@reticlehq/core 2.14.0 → 3.1.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 (143) hide show
  1. package/dist/{artifacts-entry.d.ts → artifacts/artifacts-entry.d.ts} +7 -7
  2. package/dist/{artifacts-entry.js → artifacts/artifacts-entry.js} +7 -7
  3. package/dist/artifacts/flow-composition.d.ts +30 -0
  4. package/dist/artifacts/flow-composition.js +19 -0
  5. package/dist/{flow-constants.d.ts → artifacts/flow-constants.d.ts} +89 -3
  6. package/dist/{flow-constants.js → artifacts/flow-constants.js} +95 -4
  7. package/dist/artifacts/flow-mutation-target.d.ts +39 -0
  8. package/dist/artifacts/flow-mutation-target.js +89 -0
  9. package/dist/artifacts/flow-order.d.ts +30 -0
  10. package/dist/artifacts/flow-order.js +49 -0
  11. package/dist/artifacts/flow-select.d.ts +56 -0
  12. package/dist/artifacts/flow-select.js +56 -0
  13. package/dist/artifacts/flow-step-tool.d.ts +31 -0
  14. package/dist/artifacts/flow-step-tool.js +31 -0
  15. package/dist/artifacts/flow-types.d.ts +3736 -0
  16. package/dist/artifacts/flow-types.js +463 -0
  17. package/dist/artifacts/flow-unreached.d.ts +12 -0
  18. package/dist/artifacts/flow-unreached.js +24 -0
  19. package/dist/{impact.d.ts → artifacts/impact.d.ts} +119 -103
  20. package/dist/{impact.js → artifacts/impact.js} +14 -5
  21. package/dist/{journal.d.ts → artifacts/journal.d.ts} +51 -7
  22. package/dist/{journal.js → artifacts/journal.js} +38 -2
  23. package/dist/artifacts/step-effect.d.ts +29 -0
  24. package/dist/artifacts/step-effect.js +28 -0
  25. package/dist/hooks/hook-events.d.ts +311 -0
  26. package/dist/hooks/hook-events.js +127 -0
  27. package/dist/hooks/hooks-entry.d.ts +9 -0
  28. package/dist/hooks/hooks-entry.js +9 -0
  29. package/dist/{brand.d.ts → identity/brand.d.ts} +7 -0
  30. package/dist/{contract-fingerprint.d.ts → identity/contract-fingerprint.d.ts} +21 -3
  31. package/dist/{contract-fingerprint.js → identity/contract-fingerprint.js} +22 -4
  32. package/dist/{document-identity.d.ts → identity/document-identity.d.ts} +4 -5
  33. package/dist/{document-identity.js → identity/document-identity.js} +4 -5
  34. package/dist/{source-constants.d.ts → identity/source-constants.d.ts} +4 -4
  35. package/dist/{source-constants.js → identity/source-constants.js} +4 -4
  36. package/dist/index.d.ts +56 -43
  37. package/dist/index.js +65 -45
  38. package/dist/onboarding.d.ts +114 -0
  39. package/dist/onboarding.js +141 -0
  40. package/dist/realm/registry.d.ts +212 -0
  41. package/dist/realm/registry.js +302 -0
  42. package/dist/{dev-server-registry.d.ts → registry/dev-server-registry.d.ts} +6 -7
  43. package/dist/{dev-server-registry.js → registry/dev-server-registry.js} +28 -19
  44. package/dist/{project-registry.d.ts → registry/project-registry.d.ts} +5 -5
  45. package/dist/{project-registry.js → registry/project-registry.js} +5 -5
  46. package/dist/schema/command-name.json +31 -0
  47. package/dist/schema/event-payloads.json +791 -0
  48. package/dist/schema/hello-message.json +70 -2
  49. package/dist/schema/reticle-message.json +70 -2
  50. package/dist/telemetry-entry.d.ts +1 -1
  51. package/dist/telemetry-entry.js +1 -1
  52. package/dist/telemetry-feedback.d.ts +15 -16
  53. package/dist/telemetry-feedback.js +11 -12
  54. package/dist/telemetry-license.d.ts +1 -1
  55. package/dist/telemetry-license.js +1 -1
  56. package/dist/telemetry-refusal.d.ts +11 -11
  57. package/dist/telemetry-refusal.js +7 -8
  58. package/dist/telemetry-session.d.ts +51 -59
  59. package/dist/telemetry-session.js +47 -55
  60. package/dist/telemetry.d.ts +243 -214
  61. package/dist/telemetry.js +83 -98
  62. package/dist/tour-entry.d.ts +10 -0
  63. package/dist/tour-entry.js +10 -0
  64. package/dist/tour.d.ts +125 -0
  65. package/dist/tour.js +165 -0
  66. package/dist/{consequence.d.ts → verdict/consequence.d.ts} +32 -15
  67. package/dist/{consequence.js → verdict/consequence.js} +9 -31
  68. package/dist/{finding-fingerprint.js → verdict/finding-fingerprint.js} +1 -1
  69. package/dist/{findings.d.ts → verdict/findings.d.ts} +86 -39
  70. package/dist/{findings.js → verdict/findings.js} +103 -49
  71. package/dist/{instrumentation-gap.d.ts → verdict/instrumentation-gap.d.ts} +7 -14
  72. package/dist/{instrumentation-gap.js → verdict/instrumentation-gap.js} +7 -15
  73. package/dist/{intent.d.ts → verdict/intent.d.ts} +35 -46
  74. package/dist/{intent.js → verdict/intent.js} +11 -22
  75. package/dist/verdict/revision.d.ts +44 -0
  76. package/dist/verdict/revision.js +53 -0
  77. package/dist/{run-context.d.ts → verdict/run-context.d.ts} +13 -34
  78. package/dist/{run-context.js → verdict/run-context.js} +15 -36
  79. package/dist/{security.js → verdict/security.js} +12 -21
  80. package/dist/{verification-run.d.ts → verdict/verification-run.d.ts} +381 -105
  81. package/dist/{verification-run.js → verdict/verification-run.js} +157 -21
  82. package/dist/{verified-constants.d.ts → verdict/verified-constants.d.ts} +25 -13
  83. package/dist/{verified-constants.js → verdict/verified-constants.js} +25 -13
  84. package/dist/{verify-progress.d.ts → verdict/verify-progress.d.ts} +18 -22
  85. package/dist/{verify-progress.js → verdict/verify-progress.js} +6 -10
  86. package/dist/wire/channel.d.ts +46 -0
  87. package/dist/wire/channel.js +95 -0
  88. package/dist/{constants.d.ts → wire/constants/constants.d.ts} +91 -28
  89. package/dist/{constants.js → wire/constants/constants.js} +105 -28
  90. package/dist/{session-constants.d.ts → wire/constants/session-constants.d.ts} +9 -2
  91. package/dist/{session-constants.js → wire/constants/session-constants.js} +9 -2
  92. package/dist/{desktop-contract.js → wire/desktop-contract.js} +1 -1
  93. package/dist/{event-classification.js → wire/event-classification.js} +1 -1
  94. package/dist/{event-payloads.d.ts → wire/event-payloads.d.ts} +68 -13
  95. package/dist/{event-payloads.js → wire/event-payloads.js} +21 -3
  96. package/dist/{event-priority.d.ts → wire/event-priority.d.ts} +1 -4
  97. package/dist/{event-priority.js → wire/event-priority.js} +2 -5
  98. package/dist/{global-press.js → wire/global-press.js} +1 -1
  99. package/dist/{messages.d.ts → wire/messages.d.ts} +239 -48
  100. package/dist/{messages.js → wire/messages.js} +68 -5
  101. package/dist/wire/narrow.d.ts +39 -0
  102. package/dist/wire/narrow.js +45 -0
  103. package/dist/{net.d.ts → wire/net.d.ts} +12 -13
  104. package/dist/{net.js → wire/net.js} +12 -13
  105. package/dist/wire/platform.d.ts +37 -0
  106. package/dist/wire/platform.js +36 -0
  107. package/dist/{redaction.js → wire/redaction.js} +12 -12
  108. package/dist/wire/tool-names.d.ts +133 -0
  109. package/dist/wire/tool-names.js +142 -0
  110. package/dist/{toon.js → wire/toon.js} +1 -1
  111. package/dist/{types.d.ts → wire/types.d.ts} +77 -76
  112. package/dist/{types.js → wire/types.js} +4 -3
  113. package/dist/{no-session-reason.d.ts → words/no-session-reason.d.ts} +7 -3
  114. package/dist/{no-session-reason.js → words/no-session-reason.js} +7 -3
  115. package/dist/{notices.d.ts → words/notices.d.ts} +8 -12
  116. package/dist/{notices.js → words/notices.js} +8 -12
  117. package/package.json +16 -7
  118. package/dist/flow-types.d.ts +0 -1711
  119. package/dist/flow-types.js +0 -247
  120. package/dist/{impact-savings.d.ts → artifacts/impact-savings.d.ts} +0 -0
  121. package/dist/{impact-savings.js → artifacts/impact-savings.js} +0 -0
  122. package/dist/{brand.js → identity/brand.js} +0 -0
  123. package/dist/{edit-epoch.d.ts → identity/edit-epoch.d.ts} +0 -0
  124. package/dist/{edit-epoch.js → identity/edit-epoch.js} +0 -0
  125. package/dist/{project-id.d.ts → identity/project-id.d.ts} +0 -0
  126. package/dist/{project-id.js → identity/project-id.js} +0 -0
  127. package/dist/{daemon-registry.d.ts → registry/daemon-registry.d.ts} +0 -0
  128. package/dist/{daemon-registry.js → registry/daemon-registry.js} +0 -0
  129. package/dist/{finding-fingerprint.d.ts → verdict/finding-fingerprint.d.ts} +0 -0
  130. package/dist/{security.d.ts → verdict/security.d.ts} +0 -0
  131. package/dist/{desktop-contract.d.ts → wire/desktop-contract.d.ts} +0 -0
  132. package/dist/{event-classification.d.ts → wire/event-classification.d.ts} +0 -0
  133. package/dist/{global-press.d.ts → wire/global-press.d.ts} +0 -0
  134. package/dist/{redaction.d.ts → wire/redaction.d.ts} +0 -0
  135. package/dist/{state-select.d.ts → wire/state-select.d.ts} +0 -0
  136. package/dist/{state-select.js → wire/state-select.js} +0 -0
  137. package/dist/{toon.d.ts → wire/toon.d.ts} +0 -0
  138. package/dist/{browser-misdirect.d.ts → words/browser-misdirect.d.ts} +0 -0
  139. package/dist/{browser-misdirect.js → words/browser-misdirect.js} +0 -0
  140. package/dist/{unreachable-notice.d.ts → words/unreachable-notice.d.ts} +0 -0
  141. package/dist/{unreachable-notice.js → words/unreachable-notice.js} +0 -0
  142. package/dist/{upgrade.d.ts → words/upgrade.d.ts} +2 -2
  143. /package/dist/{upgrade.js → words/upgrade.js} +0 -0
