@reticlehq/core 3.6.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 (90) hide show
  1. package/dist/artifacts/artifacts-entry.d.ts +2 -0
  2. package/dist/artifacts/artifacts-entry.js +2 -0
  3. package/dist/artifacts/drive-script.d.ts +158 -52
  4. package/dist/artifacts/drive-script.js +24 -1
  5. package/dist/artifacts/flow-constants.d.ts +18 -0
  6. package/dist/artifacts/flow-constants.js +20 -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 +25 -437
  10. package/dist/artifacts/flow-types.js +5 -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/impact.d.ts +354 -145
  16. package/dist/artifacts/impact.js +66 -48
  17. package/dist/artifacts/journal.d.ts +56 -5
  18. package/dist/artifacts/journal.js +26 -0
  19. package/dist/artifacts/screenshot-upload.d.ts +51 -0
  20. package/dist/artifacts/screenshot-upload.js +26 -0
  21. package/dist/hooks/hook-events.d.ts +4 -4
  22. package/dist/hud-entry.d.ts +1 -0
  23. package/dist/hud-entry.js +2 -0
  24. package/dist/index.d.ts +5 -0
  25. package/dist/index.js +5 -0
  26. package/dist/onboarding.d.ts +8 -0
  27. package/dist/onboarding.js +6 -0
  28. package/dist/realm/registry.js +19 -1
  29. package/dist/schema/command-message.json +30 -0
  30. package/dist/schema/command-name.json +3 -1
  31. package/dist/schema/event-payloads.json +40 -2
  32. package/dist/schema/reticle-message.json +30 -0
  33. package/dist/telemetry-bug.d.ts +169 -0
  34. package/dist/telemetry-bug.js +123 -0
  35. package/dist/telemetry-entry.d.ts +1 -0
  36. package/dist/telemetry-entry.js +1 -0
  37. package/dist/telemetry-feedback.d.ts +2 -2
  38. package/dist/telemetry-refusal.d.ts +2 -2
  39. package/dist/telemetry-session.d.ts +74 -0
  40. package/dist/telemetry-session.js +54 -0
  41. package/dist/telemetry-signals.d.ts +339 -0
  42. package/dist/telemetry-signals.js +138 -0
  43. package/dist/telemetry.d.ts +300 -254
  44. package/dist/telemetry.js +40 -115
  45. package/dist/verdict/disparity.d.ts +105 -0
  46. package/dist/verdict/disparity.js +40 -0
  47. package/dist/verdict/findings.d.ts +6 -0
  48. package/dist/verdict/findings.js +9 -0
  49. package/dist/verdict/instrumentation-coverage.d.ts +115 -0
  50. package/dist/verdict/instrumentation-coverage.js +226 -0
  51. package/dist/verdict/instrumentation-gap.js +1 -1
  52. package/dist/verdict/intent.d.ts +19 -5
  53. package/dist/verdict/intent.js +13 -1
  54. package/dist/verdict/predicate-tree.d.ts +15 -0
  55. package/dist/verdict/predicate-tree.js +21 -0
  56. package/dist/verdict/predicate.d.ts +14 -0
  57. package/dist/verdict/predicate.js +87 -3
  58. package/dist/verdict/security.d.ts +25 -0
  59. package/dist/verdict/security.js +82 -0
  60. package/dist/verdict/verification-run.d.ts +620 -32
  61. package/dist/verdict/verification-run.js +82 -0
  62. package/dist/wire/constants/constants.d.ts +15 -16
  63. package/dist/wire/constants/constants.js +16 -17
  64. package/dist/wire/constants/hud-controls.js +17 -5
  65. package/dist/wire/constants/hud-use.d.ts +29 -4
  66. package/dist/wire/constants/hud-use.js +26 -4
  67. package/dist/wire/constants/mcp-wire.d.ts +10 -0
  68. package/dist/wire/constants/mcp-wire.js +10 -0
  69. package/dist/wire/constants/reticle-chrome.d.ts +19 -0
  70. package/dist/wire/constants/reticle-chrome.js +19 -0
  71. package/dist/wire/constants/session-constants.d.ts +15 -2
  72. package/dist/wire/constants/session-constants.js +15 -2
  73. package/dist/wire/desktop-contract.d.ts +8 -0
  74. package/dist/wire/desktop-contract.js +11 -0
  75. package/dist/wire/event-payloads.d.ts +56 -4
  76. package/dist/wire/event-payloads.js +17 -0
  77. package/dist/wire/messages.d.ts +105 -32
  78. package/dist/wire/messages.js +9 -1
  79. package/dist/wire/platform-link.d.ts +77 -0
  80. package/dist/wire/platform-link.js +45 -0
  81. package/dist/wire/tool-names.d.ts +2 -0
  82. package/dist/wire/tool-names.js +2 -0
  83. package/dist/wire/types.d.ts +19 -6
  84. package/dist/wire/types.js +5 -0
  85. package/dist/words/notices.d.ts +1 -1
  86. package/dist/words/notices.js +1 -1
  87. package/dist/words/upgrade.js +1 -1
  88. package/dist/words/writing-rule.d.ts +14 -0
  89. package/dist/words/writing-rule.js +17 -0
  90. package/package.json +1 -1
