@reticlehq/core 3.6.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 (90) hide show
  1. package/dist/artifacts/artifacts-entry.d.ts +2 -0
  2. package/dist/artifacts/artifacts-entry.js +2 -0
  3. package/dist/artifacts/drive-script.d.ts +158 -52
  4. package/dist/artifacts/drive-script.js +24 -1
  5. package/dist/artifacts/flow-constants.d.ts +18 -0
  6. package/dist/artifacts/flow-constants.js +20 -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 +25 -437
  10. package/dist/artifacts/flow-types.js +5 -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/impact.d.ts +354 -145
  16. package/dist/artifacts/impact.js +66 -48
  17. package/dist/artifacts/journal.d.ts +56 -5
  18. package/dist/artifacts/journal.js +26 -0
  19. package/dist/artifacts/screenshot-upload.d.ts +51 -0
  20. package/dist/artifacts/screenshot-upload.js +26 -0
  21. package/dist/hooks/hook-events.d.ts +4 -4
  22. package/dist/hud-entry.d.ts +1 -0
  23. package/dist/hud-entry.js +2 -0
  24. package/dist/index.d.ts +5 -0
  25. package/dist/index.js +5 -0
  26. package/dist/onboarding.d.ts +8 -0
  27. package/dist/onboarding.js +6 -0
  28. package/dist/realm/registry.js +19 -1
  29. package/dist/schema/command-message.json +30 -0
  30. package/dist/schema/command-name.json +3 -1
  31. package/dist/schema/event-payloads.json +40 -2
  32. package/dist/schema/reticle-message.json +30 -0
  33. package/dist/telemetry-bug.d.ts +169 -0
  34. package/dist/telemetry-bug.js +123 -0
  35. package/dist/telemetry-entry.d.ts +1 -0
  36. package/dist/telemetry-entry.js +1 -0
  37. package/dist/telemetry-feedback.d.ts +2 -2
  38. package/dist/telemetry-refusal.d.ts +2 -2
  39. package/dist/telemetry-session.d.ts +74 -0
  40. package/dist/telemetry-session.js +54 -0
  41. package/dist/telemetry-signals.d.ts +339 -0
  42. package/dist/telemetry-signals.js +138 -0
  43. package/dist/telemetry.d.ts +300 -254
  44. package/dist/telemetry.js +40 -115
  45. package/dist/verdict/disparity.d.ts +105 -0
  46. package/dist/verdict/disparity.js +40 -0
  47. package/dist/verdict/findings.d.ts +6 -0
  48. package/dist/verdict/findings.js +9 -0
  49. package/dist/verdict/instrumentation-coverage.d.ts +115 -0
  50. package/dist/verdict/instrumentation-coverage.js +226 -0
  51. package/dist/verdict/instrumentation-gap.js +1 -1
  52. package/dist/verdict/intent.d.ts +19 -5
  53. package/dist/verdict/intent.js +13 -1
  54. package/dist/verdict/predicate-tree.d.ts +15 -0
  55. package/dist/verdict/predicate-tree.js +21 -0
  56. package/dist/verdict/predicate.d.ts +14 -0
  57. package/dist/verdict/predicate.js +87 -3
  58. package/dist/verdict/security.d.ts +25 -0
  59. package/dist/verdict/security.js +82 -0
  60. package/dist/verdict/verification-run.d.ts +620 -32
  61. package/dist/verdict/verification-run.js +82 -0
  62. package/dist/wire/constants/constants.d.ts +15 -16
  63. package/dist/wire/constants/constants.js +16 -17
  64. package/dist/wire/constants/hud-controls.js +17 -5
  65. package/dist/wire/constants/hud-use.d.ts +29 -4
  66. package/dist/wire/constants/hud-use.js +26 -4
  67. package/dist/wire/constants/mcp-wire.d.ts +10 -0
  68. package/dist/wire/constants/mcp-wire.js +10 -0
  69. package/dist/wire/constants/reticle-chrome.d.ts +19 -0
  70. package/dist/wire/constants/reticle-chrome.js +19 -0
  71. package/dist/wire/constants/session-constants.d.ts +15 -2
  72. package/dist/wire/constants/session-constants.js +15 -2
  73. package/dist/wire/desktop-contract.d.ts +8 -0
  74. package/dist/wire/desktop-contract.js +11 -0
  75. package/dist/wire/event-payloads.d.ts +56 -4
  76. package/dist/wire/event-payloads.js +17 -0
  77. package/dist/wire/messages.d.ts +105 -32
  78. package/dist/wire/messages.js +9 -1
  79. package/dist/wire/platform-link.d.ts +77 -0
  80. package/dist/wire/platform-link.js +45 -0
  81. package/dist/wire/tool-names.d.ts +2 -0
  82. package/dist/wire/tool-names.js +2 -0
  83. package/dist/wire/types.d.ts +19 -6
  84. package/dist/wire/types.js +5 -0
  85. package/dist/words/notices.d.ts +1 -1
  86. package/dist/words/notices.js +1 -1
  87. package/dist/words/upgrade.js +1 -1
  88. package/dist/words/writing-rule.d.ts +14 -0
  89. package/dist/words/writing-rule.js +17 -0
  90. package/package.json +1 -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
