import { encodeSseEvent } from './sse.js';
export { encodeSseEvent };
/**
 * Heartbeat interval. 25 s sits safely under the most aggressive
 * proxy/idle timeouts we've encountered in production (Cloudflare 30 s,
 * Vercel Serverless 30 s, most reverse-proxies 60 s). Identical to the
 * preview stream's value so both channels behave the same way under
 * the same proxy fleet.
 */
export declare const NOTIFICATION_SSE_HEARTBEAT_MS = 25000;
/**
 * Maximum stream lifetime in ms. After this, the server closes the
 * stream cleanly so `EventSource` reconnects — important because some
 * platforms (Vercel Fluid Compute, Cloudflare Workers) cap any single
 * response at a few minutes regardless of activity.
 */
export declare const NOTIFICATION_SSE_MAX_LIFETIME_MS: number;
export interface NotificationStreamOptions {
    /** Override for tests so we don't have to wait 25 seconds. */
    heartbeatMs?: number;
    /** Override for tests so we don't tie up the suite for 4 minutes. */
    maxLifetimeMs?: number;
}
/**
 * Build a `ReadableStream<Uint8Array>` of notification SSE events for
 * the given userId. See the file header for the wire format.
 *
 * The stream:
 *
 *   1. Emits the `ready` frame.
 *   2. Subscribes to the notification bus for `userId`.
 *   3. Forwards every `publishNotification(...)` to the client.
 *   4. Sends heartbeats every `heartbeatMs`.
 *   5. Closes cleanly after `maxLifetimeMs`, letting `EventSource`
 *      auto-reconnect (the browser does this for us at the HTTP/2
 *      stream layer).
 *
 * On `cancel()` (client disconnect or `controller.close()`), every
 * timer is cleared and the bus subscription is dropped — no leaked
 * listener after a hang-up.
 */
export declare function createNotificationStream(userId: string, opts?: NotificationStreamOptions): ReadableStream<Uint8Array>;
/**
 * Standard SSE response headers. Identical to the preview stream's
 * header set — same proxy fleet, same X-Accel-Buffering disable, same
 * cache-control directives.
 */
export declare const NOTIFICATION_SSE_HEADERS: Record<string, string>;
export declare function createNotificationStreamResponse(userId: string, opts?: NotificationStreamOptions): Response;
//# sourceMappingURL=notification-stream.d.ts.map