/** * Minimal Server-Sent Events parser for HTTP streaming responses. * * Yields parsed events as `{ event, data }` pairs. Per spec: * - Each event is separated by a blank line * - `event: foo` sets the event name (defaults to "message") * - `data: ...` lines accumulate into the data buffer * - `:` lines are comments and ignored * - `id` / `retry` fields are accepted and ignored * * For Anthropic the wire format is canonical SSE with explicit `event:` lines. * For OpenAI / OpenAI-compatible the format omits `event:` and just emits * `data: ` chunks, with a final `data: [DONE]`. Both work with this * parser; consumers branch on event name or just on `data`. */ export interface SSEMessage { event: string; data: string; } export declare function parseSSE(body: ReadableStream | NodeJS.ReadableStream | null): AsyncIterable; /** * SSE line-folding transform stream. * * Wraps an upstream `ReadableStream` so oversized `data:` fields * are split into multiple `data:` lines at JSON-safe boundaries. `parseSSE` * rejoins those lines with `\n`, which preserves semantic content for the * structured JSON envelopes emitted by provider streams while keeping the * per-line pending buffer under the safety cap. */ export declare function createSseLineFoldingTransform(source: ReadableStream, maxLineBytes?: number): ReadableStream; //# sourceMappingURL=sse.d.ts.map