@reticlehq/core 3.5.0 → 3.7.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 (113) hide show
  1. package/dist/artifacts/artifacts-entry.d.ts +4 -0
  2. package/dist/artifacts/artifacts-entry.js +4 -0
  3. package/dist/artifacts/drive-script.d.ts +1404 -0
  4. package/dist/artifacts/drive-script.js +220 -0
  5. package/dist/artifacts/flow-constants.d.ts +19 -0
  6. package/dist/artifacts/flow-constants.js +21 -0
  7. package/dist/artifacts/flow-results.d.ts +450 -0
  8. package/dist/artifacts/flow-results.js +1 -0
  9. package/dist/artifacts/flow-types.d.ts +75 -427
  10. package/dist/artifacts/flow-types.js +15 -2
  11. package/dist/artifacts/harness-credits.d.ts +39 -0
  12. package/dist/artifacts/harness-credits.js +69 -0
  13. package/dist/artifacts/harness-map.d.ts +98 -0
  14. package/dist/artifacts/harness-map.js +36 -0
  15. package/dist/artifacts/hud-notices.d.ts +134 -0
  16. package/dist/artifacts/hud-notices.js +124 -0
  17. package/dist/artifacts/impact.d.ts +489 -189
  18. package/dist/artifacts/impact.js +90 -47
  19. package/dist/artifacts/journal.d.ts +105 -5
  20. package/dist/artifacts/journal.js +41 -0
  21. package/dist/artifacts/prompt-context.d.ts +105 -0
  22. package/dist/artifacts/prompt-context.js +108 -0
  23. package/dist/artifacts/screenshot-upload.d.ts +51 -0
  24. package/dist/artifacts/screenshot-upload.js +26 -0
  25. package/dist/desktop-contract.cjs +1 -0
  26. package/dist/desktop-contract.d.cts +1 -0
  27. package/dist/hooks/hook-events.d.ts +4 -4
  28. package/dist/hud-entry.d.ts +2 -0
  29. package/dist/hud-entry.js +4 -0
  30. package/dist/identity/contract-fingerprint.d.ts +9 -0
  31. package/dist/identity/contract-fingerprint.js +12 -0
  32. package/dist/identity/testid-attribute.d.ts +18 -0
  33. package/dist/identity/testid-attribute.js +24 -0
  34. package/dist/index.d.ts +9 -1
  35. package/dist/index.js +9 -1
  36. package/dist/onboarding.d.ts +10 -2
  37. package/dist/onboarding.js +6 -0
  38. package/dist/realm/registry.js +19 -1
  39. package/dist/schema/command-message.json +36 -0
  40. package/dist/schema/command-name.json +5 -1
  41. package/dist/schema/event-payloads.json +56 -2
  42. package/dist/schema/reticle-message.json +36 -0
  43. package/dist/telemetry-bug.d.ts +169 -0
  44. package/dist/telemetry-bug.js +123 -0
  45. package/dist/telemetry-entry.d.ts +1 -0
  46. package/dist/telemetry-entry.js +1 -0
  47. package/dist/telemetry-feedback.d.ts +2 -2
  48. package/dist/telemetry-refusal.d.ts +5 -4
  49. package/dist/telemetry-session.d.ts +79 -1
  50. package/dist/telemetry-session.js +57 -1
  51. package/dist/telemetry-signals.d.ts +339 -0
  52. package/dist/telemetry-signals.js +138 -0
  53. package/dist/telemetry.d.ts +330 -276
  54. package/dist/telemetry.js +40 -115
  55. package/dist/tour.d.ts +1 -0
  56. package/dist/tour.js +13 -5
  57. package/dist/verdict/consequence.d.ts +3 -0
  58. package/dist/verdict/disparity.d.ts +105 -0
  59. package/dist/verdict/disparity.js +40 -0
  60. package/dist/verdict/findings.d.ts +11 -0
  61. package/dist/verdict/findings.js +16 -0
  62. package/dist/verdict/instrumentation-coverage.d.ts +115 -0
  63. package/dist/verdict/instrumentation-coverage.js +226 -0
  64. package/dist/verdict/instrumentation-gap.js +1 -1
  65. package/dist/verdict/intent.d.ts +19 -5
  66. package/dist/verdict/intent.js +13 -1
  67. package/dist/verdict/predicate-tree.d.ts +15 -0
  68. package/dist/verdict/predicate-tree.js +21 -0
  69. package/dist/verdict/predicate.d.ts +28 -0
  70. package/dist/verdict/predicate.js +94 -15
  71. package/dist/verdict/security.d.ts +25 -0
  72. package/dist/verdict/security.js +82 -0
  73. package/dist/verdict/verdict-attribution.js +1 -0
  74. package/dist/verdict/verification-run.d.ts +638 -32
  75. package/dist/verdict/verification-run.js +90 -0
  76. package/dist/verdict/verified-constants.d.ts +19 -0
  77. package/dist/verdict/verified-constants.js +22 -0
  78. package/dist/wire/constants/constants.d.ts +60 -32
  79. package/dist/wire/constants/constants.js +61 -33
  80. package/dist/wire/constants/hud-controls.d.ts +1 -1
  81. package/dist/wire/constants/hud-controls.js +34 -1
  82. package/dist/wire/constants/hud-use.d.ts +89 -1
  83. package/dist/wire/constants/hud-use.js +62 -1
  84. package/dist/wire/constants/mcp-wire.d.ts +10 -0
  85. package/dist/wire/constants/mcp-wire.js +10 -0
  86. package/dist/wire/constants/reticle-chrome.d.ts +19 -0
  87. package/dist/wire/constants/reticle-chrome.js +19 -0
  88. package/dist/wire/constants/session-constants.d.ts +21 -0
  89. package/dist/wire/constants/session-constants.js +21 -0
  90. package/dist/wire/desktop-contract.d.ts +11 -0
  91. package/dist/wire/desktop-contract.js +14 -0
  92. package/dist/wire/event-payloads.d.ts +77 -4
  93. package/dist/wire/event-payloads.js +27 -0
  94. package/dist/wire/global-press.d.ts +34 -3
  95. package/dist/wire/global-press.js +91 -3
  96. package/dist/wire/hold.d.ts +14 -0
  97. package/dist/wire/hold.js +18 -0
  98. package/dist/wire/messages.d.ts +129 -32
  99. package/dist/wire/messages.js +17 -1
  100. package/dist/wire/platform-link.d.ts +238 -0
  101. package/dist/wire/platform-link.js +234 -0
  102. package/dist/wire/tool-names.d.ts +2 -0
  103. package/dist/wire/tool-names.js +2 -0
  104. package/dist/wire/types.d.ts +26 -6
  105. package/dist/wire/types.js +5 -0
  106. package/dist/words/no-session-reason.d.ts +7 -0
  107. package/dist/words/no-session-reason.js +7 -0
  108. package/dist/words/notices.d.ts +1 -1
  109. package/dist/words/notices.js +5 -3
  110. package/dist/words/upgrade.js +1 -1
  111. package/dist/words/writing-rule.d.ts +14 -0
  112. package/dist/words/writing-rule.js +17 -0
  113. package/package.json +1 -1
