Documentation
¶
Index ¶
- Constants
- func Approve(root, change string, options ApproveOptions) (core.ApprovalRecord, error)
- func Archive(root, change string, options ArchiveOptions) (core.ArchiveResult, error)
- func Check(root, change string) (core.CheckResult, error)
- func Complete(root, change, taskID string, expectedRevision uint64, options CompleteOptions) (core.Completion, error)
- func Context(root, change, taskID string, budgetBytes int) (contextmodel.Manifest, error)
- func Envelope(outcome Outcome) (agentjson.Envelope, error)
- func ExitCode(err error) int
- func RenderCheck(result core.CheckResult) string
- func RenderContextJSON(manifest contextmodel.Manifest) ([]byte, error)
- func RenderJSON(outcome Outcome) ([]byte, int, error)
- func RenderReportJSON(result ReportResult) ([]byte, error)
- func RenderReportText(result ReportResult) string
- func RenderStatusJSON(result StatusResult) ([]byte, error)
- func RenderStatusText(result StatusResult) string
- func RenderText(envelope agentjson.Envelope) string
- func Sync(root, change string, options SyncOptions) (core.SyncResult, error)
- type ActivityCounts
- type ApproveOptions
- type ArchiveOptions
- type CompleteOptions
- type FrictionResult
- type InitResult
- type NewResult
- type NextRefusal
- type NextResult
- type Outcome
- type ReportFact
- type ReportResult
- type Request
- type Result
- type ReviewOptions
- type ReviewResult
- type Root
- type Route
- type StartOptions
- type StartResult
- type StatusNextAction
- type StatusProduction
- type StatusResult
- type SyncOptions
- type UsageRefusal
- type VerifyOptions
- type VerifyResult
Constants ¶
const ( VerdictApprove = "approve" VerdictReject = "reject" )
The two verdicts. There is no third, and no default: an unknown verdict fails closed, and an absent one records nothing at all.
const ReviewerVariable = "SPECD_REVIEWER"
ReviewerVariable names the second human. Reviewer identity is resolved from a trusted source exactly as approval identity is; a claim that disagrees with the trusted identity is refused rather than believed.
Variables ¶
This section is empty.
Functions ¶
func Approve ¶ added in v1.1.0
func Approve(root, change string, options ApproveOptions) (core.ApprovalRecord, error)
func Archive ¶ added in v1.1.0
func Archive(root, change string, options ArchiveOptions) (core.ArchiveResult, error)
func Complete ¶ added in v1.1.0
func Complete(root, change, taskID string, expectedRevision uint64, options CompleteOptions) (core.Completion, error)
func Context ¶ added in v1.1.0
func Context(root, change, taskID string, budgetBytes int) (contextmodel.Manifest, error)
func Envelope ¶ added in v1.1.0
Envelope projects one canonical result or refusal into the agent document.
func ExitCode ¶ added in v1.1.0
ExitCode maps a dispatch outcome to its declared exit class: 0 success, 1 failure, 2 usage or fail-closed refusal.
func RenderCheck ¶ added in v1.1.0
func RenderCheck(result core.CheckResult) string
func RenderContextJSON ¶ added in v1.1.0
func RenderContextJSON(manifest contextmodel.Manifest) ([]byte, error)
func RenderJSON ¶ added in v1.1.0
RenderJSON is the one machine surface: one document and its exit code.
func RenderReportJSON ¶ added in v1.1.0
func RenderReportJSON(result ReportResult) ([]byte, error)
RenderReportJSON is the machine surface over the same values.
func RenderReportText ¶ added in v1.1.0
func RenderReportText(result ReportResult) string
RenderReportText is the human surface. It prints the same facts in the same order the JSON document carries.
func RenderStatusJSON ¶ added in v1.1.0
func RenderStatusJSON(result StatusResult) ([]byte, error)
func RenderStatusText ¶ added in v1.1.0
func RenderStatusText(result StatusResult) string
func RenderText ¶ added in v1.1.0
RenderText is the one human surface. It renders the same envelope, so the terminal cannot disagree with JSON about facts, diagnostics, exit, or the legal next action.
func Sync ¶ added in v1.1.0
func Sync(root, change string, options SyncOptions) (core.SyncResult, error)
Types ¶
type ActivityCounts ¶ added in v1.1.0
type ApproveOptions ¶ added in v1.1.0
type ArchiveOptions ¶ added in v1.1.0
ArchiveOptions carries the acting identity and the injected clock. Now is local time on purpose: the archive prefix is a local calendar date.
type CompleteOptions ¶ added in v1.1.0
type CompleteOptions struct {
Actor string
}
type FrictionResult ¶ added in v1.1.0
type FrictionResult struct {
Change string `json:"change"`
TaskID string `json:"task"`
Domain string `json:"domain"`
Operation string `json:"operation"`
Blocker string `json:"blocker"`
Consequence string `json:"consequence"`
Actor string `json:"actor"`
Revision uint64 `json:"revision"`
StateHash string `json:"state_hash"`
EvidenceSet string `json:"evidence_set"`
Eligibility []core.FrictionEligibility `json:"eligibility"`
}
FrictionResult is the canonical friction outcome: the observation that was appended and the D14 eligibility it now contributes to. Eligibility is a projection, not a grant — it reports that the root owner may decide, never that a deferred domain became available.
func Friction ¶ added in v1.1.0
func Friction(root, change string, request core.FrictionRequest) (FrictionResult, error)
Friction records one blocked-work observation through the canonical recorder and projects the resulting D14 eligibility. It adds no rule of its own: the recorder owns identity, staleness, blocked-task, and domain refusals.
type InitResult ¶ added in v1.1.0
type InitResult struct {
Root Root `json:"root"`
// Guidance is the generated agent surface installed into the project root.
// A fresh agent resumes from it, so adoption installs it rather than
// leaving the file to a route only a Go caller can reach.
Guidance string `json:"guidance"`
}
func Init ¶ added in v1.1.0
func Init(root string) (InitResult, error)
type NewResult ¶ added in v1.1.0
type NewResult struct {
Root Root `json:"root"`
state.Projection
}
type NextRefusal ¶ added in v1.1.0
func (*NextRefusal) Unwrap ¶ added in v1.1.0
func (refusal *NextRefusal) Unwrap() error
type NextResult ¶ added in v1.1.0
type NextResult struct {
Root Root `json:"root"`
Change string `json:"change"`
Revision uint64 `json:"revision"`
Frontier []string `json:"frontier"`
Selected *core.TaskReadiness `json:"selected,omitempty"`
Classification string `json:"classification"`
Blocker *core.ReadinessBlocker `json:"blocker,omitempty"`
Action string `json:"action"`
}
func Next ¶ added in v1.1.0
func Next(root, change, taskID string) (NextResult, error)
Next is a read-only view of the same frontier returned by Status. An empty task ID returns every eligible task; a non-empty ID only validates membership.
type Outcome ¶ added in v1.1.0
type Outcome struct {
Operation string
Root string
Change string
Task string
Value any
Err error
Exit int
}
Outcome is one dispatched invocation as the renderer sees it: the canonical result or its error, plus the selectors resolved before the handler ran. The renderer projects it; it decides nothing about lifecycle, evidence, or scope.
type ReportFact ¶ added in v1.1.0
ReportFact is one normalized report value, keyed by its field name. Both surfaces render this list and nothing else, so the terminal and the JSON document cannot disagree about a value or about the order it appears in.
type ReportResult ¶ added in v1.1.0
type ReportResult struct {
Root Root `json:"root"`
Change string `json:"change"`
Kind string `json:"kind"`
Facts []ReportFact `json:"facts"`
}
ReportResult is one projected report. It carries identities, counts, codes, and bounded facts only: no authored bodies, no command output, no patch text, no logs. Rendering owns no truth — every value comes from a canonical model.
func Report ¶ added in v1.1.0
func Report(root, change, kind, profile string) (ReportResult, error)
Report projects exactly one of the four canonical reports. It reads through the report owner alone: it writes nothing, transitions nothing, executes nothing, and reaches no network.
type Request ¶ added in v1.1.0
Request is one invocation. Args is the full argv beginning with the operation id; Root is the fallback root when the invocation selects none.
type Result ¶ added in v1.1.0
Result is one dispatched operation's outcome. Exit keeps the distinct exit classes the registry declares.
type ReviewOptions ¶ added in v1.1.0
type ReviewResult ¶ added in v1.1.0
type ReviewResult struct {
Change string `json:"change"`
TaskID string `json:"task"`
AttemptID string `json:"attempt"`
PolicyDigest string `json:"policy_digest"`
PacketHash string `json:"packet_hash"`
EvidenceSet string `json:"evidence_set"`
Approvable bool `json:"approvable"`
Blockers []core.ReadinessBlocker `json:"blockers"`
Verdict evidence.ReviewVerdict `json:"verdict"`
RecordID string `json:"record,omitempty"`
Findings string `json:"findings,omitempty"`
FindingsTruncated bool `json:"findings_truncated,omitempty"`
}
ReviewResult is the canonical review outcome: the bounded packet identity the verdict was taken against, the projected verdict state, and the recorded findings excerpt. It carries no packet body, no patch text, and no prose.
func Review ¶ added in v1.1.0
func Review(root, change, task, attempt string, options ReviewOptions) (ReviewResult, error)
Review projects the bounded review packet and records or reports one separate reviewer verdict. An omitted verdict writes nothing: it reports whether the current review is approved, rejected, stale, or missing.
type Route ¶ added in v1.1.0
type Route string
Route is how an invocation reached the harness. It is provenance, never proof: only a conformant host can attest that a human is at the keyboard.
type StartOptions ¶ added in v1.1.0
type StartOptions struct {
Actor string
}
type StartResult ¶ added in v1.1.0
type StartResult struct {
Change string `json:"change"`
TaskID string `json:"task"`
AttemptID string `json:"attempt"`
BaselineHEAD string `json:"baselineHead"`
RevisionBefore uint64 `json:"revisionBefore"`
RevisionAfter uint64 `json:"revisionAfter"`
DeclaredFiles []string `json:"declaredFiles"`
Assurance string `json:"assurance"`
}
func Start ¶ added in v1.1.0
func Start(root, change, taskID string, expectedRevision uint64, options StartOptions) (StartResult, error)
type StatusNextAction ¶ added in v1.1.0
type StatusProduction ¶ added in v1.1.0
type StatusProduction struct {
Profile string `json:"profile"`
PolicyDigest string `json:"policyDigest"`
Assurance string `json:"assurance"`
ReviewApprovable bool `json:"reviewApprovable"`
ReviewBlockers []core.ReadinessBlocker `json:"reviewBlockers"`
FrictionEligibility []core.FrictionEligibility `json:"frictionEligibility"`
}
StatusProduction is the stage-8 extension of canonical status: the policy the projection ran under, the assurance level the harness can honestly claim, whether the change presents a reviewable packet, and mechanical deferred-domain eligibility. Eligibility is a fact for a root owner to weigh; it authorizes no domain and unblocks no operation.
type StatusResult ¶ added in v1.1.0
type StatusResult struct {
Root Root `json:"root"`
Approval *core.ApprovalHandoff `json:"approval,omitempty"`
ApprovalStatus core.ApprovalStatus `json:"approvalStatus"`
Counts ActivityCounts `json:"counts"`
Tasks []core.TaskReadiness `json:"tasks"`
Frontier []string `json:"frontier"`
Next StatusNextAction `json:"next"`
AllTasksComplete bool `json:"allTasksComplete"`
Production StatusProduction `json:"production"`
state.Projection
}
func Status ¶ added in v1.1.0
func Status(root, change string) (StatusResult, error)
Status projects canonical status under the default policy. It loads truth once through the report owner, so status and every report read the same snapshot rather than two parsers of the same files.
type SyncOptions ¶ added in v1.1.0
SyncOptions mirrors ApproveOptions: sync is the second human gate, so it resolves identity from the same trusted sources and prompts the same way. Now is injected so the archive target a review shows is deterministic.
type UsageRefusal ¶ added in v1.1.0
UsageRefusal is a pre-handler refusal: unknown operation, unknown flag or enum, missing selector, lifecycle mismatch, or unauthorized actor. It maps to the fail-closed exit class and guarantees no handler ran.
func (*UsageRefusal) Unwrap ¶ added in v1.1.0
func (refusal *UsageRefusal) Unwrap() error
type VerifyOptions ¶ added in v1.1.0
type VerifyOptions struct {
Actor string
Timeout time.Duration
OutputLimit int
// Production options. An empty class keeps the default test-run loop, which
// runs exactly the approved task verification command.
Profile string
Class string
CheckID string
Command string
Reviewer string
ReviewPassed bool
}
type VerifyResult ¶ added in v1.1.0
type VerifyResult struct {
Evidence evidence.TestRun `json:"evidence"`
// Production carries build, lint, and review observations. It is absent for
// the default profile, whose result shape is unchanged.
Production *evidence.Production `json:"production,omitempty"`
RecordID string `json:"recordId"`
Complete bool `json:"complete"`
}
func Verify ¶ added in v1.1.0
func Verify(ctx context.Context, root, change, taskID, attemptID string, options VerifyOptions) (VerifyResult, error)