/** Internal, side-effect-free lifecycle contracts. Effects belong to the owner. */ export type TransitionTable = Readonly>>>>; export declare class Lifecycle { readonly name: string; private readonly table; private current; private transitions; constructor(name: string, initial: S, table: TransitionTable); get state(): S; get history(): { from: S; event: E; to: S; }[]; can(event: E): boolean; send(event: E): S; } /** One WebSocket connection attempt; room synchronization starts after `open`. */ export type WebSocketHandshakeState = 'idle' | 'awaitingTicket' | 'connecting' | 'open' | 'diagnosing' | 'failed' | 'cancelled'; export type WebSocketHandshakeEvent = 'request' | 'ticket' | 'opened' | 'diagnose' | 'fail' | 'cancel'; export declare const webSocketHandshakeTransitions: TransitionTable; /** One P2P RTCPeerConnection; replacement creates a new machine and token. */ export type P2pPeerState = 'negotiating' | 'connected' | 'disconnected' | 'restarting' | 'closed'; export type P2pPeerEvent = 'connected' | 'disconnect' | 'fail' | 'restart' | 'close'; export declare const p2pPeerTransitions: TransitionTable; export type RoomConnectionState = 'idle' | 'connecting' | 'ready' | 'reconnecting' | 'closed' | 'error'; export type RoomConnectionEvent = 'connect' | 'transportReady' | 'failed' | 'transportClosed' | 'retry' | 'leave'; export declare const roomConnectionTransitions: TransitionTable; export type SfuConnectionState = 'idle' | 'connecting' | 'connected' | 'recovering' | 'error' | 'closed'; export type SfuConnectionEvent = 'connect' | 'connected' | 'recover' | 'failed' | 'close'; export declare const sfuConnectionTransitions: TransitionTable; export type DeltaBaselineState = 'empty' | 'ready'; export type DeltaBaselineEvent = 'checkpoint' | 'patch' | 'replay'; export declare const deltaBaselineTransitions: TransitionTable; export type CameraState = 'off' | 'acquiring' | 'publishing' | 'on' | 'stopping' | 'error'; export type CameraEvent = 'acquire' | 'captured' | 'published' | 'release' | 'stopped' | 'failed' | 'leave'; export declare const cameraTransitions: TransitionTable; export type ActivityState = 'active' | 'hidden' | 'hostPaused' | 'hiddenAndHostPaused'; export type ActivityEvent = 'hide' | 'show' | 'pause' | 'resume'; export declare const activityTransitions: TransitionTable; /** Owners register/remove events; this object owns only the two independent gates. */ export declare class MediaActivity { readonly lifecycle: Lifecycle; constructor(); refreshVisibility(): void; pause(): void; resume(): void; get active(): boolean; get hostPaused(): boolean; get hidden(): boolean; } export type CaptureSessionState = 'idle' | 'acquiring' | 'configuring' | 'joined' | 'leaving'; export type CaptureSessionEvent = 'join' | 'captured' | 'joined' | 'leave' | 'cleaned'; export declare const captureSessionTransitions: TransitionTable; /** Foreground capture repair is independent from call ownership and transport recovery. */ export type MediaRestorationState = 'idle' | 'restoring' | 'backoff' | 'failed' | 'cancelled'; export type MediaRestorationEvent = 'start' | 'retry' | 'attempt' | 'success' | 'fail' | 'cancel' | 'reset'; export declare const mediaRestorationTransitions: TransitionTable; export type MatchSearchState = 'idle' | 'requesting' | 'queued' | 'admitting' | 'matched' | 'cancelling' | 'expiring' | 'failing' | 'cancelled' | 'expired' | 'error'; export type MatchSearchEvent = 'start' | 'queued' | 'assigned' | 'confirmed' | 'cancel' | 'expire' | 'fail' | 'cleaned'; export declare const matchSearchTransitions: TransitionTable; export type ActionDeliveryState = 'queued' | 'inFlight' | 'waitingSync' | 'acknowledged' | 'rejected' | 'expired' | 'cancelled'; export type ActionDeliveryEvent = 'send' | 'wait' | 'ack' | 'reject' | 'expire' | 'cancel'; export declare const actionDeliveryTransitions: TransitionTable; /** Ownership of a durable request id, independent from transport delivery. */ export type ActionIdentityState = 'active' | 'completed' | 'released' | 'evicted'; export type ActionIdentityEvent = 'complete' | 'release' | 'evict'; export declare const actionIdentityTransitions: TransitionTable; export type VersionCheckState = 'stopped' | 'idle' | 'checking' | 'recovering'; export type VersionCheckEvent = 'start' | 'probe' | 'matched' | 'mismatch' | 'unresponsive' | 'stop'; export declare const versionCheckTransitions: TransitionTable; export type LossRecoveryState = 'healthy' | 'suspect' | 'degraded' | 'eligible'; export type LossRecoveryEvent = 'bad' | 'good'; export declare const lossRecoveryTransitions: TransitionTable; export type FirstFrameState = 'waiting' | 'receiving' | 'cooldown'; export type FirstFrameEvent = 'reset' | 'frame' | 'retry'; export declare const firstFrameTransitions: TransitionTable; /** P2P video receive health, including receiver replacement and later decoder stalls. */ export type P2pVideoHealthState = 'waiting' | 'receiving' | 'suspect' | 'recovering'; export type P2pVideoHealthEvent = 'frame' | 'stall' | 'retry' | 'reset'; export declare const p2pVideoHealthTransitions: TransitionTable; /** Periodic RTC diagnostics; app suspension pauses sampling without losing baselines. */ export type NetworkProbeState = 'idle' | 'running' | 'sampling' | 'paused' | 'failed' | 'stopped'; export type NetworkProbeEvent = 'start' | 'sample' | 'success' | 'fail' | 'pause' | 'resume' | 'retry' | 'stop'; export declare const networkProbeTransitions: TransitionTable; /** Socket openness and authoritative room freshness are independent dimensions. */ export type RoomSynchronizationState = 'stale' | 'awaitingSnapshot' | 'synchronized'; export type RoomSynchronizationEvent = 'request' | 'confirm' | 'invalidate'; export declare const roomSynchronizationTransitions: TransitionTable; export type ControlReadState = 'idle' | 'reading' | 'backoff' | 'succeeded' | 'failed' | 'cancelled'; export type ControlReadEvent = 'attempt' | 'retry' | 'success' | 'fail' | 'cancel'; export declare const controlReadTransitions: TransitionTable; export type ControlWriteState = 'idle' | 'inFlight' | 'succeeded' | 'failed' | 'expired' | 'cancelled'; export type ControlWriteEvent = 'start' | 'succeed' | 'fail' | 'expire' | 'cancel'; export declare const controlWriteTransitions: TransitionTable; /** A server-declared idempotent write may repeat the exact payload after an ambiguous response. */ export type IdempotentWriteState = 'idle' | 'inFlight' | 'backoff' | 'succeeded' | 'failed' | 'expired' | 'cancelled'; export type IdempotentWriteEvent = 'attempt' | 'retry' | 'succeed' | 'fail' | 'expire' | 'cancel'; export declare const idempotentWriteTransitions: TransitionTable; export type MediaRequestState = 'queued' | 'inFlight' | 'succeeded' | 'failed' | 'expired' | 'cancelled'; export type MediaRequestEvent = 'send' | 'succeed' | 'fail' | 'expire' | 'cancel'; export declare const mediaRequestTransitions: TransitionTable; export type LeaderboardState = 'idle' | 'loading' | 'ready' | 'error' | 'disposed'; export type LeaderboardEvent = 'query' | 'snapshot' | 'fail' | 'dispose'; export declare const leaderboardTransitions: TransitionTable; export type ScoreSubmissionState = 'queued' | 'inFlight' | 'backoff' | 'succeeded' | 'failed' | 'expired' | 'cancelled'; export type ScoreSubmissionEvent = 'send' | 'retry' | 'succeed' | 'fail' | 'expire' | 'cancel'; export declare const scoreSubmissionTransitions: TransitionTable; /** Legacy enqueue operations and controller ownership; findMatch has its own FSM. */ export type MatchQueueState = 'idle' | 'joining' | 'queued' | 'matched' | 'leaving' | 'error' | 'disposed'; export type MatchQueueEvent = 'join' | 'queued' | 'matched' | 'leave' | 'left' | 'fail' | 'dispose'; export declare const matchQueueTransitions: TransitionTable; export type RoomDispatchState = 'idle' | 'draining'; export type RoomDispatchEvent = 'begin' | 'finish'; export declare const roomDispatchTransitions: TransitionTable; /** A cached client is retired before a newly-created room reuses its id. */ export type RoomHandleState = 'cached' | 'retiring' | 'replacementInstalled' | 'replaced' | 'replacedAfterCleanupError'; export type RoomHandleEvent = 'retire' | 'install' | 'cleanupSucceeded' | 'cleanupFailed'; export declare const roomHandleTransitions: TransitionTable; /** Reliable chat delivery uses the server echo as its acknowledgement. */ export type ChatDeliveryState = 'queued' | 'inFlight' | 'retrying' | 'acknowledged' | 'rejected' | 'expired' | 'cancelled'; export type ChatDeliveryEvent = 'send' | 'wait' | 'ack' | 'reject' | 'expire' | 'cancel'; export declare const chatDeliveryTransitions: TransitionTable;