import type { SuspendedStep } from "#harness/session-machine/view.js"; import { type Step } from "#harness/step/context.js"; import type { HarnessToolLookup, StepInput, StepResult } from "#harness/types.js"; import type { InstrumentationAttempt } from "#instrumentation/runtime.js"; /** * What a delivery does before its turn runs. `stop` ends the step: the answers left nothing to * run yet, so the turn holds, or a responder must sign in first. `run` carries the turn's input, * without the answers the session took, and the approved work that runs once the turn opens. */ export type HumanInputIntake = { readonly kind: "stop"; readonly result: StepResult; } | { readonly kind: "run"; readonly input: StepInput | undefined; /** The message the turn receives, as the stream shows it. */ readonly message?: StepInput["message"]; /** A plain-text answer consumed the message, so the model never reads it. */ readonly consumedMessage: boolean; /** The delivery carries input for a turn. */ readonly opensTurn: boolean; readonly approved: ApprovedWork; }; /** * What the delivery decided: the session-limit answer, and the tools approved calls run with. * The calls themselves wait in their suspended steps until the turn's next model step. */ export interface ApprovedWork { readonly limit?: { readonly granted: boolean; }; /** The entries a parked step's calls run with: those of the step that asked. */ readonly toolsOf: (step: SuspendedStep | undefined) => HarnessToolLookup; } /** * Answers what the session asked: approval answers pass the response policies, and the session * decides which parked steps they resolve. Runs before the delivery joins its turn, so approved * calls get the tools of the step that asked. */ export declare function acceptHumanInput(step: Step, input: StepInput | undefined, options: { readonly takeQueued: boolean; }): Promise; /** * Admits what a delivery decided before its turn calls the model: a session-limit answer grants a * fresh budget or ends the turn tree, and a step its answers completed, as denials do, commits. */ export declare function admitApprovedWork(step: Step, work: ApprovedWork): Promise; /** Whether a suspended step holds approved calls that haven't run. */ export declare function hasApprovedWork(step: Step): boolean; /** * Approved workflow and agent calls join the runs their steps wait on, once the step has started * and before its budget check. Returns whether any did: the turn then waits on the runtime, and * approved local calls run after their results arrive. */ export declare function dispatchApprovedWorkflows(step: Step, work: ApprovedWork): Promise; /** * Runs approved local calls once the step has started and its budget allows it, as the AI SDK ran * them before the model read their results: each with the tools of the step that asked, as * whoever approved it, and in the step's first attempt. A call that needs a sign-in holds the * turn. */ export declare function runApprovedLocalCalls(step: Step, work: ApprovedWork, setAttemptScope: (scope: InstrumentationAttempt | undefined) => void): Promise; /** * The held turn holds on, for a person to act on its sign-in, approval, or the session-limit * prompt; the session resumes it when they do. */ export declare function holdForInput(step: Step): Promise;