@reticlehq/core 2.2.0 → 2.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 (99) hide show
  1. package/dist/brand.d.ts +0 -1
  2. package/dist/brand.js +0 -1
  3. package/dist/consequence.d.ts +0 -1
  4. package/dist/consequence.js +0 -1
  5. package/dist/constants.d.ts +30 -25
  6. package/dist/constants.js +33 -23
  7. package/dist/daemon-registry.d.ts +0 -1
  8. package/dist/daemon-registry.js +0 -1
  9. package/dist/desktop-contract.cjs +11 -0
  10. package/dist/desktop-contract.d.cts +6 -0
  11. package/dist/desktop-contract.d.ts +58 -0
  12. package/dist/desktop-contract.js +59 -0
  13. package/dist/event-payloads.d.ts +60 -3
  14. package/dist/event-payloads.js +35 -4
  15. package/dist/event-priority.d.ts +25 -0
  16. package/dist/event-priority.js +45 -0
  17. package/dist/findings.d.ts +124 -0
  18. package/dist/findings.js +122 -0
  19. package/dist/flow-constants.d.ts +0 -1
  20. package/dist/flow-constants.js +0 -1
  21. package/dist/flow-types.d.ts +9 -1
  22. package/dist/flow-types.js +0 -1
  23. package/dist/index.d.ts +8 -1
  24. package/dist/index.js +8 -1
  25. package/dist/journal.d.ts +0 -1
  26. package/dist/journal.js +0 -1
  27. package/dist/messages.d.ts +16 -11
  28. package/dist/messages.js +0 -1
  29. package/dist/net.d.ts +41 -0
  30. package/dist/net.js +40 -0
  31. package/dist/notices.d.ts +0 -1
  32. package/dist/notices.js +0 -1
  33. package/dist/redaction.d.ts +0 -1
  34. package/dist/redaction.js +1 -2
  35. package/dist/schema/event-message.json +3 -1
  36. package/dist/schema/event-type.json +3 -1
  37. package/dist/schema/reticle-event.json +3 -1
  38. package/dist/schema/reticle-message.json +3 -1
  39. package/dist/security.d.ts +20 -1
  40. package/dist/security.js +45 -1
  41. package/dist/session-constants.d.ts +0 -1
  42. package/dist/session-constants.js +0 -1
  43. package/dist/state-select.d.ts +0 -1
  44. package/dist/state-select.js +32 -1
  45. package/dist/telemetry-feedback.d.ts +265 -0
  46. package/dist/telemetry-feedback.js +163 -0
  47. package/dist/telemetry-session.d.ts +524 -0
  48. package/dist/telemetry-session.js +245 -0
  49. package/dist/telemetry.d.ts +1463 -0
  50. package/dist/telemetry.js +375 -0
  51. package/dist/toon.d.ts +0 -1
  52. package/dist/toon.js +0 -1
  53. package/dist/types.d.ts +9 -2
  54. package/dist/types.js +0 -1
  55. package/dist/upgrade.d.ts +16 -3
  56. package/dist/upgrade.js +14 -2
  57. package/dist/verification-run.d.ts +4 -5
  58. package/dist/verification-run.js +0 -1
  59. package/dist/verified-constants.d.ts +104 -0
  60. package/dist/verified-constants.js +102 -0
  61. package/package.json +7 -3
  62. package/dist/brand.d.ts.map +0 -1
  63. package/dist/brand.js.map +0 -1
  64. package/dist/consequence.d.ts.map +0 -1
  65. package/dist/consequence.js.map +0 -1
  66. package/dist/constants.d.ts.map +0 -1
  67. package/dist/constants.js.map +0 -1
  68. package/dist/daemon-registry.d.ts.map +0 -1
  69. package/dist/daemon-registry.js.map +0 -1
  70. package/dist/event-payloads.d.ts.map +0 -1
  71. package/dist/event-payloads.js.map +0 -1
  72. package/dist/flow-constants.d.ts.map +0 -1
  73. package/dist/flow-constants.js.map +0 -1
  74. package/dist/flow-types.d.ts.map +0 -1
  75. package/dist/flow-types.js.map +0 -1
  76. package/dist/index.d.ts.map +0 -1
  77. package/dist/index.js.map +0 -1
  78. package/dist/journal.d.ts.map +0 -1
  79. package/dist/journal.js.map +0 -1
  80. package/dist/messages.d.ts.map +0 -1
  81. package/dist/messages.js.map +0 -1
  82. package/dist/notices.d.ts.map +0 -1
  83. package/dist/notices.js.map +0 -1
  84. package/dist/redaction.d.ts.map +0 -1
  85. package/dist/redaction.js.map +0 -1
  86. package/dist/security.d.ts.map +0 -1
  87. package/dist/security.js.map +0 -1
  88. package/dist/session-constants.d.ts.map +0 -1
  89. package/dist/session-constants.js.map +0 -1
  90. package/dist/state-select.d.ts.map +0 -1
  91. package/dist/state-select.js.map +0 -1
  92. package/dist/toon.d.ts.map +0 -1
  93. package/dist/toon.js.map +0 -1
  94. package/dist/types.d.ts.map +0 -1
  95. package/dist/types.js.map +0 -1
  96. package/dist/upgrade.d.ts.map +0 -1
  97. package/dist/upgrade.js.map +0 -1
  98. package/dist/verification-run.d.ts.map +0 -1
  99. package/dist/verification-run.js.map +0 -1
