@reticlehq/core 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/artifacts/flow-composition.d.ts +3 -2
  2. package/dist/artifacts/flow-constants.d.ts +49 -2
  3. package/dist/artifacts/flow-constants.js +49 -2
  4. package/dist/artifacts/flow-expect-flat.d.ts +260 -0
  5. package/dist/artifacts/flow-expect-flat.js +284 -0
  6. package/dist/artifacts/flow-mutation-target.d.ts +0 -1
  7. package/dist/artifacts/flow-mutation-target.js +26 -2
  8. package/dist/artifacts/flow-step-tool.d.ts +2 -0
  9. package/dist/artifacts/flow-types.d.ts +1074 -1228
  10. package/dist/artifacts/flow-types.js +96 -140
  11. package/dist/artifacts/impact.d.ts +48 -20
  12. package/dist/artifacts/impact.js +11 -0
  13. package/dist/artifacts/journal.d.ts +33 -6
  14. package/dist/artifacts/journal.js +13 -0
  15. package/dist/hooks/hook-events.d.ts +18 -18
  16. package/dist/hud-entry.d.ts +9 -0
  17. package/dist/hud-entry.js +9 -0
  18. package/dist/identity/source-constants.d.ts +11 -0
  19. package/dist/identity/source-constants.js +11 -0
  20. package/dist/index.d.ts +8 -0
  21. package/dist/index.js +24 -1
  22. package/dist/onboarding.d.ts +2 -2
  23. package/dist/realm/registry.d.ts +0 -8
  24. package/dist/realm/registry.js +1 -11
  25. package/dist/schema/event-message.json +3 -1
  26. package/dist/schema/event-payloads.json +69 -0
  27. package/dist/schema/event-type.json +3 -1
  28. package/dist/schema/reticle-event.json +3 -1
  29. package/dist/schema/reticle-message.json +3 -1
  30. package/dist/source-constants.cjs +1 -0
  31. package/dist/source-constants.d.cts +1 -0
  32. package/dist/telemetry-feedback.d.ts +6 -6
  33. package/dist/telemetry-refusal.d.ts +2 -2
  34. package/dist/telemetry-session.d.ts +25 -2
  35. package/dist/telemetry-session.js +13 -0
  36. package/dist/telemetry.d.ts +121 -94
  37. package/dist/verdict/consequence.d.ts +10 -0
  38. package/dist/verdict/consequence.js +13 -0
  39. package/dist/verdict/intent.d.ts +36 -12
  40. package/dist/verdict/intent.js +66 -10
  41. package/dist/verdict/predicate-tree.d.ts +47 -0
  42. package/dist/verdict/predicate-tree.js +146 -0
  43. package/dist/verdict/predicate.d.ts +129 -0
  44. package/dist/verdict/predicate.js +394 -0
  45. package/dist/verdict/property-assertion.d.ts +191 -0
  46. package/dist/verdict/property-assertion.js +42 -0
  47. package/dist/verdict/security.js +16 -4
  48. package/dist/verdict/verdict-attribution.d.ts +52 -0
  49. package/dist/verdict/verdict-attribution.js +87 -0
  50. package/dist/verdict/verification-run.d.ts +98 -84
  51. package/dist/verdict/verification-run.js +8 -1
  52. package/dist/verdict/verified-constants.d.ts +9 -0
  53. package/dist/verdict/verified-constants.js +9 -0
  54. package/dist/wire/constants/constants.d.ts +20 -98
  55. package/dist/wire/constants/constants.js +22 -97
  56. package/dist/wire/constants/discovery.d.ts +25 -0
  57. package/dist/wire/constants/discovery.js +25 -0
  58. package/dist/wire/constants/event-types.d.ts +122 -0
  59. package/dist/wire/constants/event-types.js +121 -0
  60. package/dist/wire/constants/hud-controls.d.ts +19 -0
  61. package/dist/wire/constants/hud-controls.js +95 -0
  62. package/dist/wire/constants/hud-use.d.ts +27 -0
  63. package/dist/wire/constants/hud-use.js +24 -0
  64. package/dist/wire/constants/session-constants.d.ts +10 -0
  65. package/dist/wire/constants/session-constants.js +10 -0
  66. package/dist/wire/event-payloads.d.ts +66 -10
  67. package/dist/wire/event-payloads.js +18 -1
  68. package/dist/wire/messages.d.ts +89 -48
  69. package/dist/wire/messages.js +17 -0
  70. package/dist/wire/net.d.ts +18 -0
  71. package/dist/wire/net.js +24 -0
  72. package/dist/wire/state-select.d.ts +2 -1
  73. package/dist/wire/state-select.js +56 -3
  74. package/dist/wire/toon.js +28 -7
  75. package/dist/wire/types.d.ts +91 -66
  76. package/dist/wire/types.js +23 -1
  77. package/package.json +5 -1
