Skip to main content

@flow-state-dev/harness-manager

Classes​

HarnessAttemptFailed​

An attempt failed. Carries only a message — the board captures it as feedback, which is how the next attempt is told why this one stopped.

Extends​

  • Error

Constructors​

Constructor​
new HarnessAttemptFailed(message): HarnessAttemptFailed;
Parameters​
message​

string

Returns​

HarnessAttemptFailed

Overrides​

Error.constructor

Properties​

cause?​
cause?: unknown;
Inherited from​

Error.cause

message​
message: string;
Inherited from​

Error.message

name​
name: string;
Inherited from​

Error.name

stack?​
stack?: string;
Inherited from​

Error.stack


HarnessAttemptSuperseded​

This attempt is no longer the live one.

Distinct from HarnessAttemptFailed because it is not a failed attempt — §9's taxonomy puts a lost claim in neither class: the attempt writes nothing and leaves the row to be recovered. Throwing is still the right exit, because the board's own fenced recorder declines a settlement from a lost claim, so nothing is settled and no retry is spent.

Extends​

  • Error

Constructors​

Constructor​
new HarnessAttemptSuperseded(where): HarnessAttemptSuperseded;
Parameters​
where​

string

Returns​

HarnessAttemptSuperseded

Overrides​

Error.constructor

Properties​

cause?​
cause?: unknown;
Inherited from​

Error.cause

message​
message: string;
Inherited from​

Error.message

name​
name: string;
Inherited from​

Error.name

stack?​
stack?: string;
Inherited from​

Error.stack


HarnessRunChangesRefused​

Why the changes view found nothing to read. The view fails with this.

Extends​

  • Error

Constructors​

Constructor​
new HarnessRunChangesRefused(reason): HarnessRunChangesRefused;
Parameters​
reason​

"not-started" | "not-this-session"

Returns​

HarnessRunChangesRefused

Overrides​

Error.constructor

Properties​

cause?​
cause?: unknown;
Inherited from​

Error.cause

message​
message: string;
Inherited from​

Error.message

name​
name: string;
Inherited from​

Error.name

reason​
readonly reason: "not-started" | "not-this-session";
stack?​
stack?: string;
Inherited from​

Error.stack


HarnessRunRefused​

The run's workspace refused it: its source answered refused, or the host would not provision what the source named. The same answer next time, so the recorder ends the row on this attempt instead of retrying.

Extends​

  • TaskEndsForGoodError

Constructors​

Constructor​
new HarnessRunRefused(message, options): HarnessRunRefused;
Parameters​
message​

string

options​
ending​

"errored" | "cancelled"

taskId​

string

Returns​

HarnessRunRefused

Overrides​

TaskEndsForGoodError.constructor

Properties​

cause?​
cause?: unknown;
Inherited from​

TaskEndsForGoodError.cause

ending​
readonly ending: "errored" | "cancelled";
Inherited from​

TaskEndsForGoodError.ending

message​
message: string;
Inherited from​

TaskEndsForGoodError.message

name​
name: string;
Inherited from​

TaskEndsForGoodError.name

stack?​
stack?: string;
Inherited from​

TaskEndsForGoodError.stack

taskId​
readonly taskId: string;
Inherited from​

TaskEndsForGoodError.taskId


SessionDoorRefused​

The door refused. The request fails with this, so nothing reads as delivered.

Extends​

  • Error

Constructors​

Constructor​
new SessionDoorRefused(reason): SessionDoorRefused;
Parameters​
reason​

SessionDoorRefusalReason

Returns​

SessionDoorRefused

Overrides​

Error.constructor

Properties​

cause?​
cause?: unknown;
Inherited from​

Error.cause

message​
message: string;
Inherited from​

Error.message

name​
name: string;
Inherited from​

Error.name

reason​
readonly reason: SessionDoorRefusalReason;
stack?​
stack?: string;
Inherited from​

Error.stack

Interfaces​

AnsweredQuestion​

One answered question, as the prompt fold receives it.

Properties​

answer​
answer: string;

What the person answered.

question​
question: string;

What was asked: the run's own words, or the question the task was filed with.


CodingBriefParts​

What an app puts in a coding brief beside the task. Every part is optional.

Properties​

conventions?​
conventions?: string;

How this team works. Absent: one line pointing at the repository's AGENTS.md or CLAUDE.md.

instructions?​
instructions?: string;

The worker's own instructions: its WORKER.md body.

report?​
report?: false;

false leaves out the report of changes and checks: for a run whose last message is the answer the user reads, and which no check follows. Default: on.

standingBrief?​
standingBrief?: object;

A document the worker works from, by its name.

name​
name: string;
text​
text: string;
terms?​
terms?: readonly string[];

The app's own terms, under where and how to work: what counts as done, how to ask.


CollectionHoldingContext​

A block or harness callback that holds the run-record collection. The resolver takes only the registry so a harness feed can write records without casting its callback context to the full BlockContext.

Properties​

resources?​
resources?: unknown;

CommandCheckOptions​

Options for commandCheck and harnessSessionFlow's verify.

Type Parameters​

TContext​

TContext = CompletionRunContext

Properties​

commands​
commands: CommandCheckCommands<TContext>;

The commands, in order. An empty list runs nothing and passes.

env?​
env?: Record<string, string>;

Variables to set for the commands. They never inherit the host's whole environment: only PATH, HOME, locale, proxy and CA settings are passed.

inBrief?​
inBrief?: boolean;

Name the commands in the brief too: commandCheck adds a section to the mode's instructions, and harnessSessionFlow to each turn's, saying these run after the agent and asking it to run them first and report each with its result. Read from the same commands, so the brief names exactly what runs. A resolver is then also handed the prompt's context, before the run: for commandCheck, the run's context with stopReport, answer and baseCommit all null. A resolver must not read them to leave a check out of the brief, or the brief names fewer checks than run. Off by default: the prompt is the mode's own.

timeoutMs​
timeoutMs: number;

The wall clock for all of them together, in milliseconds.


CompletionRunContext​

What a done-condition gets on top of ModeRunContext: the one thing the run's own report adds.

Separate from ModeRunContext for the same reason PromptRunContext is — a prompt builder has no use for it, and the two sides carry facts about different attempts. feedback describes the attempt BEFORE this one and is prompt-side only; stopReport describes THIS one and is completion-side only. A single field meaning "this attempt" in one place and "the last one" in another lies by position.

Extends​

Properties​

answer​
answer: string | null;

The run's final message, as it reported it; null when it reported none. A phase whose work is an answer rather than a change reads it: a run that ended with nothing to say has not answered.

attempt​
attempt: number;

Which attempt this is, as the board counted it.

Inherited from​

ModeRunContext.attempt

baseCommit?​
baseCommit?: string | null;

The commit the run's branch was cut at, from the run's record (never read off the checkout, whose refs the run can move). null when the run has no recorded base, or works on files rather than a repository. A phase that asks "did this run change anything?" compares the checkout against it.

branch​
branch: string;
Inherited from​

ModeRunContext.branch

ctx​
ctx: BlockContext;

The block context, so a builder can read its mode's collections.

Inherited from​

ModeRunContext.ctx

epic​
epic: string;

The board's discriminator — see RunLocation.epic. A fixed board's id, or for a board read from the claim, its ledger id and partition digest (runBoardSegment).

Inherited from​

ModeRunContext.epic

feedback?​
feedback?: string;

Why the LAST attempt stopped, as the board captured it when fail() re-pended the row. This — not the run record — is the carry-forward: without it a deterministic failure replays and the retry budget burns for nothing.

Inherited from​

ModeRunContext.feedback

issue​
issue: string;
Inherited from​

ModeRunContext.issue

mode​
mode: string;

The segment the run is keyed by: its mode's name, or the older one it was found under (ModeSpec.formerName).

Inherited from​

ModeRunContext.mode

signal?​
signal?: AbortSignal;

Aborted when the completion check's time is up, or the request is cancelled. A check that starts work of its own (commandCheck's commands) stops it and starts no more, because the manager lets the checkout go soon after.

stopReport​
stopReport: HarnessRunOutcome | string & object | null;

How the run said it stopped, as it said it — the run's own three-way word (finished / stopped-at-limit / failed), reached only on a clean verdict.

Not the run record's outcome, which is this manager's own bookkeeping (running / succeeded / failed) and is never what a phase reads. Two fields, two enums; the names are kept apart on purpose.

The word crosses as reported, which is why string widens HarnessRunOutcome here rather than the closed union being reused.

A conforming harness can only report the three words: harnessRunHandleSchema is a z.enum, so the union is the whole vocabulary the contract offers. But this manager does not read a handle through that schema — decide declares outcome: z.string().nullable(), deliberately loose, so a harness that reports something else is seen rather than rejected at the door. This type says what can actually arrive at this seam. Narrowing it would not make the value narrower; it would only stop a phase being able to notice, which is the silent partial success this field exists to prevent, one layer down. null means no terminal result was reported at all — a distinct fact from "finished", and a check that cannot tell them apart is the sometimes-absent shape this contract already refuses.

No settlement decision is made on it here. The manager's one read of the same value is arm 3's failure text, chosen after the arm already was. What "done" means is the phase's call, and a phase that ignores this field settles exactly as one written before the field existed — including on a run that committed half the job and ran out of road.

trackerIssue​
trackerIssue: string | null;

The tracker issue the task names (ENG-142), or null when it names none. On a fixed board it is issue. On a board read from the claim, issue is the row's own id and this is the issue its harnessFeature key names, so a prompt can say what the work is for.

Inherited from​

ModeRunContext.trackerIssue

validated?​
validated?: unknown;

Whatever this mode's own ModeDone.validate returned, for THIS manager.

unknown because only the mode that produced it knows its shape — the manager carries it and never reads it. Absent when the mode has no validate.

Inherited from​

ModeRunContext.validated

workspacePath​
workspacePath: string;

The run's own checkout.

Inherited from​

ModeRunContext.workspacePath


GoalJudgeOptions​

What goalJudge takes.

Properties​

floor?​
floor?: number;

The floor a not done or ask must reach. Default GOAL_JUDGE_FLOOR.

model?​
model?: string;

The evaluation model. Default GOAL_JUDGE_MODEL.

name​
name: string;

The evaluator block's name; its steps are named after it.


HarnessJudge​

A second reading of a run that passed the phase's own check, on a board read from the claim: did the answer meet the task's goal?

The block is the host's, typically an evaluator; the manager names no model. It runs after isDone passes, for a row with a goal, and its output is read through harnessJudgeVerdictSchema. A judge that throws, times out or answers something else is not a verdict: the task settles on the phase's check alone, with judged: false in the output.

Properties​

block​
block: BlockDefinition<any, any, {
answer: string | null;
commits: {
count: number;
subjects: string[];
};
diff: | {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}
| null;
goal: string;
}, unknown>;
floor​
floor: number;

The confidence a not-done or ask must reach to count. Below it, the run is done.


HarnessReadinessOptions​

Options for harnessReadiness.

Properties​

timeoutMs?​
timeoutMs?: number;

How long one check may take. Default READINESS_CHECK_TIMEOUT_MS.


HarnessReadinessRead​

The kept readiness of a host's harnesses.

Properties​

harnesses​
readonly harnesses: readonly string[];

The harnesses' keys, in the order the host gave them.

Methods​

read()​
read(options?): Promise<object[]>;

Every harness's row, in harnesses order. Runs a check for any harness with no row yet, and for those refresh names. Never throws.

Parameters​
options?​

ReadReadinessOptions

Returns​

Promise<object[]>

refusal()​
refusal(harness): Promise<string | undefined>;

Why a task on harness can't start, as a sentence that names it and says what to do, or undefined when it can. A ready row answers without a check; a not-ready or missing one gets one fresh check, so a sign-in made since the last read counts. A harness the host didn't name answers undefined: there is nothing to check.

Parameters​
harness​

string

Returns​

Promise<string | undefined>


HarnessReadinessSlot​

One harness a host offers, and how to check it.

Properties​

check​
check: HarnessReadinessCheck;

The harness's own check, from its integration package.

label?​
label?: string;

The name the user sees (Codex). Defaults to the harness's key.


HarnessRunChangesViewOptions​

How a host builds the view.

Properties​

board​
readonly board: (ctx) => Promise<SessionDoorBoard | undefined>;

The board the session's run is on, as the session door is given it: resolved from server state, never from the input.

Parameters​
ctx​

BlockContext

Returns​

Promise<SessionDoorBoard | undefined>

name?​
readonly name?: string;

Names the view's block. Default "harness-manager".

uses?​
readonly uses?: readonly DefinedCapability<string, Record<string, (...args) => any>, string, Record<string, PresetDef<any>>, undefined, undefined, undefined, undefined, undefined>[];

Capabilities the view's block holds, for the board ledgers board resolves.


HarnessSessionDoorOptions​

How a host builds the door.

Extends​

Properties​

board​
readonly board: (ctx) => Promise<SessionDoorBoard | undefined>;

The board the calling session's run is on, resolved per request from server state (the session's own fields), never from the line.

Parameters​
ctx​

BlockContext

Returns​

Promise<SessionDoorBoard | undefined>

Inherited from​

HarnessTalkTurnOptions.board

harness​
readonly harness: HarnessSlot;

The harness, as the managers behind the door are given it: talk resumes the coding session with it.

Inherited from​

HarnessTalkTurnOptions.harness

name?​
readonly name?: string;

Names the turn's blocks. Default "harness-manager".

Inherited from​

HarnessTalkTurnOptions.name

onSteered?​
readonly onSteered?: (ctx, row) => Promise<unknown>;

Called after a steer that left the task waiting on it (it was running nothing): start the turn the steer is owed. A Workforce host passes startOwedSteerTurn, which resolves to whether it started one; the door reads nothing from the result.

Parameters​
ctx​

BlockContext

row​

Task

Returns​

Promise<unknown>

talkTimeoutMs?​
readonly talkTimeoutMs?: number;

How long one talk run may take, in ms, which also sizes the hold on the checkout it runs in. Default 10 minutes.

Inherited from​

HarnessTalkTurnOptions.talkTimeoutMs

uses?​
readonly uses?: readonly DefinedCapability<string, Record<string, (...args) => any>, string, Record<string, PresetDef<any>>, undefined, undefined, undefined, undefined, undefined>[];

Capabilities the turn's blocks hold, for the board ledgers board resolves.

Inherited from​

HarnessTalkTurnOptions.uses


HarnessSessionFlowOptions​

Options for harnessSessionFlow.

Properties​

agent​
readonly agent: (feeds) => HarnessBlock;

Build the harness block from the feeds.

Parameters​
feeds​

HarnessFeeds

Returns​

HarnessBlock

approveTools?​
readonly approveTools?: boolean;

A user approves each tool call the harness hasn't been told it may make: the turn waits on them, and their answer resumes its conversation. Off by default, and with it off no feed is handed. Needs durable execution: a turn on a host without it is refused.

defaultModel?​
readonly defaultModel?: string;

The model a session with none runs on (one stored before models could be picked). Unset, the harness runs its own default.

harnessLabel?​
readonly harnessLabel?: string;

What the harness is called in a person's words, for the error a silent turn ends with (No output from Claude Code for 20 mins; stopped.). Default "the harness".

idleTimeoutMs?​
readonly idleTimeoutMs?: number;

How long the harness may send nothing, in ms, before it is stopped and the turn ends timed out. Every event it sends starts the window again. Default 20 minutes.

issueSpec?​
readonly issueSpec?: IssueSpecOption;

Open each turn of a session that names an issue with the issue's spec, until the harness confirms a conversation (./issue-spec). Off by default: a turn's prompt is the person's words alone.

kind​
readonly kind: string;

The flow kind, one per harness (claude-code-session).

turnTimeoutMs?​
readonly turnTimeoutMs?: number;

A cap on how long the harness may run in one turn, in ms, however busy it is: past it, it is stopped and the turn ends timed out. Time a turn waits on a user's answer about a tool call (approveTools) doesn't count: each run it resumes gets the whole of it. Default 4 hours, so a harness that loops while still sending events can't run forever; 0 turns the cap off.

verify?​
readonly verify?: CommandCheckOptions<HarnessSessionVerifyContext>;

Checks to run when a turn the harness finished ends, in the session's working directory, recorded on the turn's checks. A red check does not fail the turn. Unset, nothing runs.

workspace​
readonly workspace: HarnessSessionWorkspace;

Where sessions work.


HarnessSessionPlace​

Who a session belongs to, as the framework names it. Never read from the request body.

Properties​

flowKind​
readonly flowKind: string;

The session's flow kind.

issue?​
readonly issue?: string;

The issue the session was born with, when it names one. A host that names branches leads the session's branch with it, so the branch says what it is for and a tracker can link it.

sessionId​
readonly sessionId: string;
tenantId?​
readonly tenantId?: string;

The authenticated tenant, when the host has one.


HarnessSessionProvisioned​

What HarnessSessionWorkspace.provision made, when it says more than the path. One object, so later fields join it.

Properties​

path​
readonly path: string;

The working directory.

setup?​
readonly setup?: PlaceSetup;

What the host's setup command came to, when this provision ran it (WorkspacePlace.setup).

worktree?​
readonly worktree?: string;

The key of the worktree's row, when the host wrote one (WorkspacePlace.worktree).


HarnessSessionProvisionRequest​

What HarnessSessionWorkspace.provision is told beside the place. One object, so later fields join it.

Properties​

onSetup?​
readonly onSetup?: () => Promise<void>;

Call when the host's setup command starts (PlaceRequest.onSetup). Records it on the turn.

Returns​

Promise<void>

start?​
readonly start?:
| {
base: string;
}
| {
branch: string;
}
| {
pullRequest: number;
}
| {
worktreeOf: string;
};

The session's start, when it picked one. Honoured when the workspace is made; a later provision hands it back.

worktrees?​
readonly worktrees?: WorktreeRecording;

The user's worktree rows, to hand the host's provision (PlaceRequest.worktrees), so it writes the row.


HarnessSessionWorkspace​

Where the host's sessions work. Each call is one session's, keyed on its place.

Methods​

attach()?​
attach?(owner, request): Promise<string | null>;

Record that session works in owner's worktree (WorkspaceHost.attach), returning the row's key, or null when it has none. Optional: without it, an attached session records no row key.

Parameters​
owner​

HarnessSessionPlace

request​
by​

{ id: string; kind: "session" | "run"; }

by.id​

string

by.kind​

"session" | "run"

worktrees​

WorktreeCollection

Returns​

Promise<string | null>

branch()​
branch(place): string | null;

The branch whose pull requests the turn-end check reads, or null to skip the check. A branch provision named is read first.

Parameters​
place​

HarnessSessionPlace

Returns​

string | null

locate()​
locate(place): string;

Where the session's working directory is, without making it.

Parameters​
place​

HarnessSessionPlace

Returns​

string

provision()​
provision(place, request?): Promise<string | HarnessSessionProvisioned>;

The session's working directory, made on its first turn and handed back after: the path, or { path, worktree?, setup? }. Pass request.onSetup to the host and return its setup, to put the host's setup command on the turn's record; a bare path records none.

Parameters​
place​

HarnessSessionPlace

request?​

HarnessSessionProvisionRequest

Returns​

Promise<string | HarnessSessionProvisioned>

recordCheckout()?​
recordCheckout?(place, request): Promise<unknown>;

Read the worktree at a turn's end and write its branch and commit count to its row (WorkspaceHost.recordCheckout). Optional: without it, the row keeps what provision wrote.

Parameters​
place​

HarnessSessionPlace

request​
by?​

{ id: string; kind: "session" | "run"; }

by.id​

string

by.kind​

"session" | "run"

worktrees​

WorktreeCollection

Returns​

Promise<unknown>

remove()?​
remove?(place, options): Promise<{
branchDeleted: boolean;
}>;

Remove the session's worktree, and with deleteBranch its branch, through the host's one removal path (WorkspaceHost.remove). Optional: without it, removeWorktree is refused.

Parameters​
place​

HarnessSessionPlace

options​
deleteBranch​

boolean

force​

boolean

worktrees?​

WorktreeCollection

Returns​

Promise<{ branchDeleted: boolean; }>


HarnessStub​

The slot, plus the log of what each run was handed.

Properties​

runs​
runs: StubRun[];

Every run, in order. Empty means the harness was never reached.

slot​
slot: (feeds) => HarnessBlock;

The factory to hand harnessManager({ harness }).

Parameters​
feeds​

HarnessFeeds & object

Returns​

HarnessBlock

toolCalls​
toolCalls: StubToolCallRecord[];

Every scripted tool call and what became of it, in order.


HarnessStubMcpTools​

The part of a host's MCP relay the stub asks: which servers a run's project names.

Methods​

named()​
named(ctx): Promise<readonly string[]>;
Parameters​
ctx​

HarnessCallbackContext

Returns​

Promise<readonly string[]>


HarnessStubOptions​

Properties​

duringRun?​
duringRun?: (run) => void | Promise<void>;

What the run "did" in its checkout, if anything.

A check's point is often that the directory is real: the honest way to show a run was given its own checkout is to have it write there and then read the result out of git. Absent means a run that produced nothing — which is what a check's red half needs.

Parameters​
run​

StubRun

Returns​

void | Promise<void>

finalMessage?​
finalMessage?: string | ((run) => string | null) | null;

Anything the run wants to say: its final message, the answer an answer task's output carries. Recorded on the row, and becomes retry feedback. A function reads it off the run after duringRun, so a run can answer with what it found in its working folder.

mcpUses?​
mcpUses?: readonly CapabilityRef[];

The capabilities mcpTools.named reads through, held only when the slot is handed mcpTools: workforce's projectWorkspaceCapability, for its projectMcpTools.

