import type { WebSocket } from "ws"; export type HistoryRouteRegistration = { kind: "leader"; upstreamRequestId: string; } | { kind: "joined"; upstreamRequestId: string; } | { kind: "duplicate"; } | { kind: "collision"; } | { kind: "client_capacity_exceeded"; } | { kind: "capacity_exceeded"; }; export type HistoryRouteTarget = { clientWs: WebSocket; requestId: string; }; export type HistoryRouteResolution = { kind: "matched"; targets: HistoryRouteTarget[]; } | { kind: "stale_proxy"; } | { kind: "tombstone"; } | { kind: "unmatched"; }; export interface SessionHistoryRouteRegistryOptions { maxEntries?: number; maxPendingPerClient?: number; pendingTtlMs?: number; joinWindowMs?: number; tombstoneTtlMs?: number; now?: () => number; upstreamRequestIdFactory?: () => string; } /** * Coalesces overlapping history requests for the same live proxy socket and correlates the one * upstream response with every exact browser waiter. External request IDs never cross the proxy * wire: a relay-owned ID prevents a late response from being confused with a reused client ID. */ export declare class SessionHistoryRouteRegistry { private readonly routes; private readonly flights; private readonly flightTombstones; private readonly maxEntries; private readonly maxPendingPerClient; private readonly pendingTtlMs; private readonly joinWindowMs; private readonly tombstoneTtlMs; private readonly now; private readonly upstreamRequestIdFactory; private upstreamRequestSequence; constructor(options?: SessionHistoryRouteRegistryOptions); register(proxyId: string, requestId: string, clientWs: WebSocket, proxyWs: WebSocket): HistoryRouteRegistration; resolve(proxyId: string, requestId: string, proxyWs: WebSocket): HistoryRouteResolution; abandonSocket(clientWs: WebSocket): void; clearProxy(proxyId: string): void; private createFlight; private migrateFlight; private expireFlight; private setFlightTombstone; private evictOldestRouteTombstone; private pruneExpired; } //# sourceMappingURL=session-history-route-registry.d.ts.map