@reticlehq/core 3.3.0 → 3.5.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 (48) hide show
  1. package/README.md +1 -1
  2. package/dist/artifacts/flow-constants.d.ts +19 -0
  3. package/dist/artifacts/flow-constants.js +36 -1
  4. package/dist/artifacts/flow-expect-flat.d.ts +16 -16
  5. package/dist/artifacts/flow-expect-flat.js +2 -2
  6. package/dist/artifacts/flow-mutation-target.js +4 -0
  7. package/dist/artifacts/flow-types.d.ts +393 -297
  8. package/dist/artifacts/flow-types.js +17 -2
  9. package/dist/artifacts/journal.d.ts +3 -2
  10. package/dist/hooks/hook-events.d.ts +4 -4
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.js +1 -0
  13. package/dist/registry/daemon-registry.d.ts +14 -4
  14. package/dist/registry/daemon-registry.js +20 -4
  15. package/dist/schema/event-payloads.json +3 -0
  16. package/dist/telemetry-refusal.d.ts +3 -2
  17. package/dist/telemetry.d.ts +17 -16
  18. package/dist/telemetry.js +3 -3
  19. package/dist/verdict/compare-source.d.ts +80 -0
  20. package/dist/verdict/compare-source.js +93 -0
  21. package/dist/verdict/consequence.d.ts +2 -0
  22. package/dist/verdict/consequence.js +2 -0
  23. package/dist/verdict/instrumentation-gap.js +1 -1
  24. package/dist/verdict/intent.d.ts +12 -12
  25. package/dist/verdict/predicate-tree.d.ts +35 -0
  26. package/dist/verdict/predicate-tree.js +40 -0
  27. package/dist/verdict/predicate.d.ts +11 -2
  28. package/dist/verdict/predicate.js +38 -2
  29. package/dist/verdict/verification-run.d.ts +261 -28
  30. package/dist/verdict/verification-run.js +36 -0
  31. package/dist/wire/channel.d.ts +10 -0
  32. package/dist/wire/channel.js +25 -0
  33. package/dist/wire/constants/constants.d.ts +45 -5
  34. package/dist/wire/constants/constants.js +57 -5
  35. package/dist/wire/event-payloads.d.ts +12 -9
  36. package/dist/wire/event-payloads.js +8 -3
  37. package/dist/wire/messages.d.ts +24 -24
  38. package/dist/wire/net.d.ts +17 -0
  39. package/dist/wire/net.js +17 -0
  40. package/dist/wire/redaction.js +17 -0
  41. package/dist/wire/toon.d.ts +1 -1
  42. package/dist/wire/toon.js +2 -1
  43. package/dist/wire/types.d.ts +44 -44
  44. package/dist/words/no-session-reason.d.ts +7 -0
  45. package/dist/words/no-session-reason.js +7 -0
  46. package/dist/words/notices.d.ts +7 -0
  47. package/dist/words/notices.js +9 -2
  48. package/package.json +3 -2
