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 ApprovalLine(f *envelope.TaskFacts) string
- func ApprovalReason(r string) string
- func ApproveHow(repo string, n int) string
- func Cause(f *envelope.TaskFacts, notes []Note) (string, bool)
- 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 Fix(cause string) string
- func IsHold(reason string) bool
- func MergeHow(repo string, n int, byApproval bool) string
- func PolicyDecision(f *envelope.TaskFacts) string
- func PolicyHow(p envelope.PolicyFact) string
- func ReasonCode(f *envelope.TaskFacts) string
- func Reasons() []string
- func Repo(f *envelope.TaskFacts) string
- func TaskPhases() []string
- func Waiting(f *envelope.TaskFacts) (reason, next string)
- type Action
- type Approval
- type ApprovalCounts
- type Caller
- type CoordinationChildState
- type CoordinationEdge
- type CoordinationFlow
- type CoordinationNeeds
- type CoordinationNode
- type CoordinationOverview
- type Flow
- type FlowNode
- type GitHubStanding
- type JudgeMark
- type JudgeVerdict
- type Milestone
- type Need
- func Answer(f *envelope.TaskFacts, sub policy.Subject) (Need, bool)
- func Hold(f *envelope.TaskFacts, sub policy.Subject, url string) (Need, bool)
- func Items(in NeedsIn) []Need
- func Merge(f *envelope.TaskFacts, sub policy.Subject) (Need, bool)
- func MergeNeed(f *envelope.TaskFacts) (Need, bool)
- func Ordered(items []Need) []Need
- func QuestionNeed(f *envelope.TaskFacts) (Need, bool)
- type NeedAction
- type NeedSource
- type NeedsIn
- type Note
- type PolicyView
- type QueuedNote
- type RunModel
- type RunStatus
- type State
- type StatusIn
- type Step
- type StepIn
- type Summary
- type ToolCount
- type Verdict
Constants ¶
const ( NodeChild = "child" NodeIntegration = "integration" )
The node kinds of a coordination flow.
const ( EdgeArtifact = "artifact" EdgeIntegration = "integration" )
The edge kinds: an artifact a dependent consumes, or an integration's read of a child.
const ( IntegrationBeforeNode = "integration:beforeDependentMerge" IntegrationFinalNode = "integration:final" )
The integration nodes' ids: the read before a dependent merges, and the family's final one. Neither can collide with a child id, a C2 id without a colon.
const ( ConfirmParent = "parent" ConfirmChild = "child" )
The confirmation a node still waits for.
const ( // CauseAppPermission is the App's installation lacking the permission a call needs: gh answers 403. CauseAppPermission = "app_permission" // CauseCheckUnreadable is a check the factory waited on that never reported — a name `merge.checks` // carries that the App cannot read, or does not carry at all. CauseCheckUnreadable = "check_unreadable" // CauseCILogEgress is a CI log whose host the sandbox's egress policy does not allow. CauseCILogEgress = "ci_log_egress" )
The three failure causes a room's own log names, and the only three (fast-follow 6, CD12): a GitHub App missing a permission, a check the factory cannot read, and a CI log host outside the egress policy. They are codes, not sentences: Cause picks one from what the room already holds, and Fix is its one sentence, so a brief, a card and a hand-off comment cannot say the failure three ways.
const ( NeedPlanConfirmation = "plan_confirmation" // a scoper's proposed split, for a maintainer to accept NeedApproval = "approval" // a requested approval the caller may decide here NeedQuestion = "question" // the issue's author answers the scoper (SC8) NeedMerge = "merge" // a maintainer merges, or approves, the pull request NeedReview = "review" // the caller is one of the pull request's requested reviewers NeedFailedCheck = "failed_check" // a check the factory waited on never settled NeedRecovery = "recovery" // nothing runs on alone: a maintainer decides whether to retry NeedHold = "hold" // a person's hold on the room keeps the task Queued (N3) )
The needs/v1 kinds, in the one order every surface lists them (spec CD21). The declared order is kindRank's: a deadline first, then this order, then the room, so two surfaces cannot disagree.
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.
const GatePathRule = "A pull request that touches a gate path always needs a human merge."
GatePathRule ends every PolicyHow: gate paths are the repository's policy-bot rules, which the factory does not read, so the rule is stated rather than the paths listed (merge policy view D7).
Variables ¶
This section is empty.
Functions ¶
func ApprovalLine ¶ added in v0.37.0
ApprovalLine is the maintainer's approval the factory shows with merge.approveToMerge off (PRFact.ApprovedBy), in words: who approved which commit — a human's approval, not the agent reviewer's verdict — or why it is stale: of an older commit, or before the factory's last push ended. "" when the facts name no approver.
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 Cause ¶ added in v0.36.0
Cause is the one failure f and the room's notes name, and whether they name one (fast-follow 6): "" and false when the room holds nothing to act on, so a surface prints no fix rather than a guess. It reads what the caller already has — the facts, and the fold's notes — so it costs no read, and it never returns a note's text: only a code from the table, so an agent that writes one of the platform's sentences can at most make the room print the broker's own words.
The precedence is the room's own: the newest evidence first, and a permission before anything else. The App's 403 explains a check the App could not see, so it outranks the facts' reason; a log the sandbox could not fetch does not, because the factory's merge path never reads a job log — a wait that expired for another reason is still that reason.
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 Fix ¶ added in v0.36.0
Fix is a cause's one sentence: what to change and where, naming the file or the host a person edits. A cause this package does not know has none — "" — so a surface prints no line rather than a guess.
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). byApproval selects the approval's sentence instead (ApproveHow): the gate merges the head a maintainer approved, so no renderer can print the bypass for it (AM3, fast-follow 1). The bypass sentence is the by-hand hand-offs' alone — human_commit_in_pr above all, where the push check reads the same head the same way after any approval, so only an admin's merge takes it — and nextStep says that reason in so many words.
func PolicyDecision ¶ added in v0.39.0
PolicyDecision is the gate's word on the task (D6): how the merger merged it, else the reason of an AwaitingHuman hand-off (shadow_would_arm is the shadow decision), else "".
func PolicyHow ¶ added in v0.39.0
func PolicyHow(p envelope.PolicyFact) string
PolicyHow is what it takes to merge a pull request under p, the gate's rules in one sentence (merge policy view D5): the class's own conditions when live, a maintainer's approval through the merger App under approveToMerge, a maintainer's merge otherwise.
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.
func Waiting ¶ added in v0.35.0
Waiting is the reason and next step of a task that waits on something other than its own run; both are "" while it works or once it ended in a way that needs no one. A reason the map does not know is shown as written, bounded: it is the factory's own string, never an agent's.
It is exported because the factory's hand-off comment reads the same sentence the room's NEXT box does (narrate reads it): a maintainer who reads GitHub and the room about one hand-off must not be told two things (CD21, fast-follow 1).
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
// At is when the approval was asked: the approval_requested event's ts, so a needs/v1 item says how
// long it has waited (PR 1's ordering reads the deadline, not this).
At 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 Caller ¶ added in v0.35.0
type Caller struct {
WebUI bool // decides approvals in the browser
CanDecide bool // the policy's Decide: an approval item
CanClose bool // the policy's Close: a question, a recovery
CanRelease bool // the policy's StartRun, as summary.Hold asks it: a hold
RoomScoped bool
}
Caller is who asks, from where the action happens: the policy decides an approval, closing a room and releasing a hold; GitHub decides the rest (CD26). RoomScoped is a sponsored principal: the App reads a room's needs, never a login's, and every item's action is a link it cannot follow for anyone.
type CoordinationChildState ¶ added in v0.39.0
type CoordinationChildState struct {
ID string `json:"id"`
Phase string `json:"phase,omitempty"`
Reason string `json:"reason,omitempty"`
IssueURL string `json:"issueURL,omitempty"`
PRURL string `json:"prURL,omitempty"`
DependsOn []string `json:"dependsOn"`
}
CoordinationChildState is one visible child in a row.
type CoordinationEdge ¶ added in v0.39.0
type CoordinationEdge struct {
From string `json:"from"`
To string `json:"to"`
Kind string `json:"kind"`
Name string `json:"name,omitempty"`
State string `json:"state"`
}
CoordinationEdge is From feeding To: an artifact (Name <from>/<artifact>, State pending or landed), or an integration's read (State the attempt's, or released/stale for the exact head a passing integration released to a dependent).
type CoordinationFlow ¶ added in v0.39.0
type CoordinationFlow struct {
PlanVersion int32 `json:"planVersion"`
PlanHash string `json:"planHash"`
Nodes []CoordinationNode `json:"nodes"`
Edges []CoordinationEdge `json:"edges"`
RestrictedChildren int `json:"restrictedChildren"`
}
CoordinationFlow is the parent's plan and live progress as the room page draws it: the children and integrations, the artifacts between them, and how many children this viewer may not see.
type CoordinationNeeds ¶ added in v0.39.0
type CoordinationNeeds struct {
ParentTask string
PlanVersion int32
Primary string
Flow *CoordinationFlow
RecoveryCode string
}
CoordinationNeeds is what needs/v1 reads of a filtered family: the parent, its plan version and primary, the flow's nodes (each child's pending confirmation) and the one recovery's code.
type CoordinationNode ¶ added in v0.39.0
type CoordinationNode struct {
ID string `json:"id"`
Kind string `json:"kind"`
ChildID string `json:"childID,omitempty"`
Repository string `json:"repository,omitempty"`
Phase string `json:"phase,omitempty"`
Reason string `json:"reason,omitempty"`
Roles []string `json:"roles"`
Room string `json:"room,omitempty"`
IssueURL string `json:"issueURL,omitempty"`
PRURL string `json:"prURL,omitempty"`
Disabled bool `json:"disabled"`
RequiredConfirmation string `json:"requiredConfirmation,omitempty"`
}
CoordinationNode is a child or an integration. Disabled is a node that cannot start yet: a confirmation it waits for (RequiredConfirmation), or a dependency's artifact. Room, IssueURL and PRURL are set once the child is filed.
type CoordinationOverview ¶ added in v0.39.0
type CoordinationOverview struct {
PlanVersion int32 `json:"planVersion"`
RestrictedChildren int `json:"restrictedChildren"`
Children []CoordinationChildState `json:"children"`
RecoveryCode string `json:"recoveryCode,omitempty"`
}
CoordinationOverview is a parent's compact row in the room list.
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"`
// Coordination is a parent's family (AttachCoordination), drawn apart from Split and Parent.
Coordination *CoordinationFlow `json:"coordination,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 GitHubStanding ¶ added in v0.35.0
GitHubStanding is the caller's standing where a merge, a review and an answer happen (CD26): their login, whether they may write the room's repository, and the pull request's requested reviewers. The server resolves it once per room and hands it to every derivation, so the rows, the summary and the tools agree.
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 is one of the eight needs/v1 kinds, in the order they are listed.
Kind string `json:"kind"` // plan_confirmation | approval | question | merge | review | failed_check | recovery | hold
ID string `json:"id"`
What string `json:"what"`
Deadline time.Time `json:"deadline,omitzero"`
URL string `json:"url"`
// Room is the room the item belongs to: the list spans rooms, so an item names its own (Key).
Room string `json:"room,omitempty"`
// Issue and PR are the GitHub numbers the item acts on, 0 when it acts on neither.
Issue int `json:"issue,omitempty"`
PR int `json:"pr,omitempty"`
// Why is the factory's reason in prose (reasons()), the cause, while What is the move: a view may show
// both, and Why is never a repeat of What.
Why string `json:"why,omitempty"`
// At is when the item's cause landed: the facts' ts, or the approval's.
At time.Time `json:"at,omitzero"`
// Action is the one thing to do and where; URL above is the item's own link.
Action NeedAction `json:"action,omitzero"`
// Author is a question 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"`
// Source is where the item was derived from: for the tests, never in the object a surface renders.
Source NeedSource `json:"-"`
}
Need is one thing that needs a person, as needs/v1 derives it (CD21): identified by its room, kind and id (Key), with the one action to take and the link where it happens. It carries no command: approving is web-only (D4, ruling P18), and every other action happens on GitHub.
func Answer ¶
Answer is the need of a task the scoper bounced (scoper design SC8), for a caller who may close the room. A public issue's author cannot reach the rooms, so the need is the room owner's, as a merge is, and it names the author. QuestionNeed is its prose.
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).
func Items ¶ added in v0.35.0
Items is needs/v1 for one room as the caller sees it (CD21, CD26): the one derivation the room rows, the room summary, /api/needs, the CLI, the tools and the web panel all read. A sealed room, and a room whose state cannot be read, contribute nothing: no item's link may point at work that moved (Review Focus 2). The items are not ordered here: Ordered is the only order (CD21).
func Merge ¶
Merge is the need of a task that waits for a maintainer's merge, for a caller who may close the room: the standing-checked wrapper a room row and the summary's neighbours use. needs/v1 decides a merge on the caller's GitHub standing instead (CD26); MergeNeed is the prose both read.
func MergeNeed ¶ added in v0.35.0
MergeNeed is the merge need's prose alone: the standing is the derivation's (CD26), the sentence is the gate's. When the facts say an approval returns the hand-off, the sentence is ApproveHow's and Need.Approve is set, so no renderer can print the bypass for it (AM3, fast-follow 1).
func Ordered ¶ added in v0.35.0
Ordered sorts items as CD21 states the one order: a deadline ascending (none last), then the kind, then the room. No scoring, no routing, no expiry: two surfaces cannot disagree.
func QuestionNeed ¶ added in v0.35.0
QuestionNeed is the needs_author prose alone (SC8): the issue's author answers by editing the issue.
type NeedAction ¶ added in v0.35.0
type NeedAction struct {
Kind string `json:"kind"` // decide | comment | answer | merge | review | retry | release
Label string `json:"label"` // one sentence
URL string `json:"url,omitempty"`
}
NeedAction is a need's one thing to do, and where.
type NeedSource ¶ added in v0.35.0
type NeedSource struct {
Kind string `json:"kind"` // approval | facts | review_request | room
Seq int64 `json:"seq,omitempty"`
Reason string `json:"reason,omitempty"` // the factory's wait reason
}
NeedSource says where an item was derived from. It is for the tests, not for the reader, so it is never in the object the surfaces render.
type NeedsIn ¶ added in v0.35.0
type NeedsIn struct {
Room string
URL string // the room page
Repository string // owner/name, for the sentences and the pull request's URL
Sealed bool
FactsRead bool // false: the room's state could not be read
Facts *envelope.TaskFacts
FactsAt time.Time // the ts of the event that carried Facts
Approvals []Approval // the live approvals the caller may decide, as the fold lists them
GitHub GitHubStanding // what only the server can resolve
Caller Caller // what the policy says, and how the caller reads the room
Now time.Time
// Coordination is the room's family as this caller may read it, when the room is a coordination
// parent (coordinationview.NeedsOf); CoordinationStanding is the caller's standing in each
// visible child's repository.
Coordination *CoordinationNeeds
CoordinationStanding map[string]GitHubStanding
}
NeedsIn is one room, as the caller sees it (CD21). Sealed, and facts that cannot be read, contribute nothing.
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 PolicyView ¶ added in v0.39.0
type PolicyView struct {
envelope.PolicyFact
How string `json:"how"`
Decision string `json:"decision,omitempty"`
}
PolicyView is status.policy: the factory's policy fact, what it takes to merge under it, and the gate's decision on this task when there is one.
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
// FactsAt is the ts of the event that carried Facts: when the room last heard what its task waits on,
// which a needs/v1 item's At carries (a member's row and the room summary date an item alike).
FactsAt time.Time
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. A hand-off holding a commit no run of the task reported is the exception that keeps the by-hand merge: no approval returns that head, so the step names the repository admin's bypass and the reason it is the only path (fast-follow 1). The cases are ordered so that the reason-specific sentence wins over both the approve and the plain merge.
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
// SpendFinal is CD23: Spend is the task's last figure, priced again after the settle window
// and never bucketed by the factory's facts key. Absent while the dollars may still move, and
// for a task whose runs the meter could not price — a surface that shows the figure reads this
// first, and says "settling" or "unpriced" instead of a number it would have to change.
SpendFinal bool `json:"spendFinal,omitempty"`
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"`
// Policy is the merge policy that governs the task, absent until the factory posts one.
Policy *PolicyView `json:"policy,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"`
// Coordination is a coordination parent's view as this viewer may read it, as JSON: the caller
// attaches it (coordinationview.Attach), the fold of a log never holds one, and summary stays
// free of the factory's types.
Coordination json.RawMessage `json:"coordination,omitempty"`
Cursor string `json:"cursor"`
}
Summary is the summary/v1 object.
func View ¶
func View(st State, room, url string, sub policy.Subject, standing GitHubStanding, after int64, now time.Time) Summary
View is st as sub sees it (CD21): needs-you from the one derivation, which takes the caller's GitHub standing because a merge, a review and an answer are GitHub's to decide (CD26). The standing is the caller's where the action happens: the server resolves it once per room and passes the same one to the rows, the summary and the tools. Notes are those after `after`.