@reticlehq/core 3.7.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 (108) hide show
  1. package/dist/activation-entry.d.ts +9 -0
  2. package/dist/activation-entry.js +9 -0
  3. package/dist/artifacts/drive-script.d.ts +64 -64
  4. package/dist/artifacts/flow-constants.d.ts +15 -0
  5. package/dist/artifacts/flow-constants.js +15 -0
  6. package/dist/artifacts/flow-expect-flat.d.ts +8 -8
  7. package/dist/artifacts/flow-results.d.ts +11 -0
  8. package/dist/artifacts/flow-types.d.ts +164 -118
  9. package/dist/artifacts/flow-types.js +12 -0
  10. package/dist/artifacts/harness-credits.d.ts +6 -3
  11. package/dist/artifacts/harness-credits.js +9 -6
  12. package/dist/artifacts/harness-map.d.ts +6 -6
  13. package/dist/artifacts/impact.d.ts +77 -80
  14. package/dist/artifacts/impact.js +34 -17
  15. package/dist/artifacts/journal.d.ts +25 -6
  16. package/dist/artifacts/journal.js +13 -0
  17. package/dist/artifacts/prompt-context.d.ts +12 -0
  18. package/dist/artifacts/prompt-context.js +14 -3
  19. package/dist/graph/app-graph.d.ts +137 -0
  20. package/dist/graph/app-graph.js +498 -0
  21. package/dist/hooks/hook-events.d.ts +22 -22
  22. package/dist/hud-entry.js +1 -1
  23. package/dist/identity/checkout.d.ts +41 -0
  24. package/dist/identity/checkout.js +118 -0
  25. package/dist/identity/state-dir.d.ts +23 -0
  26. package/dist/identity/state-dir.js +43 -0
  27. package/dist/index.d.ts +10 -0
  28. package/dist/index.js +10 -0
  29. package/dist/onboarding.d.ts +22 -1
  30. package/dist/onboarding.js +19 -0
  31. package/dist/registry/dev-server-registry.d.ts +2 -2
  32. package/dist/schema/event-message.json +3 -1
  33. package/dist/schema/event-payloads.json +116 -1
  34. package/dist/schema/event-type.json +3 -1
  35. package/dist/schema/hello-message.json +21 -0
  36. package/dist/schema/reticle-event.json +3 -1
  37. package/dist/schema/reticle-message.json +24 -1
  38. package/dist/telemetry-bug.d.ts +6 -6
  39. package/dist/telemetry-entry.d.ts +1 -1
  40. package/dist/telemetry-entry.js +1 -1
  41. package/dist/telemetry-feedback.d.ts +14 -0
  42. package/dist/telemetry-feedback.js +19 -0
  43. package/dist/telemetry-refusal.d.ts +2 -2
  44. package/dist/telemetry-session.d.ts +23 -8
  45. package/dist/telemetry-session.js +15 -4
  46. package/dist/telemetry-signals.d.ts +227 -9
  47. package/dist/telemetry-signals.js +88 -1
  48. package/dist/telemetry.d.ts +379 -72
  49. package/dist/telemetry.js +71 -5
  50. package/dist/verdict/check-sentence.d.ts +34 -0
  51. package/dist/verdict/check-sentence.js +228 -0
  52. package/dist/verdict/consequence.d.ts +15 -0
  53. package/dist/verdict/consequence.js +11 -0
  54. package/dist/verdict/findings.d.ts +10 -0
  55. package/dist/verdict/findings.js +13 -0
  56. package/dist/verdict/instrumentation-coverage.d.ts +3 -34
  57. package/dist/verdict/instrumentation-coverage.js +14 -58
  58. package/dist/verdict/instrumentation-gap.d.ts +79 -0
  59. package/dist/verdict/instrumentation-gap.js +64 -0
  60. package/dist/verdict/predicate-tree.d.ts +2 -0
  61. package/dist/verdict/predicate-tree.js +16 -0
  62. package/dist/verdict/predicate.d.ts +2 -1
  63. package/dist/verdict/predicate.js +103 -12
  64. package/dist/verdict/property-assertion.d.ts +2 -2
  65. package/dist/verdict/run-report.d.ts +166 -0
  66. package/dist/verdict/run-report.js +53 -0
  67. package/dist/verdict/security.d.ts +36 -2
  68. package/dist/verdict/security.js +94 -14
  69. package/dist/verdict/verification-run.d.ts +95 -38
  70. package/dist/verdict/verification-run.js +33 -2
  71. package/dist/verdict/verify-progress.d.ts +6 -6
  72. package/dist/wire/constants/constants.d.ts +56 -141
  73. package/dist/wire/constants/constants.js +64 -144
  74. package/dist/wire/constants/discovery.d.ts +4 -4
  75. package/dist/wire/constants/discovery.js +4 -4
  76. package/dist/wire/constants/event-types.d.ts +35 -1
  77. package/dist/wire/constants/event-types.js +33 -1
  78. package/dist/wire/constants/hud-controls.js +0 -2
  79. package/dist/wire/constants/hud-use.d.ts +4 -0
  80. package/dist/wire/constants/hud-use.js +4 -0
  81. package/dist/wire/constants/mcp-wire.d.ts +16 -0
  82. package/dist/wire/constants/mcp-wire.js +16 -0
  83. package/dist/wire/constants/response-body-reason.d.ts +19 -0
  84. package/dist/wire/constants/response-body-reason.js +18 -0
  85. package/dist/wire/constants/reticle-env.d.ts +138 -0
  86. package/dist/wire/constants/reticle-env.js +138 -0
  87. package/dist/wire/constants/session-constants.d.ts +11 -0
  88. package/dist/wire/constants/session-constants.js +11 -0
  89. package/dist/wire/event-payloads.d.ts +150 -36
  90. package/dist/wire/event-payloads.js +83 -16
  91. package/dist/wire/messages.d.ts +102 -36
  92. package/dist/wire/messages.js +16 -0
  93. package/dist/wire/narrow.d.ts +6 -0
  94. package/dist/wire/narrow.js +26 -0
  95. package/dist/wire/next-step.d.ts +90 -0
  96. package/dist/wire/next-step.js +37 -0
  97. package/dist/wire/platform-link.d.ts +7 -0
  98. package/dist/wire/platform-link.js +12 -6
  99. package/dist/wire/production/activation-ticket.d.ts +64 -0
  100. package/dist/wire/production/activation-ticket.js +148 -0
  101. package/dist/wire/production/hello-mode.d.ts +35 -0
  102. package/dist/wire/production/hello-mode.js +32 -0
  103. package/dist/wire/production/production-policy.d.ts +138 -0
  104. package/dist/wire/production/production-policy.js +133 -0
  105. package/dist/wire/tool-names.d.ts +2 -0
  106. package/dist/wire/tool-names.js +2 -0
  107. package/dist/wire/types.d.ts +73 -48
  108. package/package.json +5 -1
