@reticlehq/core 3.9.0 → 3.10.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 (55) hide show
  1. package/dist/artifacts/flow-constants.d.ts +17 -0
  2. package/dist/artifacts/flow-constants.js +15 -0
  3. package/dist/artifacts/flow-results.d.ts +27 -2
  4. package/dist/artifacts/flow-step-tool.d.ts +17 -0
  5. package/dist/artifacts/flow-step-tool.js +18 -1
  6. package/dist/artifacts/flow-types.d.ts +59 -0
  7. package/dist/artifacts/flow-types.js +51 -6
  8. package/dist/identity/github-action.d.ts +2 -2
  9. package/dist/identity/github-action.js +1 -1
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.js +3 -0
  12. package/dist/schema/event-message.json +1 -0
  13. package/dist/schema/event-payloads.json +47 -1
  14. package/dist/schema/event-type.json +1 -0
  15. package/dist/schema/reticle-event.json +1 -0
  16. package/dist/schema/reticle-message.json +1 -0
  17. package/dist/telemetry-refusal.d.ts +82 -0
  18. package/dist/telemetry-refusal.js +49 -0
  19. package/dist/telemetry-signals.d.ts +44 -0
  20. package/dist/telemetry-signals.js +17 -0
  21. package/dist/telemetry.d.ts +45 -2
  22. package/dist/telemetry.js +1 -1
  23. package/dist/verdict/findings.d.ts +34 -0
  24. package/dist/verdict/findings.js +37 -0
  25. package/dist/verdict/predicate.d.ts +1 -0
  26. package/dist/verdict/predicate.js +26 -1
  27. package/dist/verdict/verdict-attribution.js +1 -0
  28. package/dist/verdict/verified-constants.d.ts +17 -0
  29. package/dist/verdict/verified-constants.js +17 -0
  30. package/dist/wire/click-input.d.ts +26 -0
  31. package/dist/wire/click-input.js +65 -0
  32. package/dist/wire/constants/animation-command.d.ts +2 -0
  33. package/dist/wire/constants/animation-command.js +2 -0
  34. package/dist/wire/constants/console-event.d.ts +44 -0
  35. package/dist/wire/constants/console-event.js +44 -0
  36. package/dist/wire/constants/constants.d.ts +38 -13
  37. package/dist/wire/constants/constants.js +38 -13
  38. package/dist/wire/constants/determinism.d.ts +17 -0
  39. package/dist/wire/constants/determinism.js +17 -0
  40. package/dist/wire/constants/event-types.d.ts +113 -0
  41. package/dist/wire/constants/event-types.js +87 -0
  42. package/dist/wire/event-payloads.d.ts +16 -93
  43. package/dist/wire/event-payloads.js +26 -72
  44. package/dist/wire/event-priority.js +1 -0
  45. package/dist/wire/global-press.d.ts +9 -2
  46. package/dist/wire/global-press.js +39 -12
  47. package/dist/wire/messages.d.ts +3 -0
  48. package/dist/wire/net.d.ts +39 -0
  49. package/dist/wire/net.js +56 -8
  50. package/dist/wire/redaction.d.ts +18 -0
  51. package/dist/wire/redaction.js +72 -0
  52. package/dist/wire/tool-names.d.ts +4 -0
  53. package/dist/wire/tool-names.js +4 -0
  54. package/dist/wire/types.d.ts +8 -0
  55. package/package.json +1 -1
@@ -13,99 +13,6 @@ import { EventType } from './constants/constants.js';
13
13
  * fields (stack, TTFB, initiator, path diffs) pass through instead of failing closed. Each closes
14
14
  * fully as its observer is rewritten.
15
15
  */