@@ -0,0 +1,375 @@
1
+ /**
2
+ * Anonymous product telemetry — the contract for how the OSS `reticle` runtime reports ADOPTION
3
+ * (not verification results): is it installed, how often is it invoked, which tools get used, how many
4
+ * distinct machines/projects run it. This is what turns "npm downloads" (which an investor discounts)
5
+ * into DAU/WAU/MAU, active sessions, and retention. Uninstall/churn is deliberately NOT an event —
6
+ * npm 7+/pnpm run no uninstall lifecycle scripts, so churn is inferred server-side from inactivity.
7
+ *
8
+ * Privacy is structural, not a policy: the ONLY identifiers on the wire are a random per-machine UUID
9
+ * (`anonymousId`, minted locally, never derived from anything personal) and a one-way HASH of the
10
+ * project (`projectId`) — no repo name, no path, no email, no code. The ONE exception is the
11
+ * `feedback` event, and it is an exception by consent, not by accident: it carries text a human typed
12
+ * or an agent wrote, it is NEVER emitted passively (only from an explicit `reticle_feedback` call or
13
+ * `reticle feedback` command), and it has its own kill switch. It is strictly opt-OUT (respects
14
+ * `RETICLE_TELEMETRY=0` and the `DO_NOT_TRACK` convention) and best-effort (a failed send never touches
15
+ * the tool's behaviour). Same conventions as the rest of core: enums are `as const` narrowed with
16
+ * `z.nativeEnum`, timestamps are epoch-ms NUMBERS, no `any`.
17
+ */
18
+ import { z } from 'zod';
19
+ import { MachineSnapshotSchema, ProjectProfileSchema, SessionSummarySchema, } from './telemetry-session.js';
20
+ import { FeedbackSchema } from './telemetry-feedback.js';
21
+ import { IdentitySchema } from './telemetry-feedback.js';
22
+ /** Bump when the event shape changes so the analytics side can segment old senders. */
23
+ export const TELEMETRY_EVENT_VERSION = 3;
24
+ /**
25
+ * The event taxonomy. Every name says WHAT HAPPENED, in `noun_verbed` form, with no abbreviations —
26
+ * the previous set failed that badly enough to confuse its own authors: `invoke` sounded like "a tool
27
+ * was invoked" but meant "the CLI binary ran", while the event that actually meant a tool call was
28
+ * `tool`, emitted from a file called `invoke-tool.ts`. A name you have to look up is a name that gets
29
+ * misread on a dashboard six months from now.
30
+ *
31
+ * VOLUME IS PART OF THE DESIGN. PostHog bills per ingested event, so the taxonomy is deliberately
32
+ * shaped around one high-frequency thing (tool calls) being AGGREGATED rather than emitted. A single
33
+ * agent verification loop is 50–200 tool calls; at one event each, a thousand users would push
34
+ * millions of events a day for a question — "which tools get used" — that one summary property
35
+ * answers better, because it also preserves the SHAPE of a session instead of scattering it across
36
+ * 200 rows. See `SessionSummary`.
37
+ */
38
+ export const TelemetryEventKind = {
39
+ /** First-ever run on this machine — powers install count + the new-user curve. */
40
+ RETICLE_INSTALLED: 'reticle_installed',
41
+ /**
42
+ * A human ran a `reticle` subcommand. Carries WHICH command, which is the closest honest read we
43
+ * have on human intent (`verify` and `gate` mean something very different from `status`).
44
+ *
45
+ * Explicitly NOT emitted for the internal `_daemon` spawn: `reticle mcp` re-runs its own binary to
46
+ * start the daemon, so counting that child inflated the old `invoke` metric ~2x — and worst on
47
+ * exactly the agent-driven sessions that matter most, while leaving one-shot commands like
48
+ * `version` untouched. That skewed the ratio, not just the scale.
49
+ */
50
+ CLI_COMMAND_RUN: 'cli_command_run',
51
+ /** The daemon came up — the numerator of active sessions + DAU/WAU/MAU. */
52
+ DAEMON_STARTED: 'daemon_started',
53
+ /**
54
+ * The daemon exited. THE RICH ONE: carries the whole session rolled up (duration, tool histogram,
55
+ * errors, features touched). One event replaces the hundreds the old per-call `tool` event sent.
56
+ */
57
+ DAEMON_STOPPED: 'daemon_stopped',
58
+ /**
59
+ * A verification produced a verdict. The product's reason to exist, and the one metric an investor
60
+ * should be shown: not "tools were called" but "an app was actually verified, and here is how often
61
+ * that caught something a green test would have missed".
62
+ */
63
+ VERIFICATION_COMPLETED: 'verification_completed',
64
+ /**
65
+ * A snapshot of the project Reticle is pointed at — stack, size, and how DEEPLY the feature surface
66
+ * is used. Answers "are they using all of Reticle or three tools of it", which is the difference
67
+ * between a retention problem and an activation problem. Once per daemon start, so it is cheap.
68
+ */
69
+ PROJECT_PROFILED: 'project_profiled',
70
+ /** `reticle update` or `reticle rollback` moved the installed version. Carries from → to. */
71
+ VERSION_CHANGED: 'version_changed',
72
+ /** An uncaught exception or unhandled rejection reached the top of the daemon. Crash analytics. */
73
+ RUNTIME_CRASHED: 'runtime_crashed',
74
+ /**
75
+ * Someone told us something went wrong (or right). UNLIKE every other kind, this one carries
76
+ * author-written free text — which is exactly why it is never emitted passively: it exists only
77
+ * because an agent called `reticle_feedback` or a human ran `reticle feedback`. See
78
+ * `FeedbackSchema` for the consent/redaction contract.
79
+ */
80
+ FEEDBACK_SUBMITTED: 'feedback_submitted',
81
+ /**
82
+ * Someone chose to tell us who they are. Like `feedback_submitted`, this exists ONLY because a
83
+ * human ran a command — Reticle never infers an identity from a git remote, an email in git
84
+ * config, or anything else. See `identify.ts` for why that refusal is deliberate.
85
+ */
86
+ IDENTIFIED: 'identified',
87
+ /**
88
+ * An MCP client attached to the daemon.
89
+ *
90
+ * The one event that separates "Reticle is installed and running" from "somebody is actually using
91
+ * it": a daemon can sit up for days with no agent attached. It also exposes reconnect churn — a
92
+ * client that reattaches every few minutes is a client whose transport is broken, which looks
93
+ * identical to healthy usage in every other metric.
94
+ */
95
+ MCP_CLIENT_CONNECTED: 'mcp_client_connected',
96
+ /**
97
+ * `reticle init` finished. The onboarding funnel had no instrumentation at all, so a setup that
98
+ * failed on a missing dependency was indistinguishable from a user who never tried.
99
+ */
100
+ INIT_COMPLETED: 'init_completed',
101
+ /**
102
+ * Reticle found a defect in the app under test.
103
+ *
104
+ * THE metric the product exists to produce. Everything else here measures whether Reticle is used;
105
+ * this measures whether it WORKS — and it is the only number that can honestly be put in front of
106
+ * an investor or published, because it counts outcomes for users rather than activity by them.
107
+ *
108
+ * Deliberately a discrete event rather than only a counter: each bug carries its KIND, and the
109
+ * distribution is the interesting part. "We found 4,000 bugs" is a claim; "1,200 of them were
110
+ * greens that lied — a passing assertion sitting on a failed write, which no screenshot and no
111
+ * human watching the screen would have caught" is the argument.
112
+ */
113
+ BUG_FOUND: 'bug_found',
114
+ };
115
+ /**
116
+ * Who caused this. The only honest split available to us: a `reticle` command was TYPED by a person,
117
+ * while an MCP tool call came from the agent's own loop.
118
+ *
119
+ * What we deliberately do NOT claim to know is whether the human told the agent to verify or the
120
+ * agent decided on its own — that lives in a prompt Reticle never sees. Inferring it from timing
121
+ * would be a guess dressed as a measurement, and a dashboard cannot tell the difference later.
122
+ */
123
+ export const TelemetryActor = {
124
+ HUMAN: 'human',
125
+ AGENT: 'agent',
126
+ };
127
+ /**
128
+ * What `projectId` was derived from — and therefore whether it is comparable ACROSS machines.
129
+ *
130
+ * This is the field that keeps "how many users share this project" from silently lying. A
131
+ * cwd-derived id is unique per machine, so those rows always show exactly one user per project. Left
132
+ * unlabelled they would drag the average toward 1 and hide real team adoption; labelled, the
133
+ * analytics can restrict that question to `git_origin` rows, where it is a real measurement.
134
+ */
135
+ export const ProjectIdSource = {
136
+ /** Hash of the shared git origin — the same on every clone, so cross-machine counting is valid. */
137
+ GIT_ORIGIN: 'git_origin',
138
+ /** Hash of the local directory path — unique per machine; NOT comparable across users. */
139
+ CWD: 'cwd',
140
+ };
141
+ /**
142
+ * How Reticle reached the browser during a session. Distinguishes the always-on SDK (observing the
143
+ * human's own tab) from a Reticle-launched or CDP-attached browser, which is the expensive path and
144
+ * the one whose failures hurt most.
145
+ */
146
+ export const BrowserLaunchKind = {
147
+ /** `reticle drive` / `reticle verify` launched a browser. */
148
+ LAUNCHED: 'launched',
149
+ /** Attached to an already-running browser over `RETICLE_CDP_URL`. */
150
+ ATTACHED: 'attached',
151
+ /** A pooled headless context leased for a parallel flow. */
152
+ POOLED: 'pooled',
153
+ };
154
+ /** The outcome of one verification. `verified` is Reticle's own honesty grade, not merely pass/fail. */
155
+ export const VerificationSchema = z.object({
156
+ /** Which tool produced the verdict (`reticle_assert`, `reticle_flow_verify`, …). */
157
+ via: z.string().min(1).max(64),
158
+ /** `yes` | `no` | `unknown` — the honest verdict, where `unknown` means the evidence could not decide. */
159
+ verified: z.string().min(1).max(16),
160
+ /** Did the underlying assertion pass? Distinct from `verified` on purpose. */
161
+ passed: z.boolean(),
162
+ /**
163
+ * TRUE when the assertion passed but Reticle refused to call it verified — a caught false green.
164
+ * This is the product's whole thesis expressed as one boolean, and the number to put in a deck.
165
+ */
166
+ falseGreenCaught: z.boolean(),
167
+ durationMs: z.number().int().nonnegative().optional(),
168
+ });
169
+ /** Which way the installed version moved, and between which versions. */
170
+ export const VersionChangeSchema = z.object({
171
+ from: z.string().min(1).max(64),
172
+ to: z.string().min(1).max(64),
173
+ /** `update` (forward) or `rollback` (back) — a rollback is a release-quality alarm. */
174
+ direction: z.string().min(1).max(16),
175
+ });
176
+ /**
177
+ * A crash, with enough detail to actually diagnose it.
178
+ *
179
+ * The first version of this carried only a fingerprint — a hash — which made crashes RANKABLE and
180
+ * completely UNDIAGNOSABLE: you could see that forty machines hit `a3f2c1d8e9b0` and had no way on
181
+ * earth to learn what `a3f2c1d8e9b0` was. A group key with no dictionary. Everything below exists to
182
+ * give the hash a meaning, while keeping the line that matters: our code and our failure, never the
183
+ * user's code and never their data.
184
+ */
185
+ export const CrashSchema = z.object({
186
+ /** `uncaught_exception` | `unhandled_rejection`. */
187
+ kind: z.string().min(1).max(32),
188
+ /** The error's constructor name (`TypeError`) — coarse, safe, and enough to triage. */
189
+ errorType: z.string().min(1).max(64).optional(),
190
+ /** Hash of the type + our own frames. Groups the same crash across every machine. */
191
+ fingerprint: z.string().min(1).max(64).optional(),
192
+ /**
193
+ * The message with every VARIABLE part removed — quoted strings, URLs, paths, ids, numbers all
194
+ * replaced by `*`. `no baseline named *` tells us exactly what broke; the flow name that made it
195
+ * specific to one user never leaves. This is what turns the fingerprint from an opaque key into a
196
+ * readable defect.
197
+ */
198
+ message: z.string().max(300).optional(),
199
+ /**
200
+ * The RETICLE-OWNED stack frames, innermost first, as `function@file:line`.
201
+ *
202
+ * This is our own published code — `runTool@invoke-tool.js:88` is a line anyone can read in the
203
+ * npm tarball — so there is no privacy question in sending it, and it is the single most useful
204
+ * thing for a root-cause analysis: the file, the line, and the function. Frames belonging to the
205
+ * user's application or to node internals are dropped entirely before this is built.
206
+ */
207
+ frames: z.array(z.string().max(120)).max(12).optional(),
208
+ /** The MCP tool in flight when it happened, when there was one. The trigger point. */
209
+ tool: z.string().min(1).max(64).optional(),
210
+ /**
211
+ * The tool calls immediately before the failure, oldest first — the agent's approach run.
212
+ *
213
+ * Answers "what was it trying to do", which a single frame cannot: `snapshot → act → act →
214
+ * assert` is a verification loop, `lease_acquire → navigate → crash` is a startup problem. Tool
215
+ * NAMES only, from our own fixed vocabulary; no arguments, so nothing the agent typed is in here.
216
+ */
217
+ breadcrumb: z.array(z.string().max(64)).max(12).optional(),
218
+ /** Node major/minor — crashes cluster hard by runtime version and we were not recording it. */
219
+ nodeVersion: z.string().max(24).optional(),
220
+ /** `arm64` / `x64`. A surprising number of native-module failures are architecture-specific. */
221
+ arch: z.string().max(16).optional(),
222
+ /**
223
+ * The machine at the moment of the crash. "Out of memory" and "our bug" look identical in a stack
224
+ * trace and are completely different problems; this is what tells them apart.
225
+ */
226
+ machine: MachineSnapshotSchema.optional(),
227
+ });
228
+ /**
229
+ * How Reticle came to find a defect. Four routes, in descending order of "a human would have missed
230
+ * this": a contradiction is invisible to someone watching the screen, a crawl finding required no
231
+ * script at all, a replay failure is a regression on something that used to work, and a failed
232
+ * assertion is the agent's own check not holding.
233
+ */
234
+ export const BugSource = {
235
+ /** Channels disagreed — the false green. A passing screen sitting on a failed write. */
236
+ CONTRADICTION: 'contradiction',
237
+ /** `reticle_crawl` found it autonomously, with nobody writing a test. */
238
+ CRAWL: 'crawl',
239
+ /** A saved flow that used to pass stopped passing — a regression. */
240
+ REPLAY: 'replay',
241
+ /** An assertion the agent declared did not hold. */
242
+ ASSERTION: 'assertion',
243
+ };
244
+ /**
245
+ * One defect Reticle found in the app under test.
246
+ *
247
+ * `kind` is the taxonomy value from `findings.ts` — `signal-contradicted`, `console-error`,
248
+ * `duplicate-request` and so on. Never a selector, a URL, an element, or any description of the
249
+ * user's app: we report THAT a class of defect was found, never WHAT it was in.
250
+ */
251
+ export const BugFoundSchema = z.object({
252
+ source: z.nativeEnum(BugSource),
253
+ /** The classified kind from Reticle's own findings vocabulary. */
254
+ kind: z.string().min(1).max(64),
255
+ /**
256
+ * True when the defect PRESENTED AS SUCCESS — the screen advanced, the assertion passed, the click
257
+ * looked fine — while another channel showed it had not.
258
+ *
259
+ * Defined by the presentation rather than by "an assertion passed", because the same defect arrives
260
+ * both ways: through `reticle_assert` there IS a passing assertion to contradict, and through
261
+ * `reticle_crawl` there is no assertion at all and the UI simply moved on over a failed write. Both
262
+ * are the thing a human watching the screen cannot see, and that is what the flag has to mean if
263
+ * the number is going to be published.
264
+ *
265
+ * The subset worth naming separately, because it is the only category Reticle can claim as uniquely
266
+ * its own: every other kind of bug is findable by a careful human or an ordinary test.
267
+ */
268
+ falseGreen: z.boolean(),
269
+ /** Which tool surfaced it. */
270
+ tool: z.string().min(1).max(64).optional(),
271
+ /**
272
+ * TRUE when this KIND was already reported in this session — i.e. this is another INSTANCE of a
273
+ * defect already counted, not another defect.
274
+ *
275
+ * Both numbers are claims, and they are different ones. "Reticle found N defects" is the headline;
276
+ * "users hit them M times" is the frequency that says which ones actually cost anybody anything.
277
+ * Without this flag the event stream answers only the second while looking like it answers the
278
+ * first, so any distinct-defect count read off it is silently inflated — the exact way a published
279
+ * number goes wrong. Count `repeat: false` for distinct, count everything for instances.
280
+ *
281
+ * Scoped to the SESSION, because that is the only identity available: the payload deliberately
282
+ * carries no selector, URL or app detail, so the same defect in two sessions cannot be recognised
283
+ * as one — and must not be, since that would need data this event refuses to collect.
284
+ */
285
+ repeat: z.boolean(),
286
+ });
287
+ /** An MCP client attaching. Separates "installed and running" from "someone is actually using it". */
288
+ export const McpConnectionSchema = z.object({
289
+ /** False the first time a client attaches to this daemon; true for every attach after. */
290
+ reconnect: z.boolean(),
291
+ /**
292
+ * How long the daemon had been up first. A large value on the FIRST connect is the interesting
293
+ * case — it means Reticle was started and then sat unused, which is an onboarding failure nobody
294
+ * would otherwise report.
295
+ */
296
+ daemonAgeMs: z.number().int().nonnegative(),
297
+ /** Which client, from its own handshake (`claude-code`, `cursor`). */
298
+ client: z.string().min(1).max(64).optional(),
299
+ });
300
+ /** How `reticle init` went. The onboarding funnel, which had no instrumentation whatsoever. */
301
+ export const InitOutcomeSchema = z.object({
302
+ ok: z.boolean(),
303
+ /** Classified cause when it failed — our vocabulary, never a raw error or a path. */
304
+ reason: z.string().max(64).optional(),
305
+ /** The framework it detected, so we can see which stacks fail to set up. */
306
+ stack: z.string().max(64).optional(),
307
+ /** Whether the MCP registration step succeeded — the step most likely to fail silently. */
308
+ mcpRegistered: z.boolean().optional(),
309
+ });
310
+ /**
311
+ * One anonymous telemetry event. `anonymousId` and the optional hashed `projectId` are the only
312
+ * identifiers; everything else is a low-cardinality dimension for slicing the adoption metrics.
313
+ */
314
+ export const TelemetryEventSchema = z.object({
315
+ v: z.literal(TELEMETRY_EVENT_VERSION),
316
+ /** Random UUID persisted at `~/.reticle/telemetry-id`. Distinct-count of this = users (DAU/WAU/MAU). */
317
+ anonymousId: z.string().min(1).max(128),
318
+ /** One-way hash of the git remote (or cwd) — counts DISTINCT PROJECTS without revealing any of them. */
319
+ projectId: z.string().min(1).max(128).optional(),
320
+ /**
321
+ * One daemon run. Ties `daemon_started` → every verification → a crash → `daemon_stopped` into a
322
+ * single story.
323
+ *
324
+ * Without it, events could only be grouped by machine and approximate time — so "what was happening
325
+ * when this crashed?" was unanswerable, three concurrent daemons on one machine (which the product
326
+ * explicitly supports) interleaved into one undifferentiated stream, and no per-session funnel could
327
+ * be built at all. It cannot be backfilled, which is why it is worth adding before the data matters.
328
+ */
329
+ sessionId: z.string().min(1).max(64),
330
+ event: z.nativeEnum(TelemetryEventKind),
331
+ /** Client epoch-ms when the event happened (the server also stamps its own receive time). */
332
+ ts: z.number().int().nonnegative(),
333
+ /** Reticle version emitting the event — lets us see adoption of new releases + version spread. */
334
+ version: z.string().min(1).max(64),
335
+ /** Runs inside CI? Separates real human DAU from pipeline traffic (both matter, differently). */
336
+ ci: z.boolean(),
337
+ /**
338
+ * What `projectId` was derived from. On EVERY event, not just the profile, because the core
339
+ * counting questions ("users per project", "projects per user") run over all events and need to
340
+ * know which rows are comparable across machines without joining to another event first.
341
+ */
342
+ projectIdSource: z.nativeEnum(ProjectIdSource).optional(),
343
+ /** `process.platform` (darwin/linux/win32) — OS mix, low cardinality, non-identifying. */
344
+ os: z.string().min(1).max(32),
345
+ /** Only on `feedback`: the author-submitted report + its environment context. Never sent otherwise. */
346
+ feedback: FeedbackSchema.optional(),
347
+ /** Human or agent. Absent on events that are neither (a crash, a version change). */
348
+ actor: z.nativeEnum(TelemetryActor).optional(),
349
+ /** Only on `cli_command_run`: which subcommand. */
350
+ command: z.string().min(1).max(32).optional(),
351
+ /**
352
+ * Only on `cli_command_run`: which flags were PRESENT, by name. Never their values — a flag value
353
+ * is a port, a URL, a file path, or in `--http-token`'s case a secret. Names alone answer the
354
+ * question ("does anyone use `--storage-state`?") with none of that risk.
355
+ */
356
+ flags: z.array(z.string().max(32)).max(16).optional(),
357
+ /** Only on `daemon_stopped`: the whole session rolled into one event. */
358
+ session: SessionSummarySchema.optional(),
359
+ /** Only on `project_profiled`: the shape and depth-of-use of the project. */
360
+ project: ProjectProfileSchema.optional(),
361
+ /** Only on `verification_completed`. */
362
+ verification: VerificationSchema.optional(),
363
+ /** Only on `version_changed`. */
364
+ versionChange: VersionChangeSchema.optional(),
365
+ /** Only on `runtime_crashed`. */
366
+ crash: CrashSchema.optional(),
367
+ /** Only on `identified` — self-declared, opt-in, and the only personal data ever sent. */
368
+ identity: IdentitySchema.optional(),
369
+ /** Only on `mcp_client_connected`. */
370
+ connection: McpConnectionSchema.optional(),
371
+ /** Only on `init_completed`. */
372
+ init: InitOutcomeSchema.optional(),
373
+ /** Only on `bug_found`. */
374
+ bug: BugFoundSchema.optional(),
375
+ });
package/dist/toon.d.ts CHANGED
@@ -42,4 +42,3 @@ export declare function toToon(elements: ToonElement[]): string;
42
42
  export declare function resultToToon(result: Record<string, unknown>): string;
