/** * @module @nhtio/adk/batteries/orchestration/dispatch_reasoner */ import { InMemorySpoolStore } from "../storage/in_memory/index"; import type { ReasonerFn } from "./types"; import type { DispatchExecutorFn } from "../../types"; /** * Builds a reasoner that answers through a forced tool dispatch. * * A reasoning node must return a structured, schema-validated result, but * {@link DispatchRunner.dispatch} resolves to `void`. This helper bridges that * gap by wiring the node's output schema onto a forced tool's `inputSchema` and * capturing the arguments the model submits to that tool. Because the tool's * input schema is the node's output schema, validation rejects malformed * arguments before the handler ever runs, so the model cannot answer with * unstructured prose. * * The captured value is read from a closure after the dispatch resolves; the * void return value is irrelevant. If the tool is never called, the dispatch is * a halting failure and this function throws rather than fabricating or * returning a partial result. * * The boundary this draws is deliberate: the battery owns the forced-tool protocol and the retry * bound, and the CONSUMER owns the model. `DispatchRunner` takes an injected executor rather than * a model identifier, so a consumer wires whichever provider they already use and this helper * never grows credential handling. * * @param options - Configuration for the reasoner. * @param options.executor - The consumer's LLM call, invoked by the runner on every iteration. * @param options.spoolStore - Store used to spool large results. Defaults to a * fresh {@link InMemorySpoolStore} so a large reasoning result always has * somewhere to go. * @param options.toolName - Name of the forced capture tool. Defaults to * `'submit_reasoning'`. * @returns A {@link ReasonerFn} that resolves to the validated reasoning * result or throws if no valid result could be captured. */ export declare const createDispatchReasoner: (options: { executor: DispatchExecutorFn; spoolStore?: InMemorySpoolStore; toolName?: string; }) => ReasonerFn;