ontrackd 0.13.0 → 0.14.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 +24 -12
  2. package/dist/cli/pull.js +5 -0
  3. package/dist/cli/pull.js.map +1 -1
  4. package/dist/core/exportTaskDoc.js +43 -1
  5. package/dist/core/exportTaskDoc.js.map +1 -1
  6. package/dist/core/feedbackTypes.d.ts +37 -0
  7. package/dist/core/journey.d.ts +31 -0
  8. package/dist/core/journey.js +93 -0
  9. package/dist/core/journey.js.map +1 -0
  10. package/dist/core/untrusted.js +10 -6
  11. package/dist/core/untrusted.js.map +1 -1
  12. package/dist/mcp/search.js +3 -2
  13. package/dist/mcp/search.js.map +1 -1
  14. package/dist/mcp/server.js +13 -7
  15. package/dist/mcp/server.js.map +1 -1
  16. package/dist/overlay/anchors.d.ts +1 -0
  17. package/dist/overlay/anchors.js +3 -0
  18. package/dist/overlay/anchors.js.map +1 -1
  19. package/dist/overlay/api.d.ts +18 -1
  20. package/dist/overlay/api.js +37 -7
  21. package/dist/overlay/api.js.map +1 -1
  22. package/dist/overlay/attachments.d.ts +5 -1
  23. package/dist/overlay/attachments.js +16 -3
  24. package/dist/overlay/attachments.js.map +1 -1
  25. package/dist/overlay/connectDialog.js +1 -1
  26. package/dist/overlay/connectDialog.js.map +1 -1
  27. package/dist/overlay/directReviewer.d.ts +17 -2
  28. package/dist/overlay/directReviewer.js +37 -10
  29. package/dist/overlay/directReviewer.js.map +1 -1
  30. package/dist/overlay/journeyRecorder.d.ts +30 -0
  31. package/dist/overlay/journeyRecorder.js +238 -0
  32. package/dist/overlay/journeyRecorder.js.map +1 -0
  33. package/dist/overlay/movedAnchors.js +5 -0
  34. package/dist/overlay/movedAnchors.js.map +1 -1
  35. package/dist/overlay/recorder.d.ts +8 -4
  36. package/dist/overlay/recorder.js +163 -47
  37. package/dist/overlay/recorder.js.map +1 -1
  38. package/dist/overlay/recordingEditor.d.ts +12 -0
  39. package/dist/overlay/recordingEditor.js +130 -0
  40. package/dist/overlay/recordingEditor.js.map +1 -0
  41. package/dist/overlay/recordingPlayer.d.ts +14 -0
  42. package/dist/overlay/recordingPlayer.js +311 -0
  43. package/dist/overlay/recordingPlayer.js.map +1 -0
  44. package/dist/overlay/rrweb-replay.js +120 -0
  45. package/dist/overlay/runtime.js +748 -52
  46. package/dist/overlay/runtime.js.map +1 -1
  47. package/dist/overlay/state.js +2 -1
  48. package/dist/overlay/state.js.map +1 -1
  49. package/dist/overlay/styles.js +45 -0
  50. package/dist/overlay/styles.js.map +1 -1
  51. package/dist/remote/client.d.ts +3 -2
  52. package/dist/remote/client.js +3 -3
  53. package/dist/remote/client.js.map +1 -1
  54. package/dist/remote/content-schema.d.ts +291 -43
  55. package/dist/remote/content-schema.js +91 -0
  56. package/dist/remote/content-schema.js.map +1 -1
  57. package/dist/remote/content.js +4 -2
  58. package/dist/remote/content.js.map +1 -1
  59. package/dist/remote/store.js +3 -1
  60. package/dist/remote/store.js.map +1 -1
  61. package/dist/remote/types.d.ts +1 -0
  62. package/dist/sidecar/commentFiles.js +1 -1
  63. package/dist/sidecar/commentFiles.js.map +1 -1
  64. package/package.json +4 -2