43
43
  /** Whether a tool result object should be encoded as TOON (has an elements array). */
44
44
  export declare function isToonable(result: unknown): boolean;
45
- //# sourceMappingURL=toon.d.ts.map
package/dist/toon.js CHANGED
@@ -167,4 +167,3 @@ export function isToonable(result) {
167
167
  !Array.isArray(result) &&
168
168
  Array.isArray(result['elements']));
169
169
  }
170
- //# sourceMappingURL=toon.js.map
package/dist/types.d.ts CHANGED
@@ -863,9 +863,17 @@ export type AnnotateResult = {
863
863
  ok: true;
864
864
  target: AnnotationTarget;
865
865
  compiled: string;
866
- } | {
866
+ }
867
+ /**
868
+ * A failure carries its own way out. `code` alone told the caller WHAT was wrong and never what to
869
+ * do, and the recovery hints elsewhere only attach to THROWN messages — a structured `{ ok: false }`
870
+ * got none. So an agent hitting `annotate_no_recording` had no way to learn that a recording has to
871
+ * be started first, and simply stopped annotating.
872
+ */
873
+ | {
867
874
  ok: false;
868
875
  code: AnnotationErrorCode;
876
+ recovery?: string;
869
877
  };
870
878
  /**
871
879
  * The patch a compiled annotation produces. The caller applies it to the
@@ -892,4 +900,3 @@ export type ContractFile = z.infer<typeof ContractFileSchema>;
892
900
  export type RunEvidence = z.infer<typeof RunEvidenceSchema>;
893
901
  export type CapabilityFlow = z.infer<typeof CapabilityFlowSchema>;
894
902
  export type RiskZone = z.infer<typeof RiskZoneSchema>;
895
- //# sourceMappingURL=types.d.ts.map
package/dist/types.js CHANGED
@@ -168,4 +168,3 @@ export const AnnotationSchema = z.discriminatedUnion('kind', [
168
168
  text: z.string().min(1),
169
169
  }),
170
170
  ]);
171
- //# sourceMappingURL=types.js.map
package/dist/upgrade.d.ts CHANGED
@@ -32,6 +32,13 @@ export declare const CloudCapability: {
32
32
  readonly CORPUS_HEAL: "corpus_heal";
33
33
  /** Verify-before-merge policy gate in CI (the governance tier). */
