@reticlehq/core 3.2.0 → 3.4.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 (91) hide show
  1. package/README.md +1 -1
  2. package/dist/artifacts/flow-composition.d.ts +3 -2
  3. package/dist/artifacts/flow-constants.d.ts +68 -2
  4. package/dist/artifacts/flow-constants.js +84 -2
  5. package/dist/artifacts/flow-expect-flat.d.ts +260 -0
  6. package/dist/artifacts/flow-expect-flat.js +284 -0
  7. package/dist/artifacts/flow-mutation-target.d.ts +0 -1
  8. package/dist/artifacts/flow-mutation-target.js +30 -2
  9. package/dist/artifacts/flow-step-tool.d.ts +2 -0
  10. package/dist/artifacts/flow-types.d.ts +1285 -1343
  11. package/dist/artifacts/flow-types.js +111 -140
  12. package/dist/artifacts/impact.d.ts +48 -20
  13. package/dist/artifacts/impact.js +11 -0
  14. package/dist/artifacts/journal.d.ts +34 -6
  15. package/dist/artifacts/journal.js +13 -0
  16. package/dist/hooks/hook-events.d.ts +18 -18
  17. package/dist/hud-entry.d.ts +9 -0
  18. package/dist/hud-entry.js +9 -0
  19. package/dist/identity/source-constants.d.ts +11 -0
  20. package/dist/identity/source-constants.js +11 -0
  21. package/dist/index.d.ts +9 -0
  22. package/dist/index.js +25 -1
  23. package/dist/onboarding.d.ts +2 -2
  24. package/dist/realm/registry.d.ts +0 -8
  25. package/dist/realm/registry.js +1 -11
  26. package/dist/registry/daemon-registry.d.ts +14 -4
  27. package/dist/registry/daemon-registry.js +20 -4
  28. package/dist/schema/event-message.json +3 -1
  29. package/dist/schema/event-payloads.json +72 -0
  30. package/dist/schema/event-type.json +3 -1
  31. package/dist/schema/reticle-event.json +3 -1
  32. package/dist/schema/reticle-message.json +3 -1
  33. package/dist/source-constants.cjs +1 -0
  34. package/dist/source-constants.d.cts +1 -0
  35. package/dist/telemetry-feedback.d.ts +6 -6
  36. package/dist/telemetry-refusal.d.ts +5 -4
  37. package/dist/telemetry-session.d.ts +25 -2
  38. package/dist/telemetry-session.js +13 -0
  39. package/dist/telemetry.d.ts +130 -102
  40. package/dist/verdict/compare-source.d.ts +80 -0
  41. package/dist/verdict/compare-source.js +93 -0
  42. package/dist/verdict/consequence.d.ts +12 -0
  43. package/dist/verdict/consequence.js +15 -0
  44. package/dist/verdict/instrumentation-gap.js +1 -1
  45. package/dist/verdict/intent.d.ts +24 -0
  46. package/dist/verdict/intent.js +66 -10
  47. package/dist/verdict/predicate-tree.d.ts +82 -0
  48. package/dist/verdict/predicate-tree.js +186 -0
  49. package/dist/verdict/predicate.d.ts +138 -0
  50. package/dist/verdict/predicate.js +430 -0
  51. package/dist/verdict/property-assertion.d.ts +191 -0
  52. package/dist/verdict/property-assertion.js +42 -0
  53. package/dist/verdict/security.js +16 -4
  54. package/dist/verdict/verdict-attribution.d.ts +52 -0
  55. package/dist/verdict/verdict-attribution.js +87 -0
  56. package/dist/verdict/verification-run.d.ts +330 -83
  57. package/dist/verdict/verification-run.js +44 -1
  58. package/dist/verdict/verified-constants.d.ts +9 -0
  59. package/dist/verdict/verified-constants.js +9 -0
  60. package/dist/wire/channel.d.ts +10 -0
  61. package/dist/wire/channel.js +25 -0
  62. package/dist/wire/constants/constants.d.ts +65 -102
  63. package/dist/wire/constants/constants.js +79 -101
  64. package/dist/wire/constants/discovery.d.ts +25 -0
  65. package/dist/wire/constants/discovery.js +25 -0
  66. package/dist/wire/constants/event-types.d.ts +122 -0
  67. package/dist/wire/constants/event-types.js +121 -0
  68. package/dist/wire/constants/hud-controls.d.ts +19 -0
  69. package/dist/wire/constants/hud-controls.js +95 -0
  70. package/dist/wire/constants/hud-use.d.ts +27 -0
  71. package/dist/wire/constants/hud-use.js +24 -0
  72. package/dist/wire/constants/session-constants.d.ts +10 -0
  73. package/dist/wire/constants/session-constants.js +10 -0
  74. package/dist/wire/event-payloads.d.ts +72 -13
  75. package/dist/wire/event-payloads.js +26 -4
  76. package/dist/wire/messages.d.ts +97 -56
  77. package/dist/wire/messages.js +17 -0
  78. package/dist/wire/net.d.ts +35 -0
  79. package/dist/wire/net.js +41 -0
  80. package/dist/wire/redaction.js +17 -0
  81. package/dist/wire/state-select.d.ts +2 -1
  82. package/dist/wire/state-select.js +56 -3
  83. package/dist/wire/toon.d.ts +1 -1
  84. package/dist/wire/toon.js +30 -8
  85. package/dist/wire/types.d.ts +119 -94
  86. package/dist/wire/types.js +23 -1
  87. package/dist/words/no-session-reason.d.ts +7 -0
  88. package/dist/words/no-session-reason.js +7 -0
  89. package/dist/words/notices.d.ts +7 -0
  90. package/dist/words/notices.js +9 -2
  91. package/package.json +7 -2