@@ -0,0 +1,238 @@
1
+ import { anchorCandidatesFor } from './anchors.js';
2
+ const MAX_ENTRIES = 500;
3
+ /** Leaves room for a 4,000-code-point body and the rest of the 65,536-byte Cloud content object. */
4
+ const MAX_JOURNEY_BYTES = 40 * 1024;
5
+ const MAX_LABEL = 120;
6
+ const MAX_MESSAGE = 500;
7
+ const MAX_URL = 2000;
8
+ /**
9
+ * The small, searchable log that accompanies an rrweb journey.
10
+ *
11
+ * It observes outcomes only: no input values, request bodies, headers, query strings or hashes.
12
+ * Every wrapper is conditional on its still being installed when cleanup runs, so a page that
13
+ * replaced the same API meanwhile keeps its own replacement.
14
+ */
15
+ export class JourneyRecorder {
16
+ startedAt;
17
+ apiOrigin;
18
+ emit;
19
+ entries = [];
20
+ truncated = false;
21
+ cleanup = [];
22
+ active = false;
23
+ bytes = 2; // JSON array brackets.
24
+ constructor(startedAt, apiOrigin, emit) {
25
+ this.startedAt = startedAt;
26
+ this.apiOrigin = apiOrigin;
27
+ this.emit = emit;
28
+ }
29
+ start() {
30
+ if (this.active)
31
+ return;
32
+ this.active = true;
33
+ try {
34
+ this.listenForClicks();
35
+ this.listenForRoutes();
36
+ this.listenForConsoleErrors();
37
+ this.listenForFailedRequests();
38
+ }
39
+ catch (error) {
40
+ this.stop(0);
41
+ throw error;
42
+ }
43
+ }
44
+ stop(durationMs) {
45
+ this.active = false;
46
+ for (const undo of this.cleanup.splice(0).reverse()) {
47
+ try {
48
+ undo();
49
+ }
50
+ catch { /* One hostile property must not leave the other page APIs wrapped. */ }
51
+ }
52
+ for (const entry of this.entries)
53
+ entry.t = Math.min(entry.t, durationMs);
54
+ }
55
+ elapsed() {
56
+ return Math.max(0, Math.round(performance.now() - this.startedAt));
57
+ }
58
+ note(entry) {
59
+ if (!this.active)
60
+ return;
61
+ if (this.entries.length >= MAX_ENTRIES) {
62
+ this.truncated = true;
63
+ return;
64
+ }
65
+ const timed = { ...entry, t: this.elapsed() };
66
+ const encoded = new TextEncoder().encode(JSON.stringify(timed)).byteLength + (this.entries.length ? 1 : 0);
67
+ if (this.bytes + encoded > MAX_JOURNEY_BYTES) {
68
+ this.truncated = true;
69
+ return;
70
+ }
71
+ this.bytes += encoded;
72
+ this.entries.push(timed);
73
+ try {
74
+ this.emit(timed);
75
+ }
76
+ catch { /* The searchable log still survives when rrweb refuses a custom event. */ }
77
+ }
78
+ listenForClicks() {
79
+ const onClick = (event) => {
80
+ const target = event.target instanceof Element ? event.target : null;
81
+ if (!target || target.closest('[data-feedback-overlay]'))
82
+ return;
83
+ const candidate = anchorCandidatesFor(target)[0];
84
+ const anchor = candidate?.anchor;
85
+ const source = anchor?.file ? { file: anchor.file, line: anchor.line, column: anchor.column } : null;
86
+ const field = target.closest('input,textarea,select,[contenteditable]:not([contenteditable="false"])');
87
+ const labelled = target.closest('button,a') ?? target;
88
+ const label = field ? '' : truncate(visibleText(labelled), MAX_LABEL);
89
+ this.note({ type: 'click', source, label, domPath: truncate(anchor?.domPath ?? '', 2000) });
90
+ };
91
+ document.addEventListener('click', onClick, true);
92
+ this.cleanup.push(() => document.removeEventListener('click', onClick, true));
93
+ }
94
+ listenForRoutes() {
95
+ const note = () => this.note({ type: 'route', route: truncate(location.pathname, MAX_URL) });
96
+ const owner = this;
97
+ for (const method of ['pushState', 'replaceState']) {
98
+ const original = history[method];
99
+ const wrapped = function (...args) {
100
+ const result = original.apply(this, args);
101
+ if (owner.active)
102
+ note();
103
+ return result;
104
+ };
105
+ history[method] = wrapped;
106
+ this.cleanup.push(() => { if (history[method] === wrapped)
107
+ history[method] = original; });
108
+ }
109
+ for (const name of ['popstate', 'hashchange']) {
110
+ window.addEventListener(name, note);
111
+ this.cleanup.push(() => window.removeEventListener(name, note));
112
+ }
113
+ }
114
+ listenForConsoleErrors() {
115
+ const original = console.error;
116
+ const wrapped = (...args) => {
117
+ if (this.active)
118
+ this.note({ type: 'console_error', message: truncate(consoleMessage(args), MAX_MESSAGE) });
119
+ original.apply(console, args);
120
+ };
121
+ console.error = wrapped;
122
+ this.cleanup.push(() => { if (console.error === wrapped)
123
+ console.error = original; });
124
+ const onError = (event) => {
125
+ this.note({ type: 'console_error', message: truncate(String(event.message || event.error?.message || 'Uncaught error'), MAX_MESSAGE) });
126
+ };
127
+ const onRejection = (event) => {
128
+ this.note({ type: 'console_error', message: truncate(consoleValue(event.reason), MAX_MESSAGE) });
129
+ };
130
+ window.addEventListener('error', onError);
131
+ window.addEventListener('unhandledrejection', onRejection);
132
+ this.cleanup.push(() => window.removeEventListener('error', onError));
133
+ this.cleanup.push(() => window.removeEventListener('unhandledrejection', onRejection));
134
+ }
135
+ listenForFailedRequests() {
136
+ const originalFetch = window.fetch;
137
+ const wrappedFetch = async (input, init) => {
138
+ if (!this.active)
139
+ return originalFetch(input, init);
140
+ const request = requestMeta(input, init);
141
+ const safe = this.safeRequest(request);
142
+ try {
143
+ const response = await originalFetch(input, init);
144
+ if (safe && response.status >= 400)
145
+ this.note({ type: 'request_failed', ...safe, status: response.status });
146
+ return response;
147
+ }
148
+ catch (error) {
149
+ if (safe)
150
+ this.note({ type: 'request_failed', ...safe, status: 0 });
151
+ throw error;
152
+ }
153
+ };
154
+ window.fetch = wrappedFetch;
155
+ this.cleanup.push(() => { if (window.fetch === wrappedFetch)
156
+ window.fetch = originalFetch; });
157
+ const requests = new WeakMap();
158
+ const originalOpen = XMLHttpRequest.prototype.open;
159
+ const originalSend = XMLHttpRequest.prototype.send;
160
+ const owner = this;
161
+ const wrappedOpen = function (method, url, ...rest) {
162
+ if (!owner.active)
163
+ return originalOpen.apply(this, [method, url, ...rest]);
164
+ requests.set(this, owner.safeRequest({ method, url: String(url) }));
165
+ return originalOpen.apply(this, [method, url, ...rest]);
166
+ };
167
+ const wrappedSend = function (body) {
168
+ if (!owner.active)
169
+ return originalSend.call(this, body);
170
+ const request = requests.get(this);
171
+ if (request) {
172
+ this.addEventListener('loadend', () => {
173
+ if (this.status === 0 || this.status >= 400)
174
+ owner.note({ type: 'request_failed', ...request, status: this.status || 0 });
175
+ }, { once: true });
176
+ }
177
+ return originalSend.call(this, body);
178
+ };
179
+ XMLHttpRequest.prototype.open = wrappedOpen;
180
+ this.cleanup.push(() => { if (XMLHttpRequest.prototype.open === wrappedOpen)
181
+ XMLHttpRequest.prototype.open = originalOpen; });
182
+ XMLHttpRequest.prototype.send = wrappedSend;
183
+ this.cleanup.push(() => { if (XMLHttpRequest.prototype.send === wrappedSend)
184
+ XMLHttpRequest.prototype.send = originalSend; });
185
+ }
186
+ safeRequest(request) {
187
+ try {
188
+ const url = new URL(request.url, location.href);
189
+ if (this.apiOrigin && url.origin === this.apiOrigin)
190
+ return null;
191
+ return { method: truncate(request.method.toUpperCase(), 10) || 'GET', url: truncate(`${url.origin}${url.pathname}`, MAX_URL) };
192
+ }
193
+ catch {
194
+ return null;
195
+ }
196
+ }
197
+ }
198
+ function requestMeta(input, init) {
199
+ const request = typeof Request !== 'undefined' && input instanceof Request ? input : null;
200
+ return { method: String(init?.method ?? request?.method ?? 'GET'), url: String(request?.url ?? input) };
201
+ }
202
+ const privateText = 'input,textarea,select,option,[contenteditable]:not([contenteditable="false"])';
203
+ function visibleText(element) {
204
+ const parts = [];
205
+ const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
206
+ for (let node = walker.nextNode(); node; node = walker.nextNode()) {
207
+ const parent = node.parentElement;
208
+ if (!parent || parent.closest(privateText) || parent.closest('script,style'))
209
+ continue;
210
+ if (parent instanceof HTMLElement && parent.getClientRects().length === 0)
211
+ continue;
212
+ parts.push(node.textContent ?? '');
213
+ }
214
+ return parts.join(' ').replace(/\s+/g, ' ').trim();
215
+ }
216
+ function truncate(value, codePoints) {
217
+ const result = [];
218
+ for (const character of value) {
219
+ if (result.length >= codePoints)
220
+ break;
221
+ const unit = character.charCodeAt(0);
222
+ result.push(character.length === 1 && unit >= 0xD800 && unit <= 0xDFFF ? '�' : character);
223
+ }
224
+ return result.join('');
225
+ }
226
+ function consoleMessage(args) {
227
+ return args.map(consoleValue).join(' ');
228
+ }
229
+ function consoleValue(value) {
230
+ if (value instanceof Error)
231
+ return value.message;
232
+ if (typeof value === 'string')
233
+ return value;
234
+ if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint' || value == null)
235
+ return String(value);
236
+ return Object.prototype.toString.call(value);
237
+ }
238
+ //# sourceMappingURL=journeyRecorder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journeyRecorder.js","sourceRoot":"","sources":["../../src/overlay/journeyRecorder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,oGAAoG;AACpG,MAAM,iBAAiB,GAAG,EAAE,GAAG,IAAI,CAAC;AACpC,MAAM,SAAS,G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,MAAM;QACvC,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,cAAc,CAAC,IAAe;IACrC,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,KAAK,CAAC,OAAO,CAAC;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IAChI,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/C,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { isRecording } from '../core/journey.js';
1
2
  import { anchorMatches, locateAnchor } from './anchors.js';
