Documentation
¶
Overview ¶
Package runner runs a delegated role through a command-line harness the operator named, with the same brief, inputs and output contract the host's own sub-agent gets (itd-2609201916056194, spc-2609221533057881).
A role's route is roles.<role>.runner in the layered configuration (config.go): host, the default, or a runner this machine enabled under runner.<name>. The shipped runners are the claude CLI in print mode with the bare flag (claude.go) and opencode's run mode (opencode.go). Each is started as a process (proc.go): the argv is a vector and never a shell line, the binary is resolved on PATH and refused inside the repository, the environment is the parent's scrubbed of every git repository-selection and config-injection variable, stdin is the null device, output is bounded, and a run past its time is killed with the process group it leads.
The fallback is decided in one place (dispatch.go): an absent, refusing, failing or unparsable runner, or an answer the contract's validator refuses, hands the role to the host session, or with no host session to the host the operator configured (runner.fallback_host), and writes one receipt naming the role, the runner asked for, the reason and the route that ran. Tally counts those receipts per runner and per role for the run's summary.
The package never prints. It starts processes only through Dispatch and the adapters' Run, and never logs a harness in: a harness's credential is its own, read from its own environment or configuration, and abcd never puts one on a command line, in an error or in a receipt.
Index ¶
- Constants
- Variables
- func AdmitClaude(repoRoot string) error
- func CheckLogin(ctx context.Context, p Profile) error
- func CheckPinnedBinaries(p Profile) error
- func CheckWallSettings(p Profile, bin string) error
- func CheckWallSettingsBesideHarness(p Profile, bin string) error
- func HarnessMoved(p Profile) bool
- func HarnessOwed(p Profile) bool
- func HeldCredentials() []string
- func HookedEnv(p Profile) func([]string) []string
- func LongestRun(timeout time.Duration) time.Duration
- func MakePreflightGo(p Profile) (string, error)
- func PinPrograms(dir string, names ...string)
- func PinnedBinary(p Profile, path string) ([sha256.Size]byte, bool)
- func PlainProfileName(name string) bool
- func PreflightEnv(p Profile, goDir string) []string
- func ProveCandidate(ctx context.Context, p Profile, candidate string) (err error)
- func ProveWall(ctx context.Context, p Profile, bin string) error
- func RemovePreflightGo(p Profile, dir string) error
- func ReproveHarness(ctx context.Context, p Profile, bin string) (string, error)
- func ResetStageHome(p Profile) error
- func SelfBinary() string
- func SessionOnProfile(home, configDir string) (on bool, why string)
- func SetAsideSyncedSkills(p Profile) (string, error)
- func StageCachesNote(p Profile) string
- func VerifyModules(ctx context.Context, dir string, env []string) (note string, err error)
- func WriteWallSettings(p Profile, bin string) (replaced bool, _ error)
- type Answer
- type AwaitRepeat
- type Blame
- type ClaudeCLI
- type Command
- type Config
- func (c *Config) AddClassRoutes(routes []string)
- func (c *Config) CanLaunch(role, model string, hostSession bool) error
- func (c *Config) FallbackHost() string
- func (c *Config) FlagRoutes() map[string]string
- func (c *Config) JudgeOnOpenCode() bool
- func (c *Config) Ledger() *Ledger
- func (c *Config) OnWalledLogin() bool
- func (c *Config) Override(routes []oracle.FlagRoute) error
- func (c *Config) PinnedToHost(roles []string) []string
- func (c *Config) ProbeLimit(ctx context.Context, role, model string) (bool, *Failure)
- func (c *Config) Quota(ctx context.Context, name string) (Quota, bool, error)
- func (c *Config) RouteFor(role string) Route
- func (c *Config) Runner(name string) (RunnerConfig, bool)
- func (c *Config) TimeoutFor(role string) time.Duration
- func (c *Config) Walled(p Profile) *Config
- func (c *Config) WithClassRoutes(routes []string) *Config
- type Counts
- type Dispatcher
- type Failure
- type FallbackReceipt
- type HarnessSeen
- type HarnessSigning
- type HarnessTeamError
- type HistoryStore
- type LaunchEnd
- type LaunchStart
- type LaunchWork
- type Ledger
- type LedgerEntry
- type LedgerListing
- type LedgerProblem
- type LedgerQuery
- type LedgerTotals
- type LimitError
- type ModuleCacheError
- type NoVerdictError
- type OpenCodeCLI
- type Orchestrator
- type Outcome
- type Output
- type Profile
- type Quota
- type QuotaReporter
- type Reason
- type Request
- type Retention
- type RoleReceipt
- type Route
- type RouteRecord
- type Runner
- type RunnerConfig
- type Sides
- type Spend
- type StartPins
- type TranscriptStore
- type WallError
Constants ¶
const ( RouteKey = "key" RouteSubscription = "subscription" RouteHost = "host" RouteUnknown = "unknown" )
The billing routes an entry names. Only RouteKey's cost counts as spend.
const ( OutcomeRunning = "running" OutcomeFinished = "finished" OutcomeFailed = "failed" OutcomeStopped = "stopped" OutcomeHanded = "handed-to-host" OutcomeLost = "lost" )
The outcomes an entry names. OutcomeLost is never written: a reader judges it, of a running entry whose process is gone.
const ( OrchestratorSession = "session" OrchestratorRun = "run" )
The kinds of orchestrator: a host session, or a run with no session over it.
const ( DefaultRetentionDays = 30 DefaultRetentionCount = 20000 )
The shipped retention (decision 14).
const ( StageHomeEnv = abcdhome.StageHomeEnv StageProtectEnv = "ABCD_STAGE_PROTECT" StageDeclaredEnv = "ABCD_STAGE_DECLARED" StageBaseEnv = "ABCD_STAGE_BASE" StageHarnessEnv = "ABCD_STAGE_HARNESS" )
The rest of what a walled launch's guard reads: the shell's home, what is protected from the stage, what its work declares it changes, and the commit its lane was cut from.
const ( Host = "host" Claude = "claude" OpenCode = "opencode" )
The routes a role may name. Host is the default.
const ( MinTimeout = 5 * time.Minute MaxTimeout = 12 * time.Hour )
MinTimeout and MaxTimeout bound a roles.<role>.timeout the person sets.
const ( WallLogin = "login state" WallSettingsFile = "settings" WallLaunch = "live launch" WallTools = "tool list" WallServers = "servers" WallPlugins = "plugins" WallKey = "no key" WallGuard = "guard" WallWorkingTree = "working tree's settings" WallHome = "shell's home" WallApprover = "approver" WallEnv = "shell's environment" WallIdentity = "git identity" )
The walls a drive names when one does not hold.
const (
ApproverTool = "mcp__" + approverServer + "__approve"
)
approverServer is the name of the one server a shell launch starts, and ApproverTool the permission prompt tool it names on that server.
const BudgetIntent = "itd-2611011230226453"
BudgetIntent, which a drive's refusals name, covers how a key reaches the harness and what it may spend.
const ConfigDirEnv = "CLAUDE_CONFIG_DIR"
ConfigDirEnv is the variable that points the agent tool at its configuration directory. Another host's session reports no such variable and so reads as off a profile.
const CostNote = "a cost is the harness's own estimate at its price table, and the provider's invoice is the final figure; " +
"only a key's cost counts as spend"
CostNote is said wherever a cost is shown (the fourth scope condition).
const DefaultImplementerTimeout = 3 * time.Hour
DefaultImplementerTimeout bounds an implementer's run when the person set no roles.implementer.timeout. An implementer builds, commits, writes its report and runs its scoped definition of done, which waits at the load gate behind other preflights on a shared machine; on 2026-11-01 three routed implementers were killed at the hour with their work committed and their receipts unwritten (iss-2611012202511008).
const DefaultTimeout = 60 * time.Minute
DefaultTimeout bounds one run when the request names no timeout and the person set no roles.<role>.timeout (Config.TimeoutFor).
const HostSessionEnv = "CLAUDE_CODE_SESSION_ID"
HostSessionEnv is where the host exports the id of the session running a command (decision 10).
const LedgerSchema = 1
LedgerSchema is the version of the entries this build writes. A reader takes an entry above it as far as it can and names it as newer.
const RetentionFloorDays = 32
RetentionFloorDays is the shortest the store ever keeps an entry: the longest cap period a key's budget counts, a calendar month of 31 days (itd-2611011230226453), plus one day, so a month's totals are always summed from entries still held.
const StageWritesEnv = "ABCD_STAGE_WRITES"
StageWritesEnv names where a walled launch's file tools may write.
const TokenBasis = "every count the harness reports: prompt, completion, cache read and cache write"
TokenBasis is what a token total counts, said wherever one is shown: reasoning tokens sit inside the completion count, so they add nothing.
Variables ¶
var ( ErrNotOnPath = errors.New("not on PATH") ErrRefused = errors.New("refused before it is run") ErrNotStarted = errors.New("could not be started") ErrKilled = errors.New("killed") )
The launch stages a Failure can name through errors.Is: the program was not found, it was found and refused, or it was admitted and could not start. ErrKilled names a run that started and was killed, past its time or when the run it belongs to ended (iss-2611021751406429): its work may stand in its working tree, and what it spent shows only in its transcript. Every other failure (a non-zero exit, an overrun bound) is none of them.
var ( ErrNoProfile = errors.New("no profile directory") ErrSeveralProfiles = errors.New("more than one profile directory") ErrProfileName = errors.New("no plain profile name") )
The refusals DriveProfile names, through errors.Is.
var EffortLevels = []string{"low", "medium", "high", "xhigh", "max"}
EffortLevels are the efforts a request may run at, least first (itd-2611101419006280): the levels the claude harness's effort flag takes, and the only ones a request carries, whoever built it.
var Signing = HarnessSigning{Team: codesignTeam, Verify: codesignVerify}
Signing is what a drive reads signatures with; a test replaces it.
Functions ¶
func AdmitClaude ¶ added in v0.16.2
AdmitClaude reports why the claude harness would not be run from the checkout repoRoot, nil when it would.
func CheckLogin ¶ added in v0.16.2
CheckLogin asks the harness whether the walled directory has a login. It reads the one state and keeps nothing else the harness reports.
func CheckPinnedBinaries ¶ added in v0.17.0
CheckPinnedBinaries holds the binaries to what p's run pinned in this process, before a start tried again pins anything new. The harness stands aside: an update of it is proved, not refused. With no pin there is nothing to hold them to.
func CheckWallSettings ¶ added in v0.16.2
CheckWallSettings compares the walled settings with what abcd wrote for bin.
func CheckWallSettingsBesideHarness ¶ added in v0.17.0
CheckWallSettingsBesideHarness is CheckWallSettings leaving aside a harness file that has gone and a new one yet to pass: what the check before a stage holds to, and a wait for the proof, since the launch's own full check starts nothing on either. New bytes at the file's path still stop the run.
func HarnessMoved ¶ added in v0.17.0
HarnessMoved resolves the harness as a start would and reports whether that is anything but the file p's run pinned. Its ordinary update moves a link to a new versioned file and leaves the old one, which nothing else here notices. A different file the run's signing team admits is marked as owing a proof, so the next check before a stage proves and pins it through ReproveHarness. One it does not admit, or with no team to hold it to, marks nothing: a re-proof could only stop a run whose file still stands, and if that file goes the wall rules then. Nor does a name that resolves to nothing mark anything.
func HarnessOwed ¶ added in v0.17.0
HarnessOwed reports whether p's run must prove the harness before a stage starts.
func HeldCredentials ¶ added in v0.16.2
func HeldCredentials() []string
HeldCredentials names each of credentialVars set in this process's environment. It reports the names alone and keeps no value.
func HookedEnv ¶ added in v0.16.2
HookedEnv is the environment a hook the driver's own git runs gets: what a stage carries, under its home, with git's own settings kept and the configuration the drive wrote in place of whatever a stage left in that home.
func LongestRun ¶ added in v0.16.1
LongestRun is the longest a run of the given bound can last: its bound and the most it is credited for waiting at the load gate.
func MakePreflightGo ¶
MakePreflightGo makes the folder one preflight's Go build cache and GOPATH live in, and returns its path: beside the stage's home, under a name drawn at random, made by a mkdir that fails on any entry already at that name, a link included, and read back as a real directory. A drive makes it after the stage's home was emptied (ResetStageHome), and removes it once the preflight ends (RemovePreflightGo). A folder of this kind an earlier preflight left, as a drive stopped part-way leaves it, is removed first.
func PinPrograms ¶ added in v0.16.2
PinPrograms fixes what each program name means for the rest of this process and what it starts: the directory each resolves into goes first on PATH, in PATH's own order, so each name keeps its first match and one placed earlier on PATH later is not what runs. A name not on PATH is left, and so is a name PATH finds inside dir or the process's working directory, or any working tree either lies in (tools.LookPath): its directory is never moved ahead, and the program is left to each caller's own lookup. make and gh are found through tools.LookPath and the harness through the launcher's admit, and each of those refuses it. git is the exception: gitutil and the rest of abcd start git by bare name, so os/exec finds it on PATH as PATH stands and nothing refuses one inside the working tree. That is the one program the rule does not reach, a module-wide limit of how abcd finds git.
func PinnedBinary ¶ added in v0.17.0
PinnedBinary is the digest p's run holds for the binary at path, read at its start, and whether it holds one.
func PlainProfileName ¶ added in v0.17.0
PlainProfileName reports whether name is one a drive may run on: a letter or digit, then letters, digits, '.', '_' and '-'. That is one path element with no way out of the profiles' folder, no separator the environment's lists would split it on, nothing a terminal would act on and nothing a shell would, so the command a line suggests with it reads the same pasted.
func PreflightEnv ¶ added in v0.16.2
PreflightEnv is the environment a lane's preflight runs in: what a stage carries, under its home, with the person's home named for the load gate, the person's own module cache as a stage is told it, and a build cache and GOPATH in goDir, the folder MakePreflightGo made for this preflight alone, in place of the ones a stage is told. Nothing else of the parent's passes.
func ProveCandidate ¶ added in v0.17.0
ProveCandidate proves a release's binary before anything depends on it: the settings name candidate for the one live launch, it serves as the approver and the hooks, and the settings are put back naming the running binary on every way out, byte for byte what the check before each stage compares against. Only the settings file is written: the running drive's baseline stands. The caller checks the settings before it, as before any stage. A proof that fails leaves the drive as it was.
func ProveWall ¶ added in v0.16.2
ProveWall starts one short live launch on p and reads each wall from what the harness reports: the tools it holds are the ones the launch named, the only server is the approver and it is connected, no plugin is loaded but the harness's own, no key is in use, the guard hook refuses a command it is meant to refuse, the shell shows the stage's home and only the variables it may hold, and a settings file in the working tree has no effect. bin is the abcd binary serving the approver.
func RemovePreflightGo ¶
RemovePreflightGo removes the folder MakePreflightGo made at dir, through the stage's scope, so a link inside it is removed and never followed.
func ReproveHarness ¶ added in v0.17.0
ReproveHarness is the check before a stage when HarnessOwed: every other wall, then the harness resolved again and held to the signing team the start verified, before anything runs it; then pinned, and the login check and the proof on that file, from an empty stage home. What a launch shows says what it holds, not who wrote the file, so the team is what admits it, and with no team to hold it to the run stops. It returns the one line that says what changed, "" when nothing was owed. Pinned first, the file is unproved until it passes, so nothing starts on it. A limit or a launch with no verdict comes back as the first proof's would, as does a file that goes, since an upgrade leaves that for a moment, and a signature or a proof that failed before the file's last try; called again it resolves and proves again, and still names the version the run last proved. New bytes at a path it holds stop the run. It is called between stages, never during one.
func ResetStageHome ¶ added in v0.16.2
ResetStageHome makes a stage's home empty but for its git configuration, so nothing one stage leaves there reaches the next or a preflight. Every step goes through a root on the home's parent, reached level by level, so it stays inside: no link, however it came to be there, carries a change of mode, a removal or a write out of the tree. A home that is no real directory is refused, not followed.
func SelfBinary ¶ added in v0.16.2
func SelfBinary() string
SelfBinary is the absolute path of the running abcd, "" when the system cannot name it: the binary a drive's hooks name.
func SessionOnProfile ¶ added in v0.16.2
SessionOnProfile reports whether configDir, the value of ConfigDirEnv in the session's environment, names a profile of the person whose home directory is home. When it does not, why says how the setting reads, naming neither the variable nor a path.
A profile is a directory directly under the profiles' folder, judged after resolving configDir's links, so a link out of the folder is off and a link into it is on. Only home itself may be reached through a link, as temporary and some home directories are: a linked ~/.abcd.noindex or profiles folder reads as off, as a linked level of abcd's home is refused everywhere else. Every doubt reads as off, since a warning printed once too often costs a line.
func SetAsideSyncedSkills ¶ added in v0.17.0
SetAsideSyncedSkills moves the copy of the account's skills that the harness syncs into the walled directory at its login out to abcd's home, whole, and leaves the skills directory empty and closed to writes: a launch loads none of them and the harness cannot sync them back. It returns where the copy went, "" when there was none to move. Only the synced folder standing alone is moved: a skill a person placed there, or anything beside the copy, stays where it is for the check to refuse.
func StageCachesNote ¶ added in v0.16.2
StageCachesNote says why the stages on p's shell home will not use the person's Go caches, "" when they will or there is no Go: what WriteWallSettings found.
func VerifyModules ¶
VerifyModules checks, with `go mod verify` in dir under env, the preflight's own, the repository's own dependencies the person's module cache holds: each module of the main module's build list (every workspace module's, with a go.work in force) whose directory or zip the cache holds is held to the hash Go recorded when it unpacked it, and Go's build then holds that hash to go.sum. A module the cache does not hold is passed over. Nothing else in the cache is checked: not the Go toolchain a go.mod or GOTOOLCHAIN selects, not a tool `go install` or `go run` takes by version, and no program on PATH.
It runs first with GOPROXY=off, so a cache that holds the module graph is read with no network, and with GOFLAGS=-mod=mod in module mode, so a go.mod the build list has outgrown does not stop the run; -mod=mod lets go write go.mod and go.sum, and the put-back below is what keeps them as they were. In workspace mode, where the build refuses -mod=mod, it runs with the GOFLAGS env carries less any -mod. Where that run stops only because the cache lacks a module's metadata (`module lookup disabled by GOPROXY=off`), it runs again with the GOPROXY env carries, which fetches that metadata, and can download a toolchain the checkout selects. Each run is bounded by verifyTimeout.
A module go reports changed refuses the preflight and is named; so does any other failure, in go's words, and a run that leaves go.mod, go.sum, go.work or go.work.sum in dir other than it found them, each put back first. Nothing is verified, and note says why, where the build reads no dependency from the module cache (vendorMode), where dir holds no go.mod, and where no go is on PATH. go is the one PATH finds, held to the in-checkout rule (tools.LookPath).
func WriteWallSettings ¶ added in v0.16.2
WriteWallSettings writes the walled settings at each start, so a new binary re-wires them. It reports whether it replaced a file that abcd did not render, which the caller says. Nothing else in the directory is touched.
Types ¶
type Answer ¶
type Answer struct {
// Text is the harness's final message.
Text string
// Model is the model the harness reports, "" when it reports none: the
// model the runner asked for is Sides.ModelAsked, and never stands in for
// the one that answered (itd-166, iss-2610161709506207).
Model string
// SessionID is the harness's own session id, "" when it reports none.
SessionID string
// Sides is both sides of the run: what the runner asked for, and the
// token counts, cost and served models the harness's events report.
Sides
// contains filtered or unexported fields
}
Answer is the one answer shape every adapter parses its harness's events into. The contract's own answer is the receipt file; this is what the harness said about the run.
type AwaitRepeat ¶ added in v0.16.2
type AwaitRepeat struct {
Run string `json:"run"`
Lane string `json:"lane,omitempty"`
Await string `json:"await"`
Launches []string `json:"launches"`
}
AwaitRepeat is two or more launches for one await: the first place a role paid for twice shows (iss-2611031337115764).
type Blame ¶ added in v0.16.2
type Blame int
Blame is what a failed launch says of the work it was launched for.
const ( // BlameNone: nothing: it shows an outage, or no launch ran. BlameNone Blame = iota // BlameAsk: it does not say; a probe answering shows the account is alive, // which leaves the work. BlameAsk // BlameWork: its answer was refused, so the work is what failed. BlameWork )
What a failed launch says.
type ClaudeCLI ¶
type ClaudeCLI struct {
// contains filtered or unexported fields
}
ClaudeCLI is the claude CLI runner.
type Command ¶ added in v0.13.0
type Command struct {
// Name is the program's fixed name, looked up on PATH; a name carrying a
// path separator is refused, so no caller can point Exec at a file.
Name string
// Args is the argument vector, never a shell line.
Args []string
// Dir is the working directory the program runs in; empty runs it at the
// file-system root, never in the caller's directory, which for abcd is
// usually a project whose settings a vendor binary must not read.
Dir string
// Guards are the folders a program resolving inside is refused from,
// lexically or through a link: repository content is never run. A caller
// running in or for a project passes it here; Exec cannot know it.
Guards []string
// Timeout bounds the run; past it the program's group is killed. A
// command without one is never run.
Timeout time.Duration
// MaxStdout and MaxStderr bound each stream; past either the run fails.
MaxStdout, MaxStderr int
}
Command is one program found on PATH that another package runs under this file's discipline: the one launch primitive abcd has for a vendor binary, so a second copy of the admission, the group kill and the bounds is never written. Zero output bounds take a harness's own.
type Config ¶
type Config struct {
// Diagnostics are the non-fatal reports the read produced, one line each,
// for a front door to print on stderr.
Diagnostics []string
// contains filtered or unexported fields
}
Config is the runner configuration one invocation read.
func Load ¶
Load reads and validates the runner configuration. A fault is an error naming the file and the key; none falls through to a default.
func (*Config) AddClassRoutes ¶ added in v0.17.0
AddClassRoutes adds routes, those of a class map read during this process (the machine's models.classes over the bundled map, as a run's start reads it), to the routes c takes by name, so a run started after the map changed launches its reviewers. It is safe from concurrent lanes, and a configuration WithClassRoutes never set takes nothing by name still.
func (*Config) CanLaunch ¶ added in v0.17.0
CanLaunch reports whether role can be launched at model on this machine, as Dispatch would admit it (admitRequest), with or without a host session: nil when it can, else a refusal naming the role, the model and what would let it run, by why it was refused: for a model a denylist entry refuses, that entry or models.classes, since a provider block does not lift it; for a provider not configured or a model off its list, oracle.api.<provider>; and outside a drive's walled launch, where every role runs on the claude harness whatever its route, a runner route too. It names configuration keys and the machine's file as abcd displays it, never a secret or an absolute path. A drive asks it of its walled configuration, for every reviewer in its review set, before it opens a lane.
func (*Config) FallbackHost ¶
FallbackHost is the runner that runs a role when there is no host session, "" when none is configured.
func (*Config) FlagRoutes ¶ added in v0.16.0
FlagRoutes are the roles the person's --route routed for this invocation (Override), each with the --route text verbatim; nil when none did.
func (*Config) JudgeOnOpenCode ¶ added in v0.16.2
JudgeOnOpenCode reports whether the machine routes the drain's judge to opencode.
func (*Config) Ledger ¶ added in v0.16.2
Ledger is the launch ledger this configuration's launches are written to.
func (*Config) OnWalledLogin ¶ added in v0.16.2
OnWalledLogin reports whether every launch runs on a walled login (Walled).
func (*Config) Override ¶ added in v0.16.0
Override places the person's --route runner routes (oracle.ParseRunnerRoutes) in the flag layer, for this invocation alone (iss-2610161801358637): each hands its role to the runner it names, asking for the model it names in place of the runner's machine model, which stays every other role's. The flag is the person's own, so it may hand a role to a runner as the machine file may (personal), but only to a runner this machine enabled, and only for a model the runner's provider lists: the allowlist check a machine model route passes (adr-2609221009491186). A refusal routes nothing and names the fix.
func (*Config) PinnedToHost ¶ added in v0.16.2
PinnedToHost lists those of roles a configured layer keeps on the host.
func (*Config) ProbeLimit ¶ added in v0.16.2
ProbeLimit asks whether a limit has lifted for role, with one short launch on the profile, on model, a model route, or the runner's own for "". It reports true when the launch answers what it was asked; otherwise the failure says what came back: a rate-limited one with the reset it named, if any, or any other, which says nothing about the limit.
func (*Config) Quota ¶ added in v0.14.0
Quota asks the runner the machine enabled under name for its remaining quota. The host, and a name the machine has not enabled, report none.
func (*Config) RouteFor ¶
RouteFor returns where role runs: its configured route, or the host from the bundled default.
func (*Config) Runner ¶
func (c *Config) Runner(name string) (RunnerConfig, bool)
Runner returns the runner this machine enabled under name.
func (*Config) TimeoutFor ¶ added in v0.16.1
TimeoutFor is how long one run of role may take on a runner: the machine's roles.<role>.timeout, else DefaultImplementerTimeout for the implementer and DefaultTimeout for every other role.
func (*Config) Walled ¶ added in v0.16.2
Walled is c for one drive: every role runs on the claude runner, on p, which is the route the person's yes named (itd-2610222215485265 decision 5). c is left as it was read.
func (*Config) WithClassRoutes ¶ added in v0.17.0
WithClassRoutes is c holding routes, the routes the machine's class map resolves (the loop's ClassRoutes), as the routes a walled launch of the claude harness may take by name (byName); c is left as it was. A configuration that holds none takes nothing by name. A drive's start sets it where it walls the configuration.
type Counts ¶
type Counts struct {
Total int `json:"total"`
ByRunner map[string]int `json:"by_runner"`
ByRole map[string]int `json:"by_role"`
// CostUSD is what the killed launches among them spent, as their
// transcripts show it in USD, and ChargedRuns the agent runs charged for
// those whose transcripts show no cost (Spend).
CostUSD float64 `json:"cost_usd,omitempty"`
ChargedRuns int `json:"charged_runs,omitempty"`
}
Counts is the fallback intel a run's summary reports.
func Tally ¶
func Tally(rs []FallbackReceipt) Counts
Tally counts fallback receipts per runner asked for and per role. A run with none reports zero, with empty maps rather than none.
type Dispatcher ¶
type Dispatcher struct {
// Config is the runner configuration read at the lane's start.
Config *Config
// HostSession is true when a host session drives the loop and can take a
// role handed back to it.
HostSession bool
// Attended is true when the person is at the terminal with no host session
// (the plain-Terminal interviews, spc-2610030911534855): a role routed to a
// runner runs there although no runner.fallback_host is configured, and a
// runner that does not answer stops the run, its fallback receipt naming
// none as the route that ran, rather than leaving the role nowhere to land.
// A role on the host still needs a host session or a configured host.
Attended bool
// Cell is true inside a model-matrix cell (itd-2610161733316518 decision
// 4): the route is the one under test, so nothing stands in for it. A
// runner that fails, refuses, answers unparsably or fails the validator
// returns its failure in the outcome as the cell's, with no fallback
// receipt, since nothing fell back, and neither the host session nor the
// configured host runs the role: an answer from either would measure the
// wrong model. A role on the host runs only in a host session. A rate
// limit still reaches the caller as an error, since it is the window's and
// not the model's; a runner that names its provider's throttling only as
// an API status (opencode's 429 error event) returns a failure whose
// ProviderDown holds when nothing was spent, which the caller retries as
// not started rather than scoring.
Cell bool
// Validate is the contract's validator: the same check the host sub-agent's
// answer passes. It is handed the runner that ran the role, so a caller
// whose validator also records the answer (the loop's receipt verifier)
// can name the route that ran.
Validate func(runner string, req Request, ans Answer) error
// Transcripts is where every runner's transcript lands.
Transcripts TranscriptStore
// Record appends one fallback receipt to the run's state.
Record func(FallbackReceipt) error
// Prepare, when set, readies req's files for the runner about to run it,
// before each runner starts: the routed one and a fallback host alike. A
// *Failure it returns is that runner's failure, recorded and fallen back
// on as a launch's would be, with nothing launched; any other error ends
// the dispatch.
Prepare func(runner string, req Request) error
// Now is the clock the receipts are stamped with; time.Now when nil.
Now func() time.Time
}
Dispatcher runs roles by their routes.
type Failure ¶
type Failure struct {
Runner string
Reason Reason
Detail string
// Spent is what a killed launch spent, read from its transcript
// (ErrKilled, Spend); nil for every other failure.
Spent *Spend
// ResetsAt is when a rate limit resets, as the harness reported it; zero
// when it reported none or the failure is no limit.
ResetsAt time.Time
// Seen is what the harness showed of its failure, for a run's evidence
// file; nil when no launch ran. It stays out of Detail, which is abcd's.
Seen *HarnessSeen
// Model is the model route the failed launch asked for, "" for the
// harness's own default.
Model string
// contains filtered or unexported fields
}
Failure is a runner's failure. Detail is written by abcd, never copied from the harness's output, so it cannot carry anything the harness printed, a credential it echoed included.
func (*Failure) Blame ¶ added in v0.16.2
Blame is what this launch says of the work it was launched for. Only an answer the contract refused shows that by itself. A launch that spent may have lost the service afterwards, so that is the probe's to settle: a live account answers, and a service that is down does not. With nothing spent, a launch that was retrying the model service, or a result naming a status that is the account's or the service's, says nothing of the work. An init event shows nothing either: on 2.1.318 it was seen to come before any contact with the model. Anything else does not say, so the caller may ask a probe.
func (*Failure) Outage ¶ added in v0.16.2
Outage reports whether this launch was retrying the model service when it ended, or ran out of retries having spent nothing.
func (*Failure) ProviderDown ¶ added in v0.17.0
ProviderDown reports whether the launch met the model service down, or throttling it, before it spent anything: it was retrying the service, ran out of retries, or its result named a 5xx status or the provider's throttling answer (429), with nothing spent. A model-matrix copy that ends so never started (decision 6 of itd-2610161733316518): it is retried on the same pin and never scored as the model's failure, since a rate limit is the window's and not the model's. One that spent had begun, and an account's refusal (401, 403) is no outage.
type FallbackReceipt ¶
type FallbackReceipt struct {
At time.Time `json:"at"`
Role string `json:"role"`
Asked string `json:"asked"`
Reason Reason `json:"reason"`
// Detail is abcd's own account of the reason; it never carries the
// harness's output.
Detail string `json:"detail"`
Ran string `json:"ran"`
// Spent is what the launch spent when it was killed (ErrKilled), read
// from its transcript; nil for every other failure, which spent nothing
// a transcript shows or reported its spend as it ended.
Spent *Spend `json:"spent,omitempty"`
}
FallbackReceipt is one fallback: the role, the runner asked for, the reason, and the route that ran instead.
type HarnessSeen ¶ added in v0.16.2
type HarnessSeen struct {
// ExitCode is the process's status, -1 when it was killed or did not exit.
ExitCode int
// Shape is the end of its event stream, one line per event, with every
// identifier dropped and free text reduced to its length.
Shape []string
// Stderr is the first line it wrote to stderr.
Stderr string
// SilentFor is how long it had written nothing when it ended.
SilentFor time.Duration
// Spent says its stream shows tokens or a cost above zero.
Spent bool
// APIStatus is the status a failed result names, "" for none.
APIStatus string
// Retries counts the retries of the model service its stream reports, and
// Retrying says the stream ended on one.
Retries int
Retrying bool
}
HarnessSeen is what a launch that failed showed, in the terms a person needs to learn how a harness behaves at a limit: nothing here is read to decide anything. The strings are the harness's own and not yet redacted, so whoever keeps them passes them through the scanner first.
type HarnessSigning ¶ added in v0.17.0
type HarnessSigning struct {
// Team is the team named in path's signature, "" when it names none or cannot be read.
Team func(path string) string
// Verify reports whether path's signature holds and is team's.
Verify func(path, team string) error
}
HarnessSigning reads and checks who signed a harness file. Neither runs the file or reads a login.
type HarnessTeamError ¶ added in v0.17.0
type HarnessTeamError struct{ *WallError }
HarnessTeamError is a start tried again finding a harness the signing team its run pinned does not admit. Trying once more cannot change that, so it ends the run, as the same finding between stages does.
func (*HarnessTeamError) Unwrap ¶ added in v0.17.0
func (e *HarnessTeamError) Unwrap() error
Unwrap is the wall it stops on.
type HistoryStore ¶
HistoryStore is the production store: the repository's lane of the user-level transcript store, keyed on its root commit.
type LaunchEnd ¶ added in v0.16.2
type LaunchEnd struct {
Answer Answer
// Transcript is the harness's event stream, what a failed or killed launch
// has to show for itself.
Transcript []byte
// Err is the launch's own failure, which RecordLaunch records and returns
// to the caller untouched.
Err error
}
LaunchEnd is what a launch returned.
func RecordLaunch ¶ added in v0.16.2
func RecordLaunch(ctx context.Context, l *Ledger, s LaunchStart, run func(context.Context) LaunchEnd) (LaunchEnd, error)
RecordLaunch is the one way an entry is written. It writes the entry marked running, runs run with a context launchStarted answers on, and completes the entry from what run returned; a nil run is a role handed to the host, which gets a placeholder with no figures (decision 21).
An error means nothing ran: the entry could not be written, and a launch that could not be recorded is not started, since the claim is that none escapes the record. The launch's own failure comes back in LaunchEnd.Err. A completion that cannot be written leaves the answer standing and the entry as it was, which a reader shows as lost once the process is gone.
type LaunchStart ¶ added in v0.16.2
type LaunchStart struct {
Role string
// Runner is the runner that will run it, or Host for a role handed over.
Runner string
// ModelAsked is the model the runner asks for, "" for the harness's own.
ModelAsked string
// Repo is the checkout the launch works for.
Repo string
Work LaunchWork
// Fallback names the orchestrator when no session and no run does: the
// launch's own transcript session.
Fallback string
// Key is the configured name of the key abcd handed this launch, never
// its value; "" when it handed none.
Key string
}
LaunchStart is what is known of a launch before it starts.
type LaunchWork ¶ added in v0.16.2
LaunchWork is the piece of work a launch is for: the run, lane and await, or an interview and its turn. Each is free of meaning to the ledger but for the listing, and two launches naming one await are named as a pair.
type Ledger ¶ added in v0.16.2
type Ledger struct {
// contains filtered or unexported fields
}
Ledger is the store one machine's launches are written to.
func (*Ledger) Read ¶ added in v0.16.2
func (l *Ledger) Read(q LedgerQuery) (LedgerListing, error)
Read is ReadLedger on this ledger's store.
type LedgerEntry ¶ added in v0.16.2
type LedgerEntry struct {
Schema int `json:"schema_version"`
ID string `json:"id"`
Orchestrator Orchestrator `json:"orchestrator"`
Repo string `json:"repo,omitempty"`
Run string `json:"run,omitempty"`
Lane string `json:"lane,omitempty"`
Await string `json:"await,omitempty"`
Role string `json:"role"`
Runner string `json:"runner"`
ModelAsked string `json:"model_asked,omitempty"`
// Route is the billing route, Key the configured name of a key route's
// key, and RouteWhy why a route reads unknown.
Route string `json:"route"`
Key string `json:"key,omitempty"`
RouteWhy string `json:"route_why,omitempty"`
// Model is the model the harness says answered.
Model string `json:"model,omitempty"`
Usage *oracle.Usage `json:"usage,omitempty"`
Cost *oracle.Cost `json:"cost,omitempty"`
// APIMillis is the time the harness says it spent waiting on the model,
// absent when it reports none.
APIMillis *int64 `json:"api_ms,omitempty"`
WallMillis int64 `json:"wall_ms,omitempty"`
Outcome string `json:"outcome"`
Reason string `json:"reason,omitempty"`
StartedAt time.Time `json:"started_at"`
EndedAt *time.Time `json:"ended_at,omitempty"`
// PID is the process a reader judges a running entry by: the launcher's
// until the harness has started, then the harness's. PIDStartUnix is the
// harness's start, which tells it from a later process given the same id;
// zero while PID is the launcher's.
PID int `json:"pid,omitempty"`
PIDStartUnix int64 `json:"pid_start_unix,omitempty"`
}
LedgerEntry is one launch: one line of one file.
type LedgerListing ¶ added in v0.16.2
type LedgerListing struct {
Entries []LedgerEntry `json:"entries"`
Totals LedgerTotals `json:"totals"`
// TokenBasis and CostNote say what the totals count.
TokenBasis string `json:"token_basis"`
CostNote string `json:"cost_note"`
// Unreadable is every file the reader could not take as an entry. It
// cannot say whose launch one was, so a filtered listing names them too.
Unreadable []LedgerProblem `json:"unreadable"`
// Newer is the id of every entry a later abcd wrote, read as far as this
// one can.
Newer []string `json:"newer"`
// Repeats is every await with two or more launches.
Repeats []AwaitRepeat `json:"repeats"`
// LivenessUnread is true when the process table could not be read, so a
// running entry stands as written and none was judged lost.
LivenessUnread bool `json:"liveness_unread,omitempty"`
}
LedgerListing is what a read of the ledger found, oldest launch first.
func ReadLedger ¶ added in v0.16.2
func ReadLedger(home string, q LedgerQuery) (LedgerListing, error)
ReadLedger reads home's ledger for q. An absent store is an empty listing; a store that cannot be opened (behind a link, or not a folder) is an error.
type LedgerProblem ¶ added in v0.16.2
LedgerProblem is a file in the store the reader could not take as an entry.
type LedgerQuery ¶ added in v0.16.2
LedgerQuery says which launches to read: one session's, one run's, or every one.
type LedgerTotals ¶ added in v0.16.2
type LedgerTotals struct {
Launches int `json:"launches"`
Running int `json:"running"`
Finished int `json:"finished"`
Failed int `json:"failed"`
Stopped int `json:"stopped"`
Lost int `json:"lost"`
Handed int `json:"handed_to_host"`
SpendByKey map[string]float64 `json:"spend_usd_by_key"`
EstimateUSD float64 `json:"estimate_usd"`
Tokens int64 `json:"tokens"`
APIMillis int64 `json:"api_ms"`
}
LedgerTotals adds a listing up. SpendByKey is money, in USD, per key; EstimateUSD is what the rest would have cost, which is no money spent.
type LimitError ¶ added in v0.16.2
type LimitError struct {
// ResetsAt is the reset the launch named, zero when it named none.
ResetsAt time.Time
// Seen is what the launch showed.
Seen *HarnessSeen
}
LimitError is a limit a launch met before it could show anything else: a limit, never the thing it was launched to check.
func (*LimitError) Error ¶ added in v0.16.2
func (e *LimitError) Error() string
type ModuleCacheError ¶
type ModuleCacheError struct {
// Modified names each module whose directory or zip go found changed, as
// go names it (path and version).
Modified []string
// Lines are go's own words, sanitised and capped.
Lines []string
// Changed names a file of the checkout the verification wrote, put back as
// it was.
Changed string
}
ModuleCacheError is a module cache `go mod verify` did not pass, or a verification that changed what it must only read: the preflight is not run.
func (*ModuleCacheError) Error ¶
func (e *ModuleCacheError) Error() string
type NoVerdictError ¶ added in v0.16.2
type NoVerdictError struct {
// Detail is abcd's own words for how it ended.
Detail string
// Seen is what the launch showed.
Seen *HarnessSeen
// RetryAfter is how long to wait before the next try, when the attempt sets that
// itself rather than following the outage's schedule.
RetryAfter time.Duration
}
NoVerdictError is the live proof's launch ending with no verdict on any check: which an outage may look like, or a limit waited out inside it. It reads as the launch's own failure, wrapped.
func (*NoVerdictError) Error ¶ added in v0.16.2
func (e *NoVerdictError) Error() string
func (*NoVerdictError) Unwrap ¶ added in v0.16.2
func (e *NoVerdictError) Unwrap() error
Unwrap reads as the failed launch to whoever does not ask for this type.
type OpenCodeCLI ¶
type OpenCodeCLI struct {
// contains filtered or unexported fields
}
OpenCodeCLI is the opencode runner.
type Orchestrator ¶ added in v0.16.2
type Orchestrator struct {
Kind string `json:"kind"`
ID string `json:"id"`
// Name is a session's persona name, "" when it has none.
Name string `json:"name,omitempty"`
}
Orchestrator is who asked for a launch.
func CurrentSession ¶ added in v0.16.2
func CurrentSession(home string) (Orchestrator, bool)
CurrentSession is the session this process runs under, with the persona name home's register holds for it: the one the host exports, else one whose host process it descends from. It reports false under neither, as a run driven from a plain terminal is.
type Outcome ¶
type Outcome struct {
// Handoff is true when the host session runs the role, exactly as it does
// with no runner configured: the caller hands the host the brief and
// awaits its receipt.
Handoff bool
// Answer is the runner's parsed answer when a runner ran the role.
Answer *Answer
// Fallback is the receipt this dispatch recorded, nil when none.
Fallback *FallbackReceipt
// Failure is the routed runner's failure the fallback was for, nil when
// none: errors.Is(Failure, ErrKilled) tells a launch killed with its
// work possibly done from one that never ran it.
Failure *Failure
// Receipt is the role's receipt block.
Receipt RoleReceipt
}
Outcome is one dispatch's result.
type Output ¶ added in v0.13.0
type Output struct {
Stdout, Stderr []byte
}
Output is what an Exec run wrote, each stream up to its bound.
func Exec ¶ added in v0.13.0
Exec admits c.Name exactly as a harness is admitted (admit) and runs it exactly as a harness is run (run): the scrubbed environment, the null device on stdin, the bounds, and the process group killed through this handle at the timeout or when ctx ends. A failure is a *Failure, whose errors.Is names the stage for ErrNotOnPath, ErrRefused and ErrNotStarted; the output is returned whenever the program produced some. Its clock never stops: the load gate's credit is a role's (gatewait.go), and c.Timeout is the caller's own bound.
type Profile ¶ added in v0.16.2
type Profile struct {
// Dir is the walled directory's absolute path.
Dir string
// StageRoot holds what a stage's shell reads: ShellHome is the home it runs
// under, and EnvFile the file it sources before each command.
StageRoot string
ShellHome string
EnvFile string
// PersonHome is the person's own home directory.
PersonHome string
// Began is what a resuming drive's process began on, nil for a start a person typed.
Began *StartPins
// Repo is the checkout the drive runs in, whose git configuration names the
// identity a stage commits under.
Repo string
// Ledger is the launch ledger the proof's launch is written to.
Ledger *Ledger
// Env is the launch's environment switches (sealedEnv): each KEY=value is
// set over the parent's, and each bare name taken out.
Env []string
// Args are the launch's walled arguments.
Args []string
}
Profile is what a drive's launch runs on.
func DriveProfile ¶ added in v0.16.2
DriveProfile is the profile a drive runs on, below home, the person's home directory: the directory name names, or with name empty the one directory there is. It refuses a name that is no plain one or that the folder does not hold exactly, none, several with no name, and a directory it would not trust with the settings that decide what the drive's agents run, or one behind a level of abcd's home that is a link or that another account can change, judged as every declaration read there is. A refusal lists what the folder holds and never repeats the name, as abcd's other refusals of a typed value do not.
func (Profile) ForCheckout ¶ added in v0.16.2
ForCheckout is p for a drive in the checkout at repo: its stage's home and shell file are that checkout's own, so a drive in another deletes nothing of this one.
type Quota ¶ added in v0.14.0
type Quota struct {
Remaining int `json:"remaining"`
}
Quota is what a runner reports of its budget before a run starts (itd-2609201925079472 criterion 7): the agent runs it can still start in its current window. A runner whose harness counts its budget in another unit converts it, or reports none.
type QuotaReporter ¶ added in v0.14.0
QuotaReporter is a Runner that reports its remaining quota. Neither shipped runner is one: the claude CLI and opencode expose no remaining quota a launch can read before it starts, so a run routed to either names it and skips the budget check out loud.
type Reason ¶
type Reason string
Reason is why a runner did not answer: the kinds the fallback records.
const ( // ReasonAbsent: the runner is not enabled on this machine, or its binary // is not on PATH or is refused. ReasonAbsent Reason = "absent" // ReasonRefused: the harness ran and reported that it refused or erred. ReasonRefused Reason = "refused" // ReasonFailed: the harness could not start, exited non-zero, ran out of // time or overran its output bound. ReasonFailed Reason = "failed" // ReasonUnparsable: the harness's output is not its structured events. ReasonUnparsable Reason = "unparsable" // ReasonInvalid: the answer failed the contract's validator. ReasonInvalid Reason = "invalid" // ReasonRateLimited: the harness reported a rate-limit response and did // not finish. It is never fallen back on (dispatch.go): every route spends // the budget the run's window paces, so the caller ends the window // (itd-2609201925079472 criterion 8). ReasonRateLimited Reason = "rate-limited" )
type Request ¶
type Request struct {
// Role is the agent the run plays: an agent in the roster, or the
// implementer.
Role string
// Brief is the absolute path of the brief the role follows; it states the
// task and the output contract.
Brief string
// Receipt is the absolute path the contract says the answer is written to.
Receipt string
// Dir is the absolute path of the working tree the role runs in.
Dir string
// Checkout is the absolute path of the checkout the run belongs to when
// Dir is a worktree of it (a lane's worktree lives outside it); a program
// inside it is repository content and is never run, as one inside Dir is
// not. Empty when Dir is the checkout itself.
Checkout string
// Tools are the tools the role's contract grants, granted without a
// prompt; none granted when empty.
Tools []string
// Base is the full object name of the commit the run's working tree was
// cut from: a lane's base, or the HEAD an interview launched on. A launch
// that grants the shell needs it, since the approver judges every
// command against the hazard registry at that commit.
Base string
// Declared are the paths the work declares it changes, relative to Dir.
Declared []string
// Denied are the tools the role is refused outright, whatever else would
// grant them: a harness that keeps a deny list takes them there, ahead of
// every grant.
Denied []string
// Model is the <provider>/<model> route this request runs at, over the
// model the runner's own route names, so one runner serves two reviewers
// at two classes (itd-2610240922461281 decision 4); "" keeps the route's.
// It is admitted when the request is dispatched, never trusted because a
// caller stored it: against the provider's allowlist, as a configured
// route is when it is read, or, on a drive's walled launch of the claude
// harness for a route of the harness's own vendor, by its being one the
// machine's class map resolves, with the denylist still refusing it
// (Config.admitModelFor).
Model string
// Class is the model class the request runs at, and Effort that class's
// effort (itd-2611101419006280 decision 7): a runner that can pass an
// effort passes it, and its record says what was asked. Both are "" for a
// role launched with no class, the implementer among them, which keeps the
// harness's default effort, as a runner's own configured model does.
Class string
Effort string
// SessionID names the run's transcript record when the harness reports no
// session of its own.
SessionID string
// Timeout bounds the run; DefaultTimeout when zero.
Timeout time.Duration
// Work is the piece of work the launch is for, as the ledger lists it.
Work LaunchWork
// Key is the configured name of the key abcd hands this launch, never its
// value, which the ledger's route reads; "" when it hands none.
Key string
}
Request is what a role is handed: the same the host sub-agent is handed.
type Retention ¶ added in v0.16.2
Retention is how long the store keeps entries: the next writer prunes the oldest whole files past either limit, and never one inside the floor.
type RoleReceipt ¶
type RoleReceipt struct {
Role string `json:"role"`
Brief string `json:"brief"`
// Contract is the receipt path the contract names.
Contract string `json:"contract"`
Route RouteRecord `json:"route"`
}
RoleReceipt is a role run's receipt block. Everything but Route is the request's, so two runs of one request differ in their route alone.
type RouteRecord ¶
type RouteRecord struct {
// Asked is the route the configuration named: host or a runner.
Asked string `json:"asked"`
// Ran is the route that ran the role: host, a runner, or none.
Ran string `json:"ran"`
// Model is the model the runner that ran it reported, the canonical
// served model; "" on the host, whose own receipt reports it, and when
// the runner reported none.
Model string `json:"model"`
// Override is the --route text verbatim when the person's flag routed the
// role for this invocation, so a run on a chosen model is never mistaken
// for the configured route; "" otherwise.
Override string `json:"override,omitempty"`
// Sides is both sides of the run, present when a runner ran it; its
// fields are omitted when empty, so a host's or an older record reads as
// it always has.
Sides
}
RouteRecord is the route a role asked for and the one that ran it, and, when a runner ran it, both sides of the run (itd-166).
func RecordOf ¶ added in v0.16.0
func RecordOf(asked, ran string, ans Answer) RouteRecord
RecordOf is the route record of a role ran ran, routed to asked, whose harness answered ans: the served model as the canonical one, and both sides beside it.
type Runner ¶
type Runner interface {
// Name is the route's name, as roles.<role>.runner spells it.
Name() string
// Run runs the role and returns the parsed answer and the transcript, the
// harness's raw event stream. A failure is a *Failure; the transcript is
// returned whenever the harness produced one, failure or not.
Run(ctx context.Context, req Request) (Answer, []byte, error)
}
Runner is one route a role can run through.
type RunnerConfig ¶
type RunnerConfig struct {
Name string
// Model is the admitted <provider>/<model> route, "" for the harness's own
// default.
Model string
// Pin is the machine's pin for that model on that provider
// (oracle.Pin), nil when it sets none; the opencode runner holds a run
// to it.
Pin *oracle.Pin
// Local says the model's provider is a block on this machine, and
// LocalPin is the machine's local pin for the model, nil when it sets
// none (oracle.LocalPin): opencode is held to it after a probe.
Local bool
LocalPin *oracle.LocalPin
Origin string
}
RunnerConfig is one runner this machine enabled.
type Sides ¶ added in v0.16.0
type Sides struct {
// ModelAsked is the model the runner passed the harness, "" when it
// passed none and the harness chose.
ModelAsked string `json:"model_asked,omitempty"`
// EffortAsked is the effort the runner passed the harness, the effort of
// the class the role was launched at; "" when it passed none.
EffortAsked string `json:"effort_asked,omitempty"`
// ServedModels is every model the harness says served the run (claude's
// per-model usage), sorted; empty when it names none.
ServedModels []string `json:"served_models,omitempty"`
// ServedProvider is the provider the harness names as serving the
// canonical model, "" when it names none.
ServedProvider string `json:"served_provider,omitempty"`
// FinishReason is why the run's last turn stopped, as the harness says.
FinishReason string `json:"finish_reason,omitempty"`
// HarnessVersion is the harness's own version, as it reports it.
HarnessVersion string `json:"harness_version,omitempty"`
// PromptSHA256 is the SHA-256 of the prompt the runner handed the harness
// (prompt), never its text; the brief it names is the run's own file.
PromptSHA256 string `json:"prompt_sha256,omitempty"`
// Usage and Cost are the run's token counts and cost, nil when the
// harness reported none. Each count is the harness's own: claude's
// input_tokens and opencode's input exclude the cached prompt tokens,
// which are counted apart.
Usage *oracle.Usage `json:"usage,omitempty"`
Cost *oracle.Cost `json:"cost,omitempty"`
// Unpinned lists every field of the fixed lists the run could not pin.
Unpinned []oracle.Unpinned `json:"unpinned,omitempty"`
// ProviderPin is the pin the run's opencode was pointed at, and
// PinConfigSHA256 the SHA-256 of the sealed configuration that carried it
// (pin.go); empty when the run was not pinned. It is what was configured,
// not what reached OpenRouter, so Unpinned lists it as not verified.
ProviderPin *oracle.Pin `json:"provider_pin,omitempty"`
PinConfigSHA256 string `json:"pin_config_sha256,omitempty"`
// LocalPin is the local pin of a run routed to a model on this machine
// (oracle.LocalPin, iss-2610161734428291), and LocalServed what the
// server reported when it was probed before the run; both absent on any
// other route. LocalServed describes the probe, not the run: opencode
// can still be pointed at another server (askedUnpinned), so the local
// fields stay not verified. PinConfigSHA256 is then the sealed
// configuration that pointed opencode at the probed server.
LocalPin *oracle.LocalPin `json:"local_pin,omitempty"`
LocalServed *oracle.LocalServed `json:"local_served,omitempty"`
// Local says the route's provider is a block on this machine, so the
// record lists the local fields (iss-2610171545099084). A harness's
// output cannot say so; the configuration does.
Local bool `json:"local,omitempty"`
}
Sides is both sides of a run as a runner records them. Every string the harness supplied is cleaned and bounded (cleanHarness) before it is set.
func (Sides) StoppedShort ¶ added in v0.17.0
StoppedShort reports whether the harness says the run's last turn ended before its writer finished it: a limit on what it may write or read, a provider's filter or refusal, or an error. A reason it does not list, and no reason, say nothing of the kind; the harnesses and providers each spell these in their own way.
type Spend ¶ added in v0.16.1
type Spend struct {
Usage *oracle.Usage `json:"usage,omitempty"`
Cost *oracle.Cost `json:"cost,omitempty"`
// ChargedRuns is the agent runs the launch is charged when its
// transcript shows no cost: one, else zero.
ChargedRuns int `json:"charged_runs,omitempty"`
}
Spend is what a killed launch spent (iss-2611021751406429). A harness killed at its bound writes no closing event, so the cost it would have reported there never comes: the token counts and any cost its transcript does carry are read from it instead, and a launch whose transcript shows no cost is charged as one agent run of its runner's budget, the unit Quota counts, so its spend is never dropped from the tally.
type StartPins ¶ added in v0.17.0
type StartPins struct {
// contains filtered or unexported fields
}
StartPins are what a process began on before any start of it pinned anything: the person's machine declarations and the programs beside the harness, which stands aside here because an update of it is proved, not refused.
type TranscriptStore ¶
TranscriptStore keeps one runner's transcript of one role's run.