@reticlehq/core 3.2.0 → 3.3.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 (77) hide show
  1. package/dist/artifacts/flow-composition.d.ts +3 -2
  2. package/dist/artifacts/flow-constants.d.ts +49 -2
  3. package/dist/artifacts/flow-constants.js +49 -2
  4. package/dist/artifacts/flow-expect-flat.d.ts +260 -0
  5. package/dist/artifacts/flow-expect-flat.js +284 -0
  6. package/dist/artifacts/flow-mutation-target.d.ts +0 -1
  7. package/dist/artifacts/flow-mutation-target.js +26 -2
  8. package/dist/artifacts/flow-step-tool.d.ts +2 -0
  9. package/dist/artifacts/flow-types.d.ts +1074 -1228
  10. package/dist/artifacts/flow-types.js +96 -140
  11. package/dist/artifacts/impact.d.ts +48 -20
  12. package/dist/artifacts/impact.js +11 -0
  13. package/dist/artifacts/journal.d.ts +33 -6
  14. package/dist/artifacts/journal.js +13 -0
  15. package/dist/hooks/hook-events.d.ts +18 -18
  16. package/dist/hud-entry.d.ts +9 -0
  17. package/dist/hud-entry.js +9 -0
  18. package/dist/identity/source-constants.d.ts +11 -0
  19. package/dist/identity/source-constants.js +11 -0
  20. package/dist/index.d.ts +8 -0
  21. package/dist/index.js +24 -1
  22. package/dist/onboarding.d.ts +2 -2
  23. package/dist/realm/registry.d.ts +0 -8
  24. package/dist/realm/registry.js +1 -11
  25. package/dist/schema/event-message.json +3 -1
  26. package/dist/schema/event-payloads.json +69 -0
  27. package/dist/schema/event-type.json +3 -1
  28. package/dist/schema/reticle-event.json +3 -1
  29. package/dist/schema/reticle-message.json +3 -1
  30. package/dist/source-constants.cjs +1 -0
  31. package/dist/source-constants.d.cts +1 -0
  32. package/dist/telemetry-feedback.d.ts +6 -6
  33. package/dist/telemetry-refusal.d.ts +2 -2
  34. package/dist/telemetry-session.d.ts +25 -2
  35. package/dist/telemetry-session.js +13 -0
  36. package/dist/telemetry.d.ts +121 -94
  37. package/dist/verdict/consequence.d.ts +10 -0
  38. package/dist/verdict/consequence.js +13 -0
  39. package/dist/verdict/intent.d.ts +36 -12
  40. package/dist/verdict/intent.js +66 -10
  41. package/dist/verdict/predicate-tree.d.ts +47 -0
  42. package/dist/verdict/predicate-tree.js +146 -0
  43. package/dist/verdict/predicate.d.ts +129 -0
  44. package/dist/verdict/predicate.js +394 -0
  45. package/dist/verdict/property-assertion.d.ts +191 -0
  46. package/dist/verdict/property-assertion.js +42 -0
  47. package/dist/verdict/security.js +16 -4
  48. package/dist/verdict/verdict-attribution.d.ts +52 -0
  49. package/dist/verdict/verdict-attribution.js +87 -0
  50. package/dist/verdict/verification-run.d.ts +98 -84
  51. package/dist/verdict/verification-run.js +8 -1
  52. package/dist/verdict/verified-constants.d.ts +9 -0
  53. package/dist/verdict/verified-constants.js +9 -0
  54. package/dist/wire/constants/constants.d.ts +20 -98
  55. package/dist/wire/constants/constants.js +22 -97
  56. package/dist/wire/constants/discovery.d.ts +25 -0
  57. package/dist/wire/constants/discovery.js +25 -0
  58. package/dist/wire/constants/event-types.d.ts +122 -0
  59. package/dist/wire/constants/event-types.js +121 -0
  60. package/dist/wire/constants/hud-controls.d.ts +19 -0
  61. package/dist/wire/constants/hud-controls.js +95 -0
  62. package/dist/wire/constants/hud-use.d.ts +27 -0
  63. package/dist/wire/constants/hud-use.js +24 -0
  64. package/dist/wire/constants/session-constants.d.ts +10 -0
  65. package/dist/wire/constants/session-constants.js +10 -0
  66. package/dist/wire/event-payloads.d.ts +66 -10
  67. package/dist/wire/event-payloads.js +18 -1
  68. package/dist/wire/messages.d.ts +89 -48
  69. package/dist/wire/messages.js +17 -0
  70. package/dist/wire/net.d.ts +18 -0
  71. package/dist/wire/net.js +24 -0
  72. package/dist/wire/state-select.d.ts +2 -1
  73. package/dist/wire/state-select.js +56 -3
  74. package/dist/wire/toon.js +28 -7
  75. package/dist/wire/types.d.ts +91 -66
  76. package/dist/wire/types.js +23 -1
  77. package/package.json +5 -1
