import type { Response } from "express";
import type { EventEmitter } from "events";
import type { StreamEvent } from "../services/claude.js";
/**
 * Write standard SSE headers to an Express response.
 */
export declare function writeSSEHeaders(res: Response): void;
/**
 * Send an SSE event as a JSON-encoded `data:` line.
 */
export declare function sendSSE(res: Response, data: Record<string, unknown>): void;
/**
 * Start a periodic SSE heartbeat (comment line) to keep the connection alive
 * and allow detection of dead connections on both sides.
 *
 * SSE comment lines (`:`) are ignored by EventSource and custom parsers but
 * keep the TCP socket alive through proxies and cause dead sockets to surface
 * EPIPE/ECONNRESET — triggering `req.on("close")` for server-side cleanup.
 *
 * Returns a cleanup function to stop the heartbeat.
 */
export declare function startSSEHeartbeat(res: Response, intervalMs?: number): () => void;
/**
 * Create a standard SSE event handler that forwards StreamEvents to the client.
 *
 * Handles: done → message_complete, error → message_error,
 * permission_request/user_question/plan_review/budget → forwarded as-is,
 * everything else → message_update notification.
 *
 * Returns the handler function so the caller can attach/detach it from an emitter.
 */
export declare function createSSEHandler(res: Response, emitter: EventEmitter): (event: StreamEvent) => void;
//# sourceMappingURL=sse.d.ts.map