@reticlehq/core 3.5.0 → 3.7.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 (113) hide show
  1. package/dist/artifacts/artifacts-entry.d.ts +4 -0
  2. package/dist/artifacts/artifacts-entry.js +4 -0
  3. package/dist/artifacts/drive-script.d.ts +1404 -0
  4. package/dist/artifacts/drive-script.js +220 -0
  5. package/dist/artifacts/flow-constants.d.ts +19 -0
  6. package/dist/artifacts/flow-constants.js +21 -0
  7. package/dist/artifacts/flow-results.d.ts +450 -0
  8. package/dist/artifacts/flow-results.js +1 -0
  9. package/dist/artifacts/flow-types.d.ts +75 -427
  10. package/dist/artifacts/flow-types.js +15 -2
  11. package/dist/artifacts/harness-credits.d.ts +39 -0
  12. package/dist/artifacts/harness-credits.js +69 -0
  13. package/dist/artifacts/harness-map.d.ts +98 -0
  14. package/dist/artifacts/harness-map.js +36 -0
  15. package/dist/artifacts/hud-notices.d.ts +134 -0
  16. package/dist/artifacts/hud-notices.js +124 -0
  17. package/dist/artifacts/impact.d.ts +489 -189
  18. package/dist/artifacts/impact.js +90 -47
  19. package/dist/artifacts/journal.d.ts +105 -5
  20. package/dist/artifacts/journal.js +41 -0
  21. package/dist/artifacts/prompt-context.d.ts +105 -0
  22. package/dist/artifacts/prompt-context.js +108 -0
  23. package/dist/artifacts/screenshot-upload.d.ts +51 -0
  24. package/dist/artifacts/screenshot-upload.js +26 -0
  25. package/dist/desktop-contract.cjs +1 -0
  26. package/dist/desktop-contract.d.cts +1 -0
  27. package/dist/hooks/hook-events.d.ts +4 -4
  28. package/dist/hud-entry.d.ts +2 -0
  29. package/dist/hud-entry.js +4 -0
  30. package/dist/identity/contract-fingerprint.d.ts +9 -0
  31. package/dist/identity/contract-fingerprint.js +12 -0
  32. package/dist/identity/testid-attribute.d.ts +18 -0
  33. package/dist/identity/testid-attribute.js +24 -0
  34. package/dist/index.d.ts +9 -1
  35. package/dist/index.js +9 -1
  36. package/dist/onboarding.d.ts +10 -2
  37. package/dist/onboarding.js +6 -0
  38. package/dist/realm/registry.js +19 -1
  39. package/dist/schema/command-message.json +36 -0
  40. package/dist/schema/command-name.json +5 -1
  41. package/dist/schema/event-payloads.json +56 -2
  42. package/dist/schema/reticle-message.json +36 -0
  43. package/dist/telemetry-bug.d.ts +169 -0
  44. package/dist/telemetry-bug.js +123 -0
  45. package/dist/telemetry-entry.d.ts +1 -0
  46. package/dist/telemetry-entry.js +1 -0
  47. package/dist/telemetry-feedback.d.ts +2 -2
  48. package/dist/telemetry-refusal.d.ts +5 -4
  49. package/dist/telemetry-session.d.ts +79 -1
  50. package/dist/telemetry-session.js +57 -1
  51. package/dist/telemetry-signals.d.ts +339 -0
  52. package/dist/telemetry-signals.js +138 -0
  53. package/dist/telemetry.d.ts +330 -276
  54. package/dist/telemetry.js +40 -115
  55. package/dist/tour.d.ts +1 -0
  56. package/dist/tour.js +13 -5
  57. package/dist/verdict/consequence.d.ts +3 -0
  58. package/dist/verdict/disparity.d.ts +105 -0
  59. package/dist/verdict/disparity.js +40 -0
  60. package/dist/verdict/findings.d.ts +11 -0
  61. package/dist/verdict/findings.js +16 -0
  62. package/dist/verdict/instrumentation-coverage.d.ts +115 -0
  63. package/dist/verdict/instrumentation-coverage.js +226 -0
  64. package/dist/verdict/instrumentation-gap.js +1 -1
  65. package/dist/verdict/intent.d.ts +19 -5
  66. package/dist/verdict/intent.js +13 -1
  67. package/dist/verdict/predicate-tree.d.ts +15 -0
  68. package/dist/verdict/predicate-tree.js +21 -0
  69. package/dist/verdict/predicate.d.ts +28 -0
  70. package/dist/verdict/predicate.js +94 -15
  71. package/dist/verdict/security.d.ts +25 -0
  72. package/dist/verdict/security.js +82 -0
  73. package/dist/verdict/verdict-attribution.js +1 -0
  74. package/dist/verdict/verification-run.d.ts +638 -32
  75. package/dist/verdict/verification-run.js +90 -0
  76. package/dist/verdict/verified-constants.d.ts +19 -0
  77. package/dist/verdict/verified-constants.js +22 -0
  78. package/dist/wire/constants/constants.d.ts +60 -32
  79. package/dist/wire/constants/constants.js +61 -33
  80. package/dist/wire/constants/hud-controls.d.ts +1 -1
  81. package/dist/wire/constants/hud-controls.js +34 -1
  82. package/dist/wire/constants/hud-use.d.ts +89 -1
  83. package/dist/wire/constants/hud-use.js +62 -1
  84. package/dist/wire/constants/mcp-wire.d.ts +10 -0
  85. package/dist/wire/constants/mcp-wire.js +10 -0
  86. package/dist/wire/constants/reticle-chrome.d.ts +19 -0
  87. package/dist/wire/constants/reticle-chrome.js +19 -0
  88. package/dist/wire/constants/session-constants.d.ts +21 -0
  89. package/dist/wire/constants/session-constants.js +21 -0
  90. package/dist/wire/desktop-contract.d.ts +11 -0
  91. package/dist/wire/desktop-contract.js +14 -0
  92. package/dist/wire/event-payloads.d.ts +77 -4
  93. package/dist/wire/event-payloads.js +27 -0
  94. package/dist/wire/global-press.d.ts +34 -3
  95. package/dist/wire/global-press.js +91 -3
  96. package/dist/wire/hold.d.ts +14 -0
  97. package/dist/wire/hold.js +18 -0
  98. package/dist/wire/messages.d.ts +129 -32
  99. package/dist/wire/messages.js +17 -1
  100. package/dist/wire/platform-link.d.ts +238 -0
  101. package/dist/wire/platform-link.js +234 -0
  102. package/dist/wire/tool-names.d.ts +2 -0
  103. package/dist/wire/tool-names.js +2 -0
  104. package/dist/wire/types.d.ts +26 -6
  105. package/dist/wire/types.js +5 -0
  106. package/dist/words/no-session-reason.d.ts +7 -0
  107. package/dist/words/no-session-reason.js +7 -0
  108. package/dist/words/notices.d.ts +1 -1
  109. package/dist/words/notices.js +5 -3
  110. package/dist/words/upgrade.js +1 -1
  111. package/dist/words/writing-rule.d.ts +14 -0
  112. package/dist/words/writing-rule.js +17 -0
  113. package/package.json +1 -1
