Documentation
¶
Index ¶
- func BreakStaleLock(lockDir, staleOwner string) (string, error)
- func CheckRosterEntry(c *Config, entry RosterEntry) error
- func DefaultOrcaCli() string
- func PutRosterEntry(path string, entry RosterEntry) (string, error)
- type Config
- type CursorResult
- type GraphQLServer
- type OrcaRunner
- type RegisterRow
- type RosterEntry
- type RouterError
- type RunResult
- type Terminal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BreakStaleLock ¶
BreakStaleLock is breakStaleLock for a lock judged stale by its owner record staleOwner: "retry" (broken, or already gone — take it) or "busy" (another run took it under the stale judgement — stand down). The rename protocol never fails outright, so err is always nil; it is in the signature for the callers that treat a lock break as fallible.
func CheckRosterEntry ¶
func CheckRosterEntry(c *Config, entry RosterEntry) error
CheckRosterEntry performs the same identity checks used under the writer lock.
func DefaultOrcaCli ¶
func DefaultOrcaCli() string
DefaultOrcaCli is Orca's bundled CLI on macOS; elsewhere `orca` on PATH.
func PutRosterEntry ¶
func PutRosterEntry(path string, entry RosterEntry) (string, error)
PutRosterEntry preserves unknown config fields and refuses a reassignment. The caller holds its onboarding lock for the complete operation sequence; the router writer lock additionally excludes an in-flight delivery here.
Types ¶
type Config ¶
type Config struct {
// Fingerprint identifies the exact bytes loaded, without exposing state tokens.
Fingerprint string `json:"-"`
App string `json:"app"`
Channel string `json:"channel"`
OrcaCli string `json:"orcaCli"`
StateDir string `json:"stateDir"`
Roster []RosterEntry `json:"roster"`
// BusyWaitMS is the idle gate's tui-idle wait (default 60 s).
BusyWaitMS int `json:"busyWaitMs"`
// SubmitWaitS is `orca terminal send --wait-submit` (default 15 s).
SubmitWaitS int `json:"submitWaitS"`
// CoordinatorWatchMin is the #1826 liveness rule's N: minutes of
// continuous idle a flagged worker must exceed (strictly) before its
// liveness nudge may fire. Positive and finite; default 20.
CoordinatorWatchMin float64 `json:"coordinatorWatchMinutes"`
}
Config is the router's host-local configuration. Its JSON keys are router.ts's, so an existing ~/.config/hadron-orca-attention-router config loads unchanged (cli#829: config migrates). `hadronCli` is accepted and ignored: this port speaks GraphQL natively.
func LoadConfig ¶
LoadConfig reads and validates the router config. Validation is strict where a permissive read once passed a typo silently: roster entries need worker, name and worktree; the watch flags are JSON booleans; a pin is a non-empty string; no worker, pin or worktree appears twice; numbers are JSON numbers.
type CursorResult ¶
CursorResult is a worker's channelReadState (#1826). FieldErrs carries GraphQL errors that arrived WITH data: an integer alongside errors is not a verdict (#1829 P1-1).
type GraphQLServer ¶
type GraphQLServer struct {
// contains filtered or unexported fields
}
GraphQLServer is the router's typed reads (internal/api/queries/ teamrouter.graphql) on the operator's login. Every method is a read. The router that polled attention through it is retired (cli#935); RegisterRow still serves `team worker onboard`.
func NewGraphQLServer ¶
func NewGraphQLServer(client graphql.Client, app, channel string) *GraphQLServer
NewGraphQLServer reads app's state for the team Channel channel (an id).
func (*GraphQLServer) ChannelHead ¶
ChannelHead is the Channel's watermark.
func (*GraphQLServer) ReadCursor ¶
func (s *GraphQLServer) ReadCursor(ctx context.Context, workerID string) (CursorResult, error)
ReadCursor is the worker's read cursor on the team Channel. Any GraphQL error — including errors that arrive WITH data — is an error here, so the router reads it as unknown (#1829 P1-1).
func (*GraphQLServer) RegisterRow ¶
func (s *GraphQLServer) RegisterRow(ctx context.Context, workerID string) (RegisterRow, error)
RegisterRow is the worker's winning register row on the team Channel, or the zero row (which never counts as mention-only) when it has none there.
type OrcaRunner ¶
OrcaRunner execs the `orca` CLI. argv starts at the verb ("terminal", "list", …): the binary is the runner's business, so a fake never sees it.
func ExecOrca ¶
func ExecOrca(bin string) OrcaRunner
ExecOrca is the production runner: it execs bin with argv and never errors on a non-zero exit — the envelope (or its absence) is the verdict.
type RegisterRow ¶
type RegisterRow struct {
NamedBy string `json:"namedBy"`
ChannelID string `json:"channel"`
MentionOnly bool `json:"mentionOnly"`
OwnerType string `json:"ownerType,omitempty"`
}
RegisterRow is the WINNING attendeeRegister row for the team Channel (App over organization; Worker over Agent over everyone).
type RosterEntry ¶
type RosterEntry struct {
// Worker is the Worker's permanent id.
Worker string `json:"worker"`
Name string `json:"name"`
// Worktree is the Orca worktree this worker is driven in.
Worktree string `json:"worktree"`
// Terminal (#1845) pins the handle of this worker's MAIN terminal. A pin
// resolves FIRST, but only ever to a terminal IN this row's worktree,
// connected and writable — a stale pin falls through with its reason.
Terminal string `json:"terminal,omitempty"`
// Coordinator / Lifecycle (#1826) opt the row into the liveness rule:
// a watch a passive wait can strand.
Coordinator bool `json:"coordinator,omitempty"`
Lifecycle bool `json:"lifecycle,omitempty"`
}
RosterEntry names one worker this router may wake.
type RouterError ¶
type RouterError struct {
Reason string
}
RouterError is a config or roster failure, reported with its reason.
func (*RouterError) Error ¶
func (e *RouterError) Error() string
type Terminal ¶
type Terminal struct {
Handle string `json:"handle"`
WorktreePath string `json:"worktreePath"`
AgentIdentity *string `json:"agentIdentity"`
Connected bool `json:"connected"`
Writable bool `json:"writable"`
LastOutputAt *int64 `json:"lastOutputAt"` // nil = untracked (#7398)
}
Terminal is one `orca terminal list` row.
func (*Terminal) UnmarshalJSON ¶
UnmarshalJSON reads Orca's row with router.ts's defaults: connected and writable count unless explicitly false, and ANY non-null lastOutputAt is tracking (only null means it was lost).