@reticlehq/core 2.13.1 → 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 (147) hide show
  1. package/dist/artifacts/artifacts-entry.d.ts +20 -0
  2. package/dist/artifacts/artifacts-entry.js +20 -0
  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} +97 -3
  6. package/dist/{flow-constants.js → artifacts/flow-constants.js} +103 -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-savings.d.ts → artifacts/impact-savings.d.ts} +7 -3
  20. package/dist/{impact-savings.js → artifacts/impact-savings.js} +27 -4
  21. package/dist/{impact.d.ts → artifacts/impact.d.ts} +122 -54
  22. package/dist/{impact.js → artifacts/impact.js} +30 -0
  23. package/dist/{journal.d.ts → artifacts/journal.d.ts} +50 -6
  24. package/dist/{journal.js → artifacts/journal.js} +38 -2
  25. package/dist/artifacts/step-effect.d.ts +29 -0
  26. package/dist/artifacts/step-effect.js +28 -0
  27. package/dist/hooks/hook-events.d.ts +311 -0
  28. package/dist/hooks/hook-events.js +127 -0
  29. package/dist/hooks/hooks-entry.d.ts +9 -0
  30. package/dist/hooks/hooks-entry.js +9 -0
  31. package/dist/{brand.d.ts → identity/brand.d.ts} +7 -0
  32. package/dist/{contract-fingerprint.d.ts → identity/contract-fingerprint.d.ts} +21 -3
  33. package/dist/{contract-fingerprint.js → identity/contract-fingerprint.js} +22 -4
  34. package/dist/{document-identity.d.ts → identity/document-identity.d.ts} +4 -5
  35. package/dist/{document-identity.js → identity/document-identity.js} +4 -5
  36. package/dist/{source-constants.d.ts → identity/source-constants.d.ts} +4 -4
  37. package/dist/{source-constants.js → identity/source-constants.js} +4 -4
  38. package/dist/index.d.ts +69 -42
  39. package/dist/index.js +78 -44
  40. package/dist/onboarding.d.ts +114 -0
  41. package/dist/onboarding.js +141 -0
  42. package/dist/realm/registry.d.ts +212 -0
  43. package/dist/realm/registry.js +302 -0
  44. package/dist/{dev-server-registry.d.ts → registry/dev-server-registry.d.ts} +4 -5
  45. package/dist/{dev-server-registry.js → registry/dev-server-registry.js} +28 -19
  46. package/dist/{project-registry.d.ts → registry/project-registry.d.ts} +5 -5
  47. package/dist/{project-registry.js → registry/project-registry.js} +5 -5
  48. package/dist/schema/command-name.json +31 -0
  49. package/dist/schema/event-message.json +1 -0
  50. package/dist/schema/event-payloads.json +791 -0
  51. package/dist/schema/event-type.json +1 -0
  52. package/dist/schema/hello-message.json +76 -2
  53. package/dist/schema/reticle-event.json +1 -0
  54. package/dist/schema/reticle-message.json +77 -2
  55. package/dist/telemetry-entry.d.ts +15 -0
  56. package/dist/telemetry-entry.js +15 -0
  57. package/dist/telemetry-feedback.d.ts +13 -14
  58. package/dist/telemetry-feedback.js +11 -12
  59. package/dist/telemetry-license.d.ts +1 -1
  60. package/dist/telemetry-license.js +1 -1
  61. package/dist/telemetry-refusal.d.ts +11 -11
  62. package/dist/telemetry-refusal.js +7 -8
  63. package/dist/telemetry-session.d.ts +49 -57
  64. package/dist/telemetry-session.js +47 -55
  65. package/dist/telemetry.d.ts +229 -198
  66. package/dist/telemetry.js +83 -98
  67. package/dist/tour-entry.d.ts +10 -0
  68. package/dist/tour-entry.js +10 -0
  69. package/dist/tour.d.ts +125 -0
  70. package/dist/tour.js +165 -0
  71. package/dist/{consequence.d.ts → verdict/consequence.d.ts} +35 -11
  72. package/dist/{consequence.js → verdict/consequence.js} +9 -22
  73. package/dist/{finding-fingerprint.js → verdict/finding-fingerprint.js} +1 -1
  74. package/dist/{findings.d.ts → verdict/findings.d.ts} +149 -41
  75. package/dist/{findings.js → verdict/findings.js} +169 -48
  76. package/dist/{instrumentation-gap.d.ts → verdict/instrumentation-gap.d.ts} +22 -14
  77. package/dist/{instrumentation-gap.js → verdict/instrumentation-gap.js} +23 -15
  78. package/dist/{intent.d.ts → verdict/intent.d.ts} +41 -52
  79. package/dist/{intent.js → verdict/intent.js} +11 -22
  80. package/dist/verdict/revision.d.ts +44 -0
  81. package/dist/verdict/revision.js +53 -0
  82. package/dist/{run-context.d.ts → verdict/run-context.d.ts} +13 -34
  83. package/dist/{run-context.js → verdict/run-context.js} +15 -36
  84. package/dist/{security.js → verdict/security.js} +12 -21
  85. package/dist/{verification-run.d.ts → verdict/verification-run.d.ts} +369 -93
  86. package/dist/{verification-run.js → verdict/verification-run.js} +157 -21
  87. package/dist/{verified-constants.d.ts → verdict/verified-constants.d.ts} +36 -13
  88. package/dist/{verified-constants.js → verdict/verified-constants.js} +36 -13
  89. package/dist/verdict/verify-progress.d.ts +129 -0
  90. package/dist/verdict/verify-progress.js +74 -0
  91. package/dist/wire/channel.d.ts +46 -0
  92. package/dist/wire/channel.js +95 -0
  93. package/dist/{constants.d.ts → wire/constants/constants.d.ts} +124 -28
  94. package/dist/{constants.js → wire/constants/constants.js} +137 -28
  95. package/dist/{session-constants.d.ts → wire/constants/session-constants.d.ts} +9 -2
  96. package/dist/{session-constants.js → wire/constants/session-constants.js} +9 -2
  97. package/dist/{desktop-contract.js → wire/desktop-contract.js} +1 -1
  98. package/dist/{event-classification.js → wire/event-classification.js} +1 -1
  99. package/dist/{event-payloads.d.ts → wire/event-payloads.d.ts} +229 -17
  100. package/dist/{event-payloads.js → wire/event-payloads.js} +61 -3
  101. package/dist/{event-priority.d.ts → wire/event-priority.d.ts} +1 -4
  102. package/dist/{event-priority.js → wire/event-priority.js} +2 -5
  103. package/dist/wire/global-press.d.ts +30 -0
  104. package/dist/wire/global-press.js +54 -0
  105. package/dist/{messages.d.ts → wire/messages.d.ts} +290 -38
  106. package/dist/{messages.js → wire/messages.js} +93 -5
  107. package/dist/wire/narrow.d.ts +39 -0
  108. package/dist/wire/narrow.js +45 -0
  109. package/dist/{net.d.ts → wire/net.d.ts} +49 -10
  110. package/dist/{net.js → wire/net.js} +49 -10
  111. package/dist/wire/platform.d.ts +37 -0
  112. package/dist/wire/platform.js +36 -0
  113. package/dist/{redaction.d.ts → wire/redaction.d.ts} +30 -0
  114. package/dist/wire/redaction.js +274 -0
  115. package/dist/wire/tool-names.d.ts +133 -0
  116. package/dist/wire/tool-names.js +142 -0
  117. package/dist/{toon.js → wire/toon.js} +1 -1
  118. package/dist/{types.d.ts → wire/types.d.ts} +106 -66
  119. package/dist/{types.js → wire/types.js} +24 -4
  120. package/dist/{no-session-reason.d.ts → words/no-session-reason.d.ts} +7 -3
  121. package/dist/{no-session-reason.js → words/no-session-reason.js} +7 -3
  122. package/dist/{notices.d.ts → words/notices.d.ts} +24 -12
  123. package/dist/{notices.js → words/notices.js} +27 -12
  124. package/package.json +22 -5
  125. package/dist/flow-types.d.ts +0 -1473
  126. package/dist/flow-types.js +0 -195
  127. package/dist/redaction.js +0 -149
  128. /package/dist/{brand.js → identity/brand.js} +0 -0
  129. /package/dist/{edit-epoch.d.ts → identity/edit-epoch.d.ts} +0 -0
  130. /package/dist/{edit-epoch.js → identity/edit-epoch.js} +0 -0
  131. /package/dist/{project-id.d.ts → identity/project-id.d.ts} +0 -0
  132. /package/dist/{project-id.js → identity/project-id.js} +0 -0
  133. /package/dist/{daemon-registry.d.ts → registry/daemon-registry.d.ts} +0 -0
  134. /package/dist/{daemon-registry.js → registry/daemon-registry.js} +0 -0
  135. /package/dist/{finding-fingerprint.d.ts → verdict/finding-fingerprint.d.ts} +0 -0
  136. /package/dist/{security.d.ts → verdict/security.d.ts} +0 -0
  137. /package/dist/{desktop-contract.d.ts → wire/desktop-contract.d.ts} +0 -0
  138. /package/dist/{event-classification.d.ts → wire/event-classification.d.ts} +0 -0
  139. /package/dist/{state-select.d.ts → wire/state-select.d.ts} +0 -0
  140. /package/dist/{state-select.js → wire/state-select.js} +0 -0
  141. /package/dist/{toon.d.ts → wire/toon.d.ts} +0 -0
  142. /package/dist/{browser-misdirect.d.ts → words/browser-misdirect.d.ts} +0 -0
  143. /package/dist/{browser-misdirect.js → words/browser-misdirect.js} +0 -0
  144. /package/dist/{unreachable-notice.d.ts → words/unreachable-notice.d.ts} +0 -0
  145. /package/dist/{unreachable-notice.js → words/unreachable-notice.js} +0 -0
  146. /package/dist/{upgrade.d.ts → words/upgrade.d.ts} +0 -0
  147. /package/dist/{upgrade.js → words/upgrade.js} +0 -0
