@reticlehq/core 3.2.0 → 3.4.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 (91) hide show
  1. package/README.md +1 -1
  2. package/dist/artifacts/flow-composition.d.ts +3 -2
  3. package/dist/artifacts/flow-constants.d.ts +68 -2
  4. package/dist/artifacts/flow-constants.js +84 -2
  5. package/dist/artifacts/flow-expect-flat.d.ts +260 -0
  6. package/dist/artifacts/flow-expect-flat.js +284 -0
  7. package/dist/artifacts/flow-mutation-target.d.ts +0 -1
  8. package/dist/artifacts/flow-mutation-target.js +30 -2
  9. package/dist/artifacts/flow-step-tool.d.ts +2 -0
  10. package/dist/artifacts/flow-types.d.ts +1285 -1343
  11. package/dist/artifacts/flow-types.js +111 -140
  12. package/dist/artifacts/impact.d.ts +48 -20
  13. package/dist/artifacts/impact.js +11 -0
  14. package/dist/artifacts/journal.d.ts +34 -6
  15. package/dist/artifacts/journal.js +13 -0
  16. package/dist/hooks/hook-events.d.ts +18 -18
  17. package/dist/hud-entry.d.ts +9 -0
  18. package/dist/hud-entry.js +9 -0
  19. package/dist/identity/source-constants.d.ts +11 -0
  20. package/dist/identity/source-constants.js +11 -0
  21. package/dist/index.d.ts +9 -0
  22. package/dist/index.js +25 -1
  23. package/dist/onboarding.d.ts +2 -2
  24. package/dist/realm/registry.d.ts +0 -8
  25. package/dist/realm/registry.js +1 -11
  26. package/dist/registry/daemon-registry.d.ts +14 -4
  27. package/dist/registry/daemon-registry.js +20 -4
  28. package/dist/schema/event-message.json +3 -1
  29. package/dist/schema/event-payloads.json +72 -0
  30. package/dist/schema/event-type.json +3 -1
  31. package/dist/schema/reticle-event.json +3 -1
  32. package/dist/schema/reticle-message.json +3 -1
  33. package/dist/source-constants.cjs +1 -0
  34. package/dist/source-constants.d.cts +1 -0
  35. package/dist/telemetry-feedback.d.ts +6 -6
  36. package/dist/telemetry-refusal.d.ts +5 -4
  37. package/dist/telemetry-session.d.ts +25 -2
  38. package/dist/telemetry-session.js +13 -0
  39. package/dist/telemetry.d.ts +130 -102
  40. package/dist/verdict/compare-source.d.ts +80 -0
  41. package/dist/verdict/compare-source.js +93 -0
  42. package/dist/verdict/consequence.d.ts +12 -0
  43. package/dist/verdict/consequence.js +15 -0
  44. package/dist/verdict/instrumentation-gap.js +1 -1
  45. package/dist/verdict/intent.d.ts +24 -0
  46. package/dist/verdict/intent.js +66 -10
  47. package/dist/verdict/predicate-tree.d.ts +82 -0
  48. package/dist/verdict/predicate-tree.js +186 -0
  49. package/dist/verdict/predicate.d.ts +138 -0
  50. package/dist/verdict/predicate.js +430 -0
  51. package/dist/verdict/property-assertion.d.ts +191 -0
  52. package/dist/verdict/property-assertion.js +42 -0
  53. package/dist/verdict/security.js +16 -4
  54. package/dist/verdict/verdict-attribution.d.ts +52 -0
  55. package/dist/verdict/verdict-attribution.js +87 -0
  56. package/dist/verdict/verification-run.d.ts +330 -83
  57. package/dist/verdict/verification-run.js +44 -1
  58. package/dist/verdict/verified-constants.d.ts +9 -0
  59. package/dist/verdict/verified-constants.js +9 -0
  60. package/dist/wire/channel.d.ts +10 -0
  61. package/dist/wire/channel.js +25 -0
  62. package/dist/wire/constants/constants.d.ts +65 -102
  63. package/dist/wire/constants/constants.js +79 -101
  64. package/dist/wire/constants/discovery.d.ts +25 -0
  65. package/dist/wire/constants/discovery.js +25 -0
  66. package/dist/wire/constants/event-types.d.ts +122 -0
  67. package/dist/wire/constants/event-types.js +121 -0
  68. package/dist/wire/constants/hud-controls.d.ts +19 -0
  69. package/dist/wire/constants/hud-controls.js +95 -0
  70. package/dist/wire/constants/hud-use.d.ts +27 -0
  71. package/dist/wire/constants/hud-use.js +24 -0
  72. package/dist/wire/constants/session-constants.d.ts +10 -0
  73. package/dist/wire/constants/session-constants.js +10 -0
  74. package/dist/wire/event-payloads.d.ts +72 -13
  75. package/dist/wire/event-payloads.js +26 -4
  76. package/dist/wire/messages.d.ts +97 -56
  77. package/dist/wire/messages.js +17 -0
  78. package/dist/wire/net.d.ts +35 -0
  79. package/dist/wire/net.js +41 -0
  80. package/dist/wire/redaction.js +17 -0
  81. package/dist/wire/state-select.d.ts +2 -1
  82. package/dist/wire/state-select.js +56 -3
  83. package/dist/wire/toon.d.ts +1 -1
  84. package/dist/wire/toon.js +30 -8
  85. package/dist/wire/types.d.ts +119 -94
  86. package/dist/wire/types.js +23 -1
  87. package/dist/words/no-session-reason.d.ts +7 -0
  88. package/dist/words/no-session-reason.js +7 -0
  89. package/dist/words/notices.d.ts +7 -0
  90. package/dist/words/notices.js +9 -2
  91. package/package.json +7 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @reticlehq/core