@@ -1,13 +1,28 @@
1
1
  import { z } from 'zod';
2
- import { CROSS_STEP_ADDRESS, FlowStepTool } from './flow-step-tool.js';
2
+ import { CROSS_STEP_ADDRESS } from './flow-step-tool.js';
3
+ import { READABLE_FLOW_VERSIONS } from './flow-constants.js';
3
4
  import { StepEffect } from './step-effect.js';
4
- export { CROSS_STEP_ADDRESS, FlowStepTool } from './flow-step-tool.js';
5
5
  import { ActionType } from '../wire/constants/constants.js';
6
- import { CONSEQUENCE_KINDS } from '../verdict/consequence.js';
6
+ import { CONSEQUENCE_KINDS, PRESENCE_GRADED } from '../verdict/consequence.js';
7
+ import { PredicateKind } from '../verdict/consequence.js';
8
+ import { PredicateSchema } from '../verdict/predicate.js';
9
+ import { sessionBoundField, sessionRefRefusal } from '../verdict/predicate-tree.js';
10
+ import { FlowExpectSchema, flowExpectToPredicate } from './flow-expect-flat.js';
11
+ // The older flat shape and its reader live together; both are re-exported so the one public name
12
+ // for "a flow's types" still answers for them.
13
+ export { FlowExpectSchema } from './flow-expect-flat.js';
7
14
  // Its own directory's constants, which this file had been reaching through `wire/constants/constants.js`
8
15
  // to get -- the clearest cost of that re-export: artifacts went out to wire to fetch a symbol
9
16
  // that had been sitting next door the whole time.
10
- import { AnchorKind, FLOW_FILE_VERSION, FlowStatus, } from './flow-constants.js';
17
+ import { AnchorKind, FlowStatus, } from './flow-constants.js';
18
+ /**
19
+ * The MCP tool names that can appear as a recorded flow step's `tool`. These are the ONLY tool names
20
+ * that cross the wire into a persisted flow file — the browser recorder stamps them, the server replays
21
+ * them, and FlowStep types them — so they live in core, the wire contract. The full agent-facing tool
22
+ * surface stays server-side (ReticleTool); ReticleTool references THESE for the flow-persisted three, so
23
+ * there is one source of truth and a rename cannot silently desync the recorder from the replayer (a
24
+ * tool rename once killed four e2e specs — this closes the browser/server half of that drift).
25
+ */
11
26
  /**
12
27
  * A semantic anchor: how a step re-finds its element/event at replay
13
28
  * time. Never a volatile eXX ref. testid/role+name bind a DOM element; signal binds an event.
@@ -41,131 +56,53 @@ export const FlowAnchorSchema = z.discriminatedUnion('kind', [
41
56
  name: z.string().optional(),
42
57
  }),
43
58
  ]);
59
+ // A ref is one session's address. Kept, it resolves to nothing on replay — and a scope that
60
+ // resolves to nothing SATISFIES an absence check — so the step could never go red. Refused here,
61
+ // on the one schema both the save path and the load path go through.
62
+ export const FlowPredicateSchema = PredicateSchema.superRefine((predicate, ctx) => {
63
+ const field = sessionBoundField(predicate);
64
+ if (field === undefined)
65
+ return;
66
+ ctx.addIssue({
67
+ code: z.ZodIssueCode.custom,
68
+ message: sessionRefRefusal(field),
69
+ });
70
+ });
44
71
  /**
45
- * A post-condition a step asserts (compiled from a structured annotation; optional).
72
+ * Accept either shape and always yield a PREDICATE.
73
+ *
74
+ * A v2 file stores the predicate directly; a v1 file stores the flat struct, and is lifted on read
75
+ * by `flowExpectToPredicate`. The discriminator is `kind`, which every predicate has and no flat
76
+ * expect ever did, so the two can never be confused for one another.
46
77
  *
47
- * Strict, at every nesting level: an unrecognized key (a typo, or a predicate kind this schema
48
- * doesn't model, e.g. `allOf`, or a typo'd `net`/`console`/`element`/`state` sub-field) must fail
49
- * to parse instead of being silently dropped. A loose z.object() here would quietly discard the
50
- * extra key and leave the step with a weaker (or empty) assertion than its author wrote — the
51
- * flow then replays green against nothing, having proved no real regression.
78
+ * Nothing is written back. A v1 file read this way stays a v1 file on disk, which is what makes the
79
+ * migration safe for flows that are committed to a shared repository.
52
80
  */
