import type { TStage, TProcessingFailure, TPipelineEvent } from "../pipelines/types.js"; import type { TLlmProvider, TLlmTokenUsage, TResponseId } from "../llm/types.js"; /** * Input supplied to a single conversational turn. The caller is * responsible for assembling the user message (which may include the * full transcript when the provider cannot chain by reference). */ export type TTurnInput = { /** The user message for this turn. */ userMessage: string; /** The provider response id to chain against; absent for the first turn. */ previousResponseId?: TResponseId; }; /** * Result of a single conversational turn. Mirrors the shape the * server's Argument Builder actions need: output, the new response id, * token usage, and any processing failures. */ export type TTurnResult = { /** The stage's parsed output, or `null` when the turn failed. */ output: TOut | null; /** The provider response id for this turn (nullable for * non-chaining providers such as chat-completions). */ responseId: TResponseId | null; /** Cumulative token usage for this turn's LLM call. */ tokenUsage: TLlmTokenUsage; /** Processing failures recorded during the turn. */ failures: TProcessingFailure[]; }; /** * Minimal dependencies for a single-turn execution. A subset of the * full pipeline deps — no concurrency or pipeline-level bookkeeping. */ export type TExecuteTurnDeps = { llm: TLlmProvider; signal?: AbortSignal; onEvent?: (event: TPipelineEvent) => void; /** Called after the stage completes (after retry loop + validation). * Useful for terminal turns that need to seal a conversation. */ onComplete?: () => void; }; /** * Run one conversational turn: execute the stage through the single-stage * executor (preserving retry loop, output-schema validation, event * emission, token accounting) while threading `previousResponseId` into * the LLM request and surfacing the provider response id. * * Uses a synthetic pipeline so `executeStage` can run the arbitrary stage * through the same execution machinery the full pipeline uses. The stage's * own `dependsOn` are preserved; since no upstream stages exist, any * dependencies that are satisfied will be `completed` (they simply don't * exist, so `ctx.get` returns `undefined` for them). */ export declare function executeTurn(stage: TStage, input: TTurnInput, deps: TExecuteTurnDeps): Promise>; //# sourceMappingURL=turn.d.ts.map