/** * A verdict given as a tool call, rather than recovered from prose. * * A reviewer's answer is two things at once: an argument, which is prose and * belongs in the transcript, and a decision, which is a boolean and does not. * Reading the second out of the first means matching text written for a human * against a word chosen by a caller, and a match is only ever as good as the * agreement about how to write it. * * A tool call carries the decision on its own channel. It is a discrete event * with a schema, so "did it decide" and "what did it decide" are closed * questions, and the prose beside it stays prose. * * The flow grants it, as it grants `submit`: a `verdict:` node adds it to its * agent's `tools:`, and nothing else offers it. A definition that named it * would send its model after a tool that a `/step` or a `loop` never holds, * and every call there is refused. */ import { type ToolDefinition } from "../session.ts"; /** The tool's name, which a `verdict:` node adds to its agent's `tools:`. */ export declare const VERDICT_TOOL = "verdict"; /** What an agent said about one obligation it had raised. */ export type Resolution = { /** The obligation, by the id the ledger gave it. */ id: string; /** `"addressed"` when the work was done, `"withdrawn"` when it is dropped. */ how: "addressed" | "withdrawn"; /** Why. A withdrawal without one is a silent drop. */ reason?: string; }; /** One decision, as the agent that made it declared it. */ export type Verdict = { /** Whether the agent has nothing further to ask. Never the last word on its own. */ approved: boolean; /** * Why, in the reviewer's own words. Required when `approved` is false. * * The reviewer's **argument** stays in its prose, which is what its * definition disciplines and what the worker is sent. This is the short form * it chose to attach to the decision, kept for whoever reads the outcome. */ remarks?: string; /** Obligations it says are done with, by id. Ones it does not name stay open. */ resolved: Resolution[]; /** New obligations it raises, as it wrote them. */ raised: string[]; }; /** What a verdict tool needs to know beyond what the agent tells it. */ export type VerdictToolOptions = { /** * Whether an id is one the agent may close right now. * * Without it every id is taken on trust. Measured with a small open-weight * model: an auditor with nothing open sent `resolved: [{ id: "1" }]`, * inventing both the line and the id format. Such an id is dropped from the * verdict and named back to the agent, which keeps the ledger honest without * costing the decision the same call carried. */ knows?: (id: string) => boolean; /** The ids it may close, named in the refusal so it can correct itself. */ open?: () => readonly string[]; /** * Whether a recorded call ends the turn. Off by default: `pair` hands the * worker the prose its reviewer writes, and that prose mostly comes after * the call. * * For a caller that reads the call and nothing else. Measured with a small * open-weight model: a turn left to go on after its call called `verdict` * again and again, 59 times in one review, until its deadline cut it. The * last of those calls, the one a record reads, approved a change 33 of them * had refused. */ ends?: boolean; }; /** The tool, and the decisions it has collected so far. */ export type VerdictTool = { /** Pass this to `SpawnOptions.customTools`. */ tool: ToolDefinition; /** * The verdicts given since the previous call, oldest first, and forgets them. * * Draining rather than accumulating: a caller asks "what did *this* turn * decide", and a persistent reviewer answers several times over its life. */ take(): Verdict[]; }; /** * Builds a `verdict` tool and the collector behind it. * * One per reviewer, never shared: the collector is how the decision gets back, * so two agents writing into one would make the answers indistinguishable. * * The tool body only records. It runs no check and reverses no decision, which * is what lets the caller treat what comes out of `take()` as exactly what the * agent said. */ export declare function verdictTool(options?: VerdictToolOptions): VerdictTool; /** Whether an agent's `tools:` names the tool, as a `verdict:` node's agent's do. */ export declare function declaresVerdict(tools: readonly string[] | undefined): boolean; //# sourceMappingURL=verdict.d.ts.map