53
- export const FlowExpectSchema = z
54
- .object({
55
- /**
56
- * The route the step must have reached — the consequence of a NAVIGATION.
57
- *
58
- * Absent until now, and its absence was not a corner case: navigation is one of the commonest
59
- * journeys there is, and every route-asserted drive saved a flow that could never go red. Found
60
- * by driving a real app, where `act_and_wait { until: { kind: "route" } }` returned
61
- * `verified: "yes"` and the flow saved from that same drive graded `assertion-free`.
62
- *
63
- * Additive and optional, so a flow file written before it still parses and FLOW_FILE_VERSION
64
- * stays 1 — the same treatment `signalData` and `signalCount` had.
65
- */
66
- route: z
67
- .object({ pathname: z.string().optional(), contains: z.string().optional() })
68
- .optional(),
69
- signal: z.string().optional(),
70
- /**
71
- * Optional payload shape an `assert-signal` annotation requires the signal
72
- * to match (the predicate DSL's signal.dataMatches). Additive/optional — a flow file with a
73
- * bare `signal` still parses, and the on-disk version stays FLOW_FILE_VERSION 1.
74
- */
75
- signalData: z.record(z.unknown()).optional(),
76
- /**
77
- * Exact number of times the signal must have fired — the signal-side twin of `net.count`, and the
78
- * only way a saved flow can keep a cardinality the agent actually asserted. Without it a
79
- * `count: 1` drive would be recorded as bare presence, which is a strictly WEAKER claim than the
80
- * one made: the replayed flow then goes green on the double-fire it was recorded to catch.
81
- * Additive/optional — a flow file with a bare `signal` still parses, and FLOW_FILE_VERSION stays 1.
82
- */
83
- signalCount: z.number().int().nonnegative().optional(),
84
- net: z
85
- .object({
86
- method: z.string().optional(),
87
- urlContains: z.string().optional(),
88
- status: z.number().optional(),
89
- /**
90
- * Exact number of matching requests since the action — turns presence into a cardinality
91
- * assertion. Catches the double-submit / useEffect-double-fire / retry-storm regression class:
92
- * the request fired (presence passes) but fired the WRONG number of times. Omit = presence (≥1).
93
- */
94
- count: z.number().int().nonnegative().optional(),
95
- })
96
- .strict()
97
- .optional(),
98
- /**
99
- * Console golden end-condition: assert the action logged (or, with absent:true, did NOT log) a
100
- * console message at `level` (default 'error'). `absent:true` is the common case — "the action
101
- * completed with a clean console" — catching the regression where an action throws a caught error
102
- * / logs an uncaught rejection while the UI still renders fine (a presence check passes it).
103
- */
104
- console: z
105
- .object({
106
- level: z.string().optional(),
107
- absent: z.boolean().optional(),
108
- })
109
- .strict()
110
- .optional(),
111
- element: z
112
- .object({
113
- testid: z.string().optional(),
114
- role: z.string().optional(),
115
- name: z.string().optional(),
116
- })
117
- .strict()
118
- .optional(),
119
- /**
120
- * Rendered text as an end-condition, using the shapes the assert surface already accepts.
121
- *
122
- * The gap this closes: an app with no testids, no `reticle.signal`, no registrable store and no
123
- * network call on the interaction under test -- a discount price computed and rendered, a
124
- * formatted total, a derived label -- could not produce an asserted flow AT ALL. Everything the
125
- * vocabulary offered needed a channel that app does not have, so the only honest outcome was
126
- * `assertion-free`, which is a permanent green (#811).
127
- *
128
- * Derived-DOM rendering is a large share of what actually breaks in a UI, and it was the share
129
- * that could not be pinned.
130
- *
131
- * Classified PRESENCE, not consequence, and that is not a technicality: text is read from the
132
- * DOM, so a locator healed to the wrong element can still satisfy it. It earns `presence-only`,
133
- * which is a real grade above `assertion-free` and honestly below `signal`/`net`/`state`.
134
- */
135
- text: z
136
- .object({
137
- contains: z.string().min(1),
138
- /** Narrow the search to a container, exactly as the `text` predicate's `scope` does. */
139
- scope: z.string().optional(),
140
- /** Assert the text is GONE — the regression check for a cleared error or a dismissed toast. */
141
- absent: z.boolean().optional(),
142
- /** Require the match to be visible, not merely present in the DOM. */
143
- visible: z.boolean().optional(),
144
- })
145
- .strict()
146
- .optional(),
147
- /**
148
- * Assert a registered store's value — the source of truth no DOM/network read can reach. Compiles
149
- * to the predicate engine's `state` predicate. Additive/optional — a flow without it still parses
150
- * and the on-disk version stays FLOW_FILE_VERSION 1. `equals` accepts a literal, omitted = presence,
151
- * or a `{ $gte | $contains | $length }` operator pattern.
152
- */
153
- state: z
154
- .object({
155
- store: z.string().optional(),
156
- path: z.string(),
157
- equals: z.unknown().optional(),
158
- /**
159
- * Treat this as an INVARIANT that must still hold AFTER the action settles, rather than a
160
- * condition to wait for. Set it for a blast-radius check ("this unrelated path must NOT have
161
- * moved") — without it a wait-until-true read passes before an over-reaching side-effect lands.
162
- */
163
- hold: z.boolean().optional(),
164
- })
165
- .strict()
166
- .optional(),
167
- })
168
- .strict();
81
+ /*
82
+ * A union rather than a preprocess, and the difference is STRICTNESS.
83
+ *
84
+ * A preprocess lifts the raw object before anything validates it, so a v1 expect carrying a
85
+ * misspelled key would have had that key quietly ignored by the lift and the rest accepted — a
86
+ * stripped field and a green, which is the precise shape this schema was made strict to prevent.
87
+ *
88
+ * Running `FlowExpectSchema` as a branch keeps it: a v2 predicate matches the first branch on its
89
+ * `kind`, a well-formed v1 expect matches the second and is lifted by the transform, and an expect
90
+ * that is neither is refused by both. Strictness at every level of the v1 shape survives unchanged.
91
+ */
92
+ const ExpectSchema = z.union([
93
+ FlowPredicateSchema,
94
+ FlowExpectSchema.transform((expect) => flowExpectToPredicate(expect)),
95
+ ]);
96
+ /**
97
+ * The same lift over a LIST, dropping the entries that assert nothing.
98
+ *
99
+ * `requires` and `ensures` are arrays, and an element that lifts to `undefined` is a claim with no
100
+ * content. Keeping a hole in the list would make `canFollow` compare against nothing and report a
101
+ * precondition as met by a claim that says nothing at all.
102
+ */
103
+ const ExpectListSchema = z
104
+ .array(ExpectSchema)
105
+ .transform((list) => list.filter((one) => one !== undefined));
169
106
  const baseFlowStep = z.object({
170
107
  tool: z.string(),
171
108
  anchor: FlowAnchorSchema,
@@ -195,9 +132,11 @@ const baseFlowStep = z.object({
195
132
  id: z.string().min(1).optional(),
196
133
  /** What this step does to the subject; absent means unknown. See StepEffect. */
197
134
  effect: z.nativeEnum(StepEffect).optional(),
135
+ /** Rebound by `heal` rather than recorded — see FlowStep.healed. */
136
+ healed: z.object({ from: z.string(), at: z.number() }).optional(),
198
137
  action: z.nativeEnum(ActionType).optional(),
199
138
  args: z.record(z.unknown()).optional(),
200
- expect: FlowExpectSchema.optional(),
139
+ expect: ExpectSchema.optional(),
201
140
  degraded: z.boolean().optional(),
202
141
  timeoutMs: z.number().int().positive().optional(),
203
142
  invoke: z.string().min(1).optional(),
@@ -211,7 +150,14 @@ export const FlowStepSchema = baseFlowStep.extend({
211
150
  * file with neither still parses — back-compat is locked by a test).
212
151
  */
213
152
  export const FlowFileSchema = z.object({
214
- version: z.literal(FLOW_FILE_VERSION),
153
+ /**
154
+ * The format this file was WRITTEN in. Both readable versions are accepted, because a v1 file is
155
+ * lifted rather than refused — see READABLE_FLOW_VERSIONS.
156
+ */
157
+ version: z
158
+ .number()
159
+ .int()
160
+ .refine((v) => READABLE_FLOW_VERSIONS.has(v)),
215
161
  name: z.string(),
216
162
  /**
217
163
  * The business goal this flow exists to verify, one line (e.g. "ship a deploy to production").
@@ -269,8 +215,8 @@ export const FlowFileSchema = z.object({
269
215
  * Same predicate shape as a step's `expect`, deliberately — a precondition is just a consequence
270
216
  * somebody else's flow was responsible for.
271
217
  */
272
- requires: z.array(FlowExpectSchema).optional(),
273
- ensures: z.array(FlowExpectSchema).optional(),
218
+ requires: ExpectListSchema.optional(),
219
+ ensures: ExpectListSchema.optional(),
274
220
  /** From the injected clock (ms) — deterministic in tests, byte-stable on disk. */
275
221
  createdAt: z.number(),
276
222
  steps: z.array(FlowStepSchema),
@@ -283,7 +229,7 @@ export const FlowFileSchema = z.object({
283
229
  * replays exactly as before and the on-disk version stays FLOW_FILE_VERSION 1.
284
230
  */
285
231
  signalTimeoutMs: z.number().int().positive().optional(),
286
- success: FlowExpectSchema.optional(),
232
+ success: ExpectSchema.optional(),
287
233
  /**
288
234
  * Anchors whose CONTENT must not be asserted (e.g. LLM output). Replay asserts
289
235
  * presence, not words. Compiled from a `mark-dynamic` annotation.
@@ -431,14 +377,7 @@ export function staleKnownBugs(notes, currentAssertions) {
431
377
  }
432
378
  /** True when a FlowExpect asserts at least one consequence (any of the ConsequenceKind fields set). */
433
379
  export function flowExpectHasConsequence(expect) {
434
- if (expect === undefined)
435
- return false;
436
- const fields = expect;
437
- for (const kind of CONSEQUENCE_KINDS) {
438
- if (fields[kind] !== undefined)
439
- return true;
440
- }
441
- return false;
380
+ return expectClauses(expect).some((clause) => CONSEQUENCE_KINDS.has(clause.kind));
442
381
  }
443
382
  /**
444
383
  * True when a FlowExpect checks ONLY presence — an element, rendered text or a route, no consequence.
@@ -459,5 +398,22 @@ export function flowExpectHasConsequence(expect) {
459
398
  export function flowExpectIsPresenceOnly(expect) {
460
399
  if (expect === undefined || flowExpectHasConsequence(expect))
461
400
  return false;
462
- return expect.element !== undefined || expect.text !== undefined || expect.route !== undefined;
401
+ return expectClauses(expect).some((clause) => PRESENCE_GRADED.has(clause.kind));
402
+ }
403
+ /**
404
+ * Every clause an expectation contains, composites flattened.
405
+ *
406
+ * The grade is about what a flow CAN prove, so a consequence buried in an `allOf` counts exactly as
407
+ * much as one at the top. It got simpler with the tree rather than harder: the old version had to
408
+ * probe a struct for one key per kind, and a predicate carries its kind on itself.
409
+ */
410
+ function expectClauses(expect) {
411
+ if (expect === undefined)
412
+ return [];
413
+ if (PredicateKind.ALL_OF === expect.kind || PredicateKind.ANY_OF === expect.kind) {
414
+ return expect.predicates.flatMap(expectClauses);
415
+ }
416
+ if (PredicateKind.NOT === expect.kind)
417
+ return expectClauses(expect.predicate);
418
+ return [expect];
463
419
  }
@@ -255,13 +255,13 @@ export declare const ImpactDefectSchema: z.ZodObject<{
255
255
  }, "strip", z.ZodTypeAny, {
256
256
  at: number;
257
257
  title: string;
258
- source?: string | undefined;
259
258
  detail?: string | undefined;
259
+ source?: string | undefined;
260
260
  }, {
261
261
  at: number;
262
262
  title: string;
263
- source?: string | undefined;
264
263
  detail?: string | undefined;
264
+ source?: string | undefined;
265
265
  }>;
266
266
  export type ImpactDefect = z.infer<typeof ImpactDefectSchema>;
267
267
  /** One scope of the record: this project, or everything on this machine. */
@@ -470,13 +470,13 @@ export declare const ImpactScopeSchema: z.ZodObject<{
470
470
  }, "strip", z.ZodTypeAny, {
471
471
  at: number;
472
472
  title: string;
473
- source?: string | undefined;
474
473
  detail?: string | undefined;
474
+ source?: string | undefined;
475
475
  }, {
476
476
  at: number;
477
477
  title: string;
478
- source?: string | undefined;
479
478
  detail?: string | undefined;
479
+ source?: string | undefined;
480
480
  }>, "many">>;
481
481
  }, "strip", z.ZodTypeAny, {
482
482
  since: number;
@@ -527,8 +527,8 @@ export declare const ImpactScopeSchema: z.ZodObject<{
527
527
  defects: {
528
528
  at: number;
529
529
  title: string;
530
- source?: string | undefined;
531
530
  detail?: string | undefined;
531
+ source?: string | undefined;
532
532
  }[];
533
533
  }, {
534
534
  since: number;
@@ -579,8 +579,8 @@ export declare const ImpactScopeSchema: z.ZodObject<{
579
579
  defects?: {
580
580
  at: number;
581
581
  title: string;
582
- source?: string | undefined;
583
582
  detail?: string | undefined;
583
+ source?: string | undefined;
584
584
  }[] | undefined;
585
585
  }>;
586
586
  export type ImpactScope = z.infer<typeof ImpactScopeSchema>;
@@ -639,6 +639,17 @@ export declare const HarnessOfferSchema: z.ZodObject<{
639
639
  daysRemaining: z.ZodOptional<z.ZodNumber>;
640
640
  /** Where claiming happens. Absent ⇒ the HUD shows nothing, because a pitch with no door is noise. */
641
641
  claimUrl: z.ZodOptional<z.ZodString>;
642
+ /**
643
+ * Whether a drive could actually run if the offer were taken.
644
+ *
645
+ * Entitlement is not readiness. A workspace can be fully entitled against a deployment that holds
646
+ * no key for its provider, and then every signal reads healthy while a drive cannot start —
647
+ * including the card, which would sell three free months of something unusable and burn the one
648
+ * claim the person gets. Absent means "not told", which is treated as drivable for the same
649
+ * reason `claimed` is required and the rest are not: silence from an older platform must not
650
+ * switch the feature off.
651
+ */
652
+ drivable: z.ZodOptional<z.ZodBoolean>;
642
653
  /**
643
654
  * Whether claiming would still grant anything.
644
655
  *
@@ -654,12 +665,14 @@ export declare const HarnessOfferSchema: z.ZodObject<{
654
665
  expiresAt?: number | undefined;
655
666
  daysRemaining?: number | undefined;
656
667
  claimUrl?: string | undefined;
668
+ drivable?: boolean | undefined;
657
669
  eligible?: boolean | undefined;
658
670
  }, {
659
671
  claimed: boolean;
660
672
  expiresAt?: number | undefined;
661
673
  daysRemaining?: number | undefined;
662
674
  claimUrl?: string | undefined;
675
+ drivable?: boolean | undefined;
663
676
  eligible?: boolean | undefined;
664
677
  }>;
665
678
  export type HarnessOffer = z.infer<typeof HarnessOfferSchema>;
@@ -892,13 +905,13 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
892
905
  }, "strip", z.ZodTypeAny, {
893
906
  at: number;
894
907
  title: string;
895
- source?: string | undefined;
896
908
  detail?: string | undefined;
909
+ source?: string | undefined;
897
910
  }, {
898
911
  at: number;
899
912
  title: string;
900
- source?: string | undefined;
901
913
  detail?: string | undefined;
914
+ source?: string | undefined;
902
915
  }>, "many">>;
903
916
  }, "strip", z.ZodTypeAny, {
904
917
  since: number;
@@ -949,8 +962,8 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
949
962
  defects: {
950
963
  at: number;
951
964
  title: string;
952
- source?: string | undefined;
953
965
  detail?: string | undefined;
966
+ source?: string | undefined;
954
967
  }[];
955
968
  }, {
956
969
  since: number;
@@ -1001,8 +1014,8 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1001
1014
  defects?: {
1002
1015
  at: number;
1003
1016
  title: string;
1004
- source?: string | undefined;
1005
1017
  detail?: string | undefined;
1018
+ source?: string | undefined;
1006
1019
  }[] | undefined;
1007
1020
  }>;
1008
1021
  global: z.ZodObject<{
@@ -1210,13 +1223,13 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1210
1223
  }, "strip", z.ZodTypeAny, {
1211
1224
  at: number;
1212
1225
  title: string;
1213
- source?: string | undefined;
1214
1226
  detail?: string | undefined;
1227
+ source?: string | undefined;
1215
1228
  }, {
1216
1229
  at: number;
1217
1230
  title: string;
1218
- source?: string | undefined;
1219
1231
  detail?: string | undefined;
1232
+ source?: string | undefined;
1220
1233
  }>, "many">>;
1221
1234
  }, "strip", z.ZodTypeAny, {
1222
1235
  since: number;
@@ -1267,8 +1280,8 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1267
1280
  defects: {
1268
1281
  at: number;
1269
1282
  title: string;
1270
- source?: string | undefined;
1271
1283
  detail?: string | undefined;
1284
+ source?: string | undefined;
1272
1285
  }[];
1273
1286
  }, {
1274
1287
  since: number;
@@ -1319,8 +1332,8 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1319
1332
  defects?: {
1320
1333
  at: number;
1321
1334
  title: string;
1322
- source?: string | undefined;
1323
1335
  detail?: string | undefined;
1336
+ source?: string | undefined;
1324
1337
  }[] | undefined;
1325
1338
  }>;
1326
1339
  /** Project name, for the report's title row. */
@@ -1365,6 +1378,17 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1365
1378
  daysRemaining: z.ZodOptional<z.ZodNumber>;
1366
1379
  /** Where claiming happens. Absent ⇒ the HUD shows nothing, because a pitch with no door is noise. */
1367
1380
  claimUrl: z.ZodOptional<z.ZodString>;
1381
+ /**
1382
+ * Whether a drive could actually run if the offer were taken.
1383
+ *
1384
+ * Entitlement is not readiness. A workspace can be fully entitled against a deployment that holds
1385
+ * no key for its provider, and then every signal reads healthy while a drive cannot start —
1386
+ * including the card, which would sell three free months of something unusable and burn the one
1387
+ * claim the person gets. Absent means "not told", which is treated as drivable for the same
1388
+ * reason `claimed` is required and the rest are not: silence from an older platform must not
1389
+ * switch the feature off.
1390
+ */
1391
+ drivable: z.ZodOptional<z.ZodBoolean>;
1368
1392
  /**
1369
1393
  * Whether claiming would still grant anything.
1370
1394
  *
@@ -1380,12 +1404,14 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1380
1404
  expiresAt?: number | undefined;
1381
1405
  daysRemaining?: number | undefined;
1382
1406
  claimUrl?: string | undefined;
1407
+ drivable?: boolean | undefined;
1383
1408
  eligible?: boolean | undefined;
1384
1409
  }, {
1385
1410
  claimed: boolean;
1386
1411
  expiresAt?: number | undefined;
1387
1412
  daysRemaining?: number | undefined;
1388
1413
  claimUrl?: string | undefined;
1414
+ drivable?: boolean | undefined;
1389
1415
  eligible?: boolean | undefined;
1390
1416
  }>>;
1391
1417
  /**
@@ -1416,6 +1442,7 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1416
1442
  harnessEntitled: boolean;
1417
1443
  }>>;
1418
1444
  }, "strip", z.ZodTypeAny, {
1445
+ schemaVersion: number;
1419
1446
  project: {
1420
1447
  since: number;
1421
1448
  counts: {
@@ -1465,11 +1492,10 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1465
1492
  defects: {
1466
1493
  at: number;
1467
1494
  title: string;
1468
- source?: string | undefined;
1469
1495
  detail?: string | undefined;
1496
+ source?: string | undefined;
1470
1497
  }[];
1471
1498
  };
1472
- schemaVersion: number;
1473
1499
  global: {
1474
1500
  since: number;
1475
1501
  counts: {
@@ -1519,8 +1545,8 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1519
1545
  defects: {
1520
1546
  at: number;
1521
1547
  title: string;
1522
- source?: string | undefined;
1523
1548
  detail?: string | undefined;
1549
+ source?: string | undefined;
1524
1550
  }[];
1525
1551
  };
1526
1552
  projectName?: string | undefined;
@@ -1536,6 +1562,7 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1536
1562
  expiresAt?: number | undefined;
1537
1563
  daysRemaining?: number | undefined;
1538
1564
  claimUrl?: string | undefined;
1565
+ drivable?: boolean | undefined;
1539
1566
  eligible?: boolean | undefined;
1540
1567
  } | undefined;
1541
1568
  harnessConfig?: {
@@ -1544,6 +1571,7 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1544
1571
  harnessEntitled: boolean;
1545
1572
  } | undefined;
1546
1573
  }, {
1574
+ schemaVersion: number;
1547
1575
  project: {
1548
1576
  since: number;
1549
1577
  counts: {
@@ -1593,11 +1621,10 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1593
1621
  defects?: {
1594
1622
  at: number;
1595
1623
  title: string;
1596
- source?: string | undefined;
1597
1624
  detail?: string | undefined;
1625
+ source?: string | undefined;
1598
1626
  }[] | undefined;
1599
1627
  };
1600
- schemaVersion: number;
1601
1628
  global: {
1602
1629
  since: number;
1603
1630
  counts: {
@@ -1647,8 +1674,8 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1647
1674
  defects?: {
1648
1675
  at: number;
1649
1676
  title: string;
1650
- source?: string | undefined;
1651
1677
  detail?: string | undefined;
1678
+ source?: string | undefined;
1652
1679
  }[] | undefined;
1653
1680
  };
1654
1681
  projectName?: string | undefined;
@@ -1664,6 +1691,7 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1664
1691
  expiresAt?: number | undefined;
1665
1692
  daysRemaining?: number | undefined;
1666
1693
  claimUrl?: string | undefined;
1694
+ drivable?: boolean | undefined;
1667
1695
  eligible?: boolean | undefined;
1668
1696
  } | undefined;
1669
1697
  harnessConfig?: {
@@ -159,6 +159,17 @@ export const HarnessOfferSchema = z.object({
159
159
  daysRemaining: z.number().optional(),
160
160
  /** Where claiming happens. Absent ⇒ the HUD shows nothing, because a pitch with no door is noise. */
161
161
  claimUrl: z.string().optional(),
162
+ /**
163
+ * Whether a drive could actually run if the offer were taken.
164
+ *
165
+ * Entitlement is not readiness. A workspace can be fully entitled against a deployment that holds
166
+ * no key for its provider, and then every signal reads healthy while a drive cannot start —
167
+ * including the card, which would sell three free months of something unusable and burn the one
168
+ * claim the person gets. Absent means "not told", which is treated as drivable for the same
169
+ * reason `claimed` is required and the rest are not: silence from an older platform must not
170
+ * switch the feature off.
171
+ */
172
+ drivable: z.boolean().optional(),
162
173
  /**
163
174
  * Whether claiming would still grant anything.
164
175
  *
@@ -162,6 +162,31 @@ export declare const JournalVerdictEffectSchema: z.ZodObject<{
162
162
  }>;
163
163
  /** `file:line` for the element driven, when the page told us one. */
164
164
  source: z.ZodOptional<z.ZodString>;
165
+ /**
166
+ * Which source of truth answering the claim required -- the predicate's own kind.
167
+ *
168
+ * A run folded from this journal has to say what a check READ, and with no field here it had
169
+ * nothing to say it from: every check ever folded was stamped `element`, including the ones whose
170
+ * own `grade` in the same object said `net`. Channel routing reads this, so a network verdict
171
+ * arrived as a UI verdict.
172
+ *
173
+ * Optional, because a record written before this field existed has no kind and must not be read
174
+ * as though it had one.
175
+ */
176
+ kind: z.ZodOptional<z.ZodNativeEnum<{
177
+ readonly ELEMENT: "element";
178
+ readonly TEXT: "text";
179
+ readonly SIGNAL: "signal";
180
+ readonly NET: "net";
181
+ readonly STATE: "state";
182
+ readonly ROUTE: "route";
183
+ readonly CONSOLE: "console";
184
+ readonly ANIMATION: "animation";
185
+ readonly SETTLED: "settled";
186
+ readonly ALL_OF: "allOf";
187
+ readonly ANY_OF: "anyOf";
188
+ readonly NOT: "not";
189
+ }>>;
165
190
  /**
166
191
  * Was the claim written down BEFORE the action, or after it?
167
192
  *
@@ -200,19 +225,21 @@ export declare const JournalVerdictEffectSchema: z.ZodObject<{
200
225
  reason: z.ZodOptional<z.ZodString>;
201
226
  }, "strip", z.ZodTypeAny, {
202
227
  claim: string;
203
- verified: "unknown" | "yes" | "no" | "no-fault";
204
- source?: string | undefined;
205
- reason?: string | undefined;
228
+ verified: "yes" | "no" | "unknown" | "no-fault";
229
+ kind?: "signal" | "text" | "net" | "state" | "element" | "route" | "console" | "animation" | "settled" | "allOf" | "anyOf" | "not" | undefined;
206
230
  declaredBeforeActing?: boolean | undefined;
207
231
  grade?: string | undefined;
208
232
  couldNotSee?: string[] | undefined;
233
+ reason?: string | undefined;
234
+ source?: string | undefined;
209
235
  }, {
210
236
  claim: string;
211
- verified: "unknown" | "yes" | "no" | "no-fault";
212
- source?: string | undefined;
213
- reason?: string | undefined;
237
+ verified: "yes" | "no" | "unknown" | "no-fault";
238
+ kind?: "signal" | "text" | "net" | "state" | "element" | "route" | "console" | "animation" | "settled" | "allOf" | "anyOf" | "not" | undefined;
214
239
  declaredBeforeActing?: boolean | undefined;
215
240
  grade?: string | undefined;
216
241
  couldNotSee?: string[] | undefined;
242
+ reason?: string | undefined;
243
+ source?: string | undefined;
217
244
  }>;
218
245
  export type JournalVerdictEffect = z.infer<typeof JournalVerdictEffectSchema>;
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { TRANSPORT_LIMITS, TruncationChannel } from '../wire/constants/constants.js';
3
3
  import { Verified } from '../verdict/verified-constants.js';
4
+ import { PredicateKind } from '../verdict/consequence.js';
4
5
  /**
5
6
  * The durable causal journal. Each session gets an append-only pair on disk:
6
7
  * `.reticle/sessions/<id>/events.jsonl` (one `ReticleEvent` per line — already seq/actionId-stamped
@@ -91,6 +92,18 @@ export const JournalVerdictEffectSchema = z.object({
91
92
  verified: z.nativeEnum(Verified),
92
93
  /** `file:line` for the element driven, when the page told us one. */
93
94
  source: z.string().max(TRANSPORT_LIMITS.MAX_URL_LENGTH).optional(),
95
+ /**
96
+ * Which source of truth answering the claim required -- the predicate's own kind.
97
+ *
98
+ * A run folded from this journal has to say what a check READ, and with no field here it had
99
+ * nothing to say it from: every check ever folded was stamped `element`, including the ones whose
100
+ * own `grade` in the same object said `net`. Channel routing reads this, so a network verdict
101
+ * arrived as a UI verdict.
102
+ *
103
+ * Optional, because a record written before this field existed has no kind and must not be read
104
+ * as though it had one.
105
+ */
106
+ kind: z.nativeEnum(PredicateKind).optional(),
94
107
  /**
95
108
  * Was the claim written down BEFORE the action, or after it?
96
109
  *