/** * Centralized internal identifiers and tuning defaults. * * The string values here are the cross-tab `BroadcastChannel` topic names and * the internal `SubscriptionManager` event keys. They are an implementation * detail of a single library version — every tab runs the same build — not a * wire/server protocol, so the literal values can change freely as long as * they stay consistent within a release. Keeping them in one place removes the * scatter of magic strings and the risk of an emit/handler typo mismatch. */ /** BroadcastChannel name shared by every tab of one SharedWebSocket instance. */ export declare const MESSAGE_BUS_CHANNEL = "shared-ws"; export declare const COORD: { /** Candidate announces an election (carries its tabId). */ readonly ELECTION: "coord:election"; /** Current leader rejects a candidate. */ readonly REJECT: "coord:reject"; /** Leader liveness beat. */ readonly HEARTBEAT: "coord:heartbeat"; /** Leader relinquished — followers should elect. */ readonly ABDICATE: "coord:abdicate"; /** Health probe sent to the leader. */ readonly PING: "coord:ping"; /** Forced demotion demanded by an active tab taking over. */ readonly STEP_DOWN: "coord:step-down"; }; /** One-shot reply topic for a health ping keyed by replyId. */ export declare const coordPongReply: (replyId: string) => string; export declare const BUS: { /** Incoming server frame fanned out to every tab. */ readonly MESSAGE: "ws:message"; /** Follower → leader outbound dispatch request. */ readonly DISPATCH: "ws:dispatch"; /** Leader → originator ack: drop the buffered entry. */ readonly DISPATCH_FLUSHED: "ws:dispatch-flushed"; /** New leader asks every tab for still-pending dispatches. */ readonly GATHER_PENDING: "ws:gather-pending"; /** New leader asks every tab for its channels/topics. */ readonly GATHER_SUBS: "ws:gather-subs"; /** Cross-tab state sync (no server roundtrip). */ readonly SYNC: "ws:sync"; /** Request/response routed to the leader's socket. */ readonly REQUEST: "ws:request"; /** Follower asks the leader to reconnect. */ readonly RECONNECT: "ws:reconnect"; /** Follower hint to reconnect a failed socket after re-auth. */ readonly AUTH_RESUME: "ws:authenticate-resume"; /** Lifecycle events broadcast to all tabs. */ readonly LIFECYCLE: "ws:lifecycle"; }; /** Reply topic for a pending-dispatch gather keyed by replyId. */ export declare const busPendingReply: (replyId: string) => string; /** Reply topic for a subscription gather keyed by replyId. */ export declare const busSubsReply: (replyId: string) => string; export declare const LIFECYCLE: { readonly CONNECT: "$lifecycle:connect"; readonly DISCONNECT: "$lifecycle:disconnect"; readonly RECONNECTING: "$lifecycle:reconnecting"; readonly RECONNECT_FAILED: "$lifecycle:reconnectFailed"; readonly LEADER: "$lifecycle:leader"; readonly ERROR: "$lifecycle:error"; readonly AUTH: "$lifecycle:auth"; readonly ACTIVE: "$lifecycle:active"; }; /** Sync-store key holding the runtime auth token. */ export declare const AUTH_TOKEN_KEY = "$auth:token"; /** TabCoordinator timing defaults (ms). */ export declare const COORD_DEFAULTS: { readonly ELECTION_TIMEOUT: 200; readonly HEARTBEAT_INTERVAL: 2000; readonly LEADER_TIMEOUT: 5000; readonly LEADER_PING_TIMEOUT: 1500; /** How often a follower re-checks the leader heartbeat. */ readonly LEADER_CHECK_INTERVAL: 1000; }; /** SharedSocket connection defaults. */ export declare const SOCKET_DEFAULTS: { readonly RECONNECT_MAX_DELAY: 30000; readonly HEARTBEAT_INTERVAL: 30000; readonly SEND_BUFFER: 100; /** Initial reconnect backoff before exponential growth. */ readonly BACKOFF_BASE: 1000; /** Default "auth failed — stop retrying" close code (PolicyViolation). */ readonly AUTH_FAILURE_CLOSE_CODE: 1008; }; /** SharedWebSocket / Outbox defaults. */ export declare const WS_DEFAULTS: { readonly OUTBOUND_BUFFER_SIZE: 100; /** Cross-tab subscription-gather window (ms). */ readonly GATHER_SUBS_TIMEOUT: 150; /** Cross-tab pending-dispatch-gather window (ms). */ readonly GATHER_PENDING_TIMEOUT: 100; /** Default request/response timeout (ms). */ readonly REQUEST_TIMEOUT: 5000; /** Default Channel.ready ack timeout (ms). */ readonly CHANNEL_ACK_TIMEOUT: 5000; };