@reticlehq/core 3.6.0 → 3.8.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 (133) hide show
  1. package/dist/activation-entry.d.ts +9 -0
  2. package/dist/activation-entry.js +9 -0
  3. package/dist/artifacts/artifacts-entry.d.ts +2 -0
  4. package/dist/artifacts/artifacts-entry.js +2 -0
  5. package/dist/artifacts/drive-script.d.ts +222 -116
  6. package/dist/artifacts/drive-script.js +24 -1
  7. package/dist/artifacts/flow-constants.d.ts +33 -0
  8. package/dist/artifacts/flow-constants.js +35 -0
  9. package/dist/artifacts/flow-expect-flat.d.ts +8 -8
  10. package/dist/artifacts/flow-results.d.ts +461 -0
  11. package/dist/artifacts/flow-results.js +1 -0
  12. package/dist/artifacts/flow-types.d.ts +177 -543
  13. package/dist/artifacts/flow-types.js +17 -2
  14. package/dist/artifacts/harness-credits.d.ts +42 -0
  15. package/dist/artifacts/harness-credits.js +72 -0
  16. package/dist/artifacts/harness-map.d.ts +98 -0
  17. package/dist/artifacts/harness-map.js +36 -0
  18. package/dist/artifacts/impact.d.ts +355 -149
  19. package/dist/artifacts/impact.js +84 -49
  20. package/dist/artifacts/journal.d.ts +81 -11
  21. package/dist/artifacts/journal.js +39 -0
  22. package/dist/artifacts/prompt-context.d.ts +12 -0
  23. package/dist/artifacts/prompt-context.js +14 -3
  24. package/dist/artifacts/screenshot-upload.d.ts +51 -0
  25. package/dist/artifacts/screenshot-upload.js +26 -0
  26. package/dist/graph/app-graph.d.ts +137 -0
  27. package/dist/graph/app-graph.js +498 -0
  28. package/dist/hooks/hook-events.d.ts +26 -26
  29. package/dist/hud-entry.d.ts +1 -0
  30. package/dist/hud-entry.js +2 -0
  31. package/dist/identity/checkout.d.ts +41 -0
  32. package/dist/identity/checkout.js +118 -0
  33. package/dist/identity/state-dir.d.ts +23 -0
  34. package/dist/identity/state-dir.js +43 -0
  35. package/dist/index.d.ts +15 -0
  36. package/dist/index.js +15 -0
  37. package/dist/onboarding.d.ts +30 -1
  38. package/dist/onboarding.js +25 -0
  39. package/dist/realm/registry.js +19 -1
  40. package/dist/registry/dev-server-registry.d.ts +2 -2
  41. package/dist/schema/command-message.json +30 -0
  42. package/dist/schema/command-name.json +3 -1
  43. package/dist/schema/event-message.json +3 -1
  44. package/dist/schema/event-payloads.json +156 -3
  45. package/dist/schema/event-type.json +3 -1
  46. package/dist/schema/hello-message.json +21 -0
  47. package/dist/schema/reticle-event.json +3 -1
  48. package/dist/schema/reticle-message.json +54 -1
  49. package/dist/telemetry-bug.d.ts +169 -0
  50. package/dist/telemetry-bug.js +123 -0
  51. package/dist/telemetry-entry.d.ts +2 -1
  52. package/dist/telemetry-entry.js +2 -1
  53. package/dist/telemetry-feedback.d.ts +16 -2
  54. package/dist/telemetry-feedback.js +19 -0
  55. package/dist/telemetry-session.d.ts +91 -2
  56. package/dist/telemetry-session.js +65 -0
  57. package/dist/telemetry-signals.d.ts +557 -0
  58. package/dist/telemetry-signals.js +225 -0
  59. package/dist/telemetry.d.ts +649 -296
  60. package/dist/telemetry.js +110 -119
  61. package/dist/verdict/check-sentence.d.ts +34 -0
  62. package/dist/verdict/check-sentence.js +228 -0
  63. package/dist/verdict/consequence.d.ts +15 -0
  64. package/dist/verdict/consequence.js +11 -0
  65. package/dist/verdict/disparity.d.ts +105 -0
  66. package/dist/verdict/disparity.js +40 -0
  67. package/dist/verdict/findings.d.ts +16 -0
  68. package/dist/verdict/findings.js +22 -0
  69. package/dist/verdict/instrumentation-coverage.d.ts +84 -0
  70. package/dist/verdict/instrumentation-coverage.js +182 -0
  71. package/dist/verdict/instrumentation-gap.d.ts +79 -0
  72. package/dist/verdict/instrumentation-gap.js +65 -1
  73. package/dist/verdict/intent.d.ts +19 -5
  74. package/dist/verdict/intent.js +13 -1
  75. package/dist/verdict/predicate-tree.d.ts +17 -0
  76. package/dist/verdict/predicate-tree.js +37 -0
  77. package/dist/verdict/predicate.d.ts +16 -1
  78. package/dist/verdict/predicate.js +188 -13
  79. package/dist/verdict/property-assertion.d.ts +2 -2
  80. package/dist/verdict/run-report.d.ts +166 -0
  81. package/dist/verdict/run-report.js +53 -0
  82. package/dist/verdict/security.d.ts +60 -1
  83. package/dist/verdict/security.js +174 -12
  84. package/dist/verdict/verification-run.d.ts +713 -68
  85. package/dist/verdict/verification-run.js +113 -0
  86. package/dist/verdict/verify-progress.d.ts +6 -6
  87. package/dist/wire/constants/constants.d.ts +69 -155
  88. package/dist/wire/constants/constants.js +78 -159
  89. package/dist/wire/constants/discovery.d.ts +4 -4
  90. package/dist/wire/constants/discovery.js +4 -4
  91. package/dist/wire/constants/event-types.d.ts +35 -1
  92. package/dist/wire/constants/event-types.js +33 -1
  93. package/dist/wire/constants/hud-controls.js +15 -5
  94. package/dist/wire/constants/hud-use.d.ts +33 -4
  95. package/dist/wire/constants/hud-use.js +30 -4
  96. package/dist/wire/constants/mcp-wire.d.ts +26 -0
  97. package/dist/wire/constants/mcp-wire.js +26 -0
  98. package/dist/wire/constants/response-body-reason.d.ts +19 -0
  99. package/dist/wire/constants/response-body-reason.js +18 -0
  100. package/dist/wire/constants/reticle-chrome.d.ts +19 -0
  101. package/dist/wire/constants/reticle-chrome.js +19 -0
  102. package/dist/wire/constants/reticle-env.d.ts +138 -0
  103. package/dist/wire/constants/reticle-env.js +138 -0
  104. package/dist/wire/constants/session-constants.d.ts +26 -2
  105. package/dist/wire/constants/session-constants.js +26 -2
  106. package/dist/wire/desktop-contract.d.ts +8 -0
  107. package/dist/wire/desktop-contract.js +11 -0
  108. package/dist/wire/event-payloads.d.ts +202 -36
  109. package/dist/wire/event-payloads.js +100 -16
  110. package/dist/wire/messages.d.ts +193 -54
  111. package/dist/wire/messages.js +25 -1
  112. package/dist/wire/narrow.d.ts +6 -0
  113. package/dist/wire/narrow.js +26 -0
  114. package/dist/wire/next-step.d.ts +90 -0
  115. package/dist/wire/next-step.js +37 -0
  116. package/dist/wire/platform-link.d.ts +84 -0
  117. package/dist/wire/platform-link.js +57 -6
  118. package/dist/wire/production/activation-ticket.d.ts +64 -0
  119. package/dist/wire/production/activation-ticket.js +148 -0
  120. package/dist/wire/production/hello-mode.d.ts +35 -0
  121. package/dist/wire/production/hello-mode.js +32 -0
  122. package/dist/wire/production/production-policy.d.ts +138 -0
  123. package/dist/wire/production/production-policy.js +133 -0
  124. package/dist/wire/tool-names.d.ts +4 -0
  125. package/dist/wire/tool-names.js +4 -0
  126. package/dist/wire/types.d.ts +90 -52
  127. package/dist/wire/types.js +5 -0
  128. package/dist/words/notices.d.ts +1 -1
  129. package/dist/words/notices.js +1 -1
  130. package/dist/words/upgrade.js +1 -1
  131. package/dist/words/writing-rule.d.ts +14 -0
  132. package/dist/words/writing-rule.js +17 -0
  133. package/package.json +5 -1
