import type * as http from "node:http";
export declare function initSSE(res: http.ServerResponse, req?: http.IncomingMessage): void;
export declare function sendSSE(res: http.ServerResponse, event: string, data: unknown): void;
export declare function sendSSEDone(res: http.ServerResponse, data: unknown): void;
export interface DynamicHeartbeat {
    update(phase: string, message: string): void;
    stop(): void;
}
/**
 * Start a dynamic heartbeat that can switch phase/message on the fly.
 * Unlike `withHeartbeat`, this is imperative: call `update()` to change
 * what the next tick emits, and `stop()` when done.
 */
export declare function startDynamicHeartbeat(res: http.ServerResponse, evalId: number | undefined, initialPhase: string, initialMessage: string, intervalMs?: number): DynamicHeartbeat;
/**
 * Wrap an async operation with periodic heartbeat SSE events.
 * Emits a progress event every `intervalMs` with elapsed time so the
 * frontend knows the system is still alive during long LLM calls.
 */
export declare function withHeartbeat<T>(res: http.ServerResponse, evalId: number | undefined, phase: string, messagePrefix: string, fn: () => Promise<T>, intervalMs?: number): Promise<T>;
