import type { Request, Response } from "express"; import { WebSocket } from "ws"; import { type RelayControlMessage } from "@dev-anywhere/shared"; import type { Logger } from "@dev-anywhere/shared/logger"; import type { RelayChaos } from "./chaos.js"; import type { RelayRegistry } from "./registry.js"; interface DevicePreviewBridgeOptions { registry: RelayRegistry; logger: Logger; chaos?: RelayChaos; clientTokenRequired?: boolean; validateClientToken?: (token: string | null) => boolean; tokenTtlMs?: number; startTimeoutMs?: number; firstFrameTimeoutMs?: number; drainTimeoutMs?: number; registerTimeoutMs?: number; maxStreams?: number; maxStreamsPerProxy?: number; maxStreamsPerClient?: number; maxStreamsPerPreview?: number; maxInputsPerSecond?: number; maxOutstandingInputsPerLease?: number; now?: () => number; tokenFactory?: () => string; idFactory?: () => string; } export declare class DevicePreviewBridge { private readonly options; private readonly routes; private readonly proxyConnections; private readonly transports; private readonly tokens; private readonly leases; private readonly controllerByPreview; private readonly streams; private readonly tokenTtlMs; private readonly startTimeoutMs; private readonly firstFrameTimeoutMs; private readonly drainTimeoutMs; private readonly registerTimeoutMs; private readonly maxStreams; private readonly maxStreamsPerProxy; private readonly maxStreamsPerClient; private readonly maxStreamsPerPreview; private readonly maxInputsPerSecond; private readonly maxOutstandingInputsPerLease; private readonly now; private readonly tokenFactory; private readonly idFactory; private disposed; constructor(options: DevicePreviewBridgeOptions); /** Called for every successful main `/proxy` registration; returns a per-connection nonce. */ registerProxyConnection(proxyId: string, proxyWs: WebSocket): string; handleStreamTransportConnection(ws: WebSocket): void; handleClientControl(clientWs: WebSocket, message: RelayControlMessage): boolean; handleProxyControl(proxyId: string, proxyWs: WebSocket, message: RelayControlMessage, raw: string): boolean; handlePreviewRemovedEvent(proxyId: string, proxyWs: WebSocket, previewId: string): void; handleHttpRequest(req: Request, res: Response): void; abandonClientSocket(clientWs: WebSocket): void; clearProxy(proxyId: string): void; revokeProxy(proxyId: string): void; dispose(): void; private forwardManagementRequest; private sendManagementFailure; private resolveManagementResponse; private issueStreamUrl; private forwardInput; private claimControl; private handleStreamStartResponse; private handleStreamComplete; private handleInputAck; private handleFrame; private handleH264Packet; private writeFrame; private writeH264Packet; private writeStreamRecord; private requestH264Resync; private armFirstFrameTimer; private clearFirstFrameTimer; private sendFlow; private failStream; private finishStream; private markStreamFinished; private stopPreviewStreams; private failStreamsForTransport; private releaseLease; private expireToken; private cleanupExpiredTokens; private hasLeaseCapacity; private clientBindingStillMatches; private clientLeaseStillValid; private sendControlRevoked; private allocateUniqueToken; private allocateUniqueRuntimeId; private clearProxyRuntime; private isCurrentProxyConnection; private isDeviceMessage; private rejectTransport; private sendClient; private sendProxy; /** Relay-owned lifecycle barriers bypass public chaos routing to preserve main-WS ordering. */ private sendProxyInternal; private sendRelayError; } export {}; //# sourceMappingURL=device-preview-bridge.d.ts.map