aperta-cli 1.0.0-beta.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.
Files changed (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +386 -0
  3. package/bin/aperta.js +3 -0
  4. package/dashboard/dist/assets/index-CWL1aA6j.js +11 -0
  5. package/dashboard/dist/assets/index-D0Ru46BW.css +1 -0
  6. package/dashboard/dist/index.html +15 -0
  7. package/dist-cli/src/adapters/git-only.js +7 -0
  8. package/dist-cli/src/adapters/git-only.js.map +1 -0
  9. package/dist-cli/src/adapters/opencode.js +47 -0
  10. package/dist-cli/src/adapters/opencode.js.map +1 -0
  11. package/dist-cli/src/agent-harness.js +1292 -0
  12. package/dist-cli/src/agent-harness.js.map +1 -0
  13. package/dist-cli/src/capture.js +17 -0
  14. package/dist-cli/src/capture.js.map +1 -0
  15. package/dist-cli/src/cli.js +283 -0
  16. package/dist-cli/src/cli.js.map +1 -0
  17. package/dist-cli/src/coach.js +315 -0
  18. package/dist-cli/src/coach.js.map +1 -0
  19. package/dist-cli/src/dashboard-data.js +254 -0
  20. package/dist-cli/src/dashboard-data.js.map +1 -0
  21. package/dist-cli/src/dashboard-server.js +379 -0
  22. package/dist-cli/src/dashboard-server.js.map +1 -0
  23. package/dist-cli/src/engine.js +85 -0
  24. package/dist-cli/src/engine.js.map +1 -0
  25. package/dist-cli/src/execution.js +20 -0
  26. package/dist-cli/src/execution.js.map +1 -0
  27. package/dist-cli/src/git.js +131 -0
  28. package/dist-cli/src/git.js.map +1 -0
  29. package/dist-cli/src/harness-intelligence.js +110 -0
  30. package/dist-cli/src/harness-intelligence.js.map +1 -0
  31. package/dist-cli/src/hook.js +39 -0
  32. package/dist-cli/src/hook.js.map +1 -0
  33. package/dist-cli/src/impact.js +224 -0
  34. package/dist-cli/src/impact.js.map +1 -0
  35. package/dist-cli/src/jobs.js +27 -0
  36. package/dist-cli/src/jobs.js.map +1 -0
  37. package/dist-cli/src/ledger.js +211 -0
  38. package/dist-cli/src/ledger.js.map +1 -0
  39. package/dist-cli/src/map.js +73 -0
  40. package/dist-cli/src/map.js.map +1 -0
  41. package/dist-cli/src/observer.js +127 -0
  42. package/dist-cli/src/observer.js.map +1 -0
  43. package/dist-cli/src/probes.js +195 -0
  44. package/dist-cli/src/probes.js.map +1 -0
  45. package/dist-cli/src/prompt.js +44 -0
  46. package/dist-cli/src/prompt.js.map +1 -0
  47. package/dist-cli/src/proof-graph.js +123 -0
  48. package/dist-cli/src/proof-graph.js.map +1 -0
  49. package/dist-cli/src/proof.js +99 -0
  50. package/dist-cli/src/proof.js.map +1 -0
  51. package/dist-cli/src/registry.js +60 -0
  52. package/dist-cli/src/registry.js.map +1 -0
  53. package/dist-cli/src/repository.js +39 -0
  54. package/dist-cli/src/repository.js.map +1 -0
  55. package/dist-cli/src/semantic.js +183 -0
  56. package/dist-cli/src/semantic.js.map +1 -0
  57. package/dist-cli/src/service.js +60 -0
  58. package/dist-cli/src/service.js.map +1 -0
  59. package/dist-cli/src/session.js +41 -0
  60. package/dist-cli/src/session.js.map +1 -0
  61. package/dist-cli/src/settings.js +305 -0
  62. package/dist-cli/src/settings.js.map +1 -0
  63. package/dist-cli/src/skills.js +104 -0
  64. package/dist-cli/src/skills.js.map +1 -0
  65. package/dist-cli/src/storage.js +163 -0
  66. package/dist-cli/src/storage.js.map +1 -0
  67. package/dist-cli/src/types.js +2 -0
  68. package/dist-cli/src/types.js.map +1 -0
  69. package/package.json +56 -0
@@ -0,0 +1,305 @@
1
+ import { execFile } from "node:child_process";
2
+ import { randomUUID } from "node:crypto";
3
+ import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
4
+ import { homedir } from "node:os";
5
+ import { join, resolve } from "node:path";
6
+ import { promisify } from "node:util";
7
+ import { requestProviderAction, requestProviderJson } from "./coach.js";
8
+ const execFileAsync = promisify(execFile);
9
+ const providers = new Set(["openai", "anthropic", "google", "deepseek", "ollama", "openrouter", "groq", "openai-compatible"]);
10
+ const defaultBaseUrls = {
11
+ openai: "https://api.openai.com/v1", anthropic: "https://api.anthropic.com/v1", google: "https://generativelanguage.googleapis.com/v1beta",
12
+ deepseek: "https://api.deepseek.com", ollama: "http://127.0.0.1:11434", openrouter: "https://openrouter.ai/api/v1", groq: "https://api.groq.com/openai/v1", "openai-compatible": "",
13
+ };
14
+ export const providerCatalog = [
15
+ { id: "openai", label: "OpenAI", description: "Direct OpenAI models with native tools.", category: "Direct", baseUrl: defaultBaseUrls.openai },
16
+ { id: "anthropic", label: "Anthropic", description: "Claude models with native tool use.", category: "Direct", baseUrl: defaultBaseUrls.anthropic },
17
+ { id: "google", label: "Google Gemini", description: "Gemini models through the Developer API.", category: "Direct", baseUrl: defaultBaseUrls.google },
18
+ { id: "deepseek", label: "DeepSeek", description: "DeepSeek V4 models through the native OpenAI-compatible tool API.", category: "Direct", baseUrl: defaultBaseUrls.deepseek },
19
+ { id: "openrouter", label: "OpenRouter", description: "A broad model catalog behind one tool-capable API.", category: "Gateway", baseUrl: defaultBaseUrls.openrouter },
20
+ { id: "groq", label: "Groq", description: "Low-latency hosted open models with tool use.", category: "Gateway", baseUrl: defaultBaseUrls.groq },
21
+ { id: "ollama", label: "Ollama", description: "Private models running on this machine.", category: "Local", baseUrl: defaultBaseUrls.ollama },
22
+ { id: "openai-compatible", label: "Custom endpoint", description: "LM Studio, vLLM, Together, Fireworks, xAI, or another compatible API.", category: "Advanced", baseUrl: "" },
23
+ ];
24
+ const defaultAgentRuntime = { kind: "aperta", model: "", command: "cursor-agent" };
25
+ const runtimeCommands = { aperta: "", cursor: "cursor-agent", claude: "claude", opencode: "opencode" };
26
+ function settingsDir() { return process.env.APERTA_HOME ? resolve(process.env.APERTA_HOME) : join(homedir(), ".aperta"); }
27
+ function settingsFile() { return join(settingsDir(), "settings.json"); }
28
+ function serviceName(id) { return `dev.aperta.model.${id}`; }
29
+ function validateUrl(value) {
30
+ if (!value)
31
+ throw new Error("A base URL is required for this provider");
32
+ const url = new URL(value);
33
+ const local = ["127.0.0.1", "localhost", "::1"].includes(url.hostname);
34
+ if (url.protocol !== "https:" && !(url.protocol === "http:" && local))
35
+ throw new Error("Remote model endpoints must use HTTPS");
36
+ return url.toString().replace(/\/$/, "");
37
+ }
38
+ async function readRaw() {
39
+ try {
40
+ const value = JSON.parse(await readFile(settingsFile(), "utf8"));
41
+ const legacy = typeof value.activeCoachProfileId === "string" ? value.activeCoachProfileId : undefined;
42
+ const rawRuntime = value.agentRuntime && typeof value.agentRuntime === "object" ? value.agentRuntime : {};
43
+ const agentRuntime = {
44
+ kind: ["cursor", "claude", "opencode"].includes(rawRuntime.kind) ? rawRuntime.kind : "aperta",
45
+ model: typeof rawRuntime.model === "string" ? rawRuntime.model.trim().slice(0, 160) : "",
46
+ command: runtimeCommands[["cursor", "claude", "opencode"].includes(rawRuntime.kind) ? rawRuntime.kind : "aperta"],
47
+ };
48
+ return { version: 2, activeProfileIds: value.activeProfileIds && typeof value.activeProfileIds === "object" ? value.activeProfileIds : legacy ? { builder: legacy, coach: legacy, verifier: legacy } : {}, profiles: Array.isArray(value.profiles) ? value.profiles : [], agentRuntime };
49
+ }
50
+ catch (error) {
51
+ if (error.code === "ENOENT")
52
+ return { version: 2, activeProfileIds: {}, profiles: [], agentRuntime: { ...defaultAgentRuntime } };
53
+ throw error;
54
+ }
55
+ }
56
+ async function writeRaw(settings) {
57
+ await mkdir(settingsDir(), { recursive: true });
58
+ const temporary = join(settingsDir(), `settings.${process.pid}.tmp`);
59
+ await writeFile(temporary, `${JSON.stringify(settings, null, 2)}\n`, { encoding: "utf8", mode: 0o600 });
60
+ await rename(temporary, settingsFile());
61
+ }
62
+ async function keychainRead(id) {
63
+ if (process.platform !== "darwin")
64
+ return null;
65
+ try {
66
+ return (await execFileAsync("security", ["find-generic-password", "-w", "-s", serviceName(id), "-a", "api-key"], { maxBuffer: 64 * 1024 })).stdout.trim();
67
+ }
68
+ catch {
69
+ return null;
70
+ }
71
+ }
72
+ async function keychainWrite(id, secret) {
73
+ if (process.platform !== "darwin")
74
+ throw new Error("Secure credential storage is not available on this platform; use environment variables.");
75
+ await execFileAsync("security", ["add-generic-password", "-U", "-s", serviceName(id), "-a", "api-key", "-w", secret], { maxBuffer: 64 * 1024 });
76
+ }
77
+ async function keychainDelete(id) {
78
+ if (process.platform !== "darwin")
79
+ return;
80
+ try {
81
+ await execFileAsync("security", ["delete-generic-password", "-s", serviceName(id), "-a", "api-key"], { maxBuffer: 64 * 1024 });
82
+ }
83
+ catch { }
84
+ }
85
+ function environmentKey(provider) {
86
+ if (process.env.APERTA_AI_API_KEY)
87
+ return process.env.APERTA_AI_API_KEY;
88
+ if (provider === "openai")
89
+ return process.env.OPENAI_API_KEY;
90
+ if (provider === "anthropic")
91
+ return process.env.ANTHROPIC_API_KEY;
92
+ if (provider === "google")
93
+ return process.env.GOOGLE_API_KEY ?? process.env.GEMINI_API_KEY;
94
+ if (provider === "deepseek")
95
+ return process.env.DEEPSEEK_API_KEY;
96
+ if (provider === "openrouter")
97
+ return process.env.OPENROUTER_API_KEY;
98
+ if (provider === "groq")
99
+ return process.env.GROQ_API_KEY;
100
+ return undefined;
101
+ }
102
+ export async function publicModelSettings() {
103
+ const settings = await readRaw();
104
+ const profiles = await Promise.all(settings.profiles.map(async (profile) => ({ ...profile, credentialConfigured: profile.provider === "ollama" || Boolean(environmentKey(profile.provider)) || Boolean(await keychainRead(profile.id)) })));
105
+ const [agentRuntime, apertaRuntime, cursorRuntime, claudeRuntime, opencodeRuntime] = await Promise.all([
106
+ inspectAgentRuntime(settings.agentRuntime),
107
+ inspectAgentRuntime({ kind: "aperta", model: "", command: "" }),
108
+ inspectAgentRuntime({ kind: "cursor", model: settings.agentRuntime.kind === "cursor" ? settings.agentRuntime.model : "", command: "cursor-agent" }),
109
+ inspectAgentRuntime({ kind: "claude", model: settings.agentRuntime.kind === "claude" ? settings.agentRuntime.model : "", command: "claude" }),
110
+ inspectAgentRuntime({ kind: "opencode", model: settings.agentRuntime.kind === "opencode" ? settings.agentRuntime.model : "", command: "opencode" }),
111
+ ]);
112
+ return { activeCoachProfileId: settings.activeProfileIds.coach ?? null, activeProfileIds: settings.activeProfileIds, profiles, providers: providerCatalog, agentRuntime, agentRuntimes: [apertaRuntime, cursorRuntime, claudeRuntime, opencodeRuntime], secureStorage: process.platform === "darwin" ? "macOS Keychain" : "environment only" };
113
+ }
114
+ export async function inspectAgentRuntime(config) {
115
+ const runtime = config ?? (await readRaw()).agentRuntime;
116
+ if (runtime.kind === "aperta")
117
+ return { ...runtime, available: true, detail: "Aperta's bounded native tool loop is available." };
118
+ try {
119
+ const { stdout, stderr } = await execFileAsync(runtime.command, ["--version"], { timeout: 5_000, maxBuffer: 64 * 1024 });
120
+ const version = `${stdout}${stderr}`.trim().split("\n")[0]?.slice(0, 160) || "installed";
121
+ const label = runtime.kind === "cursor" ? "Cursor" : runtime.kind === "claude" ? "Claude Code" : "OpenCode";
122
+ if (runtime.kind === "claude" && !process.env.ANTHROPIC_API_KEY && !process.env.CLAUDE_CODE_OAUTH_TOKEN) {
123
+ try {
124
+ const auth = await execFileAsync(runtime.command, ["auth", "status"], { timeout: 5_000, maxBuffer: 64 * 1024 });
125
+ const status = JSON.parse(auth.stdout);
126
+ if (status?.loggedIn !== true)
127
+ return { ...runtime, available: false, version, detail: "Claude Code is installed but is not authenticated. Run claude auth login first." };
128
+ }
129
+ catch {
130
+ return { ...runtime, available: false, version, detail: "Claude Code is installed, but Aperta could not verify its authentication. Run claude auth status." };
131
+ }
132
+ }
133
+ return { ...runtime, available: true, version, detail: `${label} CLI is installed. Authentication remains managed by ${label}.` };
134
+ }
135
+ catch (error) {
136
+ const missing = error.code === "ENOENT";
137
+ const label = runtime.kind === "cursor" ? "Cursor" : runtime.kind === "claude" ? "Claude Code" : "OpenCode";
138
+ return { ...runtime, available: false, detail: missing ? `${label} CLI is not installed or is not on PATH.` : `${label} CLI could not be started: ${error instanceof Error ? error.message : String(error)}` };
139
+ }
140
+ }
141
+ export async function saveAgentRuntime(input) {
142
+ if (!input.kind || !["aperta", "cursor", "claude", "opencode"].includes(input.kind))
143
+ throw new Error("Choose a supported agent runtime");
144
+ const settings = await readRaw();
145
+ const runtime = { kind: input.kind, model: typeof input.model === "string" ? input.model.trim().slice(0, 160) : "", command: runtimeCommands[input.kind] };
146
+ const status = await inspectAgentRuntime(runtime);
147
+ if (runtime.kind !== "aperta" && !status.available)
148
+ throw new Error(`${status.detail} Install and authenticate the runtime before activating it.`);
149
+ settings.agentRuntime = runtime;
150
+ await writeRaw(settings);
151
+ return status;
152
+ }
153
+ export async function activeAgentRuntime() {
154
+ return inspectAgentRuntime((await readRaw()).agentRuntime);
155
+ }
156
+ export async function saveModelProfile(input) {
157
+ if (!input.provider || !providers.has(input.provider))
158
+ throw new Error("Choose a supported model provider");
159
+ if (!input.model?.trim())
160
+ throw new Error("Model ID is required");
161
+ const settings = await readRaw();
162
+ const id = input.id && /^[a-zA-Z0-9-]{8,80}$/.test(input.id) ? input.id : randomUUID();
163
+ const existing = settings.profiles.find((profile) => profile.id === id);
164
+ const baseUrl = validateUrl(input.baseUrl?.trim() || defaultBaseUrls[input.provider]);
165
+ let credentialSource = input.provider === "ollama" ? "none" : existing?.credentialSource ?? "environment";
166
+ if (input.apiKey?.trim()) {
167
+ await keychainWrite(id, input.apiKey.trim());
168
+ credentialSource = "keychain";
169
+ }
170
+ const profile = { id, name: input.name?.trim().slice(0, 80) || `${input.provider} · ${input.model.trim()}`, provider: input.provider, model: input.model.trim(), baseUrl, credentialSource, toolTransport: input.toolTransport ?? existing?.toolTransport ?? (input.provider === "openai-compatible" ? "json" : "native"), capabilities: input.capabilities ?? existing?.capabilities };
171
+ settings.profiles = [profile, ...settings.profiles.filter((item) => item.id !== id)];
172
+ if (input.activate || !settings.activeProfileIds.builder)
173
+ settings.activeProfileIds.builder = id;
174
+ if (input.activate || !settings.activeProfileIds.coach)
175
+ settings.activeProfileIds.coach = id;
176
+ if (!settings.activeProfileIds.verifier)
177
+ settings.activeProfileIds.verifier = id;
178
+ await writeRaw(settings);
179
+ return profile;
180
+ }
181
+ export async function activateModelProfile(id) {
182
+ const settings = await readRaw();
183
+ if (!settings.profiles.some((profile) => profile.id === id))
184
+ throw new Error("Model profile not found");
185
+ settings.activeProfileIds.coach = id;
186
+ settings.activeProfileIds.builder = id;
187
+ await writeRaw(settings);
188
+ }
189
+ export async function assignModelRole(id, role) {
190
+ const settings = await readRaw();
191
+ if (!settings.profiles.some((profile) => profile.id === id))
192
+ throw new Error("Model profile not found");
193
+ if (!["builder", "coach", "verifier"].includes(role))
194
+ throw new Error("Unknown model role");
195
+ settings.activeProfileIds[role] = id;
196
+ await writeRaw(settings);
197
+ }
198
+ export async function deleteModelProfile(id) {
199
+ const settings = await readRaw();
200
+ if (!settings.profiles.some((profile) => profile.id === id))
201
+ throw new Error("Model profile not found");
202
+ settings.profiles = settings.profiles.filter((profile) => profile.id !== id);
203
+ for (const role of ["builder", "coach", "verifier"])
204
+ if (settings.activeProfileIds[role] === id) {
205
+ const replacement = settings.profiles[0]?.id;
206
+ if (replacement)
207
+ settings.activeProfileIds[role] = replacement;
208
+ else
209
+ delete settings.activeProfileIds[role];
210
+ }
211
+ await writeRaw(settings);
212
+ await keychainDelete(id);
213
+ }
214
+ function providerHeaders(provider, apiKey) {
215
+ if (provider === "anthropic")
216
+ return { "x-api-key": apiKey ?? "", "anthropic-version": "2023-06-01" };
217
+ if (provider === "google")
218
+ return { "x-goog-api-key": apiKey ?? "" };
219
+ return apiKey ? { authorization: `Bearer ${apiKey}` } : {};
220
+ }
221
+ async function inspectionKey(input) {
222
+ if (input.apiKey?.trim())
223
+ return input.apiKey.trim();
224
+ if (input.id) {
225
+ const stored = await keychainRead(input.id);
226
+ if (stored)
227
+ return stored;
228
+ }
229
+ return input.provider ? environmentKey(input.provider) : undefined;
230
+ }
231
+ export async function inspectModelProvider(input, fetcher = fetch) {
232
+ if (!input.provider || !providers.has(input.provider))
233
+ throw new Error("Choose a supported model provider");
234
+ const baseUrl = validateUrl(input.baseUrl?.trim() || defaultBaseUrls[input.provider]);
235
+ const apiKey = await inspectionKey(input);
236
+ const local = ["127.0.0.1", "localhost", "::1"].includes(new URL(baseUrl).hostname);
237
+ if (input.provider !== "ollama" && !(input.provider === "openai-compatible" && local) && !apiKey)
238
+ throw new Error("Add an API key before testing this provider");
239
+ const started = Date.now();
240
+ let discoveryError = "";
241
+ let models = [];
242
+ try {
243
+ const url = input.provider === "ollama" ? `${baseUrl}/api/tags` : input.provider === "google" ? `${baseUrl}/models?pageSize=1000` : input.provider === "anthropic" ? `${baseUrl}/models?limit=1000` : `${baseUrl}/models`;
244
+ const response = await fetcher(url, { headers: providerHeaders(input.provider, apiKey), signal: AbortSignal.timeout(12_000) });
245
+ const text = await response.text();
246
+ if (!response.ok)
247
+ throw new Error(`${response.status}: ${text.slice(0, 180)}`);
248
+ const body = JSON.parse(text);
249
+ const rows = input.provider === "ollama" ? body.models : input.provider === "google" ? body.models : body.data;
250
+ models = (Array.isArray(rows) ? rows : []).map((row) => {
251
+ const id = String(row.id ?? row.name ?? "").replace(/^models\//, "");
252
+ const parameters = Array.isArray(row.supported_parameters) ? row.supported_parameters : [];
253
+ return { id, name: String(row.display_name ?? row.displayName ?? row.name ?? row.id ?? id).replace(/^models\//, ""), nativeTools: parameters.length ? parameters.includes("tools") : undefined, contextWindow: Number(row.context_length ?? row.contextWindow ?? 0) || undefined };
254
+ }).filter((model) => model.id).sort((a, b) => a.name.localeCompare(b.name));
255
+ }
256
+ catch (error) {
257
+ discoveryError = error instanceof Error ? error.message : String(error);
258
+ }
259
+ let nativeTools = false, toolError = "";
260
+ if (input.model?.trim()) {
261
+ const config = { provider: input.provider, model: input.model.trim(), baseUrl, apiKey, toolTransport: "native" };
262
+ try {
263
+ const action = await requestProviderAction(config, "You are testing a model connection. Use the required tool.", "Return a finish action whose summary is connection ready.", undefined, fetcher, 300);
264
+ nativeTools = action?.action === "finish";
265
+ if (!nativeTools)
266
+ toolError = "The model connected but did not honor the native action schema.";
267
+ }
268
+ catch (error) {
269
+ toolError = error instanceof Error ? error.message : String(error);
270
+ try {
271
+ await requestProviderJson({ ...config, toolTransport: "json" }, "Return JSON only.", 'Return {"action":"finish","summary":"connection ready"}.', undefined, fetcher, 300);
272
+ }
273
+ catch (fallbackError) {
274
+ throw new Error(`Connection failed: ${fallbackError instanceof Error ? fallbackError.message : String(fallbackError)}`);
275
+ }
276
+ }
277
+ }
278
+ else if (discoveryError)
279
+ throw new Error(`Model discovery failed: ${discoveryError}`);
280
+ const detail = [nativeTools ? "Native tool calling verified." : input.model ? "Connected using structured JSON fallback." : "Choose a model to verify tool calling.", discoveryError ? `Model discovery unavailable: ${discoveryError}` : ""].filter(Boolean).join(" ");
281
+ return { baseUrl, models, testedModel: input.model?.trim() ?? "", capabilities: { status: nativeTools || !toolError ? "connected" : "degraded", nativeTools, modelDiscovery: !discoveryError, testedAt: new Date().toISOString(), latencyMs: Date.now() - started, detail } };
282
+ }
283
+ export async function retestModelProfile(id, fetcher = fetch) {
284
+ const settings = await readRaw();
285
+ const profile = settings.profiles.find((item) => item.id === id);
286
+ if (!profile)
287
+ throw new Error("Model profile not found");
288
+ const inspection = await inspectModelProvider(profile, fetcher);
289
+ profile.baseUrl = inspection.baseUrl;
290
+ profile.capabilities = inspection.capabilities;
291
+ profile.toolTransport = inspection.capabilities.nativeTools ? "native" : "json";
292
+ await writeRaw(settings);
293
+ return profile;
294
+ }
295
+ export async function activeModelConfig(role = "builder") {
296
+ const settings = await readRaw();
297
+ const profile = settings.profiles.find((item) => item.id === (settings.activeProfileIds[role] ?? settings.activeProfileIds.builder ?? settings.activeProfileIds.coach));
298
+ if (!profile)
299
+ return null;
300
+ const apiKey = await keychainRead(profile.id) ?? environmentKey(profile.provider);
301
+ if (profile.provider !== "ollama" && !(profile.provider === "openai-compatible" && ["127.0.0.1", "localhost", "::1"].includes(new URL(profile.baseUrl).hostname)) && !apiKey)
302
+ return null;
303
+ return { provider: profile.provider, model: profile.model, baseUrl: profile.baseUrl, apiKey, toolTransport: profile.toolTransport };
304
+ }
305
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAwC,MAAM,YAAY,CAAC;AAE9G,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1C,MAAM,SAAS,GAAG,IAAI,GAAG,CAAgB,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC;AAC7I,MAAM,eAAe,GAAkC;IACrD,MAAM,EAAE,2BAA2B,EAAE,SAAS,EAAE,8BAA8B,EAAE,MAAM,EAAE,kDAAkD;IAC1I,QAAQ,EAAE,0BAA0B,EAAE,MAAM,EAAE,wBAAwB,EAAE,UAAU,EAAE,8BAA8B,EAAE,IAAI,EAAE,gCAAgC,EAAE,mBAAmB,EAAE,EAAE;CACpL,CAAC;AAQF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,yCAAyC,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,CAAC,MAAM,EAAE;IAC9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F,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACzB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAkB,SAAS;IACjE,MAAM,QAAQ,GAAG,MAAM,OAAO,EAAE,CAAC;IACjC,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,gBAAgB,CAAC,OAAO,IAAI,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;IACxK,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClF,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,mBAAmB,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAC1L,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC;AACtI,CAAC"}
@@ -0,0 +1,104 @@
1
+ const readTools = ["repository.list", "repository.read", "repository.search"];
2
+ const changeTools = [...readTools, "repository.write", "checks.run", "service.start", "http.local"];
3
+ const definitions = [
4
+ {
5
+ id: "debug-failing-behavior", version: 1, label: "Debug failing behavior", description: "Reproduce, isolate, repair, and independently verify an observed failure.", mode: "diagnose", allowedTools: changeTools,
6
+ phases: [
7
+ { id: "reproduce", title: "Reproduce the failure", detail: "Use the reported or detected check to establish concrete failing evidence." },
8
+ { id: "isolate", title: "Isolate the cause", detail: "Trace the smallest code path that explains the observed output." },
9
+ { id: "repair", title: "Repair the cause", detail: "Make the smallest coherent correction without weakening legitimate checks." },
10
+ { id: "verify", title: "Verify the repair", detail: "Rerun the relevant check and compare the result with the original failure." },
11
+ ],
12
+ proof: [
13
+ { id: "failure-observed", text: "The original failure is grounded in recorded command or repository evidence.", method: "checks" },
14
+ { id: "cause-repaired", text: "The patch addresses the identified cause rather than suppressing its symptom.", method: "diff" },
15
+ { id: "repair-verified", text: "The relevant project check passes after the repair.", method: "checks" },
16
+ ],
17
+ learningObjectives: ["Trace the failure from its observable output to the responsible execution path.", "Explain why the repair addresses the cause and not only the symptom.", "Name the first diagnostic signal to inspect if the failure returns."],
18
+ score: (intent) => /\b(?:failing|failure|broken|error|exception|regression|doesn'?t work|not working|fix the checks?|compiler output)\b/i.test(intent) ? 100 : 0,
19
+ },
20
+ {
21
+ id: "verify-project", version: 1, label: "Verify project behavior", description: "Execute detected project checks and report observed evidence without manufacturing a patch.", mode: "verify", allowedTools: [...readTools, "checks.run", "service.start", "http.local"],
22
+ phases: [
23
+ { id: "detect", title: "Detect verification surface", detail: "Identify the relevant allowlisted project check or bounded runtime probe." },
24
+ { id: "execute", title: "Execute verification", detail: "Run the requested capability through Aperta and retain complete output locally." },
25
+ { id: "interpret", title: "Interpret evidence", detail: "Report what the result proves and what remains outside its scope." },
26
+ ],
27
+ proof: [{ id: "observed-result", text: "The response cites an Aperta-executed check or runtime observation.", method: "checks" }],
28
+ learningObjectives: ["Explain what the executed check covers.", "Distinguish a passing command from proof of the requested behavior.", "Identify the next check that would reduce remaining uncertainty."],
29
+ score: (intent) => /\b(?:run|execute|rerun|re-run|verify)\b[\s\S]{0,80}\b(?:tests?|checks?|build|lint|typecheck|type-check|health|endpoint)\b/i.test(intent) ? 90 : 0,
30
+ },
31
+ {
32
+ id: "observe-runtime", version: 1, label: "Observe runtime behavior", description: "Start or inspect a bounded local runtime and distinguish live evidence from configuration inference.", mode: "observe", allowedTools: [...readTools, "checks.run", "service.start", "http.local"],
33
+ phases: [
34
+ { id: "orient", title: "Inspect runtime configuration", detail: "Find the configured service, command, endpoint, and expected port." },
35
+ { id: "observe", title: "Collect live evidence", detail: "Use an Aperta-managed service or localhost probe when the request requires live status." },
36
+ { id: "interpret", title: "Separate evidence from inference", detail: "State exactly what was observed and what is known only from repository configuration." },
37
+ ],
38
+ proof: [{ id: "runtime-observed", text: "A bounded local capability records the runtime result when live status is requested.", method: "checks" }],
39
+ learningObjectives: ["Trace the runtime from configuration to its observable endpoint or port.", "Explain which conclusion is directly observed and which is inferred.", "Describe how to reproduce the observation without the agent."],
40
+ score: (intent) => /\b(?:is|are|check|inspect|probe|start|run|try|curl|request|whether|status)\b[\s\S]{0,80}\b(?:redis|postgres|mysql|mongo(?:db)?|server|service|runtime|curl|localhost|port|endpoint|running|reachable|live|health)\b/i.test(intent) || /\b(?:redis|postgres|mysql|mongo(?:db)?|server|service|runtime|curl|localhost|port|endpoint)\b[\s\S]{0,60}\b(?:running|reachable|status|available|responding|up|request)\b/i.test(intent) ? 80 : 0,
41
+ },
42
+ {
43
+ id: "implement-proven-change", version: 1, label: "Implement a proven change", description: "Inspect, plan, implement, verify, and prepare a scoped patch for human promotion.", mode: "change", allowedTools: changeTools,
44
+ phases: [
45
+ { id: "understand", title: "Understand the requested behavior", detail: "Inspect the relevant implementation, callers, conventions, and existing evidence." },
46
+ { id: "plan", title: "Plan the smallest coherent change", detail: "Name the affected behavior, constraints, risks, and verification strategy." },
47
+ { id: "implement", title: "Implement the change", detail: "Modify only the repository surfaces needed for the requested outcome." },
48
+ { id: "verify", title: "Prove the result", detail: "Run relevant detected checks and retain the resulting evidence." },
49
+ ],
50
+ proof: [
51
+ { id: "requested-outcome", text: "The isolated patch implements the requested observable outcome.", method: "diff" },
52
+ { id: "project-checks", text: "Relevant detected project checks pass after the change.", method: "checks" },
53
+ ],
54
+ learningObjectives: ["Trace the changed behavior through its primary execution path.", "Explain why the implementation works and where it could fail.", "Describe one safe follow-up modification and its verification check."],
55
+ score: (intent) => /\b(?:add|build|create|change|edit|implement|update|remove|replace|refactor|make|fix|increase|decrease|enable|disable|toggle|rename|move)\b/i.test(intent) ? 70 : 0,
56
+ },
57
+ {
58
+ id: "explain-code", version: 1, label: "Explain repository behavior", description: "Ground an explanation in repository evidence without changing files.", mode: "analyze", allowedTools: readTools,
59
+ phases: [
60
+ { id: "orient", title: "Find the relevant surfaces", detail: "Locate the entry point, implementation, configuration, and evidence relevant to the question." },
61
+ { id: "trace", title: "Trace the behavior", detail: "Follow control and data through the smallest grounded repository path." },
62
+ { id: "explain", title: "Explain with boundaries", detail: "Answer clearly while separating observed code from inference and unresolved runtime behavior." },
63
+ ],
64
+ proof: [{ id: "grounded-explanation", text: "The explanation is grounded in inspected repository evidence and names remaining uncertainty.", method: "human" }],
65
+ learningObjectives: ["Trace the behavior from entry point to observable outcome.", "Identify the repository evidence supporting the explanation.", "Name one uncertainty that requires executable evidence."],
66
+ score: (intent) => /\b(?:explain|how|why|what|where|understand|walk me through|trace|show me)\b/i.test(intent) ? 60 : 0,
67
+ },
68
+ {
69
+ id: "explore-repository", version: 1, label: "Explore the repository", description: "Inspect and summarize repository structure without making changes.", mode: "analyze", allowedTools: readTools,
70
+ phases: [{ id: "inspect", title: "Inspect repository evidence", detail: "Search and read only the surfaces needed to answer the request." }, { id: "summarize", title: "Summarize with uncertainty", detail: "Return a grounded answer and clearly identify what was not verified." }],
71
+ proof: [{ id: "grounded-answer", text: "The answer is grounded in inspected repository content.", method: "human" }],
72
+ learningObjectives: ["Identify the repository surfaces that support the answer.", "Explain the most important relationship discovered during inspection."],
73
+ score: () => 1,
74
+ },
75
+ ];
76
+ export function selectAgentSkill(intent) {
77
+ const selected = definitions.map((skill) => ({ skill, score: skill.score(intent) })).sort((a, b) => b.score - a.score)[0].skill;
78
+ const { score: _score, ...contract } = selected;
79
+ return { ...contract, allowedTools: [...contract.allowedTools], phases: contract.phases.map((phase) => ({ ...phase })), proof: contract.proof.map((item) => ({ ...item })), learningObjectives: [...contract.learningObjectives], reason: `Selected deterministically from the request as ${contract.mode} work.` };
80
+ }
81
+ export function toolForAgentAction(action) {
82
+ if (action.action === "list")
83
+ return "repository.list";
84
+ if (action.action === "read")
85
+ return "repository.read";
86
+ if (action.action === "search")
87
+ return "repository.search";
88
+ if (action.action === "write")
89
+ return "repository.write";
90
+ if (action.action === "service")
91
+ return "service.start";
92
+ if (action.action === "run")
93
+ return action.command === "curl" ? "http.local" : "checks.run";
94
+ return null;
95
+ }
96
+ export function assertSkillAllowsAction(skill, action) {
97
+ const tool = toolForAgentAction(action);
98
+ if (tool && !skill.allowedTools.includes(tool))
99
+ throw new Error(`${skill.label} does not permit ${tool}. Start a change-oriented task if repository mutation is intended.`);
100
+ }
101
+ export function skillPrompt(skill) {
102
+ return { id: skill.id, version: skill.version, label: skill.label, mode: skill.mode, allowedTools: skill.allowedTools, phases: skill.phases, proofRequirements: skill.proof, learningObjectives: skill.learningObjectives, instruction: "Follow this Aperta skill contract. Do not use capabilities outside allowedTools. Preserve its proof requirements if you refine the implementation plan." };
103
+ }
104
+ //# sourceMappingURL=skills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/skills.ts"],"names":[],"mappings":"AAoCA,MAAM,SAAS,GAAkB,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;AAC7F,MAAM,WAAW,GAAkB,CAAC,GAAG,SAAS,EAAE,kBAAkB,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC;AAEnH,MAAM,WAAW,GAAsB;IACrC;QACE,EAAE,EAAE,wBAAwB,EAAE,OAAO,EAAE,CAAC,EAAE,K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I,MAAM,CAAC,MAAM,KAAK,OAAO;QAAE,OAAO,kBAAkB,CAAC;IACzD,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,eAAe,CAAC;IACxD,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK;QAAE,OAAO,MAAM,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC;IAC5F,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,KAAyB,EAAE,MAA+B;IAChG,MAAM,IAAI,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,oBAAoB,IAAI,oEAAoE,CAAC,CAAC;AAC9K,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAyB;IACnD,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,KAAK,EAAE,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAAE,WAAW,EAAE,yJAAyJ,EAAE,CAAC;AACtY,CAAC"}
@@ -0,0 +1,163 @@
1
+ import { createHash, randomUUID } from "node:crypto";
2
+ import { execFile } from "node:child_process";
3
+ import { chmod, cp, lstat, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
4
+ import { readFileSync } from "node:fs";
5
+ import { homedir, tmpdir } from "node:os";
6
+ import { dirname, join, resolve } from "node:path";
7
+ import { promisify } from "node:util";
8
+ const execFileAsync = promisify(execFile);
9
+ export const APERTA_DIR = ".comprehension";
10
+ export const PROJECT_FILE = "project.json";
11
+ const migrations = new Map();
12
+ const initialized = new Set();
13
+ export function apertaHome() {
14
+ if (process.env.APERTA_HOME)
15
+ return resolve(process.env.APERTA_HOME);
16
+ if (process.env.NODE_TEST_CONTEXT)
17
+ return join(tmpdir(), "aperta-test-home");
18
+ return join(homedir(), ".aperta");
19
+ }
20
+ function fallbackId(root) {
21
+ return createHash("sha256").update(resolve(root)).digest("hex").slice(0, 24);
22
+ }
23
+ export function projectIdentity(root) {
24
+ try {
25
+ const parsed = JSON.parse(readFileSync(join(root, APERTA_DIR, PROJECT_FILE), "utf8"));
26
+ if (parsed?.version === 1 && typeof parsed.id === "string" && /^[a-f0-9-]{16,64}$/i.test(parsed.id))
27
+ return parsed;
28
+ }
29
+ catch { }
30
+ return { version: 1, id: fallbackId(root), createdAt: new Date(0).toISOString() };
31
+ }
32
+ export function privateProjectDir(root) {
33
+ return join(apertaHome(), "repositories", projectIdentity(root).id);
34
+ }
35
+ export function privateCachePath(root, ...parts) {
36
+ return join(privateProjectDir(root), "cache", ...parts);
37
+ }
38
+ async function exists(path) {
39
+ try {
40
+ await stat(path);
41
+ return true;
42
+ }
43
+ catch {
44
+ return false;
45
+ }
46
+ }
47
+ async function hardenPrivatePath(path) {
48
+ const details = await lstat(path);
49
+ if (details.isSymbolicLink())
50
+ return;
51
+ if (details.isDirectory()) {
52
+ await chmod(path, 0o700);
53
+ for (const entry of await readdir(path))
54
+ await hardenPrivatePath(join(path, entry));
55
+ return;
56
+ }
57
+ if (details.isFile())
58
+ await chmod(path, 0o600);
59
+ }
60
+ async function trackedLegacyFiles(root) {
61
+ try {
62
+ const { stdout } = await execFileAsync("git", ["ls-files", "--", `${APERTA_DIR}/config.json`, `${APERTA_DIR}/ledger.jsonl`, `${APERTA_DIR}/cache`], { cwd: root, maxBuffer: 64_000 });
63
+ return stdout.split("\n").filter(Boolean);
64
+ }
65
+ catch {
66
+ return [];
67
+ }
68
+ }
69
+ async function movePrivate(source, destination, backupDir) {
70
+ if (!(await exists(source)))
71
+ return false;
72
+ await mkdir(dirname(destination), { recursive: true, mode: 0o700 });
73
+ if (await exists(destination)) {
74
+ await mkdir(backupDir, { recursive: true, mode: 0o700 });
75
+ const backup = join(backupDir, source.split("/").at(-1) ?? "legacy-data");
76
+ try {
77
+ await rename(source, backup);
78
+ }
79
+ catch {
80
+ await cp(source, backup, { recursive: true });
81
+ await rm(source, { recursive: true, force: true });
82
+ }
83
+ return true;
84
+ }
85
+ try {
86
+ await rename(source, destination);
87
+ }
88
+ catch {
89
+ await cp(source, destination, { recursive: true });
90
+ await rm(source, { recursive: true, force: true });
91
+ }
92
+ return true;
93
+ }
94
+ export async function initializePrivateStorage(root, defaultConfig) {
95
+ const canonical = resolve(root);
96
+ if (initialized.has(canonical))
97
+ return false;
98
+ const publicDir = join(root, APERTA_DIR);
99
+ const identityPath = join(publicDir, PROJECT_FILE);
100
+ let created = false;
101
+ await mkdir(publicDir, { recursive: true });
102
+ let identity;
103
+ try {
104
+ identity = JSON.parse(await readFile(identityPath, "utf8"));
105
+ if (identity.version !== 1 || !/^[a-f0-9-]{16,64}$/i.test(identity.id))
106
+ throw new Error("invalid project identity");
107
+ }
108
+ catch {
109
+ const candidate = { version: 1, id: randomUUID(), createdAt: new Date().toISOString() };
110
+ try {
111
+ await writeFile(identityPath, `${JSON.stringify(candidate, null, 2)}\n`, { encoding: "utf8", mode: 0o644, flag: "wx" });
112
+ identity = candidate;
113
+ created = true;
114
+ }
115
+ catch (error) {
116
+ if (error.code !== "EEXIST")
117
+ throw error;
118
+ identity = JSON.parse(await readFile(identityPath, "utf8"));
119
+ }
120
+ }
121
+ const privateDir = join(apertaHome(), "repositories", identity.id);
122
+ const cacheDir = join(privateDir, "cache");
123
+ await mkdir(privateDir, { recursive: true, mode: 0o700 });
124
+ const previouslyTracked = await trackedLegacyFiles(root);
125
+ const stamp = new Date().toISOString().replace(/[:.]/g, "-");
126
+ const backupDir = join(privateDir, "migration", stamp);
127
+ const migrated = [];
128
+ for (const [name, destination] of [
129
+ ["config.json", join(privateDir, "config.json")],
130
+ ["ledger.jsonl", join(privateDir, "ledger.jsonl")],
131
+ ["cache", cacheDir],
132
+ ]) {
133
+ if (await movePrivate(join(publicDir, name), destination, backupDir))
134
+ migrated.push(name);
135
+ }
136
+ if (!(await exists(join(privateDir, "config.json"))))
137
+ await writeFile(join(privateDir, "config.json"), `${JSON.stringify(defaultConfig, null, 2)}\n`, { encoding: "utf8", mode: 0o600 });
138
+ if (!(await exists(join(privateDir, "ledger.jsonl"))))
139
+ await writeFile(join(privateDir, "ledger.jsonl"), "", { encoding: "utf8", mode: 0o600 });
140
+ await mkdir(cacheDir, { recursive: true, mode: 0o700 });
141
+ await writeFile(join(publicDir, ".gitignore"), "*\n!.gitignore\n!project.json\n", "utf8");
142
+ if (migrated.length || previouslyTracked.length) {
143
+ const migration = { migrated, previouslyTracked, privateDirectory: privateDir };
144
+ migrations.set(resolve(root), migration);
145
+ await writeFile(join(privateDir, "migration.json"), `${JSON.stringify({ ...migration, migratedAt: new Date().toISOString(), source: resolve(root) }, null, 2)}\n`, { encoding: "utf8", mode: 0o600 });
146
+ }
147
+ await hardenPrivatePath(privateDir);
148
+ initialized.add(canonical);
149
+ return created;
150
+ }
151
+ export function storageMigration(root) {
152
+ return migrations.get(resolve(root)) ?? null;
153
+ }
154
+ export async function inspectStoragePrivacy(root) {
155
+ const legacy = await Promise.all(["config.json", "ledger.jsonl", "cache"].map(async (name) => (await exists(join(root, APERTA_DIR, name))) ? `${APERTA_DIR}/${name}` : null));
156
+ return {
157
+ privateDirectory: privateProjectDir(root),
158
+ repositoryIdentity: join(root, APERTA_DIR, PROJECT_FILE),
159
+ legacyPaths: legacy.filter((path) => Boolean(path)),
160
+ trackedPrivatePaths: await trackedLegacyFiles(root),
161
+ };
162
+ }
163
+ //# sourceMappingURL=storage.js.map