34
34
  readonly CI_GATE: "ci_gate";
35
+ /**
36
+ * Hosted execution — verify a URL on OUR browsers instead of the caller's. This is the axis a local
37
+ * tool structurally cannot serve: CI with no Chromium, background/autonomous agents with no foreground
38
+ * browser, and "verify my deployed staging URL". Without this capability the runner pillar had no name,
39
+ * so a blocked agent could not emit a hint for it at all.
40
+ */
41
+ readonly HOSTED_RUNNER: "hosted_runner";
35
42
  };
36
43
  export type CloudCapability = (typeof CloudCapability)[keyof typeof CloudCapability];
37
44
  /**
@@ -51,18 +58,25 @@ export declare const UpgradeHintSchema: z.ZodObject<{
51
58
  readonly CORPUS_HEAL: "corpus_heal";
52
59
  /** Verify-before-merge policy gate in CI (the governance tier). */
53
60
  readonly CI_GATE: "ci_gate";
61
+ /**
62
+ * Hosted execution — verify a URL on OUR browsers instead of the caller's. This is the axis a local
63
+ * tool structurally cannot serve: CI with no Chromium, background/autonomous agents with no foreground
64
+ * browser, and "verify my deployed staging URL". Without this capability the runner pillar had no name,
65
+ * so a blocked agent could not emit a hint for it at all.
66
+ */
67
+ readonly HOSTED_RUNNER: "hosted_runner";
54
68
  }>;
