@flow-state-dev/harness-manager/kit
Interfaces
CoderFlowOptions
The coding worker flow's policy: the harness kit's config.
Properties
approveTools?
approveTools?: boolean;
A run asks the user before its tool calls (harness-manager's approveTools). Default false.
branchPrefix?
branchPrefix?: string;
What each run's branch starts with: the app's own name, such as teammates/. Default fsd/.
checks?
checks?: object;
The commands a run that changed files must pass in its worktree, and how long they may take together.
commands
readonly commands: readonly string[];
timeoutMs?
readonly timeoutMs?: number;
defaultHarness?
defaultHarness?: string;
The harness a worker whose file names none runs on, and the one a coding task filed from outside any coding run carries. Absent: such a worker's task is refused, and such a filing carries none.
defaultMode?
defaultMode?: string;
The mode a task that names none runs. Default default; refused when it isn't registered.
idleTimeoutMs?
idleTimeoutMs?: number;
How long a run's harness may send nothing before the run is stopped and fails. Default 20 minutes.
judge?
judge?: boolean;
goalJudge reads each run against its task's goal. Default true.
modes?
modes?: Readonly<Record<string, Partial<CoderMode>>>;
The ways a run can work, by name. Absent: the kit's one mode, default
(the coding brief; done when the harness finished). A default entry is
completed from the kit's, so an app can replace part of it; any other
entry names its instructions and doneWhen. A mode's workspace is
absent for the kit's.
onPullRequestRecorded?
onPullRequestRecorded?: (installation) => PullRequestFollower;
Builds the follower each pull request a run records is handed to, on the
installation the coding flow is built on (workforce's
(installation) => followPullRequest({ providers, installation })), so the
run's session hears that pull request's reviews, comments and CI. Absent:
nothing follows a pull request a run opens.
Parameters
installation
WorkerInstallation
Returns
PullRequestFollower
project?
project?: boolean;
A task works in its session's project: it needs one, runs in its checkout, and runs the project's checks. Default false. A mode's own project overrides the last two for its runs.
pullRequests?
pullRequests?: boolean;
A task whose run opened a pull request waits for it to merge or close. Default true.
replies?
replies?: ReviewReplyPoster;
The poster a run's replies to review comments go through (workforce's
operatorGitHub(…).reviewReplies): a run's brief names its reply folder,
and the drafts it writes there are posted, or refused with a line in its
session, when its turn ends. Absent: no folder is named and nothing is posted.
review?
review?: boolean;
A run that committed waits for your review before its task completes, whatever the worker's review: line says; a worker's review: true turns it on alone. Default false.
runTimeoutMs?
runTimeoutMs?: number;
A cap on one run's wall-clock time, however busy its harness is. Default 4 hours; 0 turns it off.
worker?
worker?: CoderWorkerExtension;
The app's own extension of the flow: settings a worker's file may set beside the flow's (a schema shape by key), documents installed on the flow, and actions built on the installation. The flow never reads them. A setting or action the flow already declares is refused.
workspace
workspace: WorkspaceHost;
Where each run works.
CoderMode
One mode an app registers on the coding worker flow.
Properties
doneWhen
doneWhen:
| ModeDone
| ((run) =>
| boolean
| ModeDoneVerdict
| Promise<boolean | ModeDoneVerdict>);
When the run counts as done: the server-side check, with how long it may take and what it needs from the workspace, or the check alone.
Union Members
Function
(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
Returns
| boolean
| ModeDoneVerdict
| Promise<boolean | ModeDoneVerdict>
instructions
instructions: (run) => string | Promise<string>;
The run's prompt, the task's own text included, rebuilt on every wake (ModeSpec.instructions).
The run's prompt, rebuilt on every wake from current state, never computed when the row was filed.
Parameters
run
Returns
string | Promise<string>
project?
project?: boolean;
This mode's runs work in their task's project: they hold the project
collections their workspace's source reads, and run the project's checks.
Overrides the kit's project for this mode only; whether a filing needs a
project stays the kit's. Absent: the kit's.
requires?
requires?: readonly ("issue" | "project")[];
The task-input fields a task in this mode needs, such as ["issue"]. The
filing check refuses a task in this mode without them, by name, and the
claim checks again. Absent: none.
workspace?
workspace?: WorkspaceHost;
Where the run works: a workspace host, as the kit's own workspace is. Absent: the kit's.
CoderWorkerExtension
The app's own part of the coding worker flow, which the flow carries and never reads.
Properties
actions?
actions?: (installation) => Readonly<Record<string, unknown>>;
Actions served beside respond and harness, built once on the installation.
Parameters
installation
WorkerInstallation
Returns
Readonly<Record<string, unknown>>
resources?
resources?: DeclaredResources;
Documents installed at flow level, beside the installation's (resourcesFromDocs).
settings?
settings?: ZodRawShape;
Settings a worker's file may set, beside harness and review.
WorkerLock
The values a worker's lock: fixes. A task that differs on one is refused
by name, at filing and at claim.
Properties
harness?
readonly harness?: string;
mode?
readonly mode?: string;
Type Aliases
CodingTaskInput
type CodingTaskInput = z.infer<typeof codingTaskInputSchema>;
A coding task's input, as the claim hands it on.
CodingTaskInputField
type CodingTaskInputField = typeof TASK_INPUT_FIELDS[number];
A task-input field a mode can need (requires).
HarnessesConfig
type HarnessesConfig = CoderFlowOptions & object;
The harness kit's config: where runs work, and the coding worker flow's policy.
Type Declaration
logReadiness?
logReadiness?: boolean;
Check every harness at start and log the rows as a table, never awaited: a missing sign-in never stops the app. Default false.
Variables
codingTaskInputSchema
const codingTaskInputSchema: z.ZodObject<{
harness: z.ZodOptional<z.ZodString>;
issue: z.ZodOptional<z.ZodString>;
mode: z.ZodOptional<z.ZodString>;
model: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
id: z.ZodString;
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, "strict", z.ZodTypeAny, {
id: string;
params?: Record<string, unknown>;
}, {
id: string;
params?: Record<string, unknown>;
}>]>>;
plan: z.ZodOptional<z.ZodBoolean>;
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
harness: z.ZodOptional<z.ZodString>;
issue: z.ZodOptional<z.ZodString>;
mode: z.ZodOptional<z.ZodString>;
model: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
id: z.ZodString;
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, "strict", z.ZodTypeAny, {
id: string;
params?: Record<string, unknown>;
}, {
id: string;
params?: Record<string, unknown>;
}>]>>;
plan: z.ZodOptional<z.ZodBoolean>;
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
harness: z.ZodOptional<z.ZodString>;
issue: z.ZodOptional<z.ZodString>;
mode: z.ZodOptional<z.ZodString>;
model: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
id: z.ZodString;
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, "strict", z.ZodTypeAny, {
id: string;
params?: Record<string, unknown>;
}, {
id: string;
params?: Record<string, unknown>;
}>]>>;
plan: z.ZodOptional<z.ZodBoolean>;
}, z.ZodTypeAny, "passthrough">>;
A coding task's input. Declared in full, the run settings included, so the declaration (and the stamp a filed row carries) does not change as later settings start being filled.
harnesses
const harnesses: KitFactory;
Coding harnesses, as a kit. Requires workforce.
Example
createFlowState({
kits: [workforce({ agent: { model } }), harnesses({ workspace, defaultHarness: "cursor" })],
fill: { [harnesses.slots.harnesses]: [codexHarness(), cursorHarness()] },
});
HARNESSES_FLOW
const HARNESSES_FLOW: "harnesses" = "harnesses";
The flow the harness kit serves its views on.
KIT_MODE
const KIT_MODE: "default" = "default";
The kit's own mode's name: what a task runs when the app registers no modes.
Functions
codingDrainBudgetMs()
function codingDrainBudgetMs(options): number;
How long a shutdown waits for a coding run still going: its run, the
ownership wait, the judge and the checks. A host hands it to
createFlowState as dispatchDrainTimeoutMs, in place of the engine's
30 s default, which would cancel the run.
Parameters
options
Pick<CoderFlowOptions,
| "checks"
| "project"
| "judge"
| "runTimeoutMs"
| "idleTimeoutMs"
| "modes"
| "defaultMode">
Returns
number
isCheckedCodingTask()
function isCheckedCodingTask(task): boolean;
Whether the filing check wrote this stored task's input for the coder
flow's current declaration, so its mode and issue are the checked ones.
A reader of a stored coding task outside the flow asks this before it reads
either: on any other task they were a model's free fields, and only the old
harnessFeature marker names its work.
Parameters
task
Pick<Task, "metadata">
Returns
boolean
References
CODER_FLOW
Re-exports CODER_FLOW