@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
@@ -66,19 +66,19 @@ export declare const VerdictHookPayloadSchema: z.ZodObject<{
66
66
  sessionId: z.ZodOptional<z.ZodString>;
67
67
  url: z.ZodOptional<z.ZodString>;
68
68
  }, "strip", z.ZodTypeAny, {
69
- event: "verdict";
70
69
  at: string;
71
- tool: string;
70
+ event: "verdict";
72
71
  verified: string;
72
+ tool: string;
73
73
  url?: string | undefined;
74
74
  projectId?: string | undefined;
75
75
  sessionId?: string | undefined;
76
76
  because?: string | undefined;
77
77
  }, {
78
- event: "verdict";
79
78
  at: string;
80
- tool: string;
79
+ event: "verdict";
81
80
  verified: string;
81
+ tool: string;
82
82
  url?: string | undefined;
83
83
  projectId?: string | undefined;
84
84
  sessionId?: string | undefined;
@@ -98,22 +98,22 @@ export declare const BugFoundHookPayloadSchema: z.ZodObject<{
98
98
  tool: z.ZodString;
99
99
  sessionId: z.ZodOptional<z.ZodString>;
100
100
  }, "strip", z.ZodTypeAny, {
101
+ repeat: boolean;
102
+ at: string;
101
103
  kind: string;
102
104
  event: "bug_found";
103
- at: string;
104
105
  tool: string;
105
- repeat: boolean;
106
106
  route?: string | undefined;
107
107
  source?: string | undefined;
108
108
  projectId?: string | undefined;
109
109
  sessionId?: string | undefined;
110
110
  fingerprint?: string | undefined;
111
111
  }, {
112
+ repeat: boolean;
113
+ at: string;
112
114
  kind: string;
113
115
  event: "bug_found";
114
- at: string;
115
116
  tool: string;
116
- repeat: boolean;
117
117
  route?: string | undefined;
118
118
  source?: string | undefined;
119
119
  projectId?: string | undefined;
@@ -130,15 +130,15 @@ export declare const SessionHookPayloadSchema: z.ZodObject<{
130
130
  url: z.ZodOptional<z.ZodString>;
131
131
  runtime: z.ZodOptional<z.ZodString>;
132
132
  }, "strip", z.ZodTypeAny, {
133
- event: "session_started" | "session_ended";
134
133
  at: string;
134
+ event: "session_started" | "session_ended";
135
135
  sessionId: string;
136
136
  url?: string | undefined;
137
137
  projectId?: string | undefined;
138
138
  runtime?: string | undefined;
139
139
  }, {
140
- event: "session_started" | "session_ended";
141
140
  at: string;
141
+ event: "session_started" | "session_ended";
142
142
  sessionId: string;
143
143
  url?: string | undefined;
144
144
  projectId?: string | undefined;
@@ -154,16 +154,16 @@ export declare const SyncHookPayloadSchema: z.ZodObject<{
154
154
  ok: z.ZodBoolean;
155
155
  error: z.ZodOptional<z.ZodString>;
156
156
  }, "strip", z.ZodTypeAny, {
157
+ at: string;
157
158
  ok: boolean;
158
159
  event: "sync_completed";
159
- at: string;
160
160
  runsPushed: number;
161
161
  error?: string | undefined;
162
162
  projectId?: string | undefined;
163
163
  }, {
164
+ at: string;
164
165
  ok: boolean;
165
166
  event: "sync_completed";
166
- at: string;
167
167
  runsPushed: number;
168
168
  error?: string | undefined;
169
169
  projectId?: string | undefined;
@@ -181,19 +181,19 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
181
181
  sessionId: z.ZodOptional<z.ZodString>;
182
182
  url: z.ZodOptional<z.ZodString>;
183
183
  }, "strip", z.ZodTypeAny, {
184
- event: "verdict";
185
184
  at: string;
186
- tool: string;
185
+ event: "verdict";
187
186
  verified: string;
187
+ tool: string;
188
188
  url?: string | undefined;
189
189
  projectId?: string | undefined;
190
190
  sessionId?: string | undefined;
191
191
  because?: string | undefined;
192
192
  }, {
193
- event: "verdict";
194
193
  at: string;
195
- tool: string;
194
+ event: "verdict";
196
195
  verified: string;
196
+ tool: string;
197
197
  url?: string | undefined;
198
198
  projectId?: string | undefined;
199
199
  sessionId?: string | undefined;
@@ -211,22 +211,22 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
211
211
  tool: z.ZodString;
212
212
  sessionId: z.ZodOptional<z.ZodString>;
213
213
  }, "strip", z.ZodTypeAny, {
214
+ repeat: boolean;
215
+ at: string;
214
216
  kind: string;
215
217
  event: "bug_found";
216
- at: string;
217
218
  tool: string;
218
- repeat: boolean;
219
219
  route?: string | undefined;
220
220
  source?: string | undefined;
221
221
  projectId?: string | undefined;
222
222
  sessionId?: string | undefined;
223
223
  fingerprint?: string | undefined;
224
224
  }, {
225
+ repeat: boolean;
226
+ at: string;
225
227
  kind: string;
226
228
  event: "bug_found";
227
- at: string;
228
229
  tool: string;
229
- repeat: boolean;
230
230
  route?: string | undefined;
231
231
  source?: string | undefined;
232
232
  projectId?: string | undefined;
@@ -241,15 +241,15 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
241
241
  } & {
242
242
  event: z.ZodLiteral<"session_started">;
243
243
  }, "strip", z.ZodTypeAny, {
244
- event: "session_started";
245
244
  at: string;
245
+ event: "session_started";
246
246
  sessionId: string;
247
247
  url?: string | undefined;
248
248
  projectId?: string | undefined;
249
249
  runtime?: string | undefined;
250
250
  }, {
251
- event: "session_started";
252
251
  at: string;
252
+ event: "session_started";
253
253
  sessionId: string;
254
254
  url?: string | undefined;
255
255
  projectId?: string | undefined;
@@ -263,15 +263,15 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
263
263
  } & {
264
264
  event: z.ZodLiteral<"session_ended">;
265
265
  }, "strip", z.ZodTypeAny, {
266
- event: "session_ended";
267
266
  at: string;
267
+ event: "session_ended";
268
268
  sessionId: string;
269
269
  url?: string | undefined;
270
270
  projectId?: string | undefined;
271
271
  runtime?: string | undefined;
272
272
  }, {
273
- event: "session_ended";
274
273
  at: string;
274
+ event: "session_ended";
275
275
  sessionId: string;
276
276
  url?: string | undefined;
277
277
  projectId?: string | undefined;
@@ -285,16 +285,16 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
285
285
  ok: z.ZodBoolean;
286
286
  error: z.ZodOptional<z.ZodString>;
287
287
  }, "strip", z.ZodTypeAny, {
288
+ at: string;
288
289
  ok: boolean;
289
290
  event: "sync_completed";
290
- at: string;
291
291
  runsPushed: number;
292
292
  error?: string | undefined;
293
293
  projectId?: string | undefined;
294
294
  }, {
295
+ at: string;
295
296
  ok: boolean;
296
297
  event: "sync_completed";
297
- at: string;
298
298
  runsPushed: number;
299
299
  error?: string | undefined;
300
300
  projectId?: string | undefined;
@@ -8,3 +8,4 @@
8
8
  */
9
9
  export * from './wire/constants/hud-controls.js';
10
10
  export * from './artifacts/hud-notices.js';
11
+ export * from './artifacts/harness-credits.js';
package/dist/hud-entry.js CHANGED
@@ -9,3 +9,5 @@
9
9
  export * from './wire/constants/hud-controls.js';
10
10
  // The rail's notices: read by the daemon that chooses them and the lazy panel that renders them.
11
11
  export * from './artifacts/hud-notices.js';
12
+ // Credits: the HUD's row says what the daemon's refusal says.
13
+ export * from './artifacts/harness-credits.js';
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Which git checkout a directory is in, and which checkout is the main one.
3
+ *
4
+ * Agents work in git worktrees. Every worktree of a project is the same project, so it must find
5
+ * the same config, the same daemon and the same cloud link as the main checkout. But it must keep
6
+ * its own results. This reads the two facts that make that possible from the `.git` entry, with no
7
+ * `git` process: a worktree's `.git` is a file that says `gitdir: <main>/.git/worktrees/<name>`.
8
+ *
9
+ * Pure. The caller supplies `readFile` (undefined for a missing file), so core stays free of Node.
10
+ */
11
+ /** A git checkout, as read from disk. */
12
+ export interface Checkout {
13
+ /** The top directory of this checkout. */
14
+ root: string;
15
+ /** The top directory of the main checkout. Equals `root` when there is no other. */
16
+ mainRoot: string;
17
+ /**
18
+ * The repository's own git directory, which every worktree of it shares (`git rev-parse
19
+ * --git-common-dir`). Two checkouts are worktrees of one repository when this is equal. A bare
20
+ * repository has worktrees but no main checkout, so `mainRoot` cannot tell them apart.
21
+ */
22
+ commonDir: string;
23
+ /** The branch checked out. Absent on a detached HEAD. */
24
+ branch?: string;
25
+ /** True for a linked worktree (`git worktree add`). */
26
+ linked: boolean;
27
+ }
28
+ export declare function checkoutOf(dir: string, readFile: (path: string) => string | undefined): Checkout | undefined;
29
+ /**
30
+ * The same path in the main checkout, when `path` sits in a linked worktree; otherwise undefined.
31
+ *
32
+ * What a fresh worktree does not have yet is often in the main checkout: an uncommitted or
33
+ * git-ignored `.reticle/cloud.json`, or a flow saved there and not yet committed. Callers read the
34
+ * twin only as a fallback, and never write to it.
35
+ */
36
+ export declare function mainCheckoutTwin(path: string, readFile: (path: string) => string | undefined): string | undefined;
37
+ /**
38
+ * True when two paths that `checkoutOf` returned name one directory. A Windows path ignores case, and
39
+ * the same folder arrives as `C:\wt\a` from a shell and as `C:/wt/a` from Vite and git.
40
+ */
41
+ export declare function samePath(a: string, b: string): boolean;
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Which git checkout a directory is in, and which checkout is the main one.
3
+ *
4
+ * Agents work in git worktrees. Every worktree of a project is the same project, so it must find
5
+ * the same config, the same daemon and the same cloud link as the main checkout. But it must keep
6
+ * its own results. This reads the two facts that make that possible from the `.git` entry, with no
7
+ * `git` process: a worktree's `.git` is a file that says `gitdir: <main>/.git/worktrees/<name>`.
8
+ *
9
+ * Pure. The caller supplies `readFile` (undefined for a missing file), so core stays free of Node.
10
+ */
11
+ /** How far up to walk for a `.git`. A backstop for a deep tree, not a policy. */
12
+ const MAX_UP_LEVELS = 50;
13
+ const GITDIR_PREFIX = 'gitdir:';
14
+ const BRANCH_PREFIX = 'ref: refs/heads/';
15
+ const WORKTREES_SEGMENT = 'worktrees';
16
+ const GIT_DIR_NAME = '.git';
17
+ /** A path that starts with a drive letter. */
18
+ const WINDOWS_PATH = /^[A-Za-z]:[\\/]/;
19
+ export function checkoutOf(dir, readFile) {
20
+ const sep = dir.includes('\\') ? '\\' : '/';
21
+ let current = trimEnd(dir, sep);
22
+ for (let level = 0; level <= MAX_UP_LEVELS; level += 1) {
23
+ const head = readFile(`${current}${sep}${GIT_DIR_NAME}${sep}HEAD`);
24
+ if (head !== undefined) {
25
+ return withBranch({
26
+ root: current,
27
+ mainRoot: current,
28
+ commonDir: `${current}${sep}${GIT_DIR_NAME}`,
29
+ linked: false,
30
+ }, head);
31
+ }
32
+ const pointer = readFile(`${current}${sep}${GIT_DIR_NAME}`);
33
+ if (pointer !== undefined && pointer.trim().startsWith(GITDIR_PREFIX)) {
34
+ return linkedCheckout(current, pointer.trim().slice(GITDIR_PREFIX.length).trim(), sep, readFile);
35
+ }
36
+ const parent = parentOf(current, sep);
37
+ if (parent === undefined)
38
+ return undefined;
39
+ current = parent;
40
+ }
41
+ return undefined;
42
+ }
43
+ /**
44
+ * The same path in the main checkout, when `path` sits in a linked worktree; otherwise undefined.
45
+ *
46
+ * What a fresh worktree does not have yet is often in the main checkout: an uncommitted or
47
+ * git-ignored `.reticle/cloud.json`, or a flow saved there and not yet committed. Callers read the
48
+ * twin only as a fallback, and never write to it.
49
+ */
50
+ export function mainCheckoutTwin(path, readFile) {
51
+ const checkout = checkoutOf(path, readFile);
52
+ if (checkout === undefined || checkout.root === checkout.mainRoot)
53
+ return undefined;
54
+ return `${checkout.mainRoot}${path.slice(checkout.root.length)}`;
55
+ }
56
+ /**
57
+ * True when two paths that `checkoutOf` returned name one directory. A Windows path ignores case, and
58
+ * the same folder arrives as `C:\wt\a` from a shell and as `C:/wt/a` from Vite and git.
59
+ */
60
+ export function samePath(a, b) {
61
+ if (a === b)
62
+ return true;
63
+ if (!WINDOWS_PATH.test(a) || !WINDOWS_PATH.test(b))
64
+ return false;
65
+ return a.replaceAll('\\', '/').toLowerCase() === b.replaceAll('\\', '/').toLowerCase();
66
+ }
67
+ function linkedCheckout(root, gitdir, sep, readFile) {
68
+ const absolute = resolvePath(root, gitdir.split(/[\\/]/).join(sep), sep);
69
+ const parts = absolute.split(sep);
70
+ // `<main>/.git/worktrees/<name>`: a worktree. Anything else (`.git/modules/x`) is a submodule.
71
+ const isWorktree = WORKTREES_SEGMENT === parts[parts.length - 2];
72
+ const gitDirOfRepo = parts.slice(0, -2);
73
+ const commonDir = isWorktree ? gitDirOfRepo.join(sep) : absolute;
74
+ // A bare repository has no main checkout to share; the worktree is its own main checkout.
75
+ const mainRoot = isWorktree && GIT_DIR_NAME === gitDirOfRepo[gitDirOfRepo.length - 1]
76
+ ? gitDirOfRepo.slice(0, -1).join(sep)
77
+ : root;
78
+ const head = readFile(`${absolute}${sep}HEAD`);
79
+ const checkout = { root, mainRoot, commonDir, linked: isWorktree };
80
+ return head === undefined ? checkout : withBranch(checkout, head);
81
+ }
82
+ function withBranch(checkout, head) {
83
+ const ref = head.trim();
84
+ return ref.startsWith(BRANCH_PREFIX)
85
+ ? { ...checkout, branch: ref.slice(BRANCH_PREFIX.length) }
86
+ : checkout;
87
+ }
88
+ /** `rel` against `base`, with `.` and `..` folded. An absolute `rel` (POSIX or drive) wins. */
89
+ function resolvePath(base, rel, sep) {
90
+ const absolute = rel.startsWith(sep) || /^[A-Za-z]:/.test(rel);
91
+ const parts = (absolute ? rel : `${base}${sep}${rel}`).split(sep);
92
+ const out = [];
93
+ for (const part of parts) {
94
+ if ('.' === part || ('' === part && out.length > 0))
95
+ continue;
96
+ if ('..' === part) {
97
+ if (out.length > 1)
98
+ out.pop();
99
+ continue;
100
+ }
101
+ out.push(part);
102
+ }
103
+ return out.join(sep);
104
+ }
105
+ function parentOf(path, sep) {
106
+ const at = path.lastIndexOf(sep);
107
+ if (at <= 0)
108
+ return undefined;
109
+ const parent = path.slice(0, at);
110
+ // `C:` alone is not a directory we can append to; stop at the drive root.
111
+ return /^[A-Za-z]:$/.test(parent) ? undefined : parent;
112
+ }
113
+ function trimEnd(path, sep) {
114
+ let end = path.length;
115
+ while (end > 1 && sep === path[end - 1])
116
+ end -= 1;
117
+ return path.slice(0, end);
118
+ }
@@ -0,0 +1,23 @@
1
+ /** Why a state or token folder was refused. Names the variables that move it. */
2
+ export declare const stateDirNotAbsolute: (dir: string) => string;
3
+ /** Why a relative override was used against the working folder. */
4
+ export declare const stateDirResolvedFromCwd: (dir: string, resolved: string) => string;
5
+ /** Why a Windows drive path was not used on a POSIX system. */
6
+ export declare const stateDirWindowsPathOnPosix: (dir: string, fallback: string) => string;
7
+ /** The `node:path` rules the caller uses. Core imports no Node module, so the caller passes them. */
8
+ export interface StatePathRules {
9
+ isAbsolute: (path: string) => boolean;
10
+ resolve: (path: string) => string;
11
+ sep: string;
12
+ }
13
+ /**
14
+ * The folder for the pairing token or other machine state: the override when it is set, else the
15
+ * fallback. A setting that cannot be used never stops Reticle. It gets one warning and a folder:
16
+ *
17
+ * - A relative override is resolved against the working folder, as Reticle did up to 3.7.
18
+ * - A Windows drive path on POSIX (WSL, a container) is not used. Such a path is relative there, and
19
+ * it made a `C:` folder inside the app, with the pairing token under it. The fallback is used.
20
+ *
21
+ * Throws only when the fallback is not absolute, because then no folder is safe to use.
22
+ */
23
+ export declare function resolveStateDir(override: string | undefined, fallback: string, rules: StatePathRules, warn: (message: string) => void): string;
@@ -0,0 +1,43 @@
1
+ import { ReticleEnv } from '../wire/constants/reticle-env.js';
2
+ /** Why a state or token folder was refused. Names the variables that move it. */
3
+ export const stateDirNotAbsolute = (dir) => `The Reticle state folder "${dir}" is not an absolute path, so Reticle did not use it. A ` +
4
+ 'relative folder is made inside the folder this process runs in, which is often the project. ' +
5
+ `Set ${ReticleEnv.PAIRING_TOKEN_DIR} and ${ReticleEnv.STATE_DIR} to absolute paths, or unset them.`;
6
+ /** Why a relative override was used against the working folder. */
7
+ export const stateDirResolvedFromCwd = (dir, resolved) => `The Reticle state folder "${dir}" is a relative path. Reticle uses "${resolved}", in the folder ` +
8
+ `this process runs in. Set ${ReticleEnv.PAIRING_TOKEN_DIR} to an absolute path to remove this warning.`;
9
+ /** Why a Windows drive path was not used on a POSIX system. */
10
+ export const stateDirWindowsPathOnPosix = (dir, fallback) => `The Reticle state folder "${dir}" is a Windows path, and this system does not use Windows paths. ` +
11
+ `Reticle did not use it, and uses "${fallback}". Set ${ReticleEnv.PAIRING_TOKEN_DIR} to a path ` +
12
+ 'for this system, or unset it.';
13
+ /** A Windows drive path: `C:\...`, `C:/...` or the drive-relative `C:x`. */
14
+ const WINDOWS_DRIVE = /^[A-Za-z]:/;
15
+ /** The separator of POSIX path rules. */
16
+ const POSIX_SEPARATOR = '/';
17
+ /**
18
+ * The folder for the pairing token or other machine state: the override when it is set, else the
19
+ * fallback. A setting that cannot be used never stops Reticle. It gets one warning and a folder:
20
+ *
21
+ * - A relative override is resolved against the working folder, as Reticle did up to 3.7.
22
+ * - A Windows drive path on POSIX (WSL, a container) is not used. Such a path is relative there, and
23
+ * it made a `C:` folder inside the app, with the pairing token under it. The fallback is used.
24
+ *
25
+ * Throws only when the fallback is not absolute, because then no folder is safe to use.
26
+ */
27
+ export function resolveStateDir(override, fallback, rules, warn) {
28
+ if (override !== undefined && override.length > 0) {
29
+ if (rules.isAbsolute(override)) {
30
+ return override;
31
+ }
32
+ if (rules.sep !== POSIX_SEPARATOR || !WINDOWS_DRIVE.test(override)) {
33
+ const resolved = rules.resolve(override);
34
+ warn(stateDirResolvedFromCwd(override, resolved));
35
+ return resolved;
36
+ }
37
+ warn(stateDirWindowsPathOnPosix(override, fallback));
38
+ }
39
+ if (!rules.isAbsolute(fallback)) {
40
+ throw new Error(stateDirNotAbsolute(fallback));
41
+ }
42
+ return fallback;
43
+ }
package/dist/index.d.ts CHANGED
@@ -23,22 +23,29 @@ export * from './artifacts/flow-order.js';
23
23
  export * from './artifacts/flow-select.js';
24
24
  export * from './artifacts/flow-unreached.js';
25
25
  export * from './artifacts/flow-mutation-target.js';
26
+ export * from './graph/app-graph.js';
26
27
  export * from './wire/constants/constants.js';
28
+ export * from './wire/constants/response-body-reason.js';
27
29
  export * from './identity/source-constants.js';
28
30
  export * from './identity/testid-attribute.js';
29
31
  export * from './wire/event-classification.js';
30
32
  export * from './wire/global-press.js';
31
33
  export * from './wire/hold.js';
32
34
  export * from './verdict/verified-constants.js';
35
+ export * from './verdict/run-report.js';
33
36
  export * from './verdict/verdict-attribution.js';
34
37
  export * from './verdict/verify-progress.js';
35
38
  export * from './wire/constants/session-constants.js';
36
39
  export * from './wire/constants/hud-use.js';
40
+ export * from './wire/constants/reticle-chrome.js';
37
41
  export * from './wire/platform-link.js';
38
42
  export * from './wire/constants/discovery.js';
39
43
  export * from './identity/document-identity.js';
40
44
  export * from './identity/edit-epoch.js';
41
45
  export * from './wire/messages.js';
46
+ export * from './wire/production/hello-mode.js';
47
+ export * from './wire/production/production-policy.js';
48
+ export * from './wire/production/activation-ticket.js';
42
49
  export * from './wire/event-payloads.js';
43
50
  export * from './wire/event-priority.js';
44
51
  export * from './artifacts/flow-constants.js';
@@ -47,6 +54,7 @@ export * from './artifacts/flow-types.js';
47
54
  export * from './artifacts/step-effect.js';
48
55
  export * from './artifacts/flow-composition.js';
49
56
  export * from './verdict/verification-run.js';
57
+ export * from './verdict/disparity.js';
50
58
  export * from './wire/types.js';
51
59
  export * from './identity/brand.js';
52
60
  export * from './wire/net.js';
@@ -59,6 +67,8 @@ export * from './verdict/predicate.js';
59
67
  export * from './verdict/predicate-tree.js';
60
68
  export * from './artifacts/flow-expect-flat.js';
61
69
  export * from './identity/project-id.js';
70
+ export * from './identity/checkout.js';
71
+ export * from './identity/state-dir.js';
62
72
  export * from './words/notices.js';
63
73
  export * from './artifacts/journal.js';
64
74
  export * from './words/browser-misdirect.js';
@@ -68,6 +78,8 @@ export * from './registry/project-registry.js';
68
78
  export * from './verdict/intent.js';
69
79
  export * from './verdict/run-context.js';
70
80
  export * from './verdict/instrumentation-gap.js';
81
+ export * from './verdict/instrumentation-coverage.js';
82
+ export * from './verdict/check-sentence.js';
71
83
  export * from './verdict/security.js';
72
84
  export * from './wire/redaction.js';
73
85
  export * from './wire/state-select.js';
@@ -78,12 +90,14 @@ export * from './words/no-session-reason.js';
78
90
  export * from './telemetry-refusal.js';
79
91
  export * from './wire/narrow.js';
80
92
  export * from './wire/tool-names.js';
93
+ export * from './wire/next-step.js';
81
94
  export * from './wire/snapshot-tree.js';
82
95
  export * from './wire/platform.js';
83
96
  export * from './wire/channel.js';
84
97
  export * from './verdict/revision.js';
85
98
  export * from './realm/registry.js';
86
99
  export * from './telemetry-session.js';
100
+ export * from './telemetry-signals.js';
87
101
  export * from './telemetry-license.js';
88
102
  export * from './telemetry-feedback.js';
89
103
  export * from './artifacts/impact.js';
@@ -91,3 +105,4 @@ export * from './artifacts/impact-savings.js';
91
105
  export { CONTRACT_FINGERPRINT, CONTRACT_PARTS, RETIRED_WIRE_NAMES, fnv1a, fingerprintOf, } from './identity/contract-fingerprint.js';
92
106
  export { fingerprintFinding, type FindingIdentity } from './verdict/finding-fingerprint.js';
93
107
  export * from './words/unreachable-notice.js';
108
+ export * from './words/writing-rule.js';
package/dist/index.js CHANGED
@@ -24,23 +24,30 @@ export * from './artifacts/flow-order.js'; // orderFlows — prerequisites first
24
24
  export * from './artifacts/flow-select.js'; // selectFlows — which flows a run replays, and what it held back
25
25
  export * from './artifacts/flow-unreached.js'; // unreachedRoutes — known routes this run never visited
26
26
  export * from './artifacts/flow-mutation-target.js'; // what a flow says it depends on: mutationTargetsFor + perturbationFor
27
+ export * from './graph/app-graph.js'; // the App Graph: an app as screens, actions, requests; one fold for cloud and daemon
27
28
  export * from './wire/constants/constants.js'; // EventType, ActionType, wire constants, TRANSPORT_LIMITS, …
29
+ export * from './wire/constants/response-body-reason.js'; // why a NET_REQUEST carries no response body (#1520)
28
30
  export * from './identity/source-constants.js'; // DATA_RETICLE_SOURCE_ATTR, RETICLE_ROOT_GLOBAL
29
31
  export * from './identity/testid-attribute.js'; // DEFAULT_TESTID_ATTR, ALTERNATIVE_TESTID_ATTRS
30
32
  export * from './wire/event-classification.js'; // CHURN_TYPES — shared eviction priority for buffer/queue
31
33
  export * from './wire/global-press.js'; // which press is a document key (Escape / Tab / a shortcut)
32
34
  export * from './wire/hold.js'; // clampHoldMs — the bounded hold both input paths honour
33
35
  export * from './verdict/verified-constants.js'; // Verified — the one field an agent gates on
36
+ export * from './verdict/run-report.js'; // the end-of-run report an agent shows the user
34
37
  // Its own module so a page that never needs it does not download it — see first-load-size.
35
38
  export * from './verdict/verdict-attribution.js';
36
39
  export * from './verdict/verify-progress.js'; // VerifyPhase — what a run is doing while it is still doing it
37
40
  export * from './wire/constants/session-constants.js';
38
41
  export * from './wire/constants/hud-use.js'; // where the HUD sits, for HUD_USED events
42
+ export * from './wire/constants/reticle-chrome.js'; // Reticle's own UI, hidden from every capture
39
43
  export * from './wire/platform-link.js'; // daemon <-> platform: capabilities, drive spec, tool session
40
44
  export * from './wire/constants/discovery.js'; // the call-the-founder invitation, one link for every surface
41
45
  export * from './identity/document-identity.js'; // which document an observation belongs to
42
46
  export * from './identity/edit-epoch.js'; // which round of source edits an observation belongs to
43
47
  export * from './wire/messages.js'; // ReticleEvent + the message schemas
48
+ export * from './wire/production/hello-mode.js'; // HelloEnv / HelloScope: a leaf the SDK sends
49
+ export * from './wire/production/production-policy.js'; // the production action policy: rules + refused requests
50
+ export * from './wire/production/activation-ticket.js'; // the signed ticket a live page checks before it loads the SDK
44
51
  export * from './wire/event-payloads.js'; // per-event payload schemas + wire vocab
45
52
  export * from './wire/event-priority.js'; // which events survive the bridge rate cap
46
53
  export * from './artifacts/flow-constants.js'; // moved off wire/constants/constants, which had no use for them
@@ -60,6 +67,7 @@ export * from './artifacts/flow-types.js'; // FlowStep, FlowExpect, replay resul
60
67
  export * from './artifacts/step-effect.js'; // StepEffect: a leaf, so the page never downloads it
61
68
  export * from './artifacts/flow-composition.js'; // canFollow: may B replay straight after A
62
69
  export * from './verdict/verification-run.js'; // run/verdict shapes for the CI surface
70
+ export * from './verdict/disparity.js';
63
71
  export * from './wire/types.js';
64
72
  export * from './identity/brand.js'; // RunId / SessionId / ProjectId / Ref brands + validators
65
73
  export * from './wire/net.js'; // NetInitiator / ipc:// scheme — network + desktop-IPC call vocabulary
@@ -75,6 +83,8 @@ export * from './verdict/predicate-tree.js';
75
83
  // The version 1 reader: a flat expect lifted to the predicate a v2 file stores directly.
76
84
  export * from './artifacts/flow-expect-flat.js';
77
85
  export * from './identity/project-id.js';
86
+ export * from './identity/checkout.js';
87
+ export * from './identity/state-dir.js'; // resolveStateDir: refuses a state folder that is not absolute
78
88
  export * from './words/notices.js';
79
89
  export * from './artifacts/journal.js';
80
90
  // Not an API — three names that exist so importing the BROWSER SDK from here fails with a sentence
@@ -87,6 +97,8 @@ export * from './registry/project-registry.js'; // projectId -> directory, so a
87
97
  export * from './verdict/intent.js'; // what a change was supposed to make true, captured while somebody knows
88
98
  export * from './verdict/run-context.js'; // what a run established, folded and capped, for the agent to pull back
89
99
  export * from './verdict/instrumentation-gap.js'; // what Reticle could not see, and the change that would let it
100
+ export * from './verdict/instrumentation-coverage.js'; // how much of an app Reticle sees, and the prompt that closes the rest
101
+ export * from './verdict/check-sentence.js'; // a recorded check as a person's sentence, and the part that failed
90
102
  export * from './verdict/security.js'; // sanitize/serialize helpers shared by browser + server
91
103
  export * from './wire/redaction.js'; // isSensitiveKey / scrubKnownSecrets — the shared redaction rules
92
104
  export * from './wire/state-select.js'; // selectPath / capDepth — shared by browser SDK + server fallback
@@ -97,6 +109,7 @@ export * from './words/no-session-reason.js';
97
109
  export * from './telemetry-refusal.js';
98
110
  export * from './wire/narrow.js';
99
111
  export * from './wire/tool-names.js';
112
+ export * from './wire/next-step.js'; // who does what next after a refusal, and the connect command
100
113
  export * from './wire/snapshot-tree.js'; // parseInteractive — the browser writes this format, Node reads it
101
114
  export * from './wire/platform.js';
102
115
  export * from './wire/channel.js';
@@ -111,6 +124,7 @@ export * from './realm/registry.js';
111
124
  // from the protocol. What core re-exports are the few names this repository has always spelled its
112
125
  // own way -- see wire/channel.ts, which imports the rule rather than restating it.
113
126
  export * from './telemetry-session.js'; // the session/project rollup payloads
127
+ export * from './telemetry-signals.js'; // account, client, HUD, link and Harness-run signals
114
128
  export * from './telemetry-license.js'; // LicenseActivation — shared by the licence gate and telemetry
115
129
  export * from './telemetry-feedback.js'; // the two things a PERSON writes: feedback + a self-declared identity
116
130
  export * from './artifacts/impact.js'; // the user's own record of what Reticle has done for them (local only)
@@ -118,3 +132,4 @@ export * from './artifacts/impact-savings.js'; // the savings model - one file,
118
132
  export { CONTRACT_FINGERPRINT, CONTRACT_PARTS, RETIRED_WIRE_NAMES, fnv1a, fingerprintOf, } from './identity/contract-fingerprint.js';
119
133
  export { fingerprintFinding } from './verdict/finding-fingerprint.js';
120
134
  export * from './words/unreachable-notice.js'; // the page's unreachable warning, as a contract the daemon parses
135
+ export * from './words/writing-rule.js'; // how agents write the text Reticle keeps (ASD-STE100, about 80%)
@@ -47,8 +47,18 @@ export type OnboardingStepStatus = (typeof OnboardingStepStatus)[keyof typeof On
47
47
  export declare const OnboardingSteps: {
48
48
  readonly install: readonly ["script_started", "runtime_ready", "cli_installed", "agents_detected", "mcp_registered"];
49
49
  readonly onboard: readonly ["tour_started", "concept_shown", "first_look", "first_act", "first_verdict"];
50
- readonly first_run: readonly ["project_detected", "instrumented", "app_connected", "driven", "flow_recorded", "verdict_produced"];
50
+ readonly first_run: readonly ["project_detected", "next_step_offered", "instrumented", "app_connected", "driven", "flow_recorded", "verdict_produced"];
51
51
  };
52
+ /**
53
+ * The next step that the first session call in an unwired project offers. `lease` checks the
54
+ * running app now and installs nothing. `init_consent` asks the user to agree to wire the app,
55
+ * when no app is up to lease.
56
+ */
57
+ export declare const NextStepOffered: {
58
+ readonly LEASE: "lease";
59
+ readonly INIT_CONSENT: "init_consent";
60
+ };
61
+ export type NextStepOffered = (typeof NextStepOffered)[keyof typeof NextStepOffered];
52
62
  export declare const OnboardingStepSchema: z.ZodObject<{
53
63
  phase: z.ZodNativeEnum<{
54
64
  /** Getting the CLI onto the machine and the MCP registered with the agents that are there. */
@@ -94,6 +104,19 @@ export declare const OnboardingStepSchema: z.ZodObject<{
94
104
  * neither: a human abandons a step, an agent's run exits.
95
105
  */
96
106
  unattended: z.ZodOptional<z.ZodBoolean>;
107
+ /**
108
+ * The first time this machine + project crossed this step, ever. The daemon's "first" steps are
109
+ * claimed on disk and fire once; absent on a step that is not a first, and on one reported from a
110
+ * home that could not be written (which fires once per process instead).
111
+ */
112
+ firstEver: z.ZodOptional<z.ZodBoolean>;
113
+ /** Only on `next_step_offered`: the step the first session call offered. */
114
+ offered: z.ZodOptional<z.ZodNativeEnum<{
115
+ readonly LEASE: "lease";
116
+ readonly INIT_CONSENT: "init_consent";
117
+ }>>;
118
+ /** Only on a `completed` `next_step_offered`: the agent's next call did the offered step. */
119
+ nextFollowed: z.ZodOptional<z.ZodBoolean>;
97
120
  }, "strip", z.ZodTypeAny, {
98
121
  step: string;
99
122
  status: "skipped" | "completed" | "failed" | "started" | "abandoned";
@@ -102,6 +125,9 @@ export declare const OnboardingStepSchema: z.ZodObject<{
102
125
  stack?: string | undefined;
103
126
  elapsedMs?: number | undefined;
104
127
  unattended?: boolean | undefined;
128
+ firstEver?: boolean | undefined;
129
+ offered?: "lease" | "init_consent" | undefined;
130
+ nextFollowed?: boolean | undefined;
105
131
  }, {
106
132
  step: string;
107
133
  status: "skipped" | "completed" | "failed" | "started" | "abandoned";
@@ -110,5 +136,8 @@ export declare const OnboardingStepSchema: z.ZodObject<{
110
136
  stack?: string | undefined;
111
137
  elapsedMs?: number | undefined;
112
138
  unattended?: boolean | undefined;
139
+ firstEver?: boolean | undefined;
140
+ offered?: "lease" | "init_consent" | undefined;
141
+ nextFollowed?: boolean | undefined;
113
142
  }>;
114
143
  export type OnboardingStep = z.infer<typeof OnboardingStepSchema>;