import type { AgentTrace } from './types'; export interface StreamingChunk { type: 'openai' | 'anthropic' | 'sse'; data: any; timestamp: string; raw?: string; } export interface StreamingRecorderOptions { format?: 'openai' | 'anthropic' | 'sse' | 'auto'; metadata?: Record; } type ChunkHandler = (chunk: StreamingChunk) => void; type CompleteHandler = (trace: AgentTrace) => void; type ErrorHandler = (error: Error) => void; /** * Records agent traces from streaming responses. * Supports OpenAI streaming, Anthropic streaming, and raw SSE format. */ export declare class StreamingRecorder { private chunks; private format; private metadata; private chunkHandlers; private completeHandlers; private errorHandlers; private assembledContent; private toolCalls; private startTime; private finished; private cachedTrace; constructor(options?: StreamingRecorderOptions); /** Register a chunk listener */ onChunk(handler: ChunkHandler): void; /** Register a completion listener */ onComplete(handler: CompleteHandler): void; /** Register an error listener */ onError(handler: ErrorHandler): void; /** Feed a raw chunk into the recorder */ recordChunk(data: any, format?: 'openai' | 'anthropic' | 'sse'): void; /** Parse and record an SSE text block (multiple `data:` lines) */ recordSSE(text: string): void; /** Signal that streaming is complete and assemble the trace */ finish(): AgentTrace; /** Get all recorded chunks */ getChunks(): StreamingChunk[]; /** Check if recording is finished */ isFinished(): boolean; /** Save the assembled trace to a file */ save(outputPath: string): void; private detectFormat; private processOpenAIChunk; private processAnthropicChunk; private processSSEChunk; private assembleTrace; } export {}; //# sourceMappingURL=streaming.d.ts.map