summary

package
v0.30.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

View Source
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).

View Source
const (
	StepApprove = "approve" // the room page: gates and high-cost runs are decided there
	StepPR      = "pr"      // GitHub: merge 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.

View Source
const APIVersion = "summary/v1"

APIVersion is the contract maku and the web page render against.

Variables

This section is empty.

Functions

func Coarse

func Coarse(task, room string, nextRun bool) string

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

func Decidable(web policy.Subject, fourEyes bool, prompters []string) bool

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 Elapsed

func Elapsed(from, now time.Time) string

Elapsed is a duration at a glance: "<1 min", "4 min", "1 h 5 min".

func IsHold

func IsHold(reason string) bool

IsHold reports whether reason is one of the Queued reasons another holder of the room causes.

func MergeHow

func MergeHow(repo string, n int) string

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

func ReasonCode(f *envelope.TaskFacts) string

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

func Repo(f *envelope.TaskFacts) string

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 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 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"`
}

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

func Answer(f *envelope.TaskFacts, sub policy.Subject) (Need, bool)

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

func Hold(f *envelope.TaskFacts, sub policy.Subject, url string) (Need, bool)

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 Merge

func Merge(f *envelope.TaskFacts, sub policy.Subject) (Need, bool)

Merge is the need of a task that waits for a maintainer's merge: AwaitingHuman with a pull request. Whoever owns the room, the maintainer, sees it; GitHub still decides who may merge.

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

func StatusLine(in StatusIn) RunStatus

StatusLine is the room's status, "" kind when the state is one this broker does not know.

func StatusOf

func StatusOf(s Summary, now time.Time) RunStatus

StatusOf is the status of a summary, as the caller holds it: now is the clock the run's age reads.

func (RunStatus) String

func (s RunStatus) String() string

String is the line as text: "● Running — implementer, 4 min".

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
}

State is what Fold keeps of a log.

func Fold

func Fold(evs []envelope.Event) State

Fold is the state of a whole log; Add folds the same log a page at a time.

func (*State) Add

func (st *State) Add(evs []envelope.Event)

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) CountApprovals added in v0.30.1

func (st State) CountApprovals(web policy.Subject, fourEyes bool, now time.Time) *ApprovalCounts

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"`
}

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

func StepFor(in StepIn) *Step

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.

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
}

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"`
	Cursor string `json:"cursor"`
}

Summary is the summary/v1 object.

func View

func View(st State, room, url string, sub policy.Subject, after int64, now time.Time) Summary

View is st as sub sees it: needs-you and actions follow sub's standing, notes are those after `after`.

type Verdict

type Verdict struct {
	By      string    `json:"by"`
	Verdict string    `json:"verdict"`
	At      time.Time `json:"at"`
}

Verdict is the latest reviewer verdict.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL