/** * The output-tool contract (spec §9.2/§10.1): the two tools a step may call to submit its result, and * the pure helpers for reading one back out of a turn. * * Which tool was called IS the discriminator between a result and a question batch, replacing the * `{result} | {questions}` union the text path has to sniff (`agent-output.ts`). Providers pick between * tools far more reliably than between branches of a union inside one payload. * * No host/PI deps — the host imports these names to register the tools, the engine to read them back. */ import { type TSchema } from "typebox"; import { SUBMIT_QUESTIONS_TOOL, SUBMIT_RESULT_TOOL } from "../flow/output-tool-names.ts"; import type { SubmittedOutput } from "./types.ts"; export { SUBMIT_QUESTIONS_TOOL, SUBMIT_RESULT_TOOL }; /** Every tool name the engine will read a payload from. A host registers exactly these. */ export declare const OUTPUT_TOOL_NAMES: readonly string[]; /** * The `submit_result` parameter schema for a step whose contract is `outputSchema`. * * The result is WRAPPED in an object because tool parameters must be one — `outputSchema` itself may be * any schema, including a bare string or array. */ export declare function submitResultParameters(outputSchema: TSchema): TSchema; /** The `submit_questions` parameter schema — framework-owned and identical for every step. */ export declare function submitQuestionsParameters(): TSchema; /** What a submitted tool call carried, with the tool identity resolved to a kind. */ export type SubmittedPayload = { readonly kind: "result"; readonly value: unknown; } | { readonly kind: "questions"; readonly value: unknown; } /** The tool was called, but its arguments cannot be read as a payload at all. */ | { readonly kind: "malformed"; readonly tool: string; readonly reason: string; }; /** * Read a submitted call's payload. Returns undefined for a call this contract does not own, so an * unrelated tool the model happened to use last can never be mistaken for the step's output. */ export declare function readSubmittedPayload(submitted: SubmittedOutput | undefined): SubmittedPayload | undefined; /** True when `name` is one of the output tools — used by hosts scanning a transcript. */ export declare function isOutputToolName(name: string): boolean; //# sourceMappingURL=output-tools.d.ts.map