@reticlehq/core 2.4.0 → 2.5.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 (44) hide show
  1. package/dist/consequence.d.ts +27 -0
  2. package/dist/consequence.js +26 -0
  3. package/dist/constants.d.ts +52 -0
  4. package/dist/constants.js +49 -0
  5. package/dist/contract-fingerprint.d.ts +29 -0
  6. package/dist/contract-fingerprint.js +56 -0
  7. package/dist/daemon-registry.js +1 -1
  8. package/dist/event-payloads.d.ts +48 -0
  9. package/dist/event-payloads.js +12 -1
  10. package/dist/flow-constants.d.ts +8 -0
  11. package/dist/flow-constants.js +12 -0
  12. package/dist/flow-types.d.ts +23 -0
  13. package/dist/index.d.ts +2 -0
  14. package/dist/index.js +2 -0
  15. package/dist/journal.d.ts +2 -2
  16. package/dist/messages.d.ts +48 -0
  17. package/dist/messages.js +20 -0
  18. package/dist/net.d.ts +40 -0
  19. package/dist/net.js +44 -0
  20. package/dist/project-id.d.ts +28 -0
  21. package/dist/project-id.js +51 -0
  22. package/dist/redaction.js +4 -4
  23. package/dist/schema/hello-message.json +8 -0
  24. package/dist/schema/reticle-message.json +8 -0
  25. package/dist/security.js +10 -5
  26. package/dist/source-constants.d.ts +6 -0
  27. package/dist/source-constants.js +6 -0
  28. package/dist/state-select.d.ts +14 -2
  29. package/dist/state-select.js +77 -14
  30. package/dist/telemetry-feedback.d.ts +32 -10
  31. package/dist/telemetry-feedback.js +21 -0
  32. package/dist/telemetry-session.d.ts +30 -0
  33. package/dist/telemetry-session.js +24 -0
  34. package/dist/telemetry.d.ts +491 -81
  35. package/dist/telemetry.js +188 -2
  36. package/dist/toon.d.ts +2 -1
  37. package/dist/toon.js +37 -37
  38. package/dist/types.d.ts +48 -0
  39. package/dist/types.js +12 -0
  40. package/dist/upgrade.js +1 -1
  41. package/dist/verification-run.d.ts +28 -28
  42. package/dist/verified-constants.d.ts +37 -0
  43. package/dist/verified-constants.js +36 -0
  44. package/package.json +5 -3
package/dist/telemetry.js CHANGED
@@ -17,7 +17,8 @@
17
17
  */
18
18
  import { z } from 'zod';
19
19
  import { MachineSnapshotSchema, ProjectProfileSchema, SessionSummarySchema, } from './telemetry-session.js';
20
- import { FeedbackSchema } from './telemetry-feedback.js';
20
+ import { BrowserBrand, FeedbackSchema } from './telemetry-feedback.js';
21
+ import { VerifiedReason } from './verified-constants.js';
21
22
  import { IdentitySchema } from './telemetry-feedback.js';
22
23
  /** Bump when the event shape changes so the analytics side can segment old senders. */
23
24
  export const TELEMETRY_EVENT_VERSION = 3;
@@ -55,6 +56,20 @@ export const TelemetryEventKind = {
55
56
  * errors, features touched). One event replaces the hundreds the old per-call `tool` event sent.
56
57
  */
57
58
  DAEMON_STOPPED: 'daemon_stopped',
59
+ /**
60
+ * A PERIODIC roll-up from a daemon that is still running — same payload shape as DAEMON_STOPPED,
61
+ * `final: false`.
62
+ *
63
+ * It used to be emitted AS `daemon_stopped`, which made an event named for an exit fire while the
64
+ * process was alive. Measured over one day: 98 `daemon_stopped` events were 73 real exits plus 25
65
+ * flushes, so anything counting sessions over-stated by 34% — and worse, the two populations are
66
+ * opposites. Every one of the 25 flushes had tool calls; not one of the 73 exits did (a daemon that
67
+ * served a tool never idle-exits, so only the idle ones ever reach a clean shutdown). A funnel over
68
+ * the raw event therefore describes active sessions at one end and abandoned ones at the other.
69
+ *
70
+ * Count sessions with DAEMON_STOPPED. Sum work with both.
71
+ */
72
+ SESSION_PROGRESS: 'session_progress',
58
73
  /**
59
74
  * A verification produced a verdict. The product's reason to exist, and the one metric an investor
60
75
  * should be shown: not "tools were called" but "an app was actually verified, and here is how often
@@ -93,6 +108,23 @@ export const TelemetryEventKind = {
93
108
  * identical to healthy usage in every other metric.
94
109
  */