@@ -1,1473 +0,0 @@
1
- import { z } from 'zod';
2
- import { ActionType, type DriftReason, type HealStatus, type ReplayStatus } 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 declare const FlowStepTool: {
12
- readonly ACT: "reticle_act";
13
- readonly ACT_SEQUENCE: "reticle_act_sequence";
14
- readonly ACT_AND_WAIT: "reticle_act_and_wait";
15
- };
16
- export type FlowStepTool = (typeof FlowStepTool)[keyof typeof FlowStepTool];
17
- /**
18
- * A semantic anchor: how a step re-finds its element/event at replay
19
- * time. Never a volatile eXX ref. testid/role+name bind a DOM element; signal binds an event.
20
- */
21
- export declare const FlowAnchorSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
22
- kind: z.ZodLiteral<"testid">;
23
- value: z.ZodString;
24
- source: z.ZodOptional<z.ZodObject<{
25
- file: z.ZodString;
26
- line: z.ZodNumber;
27
- column: z.ZodOptional<z.ZodNumber>;
28
- }, "strip", z.ZodTypeAny, {
29
- file: string;
30
- line: number;
31
- column?: number | undefined;
32
- }, {
33
- file: string;
34
- line: number;
35
- column?: number | undefined;
36
- }>>;
37
- }, "strip", z.ZodTypeAny, {
38
- kind: "testid";
39
- value: string;
40
- source?: {
41
- file: string;
42
- line: number;
43
- column?: number | undefined;
44
- } | undefined;
45
- }, {
46
- kind: "testid";
47
- value: string;
48
- source?: {
49
- file: string;
50
- line: number;
51
- column?: number | undefined;
52
- } | undefined;
53
- }>, z.ZodObject<{
54
- kind: z.ZodLiteral<"role">;
55
- role: z.ZodString;
56
- name: z.ZodOptional<z.ZodString>;
57
- }, "strip", z.ZodTypeAny, {
58
- role: string;
59
- kind: "role";
60
- name?: string | undefined;
61
- }, {
62
- role: string;
63
- kind: "role";
64
- name?: string | undefined;
65
- }>, z.ZodObject<{
66
- kind: z.ZodLiteral<"signal">;
67
- name: z.ZodString;
68
- }, "strip", z.ZodTypeAny, {
69
- kind: "signal";
70
- name: string;
71
- }, {
72
- kind: "signal";
73
- name: string;
74
- }>, z.ZodObject<{
75
- kind: z.ZodLiteral<"component">;
76
- component: z.ZodOptional<z.ZodString>;
77
- source: z.ZodOptional<z.ZodObject<{
78
- file: z.ZodString;
79
- line: z.ZodNumber;
80
- column: z.ZodOptional<z.ZodNumber>;
81
- }, "strip", z.ZodTypeAny, {
82
- file: string;
83
- line: number;
84
- column?: number | undefined;
85
- }, {
86
- file: string;
87
- line: number;
88
- column?: number | undefined;
89
- }>>;
90
- role: z.ZodOptional<z.ZodString>;
91
- name: z.ZodOptional<z.ZodString>;
92
- }, "strip", z.ZodTypeAny, {
93
- kind: "component";
94
- role?: string | undefined;
95
- component?: string | undefined;
96
- source?: {
97
- file: string;
98
- line: number;
99
- column?: number | undefined;
100
- } | undefined;
101
- name?: string | undefined;
102
- }, {
103
- kind: "component";
104
- role?: string | undefined;
105
- component?: string | undefined;
106
- source?: {
107
- file: string;
108
- line: number;
109
- column?: number | undefined;
110
- } | undefined;
111
- name?: string | undefined;
112
- }>]>;
113
- export type FlowAnchor = z.infer<typeof FlowAnchorSchema>;
114
- /** A post-condition a step asserts (compiled from a structured annotation; optional). */
115
- export declare const FlowExpectSchema: z.ZodObject<{
116
- signal: z.ZodOptional<z.ZodString>;
117
- /**
118
- * Optional payload shape an `assert-signal` annotation requires the signal
119
- * to match (the predicate DSL's signal.dataMatches). Additive/optional — a flow file with a
120
- * bare `signal` still parses, and the on-disk version stays FLOW_FILE_VERSION 1.
121
- */
122
- signalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
123
- /**
124
- * Exact number of times the signal must have fired — the signal-side twin of `net.count`, and the
125
- * only way a saved flow can keep a cardinality the agent actually asserted. Without it a
126
- * `count: 1` drive would be recorded as bare presence, which is a strictly WEAKER claim than the
127
- * one made: the replayed flow then goes green on the double-fire it was recorded to catch.
128
- * Additive/optional — a flow file with a bare `signal` still parses, and FLOW_FILE_VERSION stays 1.
129
- */
130
- signalCount: z.ZodOptional<z.ZodNumber>;
131
- net: z.ZodOptional<z.ZodObject<{
132
- method: z.ZodOptional<z.ZodString>;
133
- urlContains: z.ZodOptional<z.ZodString>;
134
- status: z.ZodOptional<z.ZodNumber>;
135
- /**
136
- * Exact number of matching requests since the action — turns presence into a cardinality
137
- * assertion. Catches the double-submit / useEffect-double-fire / retry-storm regression class:
138
- * the request fired (presence passes) but fired the WRONG number of times. Omit = presence (≥1).
139
- */
140
- count: z.ZodOptional<z.ZodNumber>;
141
- }, "strip", z.ZodTypeAny, {
142
- status?: number | undefined;
143
- method?: string | undefined;
144
- count?: number | undefined;
145
- urlContains?: string | undefined;
146
- }, {
147
- status?: number | undefined;
148
- method?: string | undefined;
149
- count?: number | undefined;
150
- urlContains?: string | undefined;
151
- }>>;
152
- /**
153
- * Console golden end-condition: assert the action logged (or, with absent:true, did NOT log) a
154
- * console message at `level` (default 'error'). `absent:true` is the common case — "the action
155
- * completed with a clean console" — catching the regression where an action throws a caught error
156
- * / logs an uncaught rejection while the UI still renders fine (a presence check passes it).
157
- */
158
- console: z.ZodOptional<z.ZodObject<{
159
- level: z.ZodOptional<z.ZodString>;
160
- absent: z.ZodOptional<z.ZodBoolean>;
161
- }, "strip", z.ZodTypeAny, {
162
- level?: string | undefined;
163
- absent?: boolean | undefined;
164
- }, {
165
- level?: string | undefined;
166
- absent?: boolean | undefined;
167
- }>>;
168
- element: z.ZodOptional<z.ZodObject<{
169
- testid: z.ZodOptional<z.ZodString>;
170
- role: z.ZodOptional<z.ZodString>;
171
- name: z.ZodOptional<z.ZodString>;
172
- }, "strip", z.ZodTypeAny, {
173
- testid?: string | undefined;
174
- role?: string | undefined;
175
- name?: string | undefined;
176
- }, {
177
- testid?: string | undefined;
178
- role?: string | undefined;
179
- name?: string | undefined;
180
- }>>;
181
- /**
182
- * Assert a registered store's value — the source of truth no DOM/network read can reach. Compiles
183
- * to the predicate engine's `state` predicate. Additive/optional — a flow without it still parses
184
- * and the on-disk version stays FLOW_FILE_VERSION 1. `equals` accepts a literal, omitted = presence,
185
- * or a `{ $gte | $contains | $length }` operator pattern.
186
- */
187
- state: z.ZodOptional<z.ZodObject<{
188
- store: z.ZodOptional<z.ZodString>;
189
- path: z.ZodString;
190
- equals: z.ZodOptional<z.ZodUnknown>;
191
- /**
192
- * Treat this as an INVARIANT that must still hold AFTER the action settles, rather than a
193
- * condition to wait for. Set it for a blast-radius check ("this unrelated path must NOT have
194
- * moved") — without it a wait-until-true read passes before an over-reaching side-effect lands.
195
- */
196
- hold: z.ZodOptional<z.ZodBoolean>;
197
- }, "strip", z.ZodTypeAny, {
198
- path: string;
199
- store?: string | undefined;
200
- equals?: unknown;
201
- hold?: boolean | undefined;
202
- }, {
203
- path: string;
204
- store?: string | undefined;
205
- equals?: unknown;
206
- hold?: boolean | undefined;
207
- }>>;
208
- }, "strip", z.ZodTypeAny, {
209
- signal?: string | undefined;
210
- signalData?: Record<string, unknown> | undefined;
211
- signalCount?: number | undefined;
212
- net?: {
213
- status?: number | undefined;
214
- method?: string | undefined;
215
- count?: number | undefined;
216
- urlContains?: string | undefined;
217
- } | undefined;
218
- console?: {
219
- level?: string | undefined;
220
- absent?: boolean | undefined;
221
- } | undefined;
222
- element?: {
223
- testid?: string | undefined;
224
- role?: string | undefined;
225
- name?: string | undefined;
226
- } | undefined;
227
- state?: {
228
- path: string;
229
- store?: string | undefined;
230
- equals?: unknown;
231
- hold?: boolean | undefined;
232
- } | undefined;
233
- }, {
234
- signal?: string | undefined;
235
- signalData?: Record<string, unknown> | undefined;
236
- signalCount?: number | undefined;
237
- net?: {
238
- status?: number | undefined;
239
- method?: string | undefined;
240
- count?: number | undefined;
241
- urlContains?: string | undefined;
242
- } | undefined;
243
- console?: {
244
- level?: string | undefined;
245
- absent?: boolean | undefined;
246
- } | undefined;
247
- element?: {
248
- testid?: string | undefined;
249
- role?: string | undefined;
250
- name?: string | undefined;
251
- } | undefined;
252
- state?: {
253
- path: string;
254
- store?: string | undefined;
255
- equals?: unknown;
256
- hold?: boolean | undefined;
257
- } | undefined;
258
- }>;
259
- export type FlowExpect = z.infer<typeof FlowExpectSchema>;
260
- /** One step of a flow: an anchored action (+ optional expectation). */
261
- export interface FlowStep {
262
- /** FlowStepTool.ACT | FlowStepTool.ACT_SEQUENCE (core, shared with ReticleTool). */
263
- tool: string;
264
- anchor: FlowAnchor;
265
- action?: ActionType;
266
- args?: Record<string, unknown>;
267
- expect?: FlowExpect;
268
- /** true when the anchor is best-effort (no testid was resolvable at record time). NOT dropped. */
269
- degraded?: boolean;
270
- /** sub-steps for an act_sequence, each independently anchored. */
271
- steps?: FlowStep[];
272
- }
273
- export declare const FlowStepSchema: z.ZodType<FlowStep>;
274
- /**
275
- * A legible-drift record returned when an anchor misses at replay.
276
- * The "whose fault is it" payload: what was expected, why it's gone, and the closest surviving
277
- * anchor (a concrete fix suggestion). Never a bare "command failed".
278
- */
279
- export interface Drift {
280
- /** Named reason kind (testid not found / signal not observed). */
281
- reasonKind: DriftReason;
282
- /** Human sentence, e.g. `testid "chat-send" not found`. */
283
- reason: string;
284
- /** The missed anchor value (the testid string, or the signal name). */
285
- anchor: string;
286
- /** Closest present testid via the live near-miss; null only when the page has no testids (or signal drift). */
287
- nearest: string | null;
288
- /**
289
- * True when two or more present testids tie at the minimum edit distance, so `nearest` is an
290
- * arbitrary pick. An ambiguous drift is NEVER auto-healed (a wrong rebind ships a bug green) —
291
- * it is surfaced for a human/agent to choose. Absent ⇒ unambiguous.
292
- */
293
- ambiguous?: boolean;
294
- }
295
- /** The per-step result of re-resolving + running one anchored step. */
296
- export interface FlowStepResult {
297
- /** 0-based index of this step in the flow. */
298
- step: number;
299
- /** The tool the step runs — FlowStepTool.ACT | ACT_SEQUENCE (core). */
300
- tool: string;
301
- /** The testid/signal value the step is bound to (the re-resolved anchor). */
302
- anchor: string;
303
- /**
304
- * The route (pathname) the page was on when this step ran — the "which page" of the journey.
305
- * Additive/optional: present when a route is observable, absent in route-less contexts (e.g. a
306
- * fake session with no route events). Lets a replay result read as a page-by-page journey.
307
- */
308
- page?: string;
309
- /**
310
- * A compact summary of the observable CONSEQUENCE in the window right after this step ran — the
311
- * "what happened" of the journey: a route change, a domain signal (e.g. a modal opening), a
312
- * network call, or console errors. Additive/optional and intentionally terse (token-cheap). It
313
- * captures what had landed by the time the action settled, so a very-late async effect may not
314
- * appear; the asserted consequence (expect/success) is the authoritative pass/fail signal.
315
- */
316
- consequence?: string;
317
- /**
318
- * Wall-clock ms this step took (dispatch → post-settle), from the session's injected elapsed clock.
319
- * Additive/optional: absent in contexts with no advancing clock. Feeds per-step run-to-run perf diffs.
320
- */
321
- durationMs?: number;
322
- ok: boolean;
323
- error?: string;
324
- note?: string;
325
- /** Present iff this step stopped on an anchor miss. */
326
- drift?: Drift;
327
- /**
328
- * A confidence-scored nearest-match rebind for this drifted step (additive,
329
- * optional). Set only for a confident testid drift.
330
- */
331
- proposal?: HealProposal;
332
- }
333
- /**
334
- * The autonomy decision envelope — the feedback a human used to give, made machine-actionable. From
335
- * a replay result it states the verdict, what changed, WHERE in the source to look (file:line, from a
336
- * component anchor), a suggested fix, and the single next action — so a coding agent decides its next
337
- * move without a human in the loop. Terse by design (token-cheap).
338
- */
339
- export interface ReplayDecision {
340
- /** pass = intent held; drift = a locator/anchor missed; fail = an action or the success oracle failed. */
341
- verdict: 'pass' | 'drift' | 'fail';
342
- /** One-line human/agent summary of the outcome. */
343
- summary: string;
344
- /** What regressed (the drift reason or failure), when not a pass. */
345
- whatChanged?: string;
346
- /** Where to look — `file:line` from the failing step's source anchor, or the page route. */
347
- whereInSource?: string;
348
- /** A concrete fix hint (e.g. rebind to the nearest surviving anchor). */
349
- suggestedFix?: string;
350
- /** The single next action the agent should take. */
351
- nextAction: string;
352
- }
353
- /**
354
- * One flow's line in a suite verdict — pass counts as a name; a failure carries the actionable
355
- * decision fields so the agent can fix it without re-querying.
356
- */
357
- export interface SuiteFlowResult {
358
- flow: string;
359
- /**
360
- * The flow never ran: its file failed to load, or its leased context never came up. Nothing was
361
- * learned about the app, so this row is not a regression — it is Reticle reporting its own failure
362
- * in the same array as the app's. Measured: one sweep emitted 8 `flow-regression` bug_found events
363
- * off rows like these, from a suite where no flow ever executed.
364
- */
365
- couldNotRun?: boolean;
366
- verdict: 'pass' | 'drift' | 'fail';
367
- whatChanged?: string;
368
- whereInSource?: string;
369
- nextAction?: string;
370
- }
371
- /**
372
- * The consolidated verdict of replaying EVERY known flow — the autonomous loop's "did I break
373
- * anything, and what do I fix" answer in one deterministic call. Passing flows are counted; only
374
- * failures carry detail (token-cheap). `status` is fail if any flow drifted or errored.
375
- */
376
- export interface SuiteVerdict {
377
- /**
378
- * `unverifiable` means the suite contained flows that CANNOT FAIL, so "pass" would be a lie.
379
- *
380
- * A recorded flow with no steps, or one that asserts no observable consequence, replays green no
381
- * matter what the app does. Reporting `pass` for it is a false green in the exact feature sold as
382
- * the regression suite — measured: a flow saved as `{steps: [], intent: "..."}`, which `flow_save`
383
- * had ALREADY graded assertion-free with a warning, came back "all 1 flow pass".
384
- */
385
- status: 'pass' | 'fail' | 'unverifiable';
386
- total: number;
387
- passed: number;
388
- failed: number;
389
- summary: string;
390
- /** Only the failing flows, with their decision (verdict, what changed, where, next action). */
391
- failures: SuiteFlowResult[];
392
- /**
393
- * Flows that replayed without error but assert nothing, so their green means nothing. Counted
394
- * apart from `passed` — a number that includes them is not a count of anything verified.
395
- */
396
- unverifiable?: {
397
- flow: string;
398
- reason: string;
399
- }[];
400
- /**
401
- * Flows that have both passed AND failed on UNCHANGED code — intermittent, not regressions.
402
- *
403
- * A flake and a regression demand opposite responses: one is chased, the other is quarantined. The
404
- * ledger that answers this already existed and was written only by the CLI, so an agent replaying a
405
- * suite a hundred times could never learn which of its failures were noise. Omitted entirely when
406
- * the ledger has not seen enough runs to say.
407
- */
408
- flaky?: string[];
409
- }
410
- /** The reticle_flow_replay envelope. */
411
- export interface FlowReplayResult {
412
- name: string;
413
- status: ReplayStatus;
414
- steps: FlowStepResult[];
415
- /** The machine-actionable decision derived from this replay (autonomy layer). */
416
- decision?: ReplayDecision;
417
- /** Set when status === 'error' (load failure or resolved action failure). */
418
- error?: {
419
- code: string;
420
- message: string;
421
- };
422
- /**
423
- * Set on an `ok` replay whose flow cannot fail: it asserts no observable consequence, or has no
424
- * steps at all. The replay genuinely completed, so the status stays `ok` — but a bare `ok` read
425
- * as proof the feature works is exactly the false confidence `flow-risk.ts` argues against, and
426
- * `reticle_flow_verify` already refuses to count these as passes. This carries the same reason,
427
- * from the same function, to the single-flow caller who would otherwise never see it.
428
- */
429
- unverifiable?: {
430
- reason: string;
431
- };
432
- /**
433
- * The confident rebind proposals aggregated across drifted steps (additive,
434
- * optional — present only when at least one drifted step has a confident nearest match).
435
- */
436
- proposals?: HealProposal[];
437
- /**
438
- * The push-default deviation report over this replay's route segments (ranked deviations vs the learned
439
- * envelope, or a fall-back note below N=3 runs). Additive; present when segments were observed.
440
- */
441
- deviation?: unknown;
442
- /**
443
- * What the project already knows about this flow, fetched from shared memory on the agent's
444
- * behalf.
445
- *
446
- * Present only when the project is linked, memory sync is on, and the team has actually captured
447
- * something about this flow. Consulting shared memory used to be a separate act an agent had to
448
- * remember to perform — measured across a real corpus, every subject showed zero reads, not
449
- * because the knowledge was useless but because nothing ever asked for it. A verification that
450
- * asks on the agent's behalf is the difference between memory the platform stores and memory the
451
- * platform uses.
452
- *
453
- * Deliberately additive and deliberately small: a verdict whose own result has been pushed below
454
- * a wall of statements is a worse verdict.
455
- */
456
- knows?: {
457
- statement: string;
458
- status: string;
459
- }[];
460
- }
461
- /**
462
- * The on-disk flow file: diffable, git-tracked, anchor-resolved.
463
- * The optional `dynamic` field (both `dynamic` + `success` are optional, so a
464
- * file with neither still parses — back-compat is locked by a test).
465
- */
466
- export declare const FlowFileSchema: z.ZodObject<{
467
- version: z.ZodLiteral<1>;
468
- name: z.ZodString;
469
- /**
470
- * The business goal this flow exists to verify, one line (e.g. "ship a deploy to production").
471
- * Optional + back-compat (a flow without it still parses). Set via an `intent` annotation. The
472
- * point of "intent + outcome oracle": a flow that declares an intent should also assert an
473
- * observable business OUTCOME (a consequence success-state), or it claims to verify a goal it
474
- * cannot actually check — flow-classify flags that gap.
475
- */
476
- intent: z.ZodOptional<z.ZodString>;
477
- /**
478
- * The intent-ledger row this flow discharges — the id in `.reticle/intent.json`.
479
- *
480
- * `intent` above is the prose a recorder captured; this is the LINK to the ledger that already
481
- * models declared → bound → proved and records which verdict discharged what. Without it there
482
- * would be two ways to say what a change is for, which is the defect this codebase keeps paying
483
- * for: a flow's goal and an intent's statement would drift apart with nothing to reconcile them.
484
- *
485
- * Set at save time from the flow's own prose, or written by hand to point a flow at an intent
486
- * declared earlier via `reticle_intent` — a flow can prove something somebody else declared.
487
- * Optional + back-compat: a flow without it replays exactly as before, and the on-disk version
488
- * stays FLOW_FILE_VERSION 1.
489
- */
490
- intentId: z.ZodOptional<z.ZodString>;
491
- /**
492
- * The project the flow was recorded against (the connecting session's HELLO `projectId`), stamped at
493
- * save time. Scopes a flow to its app so a shared daemon's HUD lists only the current project's flows
494
- * instead of every project that ever saved to that daemon. Optional + back-compat: a flow with no
495
- * projectId is treated as global (visible everywhere), so pre-existing files parse and still show.
496
- */
497
- projectId: z.ZodOptional<z.ZodString>;
498
- /**
499
- * The route (pathname) the journey started on, captured at record time. Replay navigates here
500
- * before step 1 so a flow whose first anchor lives on another page doesn't drift on step 1 ("a
501
- * step no longer matches") just because replay began on the wrong page. Optional + back-compat: a
502
- * flow without it (or recorded before this shipped) replays from the current page as before, and
503
- * the on-disk version stays FLOW_FILE_VERSION 1.
504
- */
505
- startPath: z.ZodOptional<z.ZodString>;
506
- fixture: z.ZodOptional<z.ZodString>;
507
- /** From the injected clock (ms) — deterministic in tests, byte-stable on disk. */
508
- createdAt: z.ZodNumber;
509
- steps: z.ZodArray<z.ZodType<FlowStep, z.ZodTypeDef, FlowStep>, "many">;
510
- success: z.ZodOptional<z.ZodObject<{
511
- signal: z.ZodOptional<z.ZodString>;
512
- /**
513
- * Optional payload shape an `assert-signal` annotation requires the signal
514
- * to match (the predicate DSL's signal.dataMatches). Additive/optional — a flow file with a
515
- * bare `signal` still parses, and the on-disk version stays FLOW_FILE_VERSION 1.
516
- */
517
- signalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
518
- /**
519
- * Exact number of times the signal must have fired — the signal-side twin of `net.count`, and the
520
- * only way a saved flow can keep a cardinality the agent actually asserted. Without it a
521
- * `count: 1` drive would be recorded as bare presence, which is a strictly WEAKER claim than the
522
- * one made: the replayed flow then goes green on the double-fire it was recorded to catch.
523
- * Additive/optional — a flow file with a bare `signal` still parses, and FLOW_FILE_VERSION stays 1.
524
- */
525
- signalCount: z.ZodOptional<z.ZodNumber>;
526
- net: z.ZodOptional<z.ZodObject<{
527
- method: z.ZodOptional<z.ZodString>;
528
- urlContains: z.ZodOptional<z.ZodString>;
529
- status: z.ZodOptional<z.ZodNumber>;
530
- /**
531
- * Exact number of matching requests since the action — turns presence into a cardinality
532
- * assertion. Catches the double-submit / useEffect-double-fire / retry-storm regression class:
533
- * the request fired (presence passes) but fired the WRONG number of times. Omit = presence (≥1).
534
- */
535
- count: z.ZodOptional<z.ZodNumber>;
536
- }, "strip", z.ZodTypeAny, {
537
- status?: number | undefined;
538
- method?: string | undefined;
539
- count?: number | undefined;
540
- urlContains?: string | undefined;
541
- }, {
542
- status?: number | undefined;
543
- method?: string | undefined;
544
- count?: number | undefined;
545
- urlContains?: string | undefined;
546
- }>>;
547
- /**
548
- * Console golden end-condition: assert the action logged (or, with absent:true, did NOT log) a
549
- * console message at `level` (default 'error'). `absent:true` is the common case — "the action
550
- * completed with a clean console" — catching the regression where an action throws a caught error
551
- * / logs an uncaught rejection while the UI still renders fine (a presence check passes it).
552
- */
553
- console: z.ZodOptional<z.ZodObject<{
554
- level: z.ZodOptional<z.ZodString>;
555
- absent: z.ZodOptional<z.ZodBoolean>;
556
- }, "strip", z.ZodTypeAny, {
557
- level?: string | undefined;
558
- absent?: boolean | undefined;
559
- }, {
560
- level?: string | undefined;
561
- absent?: boolean | undefined;
562
- }>>;
563
- element: z.ZodOptional<z.ZodObject<{
564
- testid: z.ZodOptional<z.ZodString>;
565
- role: z.ZodOptional<z.ZodString>;
566
- name: z.ZodOptional<z.ZodString>;
567
- }, "strip", z.ZodTypeAny, {
568
- testid?: string | undefined;
569
- role?: string | undefined;
570
- name?: string | undefined;
571
- }, {
572
- testid?: string | undefined;
573
- role?: string | undefined;
574
- name?: string | undefined;
575
- }>>;
576
- /**
577
- * Assert a registered store's value — the source of truth no DOM/network read can reach. Compiles
578
- * to the predicate engine's `state` predicate. Additive/optional — a flow without it still parses
579
- * and the on-disk version stays FLOW_FILE_VERSION 1. `equals` accepts a literal, omitted = presence,
580
- * or a `{ $gte | $contains | $length }` operator pattern.
581
- */
582
- state: z.ZodOptional<z.ZodObject<{
583
- store: z.ZodOptional<z.ZodString>;
584
- path: z.ZodString;
585
- equals: z.ZodOptional<z.ZodUnknown>;
586
- /**
587
- * Treat this as an INVARIANT that must still hold AFTER the action settles, rather than a
588
- * condition to wait for. Set it for a blast-radius check ("this unrelated path must NOT have
589
- * moved") — without it a wait-until-true read passes before an over-reaching side-effect lands.
590
- */
591
- hold: z.ZodOptional<z.ZodBoolean>;
592
- }, "strip", z.ZodTypeAny, {
593
- path: string;
594
- store?: string | undefined;
595
- equals?: unknown;
596
- hold?: boolean | undefined;
597
- }, {
598
- path: string;
599
- store?: string | undefined;
600
- equals?: unknown;
601
- hold?: boolean | undefined;
602
- }>>;
603
- }, "strip", z.ZodTypeAny, {
604
- signal?: string | undefined;
605
- signalData?: Record<string, unknown> | undefined;
606
- signalCount?: number | undefined;
607
- net?: {
608
- status?: number | undefined;
609
- method?: string | undefined;
610
- count?: number | undefined;
611
- urlContains?: string | undefined;
612
- } | undefined;
613
- console?: {
614
- level?: string | undefined;
615
- absent?: boolean | undefined;
616
- } | undefined;
617
- element?: {
618
- testid?: string | undefined;
619
- role?: string | undefined;
620
- name?: string | undefined;
621
- } | undefined;
622
- state?: {
623
- path: string;
624
- store?: string | undefined;
625
- equals?: unknown;
626
- hold?: boolean | undefined;
627
- } | undefined;
628
- }, {
629
- signal?: string | undefined;
630
- signalData?: Record<string, unknown> | undefined;
631
- signalCount?: number | undefined;
632
- net?: {
633
- status?: number | undefined;
634
- method?: string | undefined;
635
- count?: number | undefined;
636
- urlContains?: string | undefined;
637
- } | undefined;
638
- console?: {
639
- level?: string | undefined;
640
- absent?: boolean | undefined;
641
- } | undefined;
642
- element?: {
643
- testid?: string | undefined;
644
- role?: string | undefined;
645
- name?: string | undefined;
646
- } | undefined;
647
- state?: {
648
- path: string;
649
- store?: string | undefined;
650
- equals?: unknown;
651
- hold?: boolean | undefined;
652
- } | undefined;
653
- }>>;
654
- /**
655
- * Anchors whose CONTENT must not be asserted (e.g. LLM output). Replay asserts
656
- * presence, not words. Compiled from a `mark-dynamic` annotation.
657
- */
658
- dynamic: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
659
- kind: z.ZodLiteral<"testid">;
660
- value: z.ZodString;
661
- source: z.ZodOptional<z.ZodObject<{
662
- file: z.ZodString;
663
- line: z.ZodNumber;
664
- column: z.ZodOptional<z.ZodNumber>;
665
- }, "strip", z.ZodTypeAny, {
666
- file: string;
667
- line: number;
668
- column?: number | undefined;
669
- }, {
670
- file: string;
671
- line: number;
672
- column?: number | undefined;
673
- }>>;
674
- }, "strip", z.ZodTypeAny, {
675
- kind: "testid";
676
- value: string;
677
- source?: {
678
- file: string;
679
- line: number;
680
- column?: number | undefined;
681
- } | undefined;
682
- }, {
683
- kind: "testid";
684
- value: string;
685
- source?: {
686
- file: string;
687
- line: number;
688
- column?: number | undefined;
689
- } | undefined;
690
- }>, z.ZodObject<{
691
- kind: z.ZodLiteral<"role">;
692
- role: z.ZodString;
693
- name: z.ZodOptional<z.ZodString>;
694
- }, "strip", z.ZodTypeAny, {
695
- role: string;
696
- kind: "role";
697
- name?: string | undefined;
698
- }, {
699
- role: string;
700
- kind: "role";
701
- name?: string | undefined;
702
- }>, z.ZodObject<{
703
- kind: z.ZodLiteral<"signal">;
704
- name: z.ZodString;
705
- }, "strip", z.ZodTypeAny, {
706
- kind: "signal";
707
- name: string;
708
- }, {
709
- kind: "signal";
710
- name: string;
711
- }>, z.ZodObject<{
712
- kind: z.ZodLiteral<"component">;
713
- component: z.ZodOptional<z.ZodString>;
714
- source: z.ZodOptional<z.ZodObject<{
715
- file: z.ZodString;
716
- line: z.ZodNumber;
717
- column: z.ZodOptional<z.ZodNumber>;
718
- }, "strip", z.ZodTypeAny, {
719
- file: string;
720
- line: number;
721
- column?: number | undefined;
722
- }, {
723
- file: string;
724
- line: number;
725
- column?: number | undefined;
726
- }>>;
727
- role: z.ZodOptional<z.ZodString>;
728
- name: z.ZodOptional<z.ZodString>;
729
- }, "strip", z.ZodTypeAny, {
730
- kind: "component";
731
- role?: string | undefined;
732
- component?: string | undefined;
733
- source?: {
734
- file: string;
735
- line: number;
736
- column?: number | undefined;
737
- } | undefined;
738
- name?: string | undefined;
739
- }, {
740
- kind: "component";
741
- role?: string | undefined;
742
- component?: string | undefined;
743
- source?: {
744
- file: string;
745
- line: number;
746
- column?: number | undefined;
747
- } | undefined;
748
- name?: string | undefined;
749
- }>]>, "many">>;
750
- }, "strip", z.ZodTypeAny, {
751
- name: string;
752
- steps: FlowStep[];
753
- version: 1;
754
- createdAt: number;
755
- intent?: string | undefined;
756
- projectId?: string | undefined;
757
- intentId?: string | undefined;
758
- startPath?: string | undefined;
759
- fixture?: string | undefined;
760
- success?: {
761
- signal?: string | undefined;
762
- signalData?: Record<string, unknown> | undefined;
763
- signalCount?: number | undefined;
764
- net?: {
765
- status?: number | undefined;
766
- method?: string | undefined;
767
- count?: number | undefined;
768
- urlContains?: string | undefined;
769
- } | undefined;
770
- console?: {
771
- level?: string | undefined;
772
- absent?: boolean | undefined;
773
- } | undefined;
774
- element?: {
775
- testid?: string | undefined;
776
- role?: string | undefined;
777
- name?: string | undefined;
778
- } | undefined;
779
- state?: {
780
- path: string;
781
- store?: string | undefined;
782
- equals?: unknown;
783
- hold?: boolean | undefined;
784
- } | undefined;
785
- } | undefined;
786
- dynamic?: ({
787
- kind: "testid";
788
- value: string;
789
- source?: {
790
- file: string;
791
- line: number;
792
- column?: number | undefined;
793
- } | undefined;
794
- } | {
795
- role: string;
796
- kind: "role";
797
- name?: string | undefined;
798
- } | {
799
- kind: "signal";
800
- name: string;
801
- } | {
802
- kind: "component";
803
- role?: string | undefined;
804
- component?: string | undefined;
805
- source?: {
806
- file: string;
807
- line: number;
808
- column?: number | undefined;
809
- } | undefined;
810
- name?: string | undefined;
811
- })[] | undefined;
812
- }, {
813
- name: string;
814
- steps: FlowStep[];
815
- version: 1;
816
- createdAt: number;
817
- intent?: string | undefined;
818
- projectId?: string | undefined;
819
- intentId?: string | undefined;
820
- startPath?: string | undefined;
821
- fixture?: string | undefined;
822
- success?: {
823
- signal?: string | undefined;
824
- signalData?: Record<string, unknown> | undefined;
825
- signalCount?: number | undefined;
826
- net?: {
827
- status?: number | undefined;
828
- method?: string | undefined;
829
- count?: number | undefined;
830
- urlContains?: string | undefined;
831
- } | undefined;
832
- console?: {
833
- level?: string | undefined;
834
- absent?: boolean | undefined;
835
- } | undefined;
836
- element?: {
837
- testid?: string | undefined;
838
- role?: string | undefined;
839
- name?: string | undefined;
840
- } | undefined;
841
- state?: {
842
- path: string;
843
- store?: string | undefined;
844
- equals?: unknown;
845
- hold?: boolean | undefined;
846
- } | undefined;
847
- } | undefined;
848
- dynamic?: ({
849
- kind: "testid";
850
- value: string;
851
- source?: {
852
- file: string;
853
- line: number;
854
- column?: number | undefined;
855
- } | undefined;
856
- } | {
857
- role: string;
858
- kind: "role";
859
- name?: string | undefined;
860
- } | {
861
- kind: "signal";
862
- name: string;
863
- } | {
864
- kind: "component";
865
- role?: string | undefined;
866
- component?: string | undefined;
867
- source?: {
868
- file: string;
869
- line: number;
870
- column?: number | undefined;
871
- } | undefined;
872
- name?: string | undefined;
873
- })[] | undefined;
874
- }>;
875
- export type FlowFile = z.infer<typeof FlowFileSchema>;
876
- /**
877
- * The in-page → wire payload for a finished human recording. The browser
878
- * compiles captured interactions into a FlowFile-shaped object (resolving semantic anchors at
879
- * capture time) and emits it as ONE EventType.FLOW_RECORDED event; the server persists it.
880
- */
881
- export declare const RecordedFlowSchema: z.ZodObject<{
882
- name: z.ZodString;
883
- flow: z.ZodObject<{
884
- version: z.ZodLiteral<1>;
885
- name: z.ZodString;
886
- /**
887
- * The business goal this flow exists to verify, one line (e.g. "ship a deploy to production").
888
- * Optional + back-compat (a flow without it still parses). Set via an `intent` annotation. The
889
- * point of "intent + outcome oracle": a flow that declares an intent should also assert an
890
- * observable business OUTCOME (a consequence success-state), or it claims to verify a goal it
891
- * cannot actually check — flow-classify flags that gap.
892
- */
893
- intent: z.ZodOptional<z.ZodString>;
894
- /**
895
- * The intent-ledger row this flow discharges — the id in `.reticle/intent.json`.
896
- *
897
- * `intent` above is the prose a recorder captured; this is the LINK to the ledger that already
898
- * models declared → bound → proved and records which verdict discharged what. Without it there
899
- * would be two ways to say what a change is for, which is the defect this codebase keeps paying
900
- * for: a flow's goal and an intent's statement would drift apart with nothing to reconcile them.
901
- *
902
- * Set at save time from the flow's own prose, or written by hand to point a flow at an intent
903
- * declared earlier via `reticle_intent` — a flow can prove something somebody else declared.
904
- * Optional + back-compat: a flow without it replays exactly as before, and the on-disk version
905
- * stays FLOW_FILE_VERSION 1.
906
- */
907
- intentId: z.ZodOptional<z.ZodString>;
908
- /**
909
- * The project the flow was recorded against (the connecting session's HELLO `projectId`), stamped at
910
- * save time. Scopes a flow to its app so a shared daemon's HUD lists only the current project's flows
911
- * instead of every project that ever saved to that daemon. Optional + back-compat: a flow with no
912
- * projectId is treated as global (visible everywhere), so pre-existing files parse and still show.
913
- */
914
- projectId: z.ZodOptional<z.ZodString>;
915
- /**
916
- * The route (pathname) the journey started on, captured at record time. Replay navigates here
917
- * before step 1 so a flow whose first anchor lives on another page doesn't drift on step 1 ("a
918
- * step no longer matches") just because replay began on the wrong page. Optional + back-compat: a
919
- * flow without it (or recorded before this shipped) replays from the current page as before, and
920
- * the on-disk version stays FLOW_FILE_VERSION 1.
921
- */
922
- startPath: z.ZodOptional<z.ZodString>;
923
- fixture: z.ZodOptional<z.ZodString>;
924
- /** From the injected clock (ms) — deterministic in tests, byte-stable on disk. */
925
- createdAt: z.ZodNumber;
926
- steps: z.ZodArray<z.ZodType<FlowStep, z.ZodTypeDef, FlowStep>, "many">;
927
- success: z.ZodOptional<z.ZodObject<{
928
- signal: z.ZodOptional<z.ZodString>;
929
- /**
930
- * Optional payload shape an `assert-signal` annotation requires the signal
931
- * to match (the predicate DSL's signal.dataMatches). Additive/optional — a flow file with a
932
- * bare `signal` still parses, and the on-disk version stays FLOW_FILE_VERSION 1.
933
- */
934
- signalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
935
- /**
936
- * Exact number of times the signal must have fired — the signal-side twin of `net.count`, and the
937
- * only way a saved flow can keep a cardinality the agent actually asserted. Without it a
938
- * `count: 1` drive would be recorded as bare presence, which is a strictly WEAKER claim than the
939
- * one made: the replayed flow then goes green on the double-fire it was recorded to catch.
940
- * Additive/optional — a flow file with a bare `signal` still parses, and FLOW_FILE_VERSION stays 1.
941
- */
942
- signalCount: z.ZodOptional<z.ZodNumber>;
943
- net: z.ZodOptional<z.ZodObject<{
944
- method: z.ZodOptional<z.ZodString>;
945
- urlContains: z.ZodOptional<z.ZodString>;
946
- status: z.ZodOptional<z.ZodNumber>;
947
- /**
948
- * Exact number of matching requests since the action — turns presence into a cardinality
949
- * assertion. Catches the double-submit / useEffect-double-fire / retry-storm regression class:
950
- * the request fired (presence passes) but fired the WRONG number of times. Omit = presence (≥1).
951
- */
952
- count: z.ZodOptional<z.ZodNumber>;
953
- }, "strip", z.ZodTypeAny, {
954
- status?: number | undefined;
955
- method?: string | undefined;
956
- count?: number | undefined;
957
- urlContains?: string | undefined;
958
- }, {
959
- status?: number | undefined;
960
- method?: string | undefined;
961
- count?: number | undefined;
962
- urlContains?: string | undefined;
963
- }>>;
964
- /**
965
- * Console golden end-condition: assert the action logged (or, with absent:true, did NOT log) a
966
- * console message at `level` (default 'error'). `absent:true` is the common case — "the action
967
- * completed with a clean console" — catching the regression where an action throws a caught error
968
- * / logs an uncaught rejection while the UI still renders fine (a presence check passes it).
969
- */
970
- console: z.ZodOptional<z.ZodObject<{
971
- level: z.ZodOptional<z.ZodString>;
972
- absent: z.ZodOptional<z.ZodBoolean>;
973
- }, "strip", z.ZodTypeAny, {
974
- level?: string | undefined;
975
- absent?: boolean | undefined;
976
- }, {
977
- level?: string | undefined;
978
- absent?: boolean | undefined;
979
- }>>;
980
- element: z.ZodOptional<z.ZodObject<{
981
- testid: z.ZodOptional<z.ZodString>;
982
- role: z.ZodOptional<z.ZodString>;
983
- name: z.ZodOptional<z.ZodString>;
984
- }, "strip", z.ZodTypeAny, {
985
- testid?: string | undefined;
986
- role?: string | undefined;
987
- name?: string | undefined;
988
- }, {
989
- testid?: string | undefined;
990
- role?: string | undefined;
991
- name?: string | undefined;
992
- }>>;
993
- /**
994
- * Assert a registered store's value — the source of truth no DOM/network read can reach. Compiles
995
- * to the predicate engine's `state` predicate. Additive/optional — a flow without it still parses
996
- * and the on-disk version stays FLOW_FILE_VERSION 1. `equals` accepts a literal, omitted = presence,
997
- * or a `{ $gte | $contains | $length }` operator pattern.
998
- */
999
- state: z.ZodOptional<z.ZodObject<{
1000
- store: z.ZodOptional<z.ZodString>;
1001
- path: z.ZodString;
1002
- equals: z.ZodOptional<z.ZodUnknown>;
1003
- /**
1004
- * Treat this as an INVARIANT that must still hold AFTER the action settles, rather than a
1005
- * condition to wait for. Set it for a blast-radius check ("this unrelated path must NOT have
1006
- * moved") — without it a wait-until-true read passes before an over-reaching side-effect lands.
1007
- */
1008
- hold: z.ZodOptional<z.ZodBoolean>;
1009
- }, "strip", z.ZodTypeAny, {
1010
- path: string;
1011
- store?: string | undefined;
1012
- equals?: unknown;
1013
- hold?: boolean | undefined;
1014
- }, {
1015
- path: string;
1016
- store?: string | undefined;
1017
- equals?: unknown;
1018
- hold?: boolean | undefined;
1019
- }>>;
1020
- }, "strip", z.ZodTypeAny, {
1021
- signal?: string | undefined;
1022
- signalData?: Record<string, unknown> | undefined;
1023
- signalCount?: number | undefined;
1024
- net?: {
1025
- status?: number | undefined;
1026
- method?: string | undefined;
1027
- count?: number | undefined;
1028
- urlContains?: string | undefined;
1029
- } | undefined;
1030
- console?: {
1031
- level?: string | undefined;
1032
- absent?: boolean | undefined;
1033
- } | undefined;
1034
- element?: {
1035
- testid?: string | undefined;
1036
- role?: string | undefined;
1037
- name?: string | undefined;
1038
- } | undefined;
1039
- state?: {
1040
- path: string;
1041
- store?: string | undefined;
1042
- equals?: unknown;
1043
- hold?: boolean | undefined;
1044
- } | undefined;
1045
- }, {
1046
- signal?: string | undefined;
1047
- signalData?: Record<string, unknown> | undefined;
1048
- signalCount?: number | undefined;
1049
- net?: {
1050
- status?: number | undefined;
1051
- method?: string | undefined;
1052
- count?: number | undefined;
1053
- urlContains?: string | undefined;
1054
- } | undefined;
1055
- console?: {
1056
- level?: string | undefined;
1057
- absent?: boolean | undefined;
1058
- } | undefined;
1059
- element?: {
1060
- testid?: string | undefined;
1061
- role?: string | undefined;
1062
- name?: string | undefined;
1063
- } | undefined;
1064
- state?: {
1065
- path: string;
1066
- store?: string | undefined;
1067
- equals?: unknown;
1068
- hold?: boolean | undefined;
1069
- } | undefined;
1070
- }>>;
1071
- /**
1072
- * Anchors whose CONTENT must not be asserted (e.g. LLM output). Replay asserts
1073
- * presence, not words. Compiled from a `mark-dynamic` annotation.
1074
- */
1075
- dynamic: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1076
- kind: z.ZodLiteral<"testid">;
1077
- value: z.ZodString;
1078
- source: z.ZodOptional<z.ZodObject<{
1079
- file: z.ZodString;
1080
- line: z.ZodNumber;
1081
- column: z.ZodOptional<z.ZodNumber>;
1082
- }, "strip", z.ZodTypeAny, {
1083
- file: string;
1084
- line: number;
1085
- column?: number | undefined;
1086
- }, {
1087
- file: string;
1088
- line: number;
1089
- column?: number | undefined;
1090
- }>>;
1091
- }, "strip", z.ZodTypeAny, {
1092
- kind: "testid";
1093
- value: string;
1094
- source?: {
1095
- file: string;
1096
- line: number;
1097
- column?: number | undefined;
1098
- } | undefined;
1099
- }, {
1100
- kind: "testid";
1101
- value: string;
1102
- source?: {
1103
- file: string;
1104
- line: number;
1105
- column?: number | undefined;
1106
- } | undefined;
1107
- }>, z.ZodObject<{
1108
- kind: z.ZodLiteral<"role">;
1109
- role: z.ZodString;
1110
- name: z.ZodOptional<z.ZodString>;
1111
- }, "strip", z.ZodTypeAny, {
1112
- role: string;
1113
- kind: "role";
1114
- name?: string | undefined;
1115
- }, {
1116
- role: string;
1117
- kind: "role";
1118
- name?: string | undefined;
1119
- }>, z.ZodObject<{
1120
- kind: z.ZodLiteral<"signal">;
1121
- name: z.ZodString;
1122
- }, "strip", z.ZodTypeAny, {
1123
- kind: "signal";
1124
- name: string;
1125
- }, {
1126
- kind: "signal";
1127
- name: string;
1128
- }>, z.ZodObject<{
1129
- kind: z.ZodLiteral<"component">;
1130
- component: z.ZodOptional<z.ZodString>;
1131
- source: z.ZodOptional<z.ZodObject<{
1132
- file: z.ZodString;
1133
- line: z.ZodNumber;
1134
- column: z.ZodOptional<z.ZodNumber>;
1135
- }, "strip", z.ZodTypeAny, {
1136
- file: string;
1137
- line: number;
1138
- column?: number | undefined;
1139
- }, {
1140
- file: string;
1141
- line: number;
1142
- column?: number | undefined;
1143
- }>>;
1144
- role: z.ZodOptional<z.ZodString>;
1145
- name: z.ZodOptional<z.ZodString>;
1146
- }, "strip", z.ZodTypeAny, {
1147
- kind: "component";
1148
- role?: string | undefined;
1149
- component?: string | undefined;
1150
- source?: {
1151
- file: string;
1152
- line: number;
1153
- column?: number | undefined;
1154
- } | undefined;
1155
- name?: string | undefined;
1156
- }, {
1157
- kind: "component";
1158
- role?: string | undefined;
1159
- component?: string | undefined;
1160
- source?: {
1161
- file: string;
1162
- line: number;
1163
- column?: number | undefined;
1164
- } | undefined;
1165
- name?: string | undefined;
1166
- }>]>, "many">>;
1167
- }, "strip", z.ZodTypeAny, {
1168
- name: string;
1169
- steps: FlowStep[];
1170
- version: 1;
1171
- createdAt: number;
1172
- intent?: string | undefined;
1173
- projectId?: string | undefined;
1174
- intentId?: string | undefined;
1175
- startPath?: string | undefined;
1176
- fixture?: string | undefined;
1177
- success?: {
1178
- signal?: string | undefined;
1179
- signalData?: Record<string, unknown> | undefined;
1180
- signalCount?: number | undefined;
1181
- net?: {
1182
- status?: number | undefined;
1183
- method?: string | undefined;
1184
- count?: number | undefined;
1185
- urlContains?: string | undefined;
1186
- } | undefined;
1187
- console?: {
1188
- level?: string | undefined;
1189
- absent?: boolean | undefined;
1190
- } | undefined;
1191
- element?: {
1192
- testid?: string | undefined;
1193
- role?: string | undefined;
1194
- name?: string | undefined;
1195
- } | undefined;
1196
- state?: {
1197
- path: string;
1198
- store?: string | undefined;
1199
- equals?: unknown;
1200
- hold?: boolean | undefined;
1201
- } | undefined;
1202
- } | undefined;
1203
- dynamic?: ({
1204
- kind: "testid";
1205
- value: string;
1206
- source?: {
1207
- file: string;
1208
- line: number;
1209
- column?: number | undefined;
1210
- } | undefined;
1211
- } | {
1212
- role: string;
1213
- kind: "role";
1214
- name?: string | undefined;
1215
- } | {
1216
- kind: "signal";
1217
- name: string;
1218
- } | {
1219
- kind: "component";
1220
- role?: string | undefined;
1221
- component?: string | undefined;
1222
- source?: {
1223
- file: string;
1224
- line: number;
1225
- column?: number | undefined;
1226
- } | undefined;
1227
- name?: string | undefined;
1228
- })[] | undefined;
1229
- }, {
1230
- name: string;
1231
- steps: FlowStep[];
1232
- version: 1;
1233
- createdAt: number;
1234
- intent?: string | undefined;
1235
- projectId?: string | undefined;
1236
- intentId?: string | undefined;
1237
- startPath?: string | undefined;
1238
- fixture?: string | undefined;
1239
- success?: {
1240
- signal?: string | undefined;
1241
- signalData?: Record<string, unknown> | undefined;
1242
- signalCount?: number | undefined;
1243
- net?: {
1244
- status?: number | undefined;
1245
- method?: string | undefined;
1246
- count?: number | undefined;
1247
- urlContains?: string | undefined;
1248
- } | undefined;
1249
- console?: {
1250
- level?: string | undefined;
1251
- absent?: boolean | undefined;
1252
- } | undefined;
1253
- element?: {
1254
- testid?: string | undefined;
1255
- role?: string | undefined;
1256
- name?: string | undefined;
1257
- } | undefined;
1258
- state?: {
1259
- path: string;
1260
- store?: string | undefined;
1261
- equals?: unknown;
1262
- hold?: boolean | undefined;
1263
- } | undefined;
1264
- } | undefined;
1265
- dynamic?: ({
1266
- kind: "testid";
1267
- value: string;
1268
- source?: {
1269
- file: string;
1270
- line: number;
1271
- column?: number | undefined;
1272
- } | undefined;
1273
- } | {
1274
- role: string;
1275
- kind: "role";
1276
- name?: string | undefined;
1277
- } | {
1278
- kind: "signal";
1279
- name: string;
1280
- } | {
1281
- kind: "component";
1282
- role?: string | undefined;
1283
- component?: string | undefined;
1284
- source?: {
1285
- file: string;
1286
- line: number;
1287
- column?: number | undefined;
1288
- } | undefined;
1289
- name?: string | undefined;
1290
- })[] | undefined;
1291
- }>;
1292
- }, "strip", z.ZodTypeAny, {
1293
- flow: {
1294
- name: string;
1295
- steps: FlowStep[];
1296
- version: 1;
1297
- createdAt: number;
1298
- intent?: string | undefined;
1299
- projectId?: string | undefined;
1300
- intentId?: string | undefined;
1301
- startPath?: string | undefined;
1302
- fixture?: string | undefined;
1303
- success?: {
1304
- signal?: string | undefined;
1305
- signalData?: Record<string, unknown> | undefined;
1306
- signalCount?: number | undefined;
1307
- net?: {
1308
- status?: number | undefined;
1309
- method?: string | undefined;
1310
- count?: number | undefined;
1311
- urlContains?: string | undefined;
1312
- } | undefined;
1313
- console?: {
1314
- level?: string | undefined;
1315
- absent?: boolean | undefined;
1316
- } | undefined;
1317
- element?: {
1318
- testid?: string | undefined;
1319
- role?: string | undefined;
1320
- name?: string | undefined;
1321
- } | undefined;
1322
- state?: {
1323
- path: string;
1324
- store?: string | undefined;
1325
- equals?: unknown;
1326
- hold?: boolean | undefined;
1327
- } | undefined;
1328
- } | undefined;
1329
- dynamic?: ({
1330
- kind: "testid";
1331
- value: string;
1332
- source?: {
1333
- file: string;
1334
- line: number;
1335
- column?: number | undefined;
1336
- } | undefined;
1337
- } | {
1338
- role: string;
1339
- kind: "role";
1340
- name?: string | undefined;
1341
- } | {
1342
- kind: "signal";
1343
- name: string;
1344
- } | {
1345
- kind: "component";
1346
- role?: string | undefined;
1347
- component?: string | undefined;
1348
- source?: {
1349
- file: string;
1350
- line: number;
1351
- column?: number | undefined;
1352
- } | undefined;
1353
- name?: string | undefined;
1354
- })[] | undefined;
1355
- };
1356
- name: string;
1357
- }, {
1358
- flow: {
1359
- name: string;
1360
- steps: FlowStep[];
1361
- version: 1;
1362
- createdAt: number;
1363
- intent?: string | undefined;
1364
- projectId?: string | undefined;
1365
- intentId?: string | undefined;
1366
- startPath?: string | undefined;
1367
- fixture?: string | undefined;
1368
- success?: {
1369
- signal?: string | undefined;
1370
- signalData?: Record<string, unknown> | undefined;
1371
- signalCount?: number | undefined;
1372
- net?: {
1373
- status?: number | undefined;
1374
- method?: string | undefined;
1375
- count?: number | undefined;
1376
- urlContains?: string | undefined;
1377
- } | undefined;
1378
- console?: {
1379
- level?: string | undefined;
1380
- absent?: boolean | undefined;
1381
- } | undefined;
1382
- element?: {
1383
- testid?: string | undefined;
1384
- role?: string | undefined;
1385
- name?: string | undefined;
1386
- } | undefined;
1387
- state?: {
1388
- path: string;
1389
- store?: string | undefined;
1390
- equals?: unknown;
1391
- hold?: boolean | undefined;
1392
- } | undefined;
1393
- } | undefined;
1394
- dynamic?: ({
1395
- kind: "testid";
1396
- value: string;
1397
- source?: {
1398
- file: string;
1399
- line: number;
1400
- column?: number | undefined;
1401
- } | undefined;
1402
- } | {
1403
- role: string;
1404
- kind: "role";
1405
- name?: string | undefined;
1406
- } | {
1407
- kind: "signal";
1408
- name: string;
1409
- } | {
1410
- kind: "component";
1411
- role?: string | undefined;
1412
- component?: string | undefined;
1413
- source?: {
1414
- file: string;
1415
- line: number;
1416
- column?: number | undefined;
1417
- } | undefined;
1418
- name?: string | undefined;
1419
- })[] | undefined;
1420
- };
1421
- name: string;
1422
- }>;
1423
- /** A concrete, confidence-scored rebind proposed for one drifted step. */
1424
- export interface HealProposal {
1425
- /** 0-based step index in the flow. */
1426
- step: number;
1427
- /** Old (missing) testid anchor value. */
1428
- from: string;
1429
- /** Proposed nearest present testid. */
1430
- to: string;
1431
- /** Normalized (0,1]; >= HEAL_CONFIDENCE_MIN to be applicable. */
1432
- confidence: number;
1433
- }
1434
- /** One applied rebind (a HealProposal that was written to disk). */
1435
- export interface HealChange {
1436
- step: number;
1437
- from: string;
1438
- to: string;
1439
- }
1440
- /** The reticle_flow_heal envelope. */
1441
- export interface FlowHealResult {
1442
- name: string;
1443
- status: HealStatus;
1444
- /** Whether the file was rewritten (true only when status === 'healed'). */
1445
- applied: boolean;
1446
- /** Confident, applicable rebinds. With apply:false these are the dry-run diff. */
1447
- proposals: HealProposal[];
1448
- /** Anchors actually written (empty unless applied). */
1449
- changed: HealChange[];
1450
- /** Human one-liner for the agent (e.g. "nothing to heal", floor explanation). */
1451
- message: string;
1452
- error?: {
1453
- code: string;
1454
- message: string;
1455
- };
1456
- }
1457
- export type RecordedFlow = z.infer<typeof RecordedFlowSchema>;
1458
- /**
1459
- * One replayable-flow chip on the in-page HUD.
1460
- *
1461
- * Crosses the bridge: the daemon builds these from the flows on disk and pushes them with
1462
- * `ReticleCommand.FLOWS`; the presenter panel renders one ▶ button per chip. It lived as two
1463
- * identical `interface FlowChip` declarations — one in the server, one in the browser — which is the
1464
- * shape that drifts silently, because nothing links the two and no test crosses the boundary.
1465
- *
1466
- * A TYPE and not a zod schema on purpose: the browser SDK ships into the user's app and carries no
1467
- * zod, so the receiving side narrows the raw wire value by hand. The type is what both ends agree on.
1468
- */
1469
- export interface FlowChip {
1470
- name: string;
1471
- /** The testid the flow's first step anchors to, when it has one — the panel hides chips that cannot start on the current page. */
1472
- start?: string;
1473
- }