@full-self-browsing/phantom-stream 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +48 -2
  2. package/dist/types/adapters/extension.d.ts.map +1 -1
  3. package/dist/types/adapters/playwright.d.ts.map +1 -1
  4. package/dist/types/capture/index.d.ts +150 -0
  5. package/dist/types/capture/index.d.ts.map +1 -1
  6. package/dist/types/index.d.ts +2 -0
  7. package/dist/types/player/index.d.ts +136 -0
  8. package/dist/types/player/index.d.ts.map +1 -0
  9. package/dist/types/protocol/constants.d.ts +22 -0
  10. package/dist/types/protocol/constants.d.ts.map +1 -1
  11. package/dist/types/protocol/index.d.ts +1 -0
  12. package/dist/types/protocol/media-reconcile.d.ts +53 -0
  13. package/dist/types/protocol/media-reconcile.d.ts.map +1 -0
  14. package/dist/types/protocol/messages.d.ts +326 -4
  15. package/dist/types/protocol/messages.d.ts.map +1 -1
  16. package/dist/types/recorder/index.d.ts +207 -0
  17. package/dist/types/recorder/index.d.ts.map +1 -0
  18. package/dist/types/renderer/asset-policy.d.ts +72 -0
  19. package/dist/types/renderer/asset-policy.d.ts.map +1 -0
  20. package/dist/types/renderer/diff.d.ts.map +1 -1
  21. package/dist/types/renderer/index.d.ts +61 -8
  22. package/dist/types/renderer/index.d.ts.map +1 -1
  23. package/dist/types/renderer/media-player.d.ts +114 -0
  24. package/dist/types/renderer/media-player.d.ts.map +1 -0
  25. package/dist/types/renderer/overlays.d.ts +12 -0
  26. package/dist/types/renderer/overlays.d.ts.map +1 -1
  27. package/dist/types/renderer/parser-safe.d.ts +26 -0
  28. package/dist/types/renderer/parser-safe.d.ts.map +1 -0
  29. package/dist/types/renderer/sanitize.d.ts +22 -0
  30. package/dist/types/renderer/sanitize.d.ts.map +1 -1
  31. package/dist/types/renderer/snapshot.d.ts +38 -0
  32. package/dist/types/renderer/snapshot.d.ts.map +1 -1
  33. package/dist/types/transport/websocket.d.ts.map +1 -1
  34. package/docs/ARCHITECTURE.md +83 -4
  35. package/docs/QUICKSTARTS.md +64 -0
  36. package/docs/SECURITY.md +279 -2
  37. package/docs/paper/OUTLINE.md +24 -91
  38. package/examples/bookmarklet-demo/viewer.html +12 -3
  39. package/examples/extension-mv3/viewer.html +10 -3
  40. package/package.json +25 -1
  41. package/src/adapters/extension.js +202 -7
  42. package/src/adapters/playwright-inject.js +645 -28
  43. package/src/adapters/playwright.js +176 -2
  44. package/src/capture/README.md +96 -1
  45. package/src/capture/index.js +1672 -40
  46. package/src/index.js +2 -0
  47. package/src/player/README.md +175 -0
  48. package/src/player/index.js +627 -0
  49. package/src/protocol/constants.js +24 -0
  50. package/src/protocol/index.js +1 -0
  51. package/src/protocol/media-reconcile.js +188 -0
  52. package/src/protocol/messages.js +195 -4
  53. package/src/recorder/README.md +225 -0
  54. package/src/recorder/index.js +487 -0
  55. package/src/renderer/README.md +111 -8
  56. package/src/renderer/asset-policy.js +172 -0
  57. package/src/renderer/diff.js +158 -15
  58. package/src/renderer/index.js +978 -21
  59. package/src/renderer/media-player.js +367 -0
  60. package/src/renderer/overlays.js +324 -0
  61. package/src/renderer/parser-safe.js +111 -0
  62. package/src/renderer/sanitize.js +25 -3
  63. package/src/renderer/snapshot.js +534 -3
  64. package/src/transport/websocket.js +36 -0
