@reticlehq/core 3.6.0 → 3.8.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 (133) hide show
  1. package/dist/activation-entry.d.ts +9 -0
  2. package/dist/activation-entry.js +9 -0
  3. package/dist/artifacts/artifacts-entry.d.ts +2 -0
  4. package/dist/artifacts/artifacts-entry.js +2 -0
  5. package/dist/artifacts/drive-script.d.ts +222 -116
  6. package/dist/artifacts/drive-script.js +24 -1
  7. package/dist/artifacts/flow-constants.d.ts +33 -0
  8. package/dist/artifacts/flow-constants.js +35 -0
  9. package/dist/artifacts/flow-expect-flat.d.ts +8 -8
  10. package/dist/artifacts/flow-results.d.ts +461 -0
  11. package/dist/artifacts/flow-results.js +1 -0
  12. package/dist/artifacts/flow-types.d.ts +177 -543
  13. package/dist/artifacts/flow-types.js +17 -2
  14. package/dist/artifacts/harness-credits.d.ts +42 -0
  15. package/dist/artifacts/harness-credits.js +72 -0
  16. package/dist/artifacts/harness-map.d.ts +98 -0
  17. package/dist/artifacts/harness-map.js +36 -0
  18. package/dist/artifacts/impact.d.ts +355 -149
  19. package/dist/artifacts/impact.js +84 -49
  20. package/dist/artifacts/journal.d.ts +81 -11
  21. package/dist/artifacts/journal.js +39 -0
  22. package/dist/artifacts/prompt-context.d.ts +12 -0
  23. package/dist/artifacts/prompt-context.js +14 -3
  24. package/dist/artifacts/screenshot-upload.d.ts +51 -0
  25. package/dist/artifacts/screenshot-upload.js +26 -0
  26. package/dist/graph/app-graph.d.ts +137 -0
  27. package/dist/graph/app-graph.js +498 -0
  28. package/dist/hooks/hook-events.d.ts +26 -26
  29. package/dist/hud-entry.d.ts +1 -0
  30. package/dist/hud-entry.js +2 -0
  31. package/dist/identity/checkout.d.ts +41 -0
  32. package/dist/identity/checkout.js +118 -0
  33. package/dist/identity/state-dir.d.ts +23 -0
  34. package/dist/identity/state-dir.js +43 -0
  35. package/dist/index.d.ts +15 -0
  36. package/dist/index.js +15 -0
  37. package/dist/onboarding.d.ts +30 -1
  38. package/dist/onboarding.js +25 -0
  39. package/dist/realm/registry.js +19 -1
  40. package/dist/registry/dev-server-registry.d.ts +2 -2
  41. package/dist/schema/command-message.json +30 -0
  42. package/dist/schema/command-name.json +3 -1
  43. package/dist/schema/event-message.json +3 -1
  44. package/dist/schema/event-payloads.json +156 -3
  45. package/dist/schema/event-type.json +3 -1
  46. package/dist/schema/hello-message.json +21 -0
  47. package/dist/schema/reticle-event.json +3 -1
  48. package/dist/schema/reticle-message.json +54 -1
  49. package/dist/telemetry-bug.d.ts +169 -0
  50. package/dist/telemetry-bug.js +123 -0
  51. package/dist/telemetry-entry.d.ts +2 -1
  52. package/dist/telemetry-entry.js +2 -1
  53. package/dist/telemetry-feedback.d.ts +16 -2
  54. package/dist/telemetry-feedback.js +19 -0
  55. package/dist/telemetry-session.d.ts +91 -2
  56. package/dist/telemetry-session.js +65 -0
  57. package/dist/telemetry-signals.d.ts +557 -0
  58. package/dist/telemetry-signals.js +225 -0
  59. package/dist/telemetry.d.ts +649 -296
  60. package/dist/telemetry.js +110 -119
  61. package/dist/verdict/check-sentence.d.ts +34 -0
  62. package/dist/verdict/check-sentence.js +228 -0
  63. package/dist/verdict/consequence.d.ts +15 -0
  64. package/dist/verdict/consequence.js +11 -0
  65. package/dist/verdict/disparity.d.ts +105 -0
  66. package/dist/verdict/disparity.js +40 -0
  67. package/dist/verdict/findings.d.ts +16 -0
  68. package/dist/verdict/findings.js +22 -0
  69. package/dist/verdict/instrumentation-coverage.d.ts +84 -0
  70. package/dist/verdict/instrumentation-coverage.js +182 -0
  71. package/dist/verdict/instrumentation-gap.d.ts +79 -0
  72. package/dist/verdict/instrumentation-gap.js +65 -1
  73. package/dist/verdict/intent.d.ts +19 -5
  74. package/dist/verdict/intent.js +13 -1
  75. package/dist/verdict/predicate-tree.d.ts +17 -0
  76. package/dist/verdict/predicate-tree.js +37 -0
  77. package/dist/verdict/predicate.d.ts +16 -1
  78. package/dist/verdict/predicate.js +188 -13
  79. package/dist/verdict/property-assertion.d.ts +2 -2
  80. package/dist/verdict/run-report.d.ts +166 -0
  81. package/dist/verdict/run-report.js +53 -0
  82. package/dist/verdict/security.d.ts +60 -1
  83. package/dist/verdict/security.js +174 -12
  84. package/dist/verdict/verification-run.d.ts +713 -68
  85. package/dist/verdict/verification-run.js +113 -0
  86. package/dist/verdict/verify-progress.d.ts +6 -6
  87. package/dist/wire/constants/constants.d.ts +69 -155
  88. package/dist/wire/constants/constants.js +78 -159
  89. package/dist/wire/constants/discovery.d.ts +4 -4
  90. package/dist/wire/constants/discovery.js +4 -4
  91. package/dist/wire/constants/event-types.d.ts +35 -1
  92. package/dist/wire/constants/event-types.js +33 -1
  93. package/dist/wire/constants/hud-controls.js +15 -5
  94. package/dist/wire/constants/hud-use.d.ts +33 -4
  95. package/dist/wire/constants/hud-use.js +30 -4
  96. package/dist/wire/constants/mcp-wire.d.ts +26 -0
  97. package/dist/wire/constants/mcp-wire.js +26 -0
  98. package/dist/wire/constants/response-body-reason.d.ts +19 -0
  99. package/dist/wire/constants/response-body-reason.js +18 -0
  100. package/dist/wire/constants/reticle-chrome.d.ts +19 -0
  101. package/dist/wire/constants/reticle-chrome.js +19 -0
  102. package/dist/wire/constants/reticle-env.d.ts +138 -0
  103. package/dist/wire/constants/reticle-env.js +138 -0
  104. package/dist/wire/constants/session-constants.d.ts +26 -2
  105. package/dist/wire/constants/session-constants.js +26 -2
  106. package/dist/wire/desktop-contract.d.ts +8 -0
  107. package/dist/wire/desktop-contract.js +11 -0
  108. package/dist/wire/event-payloads.d.ts +202 -36
  109. package/dist/wire/event-payloads.js +100 -16
  110. package/dist/wire/messages.d.ts +193 -54
  111. package/dist/wire/messages.js +25 -1
  112. package/dist/wire/narrow.d.ts +6 -0
  113. package/dist/wire/narrow.js +26 -0
  114. package/dist/wire/next-step.d.ts +90 -0
  115. package/dist/wire/next-step.js +37 -0
  116. package/dist/wire/platform-link.d.ts +84 -0
  117. package/dist/wire/platform-link.js +57 -6
  118. package/dist/wire/production/activation-ticket.d.ts +64 -0
  119. package/dist/wire/production/activation-ticket.js +148 -0
  120. package/dist/wire/production/hello-mode.d.ts +35 -0
  121. package/dist/wire/production/hello-mode.js +32 -0
  122. package/dist/wire/production/production-policy.d.ts +138 -0
  123. package/dist/wire/production/production-policy.js +133 -0
  124. package/dist/wire/tool-names.d.ts +4 -0
  125. package/dist/wire/tool-names.js +4 -0
  126. package/dist/wire/types.d.ts +90 -52
  127. package/dist/wire/types.js +5 -0
  128. package/dist/words/notices.d.ts +1 -1
  129. package/dist/words/notices.js +1 -1
  130. package/dist/words/upgrade.js +1 -1
  131. package/dist/words/writing-rule.d.ts +14 -0
  132. package/dist/words/writing-rule.js +17 -0
  133. package/package.json +5 -1
