@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
@@ -15,7 +15,10 @@ export { FlowExpectSchema } from './flow-expect-flat.js';
15
15
  // Its own directory's constants, which this file had been reaching through `wire/constants/constants.js`
16
16
  // to get -- the clearest cost of that re-export: artifacts went out to wire to fetch a symbol
17
17
  // that had been sitting next door the whole time.
18
- import { AnchorKind, FlowStatus, } from './flow-constants.js';
18
+ import { AnchorKind, FlowStatus } from './flow-constants.js';
19
+ // The replay, suite and heal result envelopes live in their own module, re-exported for the same
20
+ // reason as the flat expect above.
21
+ export * from './flow-results.js';
19
22
  /**
20
23
  * The MCP tool names that can appear as a recorded flow step's `tool`. These are the ONLY tool names
21
24
  * that cross the wire into a persisted flow file — the browser recorder stamps them, the server replays
@@ -35,6 +38,9 @@ export const FlowAnchorSchema = z.discriminatedUnion('kind', [
35
38
  z.object({
36
39
  kind: z.literal(AnchorKind.TESTID),
37
40
  value: z.string().min(1),
41
+ // How many elements carried this test id when the step was recorded, when more than one did.
42
+ // A replay takes the first, so a shared test id is named at save instead of found as a drift.
43
+ of: z.number().int().min(2).optional(),
38
44
  source: z
39
45
  .object({ file: z.string(), line: z.number(), column: z.number().optional() })
40
46
  .optional(),
@@ -139,11 +145,13 @@ const baseFlowStep = z.object({
139
145
  effect: z.nativeEnum(StepEffect).optional(),
140
146
  /** Rebound by `heal` rather than recorded — see FlowStep.healed. */
141
147
  healed: z.object({ from: z.string(), at: z.number() }).optional(),
148
+ /** See FlowStep.writes. */
149
+ writes: z.boolean().optional(),
142
150
  action: z.nativeEnum(ActionType).optional(),
143
151
  args: z.record(z.unknown()).optional(),
144
152
  expect: ExpectSchema.optional(),
145
153
  degraded: z.boolean().optional(),
146
- timeoutMs: z.number().int().positive().optional(),
154
+ timeoutMs: z.number().int().nonnegative().optional(),
147
155
  invoke: z.string().min(1).optional(),
148
156
  /** See FlowStep.page / FlowStep.endPage. */
149
157
  page: z.string().optional(),
