@reticlehq/core 2.14.0 → 3.2.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 (148) hide show
  1. package/dist/{artifacts-entry.d.ts → artifacts/artifacts-entry.d.ts} +7 -7
  2. package/dist/{artifacts-entry.js → artifacts/artifacts-entry.js} +7 -7
  3. package/dist/artifacts/flow-composition.d.ts +30 -0
  4. package/dist/artifacts/flow-composition.js +19 -0
  5. package/dist/{flow-constants.d.ts → artifacts/flow-constants.d.ts} +99 -3
  6. package/dist/{flow-constants.js → artifacts/flow-constants.js} +108 -4
  7. package/dist/artifacts/flow-mutation-target.d.ts +39 -0
  8. package/dist/artifacts/flow-mutation-target.js +89 -0
  9. package/dist/artifacts/flow-order.d.ts +30 -0
  10. package/dist/artifacts/flow-order.js +49 -0
  11. package/dist/artifacts/flow-select.d.ts +56 -0
  12. package/dist/artifacts/flow-select.js +56 -0
  13. package/dist/artifacts/flow-step-tool.d.ts +31 -0
  14. package/dist/artifacts/flow-step-tool.js +31 -0
  15. package/dist/artifacts/flow-types.d.ts +3736 -0
  16. package/dist/artifacts/flow-types.js +463 -0
  17. package/dist/artifacts/flow-unreached.d.ts +12 -0
  18. package/dist/artifacts/flow-unreached.js +24 -0
  19. package/dist/{impact.d.ts → artifacts/impact.d.ts} +271 -103
  20. package/dist/{impact.js → artifacts/impact.js} +75 -5
  21. package/dist/artifacts/journal.d.ts +218 -0
  22. package/dist/artifacts/journal.js +130 -0
  23. package/dist/artifacts/step-effect.d.ts +29 -0
  24. package/dist/artifacts/step-effect.js +28 -0
  25. package/dist/hooks/hook-events.d.ts +311 -0
  26. package/dist/hooks/hook-events.js +127 -0
  27. package/dist/hooks/hooks-entry.d.ts +9 -0
  28. package/dist/hooks/hooks-entry.js +9 -0
  29. package/dist/identity/brand.d.ts +102 -0
  30. package/dist/{brand.js → identity/brand.js} +7 -0
  31. package/dist/{contract-fingerprint.d.ts → identity/contract-fingerprint.d.ts} +21 -3
  32. package/dist/{contract-fingerprint.js → identity/contract-fingerprint.js} +22 -4
  33. package/dist/{document-identity.d.ts → identity/document-identity.d.ts} +4 -5
  34. package/dist/{document-identity.js → identity/document-identity.js} +4 -5
  35. package/dist/{source-constants.d.ts → identity/source-constants.d.ts} +4 -4
  36. package/dist/{source-constants.js → identity/source-constants.js} +4 -4
  37. package/dist/index.d.ts +57 -43
  38. package/dist/index.js +66 -45
  39. package/dist/onboarding.d.ts +114 -0
  40. package/dist/onboarding.js +141 -0
  41. package/dist/realm/registry.d.ts +212 -0
  42. package/dist/realm/registry.js +302 -0
  43. package/dist/{dev-server-registry.d.ts → registry/dev-server-registry.d.ts} +6 -7
  44. package/dist/{dev-server-registry.js → registry/dev-server-registry.js} +28 -19
  45. package/dist/{project-registry.d.ts → registry/project-registry.d.ts} +5 -5
  46. package/dist/{project-registry.js → registry/project-registry.js} +5 -5
  47. package/dist/schema/command-name.json +31 -0
  48. package/dist/schema/event-payloads.json +795 -0
  49. package/dist/schema/hello-message.json +70 -2
  50. package/dist/schema/reticle-message.json +70 -2
  51. package/dist/telemetry-entry.d.ts +1 -1
  52. package/dist/telemetry-entry.js +1 -1
  53. package/dist/telemetry-feedback.d.ts +15 -16
  54. package/dist/telemetry-feedback.js +11 -12
  55. package/dist/telemetry-license.d.ts +1 -1
  56. package/dist/telemetry-license.js +1 -1
  57. package/dist/telemetry-refusal.d.ts +11 -11
  58. package/dist/telemetry-refusal.js +7 -8
  59. package/dist/telemetry-session.d.ts +51 -59
  60. package/dist/telemetry-session.js +47 -55
  61. package/dist/telemetry.d.ts +306 -222
  62. package/dist/telemetry.js +112 -99
  63. package/dist/tour-entry.d.ts +10 -0
  64. package/dist/tour-entry.js +10 -0
  65. package/dist/tour.d.ts +125 -0
  66. package/dist/tour.js +165 -0
  67. package/dist/{consequence.d.ts → verdict/consequence.d.ts} +32 -15
  68. package/dist/{consequence.js → verdict/consequence.js} +9 -31
  69. package/dist/{finding-fingerprint.js → verdict/finding-fingerprint.js} +1 -1
  70. package/dist/{findings.d.ts → verdict/findings.d.ts} +86 -39
  71. package/dist/{findings.js → verdict/findings.js} +103 -49
  72. package/dist/{instrumentation-gap.d.ts → verdict/instrumentation-gap.d.ts} +7 -14
  73. package/dist/{instrumentation-gap.js → verdict/instrumentation-gap.js} +7 -15
  74. package/dist/{intent.d.ts → verdict/intent.d.ts} +35 -46
  75. package/dist/{intent.js → verdict/intent.js} +11 -22
  76. package/dist/verdict/revision.d.ts +44 -0
  77. package/dist/verdict/revision.js +53 -0
  78. package/dist/{run-context.d.ts → verdict/run-context.d.ts} +13 -34
  79. package/dist/{run-context.js → verdict/run-context.js} +15 -36
  80. package/dist/{security.js → verdict/security.js} +12 -21
  81. package/dist/{verification-run.d.ts → verdict/verification-run.d.ts} +381 -105
  82. package/dist/{verification-run.js → verdict/verification-run.js} +157 -21
  83. package/dist/{verified-constants.d.ts → verdict/verified-constants.d.ts} +34 -13
  84. package/dist/{verified-constants.js → verdict/verified-constants.js} +34 -13
  85. package/dist/{verify-progress.d.ts → verdict/verify-progress.d.ts} +18 -22
  86. package/dist/{verify-progress.js → verdict/verify-progress.js} +6 -10
  87. package/dist/wire/channel.d.ts +46 -0
  88. package/dist/wire/channel.js +95 -0
  89. package/dist/{constants.d.ts → wire/constants/constants.d.ts} +179 -28
  90. package/dist/{constants.js → wire/constants/constants.js} +199 -28
  91. package/dist/{session-constants.d.ts → wire/constants/session-constants.d.ts} +23 -2
  92. package/dist/{session-constants.js → wire/constants/session-constants.js} +23 -2
  93. package/dist/{desktop-contract.js → wire/desktop-contract.js} +1 -1
  94. package/dist/{event-classification.js → wire/event-classification.js} +1 -1
  95. package/dist/{event-payloads.d.ts → wire/event-payloads.d.ts} +72 -13
  96. package/dist/{event-payloads.js → wire/event-payloads.js} +23 -3
  97. package/dist/{event-priority.d.ts → wire/event-priority.d.ts} +1 -4
  98. package/dist/{event-priority.js → wire/event-priority.js} +2 -5
  99. package/dist/{global-press.js → wire/global-press.js} +1 -1
  100. package/dist/{messages.d.ts → wire/messages.d.ts} +240 -48
  101. package/dist/{messages.js → wire/messages.js} +68 -5
  102. package/dist/wire/narrow.d.ts +39 -0
  103. package/dist/wire/narrow.js +45 -0
  104. package/dist/{net.d.ts → wire/net.d.ts} +36 -13
  105. package/dist/{net.js → wire/net.js} +36 -13
  106. package/dist/wire/platform.d.ts +37 -0
  107. package/dist/wire/platform.js +36 -0
  108. package/dist/{redaction.js → wire/redaction.js} +12 -12
  109. package/dist/wire/snapshot-tree.d.ts +33 -0
  110. package/dist/wire/snapshot-tree.js +43 -0
  111. package/dist/wire/tool-names.d.ts +133 -0
  112. package/dist/wire/tool-names.js +142 -0
  113. package/dist/{toon.js → wire/toon.js} +1 -1
  114. package/dist/{types.d.ts → wire/types.d.ts} +77 -76
  115. package/dist/{types.js → wire/types.js} +4 -3
  116. package/dist/{no-session-reason.d.ts → words/no-session-reason.d.ts} +7 -3
  117. package/dist/{no-session-reason.js → words/no-session-reason.js} +7 -3
  118. package/dist/{notices.d.ts → words/notices.d.ts} +8 -12
  119. package/dist/{notices.js → words/notices.js} +8 -12
  120. package/package.json +16 -7
  121. package/dist/brand.d.ts +0 -49
  122. package/dist/flow-types.d.ts +0 -1711
  123. package/dist/flow-types.js +0 -247
  124. package/dist/journal.d.ts +0 -122
  125. package/dist/journal.js +0 -57
  126. package/dist/{impact-savings.d.ts → artifacts/impact-savings.d.ts} +0 -0
  127. package/dist/{impact-savings.js → artifacts/impact-savings.js} +0 -0
  128. package/dist/{edit-epoch.d.ts → identity/edit-epoch.d.ts} +0 -0
  129. package/dist/{edit-epoch.js → identity/edit-epoch.js} +0 -0
  130. package/dist/{project-id.d.ts → identity/project-id.d.ts} +0 -0
  131. package/dist/{project-id.js → identity/project-id.js} +0 -0
  132. package/dist/{daemon-registry.d.ts → registry/daemon-registry.d.ts} +0 -0
  133. package/dist/{daemon-registry.js → registry/daemon-registry.js} +0 -0
  134. package/dist/{finding-fingerprint.d.ts → verdict/finding-fingerprint.d.ts} +0 -0
  135. package/dist/{security.d.ts → verdict/security.d.ts} +0 -0
  136. package/dist/{desktop-contract.d.ts → wire/desktop-contract.d.ts} +0 -0
  137. package/dist/{event-classification.d.ts → wire/event-classification.d.ts} +0 -0
  138. package/dist/{global-press.d.ts → wire/global-press.d.ts} +0 -0
  139. package/dist/{redaction.d.ts → wire/redaction.d.ts} +0 -0
  140. package/dist/{state-select.d.ts → wire/state-select.d.ts} +0 -0
  141. package/dist/{state-select.js → wire/state-select.js} +0 -0
  142. package/dist/{toon.d.ts → wire/toon.d.ts} +0 -0
  143. package/dist/{browser-misdirect.d.ts → words/browser-misdirect.d.ts} +0 -0
  144. package/dist/{browser-misdirect.js → words/browser-misdirect.js} +0 -0
  145. package/dist/{unreachable-notice.d.ts → words/unreachable-notice.d.ts} +0 -0
  146. package/dist/{unreachable-notice.js → words/unreachable-notice.js} +0 -0
  147. package/dist/{upgrade.d.ts → words/upgrade.d.ts} +2 -2
  148. /package/dist/{upgrade.js → words/upgrade.js} +0 -0