@@ -46,6 +46,53 @@ export declare const ScrollDirection: {
46
46
  readonly DOWN: "down";
47
47
  };
48
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
+ };
49
96
  /**
50
97
  * The three readable client-side storage areas.
51
98
  *
@@ -73,8 +120,8 @@ export declare const SeedCookieSchema: z.ZodObject<{
73
120
  sameSite: z.ZodOptional<z.ZodEnum<["Strict", "Lax", "None"]>>;
74
121
  expires: z.ZodOptional<z.ZodNumber>;
75
122
  }, "strip", z.ZodTypeAny, {
76
- value: string;
77
123
  name: string;
124
+ value: string;
78
125
  path?: string | undefined;
79
126
  url?: string | undefined;
80
127
  domain?: string | undefined;
@@ -83,8 +130,8 @@ export declare const SeedCookieSchema: z.ZodObject<{
83
130
  sameSite?: "Strict" | "Lax" | "None" | undefined;
84
131
  expires?: number | undefined;
85
132
  }, {
86
- value: string;
87
133
  name: string;
134
+ value: string;
88
135
  path?: string | undefined;
89
136
  url?: string | undefined;
90
137
  domain?: string | undefined;
@@ -105,8 +152,8 @@ export declare const SeedCookiesSchema: z.ZodUnion<[z.ZodRecord<z.ZodString, z.Z
105
152
  sameSite: z.ZodOptional<z.ZodEnum<["Strict", "Lax", "None"]>>;
106
153
  expires: z.ZodOptional<z.ZodNumber>;
107
154
  }, "strip", z.ZodTypeAny, {
108
- value: string;
109
155
  name: string;
156
+ value: string;
110
157
  path?: string | undefined;
111
158
  url?: string | undefined;
112
159
  domain?: string | undefined;
@@ -115,8 +162,8 @@ export declare const SeedCookiesSchema: z.ZodUnion<[z.ZodRecord<z.ZodString, z.Z
115
162
  sameSite?: "Strict" | "Lax" | "None" | undefined;
116
163
  expires?: number | undefined;
117
164
  }, {
118
- value: string;
119
165
  name: string;
166
+ value: string;
120
167
  path?: string | undefined;
121
168
  url?: string | undefined;
122
169
  domain?: string | undefined;
@@ -144,8 +191,8 @@ export declare const SeedStorageSchema: z.ZodObject<{
144
191
  sameSite: z.ZodOptional<z.ZodEnum<["Strict", "Lax", "None"]>>;
145
192
  expires: z.ZodOptional<z.ZodNumber>;
146
193
  }, "strip", z.ZodTypeAny, {
147
- value: string;
148
194
  name: string;
195
+ value: string;
149
196
  path?: string | undefined;
150
197
  url?: string | undefined;
151
198
  domain?: string | undefined;
@@ -154,8 +201,8 @@ export declare const SeedStorageSchema: z.ZodObject<{
154
201
  sameSite?: "Strict" | "Lax" | "None" | undefined;
155
202
  expires?: number | undefined;
156
203
  }, {
157
- value: string;
158
204
  name: string;
205
+ value: string;
159
206
  path?: string | undefined;
160
207
  url?: string | undefined;
161
208
  domain?: string | undefined;
@@ -168,8 +215,8 @@ export declare const SeedStorageSchema: z.ZodObject<{
168
215
  local?: Record<string, string> | undefined;
169
216
  session?: Record<string, string> | undefined;
170
217
  cookies?: Record<string, string> | {
171
- value: string;
172
218
  name: string;
219
+ value: string;
173
220
  path?: string | undefined;
174
221
  url?: string | undefined;
175
222
  domain?: string | undefined;
@@ -182,8 +229,8 @@ export declare const SeedStorageSchema: z.ZodObject<{
182
229
  local?: Record<string, string> | undefined;
183
230
  session?: Record<string, string> | undefined;
184
231
  cookies?: Record<string, string> | {
185
- value: string;
186
232
  name: string;
233
+ value: string;
187
234
  path?: string | undefined;
188
235
  url?: string | undefined;
189
236
  domain?: string | undefined;
@@ -203,21 +250,21 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
203
250
  role: z.ZodOptional<z.ZodString>;
204
251
  name: z.ZodOptional<z.ZodString>;
205
252
  }, "strip", z.ZodTypeAny, {
206
- role?: string | undefined;
207
253
  name?: string | undefined;
208
- }, {
209
254
  role?: string | undefined;
255
+ }, {
210
256
  name?: string | undefined;
257
+ role?: string | undefined;
211
258
  }>;
212
259
  "dom.removed": z.ZodObject<{
213
260
  role: z.ZodOptional<z.ZodString>;
214
261
  name: z.ZodOptional<z.ZodString>;
215
262
  }, "strip", z.ZodTypeAny, {
216
- role?: string | undefined;
217
263
  name?: string | undefined;
218
- }, {
219
264
  role?: string | undefined;
265
+ }, {
220
266
  name?: string | undefined;
267
+ role?: string | undefined;
221
268
  }>;
222
269
  "dom.attr": z.ZodObject<{
223
270
  attr: z.ZodString;
@@ -235,11 +282,22 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
235
282
  "dom.text": z.ZodObject<{
236
283
  text: z.ZodString;
237
284
  old: z.ZodOptional<z.ZodString>;
285
+ /**
286
+ * The `data-testid` of the element or its nearest ancestor, so a text change can be named and a
287
+ * stale one (a store field changed, the text that shows it did not) can be found.
288
+ */
289
+ testid: z.ZodOptional<z.ZodString>;
290
+ /** The text an element ARRIVED with, not a change: the baseline a later change is read against. */
291
+ initial: z.ZodOptional<z.ZodBoolean>;
238
292
  }, "strip", z.ZodTypeAny, {
239
293
  text: string;
294
+ testid?: string | undefined;
295
+ initial?: boolean | undefined;
240
296
  old?: string | undefined;
241
297
  }, {
242
298
  text: string;
299
+ testid?: string | undefined;
300
+ initial?: boolean | undefined;
243
301
  old?: string | undefined;
244
302
  }>;
