import { StreamWriterGuard } from './stream-writer-guard'; import type { StreamChunk } from '../../types'; import type { ExecutionOptions, RunOptions, TokenUsage } from '../../types/sdk/agent'; import type { AgentAbortScope, AgentEventBus } from '../state/event-bus'; export interface StreamSessionDeps { eventBus: AgentEventBus; abortScope: AgentAbortScope; runId: string; options: (RunOptions & ExecutionOptions) | undefined; withRootSpan: (operation: 'generate' | 'stream', options: ExecutionOptions | undefined, runId: string, fn: () => Promise) => Promise; runLoop: (guard: StreamWriterGuard) => Promise; flushTelemetry: (options: ExecutionOptions | undefined) => Promise; cleanupRun: () => Promise; updateState: (status: 'failed' | 'cancelled') => void; emitError: (error: unknown) => void; persistTurnOnAbort?: () => Promise; getTerminalFinish?: () => { usage?: TokenUsage; model?: string; }; } export declare function startStreamSession(deps: StreamSessionDeps): ReadableStream;