@@ -23,7 +23,11 @@ export const ScriptStepKind = {
23
23
  CHECKPOINT: 'checkpoint',
24
24
  BRANCH: 'branch',
25
25
  };
26
+ /** How a journey of a plan was answered: its saved flows replayed (no model), or the model drove it. */
27
+ export const JourneyBy = { REPLAY: 'replay', MODEL: 'model' };
26
28
  export const ScriptSource = { LOCAL: 'local', PLATFORM: 'platform' };
29
+ /** How the journey a condition names must have ended for the conditional one to run. */
30
+ export const JourneyOutcome = { PASSED: 'passed', FAILED: 'failed' };
27
31
  const ReplayStep = z.object({
28
32
  kind: z.literal(ScriptStepKind.REPLAY),
29
33
  flow: z.string().min(1),
@@ -74,7 +78,23 @@ export const JourneySchema = z.object({
74
78
  title: z.string().min(1),
75
79
  persona: z.string().optional(),
76
80
  dependsOn: z.array(z.string()).default([]),
81
+ /**
82
+ * Run only when an earlier journey ended this way, else it is not taken: "if sign-in failed, the
83
+ * error says why". Unlike `dependsOn` it is not blocked by a failure; a failure can be the point.
84
+ */
85
+ when: z
86
+ .object({
87
+ journey: z.string().min(1),
88
+ is: z.enum([JourneyOutcome.PASSED, JourneyOutcome.FAILED]),
89
+ })
90
+ .optional(),
77
91
  steps: z.array(ScriptStepSchema).min(1),
92
+ /**
93
+ * Replay first: when every replay in `steps` decides nothing (neither held nor failed), the model
94
+ * drives this goal instead. A replay that failed is a regression and is never re-driven. An older
95
+ * platform omits it.
96
+ */
97
+ fallback: z.object({ goal: z.string().min(1) }).optional(),
78
98
  });
79
99
  export const LaneSchema = z.object({
80
100
  id: z.string().min(1),
@@ -113,6 +133,8 @@ export function checkScript(script) {
113
133
  if (!byId.has(dep))
114
134
  problems.push(`journey "${journey.id}" depends on unknown "${dep}"`);
115
135
  }
136
+ if (journey.when !== undefined && !byId.has(journey.when.journey))
137
+ problems.push(`journey "${journey.id}" runs when unknown "${journey.when.journey}" ends`);
116
138
  problems.push(...checkBranches(journey));
117
139
  }
118
140
  script.lanes.forEach((lane, laneIndex) => {
@@ -122,7 +144,8 @@ export function checkScript(script) {
122
144
  problems.push(`lane "${lane.id}" names unknown journey "${id}"`);
123
145
  return;
124
146
  }
125
- for (const dep of journey.dependsOn) {
147
+ const after = journey.when === undefined ? [] : [journey.when.journey];
148
+ for (const dep of [...journey.dependsOn, ...after]) {
126
149
  if (!byId.has(dep))
127
150
  continue;
128
151
  const sameLane = lane.journeys.slice(0, position).includes(dep);
@@ -104,6 +104,24 @@ export type AnchorKind = (typeof AnchorKind)[keyof typeof AnchorKind];
104
104
  * here" marker that a human/self-healing pass re-binds. Satisfies the anchor min(1).
105
105
  */
106
106
  export declare const DEGRADED_ANCHOR_ROLE = "unresolved";
107
+ /**
108
+ * The JSON replacer every flow is written and sent with: a predicate flag at its default is left
109
+ * out. An older platform's schema rejects a key it does not know (`ignoreCase` on a text check was
110
+ * refused on every sync), so a flow that never asked for the flag must not carry it; only a check
111
+ * that really is case-insensitive depends on a platform that knows the word.
112
+ */
113
+ export declare function flowJsonReplacer(key: string, value: unknown): unknown;
114
+ /**
115
+ * How a missing flow is said, so a reader of a replay's error can tell "not on this computer" from
116
+ * "the journey failed": a whole-app run called missing flows "regressions in journeys that used to
117
+ * pass".
118
+ */
119
+ export declare const NO_SUCH_FLOW = "no such flow on disk";
120
+ /**
121
+ * A flow that calls one not on disk stops there, having never run: said with `NO_SUCH_FLOW`, so a
122
+ * plan does not call a flow that never passed a "regression in a journey that used to pass".
123
+ */
124
+ export declare const invokedFlowMissing: (name: string) => string;
107
125
  /** Structured failure codes for flow disk ops (returned, never thrown as free strings). */
108
126
  export declare const FlowErrorCode: {
109
127
  readonly INVALID_NAME: "flow_invalid_name";
@@ -116,6 +116,26 @@ export const AnchorKind = {
116
116
  * here" marker that a human/self-healing pass re-binds. Satisfies the anchor min(1).
117
117
  */
118
118
  export const DEGRADED_ANCHOR_ROLE = 'unresolved';
119
+ /**
120
+ * The JSON replacer every flow is written and sent with: a predicate flag at its default is left
121
+ * out. An older platform's schema rejects a key it does not know (`ignoreCase` on a text check was
122
+ * refused on every sync), so a flow that never asked for the flag must not carry it; only a check
123
+ * that really is case-insensitive depends on a platform that knows the word.
124
+ */
125
+ export function flowJsonReplacer(key, value) {
126
+ return 'ignoreCase' === key && false === value ? undefined : value;
127
+ }
128
+ /**
129
+ * How a missing flow is said, so a reader of a replay's error can tell "not on this computer" from
130
+ * "the journey failed": a whole-app run called missing flows "regressions in journeys that used to
131
+ * pass".
132
+ */
133
+ export const NO_SUCH_FLOW = 'no such flow on disk';
134
+ /**
135
+ * A flow that calls one not on disk stops there, having never run: said with `NO_SUCH_FLOW`, so a
136
+ * plan does not call a flow that never passed a "regression in a journey that used to pass".
137
+ */
138
+ export const invokedFlowMissing = (name) => `cannot replay "${name}": ${NO_SUCH_FLOW}, so this journey would report green having never run it`;
119
139
  /** Structured failure codes for flow disk ops (returned, never thrown as free strings). */
120
140
  export const FlowErrorCode = {
121
141
  INVALID_NAME: 'flow_invalid_name', // path traversal / illegal chars
@@ -0,0 +1,450 @@
1
+ /**
2
+ * What replaying, verifying and healing a flow REPORT — the result envelopes, as opposed to the flow
3
+ * file they run.
4
+ *
5
+ * Split from `flow-types.ts`, which keeps the on-disk shape and its zod schemas. Everything here is a
6
+ * plain type with no runtime value, and `flow-types.ts` re-exports it, so the one public name for "a
7
+ * flow's types" still answers for both halves.
8
+ */
9
+ import type { Contradiction } from '../verdict/findings.js';
10
+ import type { DriftReason, HealStatus, ReplayStatus, SuiteIsolation } from './flow-constants.js';
11
+ /**
12
+ * A legible-drift record returned when an anchor misses at replay.
13
+ * The "whose fault is it" payload: what was expected, why it's gone, and the closest surviving
14
+ * anchor (a concrete fix suggestion). Never a bare "command failed".
15
+ */
16
+ export interface Drift {
17
+ /** Named reason kind (testid not found / signal not observed). */
18
+ reasonKind: DriftReason;
19
+ /** Human sentence, e.g. `testid "chat-send" not found`. */
20
+ reason: string;
21
+ /** The missed anchor value (the testid string, or the signal name). */
22
+ anchor: string;
23
+ /** Closest present testid via the live near-miss; null only when the page has no testids (or signal drift). */
24
+ nearest: string | null;
25
+ /**
26
+ * True when two or more present testids tie at the minimum edit distance, so `nearest` is an
27
+ * arbitrary pick. An ambiguous drift is NEVER auto-healed (a wrong rebind ships a bug green) —
28
+ * it is surfaced for a human/agent to choose. Absent ⇒ unambiguous.
29
+ */
30
+ ambiguous?: boolean;
31
+ }
32
+ /** The per-step result of re-resolving + running one anchored step. */
33
+ /**
34
+ * Counts of what an app did inside one window, and the width of that window.
35
+ *
36
+ * Defined HERE because it is part of the artifact contract, and consumed by the engine that computes
37
+ * it: core is the bottom of the graph and everything depends on it, so one shape lives in one place
38
+ * rather than being declared twice and drifting.
39
+ */
40
+ export interface ReactionSummary {
41
+ total: number;
42
+ network: number;
43
+ domAdded: number;
44
+ domRemoved: number;
45
+ domChanged: number;
46
+ routeChanges: number;
47
+ consoleErrors: number;
48
+ animations: number;
49
+ signals: number;
50
+ }
51
+ /**
52
+ * The digest's counts: `total` always, every other counter only when it is NON-ZERO.
53
+ *
54
+ * This shape is sparse and the full `ReactionSummary` above is not, on purpose. The digest ships on
55
+ * every step of every replay and on every `act_and_wait`; the full report does not. Across a
56
+ * four-step replay 25 of 36 counters are typically zero — every step spelling out `"network":0,
57
+ * "domAdded":0,"routeChanges":0,…` whether or not anything moved.
58
+ *
59
+ * Omitting a zero is a ROUTE cut and never an evidence cut: an absent counter IS zero, so the reader
60
+ * answers the same question from the same facts. Read one as `summary.network ?? 0`.
61
+ *
62
+ * `total` is unconditional because "the window was empty" is itself evidence, and a summary with no
63
+ * keys could not be told apart from one that was never computed.
64
+ */
65
+ export type ReactionSummaryDigest = {
66
+ total: number;
67
+ } & Partial<Omit<ReactionSummary, 'total'>>;
68
+ /** The lean reaction report: the window and the counts, without the per-event timeline. */
69
+ export interface ReactionDigest {
70
+ window_ms: number;
71
+ summary: ReactionSummaryDigest;
72
+ }
73
+ export interface FlowStepResult {
74
+ /** 0-based index of this step in the flow. */
75
+ step: number;
76
+ /**
77
+ * Where the screenshot of the page at this step's outcome is, and how it was taken — or why
78
+ * there is none. A path to open when the look of the page matters; never the image itself.
79
+ */
80
+ screenshot?: {
81
+ path: string;
82
+ source: string;
83
+ } | {
84
+ error: string;
85
+ };
86
+ /**
87
+ * The tool the step runs — FlowStepTool.ACT | ACT_SEQUENCE | the synthetic success oracle.
88
+ *
89
+ * OMITTED when it is `ACT`, which 137/137 steps in this repo's corpus are. Read it as
90
+ * `tool ?? FlowStepTool.ACT`. Every reader only ever asks "is this the success oracle?", and a
91
+ * missing field is correctly falsy against that — so the coercion fails in the safe direction.
92
+ */
93
+ tool?: string;
94
+ /** The testid/signal value the step is bound to (the re-resolved anchor). */
95
+ anchor: string;
96
+ /**
97
+ * Where this step lives, rendered, when the flow is a COMPOSITE — `signin#0 (invoked from full#1)`.
98
+ *
99
+ * Absent for a flat flow, where `step` is already the whole answer and an address on every row
100
+ * would be noise on every replay of every flow.
101
+ */
102
+ at?: string;
103
+ /**
104
+ * The route (pathname) the page was on when this step ran — the "which page" of the journey.
105
+ * Additive/optional: present when a route is observable, absent in route-less contexts (e.g. a
106
+ * fake session with no route events). Lets a replay result read as a page-by-page journey.
107
+ */
108
+ page?: string;
109
+ /** The route the page was on once this step settled — where it led. Absent when unobservable. */
110
+ endPage?: string;
111
+ /**
112
+ * A compact summary of the observable CONSEQUENCE in the window right after this step ran — the
113
+ * "what happened" of the journey: a route change, a domain signal (e.g. a modal opening), a
114
+ * network call, or console errors. Additive/optional and intentionally terse (token-cheap). It
115
+ * captures what had landed by the time the action settled, so a very-late async effect may not
116
+ * appear; the asserted consequence (expect/success) is the authoritative pass/fail signal.
117
+ */
118
+ consequence?: string;
119
+ /**
120
+ * Wall-clock ms this step took (dispatch → post-settle), from the session's injected elapsed clock.
121
+ * Additive/optional: absent in contexts with no advancing clock. Feeds per-step run-to-run perf diffs.
122
+ */
123
+ durationMs?: number;
124
+ /**
125
+ * The event-stream span this step's evidence lives in — its drill address.
126
+ *
127
+ * `reticle_observe` already accepts `{ since, until }` and returns "the span between action A and
128
+ * B", so a step that carries its own window is a step somebody can ask about afterwards without
129
+ * re-driving anything. Without it the evidence is captured and has no address, which is why a
130
+ * deterministic run could say a step passed and nothing more.
131
+ *
132
+ * Bounded on BOTH ends deliberately. A `since` alone returns everything from that point to now, so
133
+ * on a long flow step two's window would include steps three through twenty-five — and an agent
134
+ * reading it would attribute the whole tail to one click.
135
+ *
136
+ * Additive/optional, and omitted rather than zero-width where no clock advanced: a `{since: 0,
137
+ * until: 0}` would read as "this step caused nothing" instead of "nothing here measures time".
138
+ */
139
+ window?: {
140
+ since: number;
141
+ until: number;
142
+ };
143
+ /**
144
+ * What the app DID in that window, as counts.
145
+ *
146
+ * `consequence` beside it is a sentence — readable, and not scannable. Twenty-five sentences is
147
+ * prose somebody has to read; twenty-five of these is a surface they can skim for the one row that
148
+ * is unlike the others, which is the whole difference between a step ledger and a wall of text.
149
+ *
150
+ * The counts, not the events. The per-event timeline is the expensive half and it is one
151
+ * `reticle_observe { since, until }` away using this step's own `window`, so the cheap form is
152
+ * what travels and the full form is addressable rather than sent.
153
+ */
154
+ digest?: ReactionDigest;
155
+ /**
156
+ * Channels that DISAGREE about what this step did — reported even when the step passed.
157
+ *
158
+ * That is the entire point. A step whose anchor resolved, whose action fired and whose declared
159
+ * consequence held, while a request in the same window failed, is the false green this product
160
+ * exists to catch. The detectors run independently of the assertion, so a green step with an entry
161
+ * here is a finding, not a contradiction in terms.
162
+ *
163
+ * Omitted when the channels agree, never an empty array: a field that is always present teaches a
164
+ * reader to skim past it, and the whole value here is that its presence is the signal.
165
+ */
166
+ contradictions?: Contradiction[];
167
+ /**
168
+ * The console errors and uncaught exceptions this step's window saw, the first few only; `digest`
169
+ * still counts every one. A run artifact's `evidence.consoleErrors` is built from these, so it
170
+ * reports what replay observed instead of claiming a clean console. Omitted when there were none.
171
+ */
172
+ consoleErrors?: {
173
+ level: string;
174
+ message: string;
175
+ at: number;
176
+ }[];
177
+ ok: boolean;
178
+ error?: string;
179
+ note?: string;
180
+ /** Present iff this step stopped on an anchor miss. */
181
+ drift?: Drift;
182
+ /**
183
+ * A confidence-scored nearest-match rebind for this drifted step (additive,
184
+ * optional). Set only for a confident testid drift.
185
+ */
186
+ proposal?: HealProposal;
187
+ }
188
+ /**
189
+ * The autonomy decision envelope — the feedback a human used to give, made machine-actionable. From
190
+ * a replay result it states the verdict, what changed, WHERE in the source to look (file:line, from a
191
+ * component anchor), a suggested fix, and the single next action — so a coding agent decides its next
192
+ * move without a human in the loop. Terse by design (token-cheap).
193
+ */
194
+ export interface ReplayDecision {
195
+ /** pass = intent held; drift = a locator/anchor missed; fail = an action or the success oracle failed. */
196
+ verdict: 'pass' | 'drift' | 'fail';
197
+ /** One-line human/agent summary of the outcome. */
198
+ summary: string;
199
+ /** What regressed (the drift reason or failure), when not a pass. */
200
+ whatChanged?: string;
201
+ /** Where to look — `file:line` from the failing step's source anchor, or the page route. */
202
+ whereInSource?: string;
203
+ /** A concrete fix hint (e.g. rebind to the nearest surviving anchor). */
204
+ suggestedFix?: string;
205
+ /** The single next action the agent should take. */
206
+ nextAction: string;
207
+ }
208
+ /**
209
+ * One flow's line in a suite verdict — pass counts as a name; a failure carries the actionable
210
+ * decision fields so the agent can fix it without re-querying.
211
+ */
212
+ export interface SuiteFlowResult {
213
+ flow: string;
214
+ /**
215
+ * The flow never ran: its file failed to load, or its leased context never came up. Nothing was
216
+ * learned about the app, so this row is not a regression — it is Reticle reporting its own failure
217
+ * in the same array as the app's. Measured: one sweep emitted 8 `flow-regression` bug_found events
218
+ * off rows like these, from a suite where no flow ever executed.
219
+ */
220
+ couldNotRun?: boolean;
221
+ verdict: 'pass' | 'drift' | 'fail';
222
+ whatChanged?: string;
223
+ whereInSource?: string;
224
+ nextAction?: string;
225
+ }
226
+ /**
227
+ * The consolidated verdict of replaying EVERY known flow — the autonomous loop's "did I break
228
+ * anything, and what do I fix" answer in one deterministic call. Passing flows are counted; only
229
+ * failures carry detail (token-cheap). `status` is fail if any flow drifted or errored.
230
+ */
231
+ export interface SuiteVerdict {
232
+ /**
233
+ * `unverifiable` means the suite contained flows that CANNOT FAIL, so "pass" would be a lie.
234
+ *
235
+ * A recorded flow with no steps, or one that asserts no observable consequence, replays green no
236
+ * matter what the app does. Reporting `pass` for it is a false green in the exact feature sold as
237
+ * the regression suite — measured: a flow saved as `{steps: [], intent: "..."}`, which `flow_save`
238
+ * had ALREADY graded assertion-free with a warning, came back "all 1 flow pass".
239
+ */
240
+ status: 'pass' | 'fail' | 'unverifiable';
241
+ total: number;
242
+ passed: number;
243
+ failed: number;
244
+ summary: string;
245
+ /** The ready-to-paste "Reticle result" block the agent ends with; built by the server. */
246
+ reticleResult?: string;
247
+ /** Only the failing flows, with their decision (verdict, what changed, where, next action). */
248
+ failures: SuiteFlowResult[];
249
+ /**
250
+ * How the flows were kept apart — see `SuiteIsolation`.
251
+ *
252
+ * Absent when the caller did not say. Present, it is the difference between two counts that can
253
+ * be compared and two that cannot: a shared-session pass may be inherited from an earlier flow.
254
+ */
255
+ isolation?: SuiteIsolation;
256
+ /**
257
+ * Flows that replayed without error but assert nothing, so their green means nothing. Counted
258
+ * apart from `passed` — a number that includes them is not a count of anything verified.
259
+ */
260
+ unverifiable?: {
261
+ flow: string;
262
+ reason: string;
263
+ }[];
264
+ /**
265
+ * Flows that have both passed AND failed on UNCHANGED code — intermittent, not regressions.
266
+ *
267
+ * A flake and a regression demand opposite responses: one is chased, the other is quarantined. The
268
+ * ledger that answers this already existed and was written only by the CLI, so an agent replaying a
269
+ * suite a hundred times could never learn which of its failures were noise. Omitted entirely when
270
+ * the ledger has not seen enough runs to say.
271
+ */
272
+ flaky?: string[];
273
+ /**
274
+ * How much of what the suite DROVE it actually proved.
275
+ *
276
+ * `unverifiable` above catches a flow that asserts nothing at all. It cannot catch the commoner
277
+ * shape: a flow of twelve steps where three declare a consequence and nine do not. That flow
278
+ * passes, counts in `passed`, and nine of its steps would have replayed green whether or not the
279
+ * feature worked.
280
+ *
281
+ * So the count travels. Sixty-three steps driven and forty-seven declared is not "75% verified" —
282
+ * it is verified for forty-seven and silent about sixteen, and only a number carrying both lets a
283
+ * reader tell those apart. Omitted when no flow file was available to count, because an invented
284
+ * zero would read as "nothing was declared" rather than "nothing was counted".
285
+ */
286
+ coverage?: {
287
+ steps: number;
288
+ declared: number;
289
+ };
290
+ /**
291
+ * Known routes this run never opened.
292
+ *
293
+ * `coverage` above counts what the suite DROVE. Neither it nor anything else here notices a route
294
+ * no flow goes near — so a selection replaying two of eleven flows reports "all 2 flows pass",
295
+ * which is true and says nothing about the nine routes that were not looked at.
296
+ *
297
+ * Known means seen before, not enumerated from the app: every flow the project holds contributes
298
+ * the route it starts on. Omitted when the caller knows of no routes, because "0 unreached" from
299
+ * an empty ledger reads as a clean sweep rather than as an unanswered question.
300
+ */
301
+ unreached?: string[];
302
+ /**
303
+ * Every channel disagreement the suite saw, including on flows that PASSED.
304
+ *
305
+ * The step-level rule already says a contradiction is reported regardless of `ok`, for the reason
306
+ * that a step whose action fired and whose consequence held, while a request in the same window
307
+ * failed, is the false green this product exists to catch. The suite verdict returned only its
308
+ * failures, so on a green run every one of those was computed, attached to a step, and discarded
309
+ * at exactly the moment somebody would have read it — a nightly run of a hundred steps reporting
310
+ * "all 12 flows pass".
311
+ *
312
+ * Carrying them also means a green suite is not reported as `pass`: see `status`.
313
+ */
314
+ contradictions?: SuiteContradiction[];
315
+ }
316
+ /** A step-level contradiction, addressed back to the flow and step that produced it. */
317
+ export interface SuiteContradiction extends Contradiction {
318
+ flow: string;
319
+ /** Index within the flow, so the reader can drill straight to the step's own window. */
320
+ step: number;
321
+ }
322
+ /** The reticle_flow_replay envelope. */
323
+ export interface FlowReplayResult {
324
+ name: string;
325
+ status: ReplayStatus;
326
+ /**
327
+ * The verification run this replay was written down as, so whoever started it (the platform's
328
+ * Re-verify) can tie its check to the run and a passing replay resolves the issue it was for.
329
+ */
330
+ runId?: string;
331
+ /**
332
+ * Contradictions that span steps — found by re-running the detectors over the WHOLE replay, minus
333
+ * everything a step already reported.
334
+ *
335
+ * A step's window closes when the step ends, so a request fired at step 2 and still unanswered at
336
+ * step 5 sits outside every per-step window. It is exactly the shape a long journey produces and
337
+ * exactly the shape a per-step view cannot see.
338
+ *
339
+ * Omitted when the whole-span pass adds nothing over the steps.
340
+ */
341
+ crossStep?: Contradiction[];
342
+ /**
343
+ * What this flow knows after this run — every defect it has seen, and whether it is still open.
344
+ *
345
+ * Written back to the flow file so the next replay starts from it. This is how a flow gets
346
+ * stricter without anybody writing a new assertion: a defect observed, then observed GONE, becomes
347
+ * something the app can never quietly reacquire.
348
+ */
349
+ learned?: {
350
+ kind: string;
351
+ step: number;
352
+ state: 'open' | 'guarded';
353
+ cleanRuns?: number | undefined;
354
+ }[];
355
+ /** Defects this run saw disappear. The app got better here. */
356
+ promoted?: string[];
357
+ /** Guarded defects that came back. The app got worse here, and only this flow would have known. */
358
+ regressed?: string[];
359
+ steps: FlowStepResult[];
360
+ /** The machine-actionable decision derived from this replay (autonomy layer). */
361
+ decision?: ReplayDecision;
362
+ /** Set when status === 'error' (load failure or resolved action failure). */
363
+ error?: {
364
+ code: string;
365
+ message: string;
366
+ };
367
+ /**
368
+ * Set when the replay STOPPED before the end of the flow.
369
+ *
370
+ * Replay breaks on the first failing step, so a flow that halted returns fewer step results than
371
+ * it has steps — and nothing said so. A caller reading a two-step flow's one result saw a step
372
+ * that was simply absent, which was reported as replay "silently skipping" an action. It does not
373
+ * skip; it stops, and now it says where and how much it never reached. Omitted entirely when every
374
+ * step ran, so a clean pass carries no extra bytes.
375
+ */
376
+ halted?: {
377
+ atStep: number;
378
+ notAttempted: number;
379
+ };
380
+ /**
381
+ * Set on an `ok` replay whose flow cannot fail: it asserts no observable consequence, or has no
382
+ * steps at all. The replay genuinely completed, so the status stays `ok` — but a bare `ok` read
383
+ * as proof the feature works is exactly the false confidence `flow-risk.ts` argues against, and
384
+ * `reticle_flow_verify` already refuses to count these as passes. This carries the same reason,
385
+ * from the same function, to the single-flow caller who would otherwise never see it.
386
+ */
387
+ unverifiable?: {
388
+ reason: string;
389
+ };
390
+ /**
391
+ * The confident rebind proposals aggregated across drifted steps (additive,
392
+ * optional — present only when at least one drifted step has a confident nearest match).
393
+ */
394
+ proposals?: HealProposal[];
395
+ /**
396
+ * The push-default deviation report over this replay's route segments (ranked deviations vs the learned
397
+ * envelope, or a fall-back note below N=3 runs). Additive; present when segments were observed.
398
+ */
399
+ deviation?: unknown;
400
+ /**
401
+ * What the project already knows about this flow, fetched from shared memory on the agent's
402
+ * behalf.
403
+ *
404
+ * Present only when the project is linked, memory sync is on, and the team has actually captured
405
+ * something about this flow. Shared memory an agent has to remember to consult is never consulted,
406
+ * so the verification asks on the agent's behalf — the difference between memory the platform
407
+ * stores and memory the platform uses.
408
+ *
409
+ * Deliberately additive and deliberately small: a verdict whose own result has been pushed below
410
+ * a wall of statements is a worse verdict.
411
+ */
412
+ knows?: {
413
+ statement: string;
414
+ status: string;
415
+ }[];
416
+ }
417
+ /** A concrete, confidence-scored rebind proposed for one drifted step. */
418
+ export interface HealProposal {
419
+ /** 0-based step index in the flow. */
420
+ step: number;
421
+ /** Old (missing) testid anchor value. */
422
+ from: string;
423
+ /** Proposed nearest present testid. */
424
+ to: string;
425
+ /** Normalized (0,1]; >= HEAL_CONFIDENCE_MIN to be applicable. */
426
+ confidence: number;
427
+ }
428
+ /** One applied rebind (a HealProposal that was written to disk). */
429
+ export interface HealChange {
430
+ step: number;
431
+ from: string;
432
+ to: string;
433
+ }
434
+ /** The reticle_flow_heal envelope. */
435
+ export interface FlowHealResult {
436
+ name: string;
437
+ status: HealStatus;
438
+ /** Whether the file was rewritten (true only when status === 'healed'). */
439
+ applied: boolean;
440
+ /** Confident, applicable rebinds. With apply:false these are the dry-run diff. */
441
+ proposals: HealProposal[];
442
+ /** Anchors actually written (empty unless applied). */
443
+ changed: HealChange[];
444
+ /** Human one-liner for the agent (e.g. "nothing to heal", floor explanation). */
445
+ message: string;
446
+ error?: {
447
+ code: string;
448
+ message: string;
449
+ };
450
+ }
@@ -0,0 +1 @@
1
+ export {};