@@ -1,247 +0,0 @@
1
- import { z } from 'zod';
2
- import { ActionType, AnchorKind, FLOW_FILE_VERSION, } from './constants.js';
3
- /**
4
- * The MCP tool names that can appear as a recorded flow step's `tool`. These are the ONLY tool names
5
- * that cross the wire into a persisted flow file — the browser recorder stamps them, the server replays
6
- * them, and FlowStep types them — so they live in core, the wire contract. The full agent-facing tool
7
- * surface stays server-side (ReticleTool); ReticleTool references THESE for the flow-persisted three, so
8
- * there is one source of truth and a rename cannot silently desync the recorder from the replayer (a
9
- * tool rename once killed four e2e specs — this closes the browser/server half of that drift).
10
- */
11
- export const FlowStepTool = {
12
- ACT: 'reticle_act',
13
- ACT_SEQUENCE: 'reticle_act_sequence',
14
- ACT_AND_WAIT: 'reticle_act_and_wait',
15
- };
16
- /**
17
- * A semantic anchor: how a step re-finds its element/event at replay
18
- * time. Never a volatile eXX ref. testid/role+name bind a DOM element; signal binds an event.
19
- */
20
- export const FlowAnchorSchema = z.discriminatedUnion('kind', [
21
- // `source` is provenance, not part of how the step re-finds its element — the testid does that.
22
- // It rides along so a failure can say which file to open; optional, so existing flow files parse
23
- // unchanged and FLOW_FILE_VERSION does not move.
24
- z.object({
25
- kind: z.literal(AnchorKind.TESTID),
26
- value: z.string().min(1),
27
- source: z
28
- .object({ file: z.string(), line: z.number(), column: z.number().optional() })
29
- .optional(),
30
- }),
31
- z.object({
32
- kind: z.literal(AnchorKind.ROLE),
33
- role: z.string().min(1),
34
- name: z.string().optional(),
35
- }),
36
- z.object({ kind: z.literal(AnchorKind.SIGNAL), name: z.string().min(1) }),
37
- // Auto-anchor: re-find an element by component identity / source location when it has no testid.
38
- // component or source carries the durable signal; role/name are disambiguating extras.
39
- z.object({
40
- kind: z.literal(AnchorKind.COMPONENT),
41
- component: z.string().optional(),
42
- source: z
43
- .object({ file: z.string(), line: z.number(), column: z.number().optional() })
44
- .optional(),
45
- role: z.string().optional(),
46
- name: z.string().optional(),
47
- }),
48
- ]);
49
- /**
50
- * A post-condition a step asserts (compiled from a structured annotation; optional).
51
- *
52
- * Strict, at every nesting level: an unrecognized key (a typo, or a predicate kind this schema
53
- * doesn't model, e.g. `allOf`, or a typo'd `net`/`console`/`element`/`state` sub-field) must fail
54
- * to parse instead of being silently dropped. A loose z.object() here would quietly discard the
55
- * extra key and leave the step with a weaker (or empty) assertion than its author wrote — the
56
- * flow then replays green against nothing, having proved no real regression.
57
- */
58
- export const FlowExpectSchema = z
59
- .object({
60
- signal: z.string().optional(),
61
- /**
62
- * Optional payload shape an `assert-signal` annotation requires the signal
63
- * to match (the predicate DSL's signal.dataMatches). Additive/optional — a flow file with a
64
- * bare `signal` still parses, and the on-disk version stays FLOW_FILE_VERSION 1.
65
- */
66
- signalData: z.record(z.unknown()).optional(),
67
- /**
68
- * Exact number of times the signal must have fired — the signal-side twin of `net.count`, and the
69
- * only way a saved flow can keep a cardinality the agent actually asserted. Without it a
70
- * `count: 1` drive would be recorded as bare presence, which is a strictly WEAKER claim than the
71
- * one made: the replayed flow then goes green on the double-fire it was recorded to catch.
72
- * Additive/optional — a flow file with a bare `signal` still parses, and FLOW_FILE_VERSION stays 1.
73
- */
74
- signalCount: z.number().int().nonnegative().optional(),
75
- net: z
76
- .object({
77
- method: z.string().optional(),
78
- urlContains: z.string().optional(),
79
- status: z.number().optional(),
80
- /**
81
- * Exact number of matching requests since the action — turns presence into a cardinality
82
- * assertion. Catches the double-submit / useEffect-double-fire / retry-storm regression class:
83
- * the request fired (presence passes) but fired the WRONG number of times. Omit = presence (≥1).
84
- */
85
- count: z.number().int().nonnegative().optional(),
86
- })
87
- .strict()
88
- .optional(),
89
- /**
90
- * Console golden end-condition: assert the action logged (or, with absent:true, did NOT log) a
91
- * console message at `level` (default 'error'). `absent:true` is the common case — "the action
92
- * completed with a clean console" — catching the regression where an action throws a caught error
93
- * / logs an uncaught rejection while the UI still renders fine (a presence check passes it).
94
- */
95
- console: z
96
- .object({
97
- level: z.string().optional(),
98
- absent: z.boolean().optional(),
99
- })
100
- .strict()
101
- .optional(),
102
- element: z
103
- .object({
104
- testid: z.string().optional(),
105
- role: z.string().optional(),
106
- name: z.string().optional(),
107
- })
108
- .strict()
109
- .optional(),
110
- /**
111
- * Rendered text as an end-condition, using the shapes the assert surface already accepts.
112
- *
113
- * The gap this closes: an app with no testids, no `reticle.signal`, no registrable store and no
114
- * network call on the interaction under test -- a discount price computed and rendered, a
115
- * formatted total, a derived label -- could not produce an asserted flow AT ALL. Everything the
116
- * vocabulary offered needed a channel that app does not have, so the only honest outcome was
117
- * `assertion-free`, which is a permanent green (#811).
118
- *
119
- * Derived-DOM rendering is a large share of what actually breaks in a UI, and it was the share
120
- * that could not be pinned.
121
- *
122
- * Classified PRESENCE, not consequence, and that is not a technicality: text is read from the
123
- * DOM, so a locator healed to the wrong element can still satisfy it. It earns `presence-only`,
124
- * which is a real grade above `assertion-free` and honestly below `signal`/`net`/`state`.
125
- */
126
- text: z
127
- .object({
128
- contains: z.string().min(1),
129
- /** Narrow the search to a container, exactly as the `text` predicate's `scope` does. */
130
- scope: z.string().optional(),
131
- /** Assert the text is GONE — the regression check for a cleared error or a dismissed toast. */
132
- absent: z.boolean().optional(),
133
- /** Require the match to be visible, not merely present in the DOM. */
134
- visible: z.boolean().optional(),
135
- })
136
- .strict()
137
- .optional(),
138
- /**
139
- * Assert a registered store's value — the source of truth no DOM/network read can reach. Compiles
140
- * to the predicate engine's `state` predicate. Additive/optional — a flow without it still parses
141
- * and the on-disk version stays FLOW_FILE_VERSION 1. `equals` accepts a literal, omitted = presence,
142
- * or a `{ $gte | $contains | $length }` operator pattern.
143
- */
144
- state: z
145
- .object({
146
- store: z.string().optional(),
147
- path: z.string(),
148
- equals: z.unknown().optional(),
149
- /**
150
- * Treat this as an INVARIANT that must still hold AFTER the action settles, rather than a
151
- * condition to wait for. Set it for a blast-radius check ("this unrelated path must NOT have
152
- * moved") — without it a wait-until-true read passes before an over-reaching side-effect lands.
153
- */
154
- hold: z.boolean().optional(),
155
- })
156
- .strict()
157
- .optional(),
158
- })
159
- .strict();
160
- const baseFlowStep = z.object({
161
- tool: z.string(),
162
- anchor: FlowAnchorSchema,
163
- action: z.nativeEnum(ActionType).optional(),
164
- args: z.record(z.unknown()).optional(),
165
- expect: FlowExpectSchema.optional(),
166
- degraded: z.boolean().optional(),
167
- timeoutMs: z.number().int().positive().optional(),
168
- });
169
- export const FlowStepSchema = baseFlowStep.extend({
170
- steps: z.lazy(() => z.array(FlowStepSchema).optional()),
171
- });
172
- /**
173
- * The on-disk flow file: diffable, git-tracked, anchor-resolved.
174
- * The optional `dynamic` field (both `dynamic` + `success` are optional, so a
175
- * file with neither still parses — back-compat is locked by a test).
176
- */
177
- export const FlowFileSchema = z.object({
178
- version: z.literal(FLOW_FILE_VERSION),
179
- name: z.string(),
180
- /**
181
- * The business goal this flow exists to verify, one line (e.g. "ship a deploy to production").
182
- * Optional + back-compat (a flow without it still parses). Set via an `intent` annotation. The
183
- * point of "intent + outcome oracle": a flow that declares an intent should also assert an
184
- * observable business OUTCOME (a consequence success-state), or it claims to verify a goal it
185
- * cannot actually check — flow-classify flags that gap.
186
- */
187
- intent: z.string().optional(),
188
- /**
189
- * The intent-ledger row this flow discharges — the id in `.reticle/intent.json`.
190
- *
191
- * `intent` above is the prose a recorder captured; this is the LINK to the ledger that already
192
- * models declared → bound → proved and records which verdict discharged what. Without it there
193
- * would be two ways to say what a change is for, which is the defect this codebase keeps paying
194
- * for: a flow's goal and an intent's statement would drift apart with nothing to reconcile them.
195
- *
196
- * Set at save time from the flow's own prose, or written by hand to point a flow at an intent
197
- * declared earlier via `reticle_intent` — a flow can prove something somebody else declared.
198
- * Optional + back-compat: a flow without it replays exactly as before, and the on-disk version
199
- * stays FLOW_FILE_VERSION 1.
200
- */
201
- intentId: z.string().optional(),
202
- /**
203
- * The project the flow was recorded against (the connecting session's HELLO `projectId`), stamped at
204
- * save time. Scopes a flow to its app so a shared daemon's HUD lists only the current project's flows
205
- * instead of every project that ever saved to that daemon. Optional + back-compat: a flow with no
206
- * projectId is treated as global (visible everywhere), so pre-existing files parse and still show.
207
- */
208
- projectId: z.string().optional(),
209
- /**
210
- * The route (pathname) the journey started on, captured at record time. Replay navigates here
211
- * before step 1 so a flow whose first anchor lives on another page doesn't drift on step 1 ("a
212
- * step no longer matches") just because replay began on the wrong page. Optional + back-compat: a
213
- * flow without it (or recorded before this shipped) replays from the current page as before, and
214
- * the on-disk version stays FLOW_FILE_VERSION 1.
215
- */
216
- startPath: z.string().optional(),
217
- // FUTURE: fixtures/preconditions — schema slot reserved, unpopulated this cut. The recorder
218
- // never writes it and no fixture runner exists.
219
- fixture: z.string().optional(),
220
- /** From the injected clock (ms) — deterministic in tests, byte-stable on disk. */
221
- createdAt: z.number(),
222
- steps: z.array(FlowStepSchema),
223
- /**
224
- * How long every step of this flow waits for its declared consequence, in ms. A step's own
225
- * `timeoutMs` wins over it; absent both, FLOW_SIGNAL_TIMEOUT_MS applies.
226
- *
227
- * Flow-level because slowness is usually a property of the APP, not of one control — a remote
228
- * database, a model-backed endpoint, a cold container. Optional + back-compat: a flow without it
229
- * replays exactly as before and the on-disk version stays FLOW_FILE_VERSION 1.
230
- */
231
- signalTimeoutMs: z.number().int().positive().optional(),
232
- success: FlowExpectSchema.optional(),
233
- /**
234
- * Anchors whose CONTENT must not be asserted (e.g. LLM output). Replay asserts
235
- * presence, not words. Compiled from a `mark-dynamic` annotation.
236
- */
237
- dynamic: z.array(FlowAnchorSchema).optional(),
238
- });
239
- /**
240
- * The in-page → wire payload for a finished human recording. The browser
241
- * compiles captured interactions into a FlowFile-shaped object (resolving semantic anchors at
242
- * capture time) and emits it as ONE EventType.FLOW_RECORDED event; the server persists it.
243
- */
244
- export const RecordedFlowSchema = z.object({
245
- name: z.string(),
246
- flow: FlowFileSchema,
247
- });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -70,13 +70,13 @@ export declare const UpgradeHintSchema: z.ZodObject<{
70
70
  unlockedBy: z.ZodString;
71
71
  learnMoreUrl: z.ZodString;
72
72
  }, "strip", z.ZodTypeAny, {
73
- capability: "share_proof" | "run_history" | "team_review" | "corpus_heal" | "ci_gate" | "hosted_runner";
74
73
  reason: string;
74
+ capability: "share_proof" | "run_history" | "team_review" | "corpus_heal" | "ci_gate" | "hosted_runner";
75
75
  unlockedBy: string;
76
76
  learnMoreUrl: string;
77
77
  }, {
78
- capability: "share_proof" | "run_history" | "team_review" | "corpus_heal" | "ci_gate" | "hosted_runner";
79
78
  reason: string;
79
+ capability: "share_proof" | "run_history" | "team_review" | "corpus_heal" | "ci_gate" | "hosted_runner";
80
80
  unlockedBy: string;
81
81
  learnMoreUrl: string;
82
82
  }>;
File without changes