Documentation
¶
Overview ¶
Package envelope is the C4 event envelope, frozen at v1 (programme C4). SP2 owns it.
Index ¶
- Constants
- Variables
- func Clip(list []string) ([]string, bool)
- func Control(r rune) bool
- func GitHubURL(s string) bool
- func IntegrationStates() []string
- func LoopEnd(reason string) bool
- func MonitorVerdicts() []string
- func Must(v any) json.RawMessage
- func Oversize(t Type, n int) json.RawMessage
- func StatePayload(kind string, fields map[string]any) json.RawMessage
- func TaskStatePayload(f TaskFacts) json.RawMessage
- func ValidBranch(s string) bool
- func ValidClassName(s string) bool
- func ValidCommit(s string) bool
- func ValidEffort(s string) bool
- func ValidID(s string) bool
- func ValidLogin(s string) bool
- func ValidModel(s string) bool
- func ValidPersona(s string) bool
- type Acceptance
- type Actor
- type ActorKind
- type ApprovalDecidedPayload
- type ApprovalRequestedPayload
- type BudgetFact
- type Delivery
- type Draft
- type DriverPayload
- type Event
- type HandoffPayload
- type IntegrationResult
- type IssueFact
- type MessageKind
- type MessagePayload
- type Origin
- type OutputRecord
- type PRFact
- type ParentFact
- type PartFact
- type ParticipantPayload
- type PolicyClass
- type PolicyConditions
- type PolicyFact
- type ProvenanceFact
- type RunFact
- type Scope
- type SpendFact
- type Split
- type SplitFact
- type TaskFacts
- type ToolCallPayload
- type ToolResultPayload
- type TurnPayload
- type Type
Constants ¶
const ( Version = 1 MaxPayload = 64 << 10 // C4 MaxToolOutput = 16 << 10 // SP2 §4 MaxHumanMessage = 16 << 10 // SP2 §4 )
Envelope version and the size limits the broker enforces.
const ( EndJudgeImpossible = "judge_impossible" EndStalled = "stalled" EndNotMet = "not_met" )
The loop policy's end reasons, as agent-run sends them on its final read (harness R13).
const ( IntegrationPending = "pending" IntegrationPassed = "passed" IntegrationFailed = "failed" )
The integration states, as the Task CRD's status.result enumerates them. A run reports only a terminal one.
const ( OutcomeSucceeded = "succeeded" OutcomeFailed = "failed" OutcomeBudgetExhausted = "budget_exhausted" OutcomeRevoked = "revoked" OutcomeLost = "lost" OutcomeEnded = "ended" )
A run's outcome, once it has ended. An empty Outcome is a run that has not.
const ( ApprovalOlderCommit = "older_commit" ApprovalBeforeRunsEnded = "before_runs_ended" )
Why a shown approval is stale (PRFact.ApprovalStale): it is of an older commit than the head, or of the head but submitted before the task's last pushing run ended, so before that push landed.
const ( PolicyLive = "live" PolicyShadow = "shadow" PolicyUnarmed = "unarmed" )
The modes of a merge class, the gate's three outcomes: live arms once its conditions hold, shadow is decided like live and never armed, unarmed is never merged by the factory.
const ( MaxPolicyClasses = 16 MaxPolicyList = 8 MaxPolicyEntry = 120 )
The policy fact's bounds: the facts ride one bounded POST, which the broker refuses for good when they fail validation, so the factory clamps to these (Clip) and says so in Truncated.
const ( ScopeReady = "ready" ScopeQuestion = "question" )
The scope's states (scoper design SC6, SC7): ready, the implementer can start; question, the task waits for its issue's author.
const ( MinChildren = 2 MaxChildren = 5 MaxSplitBytes = 21 << 10 )
A split's bounds (splitter design SL2, "The split"): 2 to 5 parts, 21 KiB in all, well under the broker's 64 KiB event beside the scope and the summary.
const EndBudgetCalls = "budget_calls"
EndBudgetCalls is the harness's end of a scoper run stopped at its tool-call limit before any handoff (harness roles HR2). The factory fails it open, as a missing scope.
const HarnessEnd = "harness_end"
HarnessEnd is the state_changed kind a bridge records when agent-run reports why the loop policy, or the scoper's tool-call limit, ended its run (loops design, "How a run ends"): {"kind":"harness_end","reason":…}.
const HarnessStatus = "harness_status"
HarnessStatus is the state_changed kind a bridge records for a change of its harness's execution_status: {"kind":"harness_status","status","previous"}, plus effort once the harness has told it.
const MaxMicroUSD int64 = 1_000_000_000_000
MaxMicroUSD bounds every dollar amount in the facts ($1,000,000), so sums of them cannot overflow.
const MaxPlan = 8
MaxPlan bounds TaskFacts.Plan.
const MaxProgressNote = 280
MaxProgressNote bounds a progress note, in characters.
const MaxRuns = 20
MaxRuns bounds TaskFacts.Runs.
const MaxScopeBytes = 4096
MaxScopeBytes bounds a scope as canonical JSON (SC6).
const MaxVerdict = 32
MaxVerdict bounds RunFact.Verdict, in bytes, as the Task CRD bounds RunRecord.Verdict.
const ScopeSchema = `{"type":"object","additionalProperties":false,"required":["state","task","touches","plan","acceptance"],"properties":{` +
`"state":{"enum":["ready","question"]},` +
`"task":{"type":"string","minLength":1,"maxLength":1000},` +
`"touches":{"type":"array","minItems":1,"maxItems":10,"items":{"type":"string","minLength":1,"maxLength":200}},` +
`"leave":{"type":"array","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":200}},` +
`"plan":{"type":"array","minItems":1,"maxItems":7,"items":{"type":"string","minLength":1,"maxLength":300}},` +
`"assumptions":{"type":"array","maxItems":5,"items":{"type":"string","minLength":1,"maxLength":300}},` +
`"acceptance":{"type":"array","minItems":1,"maxItems":5,"items":{"type":"object","additionalProperties":false,"required":["check","proves"],` +
`"properties":{"check":{"type":"string","minLength":1,"maxLength":300},"proves":{"type":"string","minLength":1,"maxLength":200}}}},` +
`"question":{"type":"string","maxLength":500}}}`
ScopeSchema is the scope property of room_handoff's input schema, listed to the triager only.
Variables ¶
var Efforts = []string{"none", "minimal", "low", "medium", "high", "xhigh", "max"}
Efforts are the reasoning efforts a run may report: the gateway's providers' vocabularies, merged. A closed set of seven, so a value the sandbox chose is still a bounded metric label.
var ErrScope = errors.New("scope: state ready or question; task 1-1000 bytes; touches 1-10 and leave 0-10, each 1-200; " +
"plan 1-7 and assumptions 0-5, each 1-300; acceptance 1-5 of {check 1-300, proves 1-200}; question 1-500 exactly when " +
"state is question, with at least one assumption; at most 4096 bytes as JSON")
ErrScope is every refusal of Validate: the broker returns it to the model as an argument error.
var ErrSplit = errors.New("split: why 1-500 bytes; children 2-5, in the order they merge, each a scope in state ready " +
"with no question; at most 21504 bytes as JSON; and beside it scope, in state ready: the whole task")
ErrSplit is every refusal of a split: Validate's, and a split handed off without the whole task.
var SplitSchema = `{"type":"object","additionalProperties":false,"required":["why","children"],"properties":{` + `"why":{"type":"string","minLength":1,"maxLength":500},` + `"children":{"type":"array","minItems":2,"maxItems":5,"items":` + strings.Replace(ScopeSchema, `"enum":["ready","question"]`, `"enum":["ready"]`, 1) + `}}}`
SplitSchema is the split property of room_handoff's input schema, listed to the triager only: each part is the scope's schema in state ready.
Functions ¶
func Clip ¶ added in v0.39.0
Clip is list within the policy's bounds, a copy, and whether anything was cut.
func Control ¶
Control is a control character other than tab and newline, or a Unicode format character (zero-width, bidi): the same runes steering.Validate refuses, since a scope is agent-influencing text in later implementer briefs.
func IntegrationStates ¶ added in v0.39.0
func IntegrationStates() []string
IntegrationStates are the values IntegrationResult.State may hold on the Task.
func LoopEnd ¶
LoopEnd reports whether reason is one of the harness's end reasons: the loop policy's three and the scoper's tool-call limit.
func MonitorVerdicts ¶ added in v0.33.0
func MonitorVerdicts() []string
MonitorVerdicts are the values TaskFacts.Monitor may hold.
func Must ¶
func Must(v any) json.RawMessage
Must marshals a payload struct; the structs here cannot fail to marshal.
func Oversize ¶
func Oversize(t Type, n int) json.RawMessage
Oversize is stored in place of a payload over MaxPayload (ruling P20): refusing a harness event would block the bridge's cursor forever.
func StatePayload ¶
func StatePayload(kind string, fields map[string]any) json.RawMessage
StatePayload builds a state_changed payload: {kind, …fields}.
func TaskStatePayload ¶
func TaskStatePayload(f TaskFacts) json.RawMessage
TaskStatePayload is the state_changed payload of a TaskFacts: {"kind":"task", ...facts}.
func ValidBranch ¶ added in v0.35.0
ValidBranch reports whether s is an AgentRun's branch (v1alpha1.AgentRunSpec.Branch's pattern): the one thing a forge.push approval binds (v3.x Slack push approval D5).
func ValidClassName ¶ added in v0.39.0
ValidClassName reports whether s is a class name the policy fact carries.
func ValidCommit ¶ added in v0.37.0
ValidCommit reports whether s is empty or a commit id PRFact.ApprovedCommit may carry.
func ValidLogin ¶
ValidLogin reports whether s is a GitHub login in that rule's shape: a user, or an App's "<slug>[bot]". Facts are not refused for an author outside it (legacy logins with double or trailing hyphens, Enterprise Managed Users' "name_shortcode" exist): a view that names the author in a sentence of its own checks it here, and says "the issue's author" otherwise.
func ValidModel ¶
ValidModel reports whether s is 1 to 64 letters, digits and ._:/@+- characters, starting with a letter or digit. spec.model is the claim's, never the sandbox's; this is defence in depth.
func ValidPersona ¶ added in v0.33.0
ValidPersona reports whether s is a persona name: lowercase, at most 32 characters, safe to render and to use as a CSS class suffix.
Types ¶
type Acceptance ¶
Acceptance is one check the judge reads: a command or an observation, and what it proves.
type Actor ¶
type Actor struct {
Kind ActorKind `json:"kind"`
ID string `json:"id"`
Role string `json:"role,omitempty"`
}
Actor is stamped by the broker from the authenticated credential, never taken from a client.
type ActorKind ¶
type ActorKind string
ActorKind is who acted: an agent run, a human, or the platform.
type ApprovalDecidedPayload ¶
type ApprovalDecidedPayload struct {
ApprovalID string `json:"approvalId"`
Decision string `json:"decision"` // approved | denied | expired | superseded
Reason string `json:"reason,omitempty"`
}
ApprovalDecidedPayload is an approval_decided event's payload.
type ApprovalRequestedPayload ¶
type ApprovalRequestedPayload struct {
ApprovalID string `json:"approvalId"`
CallID string `json:"callId"`
Class string `json:"class"`
// Branch is the run's branch, set by the bridge for the classes it forwards (D5): the one
// thing a forge.push approval binds. Empty for every other class and for older requests.
Branch string `json:"branch,omitempty"`
Action json.RawMessage `json:"action"` // the raw, redacted call (T3)
ExpiresAt time.Time `json:"expiresAt"`
// Prompters are the principals who prompted the turn: with four-eyes on, none of
// them may decide it. The page reads them to say who may.
Prompters []string `json:"prompters,omitempty"`
}
ApprovalRequestedPayload is an approval_requested event's payload.
type BudgetFact ¶
type BudgetFact struct {
UsedTokens int64 `json:"usedTokens"`
LimitTokens int64 `json:"limitTokens"`
}
BudgetFact is the token budget and usage of a task.
type Draft ¶
type Draft struct {
RoomID string
RunID string
Actor Actor
Type Type
CausedBy *int64
Origin Origin
OriginClient string
OriginSeq int64
Redactions []string
Payload json.RawMessage
}
Draft is everything a writer hands the store. The store stamps v, id, seq and ts. OriginClient and OriginSeq are the idempotency key: "agent:<runId>" + harnessSeq, "human:<sub>" + clientSeq, or "broker:<what>" + a fixed step number.
type DriverPayload ¶
type DriverPayload struct {
From string `json:"from"`
To string `json:"to"`
Epoch int64 `json:"epoch"`
Reason string `json:"reason"` // given | requested | taken | lease_expired
}
DriverPayload is a driver event's payload: the driver token moved.
type Event ¶
type Event struct {
V int `json:"v"`
ID string `json:"id"`
Seq int64 `json:"seq"`
RoomID string `json:"roomId"`
RunID string `json:"runId,omitempty"`
Actor Actor `json:"actor"`
Type Type `json:"type"`
CausedBy *int64 `json:"causedBy,omitempty"`
Origin Origin `json:"origin"`
TS time.Time `json:"ts"`
Redactions []string `json:"redactions"`
Payload json.RawMessage `json:"payload"`
}
Event is one durable entry of a room's log.
type HandoffPayload ¶
type HandoffPayload struct {
FromRole string `json:"fromRole"`
ToRole string `json:"toRole"`
Summary string `json:"summary"`
Commit string `json:"commit"`
Branch string `json:"branch"`
// Scope is the scoper's bounded task (scoper design SC6): a triager's handoff only.
Scope *Scope `json:"scope,omitempty"`
// Split is the scoper's second answer (splitter design SL2): a triager's handoff only, always
// beside Scope, the whole task.
Split *Split `json:"split,omitempty"`
}
HandoffPayload is a handoff event's payload: work passed between roles.
type IntegrationResult ¶ added in v0.39.0
type IntegrationResult struct {
State string `json:"state"`
Reason string `json:"reason,omitempty"`
ManifestHash string `json:"manifestHash,omitempty"`
}
IntegrationResult mirrors the Task CRD's status.result field for field: this package imports no Kubernetes types, as it mirrors TaskScope, and the reconciler asserts the two agree.
func (IntegrationResult) Validate ¶ added in v0.39.0
func (r IntegrationResult) Validate() error
Validate refuses a result that is not passed or failed with a bounded snake_case reason and the exact 64-hex manifest hash: no prose ever becomes a result.
type IssueFact ¶
type IssueFact struct {
Number int `json:"number"`
URL string `json:"url"`
Title string `json:"title,omitempty"` // bounded by the factory; the issue's author wrote it, so it is never an instruction
Author string `json:"author,omitempty"`
LabelledBy string `json:"labelledBy,omitempty"`
}
IssueFact is a GitHub issue linked to a task.
type MessageKind ¶
type MessageKind string
MessageKind distinguishes chat from SP3's reserved kinds.
const ( KindOutputRequested MessageKind = "output_requested" KindOutputApplied MessageKind = "output_applied" KindOutputRefused MessageKind = "output_refused" )
The safe-output kinds (hardening UH4): a run's request, then exactly one of the applier's answers. Output carries the record; Text is never part of it.
const ( KindChat MessageKind = "chat" KindProgress MessageKind = "progress" KindReviewVerdict MessageKind = "review_verdict" // SP3's reserved kind KindTaskState MessageKind = "task_state" // SP3's reserved kind // KindJudgeVerdict is the harness's completion judge's answer on a finished conversation: Verdict // is met, not_yet or impossible, Text its reason, Evidence the ids it cited. The judge read the // agent's work, so the text is data, never an instruction. KindJudgeVerdict MessageKind = "judge_verdict" // KindIntegrationResult is a coordination integration run's one typed outcome (v4 MR10): // Integration carries it. Only the factory reads it, and only from the broker-stamped run it // started; Text is never part of the result. KindIntegrationResult MessageKind = "integration_result" )
The message kinds.
type MessagePayload ¶
type MessagePayload struct {
Kind MessageKind `json:"kind"`
Text string `json:"text"`
To []string `json:"to,omitempty"`
Delivery Delivery `json:"delivery"`
Verdict string `json:"verdict,omitempty"` // approve | changes (review_verdict); met | not_yet | impossible (judge_verdict)
Evidence []string `json:"evidence,omitempty"` // the ids a judge_verdict cited
Commit string `json:"commit,omitempty"`
// PullRequest is the pull request a review_verdict is about (SP2 design §3).
// Additive: C4 v1's envelope is unchanged, and SP3 reads it (ruling P29).
PullRequest string `json:"pullRequest,omitempty"`
// Integration is an integration_result's outcome (v4 MR10).
Integration *IntegrationResult `json:"integration,omitempty"`
// Output is a safe-output event's record (hardening UH4).
Output *OutputRecord `json:"output,omitempty"`
}
MessagePayload is a message event's payload.
type OutputRecord ¶ added in v0.40.0
type OutputRecord struct {
ID string `json:"id"`
Type string `json:"type"`
Digest string `json:"digest"`
Bytes int `json:"bytes,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
Object string `json:"object,omitempty"`
Reason string `json:"reason,omitempty"`
}
OutputRecord is one safe-output event's record: the request's id, type and payload digest, and the GitHub object an applied output wrote or the one bounded reason a refused one got. The payload itself, for every type but push, is Payload; a push bundle is stored beside the log.
func (OutputRecord) Validate ¶ added in v0.40.0
func (r OutputRecord) Validate(k MessageKind) error
Validate holds r to its kind: an id, type and digest always; an object on github.com only when applied; a snake_case reason only when refused.
type PRFact ¶
type PRFact struct {
Number int `json:"number"`
URL string `json:"url"`
Author string `json:"author,omitempty"`
Reviewers []string `json:"reviewers,omitempty"`
// ApprovedBy, ApprovedCommit and ApprovalStale are a maintainer's approval of an AwaitingHuman
// pull request the factory shows with merge.approveToMerge off, beside the hand-off's reason,
// which stands: who, a GitHub login; the commit approved; and why it is stale, empty while it is
// current: ApprovalOlderCommit or ApprovalBeforeRunsEnded.
ApprovedBy string `json:"approvedBy,omitempty"`
ApprovedCommit string `json:"approvedCommit,omitempty"`
ApprovalStale string `json:"approvalStale,omitempty"`
}
PRFact is a GitHub pull request linked to a task.
type ParentFact ¶ added in v0.33.0
type ParentFact struct {
Room string `json:"room"`
Issue int `json:"issue"`
Index int `json:"index"`
Of int `json:"of"`
}
ParentFact points a part's room back at the task it was split from, and says which part it is.
type PartFact ¶ added in v0.33.0
type PartFact struct {
Index int `json:"index"`
Issue int `json:"issue"`
Room string `json:"room"`
Outcome string `json:"outcome,omitempty"`
}
PartFact is one part of a split: its place in the merge order (1-based), its issue and room, and how it ended, empty while it has not. Outcome is landed, dropped or reverted.
type ParticipantPayload ¶
type ParticipantPayload struct {
Principal string `json:"principal"`
Change string `json:"change"` // joined | left | role_changed
Role string `json:"role,omitempty"`
Approver bool `json:"approver,omitempty"`
}
ParticipantPayload is a participant event's payload.
type PolicyClass ¶ added in v0.39.0
type PolicyClass struct {
Name string `json:"name"`
Mode string `json:"mode"`
Adopted bool `json:"adopted,omitempty"`
}
PolicyClass is one row of the repository's class table.
type PolicyConditions ¶ added in v0.39.0
type PolicyConditions struct {
AllowedFiles []string `json:"allowedFiles,omitempty"`
ProtectedFiles []string `json:"protectedFiles,omitempty"`
ModifyOnly bool `json:"modifyOnly,omitempty"`
MaxPatchFiles int `json:"maxPatchFiles,omitempty"`
MaxModifiedLines int `json:"maxModifiedLines,omitempty"`
DiffShape string `json:"diffShape,omitempty"`
HoldoutChecks []string `json:"holdoutChecks,omitempty"`
MaxPerDay int `json:"maxPerDay,omitempty"`
AdoptLogins []string `json:"adoptLogins,omitempty"`
RequiredLabel string `json:"requiredLabel,omitempty"`
Oracle bool `json:"oracle,omitempty"`
}
PolicyConditions are a class's declared conditions, as the factory config names them.
type PolicyFact ¶ added in v0.39.0
type PolicyFact struct {
Class string `json:"class,omitempty"`
Mode string `json:"mode"`
// GateOff: no class is live or shadow on the factory, so it holds no merger and merges nothing.
GateOff bool `json:"gateOff,omitempty"`
// ApproveToMerge: a maintainer's approval of the current commit arms the merger (AM1); never
// for an adopted class.
ApproveToMerge bool `json:"approveToMerge,omitempty"`
Adopted bool `json:"adopted,omitempty"`
Conditions *PolicyConditions `json:"conditions,omitempty"`
Classes []PolicyClass `json:"classes,omitempty"`
// MergedHow is how the merger merged the pull request: class or approved, "" otherwise.
MergedHow string `json:"mergedHow,omitempty"`
Truncated bool `json:"truncated,omitempty"`
}
PolicyFact is the merge policy that governs the room's task (merge policy view D1): its class and mode, the class's declared conditions, and the repository's class table. It carries the room's own repository only, so it is visible to whoever may read the room (D2).
type ProvenanceFact ¶
type ProvenanceFact struct {
FactoryVersion string `json:"factoryVersion,omitempty"`
CompositionRevision string `json:"compositionRevision,omitempty"`
HarnessImage string `json:"harnessImage,omitempty"`
ServedModels []string `json:"servedModels,omitempty"`
}
ProvenanceFact is what a run ran on (R10): the factory build, the AgentRun CompositionRevision, the harness image digest and the models that served it. Each empty until known.
type RunFact ¶
type RunFact struct {
ID string `json:"id"`
Role string `json:"role"`
Trigger string `json:"trigger,omitempty"`
// Persona is what the run is for, set by the factory alone; Role stays what it may do.
Persona string `json:"persona,omitempty"`
StartedAt time.Time `json:"startedAt,omitzero"`
// EndedAt, Outcome, Verdict and MicroUSD are set once the run has ended.
EndedAt time.Time `json:"endedAt,omitzero"`
Outcome string `json:"outcome,omitempty"`
Verdict string `json:"verdict,omitempty"`
MicroUSD int64 `json:"microUSD,omitempty"`
// What the run ran on (R10), as far as the factory knows it yet.
Provenance *ProvenanceFact `json:"provenance,omitempty"`
}
RunFact is a run's role, trigger, and lifecycle in a task.
type Scope ¶
type Scope struct {
State string `json:"state"`
Task string `json:"task"`
Touches []string `json:"touches"`
Leave []string `json:"leave,omitempty"`
Plan []string `json:"plan"`
Assumptions []string `json:"assumptions,omitempty"`
Acceptance []Acceptance `json:"acceptance"`
Question string `json:"question,omitempty"`
}
Scope is the scoper's bounded task (SC6), carried by a triager's room_handoff. The broker validates it; the factory re-injects it into every implementer brief (SC9).
type SpendFact ¶
type SpendFact struct {
UsedMicroUSD int64 `json:"usedMicroUSD"`
LimitMicroUSD int64 `json:"limitMicroUSD,omitempty"`
}
SpendFact is the dollars a task has spent and, when it has one, its dollar limit.
type Split ¶
Split is the scoper's second answer (SL1, SL2): the task as two to five bounded tasks, in the order they merge, each a scope in state ready. It rides a triager's room_handoff beside the scope of the whole task, which /factory retry runs when a maintainer declines the split.
type SplitFact ¶ added in v0.33.0
SplitFact is a split parent's view of its parts: Of parts, between MinChildren and MaxChildren.
type TaskFacts ¶
type TaskFacts struct {
Phase string `json:"phase"`
Reason string `json:"reason,omitempty"`
Run *RunFact `json:"run,omitempty"`
Budget *BudgetFact `json:"budget,omitempty"`
// Spend is the task's dollars, beside Budget's tokens (BudgetFact is unchanged).
Spend *SpendFact `json:"spend,omitempty"`
// SpendFinal is CD23: the Spend beside it is the task's last figure — priced again after the
// settle window, and never bucketed by the facts key. False while the dollars may still move,
// and for a task whose runs the meter cannot price: no figure is claimed for those.
SpendFinal bool `json:"spendFinal,omitempty"`
// Runs is the task's run history, oldest first, at most MaxRuns.
Runs []RunFact `json:"runs,omitempty"`
Issue *IssueFact `json:"issue,omitempty"`
PR *PRFact `json:"pr,omitempty"`
// Origin is the room of the investigate task this task's issue was published from (RunLore
// agent-to-agent RA10), a C2 id; the webhook tracker repeats it on every event of the room.
Origin string `json:"origin,omitempty"`
// MergeByApproval is the gate's hand-off of an AwaitingHuman pull request (human path AM3): a
// maintainer's approval of the head returns it to the gate, which merges it. False is the
// bypass: the switch off, an adopted class, or a reason no approval returns.
MergeByApproval bool `json:"mergeByApproval,omitempty"`
// Plan is the personas the task expects to run, in order, at most MaxPlan: the factory's
// forecast, so a view can show the steps ahead.
Plan []string `json:"plan,omitempty"`
// Split is the task as a parent of parts (a maintainer accepted the scoper's split).
Split *SplitFact `json:"split,omitempty"`
// Parent is set on a part's room: the task it was split from.
Parent *ParentFact `json:"parent,omitempty"`
// Monitor is the post-merge monitor's verdict (one of MonitorVerdicts), set only for a task with
// an origin. A verdict is final once set; the webhook tracker sends it once as room.monitor_verdict.
Monitor string `json:"monitor,omitempty"`
// Policy is the merge policy that governs the task, as the factory's config declares it.
Policy *PolicyFact `json:"policy,omitempty"`
}
TaskFacts are what the factory knows about a room's task, written as state_changed{kind:task} so the room summary depends on the room log alone.
type ToolCallPayload ¶
type ToolCallPayload struct {
CallID string `json:"callId"`
Tool string `json:"tool"`
Args json.RawMessage `json:"args"`
Class string `json:"class,omitempty"`
Risk string `json:"risk,omitempty"`
DecidedBy *string `json:"decidedBy"` // policy | human | null
}
ToolCallPayload is a tool_call event's payload.
type ToolResultPayload ¶
type ToolResultPayload struct {
CallID string `json:"callId"`
Status string `json:"status"` // ok | error | rejected
Output string `json:"output"`
Truncated bool `json:"truncated"`
Bytes int `json:"bytes"`
}
ToolResultPayload is a tool_result event's payload.
type TurnPayload ¶
type TurnPayload struct {
RunID string `json:"runId"`
TurnID string `json:"turnId"`
Phase string `json:"phase"` // started | completed | cancelled | failed
}
TurnPayload is a turn event's payload.
type Type ¶
type Type string
Type is an event's kind, one of the ten C4 types.
const ( Message Type = "message" Turn Type = "turn" ToolCall Type = "tool_call" ToolResult Type = "tool_result" ApprovalRequested Type = "approval_requested" ApprovalDecided Type = "approval_decided" Participant Type = "participant" Driver Type = "driver" Handoff Type = "handoff" StateChanged Type = "state_changed" )
The ten C4 event types.