16
- /**
17
- * Wire payload vocabularies. The browser observers EMIT these values and the schemas below VALIDATE
18
- * them, so a browser-side typo (`'SSE'`) would pass tsc and fail only here, at runtime. Each is a const
19
- * object — the browser imports the members, the schema derives its z.nativeEnum from the same object —
20
- * so emitter and validator are one source. Co-located with the schemas (kept constants.ts under its cap).
21
- */
22
- /**
23
- * `FETCH` is a response whose BODY is still arriving after the request itself resolved.
24
- *
25
- * `fetch` settles at HEADERS, so a streamed response is reported complete while the server is still
26
- * writing. Measured on a Next.js App Router page: the RSC payload's NET_REQUEST landed 16 ms in, the
27
- * shell rendered, and the Suspense boundary's content arrived 889 ms later — a window in which
28
- * nothing at all was observed, so `settled` passed while the fallback was still on screen.
29
- */
30
- export declare const StreamTransport: {
31
- readonly SSE: "sse";
32
- readonly WS: "ws";
33
- readonly FETCH: "fetch";
34
- };
35
- export type StreamTransport = (typeof StreamTransport)[keyof typeof StreamTransport];
36
- /** `CLOSE` pairs with `OPEN`: until it arrives, the body is still being written. */
37
- export declare const StreamDirection: {
38
- readonly OPEN: "open";
39
- readonly IN: "in";
40
- readonly OUT: "out";
41
- readonly CLOSE: "close";
42
- };
43
- export type StreamDirection = (typeof StreamDirection)[keyof typeof StreamDirection];
44
- export declare const ScrollDirection: {
45
- readonly UP: "up";
46
- readonly DOWN: "down";
47
- };
48
- export type ScrollDirection = (typeof ScrollDirection)[keyof typeof ScrollDirection];
49
- /**
50
- * How a `route.change` happened.
51
- *
52
- * `push` is `history.pushState`, `replace` is `history.replaceState`, and `pop` is the session
53
- * history moving under the page (`popstate`, or a `hashchange` the page did not push). A
54
- * same-pathname replace records UI state in the URL; it is not a navigation to a new view.
55
- */
56
- export declare const RouteChangeHow: {
57
- readonly PUSH: "push";
58
- readonly REPLACE: "replace";
59
- readonly POP: "pop";
60
- };
61
- export type RouteChangeHow = (typeof RouteChangeHow)[keyof typeof RouteChangeHow];
62
- /** Wire field on `route.change` carrying a `RouteChangeHow`. */
63
- export declare const ROUTE_CHANGE_HOW_FIELD = "how";
64
- /**
65
- * Why a `field.change` was emitted.
66
- *
67
- * `input` is a burst of keystrokes and `change` is the commit that ends one — both are the user's
68
- * own event, fired before a controlled component restores its DOM property. `settled` is a read of
69
- * that property on the frame after the handlers ran. Only a settled read that differs from the
70
- * pre-action value is evidence the screen moved.
71
- */
72
- export declare const FieldChangeKind: {
73
- readonly INPUT: "input";
74
- readonly CHANGE: "change";
75
- readonly SETTLED: "settled";
76
- };
77
- export type FieldChangeKind = (typeof FieldChangeKind)[keyof typeof FieldChangeKind];
78
- /**
79
- * Wire fields on `field.change` beyond `field` / `kind` / `value` / `length`.
80
- *
81
- * `checked` is the property a checkbox or radio actually renders; `value` on those is the HTML
82
- * value (`"on"`), which does not move when the box is toggled. `previous` and `previousChecked`
83
- * are the same reading from before the action, present on a settled event so a consumer can tell
84
- * a render from a restore.
85
- */
86
- export declare const FieldChangeField: {
87
- readonly FIELD: "field";
88
- readonly KIND: "kind";
89
- readonly LENGTH: "length";
90
- readonly VALUE: "value";
91
- readonly REDACTED: "redacted";
92
- readonly CHECKED: "checked";
93
- readonly PREVIOUS: "previous";
94
- readonly PREVIOUS_CHECKED: "previousChecked";
95
- };
96
- /**
97
- * The three readable client-side storage areas.
98
- *
99
- * `cookies` is plural because that is what the storage tool accepts, what the browser returns and
100
- * what the docs publish. This member read `cookie` for as long as it had no callers, which is
101
- * exactly how long a name can disagree with every use of it for free.
102
- */
103
- export declare const StorageArea: {
104
- readonly LOCAL: "local";
105
- readonly SESSION: "session";
106
- readonly COOKIE: "cookies";
107
- };
108
- export type StorageArea = (typeof StorageArea)[keyof typeof StorageArea];
109
16
  /**
110
17
  * A single cookie to seed before initial navigation.
111
18
  */
@@ -188,6 +95,10 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
188
95
  old: z.ZodOptional<z.ZodString>;
189
96
  testid: z.ZodOptional<z.ZodString>;
190
97
  initial: z.ZodOptional<z.ZodBoolean>;
98
+ live: z.ZodOptional<z.ZodEnum<{
99
+ readonly ASSERTIVE: "assertive";
100
+ readonly POLITE: "polite";
101
+ }>>;
191
102
  }, z.core.$strip>;
192
103
  "net.request": z.ZodObject<{
193
104
  id: z.ZodString;
@@ -200,6 +111,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
200
111
  urlRaw: z.ZodOptional<z.ZodString>;
201
112
  nextAction: z.ZodOptional<z.ZodString>;
202
113
  requestShape: z.ZodOptional<z.ZodString>;
114
+ fromDepartedDocument: z.ZodOptional<z.ZodBoolean>;
203
115
  }, z.core.$loose>;
204
116
  "net.pending": z.ZodObject<{
205
117
  id: z.ZodString;
@@ -207,7 +119,15 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
207
119
  url: z.ZodString;
208
120
  initiator: z.ZodString;
209
121
  urlRaw: z.ZodOptional<z.ZodString>;
122
+ fromDepartedDocument: z.ZodOptional<z.ZodBoolean>;
123
+ pageUnloaded: z.ZodOptional<z.ZodBoolean>;
210
124
  }, z.core.$strip>;
