@reticlehq/core 3.1.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 (82) hide show
  1. package/dist/artifacts/flow-composition.d.ts +3 -2
  2. package/dist/artifacts/flow-constants.d.ts +59 -2
  3. package/dist/artifacts/flow-constants.js +63 -3
  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 +1071 -1225
  10. package/dist/artifacts/flow-types.js +96 -140
  11. package/dist/artifacts/impact.d.ts +200 -20
  12. package/dist/artifacts/impact.js +72 -0
  13. package/dist/artifacts/journal.d.ts +85 -6
  14. package/dist/artifacts/journal.js +51 -1
  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/brand.d.ts +46 -0
  19. package/dist/identity/brand.js +7 -0
  20. package/dist/identity/source-constants.d.ts +11 -0
  21. package/dist/identity/source-constants.js +11 -0
  22. package/dist/index.d.ts +9 -0
  23. package/dist/index.js +26 -2
  24. package/dist/onboarding.d.ts +2 -2
  25. package/dist/realm/registry.d.ts +0 -8
  26. package/dist/realm/registry.js +1 -11
  27. package/dist/schema/event-message.json +3 -1
  28. package/dist/schema/event-payloads.json +74 -1
  29. package/dist/schema/event-type.json +3 -1
  30. package/dist/schema/reticle-event.json +3 -1
  31. package/dist/schema/reticle-message.json +3 -1
  32. package/dist/source-constants.cjs +1 -0
  33. package/dist/source-constants.d.cts +1 -0
  34. package/dist/telemetry-feedback.d.ts +6 -6
  35. package/dist/telemetry-refusal.d.ts +2 -2
  36. package/dist/telemetry-session.d.ts +25 -2
  37. package/dist/telemetry-session.js +13 -0
  38. package/dist/telemetry.d.ts +184 -102
  39. package/dist/telemetry.js +29 -1
  40. package/dist/verdict/consequence.d.ts +10 -0
  41. package/dist/verdict/consequence.js +13 -0
  42. package/dist/verdict/intent.d.ts +36 -12
  43. package/dist/verdict/intent.js +66 -10
  44. package/dist/verdict/predicate-tree.d.ts +47 -0
  45. package/dist/verdict/predicate-tree.js +146 -0
  46. package/dist/verdict/predicate.d.ts +129 -0
  47. package/dist/verdict/predicate.js +394 -0
  48. package/dist/verdict/property-assertion.d.ts +191 -0
  49. package/dist/verdict/property-assertion.js +42 -0
  50. package/dist/verdict/security.js +16 -4
  51. package/dist/verdict/verdict-attribution.d.ts +52 -0
  52. package/dist/verdict/verdict-attribution.js +87 -0
  53. package/dist/verdict/verification-run.d.ts +98 -84
  54. package/dist/verdict/verification-run.js +8 -1
  55. package/dist/verdict/verified-constants.d.ts +18 -0
  56. package/dist/verdict/verified-constants.js +18 -0
  57. package/dist/wire/constants/constants.d.ts +108 -98
  58. package/dist/wire/constants/constants.js +116 -97
  59. package/dist/wire/constants/discovery.d.ts +25 -0
  60. package/dist/wire/constants/discovery.js +25 -0
  61. package/dist/wire/constants/event-types.d.ts +122 -0
  62. package/dist/wire/constants/event-types.js +121 -0
  63. package/dist/wire/constants/hud-controls.d.ts +19 -0
  64. package/dist/wire/constants/hud-controls.js +95 -0
  65. package/dist/wire/constants/hud-use.d.ts +27 -0
  66. package/dist/wire/constants/hud-use.js +24 -0
  67. package/dist/wire/constants/session-constants.d.ts +24 -0
  68. package/dist/wire/constants/session-constants.js +24 -0
  69. package/dist/wire/event-payloads.d.ts +70 -10
  70. package/dist/wire/event-payloads.js +20 -1
  71. package/dist/wire/messages.d.ts +90 -48
  72. package/dist/wire/messages.js +17 -0
  73. package/dist/wire/net.d.ts +42 -0
  74. package/dist/wire/net.js +48 -0
  75. package/dist/wire/snapshot-tree.d.ts +33 -0
  76. package/dist/wire/snapshot-tree.js +43 -0
  77. package/dist/wire/state-select.d.ts +2 -1
  78. package/dist/wire/state-select.js +56 -3
  79. package/dist/wire/toon.js +28 -7
  80. package/dist/wire/types.d.ts +91 -66
  81. package/dist/wire/types.js +23 -1
  82. 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>;