@@ -15,13 +15,48 @@ export declare const HumanControlDataSchema: z.ZodObject<{
15
15
  }>;
16
16
  text: z.ZodOptional<z.ZodString>;
17
17
  }, "strip", z.ZodTypeAny, {
18
- kind: "message" | "pause" | "resume" | "end" | "replay" | "sync" | "harness";
18
+ kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync";
19
19
  text?: string | undefined;
20
20
  }, {
21
- kind: "message" | "pause" | "resume" | "end" | "replay" | "sync" | "harness";
21
+ kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync";
22
22
  text?: string | undefined;
23
23
  }>;
24
24
  export type HumanControlData = z.infer<typeof HumanControlDataSchema>;
25
+ /**
26
+ * The narrowed payload of a HUD_USED event: a control pressed, or where the HUD now sits.
27
+ *
28
+ * The shape of a control id only. Membership in HUD_CONTROLS is checked where it is counted, in the
29
+ * daemon, so the list stays out of the bytes every page downloads on load.
30
+ */
31
+ export declare const HudUseDataSchema: z.ZodObject<{
32
+ control: z.ZodOptional<z.ZodString>;
33
+ toggle: z.ZodOptional<z.ZodNativeEnum<{
34
+ readonly ON: "on";
35
+ readonly OFF: "off";
36
+ }>>;
37
+ view: z.ZodOptional<z.ZodNativeEnum<{
38
+ readonly BUBBLE: "bubble";
39
+ readonly COLLAPSED: "collapsed";
40
+ readonly EXPANDED: "expanded";
41
+ }>>;
42
+ panel: z.ZodOptional<z.ZodNativeEnum<{
43
+ readonly CHAT: "chat";
44
+ readonly SETTINGS: "settings";
45
+ readonly REPORT: "report";
46
+ readonly NONE: "none";
47
+ }>>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ control?: string | undefined;
50
+ toggle?: "on" | "off" | undefined;
51
+ view?: "expanded" | "bubble" | "collapsed" | undefined;
52
+ panel?: "none" | "chat" | "settings" | "report" | undefined;
53
+ }, {
54
+ control?: string | undefined;
55
+ toggle?: "on" | "off" | undefined;
56
+ view?: "expanded" | "bubble" | "collapsed" | undefined;
57
+ panel?: "none" | "chat" | "settings" | "report" | undefined;
58
+ }>;
59
+ export type HudUseData = z.infer<typeof HudUseDataSchema>;
25
60
  /**
26
61
  * Human review: the narrowed payload of a HUMAN_MARK event. A human flagged a mistake pinned to an
27
62
  * element on the running page; the server safeParses `event.data` against this at the inbound
@@ -59,9 +94,9 @@ export declare const HumanMarkDataSchema: z.ZodObject<{
59
94
  }, "strip", z.ZodTypeAny, {
60
95
  anchor: string;
61
96
  note: string;
62
- strategy: "role" | "testid" | "component" | "position";
63
- label?: string | undefined;
97
+ strategy: "testid" | "role" | "component" | "position";
64
98
  route?: string | undefined;
99
+ label?: string | undefined;
65
100
  source?: {
66
101
  file: string;
67
102
  line: number;
@@ -69,9 +104,9 @@ export declare const HumanMarkDataSchema: z.ZodObject<{
69
104
  }, {
70
105
  anchor: string;
71
106
  note: string;
72
- strategy: "role" | "testid" | "component" | "position";
73
- label?: string | undefined;
107
+ strategy: "testid" | "role" | "component" | "position";
74
108
  route?: string | undefined;
109
+ label?: string | undefined;
75
110
  source?: {
76
111
  file: string;
77
112
  line: number;
@@ -114,6 +149,7 @@ export declare const ReticleEventSchema: z.ZodObject<{
114
149
  readonly DIALOG_OPENED: "dialog.opened";
115
150
  readonly RENDER_COMMIT: "render.commit";
116
151
  readonly FOCUS_CHANGE: "focus.change";
152
+ readonly FIELD_CHANGE: "field.change";
117
153
  readonly FLOW_RECORDED: "flow.recorded";
118
154
  readonly TRANSPORT_OVERFLOW: "transport.overflow";
119
155
  readonly TRUNCATED: "truncated";
@@ -123,6 +159,7 @@ export declare const ReticleEventSchema: z.ZodObject<{
123
159
  readonly HUMAN_CONTROL: "human.control";
124
160
  readonly HUMAN_MARK: "human.mark";
125
161
  readonly DOWNLOAD: "download";
162
+ readonly HUD_USED: "hud.used";
126
163
  }>;
127
164
  sessionId: z.ZodString;
128
165
  /** Stable element reference this event concerns, when applicable (e.g. "e7"). */