55
69
  reason: z.ZodString;
56
70
  unlockedBy: z.ZodString;
57
71
  learnMoreUrl: z.ZodString;
58
72
  }, "strip", z.ZodTypeAny, {
59
73
  reason: string;
60
- capability: "share_proof" | "run_history" | "team_review" | "corpus_heal" | "ci_gate";
74
+ capability: "share_proof" | "run_history" | "team_review" | "corpus_heal" | "ci_gate" | "hosted_runner";
61
75
  unlockedBy: string;
62
76
  learnMoreUrl: string;
63
77
  }, {
64
78
  reason: string;
65
- capability: "share_proof" | "run_history" | "team_review" | "corpus_heal" | "ci_gate";
79
+ capability: "share_proof" | "run_history" | "team_review" | "corpus_heal" | "ci_gate" | "hosted_runner";
66
80
  unlockedBy: string;
67
81
  learnMoreUrl: string;
68
82
  }>;
@@ -71,4 +85,3 @@ export type UpgradeHint = z.infer<typeof UpgradeHintSchema>;
71
85
  export declare function isCloudCapability(value: unknown): value is CloudCapability;
72
86
  /** Build the canonical hint for a capability. Pure — the emitter decides WHEN, this decides WHAT. */
73
87
  export declare function buildUpgradeHint(capability: CloudCapability): UpgradeHint;
