/**
 * @param {string} data
 * @returns {Record<string, unknown> | null}
 */
export function parseStreamMessage(data: string): Record<string, unknown> | null;
/**
 * @param {Array<Record<string, unknown>>} events
 * @param {Record<string, unknown>} event
 * @returns {Array<Record<string, unknown>>}
 */
export function appendEvent(events: Array<Record<string, unknown>>, event: Record<string, unknown>): Array<Record<string, unknown>>;
/**
 * @param {{ disconnected: boolean; complete: boolean }} input
 * @returns {boolean}
 */
export function shouldStartPolling(input: {
    disconnected: boolean;
    complete: boolean;
}): boolean;
/**
 * Maps a polled setup-state.json snapshot into the degraded completion events
 * the view model can fold. Persisted state only carries terminal outcomes
 * (R8), so this can never reconstruct an in_progress cursor.
 *
 * @param {Record<string, unknown> | null} state
 * @returns {Array<Record<string, unknown>>}
 */
export function pollingStateToEvents(state: Record<string, unknown> | null): Array<Record<string, unknown>>;
/**
 * @param {Array<Record<string, unknown>>} events
 * @returns {boolean}
 */
export function isRunComplete(events: Array<Record<string, unknown>>): boolean;
/**
 * @param {{ isPrimaryTab: boolean; hasActiveRun: boolean }} input
 * @returns {{ readOnly: boolean; notice: string | null }}
 */
export function buildMultiTabViewState(input: {
    isPrimaryTab: boolean;
    hasActiveRun: boolean;
}): {
    readOnly: boolean;
    notice: string | null;
};
/**
 * @param {{ matches: boolean } | null} mediaQuery
 * @returns {boolean}
 */
export function prefersReducedMotion(mediaQuery: {
    matches: boolean;
} | null): boolean;
/**
 * Thin wiring: binds the pure decisions above to injected browser globals.
 * Not unit-tested (humble glue) — exercised in the browser only.
 *
 * @param {Object} options
 * @param {string} options.runId
 * @param {(events: Array<Record<string, unknown>>) => void} options.onEvents
 * @param {() => void} options.onDisconnected
 * @param {() => void} options.onComplete
 * @param {typeof EventSource} [options.eventSourceFactory]
 * @param {Storage} [options.storage]
 * @returns {{ close: () => void }}
 */
export function connectSetupWizardStream(options: {
    runId: string;
    onEvents: (events: Array<Record<string, unknown>>) => void;
    onDisconnected: () => void;
    onComplete: () => void;
    eventSourceFactory?: {
        new (url: string | URL, init?: import("undici-types").EventSourceInit): import("undici-types").EventSource;
        prototype: import("undici-types").EventSource;
        readonly CLOSED: 2;
        readonly CONNECTING: 0;
        readonly OPEN: 1;
    } | undefined;
    storage?: any;
}): {
    close: () => void;
};
//# sourceMappingURL=setupWizardStream.d.ts.map