package/dist/telemetry.js CHANGED
@@ -15,19 +15,19 @@
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 { SIGNAL_FIELDS } from './telemetry-signals.js';
30
+ import { OutageErrCode, SIGNAL_FIELDS, TRANSPORT_FIELDS } from './telemetry-signals.js';
31
31
  import { BugFoundSchema } from './telemetry-bug.js';
32
32
  export * from './telemetry-bug.js';
33
33
  /** Bump when the event shape changes so the analytics side can segment old senders. */
@@ -72,7 +72,7 @@ export const TelemetryEventKind = {
72
72
  * tool never idle-exits, so only idle ones reach a clean shutdown. Emitting a periodic flush under
73
73
  * an exit's name therefore describes active sessions at one end and abandoned ones at the other.
74
74
  *
75
- * 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.
76
76
  */
77
77
  SESSION_PROGRESS: 'session_progress',
78
78
  /**
@@ -86,7 +86,10 @@ export const TelemetryEventKind = {
86
86
  * between a retention problem and an activation problem. Once per daemon start, so it is cheap.
87
87
  */
88
88
  PROJECT_PROFILED: 'project_profiled',
89
- /** `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
+ */
90
93
  VERSION_CHANGED: 'version_changed',
91
94
  /** An uncaught exception or unhandled rejection reached the top of the daemon. Crash analytics. */
92
95
  RUNTIME_CRASHED: 'runtime_crashed',
@@ -149,6 +152,17 @@ export const TelemetryEventKind = {
149
152
  * that decides whether this is fixed.
150
153
  */
151
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',
152
166
  /**
153
167
  * `reticle init` finished. The onboarding funnel had no instrumentation at all, so a setup that
154
168
  * failed on a missing dependency was indistinguishable from a user who never tried.
@@ -355,6 +369,8 @@ export const VerificationSchema = z.object({
355
369
  * `VerificationDriver`. Absent is the ordinary case and means the agent called the tool itself.
356
370
  */
357
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(),
358
374
  });
359
375
  /** Which way the installed version moved, and between which versions. */