package/dist/telemetry.js CHANGED
@@ -15,18 +15,21 @@
15
15
  * `z.nativeEnum`, timestamps are epoch-ms NUMBERS, no `any`.
16
16
  */
17
17
  import { z } from 'zod';
18
- import { OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, } from './onboarding.js';
18
+ import { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, } from './onboarding.js';
19
19
  /**
20
20
  * The setup funnel's vocabulary. It is defined in `onboarding.ts`, which is its own subject, and
21
21
  * re-exported here so every `@reticlehq/core/telemetry` import reaches it.
22
22
  */
23
- export { OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, };
23
+ export { NextStepOffered, OnboardingPhase, OnboardingStepSchema, OnboardingStepStatus, OnboardingSteps, };
24
24
  import { ToolRefusalSchema } from './telemetry-refusal.js';
25
25
  import { MachineSnapshotSchema, ProjectProfileSchema, SessionSummarySchema, } from './telemetry-session.js';
26
26
  import { BrowserBrand, FeedbackSchema } from './telemetry-feedback.js';
27
27
  import { CaptureLoss, VerifiedReason } from './verdict/verified-constants.js';
28
28
  import { IdentitySchema } from './telemetry-feedback.js';
29
29
  import { LicenseActivation } from './telemetry-license.js';
30
+ import { OutageErrCode, SIGNAL_FIELDS, TRANSPORT_FIELDS } from './telemetry-signals.js';
31
+ import { BugFoundSchema } from './telemetry-bug.js';
32
+ export * from './telemetry-bug.js';
30
33
  /** Bump when the event shape changes so the analytics side can segment old senders. */
31
34
  export const TELEMETRY_EVENT_VERSION = 3;
32
35
  /**
@@ -69,7 +72,7 @@ export const TelemetryEventKind = {
69
72
  * tool never idle-exits, so only idle ones reach a clean shutdown. Emitting a periodic flush under
70
73
  * an exit's name therefore describes active sessions at one end and abandoned ones at the other.
71
74
  *
72
- * Count sessions with DAEMON_STOPPED. Sum work with both.
75
+ * Count daemon runs with DAEMON_STARTED, clean exits with DAEMON_STOPPED. Sum work with both.
73
76
  */
74
77
  SESSION_PROGRESS: 'session_progress',
75
78
  /**
@@ -83,7 +86,10 @@ export const TelemetryEventKind = {
83
86
  * between a retention problem and an activation problem. Once per daemon start, so it is cheap.
84
87
  */
85
88
  PROJECT_PROFILED: 'project_profiled',
86
- /** `reticle update` or `reticle rollback` moved the installed version. Carries from → to. */
89
+ /**
90
+ * A start found a version that differs from the last start on this machine, or `reticle update` /
91
+ * `reticle rollback` moved it. Carries from → to.
92
+ */
87
93
  VERSION_CHANGED: 'version_changed',
88
94
  /** An uncaught exception or unhandled rejection reached the top of the daemon. Crash analytics. */
89
95
  RUNTIME_CRASHED: 'runtime_crashed',