245
303
  "net.request": z.ZodObject<{
@@ -368,14 +426,32 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
368
426
  }>;
369
427
  value: z.ZodNumber;
370
428
  at: z.ZodNumber;
429
+ shifted: z.ZodOptional<z.ZodObject<{
430
+ ref: z.ZodString;
431
+ selector: z.ZodString;
432
+ }, "strip", z.ZodTypeAny, {
433
+ ref: string;
434
+ selector: string;
435
+ }, {
436
+ ref: string;
437
+ selector: string;
438
+ }>>;
371
439
  }, "strip", z.ZodTypeAny, {
372
- value: number;
373
440
  at: number;
441
+ value: number;
374
442
  metric: "lcp" | "cls" | "longtask";
443
+ shifted?: {
444
+ ref: string;
445
+ selector: string;
446
+ } | undefined;
375
447
  }, {
376
- value: number;
377
448
  at: number;
449
+ value: number;
378
450
  metric: "lcp" | "cls" | "longtask";
451
+ shifted?: {
452
+ ref: string;
453
+ selector: string;
454
+ } | undefined;
379
455
  }>;
380
456
  "route.change": z.ZodObject<{
381
457
  from: z.ZodString;
@@ -383,18 +459,29 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
383
459
  pathname: z.ZodString;
384
460
  search: z.ZodString;
385
461
  hash: z.ZodString;
462
+ how: z.ZodNativeEnum<{
463
+ readonly PUSH: "push";
464
+ readonly REPLACE: "replace";
465
+ readonly POP: "pop";
466
+ }>;
467
+ /** The app's own route pattern for the screen reached (`/personas/:personaId`), when known. */
468
+ pattern: z.ZodOptional<z.ZodString>;
386
469
  }, "strip", z.ZodTypeAny, {
470
+ search: string;
387
471
  from: string;
388
472
  to: string;
389
473
  pathname: string;
390
- search: string;
474
+ how: "replace" | "pop" | "push";
391
475
  hash: string;
476
+ pattern?: string | undefined;
392
477
  }, {
478
+ search: string;
393
479
  from: string;
394
480
  to: string;
395
481
  pathname: string;
396
- search: string;
482
+ how: "replace" | "pop" | "push";
397
483
  hash: string;
484
+ pattern?: string | undefined;
398
485
  }>;