package/dist/telemetry.js CHANGED
@@ -27,6 +27,9 @@ 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 { SIGNAL_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
  /**
@@ -95,9 +98,10 @@ export const TelemetryEventKind = {
95
98
  */
96
99
  FEEDBACK_SUBMITTED: 'feedback_submitted',
97
100
  /**
98
- * Somebody chose to say who they are. Like `feedback_submitted`, this exists ONLY because a
101
+ * Somebody chose to say who they are. Like `feedback_submitted`, this existed ONLY because a
99
102
  * 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.
103
+ * config, or anything else. The command that sent it was removed; the kind stays in the
104
+ * vocabulary because older installs still send it.
101
105
  */
102
106
  IDENTIFIED: 'identified',
103
107
  /**
@@ -175,6 +179,14 @@ export const TelemetryEventKind = {
175
179
  * This carries the fact at the moment it happens. See issue #172.
176
180
  */
177
181
  TOOL_REFUSED: 'tool_refused',
182
+ /** A HUD page (or the account menu) opened; deduped per tab. See telemetry-signals.ts. */
183
+ HUD_VIEWED: 'hud_viewed',
184
+ /** The HUD showed a sign-in or link prompt, once per surface per tab. */
185
+ HUD_SIGNIN_PROMPTED: 'hud_signin_prompted',
186
+ /** A project on this machine was linked to a workspace. */
187
+ PLATFORM_LINKED: 'platform_linked',
188
+ /** A Harness run started, or ended: one of each per run. */
189
+ HARNESS_RUN: 'harness_run',
178
190
  };