@@ -1,11 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  import { StepEffect } from './step-effect.js';
3
3
  import { ActionType } from '../wire/constants/constants.js';
4
- import type { Contradiction } from '../verdict/findings.js';
5
4
  import { PredicateKind } from '../verdict/consequence.js';
6
5
  import { type Predicate } from '../verdict/predicate.js';
7
6
  export { FlowExpectSchema, type FlowExpect } from './flow-expect-flat.js';
8
- import { type DriftReason, type HealStatus, type ReplayStatus, type SuiteIsolation } from './flow-constants.js';
7
+ export * from './flow-results.js';
9
8
  /**
10
9
  * The MCP tool names that can appear as a recorded flow step's `tool`. These are the ONLY tool names
11
10
  * that cross the wire into a persisted flow file — the browser recorder stamps them, the server replays
@@ -54,14 +53,20 @@ export declare const FlowAnchorSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObj
54
53
  kind: z.ZodLiteral<"role">;
55
54
  role: z.ZodString;
56
55
  name: z.ZodOptional<z.ZodString>;
56
+ nth: z.ZodOptional<z.ZodNumber>;
57
+ of: z.ZodOptional<z.ZodNumber>;
57
58
  }, "strip", z.ZodTypeAny, {
58
59
  kind: "role";
59
60
  role: string;
60
61
  name?: string | undefined;
62
+ of?: number | undefined;
63
+ nth?: number | undefined;
61
64
  }, {
62
65
  kind: "role";
63
66
  role: string;
64
67
  name?: string | undefined;
68
+ of?: number | undefined;
69
+ nth?: number | undefined;
65
70
  }>, z.ZodObject<{
66
71
  kind: z.ZodLiteral<"signal">;
67
72
  name: z.ZodString;
@@ -93,22 +98,22 @@ export declare const FlowAnchorSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObj
93
98
  kind: "component";
94
99
  role?: string | undefined;
95
100
  component?: string | undefined;
96
- name?: string | undefined;
97
101
  source?: {
98
102
  file: string;
99
103
  line: number;
100
104
  column?: number | undefined;
101
105
  } | undefined;
106
+ name?: string | undefined;
102
107
  }, {
103
108
  kind: "component";
104
109
  role?: string | undefined;
105
110
  component?: string | undefined;
106
- name?: string | undefined;
107
111
  source?: {
108
112
  file: string;
109
113
  line: number;
110
114
  column?: number | undefined;
111
115
  } | undefined;
116
+ name?: string | undefined;
112
117
  }>]>;
113
118
  export type FlowAnchor = z.infer<typeof FlowAnchorSchema>;
114
119
  export declare const FlowPredicateSchema: z.ZodEffects<z.ZodType<Predicate, z.ZodTypeDef, Predicate>, Predicate, Predicate>;
@@ -193,385 +198,6 @@ export interface FlowStep {
193
198
  invoke?: string;
194
199
  }
195
200
  export declare const FlowStepSchema: z.ZodType<FlowStep>;
196
- /**
197
- * A legible-drift record returned when an anchor misses at replay.
198
- * The "whose fault is it" payload: what was expected, why it's gone, and the closest surviving
199
- * anchor (a concrete fix suggestion). Never a bare "command failed".
200
- */
201
- export interface Drift {
202
- /** Named reason kind (testid not found / signal not observed). */
203
- reasonKind: DriftReason;
204
- /** Human sentence, e.g. `testid "chat-send" not found`. */
205
- reason: string;
206
- /** The missed anchor value (the testid string, or the signal name). */
207
- anchor: string;
208
- /** Closest present testid via the live near-miss; null only when the page has no testids (or signal drift). */
209
- nearest: string | null;
210
- /**
211
- * True when two or more present testids tie at the minimum edit distance, so `nearest` is an
212
- * arbitrary pick. An ambiguous drift is NEVER auto-healed (a wrong rebind ships a bug green) —
213
- * it is surfaced for a human/agent to choose. Absent ⇒ unambiguous.
214
- */
215
- ambiguous?: boolean;
216
- }
217
- /** The per-step result of re-resolving + running one anchored step. */
218
- /**
219
- * Counts of what an app did inside one window, and the width of that window.
220
- *
221
- * Defined HERE because it is part of the artifact contract, and consumed by the engine that computes
222
- * it: core is the bottom of the graph and everything depends on it, so one shape lives in one place
223
- * rather than being declared twice and drifting.
224
- */
225
- export interface ReactionSummary {
226
- total: number;
227
- network: number;
228
- domAdded: number;
229
- domRemoved: number;
230
- domChanged: number;
231
- routeChanges: number;
232
- consoleErrors: number;
233
- animations: number;
234
- signals: number;
235
- }
236
- /**
237
- * The digest's counts: `total` always, every other counter only when it is NON-ZERO.
238
- *
239
- * This shape is sparse and the full `ReactionSummary` above is not, on purpose. The digest ships on
240
- * every step of every replay and on every `act_and_wait`; the full report does not. Across a
241
- * four-step replay 25 of 36 counters are typically zero — every step spelling out `"network":0,
242
- * "domAdded":0,"routeChanges":0,…` whether or not anything moved.
243
- *
244
- * Omitting a zero is a ROUTE cut and never an evidence cut: an absent counter IS zero, so the reader
245
- * answers the same question from the same facts. Read one as `summary.network ?? 0`.
246
- *
247
- * `total` is unconditional because "the window was empty" is itself evidence, and a summary with no
248
- * keys could not be told apart from one that was never computed.
249
- */
250
- export type ReactionSummaryDigest = {
251
- total: number;
252
- } & Partial<Omit<ReactionSummary, 'total'>>;
253
- /** The lean reaction report: the window and the counts, without the per-event timeline. */
254
- export interface ReactionDigest {
255
- window_ms: number;
256
- summary: ReactionSummaryDigest;
257
- }
258
- export interface FlowStepResult {
259
- /** 0-based index of this step in the flow. */
260
- step: number;
261
- /**
262
- * The tool the step runs — FlowStepTool.ACT | ACT_SEQUENCE | the synthetic success oracle.
263
- *
264
- * OMITTED when it is `ACT`, which 137/137 steps in this repo's corpus are. Read it as
265
- * `tool ?? FlowStepTool.ACT`. Every reader only ever asks "is this the success oracle?", and a
266
- * missing field is correctly falsy against that — so the coercion fails in the safe direction.
267
- */
268
- tool?: string;
269
- /** The testid/signal value the step is bound to (the re-resolved anchor). */
270
- anchor: string;
271
- /**
272
- * Where this step lives, rendered, when the flow is a COMPOSITE — `signin#0 (invoked from full#1)`.
273
- *
274
- * Absent for a flat flow, where `step` is already the whole answer and an address on every row
275
- * would be noise on every replay of every flow.
276
- */
277
- at?: string;
278
- /**
279
- * The route (pathname) the page was on when this step ran — the "which page" of the journey.
280
- * Additive/optional: present when a route is observable, absent in route-less contexts (e.g. a
281
- * fake session with no route events). Lets a replay result read as a page-by-page journey.
282
- */
283
- page?: string;
284
- /** The route the page was on once this step settled — where it led. Absent when unobservable. */
285
- endPage?: string;
286
- /**
287
- * A compact summary of the observable CONSEQUENCE in the window right after this step ran — the
288
- * "what happened" of the journey: a route change, a domain signal (e.g. a modal opening), a
289
- * network call, or console errors. Additive/optional and intentionally terse (token-cheap). It
290
- * captures what had landed by the time the action settled, so a very-late async effect may not
291
- * appear; the asserted consequence (expect/success) is the authoritative pass/fail signal.
292
- */
293
- consequence?: string;
294
- /**
295
- * Wall-clock ms this step took (dispatch → post-settle), from the session's injected elapsed clock.
296
- * Additive/optional: absent in contexts with no advancing clock. Feeds per-step run-to-run perf diffs.
297
- */
298
- durationMs?: number;
299
- /**
300
- * The event-stream span this step's evidence lives in — its drill address.
301
- *
302
- * `reticle_observe` already accepts `{ since, until }` and returns "the span between action A and
303
- * B", so a step that carries its own window is a step somebody can ask about afterwards without
304
- * re-driving anything. Without it the evidence is captured and has no address, which is why a
305
- * deterministic run could say a step passed and nothing more.
306
- *
307
- * Bounded on BOTH ends deliberately. A `since` alone returns everything from that point to now, so
308
- * on a long flow step two's window would include steps three through twenty-five — and an agent
309
- * reading it would attribute the whole tail to one click.
310
- *
311
- * Additive/optional, and omitted rather than zero-width where no clock advanced: a `{since: 0,
312
- * until: 0}` would read as "this step caused nothing" instead of "nothing here measures time".
313
- */
314
- window?: {
315
- since: number;
316
- until: number;
317
- };
318
- /**
319
- * What the app DID in that window, as counts.
320
- *
321
- * `consequence` beside it is a sentence — readable, and not scannable. Twenty-five sentences is
322
- * prose somebody has to read; twenty-five of these is a surface they can skim for the one row that
323
- * is unlike the others, which is the whole difference between a step ledger and a wall of text.
324
- *
325
- * The counts, not the events. The per-event timeline is the expensive half and it is one
326
- * `reticle_observe { since, until }` away using this step's own `window`, so the cheap form is
327
- * what travels and the full form is addressable rather than sent.
328
- */
329
- digest?: ReactionDigest;
330
- /**
331
- * Channels that DISAGREE about what this step did — reported even when the step passed.
332
- *
333
- * That is the entire point. A step whose anchor resolved, whose action fired and whose declared
334
- * consequence held, while a request in the same window failed, is the false green this product
335
- * exists to catch. The detectors run independently of the assertion, so a green step with an entry
336
- * here is a finding, not a contradiction in terms.
337
- *
338
- * Omitted when the channels agree, never an empty array: a field that is always present teaches a
339
- * reader to skim past it, and the whole value here is that its presence is the signal.
340
- */
341
- contradictions?: Contradiction[];
342
- ok: boolean;
343
- error?: string;
344
- note?: string;
345
- /** Present iff this step stopped on an anchor miss. */
346
- drift?: Drift;
347
- /**
348
- * A confidence-scored nearest-match rebind for this drifted step (additive,
349
- * optional). Set only for a confident testid drift.
350
- */
351
- proposal?: HealProposal;
352
- }
353
- /**
354
- * The autonomy decision envelope — the feedback a human used to give, made machine-actionable. From
355
- * a replay result it states the verdict, what changed, WHERE in the source to look (file:line, from a
356
- * component anchor), a suggested fix, and the single next action — so a coding agent decides its next
357
- * move without a human in the loop. Terse by design (token-cheap).
358
- */
359
- export interface ReplayDecision {
360
- /** pass = intent held; drift = a locator/anchor missed; fail = an action or the success oracle failed. */
361
- verdict: 'pass' | 'drift' | 'fail';
362
- /** One-line human/agent summary of the outcome. */
363
- summary: string;
364
- /** What regressed (the drift reason or failure), when not a pass. */
365
- whatChanged?: string;
366
- /** Where to look — `file:line` from the failing step's source anchor, or the page route. */
367
- whereInSource?: string;
368
- /** A concrete fix hint (e.g. rebind to the nearest surviving anchor). */
369
- suggestedFix?: string;
370
- /** The single next action the agent should take. */
371
- nextAction: string;
372
- }
373
- /**
374
- * One flow's line in a suite verdict — pass counts as a name; a failure carries the actionable
375
- * decision fields so the agent can fix it without re-querying.
376
- */
377
- export interface SuiteFlowResult {
378
- flow: string;
379
- /**
380
- * The flow never ran: its file failed to load, or its leased context never came up. Nothing was
381
- * learned about the app, so this row is not a regression — it is Reticle reporting its own failure
382
- * in the same array as the app's. Measured: one sweep emitted 8 `flow-regression` bug_found events
383
- * off rows like these, from a suite where no flow ever executed.
384
- */
385
- couldNotRun?: boolean;
386
- verdict: 'pass' | 'drift' | 'fail';
387
- whatChanged?: string;
388
- whereInSource?: string;
389
- nextAction?: string;
390
- }
391
- /**
392
- * The consolidated verdict of replaying EVERY known flow — the autonomous loop's "did I break
393
- * anything, and what do I fix" answer in one deterministic call. Passing flows are counted; only
394
- * failures carry detail (token-cheap). `status` is fail if any flow drifted or errored.
395
- */
396
- export interface SuiteVerdict {
397
- /**
398
- * `unverifiable` means the suite contained flows that CANNOT FAIL, so "pass" would be a lie.
399
- *
400
- * A recorded flow with no steps, or one that asserts no observable consequence, replays green no
401
- * matter what the app does. Reporting `pass` for it is a false green in the exact feature sold as
402
- * the regression suite — measured: a flow saved as `{steps: [], intent: "..."}`, which `flow_save`
403
- * had ALREADY graded assertion-free with a warning, came back "all 1 flow pass".
404
- */
405
- status: 'pass' | 'fail' | 'unverifiable';
406
- total: number;
407
- passed: number;
408
- failed: number;
409
- summary: string;
410
- /** Only the failing flows, with their decision (verdict, what changed, where, next action). */
411
- failures: SuiteFlowResult[];
412
- /**
413
- * How the flows were kept apart — see `SuiteIsolation`.
414
- *
415
- * Absent when the caller did not say. Present, it is the difference between two counts that can
416
- * be compared and two that cannot: a shared-session pass may be inherited from an earlier flow.
417
- */
418
- isolation?: SuiteIsolation;
419
- /**
420
- * Flows that replayed without error but assert nothing, so their green means nothing. Counted
421
- * apart from `passed` — a number that includes them is not a count of anything verified.
422
- */
423
- unverifiable?: {
424
- flow: string;
425
- reason: string;
426
- }[];
427
- /**
428
- * Flows that have both passed AND failed on UNCHANGED code — intermittent, not regressions.
429
- *
430
- * A flake and a regression demand opposite responses: one is chased, the other is quarantined. The
431
- * ledger that answers this already existed and was written only by the CLI, so an agent replaying a
432
- * suite a hundred times could never learn which of its failures were noise. Omitted entirely when
433
- * the ledger has not seen enough runs to say.
434
- */
435
- flaky?: string[];
436
- /**
437
- * How much of what the suite DROVE it actually proved.
438
- *
439
- * `unverifiable` above catches a flow that asserts nothing at all. It cannot catch the commoner
440
- * shape: a flow of twelve steps where three declare a consequence and nine do not. That flow
441
- * passes, counts in `passed`, and nine of its steps would have replayed green whether or not the
442
- * feature worked.
443
- *
444
- * So the count travels. Sixty-three steps driven and forty-seven declared is not "75% verified" —
445
- * it is verified for forty-seven and silent about sixteen, and only a number carrying both lets a
446
- * reader tell those apart. Omitted when no flow file was available to count, because an invented
447
- * zero would read as "nothing was declared" rather than "nothing was counted".
448
- */
449
- coverage?: {
450
- steps: number;
451
- declared: number;
452
- };
453
- /**
454
- * Known routes this run never opened.
455
- *
456
- * `coverage` above counts what the suite DROVE. Neither it nor anything else here notices a route
457
- * no flow goes near — so a selection replaying two of eleven flows reports "all 2 flows pass",
458
- * which is true and says nothing about the nine routes that were not looked at.
459
- *
460
- * Known means seen before, not enumerated from the app: every flow the project holds contributes
461
- * the route it starts on. Omitted when the caller knows of no routes, because "0 unreached" from
462
- * an empty ledger reads as a clean sweep rather than as an unanswered question.
463
- */
464
- unreached?: string[];
465
- /**
466
- * Every channel disagreement the suite saw, including on flows that PASSED.
467
- *
468
- * The step-level rule already says a contradiction is reported regardless of `ok`, for the reason
469
- * that a step whose action fired and whose consequence held, while a request in the same window
470
- * failed, is the false green this product exists to catch. The suite verdict returned only its
471
- * failures, so on a green run every one of those was computed, attached to a step, and discarded
472
- * at exactly the moment somebody would have read it — a nightly run of a hundred steps reporting
473
- * "all 12 flows pass".
474
- *
475
- * Carrying them also means a green suite is not reported as `pass`: see `status`.
476
- */
477
- contradictions?: SuiteContradiction[];
478
- }
479
- /** A step-level contradiction, addressed back to the flow and step that produced it. */
480
- export interface SuiteContradiction extends Contradiction {
481
- flow: string;
482
- /** Index within the flow, so the reader can drill straight to the step's own window. */
483
- step: number;
484
- }
485
- /** The reticle_flow_replay envelope. */
486
- export interface FlowReplayResult {
487
- name: string;
488
- status: ReplayStatus;
489
- /**
490
- * Contradictions that span steps — found by re-running the detectors over the WHOLE replay, minus
491
- * everything a step already reported.
492
- *
493
- * A step's window closes when the step ends, so a request fired at step 2 and still unanswered at
494
- * step 5 sits outside every per-step window. It is exactly the shape a long journey produces and
495
- * exactly the shape a per-step view cannot see.
496
- *
497
- * Omitted when the whole-span pass adds nothing over the steps.
498
- */
499
- crossStep?: Contradiction[];
500
- /**
501
- * What this flow knows after this run — every defect it has seen, and whether it is still open.
502
- *
503
- * Written back to the flow file so the next replay starts from it. This is how a flow gets
504
- * stricter without anybody writing a new assertion: a defect observed, then observed GONE, becomes
505
- * something the app can never quietly reacquire.
506
- */
507
- learned?: {
508
- kind: string;
509
- step: number;
510
- state: 'open' | 'guarded';
511
- cleanRuns?: number | undefined;
512
- }[];
513
- /** Defects this run saw disappear. The app got better here. */
514
- promoted?: string[];
515
- /** Guarded defects that came back. The app got worse here, and only this flow would have known. */
516
- regressed?: string[];
517
- steps: FlowStepResult[];
518
- /** The machine-actionable decision derived from this replay (autonomy layer). */
519
- decision?: ReplayDecision;
520
- /** Set when status === 'error' (load failure or resolved action failure). */
521
- error?: {
522
- code: string;
523
- message: string;
524
- };
525
- /**
526
- * Set when the replay STOPPED before the end of the flow.
527
- *
528
- * Replay breaks on the first failing step, so a flow that halted returns fewer step results than
529
- * it has steps — and nothing said so. A caller reading a two-step flow's one result saw a step
530
- * that was simply absent, which was reported as replay "silently skipping" an action. It does not
531
- * skip; it stops, and now it says where and how much it never reached. Omitted entirely when every
532
- * step ran, so a clean pass carries no extra bytes.
533
- */
534
- halted?: {
535
- atStep: number;
536
- notAttempted: number;
537
- };
538
- /**
539
- * Set on an `ok` replay whose flow cannot fail: it asserts no observable consequence, or has no
540
- * steps at all. The replay genuinely completed, so the status stays `ok` — but a bare `ok` read
541
- * as proof the feature works is exactly the false confidence `flow-risk.ts` argues against, and
542
- * `reticle_flow_verify` already refuses to count these as passes. This carries the same reason,
543
- * from the same function, to the single-flow caller who would otherwise never see it.
544
- */
545
- unverifiable?: {
546
- reason: string;
547
- };
548
- /**
549
- * The confident rebind proposals aggregated across drifted steps (additive,
550
- * optional — present only when at least one drifted step has a confident nearest match).
551
- */
552
- proposals?: HealProposal[];
553
- /**
554
- * The push-default deviation report over this replay's route segments (ranked deviations vs the learned
555
- * envelope, or a fall-back note below N=3 runs). Additive; present when segments were observed.
556
- */
557
- deviation?: unknown;
558
- /**
559
- * What the project already knows about this flow, fetched from shared memory on the agent's
560
- * behalf.
561
- *
562
- * Present only when the project is linked, memory sync is on, and the team has actually captured
563
- * something about this flow. Shared memory an agent has to remember to consult is never consulted,
564
- * so the verification asks on the agent's behalf — the difference between memory the platform
565
- * stores and memory the platform uses.
566
- *
567
- * Deliberately additive and deliberately small: a verdict whose own result has been pushed below
568
- * a wall of statements is a worse verdict.
569
- */
570
- knows?: {
571
- statement: string;
572
- status: string;
573
- }[];
574
- }
575
201
  /**
576
202
  * The on-disk flow file: diffable, git-tracked, anchor-resolved.
577
203
  * The optional `dynamic` field (both `dynamic` + `success` are optional, so a
@@ -621,6 +247,12 @@ export declare const FlowFileSchema: z.ZodObject<{
621
247
  * the on-disk version stays FLOW_FILE_VERSION 1.
622
248
  */
