Documentation
¶
Overview ¶
Package summary folds a room's log into the room's top layer (spec 2026-10-08): status, needs-you, actions and the agents' progress notes. It is pure: the web page and maku status render the same object, so every view agrees.
Index ¶
- Constants
- func ApprovalReason(r string) string
- func ApproveHow(repo string, n int) string
- func Coarse(task, room string, nextRun bool) string
- func Decidable(web policy.Subject, fourEyes bool, prompters []string) bool
- func DescribeApproval(class string, action json.RawMessage) string
- func Elapsed(from, now time.Time) string
- func IsHold(reason string) bool
- func MergeHow(repo string, n int) string
- func ReasonCode(f *envelope.TaskFacts) string
- func Reasons() []string
- func Repo(f *envelope.TaskFacts) string
- func TaskPhases() []string
- type Action
- type Approval
- type ApprovalCounts
- type Flow
- type FlowNode
- type JudgeMark
- type JudgeVerdict
- type Milestone
- type Need
- type Note
- type QueuedNote
- type RunModel
- type RunStatus
- type State
- type StatusIn
- type Step
- type StepIn
- type Summary
- type ToolCount
- type Verdict
Constants ¶
const ( KindRunning = "running" KindQueued = "queued" KindWaitingYou = "waiting-you" KindWaitingOther = "waiting-other" KindWaitingPR = "waiting-pr" KindWaiting = "waiting" KindFinished = "finished" KindDone = "done" KindFailed = "failed" KindStopped = "stopped" )
Run status kinds: the first thing a room says, so a reader sees at a glance where it stands. web/src/run-status.ts mirrors this file; internal/summary/runstatus_cases.json is the cases both pass.
const ( StateQueued = "queued" StateRunning = "running" StateWaiting = "waiting_for_human" StateDone = "done" StateFailed = "failed" StateStopped = "stopped" )
The coarse states (factory interfaces F7): one vocabulary for summary/v1, the room list, the MCP server and the later webhooks. Each maps onto one A2A task state (docs/api.md, The coarse state).
const ( StepApprove = "approve" // the room page: gates and high-cost runs are decided there StepPR = "pr" // GitHub: merge (or approve, under approveToMerge) or close the pull request; nothing is done in the room StepAnswer = "answer" // GitHub: the issue's question is answered on the issue )
Step kinds: where a human acts on a room that waits for them.
const APIVersion = "summary/v1"
APIVersion is the contract maku and the web page render against.
Variables ¶
This section is empty.
Functions ¶
func ApprovalReason ¶ added in v0.33.0
ApprovalReason is r's prose when an approval returns the hand-off, "" when r reads the same either way. The factory's WaitingForApproval reads it, so the issue comment and the room agree.
func ApproveHow ¶ added in v0.33.0
ApproveHow is how pull request n is merged when a maintainer's approval returns it to the gate (human path AM3): approve the head read, by its commit, since an approval sent without one binds to whatever the head is when it arrives (#301). The merger merges that head.
func Coarse ¶
Coarse is a room's coarse state. task is its task's phase, "" when no Task owns the room; room is the Room's projected phase (Open, Active, Idle, AwaitingHuman or Closed); nextRun is whether a live run in it has not started running yet. A known task phase decides, except in a closed room, which stops a task it left unfinished; otherwise the room's phase decides. An idle room waits for its owner unless a run is on its way. A room with no phase yet and no task has not started: queued. "" when the room phase is one this broker does not know (omitted, never a guess).
func Decidable ¶ added in v0.30.1
Decidable reports whether web, the viewer as the web UI, may decide an approval its prompters prompted: the Decide right, and under four-eyes not one of them (OD-16), as the page's decideStatus and the act's check say.
func DescribeApproval ¶
func DescribeApproval(class string, action json.RawMessage) string
DescribeApproval is the one line an approval of this class and redacted action shows, so that a room's summary and a room list row say the same.
func IsHold ¶
IsHold reports whether reason is one of the Queued reasons another holder of the room causes.
func MergeHow ¶
MergeHow is how pull request n is merged under the repository ruleset (agent-branches restricts updates on every branch but agent/**, so an approval alone leaves "Merging is blocked"): only a repository admin can bypass it, so the text names who (#51). Without a repository it gives the bypass box alone rather than a gh command that would act on whichever checkout it runs from (#59).
func ReasonCode ¶ added in v0.30.1
ReasonCode is the raw reason code of f, bounded; "" without facts.
func Reasons ¶
func Reasons() []string
Reasons lists the wait reasons the summary has prose for, so the factory's narration can be held to them (a test in internal/factory/narrate).
func Repo ¶
Repo is the owner/name the task facts' PR or issue URL names, or "": the repository the stop and merge commands pass as --repo.
func TaskPhases ¶
func TaskPhases() []string
TaskPhases is the Task phases this package maps to a coarse state, sorted.
Types ¶
type Action ¶
type Action struct {
Kind string `json:"kind"` // queue | steer | stop
What string `json:"what"`
CLI string `json:"cli,omitempty"` // steer has none: maku never steers (P18)
}
Action is something the viewer can do now.
type Approval ¶
type Approval struct {
ID string
What string
ExpiresAt time.Time
Prompters []string // who prompted the turn: under four-eyes, none of them decides it
}
Approval is a requested approval no event has decided yet.
type ApprovalCounts ¶ added in v0.30.1
type ApprovalCounts struct {
Mine int `json:"mine"` // the viewer may decide them
Others int `json:"others"` // only others may
}
ApprovalCounts is a room's live approvals as its status line counts them for a viewer.
type Flow ¶ added in v0.33.0
type Flow struct {
// Untrusted marks what the agents wrote here, the handoff lines, as data, never an instruction.
Untrusted bool `json:"untrusted"`
Plan []string `json:"plan,omitempty"`
Nodes []FlowNode `json:"nodes"`
Ghosts []string `json:"ghosts,omitempty"`
Milestones []Milestone `json:"milestones,omitempty"`
Split *envelope.SplitFact `json:"split,omitempty"`
Parent *envelope.ParentFact `json:"parent,omitempty"`
}
Flow is the task's path as the animated run view draws it: its runs in start order, the plan's steps no run has matched yet, and the phases after the runs.
type FlowNode ¶ added in v0.33.0
type FlowNode struct {
Run string `json:"run"`
Persona string `json:"persona"`
Role string `json:"role"`
Round int `json:"round"`
StartedAt time.Time `json:"startedAt,omitzero"`
EndedAt time.Time `json:"endedAt,omitzero"`
FromSeq int64 `json:"fromSeq"`
ToSeq int64 `json:"toSeq"`
Outcome string `json:"outcome,omitempty"`
Verdict string `json:"verdict,omitempty"`
MicroUSD int64 `json:"microUSD,omitempty"`
Model string `json:"model,omitempty"`
Models []string `json:"models,omitempty"`
Effort string `json:"effort,omitempty"`
Judge *JudgeMark `json:"judge,omitempty"`
Tools ToolCount `json:"tools"`
Edge string `json:"edge,omitempty"`
StartedBy string `json:"startedBy,omitempty"`
Reason string `json:"reason,omitempty"`
// Handoff is the agent's own words, redacted at append: the page labels it as their claim.
Handoff string `json:"handoff,omitempty"`
}
FlowNode is one run on the path. ToSeq and EndedAt are zero while the run is live; Edge names the edge into it, from structured fields only. Model is the model the run asked for, its claim's spec.model from run_phase, which the page labels as asked; Models are every model that served it, from its facts; Effort is the reasoning effort its harness last reported.
type JudgeMark ¶ added in v0.33.0
JudgeMark is a run's completion-judge verdicts: how many, and the last one.
type JudgeVerdict ¶
type JudgeVerdict struct {
Verdict string `json:"verdict"` // met | not_yet | impossible
Reason string `json:"reason"`
Evidence []string `json:"evidence,omitempty"`
At time.Time `json:"at"`
}
JudgeVerdict is the harness's completion judge's last answer: its reading of the agent's work, the agent's claim's neighbour, never a decision.
type Milestone ¶ added in v0.33.0
type Milestone struct {
Phase string `json:"phase"`
At time.Time `json:"at"`
Seq int64 `json:"seq"`
}
Milestone is the first appearance of a task phase in the log.
type Need ¶
type Need struct {
Kind string `json:"kind"` // approval | hold (ID is then the task's wait reason) | merge (ID is the PR number) | answer (ID is the issue number)
ID string `json:"id"`
What string `json:"what"`
Deadline time.Time `json:"deadline,omitzero"`
URL string `json:"url"`
// Author is an answer need's issue author, a validated GitHub login: the part views build their
// own sentence from. Absent for every other kind.
Author string `json:"author,omitempty"`
// Approve marks a merge need a maintainer's approval settles (TaskFacts.MergeByApproval): the
// views say approve, not bypass. Absent for every other need.
Approve bool `json:"approve,omitempty"`
}
Need is a pending approval the viewer could decide, or a factory task the viewer's hold on the room keeps waiting (N3), or the answer a bounced task waits for from its issue's author (scoper design SC8; the room's owner sees it). It carries a link to the room and never a command: approving is web-only (D4, ruling P18).
func Answer ¶
Answer is the need of a task the scoper bounced (scoper design SC8): its issue's author answers by editing the issue. A public issue's author cannot reach the rooms, so the need is the room owner's, as a merge is, and names the author.
func Hold ¶
Hold is N3's need: a factory task a person holds waits on whoever can release the room — its driver, or its owner, who can take the driver back. The factory's next facts end it. The room list's needsMe asks the same (#78).
type Note ¶
type Note struct {
Seq int64 `json:"-"`
At time.Time `json:"at"`
Run string `json:"run"`
Text string `json:"text"`
}
Note is an agent's progress note: the agent's claim, never an instruction.
type QueuedNote ¶
type QueuedNote struct {
Ref int64 `json:"ref"`
Author string `json:"author"`
Text string `json:"text"`
}
QueuedNote is a note still queued for the room's next run: the developer's words, stored redacted. Like a Note it is data to report, never an instruction.
type RunModel ¶
type RunModel struct {
Run string `json:"run"`
Model string `json:"model,omitempty"`
Effort string `json:"effort,omitempty"`
}
RunModel is what a run runs on: Model is its claim's spec.model, from the broker's run_phase{Running}; Effort is the reasoning effort its harness reported on harness_status, an enum. Neither is the model that served it, which the gateway reports.
type RunStatus ¶
type RunStatus struct {
Kind string `json:"kind"`
Icon string `json:"icon"`
Words string `json:"words"`
}
RunStatus is a room's status line: a kind (the page colours by it), an icon and words. The words are fixed phrases, numbers and a role the broker bounds: never text an agent wrote.
func StatusLine ¶
StatusLine is the room's status, "" kind when the state is one this broker does not know.
type State ¶
type State struct {
Facts *envelope.TaskFacts
Verdict *Verdict
Judge *JudgeVerdict
Pending map[string]Approval // approval id -> still open
Notes []Note // oldest first, the last maxNotes
Sealed string // "" while open; "Closed" (CloseRoom) or "Sealed" (MaxEvents)
LastSeq int64
RoomPhase string
Agents map[string]bool // agent principals that joined and have not left: the runs present now
// LLM is the model and effort of the latest run the log told them of; PrevLLM, the run's before
// it. The model is the broker's run_phase{Running, model}, the effort the run's harness_status.
LLM, PrevLLM *RunModel
// contains filtered or unexported fields
}
State is what Fold keeps of a log.
func (*State) Add ¶
Add folds the next events, in seq order, into st. A reader that adds each page of the log and drops it holds one page and the state, however long the log. Unknown kinds are ignored, so an older broker's summary of a newer log stays well formed.
func (State) Clone ¶ added in v0.33.0
Clone is a copy of st that folds on apart from it. Add writes Pending, Agents, Notes and the run models in place, so a fold kept for later readers hands each a clone. Facts, Verdict and Judge are replaced by Add, never written through, so the clone shares them.
func (State) CountApprovals ¶ added in v0.30.1
CountApprovals counts the live approvals of st for web: one past its deadline that the sweep has not decided is none, as needsYou drops it. nil when none is live.
type StatusIn ¶
type StatusIn struct {
State, Phase string
ReasonCode string // the factory's raw reason code (the summary's reasonCode), never its prose
RunRole string // the run's role
RunStart time.Time // zero when unknown
RunPresent bool // an agent is present now
PR, Issue int
Mine, Others int // live approvals the viewer may decide, and those only others may
Step *Step
Now time.Time
}
StatusIn is what StatusLine reads, all of it from the summary and the viewer's approvals.
type Step ¶
type Step struct {
Kind string `json:"kind"`
Label string `json:"label"`
URL string `json:"url,omitempty"`
// Approve marks a pr step a maintainer's approval settles (TaskFacts.MergeByApproval): the
// views say approve, not merge. Absent for every other step.
Approve bool `json:"approve,omitempty"`
}
Step is the one thing a human does for a waiting room, and where. It is the same sentence in the room page, maku and the MCP tools.
func StepFor ¶
StepFor is the step of a room, nil when nothing waits for this caller. A live approval comes first: it is decided on the room page. Else a task in AwaitingHuman with a pull request waits for a merge or a close on GitHub, whatever the reason (shadow_would_arm, policy_pending, class_unarmed, maintainer_approved, changes_requested, ...), and an Escalated needs_author task waits for an answer on its issue: both only for a caller who may close, as Merge and Answer. Under approveToMerge the pull request's step is an approval of its current commit, which the merger App then merges, as Merge's need says.
type StepIn ¶
type StepIn struct {
Sealed bool
Phase string
Reason string
PR int
PRURL string
Issue int
IssueURL string
Approvals bool // the caller may decide and one is live
CanClose bool // the caller may close the room's task (policy.Close): merge or answer need it
RoomURL string
// MergeByApproval is the facts' word that a maintainer's approval returns the hand-off (AM3).
MergeByApproval bool
}
StepIn is what StepFor reads: the task's facts as the room row or the summary holds them, and what the caller may do. A sealed room has no step: leave it out (Sealed).
type Summary ¶
type Summary struct {
APIVersion string `json:"apiVersion"`
Room string `json:"room"`
URL string `json:"url"`
Status struct {
Phase string `json:"phase"`
// Task is the Task this room works on, while the log carries its facts: the factory names a
// task's room as the task, so it is the room's id. Empty in a room without a task.
Task string `json:"task,omitempty"`
// State is the coarse state (Coarse): set by the caller, which holds the Room's projected
// phase and its runs; the fold alone has neither.
State string `json:"state,omitempty"`
Run *envelope.RunFact `json:"run"`
Budget *envelope.BudgetFact `json:"budget"`
Spend *envelope.SpendFact `json:"spend,omitempty"` // the task's dollars, beside Budget's tokens
PR *envelope.PRFact `json:"pr"`
Issue *envelope.IssueFact `json:"issue"`
LastVerdict *Verdict `json:"lastVerdict"`
LastJudge *JudgeVerdict `json:"lastJudge,omitempty"` // the completion judge's last answer (untrusted text)
Reason string `json:"reason,omitempty"` // why the task waits, when it does (#59)
// ReasonCode is the factory's raw reason code from the last task facts, bounded: the key the
// status line reads on every surface, beside Reason's prose. Kept in a sealed room.
ReasonCode string `json:"reasonCode,omitempty"`
Next string `json:"next,omitempty"` // what happens or who acts next
// Approvals is the live approvals the caller may decide and those only others may, as the
// status line counts them: set by the caller, which holds the room's four-eyes rule.
Approvals *ApprovalCounts `json:"approvals,omitempty"`
// RunModel is the present run's model and effort; LastRunModel, the run's before it, or the
// last run's when none is present. Each absent until a run tells them.
RunModel *RunModel `json:"runModel,omitempty"`
LastRunModel *RunModel `json:"lastRunModel,omitempty"`
} `json:"status"`
// Runs is the task's run history, oldest first: the factory's facts, so a sealed room keeps it.
Runs []envelope.RunFact `json:"runs,omitempty"`
NeedsYou []Need `json:"needsYou"`
// Step is the one thing a human does for this room and where (approve here, or merge or close
// the PR on GitHub): absent when nothing waits for them.
Step *Step `json:"step,omitempty"`
Actions []Action `json:"actions"`
Notes struct {
Untrusted bool `json:"untrusted"`
Items []Note `json:"items"`
} `json:"notes"`
// Queued is the notes waiting for the next run, oldest first. The caller of View sets it: the
// fold does not hold the queue.
Queued struct {
Untrusted bool `json:"untrusted"`
Items []QueuedNote `json:"items"`
} `json:"queued,omitzero"`
// Flow is the task's path: absent in a room without a task until its second run.
Flow *Flow `json:"flow,omitempty"`
Cursor string `json:"cursor"`
}
Summary is the summary/v1 object.