/** State for hosted lifecycle terminal. */ export interface HostedLifecycleTerminalState { status: "completed" | "failed" | "cancelled"; metadata?: { modelId?: string; usage?: { inputTokens?: number; outputTokens?: number; cachedInputTokens?: number; cacheCreationInputTokens?: number; cacheReadInputTokens?: number; reasoningTokens?: number; }; usageCaptureStatus?: "complete" | "partial" | "missing"; }; terminalErrorCode?: string | null; terminalErrorMessage?: string | null; } /** Public API contract for hosted lifecycle execution. */ export interface HostedLifecycleExecution { stream: AsyncIterable; waitForFinish: () => Promise; } /** Public API contract for hosted lifecycle adapter. */ export interface HostedLifecycleAdapter { startRun: (input: { abortSignal: AbortSignal; }) => Promise | TRun; appendEvents?: (run: TRun, chunk: TChunk) => Promise | void; persistTranscriptChunk?: (run: TRun, chunk: TChunk) => Promise | void; persistTranscriptTerminalState?: (run: TRun, terminalState: HostedLifecycleTerminalState) => Promise | void; onTerminalState?: (run: TRun, terminalState: HostedLifecycleTerminalState) => Promise | void; finalizeRun?: (run: TRun, terminalState: HostedLifecycleTerminalState) => Promise | void; cancelRun?: (run: TRun, terminalState: HostedLifecycleTerminalState) => Promise | void; } /** Options accepted by hosted lifecycle runner. */ export interface HostedLifecycleRunnerOptions { abortSignal: AbortSignal; execution: HostedLifecycleExecution; adapter: HostedLifecycleAdapter; resolveTerminalState: () => Promise | HostedLifecycleTerminalState; resolveErrorTerminalState?: (error: unknown) => Promise | HostedLifecycleTerminalState; } /** Result returned from hosted lifecycle run. */ export interface HostedLifecycleRunResult { run: TRun; terminalState: HostedLifecycleTerminalState; } /** Run hosted lifecycle. */ export declare function runHostedLifecycle(options: HostedLifecycleRunnerOptions): Promise>; //# sourceMappingURL=lifecycle.d.ts.map