399
486
  "console.log": z.ZodObject<{
400
487
  message: z.ZodString;
@@ -451,11 +538,11 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
451
538
  role: z.ZodOptional<z.ZodString>;
452
539
  name: z.ZodOptional<z.ZodString>;
453
540
  }, "strip", z.ZodTypeAny, {
454
- role?: string | undefined;
455
541
  name?: string | undefined;
456
- }, {
457
542
  role?: string | undefined;
543
+ }, {
458
544
  name?: string | undefined;
545
+ role?: string | undefined;
459
546
  }>;
460
547
  "anim.start": z.ZodObject<{
461
548
  name: z.ZodString;
@@ -717,32 +804,36 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
717
804
  to?: string | undefined;
718
805
  }>;
719
806
  "field.change": z.ZodObject<{
720
- /** What an assertion would call this field: its testid, else its name, else its accessible name. */
721
807
  field: z.ZodString;
722
- /** `input` is a settled burst of keystrokes; `change` is the commit that ends one. */
723
- kind: z.ZodEnum<["input", "change"]>;
724
- /**
725
- * The length of the REAL value, never of the clipped one, and present even when redacted.
726
- *
727
- * "It was wiped" is the assertion this event exists for, and a length says it while carrying
728
- * nobody's password. A cap that shortened this would read exactly like the wipe.
729
- */
808
+ kind: z.ZodNativeEnum<{
809
+ readonly INPUT: "input";
810
+ readonly CHANGE: "change";
811
+ readonly SETTLED: "settled";
812
+ }>;
730
813
  length: z.ZodNumber;
731
- /** Omitted for a password, a sensitive field name, or a payment autocomplete hint. */
732
814
  value: z.ZodOptional<z.ZodString>;
733
815
  redacted: z.ZodOptional<z.ZodLiteral<true>>;
816
+ checked: z.ZodOptional<z.ZodBoolean>;
817
+ previous: z.ZodOptional<z.ZodString>;
818
+ previousChecked: z.ZodOptional<z.ZodBoolean>;
734
819
  }, "strip", z.ZodTypeAny, {
735
- kind: "input" | "change";
736
820
  length: number;
821
+ kind: "settled" | "input" | "change";
737
822
  field: string;
823
+ checked?: boolean | undefined;
738
824
  value?: string | undefined;
739
825
  redacted?: true | undefined;
826
+ previous?: string | undefined;
827
+ previousChecked?: boolean | undefined;
740
828
  }, {
741
- kind: "input" | "change";
742
829
  length: number;
830
+ kind: "settled" | "input" | "change";
743
831
  field: string;
832
+ checked?: boolean | undefined;
744
833
  value?: string | undefined;
745
834
  redacted?: true | undefined;
835
+ previous?: string | undefined;
836
+ previousChecked?: boolean | undefined;
746
837
  }>;
