agent-valley 4.15.0 → 4.16.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.
package/dist/index.js CHANGED
@@ -23458,7 +23458,7 @@ var require_dist3 = __commonJS(function(exports) {
23458
23458
  });
23459
23459
 
23460
23460
  // ../../node_modules/.bun/readdirp@5.1.1/node_modules/readdirp/index.js
23461
- import { lstat as lstat36, readdir as readdir22, realpath as realpath41, stat as stat9 } from "node:fs/promises";
23461
+ import { lstat as lstat37, readdir as readdir23, realpath as realpath42, stat as stat9 } from "node:fs/promises";
23462
23462
  import { join as pjoin, resolve as presolve, sep as psep } from "node:path";
23463
23463
  import { Readable as Readable2 } from "node:stream";
23464
23464
  function readdirp(root, options = {}) {
@@ -23555,7 +23555,7 @@ var init_readdirp = __esm(() => {
23555
23555
  const type = opts.type ?? defaultOptions4.type;
23556
23556
  this._fileFilter = normalizeFilter(opts.fileFilter);
23557
23557
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
23558
- const statMethod = opts.lstat ? lstat36 : stat9;
23558
+ const statMethod = opts.lstat ? lstat37 : stat9;
23559
23559
  if (wantBigintFsStats) {
23560
23560
  this._stat = (path) => statMethod(path, { bigint: true });
23561
23561
  } else {
@@ -23636,7 +23636,7 @@ var init_readdirp = __esm(() => {
23636
23636
  async _exploreDir(path, depth) {
23637
23637
  let files;
23638
23638
  try {
23639
- files = await readdir22(path, this._rdOptions);
23639
+ files = await readdir23(path, this._rdOptions);
23640
23640
  } catch (error) {
23641
23641
  this._onError(error);
23642
23642
  }
@@ -23681,8 +23681,8 @@ var init_readdirp = __esm(() => {
23681
23681
  async _getSymlinkEntryType(entry) {
23682
23682
  const full = entry.fullPath;
23683
23683
  try {
23684
- const entryRealPath = await realpath41(full);
23685
- const entryRealPathStats = await lstat36(entryRealPath);
23684
+ const entryRealPath = await realpath42(full);
23685
+ const entryRealPathStats = await lstat37(entryRealPath);
23686
23686
  if (entryRealPathStats.isFile()) {
23687
23687
  return "file";
23688
23688
  }
@@ -23885,7 +23885,7 @@ var init_runtime = __esm(() => {
23885
23885
 
23886
23886
  // ../../node_modules/.bun/chokidar@6.0.0/node_modules/chokidar/backend.js
23887
23887
  import { watch as fsWatch, realpathSync as realpathSync8 } from "node:fs";
23888
- import { lstat as lstat37, open as open20, stat as stat10 } from "node:fs/promises";
23888
+ import { lstat as lstat38, open as open20, stat as stat10 } from "node:fs/promises";
23889
23889
  import * as sp2 from "node:path";
23890
23890
  function allocateSharedResourceGeneration() {
23891
23891
  return ++nextGeneration;
@@ -24102,7 +24102,7 @@ async function handleNativeError(path, cont, error) {
24102
24102
  }
24103
24103
  async function retireIfSelfRemoved(cont, nativePath) {
24104
24104
  try {
24105
- await lstat37(sp2.join(nativePath, sp2.basename(nativePath)));
24105
+ await lstat38(sp2.join(nativePath, sp2.basename(nativePath)));
24106
24106
  return;
24107
24107
  } catch (error) {
24108
24108
  if (!isMissingError(error))
@@ -24968,7 +24968,7 @@ var init_policy = __esm(() => {
24968
24968
  });
24969
24969
 
24970
24970
  // ../../node_modules/.bun/chokidar@6.0.0/node_modules/chokidar/reconcile.js
24971
- import { realpath as fsrealpath, lstat as lstat38, readlink as readlink2, stat as stat12 } from "node:fs/promises";
24971
+ import { realpath as fsrealpath, lstat as lstat39, readlink as readlink2, stat as stat12 } from "node:fs/promises";
24972
24972
  import * as sp5 from "node:path";
24973
24973
  function recoveryTrigger(resource) {
24974
24974
  return {
@@ -25191,7 +25191,7 @@ class ObservationEngine {
25191
25191
  }
25192
25192
  async mappedFileSnapshot(path) {
25193
25193
  try {
25194
- return await lstat38(path);
25194
+ return await lstat39(path);
25195
25195
  } catch (error) {
25196
25196
  if (isMissingError(error))
25197
25197
  return false;
@@ -25213,7 +25213,7 @@ class ObservationEngine {
25213
25213
  timer = undefined;
25214
25214
  (async () => {
25215
25215
  try {
25216
- await lstat38(path);
25216
+ await lstat39(path);
25217
25217
  } catch (error) {
25218
25218
  if (!active || !fsw.lifecycle.isActive(generation))
25219
25219
  return;
@@ -25275,7 +25275,7 @@ class ObservationEngine {
25275
25275
  const listener = async (_path, newStats) => {
25276
25276
  if (!newStats || newStats.mtimeMs === 0) {
25277
25277
  try {
25278
- const newStats = prevStats.isSymbolicLink() && !this.fsw.options.followSymlinks ? await lstat38(file) : await stat12(file);
25278
+ const newStats = prevStats.isSymbolicLink() && !this.fsw.options.followSymlinks ? await lstat39(file) : await stat12(file);
25279
25279
  if (!isActive())
25280
25280
  return;
25281
25281
  const at = newStats.atimeMs;
@@ -25405,7 +25405,7 @@ class ObservationEngine {
25405
25405
  let disappeared = false;
25406
25406
  let becameNonDirectory = false;
25407
25407
  try {
25408
- const currentStats = target ? await lstat38(affectedPath) : await stat12(affectedPath);
25408
+ const currentStats = target ? await lstat39(affectedPath) : await stat12(affectedPath);
25409
25409
  becameNonDirectory = !target && !currentStats.isDirectory();
25410
25410
  } catch (stateError) {
25411
25411
  if (isMissingError(stateError))
@@ -25437,7 +25437,7 @@ class ObservationEngine {
25437
25437
  if (!this.isHelperActive(wh, path))
25438
25438
  return;
25439
25439
  try {
25440
- await lstat38(path);
25440
+ await lstat39(path);
25441
25441
  return;
25442
25442
  } catch (error) {
25443
25443
  if (!isMissingError(error))
@@ -25557,7 +25557,7 @@ class ObservationEngine {
25557
25557
  let ancestor = sp5.dirname(candidate);
25558
25558
  while (true) {
25559
25559
  try {
25560
- await lstat38(ancestor);
25560
+ await lstat39(ancestor);
25561
25561
  return missing;
25562
25562
  } catch (error) {
25563
25563
  if (!isMissingError(error)) {
@@ -25593,7 +25593,7 @@ class ObservationEngine {
25593
25593
  return;
25594
25594
  let stats;
25595
25595
  try {
25596
- stats = await lstat38(candidate);
25596
+ stats = await lstat39(candidate);
25597
25597
  } catch (error) {
25598
25598
  if (!isMissingError(error)) {
25599
25599
  this.reportError(error);
@@ -25754,7 +25754,7 @@ class ObservationEngine {
25754
25754
  this.reconcileBackendTrigger(dir, false, trigger, async () => {
25755
25755
  let rootStats;
25756
25756
  try {
25757
- rootStats = await lstat38(dir);
25757
+ rootStats = await lstat39(dir);
25758
25758
  } catch (error) {
25759
25759
  if (isMissingError(error)) {
25760
25760
  this.fsw.removePath(parentPath, sp5.basename(dir), true);
@@ -25810,7 +25810,7 @@ class ObservationEngine {
25810
25810
  wh.recursiveDisabled = true;
25811
25811
  let currentStats;
25812
25812
  try {
25813
- currentStats = await lstat38(dir);
25813
+ currentStats = await lstat39(dir);
25814
25814
  } catch (statError) {
25815
25815
  if (isMissingError(statError))
25816
25816
  fsw.removePath(sp5.dirname(dir), sp5.basename(dir), true);
@@ -26004,7 +26004,7 @@ class ObservationEngine {
26004
26004
  if (trigger.kind === "native") {
26005
26005
  let observedStats;
26006
26006
  try {
26007
- const linkStats = await lstat38(dirPath);
26007
+ const linkStats = await lstat39(dirPath);
26008
26008
  observedStats = linkStats.isSymbolicLink() && this.fsw.options.followSymlinks ? await stat12(dirPath) : linkStats;
26009
26009
  } catch (error) {
26010
26010
  if (isMissingError(error)) {
@@ -26136,7 +26136,7 @@ class ObservationEngine {
26136
26136
  return "complete";
26137
26137
  }
26138
26138
  try {
26139
- const linkStats = await lstat38(wh.watchPath);
26139
+ const linkStats = await lstat39(wh.watchPath);
26140
26140
  if (!this.isHelperActive(wh)) {
26141
26141
  return "complete";
26142
26142
  }
@@ -26262,7 +26262,7 @@ var init_reconcile = __esm(() => {
26262
26262
  // ../../node_modules/.bun/chokidar@6.0.0/node_modules/chokidar/index.js
26263
26263
  import { EventEmitter as EventEmitter2 } from "node:events";
26264
26264
  import { realpathSync as realpathSync9 } from "node:fs";
26265
- import { readdir as readdir23 } from "node:fs/promises";
26265
+ import { readdir as readdir24 } from "node:fs/promises";
26266
26266
  import * as sp6 from "node:path";
26267
26267
  function* ancestorKeys(path) {
26268
26268
  let current = sp6.resolve(path);
@@ -26725,7 +26725,7 @@ var init_chokidar = __esm(() => {
26725
26725
  const generation = this.lifecycle.generation;
26726
26726
  this.lifecycle.track((async () => {
26727
26727
  try {
26728
- await readdir23(path);
26728
+ await readdir24(path);
26729
26729
  } catch (error) {
26730
26730
  if (isMissingError(error) && this.lifecycle.isActive(generation)) {
26731
26731
  this.removePath(sp6.dirname(path), sp6.basename(path));
@@ -27234,7 +27234,7 @@ function canonicalConfig(config) {
27234
27234
  import { spawn as spawn12 } from "node:child_process";
27235
27235
  import { mkdtempSync, rmSync as rmSync2 } from "node:fs";
27236
27236
  import { homedir as homedir13, tmpdir as tmpdir5 } from "node:os";
27237
- import { delimiter as delimiter4, join as join83 } from "node:path";
27237
+ import { delimiter as delimiter4, join as join84 } from "node:path";
27238
27238
  function runTerminalCommand(request, spawnCommand = spawn12) {
27239
27239
  return new Promise((resolve) => {
27240
27240
  let child;
@@ -27283,7 +27283,7 @@ function defaults2() {
27283
27283
  discover: discoverAgents,
27284
27284
  runCommand: runTerminalCommand,
27285
27285
  supportsLoginCommand: (agent, path, env) => supportsNativeLoginCommand(agent, path, { env }),
27286
- makeTempDir: () => mkdtempSync(join83(tmpdir5(), "av-agent-install-")),
27286
+ makeTempDir: () => mkdtempSync(join84(tmpdir5(), "av-agent-install-")),
27287
27287
  removeTempDir: (path) => rmSync2(path, { recursive: true, force: true })
27288
27288
  };
27289
27289
  }
@@ -27310,7 +27310,7 @@ async function runOfficialInstaller(installerUrl, deps, options = {}) {
27310
27310
  let directory;
27311
27311
  try {
27312
27312
  directory = deps.makeTempDir();
27313
- const scriptPath = join83(directory, "install.sh");
27313
+ const scriptPath = join84(directory, "install.sh");
27314
27314
  const request = { env: options.env ?? deps.env, ...options.cwd ? { cwd: options.cwd } : {} };
27315
27315
  const download = await deps.runCommand({
27316
27316
  command: curl,
@@ -27383,7 +27383,7 @@ async function installChiefAgent(agent, overrides = {}) {
27383
27383
  const install = await runOfficialInstaller(plan.installerUrl, deps);
27384
27384
  if (!install.success)
27385
27385
  return commandFailure(install.stage === "download" ? "Installer download" : "Installation", install, plan.documentation);
27386
- const localBin = join83(deps.home, ".local", "bin");
27386
+ const localBin = join84(deps.home, ".local", "bin");
27387
27387
  const pathParts = (deps.env.PATH ?? "").split(delimiter4);
27388
27388
  if (!pathParts.includes(localBin))
27389
27389
  deps.env.PATH = [localBin, ...pathParts.filter(Boolean)].join(delimiter4);
@@ -27514,31 +27514,31 @@ var init_agent_provisioning = __esm(() => {
27514
27514
 
27515
27515
  // src/oma-provisioning.ts
27516
27516
  import { mkdtempSync as mkdtempSync2, rmSync as rmSync3 } from "node:fs";
27517
- import { chmod as chmod5, lstat as lstat39, readdir as readdir24, readFile as readFile25, realpath as realpath42, unlink as unlink7, writeFile as writeFile16 } from "node:fs/promises";
27517
+ import { chmod as chmod5, lstat as lstat40, readdir as readdir25, readFile as readFile25, realpath as realpath43, unlink as unlink7, writeFile as writeFile16 } from "node:fs/promises";
27518
27518
  import { homedir as homedir14, tmpdir as tmpdir6 } from "node:os";
27519
- import { delimiter as delimiter5, isAbsolute as isAbsolute30, join as join84, relative as relative25, resolve as resolve49 } from "node:path";
27519
+ import { delimiter as delimiter5, isAbsolute as isAbsolute31, join as join85, relative as relative25, resolve as resolve49 } from "node:path";
27520
27520
  function defaults3() {
27521
27521
  const home = homedir14();
27522
27522
  return {
27523
27523
  platform: process.platform,
27524
27524
  home,
27525
27525
  env: process.env,
27526
- resolveBinary: (name) => resolveBinaryPath(name, name === "bun" ? [join84(process.env.BUN_INSTALL ?? join84(home, ".bun"), "bin", "bun")] : []),
27526
+ resolveBinary: (name) => resolveBinaryPath(name, name === "bun" ? [join85(process.env.BUN_INSTALL ?? join85(home, ".bun"), "bin", "bun")] : []),
27527
27527
  runCommand: runTerminalCommand,
27528
- makeTempDir: () => mkdtempSync2(join84(tmpdir6(), "av-oma-install-")),
27528
+ makeTempDir: () => mkdtempSync2(join85(tmpdir6(), "av-oma-install-")),
27529
27529
  removeTempDir: (path) => rmSync3(path, { recursive: true, force: true })
27530
27530
  };
27531
27531
  }
27532
27532
  async function directory2(path) {
27533
27533
  try {
27534
- return (await lstat39(path)).isDirectory();
27534
+ return (await lstat40(path)).isDirectory();
27535
27535
  } catch {
27536
27536
  return false;
27537
27537
  }
27538
27538
  }
27539
27539
  async function present(path) {
27540
27540
  try {
27541
- await lstat39(path);
27541
+ await lstat40(path);
27542
27542
  return true;
27543
27543
  } catch {
27544
27544
  return false;
@@ -27546,7 +27546,7 @@ async function present(path) {
27546
27546
  }
27547
27547
  async function installedVersion2(skills) {
27548
27548
  try {
27549
- const marker = JSON.parse(await readFile25(join84(skills, "_version.json"), "utf8"));
27549
+ const marker = JSON.parse(await readFile25(join85(skills, "_version.json"), "utf8"));
27550
27550
  return marker.schemaVersion === 2 && marker.mode === "project" && typeof marker.version === "string" && /^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/.test(marker.version) ? marker.version : null;
27551
27551
  } catch {
27552
27552
  return null;
@@ -27555,10 +27555,10 @@ async function installedVersion2(skills) {
27555
27555
  async function snapshotConfig(agents) {
27556
27556
  const snapshots = [];
27557
27557
  for (const name of CUSTOM_CONFIG_NAMES) {
27558
- const path = join84(agents, name);
27558
+ const path = join85(agents, name);
27559
27559
  if (!await present(path))
27560
27560
  continue;
27561
- const file = await lstat39(path);
27561
+ const file = await lstat40(path);
27562
27562
  if (!file.isFile())
27563
27563
  throw new Error("Custom configuration must be a project-local regular file.");
27564
27564
  snapshots.push({ path, bytes: await readFile25(path), mode: file.mode & 511 });
@@ -27575,10 +27575,10 @@ async function restoreConfig(agents, snapshots) {
27575
27575
  ["oma-config.yaml", "oma-config.cue"],
27576
27576
  ["oma-config.local.yaml", "oma-config.local.cue"]
27577
27577
  ]) {
27578
- if (!pair.some((name) => original.has(join84(agents, name))))
27578
+ if (!pair.some((name) => original.has(join85(agents, name))))
27579
27579
  continue;
27580
27580
  for (const name of pair) {
27581
- const path = join84(agents, name);
27581
+ const path = join85(agents, name);
27582
27582
  if (!original.has(path))
27583
27583
  await unlink7(path).catch((error) => {
27584
27584
  if (error.code !== "ENOENT")
@@ -27588,17 +27588,17 @@ async function restoreConfig(agents, snapshots) {
27588
27588
  }
27589
27589
  }
27590
27590
  async function workspacePath(input) {
27591
- if (!input.trim() || !isAbsolute30(input))
27591
+ if (!input.trim() || !isAbsolute31(input))
27592
27592
  return null;
27593
27593
  const root = resolve49(input);
27594
27594
  if (!await directory2(root))
27595
27595
  return null;
27596
- for (const path of [join84(root, ".agents"), join84(root, ".agents", "skills")]) {
27596
+ for (const path of [join85(root, ".agents"), join85(root, ".agents", "skills")]) {
27597
27597
  if (!await present(path))
27598
27598
  continue;
27599
- const actual = await realpath42(path);
27600
- const location2 = relative25(await realpath42(root), actual);
27601
- if (location2 === ".." || location2.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) || isAbsolute30(location2))
27599
+ const actual = await realpath43(path);
27600
+ const location2 = relative25(await realpath43(root), actual);
27601
+ if (location2 === ".." || location2.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) || isAbsolute31(location2))
27602
27602
  return null;
27603
27603
  }
27604
27604
  return root;
@@ -27608,15 +27608,15 @@ async function inspectOma(workspaceRoot, _overrides = {}) {
27608
27608
  const root = await workspacePath(workspaceRoot);
27609
27609
  if (!root)
27610
27610
  return { success: false, message: "Choose an existing absolute workspace with project-local OMA files." };
27611
- const skills = join84(root, ".agents", "skills");
27611
+ const skills = join85(root, ".agents", "skills");
27612
27612
  const version = await installedVersion2(skills);
27613
27613
  if (!version)
27614
27614
  throw new Error("Invalid installed metadata");
27615
- const entries = (await readdir24(skills, { withFileTypes: true })).filter((entry) => /^oma-[a-z0-9-]+$/.test(entry.name));
27615
+ const entries = (await readdir25(skills, { withFileTypes: true })).filter((entry) => /^oma-[a-z0-9-]+$/.test(entry.name));
27616
27616
  if (!entries.length)
27617
27617
  throw new Error("No installed skills");
27618
27618
  for (const entry of entries) {
27619
- if (!entry.isDirectory() || !(await lstat39(join84(skills, entry.name, "SKILL.md"))).isFile())
27619
+ if (!entry.isDirectory() || !(await lstat40(join85(skills, entry.name, "SKILL.md"))).isFile())
27620
27620
  throw new Error("Incomplete installed skill");
27621
27621
  }
27622
27622
  return {
@@ -27664,16 +27664,16 @@ async function prepareOma(workspaceRoot, overrides = {}) {
27664
27664
  delete environment.OMA_YES;
27665
27665
  environment.CI = "true";
27666
27666
  const paths = [
27667
- deps.env.BUN_INSTALL_BIN ?? join84(deps.env.BUN_INSTALL ?? join84(deps.home, ".bun"), "bin"),
27668
- join84(deps.home, ".local", "bin")
27667
+ deps.env.BUN_INSTALL_BIN ?? join85(deps.env.BUN_INSTALL ?? join85(deps.home, ".bun"), "bin"),
27668
+ join85(deps.home, ".local", "bin")
27669
27669
  ];
27670
27670
  environment.PATH = [...new Set([...paths, ...(environment.PATH ?? "").split(delimiter5).filter(Boolean)])].join(delimiter5);
27671
27671
  const request = { command: bun, env: environment, cwd: root, timeoutMs: 300000 };
27672
27672
  const latest = await deps.runCommand({ ...request, args: ["install", "--global", LATEST_PACKAGE] });
27673
27673
  if (!latest.success)
27674
27674
  return failure4("OMA CLI update", latest);
27675
- const agents = join84(root, ".agents");
27676
- const existing = await installedVersion2(join84(agents, "skills")) !== null || await directory2(join84(agents, "skills")) && (await present(join84(agents, "oma-config.yaml")) || await present(join84(agents, "mcp.json")) || await directory2(join84(agents, "workflows")));
27675
+ const agents = join85(root, ".agents");
27676
+ const existing = await installedVersion2(join85(agents, "skills")) !== null || await directory2(join85(agents, "skills")) && (await present(join85(agents, "oma-config.yaml")) || await present(join85(agents, "mcp.json")) || await directory2(join85(agents, "workflows")));
27677
27677
  const custom = await snapshotConfig(agents);
27678
27678
  const args = existing ? ["update", "--yes", "--with-new-skills", "--all"] : ["install"];
27679
27679
  let installed;
@@ -29162,9 +29162,9 @@ var init_ui = __esm(() => {
29162
29162
 
29163
29163
  // src/setup/workspace-step.ts
29164
29164
  import { statSync as statSync6 } from "node:fs";
29165
- import { isAbsolute as isAbsolute31 } from "node:path";
29165
+ import { isAbsolute as isAbsolute32 } from "node:path";
29166
29166
  async function validateOrderWorkspace(path) {
29167
- if (!isAbsolute31(path))
29167
+ if (!isAbsolute32(path))
29168
29168
  return "Set workspace.root in av.yaml to an absolute Git repository path.";
29169
29169
  try {
29170
29170
  if (!statSync6(path).isDirectory())
@@ -29191,7 +29191,7 @@ async function stepWorkspace(ctx, step, total) {
29191
29191
  validate: (v) => {
29192
29192
  if (!v?.trim())
29193
29193
  return "Required";
29194
- if (!isAbsolute31(v.trim()))
29194
+ if (!isAbsolute32(v.trim()))
29195
29195
  return "Must be an absolute path";
29196
29196
  }
29197
29197
  });
@@ -29217,8 +29217,8 @@ var init_workspace_step = __esm(() => {
29217
29217
  });
29218
29218
 
29219
29219
  // src/setup/noninteractive-config.ts
29220
- import { lstat as lstat40, realpath as realpath43 } from "node:fs/promises";
29221
- import { isAbsolute as isAbsolute32, join as join85, parse as parsePath, resolve as resolve50 } from "node:path";
29220
+ import { lstat as lstat41, realpath as realpath44 } from "node:fs/promises";
29221
+ import { isAbsolute as isAbsolute33, join as join86, parse as parsePath, resolve as resolve50 } from "node:path";
29222
29222
  function validateNoninteractiveOptions(options) {
29223
29223
  if (!options.yes || options.edit || options.mode !== undefined && options.mode !== "order")
29224
29224
  throw new Error("Use av setup --yes only for local order setup; --edit and --mode tracker require interactive setup.");
@@ -29263,7 +29263,7 @@ function selectChief(options, deps, project, global2, existingProject) {
29263
29263
  const savedType = projectActor.type ?? (existingProject ? globalActor.type : undefined);
29264
29264
  const selected = options.actor ?? runtime?.actorType ?? savedType;
29265
29265
  if (!selected)
29266
- throw new SetupIdentityRequiredError(`actor.type is not selected for ${join85(deps.projectRoot, "av.yaml")}, and the current agent runtime is unknown. Defaults in ${deps.globalConfigPath} do not identify a new project's initiating agent. Rerun av setup --yes --actor <current-vendor> --model <current-model-or-empty>.`);
29266
+ throw new SetupIdentityRequiredError(`actor.type is not selected for ${join86(deps.projectRoot, "av.yaml")}, and the current agent runtime is unknown. Defaults in ${deps.globalConfigPath} do not identify a new project's initiating agent. Rerun av setup --yes --actor <current-vendor> --model <current-model-or-empty>.`);
29267
29267
  const actorType = selected;
29268
29268
  const actorSource = options.actor !== undefined ? "explicit" : runtime ? "runtime" : projectActor.type ? "project" : "global";
29269
29269
  const previousType = savedType;
@@ -29301,14 +29301,14 @@ async function prepareNoninteractiveConfig(options, deps) {
29301
29301
  validateNoninteractiveOptions(options);
29302
29302
  let projectRoot;
29303
29303
  try {
29304
- projectRoot = await realpath43(resolve50(deps.projectRoot));
29305
- if (!(await lstat40(projectRoot)).isDirectory())
29304
+ projectRoot = await realpath44(resolve50(deps.projectRoot));
29305
+ if (!(await lstat41(projectRoot)).isDirectory())
29306
29306
  throw new Error("not a directory");
29307
29307
  } catch {
29308
29308
  throw new Error(`AV configuration directory ${deps.projectRoot} does not exist. Run av setup from an existing directory.`);
29309
29309
  }
29310
29310
  const globalPath = resolve50(deps.globalConfigPath);
29311
- const projectPath = join85(projectRoot, "av.yaml");
29311
+ const projectPath = join86(projectRoot, "av.yaml");
29312
29312
  const project = await configFile(projectPath, projectConfigSchema);
29313
29313
  const global2 = await configFile(globalPath, globalConfigSchema);
29314
29314
  const chief = selectChief(options, { ...deps, projectRoot, globalConfigPath: globalPath }, project.raw, global2.raw, project.file.before !== null);
@@ -29325,11 +29325,11 @@ async function prepareNoninteractiveConfig(options, deps) {
29325
29325
  }
29326
29326
  const savedWorkspace = project.raw.workspace?.root;
29327
29327
  const selectedWorkspace = options.workspace ?? savedWorkspace ?? projectRoot;
29328
- const workspacePath = isAbsolute32(selectedWorkspace) ? selectedWorkspace : resolve50(projectRoot, selectedWorkspace);
29328
+ const workspacePath = isAbsolute33(selectedWorkspace) ? selectedWorkspace : resolve50(projectRoot, selectedWorkspace);
29329
29329
  const workspaceError = await validateOrderWorkspace(workspacePath);
29330
29330
  if (workspaceError)
29331
29331
  throw new Error(workspaceError);
29332
- const workspace = await realpath43(workspacePath);
29332
+ const workspace = await realpath44(workspacePath);
29333
29333
  const canonical = (raw) => canonicalConfig({ ...raw, agent: raw.actor ?? raw.agent });
29334
29334
  const savedProject = {
29335
29335
  ...canonical(project.raw),
@@ -29372,7 +29372,7 @@ var init_noninteractive_config = __esm(() => {
29372
29372
  });
29373
29373
 
29374
29374
  // src/setup/noninteractive.ts
29375
- import { join as join86, parse as parsePath2, resolve as resolve51 } from "node:path";
29375
+ import { join as join87, parse as parsePath2, resolve as resolve51 } from "node:path";
29376
29376
  function rerunCommand(result, options) {
29377
29377
  const quote = (value) => `'${value.replace(/'/g, "'\\''")}'`;
29378
29378
  return `cd ${quote(result.projectRoot)} && av setup --yes --actor ${result.chief.actorType} --model ${quote(result.chief.model ?? "")} --workspace ${quote(result.workspace ?? result.projectRoot)} --oma ${options.oma ?? "prepare"} --json`;
@@ -29386,7 +29386,7 @@ async function setupNoninteractive(options, overrides = {}) {
29386
29386
  projectRoot: resolve51(deps.projectRoot),
29387
29387
  workspace: null,
29388
29388
  config: {
29389
- project: join86(resolve51(deps.projectRoot), "av.yaml"),
29389
+ project: join87(resolve51(deps.projectRoot), "av.yaml"),
29390
29390
  global: resolve51(deps.globalConfigPath),
29391
29391
  saved: false
29392
29392
  },
@@ -29890,7 +29890,7 @@ var init_container_step = __esm(() => {
29890
29890
  });
29891
29891
 
29892
29892
  // src/setup/metric-step.ts
29893
- import { isAbsolute as isAbsolute33 } from "node:path";
29893
+ import { isAbsolute as isAbsolute34 } from "node:path";
29894
29894
  async function text14(message, initialValue, validate) {
29895
29895
  const value = await text12({
29896
29896
  message: `${message} (:back goes back)`,
@@ -29974,7 +29974,7 @@ async function stepMetrics(ctx) {
29974
29974
  draft.token_env = token;
29975
29975
  } else {
29976
29976
  const file = await text14("Repository-relative JSON file", old?.file ?? "metrics/revenue.json", (value) => {
29977
- if (!value || value.length > 2000 || isAbsolute33(value) || /^[A-Za-z]:/.test(value) || value.startsWith("\\") || value.split(/[\\/]/).includes(".."))
29977
+ if (!value || value.length > 2000 || isAbsolute34(value) || /^[A-Za-z]:/.test(value) || value.startsWith("\\") || value.split(/[\\/]/).includes(".."))
29978
29978
  return "Use a relative file inside the repository, without ..";
29979
29979
  });
29980
29980
  if (navigated2(file))
@@ -31878,9 +31878,9 @@ var init_setup = __esm(() => {
31878
31878
  // ../../packages/core/src/relay/credentials.ts
31879
31879
  import { readFileSync as readFileSync14 } from "node:fs";
31880
31880
  import { homedir as homedir15 } from "node:os";
31881
- import { join as join87 } from "node:path";
31881
+ import { join as join88 } from "node:path";
31882
31882
  function defaultCredentialsPath() {
31883
- return join87(homedir15(), ".agent-valley", "credentials.json");
31883
+ return join88(homedir15(), ".agent-valley", "credentials.json");
31884
31884
  }
31885
31885
  function validateRelayCredentials(value, binding, now = Date.now()) {
31886
31886
  const result = credentialsSchema.safeParse(value);
@@ -56713,8 +56713,8 @@ async function startAvMcpHttp(api, options) {
56713
56713
 
56714
56714
  // src/mission-api.ts
56715
56715
  import { randomUUID as randomUUID25 } from "node:crypto";
56716
- import { lstat as lstat29, readdir as readdir15, realpath as realpath33 } from "node:fs/promises";
56717
- import { isAbsolute as isAbsolute21, join as join60 } from "node:path";
56716
+ import { lstat as lstat30, readdir as readdir16, realpath as realpath34 } from "node:fs/promises";
56717
+ import { isAbsolute as isAbsolute22, join as join61 } from "node:path";
56718
56718
 
56719
56719
  // ../../packages/core/src/chief/reports.ts
56720
56720
  init_zod();
@@ -77908,8 +77908,8 @@ async function launchMission(input) {
77908
77908
 
77909
77909
  // src/operation-api.ts
77910
77910
  import { randomUUID as randomUUID24 } from "node:crypto";
77911
- import { realpath as realpath32 } from "node:fs/promises";
77912
- import { join as join59 } from "node:path";
77911
+ import { realpath as realpath33 } from "node:fs/promises";
77912
+ import { join as join60 } from "node:path";
77913
77913
 
77914
77914
  // ../../packages/core/src/chief/continuous-store.ts
77915
77915
  init_atomic_json();
@@ -78183,10 +78183,10 @@ class ContinuousOperationStore {
78183
78183
  }
78184
78184
 
78185
78185
  // src/chief-continuous.ts
78186
- import { execFile as execFile8 } from "node:child_process";
78186
+ import { execFile as execFile9 } from "node:child_process";
78187
78187
  import { randomUUID as randomUUID23 } from "node:crypto";
78188
- import { realpath as realpath31 } from "node:fs/promises";
78189
- import { join as join58, resolve as resolve33 } from "node:path";
78188
+ import { realpath as realpath32 } from "node:fs/promises";
78189
+ import { join as join59, resolve as resolve33 } from "node:path";
78190
78190
  import { promisify as promisify5 } from "node:util";
78191
78191
 
78192
78192
  // ../../packages/core/src/chief/container-observation-command.ts
@@ -80269,7 +80269,7 @@ init_execution();
80269
80269
  init_runtime_ignore();
80270
80270
 
80271
80271
  // src/chief-continuous-decision.ts
80272
- import { join as join55 } from "node:path";
80272
+ import { join as join56 } from "node:path";
80273
80273
  // ../../packages/core/src/chief/coordinator-checkpoint.ts
80274
80274
  class CheckpointError extends Error {
80275
80275
  }
@@ -80796,7 +80796,7 @@ init_execution();
80796
80796
 
80797
80797
  // ../../packages/core/src/chief/runtime.ts
80798
80798
  import { randomUUID as randomUUID19 } from "node:crypto";
80799
- import { join as join47, resolve as resolve29 } from "node:path";
80799
+ import { join as join48, resolve as resolve29 } from "node:path";
80800
80800
 
80801
80801
  // ../../packages/core/src/oma/receipt-adapter.ts
80802
80802
  import { spawnSync as spawnSync2 } from "node:child_process";
@@ -82425,7 +82425,78 @@ function growthReport(before, after, thresholdBytes) {
82425
82425
  const gib = (bytes) => `${(bytes / GIB2).toFixed(1)} GiB`;
82426
82426
  const where = picked.sort((a, b) => delta(b) - delta(a)).slice(0, 3).map((entry) => `${entry} (+${gib(delta(entry))})`);
82427
82427
  const size = (after.get("") ?? 0) - (after.get(".git") ?? 0) - (after.get(".agent-valley") ?? 0);
82428
- return `${STORAGE_NOTE_PREFIX} this check left ${gib(total)} of new files in the workspace (${gib(size)} in total)${where.length ? `, mostly under ${where.join(", ")}` : ""}. Nothing removes them, so repeated checks fill the disk; the tests or scripts that create these files have to remove them.`;
82428
+ return `${STORAGE_NOTE_PREFIX} this check left ${gib(total)} of new files in the workspace (${gib(size)} in total)${where.length ? `, mostly under ${where.join(", ")}` : ""}. Nothing removes them, so repeated checks fill the disk; the tests or scripts that create these files have to remove them. Until they do, name the directory in AV_WORKSPACE_SCRATCH and AV clears entries of earlier runs before each check.`;
82429
+ }
82430
+
82431
+ // ../../packages/core/src/chief/workspace-scratch.ts
82432
+ import { execFile as execFile8 } from "node:child_process";
82433
+ import { lstat as lstat26, readdir as readdir14, realpath as realpath27, rm as rm11 } from "node:fs/promises";
82434
+ import { isAbsolute as isAbsolute18, join as join47, normalize, sep as sep18 } from "node:path";
82435
+ var WORKSPACE_SCRATCH_ENV = "AV_WORKSPACE_SCRATCH";
82436
+ var WORKSPACE_SCRATCH_MINUTES_ENV = "AV_WORKSPACE_SCRATCH_MINUTES";
82437
+ var DEFAULT_WORKSPACE_SCRATCH_MINUTES = 30;
82438
+ var ignored = (workspace, directory) => new Promise((resolve) => {
82439
+ execFile8("git", ["-C", workspace, "check-ignore", "-q", "--", directory], { timeout: 20000 }, (error) => resolve(!error));
82440
+ });
82441
+ function scratchDirectories(env = process.env) {
82442
+ return [
82443
+ ...new Set((env[WORKSPACE_SCRATCH_ENV] ?? "").split(/[,\n]/).map((entry) => entry.trim()).filter(Boolean))
82444
+ ];
82445
+ }
82446
+ function scratchAgeMs(env) {
82447
+ const raw = env[WORKSPACE_SCRATCH_MINUTES_ENV]?.trim();
82448
+ const minutes = raw ? Number(raw) : DEFAULT_WORKSPACE_SCRATCH_MINUTES;
82449
+ return (Number.isFinite(minutes) && minutes >= 0 ? minutes : DEFAULT_WORKSPACE_SCRATCH_MINUTES) * 60000;
82450
+ }
82451
+ async function releaseWorkspaceScratch(workspace, env = process.env, now = Date.now()) {
82452
+ const result = { cleared: [], skipped: [] };
82453
+ const directories = scratchDirectories(env);
82454
+ if (!directories.length)
82455
+ return result;
82456
+ const limit = now - scratchAgeMs(env);
82457
+ const root = await realpath27(workspace);
82458
+ for (const directory of directories) {
82459
+ const skip = (reason) => result.skipped.push({ directory, reason });
82460
+ const relative = normalize(directory);
82461
+ const first = relative.split(sep18)[0];
82462
+ if (isAbsolute18(directory) || relative === "." || first === ".." || first === ".git" || first === ".agent-valley") {
82463
+ skip("it is not a directory inside the workspace's own files; use a workspace-relative path");
82464
+ continue;
82465
+ }
82466
+ const path = join47(root, relative);
82467
+ try {
82468
+ if (!(await lstat26(path)).isDirectory() || await realpath27(path) !== path) {
82469
+ skip("it is not a plain directory (a symbolic link is never followed)");
82470
+ continue;
82471
+ }
82472
+ } catch {
82473
+ continue;
82474
+ }
82475
+ if (!await ignored(root, relative)) {
82476
+ skip("it is not Git-ignored; AV clears only ignored output, never tracked or untracked product files");
82477
+ continue;
82478
+ }
82479
+ let entries = 0;
82480
+ for (const name of await readdir14(path)) {
82481
+ const child = join47(path, name);
82482
+ try {
82483
+ if ((await lstat26(child)).mtimeMs >= limit)
82484
+ continue;
82485
+ await rm11(child, { recursive: true, force: true });
82486
+ entries += 1;
82487
+ } catch {}
82488
+ }
82489
+ if (entries)
82490
+ result.cleared.push({ directory: relative, entries });
82491
+ }
82492
+ return result;
82493
+ }
82494
+ function scratchNote(release) {
82495
+ const parts = [
82496
+ ...release.cleared.map((entry) => `AV cleared ${entry.entries} entries of earlier runs from ${entry.directory}.`),
82497
+ ...release.skipped.map((entry) => `${WORKSPACE_SCRATCH_ENV} entry ${entry.directory} was not cleared: ${entry.reason}.`)
82498
+ ];
82499
+ return parts.length ? `Storage: ${parts.join(" ")}` : undefined;
82429
82500
  }
82430
82501
 
82431
82502
  // ../../packages/core/src/chief/runtime-integration-check.ts
@@ -82474,12 +82545,14 @@ async function runIntegrationCheck(mission, active, signal, source = process.env
82474
82545
  if (!command && !mission.verificationContract)
82475
82546
  return;
82476
82547
  await assertMissionWorkspace(mission);
82548
+ const cleared = scratchNote(await releaseWorkspaceScratch(mission.workspace.path, source));
82477
82549
  const threshold = growthThresholdBytes(source);
82478
82550
  const before = threshold > 0 ? await directorySizes(mission.workspace.path) : undefined;
82479
82551
  const result = await checkIntegratedTree(mission, active, command, signal, source);
82480
- if (!result || !before)
82552
+ if (!result)
82481
82553
  return result;
82482
- const storage = growthReport(before, await directorySizes(mission.workspace.path), threshold);
82554
+ const growth = before ? growthReport(before, await directorySizes(mission.workspace.path), threshold) : undefined;
82555
+ const storage = [cleared, growth].filter((note) => note !== undefined).map((note, index) => index ? note.slice(STORAGE_NOTE_PREFIX.length + 1) : note).join(" ");
82483
82556
  return storage ? { ok: result.ok, output: `${storage}
82484
82557
  ${result.output}`.slice(0, 8000) } : result;
82485
82558
  }
@@ -82595,7 +82668,7 @@ class ChiefRuntime {
82595
82668
  const workspace = context?.workspace ?? mission.workspace;
82596
82669
  const savedCatalog = workspace === mission.workspace ? mission.availableSkills : mission.availableSkills?.map((skill) => ({
82597
82670
  ...skill,
82598
- path: join47(workspace.path, ".agents", "skills", skill.name, "SKILL.md")
82671
+ path: join48(workspace.path, ".agents", "skills", skill.name, "SKILL.md")
82599
82672
  }));
82600
82673
  const catalog = savedCatalog ?? await discoverMissionSkills(workspace.path);
82601
82674
  if (!requiresOmaActor({ oma: mission.oma, availableSkills: catalog }))
@@ -82613,6 +82686,9 @@ class ChiefRuntime {
82613
82686
  throw new Error("A trusted verification command is required. Set --verify before creating an order.");
82614
82687
  if (mission.verificationContract)
82615
82688
  await assertMissionWorkspace(mission);
82689
+ await releaseWorkspaceScratch(mission.workspace.path).catch(() => {
82690
+ return;
82691
+ });
82616
82692
  const active = this.store.processGuard(mission.id);
82617
82693
  active.begin("verify");
82618
82694
  try {
@@ -82656,7 +82732,7 @@ class ChiefRuntime {
82656
82732
  workspace,
82657
82733
  availableSkills: mission.availableSkills?.map((skill) => ({
82658
82734
  ...skill,
82659
- path: join47(workspace.path, ".agents", "skills", skill.name, "SKILL.md")
82735
+ path: join48(workspace.path, ".agents", "skills", skill.name, "SKILL.md")
82660
82736
  }))
82661
82737
  };
82662
82738
  if (signal?.aborted)
@@ -83430,15 +83506,15 @@ init_execution();
83430
83506
 
83431
83507
  // src/chief-supervisor.ts
83432
83508
  import { randomUUID as randomUUID20 } from "node:crypto";
83433
- import { join as join51 } from "node:path";
83509
+ import { join as join52 } from "node:path";
83434
83510
  init_execution();
83435
83511
  // src/chief-delivery.ts
83436
83512
  import { createHash as createHash29 } from "node:crypto";
83437
83513
  import { mkdir as mkdir22, writeFile as writeFile15 } from "node:fs/promises";
83438
- import { join as join50 } from "node:path";
83514
+ import { join as join51 } from "node:path";
83439
83515
 
83440
83516
  // ../../packages/core/src/chief/report-delivery.ts
83441
- import { join as join49 } from "node:path";
83517
+ import { join as join50 } from "node:path";
83442
83518
 
83443
83519
  // ../../packages/core/src/chief/report-delivery-adapters.ts
83444
83520
  init_report_delivery_contract();
@@ -83822,8 +83898,8 @@ init_atomic_json();
83822
83898
  init_report_delivery_contract();
83823
83899
  import { createHash as createHash28 } from "node:crypto";
83824
83900
  import { constants as constants14 } from "node:fs";
83825
- import { mkdir as mkdir21, open as open15, readdir as readdir14, readFile as readFile18, realpath as realpath27 } from "node:fs/promises";
83826
- import { isAbsolute as isAbsolute18, join as join48, relative as relative15, resolve as resolve30 } from "node:path";
83901
+ import { mkdir as mkdir21, open as open15, readdir as readdir15, readFile as readFile18, realpath as realpath28 } from "node:fs/promises";
83902
+ import { isAbsolute as isAbsolute19, join as join49, relative as relative15, resolve as resolve30 } from "node:path";
83827
83903
  var hash4 = string2().regex(/^[a-f0-9]{64}$/);
83828
83904
  var outboxRecordSchema = strictObject({
83829
83905
  version: literal(1),
@@ -83865,12 +83941,12 @@ function receipt(record) {
83865
83941
  class ReportOutbox {
83866
83942
  directory;
83867
83943
  constructor(stateDir) {
83868
- this.directory = join48(stateDir, "report-outbox");
83944
+ this.directory = join49(stateDir, "report-outbox");
83869
83945
  }
83870
83946
  path(id) {
83871
83947
  if (!hash4.safeParse(id).success)
83872
83948
  throw new Error("Invalid report receipt ID. Use av reports to find a receipt.");
83873
- return join48(this.directory, `${id}.json`);
83949
+ return join49(this.directory, `${id}.json`);
83874
83950
  }
83875
83951
  lock(id) {
83876
83952
  return new MissionStore(this.directory).lock(id);
@@ -83899,7 +83975,7 @@ class ReportOutbox {
83899
83975
  await writeJsonAtomic(this.path(record.id), record);
83900
83976
  }
83901
83977
  async list() {
83902
- const names = await readdir14(this.directory).catch((error) => {
83978
+ const names = await readdir15(this.directory).catch((error) => {
83903
83979
  if (error.code === "ENOENT")
83904
83980
  return [];
83905
83981
  throw new Error("Cannot list report outbox. Restore access to the Chief Director state directory.");
@@ -83917,10 +83993,10 @@ async function validateReportAttachment(attachment, artifactRoot) {
83917
83993
  async function verifiedAttachment(attachment, artifactRoot, readBytes) {
83918
83994
  const failure = new ReportDeliveryError("Capture file is missing, changed, or outside the artifact directory. Restore the original capture and retry av reports.", true, false);
83919
83995
  try {
83920
- const root = await realpath27(artifactRoot);
83921
- const path = await realpath27(attachment.path);
83996
+ const root = await realpath28(artifactRoot);
83997
+ const path = await realpath28(attachment.path);
83922
83998
  const local = relative15(root, path);
83923
- if (!local || local.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) || local === ".." || isAbsolute18(local))
83999
+ if (!local || local.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) || local === ".." || isAbsolute19(local))
83924
84000
  throw failure;
83925
84001
  if (resolve30(attachment.path) !== attachment.path)
83926
84002
  throw failure;
@@ -83977,7 +84053,7 @@ function dependencies(stateDir, overrides) {
83977
84053
  env: overrides.env ?? process.env,
83978
84054
  registry: { ...createReportChannelRegistry(fetch2), ...overrides.registry },
83979
84055
  attachments: overrides.attachments ?? [],
83980
- artifactRoot: overrides.artifactRoot ?? join49(stateDir, "captures"),
84056
+ artifactRoot: overrides.artifactRoot ?? join50(stateDir, "captures"),
83981
84057
  now: overrides.now ?? (() => new Date)
83982
84058
  };
83983
84059
  }
@@ -84158,8 +84234,8 @@ init_chief_schema();
84158
84234
  init_yaml_loader();
84159
84235
  async function saveAndDeliverMissionReport(mission, root) {
84160
84236
  const repository = mission.repositoryRoot ?? root;
84161
- const directory = join50(root, ".agent-valley/reports");
84162
- const reportPath = join50(directory, `${mission.id}.md`);
84237
+ const directory = join51(root, ".agent-valley/reports");
84238
+ const reportPath = join51(directory, `${mission.id}.md`);
84163
84239
  const report = renderReport(mission);
84164
84240
  await mkdir22(directory, { recursive: true, mode: 448 });
84165
84241
  await writeFile15(reportPath, report, { mode: 384 });
@@ -84174,12 +84250,12 @@ ${explanation.eli5}`);
84174
84250
  try {
84175
84251
  const config = mergeChiefConfig(loadGlobalConfig()?.chief, loadProjectConfig(root)?.chief);
84176
84252
  const attachments = [...mission.capture?.attachments ?? []];
84177
- const artifactRoot = join50(repository, ".agent-valley/captures");
84253
+ const artifactRoot = join51(repository, ".agent-valley/captures");
84178
84254
  if (config.reporting?.destinations.length) {
84179
84255
  const bytes = Buffer.from(report);
84180
84256
  const sha256 = createHash29("sha256").update(bytes).digest("hex");
84181
- const reportDirectory = join50(artifactRoot, mission.id);
84182
- const attachmentPath = join50(reportDirectory, `report-${sha256}.md`);
84257
+ const reportDirectory = join51(artifactRoot, mission.id);
84258
+ const attachmentPath = join51(reportDirectory, `report-${sha256}.md`);
84183
84259
  await mkdir22(reportDirectory, { recursive: true, mode: 448 });
84184
84260
  await writeFile15(attachmentPath, bytes, { mode: 384 });
84185
84261
  attachments.push({
@@ -84190,7 +84266,7 @@ ${explanation.eli5}`);
84190
84266
  sha256
84191
84267
  });
84192
84268
  }
84193
- const receipts = await dispatchMissionReport(mission, report, reportPath, config.reporting, join50(repository, ".agent-valley"), {
84269
+ const receipts = await dispatchMissionReport(mission, report, reportPath, config.reporting, join51(repository, ".agent-valley"), {
84194
84270
  attachments,
84195
84271
  artifactRoot
84196
84272
  });
@@ -84455,7 +84531,7 @@ function abortableDelay(ms, signal) {
84455
84531
  async function superviseOrder(goal, options, root, dependencies = {}) {
84456
84532
  assertNotManagedRun();
84457
84533
  const id = options.resume ?? options.missionId ?? randomUUID20();
84458
- const store = new MissionStore(join51(root, ".agent-valley/missions"));
84534
+ const store = new MissionStore(join52(root, ".agent-valley/missions"));
84459
84535
  const controller = new AbortController;
84460
84536
  const interrupt = () => controller.abort(dependencies.signal?.reason);
84461
84537
  const terminate = () => controller.abort(options.service ? serviceShutdownPause() : undefined);
@@ -84811,7 +84887,7 @@ init_sandbox_binary();
84811
84887
  init_agent_discovery();
84812
84888
  import { readFileSync as readFileSync10, statSync as statSync4 } from "node:fs";
84813
84889
  import { homedir as homedir10 } from "node:os";
84814
- import { join as join52 } from "node:path";
84890
+ import { join as join53 } from "node:path";
84815
84891
  import { stripVTControlCharacters as stripVTControlCharacters4 } from "node:util";
84816
84892
  var MAX_OUTPUT_BYTES4 = 2097152;
84817
84893
  var PROBE_TIMEOUT_MS2 = 15000;
@@ -84937,8 +85013,8 @@ async function discoverFreeModels(agentType, workspacePath, signal, overrides =
84937
85013
  };
84938
85014
  let state;
84939
85015
  try {
84940
- const home = env.XDG_STATE_HOME || join52(env.HOME || homedir10(), ".local", "state");
84941
- const content = deps.readState(join52(home, agentType, "model.json"));
85016
+ const home = env.XDG_STATE_HOME || join53(env.HOME || homedir10(), ".local", "state");
85017
+ const content = deps.readState(join53(home, agentType, "model.json"));
84942
85018
  state = content && Buffer.byteLength(content) <= MAX_OUTPUT_BYTES4 ? JSON.parse(content) : undefined;
84943
85019
  } catch {
84944
85020
  state = undefined;
@@ -84969,8 +85045,8 @@ async function discoverFreeModels(agentType, workspacePath, signal, overrides =
84969
85045
  // ../../packages/core/src/chief/metric-source-adapters.ts
84970
85046
  init_metric_source_policy();
84971
85047
  import { constants as constants15 } from "node:fs";
84972
- import { lstat as lstat26, open as open16, realpath as realpath28 } from "node:fs/promises";
84973
- import { isAbsolute as isAbsolute19, relative as relative16, resolve as resolve31, sep as sep18 } from "node:path";
85048
+ import { lstat as lstat27, open as open16, realpath as realpath29 } from "node:fs/promises";
85049
+ import { isAbsolute as isAbsolute20, relative as relative16, resolve as resolve31, sep as sep19 } from "node:path";
84974
85050
  var MAX_METRIC_RESPONSE_BYTES = 2000000;
84975
85051
  function metricSourceEnvironment(request, name) {
84976
85052
  if (!name || !request.env[name]?.trim())
@@ -85053,24 +85129,24 @@ var httpJsonMetricAdapter = {
85053
85129
  };
85054
85130
  var jsonFileMetricAdapter = {
85055
85131
  async collect(request) {
85056
- const root = await realpath28(request.repositoryRoot);
85132
+ const root = await realpath29(request.repositoryRoot);
85057
85133
  const name = request.source.file;
85058
- if (!name || isAbsolute19(name))
85134
+ if (!name || isAbsolute20(name))
85059
85135
  throw new MetricSourceError("Metric file must be relative to the source repository. Set chief.metric_sources.sources[].file in av.yaml.");
85060
85136
  const path = resolve31(root, name);
85061
85137
  const within = relative16(root, path);
85062
- if (!within || within.startsWith(`..${sep18}`) || within === ".." || isAbsolute19(within))
85138
+ if (!within || within.startsWith(`..${sep19}`) || within === ".." || isAbsolute20(within))
85063
85139
  throw new MetricSourceError("Metric file escapes the source repository. Choose a repository-relative JSON file.");
85064
85140
  let current = root;
85065
- for (const part of within.split(sep18)) {
85141
+ for (const part of within.split(sep19)) {
85066
85142
  current = resolve31(current, part);
85067
- if ((await lstat26(current)).isSymbolicLink())
85143
+ if ((await lstat27(current)).isSymbolicLink())
85068
85144
  throw new MetricSourceError("Metric file and parent directories must not be symlinks. Choose a regular JSON file inside the source repository.");
85069
85145
  }
85070
85146
  const file = await open16(path, constants15.O_RDONLY | constants15.O_NOFOLLOW);
85071
85147
  try {
85072
85148
  const stat = await file.stat();
85073
- if (!stat.isFile() || stat.size > MAX_METRIC_RESPONSE_BYTES || await realpath28(path) !== path)
85149
+ if (!stat.isFile() || stat.size > MAX_METRIC_RESPONSE_BYTES || await realpath29(path) !== path)
85074
85150
  throw new MetricSourceError("Metric file must be a regular JSON file of at most 2 MB inside the source repository.");
85075
85151
  const bytes = await file.readFile();
85076
85152
  if (bytes.byteLength > MAX_METRIC_RESPONSE_BYTES)
@@ -85469,8 +85545,8 @@ function createMissionMetricPorts(repository, mission, dependencies = {}) {
85469
85545
  // src/chief-tool-config.ts
85470
85546
  import { randomUUID as randomUUID22 } from "node:crypto";
85471
85547
  import { constants as constants16 } from "node:fs";
85472
- import { link as link2, lstat as lstat27, mkdir as mkdir23, open as open17, realpath as realpath29, unlink as unlink5 } from "node:fs/promises";
85473
- import { join as join53 } from "node:path";
85548
+ import { link as link2, lstat as lstat28, mkdir as mkdir23, open as open17, realpath as realpath30, unlink as unlink5 } from "node:fs/promises";
85549
+ import { join as join54 } from "node:path";
85474
85550
  init_dist2();
85475
85551
  init_client_toml();
85476
85552
  var maximumBytes = 1024 * 1024;
@@ -85489,8 +85565,8 @@ async function assertLocalPath(root, local) {
85489
85565
  const parts = local.split("/");
85490
85566
  let current = root;
85491
85567
  for (const [index, part] of parts.entries()) {
85492
- current = join53(current, part);
85493
- const stats = await lstat27(current).catch((error) => {
85568
+ current = join54(current, part);
85569
+ const stats = await lstat28(current).catch((error) => {
85494
85570
  if (error.code === "ENOENT")
85495
85571
  return;
85496
85572
  throw error;
@@ -85546,10 +85622,10 @@ async function privateExclude(original, target, paths) {
85546
85622
  ]);
85547
85623
  const common = targetCommon.trim();
85548
85624
  const path = exclude.trim();
85549
- if (common !== join53(target, ".git") && common !== originalCommon.trim() || path !== join53(common, "info", "exclude") || await realpath29(common) !== common)
85625
+ if (common !== join54(target, ".git") && common !== originalCommon.trim() || path !== join54(common, "info", "exclude") || await realpath30(common) !== common)
85550
85626
  throw new ChiefToolConfigError("Chief MCP configuration requires the workspace's own Git metadata or its original repository's shared worktree metadata.");
85551
- const info = join53(common, "info");
85552
- const infoStats = await lstat27(info).catch((error) => {
85627
+ const info = join54(common, "info");
85628
+ const infoStats = await lstat28(info).catch((error) => {
85553
85629
  if (error.code === "ENOENT")
85554
85630
  return;
85555
85631
  throw error;
@@ -85558,7 +85634,7 @@ async function privateExclude(original, target, paths) {
85558
85634
  throw new ChiefToolConfigError("Git info storage must be a local directory before preparing Chief MCP tools.");
85559
85635
  if (!infoStats)
85560
85636
  await mkdir23(info, { mode: 448 });
85561
- if (await realpath29(info) !== info)
85637
+ if (await realpath30(info) !== info)
85562
85638
  throw new ChiefToolConfigError("Git info storage redirects through a symlink. Restore it before preparing Chief MCP tools.");
85563
85639
  const exists = await assertLocalPath(common, "info/exclude");
85564
85640
  const content = exists ? await readPrivateFile(path) : "";
@@ -85578,7 +85654,7 @@ async function privateExclude(original, target, paths) {
85578
85654
  }
85579
85655
  }
85580
85656
  async function prepareToolConfig(originalRepository, targetWorkspace) {
85581
- const [original, target] = await Promise.all([realpath29(originalRepository), realpath29(targetWorkspace)]);
85657
+ const [original, target] = await Promise.all([realpath30(originalRepository), realpath30(targetWorkspace)]);
85582
85658
  if (original === target)
85583
85659
  throw new ChiefToolConfigError("Prepare Chief MCP tools in a separate mission workspace using its original repository root.");
85584
85660
  const selected = [];
@@ -85587,29 +85663,29 @@ async function prepareToolConfig(originalRepository, targetWorkspace) {
85587
85663
  continue;
85588
85664
  if (!await assertLocalPath(original, config.path))
85589
85665
  continue;
85590
- const content = selectedNamespace(await readPrivateFile(join53(original, config.path)), config.namespace, config.toml);
85666
+ const content = selectedNamespace(await readPrivateFile(join54(original, config.path)), config.namespace, config.toml);
85591
85667
  if (content)
85592
85668
  selected.push({ path: config.path, content });
85593
85669
  }
85594
85670
  if (!selected.length)
85595
85671
  return;
85596
85672
  for (const root of [original, target]) {
85597
- const stats = await lstat27(join53(root, ".git"));
85598
- if (stats.isSymbolicLink() || !stats.isFile() && !stats.isDirectory() || await realpath29((await parallelGit(root, ["rev-parse", "--show-toplevel"])).trim()) !== root)
85673
+ const stats = await lstat28(join54(root, ".git"));
85674
+ if (stats.isSymbolicLink() || !stats.isFile() && !stats.isDirectory() || await realpath30((await parallelGit(root, ["rev-parse", "--show-toplevel"])).trim()) !== root)
85599
85675
  throw new ChiefToolConfigError("Chief MCP tools require original local Git repository metadata. Restore the workspace before starting Chief.");
85600
85676
  }
85601
85677
  await privateExclude(original, target, selected.map((config) => config.path));
85602
85678
  for (const config of selected) {
85603
85679
  const parts = config.path.split("/");
85604
85680
  if (parts.length > 1) {
85605
- const parent = join53(target, ...parts.slice(0, -1));
85681
+ const parent = join54(target, ...parts.slice(0, -1));
85606
85682
  await mkdir23(parent, { recursive: true, mode: 448 });
85607
- if (await realpath29(parent) !== parent)
85683
+ if (await realpath30(parent) !== parent)
85608
85684
  throw new ChiefToolConfigError("Chief MCP configuration parent redirects through a symlink. Restore its local directory.");
85609
85685
  }
85610
85686
  if (await assertLocalPath(target, config.path))
85611
85687
  continue;
85612
- const path = join53(target, config.path);
85688
+ const path = join54(target, config.path);
85613
85689
  const temporary = `${path}.av-mcp-${randomUUID22()}.tmp`;
85614
85690
  const file = await open17(temporary, "wx", 384);
85615
85691
  try {
@@ -85641,9 +85717,9 @@ async function prepareChiefToolConfig(originalRepository, targetWorkspace) {
85641
85717
  // src/tool-discovery.ts
85642
85718
  init_client_toml();
85643
85719
  import { constants as constants17 } from "node:fs";
85644
- import { access as access2, lstat as lstat28, readFile as readFile19, realpath as realpath30 } from "node:fs/promises";
85720
+ import { access as access2, lstat as lstat29, readFile as readFile19, realpath as realpath31 } from "node:fs/promises";
85645
85721
  import { homedir as homedir11 } from "node:os";
85646
- import { delimiter as delimiter3, isAbsolute as isAbsolute20, join as join54, resolve as resolve32 } from "node:path";
85722
+ import { delimiter as delimiter3, isAbsolute as isAbsolute21, join as join55, resolve as resolve32 } from "node:path";
85647
85723
  var binaries = [
85648
85724
  "docker",
85649
85725
  "orb",
@@ -85659,11 +85735,11 @@ var binaries = [
85659
85735
  var MAX_CONFIG_BYTES = 1048576;
85660
85736
  var record7 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
85661
85737
  async function executable2(name, env) {
85662
- for (const directory of (env.PATH ?? "").split(delimiter3).filter(isAbsolute20)) {
85738
+ for (const directory of (env.PATH ?? "").split(delimiter3).filter(isAbsolute21)) {
85663
85739
  try {
85664
- const path = join54(directory, name);
85740
+ const path = join55(directory, name);
85665
85741
  await access2(path, constants17.X_OK);
85666
- if ((await lstat28(await realpath30(path))).isFile())
85742
+ if ((await lstat29(await realpath31(path))).isFile())
85667
85743
  return true;
85668
85744
  } catch {}
85669
85745
  }
@@ -85672,7 +85748,7 @@ async function executable2(name, env) {
85672
85748
  async function mcpNames(path, scope, project, requestedRoot) {
85673
85749
  const base = { kind: "mcp", scope, authentication: "unknown", source: path };
85674
85750
  try {
85675
- const info = await lstat28(path);
85751
+ const info = await lstat29(path);
85676
85752
  if (!info.isFile() || info.isSymbolicLink() || info.size > MAX_CONFIG_BYTES)
85677
85753
  throw new Error("Invalid config");
85678
85754
  const source = await readFile19(path, "utf8");
@@ -85716,7 +85792,7 @@ async function mcpNames(path, scope, project, requestedRoot) {
85716
85792
  async function discoverTools(root, dependencies = {}) {
85717
85793
  const env = dependencies.env ?? process.env;
85718
85794
  const home = dependencies.home ?? homedir11();
85719
- const project = await realpath30(root);
85795
+ const project = await realpath31(root);
85720
85796
  const projectFiles = [
85721
85797
  ".mcp.json",
85722
85798
  ".cursor/mcp.json",
@@ -85726,11 +85802,11 @@ async function discoverTools(root, dependencies = {}) {
85726
85802
  ".codex/config.toml"
85727
85803
  ];
85728
85804
  const userFiles = [".claude.json", ".cursor/mcp.json", ".qwen/settings.json", ".gemini/settings.json"];
85729
- const codexHome = env.CODEX_HOME && isAbsolute20(env.CODEX_HOME) ? env.CODEX_HOME : join54(home, ".codex");
85805
+ const codexHome = env.CODEX_HOME && isAbsolute21(env.CODEX_HOME) ? env.CODEX_HOME : join55(home, ".codex");
85730
85806
  const configs = [
85731
- ...projectFiles.map((path) => ({ path: join54(project, path), scope: "project" })),
85807
+ ...projectFiles.map((path) => ({ path: join55(project, path), scope: "project" })),
85732
85808
  ...userFiles.map((path) => ({ path: resolve32(home, path), scope: "user" })),
85733
- { path: join54(codexHome, "config.toml"), scope: "user" }
85809
+ { path: join55(codexHome, "config.toml"), scope: "user" }
85734
85810
  ];
85735
85811
  const [cli, mcp] = await Promise.all([
85736
85812
  Promise.all(binaries.map(async (name) => ({
@@ -85786,7 +85862,7 @@ function seededExhaustion(operation, now) {
85786
85862
  async function decideContinuousGoal(operation, decisionId, root, dependencies = {}) {
85787
85863
  if (!operation.baseline)
85788
85864
  throw new Error("An accepted operation baseline is required before selecting a goal.");
85789
- const store = new MissionStore(join55(root, ".agent-valley", "operation-decisions", operation.id));
85865
+ const store = new MissionStore(join56(root, ".agent-valley", "operation-decisions", operation.id));
85790
85866
  const unlock = await store.lock(decisionId);
85791
85867
  const runtime = (dependencies.runtime ?? ((storage, signal) => new ChiefRuntime(storage, signal, undefined, undefined, undefined, discoverReadyAgents, discoverFreeModels)))(store, dependencies.signal);
85792
85868
  let mission;
@@ -85900,7 +85976,7 @@ async function decideContinuousGoal(operation, decisionId, root, dependencies =
85900
85976
  const previousId = operation.history.at(-1)?.missionId;
85901
85977
  let previousReport;
85902
85978
  if (previousId) {
85903
- const previous = await new MissionStore(join55(root, ".agent-valley", "missions")).load(previousId);
85979
+ const previous = await new MissionStore(join56(root, ".agent-valley", "missions")).load(previousId);
85904
85980
  if (previous.repositoryRoot !== operation.repositoryRoot || previous.status !== "completed")
85905
85981
  throw new Error("The previous accepted child's evidence no longer matches this operation. Restore its saved checkpoint before selecting another goal.");
85906
85982
  previousReport = renderReport(previous).slice(0, 16000);
@@ -85939,7 +86015,7 @@ async function decideContinuousGoal(operation, decisionId, root, dependencies =
85939
86015
 
85940
86016
  // src/chief-continuous-report.ts
85941
86017
  import { mkdir as mkdir24 } from "node:fs/promises";
85942
- import { join as join56 } from "node:path";
86018
+ import { join as join57 } from "node:path";
85943
86019
  init_atomic_json();
85944
86020
  function operationDeliveryLines(operation, delivery, unavailable = false) {
85945
86021
  const integration = operation.sourceIntegration;
@@ -86000,17 +86076,17 @@ function renderOperationReport(operation, delivery, unavailable = false) {
86000
86076
  `);
86001
86077
  }
86002
86078
  async function saveOperationReport(root, operation) {
86003
- const directory = join56(root, ".agent-valley", "operation-reports");
86079
+ const directory = join57(root, ".agent-valley", "operation-reports");
86004
86080
  await mkdir24(directory, { recursive: true, mode: 448 });
86005
86081
  const evidence = await deliveryFor(root, operation);
86006
- await writeTextAtomic(join56(directory, `${operation.id}.md`), renderOperationReport(operation, evidence.delivery, evidence.unavailable));
86082
+ await writeTextAtomic(join57(directory, `${operation.id}.md`), renderOperationReport(operation, evidence.delivery, evidence.unavailable));
86007
86083
  }
86008
86084
  async function deliveryFor(root, operation) {
86009
86085
  const id = operation.currentMissionId ?? operation.history.at(-1)?.missionId;
86010
86086
  if (!id)
86011
86087
  return {};
86012
86088
  try {
86013
- const mission = await new MissionStore(join56(root, ".agent-valley", "missions")).load(id);
86089
+ const mission = await new MissionStore(join57(root, ".agent-valley", "missions")).load(id);
86014
86090
  return mission.repositoryRoot === operation.repositoryRoot ? { delivery: mission.codeDelivery } : { unavailable: true };
86015
86091
  } catch {
86016
86092
  return { unavailable: true };
@@ -86043,7 +86119,7 @@ function createOperationProgressReporter(root, write = console.log) {
86043
86119
  };
86044
86120
  }
86045
86121
  // src/chief-source-integration.ts
86046
- import { join as join57 } from "node:path";
86122
+ import { join as join58 } from "node:path";
86047
86123
  init_execution();
86048
86124
  function sourceIntegrationCheckpoint(operation) {
86049
86125
  const accepted = operation.baseline;
@@ -86066,7 +86142,7 @@ async function initialSourceIntegration(repositoryRoot, id, mode, remoteDelivery
86066
86142
  async function assertChildSettled(operation, storageRoot) {
86067
86143
  if (!operation.currentMissionId)
86068
86144
  return;
86069
- const missions = new MissionStore(join57(storageRoot, ".agent-valley", "missions"));
86145
+ const missions = new MissionStore(join58(storageRoot, ".agent-valley", "missions"));
86070
86146
  if (await missions.isLocked(operation.currentMissionId))
86071
86147
  throw new Error("The current child is still owned by another coordinator. Resume source integration after its checkpoint is settled.");
86072
86148
  const child = await missions.load(operation.currentMissionId).catch((error) => {
@@ -86117,7 +86193,7 @@ async function resumeSourceIntegration(operation, mode, storageRoot, signal, sav
86117
86193
  if (selected !== "snapshot-only")
86118
86194
  throw new Error("This operation already uses explicit commit and push delivery. Keep its saved delivery policy instead of adding worktree application.");
86119
86195
  }
86120
- const persist = save ?? ((current) => new ContinuousOperationStore(join57(storageRoot, ".agent-valley", "operations")).save(current));
86196
+ const persist = save ?? ((current) => new ContinuousOperationStore(join58(storageRoot, ".agent-valley", "operations")).save(current));
86121
86197
  const { accepted, applied, caughtUp, pendingIds } = sourceIntegrationCheckpoint(operation);
86122
86198
  const activation = selected === "worktree" && operation.sourceIntegrationPolicy?.mode !== "worktree";
86123
86199
  if (activation) {
@@ -86158,7 +86234,7 @@ async function resumeSourceIntegration(operation, mode, storageRoot, signal, sav
86158
86234
  if (policy?.mode === "worktree" && accepted?.missionId && (applied?.missionId !== accepted.missionId || applied.nextTree !== accepted.baselineTree)) {
86159
86235
  if (applied?.missionId === accepted.missionId)
86160
86236
  throw new Error("The saved source application summary differs from its accepted snapshot. Restore the original verified receipt before resuming.");
86161
- const previous = await validateContinuousBaseline(operation.repositoryRoot, operation.id, join57(operation.repositoryRoot, ".agent-valley", "operations", operation.id, "baselines", applied?.missionId ?? "initial", "workspace"));
86237
+ const previous = await validateContinuousBaseline(operation.repositoryRoot, operation.id, join58(operation.repositoryRoot, ".agent-valley", "operations", operation.id, "baselines", applied?.missionId ?? "initial", "workspace"));
86162
86238
  if (applied && previous.baselineTree !== applied.nextTree)
86163
86239
  throw new Error("The last applied source snapshot no longer matches its saved summary. Restore its original baseline before resuming.");
86164
86240
  operation.sourceIntegration = await integrateContinuousSource(operation, previous, accepted, signal);
@@ -86187,7 +86263,7 @@ async function resumeSourceIntegration(operation, mode, storageRoot, signal, sav
86187
86263
  }
86188
86264
 
86189
86265
  // src/chief-continuous.ts
86190
- var execute3 = promisify5(execFile8);
86266
+ var execute3 = promisify5(execFile9);
86191
86267
  var orderKeys = [
86192
86268
  "workspace",
86193
86269
  "verify",
@@ -86226,7 +86302,7 @@ function integerOption(value, name, maximum) {
86226
86302
  return number;
86227
86303
  }
86228
86304
  function operationStore(root) {
86229
- return new ContinuousOperationStore(join58(resolve33(root), ".agent-valley", "operations"));
86305
+ return new ContinuousOperationStore(join59(resolve33(root), ".agent-valley", "operations"));
86230
86306
  }
86231
86307
  async function restoreOperationOrigin(repository, workspace) {
86232
86308
  const env = { ...process.env, ...clearedGitEnvironment };
@@ -86267,7 +86343,7 @@ async function newOperation(charter, options, root, id) {
86267
86343
  if (value !== undefined)
86268
86344
  settings[key] = value;
86269
86345
  }
86270
- const repositoryRoot = await realpath31(config.workspace);
86346
+ const repositoryRoot = await realpath32(config.workspace);
86271
86347
  const sourceIntegrationPolicy = await initialSourceIntegration(repositoryRoot, id, options.sourceIntegration, options.deliver);
86272
86348
  Object.assign(settings, {
86273
86349
  workspace: repositoryRoot,
@@ -86305,7 +86381,7 @@ async function newOperation(charter, options, root, id) {
86305
86381
  }
86306
86382
  async function runOperation(charter, options, root = process.cwd(), dependencies = {}) {
86307
86383
  assertNotManagedRun();
86308
- root = await realpath31(root);
86384
+ root = await realpath32(root);
86309
86385
  await ensureRuntimeGitignore(root);
86310
86386
  const id = options.resume ?? options.operationId ?? randomUUID23();
86311
86387
  const storage = operationStore(root);
@@ -86343,7 +86419,7 @@ async function runOperation(charter, options, root = process.cwd(), dependencies
86343
86419
  if (options.retry || decisionBudgetKeys.some((key) => options[key] !== undefined)) {
86344
86420
  if (operation.currentMissionId || !operation.decisionId)
86345
86421
  throw new Error("Operation resume budget reconciliation applies only to an active decision checkpoint. Adjust the current child's budget with av order --resume <child-id>.");
86346
- const decisions = new MissionStore(join58(root, ".agent-valley", "operation-decisions", operation.id));
86422
+ const decisions = new MissionStore(join59(root, ".agent-valley", "operation-decisions", operation.id));
86347
86423
  const unlockDecision = await decisions.lock(operation.decisionId);
86348
86424
  try {
86349
86425
  const decision = await decisions.load(operation.decisionId);
@@ -86388,7 +86464,7 @@ async function runOperation(charter, options, root = process.cwd(), dependencies
86388
86464
  const interval = integerOption(options.interval, "--interval", 86400);
86389
86465
  if (interval !== undefined)
86390
86466
  operation.waitIntervalSec = interval;
86391
- if (operation.repositoryRoot !== await realpath31(String(operation.settings.workspace)))
86467
+ if (operation.repositoryRoot !== await realpath32(String(operation.settings.workspace)))
86392
86468
  throw new Error("Operation repository identity changed. Restore its original repository before resuming.");
86393
86469
  if (hasDeliveryResumeOptions(options)) {
86394
86470
  await assertSettledSourceIntegrations(operation.repositoryRoot, operation.id, sourceIntegrationCheckpoint(operation).pendingIds);
@@ -86415,7 +86491,7 @@ async function runOperation(charter, options, root = process.cwd(), dependencies
86415
86491
  console.log(`Operation ${id}
86416
86492
  Charter: ${operation.charter}
86417
86493
  Resume: av order --resume ${id}`);
86418
- const missions = new MissionStore(join58(root, ".agent-valley", "missions"));
86494
+ const missions = new MissionStore(join59(root, ".agent-valley", "missions"));
86419
86495
  return await runContinuousOperation(operation, {
86420
86496
  signal: controller.signal,
86421
86497
  ...options.retry ? { retryDecision: true } : {},
@@ -86519,7 +86595,7 @@ class OperationApi {
86519
86595
  this.root = root;
86520
86596
  this.workspace = workspace;
86521
86597
  this.dependencies = dependencies;
86522
- this.store = new ContinuousOperationStore(join59(root, ".agent-valley/operations"));
86598
+ this.store = new ContinuousOperationStore(join60(root, ".agent-valley/operations"));
86523
86599
  this.jobs = new MissionJobs(root, "operation-jobs");
86524
86600
  }
86525
86601
  order(raw) {
@@ -86687,7 +86763,7 @@ class OperationApi {
86687
86763
  await ensureAvDirectory(this.root, ["operations"]);
86688
86764
  try {
86689
86765
  const operation = await this.store.load(id);
86690
- if (await realpath32(operation.repositoryRoot) !== this.workspace)
86766
+ if (await realpath33(operation.repositoryRoot) !== this.workspace)
86691
86767
  throw new Error("Saved operation belongs to another repository. Connect to its workspace.");
86692
86768
  return operation;
86693
86769
  } catch (error) {
@@ -86774,19 +86850,19 @@ class MissionApi {
86774
86850
  this.projectRoot = projectRoot;
86775
86851
  this.workspace = workspace;
86776
86852
  this.dependencies = dependencies;
86777
- this.store = new MissionStore(join60(projectRoot, ".agent-valley/missions"));
86853
+ this.store = new MissionStore(join61(projectRoot, ".agent-valley/missions"));
86778
86854
  this.jobs = new MissionJobs(projectRoot);
86779
86855
  this.operationApi = new OperationApi(projectRoot, workspace, dependencies);
86780
86856
  this.operationJobs = new MissionJobs(projectRoot, "operation-jobs");
86781
86857
  }
86782
86858
  static async create(workspace, dependencies = {}) {
86783
- if (!isAbsolute21(workspace))
86859
+ if (!isAbsolute22(workspace))
86784
86860
  throw new Error("Set an absolute Git repository path in av mcp --workspace <path>.");
86785
- const projectRoot = await realpath33(workspace);
86861
+ const projectRoot = await realpath34(workspace);
86786
86862
  const target = loadProjectConfig(projectRoot)?.workspace?.root ?? projectRoot;
86787
- if (!isAbsolute21(target))
86863
+ if (!isAbsolute22(target))
86788
86864
  throw new Error("Set workspace.root in av.yaml to an absolute Git repository path.");
86789
- return new MissionApi(projectRoot, await realpath33(target), dependencies);
86865
+ return new MissionApi(projectRoot, await realpath34(target), dependencies);
86790
86866
  }
86791
86867
  get targetWorkspace() {
86792
86868
  return this.workspace;
@@ -86813,7 +86889,7 @@ class MissionApi {
86813
86889
  async order(raw) {
86814
86890
  assertNotManagedRun(this.dependencies.env);
86815
86891
  const input = mcpOrderSchema.parse(raw);
86816
- if (input.workspace && (!isAbsolute21(input.workspace) || await realpath33(input.workspace) !== this.workspace))
86892
+ if (input.workspace && (!isAbsolute22(input.workspace) || await realpath34(input.workspace) !== this.workspace))
86817
86893
  throw new Error("This AV server is bound to another workspace. Start av mcp --workspace for the target repository.");
86818
86894
  return this.serializeOrder(async () => {
86819
86895
  if (input.requestId) {
@@ -86836,7 +86912,7 @@ class MissionApi {
86836
86912
  async list() {
86837
86913
  this.assertOpen();
86838
86914
  await ensureAvDirectory(this.projectRoot, ["missions"]);
86839
- const ids = new Set((await readdir15(join60(this.projectRoot, ".agent-valley/missions"))).filter((name) => name.endsWith(".json")).map((name) => missionIdSchema.parse(name.slice(0, -5))));
86915
+ const ids = new Set((await readdir16(join61(this.projectRoot, ".agent-valley/missions"))).filter((name) => name.endsWith(".json")).map((name) => missionIdSchema.parse(name.slice(0, -5))));
86840
86916
  for (const job of await this.jobs.list())
86841
86917
  ids.add(job.missionId);
86842
86918
  return {
@@ -86932,7 +87008,7 @@ class MissionApi {
86932
87008
  throw new Error("This mission is already completed. Create a new order for additional work.");
86933
87009
  validateResumeOptions(undefined, options);
86934
87010
  applyResumeOptions(structuredClone(mission), undefined, options);
86935
- if (mission.repositoryRoot && await realpath33(mission.repositoryRoot) !== this.workspace)
87011
+ if (mission.repositoryRoot && await realpath34(mission.repositoryRoot) !== this.workspace)
86936
87012
  throw new Error("The saved mission belongs to another repository. Connect to its workspace before resuming.");
86937
87013
  const unlock = await this.store.lock(id);
86938
87014
  await unlock();
@@ -86990,8 +87066,8 @@ class MissionApi {
86990
87066
  async load(id) {
86991
87067
  await ensureAvDirectory(this.projectRoot, ["missions"]);
86992
87068
  try {
86993
- const path = join60(this.projectRoot, ".agent-valley/missions", `${missionIdSchema.parse(id)}.json`);
86994
- const stat = await lstat29(path);
87069
+ const path = join61(this.projectRoot, ".agent-valley/missions", `${missionIdSchema.parse(id)}.json`);
87070
+ const stat = await lstat30(path);
86995
87071
  if (!stat.isFile() || stat.isSymbolicLink())
86996
87072
  throw new Error(`Mission record must be a regular file: ${path}. Remove the symlink before retrying.`);
86997
87073
  return await this.store.observe(id);
@@ -87015,8 +87091,8 @@ class MissionApi {
87015
87091
  // src/plugin-export.ts
87016
87092
  init_client_integrations_assets();
87017
87093
  init_client_integrations_files();
87018
- import { lstat as lstat30, readdir as readdir16, realpath as realpath34 } from "node:fs/promises";
87019
- import { dirname as dirname14, join as join61, relative as relative17, resolve as resolve34 } from "node:path";
87094
+ import { lstat as lstat31, readdir as readdir17, realpath as realpath35 } from "node:fs/promises";
87095
+ import { dirname as dirname14, join as join62, relative as relative17, resolve as resolve34 } from "node:path";
87020
87096
 
87021
87097
  // src/plugin-assets.ts
87022
87098
  import { copyFile as copyFile2, mkdir as mkdir25, readFile as readFile20 } from "node:fs/promises";
@@ -87183,8 +87259,8 @@ async function projectDirectory(workspace) {
87183
87259
  if (typeof workspace !== "string" || !workspace.trim())
87184
87260
  throw new Error("Pass --workspace /absolute/AV-project to bind every exported MCP server to its AV configuration.");
87185
87261
  try {
87186
- const project = await realpath34(resolve34(workspace));
87187
- if (!(await lstat30(project)).isDirectory())
87262
+ const project = await realpath35(resolve34(workspace));
87263
+ if (!(await lstat31(project)).isDirectory())
87188
87264
  throw new Error("not a directory");
87189
87265
  return project;
87190
87266
  } catch {
@@ -87210,12 +87286,12 @@ async function outputDirectory(output) {
87210
87286
  let ancestor = target;
87211
87287
  for (;; ) {
87212
87288
  try {
87213
- const info = await lstat30(ancestor);
87289
+ const info = await lstat31(ancestor);
87214
87290
  if (info.isSymbolicLink())
87215
87291
  throw exportConflict(ancestor, "symbolic link exports are not modified");
87216
87292
  if (!info.isDirectory())
87217
87293
  throw exportConflict(ancestor, "expected an output directory");
87218
- return join61(await realpath34(ancestor), relative17(ancestor, target));
87294
+ return join62(await realpath35(ancestor), relative17(ancestor, target));
87219
87295
  } catch (error) {
87220
87296
  if (error.code !== "ENOENT")
87221
87297
  throw error;
@@ -87226,7 +87302,7 @@ async function outputDirectory(output) {
87226
87302
  async function outputFiles(root, directory = root) {
87227
87303
  let entries;
87228
87304
  try {
87229
- entries = await readdir16(directory, { withFileTypes: true });
87305
+ entries = await readdir17(directory, { withFileTypes: true });
87230
87306
  } catch (error) {
87231
87307
  if (error.code === "ENOENT")
87232
87308
  return [];
@@ -87234,7 +87310,7 @@ async function outputFiles(root, directory = root) {
87234
87310
  }
87235
87311
  const files = [];
87236
87312
  for (const entry of entries) {
87237
- const path = join61(directory, entry.name);
87313
+ const path = join62(directory, entry.name);
87238
87314
  if (entry.isSymbolicLink())
87239
87315
  throw exportConflict(path, "symbolic links are not modified");
87240
87316
  if (entry.isDirectory())
@@ -87271,21 +87347,21 @@ async function exportPluginPackages(options) {
87271
87347
  if (output === workspace)
87272
87348
  throw exportConflict(output, "the output directory must be separate from the AV project root");
87273
87349
  const { manifest } = await loadPluginManifestAsset(options.sourceManifest ? [options.sourceManifest] : undefined);
87274
- const { content: skill } = await loadClientSkillAsset(options.sourceSkillRoot ? [join61(options.sourceSkillRoot, "SKILL.md")] : clientSkillAssetCandidates());
87350
+ const { content: skill } = await loadClientSkillAsset(options.sourceSkillRoot ? [join62(options.sourceSkillRoot, "SKILL.md")] : clientSkillAssetCandidates());
87275
87351
  const { content: license } = await loadPluginLicenseAsset(options.sourceLicense ? [options.sourceLicense] : undefined);
87276
87352
  const packageFiles = pluginPackageFiles(manifest, skill, license, { workspace, remoteUrl });
87277
- const receipt = await integrationFile(output, join61(output, receiptName2), "", 384);
87353
+ const receipt = await integrationFile(output, join62(output, receiptName2), "", 384);
87278
87354
  const hashes = ownedFileHashes(receipt.before, receipt.path);
87279
87355
  const existing = await outputFiles(output);
87280
87356
  for (const path of existing) {
87281
87357
  if (path === receiptName2)
87282
87358
  continue;
87283
87359
  if (!packageFiles.has(path) || hashes[path] === undefined)
87284
- throw exportConflict(join61(output, path), "unowned files are retained");
87360
+ throw exportConflict(join62(output, path), "unowned files are retained");
87285
87361
  }
87286
87362
  const files = [];
87287
87363
  for (const [path, content] of packageFiles) {
87288
- const file = await integrationFile(output, join61(output, path), content, 420);
87364
+ const file = await integrationFile(output, join62(output, path), content, 420);
87289
87365
  if (hashes[path] !== undefined && (file.before === null || contentHash(file.before) !== hashes[path]))
87290
87366
  throw exportConflict(file.path, "the exported file was changed or removed locally");
87291
87367
  if (hashes[path] === undefined && file.before !== null)
@@ -87304,11 +87380,11 @@ async function exportPluginPackages(options) {
87304
87380
  transport: remoteUrl ? "streamable-http" : "stdio",
87305
87381
  files: await applyIntegrationFiles(output, [...files, receipt]),
87306
87382
  packages: {
87307
- portable: join61(output, "portable/av"),
87308
- claude: join61(output, "claude/plugins/av"),
87309
- cursor: join61(output, "cursor/plugins/av"),
87310
- qwen: join61(output, "qwen/av"),
87311
- antigravity: join61(output, "antigravity/av")
87383
+ portable: join62(output, "portable/av"),
87384
+ claude: join62(output, "claude/plugins/av"),
87385
+ cursor: join62(output, "cursor/plugins/av"),
87386
+ qwen: join62(output, "qwen/av"),
87387
+ antigravity: join62(output, "antigravity/av")
87312
87388
  }
87313
87389
  };
87314
87390
  }
@@ -87370,8 +87446,8 @@ function registerAgentClientCommands(program) {
87370
87446
 
87371
87447
  // src/chief.ts
87372
87448
  import { randomUUID as randomUUID28 } from "node:crypto";
87373
- import { realpath as realpath37 } from "node:fs/promises";
87374
- import { join as join67 } from "node:path";
87449
+ import { realpath as realpath38 } from "node:fs/promises";
87450
+ import { join as join68 } from "node:path";
87375
87451
 
87376
87452
  // ../../node_modules/.bun/@langchain+core@1.3.5+84de184876195c42/node_modules/@langchain/core/dist/_virtual/_rolldown/runtime.js
87377
87453
  var __defProp4 = Object.defineProperty;
@@ -93059,7 +93135,7 @@ async function writeFileAtomic(filePath, content) {
93059
93135
  await nodeFsPromises.rm(tempPath, { force: true });
93060
93136
  }
93061
93137
  }
93062
- async function readdir18(dir) {
93138
+ async function readdir19(dir) {
93063
93139
  return nodeFsPromises.readdir(dir);
93064
93140
  }
93065
93141
  async function stat6(filePath) {
@@ -95664,7 +95740,7 @@ class Client2 {
95664
95740
  }
95665
95741
  if (maxBytes !== undefined && maxBytes > 0) {
95666
95742
  try {
95667
- const entries = await readdir18(directory);
95743
+ const entries = await readdir19(directory);
95668
95744
  const traceFiles = entries.filter((f) => f.startsWith("trace_") && f.endsWith(".json"));
95669
95745
  let total = 0;
95670
95746
  for (const name of traceFiles) {
@@ -127148,7 +127224,7 @@ var math_exports = /* @__PURE__ */ __exportAll3({
127148
127224
  innerProduct: () => innerProduct2,
127149
127225
  matrixFunc: () => matrixFunc,
127150
127226
  maximalMarginalRelevance: () => maximalMarginalRelevance,
127151
- normalize: () => normalize
127227
+ normalize: () => normalize2
127152
127228
  });
127153
127229
  function matrixFunc(X, Y, func) {
127154
127230
  if (X.length === 0 || X[0].length === 0 || Y.length === 0 || Y[0].length === 0)
@@ -127157,7 +127233,7 @@ function matrixFunc(X, Y, func) {
127157
127233
  throw new Error(`Number of columns in X and Y must be the same. X has shape ${[X.length, X[0].length]} and Y has shape ${[Y.length, Y[0].length]}.`);
127158
127234
  return X.map((xVector) => Y.map((yVector) => func(xVector, yVector)).map((similarity) => Number.isNaN(similarity) ? 0 : similarity));
127159
127235
  }
127160
- function normalize(M, similarity = false) {
127236
+ function normalize2(M, similarity = false) {
127161
127237
  const max = matrixMaxVal(M);
127162
127238
  return M.map((row) => row.map((val) => similarity ? 1 - val / max : val / max));
127163
127239
  }
@@ -139749,9 +139825,9 @@ import { lstatSync as lstatSync4 } from "node:fs";
139749
139825
  // ../../packages/core/src/workspace/isolated-branch-import.ts
139750
139826
  init_worktree_lifecycle();
139751
139827
  import { randomUUID as randomUUID27 } from "node:crypto";
139752
- import { mkdtemp as mkdtemp2, rm as rm12 } from "node:fs/promises";
139828
+ import { mkdtemp as mkdtemp2, rm as rm13 } from "node:fs/promises";
139753
139829
  import { tmpdir as tmpdir4 } from "node:os";
139754
- import { join as join63 } from "node:path";
139830
+ import { join as join64 } from "node:path";
139755
139831
  async function importIsolatedBranch(workspace, root) {
139756
139832
  if (!isIsolatedGitWorkspace(workspace))
139757
139833
  return null;
@@ -139798,7 +139874,7 @@ async function importIsolatedBranch(workspace, root) {
139798
139874
  `).filter(Boolean);
139799
139875
  if (commits.length === 0)
139800
139876
  return null;
139801
- temporaryWorktree = await mkdtemp2(join63(tmpdir4(), "av-branch-import-"));
139877
+ temporaryWorktree = await mkdtemp2(join64(tmpdir4(), "av-branch-import-"));
139802
139878
  const added = await runCommand("git", ["worktree", "add", "--detach", temporaryWorktree, currentHead], {
139803
139879
  cwd: root
139804
139880
  });
@@ -139829,7 +139905,7 @@ async function importIsolatedBranch(workspace, root) {
139829
139905
  if (temporaryWorktree) {
139830
139906
  if (worktreeAdded)
139831
139907
  await runCommand("git", ["worktree", "remove", "--force", temporaryWorktree], { cwd: root });
139832
- await rm12(temporaryWorktree, { recursive: true, force: true });
139908
+ await rm13(temporaryWorktree, { recursive: true, force: true });
139833
139909
  }
139834
139910
  await runCommand("git", ["update-ref", "-d", importedRef], { cwd: root });
139835
139911
  }
@@ -139838,8 +139914,8 @@ async function importIsolatedBranch(workspace, root) {
139838
139914
  // ../../packages/core/src/workspace/safety-net.ts
139839
139915
  init_logger();
139840
139916
  init_worktree_lifecycle();
139841
- import { lstat as lstat31, readFile as readFile21, realpath as realpath35 } from "node:fs/promises";
139842
- import { isAbsolute as isAbsolute22, join as join64, relative as relative18, resolve as resolve37, sep as sep19 } from "node:path";
139917
+ import { lstat as lstat32, readFile as readFile21, realpath as realpath36 } from "node:fs/promises";
139918
+ import { isAbsolute as isAbsolute23, join as join65, relative as relative18, resolve as resolve37, sep as sep20 } from "node:path";
139843
139919
  var CONFLICT_MARKER_PATTERN = /^(<<<<<<<|=======|>>>>>>>)( .*)?$/m;
139844
139920
  var REGENERATABLE_LOCKFILE_PATTERNS = [
139845
139921
  /(^|\/)package-lock\.json$/,
@@ -139941,7 +140017,7 @@ async function findConflictMarkerFiles(root, files) {
139941
140017
  }
139942
140018
  function isInside(parent, child) {
139943
140019
  const rel = relative18(parent, child);
139944
- return rel === "" || rel !== ".." && !rel.startsWith(`..${sep19}`) && !isAbsolute22(rel);
140020
+ return rel === "" || rel !== ".." && !rel.startsWith(`..${sep20}`) && !isAbsolute23(rel);
139945
140021
  }
139946
140022
  function untrustedGitError(detail) {
139947
140023
  return {
@@ -139951,8 +140027,8 @@ function untrustedGitError(detail) {
139951
140027
  };
139952
140028
  }
139953
140029
  async function validateTrustedWorktree(cwd, repoRoot) {
139954
- const dotGit = join64(cwd, ".git");
139955
- const entry = await lstat31(dotGit).catch(() => null);
140030
+ const dotGit = join65(cwd, ".git");
140031
+ const entry = await lstat32(dotGit).catch(() => null);
139956
140032
  if (!entry)
139957
140033
  return untrustedGitError(`missing ${dotGit}`);
139958
140034
  if (entry.isSymbolicLink())
@@ -139963,18 +140039,18 @@ async function validateTrustedWorktree(cwd, repoRoot) {
139963
140039
  if (!match?.[1])
139964
140040
  return untrustedGitError(`${dotGit} has no gitdir pointer`);
139965
140041
  const gitDir = resolve37(cwd, match[1].trim());
139966
- if (!gitDir.split(sep19).includes("worktrees"))
140042
+ if (!gitDir.split(sep20).includes("worktrees"))
139967
140043
  return untrustedGitError(`${dotGit} does not point into a worktrees directory`);
139968
140044
  if (isInside(cwd, gitDir))
139969
140045
  return untrustedGitError(`${dotGit} points inside the agent-writable workspace`);
139970
- const gitDirStat = await lstat31(gitDir).catch(() => null);
140046
+ const gitDirStat = await lstat32(gitDir).catch(() => null);
139971
140047
  if (!gitDirStat?.isDirectory())
139972
140048
  return untrustedGitError(`${dotGit} points at a missing directory`);
139973
140049
  if (repoRoot) {
139974
140050
  const commonDir = resolve37(gitDir, "..", "..");
139975
140051
  const [actualCommon, expectedCommon] = await Promise.all([
139976
- realpath35(commonDir).catch(() => null),
139977
- realpath35(join64(repoRoot, ".git")).catch(() => null)
140052
+ realpath36(commonDir).catch(() => null),
140053
+ realpath36(join65(repoRoot, ".git")).catch(() => null)
139978
140054
  ]);
139979
140055
  if (!expectedCommon || actualCommon !== expectedCommon) {
139980
140056
  return untrustedGitError(`${dotGit} points outside the configured repository`);
@@ -139987,8 +140063,8 @@ async function validateTrustedWorktree(cwd, repoRoot) {
139987
140063
  if (top.exitCode !== 0)
139988
140064
  return untrustedGitError(top.stderr.trim() || "git rev-parse failed");
139989
140065
  const [actualTop, expectedTop] = await Promise.all([
139990
- realpath35(top.stdout.trim()).catch(() => null),
139991
- realpath35(cwd).catch(() => null)
140066
+ realpath36(top.stdout.trim()).catch(() => null),
140067
+ realpath36(cwd).catch(() => null)
139992
140068
  ]);
139993
140069
  if (!actualTop || !expectedTop || actualTop !== expectedTop) {
139994
140070
  return untrustedGitError("git reports a different worktree root");
@@ -140424,11 +140500,11 @@ function createMissionContainerPorts(dependencies = {}) {
140424
140500
  }
140425
140501
 
140426
140502
  // src/chief-parent-resume.ts
140427
- import { join as join65 } from "node:path";
140503
+ import { join as join66 } from "node:path";
140428
140504
  async function resumeParentForChild(root, child, resume) {
140429
140505
  if (child.status !== "completed" || !verifiedMissionEvidence(child))
140430
140506
  return child;
140431
- const directory = join65(root, ".agent-valley", "operations");
140507
+ const directory = join66(root, ".agent-valley", "operations");
140432
140508
  const owners = (await new ContinuousOperationStore(directory).list()).filter((operation) => operation.currentMissionId === child.id);
140433
140509
  if (owners.length > 1)
140434
140510
  throw new Error("Multiple orders claim this child. Restore a single owning operation before resuming its accepted result.");
@@ -140452,16 +140528,16 @@ async function resumeParentForChild(root, child, resume) {
140452
140528
  }
140453
140529
 
140454
140530
  // src/chief-workspace-dependencies.ts
140455
- import { lstat as lstat32, mkdir as mkdir28, readdir as readdir19, readFile as readFile22, realpath as realpath36, stat as stat7, symlink } from "node:fs/promises";
140456
- import { join as join66, relative as relative19, resolve as resolve38, sep as sep20 } from "node:path";
140531
+ import { lstat as lstat33, mkdir as mkdir28, readdir as readdir20, readFile as readFile22, realpath as realpath37, stat as stat7, symlink } from "node:fs/promises";
140532
+ import { join as join67, relative as relative19, resolve as resolve38, sep as sep21 } from "node:path";
140457
140533
  var caches = new Set([".cache", ".vite", ".vite-temp"]);
140458
- var inside3 = (root, path) => path === root || path.startsWith(`${root}${sep20}`);
140534
+ var inside3 = (root, path) => path === root || path.startsWith(`${root}${sep21}`);
140459
140535
  async function prepareMissionDependencies(repository, workspace) {
140460
- const source = await realpath36(repository);
140461
- const target = await realpath36(workspace);
140536
+ const source = await realpath37(repository);
140537
+ const target = await realpath37(workspace);
140462
140538
  if (source === target)
140463
140539
  throw new Error("Dependency preparation requires a separate mission workspace.");
140464
- const packagePath = join66(source, "package.json");
140540
+ const packagePath = join67(source, "package.json");
140465
140541
  const metadata = await readFile22(packagePath, "utf8").catch((error) => {
140466
140542
  if (error.code === "ENOENT")
140467
140543
  return null;
@@ -140482,7 +140558,7 @@ async function prepareMissionDependencies(repository, workspace) {
140482
140558
  if (++visited > 1000)
140483
140559
  throw new Error("Workspace dependency discovery exceeds 1,000 directories.");
140484
140560
  if (!segments.length) {
140485
- const path = await realpath36(directory).catch(() => {
140561
+ const path = await realpath37(directory).catch(() => {
140486
140562
  return;
140487
140563
  });
140488
140564
  if (path && inside3(source, path))
@@ -140491,12 +140567,12 @@ async function prepareMissionDependencies(repository, workspace) {
140491
140567
  }
140492
140568
  const [segment, ...rest] = segments;
140493
140569
  if (segment === "*") {
140494
- for (const entry of await readdir19(directory, { withFileTypes: true }).catch(() => [])) {
140570
+ for (const entry of await readdir20(directory, { withFileTypes: true }).catch(() => [])) {
140495
140571
  if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules")
140496
- await expand(join66(directory, entry.name), rest);
140572
+ await expand(join67(directory, entry.name), rest);
140497
140573
  }
140498
140574
  } else if (segment)
140499
- await expand(join66(directory, segment), rest);
140575
+ await expand(join67(directory, segment), rest);
140500
140576
  }
140501
140577
  for (const pattern of patterns) {
140502
140578
  if (typeof pattern !== "string" || pattern.length > 1024 || pattern.startsWith("/") || pattern.split("/").some((part) => !part || part === "." || part === ".." || part.startsWith(".") || part === "node_modules" || part !== "*" && /[*?\\:]/.test(part)) || pattern.split("/").length > 8)
@@ -140507,61 +140583,61 @@ async function prepareMissionDependencies(repository, workspace) {
140507
140583
  async function link(from, to) {
140508
140584
  if (++entries > 5000)
140509
140585
  throw new Error("Installed dependencies exceed 5,000 links; prepare a smaller workspace.");
140510
- let installed = await realpath36(from);
140586
+ let installed = await realpath37(from);
140511
140587
  if (!inside3(source, installed))
140512
140588
  throw new Error("An installed dependency escapes the selected repository. Prepare repository-local dependencies.");
140513
- if (!relative19(source, installed).split(sep20).includes("node_modules")) {
140589
+ if (!relative19(source, installed).split(sep21).includes("node_modules")) {
140514
140590
  installed = resolve38(target, relative19(source, installed));
140515
- const destination = await realpath36(installed).catch(() => {
140591
+ const destination = await realpath37(installed).catch(() => {
140516
140592
  return;
140517
140593
  });
140518
140594
  if (!destination || !inside3(target, destination))
140519
140595
  throw new Error("A workspace dependency is missing or escapes the mission workspace. Restore that package.");
140520
140596
  installed = destination;
140521
140597
  }
140522
- const existing = await lstat32(to).catch((error) => {
140598
+ const existing = await lstat33(to).catch((error) => {
140523
140599
  if (error.code === "ENOENT")
140524
140600
  return;
140525
140601
  throw error;
140526
140602
  });
140527
140603
  if (existing) {
140528
- if (!existing.isSymbolicLink() || await realpath36(to) !== installed)
140604
+ if (!existing.isSymbolicLink() || await realpath37(to) !== installed)
140529
140605
  throw new Error("An existing mission dependency differs from the installed package. Preserve it and repair setup.");
140530
140606
  return;
140531
140607
  }
140532
140608
  await symlink(installed, to, (await stat7(installed)).isDirectory() ? "dir" : "file");
140533
140609
  }
140534
140610
  for (const root of roots) {
140535
- const modules = join66(root, "node_modules");
140611
+ const modules = join67(root, "node_modules");
140536
140612
  const installed = await stat7(modules).catch(() => {
140537
140613
  return;
140538
140614
  });
140539
140615
  if (!installed?.isDirectory())
140540
140616
  continue;
140541
- const destinationRoot = await realpath36(resolve38(target, relative19(source, root)));
140617
+ const destinationRoot = await realpath37(resolve38(target, relative19(source, root)));
140542
140618
  if (!inside3(target, destinationRoot))
140543
140619
  throw new Error("A mission package directory escapes its workspace.");
140544
- const destination = join66(destinationRoot, "node_modules");
140545
- const existing = await lstat32(destination).catch(() => {
140620
+ const destination = join67(destinationRoot, "node_modules");
140621
+ const existing = await lstat33(destination).catch(() => {
140546
140622
  return;
140547
140623
  });
140548
140624
  if (existing && !existing.isDirectory())
140549
140625
  throw new Error("Mission node_modules must be a local directory.");
140550
140626
  await mkdir28(destination, { recursive: true });
140551
- for (const entry of await readdir19(modules, { withFileTypes: true })) {
140627
+ for (const entry of await readdir20(modules, { withFileTypes: true })) {
140552
140628
  if (caches.has(entry.name))
140553
140629
  continue;
140554
- const from = join66(modules, entry.name);
140555
- const to = join66(destination, entry.name);
140630
+ const from = join67(modules, entry.name);
140631
+ const to = join67(destination, entry.name);
140556
140632
  if (entry.name.startsWith("@") && entry.isDirectory()) {
140557
- const scope = await lstat32(to).catch(() => {
140633
+ const scope = await lstat33(to).catch(() => {
140558
140634
  return;
140559
140635
  });
140560
140636
  if (scope && !scope.isDirectory())
140561
140637
  throw new Error("A dependency scope must be a local directory.");
140562
140638
  await mkdir28(to, { recursive: true });
140563
- for (const member of await readdir19(from))
140564
- await link(join66(from, member), join66(to, member));
140639
+ for (const member of await readdir20(from))
140640
+ await link(join67(from, member), join67(to, member));
140565
140641
  } else
140566
140642
  await link(from, to);
140567
140643
  }
@@ -140584,7 +140660,7 @@ async function runOrder(goal, options, root = process.cwd()) {
140584
140660
  if (!options.resume && [options.retry, options.resolveEffect, options.effectResult, options.accountRun, options.accountCost].some((value) => value !== undefined && value !== false))
140585
140661
  throw new Error("Use --resume <id> for retry, external-effect resolution or cost reconciliation.");
140586
140662
  await ensureRuntimeGitignore(root);
140587
- const store = new MissionStore(join67(root, ".agent-valley/missions"));
140663
+ const store = new MissionStore(join68(root, ".agent-valley/missions"));
140588
140664
  const id = options.resume ?? options.missionId ?? randomUUID28();
140589
140665
  const unlock = await store.lock(id);
140590
140666
  const abortController = new AbortController;
@@ -140628,12 +140704,12 @@ async function runOrder(goal, options, root = process.cwd()) {
140628
140704
  ...options,
140629
140705
  deliveryPaths: deliveryPaths(options.deliveryPaths)
140630
140706
  });
140631
- const operation = options.operationId ? await operationStore(await realpath37(root)).load(options.operationId) : undefined;
140632
- if (operation && (operation.repositoryRoot !== await realpath37(config.workspace) || operation.currentMissionId !== id || operation.decision?.action !== "execute" || operation.decision.goal !== goal || operation.baseline?.path !== options.baselineWorkspace))
140707
+ const operation = options.operationId ? await operationStore(await realpath38(root)).load(options.operationId) : undefined;
140708
+ if (operation && (operation.repositoryRoot !== await realpath38(config.workspace) || operation.currentMissionId !== id || operation.decision?.action !== "execute" || operation.decision.goal !== goal || operation.baseline?.path !== options.baselineWorkspace))
140633
140709
  throw new Error("Internal child launch does not match its saved operation, goal and accepted baseline. Restore the original operation checkpoint.");
140634
140710
  if (Boolean(options.baselineWorkspace) !== Boolean(options.operationId))
140635
140711
  throw new Error("An internal operation snapshot requires both its operation identity and accepted baseline.");
140636
- const workspace = options.baselineWorkspace && options.operationId ? await createContinuousMissionWorkspace(config.workspace, options.operationId, options.baselineWorkspace, id, goal) : await new WorkspaceManager(config.workspace).create(missionIssue(id, goal), undefined, codeDelivery ? join67(config.workspace, ".agent-valley", "workspaces") : undefined);
140712
+ const workspace = options.baselineWorkspace && options.operationId ? await createContinuousMissionWorkspace(config.workspace, options.operationId, options.baselineWorkspace, id, goal) : await new WorkspaceManager(config.workspace).create(missionIssue(id, goal), undefined, codeDelivery ? join68(config.workspace, ".agent-valley", "workspaces") : undefined);
140637
140713
  if (options.operationId) {
140638
140714
  await restoreOperationOrigin(config.workspace, workspace.path);
140639
140715
  const store = await operationCacheStore(workspace.path);
@@ -140707,7 +140783,7 @@ Resume: bun av order --resume ${id}`);
140707
140783
  await store.save(mission);
140708
140784
  }
140709
140785
  if (mission.status !== "completed")
140710
- await prepareChiefToolConfig(await realpath37(repository), await realpath37(mission.workspace.path));
140786
+ await prepareChiefToolConfig(await realpath38(repository), await realpath38(mission.workspace.path));
140711
140787
  if (mission.executionPolicy) {
140712
140788
  const started = Date.parse(executionState(mission).startedAt);
140713
140789
  const remaining = started + mission.executionPolicy.maxDurationSec * 1000 - Date.now();
@@ -140742,7 +140818,7 @@ Resume: bun av order --resume ${id}`);
140742
140818
  ...parallel,
140743
140819
  prepare: async (current, taskId, attempt) => {
140744
140820
  const record = await parallel.prepare(current, taskId, attempt);
140745
- await prepareChiefToolConfig(await realpath37(repository), await realpath37(record.path));
140821
+ await prepareChiefToolConfig(await realpath38(repository), await realpath38(record.path));
140746
140822
  return record;
140747
140823
  }
140748
140824
  }
@@ -140803,7 +140879,7 @@ Resume: bun av order --resume ${id}`);
140803
140879
  }
140804
140880
  async function dispatchOrder(goal, options, root = process.cwd(), dependencies = {}) {
140805
140881
  assertNotManagedRun();
140806
- root = await realpath37(root);
140882
+ root = await realpath38(root);
140807
140883
  let single = Boolean(options.once || options.worker || options.missionId || options.baselineWorkspace);
140808
140884
  if (options.resume && !single) {
140809
140885
  const missing = (error) => {
@@ -140813,7 +140889,7 @@ async function dispatchOrder(goal, options, root = process.cwd(), dependencies =
140813
140889
  };
140814
140890
  const [operation, mission] = await Promise.all([
140815
140891
  operationStore(root).load(options.resume).catch(missing),
140816
- new MissionStore(join67(root, ".agent-valley", "missions")).load(options.resume).catch(missing)
140892
+ new MissionStore(join68(root, ".agent-valley", "missions")).load(options.resume).catch(missing)
140817
140893
  ]);
140818
140894
  if (operation && mission)
140819
140895
  throw new Error(`Saved ID ${options.resume} names both an operation and a mission. Use --once to resume the mission; inspect av operations before resuming the operation.`);
@@ -140859,14 +140935,14 @@ async function dispatchOrder(goal, options, root = process.cwd(), dependencies =
140859
140935
  }
140860
140936
 
140861
140937
  // src/operations-prune.ts
140862
- import { realpath as realpath39 } from "node:fs/promises";
140938
+ import { realpath as realpath40 } from "node:fs/promises";
140863
140939
 
140864
140940
  // ../../packages/core/src/chief/continuous-retention.ts
140865
140941
  init_zod();
140866
140942
  import { createHash as createHash30 } from "node:crypto";
140867
140943
  import { constants as constants18 } from "node:fs";
140868
- import { lstat as lstat33, open as open19, readdir as readdir20, realpath as realpath38, rename as rename6, rm as rm13 } from "node:fs/promises";
140869
- import { dirname as dirname15, join as join68, resolve as resolve39, sep as sep21 } from "node:path";
140944
+ import { lstat as lstat34, open as open19, readdir as readdir21, realpath as realpath39, rename as rename6, rm as rm14 } from "node:fs/promises";
140945
+ import { dirname as dirname15, join as join69, resolve as resolve39, sep as sep22 } from "node:path";
140870
140946
  var digest7 = (content) => createHash30("sha256").update(content).digest("hex");
140871
140947
  var sha2 = string2().regex(/^[a-f0-9]{40,64}$/);
140872
140948
  var preparedSchema = strictObject({
@@ -140890,7 +140966,7 @@ var completedSchema = strictObject({
140890
140966
  });
140891
140967
  async function exists(path) {
140892
140968
  try {
140893
- await lstat33(path);
140969
+ await lstat34(path);
140894
140970
  return true;
140895
140971
  } catch (error) {
140896
140972
  if (error.code === "ENOENT")
@@ -140899,7 +140975,7 @@ async function exists(path) {
140899
140975
  }
140900
140976
  }
140901
140977
  async function localDirectory3(path) {
140902
- if (!(await lstat33(path)).isDirectory() || await realpath38(path) !== resolve39(path))
140978
+ if (!(await lstat34(path)).isDirectory() || await realpath39(path) !== resolve39(path))
140903
140979
  throw new Error("Pruning requires canonical local directories. Preserve redirected artifacts and restore their original paths.");
140904
140980
  }
140905
140981
  async function readLocal(path) {
@@ -140937,7 +141013,7 @@ async function independentGitMetadata(path) {
140937
141013
  const directory = pending.pop();
140938
141014
  if (!directory)
140939
141015
  break;
140940
- for (const entry of await readdir20(directory, { withFileTypes: true })) {
141016
+ for (const entry of await readdir21(directory, { withFileTypes: true })) {
140941
141017
  if (++entries > 1e5)
140942
141018
  throw new Error("Git metadata inspection exceeded its bound; retain this clone.");
140943
141019
  if (entry.name.endsWith(".lock"))
@@ -140945,29 +141021,29 @@ async function independentGitMetadata(path) {
140945
141021
  if (entry.isSymbolicLink())
140946
141022
  throw new Error("Git metadata redirects through a symbolic link.");
140947
141023
  if (entry.isDirectory())
140948
- pending.push(join68(directory, entry.name));
141024
+ pending.push(join69(directory, entry.name));
140949
141025
  else if (!entry.isFile())
140950
141026
  throw new Error("Git metadata contains an unsupported file type; preserve this clone.");
140951
141027
  }
140952
141028
  }
140953
141029
  }
140954
141030
  async function emptyScratch(path, depth = 0) {
140955
- if (depth > 8 || !(await lstat33(path)).isDirectory() || await realpath38(path) !== path)
141031
+ if (depth > 8 || !(await lstat34(path)).isDirectory() || await realpath39(path) !== path)
140956
141032
  return false;
140957
- const entries = await readdir20(path);
141033
+ const entries = await readdir21(path);
140958
141034
  if (entries.length > 100)
140959
141035
  return false;
140960
141036
  for (const name of entries)
140961
- if (!await emptyScratch(join68(path, name), depth + 1))
141037
+ if (!await emptyScratch(join69(path, name), depth + 1))
140962
141038
  return false;
140963
141039
  return true;
140964
141040
  }
140965
141041
  async function inspectClone(path, baseline) {
140966
141042
  await localDirectory3(path);
140967
- await localDirectory3(join68(path, ".git"));
140968
- await independentGitMetadata(join68(path, ".git"));
141043
+ await localDirectory3(join69(path, ".git"));
141044
+ await independentGitMetadata(join69(path, ".git"));
140969
141045
  for (const key of ["commondir", "objects/info/alternates", "objects/info/http-alternates", "info/grafts", "shallow"])
140970
- if (await exists(join68(path, ".git", key)))
141046
+ if (await exists(join69(path, ".git", key)))
140971
141047
  throw new Error("Git metadata depends on another repository.");
140972
141048
  const [top, branch, head, refs, status, worktrees, remotes] = await Promise.all([
140973
141049
  git2(path, ["rev-parse", "--show-toplevel"]),
@@ -140992,7 +141068,7 @@ async function inspectClone(path, baseline) {
140992
141068
  `) !== `worktree ${resolve39(path)}`)
140993
141069
  throw new Error("Frozen baseline has linked worktrees.");
140994
141070
  for (const entry of status.split("\x00").filter(Boolean)) {
140995
- if (entry === "!! .agent-valley/" && await emptyScratch(join68(path, ".agent-valley")))
141071
+ if (entry === "!! .agent-valley/" && await emptyScratch(join69(path, ".agent-valley")))
140996
141072
  continue;
140997
141073
  throw new Error("Frozen baseline has tracked, untracked or ignored changes.");
140998
141074
  }
@@ -141025,62 +141101,62 @@ async function recoverable(current, baseline) {
141025
141101
  throw new Error("The current baseline is missing recovery objects.");
141026
141102
  }
141027
141103
  async function processEvidence(storePath, missionId) {
141028
- if (await exists(join68(storePath, `${missionId}.json.lock`)))
141104
+ if (await exists(join69(storePath, `${missionId}.json.lock`)))
141029
141105
  return true;
141030
- if (await exists(join68(storePath, `${missionId}.json.lock.reclaim`)))
141106
+ if (await exists(join69(storePath, `${missionId}.json.lock.reclaim`)))
141031
141107
  return true;
141032
- return (await readdir20(storePath)).some((name) => name === `${missionId}.active` || name.startsWith(`${missionId}.run-`) && name.endsWith(".active"));
141108
+ return (await readdir21(storePath)).some((name) => name === `${missionId}.active` || name.startsWith(`${missionId}.run-`) && name.endsWith(".active"));
141033
141109
  }
141034
141110
  async function protectMissionBaseline(mission, protectedPaths) {
141035
141111
  if (!mission.repositoryRoot)
141036
141112
  throw new Error("An unresolved mission has no repository identity; preserve all baselines.");
141037
141113
  protectedPaths.add(mission.workspace.path);
141038
141114
  const workspace = mission.workspace.path;
141039
- const prefix = join68(mission.repositoryRoot, ".agent-valley", "operations");
141040
- if (!workspace.startsWith(`${prefix}${sep21}`))
141115
+ const prefix = join69(mission.repositoryRoot, ".agent-valley", "operations");
141116
+ if (!workspace.startsWith(`${prefix}${sep22}`))
141041
141117
  return;
141042
141118
  await localDirectory3(dirname15(workspace));
141043
- const raw = await readLocal(join68(dirname15(workspace), "workspace.json"));
141119
+ const raw = await readLocal(join69(dirname15(workspace), "workspace.json"));
141044
141120
  if (!raw)
141045
141121
  throw new Error("An unresolved mission is missing its workspace receipt; preserve all baselines.");
141046
141122
  const value = JSON.parse(raw);
141047
141123
  if (value.missionId !== mission.id || value.repositoryRoot !== mission.repositoryRoot || value.path !== workspace || typeof value.baselinePath !== "string")
141048
141124
  throw new Error("An unresolved mission has an ambiguous workspace receipt; preserve all baselines.");
141049
- protectedPaths.add(await realpath38(value.baselinePath));
141125
+ protectedPaths.add(await realpath39(value.baselinePath));
141050
141126
  }
141051
141127
  async function referencedBaselines(storageRoot, operations) {
141052
141128
  const protectedPaths = new Set;
141053
- const missionDirectories = [join68(storageRoot, ".agent-valley", "missions")];
141129
+ const missionDirectories = [join69(storageRoot, ".agent-valley", "missions")];
141054
141130
  for (const operation of operations) {
141055
141131
  if (operation.baseline)
141056
141132
  protectedPaths.add(operation.baseline.path);
141057
141133
  if (operation.sourceIntegration)
141058
- protectedPaths.add(join68(operation.repositoryRoot, ".agent-valley", "operations", operation.id, "baselines", operation.sourceIntegration.missionId, "workspace"));
141134
+ protectedPaths.add(join69(operation.repositoryRoot, ".agent-valley", "operations", operation.id, "baselines", operation.sourceIntegration.missionId, "workspace"));
141059
141135
  for (const id of [operation.currentMissionId, operation.decisionId]) {
141060
141136
  if (!id)
141061
141137
  continue;
141062
- const container = join68(operation.repositoryRoot, ".agent-valley", "operations", operation.id, "workspaces", id);
141138
+ const container = join69(operation.repositoryRoot, ".agent-valley", "operations", operation.id, "workspaces", id);
141063
141139
  await localDirectory3(container);
141064
- const raw = await readLocal(join68(container, "workspace.json"));
141140
+ const raw = await readLocal(join69(container, "workspace.json"));
141065
141141
  if (!raw)
141066
141142
  throw new Error("An active child or decision has no workspace receipt; preserve all baselines.");
141067
141143
  const value = JSON.parse(raw);
141068
141144
  if (value.operationId !== operation.id || value.missionId !== id || typeof value.baselinePath !== "string")
141069
141145
  throw new Error("An active workspace has an ambiguous baseline reference.");
141070
- protectedPaths.add(await realpath38(value.baselinePath));
141071
- protectedPaths.add(join68(operation.repositoryRoot, ".agent-valley", "operations", operation.id, "baselines", id, "workspace"));
141146
+ protectedPaths.add(await realpath39(value.baselinePath));
141147
+ protectedPaths.add(join69(operation.repositoryRoot, ".agent-valley", "operations", operation.id, "baselines", id, "workspace"));
141072
141148
  }
141073
- missionDirectories.push(join68(storageRoot, ".agent-valley", "operation-decisions", operation.id));
141149
+ missionDirectories.push(join69(storageRoot, ".agent-valley", "operation-decisions", operation.id));
141074
141150
  }
141075
141151
  for (const directory of missionDirectories) {
141076
141152
  if (!await exists(directory))
141077
141153
  continue;
141078
141154
  await localDirectory3(directory);
141079
141155
  const store = new MissionStore(directory);
141080
- for (const name of await readdir20(directory)) {
141156
+ for (const name of await readdir21(directory)) {
141081
141157
  if (!name.endsWith(".json"))
141082
141158
  continue;
141083
- await readLocal(join68(directory, name));
141159
+ await readLocal(join69(directory, name));
141084
141160
  const mission = await store.load(name.slice(0, -5));
141085
141161
  if (mission.status !== "completed" || mission.tasks.some((task) => task.effectState === "unknown") || mission.operations?.runs.some((run) => run.executionState && run.executionState !== "settled") || await processEvidence(directory, mission.id))
141086
141162
  await protectMissionBaseline(mission, protectedPaths);
@@ -141090,9 +141166,9 @@ async function referencedBaselines(storageRoot, operations) {
141090
141166
  }
141091
141167
  async function pruneContinuousBaselines(storageRoot, operationId, options = {}) {
141092
141168
  operationIdSchema.parse(operationId);
141093
- if (await realpath38(storageRoot) !== resolve39(storageRoot))
141169
+ if (await realpath39(storageRoot) !== resolve39(storageRoot))
141094
141170
  throw new Error("Use the original canonical operation storage root.");
141095
- const directory = join68(storageRoot, ".agent-valley", "operations");
141171
+ const directory = join69(storageRoot, ".agent-valley", "operations");
141096
141172
  await localDirectory3(directory);
141097
141173
  const store = new ContinuousOperationStore(directory);
141098
141174
  const unlock = await store.lock(operationId);
@@ -141102,26 +141178,26 @@ async function pruneContinuousBaselines(storageRoot, operationId, options = {})
141102
141178
  await localDirectory3(root);
141103
141179
  if (resolve39((await git2(root, ["rev-parse", "--show-toplevel"])).trim()) !== resolve39(root))
141104
141180
  throw new Error("Restore the original Git repository before pruning.");
141105
- const artifacts = join68(root, ".agent-valley", "operations", operationId);
141106
- const baselines = join68(artifacts, "baselines");
141181
+ const artifacts = join69(root, ".agent-valley", "operations", operationId);
141182
+ const baselines = join69(artifacts, "baselines");
141107
141183
  await localDirectory3(artifacts);
141108
141184
  await localDirectory3(baselines);
141109
141185
  const current = operation.baseline;
141110
141186
  if (!current)
141111
141187
  throw new Error("No accepted baseline exists. Preserve the operation artifacts.");
141112
141188
  const protectedPaths = await referencedBaselines(storageRoot, await store.list());
141113
- protectedPaths.add(join68(baselines, "initial", "workspace"));
141189
+ protectedPaths.add(join69(baselines, "initial", "workspace"));
141114
141190
  for (const entry of operation.history.slice(-2))
141115
141191
  protectedPaths.add(entry.baselinePath);
141116
- const currentReceipt = continuousBaselineSchema.parse(JSON.parse(await readLocal(join68(dirname15(current.path), "baseline.json")) ?? "null"));
141192
+ const currentReceipt = continuousBaselineSchema.parse(JSON.parse(await readLocal(join69(dirname15(current.path), "baseline.json")) ?? "null"));
141117
141193
  if (JSON.stringify(currentReceipt) !== JSON.stringify(current))
141118
141194
  throw new Error("The accepted baseline receipt changed.");
141119
141195
  await inspectClone(current.path, current);
141120
- const missionsPath = join68(storageRoot, ".agent-valley", "missions");
141196
+ const missionsPath = join69(storageRoot, ".agent-valley", "missions");
141121
141197
  const missions = new MissionStore(missionsPath);
141122
141198
  const candidates = [];
141123
- for (const key of (await readdir20(baselines)).sort()) {
141124
- const path = join68(baselines, key, "workspace");
141199
+ for (const key of (await readdir21(baselines)).sort()) {
141200
+ const path = join69(baselines, key, "workspace");
141125
141201
  let release;
141126
141202
  let result = { key, path, status: "kept", reason: "Retained for inspection." };
141127
141203
  try {
@@ -141129,16 +141205,16 @@ async function pruneContinuousBaselines(storageRoot, operationId, options = {})
141129
141205
  await localDirectory3(dirname15(path));
141130
141206
  if (protectedPaths.has(path))
141131
141207
  throw new Error("Initial, current, previous or referenced baseline is protected.");
141132
- const raw = await readLocal(join68(dirname15(path), "baseline.json"));
141208
+ const raw = await readLocal(join69(dirname15(path), "baseline.json"));
141133
141209
  const snapshot = continuousBaselineSchema.parse(JSON.parse(raw ?? "null"));
141134
- const transaction = continuousBaselineSchema.parse(JSON.parse(await readLocal(join68(dirname15(path), "snapshot.json")) ?? "null"));
141210
+ const transaction = continuousBaselineSchema.parse(JSON.parse(await readLocal(join69(dirname15(path), "snapshot.json")) ?? "null"));
141135
141211
  if (JSON.stringify(transaction) !== JSON.stringify(snapshot))
141136
141212
  throw new Error("Original snapshot transaction and baseline receipts differ.");
141137
141213
  if (snapshot.operationId !== operationId || snapshot.repositoryRoot !== root || snapshot.path !== path || snapshot.missionId !== key || snapshot.branch !== `av-operation/${operationId}/baseline-${key}`)
141138
141214
  throw new Error("Baseline identity does not match its private directory.");
141139
- const preparedPath = join68(dirname15(path), "pruning.json");
141140
- const completedPath = join68(dirname15(path), "pruned.json");
141141
- const quarantine = join68(dirname15(path), "workspace.pruning");
141215
+ const preparedPath = join69(dirname15(path), "pruning.json");
141216
+ const completedPath = join69(dirname15(path), "pruned.json");
141217
+ const quarantine = join69(dirname15(path), "workspace.pruning");
141142
141218
  const preparedRaw = await readLocal(preparedPath);
141143
141219
  const prepared = preparedRaw ? preparedSchema.parse(JSON.parse(preparedRaw)) : undefined;
141144
141220
  if (prepared && (prepared.operationId !== operationId || prepared.missionId !== key || prepared.path !== path || prepared.quarantine !== quarantine || prepared.commit !== snapshot.commit || prepared.tree !== snapshot.baselineTree || prepared.baselineDigest !== digest7(raw)))
@@ -141153,7 +141229,7 @@ async function pruneContinuousBaselines(storageRoot, operationId, options = {})
141153
141229
  continue;
141154
141230
  }
141155
141231
  const accepted = operation.history.some((entry) => entry.missionId === key && entry.baselinePath === path);
141156
- const journalRaw = await readLocal(join68(dirname15(path), "acceptance.json"));
141232
+ const journalRaw = await readLocal(join69(dirname15(path), "acceptance.json"));
141157
141233
  const journal = journalRaw ? continuousAcceptanceSchema.parse(JSON.parse(journalRaw)) : undefined;
141158
141234
  if (journal && (journal.operationId !== operationId || journal.repositoryRoot !== root || journal.missionId !== key || journal.baselinePath !== path || journal.commit !== snapshot.commit || journal.tree !== snapshot.baselineTree || journal.cycle > operation.completedCycles))
141159
141235
  throw new Error("Acceptance journal does not match this frozen baseline.");
@@ -141189,7 +141265,7 @@ async function pruneContinuousBaselines(storageRoot, operationId, options = {})
141189
141265
  if (hasQuarantine && !prepared)
141190
141266
  throw new Error("Unrecorded pruning quarantine is protected.");
141191
141267
  await inspectClone(physicalPath, snapshot);
141192
- const identity = await lstat33(physicalPath);
141268
+ const identity = await lstat34(physicalPath);
141193
141269
  if (prepared && (identity.dev !== prepared.device || identity.ino !== prepared.inode))
141194
141270
  throw new Error("Workspace identity changed after pruning was prepared.");
141195
141271
  result = {
@@ -141213,16 +141289,16 @@ async function pruneContinuousBaselines(storageRoot, operationId, options = {})
141213
141289
  at: (options.now?.() ?? new Date).toISOString()
141214
141290
  });
141215
141291
  await inspectClone(physicalPath, snapshot);
141216
- const checked = await lstat33(physicalPath);
141292
+ const checked = await lstat34(physicalPath);
141217
141293
  if (checked.dev !== identity.dev || checked.ino !== identity.ino)
141218
141294
  throw new Error("Workspace identity changed before pruning.");
141219
141295
  if (!hasQuarantine)
141220
141296
  await rename6(path, quarantine);
141221
141297
  await localDirectory3(quarantine);
141222
- const moved = await lstat33(quarantine);
141298
+ const moved = await lstat34(quarantine);
141223
141299
  if (moved.dev !== identity.dev || moved.ino !== identity.ino)
141224
141300
  throw new Error("Pruning quarantine identity changed.");
141225
- await rm13(quarantine, { recursive: true });
141301
+ await rm14(quarantine, { recursive: true });
141226
141302
  await immutable(completedPath, {
141227
141303
  version: 1,
141228
141304
  preparedDigest: digest7(receipt),
@@ -141255,7 +141331,7 @@ async function pruneContinuousBaselines(storageRoot, operationId, options = {})
141255
141331
  // src/operations-prune.ts
141256
141332
  async function pruneOperationArtifacts(id, options = {}, root = process.cwd()) {
141257
141333
  assertNotManagedRun();
141258
- const result = await pruneContinuousBaselines(await realpath39(root), id, options);
141334
+ const result = await pruneContinuousBaselines(await realpath40(root), id, options);
141259
141335
  console.log(`Operation ${id} baseline pruning: ${result.applied ? "apply" : "dry run"}.`);
141260
141336
  for (const entry of result.candidates)
141261
141337
  console.log(`${entry.status} ${entry.path}
@@ -141301,16 +141377,16 @@ function registerContinuousCommands(program) {
141301
141377
  }
141302
141378
 
141303
141379
  // src/chief-missions.ts
141304
- import { join as join73 } from "node:path";
141380
+ import { join as join74 } from "node:path";
141305
141381
 
141306
141382
  // ../../packages/core/src/chief/storage-gc.ts
141307
- import { lstat as lstat35, readdir as readdir21, realpath as realpath40 } from "node:fs/promises";
141308
- import { join as join70 } from "node:path";
141383
+ import { lstat as lstat36, readdir as readdir22, realpath as realpath41 } from "node:fs/promises";
141384
+ import { join as join71 } from "node:path";
141309
141385
 
141310
141386
  // ../../packages/core/src/chief/continuous-archive.ts
141311
141387
  init_zod();
141312
- import { lstat as lstat34, mkdir as mkdir29, readFile as readFile23, rename as rename7, rm as rm14 } from "node:fs/promises";
141313
- import { dirname as dirname16, join as join69 } from "node:path";
141388
+ import { lstat as lstat35, mkdir as mkdir29, readFile as readFile23, rename as rename7, rm as rm15 } from "node:fs/promises";
141389
+ import { dirname as dirname16, join as join70 } from "node:path";
141314
141390
  var sha3 = string2().regex(/^[a-f0-9]{40,64}$/);
141315
141391
  var archiveSchema = strictObject({
141316
141392
  version: literal(1),
@@ -141334,16 +141410,16 @@ var snapshotIdentity = {
141334
141410
  GIT_AUTHOR_DATE: "2000-01-01T00:00:00Z",
141335
141411
  GIT_COMMITTER_DATE: "2000-01-01T00:00:00Z"
141336
141412
  };
141337
- var exists2 = (path) => lstat34(path).then(() => true, (error) => {
141413
+ var exists2 = (path) => lstat35(path).then(() => true, (error) => {
141338
141414
  if (error.code === "ENOENT")
141339
141415
  return false;
141340
141416
  throw error;
141341
141417
  });
141342
141418
  function operationArchiveRepository(container) {
141343
- return join69(dirname16(dirname16(container)), "archive.git");
141419
+ return join70(dirname16(dirname16(container)), "archive.git");
141344
141420
  }
141345
141421
  async function readContinuousChildArchive(container) {
141346
- const raw = await readFile23(join69(container, "archive", "archive.json"), "utf8").catch(() => {
141422
+ const raw = await readFile23(join70(container, "archive", "archive.json"), "utf8").catch(() => {
141347
141423
  return;
141348
141424
  });
141349
141425
  return raw === undefined ? undefined : archiveSchema.parse(JSON.parse(raw));
@@ -141353,11 +141429,11 @@ async function archiveContinuousChild(container, options = {}) {
141353
141429
  if (!record)
141354
141430
  throw new Error(`${container} has no matching AV operation child receipt (workspace.json). Preserve it and inspect it manually.`);
141355
141431
  const repository = operationArchiveRepository(container);
141356
- const archiveDirectory = join69(container, "archive");
141432
+ const archiveDirectory = join70(container, "archive");
141357
141433
  const existing = await readContinuousChildArchive(container);
141358
141434
  if (existing) {
141359
141435
  if (options.apply !== false)
141360
- await rm14(record.path, { recursive: true, force: true });
141436
+ await rm15(record.path, { recursive: true, force: true });
141361
141437
  return { status: "already-archived", repository };
141362
141438
  }
141363
141439
  if (!await exists2(record.path))
@@ -141393,10 +141469,10 @@ async function archiveContinuousChild(container, options = {}) {
141393
141469
  await mkdir29(archiveDirectory, { recursive: true, mode: 448 });
141394
141470
  const receipts = [];
141395
141471
  for (const name of [".agent-valley", ".agents"]) {
141396
- const source = join69(record.path, name);
141472
+ const source = join70(record.path, name);
141397
141473
  if (!await exists2(source))
141398
141474
  continue;
141399
- let target = join69(archiveDirectory, name.slice(1));
141475
+ let target = join70(archiveDirectory, name.slice(1));
141400
141476
  if (await exists2(target))
141401
141477
  target = `${target}-${Date.now()}`;
141402
141478
  await rename7(source, target);
@@ -141416,25 +141492,25 @@ async function archiveContinuousChild(container, options = {}) {
141416
141492
  archivedAt: (options.now ?? (() => new Date))().toISOString(),
141417
141493
  restore: `git clone ${repository} <dir> && git -C <dir> checkout ${productCommit}`
141418
141494
  };
141419
- await writeParallelJson(join69(archiveDirectory, "archive.json"), archive);
141420
- await rm14(record.path, { recursive: true, force: true });
141495
+ await writeParallelJson(join70(archiveDirectory, "archive.json"), archive);
141496
+ await rm15(record.path, { recursive: true, force: true });
141421
141497
  return { status: "archived", repository };
141422
141498
  }
141423
141499
 
141424
141500
  // ../../packages/core/src/chief/storage-gc.ts
141425
141501
  var DEFAULT_STORAGE_STALE_DAYS = 7;
141426
141502
  var DAY_MS = 86400000;
141427
- var exists3 = (path) => lstat35(path).then(() => true, () => false);
141503
+ var exists3 = (path) => lstat36(path).then(() => true, () => false);
141428
141504
  var message2 = (error) => error instanceof Error ? error.message : String(error);
141429
141505
  async function savedMissions(root, operationIds) {
141430
141506
  const directories = [
141431
- join70(root, ".agent-valley", "missions"),
141432
- ...operationIds.map((id) => join70(root, ".agent-valley", "operation-decisions", id))
141507
+ join71(root, ".agent-valley", "missions"),
141508
+ ...operationIds.map((id) => join71(root, ".agent-valley", "operation-decisions", id))
141433
141509
  ];
141434
141510
  const saved = new Map;
141435
141511
  for (const directory of directories) {
141436
141512
  const store = new MissionStore(directory);
141437
- for (const name of (await readdir21(directory).catch(() => [])).sort()) {
141513
+ for (const name of (await readdir22(directory).catch(() => [])).sort()) {
141438
141514
  if (!name.endsWith(".json"))
141439
141515
  continue;
141440
141516
  const id = name.slice(0, -5);
@@ -141447,7 +141523,7 @@ async function savedMissions(root, operationIds) {
141447
141523
  return saved;
141448
141524
  }
141449
141525
  async function collectStorageGarbage(repositoryRoot, options = {}) {
141450
- const root = await realpath40(repositoryRoot);
141526
+ const root = await realpath41(repositoryRoot);
141451
141527
  const apply = options.apply === true;
141452
141528
  const staleDays = options.staleDays ?? DEFAULT_STORAGE_STALE_DAYS;
141453
141529
  if (!Number.isFinite(staleDays) || staleDays < 0)
@@ -141456,7 +141532,7 @@ async function collectStorageGarbage(repositoryRoot, options = {}) {
141456
141532
  const idleDays = (mission) => (now - Date.parse(mission.updatedAt)) / DAY_MS;
141457
141533
  const outcome = apply ? "released" : "eligible";
141458
141534
  const entries = [];
141459
- const operations = await new ContinuousOperationStore(join70(root, ".agent-valley", "operations")).list().catch(() => []);
141535
+ const operations = await new ContinuousOperationStore(join71(root, ".agent-valley", "operations")).list().catch(() => []);
141460
141536
  const missions = await savedMissions(root, operations.map((operation) => operation.id));
141461
141537
  for (const [missionId, { mission, active }] of missions) {
141462
141538
  const completed = mission.status === "completed";
@@ -141491,7 +141567,7 @@ async function collectStorageGarbage(repositoryRoot, options = {}) {
141491
141567
  entries.push({
141492
141568
  kind: "build-output",
141493
141569
  missionId,
141494
- path: join70(mission.workspace.path, relative),
141570
+ path: join71(mission.workspace.path, relative),
141495
141571
  outcome,
141496
141572
  reason: `Ignored build output in the AV-owned workspace of a ${why}.`
141497
141573
  });
@@ -141512,9 +141588,9 @@ async function collectStorageGarbage(repositoryRoot, options = {}) {
141512
141588
  operation.sourceIntegration?.missionId,
141513
141589
  ...operation.history.slice(-2).map((entry) => entry.missionId)
141514
141590
  ].filter((id) => Boolean(id)));
141515
- const workspaces = join70(root, ".agent-valley", "operations", operation.id, "workspaces");
141516
- for (const missionId of (await readdir21(workspaces).catch(() => [])).sort()) {
141517
- const container = join70(workspaces, missionId);
141591
+ const workspaces = join71(root, ".agent-valley", "operations", operation.id, "workspaces");
141592
+ for (const missionId of (await readdir22(workspaces).catch(() => [])).sort()) {
141593
+ const container = join71(workspaces, missionId);
141518
141594
  const record = await readContinuousMissionWorkspace(container);
141519
141595
  if (!record || !await exists3(record.path) || protectedIds.has(missionId))
141520
141596
  continue;
@@ -141531,7 +141607,7 @@ async function collectStorageGarbage(repositoryRoot, options = {}) {
141531
141607
  missionId,
141532
141608
  path: record.path,
141533
141609
  outcome,
141534
- reason: `${saved.mission.status} child idle for ${Math.floor(idleDays(saved.mission))} days; branches, evidence refs and product commit go to ${result.repository}, receipts to ${join70(container, "archive")}.`
141610
+ reason: `${saved.mission.status} child idle for ${Math.floor(idleDays(saved.mission))} days; branches, evidence refs and product commit go to ${result.repository}, receipts to ${join71(container, "archive")}.`
141535
141611
  });
141536
141612
  } catch (error) {
141537
141613
  entries.push({
@@ -141563,7 +141639,7 @@ async function collectStorageGarbage(repositoryRoot, options = {}) {
141563
141639
  entries.push({
141564
141640
  kind: "baseline",
141565
141641
  operationId: operation.id,
141566
- path: join70(root, ".agent-valley", "operations", operation.id, "baselines"),
141642
+ path: join71(root, ".agent-valley", "operations", operation.id, "baselines"),
141567
141643
  outcome: "kept",
141568
141644
  reason: message2(error)
141569
141645
  });
@@ -141574,14 +141650,14 @@ async function collectStorageGarbage(repositoryRoot, options = {}) {
141574
141650
 
141575
141651
  // src/chief-reconcile.ts
141576
141652
  init_execution();
141577
- import { join as join71 } from "node:path";
141653
+ import { join as join72 } from "node:path";
141578
141654
  async function reconcileMissionExecution(missionId, options, root = process.cwd()) {
141579
141655
  assertNotManagedRun();
141580
141656
  const runId = options.run?.trim();
141581
141657
  const evidence = options.evidence?.trim();
141582
141658
  if (!runId || runId.length > 2000 || !evidence || evidence.length > 2000)
141583
141659
  throw new Error("Set --run to the uncertain execution ID and --evidence to 1–2,000 characters describing how you confirmed it stopped.");
141584
- const store = new MissionStore(join71(root, ".agent-valley", "missions"));
141660
+ const store = new MissionStore(join72(root, ".agent-valley", "missions"));
141585
141661
  const unlock = await store.lock(missionId);
141586
141662
  try {
141587
141663
  const mission = await store.load(missionId);
@@ -141610,7 +141686,7 @@ function registerMissionReconciliation(missions, root = process.cwd()) {
141610
141686
  }
141611
141687
 
141612
141688
  // src/chief-watch.ts
141613
- import { join as join72 } from "node:path";
141689
+ import { join as join73 } from "node:path";
141614
141690
  var STORAGE_GC_INTERVAL_MS = 60 * 60 * 1000;
141615
141691
  async function watchOrders(root = process.cwd(), dependencies = {}) {
141616
141692
  assertNotManagedRun();
@@ -141624,7 +141700,7 @@ async function watchOrders(root = process.cwd(), dependencies = {}) {
141624
141700
  process.once("SIGINT", stop);
141625
141701
  process.once("SIGTERM", terminate);
141626
141702
  }
141627
- const missions = new MissionStore(join72(root, ".agent-valley", "missions"));
141703
+ const missions = new MissionStore(join73(root, ".agent-valley", "missions"));
141628
141704
  const now = dependencies.now ?? Date.now;
141629
141705
  let lastStorageGc = Number.NEGATIVE_INFINITY;
141630
141706
  try {
@@ -141726,7 +141802,7 @@ function registerMissionCommands(program) {
141726
141802
  await watchOrders(process.cwd(), { service: options.service, storageGc: collectStorageGarbage });
141727
141803
  return;
141728
141804
  }
141729
- const missions = await new MissionStore(join73(process.cwd(), ".agent-valley/missions")).list();
141805
+ const missions = await new MissionStore(join74(process.cwd(), ".agent-valley/missions")).list();
141730
141806
  if (options.json) {
141731
141807
  console.log(JSON.stringify(missions.map((mission) => ({
141732
141808
  id: mission.id,
@@ -141774,12 +141850,12 @@ function registerChiefCommands(program) {
141774
141850
 
141775
141851
  // src/chief-organization.ts
141776
141852
  import { readFile as readFile24, stat as stat8 } from "node:fs/promises";
141777
- import { isAbsolute as isAbsolute23, join as join74, resolve as resolve40 } from "node:path";
141853
+ import { isAbsolute as isAbsolute24, join as join75, resolve as resolve40 } from "node:path";
141778
141854
  init_chief_schema();
141779
141855
  init_yaml_loader();
141780
141856
  function organizationRepository(root, workspace) {
141781
141857
  const repository = workspace ?? loadProjectConfig(root)?.workspace?.root ?? root;
141782
- if (!isAbsolute23(repository))
141858
+ if (!isAbsolute24(repository))
141783
141859
  throw new Error("Set workspace.root in av.yaml or --workspace to an absolute source repository path.");
141784
141860
  return repository;
141785
141861
  }
@@ -141828,13 +141904,13 @@ function registerOrganizationCommands(program) {
141828
141904
  });
141829
141905
  const reports = program.command("reports").description("Inspect and retry third-party report attachments");
141830
141906
  reports.command("list").option("--workspace <path>", "Source repository").action(async (opts) => {
141831
- console.log(JSON.stringify(await listReportDeliveries(join74(organizationRepository(process.cwd(), opts.workspace), ".agent-valley")), null, 2));
141907
+ console.log(JSON.stringify(await listReportDeliveries(join75(organizationRepository(process.cwd(), opts.workspace), ".agent-valley")), null, 2));
141832
141908
  });
141833
141909
  reports.command("retry").option("--workspace <path>", "Source repository").action(async (opts) => {
141834
141910
  const config = mergeChiefConfig(loadGlobalConfig()?.chief, loadProjectConfig()?.chief);
141835
141911
  if (!config.reporting)
141836
141912
  throw new Error("Set chief.reporting.destinations in av.yaml before retrying reports.");
141837
- console.log(JSON.stringify(await retryPendingReports(config.reporting, join74(organizationRepository(process.cwd(), opts.workspace), ".agent-valley")), null, 2));
141913
+ console.log(JSON.stringify(await retryPendingReports(config.reporting, join75(organizationRepository(process.cwd(), opts.workspace), ".agent-valley")), null, 2));
141838
141914
  });
141839
141915
  }
141840
141916
 
@@ -141859,10 +141935,10 @@ var import_picocolors = __toESM(require_picocolors(), 1);
141859
141935
  init_project_config_path();
141860
141936
  init_yaml_loader();
141861
141937
  init_doctor_checks();
141862
- import { join as join82 } from "node:path";
141938
+ import { join as join83 } from "node:path";
141863
141939
 
141864
141940
  // src/doctor-oma-checks.ts
141865
- import { join as join81 } from "node:path";
141941
+ import { join as join82 } from "node:path";
141866
141942
  function checkOma(project, deps) {
141867
141943
  const strict = project?.oma?.mode === "strict";
141868
141944
  const order = !!project && !project.tracker && !project.linear && !project.github;
@@ -141950,7 +142026,7 @@ function checkOma(project, deps) {
141950
142026
  fix: "Set verify.command to a deterministic non-build check in av.yaml before using oma.mode: strict.",
141951
142027
  critical: true
141952
142028
  });
141953
- const triggerPath = join81(deps.cwd, ".agents", "hooks", "core", "triggers.json");
142029
+ const triggerPath = join82(deps.cwd, ".agents", "hooks", "core", "triggers.json");
141954
142030
  let table = null;
141955
142031
  try {
141956
142032
  table = parseTriggerTable(deps.readFileSync(triggerPath));
@@ -141967,7 +142043,7 @@ function checkOma(project, deps) {
141967
142043
  return results;
141968
142044
  }
141969
142045
  results.push({ id: "oma.triggers", name: "OMA trigger table", status: "pass", message: triggerPath, critical: false });
141970
- const missing = Object.entries(table.workflows).filter(([name, workflow]) => !workflow.persistent && !table.excludedWorkflows.includes(name)).map(([name]) => join81(deps.cwd, ".agents", "workflows", `${name}.md`)).filter((path) => !deps.existsSync(path));
142046
+ const missing = Object.entries(table.workflows).filter(([name, workflow]) => !workflow.persistent && !table.excludedWorkflows.includes(name)).map(([name]) => join82(deps.cwd, ".agents", "workflows", `${name}.md`)).filter((path) => !deps.existsSync(path));
141971
142047
  results.push(missing.length === 0 ? {
141972
142048
  id: "oma.workflows",
141973
142049
  name: "OMA workflow files",
@@ -142042,7 +142118,7 @@ function checkTunnel(project, deps) {
142042
142118
  }
142043
142119
  const mode = project?.tunnel?.cloudflare?.mode ?? "quick";
142044
142120
  if (mode === "named") {
142045
- const certPath = join82(deps.home, ".cloudflared", "cert.pem");
142121
+ const certPath = join83(deps.home, ".cloudflared", "cert.pem");
142046
142122
  if (!deps.existsSync(certPath)) {
142047
142123
  return {
142048
142124
  id: "tunnel",
@@ -142082,7 +142158,7 @@ function checkTunnel(project, deps) {
142082
142158
  critical: false
142083
142159
  };
142084
142160
  }
142085
- const ngrokConfigPath = deps.platform === "darwin" ? join82(deps.home, "Library", "Application Support", "ngrok", "ngrok.yml") : join82(deps.home, ".config", "ngrok", "ngrok.yml");
142161
+ const ngrokConfigPath = deps.platform === "darwin" ? join83(deps.home, "Library", "Application Support", "ngrok", "ngrok.yml") : join83(deps.home, ".config", "ngrok", "ngrok.yml");
142086
142162
  if (!deps.existsSync(ngrokConfigPath)) {
142087
142163
  return {
142088
142164
  id: "tunnel",
@@ -142153,7 +142229,7 @@ function checkConfig(deps) {
142153
142229
  critical: true
142154
142230
  });
142155
142231
  }
142156
- const projectPath = join82(deps.cwd, PROJECT_CONFIG_FILENAME);
142232
+ const projectPath = join83(deps.cwd, PROJECT_CONFIG_FILENAME);
142157
142233
  try {
142158
142234
  project = deps.loadProjectConfig(deps.cwd);
142159
142235
  results.push(project ? {
@@ -142544,10 +142620,10 @@ async function readStatus(port) {
142544
142620
  }
142545
142621
 
142546
142622
  // src/storage-gc-command.ts
142547
- import { execFile as execFile9 } from "node:child_process";
142623
+ import { execFile as execFile10 } from "node:child_process";
142548
142624
  import { promisify as promisify6 } from "node:util";
142549
142625
  init_disk_budget();
142550
- var exec5 = promisify6(execFile9);
142626
+ var exec5 = promisify6(execFile10);
142551
142627
  var GIB3 = 1024 ** 3;
142552
142628
  var gib = (bytes) => `${(bytes / GIB3).toFixed(1)} GiB`;
142553
142629
  async function diskUsage(path) {
@@ -146766,8 +146842,8 @@ init_team_relay_error();
146766
146842
 
146767
146843
  // ../../packages/core/src/relay/turso-migration-assets.ts
146768
146844
  init_zod();
146769
- import { copyFile as copyFile3, lstat as lstat41, mkdir as mkdir30, readFile as readFile26 } from "node:fs/promises";
146770
- import { dirname as dirname20, join as join88 } from "node:path";
146845
+ import { copyFile as copyFile3, lstat as lstat42, mkdir as mkdir30, readFile as readFile26 } from "node:fs/promises";
146846
+ import { dirname as dirname20, join as join89 } from "node:path";
146771
146847
  import { fileURLToPath as fileURLToPath3 } from "node:url";
146772
146848
  var TURSO_MIGRATION_ASSET_PATH = "assets/turso/migrations";
146773
146849
  var journalSchema = object({
@@ -146788,7 +146864,7 @@ function tursoMigrationAssetCandidates(moduleUrl = import.meta.url) {
146788
146864
  ];
146789
146865
  }
146790
146866
  async function regularFile2(path) {
146791
- const info = await lstat41(path);
146867
+ const info = await lstat42(path);
146792
146868
  if (!info.isFile() || info.isSymbolicLink())
146793
146869
  throw new Error(`Turso migration asset ${path} must be a regular file. Restore the checkout or reinstall the CLI package.`);
146794
146870
  }
@@ -146796,7 +146872,7 @@ async function loadTursoMigrationAssets(candidates = tursoMigrationAssetCandidat
146796
146872
  for (const directory of candidates) {
146797
146873
  let info;
146798
146874
  try {
146799
- info = await lstat41(directory);
146875
+ info = await lstat42(directory);
146800
146876
  } catch (error) {
146801
146877
  if (error.code === "ENOENT")
146802
146878
  continue;
@@ -146805,10 +146881,10 @@ async function loadTursoMigrationAssets(candidates = tursoMigrationAssetCandidat
146805
146881
  if (!info.isDirectory() || info.isSymbolicLink())
146806
146882
  throw new Error(`Turso migration directory ${directory} must be a regular directory. Restore the checkout or reinstall the CLI package.`);
146807
146883
  try {
146808
- const meta = await lstat41(join88(directory, "meta"));
146884
+ const meta = await lstat42(join89(directory, "meta"));
146809
146885
  if (!meta.isDirectory() || meta.isSymbolicLink())
146810
146886
  throw new Error("Invalid migration metadata directory");
146811
- const journalPath = join88(directory, "meta/_journal.json");
146887
+ const journalPath = join89(directory, "meta/_journal.json");
146812
146888
  await regularFile2(journalPath);
146813
146889
  const journal = journalSchema.parse(JSON.parse(await readFile26(journalPath, "utf8")));
146814
146890
  const tags = journal.entries.map((entry) => entry.tag);
@@ -146816,8 +146892,8 @@ async function loadTursoMigrationAssets(candidates = tursoMigrationAssetCandidat
146816
146892
  throw new Error("Duplicate migration tags");
146817
146893
  const files = ["meta/_journal.json", ...tags.map((tag) => `${tag}.sql`)];
146818
146894
  for (const file of files.slice(1)) {
146819
- await regularFile2(join88(directory, file));
146820
- if (!(await readFile26(join88(directory, file), "utf8")).trim())
146895
+ await regularFile2(join89(directory, file));
146896
+ if (!(await readFile26(join89(directory, file), "utf8")).trim())
146821
146897
  throw new Error("Empty migration SQL");
146822
146898
  }
146823
146899
  return { directory, files };