95
110
  MCP_CLIENT_CONNECTED: 'mcp_client_connected',
111
+ /**
112
+ * The agent LOST its Reticle tools — the worst thing this product does to anyone, and until now
113
+ * completely invisible in the field.
114
+ *
115
+ * `mcp_client_connected` shows reconnect churn only from the daemon's side, and the proxy's own
116
+ * account of an outage went to a local file nobody sends us. So "how often does a real user's MCP
117
+ * server go down, and does it come back" — the single question the transport has to answer — could
118
+ * not be asked of any dashboard.
119
+ *
120
+ * Deliberately capped at TWO per proxy process: once on the first outage of a session, and once if
121
+ * the retry budget is spent (the severe case, where it stopped retrying and went dormant). The
122
+ * per-call `tool` event was already removed here for cost, and one measured afternoon produced 547
123
+ * proxy reconnects — an event per reconnect would bill for the pathology instead of measuring it.
124
+ * The first-outage event answers "what share of sessions lose MCP at all", which is the number
125
+ * that decides whether this is fixed.
126
+ */
127
+ MCP_CONNECTION_LOST: 'mcp_connection_lost',
96
128
  /**
97
129
  * `reticle init` finished. The onboarding funnel had no instrumentation at all, so a setup that
98
130
  * failed on a missing dependency was indistinguishable from a user who never tried.
@@ -112,6 +144,32 @@ export const TelemetryEventKind = {
112
144
  */
113
145
  BUG_FOUND: 'bug_found',
114
146
  };
147
+ /**
148
+ * Events that belong to a DAEMON RUN, and therefore carry `sessionId`.
149
+ *
150
+ * `sessionId` is minted per process, which is right for a daemon (a daemon run IS the session) and
151
+ * wrong for a one-shot CLI command, which invents one that joins to nothing. Measured over a real
152
+ * day: uniq(sessionId) was 704, of which 561 came from `cli_command_run` and NOT ONE was shared with
153
+ * a daemon. The real number of daemon runs was 121, so every tile counting sessions was ~6x high.
154
+ *
155
+ * Omitting the id on the one-shot events costs nothing — no join on those ids could ever have
156
+ * succeeded — and makes `uniq(sessionId)` mean the thing every dashboard already assumes it means.
157
+ */
158
+ const SESSION_SCOPED = new Set([
159
+ TelemetryEventKind.DAEMON_STARTED,
160
+ TelemetryEventKind.DAEMON_STOPPED,
161
+ TelemetryEventKind.SESSION_PROGRESS,
162
+ TelemetryEventKind.MCP_CLIENT_CONNECTED,
163
+ TelemetryEventKind.PROJECT_PROFILED,
164
+ TelemetryEventKind.VERIFICATION_COMPLETED,
165
+ TelemetryEventKind.BUG_FOUND,
166
+ TelemetryEventKind.RUNTIME_CRASHED,
167
+ TelemetryEventKind.FEEDBACK_SUBMITTED,
168
+ ]);
169
+ /** True when this event happened inside a daemon run, so a `sessionId` on it means something. */
170
+ export function isSessionScoped(kind) {
171
+ return SESSION_SCOPED.has(kind);
172
+ }
115
173
  /**
116
174
  * Who caused this. The only honest split available to us: a `reticle` command was TYPED by a person,
117
175
  * while an MCP tool call came from the agent's own loop.
@@ -165,11 +223,54 @@ export const VerificationSchema = z.object({
165
223
  */
166
224
  falseGreenCaught: z.boolean(),
167
225
  durationMs: z.number().int().nonnegative().optional(),