747
838
  "flow.recorded": z.ZodObject<{
748
839
  name: z.ZodString;
@@ -765,11 +856,11 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
765
856
  channel: z.ZodString;
766
857
  dropped: z.ZodNumber;
767
858
  }, "strip", z.ZodTypeAny, {
768
- dropped: number;
769
859
  channel: string;
770
- }, {
771
860
  dropped: number;
861
+ }, {
772
862
  channel: string;
863
+ dropped: number;
773
864
  }>;
774
865
  "blind-spot": z.ZodObject<{
775
866
  kind: z.ZodNativeEnum<{
@@ -835,13 +926,16 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
835
926
  readonly SYNC: "sync";
836
927
  readonly SIGNIN: "signin";
837
928
  readonly HARNESS: "harness";
929
+ readonly HARNESS_RUN: "harness-run";
930
+ readonly HARNESS_STOP: "harness-stop";
931
+ readonly HARNESS_LINK: "harness-link";
838
932
  }>;
839
933
  text: z.ZodOptional<z.ZodString>;
840
934
  }, "strip", z.ZodTypeAny, {
841
- kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync" | "signin";
935
+ kind: "pause" | "message" | "harness" | "resume" | "end" | "replay" | "sync" | "signin" | "harness-run" | "harness-stop" | "harness-link";
842
936
  text?: string | undefined;
843
937
  }, {
844
- kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync" | "signin";
938
+ kind: "pause" | "message" | "harness" | "resume" | "end" | "replay" | "sync" | "signin" | "harness-run" | "harness-stop" | "harness-link";
845
939
  text?: string | undefined;
846
940
  }>;
847
941
  "human.mark": z.ZodObject<{
@@ -901,23 +995,95 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
901
995
  readonly CHAT: "chat";
902
996
  readonly FLOWS: "flows";
903
997
  readonly NOTES: "notes";
998
+ readonly HARNESS: "harness";
904
999
  readonly SETTINGS: "settings";
905
1000
  readonly REPORT: "report";
1001
+ readonly ACCOUNT: "account";
906
1002
  readonly NONE: "none";
907
1003
  }>>;
908
1004
  slide: z.ZodOptional<z.ZodString>;