@@ -620,6 +620,84 @@ export declare const AccountStateSchema: z.ZodObject<{
620
620
  host?: string | undefined;
621
621
  }>;
622
622
  export type AccountState = z.infer<typeof AccountStateSchema>;
623
+ /**
624
+ * The standing offer on the autonomous harness, as the daemon last heard it from the platform.
625
+ *
626
+ * `claimed` is the only field that decides whether anything is shown, and ABSENCE of this whole
627
+ * object means "we do not know" — never "not claimed". That distinction is the difference between
628
+ * an offer and a nag: a machine that is offline, unlinked, or paired with an older daemon has not
629
+ * told us the person still needs this, and advertising at them anyway is how a dev-only HUD gets
630
+ * switched off for good. The account field beside this one already carries that warning; it applies
631
+ * here with more force, because this one is marketing.
632
+ */
633
+ export declare const HarnessOfferSchema: z.ZodObject<{
634
+ /** True once this org has claimed. A claimed offer is shown as remaining time, never as a pitch. */
635
+ claimed: z.ZodBoolean;
636
+ /** When the free period ends, epoch ms. Absent when nothing has been claimed. */
637
+ expiresAt: z.ZodOptional<z.ZodNumber>;
638
+ /** Whole days left, already computed — the HUD has no clock worth trusting for this. */
639
+ daysRemaining: z.ZodOptional<z.ZodNumber>;
640
+ /** Where claiming happens. Absent ⇒ the HUD shows nothing, because a pitch with no door is noise. */
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>;
653
+ /**
654
+ * Whether claiming would still grant anything.
655
+ *
656
+ * Carried separately because `claimed` is "running RIGHT NOW", and an expired free period reads
657
+ * `claimed: false` — the same as never having taken it. Without this the HUD would advertise a
658
+ * three-month offer to the one group of people who can never accept it again, which is worse than
659
+ * saying nothing at all. Absent ⇒ treated as still offerable: an older platform that does not
660
+ * report it also has no expiries to get wrong.
661
+ */
662
+ eligible: z.ZodOptional<z.ZodBoolean>;
663
+ }, "strip", z.ZodTypeAny, {
664
+ claimed: boolean;
665
+ expiresAt?: number | undefined;
666
+ daysRemaining?: number | undefined;
667
+ claimUrl?: string | undefined;
668
+ drivable?: boolean | undefined;
669
+ eligible?: boolean | undefined;
670
+ }, {
671
+ claimed: boolean;
672
+ expiresAt?: number | undefined;
673
+ daysRemaining?: number | undefined;
674
+ claimUrl?: string | undefined;
675
+ drivable?: boolean | undefined;
676
+ eligible?: boolean | undefined;
677
+ }>;
678
+ export type HarnessOffer = z.infer<typeof HarnessOfferSchema>;
679
+ /**
680
+ * What the platform says about autonomous driving for this project.
681
+ *
682
+ * Mirrors `PlatformModelConfig` on the server side; both are the same wire answer read by different
683
+ * layers. Kept here because it crosses daemon -> browser, which is what makes it a wire type.
684
+ */
685
+ export declare const HarnessConfigSchema: z.ZodObject<{
686
+ provider: z.ZodString;
687
+ /** The switch somebody set. The platform's default is on. */
688
+ harnessEnabled: z.ZodBoolean;
689
+ /** Whether this workspace may drive on OUR model spend. Never folded into the switch. */
690
+ harnessEntitled: z.ZodBoolean;
691
+ }, "strip", z.ZodTypeAny, {
692
+ provider: string;
693
+ harnessEnabled: boolean;
694
+ harnessEntitled: boolean;
695
+ }, {
696
+ provider: string;
697
+ harnessEnabled: boolean;
698
+ harnessEntitled: boolean;
699
+ }>;
700
+ export type HarnessConfig = z.infer<typeof HarnessConfigSchema>;
623
701
  export declare const ImpactSnapshotSchema: z.ZodObject<{
624
702
  schemaVersion: z.ZodNumber;
625
703
  project: z.ZodObject<{
@@ -827,13 +905,13 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
827
905
  }, "strip", z.ZodTypeAny, {
828
906
  at: number;
829
907
  title: string;
830
- source?: string | undefined;
831
908
  detail?: string | undefined;
909
+ source?: string | undefined;
832
910
  }, {
833
911
  at: number;
834
912
  title: string;
835
- source?: string | undefined;
836
913
  detail?: string | undefined;
914
+ source?: string | undefined;
837
915
  }>, "many">>;
838
916
  }, "strip", z.ZodTypeAny, {
839
917
  since: number;
@@ -884,8 +962,8 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
884
962
  defects: {
885
963
  at: number;
886
964
  title: string;
887
- source?: string | undefined;
888
965
  detail?: string | undefined;
966
+ source?: string | undefined;
889
967
  }[];
890
968
  }, {
891
969
  since: number;
@@ -936,8 +1014,8 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
936
1014
  defects?: {
937
1015
  at: number;
938
1016
  title: string;
939
- source?: string | undefined;
940
1017
  detail?: string | undefined;
1018
+ source?: string | undefined;
941
1019
  }[] | undefined;
942
1020
  }>;