125
+ "net.unpatched": z.ZodObject<{
126
+ url: z.ZodString;
127
+ urlRaw: z.ZodOptional<z.ZodString>;
128
+ initiator: z.ZodString;
129
+ status: z.ZodOptional<z.ZodNumber>;
130
+ }, z.core.$loose>;
211
131
  "net.stream": z.ZodObject<{
212
132
  transport: z.ZodEnum<{
213
133
  readonly SSE: "sse";
@@ -239,6 +159,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
239
159
  }>;
240
160
  value: z.ZodNumber;
241
161
  at: z.ZodNumber;
162
+ shift: z.ZodOptional<z.ZodNumber>;
242
163
  shifted: z.ZodOptional<z.ZodObject<{
243
164
  ref: z.ZodString;
244
165
  selector: z.ZodString;
@@ -395,6 +316,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
395
316
  readonly UNOBSERVED_IPC: "unobserved-ipc";
396
317
  readonly VERDICTLESS_SEND: "verdictless-send";
397
318
  readonly UNWATCHED_STATE: "unwatched-state";
319
+ readonly CANVAS_PAINT_UNOBSERVED: "canvas-paint-unobserved";
398
320
  }>;
399
321
  count: z.ZodNumber;
400
322
  }, z.core.$strip>;
@@ -514,6 +436,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
514
436
  readonly POLL: "poll";
515
437
  readonly ACT: "act";
516
438
  }>>;
439
+ visible: z.ZodOptional<z.ZodBoolean>;
517
440
  }, z.core.$strip>;
518
441
  };
519
442
  /** Narrow an event's `data` against its type's payload schema. Unknown in, typed-or-error out. */
@@ -1,10 +1,11 @@
1
1
  import * as z from 'zod';
2
2
  import { CanvasTrigger, EventType, MediaEvent, PerfMetric } from './constants/constants.js';
3
+ import { FieldChangeField, FieldChangeKind, LivePoliteness, RouteChangeHow, ROUTE_CHANGE_HOW_FIELD, ScrollDirection, StorageArea, StreamDirection, StreamTransport, } from './constants/event-types.js';
3
4
  import { ResponseBodyReason } from './constants/response-body-reason.js';
4
5
  import { BlindSpotKind } from '../verdict/verified-constants.js';
5
6
  import { BrowserBrand } from '../telemetry-feedback.js';
6
7
  import { HudUseDataSchema, HumanControlDataSchema, HumanMarkDataSchema } from './messages.js';
7
- import { NEXT_ACTION_FIELD, REQUEST_SHAPE_FIELD } from './net.js';
8
+ import { DepartedNetField, NEXT_ACTION_FIELD, REQUEST_SHAPE_FIELD } from './net.js';
8
9
  /**
9
10
  * Per-event-type payload schemas — the typed replacement for the envelope's open `data` record.
10
11
  * The envelope (`ReticleEventSchema.data`) stays open on the wire so a richer SDK is never rejected
@@ -18,77 +19,6 @@ import { NEXT_ACTION_FIELD, REQUEST_SHAPE_FIELD } from './net.js';
18
19
  * fields (stack, TTFB, initiator, path diffs) pass through instead of failing closed. Each closes
19
20
  * fully as its observer is rewritten.
20
21
  */
