@reticlehq/core 3.7.0 → 3.8.1

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 (138) hide show
  1. package/dist/activation-entry.d.ts +9 -0
  2. package/dist/activation-entry.js +9 -0
  3. package/dist/artifacts/drive-script.d.ts +84 -1217
  4. package/dist/artifacts/drive-script.js +1 -1
  5. package/dist/artifacts/flow-constants.d.ts +15 -0
  6. package/dist/artifacts/flow-constants.js +15 -0
  7. package/dist/artifacts/flow-expect-flat.d.ts +8 -192
  8. package/dist/artifacts/flow-expect-flat.js +2 -2
  9. package/dist/artifacts/flow-results.d.ts +26 -0
  10. package/dist/artifacts/flow-types.d.ts +212 -2295
  11. package/dist/artifacts/flow-types.js +14 -2
  12. package/dist/artifacts/harness-credits.d.ts +6 -3
  13. package/dist/artifacts/harness-credits.js +9 -6
  14. package/dist/artifacts/harness-map.d.ts +8 -69
  15. package/dist/artifacts/harness-map.js +1 -1
  16. package/dist/artifacts/hud-notices.d.ts +8 -82
  17. package/dist/artifacts/hud-notices.js +1 -1
  18. package/dist/artifacts/impact.d.ts +104 -1665
  19. package/dist/artifacts/impact.js +38 -21
  20. package/dist/artifacts/journal.d.ts +15 -231
  21. package/dist/artifacts/journal.js +15 -2
  22. package/dist/artifacts/prompt-context.d.ts +7 -33
  23. package/dist/artifacts/prompt-context.js +15 -4
  24. package/dist/artifacts/screenshot-upload.d.ts +3 -26
  25. package/dist/artifacts/screenshot-upload.js +1 -1
  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 +15 -171
  29. package/dist/hooks/hook-events.js +1 -1
  30. package/dist/hud-entry.js +1 -1
  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 +10 -0
  36. package/dist/index.js +10 -0
  37. package/dist/onboarding.d.ts +23 -52
  38. package/dist/onboarding.js +20 -1
  39. package/dist/registry/daemon-registry.d.ts +2 -14
  40. package/dist/registry/daemon-registry.js +1 -1
  41. package/dist/registry/dev-server-registry.d.ts +2 -31
  42. package/dist/registry/dev-server-registry.js +1 -1
  43. package/dist/registry/project-registry.d.ts +4 -32
  44. package/dist/registry/project-registry.js +1 -1
  45. package/dist/schema/command-message.json +65 -68
  46. package/dist/schema/command-name.json +29 -33
  47. package/dist/schema/command-result.json +25 -30
  48. package/dist/schema/event-message.json +104 -101
  49. package/dist/schema/event-payloads.json +246 -108
  50. package/dist/schema/event-type.json +47 -48
  51. package/dist/schema/hello-message.json +150 -133
  52. package/dist/schema/reticle-event.json +98 -94
  53. package/dist/schema/reticle-message.json +338 -310
  54. package/dist/telemetry-bug.d.ts +4 -75
  55. package/dist/telemetry-bug.js +1 -1
  56. package/dist/telemetry-entry.d.ts +1 -1
  57. package/dist/telemetry-entry.js +1 -1
  58. package/dist/telemetry-feedback.d.ts +17 -91
  59. package/dist/telemetry-feedback.js +20 -1
  60. package/dist/telemetry-refusal.d.ts +4 -31
  61. package/dist/telemetry-refusal.js +1 -1
  62. package/dist/telemetry-session.d.ts +45 -624
  63. package/dist/telemetry-session.js +25 -12
  64. package/dist/telemetry-signals.d.ts +211 -86
  65. package/dist/telemetry-signals.js +100 -2
  66. package/dist/telemetry.d.ts +321 -1691
  67. package/dist/telemetry.js +72 -6
  68. package/dist/verdict/check-sentence.d.ts +34 -0
  69. package/dist/verdict/check-sentence.js +228 -0
  70. package/dist/verdict/compare-source.d.ts +1 -1
  71. package/dist/verdict/compare-source.js +1 -1
  72. package/dist/verdict/consequence.d.ts +15 -0
  73. package/dist/verdict/consequence.js +11 -0
  74. package/dist/verdict/disparity.d.ts +8 -56
  75. package/dist/verdict/disparity.js +1 -1
  76. package/dist/verdict/findings.d.ts +10 -0
  77. package/dist/verdict/findings.js +13 -0
  78. package/dist/verdict/instrumentation-coverage.d.ts +6 -37
  79. package/dist/verdict/instrumentation-coverage.js +15 -59
  80. package/dist/verdict/instrumentation-gap.d.ts +72 -0
  81. package/dist/verdict/instrumentation-gap.js +64 -0
  82. package/dist/verdict/intent.d.ts +25 -224
  83. package/dist/verdict/intent.js +1 -1
  84. package/dist/verdict/predicate-tree.d.ts +2 -0
  85. package/dist/verdict/predicate-tree.js +16 -0
  86. package/dist/verdict/predicate.d.ts +3 -2
  87. package/dist/verdict/predicate.js +107 -16
  88. package/dist/verdict/property-assertion.d.ts +23 -101
  89. package/dist/verdict/property-assertion.js +1 -1
  90. package/dist/verdict/run-report.d.ts +71 -0
  91. package/dist/verdict/run-report.js +53 -0
  92. package/dist/verdict/security.d.ts +48 -2
  93. package/dist/verdict/security.js +185 -18
  94. package/dist/verdict/verification-run.d.ts +124 -1623
  95. package/dist/verdict/verification-run.js +37 -6
  96. package/dist/verdict/verify-progress.d.ts +22 -64
  97. package/dist/verdict/verify-progress.js +1 -1
  98. package/dist/wire/constants/constants.d.ts +56 -141
  99. package/dist/wire/constants/constants.js +64 -144
  100. package/dist/wire/constants/discovery.d.ts +4 -4
  101. package/dist/wire/constants/discovery.js +4 -4
  102. package/dist/wire/constants/event-types.d.ts +37 -1
  103. package/dist/wire/constants/event-types.js +35 -1
  104. package/dist/wire/constants/hud-controls.js +0 -2
  105. package/dist/wire/constants/hud-use.d.ts +4 -0
  106. package/dist/wire/constants/hud-use.js +4 -0
  107. package/dist/wire/constants/mcp-wire.d.ts +16 -0
  108. package/dist/wire/constants/mcp-wire.js +16 -0
  109. package/dist/wire/constants/response-body-reason.d.ts +19 -0
  110. package/dist/wire/constants/response-body-reason.js +18 -0
  111. package/dist/wire/constants/reticle-env.d.ts +140 -0
  112. package/dist/wire/constants/reticle-env.js +140 -0
  113. package/dist/wire/constants/session-constants.d.ts +11 -0
  114. package/dist/wire/constants/session-constants.js +11 -0
  115. package/dist/wire/event-payloads.d.ts +173 -629
  116. package/dist/wire/event-payloads.js +107 -23
  117. package/dist/wire/event-priority.js +1 -0
  118. package/dist/wire/messages.d.ts +90 -713
  119. package/dist/wire/messages.js +19 -3
  120. package/dist/wire/narrow.d.ts +6 -0
  121. package/dist/wire/narrow.js +26 -0
  122. package/dist/wire/next-step.d.ts +50 -0
  123. package/dist/wire/next-step.js +37 -0
  124. package/dist/wire/platform-link.d.ts +7 -0
  125. package/dist/wire/platform-link.js +14 -8
  126. package/dist/wire/production/activation-ticket.d.ts +64 -0
  127. package/dist/wire/production/activation-ticket.js +148 -0
  128. package/dist/wire/production/hello-mode.d.ts +35 -0
  129. package/dist/wire/production/hello-mode.js +32 -0
  130. package/dist/wire/production/production-policy.d.ts +92 -0
  131. package/dist/wire/production/production-policy.js +133 -0
  132. package/dist/wire/tool-names.d.ts +2 -0
  133. package/dist/wire/tool-names.js +2 -0
  134. package/dist/wire/types.d.ts +102 -700
  135. package/dist/wire/types.js +5 -5
  136. package/dist/words/upgrade.d.ts +3 -13
  137. package/dist/words/upgrade.js +1 -1
  138. package/package.json +7 -4