943
1021
  global: z.ZodObject<{
@@ -1145,13 +1223,13 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1145
1223
  }, "strip", z.ZodTypeAny, {
1146
1224
  at: number;
1147
1225
  title: string;
1148
- source?: string | undefined;
1149
1226
  detail?: string | undefined;
1227
+ source?: string | undefined;
1150
1228
  }, {
1151
1229
  at: number;
1152
1230
  title: string;
1153
- source?: string | undefined;
1154
1231
  detail?: string | undefined;
1232
+ source?: string | undefined;
1155
1233
  }>, "many">>;
1156
1234
  }, "strip", z.ZodTypeAny, {
1157
1235
  since: number;
@@ -1202,8 +1280,8 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1202
1280
  defects: {
1203
1281
  at: number;
1204
1282
  title: string;
1205
- source?: string | undefined;
1206
1283
  detail?: string | undefined;
1284
+ source?: string | undefined;
1207
1285
  }[];
1208
1286
  }, {
1209
1287
  since: number;
@@ -1254,8 +1332,8 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1254
1332
  defects?: {
1255
1333
  at: number;
1256
1334
  title: string;
1257
- source?: string | undefined;
1258
1335
  detail?: string | undefined;
1336
+ source?: string | undefined;
1259
1337
  }[] | undefined;
1260
1338
  }>;
1261
1339
  /** Project name, for the report's title row. */
@@ -1287,7 +1365,84 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1287
1365
  org?: string | undefined;
1288
1366
  host?: string | undefined;
1289
1367
  }>>;