74
- //# sourceMappingURL=upgrade.d.ts.map
package/dist/upgrade.js CHANGED
@@ -32,6 +32,13 @@ export const CloudCapability = {
32
32
  CORPUS_HEAL: 'corpus_heal',
33
33
  /** Verify-before-merge policy gate in CI (the governance tier). */
34
34
  CI_GATE: 'ci_gate',
35
+ /**
36
+ * Hosted execution — verify a URL on OUR browsers instead of the caller's. This is the axis a local
37
+ * tool structurally cannot serve: CI with no Chromium, background/autonomous agents with no foreground
38
+ * browser, and "verify my deployed staging URL". Without this capability the runner pillar had no name,
39
+ * so a blocked agent could not emit a hint for it at all.
40
+ */
41
+ HOSTED_RUNNER: 'hosted_runner',
35
42
  };
36
43
  /**
37
44
  * A single, structured hint. `reason` states the blocker as fact; `unlockedBy` names the one action that
@@ -67,12 +74,18 @@ const COPY_BY_CAPABILITY = {
67
74
  },
68
75
  [CloudCapability.CORPUS_HEAL]: {
69
76
  reason: 'Corpus-ranked heal uses refactor outcomes learned across the fleet, served from the cloud.',
70
- unlockedBy: 'Enable the hosted heal service on a Reticle Cloud team plan.',
77
+ // Learned intelligence sits above the flat team seat (usage tier) — the copy must not promise it
78
+ // to a team plan that does not include it.
79
+ unlockedBy: 'Enable the hosted heal service on Reticle Cloud.',
71
80
  },
72
81
  [CloudCapability.CI_GATE]: {
73
82
  reason: 'Verify-before-merge is a governance gate that runs in your CI against a hosted policy.',
74
83
  unlockedBy: 'Configure the Reticle Cloud CI gate for your repository.',
75
84
  },
85
+ [CloudCapability.HOSTED_RUNNER]: {
86
+ reason: 'Verifying without a local browser (CI, a background agent, or a deployed URL) needs a browser we run for you.',
87
+ unlockedBy: 'Link a Reticle Cloud account to run verifications on hosted browsers.',
88
+ },
76
89
  };
77
90
  /** Build the canonical hint for a capability. Pure — the emitter decides WHEN, this decides WHAT. */
