/**
 * subscribeToRun — SSE client for /api/runs/:id/stream.
 *
 * Uses fetch + ReadableStream for uniform Node 18+ / browser support.
 * EventSource is NOT used — it lacks custom headers (needed for auth tokens)
 * and behaves differently across runtimes.
 *
 * Protocol:
 *   - Events are SSE-formatted: "event: NAME\nid: ID\ndata: JSON\n\n"
 *   - last-event-id is forwarded via "Last-Event-ID" header on reconnect
 *   - Auto-reconnect on stream close (max 3 retries, exponential backoff)
 *   - AbortSignal propagated; close() aborts the controller
 *
 * Sprint: command-center:sprint-523:quick-6
 */
import type { RunStep } from "./types.js";
export interface SubscribeToRunOptions {
    baseUrl: string;
    getToken?: () => Promise<string>;
    /** UUID of the last step_id received — enables resume catch-up. */
    lastEventId?: string;
    signal?: AbortSignal;
    onStep?: (step: RunStep, event: "step_existing" | "step_new") => void;
    onComplete?: (data: {
        status: string;
        duration_ms?: number;
    }) => void;
    onError?: (err: Error) => void;
}
export interface SubscribeHandle {
    close: () => void;
}
export declare function subscribeToRun(runId: string, opts: SubscribeToRunOptions): Promise<SubscribeHandle>;
//# sourceMappingURL=subscribe.d.ts.map