1005
+ prompt: z.ZodOptional<z.ZodNativeEnum<{
1006
+ readonly RAIL: "rail";
1007
+ readonly HARNESS: "harness";
1008
+ readonly HEADER: "header";
1009
+ }>>;
909
1010
  }, "strip", z.ZodTypeAny, {
910
1011
  control?: string | undefined;
911
1012
  toggle?: "on" | "off" | undefined;
912
1013
  view?: "expanded" | "bubble" | "collapsed" | undefined;
913
- panel?: "flows" | "none" | "chat" | "notes" | "settings" | "report" | undefined;
1014
+ panel?: "flows" | "harness" | "none" | "chat" | "notes" | "settings" | "report" | "account" | undefined;
914
1015
  slide?: string | undefined;
1016
+ prompt?: "harness" | "rail" | "header" | undefined;
915
1017
  }, {
916
1018
  control?: string | undefined;
917
1019
  toggle?: "on" | "off" | undefined;
918
1020
  view?: "expanded" | "bubble" | "collapsed" | undefined;
919
- panel?: "flows" | "none" | "chat" | "notes" | "settings" | "report" | undefined;
1021
+ panel?: "flows" | "harness" | "none" | "chat" | "notes" | "settings" | "report" | "account" | undefined;
920
1022
  slide?: string | undefined;
1023
+ prompt?: "harness" | "rail" | "header" | undefined;
1024
+ }>;
1025
+ "media.state": z.ZodObject<{
1026
+ event: z.ZodNativeEnum<{
1027
+ readonly PLAY: "play";
1028
+ readonly PLAYING: "playing";
1029
+ readonly PAUSE: "pause";
1030
+ readonly SEEKED: "seeked";
1031
+ readonly ENDED: "ended";
1032
+ readonly LOADED_DATA: "loadeddata";
1033
+ readonly CAN_PLAY: "canplay";
1034
+ readonly WAITING: "waiting";
1035
+ readonly ERROR: "error";
1036
+ }>;
1037
+ tag: z.ZodEnum<["video", "audio"]>;
1038
+ /** Seconds into the media, as the element reports it. */
1039
+ currentTime: z.ZodNumber;
1040
+ /** Absent while unknown (NaN) or endless (a live stream). */
1041
+ duration: z.ZodOptional<z.ZodNumber>;
1042
+ /** HTMLMediaElement.readyState, 0–4. */
1043
+ readyState: z.ZodNumber;
1044
+ paused: z.ZodBoolean;
1045
+ }, "strip", z.ZodTypeAny, {
1046
+ event: "error" | "play" | "playing" | "pause" | "seeked" | "ended" | "loadeddata" | "canplay" | "waiting";
1047
+ paused: boolean;
1048
+ tag: "video" | "audio";
1049
+ currentTime: number;
1050
+ readyState: number;
1051
+ duration?: number | undefined;
1052
+ }, {
1053
+ event: "error" | "play" | "playing" | "pause" | "seeked" | "ended" | "loadeddata" | "canplay" | "waiting";
1054
+ paused: boolean;
1055
+ tag: "video" | "audio";
1056
+ currentTime: number;
1057
+ readyState: number;
1058
+ duration?: number | undefined;
1059
+ }>;
1060
+ "canvas.digest": z.ZodObject<{
1061
+ /** A hash of a 16x16 sample of the canvas pixels: changes when what it shows changes. */
1062
+ digest: z.ZodString;
1063
+ width: z.ZodNumber;
1064
+ height: z.ZodNumber;
1065
+ /** The sample's mean colour, `[r, g, b]` 0–255: a coarse "what colour is it" a reader can check. */
1066
+ mean: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
1067
+ /**
1068
+ * `act` when an act's end took it, inside the act's window and sent even if nothing changed;
1069
+ * `poll` when the timer did. Absent from an SDK older than the field.
1070
+ */
1071
+ trigger: z.ZodOptional<z.ZodNativeEnum<{
1072
+ readonly POLL: "poll";
1073
+ readonly ACT: "act";
1074
+ }>>;
1075
+ }, "strip", z.ZodTypeAny, {
1076
+ width: number;
1077
+ height: number;
1078
+ digest: string;
1079
+ mean: [number, number, number];
1080
+ trigger?: "act" | "poll" | undefined;
1081
+ }, {
1082
+ width: number;
1083
+ height: number;
1084
+ digest: string;
1085
+ mean: [number, number, number];
1086
+ trigger?: "act" | "poll" | undefined;
921
1087
  }>;
922
1088
  };
923
1089
  /** Narrow an event's `data` against its type's payload schema. Unknown in, typed-or-error out. */
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { EventType, PerfMetric } from './constants/constants.js';
2
+ import { CanvasTrigger, EventType, MediaEvent, PerfMetric } from './constants/constants.js';
3
3
  import { BlindSpotKind } from '../verdict/verified-constants.js';
4
4
  import { BrowserBrand } from '../telemetry-feedback.js';
5
5
  import { HudUseDataSchema, HumanControlDataSchema, HumanMarkDataSchema } from './messages.js';
