import type { EventBus } from '../kernel/events.js'; import type { Logger } from '../types/logger.js'; import type { Provider, Request, Response } from '../types/provider.js'; import type { Context } from './context.js'; interface ThinkingEntry { textBuf: string; signature?: string | undefined; providerMeta?: Record; } interface StreamingState { model: string; stopReason: Response['stopReason']; usage: Response['usage']; textBuffers: string[]; currentTextIndex: number; tools: Map; }>; thinking: ThinkingEntry[]; currentThinkingIndex: number; blockOrder: Array<{ kind: 'text'; idx: number; } | { kind: 'tool'; id: string; } | { kind: 'thinking'; idx: number; }>; } export declare function buildResponse(state: StreamingState): Response; export declare function createStreamingState(model: string): StreamingState; export declare function handleMessageStart(state: StreamingState, model: string): void; export declare function handleContentBlockStart(state: StreamingState, ev: { kind?: string | undefined; id?: string | undefined; name?: string | undefined; providerMeta?: Record; }): void; export declare function handleContentBlockStop(state: StreamingState, ev: { index?: number | undefined; }): void; export declare function handleTextDelta(state: StreamingState, text: string): void; export declare function handleToolUseStart(state: StreamingState, ev: { id: string; name: string; }): void; export declare function handleToolUseInputDelta(state: StreamingState, ev: { id: string; partial: string; }): void; export declare function safeJsonOrRaw(s: string): unknown; export declare function handleToolUseStop(state: StreamingState, ev: { id: string; input?: unknown | undefined; providerMeta?: Record; }): void; /** * Open a fresh thinking block. Providers that don't pre-announce blocks * (e.g. OpenAI/DeepSeek) can call this lazily on the first reasoning delta. */ export declare function handleThinkingStart(state: StreamingState, ev: { providerMeta?: Record; }): void; export declare function handleThinkingDelta(state: StreamingState, text: string): void; export declare function handleThinkingSignature(state: StreamingState, signature: string): void; export declare function handleThinkingStop(state: StreamingState): void; export declare function handleMessageStop(state: StreamingState, ev: { stopReason?: Response['stopReason'] | undefined; usage?: Response['usage'] | undefined; }): void; export declare function streamProviderToResponse(provider: Provider, req: Request, signal: AbortSignal, ctx: Context, events: EventBus, logger: Logger): Promise; export {}; //# sourceMappingURL=streaming-response-builder.d.ts.map