1368
+ /**
1369
+ * The harness offer, when the daemon knows it. Absent is "unknown" and shows nothing — see
1370
+ * `HarnessOfferSchema` for why that asymmetry is deliberate.
1371
+ */
1372
+ harnessOffer: z.ZodOptional<z.ZodObject<{
1373
+ /** True once this org has claimed. A claimed offer is shown as remaining time, never as a pitch. */
1374
+ claimed: z.ZodBoolean;
1375
+ /** When the free period ends, epoch ms. Absent when nothing has been claimed. */
1376
+ expiresAt: z.ZodOptional<z.ZodNumber>;
1377
+ /** Whole days left, already computed — the HUD has no clock worth trusting for this. */
1378
+ daysRemaining: z.ZodOptional<z.ZodNumber>;
1379
+ /** Where claiming happens. Absent ⇒ the HUD shows nothing, because a pitch with no door is noise. */
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>;
1392
+ /**
1393
+ * Whether claiming would still grant anything.
1394
+ *
1395
+ * Carried separately because `claimed` is "running RIGHT NOW", and an expired free period reads
1396
+ * `claimed: false` — the same as never having taken it. Without this the HUD would advertise a
1397
+ * three-month offer to the one group of people who can never accept it again, which is worse than
1398
+ * saying nothing at all. Absent ⇒ treated as still offerable: an older platform that does not
1399
+ * report it also has no expiries to get wrong.
1400
+ */
1401
+ eligible: z.ZodOptional<z.ZodBoolean>;
1402
+ }, "strip", z.ZodTypeAny, {
1403
+ claimed: boolean;
1404
+ expiresAt?: number | undefined;
1405
+ daysRemaining?: number | undefined;
1406
+ claimUrl?: string | undefined;
1407
+ drivable?: boolean | undefined;
1408
+ eligible?: boolean | undefined;
1409
+ }, {
1410
+ claimed: boolean;
1411
+ expiresAt?: number | undefined;
1412
+ daysRemaining?: number | undefined;
1413
+ claimUrl?: string | undefined;
1414
+ drivable?: boolean | undefined;
1415
+ eligible?: boolean | undefined;
1416
+ }>>;
1417
+ /**
1418
+ * The harness switch and whether this workspace may drive on our spend.
1419
+ *
1420
+ * Two fields, never one, and the HUD renders them differently: `harnessEnabled` is a switch the
1421
+ * person owns, `harnessEntitled` is a fact about their account. A panel that collapsed them would
1422
+ * show "off" to somebody whose free months lapsed and invite them to turn on something they no
1423
+ * longer have.
1424
+ *
1425
+ * Absent means the daemon has not heard -- an offline machine, an unlinked project, an older
1426
+ * platform -- and the panel shows no control at all rather than guessing. Showing a switch that
1427
+ * cannot be honoured is worse than showing none.
1428
+ */
1429
+ harnessConfig: z.ZodOptional<z.ZodObject<{
1430
+ provider: z.ZodString;
1431
+ /** The switch somebody set. The platform's default is on. */
1432
+ harnessEnabled: z.ZodBoolean;
1433
+ /** Whether this workspace may drive on OUR model spend. Never folded into the switch. */
1434
+ harnessEntitled: z.ZodBoolean;
1435
+ }, "strip", z.ZodTypeAny, {
1436
+ provider: string;
1437
+ harnessEnabled: boolean;
1438
+ harnessEntitled: boolean;
1439
+ }, {
1440
+ provider: string;
1441
+ harnessEnabled: boolean;
1442
+ harnessEntitled: boolean;
1443
+ }>>;
1290
1444
  }, "strip", z.ZodTypeAny, {
1445
+ schemaVersion: number;
1291
1446
  project: {
1292
1447
  since: number;
1293
1448
  counts: {
@@ -1337,11 +1492,10 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1337
1492
  defects: {
1338
1493
  at: number;
1339
1494
  title: string;
1340
- source?: string | undefined;
1341
1495
  detail?: string | undefined;
1496
+ source?: string | undefined;
1342
1497
  }[];
1343
1498
  };
1344
- schemaVersion: number;
1345
1499
  global: {
1346
1500
  since: number;
1347
1501
  counts: {
@@ -1391,8 +1545,8 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1391
1545
  defects: {
1392
1546
  at: number;
1393
1547
  title: string;
1394
- source?: string | undefined;
1395
1548
  detail?: string | undefined;
1549
+ source?: string | undefined;
1396
1550
  }[];
1397
1551
  };
1398
1552
  projectName?: string | undefined;
@@ -1403,7 +1557,21 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1403
1557
  org?: string | undefined;
1404
1558
  host?: string | undefined;
1405
1559
  } | undefined;
1560
+ harnessOffer?: {
1561
+ claimed: boolean;
1562
+ expiresAt?: number | undefined;
1563
+ daysRemaining?: number | undefined;
1564
+ claimUrl?: string | undefined;
1565
+ drivable?: boolean | undefined;
1566
+ eligible?: boolean | undefined;
1567
+ } | undefined;
1568
+ harnessConfig?: {
1569
+ provider: string;
1570
+ harnessEnabled: boolean;
1571
+ harnessEntitled: boolean;
1572
+ } | undefined;
1406
1573
  }, {
1574
+ schemaVersion: number;
1407
1575
  project: {
1408
1576
  since: number;
1409
1577
  counts: {
@@ -1453,11 +1621,10 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1453
1621
  defects?: {
1454
1622
  at: number;
1455
1623
  title: string;
1456
- source?: string | undefined;
1457
1624
  detail?: string | undefined;
1625
+ source?: string | undefined;
1458
1626
  }[] | undefined;
1459
1627
  };
1460
- schemaVersion: number;
1461
1628
  global: {
1462
1629
  since: number;
1463
1630
  counts: {
@@ -1507,8 +1674,8 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1507
1674
  defects?: {
1508
1675
  at: number;
1509
1676
  title: string;
1510
- source?: string | undefined;
1511
1677
  detail?: string | undefined;
1678
+ source?: string | undefined;
1512
1679
  }[] | undefined;
1513
1680
  };
1514
1681
  projectName?: string | undefined;
@@ -1519,6 +1686,19 @@ export declare const ImpactSnapshotSchema: z.ZodObject<{
1519
1686
  org?: string | undefined;
1520
1687
  host?: string | undefined;
1521
1688
  } | undefined;
1689
+ harnessOffer?: {
1690
+ claimed: boolean;
1691
+ expiresAt?: number | undefined;
1692
+ daysRemaining?: number | undefined;
1693
+ claimUrl?: string | undefined;
1694
+ drivable?: boolean | undefined;
1695
+ eligible?: boolean | undefined;
1696
+ } | undefined;
1697
+ harnessConfig?: {
1698
+ provider: string;
1699
+ harnessEnabled: boolean;
1700
+ harnessEntitled: boolean;
1701
+ } | undefined;
1522
1702
  }>;
1523
1703
  export type ImpactSnapshot = z.infer<typeof ImpactSnapshotSchema>;
1524
1704
  /** Empty counters - the starting point for a fresh store and the identity for merges. */