@@ -35,6 +35,51 @@ export const StreamTransport = { SSE: 'sse', WS: 'ws', FETCH: 'fetch' };
35
35
  /** `CLOSE` pairs with `OPEN`: until it arrives, the body is still being written. */
36
36
  export const StreamDirection = { OPEN: 'open', IN: 'in', OUT: 'out', CLOSE: 'close' };
37
37
  export const ScrollDirection = { UP: 'up', DOWN: 'down' };
38
+ /**
39
+ * How a `route.change` happened.
40
+ *
41
+ * `push` is `history.pushState`, `replace` is `history.replaceState`, and `pop` is the session
42
+ * history moving under the page (`popstate`, or a `hashchange` the page did not push). A
43
+ * same-pathname replace records UI state in the URL; it is not a navigation to a new view.
44
+ */
45
+ export const RouteChangeHow = {
46
+ PUSH: 'push',
47
+ REPLACE: 'replace',
48
+ POP: 'pop',
49
+ };
50
+ /** Wire field on `route.change` carrying a `RouteChangeHow`. */
51
+ export const ROUTE_CHANGE_HOW_FIELD = 'how';
52
+ /**
53
+ * Why a `field.change` was emitted.
54
+ *
55
+ * `input` is a burst of keystrokes and `change` is the commit that ends one — both are the user's
56
+ * own event, fired before a controlled component restores its DOM property. `settled` is a read of
57
+ * that property on the frame after the handlers ran. Only a settled read that differs from the
58
+ * pre-action value is evidence the screen moved.
59
+ */
60
+ export const FieldChangeKind = {
61
+ INPUT: 'input',
62
+ CHANGE: 'change',
63
+ SETTLED: 'settled',
64
+ };
65
+ /**
66
+ * Wire fields on `field.change` beyond `field` / `kind` / `value` / `length`.
67
+ *
68
+ * `checked` is the property a checkbox or radio actually renders; `value` on those is the HTML
69
+ * value (`"on"`), which does not move when the box is toggled. `previous` and `previousChecked`
70
+ * are the same reading from before the action, present on a settled event so a consumer can tell
71
+ * a render from a restore.
72
+ */
73
+ export const FieldChangeField = {
74
+ FIELD: 'field',
75
+ KIND: 'kind',
76
+ LENGTH: 'length',
77
+ VALUE: 'value',
78
+ REDACTED: 'redacted',
79
+ CHECKED: 'checked',
80
+ PREVIOUS: 'previous',
81
+ PREVIOUS_CHECKED: 'previousChecked',
82
+ };
38
83
  /**
39
84
  * The three readable client-side storage areas.
40
85
  *
@@ -130,7 +175,17 @@ export const EVENT_PAYLOAD_SCHEMAS = {
130
175
  [EventType.DOM_ATTR]: z
131
176
  .object({ attr: z.string(), value: z.string().optional(), old: z.string().optional() })
132
177
  .passthrough(),
133
- [EventType.DOM_TEXT]: z.object({ text: z.string(), old: z.string().optional() }),
178
+ [EventType.DOM_TEXT]: z.object({
179
+ text: z.string(),
180
+ old: z.string().optional(),
181
+ /**
182
+ * The `data-testid` of the element or its nearest ancestor, so a text change can be named and a
183
+ * stale one (a store field changed, the text that shows it did not) can be found.
184
+ */
185
+ testid: z.string().optional(),
186
+ /** The text an element ARRIVED with, not a change: the baseline a later change is read against. */
187
+ initial: z.boolean().optional(),
188
+ }),
134
189
  [EventType.NET_REQUEST]: netRequestSchema,