@@ -162,27 +199,27 @@ export declare const ReticleEventSchema: z.ZodObject<{
162
199
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
163
200
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
164
201
  }, "strip", z.ZodTypeAny, {
165
- type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
202
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "field.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download" | "hud.used";
203
+ data: Record<string, unknown>;
166
204
  t: number;
167
205
  sessionId: string;
168
- data: Record<string, unknown>;
206
+ editEpoch?: number | undefined;
169
207
  ref?: string | undefined;
170
208
  seq?: number | undefined;
171
209
  actionId?: string | undefined;
172
210
  attribution?: "window" | undefined;
173
211
  documentId?: string | undefined;
174
- editEpoch?: number | undefined;
175
212
  }, {
176
- type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
213
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "field.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download" | "hud.used";
177
214
  t: number;
178
215
  sessionId: string;
216
+ editEpoch?: number | undefined;
217
+ data?: Record<string, unknown> | undefined;
179
218
  ref?: string | undefined;
180
219
  seq?: number | undefined;
181
220
  actionId?: string | undefined;
182
221
  attribution?: "window" | undefined;
183
222
  documentId?: string | undefined;
184
- editEpoch?: number | undefined;
185
- data?: Record<string, unknown> | undefined;
186
223
  }>;
187
224
  export type ReticleEvent = z.infer<typeof ReticleEventSchema>;
188
225
  /** Browser announces itself to the bridge on connect. */
