/** * Zoe SDK — HTTP response helpers * * Converts StreamTextResult into HTTP-friendly SSE responses * using the Web API Response and ReadableStream interfaces. * * Delegates to StreamManager for SSE generation. */ import type { StreamTextResult } from "../../core/types.js"; export interface SSEOptions { headers?: Record; } /** * Formats a single Server-Sent Events message. * * @param event The SSE event name * @param data The payload (will be JSON-serialised) * @returns A string in SSE wire format: `event: ...\ndata: ...\n\n` */ export declare function createSSEMessage(event: string, data: unknown): string; /** * Converts a StreamTextResult into a SSE-formatted ReadableStream. * * Delegates to the StreamManager's toSSEStream() for actual event generation. * The result's toSSEStream() emits events in the correct order: * - `text` — incremental text deltas * - `tool_call` — tool invocations * - `tool_result` — tool execution results * - `done` — final usage and finish reason */ export declare function toSSEStream(result: StreamTextResult, _options?: SSEOptions): ReadableStream; /** * Converts a StreamTextResult into a Web API `Response` with an SSE body. * * Delegates to the StreamManager's toResponse() which sets standard SSE headers: * - `Content-Type: text/event-stream` * - `Cache-Control: no-cache` * - `Connection: keep-alive` * * @param result The streaming result to convert * @param options Optional extra headers to merge into the response */ export declare function toResponse(result: StreamTextResult, options?: SSEOptions): Response;