import type { TokenUsage, ToolCall, ToolCallDelta } from '../../types.js'; import type { PartDelta } from '../types.js'; import type { ToolApprovalChunk, ToolResultChunk } from './wire.js'; export type ParsedSSELine = { id?: string | undefined; messageId?: string | undefined; content?: string | undefined; reasoningContent?: string | undefined; toolCalls?: ToolCallDelta[] | undefined; toolResult?: ToolResultChunk | undefined; toolApproval?: ToolApprovalChunk | undefined; finishReason?: string | null | undefined; model?: string | undefined; error?: string | undefined; responsesOutput?: unknown[] | undefined; usage?: TokenUsage | undefined; } | null; export type SSELineParser = (line: string) => ParsedSSELine; export declare function parseSSELine(line: string): ParsedSSELine; /** Process an SSE stream from a ReadableStream reader. With `onPart`, tool * calls stream as parts; a call the gateway answered with a result is left * off the returned `toolCalls`, which then hold only calls the caller must * run. */ export declare function processSSEStream(reader: ReadableStreamDefaultReader, onContent: (content: string) => void, onToolCall?: (toolCalls: ToolCall[]) => void, onError?: (error: string) => void, onReasoning?: (reasoning: string) => void, onMessageId?: (messageId: string) => void, parseLine?: SSELineParser, onPart?: (delta: PartDelta) => void, onUsage?: (usage: TokenUsage) => void): Promise<{ content: string; messageId: string; toolCalls: ToolCall[]; finishReason: string | null; model: string | null; reasoning: string; responsesOutput: unknown[]; }>;