179
191
  /**
180
192
  * Events that belong to a DAEMON RUN, and therefore carry `sessionId`.
@@ -199,6 +211,9 @@ const SESSION_SCOPED = new Set([
199
211
  TelemetryEventKind.RUNTIME_CRASHED,
200
212
  TelemetryEventKind.FEEDBACK_SUBMITTED,
201
213
  TelemetryEventKind.TOOL_REFUSED,
214
+ TelemetryEventKind.HUD_VIEWED,
215
+ TelemetryEventKind.HUD_SIGNIN_PROMPTED,
216
+ TelemetryEventKind.HARNESS_RUN,
202
217
  ]);
203
218
  /** True when this event happened inside a daemon run, so a `sessionId` on it means something. */
204
219
  export function isSessionScoped(kind) {
@@ -446,117 +461,6 @@ export const CrashSchema = z.object({
446
461
  */
447
462
  internalFrame: z.string().max(64).optional(),
448
463
  });
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
464
  /** An MCP client attaching. Separates "installed and running" from "someone is actually using it". */
561
465
  export const McpConnectionSchema = z.object({
562
466
  /** False the first time a client attaches to this daemon; true for every attach after. */
@@ -602,6 +506,8 @@ export const AppInstrumentationSchema = z.object({
602
506
  agentAttached: z.boolean(),
603
507
  /** How long the daemon had been up. Large values mean Reticle sat there with nothing wired. */
604
508
  msToFirstApp: z.number().int().nonnegative(),
509
+ /** The first app ever on this machine + project, not just this run. Absent otherwise. */
510
+ firstEver: z.boolean().optional(),
605
511
  });
606
512
  /**
607
513
  * WHICH stage of an MCP outage this is. Reported at most twice per proxy process, and the two are
@@ -704,6 +610,8 @@ export const InstallSource = {
704
610
  NPX_SKILL: 'npx_skill',
705
611
  /** The Claude Code plugin, which sets the marker in the `env` of the MCP server it registers. */
706
612
  PLUGIN: 'plugin',
613
+ /** The one-line installer (install.sh / install.ps1), which declares itself on `setup install`. */
614
+ INSTALL_SCRIPT: 'install_script',
707
615
  /** docs.reticle.sh, whose install snippets carry the marker. */
708
616
  DOCS_SITE: 'docs_site',
709
617
  /** The repository README's install snippet. */
@@ -724,8 +632,13 @@ export const AutomationHint = {
724
632
  CONTAINER: 'container',
725
633
  /** A hosted dev environment declared itself (Codespaces, Gitpod, Cloud Shell, dev container). */
726
634
  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',
635
+ /**
636
+ * A CI vendor's own variable is set while `CI` is not (some runners and self-hosted agents omit it).
637
+ * `no_tty` used to sit here and read true for every MCP stdio process, so it separated nothing.
638
+ */
639
+ CI_RUNNER: 'ci_runner',
640
+ /** A hosted coding-agent sandbox declared itself (a remote agent session, not a laptop). */
641
+ AGENT_SANDBOX: 'agent_sandbox',
729
642
  };
730
643
  /**
731
644
  * What `init` SAW after it finished writing, when it stayed to look.
@@ -834,6 +747,16 @@ export const TelemetryEventSchema = z.object({
834
747
  * every time-of-day tile from "which continent" into "9am or 11pm".
835
748
  */
836
749
  tzOffsetMin: z.number().int().min(-900).max(900).optional(),
750
+ /**
751
+ * The Reticle team's own run (`RETICLE_INTERNAL=1`, or `~/.reticle/telemetry-internal` present):
752
+ * dogfooding and release sweeps. Absent for everyone else. Filter it OUT of any user count.
753
+ */
754
+ internal: z.boolean().optional(),
755
+ /**
756
+ * `anonymousId` could not be persisted (read-only home, sandbox), so it is new in every process
757
+ * and a distinct count over it counts processes, not people. Absent when the id persisted.
758
+ */
759
+ idEphemeral: z.boolean().optional(),
837
760
  /** Only on `feedback`: the author-submitted report + its environment context. Never sent otherwise. */
838
761
  feedback: FeedbackSchema.optional(),
839
762
  /** Human or agent. Absent on events that are neither (a crash, a version change). */
@@ -909,4 +832,6 @@ export const TelemetryEventSchema = z.object({
909
832
  * A boolean, never the key. The key is a credential and does not leave the machine.
910
833
  */
911
834
  licenseKeyPresent: z.boolean().optional(),
835
+ // Account, workspace, client, launch, and the HUD / link / Harness-run blocks: see that file.
836
+ ...SIGNAL_FIELDS,
912
837
  });
package/dist/tour.d.ts CHANGED
@@ -39,6 +39,7 @@ export declare const TourAnchor: {
39
39
  readonly APP: "app";
40
40
  /** One control in the HUD's toolbar. Ours, so naming it is not a guess. */
41
41
  readonly HUD_CHAT: "hud-chat";
42
+ readonly HUD_FLOWS: "hud-flows";
42
43
  readonly HUD_ANNOTATE: "hud-annotate";
43
44
  readonly HUD_IMPACT: "hud-impact";
44
45
  readonly HUD_SETTINGS: "hud-settings";
package/dist/tour.js CHANGED
@@ -39,6 +39,7 @@ export const TourAnchor = {
39
39
  APP: 'app',
40
40
  /** One control in the HUD's toolbar. Ours, so naming it is not a guess. */
41
41
  HUD_CHAT: 'hud-chat',
42
+ HUD_FLOWS: 'hud-flows',
42
43
  HUD_ANNOTATE: 'hud-annotate',
43
44
  HUD_IMPACT: 'hud-impact',
44
45
  HUD_SETTINGS: 'hud-settings',
@@ -136,17 +137,24 @@ export const TOUR_STEPS = [
136
137
  export const TOUR_HUD_STEPS = [
137
138
  {
138
139
  id: 'hud-chat',
139
- title: 'Activity Panel',
140
- say: 'Watch what your agent is doing in your app, as it happens.',
140
+ title: 'Agent Log',
141
+ say: 'Watch what your agent is doing in your app, as it happens, and which steps it proved.',
141
142
  anchor: TourAnchor.HUD_CHAT,
142
143
  tryIt: 'Open it.',
143
144
  },
145
+ {
146
+ id: 'hud-flows',
147
+ title: 'Saved flows',
148
+ say: 'Every journey your agent verifies is saved here. Replay one with a click, with no agent in the loop.',
149
+ anchor: TourAnchor.HUD_FLOWS,
150
+ tryIt: 'Open them.',
151
+ },
144
152
  {
145
153
  id: 'hud-annotate',
146
- title: 'Annotate',
147
- say: 'Click anywhere in your app to drop a numbered pin with a note. Hand the pins to your agent and it fixes them.',
154
+ title: 'Notes',
155
+ say: 'Open Notes, then click anywhere in your app to drop a numbered pin with a note. Hand the pins to your agent and it fixes them.',
148
156
  anchor: TourAnchor.HUD_ANNOTATE,
149
- tryIt: 'Turn it on, then click something in your app.',
157
+ tryIt: 'Open Notes, then pin something in your app.',
150
158
  },
151
159
  {
152
160
  id: 'hud-impact',
@@ -87,6 +87,9 @@ export type ExpectedLink = {
87
87
  kind: typeof ConsequenceKind.NET;
88
88
  urlContains: string;
89
89
  status?: number;
90
+ /** The method the clause named, when it named one — a claim about `GET /save` is not a claim
91
+ * about the `POST /save` that is still pending. */
92
+ method?: string;
90
93
  } | {
91
94
  kind: typeof ConsequenceKind.STATE;
92
95
  name: string;
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Two-way testing: one goal, judged by the coding agent and by the Harness, compared.
3
+ *
4
+ * The agent pass answers "does it work?"; the Harness, starting with one sentence and no context,
5
+ * answers "can someone who has never seen it find out how?". The comparison is the product: an agent
6
+ * that proved a goal the Harness could not find is a discoverability finding, not noise and not a
7
+ * defect. Carried on a Harness run's artifact and on the explore tool's answer.
8
+ */
9
+ import { z } from 'zod';
10
+ /** How the two verdicts on one goal compare. */
11
+ export declare const DisparityKind: {
12
+ /** Both proved it: it works, and someone new can find it. */
13
+ readonly FINDABLE: "findable";
14
+ /** The agent proved it; the Harness searched and could not find it. */
15
+ readonly DISCOVERABILITY: "discoverability";
16
+ /** The Harness proved what the agent saw fail: look at the agent's assumption. */
17
+ readonly AGENT_ASSUMPTION: "agent_assumption";
18
+ /** The agent saw it fail and the Harness did not prove it: a defect. */
19
+ readonly DEFECT: "defect";
20
+ };
21
+ export type DisparityKind = (typeof DisparityKind)[keyof typeof DisparityKind];
22
+ /** Where the Harness looked, at most this many places. */
23
+ export declare const MAX_DISPARITY_SEARCHED = 20;
24
+ export declare const RunDisparitySchema: z.ZodObject<{
25
+ /** The goal's text, as the journey quoted it. */
26
+ goal: z.ZodString;
27
+ kind: z.ZodNativeEnum<{
28
+ /** Both proved it: it works, and someone new can find it. */
29
+ readonly FINDABLE: "findable";
30
+ /** The agent proved it; the Harness searched and could not find it. */
31
+ readonly DISCOVERABILITY: "discoverability";
32
+ /** The Harness proved what the agent saw fail: look at the agent's assumption. */
33
+ readonly AGENT_ASSUMPTION: "agent_assumption";
34
+ /** The agent saw it fail and the Harness did not prove it: a defect. */
35
+ readonly DEFECT: "defect";
36
+ }>;
37
+ /** The coding agent's verdict on a claim naming the goal, in the same app. */
38
+ agent: z.ZodObject<{
39
+ verified: z.ZodNativeEnum<{
40
+ readonly YES: "yes";
41
+ readonly NO: "no";
42
+ readonly UNKNOWN: "unknown";
43
+ readonly NO_FAULT: "no-fault";
44
+ }>;
45
+ claim: z.ZodString;
46
+ }, "strip", z.ZodTypeAny, {
47
+ verified: "yes" | "no" | "unknown" | "no-fault";
48
+ claim: string;
49
+ }, {
50
+ verified: "yes" | "no" | "unknown" | "no-fault";
51
+ claim: string;
52
+ }>;
53
+ /** The Harness's verdict, and the hunt behind it. */
54
+ harness: z.ZodObject<{
55
+ verified: z.ZodNativeEnum<{
56
+ readonly YES: "yes";
57
+ readonly NO: "no";
58
+ readonly UNKNOWN: "unknown";
59
+ readonly NO_FAULT: "no-fault";
60
+ }>;
61
+ /** Whether its search found the goal on a page at all. */
62
+ found: z.ZodBoolean;
63
+ /** The places it searched, in order: the path a newcomer would take. */
64
+ searched: z.ZodArray<z.ZodString, "many">;
65
+ /** The last place it looked before giving up, when it did. */
66
+ gaveUpAt: z.ZodOptional<z.ZodString>;
67
+ }, "strip", z.ZodTypeAny, {
68
+ verified: "yes" | "no" | "unknown" | "no-fault";
69
+ found: boolean;
70
+ searched: string[];
71
+ gaveUpAt?: string | undefined;
72
+ }, {
73
+ verified: "yes" | "no" | "unknown" | "no-fault";
74
+ found: boolean;
75
+ searched: string[];
76
+ gaveUpAt?: string | undefined;
77
+ }>;
78
+ }, "strip", z.ZodTypeAny, {
79
+ kind: "findable" | "discoverability" | "agent_assumption" | "defect";
80
+ goal: string;
81
+ agent: {
82
+ verified: "yes" | "no" | "unknown" | "no-fault";
83
+ claim: string;
84
+ };
85
+ harness: {
86
+ verified: "yes" | "no" | "unknown" | "no-fault";
87
+ found: boolean;
88
+ searched: string[];
89
+ gaveUpAt?: string | undefined;
90
+ };
91
+ }, {
92
+ kind: "findable" | "discoverability" | "agent_assumption" | "defect";
93
+ goal: string;
94
+ agent: {
95
+ verified: "yes" | "no" | "unknown" | "no-fault";
96
+ claim: string;
97
+ };
98
+ harness: {
99
+ verified: "yes" | "no" | "unknown" | "no-fault";
100
+ found: boolean;
101
+ searched: string[];
102
+ gaveUpAt?: string | undefined;
103
+ };
104
+ }>;
105
+ export type RunDisparity = z.infer<typeof RunDisparitySchema>;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Two-way testing: one goal, judged by the coding agent and by the Harness, compared.
3
+ *
4
+ * The agent pass answers "does it work?"; the Harness, starting with one sentence and no context,
5
+ * answers "can someone who has never seen it find out how?". The comparison is the product: an agent
6
+ * that proved a goal the Harness could not find is a discoverability finding, not noise and not a
7
+ * defect. Carried on a Harness run's artifact and on the explore tool's answer.
8
+ */
9
+ import { z } from 'zod';
10
+ import { Verified } from './verified-constants.js';
11
+ /** How the two verdicts on one goal compare. */
12
+ export const DisparityKind = {
13
+ /** Both proved it: it works, and someone new can find it. */
14
+ FINDABLE: 'findable',
15
+ /** The agent proved it; the Harness searched and could not find it. */
16
+ DISCOVERABILITY: 'discoverability',
17
+ /** The Harness proved what the agent saw fail: look at the agent's assumption. */
18
+ AGENT_ASSUMPTION: 'agent_assumption',
19
+ /** The agent saw it fail and the Harness did not prove it: a defect. */
20
+ DEFECT: 'defect',
21
+ };
22
+ /** Where the Harness looked, at most this many places. */
23
+ export const MAX_DISPARITY_SEARCHED = 20;
24
+ export const RunDisparitySchema = z.object({
25
+ /** The goal's text, as the journey quoted it. */
26
+ goal: z.string().min(1).max(500),
27
+ kind: z.nativeEnum(DisparityKind),
28
+ /** The coding agent's verdict on a claim naming the goal, in the same app. */
29
+ agent: z.object({ verified: z.nativeEnum(Verified), claim: z.string().max(2000) }),
30
+ /** The Harness's verdict, and the hunt behind it. */
31
+ harness: z.object({
32
+ verified: z.nativeEnum(Verified),
33
+ /** Whether its search found the goal on a page at all. */
34
+ found: z.boolean(),
35
+ /** The places it searched, in order: the path a newcomer would take. */
36
+ searched: z.array(z.string().max(500)).max(MAX_DISPARITY_SEARCHED),
37
+ /** The last place it looked before giving up, when it did. */
38
+ gaveUpAt: z.string().max(500).optional(),
39
+ }),
40
+ });
@@ -93,6 +93,12 @@ export declare const ContradictionKind: {
93
93
  * -- a burst on an endpoint the assertion DID name -- keeps its downgrade.
94
94
  */
95
95
  readonly DUPLICATE_REQUEST_UNRELATED: "duplicate-request-unrelated";
96
+ /**
97
+ * A request carried a value for a field whose control on screen shows a different chosen value
98
+ * (UI "Workspace default", request `projectId: "bench-app"`). ADVISORY and opt-in: a fact worth a
99
+ * look, never a verdict on its own.
100
+ */
101
+ readonly SCREEN_REQUEST_MISMATCH: "screen-request-mismatch";
96
102
  /**
97
103
  * Two reads of the same endpoint were in flight together and settled OUT OF ORDER, so the one the
98
104
  * user asked for first is the one that landed last — and the screen is showing it.
@@ -124,6 +130,11 @@ export declare const ContradictionKind: {
124
130
  * exactly the number on the screen, so every other channel agrees it is correct.
125
131
  */
126
132
  readonly UNIT_MISMATCH: "unit-mismatch";
133
+ /**
134
+ * The page label moved ("Page 2") while the app re-requested the page it already had (`page=1`):
135
+ * everything past the first page is unreachable, and every channel on its own looks healthy.
136
+ */
137
+ readonly PAGINATION_NOT_FETCHED: "pagination-not-fetched";
127
138
  /**
128
139
  * A write returned success and its OWN echo shows a field it was asked to set was not applied.
129
140
  *
@@ -62,6 +62,12 @@ export const ContradictionKind = {
62
62
  * -- a burst on an endpoint the assertion DID name -- keeps its downgrade.
63
63
  */
64
64
  DUPLICATE_REQUEST_UNRELATED: 'duplicate-request-unrelated',
65
+ /**
66
+ * A request carried a value for a field whose control on screen shows a different chosen value
67
+ * (UI "Workspace default", request `projectId: "bench-app"`). ADVISORY and opt-in: a fact worth a
68
+ * look, never a verdict on its own.
69
+ */
70
+ SCREEN_REQUEST_MISMATCH: 'screen-request-mismatch',
65
71
  /**
66
72
  * Two reads of the same endpoint were in flight together and settled OUT OF ORDER, so the one the
67
73
  * user asked for first is the one that landed last — and the screen is showing it.
@@ -93,6 +99,11 @@ export const ContradictionKind = {
93
99
  * exactly the number on the screen, so every other channel agrees it is correct.
94
100
  */
95
101
  UNIT_MISMATCH: 'unit-mismatch',
102
+ /**
103
+ * The page label moved ("Page 2") while the app re-requested the page it already had (`page=1`):
104
+ * everything past the first page is unreachable, and every channel on its own looks healthy.
105
+ */
106
+ PAGINATION_NOT_FETCHED: 'pagination-not-fetched',
96
107
  /**
97
108
  * A write returned success and its OWN echo shows a field it was asked to set was not applied.
98
109
  *
@@ -273,6 +284,7 @@ export function isAbsenceDerived(kind) {
273
284
  */
274
285
  export const ADVISORY_CONTRADICTIONS = new Set([
275
286
  ContradictionKind.DUPLICATE_REQUEST_UNRELATED,
287
+ ContradictionKind.SCREEN_REQUEST_MISMATCH,
276
288
  ]);
277
289
  /** True when this kind is reported alongside a verdict without changing it. */
278
290
  export function isAdvisory(kind) {
@@ -353,11 +365,15 @@ export const CONTRADICTION_CHANNELS = {
353
365
  [ContradictionKind.CONSEQUENCE_ELSEWHERE]: [ChannelId.NET, ChannelId.UI],
354
366
  [ContradictionKind.DUPLICATE_REQUEST]: [ChannelId.NET, ChannelId.NET],
355
367
  [ContradictionKind.DUPLICATE_REQUEST_UNRELATED]: [ChannelId.NET, ChannelId.NET],
368
+ // The value a control shows against the value the request carried for the same field.
369
+ [ContradictionKind.SCREEN_REQUEST_MISMATCH]: [ChannelId.UI, ChannelId.NET],
356
370
  // The evidence is the interleaving of two responses, read against what the screen ended up showing.
357
371
  [ContradictionKind.STALE_RESPONSE_APPLIED]: [ChannelId.NET, ChannelId.UI],
358
372
  // Both sides are the server's own answer: the status line and the payload under it.
359
373
  [ContradictionKind.PARTIAL_FAILURE_IN_OK_RESPONSE]: [ChannelId.NET, ChannelId.NET],
360
374
  [ContradictionKind.UNIT_MISMATCH]: [ChannelId.UI, ChannelId.NET],
375
+ // The label the UI shows against the query string it sent.
376
+ [ContradictionKind.PAGINATION_NOT_FETCHED]: [ChannelId.UI, ChannelId.NET],
361
377
  // What was sent against what came back -- the request and its echo, neither derived from the click.
362
378
  [ContradictionKind.WRITE_FIELD_IGNORED]: [ChannelId.NET, ChannelId.NET],
363
379
  [ContradictionKind.REQUEST_NEVER_SETTLED]: [ChannelId.TIME, ChannelId.NET],
@@ -0,0 +1,115 @@
1
+ /**
2
+ * How much of an app Reticle can see, and the prompt that asks a coding agent to close the rest.
3
+ *
4
+ * Built only from what a page announced (its HELLO channels, plus the `source` / `testid` markers in
5
+ * the same list) and the gaps its verdicts actually recorded, never from a survey of the page: the
6
+ * rule `instrumentation-gap.ts` keeps. The platform derives the same three states from the same
7
+ * report, so the HUD, `doctor` and the dashboard agree:
8
+ *
9
+ * missing a verdict recorded the gap that names it (or a channel every SDK has is absent);
10
+ * a gap about one control does not outrank its channel seen elsewhere
11
+ * seen its channel or marker was announced
12
+ * not seen yet neither — never counted as covered
13
+ */
14
+ import { z } from 'zod';
15
+ /** The eight things that decide how strong a verdict on this app can be. */
16
+ export declare const CoverageCapability: {
17
+ readonly PAGE_CONNECTED: "page connected";
18
+ readonly DOM_ACTIONS: "DOM actions";
19
+ readonly NETWORK: "network";
20
+ readonly CONSOLE: "console";
21
+ readonly APP_STATE: "app state (store registered)";
22
+ readonly SIGNALS: "signals on mutation";
23
+ readonly SOURCE_MAPPING: "file:line source mapping";
24
+ readonly TEST_IDS: "stable test ids";
25
+ };
26
+ export type CoverageCapability = (typeof CoverageCapability)[keyof typeof CoverageCapability];
27
+ /** A recorded gap, as loosely as the daemon and the platform report carry it. */
28
+ export interface CoverageGap {
29
+ kind: string;
30
+ missing?: string;
31
+ cost?: string;
32
+ fix?: string;
33
+ /** The control the gap is about, when it names one. */
34
+ ref?: string;
35
+ /** `file:line`, when the gap carries one. */
36
+ source?: string;
37
+ }
38
+ export interface MissingCapability {
39
+ capability: CoverageCapability;
40
+ cost: string;
41
+ fix: string;
42
+ }
43
+ export interface Coverage {
44
+ seen: CoverageCapability[];
45
+ missing: MissingCapability[];
46
+ /** Neither seen nor reported missing: never counted as covered. */
47
+ notSeenYet: CoverageCapability[];
48
+ total: number;
49
+ covered: number;
50
+ }
51
+ /** What a page with these channels and these recorded gaps lets Reticle see. Pure. */
52
+ export declare function coverageOf(input: {
53
+ channels: readonly string[];
54
+ gaps: readonly CoverageGap[];
55
+ }): Coverage;
56
+ /**
57
+ * The gaps that would close these capabilities: the ones verdicts recorded (they name the control
58
+ * and file), else the capability's own fix, so a capability never checked is still named. Pure.
59
+ */
60
+ export declare function gapsToClose(gaps: readonly CoverageGap[], capabilities: readonly CoverageCapability[]): CoverageGap[];
61
+ /** The first line of every coverage prompt. */
62
+ export declare const AGENT_PROMPT_LEAD = "Read https://reticle.sh/SKILL.md, then improve Reticle's coverage in this repo:";
63
+ /** The last line: what the agent hands back. */
64
+ export declare const AGENT_PROMPT_TAIL = "Report the coverage line it prints.";
65
+ /**
66
+ * The copy-paste prompt for a coding agent: only the gaps verdicts recorded, each with its fix and
67
+ * what it is missing (and the control or file, when the gap names one), then the verify that proves
68
+ * the change. The same text the platform builds from the same report. Pure.
69
+ */
70
+ export declare function agentPromptFor(input: {
71
+ gaps: readonly CoverageGap[];
72
+ appName: string;
73
+ url: string;
74
+ }): string;
75
+ /** The capabilities an app reports as not applying to it, on the wire. Closed: core's eight only. */
76
+ export declare const NotApplicableSchema: z.ZodArray<z.ZodNativeEnum<{
77
+ readonly PAGE_CONNECTED: "page connected";
78
+ readonly DOM_ACTIONS: "DOM actions";
79
+ readonly NETWORK: "network";
80
+ readonly CONSOLE: "console";
81
+ readonly APP_STATE: "app state (store registered)";
82
+ readonly SIGNALS: "signals on mutation";
83
+ readonly SOURCE_MAPPING: "file:line source mapping";
84
+ readonly TEST_IDS: "stable test ids";
85
+ }>, "many">;
86
+ /** The score at which the Harness unlocks. */
87
+ export declare const HARNESS_UNLOCK_COVERAGE = 0.8;
88
+ /** Seen ÷ applicable over the eight capabilities. See the header for the exact rule. */
89
+ export declare function coverageScore(coverage: Pick<Coverage, 'seen'>, notApplicable?: readonly CoverageCapability[]): number;
90
+ export interface HarnessGate {
91
+ /** seen ÷ applicable, 0..1. */
92
+ score: number;
93
+ /** floor(score × 100). */
94
+ percent: number;
95
+ unlocked: boolean;
96
+ /** The applicable capabilities not seen, in the order a reader climbs them. */
97
+ unseen: CoverageCapability[];
98
+ /** The one sentence a refusal says. Absent when unlocked. */
99
+ reason?: string;
100
+ }
101
+ /** The one sentence a locked Harness answers with. */
102
+ export declare const harnessLockedReason: (percent: number, unseen: readonly string[]) => string;
103
+ /** Whether the Harness may drive an app with this coverage, and the sentence when it may not. */
104
+ export declare function harnessGateOf(coverage: Pick<Coverage, 'seen'>, notApplicable?: readonly CoverageCapability[]): HarnessGate;
105
+ /**
106
+ * The prompt for the coding agent that closes the gate: each unseen capability with how to close it
107
+ * (the control and file when a verdict named one), then the one flow that proves it. Pure.
108
+ */
109
+ export declare function harnessUnlockPrompt(input: {
110
+ coverage: Pick<Coverage, 'seen'>;
111
+ gaps: readonly CoverageGap[];
112
+ appName: string;
113
+ url: string;
114
+ notApplicable?: readonly CoverageCapability[];
115
+ }): string;