@reticlehq/core 3.2.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +1 -1
  2. package/dist/artifacts/flow-composition.d.ts +3 -2
  3. package/dist/artifacts/flow-constants.d.ts +68 -2
  4. package/dist/artifacts/flow-constants.js +84 -2
  5. package/dist/artifacts/flow-expect-flat.d.ts +260 -0
  6. package/dist/artifacts/flow-expect-flat.js +284 -0
  7. package/dist/artifacts/flow-mutation-target.d.ts +0 -1
  8. package/dist/artifacts/flow-mutation-target.js +30 -2
  9. package/dist/artifacts/flow-step-tool.d.ts +2 -0
  10. package/dist/artifacts/flow-types.d.ts +1285 -1343
  11. package/dist/artifacts/flow-types.js +111 -140
  12. package/dist/artifacts/impact.d.ts +48 -20
  13. package/dist/artifacts/impact.js +11 -0
  14. package/dist/artifacts/journal.d.ts +34 -6
  15. package/dist/artifacts/journal.js +13 -0
  16. package/dist/hooks/hook-events.d.ts +18 -18
  17. package/dist/hud-entry.d.ts +9 -0
  18. package/dist/hud-entry.js +9 -0
  19. package/dist/identity/source-constants.d.ts +11 -0
  20. package/dist/identity/source-constants.js +11 -0
  21. package/dist/index.d.ts +9 -0
  22. package/dist/index.js +25 -1
  23. package/dist/onboarding.d.ts +2 -2
  24. package/dist/realm/registry.d.ts +0 -8
  25. package/dist/realm/registry.js +1 -11
  26. package/dist/registry/daemon-registry.d.ts +14 -4
  27. package/dist/registry/daemon-registry.js +20 -4
  28. package/dist/schema/event-message.json +3 -1
  29. package/dist/schema/event-payloads.json +72 -0
  30. package/dist/schema/event-type.json +3 -1
  31. package/dist/schema/reticle-event.json +3 -1
  32. package/dist/schema/reticle-message.json +3 -1
  33. package/dist/source-constants.cjs +1 -0
  34. package/dist/source-constants.d.cts +1 -0
  35. package/dist/telemetry-feedback.d.ts +6 -6
  36. package/dist/telemetry-refusal.d.ts +5 -4
  37. package/dist/telemetry-session.d.ts +25 -2
  38. package/dist/telemetry-session.js +13 -0
  39. package/dist/telemetry.d.ts +130 -102
  40. package/dist/verdict/compare-source.d.ts +80 -0
  41. package/dist/verdict/compare-source.js +93 -0
  42. package/dist/verdict/consequence.d.ts +12 -0
  43. package/dist/verdict/consequence.js +15 -0
  44. package/dist/verdict/instrumentation-gap.js +1 -1
  45. package/dist/verdict/intent.d.ts +24 -0
  46. package/dist/verdict/intent.js +66 -10
  47. package/dist/verdict/predicate-tree.d.ts +82 -0
  48. package/dist/verdict/predicate-tree.js +186 -0
  49. package/dist/verdict/predicate.d.ts +138 -0
  50. package/dist/verdict/predicate.js +430 -0
  51. package/dist/verdict/property-assertion.d.ts +191 -0
  52. package/dist/verdict/property-assertion.js +42 -0
  53. package/dist/verdict/security.js +16 -4
  54. package/dist/verdict/verdict-attribution.d.ts +52 -0
  55. package/dist/verdict/verdict-attribution.js +87 -0
  56. package/dist/verdict/verification-run.d.ts +330 -83
  57. package/dist/verdict/verification-run.js +44 -1
  58. package/dist/verdict/verified-constants.d.ts +9 -0
  59. package/dist/verdict/verified-constants.js +9 -0
  60. package/dist/wire/channel.d.ts +10 -0
  61. package/dist/wire/channel.js +25 -0
  62. package/dist/wire/constants/constants.d.ts +65 -102
  63. package/dist/wire/constants/constants.js +79 -101
  64. package/dist/wire/constants/discovery.d.ts +25 -0
  65. package/dist/wire/constants/discovery.js +25 -0
  66. package/dist/wire/constants/event-types.d.ts +122 -0
  67. package/dist/wire/constants/event-types.js +121 -0
  68. package/dist/wire/constants/hud-controls.d.ts +19 -0
  69. package/dist/wire/constants/hud-controls.js +95 -0
  70. package/dist/wire/constants/hud-use.d.ts +27 -0
  71. package/dist/wire/constants/hud-use.js +24 -0
  72. package/dist/wire/constants/session-constants.d.ts +10 -0
  73. package/dist/wire/constants/session-constants.js +10 -0
  74. package/dist/wire/event-payloads.d.ts +72 -13
  75. package/dist/wire/event-payloads.js +26 -4
  76. package/dist/wire/messages.d.ts +97 -56
  77. package/dist/wire/messages.js +17 -0
  78. package/dist/wire/net.d.ts +35 -0
  79. package/dist/wire/net.js +41 -0
  80. package/dist/wire/redaction.js +17 -0
  81. package/dist/wire/state-select.d.ts +2 -1
  82. package/dist/wire/state-select.js +56 -3
  83. package/dist/wire/toon.d.ts +1 -1
  84. package/dist/wire/toon.js +30 -8
  85. package/dist/wire/types.d.ts +119 -94
  86. package/dist/wire/types.js +23 -1
  87. package/dist/words/no-session-reason.d.ts +7 -0
  88. package/dist/words/no-session-reason.js +7 -0
  89. package/dist/words/notices.d.ts +7 -0
  90. package/dist/words/notices.js +9 -2
  91. package/package.json +7 -2