@@ -143,7 +146,7 @@ const baseFlowStep = z.object({
143
146
  args: z.record(z.unknown()).optional(),
144
147
  expect: ExpectSchema.optional(),
145
148
  degraded: z.boolean().optional(),
146
- timeoutMs: z.number().int().positive().optional(),
149
+ timeoutMs: z.number().int().nonnegative().optional(),
147
150
  invoke: z.string().min(1).optional(),
148
151
  /** See FlowStep.page / FlowStep.endPage. */
149
152
  page: z.string().optional(),
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Harness credits, as the platform grants them and as every surface says them.
3
+ *
4
+ * One file because the HUD's row and the daemon's refusal must say the same sentence: when the two
5
+ * were written apart, the HUD offered "a free monthly allowance" the platform no longer grants.
6
+ * The numbers are always the platform's (`limit`); only the trial length is not on the wire.
7
+ *
8
+ * Served from `@reticlehq/core/hud` only: from the root entry it rode into every page's first load.
9
+ */
10
+ import { CreditKind } from './impact.js';
11
+ /** The trial a card starts. Not on the wire; the platform's own sentence names it the same. */
12
+ export declare const TRIAL_DAYS = 14;
13
+ /** What a new account is granted, and what a card's trial grants. The platform's numbers, said. */
14
+ export declare const FREE_CREDITS = 10;
15
+ export declare const TRIAL_CREDITS = 500;
16
+ /** What a signed-out HUD says the Harness costs to try. */
17
+ export declare const SIGN_UP_PITCH: string;
18
+ /** The platform's offer, worded once: what a card starts, and what an account gets without one. */
19
+ export declare const TRIAL_OFFER: string;
20
+ export interface Credits {
21
+ used: number;
22
+ limit: number;
23
+ kind?: CreditKind | undefined;
24
+ /** Whole days the grant has left, when the platform gave an end date. Absent: not said. */
25
+ daysLeft?: number | undefined;
26
+ }
27
+ /** Nothing left. An unbounded plan (no credits reported) never is. */
28
+ export declare function creditsSpent(credits: Credits | undefined): boolean;
29
+ /** "8 of 10 free credits", "420 of 500 trial credits", else "N of M credits left". */
30
+ export declare function creditsLeftText(credits: Credits): string;
31
+ /** "Trial: 120 of 500 credits used · 380 left · 9 days left"; days only when the platform said. */
32
+ export declare function creditsUsageText(credits: Credits): string;
33
+ /** The sentence for no credits left, and the one thing that gets more when there is one. */
34
+ export declare function creditsUsedText(credits: Credits): {
35
+ said: string;
36
+ action?: string;
37
+ };
38
+ /** The same, as one terminal line, with where to act when there is somewhere. */
39
+ export declare function creditsUsedLine(credits: Credits, planUrl: string): string;
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Harness credits, as the platform grants them and as every surface says them.
3
+ *
4
+ * One file because the HUD's row and the daemon's refusal must say the same sentence: when the two
5
+ * were written apart, the HUD offered "a free monthly allowance" the platform no longer grants.
6
+ * The numbers are always the platform's (`limit`); only the trial length is not on the wire.
7
+ *
8
+ * Served from `@reticlehq/core/hud` only: from the root entry it rode into every page's first load.
9
+ */
10
+ import { CreditKind } from './impact.js';
11
+ /** The trial a card starts. Not on the wire; the platform's own sentence names it the same. */
12
+ export const TRIAL_DAYS = 14;
13
+ /** What a new account is granted, and what a card's trial grants. The platform's numbers, said. */
14
+ export const FREE_CREDITS = 10;
15
+ export const TRIAL_CREDITS = 500;
16
+ /** What a signed-out HUD says the Harness costs to try. */
17
+ export const SIGN_UP_PITCH = `Sign up: ${String(FREE_CREDITS)} free credits to try Reticle Harness · ` +
18
+ `add a card for a ${String(TRIAL_CREDITS)}-credit, ${String(TRIAL_DAYS)}-day trial`;
19
+ /** The platform's offer, worded once: what a card starts, and what an account gets without one. */
20
+ export const TRIAL_OFFER = `a card starts a ${String(TRIAL_DAYS)}-day trial with ${String(TRIAL_CREDITS)} Harness credits; ` +
21
+ `without one, ${String(FREE_CREDITS)} sign-up credits`;
22
+ /** A credit count: each model call is charged its exact share, so up to two decimals, never floored. */
23
+ const count = (n) => n.toLocaleString('en-US', { maximumFractionDigits: 2 });
24
+ /** Nothing left. An unbounded plan (no credits reported) never is. */
25
+ export function creditsSpent(credits) {
26
+ return credits !== undefined && credits.used >= credits.limit;
27
+ }
28
+ /** "8 of 10 free credits", "420 of 500 trial credits", else "N of M credits left". */
29
+ export function creditsLeftText(credits) {
30
+ const of = `${count(Math.max(0, credits.limit - credits.used))} of ${count(credits.limit)}`;
31
+ if (CreditKind.FREE === credits.kind)
32
+ return `${of} free credits`;
33
+ if (CreditKind.TRIAL === credits.kind)
34
+ return `${of} trial credits`;
35
+ return `${of} credits left`;
36
+ }
37
+ const GRANT_LABEL = {
38
+ [CreditKind.FREE]: 'Free',
39
+ [CreditKind.TRIAL]: 'Trial',
40
+ };
41
+ /** "Trial: 120 of 500 credits used · 380 left · 9 days left"; days only when the platform said. */
42
+ export function creditsUsageText(credits) {
43
+ const label = credits.kind === undefined ? undefined : GRANT_LABEL[credits.kind];
44
+ const left = Math.max(0, credits.limit - credits.used);
45
+ const days = credits.daysLeft === undefined
46
+ ? ''
47
+ : ` · ${String(credits.daysLeft)} day${1 === credits.daysLeft ? '' : 's'} left`;
48
+ return `${label === undefined ? '' : `${label}: `}${count(credits.used)} of ${count(credits.limit)} credits used · ${count(left)} left${days}`;
49
+ }
50
+ /** The sentence for no credits left, and the one thing that gets more when there is one. */
51
+ export function creditsUsedText(credits) {
52
+ if (CreditKind.FREE === credits.kind)
53
+ return {
54
+ said: `Your ${count(credits.limit)} free credits are used.`,
55
+ action: `Add a card to start your ${String(TRIAL_DAYS)}-day trial`,
56
+ };
57
+ if (CreditKind.TRIAL === credits.kind)
58
+ return {
59
+ said: `Your ${count(credits.limit)} trial credits are used. Pro starts when your trial ends.`,
60
+ };
61
+ return { said: "This month's credits are used. They renew over the next 30 days." };
62
+ }
63
+ /** The same, as one terminal line, with where to act when there is somewhere. */
64
+ export function creditsUsedLine(credits, planUrl) {
65
+ const text = creditsUsedText(credits);
66
+ if (text.action !== undefined)
67
+ return `${text.said} ${text.action}: ${planUrl}`;
68
+ return CreditKind.TRIAL === credits.kind ? `${text.said} Plan: ${planUrl}` : text.said;
69
+ }
@@ -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
+ route: string;
32
+ at: number;
33
+ texts: string[];
34
+ controls: string[];
35
+ heading?: string | undefined;
36
+ reachedBy?: string | undefined;
37
+ }, {
38
+ route: string;
39
+ at: number;
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
+ route: string;
64
+ at: number;
65
+ texts: string[];
66
+ controls: string[];
67
+ heading?: string | undefined;
68
+ reachedBy?: string | undefined;
69
+ }, {
70
+ route: string;
71
+ at: number;
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
+ route: string;
81
+ at: number;
82
+ texts: string[];
83
+ controls: string[];
84
+ heading?: string | undefined;
85
+ reachedBy?: string | undefined;
86
+ }[];
87
+ }, {
88
+ surveyedAt: number;
89
+ pages: {
90
+ route: string;
91
+ at: number;
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
+ });