catalogue's working set starts empty and a host gives it the seats it read (UseSeats over SeatsFromDefinitions); the node-engine's verbs and events take the seat's name from the caller. Tests take their seats from seatlisttest. Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
43 lines
1.6 KiB
Go
43 lines
1.6 KiB
Go
package catalogue
|
|
|
|
// HotkeysSeat is the machine's hotkey daemon (novox/hq ADR 0212 §5).
|
|
const HotkeysSeat = "node-hotkeys"
|
|
|
|
// MessageBusSeat is the machine's D-Bus (novox/hq ADR 0215).
|
|
const MessageBusSeat = "node-message-bus"
|
|
|
|
// BackupSeat is the machine's backups (novox/hq ADR 0214, to-be 43).
|
|
const BackupSeat = "node-backup"
|
|
|
|
// 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
|
|
}
|