@@ -164,7 +164,7 @@ export declare const SeedStorageSchema: z.ZodObject<{
164
164
  sameSite?: "Strict" | "Lax" | "None" | undefined;
165
165
  expires?: number | undefined;
166
166
  }>, "many">]>>;
167
- }, "strip", z.ZodTypeAny, {
167
+ }, "strict", z.ZodTypeAny, {
168
168
  local?: Record<string, string> | undefined;
169
169
  session?: Record<string, string> | undefined;
170
170
  cookies?: Record<string, string> | {
@@ -251,6 +251,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
251
251
  durationMs: z.ZodNumber;
252
252
  initiator: z.ZodString;
253
253
  urlRaw: z.ZodOptional<z.ZodString>;
254
+ nextAction: z.ZodOptional<z.ZodString>;
254
255
  requestShape: z.ZodOptional<z.ZodString>;
255
256
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
256
257
  id: z.ZodString;
@@ -261,6 +262,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
261
262
  durationMs: z.ZodNumber;
262
263
  initiator: z.ZodString;
263
264
  urlRaw: z.ZodOptional<z.ZodString>;
265
+ nextAction: z.ZodOptional<z.ZodString>;
264
266
  requestShape: z.ZodOptional<z.ZodString>;
265
267
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
266
268
  id: z.ZodString;
@@ -271,6 +273,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
271
273
  durationMs: z.ZodNumber;
272
274
  initiator: z.ZodString;
273
275
  urlRaw: z.ZodOptional<z.ZodString>;
276
+ nextAction: z.ZodOptional<z.ZodString>;
274
277
  requestShape: z.ZodOptional<z.ZodString>;
275
278
  }, z.ZodTypeAny, "passthrough">>;
276
279
  "net.pending": z.ZodObject<{
@@ -280,15 +283,15 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
280
283
  initiator: z.ZodString;
281
284
  urlRaw: z.ZodOptional<z.ZodString>;
282
285
  }, "strip", z.ZodTypeAny, {
283
- id: string;
284
286
  method: string;
285
287
  url: string;
288
+ id: string;
286
289
  initiator: string;
287
290
  urlRaw?: string | undefined;
288
291
  }, {
289
- id: string;
290
292
  method: string;
291
293
  url: string;
294
+ id: string;
292
295
  initiator: string;
293
296
  urlRaw?: string | undefined;
294
297
  }>;
@@ -378,15 +381,15 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
378
381
  search: z.ZodString;
379
382
  hash: z.ZodString;
380
383
  }, "strip", z.ZodTypeAny, {
381
- pathname: string;
382
384
  from: string;
383
385
  to: string;
386
+ pathname: string;
384
387
  search: string;
385
388
  hash: string;
386
389
  }, {
387
- pathname: string;
388
390
  from: string;
389
391
  to: string;
392
+ pathname: string;
390
393
  search: string;
391
394
  hash: string;
392
395
  }>;
@@ -474,15 +477,15 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
474
477
  readonly DOWN: "down";
475
478
  }>;
476
479
  }, "strip", z.ZodTypeAny, {
480
+ percent: number;
477
481
  direction: "up" | "down";
478
482
  x: number;
479
483
  y: number;
480
- percent: number;
481
484
  }, {
485
+ percent: number;
482
486
  direction: "up" | "down";
483
487
  x: number;
484
488
  y: number;
485
- percent: number;
486
489
  }>;
487
490
  "reveal.shown": z.ZodObject<{
488
491
  role: z.ZodOptional<z.ZodString>;
@@ -698,6 +701,34 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
698
701
  from?: string | undefined;
699
702
  to?: string | undefined;
700
703
  }>;
