import type { SSEEvent } from '../types/api'; import { type SSEConnectionState } from './sse-client'; export type StreamEventHandler = (event: SSEEvent) => void; export type Release = () => void; export interface StreamHandle { on: (handler: StreamEventHandler) => Release; release: Release; } /** * Connection state of the active project's multiplexed SSE stream. Extends * the raw client states with `fallback` for older daemons that serve * per-stream SSE (each fallback stream manages its own reconnects). */ export type ProjectConnectionState = SSEConnectionState | { status: 'fallback'; }; /** * Subscribe to a session's event stream over the shared multiplexed * connection. Multiple subscribers for the same session share one * subscription; all sessions share one SSE connection per window. */ export declare function acquireSessionEventStream(sessionId: string): StreamHandle; /** * Subscribe to global client events (notifications, session status) over the * shared multiplexed connection. */ export declare function acquireClientEventStream(): StreamHandle; /** Returns the active project's multiplexed SSE connection state. */ export declare function getProjectConnectionState(): ProjectConnectionState; /** * Subscribes to connection state changes of any project multiplexer. Pair * with {@link getProjectConnectionState} to read the active project's state. */ export declare function onProjectConnectionState(handler: (state: ProjectConnectionState) => void): Release; /** * Runs the full recovery path for the active project's event connection: * renews the remote owner session when a renewal broker is installed, then * re-establishes the multiplexed SSE connection. */ export declare function retryProjectConnection(): Promise; //# sourceMappingURL=event-stream.d.ts.map