@@ -1,5 +1,6 @@
1
- import { z } from 'zod';
2
- import { EventType, PerfMetric } from './constants/constants.js';
1
+ import * as z from 'zod';
2
+ import { CanvasTrigger, EventType, MediaEvent, PerfMetric } from './constants/constants.js';
3
+ import { ResponseBodyReason } from './constants/response-body-reason.js';
3
4
  import { BlindSpotKind } from '../verdict/verified-constants.js';
4
5
  import { BrowserBrand } from '../telemetry-feedback.js';
5
6
  import { HudUseDataSchema, HumanControlDataSchema, HumanMarkDataSchema } from './messages.js';
@@ -49,6 +50,37 @@ export const RouteChangeHow = {
49
50
  };
50
51
  /** Wire field on `route.change` carrying a `RouteChangeHow`. */
51
52
  export const ROUTE_CHANGE_HOW_FIELD = 'how';
53
+ /**
54
+ * Why a `field.change` was emitted.
55
+ *
56
+ * `input` is a burst of keystrokes and `change` is the commit that ends one — both are the user's
57
+ * own event, fired before a controlled component restores its DOM property. `settled` is a read of
58
+ * that property on the frame after the handlers ran. Only a settled read that differs from the
59
+ * pre-action value is evidence the screen moved.
60
+ */
61
+ export const FieldChangeKind = {
62
+ INPUT: 'input',
63
+ CHANGE: 'change',
64
+ SETTLED: 'settled',
65
+ };
66
+ /**
67
+ * Wire fields on `field.change` beyond `field` / `kind` / `value` / `length`.
68
+ *
69
+ * `checked` is the property a checkbox or radio actually renders; `value` on those is the HTML
70
+ * value (`"on"`), which does not move when the box is toggled. `previous` and `previousChecked`
71
+ * are the same reading from before the action, present on a settled event so a consumer can tell
72
+ * a render from a restore.
73
+ */
74
+ export const FieldChangeField = {
75
+ FIELD: 'field',
76
+ KIND: 'kind',
77
+ LENGTH: 'length',
78
+ VALUE: 'value',
79
+ REDACTED: 'redacted',
80
+ CHECKED: 'checked',
81
+ PREVIOUS: 'previous',
82
+ PREVIOUS_CHECKED: 'previousChecked',
83
+ };
52
84
  /**
53
85
  * The three readable client-side storage areas.
54
86
  *
@@ -71,7 +103,10 @@ export const SeedCookieSchema = z.object({
71
103
  sameSite: z.enum(['Strict', 'Lax', 'None']).optional().describe('SameSite policy.'),
72
104
  expires: z.number().optional().describe('Unix timestamp in seconds for cookie expiration.'),
73
105
  });
74
- export const SeedCookiesSchema = z.union([z.record(z.string()), z.array(SeedCookieSchema)]);
106
+ export const SeedCookiesSchema = z.union([
107
+ z.record(z.string(), z.string()),
108
+ z.array(SeedCookieSchema),
109
+ ]);
75
110
  /**
76
111
  * Client storage and session state to seed into an isolated context before the first navigation.
77
112
  * Matches the three storage areas Reticle already observes (localStorage, sessionStorage, cookies).
@@ -79,11 +114,11 @@ export const SeedCookiesSchema = z.union([z.record(z.string()), z.array(SeedCook
79
114
  export const SeedStorageSchema = z
80
115
  .object({
81
116
  local: z
82
- .record(z.string())
117
+ .record(z.string(), z.string())
83
118
  .optional()
84
119
  .describe('Key-value pairs to seed into window.localStorage before first navigation.'),
85
120
  session: z
86
- .record(z.string())
121
+ .record(z.string(), z.string())
87
122
  .optional()
88
123
  .describe('Key-value pairs to seed into window.sessionStorage before first navigation.'),
89
124
  cookies: SeedCookiesSchema.optional().describe('Cookies to seed before first navigation: a name-value record scoped to the lease URL or an array of cookie objects.'),
@@ -144,7 +179,17 @@ export const EVENT_PAYLOAD_SCHEMAS = {
144
179
  [EventType.DOM_ATTR]: z
145
180
  .object({ attr: z.string(), value: z.string().optional(), old: z.string().optional() })
146
181
  .passthrough(),
147
- [EventType.DOM_TEXT]: z.object({ text: z.string(), old: z.string().optional() }),
182
+ [EventType.DOM_TEXT]: z.object({
183
+ text: z.string(),
184
+ old: z.string().optional(),
185
+ /**
186
+ * The `data-testid` of the element or its nearest ancestor, so a text change can be named and a
187
+ * stale one (a store field changed, the text that shows it did not) can be found.
188
+ */
189
+ testid: z.string().optional(),
190
+ /** The text an element ARRIVED with, not a change: the baseline a later change is read against. */
191
+ initial: z.boolean().optional(),
192
+ }),
148
193
  [EventType.NET_REQUEST]: netRequestSchema,