704
+ "field.change": z.ZodObject<{
705
+ /** What an assertion would call this field: its testid, else its name, else its accessible name. */
706
+ field: z.ZodString;
707
+ /** `input` is a settled burst of keystrokes; `change` is the commit that ends one. */
708
+ kind: z.ZodEnum<["input", "change"]>;
709
+ /**
710
+ * The length of the REAL value, never of the clipped one, and present even when redacted.
711
+ *
712
+ * "It was wiped" is the assertion this event exists for, and a length says it while carrying
713
+ * nobody's password. A cap that shortened this would read exactly like the wipe.
714
+ */
715
+ length: z.ZodNumber;
716
+ /** Omitted for a password, a sensitive field name, or a payment autocomplete hint. */
717
+ value: z.ZodOptional<z.ZodString>;
718
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
719
+ }, "strip", z.ZodTypeAny, {
720
+ kind: "input" | "change";
721
+ length: number;
722
+ field: string;
723
+ value?: string | undefined;
724
+ redacted?: true | undefined;
725
+ }, {
726
+ kind: "input" | "change";
727
+ length: number;
728
+ field: string;
729
+ value?: string | undefined;
730
+ redacted?: true | undefined;
731
+ }>;
701
732
  "flow.recorded": z.ZodObject<{
702
733
  name: z.ZodString;
703
734
  flow: z.ZodUnknown;
@@ -791,10 +822,10 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
791
822
  }>;
792
823
  text: z.ZodOptional<z.ZodString>;
793
824
  }, "strip", z.ZodTypeAny, {
794
- kind: "message" | "pause" | "resume" | "end" | "replay" | "sync" | "harness";
825
+ kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync";
795
826
  text?: string | undefined;
796
827
  }, {
797
- kind: "message" | "pause" | "resume" | "end" | "replay" | "sync" | "harness";
828
+ kind: "message" | "harness" | "pause" | "resume" | "end" | "replay" | "sync";
798
829
  text?: string | undefined;
799
830
  }>;
800
831
  "human.mark": z.ZodObject<{
@@ -821,9 +852,9 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
821
852
  }, "strip", z.ZodTypeAny, {
822
853
  anchor: string;
823
854
  note: string;
824
- strategy: "role" | "testid" | "component" | "position";
825
- label?: string | undefined;
855
+ strategy: "testid" | "role" | "component" | "position";
826
856
  route?: string | undefined;
857
+ label?: string | undefined;
827
858
  source?: {
828
859
  file: string;
829
860
  line: number;
@@ -831,14 +862,42 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
831
862
  }, {
832
863
  anchor: string;
833
864
  note: string;
834
- strategy: "role" | "testid" | "component" | "position";
835
- label?: string | undefined;
865
+ strategy: "testid" | "role" | "component" | "position";
836
866
  route?: string | undefined;
867
+ label?: string | undefined;
837
868
  source?: {
838
869
  file: string;
839
870
  line: number;
840
871
  } | undefined;
841
872
  }>;
873
+ "hud.used": z.ZodObject<{
874
+ control: z.ZodOptional<z.ZodString>;
875
+ toggle: z.ZodOptional<z.ZodNativeEnum<{
876
+ readonly ON: "on";
877
+ readonly OFF: "off";
878
+ }>>;
879
+ view: z.ZodOptional<z.ZodNativeEnum<{
880
+ readonly BUBBLE: "bubble";
881
+ readonly COLLAPSED: "collapsed";
882
+ readonly EXPANDED: "expanded";
883
+ }>>;
884
+ panel: z.ZodOptional<z.ZodNativeEnum<{
885
+ readonly CHAT: "chat";
886
+ readonly SETTINGS: "settings";
887
+ readonly REPORT: "report";
888
+ readonly NONE: "none";
889
+ }>>;
890
+ }, "strip", z.ZodTypeAny, {
891
+ control?: string | undefined;
892
+ toggle?: "on" | "off" | undefined;
893
+ view?: "expanded" | "bubble" | "collapsed" | undefined;
894
+ panel?: "none" | "chat" | "settings" | "report" | undefined;
895
+ }, {
896
+ control?: string | undefined;
897
+ toggle?: "on" | "off" | undefined;
898
+ view?: "expanded" | "bubble" | "collapsed" | undefined;
899
+ panel?: "none" | "chat" | "settings" | "report" | undefined;
900
+ }>;
842
901
  };
843
902
  /** Narrow an event's `data` against its type's payload schema. Unknown in, typed-or-error out. */
