import type { CompletionError, CompletionEvent, CompletionFinal, CompletionStats, StopReason, ToolCall } from "../schemas/index"; import { type ToolHandlerMap } from "./tool-helpers"; export type AggregatedEvents = { contentText: string; thinkingText: string; stats: CompletionStats | undefined; toolCalls: ToolCall[]; rawFullText: string | undefined; error: CompletionError | undefined; stopReason: StopReason | undefined; /** * True when the terminal `completionDone` carried * `stopReason: "cancelled"`. The client wrapper rejects the * promise-aggregates (`final` / `text` / `toolCalls` / `stats`) with * `InferenceCancelledError` carrying the partial state when this is * set; the `events` stream itself still ends normally. */ cancelled: boolean; }; export declare function aggregateEvents(events: CompletionEvent[]): AggregatedEvents; export declare function buildFinalFromEvents(events: CompletionEvent[], handlers: ToolHandlerMap): { final: CompletionFinal; error: CompletionError | undefined; cancelled: boolean; }; //# sourceMappingURL=aggregate-events.d.ts.map