Every seat constant of mesh-sdk is mesh-contracts' generated name; the four whole seats' (BrokerSeat, CheckerSeat, asks.Seat, buscompose.VaultSeat) are marked deprecated for their importers. The package walk of mesh-sdk's own check refuses a string literal naming a defined seat or its subjects, and an exported name given to one, beyond testdata/seat-names.txt, which lists what stands before the move (module names that equal a seat's among them) and only shrinks. No new test function. Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
45 lines
1.7 KiB
Go
45 lines
1.7 KiB
Go
package catalogue
|
|
|
|
import contractseats "git.novox.be/novox/mesh-contracts/go/seats"
|
|
|
|
// HotkeysSeat is the machine's hotkey daemon (novox/hq ADR 0212 §5).
|
|
const HotkeysSeat = contractseats.NodeHotkeys
|
|
|
|
// MessageBusSeat is the machine's D-Bus (novox/hq ADR 0215).
|
|
const MessageBusSeat = contractseats.NodeMessageBus
|
|
|
|
// BackupSeat is the machine's backups (novox/hq ADR 0214, to-be 43).
|
|
const BackupSeat = contractseats.NodeBackup
|
|
|
|
// SeatContribution is one piece of configuration a module gives a seat's holder to place.
|
|
type SeatContribution struct {
|
|
// Seat is the seat whose holder places it.
|
|
Seat string `json:"seat"`
|
|
// Kind is which of the seat's receivable kinds it is.
|
|
Kind string `json:"kind"`
|
|
// Content is the text, in the tool's own grammar. Never interpreted.
|
|
Content string `json:"content,omitempty"`
|
|
// Data is the piece in the seat's own shape, for a kind the seat receives as data (novox/hq ADR
|
|
// 0255): the holder renders it with its template, and Content is then empty.
|
|
Data map[string]any `json:"data,omitempty"`
|
|
// IfCapability names a capability the machine must report for this contribution to be placed
|
|
// there (novox/hq ADR 0255): a battery's block only where the node-engine found a battery. The
|
|
// composition decides, from the machine's facts, not the tool at run time.
|
|
IfCapability string `json:"if-capability,omitempty"`
|
|
}
|
|
|
|
// receivable is what a seat receives of a kind, with the seat's canonical name; false when the seat
|
|
// is unknown or does not receive it.
|
|
func receivable(seat, kind string) (Seat, Receivable, bool) {
|
|
s, known := SeatNamed(seat)
|
|
if !known {
|
|
return Seat{}, Receivable{}, false
|
|
}
|
|
for _, r := range s.Receives {
|
|
if r.Kind == kind {
|
|
return s, r, true
|
|
}
|
|
}
|
|
return s, Receivable{}, false
|
|
}
|