149
194
  [EventType.NET_PENDING]: z.object({
150
195
  id: z.string(),
@@ -169,6 +214,8 @@ export const EVENT_PAYLOAD_SCHEMAS = {
169
214
  search: z.string(),
170
215
  hash: z.string(),
171
216
  [ROUTE_CHANGE_HOW_FIELD]: z.nativeEnum(RouteChangeHow),
217
+ /** The app's own route pattern for the screen reached (`/personas/:personaId`), when known. */
218
+ pattern: z.string().optional(),
172
219
  }),
173
220
  [EventType.CONSOLE_LOG]: consoleSchema,
174
221
  [EventType.CONSOLE_WARN]: consoleSchema,
@@ -194,7 +241,9 @@ export const EVENT_PAYLOAD_SCHEMAS = {
194
241
  }),
195
242
  [EventType.REVEAL_SHOWN]: elementLabel.passthrough(),
196
243
  [EventType.SIGNAL]: z.object({ name: z.string(), data: z.unknown().optional() }),
197
- [EventType.STATE_CHANGE]: z.object({ name: z.string(), value: z.unknown() }).passthrough(),
244
+ [EventType.STATE_CHANGE]: z
245
+ .object({ name: z.string(), value: z.unknown().optional() })
246
+ .passthrough(),
198
247
  [EventType.STORAGE_CHANGE]: z.object({
199
248
  area: z.nativeEnum(StorageArea),
200
249
  key: z.string(),
@@ -255,23 +304,23 @@ export const EVENT_PAYLOAD_SCHEMAS = {
255
304
  from: z.string().optional(),
256
305
  toBody: z.boolean(),
257
306
  }),
307
+ // Keys are FieldChangeField so the wire names exist once. `kind` is FieldChangeKind:
308
+ // input/change are the user's event; settled is the post-handler read. `length` is the REAL
309
+ // value's length, never the clipped one, and present even when redacted — a cap must never read
310
+ // as a wipe. `value` is omitted for a password, a sensitive name, or a payment autocomplete hint.
311
+ // `checked` is the checkbox/radio property (`value` there does not move). `previous` /
312
+ // `previousChecked` ride on a settled read so a restore is distinguishable from a render.
258
313
  [EventType.FIELD_CHANGE]: z.object({
259
- /** What an assertion would call this field: its testid, else its name, else its accessible name. */
260
- field: z.string(),
261
- /** `input` is a settled burst of keystrokes; `change` is the commit that ends one. */
262
- kind: z.enum(['input', 'change']),
263
- /**
264
- * The length of the REAL value, never of the clipped one, and present even when redacted.
265
- *
266
- * "It was wiped" is the assertion this event exists for, and a length says it while carrying
267
- * nobody's password. A cap that shortened this would read exactly like the wipe.
268
- */
269
- length: z.number().int().nonnegative(),
270
- /** Omitted for a password, a sensitive field name, or a payment autocomplete hint. */
271
- value: z.string().optional(),
272
- redacted: z.literal(true).optional(),
314
+ [FieldChangeField.FIELD]: z.string(),
315
+ [FieldChangeField.KIND]: z.nativeEnum(FieldChangeKind),
316
+ [FieldChangeField.LENGTH]: z.number().int().nonnegative(),
317
+ [FieldChangeField.VALUE]: z.string().optional(),
318
+ [FieldChangeField.REDACTED]: z.literal(true).optional(),
319
+ [FieldChangeField.CHECKED]: z.boolean().optional(),
320
+ [FieldChangeField.PREVIOUS]: z.string().optional(),
321
+ [FieldChangeField.PREVIOUS_CHECKED]: z.boolean().optional(),
273
322
  }),
274
- [EventType.FLOW_RECORDED]: z.object({ name: z.string(), flow: z.unknown() }),
323
+ [EventType.FLOW_RECORDED]: z.object({ name: z.string(), flow: z.unknown().optional() }),
275
324
  [EventType.TRANSPORT_OVERFLOW]: z.object({ dropped: z.number() }),
276
325
  [EventType.TRUNCATED]: z.object({ channel: z.string(), dropped: z.number() }),
277
326
  [EventType.BLIND_SPOT]: z.object({ kind: z.nativeEnum(BlindSpotKind), count: z.number() }),
@@ -287,13 +336,48 @@ export const EVENT_PAYLOAD_SCHEMAS = {
287
336
  url: z.string(),
288
337
  method: z.string().optional(),
289
338
  status: z.number(),
290
- headers: z.record(z.string()),
339
+ headers: z.record(z.string(), z.string()),
291
340
  resourceType: z.string().optional(),
292
341
  })