21
- /**
22
- * Wire payload vocabularies. The browser observers EMIT these values and the schemas below VALIDATE
23
- * them, so a browser-side typo (`'SSE'`) would pass tsc and fail only here, at runtime. Each is a const
24
- * object — the browser imports the members, the schema derives its z.nativeEnum from the same object —
25
- * so emitter and validator are one source. Co-located with the schemas (kept constants.ts under its cap).
26
- */
27
- /**
28
- * `FETCH` is a response whose BODY is still arriving after the request itself resolved.
29
- *
30
- * `fetch` settles at HEADERS, so a streamed response is reported complete while the server is still
31
- * writing. Measured on a Next.js App Router page: the RSC payload's NET_REQUEST landed 16 ms in, the
32
- * shell rendered, and the Suspense boundary's content arrived 889 ms later — a window in which
33
- * nothing at all was observed, so `settled` passed while the fallback was still on screen.
34
- */
35
- export const StreamTransport = { SSE: 'sse', WS: 'ws', FETCH: 'fetch' };
36
- /** `CLOSE` pairs with `OPEN`: until it arrives, the body is still being written. */
37
- export const StreamDirection = { OPEN: 'open', IN: 'in', OUT: 'out', CLOSE: 'close' };
38
- export const ScrollDirection = { UP: 'up', DOWN: 'down' };
39
- /**
40
- * How a `route.change` happened.
41
- *
42
- * `push` is `history.pushState`, `replace` is `history.replaceState`, and `pop` is the session
43
- * history moving under the page (`popstate`, or a `hashchange` the page did not push). A
44
- * same-pathname replace records UI state in the URL; it is not a navigation to a new view.
45
- */
46
- export const RouteChangeHow = {
47
- PUSH: 'push',
48
- REPLACE: 'replace',
49
- POP: 'pop',
50
- };
51
- /** Wire field on `route.change` carrying a `RouteChangeHow`. */
52
- export const ROUTE_CHANGE_HOW_FIELD = 'how';
53
- /**
54
- * Why a `field.change` was emitted.
55
- *
56
- * `input` is a burst of keystrokes and `change` is the commit that ends one — both are the user's
57
- * own event, fired before a controlled component restores its DOM property. `settled` is a read of
58
- * that property on the frame after the handlers ran. Only a settled read that differs from the
59
- * pre-action value is evidence the screen moved.
60
- */
61
- export const FieldChangeKind = {
62
- INPUT: 'input',
63
- CHANGE: 'change',
64
- SETTLED: 'settled',
65
- };
66
- /**
67
- * Wire fields on `field.change` beyond `field` / `kind` / `value` / `length`.
68
- *
69
- * `checked` is the property a checkbox or radio actually renders; `value` on those is the HTML
70
- * value (`"on"`), which does not move when the box is toggled. `previous` and `previousChecked`
71
- * are the same reading from before the action, present on a settled event so a consumer can tell
72
- * a render from a restore.
73
- */
74
- export const FieldChangeField = {
75
- FIELD: 'field',
76
- KIND: 'kind',
77
- LENGTH: 'length',
78
- VALUE: 'value',
79
- REDACTED: 'redacted',
80
- CHECKED: 'checked',
81
- PREVIOUS: 'previous',
82
- PREVIOUS_CHECKED: 'previousChecked',
83
- };
84
- /**
85
- * The three readable client-side storage areas.
86
- *
87
- * `cookies` is plural because that is what the storage tool accepts, what the browser returns and
88
- * what the docs publish. This member read `cookie` for as long as it had no callers, which is
89
- * exactly how long a name can disagree with every use of it for free.
90
- */
91
- export const StorageArea = { LOCAL: 'local', SESSION: 'session', COOKIE: 'cookies' };
92
22
  /**
93
23
  * A single cookie to seed before initial navigation.
94
24
  */
@@ -166,6 +96,7 @@ const netRequestSchema = z
166
96
  urlRaw: z.string().optional(),
167
97
  [NEXT_ACTION_FIELD]: z.string().optional(),
168
98
  [REQUEST_SHAPE_FIELD]: z.string().optional(),
99
+ [DepartedNetField.FROM_DEPARTED_DOCUMENT]: z.boolean().optional(),
169
100
  })
170
101
  .passthrough();
171
102
  const consoleSchema = z.object({ message: z.string() }).passthrough();
@@ -189,6 +120,12 @@ export const EVENT_PAYLOAD_SCHEMAS = {
189
120
  testid: z.string().optional(),
190
121
  /** The text an element ARRIVED with, not a change: the baseline a later change is read against. */
191
122
  initial: z.boolean().optional(),
123
+ /**
124
+ * Set when the text changed inside a live region that already exists: how urgently the region
125
+ * announces it. An app that writes its error text into an existing alert region tells the user
126
+ * about a failure, and a mount event does not record that write.
127
+ */
128
+ live: z.nativeEnum(LivePoliteness).optional(),
192
129
  }),
193
130
  [EventType.NET_REQUEST]: netRequestSchema,
194
131
  [EventType.NET_PENDING]: z.object({
@@ -197,13 +134,25 @@ export const EVENT_PAYLOAD_SCHEMAS = {
197
134
  url: z.string(),
198
135
  initiator: z.string(),
199
136
  urlRaw: z.string().optional(),
137
+ [DepartedNetField.FROM_DEPARTED_DOCUMENT]: z.boolean().optional(),
138
+ [DepartedNetField.PAGE_UNLOADED]: z.boolean().optional(),
200
139
  }),
140
+ [EventType.NET_UNPATCHED]: z
141
+ .object({
142
+ url: z.string(),
143
+ urlRaw: z.string().optional(),
144
+ initiator: z.string(),
145
+ status: z.number().optional(),
146
+ })
147
+ .passthrough(),
201
148
  [EventType.NET_STREAM]: netStreamSchema,
202
149
  [EventType.DOWNLOAD]: downloadSchema,
203
150
  [EventType.PERF]: z.object({
204
151
  metric: z.nativeEnum(PerfMetric),
205
152
  value: z.number(),
206
153
  at: z.number(),
154
+ // CLS only: this entry's own shift; `value` is the running total since load (#1784).
155
+ shift: z.number().optional(),
207
156
  // CLS only: the element the shift moved most, so the value has somewhere to point (#1266).
208
157
  shifted: z.object({ ref: z.string(), selector: z.string() }).optional(),
209
158
  }),
@@ -377,6 +326,11 @@ export const EVENT_PAYLOAD_SCHEMAS = {
377
326
  * `poll` when the timer did. Absent from an SDK older than the field.
378
327
  */
379
328
  trigger: z.nativeEnum(CanvasTrigger).optional(),
329
+ /**
330
+ * Whether the canvas had a size and was inside the viewport when it was sampled. A hidden canvas
331
+ * cannot carry a render the user sees. Absent from an SDK older than the field.
332
+ */
333
+ visible: z.boolean().optional(),
380
334
  }),
