feat(protocol): add host control mode events & constants

Step 1 of host control mode. Adds the protocol surface only — no behavior yet:
- EVENTS.SET_CONTROL_MODE (client->server: host sets mode)
- EVENTS.CONTROL_MODE   (server->client: mode changed)
- CONTROL_MODES { EVERYONE, HOST_ONLY }

Purely additive; old clients ignore the new events. Propagated to
extension/shared via build-extension. Also records the audited design
decisions in the edge-case log.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
KoalaDev
2026-06-25 23:27:19 +02:00
parent 2995afe970
commit a968f708b3
2 changed files with 34 additions and 6 deletions
+12
View File
@@ -33,6 +33,10 @@ export const EVENTS = {
ROOM_DATA: "room_data", // Server -> Client: current room state
ERROR: "error",
// Host Control Mode
SET_CONTROL_MODE: "set_control_mode", // Client -> Server: host sets room control mode ('everyone' | 'host-only')
CONTROL_MODE: "control_mode", // Server -> Client: room control mode changed { controlMode, hostPeerId }
// Media Control
PLAY: "play",
PAUSE: "pause",
@@ -57,6 +61,14 @@ export const EVENTS = {
PONG: "pong" // server responds with same { t } for client RTT calculation
};
// Room control modes (Host Control Mode feature).
// NOTE: content.js does not import this module — it uses the string literals
// 'everyone' / 'host-only' directly. Keep these values in sync there.
export const CONTROL_MODES = {
EVERYONE: 'everyone', // default: anyone can play/pause/seek for the room
HOST_ONLY: 'host-only' // only the host drives the room
};
export const HEARTBEAT_INTERVAL = 15000; // 15s
export const FORCE_SYNC_TIMEOUT = 8500; // 8.5s timeout for force sync ACKs (must be > content.js poll timeout of 8s)
export const EPISODE_LOBBY_TIMEOUT = 60000; // 60s timeout for episode lobby