623
249
  startPath: z.ZodOptional<z.ZodString>;
250
+ /**
251
+ * The saved flow this one was generated from, with different parameters (a fixture's customer,
252
+ * a seeded id). A suite that writes runtime copies of a template and deletes them after replay
253
+ * proved the template, and a strict pass of a copy counts toward it in the gate (#1321).
254
+ */
255
+ template: z.ZodOptional<z.ZodString>;
624
256
  fixture: z.ZodOptional<z.ZodString>;
625
257
  /**
626
258
  * What must already be true for this flow to mean anything, and what it leaves true.
@@ -806,6 +438,7 @@ export declare const FlowFileSchema: z.ZodObject<{
806
438
  scope?: string;
807
439
  self?: boolean;
808
440
  satisfies?: import("../index.js").PropertyAssertion;
441
+ ignoreCase?: boolean;
809
442
  } | {
810
443
  kind: typeof PredicateKind.NET;
811
444
  method?: string;
@@ -818,6 +451,7 @@ export declare const FlowFileSchema: z.ZodObject<{
818
451
  bodyMatches?: Record<string, unknown>;
819
452
  requestBodyContains?: string;
820
453
  requestBodyMatches?: Record<string, unknown>;
454
+ repeatable?: boolean;
821
455
  } | {
822
456
  kind: typeof PredicateKind.ROUTE;
823
457
  pathname?: string;
@@ -1104,6 +738,7 @@ export declare const FlowFileSchema: z.ZodObject<{
1104
738
  scope?: string;
1105
739
  self?: boolean;
1106
740
  satisfies?: import("../index.js").PropertyAssertion;
741
+ ignoreCase?: boolean;
1107
742
  } | {
1108
743
  kind: typeof PredicateKind.NET;
1109
744
  method?: string;
@@ -1116,6 +751,7 @@ export declare const FlowFileSchema: z.ZodObject<{
1116
751
  bodyMatches?: Record<string, unknown>;
1117
752
  requestBodyContains?: string;
1118
753
  requestBodyMatches?: Record<string, unknown>;
754
+ repeatable?: boolean;
1119
755
  } | {
1120
756
  kind: typeof PredicateKind.ROUTE;
1121
757
  pathname?: string;
@@ -1429,6 +1065,7 @@ export declare const FlowFileSchema: z.ZodObject<{
1429
1065
  scope?: string;
1430
1066
  self?: boolean;
1431
1067
  satisfies?: import("../index.js").PropertyAssertion;
1068
+ ignoreCase?: boolean;
1432
1069
  } | {
1433
1070
  kind: typeof PredicateKind.NET;
1434
1071
  method?: string;
@@ -1441,6 +1078,7 @@ export declare const FlowFileSchema: z.ZodObject<{
1441
1078
  bodyMatches?: Record<string, unknown>;
1442
1079
  requestBodyContains?: string;
1443
1080
  requestBodyMatches?: Record<string, unknown>;
1081
+ repeatable?: boolean;
1444
1082
  } | {
1445
1083
  kind: typeof PredicateKind.ROUTE;
1446
1084
  pathname?: string;
@@ -1564,14 +1202,20 @@ export declare const FlowFileSchema: z.ZodObject<{
1564
1202
  kind: z.ZodLiteral<"role">;
1565
1203
  role: z.ZodString;
1566
1204
  name: z.ZodOptional<z.ZodString>;
1205
+ nth: z.ZodOptional<z.ZodNumber>;
1206
+ of: z.ZodOptional<z.ZodNumber>;
1567
1207
  }, "strip", z.ZodTypeAny, {
1568
1208
  kind: "role";
1569
1209
  role: string;
1570
1210
  name?: string | undefined;
1211
+ of?: number | undefined;
1212
+ nth?: number | undefined;
1571
1213
  }, {
1572
1214
  kind: "role";
1573
1215
  role: string;
1574
1216
  name?: string | undefined;
1217
+ of?: number | undefined;
1218
+ nth?: number | undefined;
1575
1219
  }>, z.ZodObject<{
1576
1220
  kind: z.ZodLiteral<"signal">;
1577
1221
  name: z.ZodString;
@@ -1603,22 +1247,22 @@ export declare const FlowFileSchema: z.ZodObject<{
1603
1247
  kind: "component";
1604
1248
  role?: string | undefined;
1605
1249
  component?: string | undefined;
1606
- name?: string | undefined;
1607
1250
  source?: {
1608
1251
  file: string;
1609
1252
  line: number;
1610
1253
  column?: number | undefined;
1611
1254
  } | undefined;
1255
+ name?: string | undefined;
1612
1256
  }, {
1613
1257
  kind: "component";
1614
1258
  role?: string | undefined;
1615
1259
  component?: string | undefined;
1616
- name?: string | undefined;
1617
1260
  source?: {
1618
1261
  file: string;
1619
1262
  line: number;
1620
1263
  column?: number | undefined;
1621
1264
  } | undefined;
1265
+ name?: string | undefined;
1622
1266
  }>]>, "many">>;
1623
1267
  /**
1624
1268
  * Free-form labels a suite selects on — `smoke`, `checkout`, `slow`.
@@ -1726,6 +1370,7 @@ export declare const FlowFileSchema: z.ZodObject<{
1726
1370
  intent?: string | undefined;
1727
1371
  status?: "active" | "quarantined" | "draft" | undefined;
1728
1372
  startPath?: string | undefined;
1373
+ template?: string | undefined;
1729
1374
  learned?: {
1730
1375
  state: "open" | "guarded";
1731
1376
  kind: string;
@@ -1755,6 +1400,8 @@ export declare const FlowFileSchema: z.ZodObject<{
1755
1400
  kind: "role";
1756
1401
  role: string;
1757
1402
  name?: string | undefined;
1403
+ of?: number | undefined;
1404
+ nth?: number | undefined;
1758
1405
  } | {
1759
1406
  kind: "signal";
1760
1407
  name: string;
@@ -1762,12 +1409,12 @@ export declare const FlowFileSchema: z.ZodObject<{
1762
1409
  kind: "component";
1763
1410
  role?: string | undefined;
1764
1411
  component?: string | undefined;
1765
- name?: string | undefined;
1766
1412
  source?: {
1767
1413
  file: string;
1768
1414
  line: number;
1769
1415
  column?: number | undefined;
1770
1416
  } | undefined;
1417
+ name?: string | undefined;
1771
1418
  })[] | undefined;
1772
1419
  labels?: string[] | undefined;
1773
1420
  needs?: string[] | undefined;
@@ -1790,6 +1437,7 @@ export declare const FlowFileSchema: z.ZodObject<{
1790
1437
  intent?: string | undefined;
1791
1438
  status?: "active" | "quarantined" | "draft" | undefined;
1792
1439
  startPath?: string | undefined;
1440
+ template?: string | undefined;
1793
1441
  learned?: {
1794
1442
  state: "open" | "guarded";
1795
1443
  kind: string;
@@ -1924,6 +1572,8 @@ export declare const FlowFileSchema: z.ZodObject<{
1924
1572
  kind: "role";
1925
1573
  role: string;
1926
1574
  name?: string | undefined;
1575
+ of?: number | undefined;
1576
+ nth?: number | undefined;
1927
1577
  } | {
1928
1578
  kind: "signal";
1929
1579
  name: string;
@@ -1931,12 +1581,12 @@ export declare const FlowFileSchema: z.ZodObject<{
1931
1581
  kind: "component";
1932
1582
  role?: string | undefined;
1933
1583
  component?: string | undefined;
1934
- name?: string | undefined;
1935
1584
  source?: {
1936
1585
  file: string;
1937
1586
  line: number;
1938
1587
  column?: number | undefined;
1939
1588
  } | undefined;
1589
+ name?: string | undefined;
1940
1590
  })[] | undefined;
1941
1591
  labels?: string[] | undefined;
1942
1592
  needs?: string[] | undefined;
@@ -2021,6 +1671,12 @@ export declare const RecordedFlowSchema: z.ZodObject<{
2021
1671
  * the on-disk version stays FLOW_FILE_VERSION 1.
2022
1672
  */