@@ -348,7 +385,7 @@ export declare const HelloMessageSchema: z.ZodObject<{
348
385
  projectId?: string | undefined;
349
386
  token?: string | undefined;
350
387
  platform?: "native" | "web" | "webview" | "service" | undefined;
351
- channels?: ("visual" | "signal" | "net" | "state" | "route" | "ui" | "log" | "storage" | "time")[] | undefined;
388
+ channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
352
389
  commands?: string[] | undefined;
353
390
  contractParts?: {
354
391
  events: string[];
@@ -371,7 +408,7 @@ export declare const HelloMessageSchema: z.ZodObject<{
371
408
  projectId?: string | undefined;
372
409
  token?: string | undefined;
373
410
  platform?: "native" | "web" | "webview" | "service" | undefined;
374
- channels?: ("visual" | "signal" | "net" | "state" | "route" | "ui" | "log" | "storage" | "time")[] | undefined;
411
+ channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
375
412
  commands?: string[] | undefined;
376
413
  contractParts?: {
377
414
  events: string[];
@@ -394,15 +431,15 @@ export declare const CommandMessageSchema: z.ZodObject<{
394
431
  name: z.ZodString;
395
432
  args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
396
433
  }, "strip", z.ZodTypeAny, {
397
- id: string;
398
434
  kind: "command";
399
435
  name: string;
436
+ id: string;
400
437
  args: Record<string, unknown>;
401
438
  sessionId?: string | undefined;
402
439
  }, {
403
- id: string;
404
440
  kind: "command";
405
441
  name: string;
442
+ id: string;
406
443
  args?: Record<string, unknown> | undefined;
407
444
  sessionId?: string | undefined;
408
445
  }>;
@@ -415,15 +452,15 @@ export declare const CommandResultSchema: z.ZodObject<{
415
452
  result: z.ZodOptional<z.ZodUnknown>;
416
453
  error: z.ZodOptional<z.ZodString>;
417
454
  }, "strip", z.ZodTypeAny, {
418
- id: string;
419
- ok: boolean;
420
455
  kind: "command_result";
456
+ ok: boolean;
457
+ id: string;
421
458
  error?: string | undefined;
422
459
  result?: unknown;
423
460
  }, {
424
- id: string;
425
- ok: boolean;
426
461
  kind: "command_result";
462
+ ok: boolean;
463
+ id: string;
427
464
  error?: string | undefined;
428
465
  result?: unknown;
429
466
  }>;
@@ -462,6 +499,7 @@ export declare const EventMessageSchema: z.ZodObject<{
462
499
  readonly DIALOG_OPENED: "dialog.opened";
463
500
  readonly RENDER_COMMIT: "render.commit";
464
501
  readonly FOCUS_CHANGE: "focus.change";
502
+ readonly FIELD_CHANGE: "field.change";
465
503
  readonly FLOW_RECORDED: "flow.recorded";
466
504
  readonly TRANSPORT_OVERFLOW: "transport.overflow";
467
505
  readonly TRUNCATED: "truncated";
@@ -471,6 +509,7 @@ export declare const EventMessageSchema: z.ZodObject<{
471
509
  readonly HUMAN_CONTROL: "human.control";
472
510
  readonly HUMAN_MARK: "human.mark";
473
511
  readonly DOWNLOAD: "download";
512
+ readonly HUD_USED: "hud.used";
474
513
  }>;
475
514
  sessionId: z.ZodString;
476
515
  /** Stable element reference this event concerns, when applicable (e.g. "e7"). */
@@ -510,56 +549,56 @@ export declare const EventMessageSchema: z.ZodObject<{
510
549
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
511
550
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
512
551
  }, "strip", z.ZodTypeAny, {
513
- type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
552
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "field.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download" | "hud.used";
553
+ data: Record<string, unknown>;
514
554
  t: number;
515
555
  sessionId: string;
516
- data: Record<string, unknown>;
556
+ editEpoch?: number | undefined;
517
557
  ref?: string | undefined;
518
558
  seq?: number | undefined;
519
559
  actionId?: string | undefined;
520
560
  attribution?: "window" | undefined;
521
561
  documentId?: string | undefined;
522
- editEpoch?: number | undefined;
523
562
  }, {
524
- type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
563
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "field.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download" | "hud.used";
525
564
  t: number;
526
565
  sessionId: string;
566
+ editEpoch?: number | undefined;
567
+ data?: Record<string, unknown> | undefined;
527
568
  ref?: string | undefined;
528
569
  seq?: number | undefined;
529
570
  actionId?: string | undefined;
530
571
  attribution?: "window" | undefined;
531
572
  documentId?: string | undefined;
532
- editEpoch?: number | undefined;
533
- data?: Record<string, unknown> | undefined;
534
573
  }>;
535
574
  }, "strip", z.ZodTypeAny, {
575
+ kind: "event";
536
576
  event: {
537
- type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
577
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "field.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download" | "hud.used";
578
+ data: Record<string, unknown>;
538
579
  t: number;
539
580
  sessionId: string;
540
- data: Record<string, unknown>;
581
+ editEpoch?: number | undefined;
541
582
  ref?: string | undefined;
542
583
  seq?: number | undefined;
543
584
  actionId?: string | undefined;
544
585
  attribution?: "window" | undefined;
545
586
  documentId?: string | undefined;
546
- editEpoch?: number | undefined;
547
587
  };
548
- kind: "event";
549
588
  }, {
589
+ kind: "event";
550
590
  event: {
551
- type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
591
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "field.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download" | "hud.used";
552
592
  t: number;
553
593
  sessionId: string;
594
+ editEpoch?: number | undefined;
595
+ data?: Record<string, unknown> | undefined;
554
596
  ref?: string | undefined;
555
597
  seq?: number | undefined;
556
598
  actionId?: string | undefined;
557
599
  attribution?: "window" | undefined;
558
600
  documentId?: string | undefined;
559
- editEpoch?: number | undefined;
560
- data?: Record<string, unknown> | undefined;
561
601
  };
562
- kind: "event";
563
602
  }>;
564
603
  export type EventMessage = z.infer<typeof EventMessageSchema>;
565
604
  export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
@@ -724,7 +763,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
724
763
  projectId?: string | undefined;
725
764
  token?: string | undefined;
726
765
  platform?: "native" | "web" | "webview" | "service" | undefined;
727
- channels?: ("visual" | "signal" | "net" | "state" | "route" | "ui" | "log" | "storage" | "time")[] | undefined;
766
+ channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
728
767
  commands?: string[] | undefined;
729
768
  contractParts?: {
730
769
  events: string[];
@@ -747,7 +786,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
747
786
  projectId?: string | undefined;
748
787
  token?: string | undefined;
749
788
  platform?: "native" | "web" | "webview" | "service" | undefined;
750
- channels?: ("visual" | "signal" | "net" | "state" | "route" | "ui" | "log" | "storage" | "time")[] | undefined;
789
+ channels?: ("signal" | "net" | "state" | "route" | "visual" | "ui" | "log" | "storage" | "time")[] | undefined;
751
790
  commands?: string[] | undefined;
752
791
  contractParts?: {
753
792
  events: string[];
@@ -767,15 +806,15 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
767
806
  name: z.ZodString;
768
807
  args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
769
808
  }, "strip", z.ZodTypeAny, {
770
- id: string;
771
809
  kind: "command";
772
810
  name: string;
811
+ id: string;
773
812
  args: Record<string, unknown>;
774
813
  sessionId?: string | undefined;
775
814
  }, {
776
- id: string;
777
815
  kind: "command";
778
816
  name: string;
817
+ id: string;
779
818
  args?: Record<string, unknown> | undefined;
780
819
  sessionId?: string | undefined;
781
820
  }>, z.ZodObject<{
@@ -785,15 +824,15 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
785
824
  result: z.ZodOptional<z.ZodUnknown>;
786
825
  error: z.ZodOptional<z.ZodString>;
787
826
  }, "strip", z.ZodTypeAny, {
788
- id: string;
789
- ok: boolean;
790
827
  kind: "command_result";
828
+ ok: boolean;
829
+ id: string;
791
830
  error?: string | undefined;
792
831
  result?: unknown;
793
832
  }, {
794
- id: string;
795
- ok: boolean;
796
833
  kind: "command_result";
834
+ ok: boolean;
835
+ id: string;
797
836
  error?: string | undefined;
798
837
  result?: unknown;
799
838
  }>, z.ZodObject<{
@@ -829,6 +868,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
829
868
  readonly DIALOG_OPENED: "dialog.opened";
830
869
  readonly RENDER_COMMIT: "render.commit";
831
870
  readonly FOCUS_CHANGE: "focus.change";
871
+ readonly FIELD_CHANGE: "field.change";
832
872
  readonly FLOW_RECORDED: "flow.recorded";
833
873
  readonly TRANSPORT_OVERFLOW: "transport.overflow";
834
874
  readonly TRUNCATED: "truncated";
@@ -838,6 +878,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
838
878
  readonly HUMAN_CONTROL: "human.control";
839
879
  readonly HUMAN_MARK: "human.mark";
840
880
  readonly DOWNLOAD: "download";
881
+ readonly HUD_USED: "hud.used";
841
882
  }>;
842
883
  sessionId: z.ZodString;
843
884
  /** Stable element reference this event concerns, when applicable (e.g. "e7"). */
@@ -877,54 +918,54 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
877
918
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
878
919
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
879
920
  }, "strip", z.ZodTypeAny, {
880
- type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
921
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "field.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download" | "hud.used";
922
+ data: Record<string, unknown>;
881
923
  t: number;
882
924
  sessionId: string;
883
- data: Record<string, unknown>;
925
+ editEpoch?: number | undefined;
884
926
  ref?: string | undefined;
885
927
  seq?: number | undefined;
886
928
  actionId?: string | undefined;
887
929
  attribution?: "window" | undefined;
888
930
  documentId?: string | undefined;
889
- editEpoch?: number | undefined;
890
931
  }, {
891
- type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
932
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "field.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download" | "hud.used";
892
933
  t: number;
893
934
  sessionId: string;
935
+ editEpoch?: number | undefined;
936
+ data?: Record<string, unknown> | undefined;
894
937
  ref?: string | undefined;
895
938
  seq?: number | undefined;
896
939
  actionId?: string | undefined;
897
940
  attribution?: "window" | undefined;
898
941
  documentId?: string | undefined;
899
- editEpoch?: number | undefined;
900
- data?: Record<string, unknown> | undefined;
901
942
  }>;
902
943
  }, "strip", z.ZodTypeAny, {
944
+ kind: "event";
903
945
  event: {
904
- type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
946
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "field.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download" | "hud.used";
947
+ data: Record<string, unknown>;
905
948
  t: number;
906
949
  sessionId: string;
907
- data: Record<string, unknown>;
950
+ editEpoch?: number | undefined;
908
951
  ref?: string | undefined;
909
952
  seq?: number | undefined;
910
953
  actionId?: string | undefined;
911
954
  attribution?: "window" | undefined;
912
955
  documentId?: string | undefined;
913
- editEpoch?: number | undefined;
914
956
  };
915
- kind: "event";
916
957
  }, {
958
+ kind: "event";
917
959
  event: {
918
- type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
960
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "field.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download" | "hud.used";
919
961
  t: number;
920
962
  sessionId: string;
963
+ editEpoch?: number | undefined;
964
+ data?: Record<string, unknown> | undefined;
921
965
  ref?: string | undefined;
922
966
  seq?: number | undefined;
923
967
  actionId?: string | undefined;
924
968
  attribution?: "window" | undefined;
925
969
  documentId?: string | undefined;
926
- editEpoch?: number | undefined;
927
- data?: Record<string, unknown> | undefined;
928
970
  };
929
- kind: "event";
930
971
  }>]>;
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { HudPanel, HudToggle, HudView } from './constants/hud-use.js';
2
3
  import { EventAttribution, EventType, RETICLE_MIN_PROTOCOL_VERSION, RETICLE_PROTOCOL_VERSION, MessageKind, TRANSPORT_LIMITS, } from './constants/constants.js';
3
4
  import { HumanControlKind, MarkAnchorStrategy } from './constants/session-constants.js';
4
5
  import { MAX_WIRE_REDACT_KEYS, MAX_WIRE_REDACT_KEY_LENGTH } from './redaction.js';
@@ -17,6 +18,22 @@ export const HumanControlDataSchema = z.object({
17
18
  kind: z.nativeEnum(HumanControlKind),
18
19
  text: z.string().optional(),
19
20
  });
21
+ /**
22
+ * The narrowed payload of a HUD_USED event: a control pressed, or where the HUD now sits.
23
+ *
24
+ * The shape of a control id only. Membership in HUD_CONTROLS is checked where it is counted, in the
25
+ * daemon, so the list stays out of the bytes every page downloads on load.
26
+ */
27
+ export const HudUseDataSchema = z.object({
28
+ control: z
29
+ .string()
30
+ .max(48)
31
+ .regex(/^[a-z][a-zA-Z-]*(\.[a-zA-Z-]+)?$/)
32
+ .optional(),
33
+ toggle: z.nativeEnum(HudToggle).optional(),
34
+ view: z.nativeEnum(HudView).optional(),
35
+ panel: z.nativeEnum(HudPanel).optional(),
36
+ });
20
37
  /**
21
38
  * Human review: the narrowed payload of a HUMAN_MARK event. A human flagged a mistake pinned to an
22
39
  * element on the running page; the server safeParses `event.data` against this at the inbound
@@ -137,6 +137,24 @@ export declare function isDevToolingUrl(url: string | undefined): boolean;
137
137
  * caller who cannot say which page is under test gets exactly the behaviour it had before this.
138
138
  */
139
139
  export declare function isThirdPartyUrl(url: string | undefined, appUrl: string | undefined): boolean;
140
+ /**
141
+ * Is this the app's OWN background traffic — telemetry, a heartbeat — that the project declared?
142
+ *
143
+ * The same-origin half of the question `isThirdPartyUrl` answers by structure. `POST
144
+ * /api/analytics/events` on the app's own host looks exactly like the app's work, so nothing is
145
+ * inferred: a project names these in `.reticle.json` `background`, matched the way `urlContains`
146
+ * is. Nothing declared, nothing excluded. It never hides a request from a predicate that names it —
147
+ * it only stops the request holding a settle window open or contradicting an unrelated claim.
148
+ */
149
+ export declare function isOwnBackgroundTraffic(url: string | undefined, declared: readonly string[]): boolean;
150
+ /**
151
+ * Is this request somebody else's business — not the app's work under test?
152
+ *
153
+ * The ONE answer to "whose traffic counts", asked by the settle wait and by the contradiction rules
154
+ * alike. It used to be the same `||` written in two packages, and two copies of a rule are how one
155
+ * path starts judging traffic the other ignores.
156
+ */
157
+ export declare function isForeignTraffic(url: string | undefined, appUrl: string | undefined, background: readonly string[]): boolean;
140
158
  /**
141
159
  * The unredacted URL, kept so a grader can match `urlContains` against the path the app actually
142
160
  * requested. `url` is what is rendered to the agent and stored as the displayed value; this field
@@ -176,3 +194,20 @@ export declare const REQUEST_SHAPE_FIELD = "requestShape";
176
194
  * makes by not sending it: a body may have existed and nothing about it is on the record.
177
195
  */
178
196
  export declare const REQUEST_SHAPE_NONE = "none";
197
+ /**
198
+ * The request header a Next.js Server Action carries.
199
+ *
200
+ * An app's Server Actions all POST to the page's own URL, so method plus URL cannot tell the calls
201
+ * apart, and the usual `FormData` body has no shape fingerprint either. This header names the action
202
+ * that ran — an opaque id for the code, not a projection of the data — and it is present on every
203
+ * Server Action request. Recorded as `NEXT_ACTION_FIELD`; the engine folds it into the write
204
+ * discriminator in `identityOf`.
205
+ */
206
+ export declare const NEXT_ACTION_HEADER = "Next-Action";
207
+ /**
208
+ * Where the header above lands in a `NET_REQUEST`'s data.
209
+ *
210
+ * Alone it is a KNOWN identity: two POSTs that named different actions are different writes, and two
211
+ * that named the same action are the same write even when the body could not be read as text.
212
+ */
213
+ export declare const NEXT_ACTION_FIELD = "nextAction";
package/dist/wire/net.js CHANGED
@@ -186,6 +186,30 @@ export function isThirdPartyUrl(url, appUrl) {
186
186
  return false;
187
187
  return registrableDomain(target) !== registrableDomain(app);
188
188
  }
189
+ /**
190
+ * Is this the app's OWN background traffic — telemetry, a heartbeat — that the project declared?
191
+ *
192
+ * The same-origin half of the question `isThirdPartyUrl` answers by structure. `POST
193
+ * /api/analytics/events` on the app's own host looks exactly like the app's work, so nothing is
194
+ * inferred: a project names these in `.reticle.json` `background`, matched the way `urlContains`
195
+ * is. Nothing declared, nothing excluded. It never hides a request from a predicate that names it —
196
+ * it only stops the request holding a settle window open or contradicting an unrelated claim.
197
+ */
198
+ export function isOwnBackgroundTraffic(url, declared) {
199
+ if (url === undefined)
200
+ return false;
201
+ return declared.some((pattern) => url.includes(pattern));
202
+ }
203
+ /**
204
+ * Is this request somebody else's business — not the app's work under test?
205
+ *
206
+ * The ONE answer to "whose traffic counts", asked by the settle wait and by the contradiction rules
207
+ * alike. It used to be the same `||` written in two packages, and two copies of a rule are how one
208
+ * path starts judging traffic the other ignores.
209
+ */
210
+ export function isForeignTraffic(url, appUrl, background) {
211
+ return isThirdPartyUrl(url, appUrl) || isOwnBackgroundTraffic(url, background);
212
+ }
189
213
  /**
190
214
  * The unredacted URL, kept so a grader can match `urlContains` against the path the app actually
191
215
  * requested. `url` is what is rendered to the agent and stored as the displayed value; this field
@@ -231,3 +255,20 @@ export const REQUEST_SHAPE_FIELD = 'requestShape';
231
255
  * makes by not sending it: a body may have existed and nothing about it is on the record.
232
256
  */
233
257
  export const REQUEST_SHAPE_NONE = 'none';
258
+ /**
259
+ * The request header a Next.js Server Action carries.
260
+ *
261
+ * An app's Server Actions all POST to the page's own URL, so method plus URL cannot tell the calls
262
+ * apart, and the usual `FormData` body has no shape fingerprint either. This header names the action
263
+ * that ran — an opaque id for the code, not a projection of the data — and it is present on every
264
+ * Server Action request. Recorded as `NEXT_ACTION_FIELD`; the engine folds it into the write
265
+ * discriminator in `identityOf`.
266
+ */
267
+ export const NEXT_ACTION_HEADER = 'Next-Action';
268
+ /**
269
+ * Where the header above lands in a `NET_REQUEST`'s data.
270
+ *
271
+ * Alone it is a KNOWN identity: two POSTs that named different actions are different writes, and two
272
+ * that named the same action are the same write even when the body could not be read as text.
273
+ */
274
+ export const NEXT_ACTION_FIELD = 'nextAction';
@@ -117,6 +117,20 @@ export function isSensitiveKey(key) {
117
117
  const SENSITIVE_PATH_SEGMENT = /^(reset|verify|verification|confirm|activate|invite|magic|magiclink|token|key|oauth|unsubscribe|password)$/i;
118
118
  /** Only mask a following segment that looks token-like — short ids/words (`reset/form`) are left alone. */
119
119
  const PATH_TOKEN_MIN_LENGTH = 12;
120
+ function utf8Length(value) {
121
+ return new TextEncoder().encode(value).byteLength;
122
+ }
123
+ function summarizeEmbeddedUrl(raw) {
124
+ if (!/^data:/i.test(raw))
125
+ return undefined;
126
+ const comma = raw.indexOf(',');
127
+ const header = -1 === comma ? raw.slice(5) : raw.slice(5, comma);
128
+ const [candidateType = '', ...parameters] = header.split(';');
129
+ const mediaType = /^[\w.+-]+\/[\w.+-]+$/.test(candidateType) ? candidateType : 'text/plain';
130
+ const encoding = parameters.some((value) => 'base64' === value.toLowerCase()) ? ';base64' : '';
131
+ const payload = -1 === comma ? '' : raw.slice(comma + 1);
132
+ return `data:${mediaType}${encoding},<…${String(utf8Length(payload))} bytes…>`;
133
+ }
120
134
  /**
121
135
  * Redact credential-bearing values in a URL so they don't leak into the agent transcript / flow / run
122
136
  * artifacts: query params (`?access_token=…`, signed-URL keys), the authority's userinfo, path-embedded
@@ -133,6 +147,9 @@ const PATH_TOKEN_MIN_LENGTH = 12;
133
147
  * rule to consult.
134
148
  */
135
149
  export function redactUrl(raw, isSensitive = isSensitiveKey) {
150
+ const embeddedSummary = summarizeEmbeddedUrl(raw);
151
+ if (embeddedSummary !== undefined)
152
+ return embeddedSummary;
136
153
  const hashStart = raw.indexOf('#');
137
154
  const hash = -1 === hashStart ? '' : raw.slice(hashStart);
138
155
  const beforeHash = -1 === hashStart ? raw : raw.slice(0, hashStart);
@@ -25,7 +25,8 @@ export interface PathSelection {
25
25
  }
26
26
  /**
27
27
  * Walk `path` (e.g. "captionCache.v3.0.text") into `root`. Empty path returns root unchanged.
28
- * Segments are own keys, canonical array indices, Map keys, or `length` on an array/string.
28
+ * Segments are own keys, canonical array indices, Map keys, Set members, `length` on an
29
+ * array/string, or `size` on a Set/Map.
29
30
  */
30
31
  export declare function selectPath(root: unknown, path: string): PathSelection;
31
32
  /**