844
903
  export declare function parseEventPayload(type: EventType, data: unknown): z.SafeParseReturnType<unknown, unknown>;
@@ -2,8 +2,8 @@ import { z } from 'zod';
2
2
  import { EventType, PerfMetric } from './constants/constants.js';
3
3
  import { BlindSpotKind } from '../verdict/verified-constants.js';
4
4
  import { BrowserBrand } from '../telemetry-feedback.js';
5
- import { HumanControlDataSchema, HumanMarkDataSchema } from './messages.js';
6
- import { REQUEST_SHAPE_FIELD } from './net.js';
5
+ import { HudUseDataSchema, HumanControlDataSchema, HumanMarkDataSchema } from './messages.js';
6
+ import { NEXT_ACTION_FIELD, REQUEST_SHAPE_FIELD } from './net.js';
7
7
  /**
8
8
  * Per-event-type payload schemas — the typed replacement for the envelope's open `data` record.
9
9
  * The envelope (`ReticleEventSchema.data`) stays open on the wire so a richer SDK is never rejected
@@ -62,7 +62,8 @@ export const SeedCookiesSchema = z.union([z.record(z.string()), z.array(SeedCook
62
62
  * Client storage and session state to seed into an isolated context before the first navigation.
63
63
  * Matches the three storage areas Reticle already observes (localStorage, sessionStorage, cookies).
64
64
  */
65
- export const SeedStorageSchema = z.object({
65
+ export const SeedStorageSchema = z
66
+ .object({
66
67
  local: z
67
68
  .record(z.string())
68
69
  .optional()
@@ -72,7 +73,10 @@ export const SeedStorageSchema = z.object({
72
73
  .optional()
73
74
  .describe('Key-value pairs to seed into window.sessionStorage before first navigation.'),
74
75
  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.'),
75
- });
76
+ })
77
+ // Unknown keys (e.g. a typo'd `localStorage`, or a Playwright `storageState` shape) must be
78
+ // rejected, not silently dropped, or the caller believes seeding happened when nothing was seeded.
79
+ .strict();
76
80
  const elementLabel = z.object({ role: z.string().optional(), name: z.string().optional() });
77
81
  /**
78
82
  * A file the app produced. `preview`/`lines` are present only when body capture is on, for the same
@@ -105,6 +109,7 @@ const netRequestSchema = z
105
109
  durationMs: z.number(),
106
110
  initiator: z.string(),
107
111
  urlRaw: z.string().optional(),
112
+ [NEXT_ACTION_FIELD]: z.string().optional(),
108
113
  [REQUEST_SHAPE_FIELD]: z.string().optional(),
109
114
  })
110
115
  .passthrough();
@@ -223,6 +228,22 @@ export const EVENT_PAYLOAD_SCHEMAS = {
223
228
  from: z.string().optional(),
224
229
  toBody: z.boolean(),
225
230
  }),
231
+ [EventType.FIELD_CHANGE]: z.object({
232
+ /** What an assertion would call this field: its testid, else its name, else its accessible name. */
233
+ field: z.string(),
234
+ /** `input` is a settled burst of keystrokes; `change` is the commit that ends one. */
235
+ kind: z.enum(['input', 'change']),
236
+ /**
237
+ * The length of the REAL value, never of the clipped one, and present even when redacted.
238
+ *
239
+ * "It was wiped" is the assertion this event exists for, and a length says it while carrying
240
+ * nobody's password. A cap that shortened this would read exactly like the wipe.
241
+ */
242
+ length: z.number().int().nonnegative(),
243
+ /** Omitted for a password, a sensitive field name, or a payment autocomplete hint. */
244
+ value: z.string().optional(),
245
+ redacted: z.literal(true).optional(),
246
+ }),
226
247
  [EventType.FLOW_RECORDED]: z.object({ name: z.string(), flow: z.unknown() }),
227
248
  [EventType.TRANSPORT_OVERFLOW]: z.object({ dropped: z.number() }),
228
249
  [EventType.TRUNCATED]: z.object({ channel: z.string(), dropped: z.number() }),
@@ -245,6 +266,7 @@ export const EVENT_PAYLOAD_SCHEMAS = {
245
266
  .passthrough(),
246
267
  [EventType.HUMAN_CONTROL]: HumanControlDataSchema,
247
268
  [EventType.HUMAN_MARK]: HumanMarkDataSchema,
269
+ [EventType.HUD_USED]: HudUseDataSchema,
248
270
  };
249
271
  /** Narrow an event's `data` against its type's payload schema. Unknown in, typed-or-error out. */
250
272
  export function parseEventPayload(type, data) {