2
3
  /**
3
4
  * Where comments made on an earlier build are on this one.
@@ -44,6 +45,8 @@ export function anchorsToTranslate(comments) {
44
45
  return [];
45
46
  const wanted = new Map();
46
47
  for (const comment of comments) {
48
+ if (isRecording(comment))
49
+ continue;
47
50
  const buildId = buildOf(comment);
48
51
  if (!buildId || buildId === currentBuild)
49
52
  continue;
@@ -117,6 +120,8 @@ function leftElsewhere(comment) {
117
120
  }
118
121
  /** The element a comment is about on this page, or null. */
119
122
  export function locateComment(comment) {
123
+ if (isRecording(comment))
124
+ return null;
120
125
  if (leftElsewhere(comment))
121
126
  return null;
122
127
  const anchor = anchorOf(comment);
@@ -1 +1 @@
1
- {"version":3,"file":"movedAnchors.js","sourceRoot":"","sources":["../../src/overlay/movedAnchors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE3D;;;;;;;;;;;;GAYG;AACH,IAAI,YAAY,GAAkB,IAAI,CAAC;AACvC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAyB,CAAC;AAC/C,mGAAmG;AACnG,MAAM,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;AAC5C,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;AAKhC,MAAM,KAAK,GAAG,CAAC,OAAe,EAAE,QAAgB,EAAE,EAAE,CAAC,GAAG,OAAO,IAAI,QAAQ,EAAE,CAAC;AAC9E,MAAM,OAAO,GAAG,CAAC,OAAgB,EAAE,EAAE;IACnC,MAAM,KAAK,GAAI,OAA2C,CAAC,OAAO,CAAC;IACnE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC,CAAC;AAEF,wFAAwF;AACxF,MAAM,UAAU,eAAe,CAAC,KAAoB;IAClD,IAAI,KAAK,KAAK,YAAY;QAAE,OAAO;IACnC,YAAY,GAAG,KAAK,IAAI,IAAI,CAAC;IAC7B,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,OAAO,CAAC,KAAK,EAAE,CAAC;IAChB,KAAK,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC;AAED,kGAAkG;AAClG,SAAS,YAAY,CAAC,OAAgB;IACpC,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,cAAc,CAAC;IAC1E,IAAI,CAAC,KAA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2
3
  * Records what a reviewer does on the page, to attach it to a comment (contract section 18, Recordings): DOM
3
4
  * events with rrweb, never a video of the screen. Cloud only; the composer asks the Worker what the plan allows
@@ -17,6 +18,9 @@ export type RecordingEnd = {
17
18
  ok: true;
18
19
  file: File;
19
20
  durationMs: number;
21
+ startedAt: string;
22
+ journey: JourneyEntry[];
23
+ journeyTruncated?: true;
20
24
  reason: 'user' | 'limit' | 'size';
21
25
  } | {
22
26
  ok: false;
@@ -28,13 +32,15 @@ export declare class Recorder {
28
32
  private limit;
29
33
  private blockSelector;
30
34
  private tick;
35
+ private apiOrigin;
31
36
  private stopRecording;
32
37
  private timer;
33
38
  private events;
34
39
  private rawBytes;
35
40
  private startedAt;
41
+ private startedAtIso;
36
42
  private finished;
37
- private cleanup;
43
+ private journey;
38
44
  private done;
39
45
  /** Settles once, when the recording ends: stopped by the person, by the limit, or by what it could not do. */
40
46
  readonly ended: Promise<RecordingEnd>;
@@ -45,12 +51,10 @@ export declare class Recorder {
45
51
  constructor(limit: {
46
52
  seconds: number;
47
53
  bytes: number;
48
- }, blockSelector: string, tick: (elapsedMs: number) => void);
54
+ }, blockSelector: string, tick: (elapsedMs: number) => void, apiOrigin?: string | null);
49
55
  /** Starts recording. Rejects when the recorder could not be loaded or started: nothing is left running. */
50
56
  start(): Promise<void>;
51
57
  /** Stops, as the person asked. */
52
58
  stop(): void;
53
- /** pushState and hash changes make no event of their own: the route is noted, for the one who reads it. */
54
- private noteRoutes;
55
59
  private finish;
56
60
  }
@@ -1,4 +1,5 @@
1
1
  import { formatBytes } from '../core/attachmentTypes.js';
2
+ import { JourneyRecorder } from './journeyRecorder.js';
2
3
  export const RECORDING_MIME = 'application/vnd.ontrackd.recording+gzip';
3
4
  let library = null;
4
5
  /** Loaded on the first recording, from beside this module, as the screenshot library is (snapshot.ts). */
@@ -18,6 +19,95 @@ const TICK_MS = 250;
18
19
  async function gzip(text) {
19
20
  return new Uint8Array(await new Response(new Response(text).body.pipeThrough(new CompressionStream('gzip'))).arrayBuffer());
20
21
  }
22
+ /** rrweb's initial metadata and DOM attributes can carry credentials in query strings or hashes. */
23
+ const urlFields = new Set([
24
+ 'action', 'background', 'cite', 'data', 'formaction', 'href', 'imagesrcset', 'manifest', 'ping',
25
+ 'poster', 'profile', 'rr_dataurl', 'src', 'srcset', 'usemap', 'xlink:href',
26
+ ]);
27
+ const cssFields = new Set(['_cssText', 'cssText', 'replace', 'replaceSync', 'rule', 'style']);
28
+ const cssResourceFields = new Set([
29
+ 'clip-path', 'cursor', 'fill', 'filter', 'marker-end', 'marker-mid', 'marker-start', 'mask', 'stroke',
30
+ ]);
31
+ function safeUrl(value) {
32
+ try {
33
+ const url = new URL(value, location.href);
34
+ if (url.protocol === 'data:')
35
+ return 'data:';
36
+ if (url.protocol === 'blob:')
37
+ return `${url.protocol}${url.pathname}`;
38
+ return /^\/(?!\/)/.test(value.trim()) ? url.pathname : `${url.origin}${url.pathname}`;
39
+ }
40
+ catch {
41
+ return location.pathname;
42
+ }
43
+ }
44
+ function safeCss(value) {
45
+ const normalized = value.replace(/\/\*[\s\S]*?\*\//g, '');
46
+ if (normalized.includes('\\') || /(?:-webkit-)?image-set\s*\(/i.test(normalized))
47
+ return '';
48
+ return normalized
49
+ .replace(/@import\b[^;]*(?:;|$)/gi, '')
50
+ .replace(/url\(\s*[^)]*?\s*\)/gi, 'url("")');
51
+ }
52
+ function sanitizeStoredValue(value, parentTag = '') {
53
+ if (Array.isArray(value)) {
54
+ for (const item of value)
55
+ sanitizeStoredValue(item, parentTag);
56
+ return;
57
+ }
58
+ if (!value || typeof value !== 'object')
59
+ return;
60
+ const record = value;
61
+ const tag = typeof record.tagName === 'string' ? record.tagName.toLowerCase() : parentTag;
62
+ if (record.source === 0 && Array.isArray(record.texts)) {
63
+ for (const mutation of record.texts) {
64
+ if (mutation && typeof mutation === 'object' && typeof mutation.value === 'string') {
65
+ mutation.value = safeCss(mutation.value);
66
+ }
67
+ }
68
+ }
69
+ if (typeof record.property === 'string' && typeof record.value === 'string')
70
+ record.value = safeCss(record.value);
71
+ const attributes = record.attributes && typeof record.attributes === 'object' && !Array.isArray(record.attributes)
72
+ ? record.attributes : null;
73
+ if (attributes) {
74
+ const refresh = tag === 'meta' && Object.entries(attributes).some(([name, item]) => name.toLowerCase() === 'http-equiv' && String(item).toLowerCase() === 'refresh');
75
+ for (const [name, item] of Object.entries(attributes)) {
76
+ const lower = name.toLowerCase();
77
+ if (lower === 'srcdoc' || refresh && lower === 'content')
78
+ delete attributes[name];
79
+ else if (['by', 'from', 'to', 'values'].includes(lower))
80
+ delete attributes[name];
81
+ else if (typeof item === 'string' && urlFields.has(lower))
82
+ attributes[name] = safeUrl(item);
83
+ else if (typeof item === 'string' && (cssFields.has(lower) || cssResourceFields.has(lower)))
84
+ attributes[name] = safeCss(item);
85
+ }
86
+ }
87
+ for (const [name, item] of Object.entries(record)) {
88
+ if (name.toLowerCase() === 'srcdoc')
89
+ delete record[name];
90
+ else if (typeof item === 'string' && urlFields.has(name.toLowerCase()))
91
+ record[name] = safeUrl(item);
92
+ else if (typeof item === 'string' && (cssFields.has(name) || tag === 'style' && name === 'textContent'))
93
+ record[name] = safeCss(item);
94
+ else if (typeof item === 'string' && ['to', 'from', 'by', 'values'].includes(name))
95
+ delete record[name];
96
+ else
97
+ sanitizeStoredValue(item, tag);
98
+ }
99
+ }
100
+ function safeEvent(event) {
101
+ if (!event || typeof event !== 'object')
102
+ return event;
103
+ const value = event;
104
+ if (value.type === 3 && value.data && typeof value.data === 'object'
105
+ && [9, 10].includes(Number(value.data.source)))
106
+ return null;
107
+ const copy = structuredClone(event);
108
+ sanitizeStoredValue(copy);
109
+ return copy;
110
+ }
21
111
  const two = (value) => String(value).padStart(2, '0');
22
112
  /** `recording-20261121-1845.rrweb` */
23
113
  function recordingName(at) {
@@ -29,13 +119,15 @@ export class Recorder {
29
119
  limit;
30
120
  blockSelector;
31
121
  tick;
122
+ apiOrigin;
32
123
  stopRecording;
33
124
  timer;
34
125
  events = [];
35
126
  rawBytes = 0;
36
127
  startedAt = 0;
128
+ startedAtIso = '';
37
129
  finished = false;
38
- cleanup = [];
130
+ journey = null;
39
131
  done;
40
132
  /** Settles once, when the recording ends: stopped by the person, by the limit, or by what it could not do. */
41
133
  ended = new Promise((resolve) => { this.done = resolve; });
@@ -43,84 +135,108 @@ export class Recorder {
43
135
  * `blockSelector`: what is left out of the recording (the overlay itself). `tick` hears the elapsed milliseconds.
44
136
  * Input values are never recorded (`maskAllInputs`); the overlay's own words are not on the page to record.
45
137
  */
46
- constructor(limit, blockSelector, tick) {
138
+ constructor(limit, blockSelector, tick, apiOrigin = null) {
47
139
  this.limit = limit;
48
140
  this.blockSelector = blockSelector;
49
141
  this.tick = tick;
142
+ this.apiOrigin = apiOrigin;
50
143
  }
51
144
  /** Starts recording. Rejects when the recorder could not be loaded or started: nothing is left running. */
52
145
  async start() {
53
146
  const { record } = await loadLibrary();
54
147
  this.startedAt = performance.now();
55
- this.stopRecording = record({
56
- emit: (event) => {
57
- if (this.finished)
58
- return;
59
- this.events.push(event);
60
- this.rawBytes += JSON.stringify(event).length;
61
- if (this.rawBytes > MAX_RAW_BYTES)
62
- void this.finish('size');
63
- },
64
- maskAllInputs: true,
65
- blockSelector: this.blockSelector,
66
- });
67
- // record() emits its first snapshot before it returns: a page already over the cap finishes here, with nothing to undo yet.
68
- if (this.finished) {
148
+ this.startedAtIso = new Date().toISOString();
149
+ try {
150
+ const stopRecording = record({
151
+ emit: (raw) => {
152
+ if (this.finished)
153
+ return;
154
+ const event = safeEvent(raw);
155
+ if (event === null)
156
+ return;
157
+ const encoded = new TextEncoder().encode(JSON.stringify(event)).byteLength;
158
+ // Reserve enough for the envelope, duration, brackets, and commas before accepting an event.
159
+ const projected = 64 + this.rawBytes + (this.events.length ? 1 : 0) + encoded;
160
+ if (projected > MAX_RAW_BYTES) {
161
+ void this.finish('size');
162
+ return;
163
+ }
164
+ this.events.push(event);
165
+ this.rawBytes += encoded + (this.events.length > 1 ? 1 : 0);
166
+ },
167
+ maskAllInputs: true,
168
+ maskTextSelector: '[contenteditable]:not([contenteditable="false"])',
169
+ blockSelector: this.blockSelector,
170
+ });
171
+ this.stopRecording = stopRecording;
172
+ // record() emits its first snapshot before it returns: a page already over the cap finishes here.
173
+ if (this.finished) {
174
+ try {
175
+ stopRecording?.();
176
+ }
177
+ catch { /* it is stopping anyway */ }
178
+ return;
179
+ }
180
+ if (!stopRecording)
181
+ throw new Error('The recorder did not start');
182
+ this.journey = new JourneyRecorder(this.startedAt, this.apiOrigin, (entry) => {
183
+ const payload = entry.type === 'route' ? { ...entry, href: entry.route } : entry;
184
+ record.addCustomEvent(entry.type, payload);
185
+ });
186
+ this.journey.start();
187
+ this.timer = window.setInterval(() => {
188
+ const elapsed = performance.now() - this.startedAt;
189
+ this.tick(elapsed);
190
+ if (elapsed >= this.limit.seconds * 1000)
191
+ void this.finish('limit');
192
+ }, TICK_MS);
193
+ this.tick(0);
194
+ }
195
+ catch (error) {
196
+ window.clearInterval(this.timer);
197
+ this.journey?.stop(0);
69
198
  try {
70
199
  this.stopRecording?.();
71
200
  }
72
- catch { /* it is stopping anyway */ }
73
- return;
201
+ catch { /* Startup still rolls back every wrapper it can. */ }
202
+ this.stopRecording = undefined;
203
+ throw error;
74
204
  }
75
- if (!this.stopRecording)
76
- throw new Error('The recorder did not start');
77
- this.noteRoutes(record);
78
- this.timer = window.setInterval(() => {
79
- const elapsed = performance.now() - this.startedAt;
80
- this.tick(elapsed);
81
- if (elapsed >= this.limit.seconds * 1000)
82
- void this.finish('limit');
83
- }, TICK_MS);
84
- this.tick(0);
85
205
  }
86
206
  /** Stops, as the person asked. */
87
207
  stop() { void this.finish('user'); }
88
- /** pushState and hash changes make no event of their own: the route is noted, for the one who reads it. */
89
- noteRoutes(record) {
90
- const note = () => { if (!this.finished)
91
- record.addCustomEvent('route', { href: location.href }); };
92
- for (const method of ['pushState', 'replaceState']) {
93
- const original = history[method];
94
- const wrapped = function (...args) { const result = original.apply(this, args); note(); return result; };
95
- history[method] = wrapped;
96
- this.cleanup.push(() => { if (history[method] === wrapped)
97
- history[method] = original; });
98
- }
99
- for (const name of ['popstate', 'hashchange']) {
100
- window.addEventListener(name, note);
101
- this.cleanup.push(() => window.removeEventListener(name, note));
102
- }
103
- }
104
208
  async finish(reason) {
105
209
  if (this.finished)
106
210
  return;
107
211
  this.finished = true;
108
212
  const durationMs = Math.round(performance.now() - this.startedAt);
109
213
  window.clearInterval(this.timer);
214
+ this.journey?.stop(durationMs);
110
215
  try {
111
216
  this.stopRecording?.();
112
217
  }
113
218
  catch { /* it is stopping anyway */ }
114
- for (const undo of this.cleanup)
115
- undo();
116
219
  try {
220
+ if (!this.events.some((event) => event && typeof event === 'object' && event.type === 2)) {
221
+ this.events = [];
222
+ this.done?.({ ok: false, message: 'The page is too large to record' });
223
+ return;
224
+ }
117
225
  const bytes = await gzip(JSON.stringify({ version: 1, durationMs, events: this.events }));
118
226
  this.events = [];
119
227
  if (bytes.byteLength > this.limit.bytes) {
120
228
  this.done?.({ ok: false, message: `The recording is over ${formatBytes(this.limit.bytes)}: record less, or a shorter stretch` });
121
229
  return;
122
230
  }
123
- this.done?.({ ok: true, file: new File([bytes], recordingName(new Date()), { type: RECORDING_MIME }), durationMs, reason });
231
+ this.done?.({
232
+ ok: true,
233
+ file: new File([bytes], recordingName(new Date()), { type: RECORDING_MIME }),
234
+ durationMs,
235
+ startedAt: this.startedAtIso,
236
+ journey: this.journey?.entries ?? [],
237
+ ...(this.journey?.truncated ? { journeyTruncated: true } : {}),
238
+ reason,
239
+ });
124
240
  }
125
241
  catch {
126
242
  this.done?.({ ok: false, message: 'The recording could not be saved' });