import express from 'express';
import type { StreamingUpdate } from '../../agent';
import { type DataEnvelope, type ValidationError } from '../../types/dataContract';
/**
 * A buffered SSE event for replay on reconnect.
 * Stored in a per-session ring buffer so late-joining clients can catch up.
 */
export interface BufferedSseEvent {
    seqId: number;
    eventType: string;
    eventData: string;
}
/** Max events retained in the per-session ring buffer. */
export declare const SSE_RING_BUFFER_SIZE = 200;
export interface BroadcastStreamingUpdateOptions {
    observability?: {
        runId?: string;
        requestId?: string;
        runSequence?: number;
    };
    /** Monotonic sequence ID — set by the caller from the session counter. */
    seqId?: number;
    /** Called with the buffered event so the caller can push it to the ring buffer. */
    onBufferedEvent?: (event: BufferedSseEvent) => void;
    onValidDataEnvelopes?: (envelopes: DataEnvelope[]) => void;
    onDataEnvelopeValidationWarning?: (payload: {
        sessionId: string;
        envelopeIndex: number;
        errors: ValidationError[];
        envelope: {
            metaType?: string;
            metaSource?: string;
            displayLayer?: string;
            displayFormat?: string;
        };
    }) => void;
}
export declare class StreamProjector {
    private withObservability;
    setSseHeaders(res: express.Response): void;
    sendEvent(res: express.Response, eventType: string, payload: unknown, seqId?: number): void;
    sendConnected(res: express.Response, payload: unknown): void;
    sendError(res: express.Response, errorMessage: string | undefined, observability?: BroadcastStreamingUpdateOptions['observability']): void;
    sendEnd(res: express.Response, observability?: BroadcastStreamingUpdateOptions['observability']): void;
    bindKeepAlive(req: express.Request, res: express.Response, intervalMs?: number): void;
    broadcastStreamingUpdate(sessionId: string, clients: express.Response[], update: StreamingUpdate, options?: BroadcastStreamingUpdateOptions): void;
    /**
     * Replay buffered events to a single client that reconnected.
     * Sends all events with seqId > lastEventId.
     */
    replayBufferedEvents(res: express.Response, buffer: BufferedSseEvent[], lastEventId: number): number;
}
//# sourceMappingURL=streamProjector.d.ts.map