import { CopilotEvent, CopilotHandler, CopilotRequest } from './contract'; export declare const COPILOT_NDJSON_TYPE = "application/x-ndjson"; /** A `CopilotHandler` that POSTs the request to `url` and reads the NDJSON event stream of the response. */ export declare function createCopilotFetchHandler(options: { url: string; headers?: Record; fetch?: typeof fetch; }): CopilotHandler; /** Validates an incoming request body (the server side of `createCopilotFetchHandler`). */ export declare function readCopilotRequest(body: unknown): { ok: true; request: CopilotRequest; } | { ok: false; error: string; }; /** * Serializes copilot events as NDJSON, pulling one event per read. While it waits for the next event it sends a bare * `\n` every `heartbeatMs` (default 15000; 0 disables), so proxies do not close a connection that is idle while the * model thinks; readers skip blank lines. On cancel it calls `onCancel` (e.g. to abort the source), then returns the * source iterator. */ export declare function copilotEventsToNdjson(events: AsyncIterable, options?: { onError?(error: unknown): void; onCancel?(): void; heartbeatMs?: number; }): ReadableStream;