outcome?​
outcome?: HarnessRunOutcome | null;

The handle's outcome word.

Note what this does not do on its own: the manager reads status for success and then asks the mode's done check, so the outcome word is recorded rather than decisive.

outcomeOf?​
outcomeOf?: (run) => HarnessRunOutcome | null;

The handle's outcome word per run, overriding outcome.

Parameters​
run​

StubRun

Returns​

HarnessRunOutcome | null

spend?​
spend?: object;

What each run reports it spent, from its finally as a harness does: a run stopped on a held call reports too. Its run id is the run's session. Absent, the run reports nothing.

costUsd​
costUsd: number | null;
inputTokens​
inputTokens: number;
outputTokens​
outputTokens: number;
status?​
status?: HarnessRunStatus;

The handle's status. "completed" is a verdict the manager reads as a clean finish; "errored" is a failed attempt.

statusOf?​
statusOf?: (run) => HarnessRunStatus;

The handle's status per run, overriding status.

Parameters​
run​

StubRun

Returns​

HarnessRunStatus

stepEveryMs?​
stepEveryMs?: number;

How long the run pauses before each of its steps, so a user watching the run's session sees them arrive. Abortable: an interrupt ends the wait. Default 0.

steps?​
steps?: readonly string[];

Lines the run says as it works, each emitted as a message in the run's own session before duringRun. Absent means a run that says nothing, which is what a model-free check grades. A host someone watches passes them, so the task's Session has steps to show.

toolCalls?​
toolCalls?: readonly StubToolCall[];

Tool calls the run makes after its steps and before duringRun (see StubToolCall). Given, the stub declares stopsOnAbort: a held call waits for the step's stop, and the run ends with it.


HarnessTalkTurnOptions​

How a host builds a talk turn: the door's options but the steer's.

Extended by​

Properties​

board​
readonly board: (ctx) => Promise<SessionDoorBoard | undefined>;

The board the calling session's run is on, resolved per request from server state (the session's own fields), never from the line.

Parameters​
ctx​

BlockContext

Returns​

Promise<SessionDoorBoard | undefined>

harness​
readonly harness: HarnessSlot;

The harness, as the managers behind the door are given it: talk resumes the coding session with it.

name?​
readonly name?: string;

Names the turn's blocks. Default "harness-manager".

talkTimeoutMs?​
readonly talkTimeoutMs?: number;

How long one talk run may take, in ms, which also sizes the hold on the checkout it runs in. Default 10 minutes.

uses?​
readonly uses?: readonly DefinedCapability<string, Record<string, (...args) => any>, string, Record<string, PresetDef<any>>, undefined, undefined, undefined, undefined, undefined>[];

Capabilities the turn's blocks hold, for the board ledgers board resolves.


HarnessUsageFlowOptions​

Options for harnessUsageFlow.

Properties​

readers​
readers: Readonly<Record<string, HarnessUsageReader>>;

One reader per harness, keyed by the harness's name (codex). Each runs only on a Re-check. A harness with no reader is still listed when something has written its row.

timeoutMs?​
timeoutMs?: number;

How long a reader may take before Re-check stores unavailable. Default USAGE_READ_TIMEOUT_MS.


HarnessUsageView​

One harness as the query returns it.

Properties​

ageMs​
ageMs: number | null;

How old the stored reading is, or null when there is none.

checkedAt​
checkedAt: number | null;
harness​
harness: string;
plan​
plan: string | null;
reason​
reason: string | null;
refreshError​
refreshError: string | null;
status​
status: "windows" | "api-key" | "signed-out" | "unavailable";
windows​
windows: HarnessUsageWindowView[];

IssueSpecOptions​

Options for the spec brief.

Properties​

path?​
path?: (issue) => string;

The spec file for an issue, relative to the run's checkout. Default specs/issues/<ISSUE>/SPEC.md. A path that leaves the checkout is refused when read.

Parameters​
issue​

string

Returns​

string


KeptTurnUpgradeOptions​

Properties​

ledgers​
readonly ledgers: readonly string[];

The task ledgers the managers ran rows from, by collection id (a conversation's board is "tasks").

userCell​
readonly userCell: (userId, orgId) => string;

The storage key of a user's cell: the engine's resolveUserStorageKey(userId, orgId, { id, isolateUserState: false }). Kept turns, run records and a partitioned ledger all live in the shared cell.

Parameters​
userId​

string

orgId​

string

Returns​

string


KeptTurnUpgradeStores​

The stores the step reads and writes: the engine's StoreRegistry fits.

Properties​

resourceState​
readonly resourceState: object;
getByPrefix()​
getByPrefix(
scopeType,
scopeId,
prefix
): Promise<Record<string, {
state: unknown;
version: number;
}>>;
Parameters​
scopeType​

"user"

scopeId​

string

prefix​

string

Returns​

Promise<Record<string, { state: unknown; version: number; }>>

set()​
set(
scopeType,
scopeId,
resourceKey,
state,
expectedVersion
): Promise<unknown>;
Parameters​
scopeType​

"user"

scopeId​

string

resourceKey​

string

state​

Record<string, unknown>

expectedVersion​

number

Returns​

Promise<unknown>

session​
readonly session: object;
list()​
list(options?): Promise<StoredSession[]>;
Parameters​
options?​
parentage?​

"all"

Returns​

Promise<StoredSession[]>


ManagerOptions​

How the manager is wired to its board and its host.

Properties​

approveTools?​
approveTools?: boolean;

Ask a person before each tool call the harness hasn't pre-allowed. Off by default: the feed is absent, and the harness's own permission settings decide, as without it.

On, the manager hands the harness an onToolApproval feed among its feeds. A call no grant of this try covers stops the run with the call unrun, and the run waits through ctx.suspendForUser({ kind: "approval" }), which the claim gate mirrors as the task's hold and the Inbox lists. Its prompt names the tool, the command or file it touches, and the folder. The answer resumes the same coding session: a yes grants the call once, or for the rest of the try with { scope: "run" } (Allow for this run: the same tool with the same command or file); a no, with an optional { note }, tells the session it may not, and the run goes on. At the host's deadline for a user's stop it reads as a no. A cancel resumes nothing.

Only a harness that asks per call takes the feed (Claude Code); Codex and Cursor ignore it. What the harness pre-allows (allowedTools, permissionMode) never reaches it. Needs durable execution, and a harness whose stop waits for its process (stopsOnAbort): a host without durable execution is refused when the request starts.

awaitPullRequests?​
awaitPullRequests?: boolean;

Keep a task whose run opened a pull request open until that pull request merges or closes. Off by default: such a task completes when its run passes, as without it.

On, the settle (after the judge and the review) takes every pull request on the session's record stamped with one of this task's requests, whatever state it was seen in, and reads each from GitHub through the host's gh. Any still open, or any it can't read, holds the task on one external wait listing them (actor: "system"): the row stays in_progress with no lease, and a line typed in the task's session, or a message delivered to it, wakes it. A wake reads the pull requests first: all merged completes the task with them on its output (pullRequests), with no harness run; none open and some merged completes it the same way, the closed ones noted there; all closed without merging cancels it, its pull request was closed without merging; any open runs the wake's words as one more step of the same coding session, on the same attempt, and the run's end comes back to the same check; unreadable runs them too, with a status note, and never settles the task. A run that opened no pull request settles as without it.

A judge's confident not-done doesn't fail a run that opened a pull request: the task waits on it as above, the judge's reason said in a status note. The person reviewing the pull request is its check.

Only a host with a way to wake a waiting task should turn it on: until one does, the task stays open.

boardCollection?​
boardCollection?: DefinedTaskCollection;

The board's ledger declaration.

Two things read it: the attempt fence, which resolves it as a plain resource collection to read the live claim, and the ask step, which resolves it as a TaskCollectionRef so a question holds the task through the board's own write.

boardCollectionId?​
boardCollectionId?: string;

The board's ledger collection id — the fence reads the live claim from it, and every run's checkout folder, branch and run record are derived from it.

Used as is: a dotted board id (eng.feature.work) is accepted with its dots. Checked when the manager is built, so an id a git branch cannot carry (a .lock ending, a doubled or trailing dot, a separator) is refused here rather than after a row has been claimed.

Give it with boardCollection, or give ledgers, or both.

branchPrefix?​
branchPrefix?: string;

What each run's branch starts with: the app's own name for its runs, such as teammates/, so a branch says which app cut it. Lower-case letters and digits with single - or _, ending in /; refused at construction otherwise. Default fsd/. A run already recorded on a branch keeps it, whatever this says now.

harness​
harness: HarnessSlot;

The slot. How this manager is pointed at a coding harness.

Called ONCE, at construction, with the feeds the harness contract declares — and the harness package closes over the ones it takes. That is the whole coupling: this package imports no harness, names no vendor, and a second harness needs no edit here.

harness: ({ cwd, resume, onSession, onUsage, onSteerable }) =>
cursorAgent({ cwd, resume, onSession, onUsage, onSteerable }),

What the host writes inside the factory is the host's, deliberately. detached: true is not decoration there: the harness becomes a child block of the flow's gated task entry, and the claim gate refuses an entry that authors session state anywhere beneath it. A non-detached harness therefore fails at defineFlow, naming the entry — at startup, where a host can act on it, rather than mid-run.

A factory rather than a block, because the feeds are per-manager: they read and write THIS manager's own run state, and a block built before the manager exists cannot have been given them. Called once rather than per run for the same reason a flow is built once — the feeds resolve per run, the block does not.

harnessLabel?​
harnessLabel?: string;

What the harness is called in a person's words, for the error a silent run fails with. Default "the harness".

idleTimeoutMs?​
idleTimeoutMs?: number;

How long the harness may send nothing, in ms, before its run is stopped and the attempt fails saying so (No output from Claude Code for 20 mins; stopped.). Every event the harness sends (onEvent) starts the window again, so a run that is still working is never stopped for how long it has run. Default 20 minutes.

issueSpec?​
issueSpec?: IssueSpecOption;

Open the brief of a task that names an issue with the issue's spec, read from the run's checkout once it is provisioned (./issue-spec). Off by default: the brief is the phase's prompt alone.

judge?​
judge?: HarnessJudge;

Read a run that passed the phase's check once more, against its task's goal, before the row closes (see HarnessJudge). Only on a board read from the claim: a fixed board's rows never reach it. Size a host's shutdown with harnessDrainBudgetMs({ ..., judge: true }) when given.

landAttempts?​
landAttempts?: number;

How many times an accept that names a way to land tries it before the review is asked again. Default 3. A landing that fails is handed to the coding session as one more step, with the error and the person's note, and tried again when that step comes back to review, without asking the person. A failure no run can fix (the host can't land here, or its remote is unusable) is asked of the person at once. 1 asks the person after every failure, as before.

ledgers?​
ledgers?: HarnessLedgers;

Read each run's board from its claim instead of from one fixed board.