@@ -83,16 +83,16 @@ export declare const ElementQuerySchema: z.ZodObject<{
83
83
  */
84
84
  self: z.ZodOptional<z.ZodBoolean>;
85
85
  }, "strict", z.ZodTypeAny, {
86
+ text?: string | undefined;
86
87
  testid?: string | undefined;
87
88
  role?: string | undefined;
88
89
  component?: string | undefined;
89
- text?: string | undefined;
90
90
  label?: string | undefined;
91
91
  placeholder?: string | undefined;
92
92
  alt?: string | undefined;
93
93
  value?: string | undefined;
94
94
  name?: string | undefined;
95
- by?: "testid" | "role" | "component" | "text" | "label" | "placeholder" | "alt" | undefined;
95
+ by?: "text" | "testid" | "role" | "component" | "label" | "placeholder" | "alt" | undefined;
96
96
  attrs?: string[] | undefined;
97
97
  source?: {
98
98
  file: string;
@@ -102,16 +102,16 @@ export declare const ElementQuerySchema: z.ZodObject<{
102
102
  scope?: string | undefined;
103
103
  self?: boolean | undefined;
104
104
  }, {
105
+ text?: string | undefined;
105
106
  testid?: string | undefined;
106
107
  role?: string | undefined;
107
108
  component?: string | undefined;
108
- text?: string | undefined;
109
109
  label?: string | undefined;
110
110
  placeholder?: string | undefined;
111
111
  alt?: string | undefined;
112
112
  value?: string | undefined;
113
113
  name?: string | undefined;
114
- by?: "testid" | "role" | "component" | "text" | "label" | "placeholder" | "alt" | undefined;
114
+ by?: "text" | "testid" | "role" | "component" | "label" | "placeholder" | "alt" | undefined;
115
115
  attrs?: string[] | undefined;
116
116
  source?: {
117
117
  file: string;
@@ -255,11 +255,11 @@ export declare const CapabilityFlowSchema: z.ZodObject<{
255
255
  name: z.ZodString;
256
256
  steps: z.ZodArray<z.ZodString, "many">;
257
257
  }, "strip", z.ZodTypeAny, {
258
- name: string;
259
258
  steps: string[];
260
- }, {
261
259
  name: string;
260
+ }, {
262
261
  steps: string[];
262
+ name: string;
263
263
  }>;
264
264
  /**
265
265
  * A declared risk zone — the app naming a surface (auth/payment/db/…) and the paths it covers, so a
@@ -352,11 +352,11 @@ export declare const CapabilitiesSchema: z.ZodObject<{
352
352
  name: z.ZodString;
353
353
  steps: z.ZodArray<z.ZodString, "many">;
354
354
  }, "strip", z.ZodTypeAny, {
355
- name: string;
356
355
  steps: string[];
357
- }, {
358
356
  name: string;
357
+ }, {
359
358
  steps: string[];
359
+ name: string;
360
360
  }>, "many">;
361
361
  /** Optional declared governance (owner/safety/scope/redact/risk). Additive — back-compat safe. */
362
362
  governance: z.ZodOptional<z.ZodObject<{
@@ -409,8 +409,8 @@ export declare const CapabilitiesSchema: z.ZodObject<{
409
409
  }>>;
410
410
  }, "strip", z.ZodTypeAny, {
411
411
  flows: {
412
- name: string;
413
412
  steps: string[];
413
+ name: string;
414
414
  }[];
415
415
  testids: string[];
416
416
  signals: string[];
@@ -428,8 +428,8 @@ export declare const CapabilitiesSchema: z.ZodObject<{
428
428
  } | undefined;
429
429
  }, {
430
430
  flows: {
431
- name: string;
432
431
  steps: string[];
432
+ name: string;
433
433
  }[];
434
434
  testids: string[];
435
435
  signals: string[];
@@ -459,11 +459,11 @@ export declare const ContractFileSchema: z.ZodObject<{
459
459
  name: z.ZodString;
460
460
  steps: z.ZodArray<z.ZodString, "many">;
461
461
  }, "strip", z.ZodTypeAny, {
462
- name: string;
463
462
  steps: string[];
464
- }, {
465
463
  name: string;
464
+ }, {
466
465
  steps: string[];
466
+ name: string;
467
467
  }>, "many">;
468
468
  /** Optional declared governance (owner/safety/scope/redact/risk). Additive — back-compat safe. */
469
469
  governance: z.ZodOptional<z.ZodObject<{
@@ -516,8 +516,8 @@ export declare const ContractFileSchema: z.ZodObject<{
516
516
  }>>;
517
517
  }, "strip", z.ZodTypeAny, {
518
518
  flows: {
519
- name: string;
520
519
  steps: string[];
520
+ name: string;
521
521
  }[];
522
522
  testids: string[];
523
523
  signals: string[];
@@ -535,8 +535,8 @@ export declare const ContractFileSchema: z.ZodObject<{
535
535
  } | undefined;
536
536
  }, {
537
537
  flows: {
538
- name: string;
539
538
  steps: string[];
539
+ name: string;
540
540
  }[];
541
541
  testids: string[];
542
542
  signals: string[];
@@ -556,8 +556,8 @@ export declare const ContractFileSchema: z.ZodObject<{
556
556
  }, "strip", z.ZodTypeAny, {
557
557
  capabilities: {
558
558
  flows: {
559
- name: string;
560
559
  steps: string[];
560
+ name: string;
561
561
  }[];
562
562
  testids: string[];
563
563
  signals: string[];
@@ -579,8 +579,8 @@ export declare const ContractFileSchema: z.ZodObject<{
579
579
  }, {
580
580
  capabilities: {
581
581
  flows: {
582
- name: string;
583
582
  steps: string[];
583
+ name: string;
584
584
  }[];
585
585
  testids: string[];
586
586
  signals: string[];
@@ -647,10 +647,10 @@ export declare const RunRecordSchema: z.ZodObject<{
647
647
  }>>;
648
648
  durationMs: z.ZodOptional<z.ZodNumber>;
649
649
  }, "strip", z.ZodTypeAny, {
650
+ kind: "flow_replay" | "manual";
650
651
  status: "pass" | "drift" | "error" | "fail";
651
652
  at: number;
652
653
  name: string;
653
- kind: "flow_replay" | "manual";
654
654
  durationMs?: number | undefined;
655
655
  evidence?: {
656
656
  consoleErrors?: number | undefined;
@@ -659,10 +659,10 @@ export declare const RunRecordSchema: z.ZodObject<{
659
659
  } | undefined;
660
660
  summary?: string | undefined;
661
661
  }, {
662
+ kind: "flow_replay" | "manual";
662
663
  status: "pass" | "drift" | "error" | "fail";
663
664
  at: number;
664
665
  name: string;
665
- kind: "flow_replay" | "manual";
666
666
  durationMs?: number | undefined;
667
667
  evidence?: {
668
668
  consoleErrors?: number | undefined;
@@ -788,10 +788,10 @@ export declare const ProjectFileSchema: z.ZodObject<{
788
788
  }>>;
789
789
  durationMs: z.ZodOptional<z.ZodNumber>;
790
790
  }, "strip", z.ZodTypeAny, {
791
+ kind: "flow_replay" | "manual";
791
792
  status: "pass" | "drift" | "error" | "fail";
792
793
  at: number;
793
794
  name: string;
794
- kind: "flow_replay" | "manual";
795
795
  durationMs?: number | undefined;
796
796
  evidence?: {
797
797
  consoleErrors?: number | undefined;
@@ -800,10 +800,10 @@ export declare const ProjectFileSchema: z.ZodObject<{
800
800
  } | undefined;
801
801
  summary?: string | undefined;
802
802
  }, {
803
+ kind: "flow_replay" | "manual";
803
804
  status: "pass" | "drift" | "error" | "fail";
804
805
  at: number;
805
806
  name: string;
806
- kind: "flow_replay" | "manual";
807
807
  durationMs?: number | undefined;
808
808
  evidence?: {
809
809
  consoleErrors?: number | undefined;
@@ -814,10 +814,10 @@ export declare const ProjectFileSchema: z.ZodObject<{
814
814
  }>, "many">;
815
815
  }, "strip", z.ZodTypeAny, {
816
816
  runs: {
817
+ kind: "flow_replay" | "manual";
817
818
  status: "pass" | "drift" | "error" | "fail";
818
819
  at: number;
819
820
  name: string;
820
- kind: "flow_replay" | "manual";
821
821
  durationMs?: number | undefined;
822
822
  evidence?: {
823
823
  consoleErrors?: number | undefined;
@@ -837,10 +837,10 @@ export declare const ProjectFileSchema: z.ZodObject<{
837
837
  } | undefined;
838
838
  }, {
839
839
  runs: {
840
+ kind: "flow_replay" | "manual";
840
841
  status: "pass" | "drift" | "error" | "fail";
841
842
  at: number;
842
843
  name: string;
843
- kind: "flow_replay" | "manual";
844
844
  durationMs?: number | undefined;
845
845
  evidence?: {
846
846
  consoleErrors?: number | undefined;
@@ -876,22 +876,22 @@ export declare const AnnotationSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObj
876
876
  name: z.ZodString;
877
877
  dataMatches: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
878
878
  }, "strip", z.ZodTypeAny, {
879
- name: string;
880
879
  kind: "assert-signal";
880
+ name: string;
881
881
  dataMatches?: Record<string, unknown> | undefined;
882
882
  }, {
883
- name: string;
884
883
  kind: "assert-signal";
884
+ name: string;
885
885
  dataMatches?: Record<string, unknown> | undefined;
886
886
  }>, z.ZodObject<{
887
887
  kind: z.ZodLiteral<"assert-visible">;
888
888
  testid: z.ZodString;
889
889
  }, "strip", z.ZodTypeAny, {
890
- testid: string;
891
890
  kind: "assert-visible";
892
- }, {
893
891
  testid: string;
892
+ }, {
894
893
  kind: "assert-visible";
894
+ testid: string;
895
895
  }>, z.ZodObject<{
896
896
  kind: z.ZodLiteral<"assert-state">;
897
897
  statePath: z.ZodString;
@@ -945,11 +945,11 @@ export declare const AnnotationSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObj
945
945
  kind: z.ZodLiteral<"mark-dynamic">;
946
946
  testid: z.ZodString;
947
947
  }, "strip", z.ZodTypeAny, {
948
- testid: string;
949
948
  kind: "mark-dynamic";
950
- }, {
951
949
  testid: string;
950
+ }, {
952
951
  kind: "mark-dynamic";
952
+ testid: string;
953
953
  }>, z.ZodObject<{
954
954
  kind: z.ZodLiteral<"success-state">;
955
955
  signal: z.ZodOptional<z.ZodString>;
@@ -1002,52 +1002,52 @@ export declare const AnnotationSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObj
1002
1002
  }>>;
1003
1003
  }, "strip", z.ZodTypeAny, {
1004
1004
  kind: "success-state";
1005
- testid?: string | undefined;
1006
1005
  signal?: string | undefined;
1007
- text?: {
1008
- contains: string;
1009
- visible?: boolean | undefined;
1010
- scope?: string | undefined;
1011
- absent?: boolean | undefined;
1012
- } | undefined;
1013
1006
  net?: {
1014
1007
  status?: number | undefined;
1015
1008
  method?: string | undefined;
1016
1009
  urlContains?: string | undefined;
1017
1010
  count?: number | undefined;
1018
1011
  } | undefined;
1012
+ text?: {
1013
+ contains: string;
1014
+ visible?: boolean | undefined;
1015
+ scope?: string | undefined;
1016
+ absent?: boolean | undefined;
1017
+ } | undefined;
1019
1018
  console?: {
1020
1019
  level?: string | undefined;
1021
1020
  absent?: boolean | undefined;
1022
1021
  } | undefined;
1022
+ testid?: string | undefined;
1023
+ hold?: boolean | undefined;
1023
1024
  store?: string | undefined;
1024
1025
  statePath?: string | undefined;
1025
1026
  equals?: unknown;
1026
- hold?: boolean | undefined;
1027
1027
  }, {
1028
1028
  kind: "success-state";
1029
- testid?: string | undefined;
1030
1029
  signal?: string | undefined;
1031
- text?: {
1032
- contains: string;
1033
- visible?: boolean | undefined;
1034
- scope?: string | undefined;
1035
- absent?: boolean | undefined;
1036
- } | undefined;
1037
1030
  net?: {
1038
1031
  status?: number | undefined;
1039
1032
  method?: string | undefined;
1040
1033
  urlContains?: string | undefined;
1041
1034
  count?: number | undefined;
1042
1035
  } | undefined;
1036
+ text?: {
1037
+ contains: string;
1038
+ visible?: boolean | undefined;
1039
+ scope?: string | undefined;
1040
+ absent?: boolean | undefined;
1041
+ } | undefined;
1043
1042
  console?: {
1044
1043
  level?: string | undefined;
1045
1044
  absent?: boolean | undefined;
1046
1045
  } | undefined;
1046
+ testid?: string | undefined;
1047
+ hold?: boolean | undefined;
1047
1048
  store?: string | undefined;
1048
1049
  statePath?: string | undefined;
1049
1050
  equals?: unknown;
1050
- hold?: boolean | undefined;
1051
1051
  }>, z.ZodObject<{
1052
1052
  kind: z.ZodLiteral<"intent">;
1053
1053
  text: z.ZodString;
@@ -23,6 +23,13 @@ export declare const NoSessionReason: {
23
23
  readonly LEASE_EXPIRED: "lease_expired";
24
24
  /** Connected before; the tab was closed, navigated away, or hard-reloaded. */
25
25
  readonly TAB_GONE: "tab_gone";
26
+ /**
27
+ * Connected before, and the route the tab was on answers 5xx right now. A server error tears the
28
+ * page down and the SDK never reconnects, so it used to read as TAB_GONE — the URL was known, and
29
+ * nothing asked it what it answers. This is the answer, and it outranks TAB_GONE because it is not
30
+ * an absence. Present tense only: a 5xx now is what was observed, not a claim about then.
31
+ */
32
+ readonly ROUTE_SERVER_ERROR: "route_server_error";
26
33
  /** This project has connected before, but not to this daemon run. Usually a restart with no reopen. */
27
34
  readonly APP_NOT_REOPENED: "app_not_reopened";
28
35
  /** A `.reticle.json` exists OUTSIDE this daemon's directory: a scope problem, not an install one. */
@@ -23,6 +23,13 @@ export const NoSessionReason = {
23
23
  LEASE_EXPIRED: 'lease_expired',
24
24
  /** Connected before; the tab was closed, navigated away, or hard-reloaded. */
25
25
  TAB_GONE: 'tab_gone',
26
+ /**
27
+ * Connected before, and the route the tab was on answers 5xx right now. A server error tears the
28
+ * page down and the SDK never reconnects, so it used to read as TAB_GONE — the URL was known, and
29
+ * nothing asked it what it answers. This is the answer, and it outranks TAB_GONE because it is not
30
+ * an absence. Present tense only: a 5xx now is what was observed, not a claim about then.
31
+ */
32
+ ROUTE_SERVER_ERROR: 'route_server_error',
26
33
  /** This project has connected before, but not to this daemon run. Usually a restart with no reopen. */
27
34
  APP_NOT_REOPENED: 'app_not_reopened',
28
35
  /** A `.reticle.json` exists OUTSIDE this daemon's directory: a scope problem, not an install one. */
@@ -42,6 +42,13 @@ export declare const BUFFER_EVICTION_WARNING = "event buffer evicted older event
42
42
  * so the two no-session paths now agree.
43
43
  */
44
44
  export declare const NO_SESSION_CONNECTED_ERROR = "no browser session connected. Two things to check: (1) your app is running with @reticlehq/browser enabled, and (2) it points at THIS daemon's port \u2014 a mismatch between the app's reticle({ port }) / VITE_RETICLE_WS_URL and the daemon's RETICLE_PORT is the usual cause. Call reticle_sessions for the diagnosis \u2014 it names which of these it is, and what to do next \u2014 rather than retrying this call.";
45
+ /**
46
+ * Explains an unconfirmed navigation that did reconnect, but at a different URL.
47
+ *
48
+ * The URL itself is supplied by the navigation result as `landedOn`; this constant keeps the
49
+ * surrounding explanation on the core wire-copy side rather than embedding it in the server tool.
50
+ */
51
+ export declare const NAVIGATION_REDIRECT_NOTE = "The navigation arrived, but the browser landed at a different URL. The app may have redirected the navigation, for example because authentication or another route guard changed the destination.";
45
52
  /** Surfaced on act/assert results when the target tab is throttled. */
46
53
  export declare const THROTTLED_WARNING = "tab throttled; timer/rAF/pointer gestures may silently no-op; refocus before driving";
47
54
  /**
@@ -46,6 +46,13 @@ export const BUFFER_EVICTION_WARNING = 'event buffer evicted older events (age/s
46
46
  * so the two no-session paths now agree.
47
47
  */
48
48
  export const NO_SESSION_CONNECTED_ERROR = "no browser session connected. Two things to check: (1) your app is running with @reticlehq/browser enabled, and (2) it points at THIS daemon's port — a mismatch between the app's reticle({ port }) / VITE_RETICLE_WS_URL and the daemon's RETICLE_PORT is the usual cause. Call reticle_sessions for the diagnosis — it names which of these it is, and what to do next — rather than retrying this call.";
49
+ /**
50
+ * Explains an unconfirmed navigation that did reconnect, but at a different URL.
51
+ *
52
+ * The URL itself is supplied by the navigation result as `landedOn`; this constant keeps the
53
+ * surrounding explanation on the core wire-copy side rather than embedding it in the server tool.
54
+ */
55
+ export const NAVIGATION_REDIRECT_NOTE = 'The navigation arrived, but the browser landed at a different URL. The app may have redirected the navigation, for example because authentication or another route guard changed the destination.';
49
56
  /** Surfaced on act/assert results when the target tab is throttled. */
50
57
  export const THROTTLED_WARNING = 'tab throttled; timer/rAF/pointer gestures may silently no-op; refocus before driving';
51
58
  /**
@@ -55,7 +62,7 @@ export const THROTTLED_WARNING = 'tab throttled; timer/rAF/pointer gestures may
55
62
  * failure. The CLI escape hatch is named second; an MCP-only agent has no shell.
56
63
  */
57
64
  export const THROTTLED_STARVED_NOTE = 'this tab is throttled and has not rendered; a miss here is not evidence the UI is absent. ' +
58
- 'acquire a scriptable context with reticle_run { tool: "reticle_lease", action: "acquire", url } ' +
65
+ 'acquire a scriptable context with reticle_run { tool: "reticle_lease", args: { action: "acquire", url } } ' +
59
66
  '(the human can run `reticle drive <url>` if they have a shell)';
60
67
  /**
61
68
  * Carried by a `console absent` pass whose window starts where the SDK attached.
@@ -141,7 +148,7 @@ export const LEASE_IS_INVISIBLE_NOTE = 'note that a lease is a SEPARATE context:
141
148
  * No `reticle_lease` and no `reticle drive` in this sentence, deliberately. Both are checked by test.
142
149
  */
143
150
  export const DESKTOP_WINDOW_BACKGROUNDED = "this app window is in the background, and a backgrounded webview clamps its timers and rAF — a synthetic action can land on a page that never advances. Bring the app window to the front and retry. A lease is NOT the answer for a desktop app: it opens a browser context, which has none of this app's IPC or commands.";
144
- export const HIDDEN_TAB_RECOMMENDATION = 'tab hidden and may be un-focusable from here; timers and rAF are clamped in a background tab, so an action can land on a page that never advances. Refocus it, or acquire a guaranteed scriptable context yourself with `reticle_run { tool: "reticle_lease", action: "acquire", url }` (a human can equivalently run `reticle drive <url>`) — ' +
151
+ export const HIDDEN_TAB_RECOMMENDATION = 'tab hidden and may be un-focusable from here; timers and rAF are clamped in a background tab, so an action can land on a page that never advances. Refocus it, or acquire a guaranteed scriptable context yourself with `reticle_run { tool: "reticle_lease", args: { action: "acquire", url } }` (a human can equivalently run `reticle drive <url>`) — ' +
145
152
  LEASE_IS_INVISIBLE_NOTE;
146
153
  /**
147
154
  * A tab that is NOT hidden but has gone quiet — the `throttled` flag without `hidden`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reticlehq/core",
3
- "version": "3.3.0",
4
- "description": "The Reticle foundation: the shared wire contract — types, zod schemas, constants, messages, and the isomorphic kernel that every Reticle package (browser SDK, server, kits, test harness) imports. Depends only on zod.",
3
+ "version": "3.5.0",
4
+ "description": "The Reticle foundation: the shared wire contract — types, zod schemas, constants, messages, and the isomorphic kernel that every Reticle package (browser SDK, server, kits, test harness) imports. Depends only on zod and open-verification.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -46,6 +46,7 @@
46
46
  "open-verification": "1.0.0"
47
47
  },
48
48
  "devDependencies": {
49
+ "fast-check": "^4.10.2",
49
50
  "zod-to-json-schema": "^3.24.0"
50
51
  },
51
52
  "license": "Apache-2.0",