import { EventSource } from "eventsource"; import { ConversationStream, ConversationTransport, SteerResult, TransportHandlers, TransportSteerRequest, TransportStopRequest, TransportTurnRequest, TurnStopped } from "./transport"; type StreamOptions = { debug?: boolean; onPayload(payload: { success: boolean; data?: { convoId?: string; quitStream?: boolean; }; }): void; }; /** * Streams a server-sent-events endpoint, closing when the server says the stream is * done. Shared by turns and by the progress stream, which is SSE-only. */ export declare function streamSSE(url: string, options: StreamOptions): EventSource; /** Carries a turn over the HTTP chat endpoint. The default. */ export declare class SSEConversationTransport implements ConversationTransport { private readonly config; constructor(config: { endpoint(): string; stopEndpoint?(): string; steerEndpoint?(): string; apiKey: string; debug?: boolean; }); send(request: TransportTurnRequest, handlers: TransportHandlers): ConversationStream; /** * The turn is a GET that streams until it is done, so an interruption cannot travel on the * same request and gets one of its own. * * Closing the stream is deliberately not a stop: a reload, a backgrounded tab or a * reconnect all drop the connection and all expect to pick the answer back up. */ stop(request: TransportStopRequest): Promise; steer(request: TransportSteerRequest): Promise; private post; } export {};