2
2
 
3
- The **foundation** of [Reticle](https://github.com/reticlehq/reticle) — the shared wire contract that every Reticle package imports: types, [zod](https://zod.dev) schemas, constants, and the messages that cross the browser ↔ bridge ↔ agent boundary. It is isomorphic (runs in a browser or in Node), depends only on `zod`, and re-exports nothing.
3
+ The **foundation** of [Reticle](https://github.com/reticlehq/reticle) — the shared wire contract that every Reticle package imports: types, [zod](https://zod.dev) schemas, constants, and the messages that cross the browser ↔ bridge ↔ agent boundary. It is isomorphic (runs in a browser or in Node), depends only on `zod` and [`open-verification`](https://www.npmjs.com/package/open-verification) (the protocol whose vocabulary it is written in), and re-exports nothing.
4
4
 
5
5
  Most people never install this directly. Install the package for your audience instead:
6
6
 
@@ -1,4 +1,5 @@
1
- import type { FlowExpect, FlowFile } from './flow-types.js';
1
+ import type { FlowFile } from './flow-types.js';
2
+ import type { Predicate } from '../verdict/predicate.js';
2
3
  /**
3
4
  * Whether one flow may be replayed straight after another.
4
5
  *
@@ -22,7 +23,7 @@ export interface CompositionCheck {
22
23
  /** True when nothing B requires is left undischarged by A. Vacuously true when either is silent. */
23
24
  readonly ok: boolean;
24
25
  /** The claims B requires that A does not ensure. Empty when `ok`. */
25
- readonly unmet: readonly FlowExpect[];
26
+ readonly unmet: readonly Predicate[];
26
27
  /** True when neither flow declared anything, so the answer is "unchecked" rather than "safe". */
27
28
  readonly unchecked: boolean;
28
29
  }
@@ -52,8 +52,43 @@ export declare const PROJECT_RUN_CAP: {
52
52
  };
53
53
  /** Maximum distinct route identities retained in project.json. */
54
54
  export declare const PROJECT_ROUTE_CAP = 200;
55
- /** Schema version stamped onto on-disk flow files (.reticle/flows/<name>.json). */
56
- export declare const FLOW_FILE_VERSION = 1;
55
+ /**
56
+ * Schema version STAMPED onto a flow file this Reticle writes.
57
+ *
58
+ * 2 since `FlowStep.expect` became a `Predicate`. Version 1 stored one flat slot per kind, which
59
+ * could not hold a composite, a negation or a property assertion — an `allOf[netA, netB]` saved as
60
+ * one of the two arms and the other was gone with nothing said.
61
+ */
62
+ export declare const FLOW_FILE_VERSION = 2;
63
+ /** Stamped instead of FLOW_FILE_VERSION on a flow that holds a `compare` — see flowFileVersionFor. */
64
+ export declare const COMPARE_FLOW_FILE_VERSION = 3;
65
+ /**
66
+ * Every version this Reticle can READ, which is not the same question as what it writes.
67
+ *
68
+ * A flow file is committed to a repository that other people share, so a reader that refused the
69
+ * previous format would break a teammate's suite on the day one person upgraded. v1 is lifted on
70
+ * read by `flowExpectToPredicate` and is NEVER rewritten: the file on disk stays v1 until something
71
+ * saves it again, at which point it is stamped with the version above.
72
+ *
73
+ * A number outside this set is the wrong READER, not a damaged file, and says so.
74
+ */
75
+ export declare const READABLE_FLOW_VERSIONS: ReadonlySet<number>;
76
+ /**
77
+ * The version a flow file must carry for a reader to be able to replay it.
78
+ *
79
+ * A reader from before `compare` knew versions 1 and 2, so a v2 file holding one failed there as a
80
+ * generic PARSE_FAILED on the unknown kind. Stamping only the flows that USE it keeps every other
81
+ * flow readable by that older reader, and turns the rest into "the reader is the wrong one".
82
+ * Every save routes through it, so a v1 file without one keeps its version byte for byte.
83
+ *
84
+ * The walk is over the whole value rather than the four fields a predicate lives in today (step
85
+ * `expect`, `success`, `requires`, `ensures`), so a predicate slot added later cannot be missed.
86
+ * ponytail: a literal `{ kind: "compare" }` inside an `equals` value also bumps it; that only costs
87
+ * the older reader a file it could have read.
88
+ */
89
+ export declare function flowFileVersionFor(flow: {
90
+ readonly version: number;
91
+ }): number;
57
92
  /** How a flow step is anchored to the live DOM at replay time (semantic, never a volatile ref). */
58
93
  export declare const AnchorKind: {
59
94
  readonly TESTID: "testid";
@@ -74,7 +109,21 @@ export declare const FlowErrorCode: {
74
109
  readonly INVALID_NAME: "flow_invalid_name";
75
110
  readonly NOT_FOUND: "flow_not_found";
76
111
  readonly PARSE_FAILED: "flow_parse_failed";
112
+ /**
113
+ * The file is well-formed and carries a `version` this build does not read.
114
+ *
115
+ * Distinct from PARSE_FAILED because the two need OPPOSITE fixes, and saying the wrong one costs
116
+ * somebody a search for damage that is not there. Malformed means "repair or regenerate this
117
+ * file". Wrong version means the file is fine and the READER is the wrong one -- upgrade or
118
+ * downgrade Reticle, and do not touch the flow.
119
+ *
120
+ * `ProjectReadError.WRONG_VERSION` above draws the same line for `project.json` and for the same
121
+ * reason; flows simply had no equivalent, so every future format bump would have reported itself
122
+ * as corruption to every reader already in the field.
123
+ */
124
+ readonly WRONG_VERSION: "flow_wrong_version";
77
125
  readonly NO_RECORDING: "flow_no_recording";
126
+ readonly STEP_NOT_FOUND: "flow_step_not_found";
78
127
  };
79
128
  export type FlowErrorCode = (typeof FlowErrorCode)[keyof typeof FlowErrorCode];
80
129
  /** A flow name must be a single safe path segment (no '/', '\\', '..', leading dot). */
@@ -131,6 +180,23 @@ export declare const DriftReason: {
131
180
  * hunting for the nearest testid to the literal word "unresolved".
132
181
  */
133
182
  readonly ANCHOR_DEGRADED: "anchor_degraded";
183
+ /**
184
+ * The anchor resolved to MORE THAN ONE live element, so which one the recording meant is no
185
+ * longer decidable.
186
+ *
187
+ * Replay used to take the first match, act on it, and return `ok: true` carrying a note --
188
+ * "ambiguous testid 'x', used first match". The verdict is computed from `drift` and `ok` alone,
189
+ * so the note never reached it: a replay that clicked row 3 instead of row 1 reported `ok`.
190
+ * That is a locator resolving to a different element than the one recorded, reported green,
191
+ * which is the one thing a replay must never do -- its entire claim is "it did what it did
192
+ * before".
193
+ *
194
+ * Distinct from TESTID_NOT_FOUND for the same reason ANCHOR_DEGRADED is, and the distinction is
195
+ * what makes it fixable: "your element disappeared" wants a RENAMED anchor, and "your element is
196
+ * now several elements" wants a NARROWER one. Heal can only propose the second if the reason
197
+ * says which happened.
198
+ */
199
+ readonly ANCHOR_AMBIGUOUS: "anchor_ambiguous";
134
200
  /**
135
201
  * The step's anchor resolved and its action ran; the testid its `expect.element` names was absent
136
202
  * afterwards. Distinct from TESTID_NOT_FOUND for the same reason ANCHOR_DEGRADED is: "the element
@@ -1,3 +1,4 @@
1
+ import { PredicateKind } from '../verdict/consequence.js';
1
2
  /**
2
3
  * On-disk artifact constants: the project history, flow files, replay/drift status, the recorder
3
4
  * lifecycle, heal outcomes, and the structured-annotation vocabulary.
@@ -49,8 +50,58 @@ export const PROJECT_RUN_CAP = {
49
50
  };
50
51
  /** Maximum distinct route identities retained in project.json. */
51
52
  export const PROJECT_ROUTE_CAP = 200;
52
- /** Schema version stamped onto on-disk flow files (.reticle/flows/<name>.json). */
53
- export const FLOW_FILE_VERSION = 1;
53
+ /**
54
+ * Schema version STAMPED onto a flow file this Reticle writes.
55
+ *
56
+ * 2 since `FlowStep.expect` became a `Predicate`. Version 1 stored one flat slot per kind, which
57
+ * could not hold a composite, a negation or a property assertion — an `allOf[netA, netB]` saved as
58
+ * one of the two arms and the other was gone with nothing said.
59
+ */
60
+ export const FLOW_FILE_VERSION = 2;
61
+ /** Stamped instead of FLOW_FILE_VERSION on a flow that holds a `compare` — see flowFileVersionFor. */
62
+ export const COMPARE_FLOW_FILE_VERSION = 3;
63
+ /**
64
+ * Every version this Reticle can READ, which is not the same question as what it writes.
65
+ *
66
+ * A flow file is committed to a repository that other people share, so a reader that refused the
67
+ * previous format would break a teammate's suite on the day one person upgraded. v1 is lifted on
68
+ * read by `flowExpectToPredicate` and is NEVER rewritten: the file on disk stays v1 until something
69
+ * saves it again, at which point it is stamped with the version above.
70
+ *
71
+ * A number outside this set is the wrong READER, not a damaged file, and says so.
72
+ */
73
+ export const READABLE_FLOW_VERSIONS = new Set([
74
+ 1,
75
+ FLOW_FILE_VERSION,
76
+ COMPARE_FLOW_FILE_VERSION,
77
+ ]);
78
+ /**
79
+ * The version a flow file must carry for a reader to be able to replay it.
80
+ *
81
+ * A reader from before `compare` knew versions 1 and 2, so a v2 file holding one failed there as a
82
+ * generic PARSE_FAILED on the unknown kind. Stamping only the flows that USE it keeps every other
83
+ * flow readable by that older reader, and turns the rest into "the reader is the wrong one".
84
+ * Every save routes through it, so a v1 file without one keeps its version byte for byte.
85
+ *
86
+ * The walk is over the whole value rather than the four fields a predicate lives in today (step
87
+ * `expect`, `success`, `requires`, `ensures`), so a predicate slot added later cannot be missed.
88
+ * ponytail: a literal `{ kind: "compare" }` inside an `equals` value also bumps it; that only costs
89
+ * the older reader a file it could have read.
90
+ */
91
+ export function flowFileVersionFor(flow) {
92
+ if (usesCompare(flow))
93
+ return COMPARE_FLOW_FILE_VERSION;
94
+ // A file whose compare was edited away drops back; any other version is left as it was written.
95
+ return COMPARE_FLOW_FILE_VERSION === flow.version ? FLOW_FILE_VERSION : flow.version;
96
+ }
97
+ function usesCompare(value) {
98
+ if (null === value || 'object' !== typeof value)
99
+ return false;
100
+ if (Array.isArray(value))
101
+ return value.some(usesCompare);
102
+ const record = value;
103
+ return PredicateKind.COMPARE === record['kind'] || Object.values(record).some(usesCompare);
104
+ }
54
105
  /** How a flow step is anchored to the live DOM at replay time (semantic, never a volatile ref). */
55
106
  export const AnchorKind = {
56
107
  TESTID: 'testid', // { kind:'testid', value }
@@ -70,7 +121,21 @@ export const FlowErrorCode = {
70
121
  INVALID_NAME: 'flow_invalid_name', // path traversal / illegal chars
71
122
  NOT_FOUND: 'flow_not_found', // load of a missing flow
72
123
  PARSE_FAILED: 'flow_parse_failed', // on-disk JSON failed zod validation
124
+ /**
125
+ * The file is well-formed and carries a `version` this build does not read.
126
+ *
127
+ * Distinct from PARSE_FAILED because the two need OPPOSITE fixes, and saying the wrong one costs
128
+ * somebody a search for damage that is not there. Malformed means "repair or regenerate this
129
+ * file". Wrong version means the file is fine and the READER is the wrong one -- upgrade or
130
+ * downgrade Reticle, and do not touch the flow.
131
+ *
132
+ * `ProjectReadError.WRONG_VERSION` above draws the same line for `project.json` and for the same
133
+ * reason; flows simply had no equivalent, so every future format bump would have reported itself
134
+ * as corruption to every reader already in the field.
135
+ */
136
+ WRONG_VERSION: 'flow_wrong_version',
73
137
  NO_RECORDING: 'flow_no_recording', // save with no compiled program by that name
138
+ STEP_NOT_FOUND: 'flow_step_not_found', // resume `from` names no step of the flow
74
139
  };
75
140
  /** A flow name must be a single safe path segment (no '/', '\\', '..', leading dot). */
76
141
  /**
@@ -125,6 +190,23 @@ export const DriftReason = {
125
190
  * hunting for the nearest testid to the literal word "unresolved".
126
191
  */
127
192
  ANCHOR_DEGRADED: 'anchor_degraded',
193
+ /**
194
+ * The anchor resolved to MORE THAN ONE live element, so which one the recording meant is no
195
+ * longer decidable.
196
+ *
197
+ * Replay used to take the first match, act on it, and return `ok: true` carrying a note --
198
+ * "ambiguous testid 'x', used first match". The verdict is computed from `drift` and `ok` alone,
199
+ * so the note never reached it: a replay that clicked row 3 instead of row 1 reported `ok`.
200
+ * That is a locator resolving to a different element than the one recorded, reported green,
201
+ * which is the one thing a replay must never do -- its entire claim is "it did what it did
202
+ * before".
203
+ *
204
+ * Distinct from TESTID_NOT_FOUND for the same reason ANCHOR_DEGRADED is, and the distinction is
205
+ * what makes it fixable: "your element disappeared" wants a RENAMED anchor, and "your element is
206
+ * now several elements" wants a NARROWER one. Heal can only propose the second if the reason
207
+ * says which happened.
208
+ */
209
+ ANCHOR_AMBIGUOUS: 'anchor_ambiguous',
128
210
  /**
129
211
  * The step's anchor resolved and its action ran; the testid its `expect.element` names was absent
130
212
  * afterwards. Distinct from TESTID_NOT_FOUND for the same reason ANCHOR_DEGRADED is: "the element
@@ -0,0 +1,260 @@
1
+ /**
2
+ * Reading the FLAT expect a flow file used to store.
3
+ *
4
+ * The older format held one slot per kind — `{ signal, net, element, text, state, console, route }`
5
+ * — which could not nest, compose or negate. A step's expect is a `Predicate` now. This is the
6
+ * reader that bridges them, and it lives in core because the schema that parses a flow is here and
7
+ * the lift happens during the parse.
8
+ *
9
+ * A READ NEVER REWRITES. A v1 file stays v1 on disk until something saves it again; only the value
10
+ * in memory is lifted. That is what makes the migration safe to ship to people whose flows are
11
+ * committed to a repository they share.
12
+ */
13
+ import { z } from 'zod';
14
+ import type { Predicate } from '../verdict/predicate.js';
15
+ /**
16
+ * A post-condition a step asserts (compiled from a structured annotation; optional).
17
+ *
18
+ * Strict, at every nesting level: an unrecognized key (a typo, or a predicate kind this schema
19
+ * doesn't model, e.g. `allOf`, or a typo'd `net`/`console`/`element`/`state` sub-field) must fail
20
+ * to parse instead of being silently dropped. A loose z.object() here would quietly discard the
21
+ * extra key and leave the step with a weaker (or empty) assertion than its author wrote — the
22
+ * flow then replays green against nothing, having proved no real regression.
23
+ */
24
+ export declare const FlowExpectSchema: z.ZodObject<{
25
+ /**
26
+ * The route the step must have reached — the consequence of a NAVIGATION.
27
+ *
28
+ * Absent until now, and its absence was not a corner case: navigation is one of the commonest
29
+ * journeys there is, and every route-asserted drive saved a flow that could never go red. Found
30
+ * by driving a real app, where `act_and_wait { until: { kind: "route" } }` returned
31
+ * `verified: "yes"` and the flow saved from that same drive graded `assertion-free`.
32
+ *
33
+ * Additive and optional, so a flow file written before it still parses and FLOW_FILE_VERSION
34
+ * stays 1 — the same treatment `signalData` and `signalCount` had.
35
+ */
36
+ route: z.ZodOptional<z.ZodObject<{
37
+ pathname: z.ZodOptional<z.ZodString>;
38
+ contains: z.ZodOptional<z.ZodString>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ contains?: string | undefined;
41
+ pathname?: string | undefined;
42
+ }, {
43
+ contains?: string | undefined;
44
+ pathname?: string | undefined;
45
+ }>>;
46
+ signal: z.ZodOptional<z.ZodString>;
47
+ /**
48
+ * Optional payload shape an `assert-signal` annotation requires the signal
49
+ * to match (the predicate DSL's signal.dataMatches). Additive/optional — a flow file with a
50
+ * bare `signal` still parses, and the on-disk version stays FLOW_FILE_VERSION 1.
51
+ */
52
+ signalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
53
+ /**
54
+ * Exact number of times the signal must have fired — the signal-side twin of `net.count`, and the
55
+ * only way a saved flow can keep a cardinality the agent actually asserted. Without it a
56
+ * `count: 1` drive would be recorded as bare presence, which is a strictly WEAKER claim than the
57
+ * one made: the replayed flow then goes green on the double-fire it was recorded to catch.
58
+ * Additive/optional — a flow file with a bare `signal` still parses, and FLOW_FILE_VERSION stays 1.
59
+ */
60
+ signalCount: z.ZodOptional<z.ZodNumber>;
61
+ net: z.ZodOptional<z.ZodObject<{
62
+ method: z.ZodOptional<z.ZodString>;
63
+ urlContains: z.ZodOptional<z.ZodString>;
64
+ status: z.ZodOptional<z.ZodNumber>;
65
+ /**
66
+ * Exact number of matching requests since the action — turns presence into a cardinality
67
+ * assertion. Catches the double-submit / useEffect-double-fire / retry-storm regression class:
68
+ * the request fired (presence passes) but fired the WRONG number of times. Omit = presence (≥1).
69
+ */
70
+ count: z.ZodOptional<z.ZodNumber>;
71
+ }, "strict", z.ZodTypeAny, {
72
+ status?: number | undefined;
73
+ method?: string | undefined;
74
+ urlContains?: string | undefined;
75
+ count?: number | undefined;
76
+ }, {
77
+ status?: number | undefined;
78
+ method?: string | undefined;
79
+ urlContains?: string | undefined;
80
+ count?: number | undefined;
81
+ }>>;
82
+ /**
83
+ * Console golden end-condition: assert the action logged (or, with absent:true, did NOT log) a
84
+ * console message at `level` (default 'error'). `absent:true` is the common case — "the action
85
+ * completed with a clean console" — catching the regression where an action throws a caught error
86
+ * / logs an uncaught rejection while the UI still renders fine (a presence check passes it).
87
+ */
88
+ console: z.ZodOptional<z.ZodObject<{
89
+ level: z.ZodOptional<z.ZodString>;
90
+ absent: z.ZodOptional<z.ZodBoolean>;
91
+ }, "strict", z.ZodTypeAny, {
92
+ level?: string | undefined;
93
+ absent?: boolean | undefined;
94
+ }, {
95
+ level?: string | undefined;
96
+ absent?: boolean | undefined;
97
+ }>>;
98
+ element: z.ZodOptional<z.ZodObject<{
99
+ testid: z.ZodOptional<z.ZodString>;
100
+ role: z.ZodOptional<z.ZodString>;
101
+ name: z.ZodOptional<z.ZodString>;
102
+ }, "strict", z.ZodTypeAny, {
103
+ testid?: string | undefined;
104
+ role?: string | undefined;
105
+ name?: string | undefined;
106
+ }, {
107
+ testid?: string | undefined;
108
+ role?: string | undefined;
109
+ name?: string | undefined;
110
+ }>>;
111
+ /**
112
+ * Rendered text as an end-condition, using the shapes the assert surface already accepts.
113
+ *
114
+ * The gap this closes: an app with no testids, no `reticle.signal`, no registrable store and no
115
+ * network call on the interaction under test -- a discount price computed and rendered, a
116
+ * formatted total, a derived label -- could not produce an asserted flow AT ALL. Everything the
117
+ * vocabulary offered needed a channel that app does not have, so the only honest outcome was
118
+ * `assertion-free`, which is a permanent green (#811).
119
+ *
120
+ * Derived-DOM rendering is a large share of what actually breaks in a UI, and it was the share
121
+ * that could not be pinned.
122
+ *
123
+ * Classified PRESENCE, not consequence, and that is not a technicality: text is read from the
124
+ * DOM, so a locator healed to the wrong element can still satisfy it. It earns `presence-only`,
125
+ * which is a real grade above `assertion-free` and honestly below `signal`/`net`/`state`.
126
+ */
127
+ text: z.ZodOptional<z.ZodObject<{
128
+ contains: z.ZodString;
129
+ /** Narrow the search to a container, exactly as the `text` predicate's `scope` does. */
130
+ scope: z.ZodOptional<z.ZodString>;
131
+ /** Assert the text is GONE — the regression check for a cleared error or a dismissed toast. */
132
+ absent: z.ZodOptional<z.ZodBoolean>;
133
+ /** Require the match to be visible, not merely present in the DOM. */
134
+ visible: z.ZodOptional<z.ZodBoolean>;
135
+ }, "strict", z.ZodTypeAny, {
136
+ contains: string;
137
+ visible?: boolean | undefined;
138
+ scope?: string | undefined;
139
+ absent?: boolean | undefined;
140
+ }, {
141
+ contains: string;
142
+ visible?: boolean | undefined;
143
+ scope?: string | undefined;
144
+ absent?: boolean | undefined;
145
+ }>>;
146
+ /**
147
+ * Assert a registered store's value — the source of truth no DOM/network read can reach. Compiles
148
+ * to the predicate engine's `state` predicate. Additive/optional — a flow without it still parses
149
+ * and the on-disk version stays FLOW_FILE_VERSION 1. `equals` accepts a literal, omitted = presence,
150
+ * or a `{ $gte | $contains | $length }` operator pattern.
151
+ */
152
+ state: z.ZodOptional<z.ZodObject<{
153
+ store: z.ZodOptional<z.ZodString>;
154
+ path: z.ZodString;
155
+ equals: z.ZodOptional<z.ZodUnknown>;
156
+ /**
157
+ * Treat this as an INVARIANT that must still hold AFTER the action settles, rather than a
158
+ * condition to wait for. Set it for a blast-radius check ("this unrelated path must NOT have
159
+ * moved") — without it a wait-until-true read passes before an over-reaching side-effect lands.
160
+ */
161
+ hold: z.ZodOptional<z.ZodBoolean>;
162
+ }, "strict", z.ZodTypeAny, {
163
+ path: string;
164
+ hold?: boolean | undefined;
165
+ store?: string | undefined;
166
+ equals?: unknown;
167
+ }, {
168
+ path: string;
169
+ hold?: boolean | undefined;
170
+ store?: string | undefined;
171
+ equals?: unknown;
172
+ }>>;
173
+ }, "strict", z.ZodTypeAny, {
174
+ signal?: string | undefined;
175
+ net?: {
176
+ status?: number | undefined;
177
+ method?: string | undefined;
178
+ urlContains?: string | undefined;
179
+ count?: number | undefined;
180
+ } | undefined;
181
+ state?: {
182
+ path: string;
183
+ hold?: boolean | undefined;
184
+ store?: string | undefined;
185
+ equals?: unknown;
186
+ } | undefined;
187
+ element?: {
188
+ testid?: string | undefined;
189
+ role?: string | undefined;
190
+ name?: string | undefined;
191
+ } | undefined;
192
+ text?: {
193
+ contains: string;
194
+ visible?: boolean | undefined;
195
+ scope?: string | undefined;
196
+ absent?: boolean | undefined;
197
+ } | undefined;
198
+ route?: {
199
+ contains?: string | undefined;
200
+ pathname?: string | undefined;
201
+ } | undefined;
202
+ console?: {
203
+ level?: string | undefined;
204
+ absent?: boolean | undefined;
205
+ } | undefined;
206
+ signalData?: Record<string, unknown> | undefined;
207
+ signalCount?: number | undefined;
208
+ }, {
209
+ signal?: string | undefined;
210
+ net?: {
211
+ status?: number | undefined;
212
+ method?: string | undefined;
213
+ urlContains?: string | undefined;
214
+ count?: number | undefined;
215
+ } | undefined;
216
+ state?: {
217
+ path: string;
218
+ hold?: boolean | undefined;
219
+ store?: string | undefined;
220
+ equals?: unknown;
221
+ } | undefined;
222
+ element?: {
223
+ testid?: string | undefined;
224
+ role?: string | undefined;
225
+ name?: string | undefined;
226
+ } | undefined;
227
+ text?: {
228
+ contains: string;
229
+ visible?: boolean | undefined;
230
+ scope?: string | undefined;
231
+ absent?: boolean | undefined;
232
+ } | undefined;
233
+ route?: {
234
+ contains?: string | undefined;
235
+ pathname?: string | undefined;
236
+ } | undefined;
237
+ console?: {
238
+ level?: string | undefined;
239
+ absent?: boolean | undefined;
240
+ } | undefined;
241
+ signalData?: Record<string, unknown> | undefined;
242
+ signalCount?: number | undefined;
243
+ }>;
244
+ export type FlowExpect = z.infer<typeof FlowExpectSchema>;
245
+ /**
246
+ * Lift a flat `FlowExpect` into the predicate a current file stores directly.
247
+ *
248
+ * THE READER FOR THE OLDER FORMAT. A flow written before `FlowStep.expect` became a `Predicate` holds one slot
249
+ * per kind, and this is what turns that into the tree everything downstream now evaluates. It runs
250
+ * on READ and changes nothing on disk: a v1 file stays a v1 file until something re-saves it.
251
+ *
252
+ * Faithful on purpose, including one wart it does NOT fix: a `route` clause returns immediately and
253
+ * drops every other clause beside it. That is what v1 files have always meant, and a migration that
254
+ * quietly started asserting a clause those files used to ignore would turn greens red for a reason
255
+ * nobody could see in their diff. It is a real lossy path and it is being fixed separately, where it
256
+ * can carry its own test and its own explanation.
257
+ *
258
+ * `undefined` means nothing assertable, which is vacuously met rather than failed.
259
+ */
260
+ export declare function flowExpectToPredicate(success: FlowExpect): Predicate | undefined;