2023
1673
  startPath: z.ZodOptional<z.ZodString>;
1674
+ /**
1675
+ * The saved flow this one was generated from, with different parameters (a fixture's customer,
1676
+ * a seeded id). A suite that writes runtime copies of a template and deletes them after replay
1677
+ * proved the template, and a strict pass of a copy counts toward it in the gate (#1321).
1678
+ */
1679
+ template: z.ZodOptional<z.ZodString>;
2024
1680
  fixture: z.ZodOptional<z.ZodString>;
2025
1681
  /**
2026
1682
  * What must already be true for this flow to mean anything, and what it leaves true.
@@ -2206,6 +1862,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
2206
1862
  scope?: string;
2207
1863
  self?: boolean;
2208
1864
  satisfies?: import("../index.js").PropertyAssertion;
1865
+ ignoreCase?: boolean;
2209
1866
  } | {
2210
1867
  kind: typeof PredicateKind.NET;
2211
1868
  method?: string;
@@ -2218,6 +1875,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
2218
1875
  bodyMatches?: Record<string, unknown>;
2219
1876
  requestBodyContains?: string;
2220
1877
  requestBodyMatches?: Record<string, unknown>;
1878
+ repeatable?: boolean;
2221
1879
  } | {
2222
1880
  kind: typeof PredicateKind.ROUTE;
2223
1881
  pathname?: string;
@@ -2504,6 +2162,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
2504
2162
  scope?: string;
2505
2163
  self?: boolean;
2506
2164
  satisfies?: import("../index.js").PropertyAssertion;
2165
+ ignoreCase?: boolean;
2507
2166
  } | {
2508
2167
  kind: typeof PredicateKind.NET;
2509
2168
  method?: string;
@@ -2516,6 +2175,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
2516
2175
  bodyMatches?: Record<string, unknown>;
2517
2176
  requestBodyContains?: string;
2518
2177
  requestBodyMatches?: Record<string, unknown>;
2178
+ repeatable?: boolean;
2519
2179
  } | {
2520
2180
  kind: typeof PredicateKind.ROUTE;
2521
2181
  pathname?: string;
@@ -2829,6 +2489,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
2829
2489
  scope?: string;
2830
2490
  self?: boolean;
2831
2491
  satisfies?: import("../index.js").PropertyAssertion;
2492
+ ignoreCase?: boolean;
2832
2493
  } | {
2833
2494
  kind: typeof PredicateKind.NET;
2834
2495
  method?: string;
@@ -2841,6 +2502,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
2841
2502
  bodyMatches?: Record<string, unknown>;
2842
2503
  requestBodyContains?: string;
2843
2504
  requestBodyMatches?: Record<string, unknown>;
2505
+ repeatable?: boolean;
2844
2506
  } | {
2845
2507
  kind: typeof PredicateKind.ROUTE;
2846
2508
  pathname?: string;
@@ -2964,14 +2626,20 @@ export declare const RecordedFlowSchema: z.ZodObject<{
2964
2626
  kind: z.ZodLiteral<"role">;
2965
2627
  role: z.ZodString;
2966
2628
  name: z.ZodOptional<z.ZodString>;
2629
+ nth: z.ZodOptional<z.ZodNumber>;
2630
+ of: z.ZodOptional<z.ZodNumber>;
2967
2631
  }, "strip", z.ZodTypeAny, {
2968
2632
  kind: "role";
2969
2633
  role: string;
2970
2634
  name?: string | undefined;
2635
+ of?: number | undefined;
2636
+ nth?: number | undefined;
2971
2637
  }, {
2972
2638
  kind: "role";
2973
2639
  role: string;
2974
2640
  name?: string | undefined;
2641
+ of?: number | undefined;
2642
+ nth?: number | undefined;
2975
2643
  }>, z.ZodObject<{
2976
2644
  kind: z.ZodLiteral<"signal">;
2977
2645
  name: z.ZodString;
@@ -3003,22 +2671,22 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3003
2671
  kind: "component";
3004
2672
  role?: string | undefined;
3005
2673
  component?: string | undefined;
3006
- name?: string | undefined;
3007
2674
  source?: {
3008
2675
  file: string;
3009
2676
  line: number;
3010
2677
  column?: number | undefined;
3011
2678
  } | undefined;
2679
+ name?: string | undefined;
3012
2680
  }, {
3013
2681
  kind: "component";
3014
2682
  role?: string | undefined;
3015
2683
  component?: string | undefined;
3016
- name?: string | undefined;
3017
2684
  source?: {
3018
2685
  file: string;
3019
2686
  line: number;
3020
2687
  column?: number | undefined;
3021
2688
  } | undefined;
2689
+ name?: string | undefined;
3022
2690
  }>]>, "many">>;
3023
2691
  /**
3024
2692
  * Free-form labels a suite selects on — `smoke`, `checkout`, `slow`.
@@ -3126,6 +2794,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3126
2794
  intent?: string | undefined;
3127
2795
  status?: "active" | "quarantined" | "draft" | undefined;
3128
2796
  startPath?: string | undefined;
2797
+ template?: string | undefined;
3129
2798
  learned?: {
3130
2799
  state: "open" | "guarded";
3131
2800
  kind: string;
@@ -3155,6 +2824,8 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3155
2824
  kind: "role";
3156
2825
  role: string;
3157
2826
  name?: string | undefined;
2827
+ of?: number | undefined;
2828
+ nth?: number | undefined;
3158
2829
  } | {
3159
2830
  kind: "signal";
3160
2831
  name: string;
@@ -3162,12 +2833,12 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3162
2833
  kind: "component";
3163
2834
  role?: string | undefined;
3164
2835
  component?: string | undefined;
3165
- name?: string | undefined;
3166
2836
  source?: {
3167
2837
  file: string;
3168
2838
  line: number;
3169
2839
  column?: number | undefined;
3170
2840
  } | undefined;
2841
+ name?: string | undefined;
3171
2842
  })[] | undefined;
3172
2843
  labels?: string[] | undefined;
3173
2844
  needs?: string[] | undefined;
@@ -3190,6 +2861,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3190
2861
  intent?: string | undefined;
3191
2862
  status?: "active" | "quarantined" | "draft" | undefined;
3192
2863
  startPath?: string | undefined;
2864
+ template?: string | undefined;
3193
2865
  learned?: {
3194
2866
  state: "open" | "guarded";
3195
2867
  kind: string;
@@ -3324,6 +2996,8 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3324
2996
  kind: "role";
3325
2997
  role: string;
3326
2998
  name?: string | undefined;
2999
+ of?: number | undefined;
3000
+ nth?: number | undefined;
3327
3001
  } | {
3328
3002
  kind: "signal";
3329
3003
  name: string;
@@ -3331,12 +3005,12 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3331
3005
  kind: "component";
3332
3006
  role?: string | undefined;
3333
3007
  component?: string | undefined;
3334
- name?: string | undefined;
3335
3008
  source?: {
3336
3009
  file: string;
3337
3010
  line: number;
3338
3011
  column?: number | undefined;
3339
3012
  } | undefined;
3013
+ name?: string | undefined;
3340
3014
  })[] | undefined;
3341
3015
  labels?: string[] | undefined;
3342
3016
  needs?: string[] | undefined;
@@ -3361,6 +3035,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3361
3035
  intent?: string | undefined;
3362
3036
  status?: "active" | "quarantined" | "draft" | undefined;
3363
3037
  startPath?: string | undefined;
3038
+ template?: string | undefined;
3364
3039
  learned?: {
3365
3040
  state: "open" | "guarded";
3366
3041
  kind: string;
@@ -3390,6 +3065,8 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3390
3065
  kind: "role";
3391
3066
  role: string;
3392
3067
  name?: string | undefined;
3068
+ of?: number | undefined;
3069
+ nth?: number | undefined;
3393
3070
  } | {
3394
3071
  kind: "signal";
3395
3072
  name: string;
@@ -3397,12 +3074,12 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3397
3074
  kind: "component";
3398
3075
  role?: string | undefined;
3399
3076
  component?: string | undefined;
3400
- name?: string | undefined;
3401
3077
  source?: {
3402
3078
  file: string;
3403
3079
  line: number;
3404
3080
  column?: number | undefined;
3405
3081
  } | undefined;
3082
+ name?: string | undefined;
3406
3083
  })[] | undefined;
3407
3084
  labels?: string[] | undefined;
3408
3085
  needs?: string[] | undefined;
@@ -3428,6 +3105,7 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3428
3105
  intent?: string | undefined;
3429
3106
  status?: "active" | "quarantined" | "draft" | undefined;
3430
3107
  startPath?: string | undefined;
3108
+ template?: string | undefined;
3431
3109
  learned?: {
3432
3110
  state: "open" | "guarded";
3433
3111
  kind: string;
@@ -3562,6 +3240,8 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3562
3240
  kind: "role";
3563
3241
  role: string;
3564
3242
  name?: string | undefined;
3243
+ of?: number | undefined;
3244
+ nth?: number | undefined;
3565
3245
  } | {
3566
3246
  kind: "signal";
3567
3247
  name: string;
@@ -3569,12 +3249,12 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3569
3249
  kind: "component";
3570
3250
  role?: string | undefined;
3571
3251
  component?: string | undefined;
3572
- name?: string | undefined;
3573
3252
  source?: {
3574
3253
  file: string;
3575
3254
  line: number;
3576
3255
  column?: number | undefined;
3577
3256
  } | undefined;
3257
+ name?: string | undefined;
3578
3258
  })[] | undefined;
3579
3259
  labels?: string[] | undefined;
3580
3260
  needs?: string[] | undefined;
@@ -3592,40 +3272,6 @@ export declare const RecordedFlowSchema: z.ZodObject<{
3592
3272
  };
3593
3273
  name: string;
3594
3274
  }>;
3595
- /** A concrete, confidence-scored rebind proposed for one drifted step. */
3596
- export interface HealProposal {
3597
- /** 0-based step index in the flow. */
3598
- step: number;
3599
- /** Old (missing) testid anchor value. */
3600
- from: string;
3601
- /** Proposed nearest present testid. */
3602
- to: string;
3603
- /** Normalized (0,1]; >= HEAL_CONFIDENCE_MIN to be applicable. */
3604
- confidence: number;
3605
- }
3606
- /** One applied rebind (a HealProposal that was written to disk). */
3607
- export interface HealChange {
3608
- step: number;
3609
- from: string;
3610
- to: string;
3611
- }
3612
- /** The reticle_flow_heal envelope. */
3613
- export interface FlowHealResult {
3614
- name: string;
3615
- status: HealStatus;
3616
- /** Whether the file was rewritten (true only when status === 'healed'). */
3617
- applied: boolean;
3618
- /** Confident, applicable rebinds. With apply:false these are the dry-run diff. */
3619
- proposals: HealProposal[];
3620
- /** Anchors actually written (empty unless applied). */
3621
- changed: HealChange[];
3622
- /** Human one-liner for the agent (e.g. "nothing to heal", floor explanation). */
3623
- message: string;
3624
- error?: {
3625
- code: string;
3626
- message: string;
3627
- };
3628
- }
3629
3275
  export type RecordedFlow = z.infer<typeof RecordedFlowSchema>;
3630
3276
  /**
3631
3277
  * One replayable-flow chip on the in-page HUD.
@@ -3642,6 +3288,8 @@ export interface FlowChip {
3642
3288
  name: string;
3643
3289
  /** The testid the flow's first step anchors to, when it has one — the panel hides chips that cannot start on the current page. */
3644
3290
  start?: string;
3291
+ /** Saved time, used to put recent flows first in the HUD. Older flow stores may omit it. */
3292
+ createdAt?: number;
3645
3293
  }
3646
3294
  /** One recorded known bug, as stored on a flow. */
3647
3295
  export type KnownBug = NonNullable<FlowFile['knownBugs']>[number];