@@ -175,6 +183,13 @@ export const FlowFileSchema = z.object({
175
183
  * cannot actually check — flow-classify flags that gap.
176
184
  */
177
185
  intent: z.string().optional(),
186
+ /**
187
+ * True when `intent` was built from the steps' expects, not declared by anybody. An auto-saved
188
+ * drive with no declared intent was named by its request path and read as nothing. A built
189
+ * sentence names it, and this flag keeps it out of the intent ledger: it describes the steps, so
190
+ * it can never be a goal the steps then prove.
191
+ */
192
+ intentDerived: z.boolean().optional(),
178
193
  /**
179
194
  * The intent-ledger row this flow discharges — the id in `.reticle/intent.json`.
180
195
  *
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Credits, as the platform grants them and as every surface says them. They pay for the whole
3
+ * platform, not only the Harness, so every surface calls them credits.
4
+ *
5
+ * One file because the HUD's row and the daemon's refusal must say the same sentence: when the two
6
+ * were written apart, the HUD offered "a free monthly allowance" the platform no longer grants.
7
+ * The numbers are always the platform's (`limit`); only the trial length is not on the wire.
8
+ *
9
+ * Served from `@reticlehq/core/hud` only: from the root entry it rode into every page's first load.
10
+ */
11
+ import { CreditKind } from './impact.js';
12
+ /** The trial a card starts. Not on the wire; the platform's own sentence names it the same. */
13
+ export declare const TRIAL_DAYS = 14;
14
+ /**
15
+ * What a card's trial grants. No sign-up number: free credit is granted once per person, so the
16
+ * engine cannot know whether the reader still has any. Only the platform's `limit` says a count.
17
+ */
18
+ export declare const TRIAL_CREDITS = 500;
19
+ /** What a signed-out HUD says the Harness costs to try. */
20
+ export declare const SIGN_UP_PITCH: string;
21
+ /** The platform's offer, worded once: what a card starts, and what an account gets without one. */
22
+ export declare const TRIAL_OFFER: string;
23
+ export interface Credits {
24
+ used: number;
25
+ limit: number;
26
+ kind?: CreditKind | undefined;
27
+ /** Whole days the grant has left, when the platform gave an end date. Absent: not said. */
28
+ daysLeft?: number | undefined;
29
+ }
30
+ /** Nothing left. An unbounded plan (no credits reported) never is. */
31
+ export declare function creditsSpent(credits: Credits | undefined): boolean;
32
+ /** "8 of 10 free credits", "420 of 500 trial credits", else "N of M credits left". */
33
+ export declare function creditsLeftText(credits: Credits): string;
34
+ /** "Trial: 120 of 500 credits used · 380 left · 9 days left"; days only when the platform said. */
35
+ export declare function creditsUsageText(credits: Credits): string;
36
+ /** The sentence for no credits left, and the one thing that gets more when there is one. */
37
+ export declare function creditsUsedText(credits: Credits): {
38
+ said: string;
39
+ action?: string;
40
+ };
41
+ /** The same, as one terminal line, with where to act when there is somewhere. */
42
+ export declare function creditsUsedLine(credits: Credits, planUrl: string): string;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Credits, as the platform grants them and as every surface says them. They pay for the whole
3
+ * platform, not only the Harness, so every surface calls them credits.
4
+ *
5
+ * One file because the HUD's row and the daemon's refusal must say the same sentence: when the two
6
+ * were written apart, the HUD offered "a free monthly allowance" the platform no longer grants.
7
+ * The numbers are always the platform's (`limit`); only the trial length is not on the wire.
8
+ *
9
+ * Served from `@reticlehq/core/hud` only: from the root entry it rode into every page's first load.
10
+ */
11
+ import { CreditKind } from './impact.js';
12
+ /** The trial a card starts. Not on the wire; the platform's own sentence names it the same. */
13
+ export const TRIAL_DAYS = 14;
14
+ /**
15
+ * What a card's trial grants. No sign-up number: free credit is granted once per person, so the
16
+ * engine cannot know whether the reader still has any. Only the platform's `limit` says a count.
17
+ */
18
+ export const TRIAL_CREDITS = 500;
19
+ /** What a signed-out HUD says the Harness costs to try. */
20
+ export const SIGN_UP_PITCH = 'Sign up: free credits to try Reticle · ' +
21
+ `add a card for a ${String(TRIAL_CREDITS)}-credit, ${String(TRIAL_DAYS)}-day trial`;
22
+ /** The platform's offer, worded once: what a card starts, and what an account gets without one. */
23
+ export const TRIAL_OFFER = `a card starts a ${String(TRIAL_DAYS)}-day trial with ${String(TRIAL_CREDITS)} credits; ` +
24
+ 'without one, free sign-up credits';
25
+ /** A credit count: each model call is charged its exact share, so up to two decimals, never floored. */
26
+ const count = (n) => n.toLocaleString('en-US', { maximumFractionDigits: 2 });
27
+ /** Nothing left. An unbounded plan (no credits reported) never is. */
28
+ export function creditsSpent(credits) {
29
+ return credits !== undefined && credits.used >= credits.limit;
30
+ }
31
+ /** "8 of 10 free credits", "420 of 500 trial credits", else "N of M credits left". */
32
+ export function creditsLeftText(credits) {
33
+ const of = `${count(Math.max(0, credits.limit - credits.used))} of ${count(credits.limit)}`;
34
+ if (CreditKind.FREE === credits.kind)
35
+ return `${of} free credits`;
36
+ if (CreditKind.TRIAL === credits.kind)
37
+ return `${of} trial credits`;
38
+ return `${of} credits left`;
39
+ }
40
+ const GRANT_LABEL = {
41
+ [CreditKind.FREE]: 'Free',
42
+ [CreditKind.TRIAL]: 'Trial',
43
+ };
44
+ /** "Trial: 120 of 500 credits used · 380 left · 9 days left"; days only when the platform said. */
45
+ export function creditsUsageText(credits) {
46
+ const label = credits.kind === undefined ? undefined : GRANT_LABEL[credits.kind];
47
+ const left = Math.max(0, credits.limit - credits.used);
48
+ const days = credits.daysLeft === undefined
49
+ ? ''
50
+ : ` · ${String(credits.daysLeft)} day${1 === credits.daysLeft ? '' : 's'} left`;
51
+ return `${label === undefined ? '' : `${label}: `}${count(credits.used)} of ${count(credits.limit)} credits used · ${count(left)} left${days}`;
52
+ }
53
+ /** The sentence for no credits left, and the one thing that gets more when there is one. */
54
+ export function creditsUsedText(credits) {
55
+ if (CreditKind.FREE === credits.kind)
56
+ return {
57
+ said: `Your ${count(credits.limit)} free credits are used.`,
58
+ action: `Add a card to start your ${String(TRIAL_DAYS)}-day trial`,
59
+ };
60
+ if (CreditKind.TRIAL === credits.kind)
61
+ return {
62
+ said: `Your ${count(credits.limit)} trial credits are used. Pro starts when your trial ends.`,
63
+ };
64
+ return { said: "This month's credits are used. They renew over the next 30 days." };
65
+ }
66
+ /** The same, as one terminal line, with where to act when there is somewhere. */
67
+ export function creditsUsedLine(credits, planUrl) {
68
+ const text = creditsUsedText(credits);
69
+ if (text.action !== undefined)
70
+ return `${text.said} ${text.action}: ${planUrl}`;
71
+ return CreditKind.TRIAL === credits.kind ? `${text.said} Plan: ${planUrl}` : text.said;
72
+ }
@@ -0,0 +1,98 @@
1
+ /**
2
+ * The Harness's map of an app: the pages a survey reached before a drive, and what each showed.
3
+ *
4
+ * Built on the daemon with no model (the survey clicks nav links and toggles, never a field and never
5
+ * a write), kept in `.reticle/harness-map.json`, refreshed from what each drive reads, and sent to the
6
+ * platform when a drive starts. A drive that misses its goal on one page looks it up here instead of
7
+ * guessing, and the search before grading starts from it.
8
+ */
9
+ import { z } from 'zod';
10
+ /** Bounds on what one map holds: a dashboard's pages, not its rows. */
11
+ export declare const HarnessMapLimit: {
12
+ readonly PAGES: 40;
13
+ readonly TEXTS: 60;
14
+ readonly CONTROLS: 40;
15
+ readonly TEXT: 200;
16
+ };
17
+ export declare const HarnessMapPageSchema: z.ZodObject<{
18
+ /** The page's path (and hash), without its query or Reticle's own parameters. */
19
+ route: z.ZodString;
20
+ /** Its first heading, when it has one. */
21
+ heading: z.ZodOptional<z.ZodString>;
22
+ /** The words it showed: headings, labels and text, in reading order. */
23
+ texts: z.ZodArray<z.ZodString, "many">;
24
+ /** Its controls, as `role "name"`. */
25
+ controls: z.ZodArray<z.ZodString, "many">;
26
+ /** How the survey got here: the control on the start page, or absent for the start page. */
27
+ reachedBy: z.ZodOptional<z.ZodString>;
28
+ /** When this page was last read (epoch ms, injected). */
29
+ at: z.ZodNumber;
30
+ }, "strip", z.ZodTypeAny, {
31
+ at: number;
32
+ route: string;
33
+ texts: string[];
34
+ controls: string[];
35
+ heading?: string | undefined;
36
+ reachedBy?: string | undefined;
37
+ }, {
38
+ at: number;
39
+ route: string;
40
+ texts: string[];
41
+ controls: string[];
42
+ heading?: string | undefined;
43
+ reachedBy?: string | undefined;
44
+ }>;
45
+ export type HarnessMapPage = z.infer<typeof HarnessMapPageSchema>;
46
+ export declare const HarnessMapSchema: z.ZodObject<{
47
+ /** When the survey last ran (epoch ms, injected); a drive's own reads refresh pages, not this. */
48
+ surveyedAt: z.ZodNumber;
49
+ pages: z.ZodArray<z.ZodObject<{
50
+ /** The page's path (and hash), without its query or Reticle's own parameters. */
51
+ route: z.ZodString;
52
+ /** Its first heading, when it has one. */
53
+ heading: z.ZodOptional<z.ZodString>;
54
+ /** The words it showed: headings, labels and text, in reading order. */
55
+ texts: z.ZodArray<z.ZodString, "many">;
56
+ /** Its controls, as `role "name"`. */
57
+ controls: z.ZodArray<z.ZodString, "many">;
58
+ /** How the survey got here: the control on the start page, or absent for the start page. */
59
+ reachedBy: z.ZodOptional<z.ZodString>;
60
+ /** When this page was last read (epoch ms, injected). */
61
+ at: z.ZodNumber;
62
+ }, "strip", z.ZodTypeAny, {
63
+ at: number;
64
+ route: string;
65
+ texts: string[];
66
+ controls: string[];
67
+ heading?: string | undefined;
68
+ reachedBy?: string | undefined;
69
+ }, {
70
+ at: number;
71
+ route: string;
72
+ texts: string[];
73
+ controls: string[];
74
+ heading?: string | undefined;
75
+ reachedBy?: string | undefined;
76
+ }>, "many">;
77
+ }, "strip", z.ZodTypeAny, {
78
+ surveyedAt: number;
79
+ pages: {
80
+ at: number;
81
+ route: string;
82
+ texts: string[];
83
+ controls: string[];
84
+ heading?: string | undefined;
85
+ reachedBy?: string | undefined;
86
+ }[];
87
+ }, {
88
+ surveyedAt: number;
89
+ pages: {
90
+ at: number;
91
+ route: string;
92
+ texts: string[];
93
+ controls: string[];
94
+ heading?: string | undefined;
95
+ reachedBy?: string | undefined;
96
+ }[];
97
+ }>;
98
+ export type HarnessMap = z.infer<typeof HarnessMapSchema>;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The Harness's map of an app: the pages a survey reached before a drive, and what each showed.
3
+ *
4
+ * Built on the daemon with no model (the survey clicks nav links and toggles, never a field and never
5
+ * a write), kept in `.reticle/harness-map.json`, refreshed from what each drive reads, and sent to the
6
+ * platform when a drive starts. A drive that misses its goal on one page looks it up here instead of
7
+ * guessing, and the search before grading starts from it.
8
+ */
9
+ import { z } from 'zod';
10
+ /** Bounds on what one map holds: a dashboard's pages, not its rows. */
11
+ export const HarnessMapLimit = {
12
+ PAGES: 40,
13
+ TEXTS: 60,
14
+ CONTROLS: 40,
15
+ TEXT: 200,
16
+ };
17
+ const Text = z.string().max(HarnessMapLimit.TEXT);
18
+ export const HarnessMapPageSchema = z.object({
19
+ /** The page's path (and hash), without its query or Reticle's own parameters. */
20
+ route: Text.min(1),
21
+ /** Its first heading, when it has one. */
22
+ heading: Text.optional(),
23
+ /** The words it showed: headings, labels and text, in reading order. */
24
+ texts: z.array(Text).max(HarnessMapLimit.TEXTS),
25
+ /** Its controls, as `role "name"`. */
26
+ controls: z.array(Text).max(HarnessMapLimit.CONTROLS),
27
+ /** How the survey got here: the control on the start page, or absent for the start page. */
28
+ reachedBy: Text.optional(),
29
+ /** When this page was last read (epoch ms, injected). */
30
+ at: z.number().int().min(0),
31
+ });
32
+ export const HarnessMapSchema = z.object({
33
+ /** When the survey last ran (epoch ms, injected); a drive's own reads refresh pages, not this. */
34
+ surveyedAt: z.number().int().min(0),
35
+ pages: z.array(HarnessMapPageSchema).max(HarnessMapLimit.PAGES),
36
+ });