226
+ /**
227
+ * `headless` | `headed` | `attached` — how the browser under verification got there.
228
+ *
229
+ * Without it, "verifications run" is one undifferentiated number covering three different
230
+ * products: unattended CI, a human watching an agent work, and the SDK in somebody's own dev
231
+ * server. They have different costs, different failure modes and different value, and only the
232
+ * last one is what most installs actually do.
233
+ */
234
+ browser: z.string().min(1).max(16).optional(),
235
+ /**
236
+ * WHICH browser it was — `chrome` | `edge` | `arc` | `dia` | `brave` | `opera` | `firefox` |
237
+ * `safari` | `other`, from `BrowserBrand`.
238
+ *
239
+ * `browser` above says who drove it, and its most common value by far is `attached`: the SDK
240
+ * connected from a browser Reticle never launched. That leaves the actual browser unknown, and
241
+ * the engine cannot fill the gap — Chrome, Edge, Arc, Dia and Brave are one `blink`.
242
+ *
243
+ * OPTIONAL and absent rather than `"unknown"` when the page did not say: a desktop webview has no
244
+ * brand, and an older SDK does not report one. A guessed value would be indistinguishable from a
245
+ * measured one on a dashboard.
246
+ */
247
+ brand: z.nativeEnum(BrowserBrand).optional(),
248
+ /**
249
+ * WHICH clause of the honesty rule decided this — see `VerifiedReason`.
250
+ *
251
+ * `verified` alone cannot answer the question the product is judged on. `unknown` + `passed:false`
252
+ * was measured covering "Reticle caught a real bug", "the agent wrote a bad predicate" and
253
+ * "Reticle itself could not see", which need opposite responses and arrive as one value; `no`
254
+ * collapses "channels disagree" into "the agent's predicate failed" the same way.
255
+ *
256
+ * OPTIONAL because not every verdict comes from `decideVerified` — a suite reports pass/fail with
257
+ * no clause behind it, and an older SDK reports none. Absent means unclassified, never guessed.
258
+ */
259
+ reason: z.nativeEnum(VerifiedReason).optional(),
168
260
  });
169
261
  /** Which way the installed version moved, and between which versions. */
170
262
  export const VersionChangeSchema = z.object({
171
263
  from: z.string().min(1).max(64),
172
264
  to: z.string().min(1).max(64),
265
+ /**
266
+ * True when an agent had been told about exactly this version recently — so the nudge plausibly
267
+ * caused the update.
268
+ *
269
+ * Without it, `version_changed` says a version moved and never why, which leaves "the nudge never
270
+ * fired" and "the nudge fired and nobody acted" indistinguishable. Those need opposite responses,
271
+ * and the whole adoption story rests on knowing which one is happening.
272
+ */
273
+ nudged: z.boolean().optional(),
173
274
  /** `update` (forward) or `rollback` (back) — a rollback is a release-quality alarm. */
174
275
  direction: z.string().min(1).max(16),
175
276
  });
@@ -241,6 +342,28 @@ export const BugSource = {
241
342
  /** An assertion the agent declared did not hold. */
242
343
  ASSERTION: 'assertion',
243
344
  };
345
+ /**
346
+ * WHOSE fault the defect was.
347
+ *
348
+ * `bugsFound` is the number this product would most like to publish, and it is not publishable
349
+ * without this. Measured over one real session: 8 `bug_found` events, of which **one** was a defect
350
+ * in the app under test. The other seven were the agent's own bad predicates (a store path that
351
+ * never existed, an impossible selector) and one empty ref, all published as defects in the
352
+ * customer's product. A founder steering on that number is steering on noise.
353
+ *
354
+ * Deliberately OMITTED rather than guessed when the evidence does not say. A failed `element.present`
355
+ * covers "the button is missing", "the API is down" and "the agent mistyped a testid" identically,
356
+ * and inventing an owner for it would put a guess into the one number we intend to publish — the
357
+ * same mistake `brand` refuses to make by being absent rather than `"unknown"`.
358
+ */
359
+ export const BugAttribution = {
360
+ /** A defect in the app under test — the only bucket that belongs in a published defect count. */
361
+ APP: 'app',
362
+ /** The agent's own call was wrong: a path, store or target that never existed. Teach the agent. */
363
+ REQUEST: 'request',
364
+ /** Reticle could not see or could not drive. Our bug, or our configuration. Ship a fix. */
365
+ RETICLE: 'reticle',
366
+ };
244
367
  /**
245
368
  * One defect Reticle found in the app under test.
246
369
  *
@@ -283,6 +406,11 @@ export const BugFoundSchema = z.object({
283
406
  * as one — and must not be, since that would need data this event refuses to collect.
284
407
  */
285
408
  repeat: z.boolean(),
409
+ /**
410
+ * Whose fault it was — `app` | `request` | `reticle`. ABSENT when the evidence cannot say; see
411
+ * `BugAttribution`. Count `attribution: 'app'` for defects found in anybody's product.
412
+ */
413
+ attribution: z.nativeEnum(BugAttribution).optional(),
286
414
  });
287
415
  /** An MCP client attaching. Separates "installed and running" from "someone is actually using it". */
