@reticlehq/core 3.7.0 → 3.8.1
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.
- package/dist/activation-entry.d.ts +9 -0
- package/dist/activation-entry.js +9 -0
- package/dist/artifacts/drive-script.d.ts +84 -1217
- package/dist/artifacts/drive-script.js +1 -1
- package/dist/artifacts/flow-constants.d.ts +15 -0
- package/dist/artifacts/flow-constants.js +15 -0
- package/dist/artifacts/flow-expect-flat.d.ts +8 -192
- package/dist/artifacts/flow-expect-flat.js +2 -2
- package/dist/artifacts/flow-results.d.ts +26 -0
- package/dist/artifacts/flow-types.d.ts +212 -2295
- package/dist/artifacts/flow-types.js +14 -2
- package/dist/artifacts/harness-credits.d.ts +6 -3
- package/dist/artifacts/harness-credits.js +9 -6
- package/dist/artifacts/harness-map.d.ts +8 -69
- package/dist/artifacts/harness-map.js +1 -1
- package/dist/artifacts/hud-notices.d.ts +8 -82
- package/dist/artifacts/hud-notices.js +1 -1
- package/dist/artifacts/impact.d.ts +104 -1665
- package/dist/artifacts/impact.js +38 -21
- package/dist/artifacts/journal.d.ts +15 -231
- package/dist/artifacts/journal.js +15 -2
- package/dist/artifacts/prompt-context.d.ts +7 -33
- package/dist/artifacts/prompt-context.js +15 -4
- package/dist/artifacts/screenshot-upload.d.ts +3 -26
- package/dist/artifacts/screenshot-upload.js +1 -1
- package/dist/graph/app-graph.d.ts +137 -0
- package/dist/graph/app-graph.js +498 -0
- package/dist/hooks/hook-events.d.ts +15 -171
- package/dist/hooks/hook-events.js +1 -1
- package/dist/hud-entry.js +1 -1
- package/dist/identity/checkout.d.ts +41 -0
- package/dist/identity/checkout.js +118 -0
- package/dist/identity/state-dir.d.ts +23 -0
- package/dist/identity/state-dir.js +43 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/onboarding.d.ts +23 -52
- package/dist/onboarding.js +20 -1
- package/dist/registry/daemon-registry.d.ts +2 -14
- package/dist/registry/daemon-registry.js +1 -1
- package/dist/registry/dev-server-registry.d.ts +2 -31
- package/dist/registry/dev-server-registry.js +1 -1
- package/dist/registry/project-registry.d.ts +4 -32
- package/dist/registry/project-registry.js +1 -1
- package/dist/schema/command-message.json +65 -68
- package/dist/schema/command-name.json +29 -33
- package/dist/schema/command-result.json +25 -30
- package/dist/schema/event-message.json +104 -101
- package/dist/schema/event-payloads.json +246 -108
- package/dist/schema/event-type.json +47 -48
- package/dist/schema/hello-message.json +150 -133
- package/dist/schema/reticle-event.json +98 -94
- package/dist/schema/reticle-message.json +338 -310
- package/dist/telemetry-bug.d.ts +4 -75
- package/dist/telemetry-bug.js +1 -1
- package/dist/telemetry-entry.d.ts +1 -1
- package/dist/telemetry-entry.js +1 -1
- package/dist/telemetry-feedback.d.ts +17 -91
- package/dist/telemetry-feedback.js +20 -1
- package/dist/telemetry-refusal.d.ts +4 -31
- package/dist/telemetry-refusal.js +1 -1
- package/dist/telemetry-session.d.ts +45 -624
- package/dist/telemetry-session.js +25 -12
- package/dist/telemetry-signals.d.ts +211 -86
- package/dist/telemetry-signals.js +100 -2
- package/dist/telemetry.d.ts +321 -1691
- package/dist/telemetry.js +72 -6
- package/dist/verdict/check-sentence.d.ts +34 -0
- package/dist/verdict/check-sentence.js +228 -0
- package/dist/verdict/compare-source.d.ts +1 -1
- package/dist/verdict/compare-source.js +1 -1
- package/dist/verdict/consequence.d.ts +15 -0
- package/dist/verdict/consequence.js +11 -0
- package/dist/verdict/disparity.d.ts +8 -56
- package/dist/verdict/disparity.js +1 -1
- package/dist/verdict/findings.d.ts +10 -0
- package/dist/verdict/findings.js +13 -0
- package/dist/verdict/instrumentation-coverage.d.ts +6 -37
- package/dist/verdict/instrumentation-coverage.js +15 -59
- package/dist/verdict/instrumentation-gap.d.ts +72 -0
- package/dist/verdict/instrumentation-gap.js +64 -0
- package/dist/verdict/intent.d.ts +25 -224
- package/dist/verdict/intent.js +1 -1
- package/dist/verdict/predicate-tree.d.ts +2 -0
- package/dist/verdict/predicate-tree.js +16 -0
- package/dist/verdict/predicate.d.ts +3 -2
- package/dist/verdict/predicate.js +107 -16
- package/dist/verdict/property-assertion.d.ts +23 -101
- package/dist/verdict/property-assertion.js +1 -1
- package/dist/verdict/run-report.d.ts +71 -0
- package/dist/verdict/run-report.js +53 -0
- package/dist/verdict/security.d.ts +48 -2
- package/dist/verdict/security.js +185 -18
- package/dist/verdict/verification-run.d.ts +124 -1623
- package/dist/verdict/verification-run.js +37 -6
- package/dist/verdict/verify-progress.d.ts +22 -64
- package/dist/verdict/verify-progress.js +1 -1
- package/dist/wire/constants/constants.d.ts +56 -141
- package/dist/wire/constants/constants.js +64 -144
- package/dist/wire/constants/discovery.d.ts +4 -4
- package/dist/wire/constants/discovery.js +4 -4
- package/dist/wire/constants/event-types.d.ts +37 -1
- package/dist/wire/constants/event-types.js +35 -1
- package/dist/wire/constants/hud-controls.js +0 -2
- package/dist/wire/constants/hud-use.d.ts +4 -0
- package/dist/wire/constants/hud-use.js +4 -0
- package/dist/wire/constants/mcp-wire.d.ts +16 -0
- package/dist/wire/constants/mcp-wire.js +16 -0
- package/dist/wire/constants/response-body-reason.d.ts +19 -0
- package/dist/wire/constants/response-body-reason.js +18 -0
- package/dist/wire/constants/reticle-env.d.ts +140 -0
- package/dist/wire/constants/reticle-env.js +140 -0
- package/dist/wire/constants/session-constants.d.ts +11 -0
- package/dist/wire/constants/session-constants.js +11 -0
- package/dist/wire/event-payloads.d.ts +173 -629
- package/dist/wire/event-payloads.js +107 -23
- package/dist/wire/event-priority.js +1 -0
- package/dist/wire/messages.d.ts +90 -713
- package/dist/wire/messages.js +19 -3
- package/dist/wire/narrow.d.ts +6 -0
- package/dist/wire/narrow.js +26 -0
- package/dist/wire/next-step.d.ts +50 -0
- package/dist/wire/next-step.js +37 -0
- package/dist/wire/platform-link.d.ts +7 -0
- package/dist/wire/platform-link.js +14 -8
- package/dist/wire/production/activation-ticket.d.ts +64 -0
- package/dist/wire/production/activation-ticket.js +148 -0
- package/dist/wire/production/hello-mode.d.ts +35 -0
- package/dist/wire/production/hello-mode.js +32 -0
- package/dist/wire/production/production-policy.d.ts +92 -0
- package/dist/wire/production/production-policy.js +133 -0
- package/dist/wire/tool-names.d.ts +2 -0
- package/dist/wire/tool-names.js +2 -0
- package/dist/wire/types.d.ts +102 -700
- package/dist/wire/types.js +5 -5
- package/dist/words/upgrade.d.ts +3 -13
- package/dist/words/upgrade.js +1 -1
- package/package.json +7 -4
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* controls. `hook-payload-carries-no-secret.test.ts` is the check, and it reads this file's schemas
|
|
17
17
|
* rather than a hand-kept list.
|
|
18
18
|
*/
|
|
19
|
-
import
|
|
19
|
+
import * as z from 'zod';
|
|
20
20
|
/**
|
|
21
21
|
* The events a hook can attach to.
|
|
22
22
|
*
|
|
@@ -58,37 +58,17 @@ export declare const HOOK_EVENT_NAMES: readonly HookEventName[];
|
|
|
58
58
|
export declare const VerdictHookPayloadSchema: z.ZodObject<{
|
|
59
59
|
at: z.ZodString;
|
|
60
60
|
projectId: z.ZodOptional<z.ZodString>;
|
|
61
|
-
} & {
|
|
62
61
|
event: z.ZodLiteral<"verdict">;
|
|
63
62
|
tool: z.ZodString;
|
|
64
63
|
verified: z.ZodString;
|
|
65
64
|
because: z.ZodOptional<z.ZodString>;
|
|
66
65
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
67
66
|
url: z.ZodOptional<z.ZodString>;
|
|
68
|
-
},
|
|
69
|
-
event: "verdict";
|
|
70
|
-
at: string;
|
|
71
|
-
verified: string;
|
|
72
|
-
tool: string;
|
|
73
|
-
url?: string | undefined;
|
|
74
|
-
projectId?: string | undefined;
|
|
75
|
-
sessionId?: string | undefined;
|
|
76
|
-
because?: string | undefined;
|
|
77
|
-
}, {
|
|
78
|
-
event: "verdict";
|
|
79
|
-
at: string;
|
|
80
|
-
verified: string;
|
|
81
|
-
tool: string;
|
|
82
|
-
url?: string | undefined;
|
|
83
|
-
projectId?: string | undefined;
|
|
84
|
-
sessionId?: string | undefined;
|
|
85
|
-
because?: string | undefined;
|
|
86
|
-
}>;
|
|
67
|
+
}, z.core.$strip>;
|
|
87
68
|
export type VerdictHookPayload = z.infer<typeof VerdictHookPayloadSchema>;
|
|
88
69
|
export declare const BugFoundHookPayloadSchema: z.ZodObject<{
|
|
89
70
|
at: z.ZodString;
|
|
90
71
|
projectId: z.ZodOptional<z.ZodString>;
|
|
91
|
-
} & {
|
|
92
72
|
event: z.ZodLiteral<"bug_found">;
|
|
93
73
|
kind: z.ZodString;
|
|
94
74
|
source: z.ZodOptional<z.ZodString>;
|
|
@@ -97,111 +77,42 @@ export declare const BugFoundHookPayloadSchema: z.ZodObject<{
|
|
|
97
77
|
route: z.ZodOptional<z.ZodString>;
|
|
98
78
|
tool: z.ZodString;
|
|
99
79
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
100
|
-
},
|
|
101
|
-
kind: string;
|
|
102
|
-
event: "bug_found";
|
|
103
|
-
at: string;
|
|
104
|
-
tool: string;
|
|
105
|
-
repeat: boolean;
|
|
106
|
-
route?: string | undefined;
|
|
107
|
-
source?: string | undefined;
|
|
108
|
-
projectId?: string | undefined;
|
|
109
|
-
sessionId?: string | undefined;
|
|
110
|
-
fingerprint?: string | undefined;
|
|
111
|
-
}, {
|
|
112
|
-
kind: string;
|
|
113
|
-
event: "bug_found";
|
|
114
|
-
at: string;
|
|
115
|
-
tool: string;
|
|
116
|
-
repeat: boolean;
|
|
117
|
-
route?: string | undefined;
|
|
118
|
-
source?: string | undefined;
|
|
119
|
-
projectId?: string | undefined;
|
|
120
|
-
sessionId?: string | undefined;
|
|
121
|
-
fingerprint?: string | undefined;
|
|
122
|
-
}>;
|
|
80
|
+
}, z.core.$strip>;
|
|
123
81
|
export type BugFoundHookPayload = z.infer<typeof BugFoundHookPayloadSchema>;
|
|
124
82
|
export declare const SessionHookPayloadSchema: z.ZodObject<{
|
|
125
83
|
at: z.ZodString;
|
|
126
84
|
projectId: z.ZodOptional<z.ZodString>;
|
|
127
|
-
|
|
128
|
-
|
|
85
|
+
event: z.ZodEnum<{
|
|
86
|
+
session_started: "session_started";
|
|
87
|
+
session_ended: "session_ended";
|
|
88
|
+
}>;
|
|
129
89
|
sessionId: z.ZodString;
|
|
130
90
|
url: z.ZodOptional<z.ZodString>;
|
|
131
91
|
runtime: z.ZodOptional<z.ZodString>;
|
|
132
|
-
},
|
|
133
|
-
event: "session_started" | "session_ended";
|
|
134
|
-
at: string;
|
|
135
|
-
sessionId: string;
|
|
136
|
-
url?: string | undefined;
|
|
137
|
-
projectId?: string | undefined;
|
|
138
|
-
runtime?: string | undefined;
|
|
139
|
-
}, {
|
|
140
|
-
event: "session_started" | "session_ended";
|
|
141
|
-
at: string;
|
|
142
|
-
sessionId: string;
|
|
143
|
-
url?: string | undefined;
|
|
144
|
-
projectId?: string | undefined;
|
|
145
|
-
runtime?: string | undefined;
|
|
146
|
-
}>;
|
|
92
|
+
}, z.core.$strip>;
|
|
147
93
|
export type SessionHookPayload = z.infer<typeof SessionHookPayloadSchema>;
|
|
148
94
|
export declare const SyncHookPayloadSchema: z.ZodObject<{
|
|
149
95
|
at: z.ZodString;
|
|
150
96
|
projectId: z.ZodOptional<z.ZodString>;
|
|
151
|
-
} & {
|
|
152
97
|
event: z.ZodLiteral<"sync_completed">;
|
|
153
98
|
runsPushed: z.ZodNumber;
|
|
154
99
|
ok: z.ZodBoolean;
|
|
155
100
|
error: z.ZodOptional<z.ZodString>;
|
|
156
|
-
},
|
|
157
|
-
ok: boolean;
|
|
158
|
-
event: "sync_completed";
|
|
159
|
-
at: string;
|
|
160
|
-
runsPushed: number;
|
|
161
|
-
error?: string | undefined;
|
|
162
|
-
projectId?: string | undefined;
|
|
163
|
-
}, {
|
|
164
|
-
ok: boolean;
|
|
165
|
-
event: "sync_completed";
|
|
166
|
-
at: string;
|
|
167
|
-
runsPushed: number;
|
|
168
|
-
error?: string | undefined;
|
|
169
|
-
projectId?: string | undefined;
|
|
170
|
-
}>;
|
|
101
|
+
}, z.core.$strip>;
|
|
171
102
|
export type SyncHookPayload = z.infer<typeof SyncHookPayloadSchema>;
|
|
172
103
|
/** Any hook payload. A consumer narrows on `event`, which every variant carries as a literal. */
|
|
173
|
-
export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<
|
|
104
|
+
export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
174
105
|
at: z.ZodString;
|
|
175
106
|
projectId: z.ZodOptional<z.ZodString>;
|
|
176
|
-
} & {
|
|
177
107
|
event: z.ZodLiteral<"verdict">;
|
|
178
108
|
tool: z.ZodString;
|
|
179
109
|
verified: z.ZodString;
|
|
180
110
|
because: z.ZodOptional<z.ZodString>;
|
|
181
111
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
182
112
|
url: z.ZodOptional<z.ZodString>;
|
|
183
|
-
},
|
|
184
|
-
event: "verdict";
|
|
185
|
-
at: string;
|
|
186
|
-
verified: string;
|
|
187
|
-
tool: string;
|
|
188
|
-
url?: string | undefined;
|
|
189
|
-
projectId?: string | undefined;
|
|
190
|
-
sessionId?: string | undefined;
|
|
191
|
-
because?: string | undefined;
|
|
192
|
-
}, {
|
|
193
|
-
event: "verdict";
|
|
194
|
-
at: string;
|
|
195
|
-
verified: string;
|
|
196
|
-
tool: string;
|
|
197
|
-
url?: string | undefined;
|
|
198
|
-
projectId?: string | undefined;
|
|
199
|
-
sessionId?: string | undefined;
|
|
200
|
-
because?: string | undefined;
|
|
201
|
-
}>, z.ZodObject<{
|
|
113
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
202
114
|
at: z.ZodString;
|
|
203
115
|
projectId: z.ZodOptional<z.ZodString>;
|
|
204
|
-
} & {
|
|
205
116
|
event: z.ZodLiteral<"bug_found">;
|
|
206
117
|
kind: z.ZodString;
|
|
207
118
|
source: z.ZodOptional<z.ZodString>;
|
|
@@ -210,95 +121,28 @@ export declare const HookPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodO
|
|
|
210
121
|
route: z.ZodOptional<z.ZodString>;
|
|
211
122
|
tool: z.ZodString;
|
|
212
123
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
213
|
-
},
|
|
214
|
-
kind: string;
|
|
215
|
-
event: "bug_found";
|
|
216
|
-
at: string;
|
|
217
|
-
tool: string;
|
|
218
|
-
repeat: boolean;
|
|
219
|
-
route?: string | undefined;
|
|
220
|
-
source?: string | undefined;
|
|
221
|
-
projectId?: string | undefined;
|
|
222
|
-
sessionId?: string | undefined;
|
|
223
|
-
fingerprint?: string | undefined;
|
|
224
|
-
}, {
|
|
225
|
-
kind: string;
|
|
226
|
-
event: "bug_found";
|
|
227
|
-
at: string;
|
|
228
|
-
tool: string;
|
|
229
|
-
repeat: boolean;
|
|
230
|
-
route?: string | undefined;
|
|
231
|
-
source?: string | undefined;
|
|
232
|
-
projectId?: string | undefined;
|
|
233
|
-
sessionId?: string | undefined;
|
|
234
|
-
fingerprint?: string | undefined;
|
|
235
|
-
}>, z.ZodObject<{
|
|
124
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
236
125
|
at: z.ZodString;
|
|
237
126
|
projectId: z.ZodOptional<z.ZodString>;
|
|
238
127
|
sessionId: z.ZodString;
|
|
239
128
|
url: z.ZodOptional<z.ZodString>;
|
|
240
129
|
runtime: z.ZodOptional<z.ZodString>;
|
|
241
|
-
} & {
|
|
242
130
|
event: z.ZodLiteral<"session_started">;
|
|
243
|
-
},
|
|
244
|
-
event: "session_started";
|
|
245
|
-
at: string;
|
|
246
|
-
sessionId: string;
|
|
247
|
-
url?: string | undefined;
|
|
248
|
-
projectId?: string | undefined;
|
|
249
|
-
runtime?: string | undefined;
|
|
250
|
-
}, {
|
|
251
|
-
event: "session_started";
|
|
252
|
-
at: string;
|
|
253
|
-
sessionId: string;
|
|
254
|
-
url?: string | undefined;
|
|
255
|
-
projectId?: string | undefined;
|
|
256
|
-
runtime?: string | undefined;
|
|
257
|
-
}>, z.ZodObject<{
|
|
131
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
258
132
|
at: z.ZodString;
|
|
259
133
|
projectId: z.ZodOptional<z.ZodString>;
|
|
260
134
|
sessionId: z.ZodString;
|
|
261
135
|
url: z.ZodOptional<z.ZodString>;
|
|
262
136
|
runtime: z.ZodOptional<z.ZodString>;
|
|
263
|
-
} & {
|
|
264
137
|
event: z.ZodLiteral<"session_ended">;
|
|
265
|
-
},
|
|
266
|
-
event: "session_ended";
|
|
267
|
-
at: string;
|
|
268
|
-
sessionId: string;
|
|
269
|
-
url?: string | undefined;
|
|
270
|
-
projectId?: string | undefined;
|
|
271
|
-
runtime?: string | undefined;
|
|
272
|
-
}, {
|
|
273
|
-
event: "session_ended";
|
|
274
|
-
at: string;
|
|
275
|
-
sessionId: string;
|
|
276
|
-
url?: string | undefined;
|
|
277
|
-
projectId?: string | undefined;
|
|
278
|
-
runtime?: string | undefined;
|
|
279
|
-
}>, z.ZodObject<{
|
|
138
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
280
139
|
at: z.ZodString;
|
|
281
140
|
projectId: z.ZodOptional<z.ZodString>;
|
|
282
|
-
} & {
|
|
283
141
|
event: z.ZodLiteral<"sync_completed">;
|
|
284
142
|
runsPushed: z.ZodNumber;
|
|
285
143
|
ok: z.ZodBoolean;
|
|
286
144
|
error: z.ZodOptional<z.ZodString>;
|
|
287
|
-
},
|
|
288
|
-
ok: boolean;
|
|
289
|
-
event: "sync_completed";
|
|
290
|
-
at: string;
|
|
291
|
-
runsPushed: number;
|
|
292
|
-
error?: string | undefined;
|
|
293
|
-
projectId?: string | undefined;
|
|
294
|
-
}, {
|
|
295
|
-
ok: boolean;
|
|
296
|
-
event: "sync_completed";
|
|
297
|
-
at: string;
|
|
298
|
-
runsPushed: number;
|
|
299
|
-
error?: string | undefined;
|
|
300
|
-
projectId?: string | undefined;
|
|
301
|
-
}>]>;
|
|
145
|
+
}, z.core.$strip>], "event">;
|
|
302
146
|
export type HookPayload = z.infer<typeof HookPayloadSchema>;
|
|
303
147
|
/**
|
|
304
148
|
* The file a user writes: event name to command.
|
package/dist/hud-entry.js
CHANGED
|
@@ -9,5 +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
|
-
//
|
|
12
|
+
// Credits: the HUD's row says what the daemon's refusal says.
|
|
13
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,13 +23,16 @@ 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';
|
|
@@ -40,6 +43,9 @@ export * from './wire/constants/discovery.js';
|
|
|
40
43
|
export * from './identity/document-identity.js';
|
|
41
44
|
export * from './identity/edit-epoch.js';
|
|
42
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';
|
|
43
49
|
export * from './wire/event-payloads.js';
|
|
44
50
|
export * from './wire/event-priority.js';
|
|
45
51
|
export * from './artifacts/flow-constants.js';
|
|
@@ -61,6 +67,8 @@ export * from './verdict/predicate.js';
|
|
|
61
67
|
export * from './verdict/predicate-tree.js';
|
|
62
68
|
export * from './artifacts/flow-expect-flat.js';
|
|
63
69
|
export * from './identity/project-id.js';
|
|
70
|
+
export * from './identity/checkout.js';
|
|
71
|
+
export * from './identity/state-dir.js';
|
|
64
72
|
export * from './words/notices.js';
|
|
65
73
|
export * from './artifacts/journal.js';
|
|
66
74
|
export * from './words/browser-misdirect.js';
|
|
@@ -71,6 +79,7 @@ export * from './verdict/intent.js';
|
|
|
71
79
|
export * from './verdict/run-context.js';
|
|
72
80
|
export * from './verdict/instrumentation-gap.js';
|
|
73
81
|
export * from './verdict/instrumentation-coverage.js';
|
|
82
|
+
export * from './verdict/check-sentence.js';
|
|
74
83
|
export * from './verdict/security.js';
|
|
75
84
|
export * from './wire/redaction.js';
|
|
76
85
|
export * from './wire/state-select.js';
|
|
@@ -81,6 +90,7 @@ export * from './words/no-session-reason.js';
|
|
|
81
90
|
export * from './telemetry-refusal.js';
|
|
82
91
|
export * from './wire/narrow.js';
|
|
83
92
|
export * from './wire/tool-names.js';
|
|
93
|
+
export * from './wire/next-step.js';
|
|
84
94
|
export * from './wire/snapshot-tree.js';
|
|
85
95
|
export * from './wire/platform.js';
|
|
86
96
|
export * from './wire/channel.js';
|
package/dist/index.js
CHANGED
|
@@ -24,13 +24,16 @@ 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
|
|
@@ -42,6 +45,9 @@ export * from './wire/constants/discovery.js'; // the call-the-founder invitatio
|
|
|
42
45
|
export * from './identity/document-identity.js'; // which document an observation belongs to
|
|
43
46
|
export * from './identity/edit-epoch.js'; // which round of source edits an observation belongs to
|
|
44
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
|
|
45
51
|
export * from './wire/event-payloads.js'; // per-event payload schemas + wire vocab
|
|
46
52
|
export * from './wire/event-priority.js'; // which events survive the bridge rate cap
|
|
47
53
|
export * from './artifacts/flow-constants.js'; // moved off wire/constants/constants, which had no use for them
|
|
@@ -77,6 +83,8 @@ export * from './verdict/predicate-tree.js';
|
|
|
77
83
|
// The version 1 reader: a flat expect lifted to the predicate a v2 file stores directly.
|
|
78
84
|
export * from './artifacts/flow-expect-flat.js';
|
|
79
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
|
|
80
88
|
export * from './words/notices.js';
|
|
81
89
|
export * from './artifacts/journal.js';
|
|
82
90
|
// Not an API — three names that exist so importing the BROWSER SDK from here fails with a sentence
|
|
@@ -90,6 +98,7 @@ export * from './verdict/intent.js'; // what a change was supposed to make true,
|
|
|
90
98
|
export * from './verdict/run-context.js'; // what a run established, folded and capped, for the agent to pull back
|
|
91
99
|
export * from './verdict/instrumentation-gap.js'; // what Reticle could not see, and the change that would let it
|
|
92
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
|
|
93
102
|
export * from './verdict/security.js'; // sanitize/serialize helpers shared by browser + server
|
|
94
103
|
export * from './wire/redaction.js'; // isSensitiveKey / scrubKnownSecrets — the shared redaction rules
|
|
95
104
|
export * from './wire/state-select.js'; // selectPath / capDepth — shared by browser SDK + server fallback
|
|
@@ -100,6 +109,7 @@ export * from './words/no-session-reason.js';
|
|
|
100
109
|
export * from './telemetry-refusal.js';
|
|
101
110
|
export * from './wire/narrow.js';
|
|
102
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
|
|
103
113
|
export * from './wire/snapshot-tree.js'; // parseInteractive — the browser writes this format, Node reads it
|
|
104
114
|
export * from './wire/platform.js';
|
|
105
115
|
export * from './wire/channel.js';
|