diff --git a/src/shared/types.ts b/src/shared/types.ts index cf00fa0..5d4ae3a 100644 --- a/src/shared/types.ts +++ b/src/shared/types.ts @@ -29,13 +29,30 @@ export interface Message { } // Типы сообщений в long-lived port (offscreen ↔ SW; D-17 / Plan 04 / D-13) +// +// Option C (debug session empty-archive-port-race) extends the surface: +// - 'PONG' completes the health-probe loop: offscreen pings, SW echoes, +// offscreen tracks last-pong time. Replaces the 290 s pre-emptive +// `setTimeout` reconnect (whose race window weaponised the upstream +// silent-skip in createArchive — see the bisect notes in the debug +// session for full lineage). +// - REQUEST_BUFFER + BUFFER carry an architectural `requestId` so the +// SW can match a response to the in-flight request that issued it. +// This retires the silent-cross-talk failure mode where a stale +// BUFFER from a prior request would route into a newer Promise. export type PortMessageType = | 'PING' + | 'PONG' | 'REQUEST_BUFFER' | 'BUFFER'; export interface PortMessage { type: PortMessageType; + // Per-request correlation id (Option C). The SW generates a uuid for + // each REQUEST_BUFFER call and only resolves on BUFFER responses that + // echo the same id. PING/PONG do not carry a requestId — they are + // pure liveness signals. + requestId?: string; // Wire-format (D-12 base64 transfer + D-13 segment lifecycle): // segments travel as TransferredVideoSegment[] because // chrome.runtime.Port JSON-serializes payloads across extension