@@ -1,11 +1,9 @@
1
1
  /**
2
2
  * How a SESSION and a PROJECT measured — the two big rollup payloads and the types they are built from.
3
3
  *
4
- * Split out of `telemetry.ts` because they are a different kind of thing from the event contract next
5
- * door: that file answers "what happened", these answer "how much, how long, and on what". They are
6
- * also where nearly all the growth is — every new thing worth measuring lands in one of these two
7
- * shapes — so keeping them here is what stops the event contract itself from drifting past its cap
8
- * every time a counter is added.
4
+ * A different kind of thing from the event contract next door: `telemetry.ts` answers "what
5
+ * happened", these answer "how much, how long, and on what". Nearly all the growth lands here —
6
+ * every new thing worth measuring lands in one of these two shapes.
9
7
  */
10
8
  import { z } from 'zod';
11
9
  /**
@@ -118,10 +116,10 @@ export type ToolTiming = z.infer<typeof ToolTimingSchema>;
118
116
  /**
119
117
  * Attempts, successes and failure reasons for one kind of connection.
120
118
  *
121
- * The first version of this counted only successes — and counted them inconsistently, incrementing
122
- * before the await on one path and after it on another, so the CDP number was attempts and the others
123
- * were successes and nobody could have told from the data. A connection metric that cannot express
124
- * FAILURE is close to useless: the whole question is how often people cannot get a browser.
119
+ * Attempts AND successes, because a connection metric that cannot express FAILURE is close to
120
+ * useless — the whole question is how often a browser cannot be got. Every path must increment
121
+ * `attempts` on the same side of its await, or one connector's number means something different
122
+ * from the next one's and the data cannot say which.
125
123
  */