288
416
  export const McpConnectionSchema = z.object({
@@ -297,6 +425,49 @@ export const McpConnectionSchema = z.object({
297
425
  /** Which client, from its own handshake (`claude-code`, `cursor`). */
298
426
  client: z.string().min(1).max(64).optional(),
299
427
  });
428
+ /**
429
+ * WHICH stage of an MCP outage this is. Reported at most twice per proxy process, and the two are
430
+ * different facts: `first` says the session lost its tools at all, `budget_spent` says the proxy
431
+ * stopped retrying and never came back on its own.
432
+ */
433
+ export const OutageStage = {
434
+ FIRST: 'first',
435
+ BUDGET_SPENT: 'budget_spent',
436
+ };
437
+ /**
438
+ * WHY the stream went away, as far as the proxy can tell. A closed vocabulary because the proxy's
439
+ * own reason strings are free text feeding a log — `OTHER` is the bucket that lets a new one arrive
440
+ * without a raw string reaching the wire, per the classifier rule.
441
+ */
442
+ export const OutageReason = {
443
+ /** The SSE stream ended cleanly — usually the daemon exiting. */
444
+ SSE_ENDED: 'sse_ended',
445
+ /** The stream errored. */
446
+ SSE_ERROR: 'sse_error',
447
+ /** The socket died under us with neither `end` nor `error` — daemon killed, network reset. */
448
+ SSE_ABORTED: 'sse_aborted',
449
+ /** The response closed. */
450
+ SSE_CLOSED: 'sse_closed',
451
+ /** A reconnect attempt could not reach the daemon at all. */
452
+ CONNECT_ERROR: 'connect_error',
453
+ /** Anything the proxy reported that this list does not name. A classifier must be able to say so. */
454
+ OTHER: 'other',
455
+ };
456
+ /**
457
+ * The agent LOST its Reticle tools.
458
+ *
459
+ * This block existed on the emitter's input type and never on the wire: `emit()` builds its event
460
+ * from an explicit allow-list of keys and `outage` was not in it, so two deliberately different
461
+ * outages — `first`/`sse_ended`/3 and `budget_spent`/`connect_error`/12 — produced byte-identical
462
+ * events. Against a standing "MCP must never go down" mandate, the metric that measures it reported
463
+ * a bare count with no cause and no recovery signal. This is the schema half of the fix.
464
+ */
465
+ export const McpOutageSchema = z.object({
466
+ stage: z.nativeEnum(OutageStage),
467
+ reason: z.nativeEnum(OutageReason),
468
+ /** Consecutive reconnects tried when this was reported. `first` is near 1; a spent budget is high. */
469
+ attempts: z.number().int().nonnegative(),
470
+ });
300
471
  /** How `reticle init` went. The onboarding funnel, which had no instrumentation whatsoever. */
301
472
  export const InitOutcomeSchema = z.object({
302
473
  ok: z.boolean(),
@@ -326,7 +497,12 @@ export const TelemetryEventSchema = z.object({
326
497
  * explicitly supports) interleaved into one undifferentiated stream, and no per-session funnel could
327
498
  * be built at all. It cannot be backfilled, which is why it is worth adding before the data matters.
328
499
  */
329
- sessionId: z.string().min(1).max(64),
500
+ /**
501
+ * The daemon run this happened inside. ABSENT on one-shot CLI events — see isSessionScoped: a
502
+ * per-process id on `reticle status` is not a session, it is a number that inflates every session
503
+ * count and joins to nothing.
504
+ */
505
+ sessionId: z.string().min(1).max(64).optional(),
330
506
  event: z.nativeEnum(TelemetryEventKind),
331
507
  /** Client epoch-ms when the event happened (the server also stamps its own receive time). */
332
508
  ts: z.number().int().nonnegative(),
@@ -342,6 +518,14 @@ export const TelemetryEventSchema = z.object({
342
518
  projectIdSource: z.nativeEnum(ProjectIdSource).optional(),
343
519
  /** `process.platform` (darwin/linux/win32) — OS mix, low cardinality, non-identifying. */
344
520
  os: z.string().min(1).max(32),
521
+ /**
522
+ * Minutes this machine's local time is offset from UTC.
523
+ *
524
+ * "When do they work" was answerable only through ingest-side GeoIP, which may be off and is a
525
+ * coarser thing than a working day. One integer, no location, identifies nobody — and it turns
526
+ * every time-of-day tile from "which continent" into "9am or 11pm".
527
+ */
528
+ tzOffsetMin: z.number().int().min(-900).max(900).optional(),
345
529
  /** Only on `feedback`: the author-submitted report + its environment context. Never sent otherwise. */
346
530
  feedback: FeedbackSchema.optional(),
347
531
  /** Human or agent. Absent on events that are neither (a crash, a version change). */
@@ -372,4 +556,6 @@ export const TelemetryEventSchema = z.object({
372
556
  init: InitOutcomeSchema.optional(),
373
557
  /** Only on `bug_found`. */
374
558
  bug: BugFoundSchema.optional(),
559
+ /** Only on `mcp_connection_lost`: which stage of the outage, why, and after how many retries. */
560
+ outage: McpOutageSchema.optional(),
375
561
  });
package/dist/toon.d.ts CHANGED
@@ -17,7 +17,8 @@
17
17
  *
18
18
  * State flags (inside []):
19
19
  * vis visible hid hidden en enabled dis disabled
20
- * chk checked uch unchecked exp expanded col collapsed focus
20
+ * chk checked exp expanded focus focused
21
+ * (`present` is on every element, so it is never encoded — see STATE_FLAG.)
21
22
  *
22
23
  * Attributes (key=value, space-separated):
23
24
  * val="..." current value of the element
package/dist/toon.js CHANGED
@@ -17,13 +17,15 @@
17
17
  *
18
18
  * State flags (inside []):
19
19
  * vis visible hid hidden en enabled dis disabled
20
- * chk checked uch unchecked exp expanded col collapsed focus
20
+ * chk checked exp expanded focus focused
21
+ * (`present` is on every element, so it is never encoded — see STATE_FLAG.)
21
22
  *
22
23
  * Attributes (key=value, space-separated):
23
24
  * val="..." current value of the element
24
25
  * count=N child count (for containers, replaces expanding children)
25
26
  * ph="..." placeholder text
26
27
  */
28
+ import { ElementState } from './constants.js';
27
29
  const ROLE_MAP = {
28
30
  button: 'btn',
29
31
  textbox: 'inp',
@@ -65,51 +67,49 @@ const ROLE_MAP = {
65
67
  function abbreviateRole(role) {
66
68
  return ROLE_MAP[role] ?? 'el';
67
69
  }
70
+ /**
71
+ * Short flags for the states the SDK reports.
72
+ *
73
+ * `present` is deliberately absent: `getStates` seeds every element's array with it, so it is true
74
+ * of everything that could appear here and encodes nothing — while costing eight characters per
75
+ * element in the layer whose entire job is cutting the agent's token bill. `visible`/`hidden` are
76
+ * likewise absent because the `visible` field already carries them.
77
+ *
78
+ * An unlisted state falls through to its own name, so an SDK newer than this daemon still reaches
79
+ * the agent with something readable instead of losing the state.
80
+ */
81
+ const STATE_FLAG = {
82
+ [ElementState.ENABLED]: 'en',
83
+ [ElementState.DISABLED]: 'dis',
84
+ [ElementState.CHECKED]: 'chk',
85
+ [ElementState.EXPANDED]: 'exp',
86
+ [ElementState.FOCUSED]: 'focus',
87
+ };
88
+ /** States the `visible` field already encodes, plus the one that is true of everything. */
89
+ const UNENCODED_STATES = new Set([
90
+ ElementState.PRESENT,
91
+ ElementState.VISIBLE,
92
+ ElementState.HIDDEN,
93
+ ]);
68
94
  function encodeStates(states, visible) {
69
95
  const flags = [];
70
- if (visible === true)
96
+ if (true === visible)
71
97
  flags.push('vis');
72
- else if (visible === false)
98
+ else if (false === visible)
73
99
  flags.push('hid');
74
100
  for (const s of states) {
75
- switch (s) {
76
- case 'visible':
77
- break; // handled above
78
- case 'hidden':
79
- break; // handled above
80
- case 'enabled':
81
- flags.push('en');
82
- break;
83
- case 'disabled':
84
- flags.push('dis');
85
- break;
86
- case 'checked':
87
- flags.push('chk');
88
- break;
89
- case 'unchecked':
90
- flags.push('uch');
91
- break;
92
- case 'expanded':
93
- flags.push('exp');
94
- break;
95
- case 'collapsed':
96
- flags.push('col');
97
- break;
98
- case 'focused':
99
- flags.push('focus');
100
- break;
101
- default:
102
- flags.push(s);
103
- }
101
+ if (UNENCODED_STATES.has(s))
102
+ continue;
103
+ flags.push(STATE_FLAG[s] ?? s);
104
104
  }
105
105
  return flags.length > 0 ? `[${flags.join(',')}]` : '';
106
106
  }
107
107
  /** Coerce a wire field to a string. resultToToon receives UNVALIDATED wire data cast to ToonElement,
108
108
  * so a missing/numeric `name` must not make `.replace` throw and lose the whole encode. */
109
109
  function toText(v) {
110
- if (typeof v === 'string')
110
+ if ('string' === typeof v)
111
111
  return v;
112
- if (typeof v === 'number' || typeof v === 'boolean' || typeof v === 'bigint')
112
+ if ('number' === typeof v || 'boolean' === typeof v || 'bigint' === typeof v)
113
113
  return String(v);
114
114
  return ''; // undefined / null / object / symbol have no representable text on a wire field
115
115
  }
@@ -125,7 +125,7 @@ function encodeLine(el, depth) {
125
125
  const states = encodeStates(Array.isArray(el.states) ? el.states : [], el.visible);
126
126
  const ref = toText(el.ref) || '?';
127
127
  const parts = [indent + type, ref, encodeName(el.name), ...(states ? [states] : [])];
128
- if (typeof el.value === 'string' && el.value.length > 0)
128
+ if ('string' === typeof el.value && el.value.length > 0)
129
129
  parts.push(`val=${encodeValue(el.value)}`);
130
130
  if (el.childCount !== undefined)
131
131
  parts.push(`count=${String(el.childCount)}`);
@@ -149,7 +149,7 @@ function encodeTree(elements, depth = 0) {
149
149
  }
150
150
  /** Encode an array of ElementDescriptor-shaped objects to TOON text. */
151
151
  export function toToon(elements) {
152
- if (elements.length === 0)
152
+ if (0 === elements.length)
153
153
  return '# TOON v1 — empty';
154
154
  return `# TOON v1\n${encodeTree(elements)}`;
155
155
  }
@@ -162,7 +162,7 @@ export function resultToToon(result) {
162
162
  }
163
163
  /** Whether a tool result object should be encoded as TOON (has an elements array). */
164
164
  export function isToonable(result) {
165
- return (typeof result === 'object' &&
165
+ return ('object' === typeof result &&
166
166
  result !== null &&
167
167
  !Array.isArray(result) &&
168
168
  Array.isArray(result['elements']));
package/dist/types.d.ts CHANGED
@@ -136,6 +136,12 @@ export interface MatchResult {
136
136
  * confirmed absence (a false negative); both are the false-green shape this tool exists to prevent.
137
137
  */
138
138
  scopeMissing?: boolean;
139
+ /**
140
+ * Zero-match diagnosis, present only on a miss: what IS on the page. `reticle_query` has always
141
+ * returned this; MATCH (the command every PREDICATE uses) did not, so a failed assertion was a
142
+ * dead end while the same failure through query was one step from fixed.
143
+ */
144
+ hint?: QueryEmptyHint;
139
145
  }
140
146
  /**
141
147
  * A semantic cluster of interactive elements in the DOM — the replacement for the raw testid list
@@ -764,6 +770,40 @@ export declare const AnnotationSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObj
764
770
  statePath: string;
765
771
  store?: string | undefined;
766
772
  equals?: unknown;
773
+ }>, z.ZodObject<{
774
+ kind: z.ZodLiteral<"assert-net">;
775
+ net: z.ZodObject<{
776
+ method: z.ZodOptional<z.ZodString>;
777
+ urlContains: z.ZodOptional<z.ZodString>;
778
+ status: z.ZodOptional<z.ZodNumber>;
779
+ count: z.ZodOptional<z.ZodNumber>;
780
+ }, "strip", z.ZodTypeAny, {
781
+ status?: number | undefined;
782
+ method?: string | undefined;
783
+ count?: number | undefined;
784
+ urlContains?: string | undefined;
785
+ }, {
786
+ status?: number | undefined;
787
+ method?: string | undefined;
788
+ count?: number | undefined;
789
+ urlContains?: string | undefined;
790
+ }>;
791
+ }, "strip", z.ZodTypeAny, {
792
+ kind: "assert-net";
793
+ net: {
794
+ status?: number | undefined;
795
+ method?: string | undefined;
796
+ count?: number | undefined;
797
+ urlContains?: string | undefined;
798
+ };
799
+ }, {
800
+ kind: "assert-net";
801
+ net: {
802
+ status?: number | undefined;
803
+ method?: string | undefined;
804
+ count?: number | undefined;
805
+ urlContains?: string | undefined;
806
+ };
767
807
  }>, z.ZodObject<{
768
808
  kind: z.ZodLiteral<"mark-dynamic">;
769
809
  testid: z.ZodString;
@@ -863,6 +903,14 @@ export type AnnotateResult = {
863
903
  ok: true;
864
904
  target: AnnotationTarget;
865
905
  compiled: string;
906
+ /**
907
+ * Set when the compiled annotation is NOT something a replay evaluates, so `compiled` on its
908
+ * own would overstate it. `assert-signal` writes a STEP expect, and replay checks exactly two
909
+ * things per step — element presence and state — so a step signal is recorded and then never
910
+ * checked. Saying "will assert signal X" and passing regardless is a false green in the
911
+ * feature whose whole job is to catch them.
912
+ */
913
+ note?: string;
866
914
  }
867
915
  /**
868
916
  * A failure carries its own way out. `code` alone told the caller WHAT was wrong and never what to
package/dist/types.js CHANGED
@@ -127,6 +127,18 @@ export const AnnotationSchema = z.discriminatedUnion('kind', [
127
127
  store: z.string().min(1).optional(),
128
128
  equals: z.unknown().optional(),
129
129
  }),
130
+ z.object({
131
+ kind: z.literal(AnnotationKind.ASSERT_NET),
132
+ // Same shape SUCCESS_STATE already accepts, so one vocabulary describes a network consequence
133
+ // whether it gates a step or ends the flow. `count` is the point of it: presence says the
134
+ // request fired, cardinality catches the double-submit that fired it twice.
135
+ net: z.object({
136
+ method: z.string().min(1).optional(),
137
+ urlContains: z.string().min(1).optional(),
138
+ status: z.number().optional(),
139
+ count: z.number().int().nonnegative().optional(),
140
+ }),
141
+ }),
130
142
  z.object({
131
143
  kind: z.literal(AnnotationKind.MARK_DYNAMIC),
132
144
  testid: z.string().min(1),
package/dist/upgrade.js CHANGED
@@ -53,7 +53,7 @@ export const UpgradeHintSchema = z.object({
53
53
  });
54
54
  /** Narrow an unknown wire value to a CloudCapability. */
55
55
  export function isCloudCapability(value) {
56
- return typeof value === 'string' && Object.values(CloudCapability).includes(value);
56
+ return 'string' === typeof value && Object.values(CloudCapability).includes(value);
57
57
  }
58
58
  /**
59
59
  * Canned, honest copy per capability. Kept here (not inlined at emit sites) so the tone is reviewed in
@@ -550,13 +550,13 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
550
550
  previewUrl: z.ZodOptional<z.ZodString>;
551
551
  }, "strip", z.ZodTypeAny, {
552
552
  name: string;
553
- framework: "react" | "next" | "vite" | "other";
553
+ framework: "other" | "react" | "next" | "vite";
554
554
  commit?: string | undefined;
555
555
  env?: "local" | "preview" | "ci" | undefined;
556
556
  previewUrl?: string | undefined;
557
557
  }, {
558
558
  name: string;
559
- framework: "react" | "next" | "vite" | "other";
559
+ framework: "other" | "react" | "next" | "vite";
560
560
  commit?: string | undefined;
561
561
  env?: "local" | "preview" | "ci" | undefined;
562
562
  previewUrl?: string | undefined;
@@ -570,11 +570,11 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
570
570
  }>;
571
571
  model: z.ZodOptional<z.ZodString>;
572
572
  }, "strip", z.ZodTypeAny, {
573
- kind: "coding-agent" | "oem-pipeline" | "human";
573
+ kind: "human" | "coding-agent" | "oem-pipeline";
574
574
  id: string;
575
575
  model?: string | undefined;
576
576
  }, {
577
- kind: "coding-agent" | "oem-pipeline" | "human";
577
+ kind: "human" | "coding-agent" | "oem-pipeline";
578
578
  id: string;
579
579
  model?: string | undefined;
580
580
  }>;
@@ -987,6 +987,18 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
987
987
  evidenceRef?: string | undefined;
988
988
  failureReason?: string | undefined;
989
989
  }[];
990
+ agent: {
991
+ kind: "human" | "coding-agent" | "oem-pipeline";
992
+ id: string;
993
+ model?: string | undefined;
994
+ };
995
+ project: {
996
+ name: string;
997
+ framework: "other" | "react" | "next" | "vite";
998
+ commit?: string | undefined;
999
+ env?: "local" | "preview" | "ci" | undefined;
1000
+ previewUrl?: string | undefined;
1001
+ };
990
1002
  durationMs: number;
991
1003
  createdAt: number;
992
1004
  evidence: {
@@ -1017,18 +1029,6 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
1017
1029
  schemaVersion: 1;
1018
1030
  runId: string & z.BRAND<"RunId">;
1019
1031
  profile: "dev" | "prod-preview";
1020
- project: {
1021
- name: string;
1022
- framework: "react" | "next" | "vite" | "other";
1023
- commit?: string | undefined;
1024
- env?: "local" | "preview" | "ci" | undefined;
1025
- previewUrl?: string | undefined;
1026
- };
1027
- agent: {
1028
- kind: "coding-agent" | "oem-pipeline" | "human";
1029
- id: string;
1030
- model?: string | undefined;
1031
- };
1032
1032
  trigger: {
1033
1033
  kind: "manual" | "edit" | "ci" | "oem";
1034
1034
  note?: string | undefined;
@@ -1082,6 +1082,18 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
1082
1082
  signedAt: number;
1083
1083
  } | undefined;
1084
1084
  }, {
1085
+ agent: {
1086
+ kind: "human" | "coding-agent" | "oem-pipeline";
1087
+ id: string;
1088
+ model?: string | undefined;
1089
+ };
1090
+ project: {
1091
+ name: string;
1092
+ framework: "other" | "react" | "next" | "vite";
1093
+ commit?: string | undefined;
1094
+ env?: "local" | "preview" | "ci" | undefined;
1095
+ previewUrl?: string | undefined;
1096
+ };
1085
1097
  durationMs: number;
1086
1098
  createdAt: number;
1087
1099
  evidence: {
@@ -1112,18 +1124,6 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
1112
1124
  schemaVersion: 1;
1113
1125
  runId: string;
1114
1126
  profile: "dev" | "prod-preview";
1115
- project: {
1116
- name: string;
1117
- framework: "react" | "next" | "vite" | "other";
1118
- commit?: string | undefined;
1119
- env?: "local" | "preview" | "ci" | undefined;
1120
- previewUrl?: string | undefined;
1121
- };
1122
- agent: {
1123
- kind: "coding-agent" | "oem-pipeline" | "human";
1124
- id: string;
1125
- model?: string | undefined;
1126
- };
1127
1127
  trigger: {
1128
1128
  kind: "manual" | "edit" | "ci" | "oem";
1129
1129
  note?: string | undefined;
@@ -21,6 +21,43 @@ export declare const Verified: {
21
21
  readonly UNKNOWN: "unknown";
22
22
  };
23
23
  export type Verified = (typeof Verified)[keyof typeof Verified];
24
+ /**
25
+ * WHY a verdict came out the way it did — the deciding clause of the rule, named.
26
+ *
27
+ * `Verified` has three values and the rule has ten clauses, so the wire collapsed opposite facts
28
+ * into one string. Measured over a real session: `unknown` covered "the agent malformed the call",
29
+ * "the app answered 202 and has not finished", and "Reticle could not see the capture" — three
30
+ * owners needing three opposite responses, one bar on a dashboard. `no` was no better: "channels
31
+ * disagree" (Reticle earning its keep) and "the agent's predicate failed" read identically.
32
+ *
33
+ * This is the SINGLE list. `decideVerified` returns a member from each clause, and the telemetry
34
+ * schema narrows to `z.nativeEnum` of this — so a new clause cannot ship without a member here, and
35
+ * a member cannot exist without a clause producing it (`verified.test.ts` asserts the two sets are
36
+ * equal). Nothing anywhere re-lists these.
37
+ */
38
+ export declare const VerifiedReason: {
39
+ /** The assertion was never EVALUATED — under-specified call, or nothing instrumented to read. */
40
+ readonly INCONCLUSIVE: "inconclusive";
41
+ /** The declared consequence did not hold. */
42
+ readonly ASSERTION_FAILED: "assertion_failed";
43
+ /** Channels disagreed about the action — the false green this product exists to catch. */
44
+ readonly CONTRADICTED: "contradicted";
45
+ /** The consequence was already true beforehand, so it proves nothing about the action. */
46
+ readonly ALREADY_TRUE: "already_true";
47
+ /** The capture was not clean, so a green would only describe what happened to be observed. */
48
+ readonly UNCLEAN_CAPTURE: "unclean_capture";
49
+ /** Nothing was asserted at a real grade — the assertion could not have failed. */
50
+ readonly VACUOUS_GRADE: "vacuous_grade";
51
+ /** A write answered 202 Accepted: the outcome does not exist yet. */
52
+ readonly OUTCOME_PENDING: "outcome_pending";
53
+ /** A 2xx whose body was never recorded, so the one channel that could disagree was closed. */
54
+ readonly OUTCOME_UNREAD: "outcome_unread";
55
+ /** The page never settled, so the reaction window may have closed early. */
56
+ readonly UNSETTLED: "unsettled";
57
+ /** Held at a real grade over a clean capture with no channel disagreeing. */
58
+ readonly PROVED: "proved";
59
+ };
60
+ export type VerifiedReason = (typeof VerifiedReason)[keyof typeof VerifiedReason];
24
61
  /**
25
62
  * Actionable companion to NO_PROVIDER for the tools that genuinely intercept or capture through CDP
26
63
  * — network mocking and viewport control — which is NOT "visual capture".