78
91
  export function buildUpgradeHint(capability) {
@@ -84,4 +97,3 @@ export function buildUpgradeHint(capability) {
84
97
  learnMoreUrl: CLOUD_LEARN_MORE_URL,
85
98
  };
86
99
  }
87
- //# sourceMappingURL=upgrade.js.map
@@ -552,13 +552,13 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
552
552
  name: string;
553
553
  framework: "react" | "next" | "vite" | "other";
554
554
  commit?: string | undefined;
555
- env?: "local" | "ci" | "preview" | undefined;
555
+ env?: "local" | "preview" | "ci" | undefined;
556
556
  previewUrl?: string | undefined;
557
557
  }, {
558
558
  name: string;
559
559
  framework: "react" | "next" | "vite" | "other";
560
560
  commit?: string | undefined;
561
- env?: "local" | "ci" | "preview" | undefined;
561
+ env?: "local" | "preview" | "ci" | undefined;
562
562
  previewUrl?: string | undefined;
563
563
  }>;
564
564
  agent: z.ZodObject<{
@@ -1021,7 +1021,7 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
1021
1021
  name: string;
1022
1022
  framework: "react" | "next" | "vite" | "other";
1023
1023
  commit?: string | undefined;
1024
- env?: "local" | "ci" | "preview" | undefined;
1024
+ env?: "local" | "preview" | "ci" | undefined;
1025
1025
  previewUrl?: string | undefined;
1026
1026
  };
1027
1027
  agent: {
@@ -1116,7 +1116,7 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
1116
1116
  name: string;
1117
1117
  framework: "react" | "next" | "vite" | "other";
1118
1118
  commit?: string | undefined;
1119
- env?: "local" | "ci" | "preview" | undefined;
1119
+ env?: "local" | "preview" | "ci" | undefined;
1120
1120
  previewUrl?: string | undefined;
1121
1121
  };