@@ -95,9 +101,10 @@ export const TelemetryEventKind = {
95
101
  */
96
102
  FEEDBACK_SUBMITTED: 'feedback_submitted',
97
103
  /**
98
- * Somebody chose to say who they are. Like `feedback_submitted`, this exists ONLY because a
104
+ * Somebody chose to say who they are. Like `feedback_submitted`, this existed ONLY because a
99
105
  * human ran a command — Reticle never infers an identity from a git remote, an email in git
100
- * config, or anything else. See `identify.ts` for why that refusal is deliberate.
106
+ * config, or anything else. The command that sent it was removed; the kind stays in the
107
+ * vocabulary because older installs still send it.
101
108
  */
102
109
  IDENTIFIED: 'identified',
103
110
  /**
@@ -145,6 +152,17 @@ export const TelemetryEventKind = {
145
152
  * that decides whether this is fixed.
146
153
  */
147
154
  MCP_CONNECTION_LOST: 'mcp_connection_lost',
155
+ /**
156
+ * The MCP proxy process ended. The agent lost its tools until the client starts a new one.
157
+ *
158
+ * `mcp_connection_lost` cannot see this: the stream to the daemon can be healthy when the proxy
159
+ * leaves. Sent even when the proxy has no other counts to report. See `ProxyExitSchema`.
160
+ */
161
+ MCP_PROXY_EXITED: 'mcp_proxy_exited',
162
+ /** A daemon start found the pidfile of a daemon that died without a clean stop. */
163
+ DAEMON_DIED_UNCLEAN: 'daemon_died_unclean',
164
+ /** The proxy found the daemon port held by a stranger or by another project, and did not use it. */
165
+ WAKE_REFUSED: 'wake_refused',
148
166
  /**
149
167
  * `reticle init` finished. The onboarding funnel had no instrumentation at all, so a setup that
150
168
  * failed on a missing dependency was indistinguishable from a user who never tried.
@@ -175,6 +193,14 @@ export const TelemetryEventKind = {
175
193
  * This carries the fact at the moment it happens. See issue #172.
176
194
  */
177
195
  TOOL_REFUSED: 'tool_refused',
196
+ /** A HUD page (or the account menu) opened; deduped per tab. See telemetry-signals.ts. */
197
+ HUD_VIEWED: 'hud_viewed',
198
+ /** The HUD showed a sign-in or link prompt, once per surface per tab. */
199
+ HUD_SIGNIN_PROMPTED: 'hud_signin_prompted',
200
+ /** A project on this machine was linked to a workspace. */
201
+ PLATFORM_LINKED: 'platform_linked',
202
+ /** A Harness run started, or ended: one of each per run. */
203
+ HARNESS_RUN: 'harness_run',
178
204
  };
179
205
  /**
180
206
  * Events that belong to a DAEMON RUN, and therefore carry `sessionId`.
@@ -199,6 +225,9 @@ const SESSION_SCOPED = new Set([
199
225
  TelemetryEventKind.RUNTIME_CRASHED,
200
226
  TelemetryEventKind.FEEDBACK_SUBMITTED,
201
227
  TelemetryEventKind.TOOL_REFUSED,
228
+ TelemetryEventKind.HUD_VIEWED,
229
+ TelemetryEventKind.HUD_SIGNIN_PROMPTED,
230
+ TelemetryEventKind.HARNESS_RUN,
202
231
  ]);
203
232
  /** True when this event happened inside a daemon run, so a `sessionId` on it means something. */