135
190
  [EventType.NET_PENDING]: z.object({
136
191
  id: z.string(),
@@ -145,6 +200,8 @@ export const EVENT_PAYLOAD_SCHEMAS = {
145
200
  metric: z.nativeEnum(PerfMetric),
146
201
  value: z.number(),
147
202
  at: z.number(),
203
+ // CLS only: the element the shift moved most, so the value has somewhere to point (#1266).
204
+ shifted: z.object({ ref: z.string(), selector: z.string() }).optional(),
148
205
  }),
149
206
  [EventType.ROUTE_CHANGE]: z.object({
150
207
  from: z.string(),
@@ -152,6 +209,9 @@ export const EVENT_PAYLOAD_SCHEMAS = {
152
209
  pathname: z.string(),
153
210
  search: z.string(),
154
211
  hash: z.string(),
212
+ [ROUTE_CHANGE_HOW_FIELD]: z.nativeEnum(RouteChangeHow),
213
+ /** The app's own route pattern for the screen reached (`/personas/:personaId`), when known. */
214
+ pattern: z.string().optional(),
155
215
  }),
156
216
  [EventType.CONSOLE_LOG]: consoleSchema,
157
217
  [EventType.CONSOLE_WARN]: consoleSchema,
@@ -238,21 +298,21 @@ export const EVENT_PAYLOAD_SCHEMAS = {
238
298
  from: z.string().optional(),
239
299
  toBody: z.boolean(),
240
300
  }),
301
+ // Keys are FieldChangeField so the wire names exist once. `kind` is FieldChangeKind:
302
+ // input/change are the user's event; settled is the post-handler read. `length` is the REAL
303
+ // value's length, never the clipped one, and present even when redacted — a cap must never read
304
+ // as a wipe. `value` is omitted for a password, a sensitive name, or a payment autocomplete hint.
305
+ // `checked` is the checkbox/radio property (`value` there does not move). `previous` /
306
+ // `previousChecked` ride on a settled read so a restore is distinguishable from a render.
241
307
  [EventType.FIELD_CHANGE]: z.object({
242
- /** What an assertion would call this field: its testid, else its name, else its accessible name. */
243
- field: z.string(),
244
- /** `input` is a settled burst of keystrokes; `change` is the commit that ends one. */
245
- kind: z.enum(['input', 'change']),
246
- /**
247
- * The length of the REAL value, never of the clipped one, and present even when redacted.
248
- *
249
- * "It was wiped" is the assertion this event exists for, and a length says it while carrying
250
- * nobody's password. A cap that shortened this would read exactly like the wipe.
251
- */
252
- length: z.number().int().nonnegative(),
253
- /** Omitted for a password, a sensitive field name, or a payment autocomplete hint. */
254
- value: z.string().optional(),
255
- redacted: z.literal(true).optional(),
308
+ [FieldChangeField.FIELD]: z.string(),
309
+ [FieldChangeField.KIND]: z.nativeEnum(FieldChangeKind),
310
+ [FieldChangeField.LENGTH]: z.number().int().nonnegative(),
311
+ [FieldChangeField.VALUE]: z.string().optional(),
312
+ [FieldChangeField.REDACTED]: z.literal(true).optional(),
313
+ [FieldChangeField.CHECKED]: z.boolean().optional(),
314
+ [FieldChangeField.PREVIOUS]: z.string().optional(),
315
+ [FieldChangeField.PREVIOUS_CHECKED]: z.boolean().optional(),
256
316
  }),
257
317
  [EventType.FLOW_RECORDED]: z.object({ name: z.string(), flow: z.unknown() }),
258
318
  [EventType.TRANSPORT_OVERFLOW]: z.object({ dropped: z.number() }),
@@ -277,6 +337,30 @@ export const EVENT_PAYLOAD_SCHEMAS = {
277
337
  [EventType.HUMAN_CONTROL]: HumanControlDataSchema,
278
338
  [EventType.HUMAN_MARK]: HumanMarkDataSchema,
279
339
  [EventType.HUD_USED]: HudUseDataSchema,
340
+ [EventType.MEDIA_STATE]: z.object({
341
+ event: z.nativeEnum(MediaEvent),
342
+ tag: z.enum(['video', 'audio']),
343
+ /** Seconds into the media, as the element reports it. */
344
+ currentTime: z.number(),
345
+ /** Absent while unknown (NaN) or endless (a live stream). */
346
+ duration: z.number().optional(),
347
+ /** HTMLMediaElement.readyState, 0–4. */
348
+ readyState: z.number().int().min(0).max(4),
349
+ paused: z.boolean(),
350
+ }),
351
+ [EventType.CANVAS_DIGEST]: z.object({
352
+ /** A hash of a 16x16 sample of the canvas pixels: changes when what it shows changes. */
353
+ digest: z.string(),
354
+ width: z.number().int().nonnegative(),
355
+ height: z.number().int().nonnegative(),
356
+ /** The sample's mean colour, `[r, g, b]` 0–255: a coarse "what colour is it" a reader can check. */
357
+ mean: z.tuple([z.number(), z.number(), z.number()]),
358
+ /**
359
+ * `act` when an act's end took it, inside the act's window and sent even if nothing changed;
360
+ * `poll` when the timer did. Absent from an SDK older than the field.
361
+ */
362
+ trigger: z.nativeEnum(CanvasTrigger).optional(),
363
+ }),
280
364
  };
281
365
  /** Narrow an event's `data` against its type's payload schema. Unknown in, typed-or-error out. */
282
366
  export function parseEventPayload(type, data) {