1122
1122
  agent: {
@@ -1194,4 +1194,3 @@ export declare const ReticleVerificationRunSchema: z.ZodObject<{
1194
1194
  export type ReticleVerificationRun = z.infer<typeof ReticleVerificationRunSchema>;
1195
1195
  export type VerificationEvidence = z.infer<typeof VerificationEvidenceSchema>;
1196
1196
  export type RunSignature = z.infer<typeof RunSignatureSchema>;
1197
- //# sourceMappingURL=verification-run.d.ts.map
@@ -258,4 +258,3 @@ export const ReticleVerificationRunSchema = z.object({
258
258
  verdict: RunVerdictSchema,
259
259
  signature: RunSignatureSchema.optional(),
260
260
  });
261
- //# sourceMappingURL=verification-run.js.map
@@ -0,0 +1,104 @@
1
+ /**
2
+ * The ONE field an agent reads to decide whether a change is verified.
3
+ *
4
+ * An action result carries eight trust dimensions — dispatched, settled, ok, grade, attribution,
5
+ * coverage, integrity, and the assertion verdict — and until now no rule for combining them. Driving
6
+ * this surface produced `settled:false, settleReason:"timeout"` on a fill, and there was no way to
7
+ * tell whether that was a bug or noise; the honest answer was "I could not tell", and the honest
8
+ * answer was unavailable. Eight judgment calls per action is eight chances to guess wrong.
9
+ *
10
+ * UNKNOWN is load-bearing and must never collapse into NO. "The capture was truncated so I could not
11
+ * see" and "the app is broken" lead an agent to opposite next moves: one says look again with better
12
+ * coverage, the other says go fix something. Merging them manufactures both false alarms and false
13
+ * confidence, which is the entire failure class this project exists to remove.
14
+ */
15
+ export declare const Verified: {
16
+ /** Proved: the assertion held, at a real grade, over a clean capture, with no channel disagreeing. */
17
+ readonly YES: "yes";
18
+ /** Disproved: the assertion failed, or the channels contradict each other. Go look. */
19
+ readonly NO: "no";
20
+ /** Not determinable from this evidence — vacuous grade, dirty capture, or never settled. */
21
+ readonly UNKNOWN: "unknown";
22
+ };
23
+ export type Verified = (typeof Verified)[keyof typeof Verified];
24
+ /**
25
+ * Actionable companion to NO_PROVIDER for the tools that genuinely intercept or capture through CDP
26
+ * — network mocking and viewport control — which is NOT "visual capture".
27
+ *
28
+ * They used to return VISUAL_NO_PROVIDER_RECOMMENDATION verbatim, so asking to stub a request was
29
+ * answered with "visual capture needs a driven browser". An agent reading that concludes it asked
30
+ * the wrong KIND of question and goes looking for a screenshot tool, when the requirement is simply
31
+ * a driven browser.
32
+ */
33
+ /**
34
+ * The machine-readable half of the same correction.
35
+ *
36
+ * `network_mock` and `viewport` returned `reason: "no-visual-provider"`, so an agent gating on the
37
+ * code — the field that exists precisely to be matched on — was gating on a false statement: neither
38
+ * tool captures anything visual. Fixing only the human-readable recommendation would have left the
39
+ * lie in the part machines read, which is the wrong half to leave wrong.
40
+ *
41
+ * Safe to introduce: nothing outside this repo matches the old code, and the visual tools keep it.
42
+ */
43
+ export declare const CDP_NO_PROVIDER_REASON = "no-cdp-provider";
44
+ export declare const CDP_NO_PROVIDER_RECOMMENDATION = "this needs a Reticle-driven browser (it is applied through CDP, which the always-on SDK cannot do) \u2014 start with `reticle drive <url>` or set RETICLE_CDP_URL";
45
+ /**
46
+ * A region the SDK cannot see into — surfaced (never hidden) so a result's coverage reads honestly.
47
+ * Crosses the wire in a BLIND_SPOT event's `kind`, so it lives in core (the contract), not the server.
48
+ */
49
+ export declare const BlindSpotKind: {
50
+ readonly CLOSED_SHADOW_ROOT: "closed-shadow-root";
51
+ /**
52
+ * The bridge sampled: events arrived faster than its per-second cap, so some were dropped.
53
+ *
54
+ * This replaces DISCONNECTING, which is the one thing an observability layer must not do when it
55
+ * sees too much. Measured: every network request emits two messages (pending + settled), so the cap
56
+ * binds at ~500 requests/second — reachable by a dashboard burst and continuous for a streaming app.
57
+ * Going blind there meant the biggest, most complex apps were exactly the ones Reticle could not
58
+ * watch, and the failure was silent.
59
+ *
60
+ * Reported like any other blind spot, so a verdict over a sampled window says `coverage: partial`
61
+ * instead of implying it saw everything.
62
+ */
63
+ readonly RATE_LIMITED: "rate-limited";
64
+ readonly CROSS_ORIGIN_IFRAME: "cross-origin-iframe";
65
+ /**
66
+ * A SAME-ORIGIN frame, whose DOM is observed but whose NETWORK is not.
67
+ *
68
+ * A frame's `fetch`/`XMLHttpRequest` live in the frame's own realm, and the top realm's patch never
69
+ * sees them. Declared rather than half-instrumented: a request channel that is partly seen produces
70
+ * a `settled` that can be true while a frame request is still in flight, which is a false green.
71
+ */
72
+ readonly UNINSTRUMENTED_FRAME: "uninstrumented-frame";
73
+ readonly VIRTUALIZED_UNMOUNTED: "virtualized-unmounted";
74
+ /**
75
+ * Something wrapped `fetch` before we did, so the request we record is not necessarily the request
76
+ * that leaves. Wrappers chain outermost-first: anything installed EARLIER sits below us and mutates
77
+ * after we have read `init.body`. An interceptor initialised before connect(), or a polyfill, does
78
+ * exactly that. Unfixable from inside the page — there is no "patch last" primitive — so it is
79
+ * declared instead, and a verdict over it reports partial coverage rather than implying we saw the wire.
80
+ */
81
+ readonly WRAPPED_NETWORK: "wrapped-network";
82
+ /**
83
+ * An Electron renderer with no preload shim installed: every `ipcRenderer.invoke` is invisible.
84
+ *
85
+ * A desktop app reaches its backend over IPC, not HTTP, so without the shim `reticle_network`
86
+ * reports NOTHING — which reads as "this app makes no backend calls" rather than "you are blind to
87
+ * all of them", and makes `assert { net }` vacuously true. The SDK can tell the difference (it is
88
+ * running in Electron and the preload global is absent), so it says so instead of letting the
89
+ * silence pass for a clean result. `reticle doctor` names the one-line fix.
90
+ */
91
+ readonly UNOBSERVED_IPC: "unobserved-ipc";
92
+ /**
93
+ * A one-way IPC `send` in this window: dispatched, with NO verdict to observe.
94
+ *
95
+ * `ipcRenderer.send` returns immediately and the renderer never learns whether the main process
96
+ * handled it, so there is nothing to assert on. This is not a failure — it is an outcome that is
97
+ * structurally unobservable, and it has to read that way. Without it a fire-and-forget send lands
98
+ * as a clean green ("the UI said Marked as seen, no channel disagreed"), which is a false green the
99
+ * evidence cannot rule out, while treating it as a failure is a false red on a healthy app. So it
100
+ * is declared, and the verdict over it reports partial coverage.
101
+ */
102
+ readonly VERDICTLESS_SEND: "verdictless-send";
103
+ };
104
+ export type BlindSpotKind = (typeof BlindSpotKind)[keyof typeof BlindSpotKind];