import type { TStage } from "../pipelines/types.js"; import type { TLlmTokenUsage, TResponseId } from "../llm/types.js"; import type { TExecuteTurnDeps, TTurnInput, TTurnResult } from "./turn.js"; /** * The conversation object. Methods: * - `turn(stage, input, opts?)` — run one turn * - `close()` — seal the conversation (finalize calls this) * * `.turn` after `.close()` throws `ConversationClosedError`. */ export type TConversation = { /** * Run one turn: execute the stage, thread `previousResponseId` * (from `branchFrom` or the last response id), and return the * result including the new response id. */ turn(stage: TStage, input: TTurnInput, opts?: { branchFrom?: TResponseId; onComplete?: () => void; }): Promise>; /** The latest provider response id in the chain. */ readonly lastResponseId: TResponseId | null; /** Cumulative token usage across all turns. */ readonly tokenUsage: TLlmTokenUsage; /** Whether the conversation has been closed. */ readonly closed: boolean; /** Seal the conversation. Subsequent `.turn` calls throw. */ close(): void; }; /** Thrown when `.turn` is called on a closed conversation. */ export declare class ConversationClosedError extends Error { constructor(); } /** * Create a new stateful conversation object. * * The conversation holds the response-ID chain and cumulative token * usage. Each `.turn(...)` call executes a single stage through the * conversation primitive's execution path, threading `previousResponseId` * so the provider can chain against the upstream response. */ export declare function createConversation(deps: TExecuteTurnDeps): TConversation; //# sourceMappingURL=conversation.d.ts.map