204
233
  export function isSessionScoped(kind) {
@@ -340,6 +369,8 @@ export const VerificationSchema = z.object({
340
369
  * `VerificationDriver`. Absent is the ordinary case and means the agent called the tool itself.
341
370
  */
342
371
  driven: z.nativeEnum(VerificationDriver).optional(),
372
+ /** The page SDK version from its HELLO: our own release number, or `other`. Absent if unsaid. */
373
+ sdkVersion: z.string().min(1).max(32).optional(),
343
374
  });
344
375
  /** Which way the installed version moved, and between which versions. */
345
376
  export const VersionChangeSchema = z.object({
@@ -446,117 +477,6 @@ export const CrashSchema = z.object({
446
477
  */
447
478
  internalFrame: z.string().max(64).optional(),
448
479
  });
449
- /**
450
- * How Reticle came to find a defect. Four routes, in descending order of "a human would have missed
451
- * this": a contradiction is invisible to someone watching the screen, a crawl finding required no
452
- * script at all, a replay failure is a regression on something that used to work, and a failed
453
- * assertion is the agent's own check not holding.
454
- */
455
- export const BugSource = {
456
- /** Channels disagreed — the false green. A passing screen sitting on a failed write. */
457
- CONTRADICTION: 'contradiction',
458
- /** `reticle_crawl` found it autonomously, with nobody writing a test. */
459
- CRAWL: 'crawl',
460
- /** A saved flow that used to pass stopped passing — a regression. */
461
- REPLAY: 'replay',
462
- /** An assertion the agent declared did not hold. */
463
- ASSERTION: 'assertion',
464
- };
465
- /**
466
- * WHOSE fault the defect was.
467
- *
468
- * `bugsFound` is not publishable without this, and a count confidently wrong about whose fault
469
- * something is, is worse than no count: it points at the customer. Two rules keep it honest:
470
- *
471
- * 1. **Always present.** `UNCLASSIFIED` is a value, not a gap. Absence would mean an old sender or a
472
- * path that forgot; a value means the classifier ran and declined.
473
- * 2. **`APP` requires POSITIVE evidence** — something the app itself did: a request that came back
474
- * failed, a signal the app fired carrying data that disagrees with its own screen, a written
475
- * field echoed back changed. Never "nothing else explained it". Core already draws exactly this
476
- * line for the verdict, in `ABSENCE_DERIVED_CONTRADICTIONS`, and that is the line reused rather
477
- * than a second judgement invented beside it.
478
- */
479
- export const BugAttribution = {
480
- /** A defect in the app under test — the only bucket that belongs in a published defect count. */
481
- APP: 'app',
482
- /** The agent's own call was wrong: a path, store or target that never existed. Teach the agent. */
483
- REQUEST: 'request',
484
- /** Reticle could not see or could not drive. Our bug, or our configuration. Ship a fix. */
485
- RETICLE: 'reticle',
486
- /**
487
- * The classifier looked and the evidence could not say.
488
- *
489
- * The honest majority, and it must stay a value rather than becoming a gap: a failed
490
- * `element.present` covers "the button is missing", "the API is down" and "the agent mistyped a
491
- * testid" identically, and an owner invented for it would put a guess into a published number.
492
- * Exclude it from a defect count; never fold it into `app`.
493
- */
494
- UNCLASSIFIED: 'unclassified',
495
- };
496
- /**
497
- * One defect Reticle found in the app under test.
498
- *
499
- * `kind` is the taxonomy value from `findings.ts` — `signal-contradicted`, `console-error`,
500
- * `duplicate-request` and so on. Never a selector, a URL, an element, or any description of the
501
- * user's app — THAT a class of defect was found, never WHAT it was in.
502
- */
503
- export const BugFoundSchema = z.object({
504
- source: z.nativeEnum(BugSource),
505
- /** The classified kind from Reticle's own findings vocabulary. */
506
- kind: z.string().min(1).max(64),
507
- /**
508
- * True when the defect PRESENTED AS SUCCESS — the screen advanced, the assertion passed, the click
509
- * looked fine — while another channel showed it had not.
510
- *
511
- * Defined by the presentation rather than by "an assertion passed", because the same defect arrives
512
- * both ways: through `reticle_assert` there IS a passing assertion to contradict, and through
513
- * `reticle_crawl` there is no assertion at all and the UI simply moved on over a failed write. Both
514
- * are the thing a human watching the screen cannot see, and that is what the flag has to mean if
515
- * the number is going to be published.
516
- *
517
- * The subset worth naming separately, because it is the only category Reticle can claim as uniquely
518
- * its own: every other kind of bug is findable by a careful human or an ordinary test.
519
- */
520
- falseGreen: z.boolean(),
521
- /** Which tool surfaced it. */
522
- tool: z.string().min(1).max(64).optional(),
523
- /**
524
- * TRUE when this KIND was already reported in this session — i.e. this is another INSTANCE of a
525
- * defect already counted, not another defect.
526
- *
527
- * Both numbers are claims, and they are different ones. "Reticle found N defects" is the headline;
528
- * "users hit them M times" is the frequency that says which ones actually cost anybody anything.
529
- * Without this flag the event stream answers only the second while looking like it answers the
530
- * first, so any distinct-defect count read off it is silently inflated — the exact way a published
531
- * number goes wrong. Count `repeat: false` for distinct, count everything for instances.
532
- *
533
- * Scoped to the SESSION, because that is the only identity available: the payload deliberately
534
- * carries no selector, URL or app detail, so the same defect in two sessions cannot be recognised
535
- * as one — and must not be, since that would need data this event refuses to collect.
536
- */
537
- repeat: z.boolean(),
538
- /**
539
- * Whose fault it was, ALWAYS present — `unclassified` when the evidence cannot say, never absent.
540
- *
541
- * Absence and "the evidence could not say" are different facts, and only one of them is a
542
- * measurement. Count `attribution: 'app'` for defects found in anybody's product; see
543
- * `BugAttribution` for why `app` needs positive evidence.
544
- */
545
- attribution: z.nativeEnum(BugAttribution),
546
- /**
547
- * A stable hash identifying THIS defect across sessions — same kind at the same route = same
548
- * fingerprint, regardless of when or where it was found.
549
- *
550
- * The inputs (route, selector) never travel raw — only the 8-char hex hash does, following the
551
- * same privacy pattern as `projectId`. The analytics side groups on it to answer "was this bug
552
- * fixed?" (the fingerprint stops appearing) and to deduplicate the same defect found by parallel
553
- * agents in one run.
554
- *
555
- * OPTIONAL because old senders and the `reticle verify` CLI path do not yet compute it. Absent
556
- * means "not fingerprinted", never "a different defect from one that has a fingerprint".
557
- */
558
- fingerprint: z.string().max(16).optional(),
559
- });
560
480
  /** An MCP client attaching. Separates "installed and running" from "someone is actually using it". */
561
481
  export const McpConnectionSchema = z.object({
562
482
  /** False the first time a client attaches to this daemon; true for every attach after. */
@@ -586,6 +506,8 @@ export const McpConnectionSchema = z.object({
586
506
  * OPTIONAL because an older sender has none. Absent means not measured, never `false`.
587
507
  */
588
508
  appConnected: z.boolean().optional(),
509
+ /** The id of the proxy process that attached. Its outages carry the same id. */
510
+ proxyId: z.string().min(1).max(64).optional(),
589
511
  });
590
512
  /**
591
513
  * `app_instrumented`: an app carrying the SDK reached this daemon for the first time.
@@ -602,6 +524,8 @@ export const AppInstrumentationSchema = z.object({
602
524
  agentAttached: z.boolean(),
603
525
  /** How long the daemon had been up. Large values mean Reticle sat there with nothing wired. */
604
526
  msToFirstApp: z.number().int().nonnegative(),
527
+ /** The first app ever on this machine + project, not just this run. Absent otherwise. */
528
+ firstEver: z.boolean().optional(),
605
529
  });
606
530
  /**
607
531
  * WHICH stage of an MCP outage this is. Reported at most twice per proxy process, and the two are
@@ -647,6 +571,11 @@ export const OutageReason = {
647
571
  SSE_CLOSED: 'sse_closed',
648
572
  /** A reconnect attempt could not reach the daemon at all. */
649
573
  CONNECT_ERROR: 'connect_error',
574
+ /**
575
+ * A stream that was already serving was reset. The request saw the error before the response
576
+ * closed, so this used to read as `connect_error`, which says the daemon was never reached.
577
+ */
578
+ SSE_RESET: 'sse_reset',
650
579
  /** Anything the proxy reported that this list does not name. A classifier must be able to say so. */
651
580
  OTHER: 'other',
652
581
  };
@@ -676,6 +605,12 @@ export const McpOutageSchema = z.object({
676
605
  * worth driving down.
677
606
  */
678
607
  pendingLost: z.number().int().nonnegative().optional(),
608
+ /** The socket error code behind the drop, when the drop came with one. */
609
+ errCode: z.nativeEnum(OutageErrCode).optional(),
610
+ /** The stream got a response before it failed: a live stream dropped, not a refused connect. */
611
+ responded: z.boolean().optional(),
612
+ /** The proxy process. It joins `mcp_client_connected`, which carries the daemon's `sessionId`. */
613
+ proxyId: z.string().min(1).max(64).optional(),
679
614
  });
680
615
  /**
681
616
  * WHICH published route brought this install in.
@@ -704,10 +639,14 @@ export const InstallSource = {
704
639
  NPX_SKILL: 'npx_skill',
705
640
  /** The Claude Code plugin, which sets the marker in the `env` of the MCP server it registers. */
706
641
  PLUGIN: 'plugin',
642
+ /** The one-line installer (install.sh / install.ps1), which declares itself on `setup install`. */
643
+ INSTALL_SCRIPT: 'install_script',
707
644
  /** docs.reticle.sh, whose install snippets carry the marker. */
708
645
  DOCS_SITE: 'docs_site',
709
646
  /** The repository README's install snippet. */
710
647
  README: 'readme',
648
+ /** reticle.sh/blog, whose posts' install snippets carry the marker. */
649
+ BLOG: 'blog',
711
650
  /** Somebody typed the command with no channel in front of it. Only ever self-declared. */
712
651
  CLI_DIRECT: 'cli_direct',
713
652
  /** No marker, or one this list does not name. The honest answer, and expected to dominate. */
@@ -724,8 +663,13 @@ export const AutomationHint = {
724
663
  CONTAINER: 'container',
725
664
  /** A hosted dev environment declared itself (Codespaces, Gitpod, Cloud Shell, dev container). */
726
665
  HOSTED_WORKSPACE: 'hosted_workspace',
727
- /** Neither end of the process is attached to a terminal. The weakest of the three. */
728
- NO_TTY: 'no_tty',
666
+ /**
667
+ * A CI vendor's own variable is set while `CI` is not (some runners and self-hosted agents omit it).
668
+ * `no_tty` used to sit here and read true for every MCP stdio process, so it separated nothing.
669
+ */
670
+ CI_RUNNER: 'ci_runner',
671
+ /** A hosted coding-agent sandbox declared itself (a remote agent session, not a laptop). */
672
+ AGENT_SANDBOX: 'agent_sandbox',
729
673
  };
730
674
  /**
731
675
  * What `init` SAW after it finished writing, when it stayed to look.
@@ -758,6 +702,37 @@ export const InitConfirmation = {
758
702
  */
759
703
  NO_PAGE: 'no_page',
760
704
  };
705
+ /**
706
+ * The step a failed runtime `init` stopped at. It refines `reason` and never replaces it.
707
+ *
708
+ * `dev_server` and `app_connection` each covered several stops with different fixes: no dev script,
709
+ * a busy port, a launcher that exited, a build that never served, a page without the SDK, a page
710
+ * that never dialled. The event could not tell them apart, so no fix could be aimed at the common one.
711
+ */
712
+ export const InitStop = {
713
+ /** The project names no dev, start or serve script, and no `--url` was given. */
714
+ NO_DEV_COMMAND: 'no_dev_command',
715
+ /** Something answers on one loopback address and not the other, on the dev port. */
716
+ SPLIT_LOOPBACK: 'split_loopback',
717
+ /** The dev server said that its port is in use. */
718
+ PORT_BUSY: 'port_busy',
719
+ /** The dev server exited and nothing serves. */
720
+ DEV_SERVER_EXITED: 'dev_server_exited',
721
+ /** The dev server printed no URL and bound no port in the budget. */
722
+ NO_URL: 'no_url',
723
+ /** The dev server announced a URL that did not become ready in the budget. */
724
+ NOT_READY: 'not_ready',
725
+ /** Nothing answered the app URL when the connect wait ended. */
726
+ PAGE_NOT_SERVED: 'page_not_served',
727
+ /** The app URL refused the TLS handshake. */
728
+ PAGE_TLS_REFUSED: 'page_tls_refused',
729
+ /** The page answered, and its HTML does not load the SDK. */
730
+ SDK_MISSING: 'sdk_missing',
731
+ /** The page answered and no session dialled the daemon. */
732
+ NO_SESSION: 'no_session',
733
+ /** A desktop app never dialled the daemon. */
734
+ DESKTOP_NO_SESSION: 'desktop_no_session',
735
+ };
761
736
  /** How `reticle init` went. The onboarding funnel, which had no instrumentation whatsoever. */
762
737
  export const InitOutcomeSchema = z.object({
763
738
  ok: z.boolean(),
@@ -775,6 +750,8 @@ export const InitOutcomeSchema = z.object({
775
750
  * only in an interactive terminal. Absence alone is not evidence of a failed connection.
776
751
  */
777
752
  confirmation: z.nativeEnum(InitConfirmation).optional(),
753
+ /** Only with `reason` `dev_server` or `app_connection`: the step it stopped at. */
754
+ stop: z.nativeEnum(InitStop).optional(),
778
755
  });
779
756
  /**
780
757
  * One anonymous telemetry event. `anonymousId` and the optional hashed `projectId` are the only
@@ -834,6 +811,16 @@ export const TelemetryEventSchema = z.object({
834
811
  * every time-of-day tile from "which continent" into "9am or 11pm".
835
812
  */
836
813
  tzOffsetMin: z.number().int().min(-900).max(900).optional(),
814
+ /**
815
+ * The Reticle team's own run (`RETICLE_INTERNAL=1`, or `~/.reticle/telemetry-internal` present):
816
+ * dogfooding and release sweeps. Absent for everyone else. Filter it OUT of any user count.
817
+ */
818
+ internal: z.boolean().optional(),
819
+ /**
820
+ * `anonymousId` could not be persisted (read-only home, sandbox), so it is new in every process
821
+ * and a distinct count over it counts processes, not people. Absent when the id persisted.
822
+ */
823
+ idEphemeral: z.boolean().optional(),
837
824
  /** Only on `feedback`: the author-submitted report + its environment context. Never sent otherwise. */
838
825
  feedback: FeedbackSchema.optional(),
839
826
  /** Human or agent. Absent on events that are neither (a crash, a version change). */
@@ -909,4 +896,8 @@ export const TelemetryEventSchema = z.object({
909
896
  * A boolean, never the key. The key is a credential and does not leave the machine.
910
897
  */
911
898
  licenseKeyPresent: z.boolean().optional(),
899
+ // Account, workspace, client, launch, and the HUD / link / Harness-run blocks: see that file.
900
+ ...SIGNAL_FIELDS,
901
+ // The proxy-exit, unclean-death and wake-refusal blocks: see telemetry-signals.ts.
902
+ ...TRANSPORT_FIELDS,
912
903
  });
@@ -0,0 +1,34 @@
1
+ import type { Predicate } from './predicate.js';
2
+ /**
3
+ * The check in the failure voice. With `failedPart`, an `allOf` is named by the one part that failed.
4
+ * `assertion` is the verdict's (of that part, for an `allOf`): a body clause that missed on a call
5
+ * that was made reads as that, not as "no request was made".
6
+ */
7
+ export declare function failureSentence(predicate: Predicate, failedPart?: number, assertion?: string): string;
8
+ /**
9
+ * The index of the `allOf` part that failed, read from the per-part results a failed conjunction
10
+ * keeps as its evidence. A part nobody could read is skipped: a real failure outranks it, as in the
11
+ * evaluation. Undefined for a pass, a leaf, an `anyOf` (every part failed) or evidence it cannot read.
12
+ */
13
+ export declare function failedPartOf(predicate: Predicate, evidence: unknown): number | undefined;
14
+ /**
15
+ * The intent fields a recorded check carries: the agent's words, else the sentence built here. Read
16
+ * from the verdict: its evidence names an `allOf`'s failed part, and its assertion says whether a
17
+ * net claim's call was made at all.
18
+ */
19
+ export declare function checkIntent(predicate: Predicate, verdict: {
20
+ readonly evidence?: unknown;
21
+ readonly assertion?: string | undefined;
22
+ }, given?: string): {
23
+ intent: string;
24
+ intentDerived?: true;
25
+ failedPart?: number;
26
+ };
27
+ /** What a claim makes true, as a sentence: "A POST request to /api/login is made". */
28
+ export declare function expectSentence(predicate: Predicate): string;
29
+ /**
30
+ * A journey in one sentence, from what its steps expect, in order: "A POST request to /api/login is
31
+ * made, then the page moves to /home". An expect that only waits for the page to go idle says
32
+ * nothing about the journey and is skipped. Undefined when no step claims anything else.
33
+ */
34
+ export declare function journeySentence(expects: readonly Predicate[]): string | undefined;
@@ -0,0 +1,228 @@
1
+ import { PredicateKind } from './consequence.js';
2
+ /** Joins the parts of a conjunction in one sentence. */
3
+ const PART_GAP = '; ';
4
+ const ALL_OF_LEAD = 'Not all of these happened: ';
5
+ const ANY_OF_LEAD = 'None of these happened: ';
6
+ const SHOULD_NOT = ', and it should not have';
7
+ /**
8
+ * Verdict assertions that mean a call matching the method and url WAS made, and only a body clause
9
+ * missed: the request side (what the UI sent) and the response side (what the server answered).
10
+ */
11
+ const REQUEST_BODY_MISS = new Set([
12
+ 'net.requestBody',
13
+ 'net.requestBodyMatches',
14
+ ]);
15
+ const RESPONSE_BODY_MISS = new Set(['net.bodyContains', 'net.bodyMatches']);
16
+ const capital = (text) => text.charAt(0).toUpperCase() + text.slice(1);
17
+ /** The element a query names, as a noun: 'the button "Pay"', 'the element marked "x"', 'a dialog'. */
18
+ function elementNoun(query) {
19
+ if (query.testid !== undefined)
20
+ return `the element marked "${query.testid}"`;
21
+ const named = query.name ?? query.text ?? query.label ?? query.placeholder ?? query.alt;
22
+ if (query.role !== undefined)
23
+ return named === undefined ? `a ${query.role}` : `the ${query.role} "${named}"`;
24
+ if (named !== undefined)
25
+ return `the element "${named}"`;
26
+ return `an element matching ${JSON.stringify(query)}`;
27
+ }
28
+ /** What a claim is about, as a noun: "a PATCH request to /assignee", 'the text "Saved"'. */
29
+ function noun(predicate) {
30
+ switch (predicate.kind) {
31
+ case PredicateKind.NET:
32
+ return `a ${predicate.method === undefined ? '' : `${predicate.method} `}request${predicate.urlContains === undefined ? '' : ` to ${predicate.urlContains}`}`;
33
+ case PredicateKind.TEXT:
34
+ return `the text "${predicate.contains ?? ''}"`;
35
+ case PredicateKind.SIGNAL:
36
+ return predicate.name === undefined ? 'a signal' : `the app reporting "${predicate.name}"`;
37
+ case PredicateKind.ROUTE:
38
+ return predicate.pathname !== undefined
39
+ ? `a move to ${predicate.pathname}`
40
+ : predicate.contains !== undefined
41
+ ? `a move to an address holding "${predicate.contains}"`
42
+ : 'a route change';
43
+ case PredicateKind.ELEMENT:
44
+ return elementNoun(predicate.query);
45
+ default:
46
+ return `a ${predicate.kind} check`;
47
+ }
48
+ }
49
+ /** A net claim whose call was made: what it did not carry, else undefined. */
50
+ function madeWithout(predicate, assertion) {
51
+ if (PredicateKind.NET !== predicate.kind || assertion === undefined)
52
+ return undefined;
53
+ const made = `${capital(noun(predicate))} was made, but`;
54
+ if (REQUEST_BODY_MISS.has(assertion)) {
55
+ const wanted = predicate.requestBodyMatches ?? predicate.requestBodyContains;
56
+ if (wanted !== undefined)
57
+ return `${made} it did not carry ${JSON.stringify(wanted)}`;
58
+ }
59
+ if (RESPONSE_BODY_MISS.has(assertion)) {
60
+ const wanted = predicate.bodyMatches ?? predicate.bodyContains;
61
+ if (wanted !== undefined)
62
+ return `${made} its answer did not carry ${JSON.stringify(wanted)}`;
63
+ }
64
+ return undefined;
65
+ }
66
+ /** The sentence for a leaf claim that did not come true. */
67
+ function missed(predicate, assertion) {
68
+ switch (predicate.kind) {
69
+ case PredicateKind.NET:
70
+ return (madeWithout(predicate, assertion) ?? `No ${noun(predicate).slice('a '.length)} was made`);
71
+ case PredicateKind.TEXT:
72
+ return true === predicate.absent
73
+ ? `${capital(noun(predicate))} appeared${SHOULD_NOT}`
74
+ : `${capital(noun(predicate))} never appeared`;
75
+ case PredicateKind.SIGNAL:
76
+ return predicate.name === undefined
77
+ ? 'The app reported no signal'
78
+ : `The app never reported "${predicate.name}"`;
79
+ case PredicateKind.ROUTE:
80
+ return predicate.pathname !== undefined
81
+ ? `The page never moved to ${predicate.pathname}`
82
+ : predicate.contains !== undefined
83
+ ? `The address never came to hold "${predicate.contains}"`
84
+ : 'The route never changed';
85
+ case PredicateKind.ELEMENT: {
86
+ const subject = elementNoun(predicate.query);
87
+ if (true === predicate.absent)
88
+ return `${capital(subject)} appeared${SHOULD_NOT}`;
89
+ if (predicate.state !== undefined)
90
+ return `${capital(subject)} was not ${predicate.state}`;
91
+ return subject.startsWith('a ')
92
+ ? `No ${subject.slice('a '.length)} appeared`
93
+ : `${capital(subject)} never appeared`;
94
+ }
95
+ case PredicateKind.STATE:
96
+ return `The app's state at ${predicate.path} was not as the check expected`;
97
+ case PredicateKind.SETTLED:
98
+ return 'The page never went idle';
99
+ case PredicateKind.CONSOLE:
100
+ return true === predicate.absent
101
+ ? `A console message appeared${SHOULD_NOT}`
102
+ : 'No console message appeared';
103
+ case PredicateKind.ANIMATION:
104
+ return predicate.name === undefined
105
+ ? 'No animation ran'
106
+ : `The animation "${predicate.name}" never ran`;
107
+ case PredicateKind.COMPARE:
108
+ return `The ${predicate.left.from} and ${predicate.right.from} readings did not agree`;
109
+ case PredicateKind.NOT:
110
+ return `${capital(noun(predicate.predicate))} happened${SHOULD_NOT}`;
111
+ case PredicateKind.ALL_OF:
112
+ return `${ALL_OF_LEAD}${predicate.predicates.map(noun).join(PART_GAP)}`;
113
+ case PredicateKind.ANY_OF:
114
+ return `${ANY_OF_LEAD}${predicate.predicates.map(noun).join(PART_GAP)}`;
115
+ }
116
+ }
117
+ /**
118
+ * The check in the failure voice. With `failedPart`, an `allOf` is named by the one part that failed.
119
+ * `assertion` is the verdict's (of that part, for an `allOf`): a body clause that missed on a call
120
+ * that was made reads as that, not as "no request was made".
121
+ */
122
+ export function failureSentence(predicate, failedPart, assertion) {
123
+ if (PredicateKind.ALL_OF === predicate.kind && failedPart !== undefined) {
124
+ const part = predicate.predicates[failedPart];
125
+ if (part !== undefined)
126
+ return failureSentence(part, undefined, assertion);
127
+ }
128
+ return missed(predicate, assertion);
129
+ }
130
+ /**
131
+ * The index of the `allOf` part that failed, read from the per-part results a failed conjunction
132
+ * keeps as its evidence. A part nobody could read is skipped: a real failure outranks it, as in the
133
+ * evaluation. Undefined for a pass, a leaf, an `anyOf` (every part failed) or evidence it cannot read.
134
+ */
135
+ export function failedPartOf(predicate, evidence) {
136
+ if (PredicateKind.ALL_OF !== predicate.kind || !Array.isArray(evidence))
137
+ return undefined;
138
+ const index = evidence.findIndex((part) => {
139
+ if ('object' !== typeof part || null === part)
140
+ return false;
141
+ return false === Reflect.get(part, 'pass') && undefined === Reflect.get(part, 'inconclusive');
142
+ });
143
+ return index < 0 ? undefined : index;
144
+ }
145
+ /** The `assertion` a failed `allOf` part kept in the per-part results, if it kept one. */
146
+ function partAssertion(evidence, failedPart) {
147
+ const part = Array.isArray(evidence) ? evidence[failedPart] : undefined;
148
+ if ('object' !== typeof part || null === part)
149
+ return undefined;
150
+ const assertion = Reflect.get(part, 'assertion');
151
+ return 'string' === typeof assertion ? assertion : undefined;
152
+ }
153
+ /**
154
+ * The intent fields a recorded check carries: the agent's words, else the sentence built here. Read
155
+ * from the verdict: its evidence names an `allOf`'s failed part, and its assertion says whether a
156
+ * net claim's call was made at all.
157
+ */
158
+ export function checkIntent(predicate, verdict, given) {
159
+ const { evidence, assertion } = verdict;
160
+ const failedPart = failedPartOf(predicate, evidence);
161
+ const part = failedPart === undefined ? {} : { failedPart };
162
+ if (given !== undefined && 0 < given.trim().length)
163
+ return { intent: given, ...part };
164
+ const asserted = failedPart === undefined ? assertion : partAssertion(evidence, failedPart);
165
+ return {
166
+ intent: failureSentence(predicate, failedPart, asserted),
167
+ intentDerived: true,
168
+ ...part,
169
+ };
170
+ }
171
+ const lower = (text) => text.charAt(0).toLowerCase() + text.slice(1);
172
+ /** What a claim makes true, as a sentence: "A POST request to /api/login is made". */
173
+ export function expectSentence(predicate) {
174
+ switch (predicate.kind) {
175
+ case PredicateKind.NET:
176
+ return `${capital(noun(predicate))} is made`;
177
+ case PredicateKind.TEXT:
178
+ return `${capital(noun(predicate))} ${true === predicate.absent ? 'does not appear' : 'appears'}`;
179
+ case PredicateKind.SIGNAL:
180
+ return predicate.name === undefined
181
+ ? 'The app reports a signal'
182
+ : `The app reports "${predicate.name}"`;
183
+ case PredicateKind.ROUTE:
184
+ return predicate.pathname !== undefined
185
+ ? `The page moves to ${predicate.pathname}`
186
+ : predicate.contains !== undefined
187
+ ? `The address holds "${predicate.contains}"`
188
+ : 'The route changes';
189
+ case PredicateKind.ELEMENT: {
190
+ const subject = capital(elementNoun(predicate.query));
191
+ if (true === predicate.absent)
192
+ return `${subject} does not appear`;
193
+ return predicate.state === undefined
194
+ ? `${subject} appears`
195
+ : `${subject} is ${predicate.state}`;
196
+ }
197
+ case PredicateKind.STATE:
198
+ return `The app's state at ${predicate.path} holds the expected value`;
199
+ case PredicateKind.SETTLED:
200
+ return 'The page goes idle';
201
+ case PredicateKind.NOT:
202
+ return `${capital(noun(predicate.predicate))} does not happen`;
203
+ case PredicateKind.ALL_OF:
204
+ return joined(predicate.predicates, ' and ');
205
+ case PredicateKind.ANY_OF:
206
+ return joined(predicate.predicates, ' or ');
207
+ default:
208
+ return `${capital(noun(predicate))} holds`;
209
+ }
210
+ }
211
+ function joined(predicates, gap) {
212
+ return predicates
213
+ .map((p, i) => (0 === i ? expectSentence(p) : lower(expectSentence(p))))
214
+ .join(gap);
215
+ }
216
+ /** How many claims a journey's sentence names before it stops: a name, not a transcript. */
217
+ const JOURNEY_CLAIMS = 2;
218
+ /**
219
+ * A journey in one sentence, from what its steps expect, in order: "A POST request to /api/login is
220
+ * made, then the page moves to /home". An expect that only waits for the page to go idle says
221
+ * nothing about the journey and is skipped. Undefined when no step claims anything else.
222
+ */
223
+ export function journeySentence(expects) {
224
+ const claims = expects.filter((p) => PredicateKind.SETTLED !== p.kind).slice(0, JOURNEY_CLAIMS);
225
+ if (0 === claims.length)
226
+ return undefined;
227
+ return joined(claims, ', then ');
228
+ }
@@ -33,6 +33,21 @@ export type PresenceKind = (typeof PresenceKind)[keyof typeof PresenceKind];
33
33
  * The remaining kinds are neither consequence nor presence: they observe context (route, console),
34
34
  * timing (animation, settled), or combine other predicates (allOf/anyOf/not).
35
35
  */
36
+ /**
37
+ * What a `settled` check waits on. Absent: the whole page (requests and DOM). `network`: requests
38
+ * only, for a check about requests — a counted `net` claim waits for a late duplicate, and DOM churn
39
+ * from an animation must not hold it open.
40
+ */
41
+ /**
42
+ * What a `settled` waits out. NETWORK: completed requests only. APP: the default's activity plus every
43
+ * framework render commit, for an app whose commits are its work (the default leaves them out: on many
44
+ * pages they are ambient, a clock re-rendering every second, and would never go quiet).
45
+ */
46
+ export declare const SettledChannel: {
47
+ readonly NETWORK: "network";
48
+ readonly APP: "app";
49
+ };
50
+ export type SettledChannel = (typeof SettledChannel)[keyof typeof SettledChannel];
36
51
  export declare const PredicateKind: {
37
52
  readonly ELEMENT: "element";
38
53
  readonly TEXT: "text";