@@ -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
@@ -57,9 +92,9 @@ export declare const HumanMarkDataSchema: z.ZodObject<{
57
92
  /** Route/URL the mark was made on, so the agent can reproduce the context. */
58
93
  route: z.ZodOptional<z.ZodString>;
59
94
  }, "strip", z.ZodTypeAny, {
60
- anchor: string;
61
95
  note: string;
62
- strategy: "role" | "testid" | "component" | "position";
96
+ anchor: string;
97
+ strategy: "testid" | "role" | "component" | "position";
63
98
  label?: string | undefined;
64
99
  route?: string | undefined;
65
100
  source?: {
@@ -67,9 +102,9 @@ export declare const HumanMarkDataSchema: z.ZodObject<{
67
102
  line: number;
68
103
  } | undefined;
69
104
  }, {
70
- anchor: string;
71
105
  note: string;
72
- strategy: "role" | "testid" | "component" | "position";
106
+ anchor: string;
107
+ strategy: "testid" | "role" | "component" | "position";
73
108
  label?: string | undefined;
74
109
  route?: string | undefined;
75
110
  source?: {
@@ -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" | "visual" | "net" | "state" | "route" | "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" | "visual" | "net" | "state" | "route" | "ui" | "log" | "storage" | "time")[] | undefined;
375
412
  commands?: string[] | undefined;
376
413
  contractParts?: {
377
414
  events: string[];
@@ -395,14 +432,14 @@ export declare const CommandMessageSchema: z.ZodObject<{
395
432
  args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
396
433
  }, "strip", z.ZodTypeAny, {
397
434
  id: string;
398
- kind: "command";
399
435
  name: string;
436
+ kind: "command";
400
437
  args: Record<string, unknown>;
401
438
  sessionId?: string | undefined;
402
439
  }, {
403
440
  id: string;
404
- kind: "command";
405
441
  name: string;
442
+ kind: "command";
406
443
  args?: Record<string, unknown> | undefined;
407
444
  sessionId?: string | undefined;
408
445
  }>;
@@ -415,14 +452,14 @@ 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
455
  ok: boolean;
456
+ id: string;
420
457
  kind: "command_result";
421
458
  error?: string | undefined;
422
459
  result?: unknown;
423
460
  }, {
424
- id: string;
425
461
  ok: boolean;
462
+ id: string;
426
463
  kind: "command_result";
427
464
  error?: string | undefined;
428
465
  result?: unknown;
@@ -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,54 +549,54 @@ 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, {
536
575
  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";
576
+ 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";
577
+ data: Record<string, unknown>;
538
578
  t: number;
539
579
  sessionId: string;
540
- data: Record<string, unknown>;
580
+ editEpoch?: number | undefined;
541
581
  ref?: string | undefined;
542
582
  seq?: number | undefined;
543
583
  actionId?: string | undefined;
544
584
  attribution?: "window" | undefined;
545
585
  documentId?: string | undefined;
546
- editEpoch?: number | undefined;
547
586
  };
548
587
  kind: "event";
549
588
  }, {
550
589
  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";
590
+ 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
591
  t: number;
553
592
  sessionId: string;
593
+ editEpoch?: number | undefined;
594
+ data?: Record<string, unknown> | undefined;
554
595
  ref?: string | undefined;
555
596
  seq?: number | undefined;
556
597
  actionId?: string | undefined;
557
598
  attribution?: "window" | undefined;
558
599
  documentId?: string | undefined;
559
- editEpoch?: number | undefined;
560
- data?: Record<string, unknown> | undefined;
561
600
  };
562
601
  kind: "event";
563
602
  }>;
@@ -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" | "visual" | "net" | "state" | "route" | "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" | "visual" | "net" | "state" | "route" | "ui" | "log" | "storage" | "time")[] | undefined;
751
790
  commands?: string[] | undefined;
752
791
  contractParts?: {
753
792
  events: string[];
@@ -768,14 +807,14 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
768
807
  args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
769
808
  }, "strip", z.ZodTypeAny, {
770
809
  id: string;
771
- kind: "command";
772
810
  name: string;
811
+ kind: "command";
773
812
  args: Record<string, unknown>;
774
813
  sessionId?: string | undefined;
775
814
  }, {
776
815
  id: string;
777
- kind: "command";
778
816
  name: string;
817
+ kind: "command";
779
818
  args?: Record<string, unknown> | undefined;
780
819
  sessionId?: string | undefined;
781
820
  }>, z.ZodObject<{
@@ -785,14 +824,14 @@ 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
827
  ok: boolean;
828
+ id: string;
790
829
  kind: "command_result";
791
830
  error?: string | undefined;
792
831
  result?: unknown;
793
832
  }, {
794
- id: string;
795
833
  ok: boolean;
834
+ id: string;
796
835
  kind: "command_result";
797
836
  error?: string | undefined;
798
837
  result?: unknown;
@@ -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, {
903
944
  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";
945
+ 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";
946
+ data: Record<string, unknown>;
905
947
  t: number;
906
948
  sessionId: string;
907
- data: Record<string, unknown>;
949
+ editEpoch?: number | undefined;
908
950
  ref?: string | undefined;
909
951
  seq?: number | undefined;
910
952
  actionId?: string | undefined;
911
953
  attribution?: "window" | undefined;
912
954
  documentId?: string | undefined;
913
- editEpoch?: number | undefined;
914
955
  };
915
956
  kind: "event";
916
957
  }, {
917
958
  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";
959
+ 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
960
  t: number;
920
961
  sessionId: string;
962
+ editEpoch?: number | undefined;
963
+ data?: Record<string, unknown> | undefined;
921
964
  ref?: string | undefined;
922
965
  seq?: number | undefined;
923
966
  actionId?: string | undefined;
924
967
  attribution?: "window" | undefined;
925
968
  documentId?: string | undefined;
926
- editEpoch?: number | undefined;
927
- data?: Record<string, unknown> | undefined;
928
969
  };
929
970
  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
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
@@ -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
  /**
@@ -20,6 +20,19 @@ const LENGTH_SEGMENT = 'length';
20
20
  function hasIntrinsicLength(value) {
21
21
  return Array.isArray(value) || 'string' === typeof value;
22
22
  }
23
+ /**
24
+ * `size` is the second closed name, for the two collections that count with it instead of `length`.
25
+ *
26
+ * The same argument that admitted `length` admits this one: `selectedIds.size` is what an app with a
27
+ * `Set` actually holds, and refusing it reported `found: false` with `availableKeys: []` -- not "I
28
+ * cannot read this", but "the collection is empty", which is a claim about the app and a wrong one
29
+ * (#944).
30
+ *
31
+ * A closed NAME, not a property read, for exactly the reason `length` is. `size` is an accessor on
32
+ * `Set.prototype`/`Map.prototype`, so reaching it by prototype traversal would put `add`, `delete`,
33
+ * `clear`, `constructor` and `__proto__` back on the path grammar in the same move.
34
+ */
35
+ const SIZE_SEGMENT = 'size';
23
36
  /** The keys at a level, as a bounded sample plus the true count when the sample is short. */
24
37
  function keysOf(value) {
25
38
  if (Array.isArray(value)) {
@@ -35,10 +48,27 @@ function keysOf(value) {
35
48
  let total = 0;
36
49
  for (const k of value.keys()) {
37
50
  total += 1;
38
- if ('string' === typeof k && keys.length < MAX_AVAILABLE_KEYS)
51
+ if ('string' === typeof k && keys.length < MAX_AVAILABLE_KEYS - 1)
39
52
  keys.push(k);
40
53
  }
41
- return { keys, total };
54
+ // `size` is listed for the reason `length` is listed on an array: it IS selectable here, and a
55
+ // diagnosis that omits it sends someone who wanted the count looking for a key that does not
56
+ // exist. Counted too, so `totalKeys` matches what a caller can actually reach. A Map that
57
+ // really holds a `size` key already lists it, and the explicit entry is what a read returns.
58
+ if (value.has(SIZE_SEGMENT))
59
+ return { keys, total };
60
+ return { keys: [...keys, SIZE_SEGMENT], total: total + 1 };
61
+ }
62
+ if (value instanceof Set) {
63
+ // Was falling through to `Object.keys`, which is `[]` for every Set -- so a miss reported
64
+ // `availableKeys: [], totalKeys: 0` and stated as a fact that the collection was empty. Its
65
+ // members are what is reachable here, plus `size`.
66
+ const keys = [];
67
+ for (const item of value) {
68
+ if ('string' === typeof item && keys.length < MAX_AVAILABLE_KEYS - 1)
69
+ keys.push(item);
70
+ }
71
+ return { keys: [...keys, SIZE_SEGMENT], total: value.size + 1 };
42
72
  }
43
73
  if ('object' === typeof value && value !== null) {
44
74
  const all = Object.keys(value);
@@ -58,7 +88,8 @@ function miss(value) {
58
88
  }
59
89
  /**
60
90
  * Walk `path` (e.g. "captionCache.v3.0.text") into `root`. Empty path returns root unchanged.
61
- * Segments are own keys, canonical array indices, Map keys, or `length` on an array/string.
91
+ * Segments are own keys, canonical array indices, Map keys, Set members, `length` on an
92
+ * array/string, or `size` on a Set/Map.
62
93
  */
63
94
  export function selectPath(root, path) {
64
95
  const segments = path.split('.').filter((s) => s.length > 0);
@@ -83,10 +114,32 @@ export function selectPath(root, path) {
83
114
  continue;
84
115
  }
85
116
  if (current instanceof Map) {
117
+ // An explicit entry wins over the intrinsic. A Map that really holds a key called `size` is
118
+ // answering about its own data, and reading its count instead would be a silent wrong answer
119
+ // on the one shape where both readings are plausible.
86
120
  if (current.has(segment)) {
87
121
  current = current.get(segment);
88
122
  continue;
89
123
  }
124
+ if (SIZE_SEGMENT === segment) {
125
+ current = current.size;
126
+ continue;
127
+ }
128
+ return miss(current);
129
+ }
130
+ if (current instanceof Set) {
131
+ if (SIZE_SEGMENT === segment) {
132
+ current = current.size;
133
+ continue;
134
+ }
135
+ // MEMBERSHIP, not indexing: a Set has no order to index by, so the only question a named
136
+ // segment can ask of one is whether it holds that item. A segment it does not hold is a MISS
137
+ // rather than `false`, which is how every other absent path behaves here -- and the miss then
138
+ // lists what the Set does hold, which a bare `false` could not.
139
+ if (current.has(segment)) {
140
+ current = true;
141
+ continue;
142
+ }
90
143
  return miss(current);
91
144
  }
92
145
  // `Object.hasOwn`, not `in`: `in` walks the prototype, so a path segment of `constructor`,