293
342
  .passthrough(),
343
+ [EventType.NET_RESPONSE_BODY]: z
344
+ .object({
345
+ id: z.string(),
346
+ method: z.string(),
347
+ url: z.string(),
348
+ urlRaw: z.string().optional(),
349
+ responseBody: z.string(),
350
+ responseBodyTruncated: z.boolean().optional(),
351
+ responseBodyReason: z.nativeEnum(ResponseBodyReason).optional(),
352
+ })
353
+ .passthrough(),
294
354
  [EventType.HUMAN_CONTROL]: HumanControlDataSchema,
295
355
  [EventType.HUMAN_MARK]: HumanMarkDataSchema,
296
356
  [EventType.HUD_USED]: HudUseDataSchema,
357
+ [EventType.MEDIA_STATE]: z.object({
358
+ event: z.nativeEnum(MediaEvent),
359
+ tag: z.enum(['video', 'audio']),
360
+ /** Seconds into the media, as the element reports it. */
361
+ currentTime: z.number(),
362
+ /** Absent while unknown (NaN) or endless (a live stream). */
363
+ duration: z.number().optional(),
364
+ /** HTMLMediaElement.readyState, 0–4. */
365
+ readyState: z.number().int().min(0).max(4),
366
+ paused: z.boolean(),
367
+ }),
368
+ [EventType.CANVAS_DIGEST]: z.object({
369
+ /** A hash of a 16x16 sample of the canvas pixels: changes when what it shows changes. */
370
+ digest: z.string(),
371
+ width: z.number().int().nonnegative(),
372
+ height: z.number().int().nonnegative(),
373
+ /** The sample's mean colour, `[r, g, b]` 0–255: a coarse "what colour is it" a reader can check. */
374
+ mean: z.tuple([z.number(), z.number(), z.number()]),
375
+ /**
376
+ * `act` when an act's end took it, inside the act's window and sent even if nothing changed;
377
+ * `poll` when the timer did. Absent from an SDK older than the field.
378
+ */
379
+ trigger: z.nativeEnum(CanvasTrigger).optional(),
380
+ }),
297
381
  };
298
382
  /** Narrow an event's `data` against its type's payload schema. Unknown in, typed-or-error out. */
299
383
  export function parseEventPayload(type, data) {
@@ -18,6 +18,7 @@ export const HIGH_VALUE_EVENT_TYPES = new Set([
18
18
  EventType.NET_PENDING,
19
19
  EventType.NET_STREAM,
20
20
  EventType.NET_DETAIL,
21
+ EventType.NET_RESPONSE_BODY,
21
22
  EventType.CONSOLE_ERROR,
22
23
  EventType.CONSOLE_WARN,
23
24
  EventType.ERROR_UNCAUGHT,