381
335
  };
382
336
  /** Narrow an event's `data` against its type's payload schema. Unknown in, typed-or-error out. */
@@ -16,6 +16,7 @@ import { EventType } from './constants/constants.js';
16
16
  export const HIGH_VALUE_EVENT_TYPES = new Set([
17
17
  EventType.NET_REQUEST,
18
18
  EventType.NET_PENDING,
19
+ EventType.NET_UNPATCHED,
19
20
  EventType.NET_STREAM,
20
21
  EventType.NET_DETAIL,
21
22
  EventType.NET_RESPONSE_BODY,
@@ -6,10 +6,17 @@
6
6
  */
7
7
  export declare const DEFAULT_PRESS_KEY = "Enter";
8
8
  /**
9
- * Keys a real user sends at the page, not at a control. Escape dismisses, Tab moves focus.
9
+ * Keys a real user sends at the page, not at a control. Escape dismisses, Tab moves focus, and an
10
+ * arrow key moves the player in a canvas game, which often has no element to name.
10
11
  * A press of one of these with no ref is valid; a press of Enter or a letter is not.
11
12
  */
12
- export declare const GLOBAL_PRESS_KEYS: readonly ["Escape", "Tab"];
13
+ /**
14
+ * The press arg that sends ANY key to the document: `{ text: 'w', document: true }`. A canvas game
15
+ * reads WASD, Space and Enter from the page and has no element to name. Only the boolean `true`
16
+ * counts, and it is never the default, so a forgotten ref on Enter is still refused.
17
+ */
18
+ export declare const PRESS_DOCUMENT_ARG = "document";
19
+ export declare const GLOBAL_PRESS_KEYS: readonly ["Escape", "Tab", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
13
20
  /**
14
21
  * Which key a `press` is asking for.
15
22
  *
@@ -7,10 +7,24 @@ import { ActionType } from './constants/constants.js';
7
7
  */
8
8
  export const DEFAULT_PRESS_KEY = 'Enter';
9
9
  /**
10
- * Keys a real user sends at the page, not at a control. Escape dismisses, Tab moves focus.
10
+ * Keys a real user sends at the page, not at a control. Escape dismisses, Tab moves focus, and an
11
+ * arrow key moves the player in a canvas game, which often has no element to name.
11
12
  * A press of one of these with no ref is valid; a press of Enter or a letter is not.
12
13
  */
13
- export const GLOBAL_PRESS_KEYS = ['Escape', 'Tab'];
14
+ /**
15
+ * The press arg that sends ANY key to the document: `{ text: 'w', document: true }`. A canvas game
16
+ * reads WASD, Space and Enter from the page and has no element to name. Only the boolean `true`
17
+ * counts, and it is never the default, so a forgotten ref on Enter is still refused.
18
+ */
19
+ export const PRESS_DOCUMENT_ARG = 'document';
20
+ export const GLOBAL_PRESS_KEYS = [
21
+ 'Escape',
22
+ 'Tab',
23
+ 'ArrowUp',
24
+ 'ArrowDown',
25
+ 'ArrowLeft',
26
+ 'ArrowRight',
27
+ ];
14
28
  const GLOBAL_PRESS_KEY_SET = new Set(GLOBAL_PRESS_KEYS.map((k) => k.toLowerCase()));
15
29
  /**
16
30
  * Which key a `press` is asking for.
@@ -21,11 +35,13 @@ const GLOBAL_PRESS_KEY_SET = new Set(GLOBAL_PRESS_KEYS.map((k) => k.toLowerCase(
21
35
  */
22
36
  export function pressKeyFromArgs(args) {
23
37
  const text = args['text'];
24
- if ('string' === typeof text && 0 < text.length)
38
+ if ('string' === typeof text && 0 < text.length) {
25
39
  return text;
40
+ }
26
41
  const key = args['key'];
27
- if ('string' === typeof key && 0 < key.length)
42
+ if ('string' === typeof key && 0 < key.length) {
28
43
  return key;
44
+ }
29
45
  return DEFAULT_PRESS_KEY;
30
46
  }
31
47
  /**
@@ -38,12 +54,14 @@ export function pressKeyFromArgs(args) {
38
54
  */
39
55
  export function pressKeysFromArgs(args) {
40
56
  const raw = args['keys'];
41
- if (!Array.isArray(raw))
57
+ if (!Array.isArray(raw)) {
42
58
  return [];
59
+ }
43
60
  const keys = [];
44
61
  for (const item of raw) {
45
- if ('string' === typeof item && 0 < item.length)
62
+ if ('string' === typeof item && 0 < item.length) {
46
63
  keys.push(item);
64
+ }
47
65
  }
48
66
  return keys;
49
67
  }
@@ -77,15 +95,18 @@ const MODIFIER_ALIASES = {
77
95
  */
78
96
  export function pressModifiersFromArgs(args) {
79
97
  const raw = args['modifiers'];
80
- if (!Array.isArray(raw))
98
+ if (!Array.isArray(raw)) {
81
99
  return [];
100
+ }
82
101
  const named = new Set();
83
102
  for (const item of raw) {
84
- if ('string' !== typeof item)
103
+ if ('string' !== typeof item) {
85
104
  continue;
105
+ }
86
106
  const canonical = MODIFIER_ALIASES[item.toLowerCase()];
87
- if (canonical !== undefined)
107
+ if (canonical !== undefined) {
88
108
  named.add(canonical);
109
+ }
89
110
  }
90
111
  return PRESS_MODIFIERS.filter((modifier) => named.has(modifier));
91
112
  }
@@ -114,12 +135,17 @@ function hasModifiers(args) {
114
135
  * pass where `{ key: "Enter" }` is refused.
115
136
  */
116
137
  export function isGlobalPress(args) {
117
- if (hasModifiers(args))
138
+ if (true === args[PRESS_DOCUMENT_ARG]) {
118
139
  return true;
140
+ }
141
+ if (hasModifiers(args)) {
142
+ return true;
143
+ }
119
144
  const keys = pressKeysFromArgs(args);
120
145
  // SEVERAL keys held together is a sequence at the page, never aimed at one control.
121
- if (1 < keys.length)
146
+ if (1 < keys.length) {
122
147
  return true;
148
+ }
123
149
  // ONE key in `keys` is the same press as naming it in `key`/`text`, so it must answer the same
124
150
  // question. Reading the list by LENGTH alone let `{ keys: ["Enter"] }` omit a ref, which the
125
151
  // one-key spelling refuses on purpose: Enter lands on whatever holds focus, and on a focused field
@@ -134,8 +160,9 @@ export function isGlobalPress(args) {
134
160
  * The tool/step shape `{ action, args }` — a press of a document key, so no locator is required.
135
161
  */
136
162
  export function isGlobalPressCall(args) {
137
- if (ActionType.PRESS !== args['action'])
163
+ if (ActionType.PRESS !== args['action']) {
138
164
  return false;
165
+ }
139
166
  const inner = args['args'];
140
167
  const pressArgs = 'object' === typeof inner && null !== inner ? inner : {};
141
168
  return isGlobalPress(pressArgs);
@@ -96,6 +96,7 @@ export declare const ReticleEventSchema: z.ZodObject<{
96
96
  readonly DOM_TEXT: "dom.text";
97
97
  readonly NET_REQUEST: "net.request";
98
98
  readonly NET_PENDING: "net.pending";
99
+ readonly NET_UNPATCHED: "net.unpatched";
99
100
  readonly NET_STREAM: "net.stream";
100
101
  readonly PERF: "perf";
101
102
  readonly ROUTE_CHANGE: "route.change";
@@ -252,6 +253,7 @@ export declare const EventMessageSchema: z.ZodObject<{
252
253
  readonly DOM_TEXT: "dom.text";
253
254
  readonly NET_REQUEST: "net.request";
254
255
  readonly NET_PENDING: "net.pending";
256
+ readonly NET_UNPATCHED: "net.unpatched";
255
257
  readonly NET_STREAM: "net.stream";
256
258
  readonly PERF: "perf";
257
259
  readonly ROUTE_CHANGE: "route.change";
@@ -394,6 +396,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
394
396
  readonly DOM_TEXT: "dom.text";
395
397
  readonly NET_REQUEST: "net.request";
396
398
  readonly NET_PENDING: "net.pending";
399
+ readonly NET_UNPATCHED: "net.unpatched";
397
400
  readonly NET_STREAM: "net.stream";
398
401
  readonly PERF: "perf";
399
402
  readonly ROUTE_CHANGE: "route.change";
@@ -28,6 +28,16 @@ export declare const NetInitiator: {
28
28
  * false red over favicons and fonts.
29
29
  */
30
30
  readonly DOCUMENT: "document";
31
+ /**
32
+ * A file the SERVER sent as a download (`Content-Disposition: attachment`), seen by the driven
33
+ * browser's network stack.
34
+ *
35
+ * The click leaves the page as a navigation the browser turns into a download, so no patched
36
+ * transport in the page ever sees the response. Only a driven browser (CDP) does, and its detail
37
+ * had no in-page request to merge onto, so a `net` check on a working export missed. The engine
38
+ * records such a detail as a request with this initiator.
39
+ */
40
+ readonly DOWNLOAD: "download";
31
41
  /**
32
42
  * The browser is LEAVING for this URL, recorded at the moment of departure.
33
43
  *
@@ -211,3 +221,32 @@ export declare const NEXT_ACTION_HEADER = "Next-Action";
211
221
  * that named the same action are the same write even when the body could not be read as text.
212
222
  */
213
223
  export declare const NEXT_ACTION_FIELD = "nextAction";
224
+ /**
225
+ * Fields the daemon writes on a network record that the document BEFORE this one made (#1944).
226
+ *
227
+ * A click can send a request and then load a new document. The old document sends its records
228
+ * before it unloads, but the new document connects as a new session, and every read after that
229
+ * reads the new session. The daemon carries the old document's network records from the last act
230
+ * into the new session, so a `net` check and `reticle_observe { action: "network" }` still see them.
231
+ */
232
+ export declare const DepartedNetField: {
233
+ /**
234
+ * On every carried record. The record came from the document before this one. Its `t` is when
235
+ * the new document connected, not when the request happened, so it does not show the order of
236
+ * the request relative to the old document's other events.
237
+ */
238
+ readonly FROM_DEPARTED_DOCUMENT: "fromDepartedDocument";
239
+ /**
240
+ * On a carried `NET_PENDING` that had no answer when its document unloaded. The answer went to a
241
+ * document that no longer exists, so no `NET_REQUEST` can close it. Its outcome is unknown, not
242
+ * absent and not failed: the server can have received it or not.
243
+ */
244
+ readonly PAGE_UNLOADED: "pageUnloaded";
245
+ };
246
+ export type DepartedNetField = (typeof DepartedNetField)[keyof typeof DepartedNetField];
247
+ /**
248
+ * True when a `NET_PENDING` can never get its answer in this session: a departure (the browser left
249
+ * for this URL), or a request whose page unloaded before the answer arrived. Neither one is a
250
+ * request in flight. Every settle and in-flight decision reads this one function.
251
+ */
252
+ export declare function neverAnswered(data: Readonly<Record<string, unknown>>): boolean;
package/dist/wire/net.js CHANGED
@@ -28,6 +28,16 @@ export const NetInitiator = {
28
28
  * false red over favicons and fonts.
29
29
  */
30
30
  DOCUMENT: 'document',
31
+ /**
32
+ * A file the SERVER sent as a download (`Content-Disposition: attachment`), seen by the driven
33
+ * browser's network stack.
34
+ *
35
+ * The click leaves the page as a navigation the browser turns into a download, so no patched
36
+ * transport in the page ever sees the response. Only a driven browser (CDP) does, and its detail
37
+ * had no in-page request to merge onto, so a `net` check on a working export missed. The engine
38
+ * records such a detail as a request with this initiator.
39
+ */
40
+ DOWNLOAD: 'download',
31
41
  /**
32
42
  * The browser is LEAVING for this URL, recorded at the moment of departure.
33
43
  *
@@ -117,8 +127,9 @@ const DEV_TOOLING_PATTERNS = Object.values(DevToolingChannel);
117
127
  * exclusion is disclosed alongside the verdict.
118
128
  */
119
129
  export function isDevToolingUrl(url) {
120
- if (url === undefined)
130
+ if (url === undefined) {
121
131
  return false;
132
+ }
122
133
  return DEV_TOOLING_PATTERNS.some((pattern) => url.includes(pattern));
123
134
  }
124
135
  /**
@@ -133,8 +144,9 @@ const REGISTRABLE_LABELS = 2;
133
144
  function hostOf(url, base) {
134
145
  try {
135
146
  const parsed = new URL(url, base);
136
- if (!FIRST_PARTY_PROTOCOLS.includes(parsed.protocol))
147
+ if (!FIRST_PARTY_PROTOCOLS.includes(parsed.protocol)) {
137
148
  return undefined;
149
+ }
138
150
  return parsed.hostname.toLowerCase();
139
151
  }
140
152
  catch {
@@ -152,11 +164,13 @@ function hostOf(url, base) {
152
164
  */
153
165
  function registrableDomain(host) {
154
166
  const labels = host.split('.');
155
- if (labels.length <= REGISTRABLE_LABELS)
167
+ if (labels.length <= REGISTRABLE_LABELS) {
156
168
  return host;
169
+ }
157
170
  // An IPv4 literal has four labels and no registrable domain — compare it whole.
158
- if (/^[0-9.]+$/.test(host))
171
+ if (/^[0-9.]+$/.test(host)) {
159
172
  return host;
173
+ }
160
174
  return labels.slice(-REGISTRABLE_LABELS).join('.');
161
175
  }
162
176
  /**
@@ -178,12 +192,14 @@ function registrableDomain(host) {
178
192
  * caller who cannot say which page is under test gets exactly the behaviour it had before this.
179
193
  */
180
194
  export function isThirdPartyUrl(url, appUrl) {
181
- if (url === undefined || appUrl === undefined)
195
+ if (url === undefined || appUrl === undefined) {
182
196
  return false;
197
+ }
183
198
  const target = hostOf(url, appUrl);
184
199
  const app = hostOf(appUrl, appUrl);
185
- if (target === undefined || app === undefined)
200
+ if (target === undefined || app === undefined) {
186
201
  return false;
202
+ }
187
203
  return registrableDomain(target) !== registrableDomain(app);
188
204
  }
189
205
  /**
@@ -196,8 +212,9 @@ export function isThirdPartyUrl(url, appUrl) {
196
212
  * it only stops the request holding a settle window open or contradicting an unrelated claim.
197
213
  */
198
214
  export function isOwnBackgroundTraffic(url, declared) {
199
- if (url === undefined)
215
+ if (url === undefined) {
200
216
  return false;
217
+ }
201
218
  return declared.some((pattern) => url.includes(pattern));
202
219
  }
203
220
  /**
@@ -226,8 +243,9 @@ export const URL_RAW = 'urlRaw';
226
243
  */
227
244
  export function urlForMatch(data) {
228
245
  const raw = data[URL_RAW];
229
- if ('string' === typeof raw && 0 < raw.length)
246
+ if ('string' === typeof raw && 0 < raw.length) {
230
247
  return raw;
248
+ }
231
249
  const url = data['url'];
232
250
  return 'string' === typeof url ? url : '';
233
251
  }
@@ -272,3 +290,33 @@ export const NEXT_ACTION_HEADER = 'Next-Action';
272
290
  * that named the same action are the same write even when the body could not be read as text.
273
291
  */
274
292
  export const NEXT_ACTION_FIELD = 'nextAction';
293
+ /**
294
+ * Fields the daemon writes on a network record that the document BEFORE this one made (#1944).
295
+ *
296
+ * A click can send a request and then load a new document. The old document sends its records
297
+ * before it unloads, but the new document connects as a new session, and every read after that
298
+ * reads the new session. The daemon carries the old document's network records from the last act
299
+ * into the new session, so a `net` check and `reticle_observe { action: "network" }` still see them.
300
+ */
301
+ export const DepartedNetField = {
302
+ /**
303
+ * On every carried record. The record came from the document before this one. Its `t` is when
304
+ * the new document connected, not when the request happened, so it does not show the order of
305
+ * the request relative to the old document's other events.
306
+ */
307
+ FROM_DEPARTED_DOCUMENT: 'fromDepartedDocument',
308
+ /**
309
+ * On a carried `NET_PENDING` that had no answer when its document unloaded. The answer went to a
310
+ * document that no longer exists, so no `NET_REQUEST` can close it. Its outcome is unknown, not
311
+ * absent and not failed: the server can have received it or not.
312
+ */
313
+ PAGE_UNLOADED: 'pageUnloaded',
314
+ };
315
+ /**
316
+ * True when a `NET_PENDING` can never get its answer in this session: a departure (the browser left
317
+ * for this URL), or a request whose page unloaded before the answer arrived. Neither one is a
318
+ * request in flight. Every settle and in-flight decision reads this one function.
319
+ */
320
+ export function neverAnswered(data) {
321
+ return (data['initiator'] === NetInitiator.NAVIGATION || true === data[DepartedNetField.PAGE_UNLOADED]);
322
+ }
@@ -6,6 +6,24 @@
6
6
  * against. Every existing caller wants `isSensitiveKey`.
7
7
  */
8
8
  export declare function defaultIsSensitiveKey(key: string): boolean;
9
+ /**
10
+ * The word for a password, a PIN or a one-time code in other languages.
11
+ *
12
+ * The key rule above is English. A field's accessible name is in the language of the app, so a
13
+ * password field called "Пароль" was not recognised by its name. An SDK before 3.8.0 sends no
14
+ * secret mark, so the name is the only signal the server has for that fill.
15
+ *
16
+ * This list is for field names of recorded fills only. It is not part of the network key rule:
17
+ * `код` and `código` are also ordinary words in a request body ("código postal").
18
+ */
19
+ export declare const CREDENTIAL_FIELD_WORDS: readonly ["пароль", "гасло", "contraseña", "contrasena", "mot de passe", "passwort", "kennwort", "senha", "palavra-passe", "wachtwoord", "hasło", "haslo", "heslo", "jelszó", "şifre", "sifre", "parola", "lösenord", "losenord", "adgangskode", "passord", "salasana", "κωδικός", "סיסמה", "كلمة المرور", "कूटशब्द", "पासवर्ड", "পাসওয়ার্ড", "パスワード", "密码", "密碼", "비밀번호", "mật khẩu", "kata sandi", "katalaluan", "รหัสผ่าน", "pin", "otp", "код", "código"];
20
+ /**
21
+ * Whether a field's name says that the field holds a credential, in English or another language.
22
+ *
23
+ * Use it for the name of a field that a recorded fill typed into. The network key rule stays
24
+ * `defaultIsSensitiveKey`.
25
+ */
26
+ export declare function isCredentialFieldName(name: string): boolean;
9
27
  /**
10
28
  * An app's additions to (and subtractions from) the default rule.
11
29
  *