360
376
  export const VersionChangeSchema = z.object({
@@ -490,6 +506,8 @@ export const McpConnectionSchema = z.object({
490
506
  * OPTIONAL because an older sender has none. Absent means not measured, never `false`.
491
507
  */
492
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(),
493
511
  });
494
512
  /**
495
513
  * `app_instrumented`: an app carrying the SDK reached this daemon for the first time.
@@ -553,6 +571,11 @@ export const OutageReason = {
553
571
  SSE_CLOSED: 'sse_closed',
554
572
  /** A reconnect attempt could not reach the daemon at all. */
555
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',
556
579
  /** Anything the proxy reported that this list does not name. A classifier must be able to say so. */
557
580
  OTHER: 'other',
558
581
  };
@@ -582,6 +605,12 @@ export const McpOutageSchema = z.object({
582
605
  * worth driving down.
583
606
  */
584
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(),
585
614
  });
586
615
  /**
587
616
  * WHICH published route brought this install in.
@@ -616,6 +645,8 @@ export const InstallSource = {
616
645
  DOCS_SITE: 'docs_site',
617
646
  /** The repository README's install snippet. */
618
647
  README: 'readme',
648
+ /** reticle.sh/blog, whose posts' install snippets carry the marker. */
649
+ BLOG: 'blog',
619
650
  /** Somebody typed the command with no channel in front of it. Only ever self-declared. */
620
651
  CLI_DIRECT: 'cli_direct',
621
652
  /** No marker, or one this list does not name. The honest answer, and expected to dominate. */
@@ -671,6 +702,37 @@ export const InitConfirmation = {
671
702
  */
672
703
  NO_PAGE: 'no_page',
673
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
+ };
674
736
  /** How `reticle init` went. The onboarding funnel, which had no instrumentation whatsoever. */
675
737
  export const InitOutcomeSchema = z.object({
676
738
  ok: z.boolean(),
@@ -688,6 +750,8 @@ export const InitOutcomeSchema = z.object({
688
750
  * only in an interactive terminal. Absence alone is not evidence of a failed connection.
689
751
  */
690
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(),
691
755
  });
692
756
  /**
693
757
  * One anonymous telemetry event. `anonymousId` and the optional hashed `projectId` are the only
@@ -834,4 +898,6 @@ export const TelemetryEventSchema = z.object({
834
898
  licenseKeyPresent: z.boolean().optional(),
835
899
  // Account, workspace, client, launch, and the HUD / link / Harness-run blocks: see that file.
836
900
  ...SIGNAL_FIELDS,
901
+ // The proxy-exit, unclean-death and wake-refusal blocks: see telemetry-signals.ts.
902
+ ...TRANSPORT_FIELDS,
837
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";
@@ -31,6 +31,17 @@ export const PresenceKind = {
31
31
  * The remaining kinds are neither consequence nor presence: they observe context (route, console),
32
32
  * timing (animation, settled), or combine other predicates (allOf/anyOf/not).
33
33
  */
34
+ /**
35
+ * What a `settled` check waits on. Absent: the whole page (requests and DOM). `network`: requests
36
+ * only, for a check about requests — a counted `net` claim waits for a late duplicate, and DOM churn
37
+ * from an animation must not hold it open.
38
+ */
39
+ /**
40
+ * What a `settled` waits out. NETWORK: completed requests only. APP: the default's activity plus every
41
+ * framework render commit, for an app whose commits are its work (the default leaves them out: on many
42
+ * pages they are ambient, a clock re-rendering every second, and would never go quiet).
43
+ */
44
+ export const SettledChannel = { NETWORK: 'network', APP: 'app' };
34
45
  export const PredicateKind = {
35
46
  ELEMENT: PresenceKind.ELEMENT,
36
47
  TEXT: PresenceKind.TEXT,
@@ -37,6 +37,16 @@ export interface Contradiction {
37
37
  export declare const ContradictionKind: {
38
38
  /** The screen moved forward while a request in the same window failed — the swallowed rejection. */
39
39
  readonly UI_ADVANCED_REQUEST_FAILED: "ui-advanced-request-failed";
40
+ /**
41
+ * The UI moved while a write failed, and the app publishes no signal and no store change.
42
+ *
43
+ * The same window as `ui-advanced-request-failed`, but nothing could decide whether the app
44
+ * handled the failure: no acted control to follow, and no voice of the app's own. Measured on a
45
+ * zero-install live feed: the correct build and the broken one both produced the strong finding,
46
+ * because a feed that appends rows on its own is a UI that moves. Absence-derived, so it makes a
47
+ * verdict unknown, never no.
48
+ */
49
+ readonly UI_ADVANCED_UNSIGNALLED: "ui-advanced-unsignalled";
40
50
  /** The app fired its own success signal while a request in the same window failed. Strongest form:
41
51
  * the app did not merely look right, it explicitly ASSERTED success against its own evidence. */
42
52
  readonly SIGNAL_CONTRADICTED: "signal-contradicted";
@@ -6,6 +6,16 @@ import { ChannelId, disagreementCanConvict } from '../wire/channel.js';
6
6
  export const ContradictionKind = {
7
7
  /** The screen moved forward while a request in the same window failed — the swallowed rejection. */
8
8
  UI_ADVANCED_REQUEST_FAILED: 'ui-advanced-request-failed',
9
+ /**
10
+ * The UI moved while a write failed, and the app publishes no signal and no store change.
11
+ *
12
+ * The same window as `ui-advanced-request-failed`, but nothing could decide whether the app
13
+ * handled the failure: no acted control to follow, and no voice of the app's own. Measured on a
14
+ * zero-install live feed: the correct build and the broken one both produced the strong finding,
15
+ * because a feed that appends rows on its own is a UI that moves. Absence-derived, so it makes a
16
+ * verdict unknown, never no.
17
+ */
18
+ UI_ADVANCED_UNSIGNALLED: 'ui-advanced-unsignalled',
9
19
  /** The app fired its own success signal while a request in the same window failed. Strongest form:
10
20
  * the app did not merely look right, it explicitly ASSERTED success against its own evidence. */
11
21
  SIGNAL_CONTRADICTED: 'signal-contradicted',
@@ -239,6 +249,8 @@ export const ContradictionKind = {
239
249
  */
240
250
  export const ABSENCE_DERIVED_CONTRADICTIONS = new Set([
241
251
  ContradictionKind.REQUEST_NEVER_SETTLED,
252
+ // The app has no voice to say it handled the failure, and no acted control showed it either way.
253
+ ContradictionKind.UI_ADVANCED_UNSIGNALLED,
242
254
  ContradictionKind.RESPONSE_IGNORED,
243
255
  // The app said something happened and nothing corroborated it. That is an absence of agreement,
244
256
  // never proof the app is wrong — a signal about non-visual state has nothing to corroborate it by
@@ -357,6 +369,7 @@ export const MUTATING_METHODS = ['POST', 'PUT', 'PATCH', 'DELETE', 'IPC'];
357
369
  */
358
370
  export const CONTRADICTION_CHANNELS = {
359
371
  [ContradictionKind.UI_ADVANCED_REQUEST_FAILED]: [ChannelId.UI, ChannelId.NET],
372
+ [ContradictionKind.UI_ADVANCED_UNSIGNALLED]: [ChannelId.UI, ChannelId.NET],
360
373
  [ContradictionKind.SIGNAL_CONTRADICTED]: [ChannelId.SIGNAL, ChannelId.NET],
361
374
  [ContradictionKind.RESPONSE_IGNORED]: [ChannelId.NET, ChannelId.UI],
362
375
  [ContradictionKind.SIGNAL_WITHOUT_CONSEQUENCE]: [ChannelId.SIGNAL, ChannelId.NET],
@@ -53,13 +53,8 @@ export declare function coverageOf(input: {
53
53
  channels: readonly string[];
54
54
  gaps: readonly CoverageGap[];
55
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
56
  /** 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:";
57
+ export declare const AGENT_PROMPT_LEAD = "Read https://docs.reticle.sh/skill.md, then improve Reticle's coverage in this repo:";
63
58
  /** The last line: what the agent hands back. */
64
59
  export declare const AGENT_PROMPT_TAIL = "Report the coverage line it prints.";
65
60
  /**
@@ -83,33 +78,7 @@ export declare const NotApplicableSchema: z.ZodArray<z.ZodNativeEnum<{
83
78
  readonly SOURCE_MAPPING: "file:line source mapping";
84
79
  readonly TEST_IDS: "stable test ids";
85
80
  }>, "many">;
86
- /** The score at which the Harness unlocks. */
87
- export declare const HARNESS_UNLOCK_COVERAGE = 0.8;
88
81
  /** Seen ÷ applicable over the eight capabilities. See the header for the exact rule. */
89
82
  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;
83
+ /** floor(coverageScore × 100): the setup score a person reads. */
84
+ export declare function coveragePercent(coverage: Pick<Coverage, 'seen'>, notApplicable?: readonly CoverageCapability[]): number;