import type { WebSocket } from "ws"; import type { PreviewScope } from "@dev-anywhere/shared"; type PreviewRouteRegistration = { kind: "registered"; upstreamRequestId: string; } | { kind: "client_capacity_exceeded"; } | { kind: "capacity_exceeded"; }; type PreviewRouteResolution = { kind: "matched"; clientWs: WebSocket; clientId: string; clientRequestId: string; scope: PreviewScope; } | { kind: "response_type_mismatch"; expectedResponseType: ResponseType; } | { kind: "stale_proxy"; } | { kind: "tombstone"; } | { kind: "unmatched"; }; export interface PreviewRouteRegistryOptions { maxEntries?: number; maxPendingPerClient?: number; pendingTtlMs?: number; tombstoneTtlMs?: number; now?: () => number; upstreamRequestIdFactory?: () => string; } interface PreviewRouteRegistryConfig { label: string; requestIdPrefix: string; } /** * Correlates a request with the exact browser and Proxy sockets that carried it. Request IDs are * rewritten before crossing the Relay so equal IDs from different browsers cannot collide. * Completed, abandoned, and expired routes become short-lived tombstones so late responses cannot * fall through to a broadcast path. */ export declare class PreviewRouteRegistry { private readonly config; private readonly routes; private readonly maxEntries; private readonly maxPendingPerClient; private readonly pendingTtlMs; private readonly tombstoneTtlMs; private readonly now; private readonly upstreamRequestIdFactory; private upstreamRequestSequence; constructor(config: PreviewRouteRegistryConfig, options?: PreviewRouteRegistryOptions); register(proxyId: string, clientRequestId: string, expectedResponseType: ResponseType, clientWs: WebSocket, proxyWs: WebSocket): PreviewRouteRegistration; resolve(proxyId: string, upstreamRequestId: string, responseType: ResponseType, proxyWs: WebSocket): PreviewRouteResolution; abandonSocket(clientWs: WebSocket): void; clearProxy(proxyId: string): void; dispose(): void; private createUniqueUpstreamRequestId; private setTombstone; private deleteRoute; private evictOldestTombstone; private pruneExpired; } export {}; //# sourceMappingURL=preview-route-registry.d.ts.map