package/README.md CHANGED
@@ -13,11 +13,13 @@ PhantomStream mirrors a live browser tab to a remote viewer as structured DOM da
13
13
  ![Playwright](https://img.shields.io/badge/Playwright-2EAD33?style=for-the-badge&logo=playwright&logoColor=white)
14
14
  ![MIT License](https://img.shields.io/badge/License-MIT-3DA639?style=for-the-badge)
15
15
 
16
+ [![npm](https://img.shields.io/npm/v/@full-self-browsing/phantom-stream?style=for-the-badge&logo=npm&logoColor=white&color=CB3837)](https://www.npmjs.com/package/@full-self-browsing/phantom-stream)
16
17
  [![Stars](https://img.shields.io/github/stars/fullselfbrowsing/PhantomStream?style=for-the-badge&logo=github&logoColor=white&color=555555)](https://github.com/fullselfbrowsing/PhantomStream/stargazers)
17
18
  [![Issues](https://img.shields.io/github/issues/fullselfbrowsing/PhantomStream?style=for-the-badge&logo=github&logoColor=white&color=555555)](https://github.com/fullselfbrowsing/PhantomStream/issues)
18
19
  [![Last Commit](https://img.shields.io/github/last-commit/fullselfbrowsing/PhantomStream?style=for-the-badge&logo=github&logoColor=white&color=555555)](https://github.com/fullselfbrowsing/PhantomStream/commits/main)
20
+ [![Discussions](https://img.shields.io/github/discussions/fullselfbrowsing/PhantomStream?style=for-the-badge&logo=github&logoColor=white&color=555555)](https://github.com/fullselfbrowsing/PhantomStream/discussions)
19
21
 
20
- [The Problem](#the-problem) · [The Solution](#the-solution) · [Why DOM Streaming](#why-dom-streaming-instead-of-video) · [Architecture](#architecture) · [Features](#features) · [Tech Stack](#tech-stack) · [Getting Started](#getting-started) · [Quickstarts](docs/QUICKSTARTS.md) · [Documentation](#documentation) · [Roadmap](#roadmap)
22
+ [The Problem](#the-problem) · [The Solution](#the-solution) · [Why DOM Streaming](#why-dom-streaming-instead-of-video) · [Architecture](#architecture) · [Features](#features) · [Tech Stack](#tech-stack) · [Getting Started](#getting-started) · [Quickstarts](docs/QUICKSTARTS.md) · [Documentation](#documentation) · [Roadmap](#roadmap) · [Discussions](https://github.com/fullselfbrowsing/PhantomStream/discussions)
21
23
 
22
24
  </div>
23
25
 
@@ -88,6 +90,7 @@ Core mechanisms (see [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for the full t
88
90
  - **Dual watchdogs.** A capture-side self-watchdog rescues a stuck mutation queue. A second host-side alarm survives service-worker eviction and requests a fresh snapshot if the stream strands silently.
89
91
  - **Session identity.** Every message carries a `streamSessionId` plus a `snapshotId`. The viewer rejects stale messages, so late diffs from a previous page can never corrupt the mirror.
90
92
  - **Side channels.** Scroll position, automation overlays (action glow, progress card), and native `alert` / `confirm` / `prompt` dialogs mirror alongside the DOM.
93
+ - **Media by reference.** Images, video, and audio resolve to absolute source URLs and load in the viewer's own browser, so only URLs and small playback-state messages cross the relay. Playback syncs through a drift-corrected reconciler driven cross-realm, adaptive HLS and DASH play through an optional lazy player, and any media that cannot be referenced degrades to a never-break poster. A fail-closed fetch gate (https-only, private-range deny, `mediaMode`, CSP, no-referrer) governs every viewer fetch.
91
94
 
92
95
  ---
93
96
 
@@ -107,6 +110,11 @@ Core mechanisms (see [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for the full t
107
110
  | **Capture-side sanitization** | Serialization strips `on*` handlers, dangerous URL schemes, `srcdoc`, and `object` / `embed` subtrees on the wire clone only. The live page is never touched. |
108
111
  | **Privacy masking** | `blockSelector`, `maskTextSelector`, `maskInputs`, and custom mask functions redact sensitive content before it leaves the page, with passwords always masked. |
109
112
  | **Side-channel mirroring** | Scroll, automation overlays, and native dialogs stream alongside the DOM and render as host-document overlays above the mirror. |
113
+ | **Media by reference** | Images, video, and audio render in the viewer by loading the original source URL over the viewer's own network, so media bytes never cross the relay. Covers `img`, `srcset`, `picture`, `source`, SVG image, CSS background image, and video poster. |
114
+ | **Drift-corrected playback** | Video and audio play from the source URL, driven cross-realm from the parent so no player code runs in the sandbox. A pure reconciler holds small drift in tolerance, hard-seeks on large drift, and rejoins the live edge. |
115
+ | **Adaptive streaming with fallback** | HLS and DASH play through an optional lazy player, and adapters surface manifest URLs as opt-in hints. Media that cannot be referenced degrades to a poster with an observable reason, so the mirror never breaks. `hls.js` is an optional peer dependency, so the published module stays dependency-free. |
116
+ | **Fail-closed media fetch** | An https-only origin policy blocks private and internal ranges, a `mediaMode` switch gates playable sources, a string-layer gate runs before `srcdoc` parse, and a document-level no-referrer policy sends no credentials by default. |
117
+ | **Record and play back** | The recorder timestamps the capture stream into a portable JSON recording, with optional keyframe chunks for streaming upload. The player rebuilds any moment from the nearest snapshot, plays at 0.25x to 16x, skips idle gaps, and keeps the mirror inert. |
110
118
  | **Playwright adapter** | Drop the capture core into a Playwright or CDP page through a ready-made adapter, including authorized reverse remote control. |
111
119
  | **Pluggable transport** | Capture, viewer, and relay all talk through a small transport seam, so the same core runs over WebSocket, an in-page loopback channel, or any channel you supply. |
112
120
 
@@ -188,6 +196,39 @@ server.listen(8787);
188
196
 
189
197
  Clients join a room by passing `?room=<id>&role=source|viewer` on the connection URL. See `examples/two-tab-demo/server.js` for the full room and role wiring.
190
198
 
199
+ **Record a session and play it back** (the recorder is a capture transport, and the player replays a recording in an inert viewer):
200
+
201
+ ```js
202
+ import { createCapture } from '@full-self-browsing/phantom-stream/capture';
203
+ import { createRecorder } from '@full-self-browsing/phantom-stream/recorder';
204
+
205
+ const recorder = createRecorder();
206
+ const capture = createCapture({
207
+ transport: recorder.transport,
208
+ skipElement: (el) => el.id === 'my-own-overlay'
209
+ });
210
+
211
+ capture.start();
212
+ // ... later
213
+ capture.stop(); // flushes pending diffs and stamps the end time
214
+ const text = JSON.stringify(recorder.toRecording({ title: 'checkout run' }));
215
+ ```
216
+
217
+ ```js
218
+ import { createPlayer } from '@full-self-browsing/phantom-stream/player';
219
+
220
+ const player = createPlayer({
221
+ container: document.getElementById('replay'),
222
+ recording: JSON.parse(text)
223
+ });
224
+
225
+ await player.seek(0); // nothing renders until the first seek or play
226
+ player.play({ speed: 2 }); // 0.25x to 16x
227
+ player.on('marker', (m) => console.log(m.t, m.kind)); // host marks from recorder.mark()
228
+ ```
229
+
230
+ A recording holds page content, so configure masking before you record (see [docs/SECURITY.md](docs/SECURITY.md)). `src/recorder/README.md` covers keyframe chunks for streaming upload and recording while also streaming live.
231
+
191
232
  **Run the tests and demos** straight from the repository:
192
233
 
193
234
  ```bash
@@ -206,6 +247,8 @@ src/ The framework
206
247
  protocol/ Wire types, LZ envelope, shared constants, session identity
207
248
  capture/ Page-side snapshot + MutationObserver diff streaming
208
249
  renderer/ Viewer reconstruction: snapshot, diff apply, overlays
250
+ recorder/ Timestamped capture transport and the portable recording format
251
+ player/ Seekable, speed-controlled, inert playback through the viewer
209
252
  relay/ Transport-agnostic routing core + WebSocket backend
210
253
  transport/websocket.js Browser-compatible WebSocket transport for both ends
211
254
  adapters/ Playwright / CDP injection adapter
@@ -226,11 +269,12 @@ bin/phantom-stream.js CLI entry point for the demos
226
269
 
227
270
  | Document | What it covers |
228
271
  |---|---|
229
- | [docs/QUICKSTARTS.md](docs/QUICKSTARTS.md) | Installable package paths for embedded loopback, WebSocket demo, Playwright/CDP, extension MV3, bookmarklet, and CSSOM mode |
272
+ | [docs/QUICKSTARTS.md](docs/QUICKSTARTS.md) | Installable package paths for embedded loopback, WebSocket demo, Playwright/CDP, extension MV3, bookmarklet, CSSOM mode, and record and play back |
230
273
  | [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | End-to-end technical description of the capture, transport, relay, and renderer pipeline, plus known limitations |
231
274
  | [docs/SECURITY.md](docs/SECURITY.md) | The embed security contract: threat model, sanitization, masking, CSP, and sandbox guarantees |
232
275
  | [docs/DESIGN-HISTORY.md](docs/DESIGN-HISTORY.md) | How the system evolved, what failed along the way, and why the current shape won |
233
276
  | [docs/RELEASE.md](docs/RELEASE.md) | Package validation and publish-gate checklist |
277
+ | [CHANGELOG.md](CHANGELOG.md) | Release notes for every published version |
234
278
  | [docs/paper/OUTLINE.md](docs/paper/OUTLINE.md) | Research paper structure and the evaluation plan against video and rrweb baselines |
235
279
 
236
280
  ---
@@ -247,6 +291,8 @@ bin/phantom-stream.js CLI entry point for the demos
247
291
  | Security pipeline: sanitization, sandbox, privacy masking | Shipped |
248
292
  | Reference demos: two-tab, Playwright, and embedded loopback | Shipped |
249
293
  | Fidelity completion: WeakMap identity, nodeIds sidecars, shadow DOM, same-origin iframes, subtree recovery, and CSSOM mode | Shipped |
294
+ | Asset and media streaming by reference: static assets, drift-corrected video and audio sync, adaptive HLS/DASH with fallback, and media security | Shipped |
295
+ | Record and playback: timestamped recorder with keyframe chunks and a seekable, inert player | Unreleased |
250
296
  | Evaluation harness: bandwidth, latency, and fidelity against WebRTC, CDP screencast, and rrweb | Planned |
251
297
  | Research paper draft | Planned |
252
298
 
@@ -1 +1 @@
1
- {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../src/adapters/extension.js"],"names":[],"mappings":"AAuHA;;;;;;;;;;;;;;;;GAgBG;AACH,gDAbG;IAAwB,MAAM;IAC4B,SAAS,GAA3D;QAAC,IAAI,CAAC,WAAW;QAAC,SAAS,CAAC,WAAU;KAAC;IACtB,SAAS,GAA1B,MAAM;IACW,UAAU,GAA3B,MAAM;IACW,MAAM;IACJ,GAAG;CAC9B,GAAU;IACR,OAAO,EAAE,MAAM,OAAO,KAAQ,CAAC;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,KAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,eAAe,EAAE,MAAM,MAAO,IAAI,CAAA;CACnC,CA+KH;AAED;;;;;GAKG;AACH,gDAFa,MAAM,CAMlB;AA1TD,2CAA4C,wBAAwB,CAAC;AACrE,wCAAyC,2BAA2B,CAAC"}
1
+ {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../src/adapters/extension.js"],"names":[],"mappings":"AAkIA;;;;;;;;;;;;;;;;GAgBG;AACH,gDAbG;IAAwB,MAAM;IAC4B,SAAS,GAA3D;QAAC,IAAI,CAAC,WAAW;QAAC,SAAS,CAAC,WAAU;KAAC;IACtB,SAAS,GAA1B,MAAM;IACW,UAAU,GAA3B,MAAM;IACW,MAAM;IACJ,GAAG;CAC9B,GAAU;IACR,OAAO,EAAE,MAAM,OAAO,KAAQ,CAAC;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,KAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,eAAe,EAAE,MAAM,MAAO,IAAI,CAAA;CACnC,CAuWH;AAED;;;;;GAKG;AACH,gDAFa,MAAM,CAMlB;AA7fD,2CAA4C,wBAAwB,CAAC;AACrE,wCAAyC,2BAA2B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"playwright.d.ts","sourceRoot":"","sources":["../../../src/adapters/playwright.js"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH,yDAFa,MAAM,CAIlB;AA6BD;;;;;GAKG;AACH,2DAydC"}
1
+ {"version":3,"file":"playwright.d.ts","sourceRoot":"","sources":["../../../src/adapters/playwright.js"],"names":[],"mappings":"AAyBA;;;;GAIG;AACH,yDAFa,MAAM,CAIlB;AA4CD;;;;;GAKG;AACH,2DAunBC"}
@@ -1,3 +1,36 @@
1
+ /**
2
+ * Classify an asset URL by FETCHABILITY (Phase 12 ASST-04). This is a control
3
+ * distinct from hasDangerousScheme (injection): a URL can be injection-safe yet
4
+ * non-shareable as a mirrored reference. Two non-shareable classes degrade to a
5
+ * dimensioned placeholder at capture so a dead/blob reference never reaches the
6
+ * wire and one giant inline image cannot blow the per-message cap:
7
+ * - `blob:`/origin-local object URLs (always non-shareable -- they are
8
+ * origin-local and dead at the cross-origin viewer);
9
+ * - `data:` URIs whose UTF-8 byte length exceeds `capBytes`.
10
+ * Everything else (http/https, small inline `data:`, relative URLs that
11
+ * absolutify) is shareable and passes through untouched -- benign small `data:`
12
+ * icons stay byte-identical (Pitfall 5: no over-degrade).
13
+ * @param {string} url the (resolved or raw) asset reference
14
+ * @param {number} capBytes byte cap for inline `data:` (ASSET_DATA_URI_MAX_BYTES)
15
+ * @returns {{ok: true}|{ok: false, reason: 'blob'|'oversized-data'}}
16
+ */
17
+ export function classifyAssetRef(url: string, capBytes: number): {
18
+ ok: true;
19
+ } | {
20
+ ok: false;
21
+ reason: "blob" | "oversized-data";
22
+ };
23
+ /**
24
+ * Pure predicate (Phase 12 ASST-03): true only when a resolved `currentSrc`
25
+ * is present AND differs from the resolved plain `src`, i.e. a responsive
26
+ * `srcset`/`<picture>` actually negotiated a non-default variant worth pinning.
27
+ * Empty `currentSrc` (jsdom returns "") never enriches; an equal value never
28
+ * enriches (plain `<img src>` stays byte-identical on the wire).
29
+ * @param {string} resolvedCurrentSrc absolutified currentSrc
30
+ * @param {string} resolvedSrc absolutified src
31
+ * @returns {boolean}
32
+ */
33
+ export function currentSrcDiffers(resolvedCurrentSrc: string, resolvedSrc: string): boolean;
1
34
  /**
2
35
  * The host-injected message sink. `send` mirrors the fire-and-forget
3
36
  * semantics of the reference's messaging call: the capture core never awaits
@@ -80,6 +113,48 @@
80
113
  * @property {(text: string, element: Element) => string} [maskInputFn]
81
114
  * Optional (SEC-03). Custom input-value mask (rrweb signature). Same
82
115
  * fail-closed containment as maskTextFn.
116
+ * @property {string} [maskMediaSelector]
117
+ * Optional (MSEC-03). CSS selector: matching <video>/<audio>/asset elements
118
+ * omit their URL from the wire and degrade to the dimension-only block
119
+ * placeholder (the blockSelector placeholder path), AND emit NO STREAM.MEDIA
120
+ * state (the media-tracker skip predicates also gate on this selector). The
121
+ * privacy control for "mirror nothing about this media -- not its URL, not
122
+ * its playback timeline." Invalid selectors THROW Error('invalid-mask-
123
+ * selector') at factory time, exactly like blockSelector/maskTextSelector.
124
+ * @property {boolean} [maskAssetUrls]
125
+ * Optional (MSEC-03), default false. When true, strip a documented token/PII
126
+ * query-param denylist (AWS SigV4/SigV2, GCP signed-URL, Azure SAS, and a
127
+ * generic token/secret/auth set -- case-insensitive, exact-name OR denied
128
+ * prefix) from asset/media URLs before the wire. Functional params (w, h, q,
129
+ * format, v, id, t, ...) survive. A URL with no denylisted param is emitted
130
+ * BYTE-IDENTICAL (the original string, never URL.toString() normalization),
131
+ * so off-by-default keeps the wire byte-identical (the differential oracle is
132
+ * unaffected). See TOKEN_PARAM_DENYLIST + docs/SECURITY.md for the exact list.
133
+ * @property {(url: string, ctx: {attr: string, tag: string, nid: string, kind: ('image'|'media')}) => (string|null)} [maskAssetUrlFn]
134
+ * Optional (MSEC-03). Custom asset/media URL redactor; takes precedence over
135
+ * maskAssetUrls. A returned string replaces the URL on the wire; null BLOCKS
136
+ * the URL (the attribute is removed -> the viewer never fetches it); a THROW
137
+ * FAILS CLOSED -> block (logged, treated as null -- never raised, never the
138
+ * raw URL). Stricter than maskTextFn: a thrown text mask falls back to the
139
+ * asterisk default, but a thrown URL redactor blocks (a half-redacted URL
140
+ * that the viewer then fetches is worse than no URL).
141
+ * @property {number} [messageLimitBytes]
142
+ * Optional (quick task 261202-jwf), default RELAY_PER_MESSAGE_LIMIT_BYTES
143
+ * (1 MiB). The largest wire message this capture emits, in UTF-8 bytes of
144
+ * the JSON payload: it governs the snapshot hard reset, single mutation
145
+ * diffs, mutation chunking and subtree responses. Only a positive finite
146
+ * number is accepted; any other value falls back to the default. Relay
147
+ * users keep the default, because the relay drops messages over 1 MiB;
148
+ * local recorders that never pass through a relay (FSB records with 8 MiB)
149
+ * may raise it.
150
+ * @property {number} [snapshotBudgetBytes]
151
+ * Optional (quick task 261202-jwf), default
152
+ * floor(messageLimitBytes * SNAPSHOT_BUDGET_FRACTION). The budget the
153
+ * snapshot truncation passes and sidecar pruning aim for, in UTF-8 wire
154
+ * bytes. Only a positive finite number is accepted; any other value falls
155
+ * back to the default. Clamped to at most messageLimitBytes. Relay users
156
+ * keep the default; local recorders may raise it (FSB records with 4 MiB)
157
+ * so large pages keep every stylesheet.
83
158
  */
84
159
  /**
85
160
  * @typedef {Object} CaptureHandle
@@ -104,6 +179,24 @@
104
179
  * @returns {CaptureHandle}
105
180
  */
106
181
  export function createCapture(config: CaptureOptions): CaptureHandle;
182
+ /**
183
+ * Serialize ONE snapshot of the given document and return the snapshot payload
184
+ * (`{ html, nodeIds, ... }`). A convenience top-level entry that swaps the
185
+ * ambient globals from `doc.defaultView` for the lifetime of one serialization
186
+ * (mirroring the differential harness's createExtractedSide), runs a fresh
187
+ * capture's serializer against it, and restores the globals unconditionally.
188
+ *
189
+ * This is the no-observer path used by the capture-asset-degrade unit tests to
190
+ * prove the clone-only currentSrc enrichment and the blob:/oversized-data:
191
+ * placeholder degrade WITHOUT mutating the live document.
192
+ *
193
+ * @param {Document} doc the document to snapshot (must have a defaultView)
194
+ * @returns {{html: string, nodeIds: string[]}} the snapshot payload
195
+ */
196
+ export function serializeSnapshot(doc: Document): {
197
+ html: string;
198
+ nodeIds: string[];
199
+ };
107
200
  /**
108
201
  * The host-injected message sink. `send` mirrors the fire-and-forget
109
202
  * semantics of the reference's messaging call: the capture core never awaits
@@ -213,6 +306,63 @@ export type CaptureOptions = {
213
306
  * fail-closed containment as maskTextFn.
214
307
  */
215
308
  maskInputFn?: (text: string, element: Element) => string;
309
+ /**
310
+ * Optional (MSEC-03). CSS selector: matching <video>/<audio>/asset elements
311
+ * omit their URL from the wire and degrade to the dimension-only block
312
+ * placeholder (the blockSelector placeholder path), AND emit NO STREAM.MEDIA
313
+ * state (the media-tracker skip predicates also gate on this selector). The
314
+ * privacy control for "mirror nothing about this media -- not its URL, not
315
+ * its playback timeline." Invalid selectors THROW Error('invalid-mask-
316
+ * selector') at factory time, exactly like blockSelector/maskTextSelector.
317
+ */
318
+ maskMediaSelector?: string;
319
+ /**
320
+ * Optional (MSEC-03), default false. When true, strip a documented token/PII
321
+ * query-param denylist (AWS SigV4/SigV2, GCP signed-URL, Azure SAS, and a
322
+ * generic token/secret/auth set -- case-insensitive, exact-name OR denied
323
+ * prefix) from asset/media URLs before the wire. Functional params (w, h, q,
324
+ * format, v, id, t, ...) survive. A URL with no denylisted param is emitted
325
+ * BYTE-IDENTICAL (the original string, never URL.toString() normalization),
326
+ * so off-by-default keeps the wire byte-identical (the differential oracle is
327
+ * unaffected). See TOKEN_PARAM_DENYLIST + docs/SECURITY.md for the exact list.
328
+ */
329
+ maskAssetUrls?: boolean;
330
+ /**
331
+ * Optional (MSEC-03). Custom asset/media URL redactor; takes precedence over
332
+ * maskAssetUrls. A returned string replaces the URL on the wire; null BLOCKS
333
+ * the URL (the attribute is removed -> the viewer never fetches it); a THROW
334
+ * FAILS CLOSED -> block (logged, treated as null -- never raised, never the
335
+ * raw URL). Stricter than maskTextFn: a thrown text mask falls back to the
336
+ * asterisk default, but a thrown URL redactor blocks (a half-redacted URL
337
+ * that the viewer then fetches is worse than no URL).
338
+ */
339
+ maskAssetUrlFn?: (url: string, ctx: {
340
+ attr: string;
341
+ tag: string;
342
+ nid: string;
343
+ kind: ("image" | "media");
344
+ }) => (string | null);
345
+ /**
346
+ * Optional (quick task 261202-jwf), default RELAY_PER_MESSAGE_LIMIT_BYTES
347
+ * (1 MiB). The largest wire message this capture emits, in UTF-8 bytes of
348
+ * the JSON payload: it governs the snapshot hard reset, single mutation
349
+ * diffs, mutation chunking and subtree responses. Only a positive finite
350
+ * number is accepted; any other value falls back to the default. Relay
351
+ * users keep the default, because the relay drops messages over 1 MiB;
352
+ * local recorders that never pass through a relay (FSB records with 8 MiB)
353
+ * may raise it.
354
+ */
355
+ messageLimitBytes?: number;
356
+ /**
357
+ * Optional (quick task 261202-jwf), default
358
+ * floor(messageLimitBytes * SNAPSHOT_BUDGET_FRACTION). The budget the
359
+ * snapshot truncation passes and sidecar pruning aim for, in UTF-8 wire
360
+ * bytes. Only a positive finite number is accepted; any other value falls
361
+ * back to the default. Clamped to at most messageLimitBytes. Relay users
362
+ * keep the default; local recorders may raise it (FSB records with 4 MiB)
363
+ * so large pages keep every stylesheet.
364
+ */
365
+ snapshotBudgetBytes?: number;
216
366
  };
217
367
  export type CaptureHandle = {
218
368
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/capture/index.js"],"names":[],"mappings":"AAqVA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AACH,sCAHW,cAAc,GACZ,aAAa,CAu0HzB;;;;;;;;;;;;;;;;UAx6Ha,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,KAAQ,KAAK,IAAI;;;;;YAGvC,MAAM,IAAI;;;UAOV,CAAC,GAAG,IAAI,EAAE,GAAC,KAAK,IAAI;UACpB,CAAC,GAAG,IAAI,EAAE,GAAC,KAAK,IAAI;WACpB,CAAC,GAAG,IAAI,EAAE,GAAC,KAAK,IAAI;;;;;;;;;;;;;;;WAYpB,MAAO,IAAI;;;;eACX,MAAO,IAAI;;;;;;;;eAKX,SAAS;;;;aAIT,aAAa;;;;;;;;;sBAEb,CAAC,MAAM,YAAY,GAAC,IAAI,CAAC;;;;;;;;;;kBAOzB,CAAC,EAAE,EAAE,OAAO,KAAK,OAAO;;;;;;;;;;oBAQxB,MAAM;;;;;;;uBAQN,MAAM;;;;;;iBAKN,OAAO;;;;;iBAIP,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM;;;;;kBAG1C,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM;;;;;;WAO1C,MAAM,IAAI;;;;UACV,MAAM,IAAI;;;;WACV,MAAM,IAAI;;;;YACV,MAAM,IAAI;;;;;;eACV,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,GAAC,IAAI"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/capture/index.js"],"names":[],"mappings":"AA8TA;;;;;;;;;;;;;;;GAeG;AACH,sCAJW,MAAM,YACN,MAAM,GACJ;IAAC,EAAE,EAAE,IAAI,CAAA;CAAC,GAAC;IAAC,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,GAAC,gBAAgB,CAAA;CAAC,CAkBnE;AAED;;;;;;;;;GASG;AACH,sDAJW,MAAM,eACN,MAAM,GACJ,OAAO,CAMnB;AA2JD;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AACH,sCAHW,cAAc,GACZ,aAAa,CA4oKzB;AAYD;;;;;;;;;;;;;GAaG;AACH,uCAHW,QAAQ,GACN;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAC,CAqC7C;;;;;;;;;;;;;;;;UAp1Ka,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,KAAQ,KAAK,IAAI;;;;;YAGvC,MAAM,IAAI;;;UAOV,CAAC,GAAG,IAAI,EAAE,GAAC,KAAK,IAAI;UACpB,CAAC,GAAG,IAAI,EAAE,GAAC,KAAK,IAAI;WACpB,CAAC,GAAG,IAAI,EAAE,GAAC,KAAK,IAAI;;;;;;;;;;;;;;;WAYpB,MAAO,IAAI;;;;eACX,MAAO,IAAI;;;;;;;;eAKX,SAAS;;;;aAIT,aAAa;;;;;;;;;sBAEb,CAAC,MAAM,YAAY,GAAC,IAAI,CAAC;;;;;;;;;;kBAOzB,CAAC,EAAE,EAAE,OAAO,KAAK,OAAO;;;;;;;;;;oBAQxB,MAAM;;;;;;;uBAQN,MAAM;;;;;;iBAKN,OAAO;;;;;iBAIP,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM;;;;;kBAG1C,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM;;;;;;;;;;wBAG1C,MAAM;;;;;;;;;;;oBAQN,OAAO;;;;;;;;;;qBASP,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,CAAC,OAAO,GAAC,OAAO,CAAC,CAAA;KAAC,KAAK,CAAC,MAAM,GAAC,IAAI,CAAC;;;;;;;;;;;wBAQtG,MAAM;;;;;;;;;;0BASN,MAAM;;;;;;WAYN,MAAM,IAAI;;;;UACV,MAAM,IAAI;;;;WACV,MAAM,IAAI;;;;YACV,MAAM,IAAI;;;;;;eACV,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,GAAC,IAAI"}
@@ -3,4 +3,6 @@ export * from "./capture/index.js";
3
3
  export * from "./renderer/index.js";
4
4
  export * from "./relay/index.js";
5
5
  export * from "./transport/websocket.js";
6
+ export * from "./recorder/index.js";
7
+ export * from "./player/index.js";
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Create a player for one recording in a host container. Creation is
3
+ * synchronous and renders nothing: call seek() or play() to show a frame.
4
+ *
5
+ * @param {PlayerOptions} options
6
+ * @returns {PlayerHandle}
7
+ */
8
+ export function createPlayer(options: PlayerOptions): PlayerHandle;
9
+ /** Slowest playback speed (a quarter of recorded time). */
10
+ export const PLAYER_MIN_SPEED: 0.25;
11
+ /** Fastest playback speed (16 times recorded time). */
12
+ export const PLAYER_MAX_SPEED: 16;
13
+ export type PlayerOptions = {
14
+ /**
15
+ * Required. Host element the playback viewer is appended into. It must be
16
+ * connected to a document: the mirror only loads in a connected iframe.
17
+ * Otherwise the factory throws Error('player-container-required').
18
+ */
19
+ container: Element;
20
+ /**
21
+ * Required. A Recording (see the recorder module) or a bare array of
22
+ * RecordingEvent objects. Validated at creation; an invalid one throws
23
+ * Error('player-recording-invalid:' + reason).
24
+ */
25
+ recording: import("../recorder/index.js").Recording | import("../recorder/index.js").RecordingEvent[];
26
+ /**
27
+ * Optional. Defaults to a console-backed logger. Shared with the viewer.
28
+ */
29
+ logger?: {
30
+ info: Function;
31
+ warn: Function;
32
+ error: Function;
33
+ };
34
+ /**
35
+ * Optional construction-document fallback, passed to createViewer.
36
+ */
37
+ document?: Document;
38
+ /**
39
+ * Optional cap, in recording ms, on how long an idle gap plays. 0 (the
40
+ * default) plays every gap in full. Negative or non-finite values throw
41
+ * Error('player-skip-idle-invalid').
42
+ */
43
+ skipIdleMs?: number;
44
+ /**
45
+ * Optional. Default true: the mirror iframe gets the inert attribute,
46
+ * pointer-events none, and tabindex -1, so pointer and keyboard input
47
+ * never reach mirrored links or forms. Pass false only for trusted
48
+ * recordings.
49
+ */
50
+ inert?: boolean;
51
+ /**
52
+ * 'reference' (default), 'poster', or 'off'. Passed to createViewer, which
53
+ * throws Error('viewer-mediamode-invalid') for anything else.
54
+ */
55
+ mediaMode?: string;
56
+ /**
57
+ * Optional asset origin hook, passed to createViewer unchanged.
58
+ */
59
+ assetOriginPolicy?: Function;
60
+ /**
61
+ * Optional asset host allowlist, passed to createViewer unchanged.
62
+ */
63
+ allowAssetOrigins?: string[];
64
+ };
65
+ /**
66
+ * A host mark on the playback timeline: the recorded mark data plus its
67
+ * kind and its time in ms from the first event.
68
+ */
69
+ export type PlayerMarker = {
70
+ t: number;
71
+ kind: string;
72
+ } & {
73
+ [x: string]: any;
74
+ };
75
+ export type PlayerTimeEvent = {
76
+ /**
77
+ * Playback position in ms from the first event.
78
+ */
79
+ currentTime: number;
80
+ /**
81
+ * Recording length in ms.
82
+ */
83
+ duration: number;
84
+ };
85
+ export type PlayerStateEvent = {
86
+ state: "paused" | "playing" | "ended";
87
+ currentTime: number;
88
+ };
89
+ export type PlayerHandle = {
90
+ /**
91
+ * Show exactly the recorded state at ms (clamped to [0, duration]).
92
+ * Resolves once that state is applied, or once a newer seek supersedes
93
+ * this one.
94
+ */
95
+ seek: (ms: number) => Promise<void>;
96
+ /**
97
+ * Start the frame clock. Throws Error('player-speed-invalid')
98
+ * synchronously for a bad speed. From the end, restarts at 0.
99
+ */
100
+ play: (options?: {
101
+ speed?: number;
102
+ }) => Promise<void>;
103
+ pause: () => void;
104
+ /**
105
+ * Speed in [PLAYER_MIN_SPEED, PLAYER_MAX_SPEED]; otherwise throws
106
+ * Error('player-speed-invalid').
107
+ */
108
+ setSpeed: (speed: number) => void;
109
+ /**
110
+ * Read-only playback position in ms from the first event.
111
+ */
112
+ currentTime: number;
113
+ /**
114
+ * Read-only recording length in ms.
115
+ */
116
+ duration: number;
117
+ /**
118
+ * Read-only.
119
+ */
120
+ playing: boolean;
121
+ /**
122
+ * Fresh copies of every host mark, in timeline order.
123
+ */
124
+ markers: () => PlayerMarker[];
125
+ /**
126
+ * Subscribe to playback events. Returns unsubscribe. Only 'state' calls
127
+ * the handler immediately with the current value. Unknown names or
128
+ * non-function handlers throw Error('player-event-unsupported').
129
+ */
130
+ on: (eventName: "time" | "ended" | "marker" | "state" | "loaded", handler: (event: any) => void) => (() => void);
131
+ /**
132
+ * Stop playback, resolve waiting seeks, and remove the viewer. Idempotent.
133
+ */
134
+ destroy: () => void;
135
+ };
136
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/player/index.js"],"names":[],"mappings":"AA+HA;;;;;;GAMG;AACH,sCAHW,aAAa,GACX,YAAY,CA8exB;AA9lBD,2DAA2D;AAC3D,+BAAgC,IAAI,CAAC;AAErC,uDAAuD;AACvD,+BAAgC,EAAE,CAAC;;;;;;;eAOrB,OAAO;;;;;;eAIP,OAAO,sBAAsB,EAAE,SAAS,GAAC,OAAO,sBAAsB,EAAE,cAAc,EAAE;;;;aAIxF;QAAC,IAAI,WAAW;QAAC,IAAI,WAAW;QAAC,KAAK,WAAU;KAAC;;;;eAEjD,QAAQ;;;;;;iBAER,MAAM;;;;;;;YAIN,OAAO;;;;;gBAKP,MAAM;;;;;;;;wBAKN,MAAM,EAAE;;;;;;2BAQT;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAG;QAAO,MAAM,GAAE,GAAC;CAAC;;;;;iBAK5C,MAAM;;;;cAEN,MAAM;;;WAMN,QAAQ,GAAC,SAAS,GAAC,OAAO;iBAC1B,MAAM;;;;;;;;UAKN,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;;;;;UAI7B,CAAC,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAC,KAAK,OAAO,CAAC,IAAI,CAAC;WAG7C,MAAM,IAAI;;;;;cACV,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;;;;iBAGvB,MAAM;;;;cAEN,MAAM;;;;aAEN,OAAO;;;;aAEP,MAAM,YAAY,EAAE;;;;;;QAEpB,CAAC,SAAS,EAAE,MAAM,GAAC,OAAO,GAAC,QAAQ,GAAC,OAAO,GAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,KAAK,KAAQ,KAAK,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;;;;aAIvG,MAAM,IAAI"}
@@ -18,6 +18,17 @@ export const SNAPSHOT_BUDGET_BYTES: number;
18
18
  export const TRUNCATION_VIEWPORT_MULTIPLIER: 3;
19
19
  /** Scroll side-channel throttle: at most one event per this many ms. */
20
20
  export const SCROLL_THROTTLE_MS: 200;
21
+ /**
22
+ * Media side-channel heartbeat throttle: while a tracked <video>/<audio> is
23
+ * playing, a `timeupdate` heartbeat (STREAM.MEDIA) is emitted at most once per
24
+ * this many ms for drift correction. 250 ms is a practice-based co-watching
25
+ * cadence (~4 Hz) -- frequent enough for the reconciler to converge sub-second
26
+ * drift, sparse enough to stay well under the relay cap. Discrete transitions
27
+ * (play/pause/seeked/ratechange/ended/volumechange/loadedmetadata) bypass this
28
+ * throttle and flush immediately; the value is tunable against the v2.1
29
+ * evaluation harness (Phase 13 concern).
30
+ */
31
+ export const MEDIA_SYNC_THROTTLE_MS: 250;
21
32
  /** Overlay side-channel throttle: at most one broadcast per this many ms. */
22
33
  export const OVERLAY_THROTTLE_MS: 500;
23
34
  /**
@@ -32,4 +43,15 @@ export const READY_PROBE_INTERVAL_MS: 200;
32
43
  export const READY_PROBE_BUDGET_MS: 5000;
33
44
  /** Inline <style> tags larger than this are skipped during snapshot capture. */
34
45
  export const INLINE_STYLE_MAX_BYTES: 500000;
46
+ /**
47
+ * Maximum UTF-8 byte length of an inline `data:` image URI that capture will
48
+ * emit verbatim on the wire. 262144 = 256 KiB -- roughly a quarter of the
49
+ * per-message cap headroom (SNAPSHOT_BUDGET_BYTES is ~838 KiB, the 80%
50
+ * truncation budget of the 1 MiB relay cap), so a single inline asset cannot
51
+ * crowd out the rest of the snapshot. A `data:` image larger than this degrades
52
+ * to a dimensioned placeholder; small inline icons/sprites (<= cap) pass through
53
+ * byte-identical, preserving the existing `data:image/*` pass-through and the
54
+ * differential oracle. (Phase 12 ASST-04.)
55
+ */
56
+ export const ASSET_DATA_URI_MAX_BYTES: 262144;
35
57
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/protocol/constants.js"],"names":[],"mappings":"AAIA;;;GAGG;AACH,4CAA6C,OAAO,CAAC;AAErD;;;;GAIG;AACH,uCAAwC,GAAG,CAAC;AAE5C,uCAAuC;AACvC,2CAEE;AAEF;;;GAGG;AACH,6CAA8C,CAAC,CAAC;AAEhD,wEAAwE;AACxE,iCAAkC,GAAG,CAAC;AAEtC,6EAA6E;AAC7E,kCAAmC,GAAG,CAAC;AAEvC;;;GAGG;AACH,0CAA2C,IAAI,CAAC;AAEhD,0CAA0C;AAC1C,+BAAgC,GAAG,CAAC;AAEpC,uDAAuD;AACvD,sCAAuC,GAAG,CAAC;AAC3C,oCAAqC,IAAI,CAAC;AAE1C,gFAAgF;AAChF,qCAAsC,MAAM,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/protocol/constants.js"],"names":[],"mappings":"AAIA;;;GAGG;AACH,4CAA6C,OAAO,CAAC;AAErD;;;;GAIG;AACH,uCAAwC,GAAG,CAAC;AAE5C,uCAAuC;AACvC,2CAEE;AAEF;;;GAGG;AACH,6CAA8C,CAAC,CAAC;AAEhD,wEAAwE;AACxE,iCAAkC,GAAG,CAAC;AAEtC;;;;;;;;;GASG;AACH,qCAAsC,GAAG,CAAC;AAE1C,6EAA6E;AAC7E,kCAAmC,GAAG,CAAC;AAEvC;;;GAGG;AACH,0CAA2C,IAAI,CAAC;AAEhD,0CAA0C;AAC1C,+BAAgC,GAAG,CAAC;AAEpC,uDAAuD;AACvD,sCAAuC,GAAG,CAAC;AAC3C,oCAAqC,IAAI,CAAC;AAE1C,gFAAgF;AAChF,qCAAsC,MAAM,CAAC;AAE7C;;;;;;;;;GASG;AACH,uCAAwC,MAAM,CAAC"}
@@ -2,4 +2,5 @@ export * from "./constants.js";
2
2
  export * from "./messages.js";
3
3
  export * from "./envelope.js";
4
4
  export * from "./remote-control.js";
5
+ export * from "./media-reconcile.js";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Decide the single drift-correction action for one media element.
3
+ *
4
+ * Decision order (RESEARCH Pattern 1, exact):
5
+ * merge cfg -> incomplete-remote guard -> explicit `seeked` short-circuit ->
6
+ * paused/rate-0 -> NaN local guard -> latency-compensated `expected` (elapsed
7
+ * clamped >= 0) -> LIVE branch (before any duration math) -> VOD: loop-wrap ->
8
+ * hold band (carries revertRate) -> bounded sign-correct nudge (carries
9
+ * baseRate) -> hard-seek (clamp toTime into [0, duration]).
10
+ *
11
+ * @param {{currentTime?: number, paused?: boolean, playbackRate?: number}} local Observed element state
12
+ * @param {import('./messages.js').MediaSyncPayload|null} remote Latency-uncompensated captured state
13
+ * @param {number} now Caller clock (ms), e.g. performance.now()-equivalent
14
+ * @param {Partial<MediaReconcileConfig>} [config] Overrides merged over DEFAULT_MEDIA_RECONCILE_CONFIG
15
+ * @returns {{action:'hold'|'pause'|'nudge'|'seek'|'rejoin-edge', toTime?:number, rate?:number, baseRate?:number, revertRate?:number, reason?:string}}
16
+ */
17
+ export function reconcileMediaDrift(local: {
18
+ currentTime?: number;
19
+ paused?: boolean;
20
+ playbackRate?: number;
21
+ }, remote: import("./messages.js").MediaSyncPayload | null, now: number, config?: Partial<MediaReconcileConfig>): {
22
+ action: "hold" | "pause" | "nudge" | "seek" | "rejoin-edge";
23
+ toTime?: number;
24
+ rate?: number;
25
+ baseRate?: number;
26
+ revertRate?: number;
27
+ reason?: string;
28
+ };
29
+ export namespace DEFAULT_MEDIA_RECONCILE_CONFIG {
30
+ let holdBandSec: number;
31
+ let hardSeekSec: number;
32
+ let maxNudgeFraction: number;
33
+ let liveRejoinSec: number;
34
+ }
35
+ export type MediaReconcileConfig = {
36
+ /**
37
+ * In-tolerance band (s); within this, hold. Default 0.25
38
+ */
39
+ holdBandSec: number;
40
+ /**
41
+ * Hard-seek threshold (s); above this, seek. Default 1.0
42
+ */
43
+ hardSeekSec: number;
44
+ /**
45
+ * Max temporary rate delta (fraction). Default 0.05
46
+ */
47
+ maxNudgeFraction: number;
48
+ /**
49
+ * Live-edge rejoin threshold (s). Default 1.0
50
+ */
51
+ liveRejoinSec: number;
52
+ };
53
+ //# sourceMappingURL=media-reconcile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-reconcile.d.ts","sourceRoot":"","sources":["../../../src/protocol/media-reconcile.js"],"names":[],"mappings":"AAoGA;;;;;;;;;;;;;;;GAeG;AACH,2CANW;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAC,UAC/D,OAAO,eAAe,EAAE,gBAAgB,GAAC,IAAI,OAC7C,MAAM,WACN,OAAO,CAAC,oBAAoB,CAAC,GAC3B;IAAC,MAAM,EAAC,MAAM,GAAC,OAAO,GAAC,OAAO,GAAC,MAAM,GAAC,aAAa,CAAC;IAAC,MAAM,CAAC,EAAC,MAAM,CAAC;IAAC,IAAI,CAAC,EAAC,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAC,MAAM,CAAC;IAAC,UAAU,CAAC,EAAC,MAAM,CAAC;IAAC,MAAM,CAAC,EAAC,MAAM,CAAA;CAAC,CAyEpJ;;;;;;;;;;;iBArKa,MAAM;;;;iBACN,MAAM;;;;sBACN,MAAM;;;;mBACN,MAAM"}