Files
mesh-contracts/go/seats/operatorchannel/contract.go
T
jschoubben 96b7eeeaf7 SD-M2b: mesh-broker's events on the shared events stream, 7 days
The lead's ruling of 13:0x replaces 12:5x's said-subject: mesh-broker's events follow every seat, on
mesh.seat.mesh-broker.event.<event> in the shared events stream, 7 days; the bus module keeps a longer history on a
stream of its own module. So every seat family is that stream filtered to the seat's subjects: a definition says 7
days and no cap of its own, and the reader refuses anything else.

Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
2026-11-04 12:53:19 +01:00

309 lines
8.6 KiB
Go

// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// Package operatorchannel is the contract of the seat "operator-channel", defined whole (seats/operator-channel/seat.json): Asking a person and answering on a channel (ADR 0259): held by the router, the messenger module, whose manifest declares the seat; written from that seat entry (design 26).
package operatorchannel
// Seat is the seat's name.
const Seat = "operator-channel"
const (
VerbOpen = "open"
VerbHistory = "history"
VerbNotify = "notify"
VerbTell = "tell"
VerbAsks = "asks"
)
const (
AcceptAsk = "ask"
AcceptCancel = "cancel"
AcceptCondition = "condition"
)
const (
EventDecided = "decided"
)
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
func Verbs() []string {
return []string{VerbOpen, VerbHistory, VerbNotify, VerbTell, VerbAsks}
}
// Events is every event published on the seat's subject: a new copy each call.
func Events() []string {
return []string{EventDecided}
}
// Family is where the seat's events are kept: the shared events stream, filtered to the seat's subjects.
const (
Family = "operator-channel.decided"
FamilyMaxAgeDays = 7
)
// SubjectDecided is where decided is published for one caller.
func SubjectDecided(caller string) string {
return "mesh.seat.operator-channel.event.decided." + caller
}
// AcceptSubjectAsk is where one caller sends ask.
func AcceptSubjectAsk(caller string) string { return "mesh.seat.operator-channel.accept.ask." + caller }
// AcceptSubjectCancel is where one caller sends cancel.
func AcceptSubjectCancel(caller string) string {
return "mesh.seat.operator-channel.accept.cancel." + caller
}
// AcceptSubjectCondition is where one caller sends condition.
func AcceptSubjectCondition(caller string) string {
return "mesh.seat.operator-channel.accept.condition." + caller
}
// The holder's own events, listed beside the seat and published under the holder's subjects (ADR 0620 §2).
const (
HolderEventRefused = "refused"
HolderEventOffered = "offered"
HolderEventClosed = "closed"
)
// HolderSubjectRefused is where the holder publishes refused.
func HolderSubjectRefused(holder string) string { return "mesh.mod." + holder + ".event.refused" }
// HolderSubjectOffered is where the holder publishes offered, kept in the router's restricted stream (design 55 § 11).
func HolderSubjectOffered(holder string) string { return "mesh.mod." + holder + ".event.offered" }
// HolderSubjectClosed is where the holder publishes closed, kept in the router's restricted stream (design 55 § 11).
func HolderSubjectClosed(holder string) string { return "mesh.mod." + holder + ".event.closed" }
const (
RecordAsks = "asks"
)
// Ask is a type of the contract.
type Ask struct {
// what it is about: a newer ask about it replaces the older
About string `json:"about,omitempty"`
// its secondary words
Details string `json:"details,omitempty"`
// when it ends unanswered, RFC 3339
Expires string `json:"expires"`
// what happened and what it means
Explanation string `json:"explanation"`
// a few plain words
Headline string `json:"headline"`
// the asker's own id
ID string `json:"id"`
// what the asker then does
OnExpiry string `json:"on-expiry"`
// the answers it offers
Options []Option `json:"options"`
// urgent
Urgent bool `json:"urgent,omitempty"`
// who may answer: operator
Who string `json:"who"`
// the explanation with its values whole
Whole string `json:"whole,omitempty"`
// the details whole
WholeDetails string `json:"whole-details,omitempty"`
}
// ConditionActionsItem is a type of the contract.
type ConditionActionsItem struct {
Arguments map[string]string `json:"arguments,omitempty"`
// label
Label string `json:"label"`
// level
Level string `json:"level,omitempty"`
// machine
Machine string `json:"machine,omitempty"`
// verb
Verb string `json:"verb"`
}
// ConditionSubject is a type of the contract.
type ConditionSubject struct {
// id
ID string `json:"id"`
// machine
Machine string `json:"machine,omitempty"`
// scope
Scope string `json:"scope"`
}
// Condition is a type of the contract.
type Condition struct {
// the answers it offers
Actions []ConditionActionsItem `json:"actions,omitempty"`
// plain words
Explanation string `json:"explanation,omitempty"`
// plain words
Headline string `json:"headline,omitempty"`
// the condition's key
Key string `json:"key"`
// what it needs
Needs string `json:"needs,omitempty"`
// the line said when it is over
Resolved string `json:"resolved,omitempty"`
// urgent or warning
Severity string `json:"severity,omitempty"`
// raised or cleared
State string `json:"state"`
Subject ConditionSubject `json:"subject"`
// one line
Summary string `json:"summary,omitempty"`
// the form's version, 1
V int64 `json:"v"`
}
// Option is a type of the contract.
type Option struct {
// the digest of exactly what the asker performs when it is chosen
Binds string `json:"binds,omitempty"`
// what it does, in plain words
Does string `json:"does"`
// the option's id
ID string `json:"id"`
// the button's label
Label string `json:"label"`
// the proof its answer needs
Level string `json:"level"`
}
// Person is a type of the contract.
type Person struct {
// the name shown
Display string `json:"display,omitempty"`
// the account
Identity string `json:"identity"`
// the channel kind
Kind string `json:"kind"`
// how the router knew
Verified string `json:"verified"`
// the role
Who string `json:"who"`
}
// Warrant is a type of the contract.
type Warrant struct {
// what it was about
About string `json:"about,omitempty"`
// the ask
Ask string `json:"ask"`
// the digest of the ask as the router took it
AskDigest string `json:"ask-digest,omitempty"`
// its asker
Asker string `json:"asker"`
// when, RFC 3339
At string `json:"at"`
By *Person `json:"by,omitempty"`
// the module it came through
Channel string `json:"channel,omitempty"`
// its label
Label string `json:"label,omitempty"`
// its level
Level string `json:"level,omitempty"`
// the option chosen
Option string `json:"option,omitempty"`
Outcome string `json:"outcome"`
// the proofs present
Proofs []string `json:"proofs,omitempty"`
// why it ended without a choice, or what refused it
Words string `json:"words,omitempty"`
}
// OpenInput is what open takes.
type OpenInput struct {
}
// OpenAnswer is what open answers.
type OpenAnswer = map[string]any
// HistoryInput is what history takes.
type HistoryInput struct {
// at most this many of each (default 50)
Limit int64 `json:"limit,omitempty"`
}
// HistoryAnswer is what history answers.
type HistoryAnswer = map[string]any
// NotifyInput is what notify takes.
type NotifyInput struct {
// it is over
Clear bool `json:"clear,omitempty"`
// one or two plain sentences
Explanation string `json:"explanation,omitempty"`
// plain words
Headline string `json:"headline,omitempty"`
// the message's key
Key string `json:"key,omitempty"`
// the line said when it is over
Resolved string `json:"resolved,omitempty"`
Severity string `json:"severity,omitempty"`
// what it is about
Subject string `json:"subject,omitempty"`
// one line
Summary string `json:"summary,omitempty"`
}
// NotifyAnswer is what notify answers.
type NotifyAnswer = map[string]any
// TellInput is what tell takes.
type TellInput struct {
// plain words
Headline string `json:"headline,omitempty"`
// one or two plain lines
Lines []string `json:"lines,omitempty"`
// what it is about
Subject string `json:"subject,omitempty"`
}
// TellAnswer is what tell answers.
type TellAnswer = map[string]any
// AsksInput is what asks takes.
type AsksInput struct {
}
// AsksAnswer is what asks answers.
type AsksAnswer = map[string]any
// AskAccept is the body of ask.
type AskAccept = Ask
// CancelAccept is the body of cancel.
type CancelAccept struct {
// the ask's id
ID string `json:"id"`
}
// ConditionAccept is the body of condition.
type ConditionAccept = Condition
// DecidedEvent is the body of the event decided.
type DecidedEvent = Warrant
// OfferedHolderEvent is the body of the holder's event offered.
type OfferedHolderEvent struct {
// its asker
Asker string `json:"asker"`
// the channels it was offered on
Channels []string `json:"channels,omitempty"`
// its headline
Headline string `json:"headline,omitempty"`
// the ask's id
ID string `json:"id"`
}
// ClosedHolderEvent is the body of the holder's event closed.
type ClosedHolderEvent struct {
// its asker
Asker string `json:"asker"`
How string `json:"how"`
// the ask's id
ID string `json:"id"`
}
// AsksRecord is one value of the record asks.
type AsksRecord = map[string]any