A worker that takes tasks from many boards (each conversation keeps its own) has no single board to name. With this, the manager reads the ledger id and partition from the claim the entry adapter hands it on its input (claim, next to the task's fields) and resolves the board through this function. It never trusts that claim by itself: every read and write goes through the attempt fence against the row at that ledger and partition.

A task whose claim names boardCollectionId with no partition is that fixed board's row and runs exactly as it does without this option. On every other board, two things differ: a refused run fails the row for good instead of cancelling it, and the judge may read the answer. A question holds its task the same way on both.

Called on every fenced read and write, not once per run: a fence must read the row fresh. Keep it cheap.

mode​
mode: ModeSpec;

How each run is told what to do, when it counts as done, and the segment its key ends in.

name?​
name?: string;
onPullRequestRecorded?​
onPullRequestRecorded?: PullRequestFollower;

Act on each pull request a run records for the first time, in the request that records it: mid-turn, as the harness's create call settles, or at the branch check or the accept that opened it. workforce's followPullRequest({ providers }) subscribes the run's session to the pull request, so its reviews, comments and CI reach the session from that moment, including a check that completes before the turn ends. Unset, nothing follows a pull request. A follower that throws is a status note.

ownership?​
ownership?: Partial<OwnershipBounds>;

How checkout contention is bounded. Defaults derive from the longest a live attempt can hold the lock without marking it live — its silence window plus the provisioning budget, not the window alone.

replies?​
replies?: ReviewReplyPoster;

The host's poster for a run's replies to review comments. Set, a run's brief names its reply folder, and when its turn ends (after its push or landing, before the settle) the manager reads the drafts there and hands them to it, with the pull requests recorded for the task's run and the task itself. Each draft ends as a line in the run's session: its reply's link, or why it wasn't posted. A turn that only answers on a merged or closed pull request posts nothing. Unset, nothing is read or posted.

reviewChanges?​
reviewChanges?: boolean;

Hold a run that ends with commits on its branch for a person's review before its task completes. Off by default: every run settles on its verdict, as without it.

On, a run the phase's check passed (and the judge, when one read it, found done or was under its floor) that has commits over its base waits through ctx.suspendForUser({ kind: "review" }), its prompt naming the commits, the files they changed and the judge's verdict as information. The stop's data carries each changed file's added and removed lines (files); a screen reads one file's patch through harnessRunChangesView. The answer is { verdict: "accepted" }, which completes the task with no further harness run, or { verdict: "revise", words }, whose words become the user's steer: the run goes on in the same coding session on the same attempt, and comes back for review. At the host's deadline for a user's stop the task completes with review: "deadline" on its output, never read as accepted. A run with no commits, or one that failed, is not reviewed. Needs durable execution: a host without it is refused when the request starts, before any harness run.

runTimeoutMs?​
runTimeoutMs?: number;

A cap on the harness run's wall-clock time, in ms, however busy it is. Default 4 hours, so a run that loops while still sending events can't spend forever; 0 turns the cap off, and a working run then goes on until it ends or goes silent.

stopsOnAbort?​
stopsOnAbort?: boolean;

Stop a running step for a steer only when the harness's abort waits for its process to exit. Otherwise two processes could share one checkout. Off: the steer waits for the step's own end. The row is polled (STEER_POLL_MS) while a step runs.

Absent: what the harness block declares (HarnessBlock.stopsOnAbort), so Claude Code's runs are stopped and other harnesses' aren't. Set it to override the harness either way.

A run that offers a live steer (onSteerable) takes the line into its turn instead, and is never stopped for one it took; the row is polled while it offers one, with or without this.

tenant​
tenant: string | undefined;

The tenant this conductor serves — the same value that partitions the board's collection identity. Every request must resolve to it.

trackerIssueOf?​
trackerIssueOf?: (input) => string | undefined;

On a board read from the claim: the tracker issue a task's input names (ENG-142), or undefined for a task that names none. A task naming one works on that issue's branch, in this manager's mode. A host whose tasks declare their input reads its own field: the harness kit's coding flow reads its task input's issue. Absent: the harnessFeature key, read for a row stored before task input was declared.

Parameters​
input​

unknown

Returns​

string | undefined

uses?​
uses?: UsesSlot;

Capabilities installed on the blocks whose contexts a mode sees — the same uses slot any other block takes.

This replaces a bespoke readable record on the mode, which was a second way to say what the framework already says. A mode that reads its own collections ships them as a capability and the host puts it here; the manager spreads it onto the blocks a mode's hooks run inside (the instructions' and the done check's), so ctx.resources resolves for them exactly as it does anywhere else.

The reserved-accessor guard is unchanged in effect and re-aimed at this: a capability claiming runs, the usage record or the board's own accessor is refused at construction with the same message.

workspace​
workspace: WorkspaceHost;

Where each run's files come from, and where it works.

A workspace host from @flow-state-dev/workspace, which answers per run from its run source: a branch of one repository on this machine (localRepoWorkspaceHost), a branch of an allowed remote with kept files beside it, or kept files alone (localWorkspaceHost).


ModeDone​

When a mode's run counts as done: the server-side check, how long it may take, and what it needs from the workspace, checked at construction.

Properties​

timeoutMs?​
timeoutMs?: number;

How long check may take, in milliseconds; a minute (NETWORK_CALL_TIMEOUT_MS) when unset. commandCheck sets it to cover its commands. Pass the same number to harnessDrainBudgetMs({ doneTimeoutMs }), or a shutdown can stop a check before it ends.

Methods​

check()​
check(run):
| boolean
| ModeDoneVerdict
| Promise<boolean | ModeDoneVerdict>;

Has the job actually been done? Re-evaluated now, and consulted ONLY after a successful verdict — never as an alternative route to completion.

The carry-forward field is prompt-time only: feedback is absent here, deliberately and always. It describes the attempt BEFORE this one, which is what a prompt needs and what a done check has no use for — the question is whether the job is done now, not how the last attempt went. It is also not reachable at this point: it arrives on the worker's input, and the verdict handler is handed the run's own result instead. A mode whose done check genuinely needs it wants it put on the manager's state first; do that when such a mode exists rather than plumbing a field nothing reads.

What it DOES get is CompletionRunContext.stopReport: how this run said it stopped. A clean end and a finished job are not the same predicate, and a run that exhausted its turn or spend budget is where they most reliably diverge — it commits the half it managed and reports stopped-at-limit. A check that answers from the branch alone closes that row as done, silently. Reading the field is the mode's call, and declining to is a real choice with a real cost; the framework imposes nothing, because only the mode knows what finishing means for it.

Parameters​
run​

CompletionRunContext

Returns​

| boolean | ModeDoneVerdict | Promise<boolean | ModeDoneVerdict>

validate()?​
validate?(workspace): unknown;

What this mode needs from the workspace, checked before anything is claimed. Throws to refuse; absent means the mode needs nothing.

A mode's own preconditions are configuration, and configuration is refused at startup. The other guards at that door — the repository, the base ref, the numbers — protect a task from paying for a shell typo: the row is claimed, the attempt is charged, and the failure is permanent, so every retry spends itself on it. A precondition belonging to the mode has exactly that shape and could not use that door, because only the mode knows what it needs and only the flow holds the workspace.

The implement mode's completion probe reads the source repository's origin; a checkout whose GitHub remote is called something else fails it AFTER the paid agent run, once per retry. That is the case this exists for, and it is why the hook takes the workspace rather than being a boolean.

Whatever it returns is handed back to this mode's own check and instructions as ModeRunContext.validated, once per manager. That is the only way a mode can carry something it learned at construction into a run: closing over it does not work, because one ModeSpec can be given to two managers and the manager's snapshot copies function references rather than what they close over. Three separate defects came out of a mode that tried — a pin shared between managers, a pin retained by a construction that then failed, and a comparison written to paper over both.

Parameters​
workspace​

WorkspaceHost

Returns​

unknown


ModeDoneVerdict​

What a mode's done check may answer instead of a boolean: whether the job is done, why not, and the checks it ran (commandCheck).

reason is added to the not-done message, which the board hands the next attempt as its feedback. checks goes on the run record whatever the verdict, and on the review's data when the run is done.

Properties​

checks?​
checks?: CheckoutCommandResult[];

The checks the mode ran, in order.

done​
done: boolean;
reason?​
reason?: string;

Why it isn't done, in words the next attempt can act on. Read only when done is false.


ModeRunContext​

What a mode's instructions and done check are handed.

Extended by​

Properties​

attempt​
attempt: number;

Which attempt this is, as the board counted it.

branch​
branch: string;
ctx​
ctx: BlockContext;

The block context, so a builder can read its mode's collections.

epic​
epic: string;

The board's discriminator — see RunLocation.epic. A fixed board's id, or for a board read from the claim, its ledger id and partition digest (runBoardSegment).

feedback?​
feedback?: string;

Why the LAST attempt stopped, as the board captured it when fail() re-pended the row. This — not the run record — is the carry-forward: without it a deterministic failure replays and the retry budget burns for nothing.

issue​
issue: string;
mode​
mode: string;

The segment the run is keyed by: its mode's name, or the older one it was found under (ModeSpec.formerName).

trackerIssue​
trackerIssue: string | null;

The tracker issue the task names (ENG-142), or null when it names none. On a fixed board it is issue. On a board read from the claim, issue is the row's own id and this is the issue its harnessFeature key names, so a prompt can say what the work is for.

validated?​
validated?: unknown;

Whatever this mode's own ModeDone.validate returned, for THIS manager.

unknown because only the mode that produced it knows its shape — the manager carries it and never reads it. Absent when the mode has no validate.

workspacePath​
workspacePath: string;

The run's own checkout.


ModeSpec​

One mode: a name for how a coding run is told what to do and when it counts as done. A manager runs one.

Properties​

doneWhen​
doneWhen: ModeDone;

When the run counts as done.

formerName?​
formerName?: string;

The segment this mode's runs were stored under before it took name, when that differs. A run whose key under name is absent is looked up under this one, and a run found there finishes there: its branch, checkout, retries and session keep that segment. Nothing is copied or moved. Absent: there is no older key to read.

name​
name: string;

The mode's name: the last segment of its runs' keys (<epic>/<issue>/<name>), their branches and checkouts.

Methods​

instructions()​
instructions(run): string | Promise<string>;

The run's prompt, rebuilt on every wake from current state, never computed when the row was filed.

Parameters​
run​

PromptRunContext

Returns​

string | Promise<string>


OwnershipBounds​

How ownership is bounded. Sized against the renewal lag that causes overlap.

Properties​

pollMs​
pollMs: number;

How often to re-check.

staleAfterMs​
staleAfterMs: number;

A lock not marked live for this long belongs to a process that is gone.

Sized past the longest a live attempt goes without marking it — its run's silence window plus provisioning, since every event the run sends marks it (refreshCheckout) and a run silent for the window is stopped — so a lock is only ever declared stale once no live attempt could still be holding it.

waitMs​
waitMs: number;

How long to wait for a live holder to finish before failing the attempt.


PromptRunContext​

What a prompt builder gets on top of ModeRunContext: the task it was claimed for, and the two things the ask adds.

Separate from ModeRunContext rather than optional fields on it. The done-condition needs none of them, and a field that is sometimes absent is the silent-partial shape this lab exists to remove — a builder cannot tell "no answers" from "nobody read them" if the same undefined means both.

Extends​

Properties​

answers​
answers: readonly AnsweredQuestion[];

The task's answered questions, read from its row, oldest first: the questions it was filed with and the ones its runs asked, each paired with the person's answer. A question closed at a deadline with no answer is not here; its "no answer came" message reaches the run with the task's other messages. Read the same on a replay, and correct whether the coding session resumed or started cold.

askMarkerPath​
askMarkerPath: string;

Where THIS run must write a question if it has one: a new path for every run.

attempt​
attempt: number;

Which attempt this is, as the board counted it.

Inherited from​

ModeRunContext.attempt

branch​
branch: string;
Inherited from​

ModeRunContext.branch

ctx​
ctx: BlockContext;

The block context, so a builder can read its mode's collections.

Inherited from​

ModeRunContext.ctx

epic​
epic: string;

The board's discriminator — see RunLocation.epic. A fixed board's id, or for a board read from the claim, its ledger id and partition digest (runBoardSegment).

Inherited from​

ModeRunContext.epic

feedback?​
feedback?: string;

Why the LAST attempt stopped, as the board captured it when fail() re-pended the row. This — not the run record — is the carry-forward: without it a deterministic failure replays and the retry budget burns for nothing.

Inherited from​

ModeRunContext.feedback

issue​
issue: string;
Inherited from​

ModeRunContext.issue

mode​
mode: string;

The segment the run is keyed by: its mode's name, or the older one it was found under (ModeSpec.formerName).

Inherited from​

ModeRunContext.mode

replyFolder?​
replyFolder?: string;

Where THIS run writes its replies to review comments, one file each (./replies): set only when the manager has a poster (replies).

task​
task: Pick<z.infer<typeof taskWorkerInputSchema>, "goal" | "title" | "context" | "input" | "deps" | "priorWork">;

The task this attempt was claimed for, as the board packed it: its goal, and its title, context, input, deps and priorWork when the row has them. A field the row lacks is an absent key, never undefined.

The same on every attempt, so a retry or the attempt after a person's message starts from the same work. Build the prompt from this rather than from ModeRunContext.issue, which is only the row's identity. metadata is left out: it is the board's bookkeeping, not the brief.

A Pick of the board's worker-input schema, so its fields keep the board's names and there is no second field list to drift.

trackerIssue​
trackerIssue: string | null;

The tracker issue the task names (ENG-142), or null when it names none. On a fixed board it is issue. On a board read from the claim, issue is the row's own id and this is the issue its harnessFeature key names, so a prompt can say what the work is for.

Inherited from​

ModeRunContext.trackerIssue

validated?​
validated?: unknown;

Whatever this mode's own ModeDone.validate returned, for THIS manager.

unknown because only the mode that produced it knows its shape — the manager carries it and never reads it. Absent when the mode has no validate.

Inherited from​

ModeRunContext.validated

workspacePath​
workspacePath: string;

The run's own checkout.

Inherited from​

ModeRunContext.workspacePath


PullRequestRecordResourceState​

One resource in the session's pull-request record, as a screen holds it (observed-pull-requests).

Extended by​

Properties​

host?​
readonly host?: string | null;
number?​
readonly number?: number | null;
repository?​
readonly repository?: string | null;
state?​
readonly state?: string | null;
title?​
readonly title?: string | null;
url?​
readonly url?: string | null;

PullRequestWait​

What a task waits on while its pull requests are open.

Properties​

holdId​
readonly holdId: string;

The wait's hold id on the row.

prompt​
readonly prompt: string;

The words the wait was opened with.

pullRequests​
readonly pullRequests: readonly WaitedPullRequest[];
since​
readonly since: number;

When the wait opened, epoch ms.


PullRequestWaitInput​

The parts of a task pullRequestWait reads.

Properties​

holds?​
readonly holds?: readonly object[] | null;
status​
readonly status: string;
steers?​
readonly steers?: readonly object[] | null;

ReadReadinessOptions​

What HarnessReadinessRead.read is asked for.

Properties​

refresh?​
refresh?: string | boolean;

Run the checks again: every harness (true), or one by its key. Default: the kept rows.


ReplyDraft​

One reply a run drafted.

Properties​

body​
readonly body: string;

The rest, as written, without the blank lines around it.

file​
readonly file: string;

Its file's name in the run's folder.

readonly link: string;

Its first line: the link to the comment it answers.


RequestIdentityContext​

What the principal is read from — the request's authenticated identity, and nothing else.

Typed by what it READS rather than as a whole BlockContext, so any caller can pass its own narrower context without a cast. The casts were not free: an as unknown as escape hatch would silently accept a context that has no identity at all — on the one derivation where a missing identity means two principals sharing a checkout.

Properties​

request?​
request?: object;
identity?​
identity?: unknown;
user?​
user?: object;
identity?​
identity?: unknown;

ResolvedHarnessSessionStart​

What a workspace host's provision needs from a session's start (PlaceRequest and RepoRunSource).

Properties​

baseRef?​
readonly baseRef?: string;

Cut the session's branch from this ref (RepoRunSource.baseRef).

branch?​
readonly branch?: string;

Work on this existing branch instead of cutting the session's own (PlaceRequest.branch with existing).


ReviewReplyPoster​

The host's poster for a run's reply drafts (workforce's operatorGitHub(…).reviewReplies): it checks each draft and posts it, or says why not. The manager only reads the drafts and hands them over, with the pull requests recorded for the task's run and the task itself.

Properties​

resources?​
readonly resources?: Readonly<Record<string, DeclaredResourceEntry>>;

What post reads, declared on the step that runs it.

Methods​

post()​
post(
ctx,
drafts,
scope
): Promise<readonly object[]>;

Check and post each draft; each ends posted (its reply's link) or refused (why).

Parameters​
ctx​

BlockContext

drafts​

readonly ReplyDraft[]

scope​
pullRequests​

readonly object[]

task?​

{ metadata?: Readonly<Record<string, unknown>> | null; steers?: readonly object[] | null; }

task.metadata?​

Readonly<Record<string, unknown>> | null

task.steers?​

readonly object[] | null

Returns​

Promise<readonly object[]>


RunDiff​

What a run's commits changed, file by file.

Properties​

added​
added: number;

Lines added across every changed file, listed or not.

fileCount​
fileCount: number;

How many files changed, listed or not.

files​
files: RunDiffFile[];

Up to MAX_DIFF_FILES changed files, in git's order (by path).

removed​
removed: number;

Lines removed across every changed file, listed or not.

verified​
verified: boolean;

Git read the diff against a base. false when no base or no checkout could be read, and the diff is a fallback empty one.


RunDiffFile​

One file a run changed, and by how many lines.

Properties​

added​
added: number | null;

Lines added; null for a binary file, which git counts no lines in.

path​
path: string;

The file's path in the repository. A rename reads as the old path removed and the new one added.

removed​
removed: number | null;

Lines removed; null for a binary file.


RunFilePatch​

One file's patch, as a run's commits changed it.

Properties​

patch​
patch: string;

The unified diff of that file, cut at MAX_PATCH_CHARS. Empty when the run didn't change it.

path​
path: string;
truncated​
truncated: boolean;

The patch was longer than MAX_PATCH_CHARS and was cut.

verified​
verified: boolean;

As RunDiff.verified.


RunReport​

A run's report, read from its answer.

Properties​

changed​
changed: string | null;

What changed, in Markdown; null when the answer has no such section.

checks​
checks: RunReportCheck[];

Each check line, in order.

notes​
notes: string[];

Each "worth knowing" line, in Markdown.


RunReportCheck​

One check line of a run's report: how it ended, and the rest of the line in Markdown.

Properties​

status​
status: RunReportCheckStatus | null;

null when the line didn't start with one of the statuses.

text​
text: string;

The line after its status, such as "pnpm typecheck — no errors".


ScriptedHarnessOptions​

Options for scriptedHarness.

Properties​

mcpUses?​
mcpUses?: readonly CapabilityRef[];

Capabilities the slot holds when a host relays MCP tools (see harnessStub's mcpUses).

stepEveryMs​
stepEveryMs: number;

The pause before each scripted step, in milliseconds.


SessionDoorBoard​

The board a session's run may be on, as the host resolves it per request.

Properties​

runOf​
readonly runOf: (row) =>
| {
issue: string;
mode: {
formerName?: string;
name: string;
};
}
| undefined;

The issue and mode a row's run is keyed by, or undefined for a row no manager behind this door runs. A mode's formerName finds a run stored under it before the rename.

Parameters​
row​

Task

Returns​

| { issue: string; mode: { formerName?: string; name: string; }; } | undefined

tasks​
readonly tasks: TaskCollectionRef;

The board's rows, as the managers that ran them read them.


SessionPullRequest​

One pull request a run session's record holds, as readSessionPullRequests reads it: what a line draws.

Extends​

Properties​

host​
readonly host: string | null;

github.com, or a GitHub Enterprise host. null when the row names none.

Overrides​

PullRequestRecordResourceState.host

number​
readonly number: number;
Overrides​

PullRequestRecordResourceState.number

repository​
readonly repository: string | null;

owner/name. null when the row names none.

Overrides​

PullRequestRecordResourceState.repository

state​
readonly state: string | null;

GitHub's state when it was last seen (open, closed, merged), null when no sighting named one.

Overrides​

PullRequestRecordResourceState.state

title​
readonly title: string | null;
Overrides​

PullRequestRecordResourceState.title

url​
readonly url: string;

Its link on GitHub.

Overrides​

PullRequestRecordResourceState.url


StubRun​

One run the stub was asked to perform, exactly as it arrived.

Properties​

cwd​
cwd: string;

The directory the cwd feed resolved for this attempt.

prompt​
prompt: string;

The prompt the manager built.

resume​
resume: string | null;

The session id the resume feed offered, or null on a cold attempt.

session?​
session?: string;

The session id this run named through onSession. Set on every run the stub makes; optional so a host's own StubRun (a fixture) needs none.


StubToolCall​

One tool call the scripted run makes (toolCalls). Handed onToolApproval (a manager with approveTools), the run asks about it first: allowed, it runs; denied, it doesn't, and the run goes on; held, the run stops there unrun and waits to be stopped, as Claude Code's does. A resumed run makes a held call again, as a model told to does. Without the feed every call runs unasked, as under blanket permissions.

Properties​

input​
input: unknown;
run?​
run?: (run) => void | Promise<void>;

What the call does when it runs: write a marker file, say.

Parameters​
run​

StubRun

Returns​

void | Promise<void>

toolName​
toolName: string;

StubToolCallRecord​

What became of one scripted tool call, in the order the run made them.

Properties​

at​
at: number;

When the run made it (epoch ms).

decision​
decision: "allow" | "deny" | "held" | "unasked";

unasked: no approval feed was handed, and it ran.

input​
input: unknown;
run​
run: number;

Which run made it, as an index into runs.

toolName​
toolName: string;

ToolApprovalOutcome​

What a person's answer to a held call means for the run.

Properties​

grant​
grant:
| {
key: string;
scope: "run" | "once";
toolName: string;
}
| null;

The grant a yes leaves on the run, or null for a no.

prompt​
prompt: string;

The line the resumed session is handed.


WaitedPullRequest​

One pull request a task waits on.

Properties​

key​
readonly key: string;

Its key in the session's record.

number​
readonly number: number | null;

Its number, from the record, else from the key. null when neither says.

title​
readonly title: string | null;
url​
readonly url: string | null;

Its link, when the record has the row.

Type Aliases​

CommandCheckCommands​

type CommandCheckCommands<TContext> =
| readonly string[]
| ((context) => readonly string[] | Promise<readonly string[]>);

The commands to run: a list, or a resolver the run's context is handed (projectChecks()). With inBrief, a resolver is also called when the brief is built, where stopReport, answer and baseCommit are null: it must not read them to leave a check out.

Type Parameters​

TContext​

TContext


CommandCheckResult​

type CommandCheckResult = CheckoutCommandResult;

HarnessJudgeInput​

type HarnessJudgeInput = z.infer<typeof harnessJudgeInputSchema>;

HarnessJudgeVerdict​

type HarnessJudgeVerdict = z.infer<typeof harnessJudgeVerdictSchema>;

HarnessLedgers​

type HarnessLedgers = (ledgerId, ctx, partition) => Promise<TaskCollectionRef | undefined>;

Finds a board by the ledger id and partition a task's claim names, or answers undefined for a board this manager may not read. Typed as orchestration's taskLedgers resolver, so one function can serve both.

Resolve against ctx, at the running user's scope, never from a process-wide map: the ledger id and partition arrive on the manager's input, and the row the returned ref holds is what the attempt fence then checks.

Parameters​

ledgerId​

string

ctx​

BlockContext

partition​

string | undefined

Returns​

Promise<TaskCollectionRef | undefined>


HarnessReadinessView​

type HarnessReadinessView = z.infer<typeof harnessReadinessViewSchema>;

HarnessReadinessViewDefinition​

type HarnessReadinessViewDefinition = ViewDefinition<BlockDefinition<typeof readinessViewInputSchema, typeof readinessViewOutputSchema>, "user">;

The readiness view, as harnessReadinessView builds it. Import as a type in client code.


HarnessReviewAnswer​

type HarnessReviewAnswer = z.infer<typeof harnessReviewAnswerSchema>;

HarnessSessionStart​

type HarnessSessionStart = z.infer<typeof harnessSessionStartSchema>;

Where a session starts.


HarnessSessionState​

type HarnessSessionState = z.infer<typeof harnessSessionStateSchema>;

A harness session's state, as a page reads it from clientData.session.


HarnessSessionWorkspaceRecord​

type HarnessSessionWorkspaceRecord = z.infer<typeof harnessSessionWorkspaceRecordSchema>;

Where a session works.


HarnessSlot​

type HarnessSlot = (feeds) => HarnessBlock;

The harness option: a factory the manager calls once with HarnessFeeds.

Returns a block conforming to the harness contract — HarnessBlock is core's alias, and this slot is what makes that alias earn its place.

Parameters​

feeds​

HarnessFeeds

Returns​

HarnessBlock


HarnessTurnRecord​

type HarnessTurnRecord = z.infer<typeof harnessTurnRecordSchema>;

One turn's record.


HarnessUsageState​

type HarnessUsageState = z.infer<typeof harnessUsageStateSchema>;

HarnessUsageViewDefinition​

type HarnessUsageViewDefinition = ViewDefinition<BlockDefinition<typeof usageViewInputSchema, typeof usageViewOutputSchema>, "user">;

The usage view, as harnessUsageFlow builds it. Import as a type in client code.


HarnessUsageWindowView​

type HarnessUsageWindowView = z.infer<typeof storedUsageWindowSchema> & object;

One window as the query returns it: the stored reading, its age, and whether its reset has passed.

Type Declaration​

ageMs​
ageMs: number;
rolledOver​
rolledOver: boolean;

HeldRecord​

type HeldRecord = z.infer<typeof heldSchema>;

HeldToolCall​

type HeldToolCall = z.infer<typeof heldToolCallSchema>;

IssueSpecOption​

type IssueSpecOption = boolean | IssueSpecOptions;

An entry's issueSpec option: true for the defaults, or the options. Absent or false is off.


PlaceStatus​

type PlaceStatus = z.infer<typeof placeStatusSchema>;

RunChanges​

type RunChanges = z.infer<typeof runChangesSchema>;

What a changes read answers.


RunOwner​

type RunOwner = z.infer<typeof runOwnerSchema>;

Who a run belongs to, as recorded on its row.


RunRecordState​

type RunRecordState = z.infer<typeof runRecordStateSchema>;

RunReportCheckStatus​

type RunReportCheckStatus = "passed" | "failed" | "pre-existing" | "not done";

How a check the run reports ended, as the line's first word(s) say it.


SessionDoorRefusalReason​

type SessionDoorRefusalReason = "not-started" | "cannot-continue" | "task-running" | LineSteerRefusal;

Why the door refused a line. The steer refusals (steer-limit, finished, not-supported) read as they do on every door that takes a line. task-running is a talk turn's alone: a message about a task still open, which never steers it.


ToolGrant​

type ToolGrant = z.infer<typeof toolGrantSchema>;

UsageWrite​

type UsageWrite = "recorded" | "kept-stored" | "refused-older";

What recordHarnessUsage did with a reading or a run window.

Variables​

ALLOW_FOR_RUN​

const ALLOW_FOR_RUN: object;

The extra yes the stop offers, under data.approveOptions: the label a card shows and the data its yes sends. Read by any approval card that draws a stop's approveOptions (the registry's approval card does).

Type Declaration​

data​
readonly data: object;
data.scope​
readonly scope: "run";
label​
readonly label: "Allow for this run";

ASK_MARKER_DIR​

const ASK_MARKER_DIR: string;

The directory, relative to the checkout, the marker lives in.


ASK_MARKER_IGNORE_RULE​

const ASK_MARKER_IGNORE_RULE: "**/.fsdev/" = "**/.fsdev/";

The .gitignore line a target repository needs, spelled once.

It appears in the refusal a run gets, in the test fixture's repository, and in the assertions on both — three copies that have to agree, and a refusal naming a rule the fixture does not use is a message that has been wrong without anything failing.

Double-star rather than root-anchored: it matches at any depth, so the rule keeps covering the marker if the checkout layout ever nests.


ASK_MARKER_IGNORED​

const ASK_MARKER_IGNORED: IgnoredDirectory;

The directory a run writes its question into, which no repository may commit (see ./ask). Handed to the workspace host on every provision, so a checkout whose repository would commit a question is refused before the agent runs, on a reused branch as well as a new one.


CLOSED_WITHOUT_MERGING​

const CLOSED_WITHOUT_MERGING: "its pull request was closed without merging" = "its pull request was closed without merging";

The reason a task whose pull requests all closed without merging is cancelled with (D2).


commandCheckResultSchema​

const commandCheckResultSchema: z.ZodObject<{
command: z.ZodString;
durationMs: z.ZodNumber;
exitCode: z.ZodNullable<z.ZodNumber>;
skipped: z.ZodBoolean;
tail: z.ZodString;
timedOut: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
command: string;
durationMs: number;
exitCode: number | null;
skipped: boolean;
tail: string;
timedOut: boolean;
}, {
command: string;
durationMs: number;
exitCode: number | null;
skipped: boolean;
tail: string;
timedOut: boolean;
}>;

One check's result, as it is recorded: the command, how it ended, and the end of its output.


DONE_STOP_GRACE_MS​

const DONE_STOP_GRACE_MS: 5000 = 5000;

How long the manager waits, after the completion check's time is up and its signal aborted, for the check to stop before it lets the checkout go.


GOAL_JUDGE_FLOOR​

const GOAL_JUDGE_FLOOR: 0.7 = 0.7;

The confidence a not done or ask must reach to count unless a host names another.


GOAL_JUDGE_MODEL​

const GOAL_JUDGE_MODEL: "typesafe-ai/jev" = "typesafe-ai/jev";

The evaluation model the judge runs on unless a host names another.


GOAL_JUDGE_QUESTION​

const GOAL_JUDGE_QUESTION: "verdict" = "verdict";

The id of the verdict question and of the question that says why, as the model is asked them.


GOAL_JUDGE_WHY_QUESTION​

const GOAL_JUDGE_WHY_QUESTION: "why" = "why";

@flow-state-dev/harness-manager — a task-board row becomes a supervised coding run.

One dispatched worker on a board:

open the run row → build the prompt & take the checkout → run the harness → read the verdict → settle or fail

The harness is a slot, not a dependency. This package imports no coding agent and reads no vendor field: the host hands it a factory, the manager calls that factory once with the four feeds the harness contract declares (@flow-state-dev/core), and a Codex run and a Claude Code run settle identically because the verdict is read off the neutral handle.

The export surface has two halves, and the difference matters​

Supported host API — what you need to stand a manager up, and what this package versions:

  • harnessManager and its options, including the harness slot.
  • goalJudge, a ready-made judge: an evaluation model reads a run's answer and commits against its task's goal.
  • harnessSessionDoor, the door a coding flow declares for a line typed in a run's session: a steer while its task is open, talk once it has finished. harnessTalkTurn is its talk half, which a coder also runs for a message about a finished task.
  • harnessSessionFlow, a coding harness as one long-lived session a person talks to: the host says where sessions work and which harness runs. harnessStub, a scripted harness for the slot, for checks that run no model.
  • upgradeKeptTurns, the upgrade's one-off step that writes a line the coding door kept before lines became steers onto its task as a steer.
  • runOwnerClaimOrder, for a board kept per organization: a run belongs to the member who started it, and another member's drain leaves it alone.
  • followUpChainClaimOrder, for any other board a manager drains: a task waits, unclaimed, while another task of its follow-up chain runs.
  • ModeSpec (a mode: its name, instructions and done check) and the run-context types its hooks are handed: the shared base, plus the prompt side and the completion side.
  • The construction-time guards a host should run at its own door (assertDistinctRepository, assertBaseRefExists, assertCheckoutRootUsable, assertPositiveInt).
  • harnessDrainBudgetMs and resolveOwnership, because a host sizing its own shutdown needs the same numbers the manager enforces.
  • The run record collection, so a host can build a status surface. A run's question holds its task on the board, so a host reads questions there.
  • harnessReadiness, which harnesses can run on this machine, read once at start and again on request, with its user-scope view, its action, its coordinator context capability and its formatter.
  • harnessUsageFlow, the flow a host registers to serve how much of each harness's subscription a person has used: its view and its Re-check, and the collection behind them.
  • harnessRunChangesView, the session view of what a run's commits changed: each file and its lines, or one file's patch. A run review's data carries the same files; harnessSessionFlow declares the same view per turn.

Checkout internals are NOT here. They live behind @flow-state-dev/harness-manager/checkout, a separate entry point, because semver binds what this file exports regardless of what a header says about it. They are git-worktree-specific; adopt harnessManager({ harness }) and let it own the checkout.


HARNESS_RUN_OWNER_KEY​

const HARNESS_RUN_OWNER_KEY: "harnessRunOwner" = "harnessRunOwner";

The metadata key the owner is recorded under. Pinned: a status surface reads it, and rows written before a rename would stop being recognised.


HARNESS_SESSION_APPROVALS_NEED_DURABLE​

const HARNESS_SESSION_APPROVALS_NEED_DURABLE: string;

The message a turn with approvals on is refused with on a host without durable execution.


HARNESS_SESSION_ATTACH_MISSING​

const HARNESS_SESSION_ATTACH_MISSING: "The session this one attaches to (`start.worktreeOf`) has no worktree here: it is not this tenant's, was never provisioned, or was removed." = "The session this one attaches to (`start.worktreeOf`) has no worktree here: it is not this tenant's, was never provisioned, or was removed.";

The message an attaching session is refused with when the worktree it names isn't there.


HARNESS_SESSION_ATTACH_NOT_PROVISIONED​

const HARNESS_SESSION_ATTACH_NOT_PROVISIONED: "An attaching start (`{ worktreeOf }`) provisions nothing: the session works in the owner's worktree." = "An attaching start (`{ worktreeOf }`) provisions nothing: the session works in the owner's worktree.";

The message an attaching start is refused with when something asks a workspace to provision it.


HARNESS_SESSION_ATTACH_NOT_YOURS​

const HARNESS_SESSION_ATTACH_NOT_YOURS: "The worktree this session attaches to (`start.worktreeOf`) is not in your list of worktrees: only your own sessions' worktrees can be attached to, on a host that keeps that list." = "The worktree this session attaches to (`start.worktreeOf`) is not in your list of worktrees: only your own sessions' worktrees can be attached to, on a host that keeps that list.";

The message an attaching session is refused with when the worktree isn't in its user's own list.


HARNESS_SESSION_ATTACHED_BRANCH_CHANGED​

const HARNESS_SESSION_ATTACHED_BRANCH_CHANGED: "This session is attached to another session's worktree and may not change its branch." = "This session is attached to another session's worktree and may not change its branch.";

The error an attached turn records when it left the shared worktree on another branch.


HARNESS_SESSION_FAILED_OUTCOME​

const HARNESS_SESSION_FAILED_OUTCOME: "The harness reported the run as failed." = "The harness reported the run as failed.";

The error a turn records when the harness returned a run it reports as failed and gave no words for it. Core's handle carries no failure text, so a harness's own words come from its handle's failureMessage when it has one (Codex and Cursor do); this is the fallback when it hasn't.


HARNESS_SESSION_ISSUE_REFUSED​

const HARNESS_SESSION_ISSUE_REFUSED: "A session's `state.issue` is refused. An issue is a tracker key such as ENG-142: letters and digits joined by single - or _, at most 64 characters." = "A session's `state.issue` is refused. An issue is a tracker key such as ENG-142: letters and digits joined by single - or _, at most 64 characters.";

The message a create naming a malformed issue is refused with.


HARNESS_SESSION_MODEL_REQUIRED​

const HARNESS_SESSION_MODEL_REQUIRED: "A new session must name the model it runs (`state.model`)." = "A new session must name the model it runs (`state.model`).";

The message a create without a model is refused with.


HARNESS_SESSION_REMOVE_NOT_OWNER​

const HARNESS_SESSION_REMOVE_NOT_OWNER: "This session works in another session's worktree (`start.worktreeOf`); only that session removes it." = "This session works in another session's worktree (`start.worktreeOf`); only that session removes it.";

The message removeWorktree is refused with on a session that doesn't own its worktree.


HARNESS_SESSION_REMOVE_UNSUPPORTED​

const HARNESS_SESSION_REMOVE_UNSUPPORTED: "This host's workspace does not remove worktrees." = "This host's workspace does not remove worktrees.";

The message removeWorktree is refused with on a host that removes nothing.


HARNESS_SESSION_START_INVALID​

const HARNESS_SESSION_START_INVALID: "A session's start (`state.start`) is exactly one of { base: <ref> }, { branch: <name> }, { pullRequest: <number> } or { worktreeOf: <session id> }." = "A session's start (`state.start`) is exactly one of { base: <ref> }, { branch: <name> }, { pullRequest: <number> } or { worktreeOf: <session id> }.";

The message a create with a malformed start is refused with.


HARNESS_SESSION_TURN_WAITS_ON_APPROVAL​

const HARNESS_SESSION_TURN_WAITS_ON_APPROVAL: "Another turn of this session is waiting for an answer about a tool call. Answer or stop that turn, then send this one." = "Another turn of this session is waiting for an answer about a tool call. Answer or stop that turn, then send this one.";

The message a turn is refused with while another turn of its session waits on a tool approval. The wait gives back the session's turn slot, and a turn run then would work in the checkout and conversation the waiting one resumes.


HARNESS_USAGE​

const HARNESS_USAGE: "harness-usage";

Accessor key and storage prefix for the usage record.


HARNESS_USAGE_FLOW​

const HARNESS_USAGE_FLOW: "harness-usage";

The flow a host installs to serve usage (harnessUsageFlow), and the collection's runBy: a client's Re-check runs here.


harnessClaimSchema​

const harnessClaimSchema: z.ZodObject<{
collectionId: z.ZodString;
incarnationId: z.ZodOptional<z.ZodString>;
partition: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
collectionId: string;
incarnationId?: string;
partition?: string;
}, {
collectionId: string;
incarnationId?: string;
partition?: string;
}>;

The board a task was claimed on, as the trusted entry adapter hands it to the manager: the gate's verified ticket's ledger id and partition, and its incarnation when the adapter passes it.

Server-supplied, and still never trusted by itself. The adapter copies it from the gate's ticket, never from the task. The manager resolves the board through its ledgers resolver at the running user's scope, and then requires the row there to be this task, on this attempt, still running (and of this incarnation, when one is named) before it opens a run, and again on every write. A claim naming another board fails that check.


harnessJudgeInputSchema​

const harnessJudgeInputSchema: z.ZodObject<{
answer: z.ZodNullable<z.ZodString>;
commits: z.ZodObject<{
count: z.ZodNumber;
subjects: z.ZodArray<z.ZodString, "many">;
}, "strip", z.ZodTypeAny, {
count: number;
subjects: string[];
}, {
count: number;
subjects: string[];
}>;
diff: z.ZodDefault<z.ZodNullable<z.ZodObject<{
added: z.ZodNumber;
fileCount: z.ZodNumber;
files: z.ZodArray<z.ZodObject<{
added: z.ZodNullable<z.ZodNumber>;
path: z.ZodString;
removed: z.ZodNullable<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
added: number | null;
path: string;
removed: number | null;
}, {
added: number | null;
path: string;
removed: number | null;
}>, "many">;
removed: z.ZodNumber;
verified: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}, {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}>>>;
goal: z.ZodString;
}, "strip", z.ZodTypeAny, {
answer: string | null;
commits: {
count: number;
subjects: string[];
};
diff: | {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}
| null;
goal: string;
}, {
answer: string | null;
commits: {
count: number;
subjects: string[];
};
diff?: | {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}
| null;
goal: string;
}>;

What a HarnessJudge's block is handed: the task, the run's answer, its commits, and what they changed.


harnessJudgeVerdictSchema​

const harnessJudgeVerdictSchema: z.ZodObject<{
confidence: z.ZodNumber;
reason: z.ZodString;
verdict: z.ZodEnum<["done", "not-done", "ask"]>;
}, "strip", z.ZodTypeAny, {
confidence: number;
reason: string;
verdict: "ask" | "done" | "not-done";
}, {
confidence: number;
reason: string;
verdict: "ask" | "done" | "not-done";
}>;

What a HarnessJudge's block answers. done closes the task; not-done fails the attempt with reason as the next attempt's feedback; ask holds the task on reason as a question. A not-done or ask under the judge's floor counts as done.


harnessManagerInputSchema​

const harnessManagerInputSchema: z.ZodObject<object & object, "strip", z.ZodTypeAny, {
attachments?: object[];
attempts: number;
claim?: {
collectionId: string;
incarnationId?: string;
partition?: string;
};
context?: string;
deps?: Record<string, unknown>;
feedback?: string;
followUpOf?: string;
goal: string;
input?: unknown;
metadata?: Record<string, unknown>;
priorWork?: unknown;
sealed?: Record<string, unknown>;
steers?: object[];
taskId: string;
title?: string;
}, {
attachments?: object[];
attempts: number;
claim?: {
collectionId: string;
incarnationId?: string;
partition?: string;
};
context?: string;
deps?: Record<string, unknown>;
feedback?: string;
followUpOf?: string;
goal: string;
input?: unknown;
metadata?: Record<string, unknown>;
priorWork?: unknown;
sealed?: Record<string, unknown>;
steers?: object[];
taskId: string;
title?: string;
}>;

The manager's input: the board's worker input, plus the claim a board read from the claim names.


harnessReadinessViewSchema​

const harnessReadinessViewSchema: z.ZodObject<{
checkedAt: z.ZodNumber;
harness: z.ZodString;
label: z.ZodString;
ready: z.ZodBoolean;
reason: z.ZodNullable<z.ZodString>;
remedy: z.ZodNullable<z.ZodString>;
unanswered: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
checkedAt: number;
harness: string;
label: string;
ready: boolean;
reason: string | null;
remedy: string | null;
unanswered: boolean;
}, {
checkedAt: number;
harness: string;
label: string;
ready: boolean;
reason: string | null;
remedy: string | null;
unanswered: boolean;
}>;

One harness's readiness, as last read.


harnessReviewAnswerSchema​

const harnessReviewAnswerSchema: z.ZodDiscriminatedUnion<"verdict", [z.ZodObject<{
land: z.ZodOptional<z.ZodEnum<["pull-request", "merge"]>>;
verdict: z.ZodLiteral<"accepted">;
words: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
land?: "merge" | "pull-request";
verdict: "accepted";
words?: string;
}, {
land?: "merge" | "pull-request";
verdict: "accepted";
words?: string;
}>, z.ZodObject<{
verdict: z.ZodLiteral<"revise">;
words: z.ZodString;
}, "strip", z.ZodTypeAny, {
verdict: "revise";
words: string;
}, {
verdict: "revise";
words: string;
}>]>;

A person's answer to the review of a run's changes: accept them, or ask for changes in words. An accept may name how the work lands (land): pull-request pushes the run's branch and opens a pull request; merge merges it into the base branch of the person's checkout. Offered only on a host that can land (WorkspaceHost.land), as the review's data.lands.


harnessRunChangesInputSchema​

const harnessRunChangesInputSchema: z.ZodObject<{
path: z.ZodOptional<z.ZodString>;
taskId: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
path?: string;
taskId?: string;
}, {
path?: string;
taskId?: string;
}>;

What the changes view takes: optionally which of the session's tasks, and optionally one file.


harnessRunChangesOutputSchema​

const harnessRunChangesOutputSchema: z.ZodObject<object & object, "strip", z.ZodTypeAny, {
diff: | {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}
| null;
patch: | {
patch: string;
path: string;
truncated: boolean;
verified: boolean;
}
| null;
taskId: string;
}, {
diff: | {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}
| null;
patch: | {
patch: string;
path: string;
truncated: boolean;
verified: boolean;
}
| null;
taskId: string;
}>;

What the changes view answers: the task it read, and the diff or the one file's patch.


harnessSessionStartSchema​

const harnessSessionStartSchema: z.ZodUnion<[z.ZodObject<{
base: z.ZodString;
}, "strict", z.ZodTypeAny, {
base: string;
}, {
base: string;
}>, z.ZodObject<{
branch: z.ZodString;
}, "strict", z.ZodTypeAny, {
branch: string;
}, {
branch: string;
}>, z.ZodObject<{
pullRequest: z.ZodNumber;
}, "strict", z.ZodTypeAny, {
pullRequest: number;
}, {
pullRequest: number;
}>, z.ZodObject<{
worktreeOf: z.ZodString;
}, "strict", z.ZodTypeAny, {
worktreeOf: string;
}, {
worktreeOf: string;
}>]>;

Where a session starts, picked at create: exactly one of

  • base: cut a new branch from this ref (origin/main is fetched first),
  • branch: work on this existing branch, as it stands,
  • pullRequest: work on this pull request's head branch,
  • worktreeOf: work in this other session's worktree, on its branch, making neither (attaching). The session is the same user's and tenant's, of the same flow.

harnessSessionStateSchema​

const harnessSessionStateSchema: z.ZodObject<{
binding: z.ZodDefault<z.ZodNullable<z.ZodObject<{
confirmed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
confirmed: string | null;
}, {
confirmed?: string | null;
}>>>;
issue: z.ZodReadonly<z.ZodOptional<z.ZodString>>;
model: z.ZodReadonly<z.ZodOptional<z.ZodString>>;
start: z.ZodReadonly<z.ZodOptional<z.ZodUnion<[z.ZodObject<{
base: z.ZodString;
}, "strict", z.ZodTypeAny, {
base: string;
}, {
base: string;
}>, z.ZodObject<{
branch: z.ZodString;
}, "strict", z.ZodTypeAny, {
branch: string;
}, {
branch: string;
}>, z.ZodObject<{
pullRequest: z.ZodNumber;
}, "strict", z.ZodTypeAny, {
pullRequest: number;
}, {
pullRequest: number;
}>, z.ZodObject<{
worktreeOf: z.ZodString;
}, "strict", z.ZodTypeAny, {
worktreeOf: string;
}, {
worktreeOf: string;
}>]>>>;
turns: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
asked: z.ZodDefault<z.ZodNullable<z.ZodString>>;
at: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
base: z.ZodDefault<z.ZodNullable<z.ZodString>>;
checks: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodObject<..., ..., ..., ..., ...>, "many">>>;
confirmed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
endedAt: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
error: z.ZodDefault<z.ZodNullable<z.ZodString>>;
failure: z.ZodDefault<z.ZodNullable<z.ZodString>>;
head: z.ZodDefault<z.ZodNullable<z.ZodString>>;
setup: z.ZodDefault<z.ZodNullable<z.ZodObject<{
state: ...;
tail: ...;
}, "strip", z.ZodTypeAny, {
state: ...;
tail: ...;
}, {
state: ...;
tail?: ...;
}>>>;
spend: z.ZodDefault<z.ZodNullable<z.ZodObject<{
costUsd: ...;
harness: ...;
inputTokens: ...;
live: ...;
model: ...;
outputTokens: ...;
unreported: ...;
}, "strip", z.ZodTypeAny, {
costUsd?: ...;
harness: ...;
inputTokens: ...;
live: ...;
model: ...;
outputTokens: ...;
unreported: ...;
}, {
costUsd?: ...;
harness: ...;
inputTokens: ...;
live: ...;
model: ...;
outputTokens: ...;
unreported: ...;
}>>>;
steered: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
stopped: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
timedOut: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
waitsOnApproval: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
}, "strip", z.ZodTypeAny, {
asked: string | null;
at: number | null;
base: string | null;
checks: object[] | null;
confirmed: string | null;
endedAt: number | null;
error: string | null;
failure: string | null;
head: string | null;
setup: | {
state: "done" | "failed" | "running";
tail: string | null;
}
| null;
spend: | {
costUsd?: number | null;
harness: string | null;
inputTokens: number | null;
live: boolean;
model: string | null;
outputTokens: number | null;
unreported: boolean;
}
| null;
steered: string[] | null;
stopped: boolean | null;
timedOut: boolean | null;
waitsOnApproval: boolean | null;
}, {
asked?: string | null;
at?: number | null;
base?: string | null;
checks?: object[] | null;
confirmed?: string | null;
endedAt?: number | null;
error?: string | null;
failure?: string | null;
head?: string | null;
setup?: | {
state: "done" | "failed" | "running";
tail?: string | null;
}
| null;
spend?: | {
costUsd?: number | null;
harness: string | null;
inputTokens: number | null;
live: boolean;
model: string | null;
outputTokens: number | null;
unreported: boolean;
}
| null;
steered?: string[] | null;
stopped?: boolean | null;
timedOut?: boolean | null;
waitsOnApproval?: boolean | null;
}>>>>;
workspace: z.ZodDefault<z.ZodNullable<z.ZodObject<{
worktree: z.ZodDefault<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
worktree: string | null;
}, {
worktree?: string | null;
}>>>;
}, "strip", z.ZodTypeAny, {
binding: | {
confirmed: string | null;
}
| null;
issue?: string;
model?: string;
start?: | Readonly<{
base: string;
}>
| Readonly<{
branch: string;
}>
| Readonly<{
pullRequest: number;
}>
| Readonly<{
worktreeOf: string;
}>;
turns: | Record<string, {
asked: string | null;
at: number | null;
base: string | null;
checks: object[] | null;
confirmed: string | null;
endedAt: number | null;
error: string | null;
failure: string | null;
head: string | null;
setup: | {
state: "done" | "failed" | "running";
tail: string | null;
}
| null;
spend: | {
costUsd?: number | null;
harness: string | null;
inputTokens: number | null;
live: boolean;
model: string | null;
outputTokens: number | null;
unreported: boolean;
}
| null;
steered: string[] | null;
stopped: boolean | null;
timedOut: boolean | null;
waitsOnApproval: boolean | null;
}>
| null;
workspace: | {
worktree: string | null;
}
| null;
}, {
binding?: | {
confirmed?: string | null;
}
| null;
issue?: string;
model?: string;
start?: | Readonly<{
base: string;
}>
| Readonly<{
branch: string;
}>
| Readonly<{
pullRequest: number;
}>
| Readonly<{
worktreeOf: string;
}>;
turns?: | Record<string, {
asked?: string | null;
at?: number | null;
base?: string | null;
checks?: object[] | null;
confirmed?: string | null;
endedAt?: number | null;
error?: string | null;
failure?: string | null;
head?: string | null;
setup?: | {
state: "done" | "failed" | "running";
tail?: string | null;
}
| null;
spend?: | {
costUsd?: number | null;
harness: string | null;
inputTokens: number | null;
live: boolean;
model: string | null;
outputTokens: number | null;
unreported: boolean;
}
| null;
steered?: string[] | null;
stopped?: boolean | null;
timedOut?: boolean | null;
waitsOnApproval?: boolean | null;
}>
| null;
workspace?: | {
worktree?: string | null;
}
| null;
}>;

A harness session's state. model is the person's pick, set when the session is created and never after. The other two are written only by the session flow's own resolvers, never by a caller (serverOwned).


harnessSessionWorkspaceRecordSchema​

const harnessSessionWorkspaceRecordSchema: z.ZodObject<{
worktree: z.ZodDefault<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
worktree: string | null;
}, {
worktree?: string | null;
}>;

Where a session works: a pointer to its worktree's row in the user's list (worktreesCollection), which owns the path, branch, base, commit count, owner and state. Nothing of the worktree is copied here, so the row is the one owner. A record stored before this shape held copies of the path and branch; they are dropped on read.


harnessTalkInputSchema​

const harnessTalkInputSchema: z.ZodObject<{
message: z.ZodString;
}, "strip", z.ZodTypeAny, {
message: string;
}, {
message: string;
}>;

What a talk turn takes: the text the coding session is resumed with.


harnessTalkOutputSchema​

const harnessTalkOutputSchema: z.ZodObject<{
reply: z.ZodNullable<z.ZodString>;
taskId: z.ZodString;
}, "strip", z.ZodTypeAny, {
reply: string | null;
taskId: string;
}, {
reply: string | null;
taskId: string;
}>;

What a talk turn answers: the coding session's reply, and the task it was about.


harnessTaskInputSchema​

const harnessTaskInputSchema: z.ZodObject<{
issue: z.ZodString;
phase: z.ZodString;
}, "strip", z.ZodTypeAny, {
issue: string;
phase: string;
}, {
issue: string;
phase: string;
}>;

The typed payload a conductor task carries. Not model-writable — see ./workspace.


harnessTurnChangesInputSchema​

const harnessTurnChangesInputSchema: z.ZodObject<{
path: z.ZodOptional<z.ZodString>;
turn: z.ZodString;
}, "strip", z.ZodTypeAny, {
path?: string;
turn: string;
}, {
path?: string;
turn: string;
}>;

What the changes read takes: the turn, by its request id, and optionally one file.


harnessTurnRecordSchema​

const harnessTurnRecordSchema: z.ZodObject<{
asked: z.ZodDefault<z.ZodNullable<z.ZodString>>;
at: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
base: z.ZodDefault<z.ZodNullable<z.ZodString>>;
checks: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodObject<{
command: z.ZodString;
durationMs: z.ZodNumber;
exitCode: z.ZodNullable<z.ZodNumber>;
skipped: z.ZodBoolean;
tail: z.ZodString;
timedOut: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
command: string;
durationMs: number;
exitCode: number | null;
skipped: boolean;
tail: string;
timedOut: boolean;
}, {
command: string;
durationMs: number;
exitCode: number | null;
skipped: boolean;
tail: string;
timedOut: boolean;
}>, "many">>>;
confirmed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
endedAt: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
error: z.ZodDefault<z.ZodNullable<z.ZodString>>;
failure: z.ZodDefault<z.ZodNullable<z.ZodString>>;
head: z.ZodDefault<z.ZodNullable<z.ZodString>>;
setup: z.ZodDefault<z.ZodNullable<z.ZodObject<{
state: z.ZodEnum<["running", "done", "failed"]>;
tail: z.ZodDefault<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
state: "done" | "failed" | "running";
tail: string | null;
}, {
state: "done" | "failed" | "running";
tail?: string | null;
}>>>;
spend: z.ZodDefault<z.ZodNullable<z.ZodObject<{
costUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
harness: z.ZodNullable<z.ZodString>;
inputTokens: z.ZodNullable<z.ZodNumber>;
live: z.ZodBoolean;
model: z.ZodNullable<z.ZodString>;
outputTokens: z.ZodNullable<z.ZodNumber>;
unreported: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
costUsd?: number | null;
harness: string | null;
inputTokens: number | null;
live: boolean;
model: string | null;
outputTokens: number | null;
unreported: boolean;
}, {
costUsd?: number | null;
harness: string | null;
inputTokens: number | null;
live: boolean;
model: string | null;
outputTokens: number | null;
unreported: boolean;
}>>>;
steered: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
stopped: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
timedOut: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
waitsOnApproval: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
}, "strip", z.ZodTypeAny, {
asked: string | null;
at: number | null;
base: string | null;
checks: object[] | null;
confirmed: string | null;
endedAt: number | null;
error: string | null;
failure: string | null;
head: string | null;
setup: | {
state: "done" | "failed" | "running";
tail: string | null;
}
| null;
spend: | {
costUsd?: number | null;
harness: string | null;
inputTokens: number | null;
live: boolean;
model: string | null;
outputTokens: number | null;
unreported: boolean;
}
| null;
steered: string[] | null;
stopped: boolean | null;
timedOut: boolean | null;
waitsOnApproval: boolean | null;
}, {
asked?: string | null;
at?: number | null;
base?: string | null;
checks?: object[] | null;
confirmed?: string | null;
endedAt?: number | null;
error?: string | null;
failure?: string | null;
head?: string | null;
setup?: | {
state: "done" | "failed" | "running";
tail?: string | null;
}
| null;
spend?: | {
costUsd?: number | null;
harness: string | null;
inputTokens: number | null;
live: boolean;
model: string | null;
outputTokens: number | null;
unreported: boolean;
}
| null;
steered?: string[] | null;
stopped?: boolean | null;
timedOut?: boolean | null;
waitsOnApproval?: boolean | null;
}>;

What one turn asked for and what came of it, recorded under its request id.


harnessUsageCollection​

const harnessUsageCollection: object & ResourceCollectionConfig & object;

The collection. llmWritable: false: the writer below is its only writer. A client writes it only through Re-check, which HARNESS_USAGE_FLOW runs (runBy), and reads it through that flow's view, which adds each age.

Type Declaration​

client​
readonly client: object;
client.state​
readonly state: object;
client.state.read​
readonly read: true;
flowIsolation​
readonly flowIsolation: false;
llmWritable​
readonly llmWritable: false;
pattern​
readonly pattern: "harness-usage/**";
prefetchMode​
readonly prefetchMode: "lazy";
runBy​
readonly runBy: object;
runBy.flow​
flow: "harness-usage";
scope​
readonly scope: "user";
secret​
readonly secret: readonly ["account", "accountAt", "noSubscriptionAt", "lastAttemptAt"];
stateSchema​
readonly stateSchema: z.ZodObject<{
account: z.ZodDefault<z.ZodNullable<z.ZodString>>;
accountAt: z.ZodDefault<z.ZodNumber>;
checkedAt: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
lastAttemptAt: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
noSubscriptionAt: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
plan: z.ZodDefault<z.ZodNullable<z.ZodString>>;
reason: z.ZodDefault<z.ZodNullable<z.ZodString>>;
refreshError: z.ZodDefault<z.ZodNullable<z.ZodString>>;
status: z.ZodDefault<z.ZodEnum<["windows", "api-key", "signed-out", "unavailable"]>>;
windows: z.ZodDefault<z.ZodArray<z.ZodObject<object & object, "strip", z.ZodTypeAny, {
checkedAt: number;
id: string;
label: string | null;
level: "ok" | "reached" | "warning" | null;
minutes: number | null;
origin: "read" | "run";
resetsAt: number | null;
usedPercent: number | null;
}, {
checkedAt: number;
id: string;
label?: string | null;
level?: "ok" | "reached" | "warning" | null;
minutes?: number | null;
origin?: "read" | "run";
resetsAt?: number | null;
usedPercent: number | null;
}>, "many">>;
}, "strip", z.ZodTypeAny, {
account: string | null;
accountAt: number;
checkedAt: number | null;
lastAttemptAt: number | null;
noSubscriptionAt: number | null;
plan: string | null;
reason: string | null;
refreshError: string | null;
status: "api-key" | "signed-out" | "unavailable" | "windows";
windows: object[];
}, {
account?: string | null;
accountAt?: number;
checkedAt?: number | null;
lastAttemptAt?: number | null;
noSubscriptionAt?: number | null;
plan?: string | null;
reason?: string | null;
refreshError?: string | null;
status?: "api-key" | "signed-out" | "unavailable" | "windows";
windows?: object[];
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.account​
account: string | null;
ClientType.accountAt​
accountAt: number;
ClientType.checkedAt​
checkedAt: number | null;
ClientType.lastAttemptAt​
lastAttemptAt: number | null;
ClientType.noSubscriptionAt​
noSubscriptionAt: number | null;
ClientType.plan​
plan: string | null;
ClientType.reason​
reason: string | null;
ClientType.refreshError​
refreshError: string | null;
ClientType.status​
status: "api-key" | "signed-out" | "unavailable" | "windows";
ClientType.windows​
windows: object[];
StateType​
StateType: object;
StateType.account​
account: string | null;
StateType.accountAt​
accountAt: number;
StateType.checkedAt​
checkedAt: number | null;
StateType.lastAttemptAt​
lastAttemptAt: number | null;
StateType.noSubscriptionAt​
noSubscriptionAt: number | null;
StateType.plan​
plan: string | null;
StateType.reason​
reason: string | null;
StateType.refreshError​
refreshError: string | null;
StateType.status​
status: "api-key" | "signed-out" | "unavailable" | "windows";
StateType.windows​
windows: object[];

harnessUsageStateSchema​

const harnessUsageStateSchema: z.ZodObject<{
account: z.ZodDefault<z.ZodNullable<z.ZodString>>;
accountAt: z.ZodDefault<z.ZodNumber>;
checkedAt: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
lastAttemptAt: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
noSubscriptionAt: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
plan: z.ZodDefault<z.ZodNullable<z.ZodString>>;
reason: z.ZodDefault<z.ZodNullable<z.ZodString>>;
refreshError: z.ZodDefault<z.ZodNullable<z.ZodString>>;
status: z.ZodDefault<z.ZodEnum<["windows", "api-key", "signed-out", "unavailable"]>>;
windows: z.ZodDefault<z.ZodArray<z.ZodObject<object & object, "strip", z.ZodTypeAny, {
checkedAt: number;
id: string;
label: string | null;
level: "ok" | "reached" | "warning" | null;
minutes: number | null;
origin: "read" | "run";
resetsAt: number | null;
usedPercent: number | null;
}, {
checkedAt: number;
id: string;
label?: string | null;
level?: "ok" | "reached" | "warning" | null;
minutes?: number | null;
origin?: "read" | "run";
resetsAt?: number | null;
usedPercent: number | null;
}>, "many">>;
}, "strip", z.ZodTypeAny, {
account: string | null;
accountAt: number;
checkedAt: number | null;
lastAttemptAt: number | null;
noSubscriptionAt: number | null;
plan: string | null;
reason: string | null;
refreshError: string | null;
status: "api-key" | "signed-out" | "unavailable" | "windows";
windows: object[];
}, {
account?: string | null;
accountAt?: number;
checkedAt?: number | null;
lastAttemptAt?: number | null;
noSubscriptionAt?: number | null;
plan?: string | null;
reason?: string | null;
refreshError?: string | null;
status?: "api-key" | "signed-out" | "unavailable" | "windows";
windows?: object[];
}>;

One harness's usage record. Every field defaults, so a row written under an older shape still parses rather than blanking.


heldSchema​

const heldSchema: z.ZodObject<{
at: z.ZodNumber;
attempt: z.ZodNumber;
base: z.ZodNullable<z.ZodString>;
bytes: z.ZodNullable<z.ZodNumber>;
error: z.ZodNullable<z.ZodString>;
head: z.ZodNullable<z.ZodString>;
key: z.ZodNullable<z.ZodString>;
parked: z.ZodBoolean;
sha256: z.ZodNullable<z.ZodString>;
skipped: z.ZodArray<z.ZodObject<{
path: z.ZodString;
why: z.ZodString;
}, "strip", z.ZodTypeAny, {
path: string;
why: string;
}, {
path: string;
why: string;
}>, "many">;
snapshot: z.ZodNullable<z.ZodString>;
}, "strip", z.ZodTypeAny, {
at: number;
attempt: number;
base: string | null;
bytes: number | null;
error: string | null;
head: string | null;
key: string | null;
parked: boolean;
sha256: string | null;
skipped: object[];
snapshot: string | null;
}, {
at: number;
attempt: number;
base: string | null;
bytes: number | null;
error: string | null;
head: string | null;
key: string | null;
parked: boolean;
sha256: string | null;
skipped: object[];
snapshot: string | null;
}>;

One hold of a run's work, as the run record keeps it.


heldToolCallSchema​

const heldToolCallSchema: z.ZodObject<{
cwd: z.ZodString;
key: z.ZodString;
toolName: z.ZodString;
touches: z.ZodNullable<z.ZodString>;
}, "strip", z.ZodTypeAny, {
cwd: string;
key: string;
toolName: string;
touches: string | null;
}, {
cwd: string;
key: string;
toolName: string;
touches: string | null;
}>;

A call held for a person, as its stop names it and a grant matches it.


ISSUE_SPEC_MAX_BYTES​

const ISSUE_SPEC_MAX_BYTES: number;

How much of a spec file the brief carries before it cuts the rest (E3: 64 KB).


MAX_ANSWER_CHARS​

const MAX_ANSWER_CHARS: 8000 = 8000;

The most of a run's final message its output carries.


MAX_APPROVAL_STEPS​

const MAX_APPROVAL_STEPS: 25 = 25;

How many times one try's run is resumed for a tool approval's answer. Each costs a harness restart, so a run past it is asking for more than a user should click through; the try fails, saying so. Shared by every flow that holds a run's tool calls, so they stop at the same bound.


MAX_DIFF_FILES​

const MAX_DIFF_FILES: 200 = 200;

The most files one diff read lists. The totals still count every file.


MAX_PATCH_CHARS​

const MAX_PATCH_CHARS: 64000 = 64000;

The most characters of one file's patch a read hands back.


MAX_TIMER_MS​

const MAX_TIMER_MS: 2147483647 = 2147483647;

The largest delay the timer paths actually honour. Measured, and the measurement moved the number.

AbortSignal.timeout throws RangeError only above 2**32 - 1, so that looked like the ceiling. It is not: Node's timers are 32-bit signed, and anything above 2**31 - 1 is silently clamped to 1ms with a warning — so a deadline of 2^32-1 does not throw, it fires immediately and settles every row errored. The louder failure was the safer one, which is why the bound is the quieter limit.


placeStatusSchema​

const placeStatusSchema: z.ZodEnum<["provisioning", "ready", "refused", "lost", "restoring"]>;

Where a run's place stands, on a host that holds a run's work. The host's provision reports none of these words; the manager writes them around it.


PROGRESS_NOTE_MS​

const PROGRESS_NOTE_MS: 30000 = 30000;

The least time between two progress-note writes of one step, in ms.


PULL_REQUEST_EVENT​

const PULL_REQUEST_EVENT: "pull-request" = "pull-request";

The event an external wait on a pull request names on each releaser.


READINESS_CHECK_TIMEOUT_MS​

const READINESS_CHECK_TIMEOUT_MS: 30000 = 30000;

How long a check may take before it reads as unanswered: 30 s, a cold Codex start.


READINESS_GUIDANCE​

const READINESS_GUIDANCE: string;

The guidance under the rows in the coordinator's context.


RUN_REPORT_HEADINGS​

const RUN_REPORT_HEADINGS: object;

The three headings, as the brief spells them and the reader finds them.

Type Declaration​

changed​
readonly changed: "What changed";
checks​
readonly checks: "Checks";
notes​
readonly notes: "Worth knowing";

runChangesSchema​

const runChangesSchema: z.ZodObject<{
diff: z.ZodNullable<z.ZodObject<{
added: z.ZodNumber;
fileCount: z.ZodNumber;
files: z.ZodArray<z.ZodObject<{
added: z.ZodNullable<z.ZodNumber>;
path: z.ZodString;
removed: z.ZodNullable<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
added: number | null;
path: string;
removed: number | null;
}, {
added: number | null;
path: string;
removed: number | null;
}>, "many">;
removed: z.ZodNumber;
verified: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}, {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}>>;
patch: z.ZodNullable<z.ZodObject<{
patch: z.ZodString;
path: z.ZodString;
truncated: z.ZodBoolean;
verified: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
patch: string;
path: string;
truncated: boolean;
verified: boolean;
}, {
patch: string;
path: string;
truncated: boolean;
verified: boolean;
}>>;
}, "strip", z.ZodTypeAny, {
diff: | {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}
| null;
patch: | {
patch: string;
path: string;
truncated: boolean;
verified: boolean;
}
| null;
}, {
diff: | {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}
| null;
patch: | {
patch: string;
path: string;
truncated: boolean;
verified: boolean;
}
| null;
}>;

What a changes read answers: the diff when it named no file, else that file's patch. One or the other, so a screen that already shows the files (a review's data carries them) pays for no second numstat when it opens one.


runDiffSchema​

const runDiffSchema: z.ZodObject<{
added: z.ZodNumber;
fileCount: z.ZodNumber;
files: z.ZodArray<z.ZodObject<{
added: z.ZodNullable<z.ZodNumber>;
path: z.ZodString;
removed: z.ZodNullable<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
added: number | null;
path: string;
removed: number | null;
}, {
added: number | null;
path: string;
removed: number | null;
}>, "many">;
removed: z.ZodNumber;
verified: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}, {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}>;

RunDiff, as a schema: what a review's data and a changes read carry.


runFilePatchSchema​

const runFilePatchSchema: z.ZodObject<{
patch: z.ZodString;
path: z.ZodString;
truncated: z.ZodBoolean;
verified: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
patch: string;
path: string;
truncated: boolean;
verified: boolean;
}, {
patch: string;
path: string;
truncated: boolean;
verified: boolean;
}>;

RunFilePatch, as a schema.


runRecordCollection​

const runRecordCollection: object & ResourceCollectionConfig & object;

The collection. Not client-readable, deliberately: the read surface is the flow's zero-model status action, which reads the board row beside these fields server-side. A second read surface would be a second answer, and this one could not carry the half that decides completion.

Type Declaration​

pattern​
readonly pattern: "runs/**";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: z.ZodObject<{
attempt: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
baseCommit: z.ZodDefault<z.ZodNullable<z.ZodString>>;
baseRef: z.ZodDefault<z.ZodNullable<z.ZodString>>;
branch: z.ZodDefault<z.ZodNullable<z.ZodString>>;
checks: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodObject<{
command: z.ZodString;
durationMs: z.ZodNumber;
exitCode: z.ZodNullable<z.ZodNumber>;
skipped: z.ZodBoolean;
tail: z.ZodString;
timedOut: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
command: string;
durationMs: number;
exitCode: number | null;
skipped: boolean;
tail: string;
timedOut: boolean;
}, {
command: string;
durationMs: number;
exitCode: number | null;
skipped: boolean;
tail: string;
timedOut: boolean;
}>, "many">>>;
childSessionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
costUsd: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
effectiveCut: z.ZodDefault<z.ZodNullable<z.ZodString>>;
filesOnly: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
finalMessage: z.ZodDefault<z.ZodNullable<z.ZodString>>;
held: z.ZodDefault<z.ZodNullable<z.ZodObject<{
at: z.ZodNumber;
attempt: z.ZodNumber;
base: z.ZodNullable<z.ZodString>;
bytes: z.ZodNullable<z.ZodNumber>;
error: z.ZodNullable<z.ZodString>;
head: z.ZodNullable<z.ZodString>;
key: z.ZodNullable<z.ZodString>;
parked: z.ZodBoolean;
sha256: z.ZodNullable<z.ZodString>;
skipped: z.ZodArray<z.ZodObject<{
path: ...;
why: ...;
}, "strip", z.ZodTypeAny, {
path: ...;
why: ...;
}, {
path: ...;
why: ...;
}>, "many">;
snapshot: z.ZodNullable<z.ZodString>;
}, "strip", z.ZodTypeAny, {
at: number;
attempt: number;
base: string | null;
bytes: number | null;
error: string | null;
head: string | null;
key: string | null;
parked: boolean;
sha256: string | null;
skipped: object[];
snapshot: string | null;
}, {
at: number;
attempt: number;
base: string | null;
bytes: number | null;
error: string | null;
head: string | null;
key: string | null;
parked: boolean;
sha256: string | null;
skipped: object[];
snapshot: string | null;
}>>>;
incarnationId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
landedPullRequests: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
lastSave: z.ZodDefault<z.ZodNullable<z.ZodObject<{
at: z.ZodNumber;
conflicts: z.ZodArray<z.ZodString, "many">;
error: z.ZodNullable<z.ZodString>;
}, "strip", z.ZodTypeAny, {
at: number;
conflicts: string[];
error: string | null;
}, {
at: number;
conflicts: string[];
error: string | null;
}>>>;
outcome: z.ZodDefault<z.ZodNullable<z.ZodEnum<["running", "succeeded", "failed"]>>>;
place: z.ZodDefault<z.ZodNullable<z.ZodObject<{
host: z.ZodString;
state: z.ZodEnum<["provisioning", "ready", "refused", "lost", "restoring"]>;
}, "strip", z.ZodTypeAny, {
host: string;
state: "lost" | "provisioning" | "ready" | "refused" | "restoring";
}, {
host: string;
state: "lost" | "provisioning" | "ready" | "refused" | "restoring";
}>>>;
reason: z.ZodDefault<z.ZodNullable<z.ZodString>>;
remote: z.ZodDefault<z.ZodNullable<z.ZodString>>;
requestId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
requestIds: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
runKey: z.ZodDefault<z.ZodNullable<z.ZodString>>;
runs: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
sessionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
source: z.ZodDefault<z.ZodNullable<z.ZodString>>;
taskId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
turn: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
updatedAt: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
usage: z.ZodDefault<z.ZodNullable<z.ZodObject<{
inputTokens: z.ZodNumber;
outputTokens: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
inputTokens: number;
outputTokens: number;
}, {
inputTokens: number;
outputTokens: number;
}>>>;
waitOutput: z.ZodDefault<z.ZodNullable<z.ZodObject<{
attempt: z.ZodNumber;
output: z.ZodUnknown;
}, "strip", z.ZodTypeAny, {
attempt: number;
output?: unknown;
}, {
attempt: number;
output?: unknown;
}>>>;
wokeFor: z.ZodDefault<z.ZodNullable<z.ZodString>>;
workspacePath: z.ZodDefault<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
attempt: number | null;
baseCommit: string | null;
baseRef: string | null;
branch: string | null;
checks: object[] | null;
childSessionId: string | null;
costUsd: number | null;
effectiveCut: string | null;
filesOnly: boolean | null;
finalMessage: string | null;
held: | {
at: number;
attempt: number;
base: string | null;
bytes: number | null;
error: string | null;
head: string | null;
key: string | null;
parked: boolean;
sha256: string | null;
skipped: object[];
snapshot: string | null;
}
| null;
incarnationId: string | null;
landedPullRequests: string[] | null;
lastSave: | {
at: number;
conflicts: string[];
error: string | null;
}
| null;
outcome: "failed" | "running" | "succeeded" | null;
place: | {
host: string;
state: "lost" | "provisioning" | "ready" | "refused" | "restoring";
}
| null;
reason: string | null;
remote: string | null;
requestId: string | null;
requestIds: string[] | null;
runKey: string | null;
runs: number | null;
sessionId: string | null;
source: string | null;
taskId: string | null;
turn: number | null;
updatedAt: number | null;
usage: | {
inputTokens: number;
outputTokens: number;
}
| null;
waitOutput: | {
attempt: number;
output?: unknown;
}
| null;
wokeFor: string | null;
workspacePath: string | null;
}, {
attempt?: number | null;
baseCommit?: string | null;
baseRef?: string | null;
branch?: string | null;
checks?: object[] | null;
childSessionId?: string | null;
costUsd?: number | null;
effectiveCut?: string | null;
filesOnly?: boolean | null;
finalMessage?: string | null;
held?: | {
at: number;
attempt: number;
base: string | null;
bytes: number | null;
error: string | null;
head: string | null;
key: string | null;
parked: boolean;
sha256: string | null;
skipped: object[];
snapshot: string | null;
}
| null;
incarnationId?: string | null;
landedPullRequests?: string[] | null;
lastSave?: | {
at: number;
conflicts: string[];
error: string | null;
}
| null;
outcome?: "failed" | "running" | "succeeded" | null;
place?: | {
host: string;
state: "lost" | "provisioning" | "ready" | "refused" | "restoring";
}
| null;
reason?: string | null;
remote?: string | null;
requestId?: string | null;
requestIds?: string[] | null;
runKey?: string | null;
runs?: number | null;
sessionId?: string | null;
source?: string | null;
taskId?: string | null;
turn?: number | null;
updatedAt?: number | null;
usage?: | {
inputTokens: number;
outputTokens: number;
}
| null;
waitOutput?: | {
attempt: number;
output?: unknown;
}
| null;
wokeFor?: string | null;
workspacePath?: string | null;
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: JsonObject;
StateType​
StateType: JsonObject;

runRecordStateSchema​

const runRecordStateSchema: z.ZodObject<{
attempt: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
baseCommit: z.ZodDefault<z.ZodNullable<z.ZodString>>;
baseRef: z.ZodDefault<z.ZodNullable<z.ZodString>>;
branch: z.ZodDefault<z.ZodNullable<z.ZodString>>;
checks: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodObject<{
command: z.ZodString;
durationMs: z.ZodNumber;
exitCode: z.ZodNullable<z.ZodNumber>;
skipped: z.ZodBoolean;
tail: z.ZodString;
timedOut: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
command: string;
durationMs: number;
exitCode: number | null;
skipped: boolean;
tail: string;
timedOut: boolean;
}, {
command: string;
durationMs: number;
exitCode: number | null;
skipped: boolean;
tail: string;
timedOut: boolean;
}>, "many">>>;
childSessionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
costUsd: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
effectiveCut: z.ZodDefault<z.ZodNullable<z.ZodString>>;
filesOnly: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
finalMessage: z.ZodDefault<z.ZodNullable<z.ZodString>>;
held: z.ZodDefault<z.ZodNullable<z.ZodObject<{
at: z.ZodNumber;
attempt: z.ZodNumber;
base: z.ZodNullable<z.ZodString>;
bytes: z.ZodNullable<z.ZodNumber>;
error: z.ZodNullable<z.ZodString>;
head: z.ZodNullable<z.ZodString>;
key: z.ZodNullable<z.ZodString>;
parked: z.ZodBoolean;
sha256: z.ZodNullable<z.ZodString>;
skipped: z.ZodArray<z.ZodObject<{
path: z.ZodString;
why: z.ZodString;
}, "strip", z.ZodTypeAny, {
path: string;
why: string;
}, {
path: string;
why: string;
}>, "many">;
snapshot: z.ZodNullable<z.ZodString>;
}, "strip", z.ZodTypeAny, {
at: number;
attempt: number;
base: string | null;
bytes: number | null;
error: string | null;
head: string | null;
key: string | null;
parked: boolean;
sha256: string | null;
skipped: object[];
snapshot: string | null;
}, {
at: number;
attempt: number;
base: string | null;
bytes: number | null;
error: string | null;
head: string | null;
key: string | null;
parked: boolean;
sha256: string | null;
skipped: object[];
snapshot: string | null;
}>>>;
incarnationId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
landedPullRequests: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
lastSave: z.ZodDefault<z.ZodNullable<z.ZodObject<{
at: z.ZodNumber;
conflicts: z.ZodArray<z.ZodString, "many">;
error: z.ZodNullable<z.ZodString>;
}, "strip", z.ZodTypeAny, {
at: number;
conflicts: string[];
error: string | null;
}, {
at: number;
conflicts: string[];
error: string | null;
}>>>;
outcome: z.ZodDefault<z.ZodNullable<z.ZodEnum<["running", "succeeded", "failed"]>>>;
place: z.ZodDefault<z.ZodNullable<z.ZodObject<{
host: z.ZodString;
state: z.ZodEnum<["provisioning", "ready", "refused", "lost", "restoring"]>;
}, "strip", z.ZodTypeAny, {
host: string;
state: "lost" | "provisioning" | "ready" | "refused" | "restoring";
}, {
host: string;
state: "lost" | "provisioning" | "ready" | "refused" | "restoring";
}>>>;
reason: z.ZodDefault<z.ZodNullable<z.ZodString>>;
remote: z.ZodDefault<z.ZodNullable<z.ZodString>>;
requestId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
requestIds: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
runKey: z.ZodDefault<z.ZodNullable<z.ZodString>>;
runs: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
sessionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
source: z.ZodDefault<z.ZodNullable<z.ZodString>>;
taskId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
turn: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
updatedAt: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
usage: z.ZodDefault<z.ZodNullable<z.ZodObject<{
inputTokens: z.ZodNumber;
outputTokens: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
inputTokens: number;
outputTokens: number;
}, {
inputTokens: number;
outputTokens: number;
}>>>;
waitOutput: z.ZodDefault<z.ZodNullable<z.ZodObject<{
attempt: z.ZodNumber;
output: z.ZodUnknown;
}, "strip", z.ZodTypeAny, {
attempt: number;
output?: unknown;
}, {
attempt: number;
output?: unknown;
}>>>;
wokeFor: z.ZodDefault<z.ZodNullable<z.ZodString>>;
workspacePath: z.ZodDefault<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
attempt: number | null;
baseCommit: string | null;
baseRef: string | null;
branch: string | null;
checks: object[] | null;
childSessionId: string | null;
costUsd: number | null;
effectiveCut: string | null;
filesOnly: boolean | null;
finalMessage: string | null;
held: | {
at: number;
attempt: number;
base: string | null;
bytes: number | null;
error: string | null;
head: string | null;
key: string | null;
parked: boolean;
sha256: string | null;
skipped: object[];
snapshot: string | null;
}
| null;
incarnationId: string | null;
landedPullRequests: string[] | null;
lastSave: | {
at: number;
conflicts: string[];
error: string | null;
}
| null;
outcome: "failed" | "running" | "succeeded" | null;
place: | {
host: string;
state: "lost" | "provisioning" | "ready" | "refused" | "restoring";
}
| null;
reason: string | null;
remote: string | null;
requestId: string | null;
requestIds: string[] | null;
runKey: string | null;
runs: number | null;
sessionId: string | null;
source: string | null;
taskId: string | null;
turn: number | null;
updatedAt: number | null;
usage: | {
inputTokens: number;
outputTokens: number;
}
| null;
waitOutput: | {
attempt: number;
output?: unknown;
}
| null;
wokeFor: string | null;
workspacePath: string | null;
}, {
attempt?: number | null;
baseCommit?: string | null;
baseRef?: string | null;
branch?: string | null;
checks?: object[] | null;
childSessionId?: string | null;
costUsd?: number | null;
effectiveCut?: string | null;
filesOnly?: boolean | null;
finalMessage?: string | null;
held?: | {
at: number;
attempt: number;
base: string | null;
bytes: number | null;
error: string | null;
head: string | null;
key: string | null;
parked: boolean;
sha256: string | null;
skipped: object[];
snapshot: string | null;
}
| null;
incarnationId?: string | null;
landedPullRequests?: string[] | null;
lastSave?: | {
at: number;
conflicts: string[];
error: string | null;
}
| null;
outcome?: "failed" | "running" | "succeeded" | null;
place?: | {
host: string;
state: "lost" | "provisioning" | "ready" | "refused" | "restoring";
}
| null;
reason?: string | null;
remote?: string | null;
requestId?: string | null;
requestIds?: string[] | null;
runKey?: string | null;
runs?: number | null;
sessionId?: string | null;
source?: string | null;
taskId?: string | null;
turn?: number | null;
updatedAt?: number | null;
usage?: | {
inputTokens: number;
outputTokens: number;
}
| null;
waitOutput?: | {
attempt: number;
output?: unknown;
}
| null;
wokeFor?: string | null;
workspacePath?: string | null;
}>;

One issue-phase's run record.

Every field is .nullable().default(null) so a row written by an older shape still parses, and so the attempt-scoped half can be cleared to null rather than merely omitted — upsert patch-merges, so an omitted field survives from the previous attempt's write.


RUNS​

const RUNS: "runs";

Accessor key and storage prefix for the run record.


sessionDoorInputSchema​

const sessionDoorInputSchema: z.ZodObject<{
message: z.ZodString;
}, "strip", z.ZodTypeAny, {
message: string;
}, {
message: string;
}>;

What the door takes: the line. Shift Manager builds it without knowing the kind.


sessionDoorOutputSchema​

const sessionDoorOutputSchema: z.ZodUnion<[z.ZodObject<{
steered: z.ZodString;
}, "strip", z.ZodTypeAny, {
steered: string;
}, {
steered: string;
}>, z.ZodObject<{
reply: z.ZodNullable<z.ZodString>;
taskId: z.ZodString;
}, "strip", z.ZodTypeAny, {
reply: string | null;
taskId: string;
}, {
reply: string | null;
taskId: string;
}>]>;

What the door did: steered the open task, or answered the line.


STEER_POLL_MS​

const STEER_POLL_MS: 1000 = 1000;

How often a running step's row is read for a steer.


toolApprovalYesSchema​

const toolApprovalYesSchema: z.ZodObject<{
scope: z.ZodOptional<z.ZodLiteral<"run">>;
}, "strict", z.ZodTypeAny, {
scope?: "run";
}, {
scope?: "run";
}>;

The data a yes sends for Allow for this run. A plain yes sends none.


toolGrantSchema​

const toolGrantSchema: z.ZodObject<{
key: z.ZodString;
scope: z.ZodEnum<["once", "run"]>;
toolName: z.ZodString;
}, "strip", z.ZodTypeAny, {
key: string;
scope: "once" | "run";
toolName: string;
}, {
key: string;
scope: "once" | "run";
toolName: string;
}>;

A grant a person's yes leaves on the run: once lets the next matching call through and is spent; run lets every matching call through for the rest of the run (one try of the task; a retry asks again).


TRACKER_ISSUE_REFUSED​

const TRACKER_ISSUE_REFUSED: "An issue is a tracker key such as ENG-142: letters and digits joined by single - or _, at most 64 characters." = "An issue is a tracker key such as ENG-142: letters and digits joined by single - or _, at most 64 characters.";

The message a malformed issue is refused with, naming the value's shape rather than echoing it whole.


USAGE_READ_TIMEOUT_MS​

const USAGE_READ_TIMEOUT_MS: 10000 = 10000;

How long the query waits for a reader before reading unavailable.


USAGE_REFRESH_EVERY_MS​

const USAGE_REFRESH_EVERY_MS: 60000 = 60000;

How often a registered reader may be tried, per person and harness: once a minute.

Functions​

askMarkerPath()​

function askMarkerPath(
workspacePath,
attempt,
run
): string;

Where THIS run of attempt attempt must write a question, if it has one.

Parameters​

workspacePath​

string

attempt​

number

run​

number

Returns​

string


assertBaseRefExists()​

function assertBaseRefExists(
repo,
baseRef,
variable?
): void;

Refuse a base ref the target repository does not have.

provisionCheckout passes this straight to git worktree add as the commit-ish for a fresh checkout, so a typo or a repository whose default branch is not main fails every attempt — after the row is claimed, once per retry, until the budget is gone. It is a startup fact, not a run-time one, so it is checked where the operator can still see it.

Asked through @flow-state-dev/workspace (resolvesToCommit, a rev-parse --verify of <ref>^{commit}), the package that later cuts the worktree from the same ref.

variable names the setting in the message, so the whole rule travels to a second door rather than two thirds of it. Reached programmatically the failing thing is workspace.baseRef, and an error naming an environment variable the caller never set sends them looking in the wrong place.

Parameters​

repo​

string

baseRef​

string

variable?​

string

Returns​

void


assertCheckoutRootUsable()​

function assertCheckoutRootUsable(root, variable?): void;

Refuse a checkout root the host cannot hold checkouts under.

The one workspace path with no filesystem preflight. sourceRepo gets two — assertDistinctRepository and assertBaseRefExists both run git with it as cwd, so a path that is not a usable directory fails at construction. root was checked only for being spelled absolutely, and a root that names a regular file (or sits under one) is not discovered until acquireCheckout tries to create descendants beneath it — which happens AFTER the claim. The row is charged an attempt, the next attempt fails identically, and a permanent host misconfiguration eats the whole retry budget without the agent ever running.

Created, not merely inspected, because the two are the same syscall here: mkdirSync with recursive succeeds on a directory that already exists and throws when the path or any ancestor is a file. Checking statSync first would answer a question about the moment before the answer is used, and would still leave a missing root to fail later.

And a probe child, because existing as a directory is not the question. mkdirSync on a root that is already there creates nothing, so it succeeds against a read-only mount or a directory an ACL denies — certifying a root that then fails at the first acquireCheckout, which is the whole failure this guard was added to move forward. What the guard claims is that the root can HOLD checkouts, so it has to create one and take it away again.

The probe is removed on the next line, with nothing between the two — a guard that litters the checkout root with its own leftovers on every construction is worse than the gap it closes. If a check is ever added between the create and the remove, the removal has to move into a finally first: today there is no window for a throw to leak the probe, and that is a property of there being no statement there rather than of the removal being protected.

Parameters​

root​

string

variable?​

string

Returns​

void


assertDistinctRepository()​

function assertDistinctRepository(
variable,
repo,
dispatcher
): void;

Refuse a repository that is the one this process is running from.

One function, because there are two callers and they drifted. The dispatcher's config gained repository-identity comparison while the goal runner kept path equality — and the goal runner is the one that launches a real coding agent, so the site that kept the weaker rule had the larger blast radius. Adopting a rule means moving every site that speaks the old vocabulary, and a rule that lives in one function cannot be adopted halfway.

Parameters​

variable​

string

repo​

string

dispatcher​

string | readonly string[]

Returns​

void


assertPositiveInt()​

function assertPositiveInt(label, value): number;

A positive, finite, whole number of milliseconds a timer will actually honour.

The rule, at every door onto it. harnessManager is exported, so a host passes runTimeoutMs directly; a host that reads the value out of the environment has Number() to do first, and Number("abc") is NaN. Either way the value arrives here.

What each refusal costs if it is not made: NaN fails every comparison silently — including the manager's own stale-window check, so construction passes and AbortSignal.timeout is handed NaN mid-run. Measured, that is RangeError: The value of "delay" is out of range, thrown after the row was claimed. The config error is then charged to the task as a failed attempt, once per retry, and the row settles errored for a typo in a shell. Negative and fractional values throw the same way. Zero is refused too: a deadline that fires immediately settles every row errored without running anything.

The ceiling is the state that validating the others introduced. "A positive safe integer" admits 2**32, which AbortSignal.timeout rejects exactly as it rejects NaN — while a plain setTimeout silently clamps it to 1ms and fires immediately. Same defect, different clothes; see MAX_TIMER_MS for why the bound is the quieter of the two limits.

Refusing all of them at construction turns a run-time charge into a message before anything is claimed.

Parameters​

label​

string

value​

number

Returns​

number


codingBrief()​

function codingBrief(run, parts): string;

The brief for one attempt of a coding run.

Parameters​

run​

PromptRunContext

What the manager hands a prompt builder.

parts​

CodingBriefParts

The app's own parts.

Returns​

string

The prompt.


commandCheck()​

function commandCheck(mode, options): ModeSpec;

The mode, done only when its own check and then options.commands pass.

Sets the mode's doneWhen.timeoutMs to its own bound plus timeoutMs, so the manager waits long enough. Pass the same number to harnessDrainBudgetMs({ doneTimeoutMs }) so a shutdown waits for it too.

Parameters​

mode​

ModeSpec

options​

CommandCheckOptions

Returns​

ModeSpec

Throws​

At construction, on a timeoutMs that isn't a positive whole number.


commandChecksFailure()​

function commandChecksFailure(results): string | undefined;

The next attempt's words for the red checks: each command, why it is red, and the end of its output. undefined when all passed.

Parameters​

results​

readonly CheckoutCommandResult[]

Returns​

string | undefined


commandChecksPassed()​

function commandChecksPassed(results): boolean;

Whether every check passed. An empty list passes.

Parameters​

results​

readonly CheckoutCommandResult[]

Returns​

boolean


commandChecksSummary()​

function commandChecksSummary(results): string;

"Checks 2/3 passed": how many of results passed.

Parameters​

results​

readonly CheckoutCommandResult[]

Returns​

string


commitScriptedWork()​

function commitScriptedWork(run): Promise<void>;

What the scripted run does where it works: one file, committed when that is a checkout. A project with no repository runs in its files (no git), where the file itself is the work and the manager saves it back.

A retry runs in the checkout its first attempt left, where that attempt already committed this same file. With nothing new to commit, git commit fails, and that failure would replace why the first attempt was sent back (most often the judge's verdict). The commit is skipped instead: the attempt's work is already on the task's branch.

Parameters​

run​

StubRun

The attempt, as the stub hands it to duringRun.

Returns​

Promise<void>


defaultIssueSpecPath()​

function defaultIssueSpecPath(issue): string;

The default spec path: this repository's convention.

Parameters​

issue​

string

Returns​

string


describeTenant()​

function describeTenant(tenantId): string;

How a tenant reads in a message. Absence is a fact, so it gets words.

Parameters​

tenantId​

string | undefined

Returns​

string


followUpChainClaimOrder()​

function followUpChainClaimOrder(): ClaimOrder;

A board claim order that never claims a task while another task of its follow-up chain runs. The claim is what spends an attempt, so a task it passes over stays exactly as it was, and is claimed once the running task of its chain ends. Readiness and order stay the collection's: the test is an eligibility narrow, decided inside the claim write against the tasks as that write reads them, so two claims at once never both start a chain.

Wire it on a board whose tasks a manager runs: taskBoard({ claimOrder: followUpChainClaimOrder() }). runOwnerClaimOrder applies the same test.

Returns​

ClaimOrder

A claim order to pass as taskBoard({ claimOrder }).


formatHarnessReadiness()​

function formatHarnessReadiness(rows): string;

The rows as text: one line per harness, ✓ Cursor, ✗ Codex: <reason>. <remedy>., or ? Claude Code: <reason>. for a check that got no answer, under a heading. The start log and the coordinator's context both print this.

Parameters​

rows​

readonly object[]

Returns​

string


goalJudge()​

function goalJudge(options): HarnessJudge;

Build a judge for the manager's judge option.

Parameters​

options​

GoalJudgeOptions

The block's name, and optionally the model and floor.

Returns​

HarnessJudge

The judge slot's value: the block, and its floor.


grantMatches()​

function grantMatches(grant, call): boolean;

Whether a grant lets a call through: the same tool on the same file or command, or, for any other call, the same arguments. Never the tool alone, so allowing one command for the run doesn't let every other command through, and never a query alone, so the same search in another mode asks again. A grant written under an older key matches nothing, so that call asks again.

Parameters​

grant​

Pick<ToolGrant, "toolName" | "key">

call​

Pick<HeldToolCall, "toolName" | "key">

Returns​

boolean


harnessDrainBudgetMs()​

function harnessDrainBudgetMs(options): number;

Parameters​

options​
doneTimeoutMs?​

number

The phase's doneTimeoutMs, when it set one (commandCheck): the completion check's bound in place of a minute.

judge?​

boolean

The manager was given a judge, which runs after the completion check, bounded the same way.

ownershipWaitMs​

number

provisionTimeoutMs?​

number

runTimeoutMs​

number

How long a shutdown waits for the agent: the run's cap when it has one, else the host's own wait.

Returns​

number


harnessManager()​

function harnessManager(options): TaskWorker;

Build the manager: one dispatched worker for one mode.

A steer on the task is in the attempt's first prompt, and one that arrives while a step runs is the next step of the same request.

Parameters​

options​

ManagerOptions

Returns​

TaskWorker


harnessReadiness()​

function harnessReadiness(slots, options?): HarnessReadinessRead;

Keep the readiness of a host's harnesses (see the file header).

Parameters​

slots​

Readonly<Record<string, HarnessReadinessSlot>>

One check per harness, keyed by the harness's name.

options?​

HarnessReadinessOptions

Returns​

HarnessReadinessRead

Throws​

When no harness is given.


harnessReadinessCapability()​

function harnessReadinessCapability(readiness, defaultHarness?): DefinedCapability<"harness-manager:readiness", Record<string, never>, "context" | "default", Record<string, PresetDef<any>>, undefined, undefined, undefined, undefined, undefined> & object;

The readiness rows in a generator's context, for a host's coordinator: uses: [harnessReadinessCapability(readiness)]. Reads the kept rows, so a turn starts no check of its own once the first read has run. The rows move when something checks again: a Re-check, or a task start through refusal on a harness not marked ready, which the guidance tells the coordinator to try when the user says they have just signed in.

Parameters​

readiness​

HarnessReadinessRead

defaultHarness?​

string

The app's default coder, by harness id: named under the rows (defaultCoderLine), by its row's label. Omitted, or a harness with no row, names none.

Returns​

DefinedCapability<"harness-manager:readiness", Record<string, never>, "context" | "default", Record<string, PresetDef<any>>, undefined, undefined, undefined, undefined, undefined> & object


harnessReadinessView()​

function harnessReadinessView(readiness): HarnessReadinessViewDefinition;

The readiness read, as a user-scope view a host installs on a flow: views: { readiness: harnessReadinessView(readiness) }. A screen reads it with no session (harnessReadinessViewRef from /browser).

Input { refresh?: boolean }; refresh: true is Re-check. Answers one HarnessReadinessView per harness, keyed by harness. The rows are this machine's, the same for every caller the flow signs in; the view reads no resource, so its answer names no topic. Zero-model.

Parameters​

readiness​

HarnessReadinessRead

Returns​

HarnessReadinessViewDefinition


harnessRunChangesView()​

function harnessRunChangesView(options): ViewDefinition<BlockDefinition<ZodObject<{
path: ZodOptional<ZodString>;
taskId: ZodOptional<ZodString>;
}, "strip", ZodTypeAny, {
path?: string;
taskId?: string;
}, {
path?: string;
taskId?: string;
}>, ZodObject<object & object, "strip", ZodTypeAny, {
diff: | {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}
| null;
patch: | {
patch: string;
path: string;
truncated: boolean;
verified: boolean;
}
| null;
taskId: string;
}, {
diff: | {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}
| null;
patch: | {
patch: string;
path: string;
truncated: boolean;
verified: boolean;
}
| null;
taskId: string;
}>, {
path?: string;
taskId?: string;
}, {
diff: | {
added: number;
fileCount: number;
files: object[];
removed: number;
verified: boolean;
}
| null;
patch: | {
patch: string;
path: string;
truncated: boolean;
verified: boolean;
}
| null;
taskId: string;
}>, "session">;

The changes session view a coding flow declares beside its door: views: { changes: harnessRunChangesView({ board }) }.

Input { taskId?, path? }. Without path it answers { diff }: each file the run's commits changed and its lines, the totals, and verified: false when git couldn't read them. With path it answers { patch }: that file's unified diff, cut at MAX_PATCH_CHARS. A run of kept files alone has no branch, and answers a verified empty diff.

Parameters​

options​

HarnessRunChangesViewOptions

Returns​

ViewDefinition<BlockDefinition<ZodObject<{ path: ZodOptional<ZodString>; taskId: ZodOptional<ZodString>; }, "strip", ZodTypeAny, { path?: string; taskId?: string; }, { path?: string; taskId?: string; }>, ZodObject<object & object, "strip", ZodTypeAny, { diff: | { added: number; fileCount: number; files: object[]; removed: number; verified: boolean; } | null; patch: | { patch: string; path: string; truncated: boolean; verified: boolean; } | null; taskId: string; }, { diff: | { added: number; fileCount: number; files: object[]; removed: number; verified: boolean; } | null; patch: | { patch: string; path: string; truncated: boolean; verified: boolean; } | null; taskId: string; }>, { path?: string; taskId?: string; }, { diff: | { added: number; fileCount: number; files: object[]; removed: number; verified: boolean; } | null; patch: | { patch: string; path: string; truncated: boolean; verified: boolean; } | null; taskId: string; }>, "session">


harnessSessionAttachedTo()​

function harnessSessionAttachedTo(start): string | null;

The session a start attaches to, when it attaches ({ worktreeOf }).

Parameters​

start​

| { base: string; } | { branch: string; } | { pullRequest: number; } | { worktreeOf: string; } | undefined

Returns​

string | null


harnessSessionDoor()​

function harnessSessionDoor(options): object;

A coding run's door: declare it as the coding flow's action, actions: { message: harnessSessionDoor({ board, harness }) }.

Parameters​

options​

HarnessSessionDoorOptions

Returns​

object

The action entry.

block​
block: SequencerDefinition<{
message: string;
},
| {
steered: string;
}
| {
reply: string | null;
taskId: string;
}, undefined, undefined>;
description​
description: string;
inputSchema​
inputSchema: ZodObject<{
message: ZodString;
}, "strip", ZodTypeAny, {
message: string;
}, {
message: string;
}>;
userMessage​
userMessage: (input) => string;
Parameters​
input​
message​

string

Returns​

string


harnessSessionFeeds()​

function harnessSessionFeeds(
kind,
workspace,
defaultModel?,
steering?,
inUse?,
attachedHeads?
): HarnessFeeds;

The feeds for one flow kind.

Parameters​

kind​

string

The flow kind.

workspace​

HarnessSessionWorkspace

Where its sessions work.

defaultModel?​

string

What HarnessSessionFlowOptions.defaultModel says.

steering?​

HarnessSteering

The flow's steering, which holds a running turn's offer for its steer action.

inUse?​

Map<string, LockLease>

Where a turn's hold on its worktree (occupyWorktree) is kept until the turn ends, by request. Only harnessSessionFlow, which lets go of each when its turn finishes, passes one; feeds built without it take no hold, since nothing would let go of it.

attachedHeads?​

Map<string, string | null>

The branch each attached turn started on, by request, for the flow's turn-end check.

Returns​

HarnessFeeds


harnessSessionFlow()​

function harnessSessionFlow(options): FlowInstance<NormalizedActions<{
removeWorktree: {
block: BlockDefinition<ZodObject<{
deleteBranch: ZodDefault<ZodBoolean>;
force: ZodDefault<ZodBoolean>;
}, "strip", ZodTypeAny, {
deleteBranch: boolean;
force: boolean;
}, {
deleteBranch?: boolean;
force?: boolean;
}>, ZodTypeAny, {
deleteBranch: boolean;
force: boolean;
}, {
branchDeleted: boolean;
removed: true;
}>;
concurrency: "reject";
};
steer: ActionCore<BlockDefinition<ZodTypeAny, ZodTypeAny, any, any>>;
turn: {
block: | SequencerDefinition<{
prompt: string;
}, any, undefined, undefined>
| SequencerDefinition<{
prompt: string;
}, unknown, ZodObject<{
approvals: ZodDefault<ZodNullable<ZodObject<..., ..., ..., ..., ...>>>;
}, "strip", ZodTypeAny, {
approvals: | {
grants: ...[];
pending: ... | ...;
steps: number;
}
| null;
}, {
approvals?: | {
grants?: ... | ...;
pending?: ... | ... | ...;
steps?: ... | ...;
}
| null;
}>, undefined>;
concurrency: "defer";
userMessage: (input) => string;
};
}>, {
client: {
expose: readonly ["model", "issue", "start", "binding", "turns", "workspace"];
};
createCheck: (__namedParameters) =>
| {
message: string;
ok: false;
status?: undefined;
}
| {
message: string;
ok: false;
status: 404;
}
| {
message?: undefined;
ok: true;
status?: undefined;
};
serverOwned: readonly ["binding", "turns", "workspace"];
stateSchema: ZodObject<{
binding: ZodDefault<ZodNullable<ZodObject<{
confirmed: ZodDefault<ZodNullable<ZodString>>;
}, "strip", ZodTypeAny, {
confirmed: string | null;
}, {
confirmed?: string | null;
}>>>;
issue: ZodReadonly<ZodOptional<ZodString>>;
model: ZodReadonly<ZodOptional<ZodString>>;
start: ZodReadonly<ZodOptional<ZodUnion<[ZodObject<{
base: ZodString;
}, "strict", ZodTypeAny, {
base: string;
}, {
base: string;
}>, ZodObject<{
branch: ZodString;
}, "strict", ZodTypeAny, {
branch: string;
}, {
branch: string;
}>, ZodObject<{
pullRequest: ZodNumber;
}, "strict", ZodTypeAny, {
pullRequest: number;
}, {
pullRequest: number;
}>, ZodObject<{
worktreeOf: ZodString;
}, "strict", ZodTypeAny, {
worktreeOf: string;
}, {
worktreeOf: string;
}>]>>>;
turns: ZodDefault<ZodNullable<ZodRecord<ZodString, ZodObject<{
asked: ZodDefault<ZodNullable<...>>;
at: ZodDefault<ZodNullable<...>>;
base: ZodDefault<ZodNullable<...>>;
checks: ZodDefault<ZodNullable<...>>;
confirmed: ZodDefault<ZodNullable<...>>;
endedAt: ZodDefault<ZodNullable<...>>;
error: ZodDefault<ZodNullable<...>>;
failure: ZodDefault<ZodNullable<...>>;
head: ZodDefault<ZodNullable<...>>;
setup: ZodDefault<ZodNullable<...>>;
spend: ZodDefault<ZodNullable<...>>;
steered: ZodDefault<ZodNullable<...>>;
stopped: ZodDefault<ZodNullable<...>>;
timedOut: ZodDefault<ZodNullable<...>>;
waitsOnApproval: ZodDefault<ZodNullable<...>>;
}, "strip", ZodTypeAny, {
asked: string | null;
at: number | null;
base: string | null;
checks: ...[] | null;
confirmed: string | null;
endedAt: number | null;
error: string | null;
failure: string | null;
head: string | null;
setup: | {
state: ...;
tail: ...;
}
| null;
spend: | {
costUsd?: ...;
harness: ...;
inputTokens: ...;
live: ...;
model: ...;
outputTokens: ...;
unreported: ...;
}
| null;
steered: ...[] | null;
stopped: boolean | null;
timedOut: boolean | null;
waitsOnApproval: boolean | null;
}, {
asked?: string | null;
at?: number | null;
base?: string | null;
checks?: ...[] | null;
confirmed?: string | null;
endedAt?: number | null;
error?: string | null;
failure?: string | null;
head?: string | null;
setup?: | {
state: ...;
tail?: ...;
}
| null;
spend?: | {
costUsd?: ...;
harness: ...;
inputTokens: ...;
live: ...;
model: ...;
outputTokens: ...;
unreported: ...;
}
| null;
steered?: ...[] | null;
stopped?: boolean | null;
timedOut?: boolean | null;
waitsOnApproval?: boolean | null;
}>>>>;
workspace: ZodDefault<ZodNullable<ZodObject<{
worktree: ZodDefault<ZodNullable<ZodString>>;
}, "strip", ZodTypeAny, {
worktree: string | null;
}, {
worktree?: string | null;
}>>>;
}, "strip", ZodTypeAny, {
binding: | {
confirmed: string | null;
}
| null;
issue?: string;
model?: string;
start?: | Readonly<{
base: string;
}>
| Readonly<{
branch: string;
}>
| Readonly<{
pullRequest: number;
}>
| Readonly<{
worktreeOf: string;
}>;
turns: | Record<string, {
asked: string | null;
at: number | null;
base: string | null;
checks: object[] | null;
confirmed: string | null;
endedAt: number | null;
error: string | null;
failure: string | null;
head: string | null;
setup: | {
state: "done" | "failed" | "running";
tail: string | null;
}
| null;
spend: | {
costUsd?: number | null;
harness: string | null;
inputTokens: number | null;
live: boolean;
model: string | null;
outputTokens: number | null;
unreported: boolean;
}
| null;
steered: string[] | null;
stopped: boolean | null;
timedOut: boolean | null;
waitsOnApproval: boolean | null;
}>
| null;
workspace: | {
worktree: string | null;
}
| null;
}, {
binding?: | {
confirmed?: string | null;
}
| null;
issue?: string;
model?: string;
start?: | Readonly<{
base: string;
}>
| Readonly<{
branch: string;
}>
| Readonly<{
pullRequest: number;
}>
| Readonly<{
worktreeOf: string;
}>;
turns?: | Record<string, {
asked?: string | null;
at?: number | null;
base?: string | null;
checks?: object[] | null;
confirmed?: string | null;
endedAt?: number | null;
error?: string | null;
failure?: string | null;
head?: string | null;
setup?: | {
state: "done" | "failed" | "running";
tail?: string | null;
}
| null;
spend?: | {
costUsd?: number | null;
harness: string | null;
inputTokens: number | null;
live: boolean;
model: string | null;
outputTokens: number | null;
unreported: boolean;
}
| null;
steered?: string[] | null;
stopped?: boolean | null;
timedOut?: boolean | null;
waitsOnApproval?: boolean | null;
}>
| null;
workspace?: | {
worktree?: string | null;
}
| null;
}>;
}, {
onFinished: SequencerDefinition<unknown, unknown, undefined, undefined>;
}, UserConfig | undefined, OrgConfig | undefined, {
"harness-usage": object & ResourceCollectionConfig<JsonObject> & object;
worktrees: object & ResourceCollectionConfig<JsonObject> & object;
}, undefined>;

Build a harness's session flow.

turn takes the prompt. A turn sent while another runs waits for it, for as long as that one takes (concurrency: "defer", which has no time limit, where a queue wait gives up after 30 s), then continues the same conversation. steer takes a line for the turn running now: { taken: true } when the harness took it into that turn, else { taken: false } and nothing was sent. live says whether the running turn offered to take one at all.

Parameters​

options​

HarnessSessionFlowOptions

Returns​

FlowInstance<NormalizedActions<{ removeWorktree: { block: BlockDefinition<ZodObject<{ deleteBranch: ZodDefault<ZodBoolean>; force: ZodDefault<ZodBoolean>; }, "strip", ZodTypeAny, { deleteBranch: boolean; force: boolean; }, { deleteBranch?: boolean; force?: boolean; }>, ZodTypeAny, { deleteBranch: boolean; force: boolean; }, { branchDeleted: boolean; removed: true; }>; concurrency: "reject"; }; steer: ActionCore<BlockDefinition<ZodTypeAny, ZodTypeAny, any, any>>; turn: { block: | SequencerDefinition<{ prompt: string; }, any, undefined, undefined> | SequencerDefinition<{ prompt: string; }, unknown, ZodObject<{ approvals: ZodDefault<ZodNullable<ZodObject<..., ..., ..., ..., ...>>>; }, "strip", ZodTypeAny, { approvals: | { grants: ...[]; pending: ... | ...; steps: number; } | null; }, { approvals?: | { grants?: ... | ...; pending?: ... | ... | ...; steps?: ... | ...; } | null; }>, undefined>; concurrency: "defer"; userMessage: (input) => string; }; }>, { client: { expose: readonly ["model", "issue", "start", "binding", "turns", "workspace"]; }; createCheck: (__namedParameters) => | { message: string; ok: false; status?: undefined; } | { message: string; ok: false; status: 404; } | { message?: undefined; ok: true; status?: undefined; }; serverOwned: readonly ["binding", "turns", "workspace"]; stateSchema: ZodObject<{ binding: ZodDefault<ZodNullable<ZodObject<{ confirmed: ZodDefault<ZodNullable<ZodString>>; }, "strip", ZodTypeAny, { confirmed: string | null; }, { confirmed?: string | null; }>>>; issue: ZodReadonly<ZodOptional<ZodString>>; model: ZodReadonly<ZodOptional<ZodString>>; start: ZodReadonly<ZodOptional<ZodUnion<[ZodObject<{ base: ZodString; }, "strict", ZodTypeAny, { base: string; }, { base: string; }>, ZodObject<{ branch: ZodString; }, "strict", ZodTypeAny, { branch: string; }, { branch: string; }>, ZodObject<{ pullRequest: ZodNumber; }, "strict", ZodTypeAny, { pullRequest: number; }, { pullRequest: number; }>, ZodObject<{ worktreeOf: ZodString; }, "strict", ZodTypeAny, { worktreeOf: string; }, { worktreeOf: string; }>]>>>; turns: ZodDefault<ZodNullable<ZodRecord<ZodString, ZodObject<{ asked: ZodDefault<ZodNullable<...>>; at: ZodDefault<ZodNullable<...>>; base: ZodDefault<ZodNullable<...>>; checks: ZodDefault<ZodNullable<...>>; confirmed: ZodDefault<ZodNullable<...>>; endedAt: ZodDefault<ZodNullable<...>>; error: ZodDefault<ZodNullable<...>>; failure: ZodDefault<ZodNullable<...>>; head: ZodDefault<ZodNullable<...>>; setup: ZodDefault<ZodNullable<...>>; spend: ZodDefault<ZodNullable<...>>; steered: ZodDefault<ZodNullable<...>>; stopped: ZodDefault<ZodNullable<...>>; timedOut: ZodDefault<ZodNullable<...>>; waitsOnApproval: ZodDefault<ZodNullable<...>>; }, "strip", ZodTypeAny, { asked: string | null; at: number | null; base: string | null; checks: ...[] | null; confirmed: string | null; endedAt: number | null; error: string | null; failure: string | null; head: string | null; setup: | { state: ...; tail: ...; } | null; spend: | { costUsd?: ...; harness: ...; inputTokens: ...; live: ...; model: ...; outputTokens: ...; unreported: ...; } | null; steered: ...[] | null; stopped: boolean | null; timedOut: boolean | null; waitsOnApproval: boolean | null; }, { asked?: string | null; at?: number | null; base?: string | null; checks?: ...[] | null; confirmed?: string | null; endedAt?: number | null; error?: string | null; failure?: string | null; head?: string | null; setup?: | { state: ...; tail?: ...; } | null; spend?: | { costUsd?: ...; harness: ...; inputTokens: ...; live: ...; model: ...; outputTokens: ...; unreported: ...; } | null; steered?: ...[] | null; stopped?: boolean | null; timedOut?: boolean | null; waitsOnApproval?: boolean | null; }>>>>; workspace: ZodDefault<ZodNullable<ZodObject<{ worktree: ZodDefault<ZodNullable<ZodString>>; }, "strip", ZodTypeAny, { worktree: string | null; }, { worktree?: string | null; }>>>; }, "strip", ZodTypeAny, { binding: | { confirmed: string | null; } | null; issue?: string; model?: string; start?: | Readonly<{ base: string; }> | Readonly<{ branch: string; }> | Readonly<{ pullRequest: number; }> | Readonly<{ worktreeOf: string; }>; turns: | Record<string, { asked: string | null; at: number | null; base: string | null; checks: object[] | null; confirmed: string | null; endedAt: number | null; error: string | null; failure: string | null; head: string | null; setup: | { state: "done" | "failed" | "running"; tail: string | null; } | null; spend: | { costUsd?: number | null; harness: string | null; inputTokens: number | null; live: boolean; model: string | null; outputTokens: number | null; unreported: boolean; } | null; steered: string[] | null; stopped: boolean | null; timedOut: boolean | null; waitsOnApproval: boolean | null; }> | null; workspace: | { worktree: string | null; } | null; }, { binding?: | { confirmed?: string | null; } | null; issue?: string; model?: string; start?: | Readonly<{ base: string; }> | Readonly<{ branch: string; }> | Readonly<{ pullRequest: number; }> | Readonly<{ worktreeOf: string; }>; turns?: | Record<string, { asked?: string | null; at?: number | null; base?: string | null; checks?: object[] | null; confirmed?: string | null; endedAt?: number | null; error?: string | null; failure?: string | null; head?: string | null; setup?: | { state: "done" | "failed" | "running"; tail?: string | null; } | null; spend?: | { costUsd?: number | null; harness: string | null; inputTokens: number | null; live: boolean; model: string | null; outputTokens: number | null; unreported: boolean; } | null; steered?: string[] | null; stopped?: boolean | null; timedOut?: boolean | null; waitsOnApproval?: boolean | null; }> | null; workspace?: | { worktree?: string | null; } | null; }>; }, { onFinished: SequencerDefinition<unknown, unknown, undefined, undefined>; }, UserConfig | undefined, OrgConfig | undefined, { "harness-usage": object & ResourceCollectionConfig<JsonObject> & object; worktrees: object & ResourceCollectionConfig<JsonObject> & object; }, undefined>

Example​

harnessSessionFlow({
kind: "claude-code-session",
workspace,
agent: (feeds) => claudeCodeAgent({ ...feeds, permissionMode: "acceptEdits" }),
});

harnessSessionTitle()​

function harnessSessionTitle(prompt): string;

A session's title from its first prompt: its first line, whitespace collapsed, cut with an ellipsis.

Parameters​

prompt​

string

Returns​

string


harnessStub()​

function harnessStub(options?): HarnessStub;

Build a scripted harness.

Parameters​

options?​

HarnessStubOptions

What the run does in its checkout and what it reports back.

Returns​

HarnessStub

The slot to install, and the log of what it was handed.


harnessTalkTurn()​

function harnessTalkTurn(options): SequencerDefinition<{
message: string;
}, {
reply: string | null;
taskId: string;
}, ZodObject<{
cwd: ZodDefault<ZodNullable<ZodString>>;
leaseToken: ZodDefault<ZodNullable<ZodString>>;
lockPath: ZodDefault<ZodNullable<ZodString>>;
resume: ZodDefault<ZodNullable<ZodString>>;
taskId: ZodDefault<ZodNullable<ZodString>>;
}, "strip", ZodTypeAny, {
cwd: string | null;
leaseToken: string | null;
lockPath: string | null;
resume: string | null;
taskId: string | null;
}, {
cwd?: string | null;
leaseToken?: string | null;
lockPath?: string | null;
resume?: string | null;
taskId?: string | null;
}>, undefined>;

The talk half of a coding run's door, as a block of its own: one harness run resumes the coding session of this session's finished task with the message, outside any attempt, and its final text is the reply. The task, its output and its attempts don't change. The door runs it for a person's line; a coder's onMessageReceived runs it as its turn for a message.

Refuses, failing the request, when the session has no task (not-started), when its task is still open (task-running: a message never steers), and when the run confirmed no coding session (cannot-continue).

Parameters​

options​

HarnessTalkTurnOptions

Returns​

SequencerDefinition<{ message: string; }, { reply: string | null; taskId: string; }, ZodObject<{ cwd: ZodDefault<ZodNullable<ZodString>>; leaseToken: ZodDefault<ZodNullable<ZodString>>; lockPath: ZodDefault<ZodNullable<ZodString>>; resume: ZodDefault<ZodNullable<ZodString>>; taskId: ZodDefault<ZodNullable<ZodString>>; }, "strip", ZodTypeAny, { cwd: string | null; leaseToken: string | null; lockPath: string | null; resume: string | null; taskId: string | null; }, { cwd?: string | null; leaseToken?: string | null; lockPath?: string | null; resume?: string | null; taskId?: string | null; }>, undefined>

A block taking { message } and answering { reply, taskId }.


harnessUsageFlow()​

function harnessUsageFlow(options): FlowType<NormalizedActions<Record<string, ActionEntry<BlockDefinition<ZodTypeAny, ZodTypeAny, any, any>>>>, SessionConfig | undefined, RequestConfig | undefined, UserConfig | undefined, OrgConfig | undefined, Record<string, DeclaredResourceEntry>, undefined>;

The usage flow a host registers once, at HARNESS_USAGE_FLOW: flows: [harnessUsageFlow({ readers })(), ...]. The collection's runBy names it, so it is the flow a client's Re-check runs on.

  • usage, a user-scope view: { harnesses }, one HarnessUsageView per harness, sorted by name, the readers' harnesses listed even before anything is stored. Starts nothing. A screen reads it with no session (harnessUsageViewRef from /browser).
  • recheck, the write: asks each reader, at most once a minute per person and harness, and stores what it says. A reader that fails or is slow stores why beside the last good reading. Answers { asked }, the harnesses asked this time. A client sends it to the collection (recheckHarnessUsage from /browser); zero-model.

Parameters​

options​

HarnessUsageFlowOptions

Returns​

FlowType<NormalizedActions<Record<string, ActionEntry<BlockDefinition<ZodTypeAny, ZodTypeAny, any, any>>>>, SessionConfig | undefined, RequestConfig | undefined, UserConfig | undefined, OrgConfig | undefined, Record<string, DeclaredResourceEntry>, undefined>


heldToolCallOf()​

function heldToolCallOf(request, cwd): object;

The held call a request is: its tool, what it touches, its grant key and the folder it would run in.

Parameters​

request​

Pick<HarnessToolApprovalRequest, "toolName" | "input">

The call the harness asked about.

cwd​

string

The run's working folder.

Returns​

object

cwd​
cwd: string;
key​
key: string;
toolName​
toolName: string;
touches​
touches: string | null;

heldToolDecision()​

function heldToolDecision(call): HarnessToolApprovalDecision;

The feed's answer for a call it holds: the call doesn't run, and the turn stops.

Parameters​

call​
cwd​

string

key​

string

toolName​

string

touches​

string | null

Returns​

HarnessToolApprovalDecision


isTrackerIssue()​

function isTrackerIssue(value): value is string;

True when value is a usable tracker issue key, such as ENG-142.

Parameters​

value​

unknown

Returns​

value is string


progressNoteOf()​

function progressNoteOf(activity): string | null;

The note an activity reads as, or null when it says nothing: a message's first non-empty line, Thinking… for reasoning, or a tool call as what the run is doing to what (Running pnpm test, Editing src/a.ts, Reading …, Searching "…", Fetching …, Updating the plan), else Using <name> and what it touches. Whitespace collapsed, so it is one line, and cut to STATUS_NOTE_LIMIT.

Parameters​

activity​

HarnessActivity

Returns​

string | null


pullRequestWait()​

function pullRequestWait(row, records?): PullRequestWait | null;

The open pull-request wait on a task row, with each pull request it waits on read from the session's record records (number, link, title), or null when the row waits on none: not running, no open wait, or a wait on something else.

const wait = pullRequestWait(task, recordRows);
if (wait !== null) return <span>PR open · {wait.pullRequests.map((pr) => `#${pr.number}`).join(", ")}</span>;

Parameters​

row​

PullRequestWaitInput

records?​

readonly PullRequestRecordResourceState[]

Returns​

PullRequestWait | null


readAskMarker()​

function readAskMarker(
workspacePath,
attempt,
run
): Promise<string | undefined>;

Read this run's question, or undefined when it did not ask one.

Only an absent file reads as "no question". Anything else — a permission error, a directory where the marker should be — is re-thrown, so it takes the ordinary failed-attempt path and is written to the row. Swallowing it would make an unreadable question indistinguishable from a run that never asked, which is the same silent stall the ask step exists to close.

A marker that is present but blank is not a question: a run told to write one only if it has one can leave an empty file behind, and holding the task for it would hold it on nothing.

Parameters​

workspacePath​

string

attempt​

number

run​

number

Returns​

Promise<string | undefined>


readHarnessUsage()​

function readHarnessUsage(
ctx,
now,
expected?
): Promise<HarnessUsageView[]>;

Every harness's stored usage, with ages and roll-overs worked out at now. Starts nothing. expected names harnesses to list even with no row yet (the registered readers), so a harness nobody has read still shows.

Parameters​

ctx​

BlockContext

now​

number

expected?​

readonly string[]

Returns​

Promise<HarnessUsageView[]>


readIssueSpecSection()​

function readIssueSpecSection(
cwd,
issue,
options?
): Promise<string>;

The section that opens a run's brief: the issue, and its spec as the checkout at cwd holds it.

Read fresh each call, so an attempt sees the spec its checkout has now. Cut at ISSUE_SPEC_MAX_BYTES with a line saying so. A missing or unreadable file is said in one line. A path that leaves the checkout is said the same way and nothing is read.

Parameters​

cwd​

string

The run's checkout, already provisioned.

issue​

string

The issue key; checked by isTrackerIssue before it is used in a path.

options?​

IssueSpecOptions

Where the spec lives.

Returns​

Promise<string>

The section, as Markdown, starting with a ## heading.


readModeRunRecord()​

function readModeRunRecord(
ctx,
epic,
issue,
mode,
taskId?,
spelled?
): Promise<{
record: | {
attempt: number | null;
baseCommit: string | null;
baseRef: string | null;
branch: string | null;
checks: object[] | null;
childSessionId: string | null;
costUsd: number | null;
effectiveCut: string | null;
filesOnly: boolean | null;
finalMessage: string | null;
held: | {
at: number;
attempt: number;
base: string | null;
bytes: number | null;
error: string | null;
head: string | null;
key: string | null;
parked: boolean;
sha256: string | null;
skipped: object[];
snapshot: string | null;
}
| null;
incarnationId: string | null;
landedPullRequests: string[] | null;
lastSave: | {
at: number;
conflicts: string[];
error: string | null;
}
| null;
outcome: "failed" | "running" | "succeeded" | null;
place: | {
host: string;
state: "provisioning" | "ready" | "lost" | "refused" | "restoring";
}
| null;
reason: string | null;
remote: string | null;
requestId: string | null;
requestIds: string[] | null;
runKey: string | null;
runs: number | null;
sessionId: string | null;
source: string | null;
taskId: string | null;
turn: number | null;
updatedAt: number | null;
usage: | {
inputTokens: number;
outputTokens: number;
}
| null;
waitOutput: | {
attempt: number;
output?: unknown;
}
| null;
wokeFor: string | null;
workspacePath: string | null;
}
| undefined;
segment: string;
topic: string;
}>;

Find one issue's run of a mode: under <epic>/<issue>/<name> first, then, when that key is absent and the mode names a formerName, under the former key. The segment it was found under is the run's from then on; nothing is copied to the new key. Found under neither, it is a new run, keyed by name.

spelled is the segment as the task itself spelled it, when that differs from name (its folded form). Before the key folded, that spelling was the key, so it is read after name and before the former key.

Every key but name is this task's only: a record there that names another task (taskId) is another task's run, so it counts as absent and the task opens a new run under name. A record that names no task is read as the task's. Pass the reading task's id whenever it is known, or, for a task whose run another task's record continues (a follow-up, its chain's), a test of whether a record's task id is this run's.

Parameters​

ctx​

CollectionHoldingContext

epic​

string

issue​

string

mode​
formerName?​

string

name​

string

taskId?​

string | ((recordedTaskId) => boolean)

spelled?​

string

Returns​

Promise<{ record: | { attempt: number | null; baseCommit: string | null; baseRef: string | null; branch: string | null; checks: object[] | null; childSessionId: string | null; costUsd: number | null; effectiveCut: string | null; filesOnly: boolean | null; finalMessage: string | null; held: | { at: number; attempt: number; base: string | null; bytes: number | null; error: string | null; head: string | null; key: string | null; parked: boolean; sha256: string | null; skipped: object[]; snapshot: string | null; } | null; incarnationId: string | null; landedPullRequests: string[] | null; lastSave: | { at: number; conflicts: string[]; error: string | null; } | null; outcome: "failed" | "running" | "succeeded" | null; place: | { host: string; state: "provisioning" | "ready" | "lost" | "refused" | "restoring"; } | null; reason: string | null; remote: string | null; requestId: string | null; requestIds: string[] | null; runKey: string | null; runs: number | null; sessionId: string | null; source: string | null; taskId: string | null; turn: number | null; updatedAt: number | null; usage: | { inputTokens: number; outputTokens: number; } | null; waitOutput: | { attempt: number; output?: unknown; } | null; wokeFor: string | null; workspacePath: string | null; } | undefined; segment: string; topic: string; }>


readRunRecord()​

function readRunRecord(ctx, topic): Promise<
| {
attempt: number | null;
baseCommit: string | null;
baseRef: string | null;
branch: string | null;
checks: object[] | null;
childSessionId: string | null;
costUsd: number | null;
effectiveCut: string | null;
filesOnly: boolean | null;
finalMessage: string | null;
held: | {
at: number;
attempt: number;
base: string | null;
bytes: number | null;
error: string | null;
head: string | null;
key: string | null;
parked: boolean;
sha256: string | null;
skipped: object[];
snapshot: string | null;
}
| null;
incarnationId: string | null;
landedPullRequests: string[] | null;
lastSave: | {
at: number;
conflicts: string[];
error: string | null;
}
| null;
outcome: "failed" | "running" | "succeeded" | null;
place: | {
host: string;
state: "provisioning" | "ready" | "lost" | "refused" | "restoring";
}
| null;
reason: string | null;
remote: string | null;
requestId: string | null;
requestIds: string[] | null;
runKey: string | null;
runs: number | null;
sessionId: string | null;
source: string | null;
taskId: string | null;
turn: number | null;
updatedAt: number | null;
usage: | {
inputTokens: number;
outputTokens: number;
}
| null;
waitOutput: | {
attempt: number;
output?: unknown;
}
| null;
wokeFor: string | null;
workspacePath: string | null;
}
| undefined>;

Read one issue-phase's row, or undefined when nothing has opened it.

Parameters​

ctx​

CollectionHoldingContext

topic​

string

Returns​

Promise< | { attempt: number | null; baseCommit: string | null; baseRef: string | null; branch: string | null; checks: object[] | null; childSessionId: string | null; costUsd: number | null; effectiveCut: string | null; filesOnly: boolean | null; finalMessage: string | null; held: | { at: number; attempt: number; base: string | null; bytes: number | null; error: string | null; head: string | null; key: string | null; parked: boolean; sha256: string | null; skipped: object[]; snapshot: string | null; } | null; incarnationId: string | null; landedPullRequests: string[] | null; lastSave: | { at: number; conflicts: string[]; error: string | null; } | null; outcome: "failed" | "running" | "succeeded" | null; place: | { host: string; state: "provisioning" | "ready" | "lost" | "refused" | "restoring"; } | null; reason: string | null; remote: string | null; requestId: string | null; requestIds: string[] | null; runKey: string | null; runs: number | null; sessionId: string | null; source: string | null; taskId: string | null; turn: number | null; updatedAt: number | null; usage: | { inputTokens: number; outputTokens: number; } | null; waitOutput: | { attempt: number; output?: unknown; } | null; wokeFor: string | null; workspacePath: string | null; } | undefined>


readSessionPullRequests()​

function readSessionPullRequests(client, runSessionId): Promise<SessionPullRequest[]>;

The pull requests run session runSessionId records (observed-pull-requests), every request's: a task's wait spans its turns, so a later turn's pull request counts as the first one's does. Each has its number, link, title and state, and the host and repository pullRequestWait matches its wait's keys by. A row with no number or no link is left out. A session that records none, or whose record the client can't read, reads as none.

A read that fails throws the client's own error unchanged; the caller words it for its own screen, as for readRecordedWork.

const records = await readSessionPullRequests(client, task.run.sessionId);
const wait = pullRequestWait(task, records); // each pull request linked

Parameters​

client​

RecordedWorkClient

runSessionId​

string

Returns​

Promise<SessionPullRequest[]>


recordHarnessUsage()​

Call Signature​

function recordHarnessUsage(ctx, report): Promise<UsageWrite>;

Record one reading of harness's usage, made at checkedAt (epoch ms), or one window a run heard about (report).

Parameters​
ctx​

BlockContext

report​

HarnessUsageReport

Returns​

Promise<UsageWrite>

recorded when it was written; kept-stored when a reading was unavailable over a stored reading, which stays (its reason becomes refreshError); refused-older when what is stored is newer, or when it is a run window from a run that started before the stored status was read.

Call Signature​

function recordHarnessUsage(
ctx,
harness,
reading,
checkedAt
): Promise<UsageWrite>;

Record one reading of harness's usage, made at checkedAt (epoch ms), or one window a run heard about (report).

Parameters​
ctx​

BlockContext

harness​

string

reading​

HarnessUsageReading

checkedAt​

number

Returns​

Promise<UsageWrite>

recorded when it was written; kept-stored when a reading was unavailable over a stored reading, which stays (its reason becomes refreshError); refused-older when what is stored is newer, or when it is a run window from a run that started before the stored status was read.


repositoryIdentity()​

function repositoryIdentity(dir): string | undefined;

The repository dir belongs to, as identityFromCommonDir names it, or undefined.

Parameters​

dir​

string

Returns​

string | undefined


requestTenant()​

function requestTenant(ctx): string | undefined;

The tenant a request resolved to.

One derivation, exported, because two places enforce it. The flow's per-action gate refuses before the board is touched; the manager refuses before the work executes. If they computed the tenant differently — one defaulting, the other not — the gate would pass a request the manager then rejects mid-run, which is the charged-attempt failure the gate exists to remove, reintroduced by a second copy of one rule.

Absence is the value. An untenanted request resolves to undefined, and that is compared directly — it is not folded into a placeholder name. The earlier version defaulted to a literal, which made a real tenant of that name and no tenant at all the same fact: they shared a board while tenantSegment kept them in different checkouts, so a task could execute against a tree that was not its own. Presence is carried by the type here and tagged by tenantSegment in every derived identity.

Parameters​

ctx​

RequestIdentityContext

Returns​

string | undefined


resolveHarnessSessionStart()​

function resolveHarnessSessionStart(start, options): Promise<ResolvedHarnessSessionStart>;

Turn a session's start into what a workspace host's provision takes. A pull request is asked of GitHub (pullRequestHead), in options.cwd, a checkout of its repository, and refused when it comes from a fork. No start: {}, the host's default. An attaching start provisions nothing (the session flow locates the owner's worktree instead), so it is refused here.

Parameters​

start​

| { base: string; } | { branch: string; } | { pullRequest: number; } | { worktreeOf: string; } | undefined

options​
cwd​

string

gh?​

string

Returns​

Promise<ResolvedHarnessSessionStart>


resolveOwnership()​

function resolveOwnership(options): object;

Resolve the ownership bounds and check them, once.

Pure and exported because two callers need the resolved numbers: the manager enforces them, and the flow needs waitMs to size the drain budget. Re-deriving in the second place is how the last three defects on this branch happened, so there is one derivation and it is called twice.

Parameters​

options​
doneTimeoutMs?​

number

The phase's doneTimeoutMs, when it set one. The completion check holds the lock again, fresh, for up to this long plus the stop grace, so it is a third tail beside the run and the cleanup.

ownership?​

Partial<OwnershipBounds>

provisionTimeoutMs?​

number

runTimeoutMs​

number

The longest the run step holds the lock without marking it live: a manager's silence window, or a holder's whole deadline.

Returns​

object

maxLockHeldMs​
maxLockHeldMs: number;
ownership​
ownership: OwnershipBounds;

runBoardSegment()​

function runBoardSegment(ledgerId, partition): string;

The board segment of a run's identity: what RunLocation.epic and the run topic are led by.

A board with no partition is its ledger id, as is, so a fixed board's runs keep the checkout, branch and run record they always had. A board kept per partition (one conversation's rows among many on one ledger) adds a digest of the partition, so two conversations that file the same task id never share a checkout, a branch or a run record. A digest rather than the value: a partition is a server-minted string of any shape, and encodeSegment fits it to a path and a ref the way it fits a user id.

Parameters​

ledgerId​

string

partition​

string | undefined

Returns​

string


runIssueSegment()​

function runIssueSegment(task, lookup): string;

The issue a task's run is keyed by on a board that mints its ids: its follow-up root's id (followUpRootId) as taskIssueSegment encodes it. A task that follows up nothing keeps the key of its own id.

Parameters​

task​
followUpOf?​

string

id​

string

lookup​

(id) => | { followUpOf?: string; } | undefined

Returns​

string


runOwnerClaimOrder()​

function runOwnerClaimOrder(): ClaimOrder;

A board claim order that never claims a row whose coding run another member started — the half of the run-owner rule that charges nothing.

Wire it on the board that drains rows a manager runs, when that board is kept per organization (a shared board): taskBoard({ claimOrder: runOwnerClaimOrder() }). The claim is what spends an attempt, so refusing here leaves the row exactly as it was: same status, same attempt count, same lease. Readiness and order stay the collection's: the owner check is an eligibility narrow, which the substrate applies on top of its own.

A row with no recorded owner is claimable by anyone; the manager records the claimant on its first run. When a claim comes back empty only because every claimable row was someone else's, the drain is refused with an error naming whose run it is, rather than returning as if the board were idle.

It also passes over a task while another task of its follow-up chain runs, as followUpChainClaimOrder does, since a board takes one claim order.

Returns​

ClaimOrder

A claim order to pass as taskBoard({ claimOrder }).


runOwnerOf()​

function runOwnerOf(row):
| {
tenantId?: string;
userId: string;
}
| null;

The owner recorded on a row, or null when none is.

null for a row the manager has never run, for any row written before the rule existed, and for a record that does not parse. The last one is deliberate: the next run records its own principal, which is the same thing that happens to a row nobody has run.

Parameters​

row​

| { metadata?: Record<string, unknown>; } | undefined

Returns​

| { tenantId?: string; userId: string; } | null


runReport()​

function runReport(answer): RunReport | null;

A run's answer read as its report: the sections under the brief's headings. null when the answer has none of them, so a caller shows the answer whole. Text before the first heading counts toward What changed when that section is missing, so a report that only opens with prose still reads.

Parameters​

answer​

string | null | undefined

Returns​

RunReport | null


runTopic()​

function runTopic(
epic,
issue,
phase
): string;

The bare topic for one run. Never carries the runs/ prefix.

Led by the epic, for the reason D-4 partitions the board: runs/** is one collection every epic writes, and a later coordinator session of this epic must read this epic's row. Without the discriminator, two epics driving one issue-phase resolve the same topic and either manager overwrites the other's checkout, session, cost and outcome — run: present and belonging to someone else, which is a silent WRONG answer rather than the missing one the scope fold closed.

The rule this applies: a key two boards write, whose reader is a JOB, needs the board's discriminator. A key whose reader is a PERSON does not.

Three segments, which runs/** matches and runs/* would not.

Parameters​

epic​

string

issue​

string

phase​

string

Returns​

string


runTopicPrefix()​

function runTopicPrefix(epic, issue): string;

The bare prefix listing every phase of one issue, within one epic.

Parameters​

epic​

string

issue​

string

Returns​

string


scriptedHarness()​

function scriptedHarness(__namedParameters): HarnessStub;

The scripted coder: narrates a step every stepEveryMs, commits (commitScriptedWork), finishes with a one-line answer, which is what a conversation's task needs to be done.

Parameters​

__namedParameters​

ScriptedHarnessOptions

Returns​

HarnessStub

The stub, whose runs log what each attempt was handed.


taskIssueSegment()​

function taskIssueSegment(taskId): string;

The issue a task's own id stands in for, on a board that mints its ids: the id itself when it is a usable segment, else h- and its hash.

The id is the board's, not the manager's, so the grammar cannot be asked of it: the coordinator mints routed ids as routed:<request>:<round>:<delegate>, which no checkout path, branch or run topic can carry. An id that already fits keeps itself, so a run recorded under it is found again. One shaped like an encoding is encoded too, so no id lands on another's.

Every reader of a run keyed this way (a session door's runOf) derives the issue through runIssueSegment, which applies this to the task's follow-up root, so it reads the record the manager wrote.

Parameters​

taskId​

string

Returns​

string


toolApprovalOutcome()​

function toolApprovalOutcome(answer, call): ToolApprovalOutcome;

Read a held call's answer: a yes grants the call (once, or for the run with ALLOW_FOR_RUN's data); a no, or nobody answering by the deadline, tells the session it may not, with the person's note when they gave one ({ note } on the no).

Parameters​

answer​

| { answer?: unknown; approved: true; cancelled: false; } | { answer?: unknown; approved: false; cancelled: false; deadline: boolean; }

The stop's answer, not cancelled (a cancel resumes nothing).

call​

The held call.

cwd​

string

key​

string

toolName​

string

touches​

string | null

Returns​

ToolApprovalOutcome


toolApprovalStop()​

function toolApprovalStop(call): SuspendForUserOptions<"approval">;

The stop a held call waits on: an approval naming the tool, what it touches and the folder, with Allow for this run as an extra yes.

Parameters​

call​

The held call.

cwd​

string

key​

string

toolName​

string

touches​

string | null

Returns​

SuspendForUserOptions<"approval">


upgradeKeptTurns()​

function upgradeKeptTurns(stores, options): Promise<number>;

Write every kept turn no attempt took onto its task as an untaken steer. Returns how many it wrote.

Parameters​

stores​

KeptTurnUpgradeStores

options​

KeptTurnUpgradeOptions

Returns​

Promise<number>


withDeadline()​

function withDeadline<T>(
work,
ms,
what
): Promise<T>;

Core's withTimeout, with the conductor's verdict on top.

All this adds is whose fault it is: a hook that misses its deadline is a failed attempt, not a conductor defect, so it rejects with HarnessAttemptFailed and the board records that message as the next attempt's feedback. The wording differs from core's for the same reason — a person reading the feedback is being told the hook did not answer, not that a timer expired.

Type Parameters​

T​

T

Parameters​

work​

() => Promise<T>

ms​

number

what​

string

Returns​

Promise<T>

References​

shellWord​

Re-exports shellWord


workPlace​

Re-exports workPlace


WorkPlace​

Re-exports WorkPlace


WorkPlaceCommands​

Re-exports WorkPlaceCommands


WorkPlaceViewer​

Re-exports WorkPlaceViewer