126
124
  export declare const ConnectionStatsSchema: z.ZodObject<{
127
125
  attempts: z.ZodNumber;
@@ -139,7 +137,7 @@ export declare const ConnectionStatsSchema: z.ZodObject<{
139
137
  }>;
140
138
  export type ConnectionStats = z.infer<typeof ConnectionStatsSchema>;
141
139
  /**
142
- * Why a browser/lease connection failed, classified into causes we can act on.
140
+ * Why a browser/lease connection failed, classified into causes somebody can act on.
143
141
  *
144
142
  * A raw message would be both high-cardinality and unsafe (it can carry a URL or a path). These are
145
143
  * the distinct THINGS THAT GO WRONG, each with a different fix: a missing Chromium is a docs problem,
@@ -172,8 +170,8 @@ export declare const SessionSummarySchema: z.ZodObject<{
172
170
  /** Total MCP tool calls served. */
173
171
  toolCalls: z.ZodNumber;
174
172
  /**
175
- * Calls per tool name — `{ "reticle_act": 40 }`. Tool names are a fixed, low-cardinality set we
176
- * define ourselves, so this is safe to send whole and is queryable in HogQL with JSONExtract.
173
+ * Calls per tool name — `{ "reticle_act": 40 }`. Tool names are a fixed, low-cardinality set
174
+ * defined in this repository, so this is safe to send whole and is queryable with JSONExtract.
177
175
  */
178
176
  toolCounts: z.ZodRecord<z.ZodString, z.ZodNumber>;
179
177
  /** Tool calls that ended in an error, and the distinct error shapes behind them. */
@@ -238,7 +236,7 @@ export declare const SessionSummarySchema: z.ZodObject<{
238
236
  /**
239
237
  * Which PARAMETERS agents actually passed, per tool: `{"reticle_act": {"ref": 40, "action:click": 31}}`.
240
238
  *
241
- * Names only, with one narrow exception for parameters whose values are enums we define ourselves
239
+ * Names only, with one narrow exception for parameters whose values are enums defined here
242
240
  * (`action:click`). Never a raw value: `reticle_act`'s `args` carries the text being typed into the
243
241
  * app, which on a login form is a password. See argument-shape.ts for the allowlist.
244
242
  */
@@ -287,13 +285,13 @@ export declare const SessionSummarySchema: z.ZodObject<{
287
285
  browserCommands: z.ZodOptional<z.ZodNumber>;
288
286
  /** The most tool calls in flight at once — parallel agents, or one agent fanning out. */
289
287
  peakConcurrentTools: z.ZodOptional<z.ZodNumber>;
290
- /** Calls for a tool name that does not exist. A non-zero value means our surface is confusing. */
288
+ /** Calls for a tool name that does not exist. A non-zero value means the surface is confusing. */
291
289
  unknownToolCalls: z.ZodOptional<z.ZodNumber>;
292
290
  /**
293
291
  * WHICH tools the agent reached for that do not exist, with counts.
294
292
  *
295
- * The count alone said "our surface confused someone" and could never say what they wanted. The
296
- * name is a feature request in the agent's own vocabulary — and it is a NAME, from our own tool
293
+ * The count alone says "the surface confused someone" and can never say what they wanted. The name
294
+ * is a feature request in the agent's own vocabulary — and it is a NAME, from Reticle's own tool
297
295
  * namespace, carrying no app data, so it is safe under the send-names-never-values rule.
298
296
  *
299
297
  * Bounded and truncated: a guess is a short identifier, and anything longer is not one.
@@ -303,10 +301,8 @@ export declare const SessionSummarySchema: z.ZodObject<{
303
301
  * Tool calls that failed because there was no app to reach — no session connected, no session by
304
302
  * that id, or several with none named.
305
303
  *
306
- * The single biggest drop-off in the funnel, and it used to be reachable only by unpacking
307
- * `errors[]` in HogQL. 74% of daemons never call a tool at all, and of the sessions that made
308
- * exactly one call, most bounced on precisely this. Absent when it never happened, so the field's
309
- * PRESENCE is the signal.
304
+ * The single biggest drop-off in the funnel, counted here rather than left to be unpacked out of
305
+ * `errors[]` by a query. Absent when it never happened, so the field's PRESENCE is the signal.
310
306
  */
311
307
  noSessionErrors: z.ZodOptional<z.ZodNumber>;
312
308
  /**
@@ -370,9 +366,9 @@ export declare const SessionSummarySchema: z.ZodObject<{
370
366
  /**
371
367
  * Client name -> version. The other half of `clients`, and the half that explains regressions.
372
368
  *
373
- * MCP's `clientInfo` carries a name AND a version; we read both at the handshake and kept only
374
- * the name. A product whose users are agents needs to slice every rate by which agent, on which
375
- * build — a single global figure hides the finding entirely.
369
+ * MCP's `clientInfo` carries a name AND a version, and both are read at the handshake. A product
370
+ * whose users are agents needs to slice every rate by which agent, on which build — a single
371
+ * global figure hides the finding entirely.
376
372
  *
377
373
  * NOT the model: `clientInfo` has no concept of one, so the transport genuinely cannot report it.
378
374
  * Agents self-report it on feedback, which is the only mechanism there is.
@@ -380,8 +376,8 @@ export declare const SessionSummarySchema: z.ZodObject<{
380
376
  clientVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
381
377
  /**
382
378
  * Which tool surface was live. The 18-tool default and the 48-tool full surface are different
383
- * products from inside an agent's context window, and comparing outcomes across them is how we
384
- * learn whether the trim helps or hurts.
379
+ * products from inside an agent's context window, and comparing outcomes across them is the only
380
+ * way to tell whether the trim helps or hurts.
385
381
  */
386
382
  surface: z.ZodOptional<z.ZodString>;
387
383
  /**
@@ -389,9 +385,8 @@ export declare const SessionSummarySchema: z.ZodObject<{
389
385
  *
390
386
  * Zero here is the single most diagnostic number in the payload: the daemon ran and no app ever
391
387
  * connected, which is a BROKEN INSTALL. Non-zero with no tool calls is the opposite problem — the
392
- * install works and the agent never asked. Before this field those two were the same row, and
393
- * they have opposite fixes. In the field most users who attached an agent never
394
- * drove, and we could not say which case any of them was.
388
+ * install works and the agent never asked. Without this field those two are the same row, and
389
+ * they have opposite fixes.
395
390
  *
396
391
  * A counter rather than an event because the SDK reconnects on every page reload — an event per
397
392
  * connect would be high volume for a question one number answers.
@@ -410,8 +405,8 @@ export declare const SessionSummarySchema: z.ZodObject<{
410
405
  * Distinct from `exit`, which says why the PROCESS ended. A daemon can exit tidily on idle while
411
406
  * the agent's work was abandoned mid-task, and those are different findings.
412
407
  *
413
- * In the field most agents that drove an app produced no verdict, and nothing
414
- * could say whether that was a product failure or a task that simply ended.
408
+ * An agent can drive an app and never reach a verdict, and without this nothing could say whether
409
+ * that was a product failure or a task that simply ended.
415
410
  *
416
411
  * Most of this is derivable at query time from `toolCalls` / `verifications` /
417
412
  * `abandonedActions`. The part that is NOT derivable is `client_left` — whether the agent
@@ -422,26 +417,24 @@ export declare const SessionSummarySchema: z.ZodObject<{
422
417
  /**
423
418
  * How often Reticle invited the agent to send feedback.
424
419
  *
425
- * The denominator for `feedback_submitted`. A prompt nobody acts on is decoration, and without
426
- * this we could never tell the difference between "agents have nothing to report" and "our
427
- * invitation is invisible". Instrumenting our own nudge is what makes it a designed system
428
- * rather than a hope.
420
+ * The denominator for `feedback_submitted`: without it a low submission count cannot be told
421
+ * apart from an invitation that never appeared.
429
422
  */
430
423
  feedbackPrompted: z.ZodOptional<z.ZodNumber>;
431
424
  /**
432
- * Tool errors bucketed by WHOSE defect they are: `schema` (our grammar failed to explain itself),
433
- * `state` (the world moved), `refusal` (we said no on purpose), `other` (a blind spot).
425
+ * Tool errors bucketed by WHOSE defect they are: `schema` (the grammar failed to explain itself),
426
+ * `state` (the world moved), `refusal` (a deliberate no), `other` (a blind spot).
434
427
  *
435
- * `toolErrors` is one number over three failures with three different fixes. Only the `schema`
436
- * bucket is fixable by writing better descriptions, and it was indistinguishable from the rest.
428
+ * `toolErrors` alone is one number over three failures with three different fixes, and only the
429
+ * `schema` bucket is fixable by writing better descriptions.
437
430
  */
438
431
  errorClasses: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
439
432
  /**
440
433
  * Errors after which the agent's NEXT call succeeded — the message worked.
441
434
  *
442
- * The best measure of an error message is what the agent does next, and we had the loop
443
- * (`consecutiveRepeats`) and the shape (`errors[]`) but never the join. This is the most
444
- * agent-specific metric in the payload: a human would sigh, a log would show nothing.
435
+ * The best measure of an error message is what the agent does next. `consecutiveRepeats` has the
436
+ * loop and `errors[]` has the shape; this is the join. The most agent-specific metric in the
437
+ * payload: a human would sigh, a log would show nothing.
445
438
  */
446
439
  errorsRecovered: z.ZodOptional<z.ZodNumber>;
447
440
  /** Errors whose very next call failed again — the message did not land. */
@@ -465,9 +458,9 @@ export declare const SessionSummarySchema: z.ZodObject<{
465
458
  *
466
459
  * The nudge is the entire adoption mechanism for a published fix — it rides the tool-result
467
460
  * envelope once per daemon process — and it emitted NOTHING, so the one question it exists to
468
- * answer could not be asked. `versionChange.nudged` is the other half and only reaches us from
469
- * machines that DID update; the cohort pinned three releases back never fires `version_changed` at
470
- * all, which is exactly the cohort worth understanding.
461
+ * answer cannot be asked without it. `versionChange.nudged` is the other half and arrives only
462
+ * from machines that DID update; a machine pinned several releases back never fires
463
+ * `version_changed` at all, which is exactly the cohort worth understanding.
471
464
  *
472
465
  * Crossed against this same installId's `version` on a later day it separates the two causes,
473
466
  * which need opposite fixes: `false` for run after run means the nudge is not firing for them (a
@@ -482,7 +475,7 @@ export declare const SessionSummarySchema: z.ZodObject<{
482
475
  /**
483
476
  * The newer version this daemon knew about, when it knew about one.
484
477
  *
485
- * OUR OWN published version number, so it is low-cardinality and carries nothing about the
478
+ * Reticle's own published version number, so it is low-cardinality and carries nothing about the
486
479
  * machine. Without it `updateNudged: false` is two facts at once — nothing was available, or
487
480
  * something was and the nudge did not fire — and only the second is a defect.
488
481
  */
@@ -492,10 +485,10 @@ export declare const SessionSummarySchema: z.ZodObject<{
492
485
  /**
493
486
  * WHY the daemon exited. Absent on a periodic flush (`final: false`) — nothing exited.
494
487
  *
495
- * Without this, a designed exit and a real failure are the same row. In the field the large
496
- * majority of `mcp_connection_lost` events were `sse_ended` — the stream the daemon closes on its own
497
- * scheduled idle shutdown — so the metric meant to say "the agent lost its tools" was mostly
498
- * counting the daemon going to sleep as designed, and a genuine outage was invisible inside it.
488
+ * Without this, a designed exit and a real failure are the same row. `sse_ended` — the stream the
489
+ * daemon closes on its own scheduled idle shutdown — dominates `mcp_connection_lost`, so a metric
490
+ * meant to say "the agent lost its tools" mostly counts the daemon going to sleep as designed, and
491
+ * a genuine outage is invisible inside it.
499
492
  *
500
493
  * The daemon has always known this (`recordExitReason`); it simply never put it on an event. The
501
494
  * proxy that emits the outage cannot know it — it only sees a socket end — so the join is made
@@ -558,7 +551,7 @@ export declare const SessionSummarySchema: z.ZodObject<{
558
551
  clientVersions?: Record<string, string> | undefined;
559
552
  appConnects?: number | undefined;
560
553
  msToFirstApp?: number | undefined;
561
- endReason?: "verified" | "never_used" | "explored" | "abandoned" | "client_left" | undefined;
554
+ endReason?: "verified" | "abandoned" | "never_used" | "explored" | "client_left" | undefined;
562
555
  feedbackPrompted?: number | undefined;
563
556
  errorClasses?: Record<string, number> | undefined;
564
557
  errorsRecovered?: number | undefined;
@@ -566,7 +559,7 @@ export declare const SessionSummarySchema: z.ZodObject<{
566
559
  endedWithVerdict?: boolean | undefined;
567
560
  updateNudged?: boolean | undefined;
568
561
  updateOffered?: string | undefined;
569
- exit?: "unknown" | "signal" | "idle" | undefined;
562
+ exit?: "signal" | "idle" | "unknown" | undefined;
570
563
  }, {
571
564
  durationMs: number;
572
565
  toolCalls: number;
@@ -623,7 +616,7 @@ export declare const SessionSummarySchema: z.ZodObject<{
623
616
  clientVersions?: Record<string, string> | undefined;
624
617
  appConnects?: number | undefined;
625
618
  msToFirstApp?: number | undefined;
626
- endReason?: "verified" | "never_used" | "explored" | "abandoned" | "client_left" | undefined;
619
+ endReason?: "verified" | "abandoned" | "never_used" | "explored" | "client_left" | undefined;
627
620
  feedbackPrompted?: number | undefined;
628
621
  errorClasses?: Record<string, number> | undefined;
629
622
  errorsRecovered?: number | undefined;
@@ -631,7 +624,7 @@ export declare const SessionSummarySchema: z.ZodObject<{
631
624
  endedWithVerdict?: boolean | undefined;
632
625
  updateNudged?: boolean | undefined;
633
626
  updateOffered?: string | undefined;
634
- exit?: "unknown" | "signal" | "idle" | undefined;
627
+ exit?: "signal" | "idle" | "unknown" | undefined;
635
628
  }>;
636
629
  export type SessionSummary = z.infer<typeof SessionSummarySchema>;
637
630
  /**
@@ -651,8 +644,8 @@ export type ProjectSize = (typeof ProjectSize)[keyof typeof ProjectSize];
651
644
  * Why a profile carries no `stack`, when it carries none.
652
645
  *
653
646
  * `stack` unknown is one of the largest buckets on the profile, and an empty field is not a cause:
654
- * it collapses "the daemon was started somewhere that is not a project" with "we read this app's
655
- * manifest and did not recognise what it uses", which need opposite fixes — the first is a
647
+ * it collapses "the daemon was started somewhere that is not a project" with "this app's manifest
648
+ * was read and nothing in it was recognised", which need opposite fixes — the first is a
656
649
  * discovery problem, the second is a one-line addition to the dependency table.
657
650
  *
658
651
  * Derived from the branches of `detectStack` rather than computed beside them. A reason assembled
@@ -695,9 +688,8 @@ export declare const ProjectProfileSchema: z.ZodObject<{
695
688
  * WHERE the stack was found — and therefore how much to trust the absence of one.
696
689
  *
697
690
  * `cwd` means the daemon was sitting in the app. `workspace` means it was not, and discovery had
698
- * to walk down to find it. The split is the diagnostic: it says how often our inference needs
699
- * help, which is the question that decides whether an agent-correction surface is worth building
700
- * at all.
691
+ * to walk down to find it. The split is the diagnostic: it says how often the inference needs
692
+ * help, which decides whether an agent-correction surface is worth building at all.
701
693
  *
702
694
  * Before discovery existed here, stack was detected on **none of the projects where Reticle was
703
695
  * demonstrably set up**, and none of the large ones either. A detector
@@ -788,7 +780,7 @@ export declare const ProjectProfileSchema: z.ZodObject<{
788
780
  *
789
781
  * This is the first of the two bits that split it, and it is on `project_profiled` deliberately:
790
782
  * that event fires once per daemon start whatever happens afterwards, so it is the only place a
791
- * fact about a project reaches us for the users who never instrument anything. `app_instrumented`
783
+ * fact about a project is reported at all for an install that never instruments anything. `app_instrumented`
792
784
  * carries the same field and cannot answer this, because it only exists when the answer is moot.
793
785
  */
794
786
  initialized: z.ZodOptional<z.ZodBoolean>;
@@ -1,11 +1,9 @@
1
1
  /**
2
2
  * How a SESSION and a PROJECT measured — the two big rollup payloads and the types they are built from.
3
3
  *
4
- * Split out of `telemetry.ts` because they are a different kind of thing from the event contract next
5
- * door: that file answers "what happened", these answer "how much, how long, and on what". They are
6
- * also where nearly all the growth is — every new thing worth measuring lands in one of these two
7
- * shapes — so keeping them here is what stops the event contract itself from drifting past its cap
8
- * every time a counter is added.
4
+ * A different kind of thing from the event contract next door: `telemetry.ts` answers "what
5
+ * happened", these answer "how much, how long, and on what". Nearly all the growth lands here —
6
+ * every new thing worth measuring lands in one of these two shapes.
9
7
  */
10
8
  import { z } from 'zod';
11
9
  /**
@@ -83,10 +81,10 @@ export const ToolTimingSchema = z.object({
83
81
  /**
84
82
  * Attempts, successes and failure reasons for one kind of connection.
85
83
  *
86
- * The first version of this counted only successes — and counted them inconsistently, incrementing
87
- * before the await on one path and after it on another, so the CDP number was attempts and the others
88
- * were successes and nobody could have told from the data. A connection metric that cannot express
89
- * FAILURE is close to useless: the whole question is how often people cannot get a browser.
84
+ * Attempts AND successes, because a connection metric that cannot express FAILURE is close to
85
+ * useless — the whole question is how often a browser cannot be got. Every path must increment
86
+ * `attempts` on the same side of its await, or one connector's number means something different
87
+ * from the next one's and the data cannot say which.
90
88
  */
91
89
  export const ConnectionStatsSchema = z.object({
92
90
  attempts: z.number().int().nonnegative(),
@@ -95,7 +93,7 @@ export const ConnectionStatsSchema = z.object({
95
93
  failures: z.record(z.string(), z.number().int().nonnegative()).optional(),
96
94
  });
97
95
  /**
98
- * Why a browser/lease connection failed, classified into causes we can act on.
96
+ * Why a browser/lease connection failed, classified into causes somebody can act on.
99
97
  *
100
98
  * A raw message would be both high-cardinality and unsafe (it can carry a URL or a path). These are
101
99
  * the distinct THINGS THAT GO WRONG, each with a different fix: a missing Chromium is a docs problem,
@@ -127,8 +125,8 @@ export const SessionSummarySchema = z.object({
127
125
  /** Total MCP tool calls served. */
128
126
  toolCalls: z.number().int().nonnegative(),
129
127
  /**
130
- * Calls per tool name — `{ "reticle_act": 40 }`. Tool names are a fixed, low-cardinality set we
131
- * define ourselves, so this is safe to send whole and is queryable in HogQL with JSONExtract.
128
+ * Calls per tool name — `{ "reticle_act": 40 }`. Tool names are a fixed, low-cardinality set
129
+ * defined in this repository, so this is safe to send whole and is queryable with JSONExtract.
132
130
  */
133
131
  toolCounts: z.record(z.string(), z.number().int().nonnegative()),
134
132
  /** Tool calls that ended in an error, and the distinct error shapes behind them. */
@@ -155,7 +153,7 @@ export const SessionSummarySchema = z.object({
155
153
  /**
156
154
  * Which PARAMETERS agents actually passed, per tool: `{"reticle_act": {"ref": 40, "action:click": 31}}`.
157
155
  *
158
- * Names only, with one narrow exception for parameters whose values are enums we define ourselves
156
+ * Names only, with one narrow exception for parameters whose values are enums defined here
159
157
  * (`action:click`). Never a raw value: `reticle_act`'s `args` carries the text being typed into the
160
158
  * app, which on a login form is a password. See argument-shape.ts for the allowlist.
161
159
  */
@@ -180,13 +178,13 @@ export const SessionSummarySchema = z.object({
180
178
  browserCommands: z.number().int().nonnegative().optional(),
181
179
  /** The most tool calls in flight at once — parallel agents, or one agent fanning out. */
182
180
  peakConcurrentTools: z.number().int().nonnegative().optional(),
183
- /** Calls for a tool name that does not exist. A non-zero value means our surface is confusing. */
181
+ /** Calls for a tool name that does not exist. A non-zero value means the surface is confusing. */
184
182
  unknownToolCalls: z.number().int().nonnegative().optional(),
185
183
  /**
186
184
  * WHICH tools the agent reached for that do not exist, with counts.
187
185
  *
188
- * The count alone said "our surface confused someone" and could never say what they wanted. The
189
- * name is a feature request in the agent's own vocabulary — and it is a NAME, from our own tool
186
+ * The count alone says "the surface confused someone" and can never say what they wanted. The name
187
+ * is a feature request in the agent's own vocabulary — and it is a NAME, from Reticle's own tool
190
188
  * namespace, carrying no app data, so it is safe under the send-names-never-values rule.
191
189
  *
192
190
  * Bounded and truncated: a guess is a short identifier, and anything longer is not one.
@@ -196,10 +194,8 @@ export const SessionSummarySchema = z.object({
196
194
  * Tool calls that failed because there was no app to reach — no session connected, no session by
197
195
  * that id, or several with none named.
198
196
  *
199
- * The single biggest drop-off in the funnel, and it used to be reachable only by unpacking
200
- * `errors[]` in HogQL. 74% of daemons never call a tool at all, and of the sessions that made
201
- * exactly one call, most bounced on precisely this. Absent when it never happened, so the field's
202
- * PRESENCE is the signal.
197
+ * The single biggest drop-off in the funnel, counted here rather than left to be unpacked out of
198
+ * `errors[]` by a query. Absent when it never happened, so the field's PRESENCE is the signal.
203
199
  */
204
200
  noSessionErrors: z.number().int().nonnegative().optional(),
205
201
  /**
@@ -239,9 +235,9 @@ export const SessionSummarySchema = z.object({
239
235
  /**
240
236
  * Client name -> version. The other half of `clients`, and the half that explains regressions.
241
237
  *
242
- * MCP's `clientInfo` carries a name AND a version; we read both at the handshake and kept only
243
- * the name. A product whose users are agents needs to slice every rate by which agent, on which
244
- * build — a single global figure hides the finding entirely.
238
+ * MCP's `clientInfo` carries a name AND a version, and both are read at the handshake. A product
239
+ * whose users are agents needs to slice every rate by which agent, on which build — a single
240
+ * global figure hides the finding entirely.
245
241
  *
246
242
  * NOT the model: `clientInfo` has no concept of one, so the transport genuinely cannot report it.
247
243
  * Agents self-report it on feedback, which is the only mechanism there is.
@@ -249,8 +245,8 @@ export const SessionSummarySchema = z.object({
249
245
  clientVersions: z.record(z.string().max(64), z.string().max(32)).optional(),
250
246
  /**
251
247
  * Which tool surface was live. The 18-tool default and the 48-tool full surface are different
252
- * products from inside an agent's context window, and comparing outcomes across them is how we
253
- * learn whether the trim helps or hurts.
248
+ * products from inside an agent's context window, and comparing outcomes across them is the only
249
+ * way to tell whether the trim helps or hurts.
254
250
  */
255
251
  surface: z.string().max(32).optional(),
256
252
  /**
@@ -258,9 +254,8 @@ export const SessionSummarySchema = z.object({
258
254
  *
259
255
  * Zero here is the single most diagnostic number in the payload: the daemon ran and no app ever
260
256
  * connected, which is a BROKEN INSTALL. Non-zero with no tool calls is the opposite problem — the
261
- * install works and the agent never asked. Before this field those two were the same row, and
262
- * they have opposite fixes. In the field most users who attached an agent never
263
- * drove, and we could not say which case any of them was.
257
+ * install works and the agent never asked. Without this field those two are the same row, and
258
+ * they have opposite fixes.
264
259
  *
265
260
  * A counter rather than an event because the SDK reconnects on every page reload — an event per
266
261
  * connect would be high volume for a question one number answers.
@@ -279,8 +274,8 @@ export const SessionSummarySchema = z.object({
279
274
  * Distinct from `exit`, which says why the PROCESS ended. A daemon can exit tidily on idle while
280
275
  * the agent's work was abandoned mid-task, and those are different findings.
281
276
  *
282
- * In the field most agents that drove an app produced no verdict, and nothing
283
- * could say whether that was a product failure or a task that simply ended.
277
+ * An agent can drive an app and never reach a verdict, and without this nothing could say whether
278
+ * that was a product failure or a task that simply ended.
284
279
  *
285
280
  * Most of this is derivable at query time from `toolCalls` / `verifications` /
286
281
  * `abandonedActions`. The part that is NOT derivable is `client_left` — whether the agent
@@ -291,26 +286,24 @@ export const SessionSummarySchema = z.object({
291
286
  /**
292
287
  * How often Reticle invited the agent to send feedback.
293
288
  *
294
- * The denominator for `feedback_submitted`. A prompt nobody acts on is decoration, and without
295
- * this we could never tell the difference between "agents have nothing to report" and "our
296
- * invitation is invisible". Instrumenting our own nudge is what makes it a designed system
297
- * rather than a hope.
289
+ * The denominator for `feedback_submitted`: without it a low submission count cannot be told
290
+ * apart from an invitation that never appeared.
298
291
  */
299
292
  feedbackPrompted: z.number().int().nonnegative().optional(),
300
293
  /**
301
- * Tool errors bucketed by WHOSE defect they are: `schema` (our grammar failed to explain itself),
302
- * `state` (the world moved), `refusal` (we said no on purpose), `other` (a blind spot).
294
+ * Tool errors bucketed by WHOSE defect they are: `schema` (the grammar failed to explain itself),
295
+ * `state` (the world moved), `refusal` (a deliberate no), `other` (a blind spot).
303
296
  *
304
- * `toolErrors` is one number over three failures with three different fixes. Only the `schema`
305
- * bucket is fixable by writing better descriptions, and it was indistinguishable from the rest.
297
+ * `toolErrors` alone is one number over three failures with three different fixes, and only the
298
+ * `schema` bucket is fixable by writing better descriptions.
306
299
  */
307
300
  errorClasses: z.record(z.string().max(16), z.number().int().nonnegative()).optional(),
308
301
  /**
309
302
  * Errors after which the agent's NEXT call succeeded — the message worked.
310
303
  *
311
- * The best measure of an error message is what the agent does next, and we had the loop
312
- * (`consecutiveRepeats`) and the shape (`errors[]`) but never the join. This is the most
313
- * agent-specific metric in the payload: a human would sigh, a log would show nothing.
304
+ * The best measure of an error message is what the agent does next. `consecutiveRepeats` has the
305
+ * loop and `errors[]` has the shape; this is the join. The most agent-specific metric in the
306
+ * payload: a human would sigh, a log would show nothing.
314
307
  */
315
308
  errorsRecovered: z.number().int().nonnegative().optional(),
316
309
  /** Errors whose very next call failed again — the message did not land. */
@@ -334,9 +327,9 @@ export const SessionSummarySchema = z.object({
334
327
  *
335
328
  * The nudge is the entire adoption mechanism for a published fix — it rides the tool-result
336
329
  * envelope once per daemon process — and it emitted NOTHING, so the one question it exists to
337
- * answer could not be asked. `versionChange.nudged` is the other half and only reaches us from
338
- * machines that DID update; the cohort pinned three releases back never fires `version_changed` at
339
- * all, which is exactly the cohort worth understanding.
330
+ * answer cannot be asked without it. `versionChange.nudged` is the other half and arrives only
331
+ * from machines that DID update; a machine pinned several releases back never fires
332
+ * `version_changed` at all, which is exactly the cohort worth understanding.
340
333
  *
341
334
  * Crossed against this same installId's `version` on a later day it separates the two causes,
342
335
  * which need opposite fixes: `false` for run after run means the nudge is not firing for them (a
@@ -351,7 +344,7 @@ export const SessionSummarySchema = z.object({
351
344
  /**
352
345
  * The newer version this daemon knew about, when it knew about one.
353
346
  *
354
- * OUR OWN published version number, so it is low-cardinality and carries nothing about the
347
+ * Reticle's own published version number, so it is low-cardinality and carries nothing about the
355
348
  * machine. Without it `updateNudged: false` is two facts at once — nothing was available, or
356
349
  * something was and the nudge did not fire — and only the second is a defect.
357
350
  */
@@ -361,10 +354,10 @@ export const SessionSummarySchema = z.object({
361
354
  /**
362
355
  * WHY the daemon exited. Absent on a periodic flush (`final: false`) — nothing exited.
363
356
  *
364
- * Without this, a designed exit and a real failure are the same row. In the field the large
365
- * majority of `mcp_connection_lost` events were `sse_ended` — the stream the daemon closes on its own
366
- * scheduled idle shutdown — so the metric meant to say "the agent lost its tools" was mostly
367
- * counting the daemon going to sleep as designed, and a genuine outage was invisible inside it.
357
+ * Without this, a designed exit and a real failure are the same row. `sse_ended` — the stream the
358
+ * daemon closes on its own scheduled idle shutdown — dominates `mcp_connection_lost`, so a metric
359
+ * meant to say "the agent lost its tools" mostly counts the daemon going to sleep as designed, and
360
+ * a genuine outage is invisible inside it.
368
361
  *
369
362
  * The daemon has always known this (`recordExitReason`); it simply never put it on an event. The
370
363
  * proxy that emits the outage cannot know it — it only sees a socket end — so the join is made
@@ -388,8 +381,8 @@ export const ProjectSize = {
388
381
  * Why a profile carries no `stack`, when it carries none.
389
382
  *
390
383
  * `stack` unknown is one of the largest buckets on the profile, and an empty field is not a cause:
391
- * it collapses "the daemon was started somewhere that is not a project" with "we read this app's
392
- * manifest and did not recognise what it uses", which need opposite fixes — the first is a
384
+ * it collapses "the daemon was started somewhere that is not a project" with "this app's manifest
385
+ * was read and nothing in it was recognised", which need opposite fixes — the first is a
393
386
  * discovery problem, the second is a one-line addition to the dependency table.
394
387
  *
395
388
  * Derived from the branches of `detectStack` rather than computed beside them. A reason assembled
@@ -431,9 +424,8 @@ export const ProjectProfileSchema = z.object({
431
424
  * WHERE the stack was found — and therefore how much to trust the absence of one.
432
425
  *
433
426
  * `cwd` means the daemon was sitting in the app. `workspace` means it was not, and discovery had
434
- * to walk down to find it. The split is the diagnostic: it says how often our inference needs
435
- * help, which is the question that decides whether an agent-correction surface is worth building
436
- * at all.
427
+ * to walk down to find it. The split is the diagnostic: it says how often the inference needs
428
+ * help, which decides whether an agent-correction surface is worth building at all.
437
429
  *
438
430
  * Before discovery existed here, stack was detected on **none of the projects where Reticle was
439
431
  * demonstrably set up**, and none of the large ones either. A detector
@@ -483,7 +475,7 @@ export const ProjectProfileSchema = z.object({
483
475
  *
484
476
  * This is the first of the two bits that split it, and it is on `project_profiled` deliberately:
485
477
  * that event fires once per daemon start whatever happens afterwards, so it is the only place a
486
- * fact about a project reaches us for the users who never instrument anything. `app_instrumented`
478
+ * fact about a project is reported at all for an install that never instruments anything. `app_instrumented`
487
479
  * carries the same field and cannot answer this, because it only exists when the answer is moot.
488
480
  */
489
481
  initialized: z.boolean().optional(),