codeam-cli 2.76.42 → 2.76.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/index.js +723 -651
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -374,8 +374,8 @@ function defaultSpawn(timeoutMs) {
374
374
  });
375
375
  }
376
376
  function resolveConvexBin(cwd) {
377
- const local = path114.join(cwd, "node_modules", ".bin", process.platform === "win32" ? "convex.cmd" : "convex");
378
- if (fs102.existsSync(local)) return { cmd: local, args: [] };
377
+ const local = path115.join(cwd, "node_modules", ".bin", process.platform === "win32" ? "convex.cmd" : "convex");
378
+ if (fs103.existsSync(local)) return { cmd: local, args: [] };
379
379
  return { cmd: "npx", args: ["--yes", "convex"] };
380
380
  }
381
381
  function redact(text, key) {
@@ -506,13 +506,13 @@ async function runConvexAdminMcp(client3, id) {
506
506
  });
507
507
  await server.connect(new StdioServerTransport());
508
508
  }
509
- var import_node_child_process40, fs102, path114, TOOLS;
509
+ var import_node_child_process40, fs103, path115, TOOLS;
510
510
  var init_convex_admin_mcp = __esm({
511
511
  "src/integrations/convex-admin-mcp.ts"() {
512
512
  "use strict";
513
513
  import_node_child_process40 = require("child_process");
514
- fs102 = __toESM(require("fs"));
515
- path114 = __toESM(require("path"));
514
+ fs103 = __toESM(require("fs"));
515
+ path115 = __toESM(require("path"));
516
516
  TOOLS = [
517
517
  {
518
518
  name: "tables",
@@ -4369,11 +4369,11 @@ function quiet(fn) {
4369
4369
  log.debug(TAG, "ignored sync error", err);
4370
4370
  }
4371
4371
  }
4372
- function rmIfExistsQuiet(path116) {
4372
+ function rmIfExistsQuiet(path117) {
4373
4373
  try {
4374
- fs2.rmSync(path116, { force: true });
4374
+ fs2.rmSync(path117, { force: true });
4375
4375
  } catch (err) {
4376
- log.debug(TAG, `rmIfExists failed for ${path116}`, err);
4376
+ log.debug(TAG, `rmIfExists failed for ${path117}`, err);
4377
4377
  }
4378
4378
  }
4379
4379
  function killQuiet(target, signal = "SIGTERM") {
@@ -4539,9 +4539,9 @@ var _default = makeConfig();
4539
4539
  var { getConfig, ensurePluginId, addSession, removeSession, setActiveSession, getActiveSession, getActiveSessionForAgent, setDisable1mContext, setSessionAgent, setSquadAuto, getSquadAuto, clearAll, saveCliConfig, loadCliConfig } = _default;
4540
4540
 
4541
4541
  // src/commands/pair-auto.ts
4542
- var fs69 = __toESM(require("fs"));
4543
- var os49 = __toESM(require("os"));
4544
- var path76 = __toESM(require("path"));
4542
+ var fs70 = __toESM(require("fs"));
4543
+ var os50 = __toESM(require("os"));
4544
+ var path77 = __toESM(require("path"));
4545
4545
  var import_crypto4 = require("crypto");
4546
4546
 
4547
4547
  // src/services/telemetry.service.ts
@@ -4577,8 +4577,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? (0, import_pat
4577
4577
  return decodedFile;
4578
4578
  };
4579
4579
  }
4580
- function normalizeWindowsPath(path116) {
4581
- return path116.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
4580
+ function normalizeWindowsPath(path117) {
4581
+ return path117.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
4582
4582
  }
4583
4583
 
4584
4584
  // ../../node_modules/@posthog/core/dist/error-tracking/index.mjs
@@ -7311,13 +7311,13 @@ var PostHogCoreStateless = class {
7311
7311
  sentFromRoute += batchMessages.length;
7312
7312
  }
7313
7313
  }
7314
- async _sendOtlpBatch({ path: path116, payload }) {
7314
+ async _sendOtlpBatch({ path: path117, payload }) {
7315
7315
  if (this.disabled) return {
7316
7316
  kind: "fatal",
7317
7317
  error: new Error("The client is disabled")
7318
7318
  };
7319
7319
  const serialized = JSON.stringify(payload);
7320
- const url2 = `${this.host}/i/v1/${path116}?token=${encodeURIComponent(this.apiKey)}`;
7320
+ const url2 = `${this.host}/i/v1/${path117}?token=${encodeURIComponent(this.apiKey)}`;
7321
7321
  const gzippedPayload = this.disableCompression ? null : await this.compressPayload(serialized);
7322
7322
  const fetchOptions = {
7323
7323
  method: "POST",
@@ -8557,14 +8557,14 @@ async function addSourceContext(frames, openSourceFile = import_promises.open, l
8557
8557
  LRU_FILE_CONTENTS_CACHE.reduce();
8558
8558
  return frames;
8559
8559
  }
8560
- async function openRegularSourceFile(path116, openSourceFile, logger) {
8560
+ async function openRegularSourceFile(path117, openSourceFile, logger) {
8561
8561
  let fileHandle;
8562
8562
  let isValid = false;
8563
8563
  try {
8564
- fileHandle = await openSourceFile(path116, import_node_fs.constants.O_RDONLY | import_node_fs.constants.O_NONBLOCK);
8564
+ fileHandle = await openSourceFile(path117, import_node_fs.constants.O_RDONLY | import_node_fs.constants.O_NONBLOCK);
8565
8565
  const fileStat = await fileHandle.stat();
8566
8566
  if (!fileStat.isFile()) return;
8567
- if (fileStat.size > MAX_CONTEXTLINES_FILE_SIZE) return void logger?.debug(`Skipping source context for oversized file ${path116}: ${fileStat.size} bytes exceeds ${MAX_CONTEXTLINES_FILE_SIZE}`);
8567
+ if (fileStat.size > MAX_CONTEXTLINES_FILE_SIZE) return void logger?.debug(`Skipping source context for oversized file ${path117}: ${fileStat.size} bytes exceeds ${MAX_CONTEXTLINES_FILE_SIZE}`);
8568
8568
  isValid = true;
8569
8569
  return fileHandle;
8570
8570
  } catch {
@@ -8574,8 +8574,8 @@ async function openRegularSourceFile(path116, openSourceFile, logger) {
8574
8574
  });
8575
8575
  }
8576
8576
  }
8577
- async function getContextLinesFromFile(path116, ranges, output, cacheKey, openSourceFile, logger) {
8578
- const fileHandle = await openRegularSourceFile(path116, openSourceFile, logger);
8577
+ async function getContextLinesFromFile(path117, ranges, output, cacheKey, openSourceFile, logger) {
8578
+ const fileHandle = await openRegularSourceFile(path117, openSourceFile, logger);
8579
8579
  if (void 0 === fileHandle) return void LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
8580
8580
  const openedFileHandle = fileHandle;
8581
8581
  return new Promise((resolve13) => {
@@ -8677,22 +8677,22 @@ function clearLineContext(frame) {
8677
8677
  delete frame.context_line;
8678
8678
  delete frame.post_context;
8679
8679
  }
8680
- function shouldSkipContextLinesForFile(path116) {
8681
- return path116.startsWith("node:") || path116.endsWith(".min.js") || path116.endsWith(".min.cjs") || path116.endsWith(".min.mjs") || path116.startsWith("data:");
8680
+ function shouldSkipContextLinesForFile(path117) {
8681
+ return path117.startsWith("node:") || path117.endsWith(".min.js") || path117.endsWith(".min.cjs") || path117.endsWith(".min.mjs") || path117.startsWith("data:");
8682
8682
  }
8683
8683
  function shouldSkipContextLinesForFrame(frame) {
8684
8684
  if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
8685
8685
  if (void 0 !== frame.colno && frame.colno > MAX_CONTEXTLINES_COLNO) return true;
8686
8686
  return false;
8687
8687
  }
8688
- function makeSourceCacheKey(path116, basePath) {
8689
- if ((0, import_node_path.isAbsolute)(path116)) return JSON.stringify([
8688
+ function makeSourceCacheKey(path117, basePath) {
8689
+ if ((0, import_node_path.isAbsolute)(path117)) return JSON.stringify([
8690
8690
  null,
8691
- path116
8691
+ path117
8692
8692
  ]);
8693
8693
  return void 0 === basePath ? void 0 : JSON.stringify([
8694
8694
  basePath,
8695
- path116
8695
+ path117
8696
8696
  ]);
8697
8697
  }
8698
8698
  function rangeExistsInContentCache(cacheKey, range) {
@@ -11354,7 +11354,7 @@ function readAnonId() {
11354
11354
  }
11355
11355
  function superProperties() {
11356
11356
  return {
11357
- cliVersion: true ? "2.76.42" : "0.0.0-dev",
11357
+ cliVersion: true ? "2.76.43" : "0.0.0-dev",
11358
11358
  nodeVersion: process.version,
11359
11359
  platform: process.platform,
11360
11360
  arch: process.arch,
@@ -11603,7 +11603,7 @@ var http = __toESM(require("http"));
11603
11603
  // package.json
11604
11604
  var package_default = {
11605
11605
  name: "codeam-cli",
11606
- version: "2.76.42",
11606
+ version: "2.76.43",
11607
11607
  description: "Workflow-continuity bridge for AI coding agents. Wrap Claude Code or Codex in a PTY and supervise, approve, and redirect the session from any device \u2014 async. The terminal companion for CodeAgent Mobile.",
11608
11608
  type: "commonjs",
11609
11609
  main: "dist/index.js",
@@ -12979,7 +12979,7 @@ var CommandRelayService = class _CommandRelayService {
12979
12979
  // fresh + clear the "CLI update available" banner after a self-update
12980
12980
  // (a codespace that reinstalls @latest reconnects via heartbeat, not
12981
12981
  // pair/reconnect). Older backends ignore the extra field.
12982
- ..."2.76.42" ? { ideVersion: "2.76.42" } : {}
12982
+ ..."2.76.43" ? { ideVersion: "2.76.43" } : {}
12983
12983
  };
12984
12984
  try {
12985
12985
  const res = await _postJson(`${API_BASE2}/api/plugin/heartbeat`, body, this.pollSecretHeader());
@@ -13302,10 +13302,10 @@ var WINDOWS_LEGACY_JUNCTIONS = [
13302
13302
  /[\\/]Start Menu([\\/]|$)/i,
13303
13303
  /[\\/]Templates([\\/]|$)/i
13304
13304
  ];
13305
- function isUnsafeWindowsWatchRoot(dir, homedir54) {
13305
+ function isUnsafeWindowsWatchRoot(dir, homedir55) {
13306
13306
  const norm = (p2) => p2.replace(/\//g, "\\").replace(/\\+$/, "").toLowerCase();
13307
13307
  const cwd = norm(dir);
13308
- const home = norm(homedir54);
13308
+ const home = norm(homedir55);
13309
13309
  if (cwd === home) return true;
13310
13310
  if (/^[a-z]:$/.test(cwd)) return true;
13311
13311
  const sysRoots = [
@@ -14460,9 +14460,9 @@ function closeAllTerminals() {
14460
14460
  }
14461
14461
 
14462
14462
  // src/commands/start/handlers.ts
14463
- var fs68 = __toESM(require("fs"));
14464
- var os48 = __toESM(require("os"));
14465
- var path75 = __toESM(require("path"));
14463
+ var fs69 = __toESM(require("fs"));
14464
+ var os49 = __toESM(require("os"));
14465
+ var path76 = __toESM(require("path"));
14466
14466
  var import_crypto3 = require("crypto");
14467
14467
  var import_child_process25 = require("child_process");
14468
14468
 
@@ -18109,10 +18109,10 @@ function buildForPlatform(platform3) {
18109
18109
  var import_node_crypto5 = require("crypto");
18110
18110
 
18111
18111
  // src/agents/claude/resolver.ts
18112
- function buildClaudeLaunch(extraArgs = [], os74 = createOsStrategy()) {
18113
- const found = os74.findInPath("claude") ?? os74.findInPath("claude-code");
18112
+ function buildClaudeLaunch(extraArgs = [], os75 = createOsStrategy()) {
18113
+ const found = os75.findInPath("claude") ?? os75.findInPath("claude-code");
18114
18114
  if (!found) return null;
18115
- return os74.buildLaunch(found, extraArgs);
18115
+ return os75.buildLaunch(found, extraArgs);
18116
18116
  }
18117
18117
 
18118
18118
  // src/agents/claude/installer.ts
@@ -18211,8 +18211,8 @@ function parseClaudeAuthStatus(stdout) {
18211
18211
  return "unknown";
18212
18212
  }
18213
18213
  }
18214
- function probeClaudeLocalAuth(os74, timeoutMs = 1e4) {
18215
- const bin = os74.findInPath("claude") ?? os74.findInPath("claude-code");
18214
+ function probeClaudeLocalAuth(os75, timeoutMs = 1e4) {
18215
+ const bin = os75.findInPath("claude") ?? os75.findInPath("claude-code");
18216
18216
  if (!bin) return Promise.resolve("unknown");
18217
18217
  return new Promise((resolve13) => {
18218
18218
  try {
@@ -18990,8 +18990,8 @@ var ClaudeRuntimeStrategy = class {
18990
18990
  meta = getAgent("claude");
18991
18991
  mode = "interactive";
18992
18992
  os;
18993
- constructor(os74) {
18994
- this.os = os74;
18993
+ constructor(os75) {
18994
+ this.os = os75;
18995
18995
  }
18996
18996
  probeLocalAuth() {
18997
18997
  return probeClaudeLocalAuth(this.os);
@@ -20094,8 +20094,8 @@ function codexCredentialLocator() {
20094
20094
  function codexLoginLauncher() {
20095
20095
  return {
20096
20096
  async ensureInstalled() {
20097
- const os74 = createOsStrategy();
20098
- return os74.findInPath("codex") !== null;
20097
+ const os75 = createOsStrategy();
20098
+ return os75.findInPath("codex") !== null;
20099
20099
  },
20100
20100
  launch() {
20101
20101
  return (0, import_node_child_process4.spawn)("codex", ["login"], { stdio: "inherit" });
@@ -20124,8 +20124,8 @@ var CodexRuntimeStrategy = class {
20124
20124
  meta = getAgent("codex");
20125
20125
  mode = "interactive";
20126
20126
  os;
20127
- constructor(os74) {
20128
- this.os = os74;
20127
+ constructor(os75) {
20128
+ this.os = os75;
20129
20129
  }
20130
20130
  async prepareLaunch() {
20131
20131
  let binary = this.os.findInPath("codex");
@@ -20246,12 +20246,12 @@ var CodexRuntimeStrategy = class {
20246
20246
  return (await runOnce()).text;
20247
20247
  }
20248
20248
  };
20249
- function resolveNpm(os74) {
20250
- return os74.id === "win32" ? "npm.cmd" : "npm";
20249
+ function resolveNpm(os75) {
20250
+ return os75.id === "win32" ? "npm.cmd" : "npm";
20251
20251
  }
20252
- async function installCodexViaNpm(os74) {
20252
+ async function installCodexViaNpm(os75) {
20253
20253
  return new Promise((resolve13, reject) => {
20254
- const proc = (0, import_node_child_process5.spawn)(resolveNpm(os74), ["install", "-g", "--no-audit", "--no-fund", "@openai/codex"], {
20254
+ const proc = (0, import_node_child_process5.spawn)(resolveNpm(os75), ["install", "-g", "--no-audit", "--no-fund", "@openai/codex"], {
20255
20255
  stdio: "inherit"
20256
20256
  });
20257
20257
  proc.on("close", (code) => {
@@ -20268,16 +20268,16 @@ async function installCodexViaNpm(os74) {
20268
20268
  });
20269
20269
  });
20270
20270
  }
20271
- function augmentNpmGlobalBin(os74) {
20271
+ function augmentNpmGlobalBin(os75) {
20272
20272
  try {
20273
- const result = (0, import_node_child_process5.spawnSync)(resolveNpm(os74), ["prefix", "-g"], {
20273
+ const result = (0, import_node_child_process5.spawnSync)(resolveNpm(os75), ["prefix", "-g"], {
20274
20274
  stdio: ["ignore", "pipe", "ignore"]
20275
20275
  });
20276
20276
  if (result.status !== 0) return;
20277
20277
  const prefix = result.stdout.toString().trim();
20278
20278
  if (!prefix) return;
20279
- const binDir = os74.id === "win32" ? prefix : path27.join(prefix, "bin");
20280
- os74.augmentPath([binDir]);
20279
+ const binDir = os75.id === "win32" ? prefix : path27.join(prefix, "bin");
20280
+ os75.augmentPath([binDir]);
20281
20281
  } catch {
20282
20282
  }
20283
20283
  }
@@ -20471,10 +20471,10 @@ function manualInstallHint(runner, tools) {
20471
20471
  const argv = osPackageInstallArgv(detectPackageManager(runner), [...tools]);
20472
20472
  return argv ? `\`sudo ${argv.join(" ")}\`` : `your package manager (e.g. \`${pkgs}\`)`;
20473
20473
  }
20474
- function writeUnzipShim(os74, runner) {
20474
+ function writeUnzipShim(os75, runner) {
20475
20475
  const python = ["python3", "python"].find((p2) => runner.which(p2));
20476
20476
  if (!python) return null;
20477
- const dir = os74.scratchPath("codeam-cr-prereq");
20477
+ const dir = os75.scratchPath("codeam-cr-prereq");
20478
20478
  const shim = path29.join(dir, "unzip");
20479
20479
  const script = `#!/bin/sh
20480
20480
  set -e
@@ -20496,9 +20496,9 @@ exec ${python} -m zipfile -e "$archive" "$dest"
20496
20496
  (0, import_node_fs6.chmodSync)(shim, 448);
20497
20497
  return dir;
20498
20498
  }
20499
- async function ensureInstallPrerequisites(os74, deps = {}) {
20499
+ async function ensureInstallPrerequisites(os75, deps = {}) {
20500
20500
  const runner = deps.runner ?? defaultOsRunner;
20501
- const missing = REQUIRED_TOOLS.filter((t2) => os74.findInPath(t2) === null);
20501
+ const missing = REQUIRED_TOOLS.filter((t2) => os75.findInPath(t2) === null);
20502
20502
  if (missing.length === 0) return { ok: true, extraPath: [] };
20503
20503
  log.info(
20504
20504
  "coderabbit",
@@ -20517,10 +20517,10 @@ async function ensureInstallPrerequisites(os74, deps = {}) {
20517
20517
  );
20518
20518
  }
20519
20519
  }
20520
- const stillMissing = REQUIRED_TOOLS.filter((t2) => os74.findInPath(t2) === null);
20520
+ const stillMissing = REQUIRED_TOOLS.filter((t2) => os75.findInPath(t2) === null);
20521
20521
  if (stillMissing.length === 0) return { ok: true, extraPath: [] };
20522
20522
  if (stillMissing.length === 1 && stillMissing[0] === "unzip") {
20523
- const shimDir = writeUnzipShim(os74, runner);
20523
+ const shimDir = writeUnzipShim(os75, runner);
20524
20524
  if (shimDir) {
20525
20525
  log.info("coderabbit", "unzip is unavailable \u2014 using a scoped python zipfile shim");
20526
20526
  return { ok: true, extraPath: [shimDir] };
@@ -20583,15 +20583,15 @@ function summarizeInstallFailure(output) {
20583
20583
  }
20584
20584
  return lines.length > 0 ? lines[lines.length - 1] : null;
20585
20585
  }
20586
- async function ensureCoderabbitInstalled(os74, deps = {}) {
20587
- if (os74.findInPath("coderabbit")) return { ok: true };
20588
- if (os74.id === "win32") {
20586
+ async function ensureCoderabbitInstalled(os75, deps = {}) {
20587
+ if (os75.findInPath("coderabbit")) return { ok: true };
20588
+ if (os75.id === "win32") {
20589
20589
  return {
20590
20590
  ok: false,
20591
20591
  error: "CodeRabbit on Windows requires WSL. Install the CLI inside your WSL distribution (curl -fsSL https://cli.coderabbit.ai/install.sh | sh), then try again."
20592
20592
  };
20593
20593
  }
20594
- const prereq = await ensureInstallPrerequisites(os74, deps);
20594
+ const prereq = await ensureInstallPrerequisites(os75, deps);
20595
20595
  if (!prereq.ok) return { ok: false, error: prereq.error };
20596
20596
  const env = { ...process.env };
20597
20597
  if (prereq.extraPath.length > 0) {
@@ -20600,8 +20600,8 @@ async function ensureCoderabbitInstalled(os74, deps = {}) {
20600
20600
  log.info("coderabbit", "CodeRabbit CLI not found \u2014 installing via the official script");
20601
20601
  const run3 = deps.runInstallScript ?? defaultRunInstallScript;
20602
20602
  const { code, output } = await run3(env);
20603
- os74.augmentPath([`${os74.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
20604
- const binary = os74.findInPath("coderabbit");
20603
+ os75.augmentPath([`${os75.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
20604
+ const binary = os75.findInPath("coderabbit");
20605
20605
  const detail = summarizeInstallFailure(output);
20606
20606
  if (binary !== null) {
20607
20607
  if (code === 0) return { ok: true };
@@ -20655,10 +20655,10 @@ function coderabbitCredentialLocator() {
20655
20655
  validate: validateNonEmptyCredential
20656
20656
  };
20657
20657
  }
20658
- function coderabbitLoginLauncher(os74) {
20658
+ function coderabbitLoginLauncher(os75) {
20659
20659
  return {
20660
20660
  async ensureInstalled() {
20661
- const result = await ensureCoderabbitInstalled(os74);
20661
+ const result = await ensureCoderabbitInstalled(os75);
20662
20662
  if (!result.ok && result.error) console.error(`
20663
20663
  \u2717 ${result.error}
20664
20664
  `);
@@ -20718,8 +20718,8 @@ function pickLine(obj) {
20718
20718
  function toHunk(raw, groupSeverity) {
20719
20719
  if (!raw || typeof raw !== "object") return null;
20720
20720
  const o = raw;
20721
- const path116 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename", "fileName"])) ?? asString(pick(o, ["location"])?.path);
20722
- if (!path116) return null;
20721
+ const path117 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename", "fileName"])) ?? asString(pick(o, ["location"])?.path);
20722
+ if (!path117) return null;
20723
20723
  const message = asString(
20724
20724
  pick(o, [
20725
20725
  "comment",
@@ -20736,7 +20736,7 @@ function toHunk(raw, groupSeverity) {
20736
20736
  const severity = normSeverity(pick(o, ["severity", "level", "priority", "impact"])) ?? normSeverity(groupSeverity);
20737
20737
  const locObj = pick(o, ["location"]) ?? o;
20738
20738
  return {
20739
- path: path116.trim(),
20739
+ path: path117.trim(),
20740
20740
  line: pickLine(o) ?? pickLine(locObj),
20741
20741
  severity,
20742
20742
  message: (title && message ? `${title}: ${message}` : title || message).trim() || "(no message)"
@@ -20819,10 +20819,10 @@ function parsePlain(stdout) {
20819
20819
  for (const line of stdout.split(/\r?\n/)) {
20820
20820
  const m = line.match(HUNK_LINE_RE);
20821
20821
  if (!m) continue;
20822
- const [, path116, lineNo, sevToken, message] = m;
20823
- if (!path116 || !lineNo || !message) continue;
20822
+ const [, path117, lineNo, sevToken, message] = m;
20823
+ if (!path117 || !lineNo || !message) continue;
20824
20824
  hunks.push({
20825
- path: path116.trim(),
20825
+ path: path117.trim(),
20826
20826
  line: Number(lineNo),
20827
20827
  severity: sevToken ? SEVERITY_MAP[sevToken.toLowerCase()] : void 0,
20828
20828
  message: message.trim().replace(/^[*-]\s+/, "")
@@ -20882,8 +20882,8 @@ var CoderabbitRuntimeStrategy = class {
20882
20882
  meta = getAgent("coderabbit");
20883
20883
  mode = "batch";
20884
20884
  os;
20885
- constructor(os74) {
20886
- this.os = os74;
20885
+ constructor(os75) {
20886
+ this.os = os75;
20887
20887
  }
20888
20888
  getDefaultArgs() {
20889
20889
  return ["review", "--agent"];
@@ -21154,10 +21154,10 @@ function cursorCredentialLocator() {
21154
21154
  validate: validateNonEmptyCredential
21155
21155
  };
21156
21156
  }
21157
- function cursorLoginLauncher(os74) {
21157
+ function cursorLoginLauncher(os75) {
21158
21158
  return {
21159
21159
  async ensureInstalled() {
21160
- if (os74.findInPath("cursor-agent")) return true;
21160
+ if (os75.findInPath("cursor-agent")) return true;
21161
21161
  console.error(
21162
21162
  "\n \u2717 cursor-agent binary not on PATH.\n Install Cursor (https://cursor.com/) and ensure the CLI\n plugin is enabled, then re-run `codeam link cursor`.\n"
21163
21163
  );
@@ -21221,8 +21221,8 @@ var CursorRuntimeStrategy = class {
21221
21221
  meta = getAgent("cursor");
21222
21222
  mode = "interactive";
21223
21223
  os;
21224
- constructor(os74) {
21225
- this.os = os74;
21224
+ constructor(os75) {
21225
+ this.os = os75;
21226
21226
  }
21227
21227
  async prepareLaunch() {
21228
21228
  const binary = this.os.findInPath("cursor-agent");
@@ -21440,10 +21440,10 @@ function aiderCredentialLocator() {
21440
21440
  validate: validateNonEmptyCredential
21441
21441
  };
21442
21442
  }
21443
- function aiderLoginLauncher(os74) {
21443
+ function aiderLoginLauncher(os75) {
21444
21444
  return {
21445
21445
  async ensureInstalled() {
21446
- if (os74.findInPath("aider")) return true;
21446
+ if (os75.findInPath("aider")) return true;
21447
21447
  console.error(
21448
21448
  "\n \u2717 aider binary not on PATH.\n Install Aider:\n pip install aider-chat\n then re-run `codeam link aider`.\n"
21449
21449
  );
@@ -21453,7 +21453,7 @@ function aiderLoginLauncher(os74) {
21453
21453
  console.error(
21454
21454
  "\n Aider has no interactive login flow.\n Set ANTHROPIC_API_KEY or OPENAI_API_KEY in your shell,\n or re-run `codeam link aider --api-key=<your-key>`.\n"
21455
21455
  );
21456
- return (0, import_node_child_process12.spawn)(os74.id === "win32" ? "cmd.exe" : "sh", os74.id === "win32" ? ["/c", "exit", "0"] : ["-c", "exit 0"], {
21456
+ return (0, import_node_child_process12.spawn)(os75.id === "win32" ? "cmd.exe" : "sh", os75.id === "win32" ? ["/c", "exit", "0"] : ["-c", "exit 0"], {
21457
21457
  stdio: "ignore"
21458
21458
  });
21459
21459
  }
@@ -21737,8 +21737,8 @@ var AiderRuntimeStrategy = class {
21737
21737
  meta = getAgent("aider");
21738
21738
  mode = "interactive";
21739
21739
  os;
21740
- constructor(os74) {
21741
- this.os = os74;
21740
+ constructor(os75) {
21741
+ this.os = os75;
21742
21742
  }
21743
21743
  async prepareLaunch() {
21744
21744
  augmentUserLocalBinPaths();
@@ -21871,8 +21871,8 @@ function geminiCredentialLocator() {
21871
21871
  function geminiLoginLauncher() {
21872
21872
  return {
21873
21873
  async ensureInstalled() {
21874
- const os74 = createOsStrategy();
21875
- return os74.findInPath("gemini") !== null;
21874
+ const os75 = createOsStrategy();
21875
+ return os75.findInPath("gemini") !== null;
21876
21876
  },
21877
21877
  launch() {
21878
21878
  return (0, import_node_child_process13.spawn)("gemini", ["auth", "login"], { stdio: "inherit" });
@@ -22062,8 +22062,8 @@ var GeminiRuntimeStrategy = class {
22062
22062
  meta = getAgent("gemini");
22063
22063
  mode = "interactive";
22064
22064
  os;
22065
- constructor(os74) {
22066
- this.os = os74;
22065
+ constructor(os75) {
22066
+ this.os = os75;
22067
22067
  }
22068
22068
  async prepareLaunch() {
22069
22069
  const binary = this.os.findInPath("gemini");
@@ -22356,8 +22356,8 @@ var KimiRuntimeStrategy = class {
22356
22356
  meta = getAgent("kimi");
22357
22357
  mode = "interactive";
22358
22358
  os;
22359
- constructor(os74) {
22360
- this.os = os74;
22359
+ constructor(os75) {
22360
+ this.os = os75;
22361
22361
  }
22362
22362
  async prepareLaunch() {
22363
22363
  const binary = this.os.findInPath("kimi");
@@ -22501,8 +22501,8 @@ var OpencodeRuntimeStrategy = class {
22501
22501
  meta = getAgent("opencode");
22502
22502
  mode = "interactive";
22503
22503
  os;
22504
- constructor(os74) {
22505
- this.os = os74;
22504
+ constructor(os75) {
22505
+ this.os = os75;
22506
22506
  }
22507
22507
  async prepareLaunch() {
22508
22508
  const binary = this.os.findInPath("opencode");
@@ -22588,20 +22588,20 @@ var OpencodeRuntimeStrategy = class {
22588
22588
 
22589
22589
  // src/agents/registry.ts
22590
22590
  var runtimeBuilders = {
22591
- claude: (os74) => new ClaudeRuntimeStrategy(os74),
22592
- codex: (os74) => new CodexRuntimeStrategy(os74),
22593
- coderabbit: (os74) => new CoderabbitRuntimeStrategy(os74),
22594
- cursor: (os74) => new CursorRuntimeStrategy(os74),
22595
- aider: (os74) => new AiderRuntimeStrategy(os74),
22596
- gemini: (os74) => new GeminiRuntimeStrategy(os74),
22597
- kimi: (os74) => new KimiRuntimeStrategy(os74),
22598
- opencode: (os74) => new OpencodeRuntimeStrategy(os74)
22591
+ claude: (os75) => new ClaudeRuntimeStrategy(os75),
22592
+ codex: (os75) => new CodexRuntimeStrategy(os75),
22593
+ coderabbit: (os75) => new CoderabbitRuntimeStrategy(os75),
22594
+ cursor: (os75) => new CursorRuntimeStrategy(os75),
22595
+ aider: (os75) => new AiderRuntimeStrategy(os75),
22596
+ gemini: (os75) => new GeminiRuntimeStrategy(os75),
22597
+ kimi: (os75) => new KimiRuntimeStrategy(os75),
22598
+ opencode: (os75) => new OpencodeRuntimeStrategy(os75)
22599
22599
  };
22600
22600
  var deployBuilders = {
22601
22601
  claude: () => new ClaudeDeployStrategy(),
22602
22602
  codex: () => new CodexDeployStrategy()
22603
22603
  };
22604
- function createAgentStrategy(agent, os74 = createOsStrategy()) {
22604
+ function createAgentStrategy(agent, os75 = createOsStrategy()) {
22605
22605
  if (!AGENT_REGISTRY[agent]?.enabled) {
22606
22606
  throw new Error(
22607
22607
  `Agent "${agent}" is not supported in this codeam-cli version. Upgrade with 'npm i -g codeam-cli@latest'.`
@@ -22611,10 +22611,10 @@ function createAgentStrategy(agent, os74 = createOsStrategy()) {
22611
22611
  if (!build) {
22612
22612
  throw new Error(`No runtime strategy registered for agent "${agent}"`);
22613
22613
  }
22614
- return build(os74);
22614
+ return build(os75);
22615
22615
  }
22616
- function createInteractiveAgentStrategy(agent, os74 = createOsStrategy()) {
22617
- const s = createAgentStrategy(agent, os74);
22616
+ function createInteractiveAgentStrategy(agent, os75 = createOsStrategy()) {
22617
+ const s = createAgentStrategy(agent, os75);
22618
22618
  if (s.mode !== "interactive") {
22619
22619
  throw new Error(
22620
22620
  `Agent "${agent}" is a batch agent; use createAgentStrategy + .runOneShot for one-shot reviews.`
@@ -23328,8 +23328,8 @@ function collectChangedFiles(cwd) {
23328
23328
  }
23329
23329
  return [...byPath.values()];
23330
23330
  }
23331
- function restoreCoderabbitOauthBlob(os74, value) {
23332
- const dir = path41.join(os74.homeDir(), ".coderabbit");
23331
+ function restoreCoderabbitOauthBlob(os75, value) {
23332
+ const dir = path41.join(os75.homeDir(), ".coderabbit");
23333
23333
  (0, import_node_fs7.mkdirSync)(dir, { recursive: true });
23334
23334
  let file = "auth.json";
23335
23335
  let contents = value.trim();
@@ -23349,26 +23349,26 @@ function installFailureMessage(result) {
23349
23349
  return result.error ?? "CodeRabbit CLI could not be installed";
23350
23350
  }
23351
23351
  async function configureCoderabbit(input, deps = {}) {
23352
- const os74 = deps.os ?? createOsStrategy();
23352
+ const os75 = deps.os ?? createOsStrategy();
23353
23353
  const ensureInstalled = deps.ensureInstalled ?? ensureCoderabbitInstalled;
23354
23354
  const isLoggedIn = deps.isLoggedIn ?? defaultIsLoggedIn;
23355
23355
  const runOAuth = deps.runOAuthLogin ?? runCoderabbitOAuthLogin;
23356
23356
  const snapshot = deps.snapshotDir ?? (() => snapshotCredentialDir());
23357
23357
  const capture2 = deps.captureCredential ?? ((b) => diffCapturedCredential(b));
23358
23358
  const loginWithApiKey = deps.loginWithApiKey ?? defaultLoginWithApiKey;
23359
- const home = os74.homeDir();
23360
- os74.augmentPath(
23361
- os74.id === "win32" ? [
23359
+ const home = os75.homeDir();
23360
+ os75.augmentPath(
23361
+ os75.id === "win32" ? [
23362
23362
  path41.join(home, ".local", "bin"),
23363
23363
  path41.join(process.env.APPDATA ?? path41.join(home, "AppData", "Roaming"), "npm"),
23364
23364
  path41.join(home, "scoop", "shims")
23365
23365
  ] : [path41.join(home, ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"]
23366
23366
  );
23367
- const installed2 = os74.findInPath("coderabbit") !== null;
23367
+ const installed2 = os75.findInPath("coderabbit") !== null;
23368
23368
  const base = () => ({
23369
23369
  action: input.action,
23370
23370
  supported: true,
23371
- installed: os74.findInPath("coderabbit") !== null,
23371
+ installed: os75.findInPath("coderabbit") !== null,
23372
23372
  loggedIn: false
23373
23373
  });
23374
23374
  if (input.action === "status") {
@@ -23382,7 +23382,7 @@ async function configureCoderabbit(input, deps = {}) {
23382
23382
  const key = (input.apiKey ?? "").trim();
23383
23383
  if (!key) return { ...res2, error: "No API key provided" };
23384
23384
  if (!res2.installed) {
23385
- const inst = await ensureInstalled(os74);
23385
+ const inst = await ensureInstalled(os75);
23386
23386
  res2.installed = inst.ok;
23387
23387
  if (!inst.ok) return { ...res2, error: installFailureMessage(inst) };
23388
23388
  }
@@ -23406,7 +23406,7 @@ async function configureCoderabbit(input, deps = {}) {
23406
23406
  }
23407
23407
  if (!res2.installed) {
23408
23408
  deps.onEvent?.({ kind: "installing" });
23409
- const inst = await ensureInstalled(os74);
23409
+ const inst = await ensureInstalled(os75);
23410
23410
  res2.installed = inst.ok;
23411
23411
  if (!inst.ok) return { ...res2, error: installFailureMessage(inst) };
23412
23412
  }
@@ -23423,7 +23423,7 @@ async function configureCoderabbit(input, deps = {}) {
23423
23423
  return { ...res2, loggedIn: true, linked: true };
23424
23424
  }
23425
23425
  try {
23426
- restoreCoderabbitOauthBlob(os74, cred.credential);
23426
+ restoreCoderabbitOauthBlob(os75, cred.credential);
23427
23427
  } catch (err) {
23428
23428
  return {
23429
23429
  ...res2,
@@ -23447,7 +23447,7 @@ async function configureCoderabbit(input, deps = {}) {
23447
23447
  const res2 = base();
23448
23448
  if (!installed2) {
23449
23449
  deps.onEvent?.({ kind: "installing" });
23450
- const inst = await ensureInstalled(os74);
23450
+ const inst = await ensureInstalled(os75);
23451
23451
  res2.installed = inst.ok;
23452
23452
  if (!inst.ok) return { ...res2, error: installFailureMessage(inst) };
23453
23453
  }
@@ -23487,7 +23487,7 @@ async function configureCoderabbit(input, deps = {}) {
23487
23487
  }
23488
23488
  const res = base();
23489
23489
  if (!res.installed) {
23490
- const inst = await ensureInstalled(os74);
23490
+ const inst = await ensureInstalled(os75);
23491
23491
  res.installed = inst.ok;
23492
23492
  if (!inst.ok) return { ...res, error: installFailureMessage(inst) };
23493
23493
  }
@@ -24924,19 +24924,49 @@ function missingExpoWebPackages(cwd) {
24924
24924
  (p2) => !fs45.existsSync(path52.join(cwd, "node_modules", p2, "package.json"))
24925
24925
  );
24926
24926
  }
24927
+ function missingExpoPackages(cwd) {
24928
+ const core = fs45.existsSync(path52.join(cwd, "node_modules", "expo", "package.json")) ? [] : ["expo"];
24929
+ return [...core, ...missingExpoWebPackages(cwd)];
24930
+ }
24931
+ var EXPO_SDK_BY_REACT_NATIVE = {
24932
+ "0.76": "52",
24933
+ "0.79": "53",
24934
+ "0.81": "54"
24935
+ };
24936
+ var WEB_PACKAGES_BY_SDK = {
24937
+ "54": { "react-native-web": "~0.21.0", "react-dom": "19.1.0", "@expo/metro-runtime": "~6.1.2" }
24938
+ };
24939
+ function expoSdkOf(cwd) {
24940
+ try {
24941
+ const raw = JSON.parse(
24942
+ fs45.readFileSync(path52.join(cwd, "node_modules", "react-native", "package.json"), "utf8")
24943
+ );
24944
+ const m = typeof raw.version === "string" ? /^(\d+\.\d+)\./.exec(raw.version) : null;
24945
+ return m ? EXPO_SDK_BY_REACT_NATIVE[m[1]] ?? null : null;
24946
+ } catch {
24947
+ return null;
24948
+ }
24949
+ }
24927
24950
  function expoWebInstallSpecs(cwd, missing) {
24928
24951
  let pinned = {};
24929
24952
  try {
24930
24953
  const raw = JSON.parse(
24931
24954
  fs45.readFileSync(path52.join(cwd, "node_modules", "expo", "bundledNativeModules.json"), "utf8")
24932
24955
  );
24933
- if (raw && typeof raw === "object" && !Array.isArray(raw)) pinned = raw;
24956
+ if (raw && typeof raw === "object" && !Array.isArray(raw))
24957
+ pinned = raw;
24934
24958
  } catch {
24935
24959
  }
24936
- return missing.map((p2) => typeof pinned[p2] === "string" ? `${p2}@${String(pinned[p2])}` : p2);
24960
+ const sdk = expoSdkOf(cwd);
24961
+ const web = sdk ? WEB_PACKAGES_BY_SDK[sdk] ?? {} : {};
24962
+ return missing.map((p2) => {
24963
+ if (typeof pinned[p2] === "string") return `${p2}@${String(pinned[p2])}`;
24964
+ if (p2 === "expo") return sdk ? `expo@~${sdk}.0.0` : "expo";
24965
+ return web[p2] ? `${p2}@${web[p2]}` : p2;
24966
+ });
24937
24967
  }
24938
24968
  function expoWebDepsInstall(cwd) {
24939
- const missing = missingExpoWebPackages(cwd);
24969
+ const missing = missingExpoPackages(cwd);
24940
24970
  if (missing.length === 0) return null;
24941
24971
  return {
24942
24972
  cmd: "npm",
@@ -25187,11 +25217,41 @@ function stopChild(child) {
25187
25217
 
25188
25218
  // src/services/preview/run-setup.ts
25189
25219
  var import_child_process18 = require("child_process");
25220
+ var fs46 = __toESM(require("fs"));
25221
+ var os35 = __toESM(require("os"));
25222
+ var path53 = __toESM(require("path"));
25223
+ function npmCacheOverride(env = process.env, home = os35.homedir(), ownerUid = (p2) => {
25224
+ try {
25225
+ return fs46.statSync(p2).uid;
25226
+ } catch {
25227
+ return null;
25228
+ }
25229
+ }, uid = process.getuid?.()) {
25230
+ const cache = env.npm_config_cache;
25231
+ if (!cache || uid === void 0) return {};
25232
+ const foreign = (p2) => {
25233
+ const owner = ownerUid(p2);
25234
+ return owner !== null && owner !== uid;
25235
+ };
25236
+ const roots = [cache, path53.join(cache, "_cacache"), path53.join(cache, "_logs")];
25237
+ const indexes = [
25238
+ path53.join(cache, "_cacache", "index-v5"),
25239
+ path53.join(cache, "_cacache", "content-v2", "sha512")
25240
+ ];
25241
+ const entries2 = indexes.flatMap((d3) => {
25242
+ try {
25243
+ return fs46.readdirSync(d3).map((e) => path53.join(d3, e));
25244
+ } catch {
25245
+ return [];
25246
+ }
25247
+ });
25248
+ return [...roots, ...indexes, ...entries2].some(foreign) ? { npm_config_cache: path53.join(home, ".npm") } : {};
25249
+ }
25190
25250
  function runSetupCommand(cmd, args2, cwd, env, opts) {
25191
25251
  return new Promise((resolve13) => {
25192
25252
  const child = (0, import_child_process18.spawn)(cmd, args2, {
25193
25253
  cwd,
25194
- env: { ...process.env, ...env ?? {} },
25254
+ env: { ...process.env, ...npmCacheOverride(), ...env ?? {} },
25195
25255
  stdio: ["ignore", "pipe", "pipe"]
25196
25256
  });
25197
25257
  let settled = false;
@@ -25575,8 +25635,8 @@ function isComposerInstallCommand(cmd, args2) {
25575
25635
  }
25576
25636
 
25577
25637
  // src/services/preview/script-candidates.ts
25578
- var fs48 = __toESM(require("fs"));
25579
- var path55 = __toESM(require("path"));
25638
+ var fs49 = __toESM(require("fs"));
25639
+ var path56 = __toESM(require("path"));
25580
25640
  var EXCLUDE_RE = /(^|:)(deploy|publish|release|build|test|e2e|lint|format|typecheck|type-check|clean|prebuild|postinstall|preinstall|prepare|install|migrate|seed|db|prisma|codegen|storybook-build)(:|$)/i;
25581
25641
  var EXCLUDE_BODY_RE = /\b(run:android|run:ios|gradlew|fastlane|xcodebuild|eas build|eas submit)\b/i;
25582
25642
  var MAX_APPS = 40;
@@ -25594,7 +25654,7 @@ function frameworkFor(pkg, body) {
25594
25654
  }
25595
25655
  function readPkg(file) {
25596
25656
  try {
25597
- return JSON.parse(fs48.readFileSync(file, "utf8"));
25657
+ return JSON.parse(fs49.readFileSync(file, "utf8"));
25598
25658
  } catch {
25599
25659
  return null;
25600
25660
  }
@@ -25604,7 +25664,7 @@ function expandGlob(root, pattern) {
25604
25664
  if (!clean.endsWith("/*")) return [clean];
25605
25665
  const base = clean.slice(0, -2);
25606
25666
  try {
25607
- return fs48.readdirSync(path55.join(root, base), { withFileTypes: true }).filter((d3) => d3.isDirectory() && !d3.name.startsWith(".") && d3.name !== "node_modules").map((d3) => path55.join(base, d3.name));
25667
+ return fs49.readdirSync(path56.join(root, base), { withFileTypes: true }).filter((d3) => d3.isDirectory() && !d3.name.startsWith(".") && d3.name !== "node_modules").map((d3) => path56.join(base, d3.name));
25608
25668
  } catch {
25609
25669
  return [];
25610
25670
  }
@@ -25613,7 +25673,7 @@ function workspaceDirs(root, rootPkg) {
25613
25673
  const ws = rootPkg?.workspaces;
25614
25674
  const patterns = Array.isArray(ws) ? ws : ws?.packages ?? [];
25615
25675
  try {
25616
- const pnpm = fs48.readFileSync(path55.join(root, "pnpm-workspace.yaml"), "utf8");
25676
+ const pnpm = fs49.readFileSync(path56.join(root, "pnpm-workspace.yaml"), "utf8");
25617
25677
  for (const m of pnpm.matchAll(/^\s*-\s*['"]?([^'"\n]+)['"]?\s*$/gm)) patterns.push(m[1]);
25618
25678
  } catch {
25619
25679
  }
@@ -25624,14 +25684,14 @@ function workspaceDirs(root, rootPkg) {
25624
25684
  }
25625
25685
  function listScriptCandidates(root) {
25626
25686
  const out2 = [];
25627
- const rootPkg = readPkg(path55.join(root, "package.json"));
25687
+ const rootPkg = readPkg(path56.join(root, "package.json"));
25628
25688
  const add = (pkg, appDir) => {
25629
25689
  for (const [script, body] of Object.entries(pkg.scripts ?? {})) {
25630
25690
  if (out2.length >= MAX_CANDIDATES) return;
25631
25691
  if (EXCLUDE_RE.test(script) || EXCLUDE_BODY_RE.test(body)) continue;
25632
25692
  const fw = frameworkFor(pkg, body);
25633
25693
  out2.push({
25634
- app: pkg.name ?? (appDir === "." ? path55.basename(root) : appDir),
25694
+ app: pkg.name ?? (appDir === "." ? path56.basename(root) : appDir),
25635
25695
  appDir,
25636
25696
  script,
25637
25697
  body,
@@ -25645,8 +25705,8 @@ function listScriptCandidates(root) {
25645
25705
  };
25646
25706
  if (rootPkg) add(rootPkg, ".");
25647
25707
  for (const dir of workspaceDirs(root, rootPkg)) {
25648
- const pkg = readPkg(path55.join(root, dir, "package.json"));
25649
- if (pkg) add(pkg, dir.split(path55.sep).join("/"));
25708
+ const pkg = readPkg(path56.join(root, dir, "package.json"));
25709
+ if (pkg) add(pkg, dir.split(path56.sep).join("/"));
25650
25710
  }
25651
25711
  return out2;
25652
25712
  }
@@ -26398,31 +26458,31 @@ async function readActivePreviewMarker(cwd, homeDir2) {
26398
26458
  }
26399
26459
 
26400
26460
  // src/agents/acp/guardrail-config.ts
26401
- var fs53 = __toESM(require("fs"));
26402
- var path60 = __toESM(require("path"));
26403
- var os37 = __toESM(require("os"));
26461
+ var fs54 = __toESM(require("fs"));
26462
+ var path61 = __toESM(require("path"));
26463
+ var os38 = __toESM(require("os"));
26404
26464
  var current = null;
26405
- function guardrailConfigPath(homeDir2 = os37.homedir()) {
26406
- return path60.join(homeDir2, ".codeam", "guardrails.json");
26465
+ function guardrailConfigPath(homeDir2 = os38.homedir()) {
26466
+ return path61.join(homeDir2, ".codeam", "guardrails.json");
26407
26467
  }
26408
- function loadGuardrailPolicy(homeDir2 = os37.homedir()) {
26468
+ function loadGuardrailPolicy(homeDir2 = os38.homedir()) {
26409
26469
  try {
26410
- current = normalizeGuardrailPolicy(JSON.parse(fs53.readFileSync(guardrailConfigPath(homeDir2), "utf8")));
26470
+ current = normalizeGuardrailPolicy(JSON.parse(fs54.readFileSync(guardrailConfigPath(homeDir2), "utf8")));
26411
26471
  } catch {
26412
26472
  current = { ...DEFAULT_GUARDRAIL_POLICY };
26413
26473
  }
26414
26474
  return current;
26415
26475
  }
26416
- function getGuardrailPolicy(homeDir2 = os37.homedir()) {
26476
+ function getGuardrailPolicy(homeDir2 = os38.homedir()) {
26417
26477
  return current ?? loadGuardrailPolicy(homeDir2);
26418
26478
  }
26419
- function setGuardrailPolicy(raw, homeDir2 = os37.homedir()) {
26479
+ function setGuardrailPolicy(raw, homeDir2 = os38.homedir()) {
26420
26480
  const next = normalizeGuardrailPolicy(raw);
26421
26481
  current = next;
26422
26482
  try {
26423
26483
  const p2 = guardrailConfigPath(homeDir2);
26424
- fs53.mkdirSync(path60.dirname(p2), { recursive: true });
26425
- fs53.writeFileSync(p2, JSON.stringify(next, null, 2));
26484
+ fs54.mkdirSync(path61.dirname(p2), { recursive: true });
26485
+ fs54.writeFileSync(p2, JSON.stringify(next, null, 2));
26426
26486
  } catch {
26427
26487
  }
26428
26488
  return next;
@@ -26438,22 +26498,22 @@ function shouldOfferOneMRecovery(opts) {
26438
26498
  }
26439
26499
 
26440
26500
  // src/commands/host/house-proxy-config.ts
26441
- var fs54 = __toESM(require("fs"));
26442
- var os38 = __toESM(require("os"));
26443
- var path61 = __toESM(require("path"));
26501
+ var fs55 = __toESM(require("fs"));
26502
+ var os39 = __toESM(require("os"));
26503
+ var path62 = __toESM(require("path"));
26444
26504
  function houseProxyConfigPath() {
26445
- return path61.join(os38.homedir(), ".codeam", "house-proxy.json");
26505
+ return path62.join(os39.homedir(), ".codeam", "house-proxy.json");
26446
26506
  }
26447
26507
  var DEPLOY_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
26448
26508
  function deployHouseProxyConfigPath(deployId) {
26449
26509
  if (!DEPLOY_ID_RE.test(deployId) || deployId.includes("..")) return null;
26450
- return path61.join(os38.homedir(), ".codeam", "house-proxy", `${deployId}.json`);
26510
+ return path62.join(os39.homedir(), ".codeam", "house-proxy", `${deployId}.json`);
26451
26511
  }
26452
26512
  function writeJson0600(file, value) {
26453
- fs54.mkdirSync(path61.dirname(file), { recursive: true, mode: 448 });
26513
+ fs55.mkdirSync(path62.dirname(file), { recursive: true, mode: 448 });
26454
26514
  const tmp = `${file}.tmp-${process.pid}`;
26455
- fs54.writeFileSync(tmp, JSON.stringify(value, null, 2), { encoding: "utf8", mode: 384 });
26456
- fs54.renameSync(tmp, file);
26515
+ fs55.writeFileSync(tmp, JSON.stringify(value, null, 2), { encoding: "utf8", mode: 384 });
26516
+ fs55.renameSync(tmp, file);
26457
26517
  restrictToOwner(file);
26458
26518
  }
26459
26519
  function persistHouseProxyConfig(config, deployId) {
@@ -26470,7 +26530,7 @@ function persistHouseProxyConfig(config, deployId) {
26470
26530
  }
26471
26531
  function clearHouseProxyConfig(deployId) {
26472
26532
  try {
26473
- fs54.rmSync(houseProxyConfigPath(), { force: true });
26533
+ fs55.rmSync(houseProxyConfigPath(), { force: true });
26474
26534
  const perDeploy = deployId ? deployHouseProxyConfigPath(deployId) : null;
26475
26535
  if (perDeploy) writeJson0600(perDeploy, { none: true });
26476
26536
  } catch {
@@ -26493,12 +26553,12 @@ function houseProxyTokenExpiring(token, nowSec, windowSec = HOUSE_PROXY_REFRESH_
26493
26553
  }
26494
26554
  function persistedConfigFile(deployId) {
26495
26555
  const perDeploy = deployId ? deployHouseProxyConfigPath(deployId) : null;
26496
- const file = perDeploy && fs54.existsSync(perDeploy) ? perDeploy : houseProxyConfigPath();
26497
- return fs54.existsSync(file) ? file : null;
26556
+ const file = perDeploy && fs55.existsSync(perDeploy) ? perDeploy : houseProxyConfigPath();
26557
+ return fs55.existsSync(file) ? file : null;
26498
26558
  }
26499
26559
  function readConfigObject(file) {
26500
26560
  try {
26501
- const parsed = JSON.parse(fs54.readFileSync(file, "utf8"));
26561
+ const parsed = JSON.parse(fs55.readFileSync(file, "utf8"));
26502
26562
  return typeof parsed === "object" && parsed !== null ? parsed : null;
26503
26563
  } catch {
26504
26564
  return null;
@@ -26531,8 +26591,8 @@ function rewriteHouseProxyToken(deployId, freshToken) {
26531
26591
  function readHouseProxyChildEnv(deployId) {
26532
26592
  try {
26533
26593
  const perDeploy = deployId ? deployHouseProxyConfigPath(deployId) : null;
26534
- const file = perDeploy && fs54.existsSync(perDeploy) ? perDeploy : houseProxyConfigPath();
26535
- const raw = fs54.readFileSync(file, "utf8");
26594
+ const file = perDeploy && fs55.existsSync(perDeploy) ? perDeploy : houseProxyConfigPath();
26595
+ const raw = fs55.readFileSync(file, "utf8");
26536
26596
  const parsed = JSON.parse(raw);
26537
26597
  if (typeof parsed !== "object" || parsed === null) return {};
26538
26598
  const o = parsed;
@@ -26642,9 +26702,9 @@ function pickHouseProxyEnv(env) {
26642
26702
  }
26643
26703
 
26644
26704
  // src/lib/provider-routing.ts
26645
- var fs55 = __toESM(require("fs"));
26646
- var os39 = __toESM(require("os"));
26647
- var path62 = __toESM(require("path"));
26705
+ var fs56 = __toESM(require("fs"));
26706
+ var os40 = __toESM(require("os"));
26707
+ var path63 = __toESM(require("path"));
26648
26708
  var PROVIDER_BASE_URL_ENV_KEYS = [
26649
26709
  "ANTHROPIC_BASE_URL",
26650
26710
  "OPENAI_BASE_URL",
@@ -26666,15 +26726,15 @@ function redactUrlToOrigin(raw) {
26666
26726
  }
26667
26727
  }
26668
26728
  function readOpencodeProviderOrigins(opts = {}) {
26669
- const home = opts.homeDir ?? os39.homedir();
26670
- const readFile8 = opts.readFile ?? ((f) => fs55.readFileSync(f, "utf8"));
26729
+ const home = opts.homeDir ?? os40.homedir();
26730
+ const readFile8 = opts.readFile ?? ((f) => fs56.readFileSync(f, "utf8"));
26671
26731
  const candidates = [];
26672
26732
  if (opts.cwd) {
26673
- candidates.push(path62.join(opts.cwd, "opencode.json"), path62.join(opts.cwd, "opencode.jsonc"));
26733
+ candidates.push(path63.join(opts.cwd, "opencode.json"), path63.join(opts.cwd, "opencode.jsonc"));
26674
26734
  }
26675
26735
  candidates.push(
26676
- path62.join(home, ".config", "opencode", "opencode.json"),
26677
- path62.join(home, ".config", "opencode", "opencode.jsonc")
26736
+ path63.join(home, ".config", "opencode", "opencode.json"),
26737
+ path63.join(home, ".config", "opencode", "opencode.jsonc")
26678
26738
  );
26679
26739
  const out2 = [];
26680
26740
  const seen2 = /* @__PURE__ */ new Set();
@@ -27028,8 +27088,8 @@ function adapterExitMessage(opts) {
27028
27088
 
27029
27089
  // src/services/preview/start-orchestrator.ts
27030
27090
  var import_child_process20 = require("child_process");
27031
- var fs59 = __toESM(require("fs"));
27032
- var path66 = __toESM(require("path"));
27091
+ var fs60 = __toESM(require("fs"));
27092
+ var path67 = __toESM(require("path"));
27033
27093
  var import_which3 = __toESM(require("which"));
27034
27094
 
27035
27095
  // src/services/preview/detection-cwd.ts
@@ -27063,13 +27123,13 @@ function resolveDetectionCwd(root, cwd) {
27063
27123
 
27064
27124
  // src/services/project-env/index.ts
27065
27125
  var import_fs6 = require("fs");
27066
- var path65 = __toESM(require("path"));
27126
+ var path66 = __toESM(require("path"));
27067
27127
 
27068
27128
  // src/beads/project-key.ts
27069
27129
  var import_child_process19 = require("child_process");
27070
27130
  var crypto2 = __toESM(require("crypto"));
27071
- var fs57 = __toESM(require("fs"));
27072
- var path64 = __toESM(require("path"));
27131
+ var fs58 = __toESM(require("fs"));
27132
+ var path65 = __toESM(require("path"));
27073
27133
  function normalizeOrigin(raw) {
27074
27134
  const trimmed = raw.trim();
27075
27135
  if (!trimmed) return null;
@@ -27095,17 +27155,17 @@ function normalizeOrigin(raw) {
27095
27155
  return `${host2}/${pathPart}`;
27096
27156
  }
27097
27157
  function findRepoRoot(cwd) {
27098
- let dir = path64.resolve(cwd);
27158
+ let dir = path65.resolve(cwd);
27099
27159
  const seen2 = /* @__PURE__ */ new Set();
27100
27160
  for (let i = 0; i < 256; i++) {
27101
27161
  if (seen2.has(dir)) return null;
27102
27162
  seen2.add(dir);
27103
27163
  try {
27104
- const stat3 = fs57.statSync(path64.join(dir, ".git"), { throwIfNoEntry: false });
27164
+ const stat3 = fs58.statSync(path65.join(dir, ".git"), { throwIfNoEntry: false });
27105
27165
  if (stat3 && (stat3.isDirectory() || stat3.isFile())) return dir;
27106
27166
  } catch {
27107
27167
  }
27108
- const parent = path64.dirname(dir);
27168
+ const parent = path65.dirname(dir);
27109
27169
  if (parent === dir) return null;
27110
27170
  dir = parent;
27111
27171
  }
@@ -27116,7 +27176,7 @@ var _execSeam3 = {
27116
27176
  const out2 = (0, import_child_process19.execFileSync)(file, args2, opts);
27117
27177
  return typeof out2 === "string" ? out2 : out2.toString("utf8");
27118
27178
  },
27119
- realpath: (p2) => fs57.realpathSync(p2)
27179
+ realpath: (p2) => fs58.realpathSync(p2)
27120
27180
  };
27121
27181
  function readOrigin(cwd) {
27122
27182
  try {
@@ -27145,7 +27205,7 @@ function deriveProjectIdentity(cwd = process.cwd()) {
27145
27205
  } catch {
27146
27206
  }
27147
27207
  const hash = crypto2.createHash("sha256").update(real).digest("hex");
27148
- return { projectKey: `path:${hash}`, projectLabel: path64.basename(real) || "project" };
27208
+ return { projectKey: `path:${hash}`, projectLabel: path65.basename(real) || "project" };
27149
27209
  }
27150
27210
 
27151
27211
  // src/services/project-env/index.ts
@@ -27158,7 +27218,7 @@ async function readIfExists(p2) {
27158
27218
  }
27159
27219
  async function syncProjectEnvUp(cwd, ctx) {
27160
27220
  if (!ctx.pluginAuthToken) return;
27161
- const content = await readIfExists(path65.join(cwd, ".env"));
27221
+ const content = await readIfExists(path66.join(cwd, ".env"));
27162
27222
  if (content == null) return;
27163
27223
  try {
27164
27224
  const { projectKey, projectLabel } = deriveProjectIdentity(cwd);
@@ -27180,7 +27240,7 @@ async function syncProjectEnvUp(cwd, ctx) {
27180
27240
  }
27181
27241
  async function restoreProjectEnvIfMissing(cwd, ctx) {
27182
27242
  if (!ctx.pluginAuthToken) return false;
27183
- const envPath = path65.join(cwd, ".env");
27243
+ const envPath = path66.join(cwd, ".env");
27184
27244
  if (await readIfExists(envPath) != null) return false;
27185
27245
  try {
27186
27246
  const { projectKey, projectLabel } = deriveProjectIdentity(cwd);
@@ -27191,7 +27251,7 @@ async function restoreProjectEnvIfMissing(cwd, ctx) {
27191
27251
  projectKey
27192
27252
  });
27193
27253
  if (!stored) return false;
27194
- const tmp = path65.join(cwd, ".env.codeam-restore.tmp");
27254
+ const tmp = path66.join(cwd, ".env.codeam-restore.tmp");
27195
27255
  await import_fs6.promises.writeFile(tmp, stored.content, { encoding: "utf8", mode: 384 });
27196
27256
  await import_fs6.promises.rename(tmp, envPath);
27197
27257
  log.info("project-env", `restored .env (${stored.keyCount} vars) for ${projectLabel}`);
@@ -27507,8 +27567,8 @@ function normalizeDetectionForSpawn(detection, cwd) {
27507
27567
  if (args2.length === 0) return detection;
27508
27568
  const binName = args2[0];
27509
27569
  if (binName.startsWith("-")) return detection;
27510
- const binPath = path66.join(cwd, "node_modules", ".bin", binName);
27511
- if (!fs59.existsSync(binPath)) return detection;
27570
+ const binPath = path67.join(cwd, "node_modules", ".bin", binName);
27571
+ if (!fs60.existsSync(binPath)) return detection;
27512
27572
  return {
27513
27573
  ...detection,
27514
27574
  command: binPath,
@@ -27565,9 +27625,15 @@ async function runExpoBringUp(ctx) {
27565
27625
  let web = webInstall === null;
27566
27626
  if (webInstall) {
27567
27627
  emitProgress("SETUP_RUN", `${webInstall.cmd} ${webInstall.args.join(" ")} (Expo web preview)`);
27568
- const r = await runSetupCommand(webInstall.cmd, webInstall.args, ctx.cwd, detection.env, {
27569
- timeoutMs: INSTALL_TIMEOUT_MS2
27570
- });
27628
+ const r = await runSetupCommand(
27629
+ webInstall.cmd,
27630
+ webInstall.args,
27631
+ ctx.cwd,
27632
+ detection.env,
27633
+ {
27634
+ timeoutMs: INSTALL_TIMEOUT_MS2
27635
+ }
27636
+ );
27571
27637
  web = r.status === "ok";
27572
27638
  if (!web) emitProgress("SETUP_RUN", `web packages not installed (${r.status}) \u2014 Expo Go only`);
27573
27639
  }
@@ -27810,7 +27876,13 @@ async function startDevServer(ctx, extraEnv = {}) {
27810
27876
  // never shows its "Serving HTTP on … (http://0.0.0.0:8000/)" line while it
27811
27877
  // already serves — every such preview ended in a 120 s ready_timeout
27812
27878
  // (codeagent-nczt.9). First, so the project's own env can still override it.
27813
- env: { PYTHONUNBUFFERED: "1", ...process.env, ...spawnable.env ?? {}, ...extraEnv },
27879
+ env: {
27880
+ PYTHONUNBUFFERED: "1",
27881
+ ...process.env,
27882
+ ...npmCacheOverride(),
27883
+ ...spawnable.env ?? {},
27884
+ ...extraEnv
27885
+ },
27814
27886
  stdio: ["ignore", "pipe", "pipe"],
27815
27887
  // POSIX: lead a new process group so teardown can SIGTERM the whole
27816
27888
  // tree. Dev servers fork worker children that bind the port; killing
@@ -27844,7 +27916,7 @@ async function startDevServer(ctx, extraEnv = {}) {
27844
27916
  killProcessTree(devServer, "SIGTERM");
27845
27917
  emit2(USER_EVENTS.PREVIEW_ERROR, {
27846
27918
  stage: "spawn",
27847
- message: describeSpawnFailure(spawnError, spawnable.command, path66.relative(ctx.rootCwd, cwd)) ?? `The dev server exited (code ${outcome.code}) before it was ready. It may need a database or other services.`,
27919
+ message: describeSpawnFailure(spawnError, spawnable.command, path67.relative(ctx.rootCwd, cwd)) ?? `The dev server exited (code ${outcome.code}) before it was ready. It may need a database or other services.`,
27848
27920
  stderrTail: stripAnsi(outputTail).slice(-8e3)
27849
27921
  });
27850
27922
  return null;
@@ -27979,9 +28051,9 @@ function describeSpawnFailure(err, command2, relDir) {
27979
28051
 
27980
28052
  // src/beads/bd-adapter.ts
27981
28053
  var import_child_process21 = require("child_process");
27982
- var fs60 = __toESM(require("fs"));
27983
- var os40 = __toESM(require("os"));
27984
- var path67 = __toESM(require("path"));
28054
+ var fs61 = __toESM(require("fs"));
28055
+ var os41 = __toESM(require("os"));
28056
+ var path68 = __toESM(require("path"));
27985
28057
 
27986
28058
  // src/beads/schema-migrate.ts
27987
28059
  var SCHEMA_SKEW_RE = /Error 1146|table not found|refusing to auto-apply \d+ pending schema migration/i;
@@ -28030,11 +28102,11 @@ function _defaultResolveBundled() {
28030
28102
  } catch {
28031
28103
  return null;
28032
28104
  }
28033
- const binDir = path67.join(path67.dirname(pkgJsonPath), "bin");
28105
+ const binDir = path68.join(path68.dirname(pkgJsonPath), "bin");
28034
28106
  const binaryName = process.platform === "win32" ? "bd.exe" : "bd";
28035
- const binaryPath = path67.join(binDir, binaryName);
28107
+ const binaryPath = path68.join(binDir, binaryName);
28036
28108
  try {
28037
- fs60.accessSync(binaryPath, fs60.constants.F_OK);
28109
+ fs61.accessSync(binaryPath, fs61.constants.F_OK);
28038
28110
  return binaryPath;
28039
28111
  } catch {
28040
28112
  return null;
@@ -28044,13 +28116,13 @@ function resolveBdOnPath() {
28044
28116
  return _resolveSeam.resolveOnPath();
28045
28117
  }
28046
28118
  function _defaultResolveOnPath() {
28047
- const dirs = (process.env.PATH ?? "").split(path67.delimiter).filter(Boolean);
28119
+ const dirs = (process.env.PATH ?? "").split(path68.delimiter).filter(Boolean);
28048
28120
  const candidates = process.platform === "win32" ? ["bd.exe", "bd.cmd", "bd"] : ["bd"];
28049
28121
  for (const dir of dirs) {
28050
28122
  for (const candidate of candidates) {
28051
- const full = path67.join(dir, candidate);
28123
+ const full = path68.join(dir, candidate);
28052
28124
  try {
28053
- fs60.accessSync(full, fs60.constants.F_OK);
28125
+ fs61.accessSync(full, fs61.constants.F_OK);
28054
28126
  return full;
28055
28127
  } catch {
28056
28128
  }
@@ -28137,7 +28209,7 @@ var BdAdapter = class {
28137
28209
  const env = { ...process.env };
28138
28210
  if (!env.HOME) {
28139
28211
  try {
28140
- const home = os40.homedir();
28212
+ const home = os41.homedir();
28141
28213
  if (home) env.HOME = home;
28142
28214
  } catch {
28143
28215
  }
@@ -28239,9 +28311,9 @@ function coerceIssue(row, projectKey) {
28239
28311
 
28240
28312
  // src/beads/provisioner.ts
28241
28313
  var import_child_process24 = require("child_process");
28242
- var fs62 = __toESM(require("fs"));
28243
- var os42 = __toESM(require("os"));
28244
- var path69 = __toESM(require("path"));
28314
+ var fs63 = __toESM(require("fs"));
28315
+ var os43 = __toESM(require("os"));
28316
+ var path70 = __toESM(require("path"));
28245
28317
 
28246
28318
  // src/beads/install-bd.ts
28247
28319
  var import_child_process22 = require("child_process");
@@ -28306,9 +28378,9 @@ async function installBd(platform3 = process.platform) {
28306
28378
 
28307
28379
  // src/beads/install-dolt.ts
28308
28380
  var import_child_process23 = require("child_process");
28309
- var fs61 = __toESM(require("fs"));
28310
- var os41 = __toESM(require("os"));
28311
- var path68 = __toESM(require("path"));
28381
+ var fs62 = __toESM(require("fs"));
28382
+ var os42 = __toESM(require("os"));
28383
+ var path69 = __toESM(require("path"));
28312
28384
  var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
28313
28385
  var DOLT_MSI_URL = "https://github.com/dolthub/dolt/releases/latest/download/dolt-windows-amd64.msi";
28314
28386
  function resolveDoltInstallStrategy(platform3) {
@@ -28348,11 +28420,11 @@ function resolveDoltInstallStrategy(platform3) {
28348
28420
  }
28349
28421
  var DOLT_RELEASE_BASE = "https://github.com/dolthub/dolt/releases/latest/download";
28350
28422
  function doltPlatformTuple(platform3, arch2) {
28351
- const os74 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
28423
+ const os75 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
28352
28424
  const a = arch2 === "x64" ? "amd64" : arch2 === "arm64" ? "arm64" : null;
28353
28425
  if (!a) return null;
28354
- if (os74 === "windows" && a !== "amd64") return null;
28355
- return `${os74}-${a}`;
28426
+ if (os75 === "windows" && a !== "amd64") return null;
28427
+ return `${os75}-${a}`;
28356
28428
  }
28357
28429
  function resolveDoltTarballStrategy(targetDir, platform3, arch2) {
28358
28430
  const tuple = doltPlatformTuple(platform3, arch2);
@@ -28397,14 +28469,14 @@ async function installDoltToDir(targetDir, platform3 = process.platform, arch2 =
28397
28469
  return result;
28398
28470
  }
28399
28471
  var _doltPathSeam = {
28400
- homedir: () => os41.homedir(),
28472
+ homedir: () => os42.homedir(),
28401
28473
  getPath: () => process.env.PATH ?? "",
28402
28474
  setPath: (p2) => {
28403
28475
  process.env.PATH = p2;
28404
28476
  },
28405
28477
  exists: (p2) => {
28406
28478
  try {
28407
- fs61.accessSync(p2, fs61.constants.F_OK);
28479
+ fs62.accessSync(p2, fs62.constants.F_OK);
28408
28480
  return true;
28409
28481
  } catch {
28410
28482
  return false;
@@ -28415,7 +28487,7 @@ function doltBinaryNames(platform3) {
28415
28487
  return platform3 === "win32" ? ["dolt.exe", "dolt.cmd", "dolt"] : ["dolt"];
28416
28488
  }
28417
28489
  function knownDoltDirs(platform3) {
28418
- const P3 = platform3 === "win32" ? path68.win32 : path68.posix;
28490
+ const P3 = platform3 === "win32" ? path69.win32 : path69.posix;
28419
28491
  const home = _doltPathSeam.homedir();
28420
28492
  if (platform3 === "win32") {
28421
28493
  return [
@@ -28431,7 +28503,7 @@ function knownDoltDirs(platform3) {
28431
28503
  ].filter(Boolean);
28432
28504
  }
28433
28505
  function ensureDoltResolvable(platform3 = process.platform) {
28434
- const P3 = platform3 === "win32" ? path68.win32 : path68.posix;
28506
+ const P3 = platform3 === "win32" ? path69.win32 : path69.posix;
28435
28507
  const delim = platform3 === "win32" ? ";" : ":";
28436
28508
  const names = doltBinaryNames(platform3);
28437
28509
  const pathDirs = _doltPathSeam.getPath().split(delim).filter(Boolean);
@@ -28608,10 +28680,10 @@ var _provisionSeam = {
28608
28680
  /** Does the project's git remote carry Dolt data (`refs/dolt/data`)? */
28609
28681
  remoteHasDoltData,
28610
28682
  /** Throwaway cwd for a user-level-only `bd setup` (see GLOBAL_ONLY_RECIPES). */
28611
- makeSetupCwd: () => fs62.mkdtempSync(path69.join(os42.tmpdir(), "codeam-bd-setup-")),
28683
+ makeSetupCwd: () => fs63.mkdtempSync(path70.join(os43.tmpdir(), "codeam-bd-setup-")),
28612
28684
  removeSetupCwd: (dir) => {
28613
28685
  try {
28614
- fs62.rmSync(dir, { recursive: true, force: true });
28686
+ fs63.rmSync(dir, { recursive: true, force: true });
28615
28687
  } catch {
28616
28688
  }
28617
28689
  }
@@ -28633,17 +28705,17 @@ function remoteHasDoltData(cwd) {
28633
28705
  }
28634
28706
  var _linkSeam = {
28635
28707
  platform: () => process.platform,
28636
- homedir: () => os42.homedir(),
28708
+ homedir: () => os43.homedir(),
28637
28709
  isWritableDir: (dir) => {
28638
28710
  try {
28639
- fs62.accessSync(dir, fs62.constants.W_OK);
28711
+ fs63.accessSync(dir, fs63.constants.W_OK);
28640
28712
  return true;
28641
28713
  } catch {
28642
28714
  return false;
28643
28715
  }
28644
28716
  },
28645
28717
  ensureDir: (dir) => {
28646
- fs62.mkdirSync(dir, { recursive: true });
28718
+ fs63.mkdirSync(dir, { recursive: true });
28647
28719
  },
28648
28720
  /**
28649
28721
  * A directory to symlink `bd` into so the AGENT's shell + Claude Code's
@@ -28664,9 +28736,9 @@ var _linkSeam = {
28664
28736
  * which `linkBdOntoPath` creates if missing.
28665
28737
  */
28666
28738
  cliBinDir: () => {
28667
- const pathDirs = (process.env.PATH ?? "").split(path69.delimiter).filter(Boolean);
28739
+ const pathDirs = (process.env.PATH ?? "").split(path70.delimiter).filter(Boolean);
28668
28740
  const home = _linkSeam.homedir();
28669
- const localBin = home ? path69.join(home, ".local", "bin") : null;
28741
+ const localBin = home ? path70.join(home, ".local", "bin") : null;
28670
28742
  if (localBin) {
28671
28743
  try {
28672
28744
  _linkSeam.ensureDir(localBin);
@@ -28676,16 +28748,16 @@ var _linkSeam = {
28676
28748
  const candidates = [];
28677
28749
  if (localBin) candidates.push(localBin);
28678
28750
  try {
28679
- candidates.push(path69.dirname(process.execPath));
28751
+ candidates.push(path70.dirname(process.execPath));
28680
28752
  } catch {
28681
28753
  }
28682
28754
  candidates.push("/usr/local/bin");
28683
28755
  const entry = process.argv[1];
28684
28756
  if (entry) {
28685
28757
  try {
28686
- candidates.push(path69.dirname(fs62.realpathSync(entry)));
28758
+ candidates.push(path70.dirname(fs63.realpathSync(entry)));
28687
28759
  } catch {
28688
- candidates.push(path69.dirname(entry));
28760
+ candidates.push(path70.dirname(entry));
28689
28761
  }
28690
28762
  }
28691
28763
  const onPathWritable = candidates.find(
@@ -28697,20 +28769,20 @@ var _linkSeam = {
28697
28769
  /** Current symlink target at `linkPath`, or null when absent / not a link. */
28698
28770
  readlink: (linkPath) => {
28699
28771
  try {
28700
- return fs62.readlinkSync(linkPath);
28772
+ return fs63.readlinkSync(linkPath);
28701
28773
  } catch {
28702
28774
  return null;
28703
28775
  }
28704
28776
  },
28705
- unlink: (linkPath) => fs62.unlinkSync(linkPath),
28706
- symlink: (target, linkPath) => fs62.symlinkSync(target, linkPath)
28777
+ unlink: (linkPath) => fs63.unlinkSync(linkPath),
28778
+ symlink: (target, linkPath) => fs63.symlinkSync(target, linkPath)
28707
28779
  };
28708
28780
  function linkBdOntoPath(binaryPath) {
28709
28781
  if (_linkSeam.platform() === "win32") return;
28710
28782
  const binDir = _linkSeam.cliBinDir();
28711
28783
  if (!binDir) return;
28712
28784
  _linkSeam.ensureDir(binDir);
28713
- const linkPath = path69.join(binDir, "bd");
28785
+ const linkPath = path70.join(binDir, "bd");
28714
28786
  if (linkPath === binaryPath) return;
28715
28787
  const current2 = _linkSeam.readlink(linkPath);
28716
28788
  if (current2 === binaryPath) return;
@@ -28948,16 +29020,16 @@ function dedupeRecipes(agents) {
28948
29020
  }
28949
29021
  function ensureLocalGitExclude(cwd, patterns) {
28950
29022
  try {
28951
- const gitDir = path69.join(cwd, ".git");
28952
- if (!fs62.statSync(gitDir).isDirectory()) return;
28953
- const file = path69.join(gitDir, "info", "exclude");
28954
- fs62.mkdirSync(path69.dirname(file), { recursive: true });
28955
- const current2 = fs62.existsSync(file) ? fs62.readFileSync(file, "utf8") : "";
29023
+ const gitDir = path70.join(cwd, ".git");
29024
+ if (!fs63.statSync(gitDir).isDirectory()) return;
29025
+ const file = path70.join(gitDir, "info", "exclude");
29026
+ fs63.mkdirSync(path70.dirname(file), { recursive: true });
29027
+ const current2 = fs63.existsSync(file) ? fs63.readFileSync(file, "utf8") : "";
28956
29028
  const have = new Set(current2.split(/\r?\n/).map((l) => l.trim()));
28957
29029
  const missing = patterns.filter((p2) => !have.has(p2));
28958
29030
  if (missing.length === 0) return;
28959
29031
  const prefix = current2.length > 0 && !current2.endsWith("\n") ? "\n" : "";
28960
- fs62.appendFileSync(file, `${prefix}# CodeAgent: beads state stays local
29032
+ fs63.appendFileSync(file, `${prefix}# CodeAgent: beads state stays local
28961
29033
  ${missing.join("\n")}
28962
29034
  `);
28963
29035
  } catch {
@@ -28966,7 +29038,7 @@ ${missing.join("\n")}
28966
29038
 
28967
29039
  // src/beads/watcher.ts
28968
29040
  var crypto4 = __toESM(require("crypto"));
28969
- var path70 = __toESM(require("path"));
29041
+ var path71 = __toESM(require("path"));
28970
29042
  var API_BASE5 = resolveApiBaseUrl();
28971
29043
  var DEBOUNCE_MS2 = 400;
28972
29044
  var ZERO_SUMMARY = {
@@ -28990,7 +29062,7 @@ var BeadsWatcher = class {
28990
29062
  constructor(opts) {
28991
29063
  this.opts = opts;
28992
29064
  this.bd = opts.adapter ?? new BdAdapter({ cwd: opts.cwd, beadsDir: opts.beadsDir });
28993
- this.feedPath = opts.feedPath ?? path70.join(opts.cwd ?? process.cwd(), ".beads", "last-touched");
29065
+ this.feedPath = opts.feedPath ?? path71.join(opts.cwd ?? process.cwd(), ".beads", "last-touched");
28994
29066
  this.apiBase = opts.apiBaseUrl ?? API_BASE5;
28995
29067
  }
28996
29068
  opts;
@@ -29645,8 +29717,8 @@ function cleanupAttachmentTempFiles() {
29645
29717
  function saveFilesTemp(files) {
29646
29718
  return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
29647
29719
  const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
29648
- const tmpPath = path75.join(os48.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
29649
- fs68.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
29720
+ const tmpPath = path76.join(os49.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
29721
+ fs69.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
29650
29722
  pendingAttachmentFiles.add(tmpPath);
29651
29723
  return tmpPath;
29652
29724
  });
@@ -29892,10 +29964,10 @@ var listFiles = async (ctx, cmd, parsed) => {
29892
29964
  await ctx.relay.sendResult(cmd.id, "completed", result);
29893
29965
  };
29894
29966
  var envReadH = async (ctx, cmd) => {
29895
- const envPath = path75.join(process.cwd(), ".env");
29967
+ const envPath = path76.join(process.cwd(), ".env");
29896
29968
  await restoreProjectEnvIfMissing(process.cwd(), ctx);
29897
29969
  try {
29898
- const raw = await fs68.promises.readFile(envPath, "utf8");
29970
+ const raw = await fs69.promises.readFile(envPath, "utf8");
29899
29971
  await ctx.relay.sendResult(cmd.id, "completed", {
29900
29972
  exists: true,
29901
29973
  vars: parseDotenv(raw)
@@ -29924,7 +29996,7 @@ var envParseH = async (ctx, cmd, parsed) => {
29924
29996
  const existing = /* @__PURE__ */ new Map();
29925
29997
  if (!replace) {
29926
29998
  try {
29927
- const raw = await fs68.promises.readFile(path75.join(process.cwd(), ".env"), "utf8");
29999
+ const raw = await fs69.promises.readFile(path76.join(process.cwd(), ".env"), "utf8");
29928
30000
  for (const v of parseDotenv(raw)) existing.set(v.key, v.value);
29929
30001
  } catch {
29930
30002
  }
@@ -29964,15 +30036,15 @@ var envWriteH = async (ctx, cmd, parsed) => {
29964
30036
  }
29965
30037
  seen2.add(v.key);
29966
30038
  }
29967
- const envPath = path75.join(process.cwd(), ".env");
29968
- const tmpPath = path75.join(process.cwd(), ".env.codeam.tmp");
30039
+ const envPath = path76.join(process.cwd(), ".env");
30040
+ const tmpPath = path76.join(process.cwd(), ".env.codeam.tmp");
29969
30041
  try {
29970
- await fs68.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
29971
- await fs68.promises.rename(tmpPath, envPath);
30042
+ await fs69.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
30043
+ await fs69.promises.rename(tmpPath, envPath);
29972
30044
  await ctx.relay.sendResult(cmd.id, "completed", { ok: true, count: vars.length });
29973
30045
  void syncProjectEnvUp(process.cwd(), ctx);
29974
30046
  } catch (err) {
29975
- await fs68.promises.rm(tmpPath, { force: true }).catch(() => void 0);
30047
+ await fs69.promises.rm(tmpPath, { force: true }).catch(() => void 0);
29976
30048
  await ctx.relay.sendResult(cmd.id, "failed", { error: err.message });
29977
30049
  }
29978
30050
  };
@@ -30198,7 +30270,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
30198
30270
  });
30199
30271
  const token = ctx.pluginAuthToken;
30200
30272
  void (async () => {
30201
- const os74 = createOsStrategy();
30273
+ const os75 = createOsStrategy();
30202
30274
  try {
30203
30275
  const report = await reviewPullRequest(
30204
30276
  {
@@ -30207,7 +30279,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
30207
30279
  baseBranch: parsed.baseBranch
30208
30280
  },
30209
30281
  {
30210
- runReview: (input) => new CoderabbitRuntimeStrategy(os74).runOneShot(input),
30282
+ runReview: (input) => new CoderabbitRuntimeStrategy(os75).runOneShot(input),
30211
30283
  runGh: (args2) => defaultRunGh(args2),
30212
30284
  postReport: async (r) => {
30213
30285
  if (!token) return;
@@ -30321,9 +30393,9 @@ var CLI_UPDATE_MAX_ATTEMPTS = 3;
30321
30393
  function buildNpmInstallInvocation(opts) {
30322
30394
  const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
30323
30395
  const execPath = opts?.execPath ?? process.execPath;
30324
- const exists2 = opts?.existsSync ?? fs68.existsSync;
30396
+ const exists2 = opts?.existsSync ?? fs69.existsSync;
30325
30397
  const platform3 = opts?.platform ?? process.platform;
30326
- const p2 = platform3 === "win32" ? path75.win32 : path75.posix;
30398
+ const p2 = platform3 === "win32" ? path76.win32 : path76.posix;
30327
30399
  const normalized = entryScript.split(/[\\/]/).join("/");
30328
30400
  const marker = "/lib/node_modules/codeam-cli/";
30329
30401
  const markerIdx = normalized.indexOf(marker);
@@ -30342,7 +30414,7 @@ function isPermissionError(stderr) {
30342
30414
  function resolveGlobalNodeModulesDir(opts) {
30343
30415
  const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
30344
30416
  const platform3 = opts?.platform ?? process.platform;
30345
- const p2 = platform3 === "win32" ? path75.win32 : path75.posix;
30417
+ const p2 = platform3 === "win32" ? path76.win32 : path76.posix;
30346
30418
  const marker = "/lib/node_modules/codeam-cli/";
30347
30419
  const markerIdx = entryScript.split(/[\\/]/).join("/").indexOf(marker);
30348
30420
  if (markerIdx <= 0) return null;
@@ -30352,21 +30424,21 @@ function resolveGlobalNodeModulesDir(opts) {
30352
30424
  var STALE_STAGING_AGE_MS = CLI_UPDATE_INSTALL_TIMEOUT_MS;
30353
30425
  function sweepStaleCliStagingDirs(nodeModulesDir, now = Date.now(), deps) {
30354
30426
  if (!nodeModulesDir) return 0;
30355
- const readdirSync18 = deps?.readdirSync ?? fs68.readdirSync;
30356
- const statSync17 = deps?.statSync ?? fs68.statSync;
30357
- const rmSync15 = deps?.rmSync ?? fs68.rmSync;
30427
+ const readdirSync19 = deps?.readdirSync ?? fs69.readdirSync;
30428
+ const statSync18 = deps?.statSync ?? fs69.statSync;
30429
+ const rmSync15 = deps?.rmSync ?? fs69.rmSync;
30358
30430
  let removed = 0;
30359
30431
  let entries2;
30360
30432
  try {
30361
- entries2 = readdirSync18(nodeModulesDir);
30433
+ entries2 = readdirSync19(nodeModulesDir);
30362
30434
  } catch {
30363
30435
  return 0;
30364
30436
  }
30365
30437
  for (const name of entries2) {
30366
30438
  if (!/^\.codeam-cli-/.test(name)) continue;
30367
- const full = path75.join(nodeModulesDir, name);
30439
+ const full = path76.join(nodeModulesDir, name);
30368
30440
  try {
30369
- const st3 = statSync17(full);
30441
+ const st3 = statSync18(full);
30370
30442
  if (now - st3.mtimeMs < STALE_STAGING_AGE_MS) continue;
30371
30443
  rmSync15(full, { recursive: true, force: true });
30372
30444
  removed++;
@@ -31513,11 +31585,11 @@ function resolveTokenValue(args2) {
31513
31585
  }
31514
31586
  const fileFlag = args2.find((a) => a.startsWith("--token-file="));
31515
31587
  if (fileFlag) {
31516
- const path116 = fileFlag.slice("--token-file=".length);
31588
+ const path117 = fileFlag.slice("--token-file=".length);
31517
31589
  try {
31518
- const content = fs69.readFileSync(path116, "utf8").trim();
31519
- if (content.length === 0) fail(`--token-file ${path116} is empty`);
31520
- rmIfExistsQuiet(path116);
31590
+ const content = fs70.readFileSync(path117, "utf8").trim();
31591
+ if (content.length === 0) fail(`--token-file ${path117} is empty`);
31592
+ rmIfExistsQuiet(path117);
31521
31593
  return content;
31522
31594
  } catch (err) {
31523
31595
  fail(`Could not read --token-file: ${err.message}`);
@@ -31609,12 +31681,12 @@ async function claim(token, pluginId, pluginSecretHash) {
31609
31681
  }
31610
31682
  }
31611
31683
  function pairAutoLockPath() {
31612
- return path76.join(os49.homedir(), ".codeam", "pair-auto.lock");
31684
+ return path77.join(os50.homedir(), ".codeam", "pair-auto.lock");
31613
31685
  }
31614
31686
  var procRoot = "/proc";
31615
31687
  function readProcFile(rel) {
31616
31688
  try {
31617
- return fs69.readFileSync(path76.join(procRoot, rel), "utf8");
31689
+ return fs70.readFileSync(path77.join(procRoot, rel), "utf8");
31618
31690
  } catch {
31619
31691
  return void 0;
31620
31692
  }
@@ -31635,7 +31707,7 @@ function currentBootId() {
31635
31707
  function readLockRecord(lockPath) {
31636
31708
  let raw;
31637
31709
  try {
31638
- raw = fs69.readFileSync(lockPath, "utf8");
31710
+ raw = fs70.readFileSync(lockPath, "utf8");
31639
31711
  } catch {
31640
31712
  return void 0;
31641
31713
  }
@@ -31684,7 +31756,7 @@ function isLiveLockHolder(rec) {
31684
31756
  }
31685
31757
  function releaseOwnLock(lockPath) {
31686
31758
  try {
31687
- if (readLockRecord(lockPath)?.pid === process.pid) fs69.unlinkSync(lockPath);
31759
+ if (readLockRecord(lockPath)?.pid === process.pid) fs70.unlinkSync(lockPath);
31688
31760
  } catch {
31689
31761
  }
31690
31762
  }
@@ -31708,7 +31780,7 @@ function snapshotProcessTree(root) {
31708
31780
  const children = /* @__PURE__ */ new Map();
31709
31781
  let entries2 = [];
31710
31782
  try {
31711
- entries2 = fs69.readdirSync(procRoot).filter((e) => /^\d+$/.test(e));
31783
+ entries2 = fs70.readdirSync(procRoot).filter((e) => /^\d+$/.test(e));
31712
31784
  } catch {
31713
31785
  }
31714
31786
  for (const e of entries2) {
@@ -31743,18 +31815,18 @@ function signalProcessTree(refs, signal) {
31743
31815
  }
31744
31816
  function daemonLockPath(sessionId) {
31745
31817
  const safe = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
31746
- return path76.join(os49.homedir(), ".codeam", `daemon-${safe}.lock`);
31818
+ return path77.join(os50.homedir(), ".codeam", `daemon-${safe}.lock`);
31747
31819
  }
31748
31820
  function acquireDaemonLock(sessionId) {
31749
31821
  const lockPath = daemonLockPath(sessionId);
31750
31822
  try {
31751
- fs69.mkdirSync(path76.dirname(lockPath), { recursive: true });
31823
+ fs70.mkdirSync(path77.dirname(lockPath), { recursive: true });
31752
31824
  try {
31753
- fs69.writeFileSync(lockPath, ownLockBody(), { flag: "wx" });
31825
+ fs70.writeFileSync(lockPath, ownLockBody(), { flag: "wx" });
31754
31826
  } catch (e) {
31755
31827
  if (e.code !== "EEXIST") throw e;
31756
31828
  if (isLiveLockHolder(readLockRecord(lockPath))) return false;
31757
- fs69.writeFileSync(lockPath, ownLockBody());
31829
+ fs70.writeFileSync(lockPath, ownLockBody());
31758
31830
  }
31759
31831
  const release3 = () => releaseOwnLock(lockPath);
31760
31832
  process.once("exit", release3);
@@ -31774,13 +31846,13 @@ function acquireDaemonLock(sessionId) {
31774
31846
  function acquireSingletonLock() {
31775
31847
  const lockPath = pairAutoLockPath();
31776
31848
  try {
31777
- fs69.mkdirSync(path76.dirname(lockPath), { recursive: true });
31849
+ fs70.mkdirSync(path77.dirname(lockPath), { recursive: true });
31778
31850
  try {
31779
- fs69.writeFileSync(lockPath, ownLockBody(), { flag: "wx" });
31851
+ fs70.writeFileSync(lockPath, ownLockBody(), { flag: "wx" });
31780
31852
  } catch (e) {
31781
31853
  if (e.code !== "EEXIST") throw e;
31782
31854
  if (isLiveLockHolder(readLockRecord(lockPath))) return false;
31783
- fs69.writeFileSync(lockPath, ownLockBody());
31855
+ fs70.writeFileSync(lockPath, ownLockBody());
31784
31856
  }
31785
31857
  process.once("exit", () => releaseOwnLock(lockPath));
31786
31858
  return true;
@@ -32206,7 +32278,7 @@ var AgentService = class _AgentService {
32206
32278
  };
32207
32279
 
32208
32280
  // src/agents/acp/adapters.ts
32209
- var path77 = __toESM(require("path"));
32281
+ var path78 = __toESM(require("path"));
32210
32282
 
32211
32283
  // src/agents/kimi/installer.ts
32212
32284
  var import_node_child_process26 = require("child_process");
@@ -32327,13 +32399,13 @@ function resolveBin(pkgName, binName) {
32327
32399
  try {
32328
32400
  const manifestPath = require_.resolve(`${pkgName}/package.json`);
32329
32401
  const manifest = require_(`${pkgName}/package.json`);
32330
- const pkgDir = path77.dirname(manifestPath);
32402
+ const pkgDir = path78.dirname(manifestPath);
32331
32403
  const bin = manifest.bin;
32332
32404
  if (!bin) return null;
32333
- if (typeof bin === "string") return path77.resolve(pkgDir, bin);
32405
+ if (typeof bin === "string") return path78.resolve(pkgDir, bin);
32334
32406
  const target = binName ?? Object.keys(bin)[0];
32335
32407
  if (!target || !bin[target]) return null;
32336
- return path77.resolve(pkgDir, bin[target]);
32408
+ return path78.resolve(pkgDir, bin[target]);
32337
32409
  } catch {
32338
32410
  return null;
32339
32411
  }
@@ -32348,7 +32420,7 @@ function npmAdapterPackageDir(agent) {
32348
32420
  const pkg = NPM_ADAPTER_PACKAGES[agent];
32349
32421
  if (!pkg) return null;
32350
32422
  try {
32351
- return path77.dirname(require_.resolve(`${pkg}/package.json`));
32423
+ return path78.dirname(require_.resolve(`${pkg}/package.json`));
32352
32424
  } catch {
32353
32425
  return null;
32354
32426
  }
@@ -32532,8 +32604,8 @@ async function resolveAcpAdapterWithRetry(agent, opts = {}) {
32532
32604
  }
32533
32605
 
32534
32606
  // src/agents/acp/prefetch-module-graph.ts
32535
- var fs70 = __toESM(require("fs"));
32536
- var path78 = __toESM(require("path"));
32607
+ var fs71 = __toESM(require("fs"));
32608
+ var path79 = __toESM(require("path"));
32537
32609
  var LOADABLE_EXT = /* @__PURE__ */ new Set([".js", ".mjs", ".cjs", ".json", ".node"]);
32538
32610
  var DEFAULT_MODULE_GRAPH_LIMITS = {
32539
32611
  maxFiles: 2e3,
@@ -32542,23 +32614,23 @@ var DEFAULT_MODULE_GRAPH_LIMITS = {
32542
32614
  concurrency: 16
32543
32615
  };
32544
32616
  var realFs = {
32545
- readdir: (dir) => fs70.promises.readdir(dir, { withFileTypes: true }),
32546
- readFile: (file) => fs70.promises.readFile(file),
32547
- stat: (file) => fs70.promises.stat(file)
32617
+ readdir: (dir) => fs71.promises.readdir(dir, { withFileTypes: true }),
32618
+ readFile: (file) => fs71.promises.readFile(file),
32619
+ stat: (file) => fs71.promises.stat(file)
32548
32620
  };
32549
32621
  function findPackageDir(dep, fromDir) {
32550
32622
  let dir = fromDir;
32551
32623
  for (; ; ) {
32552
- const candidate = path78.join(dir, "node_modules", dep);
32553
- if (fs70.existsSync(path78.join(candidate, "package.json"))) return candidate;
32554
- const parent = path78.dirname(dir);
32624
+ const candidate = path79.join(dir, "node_modules", dep);
32625
+ if (fs71.existsSync(path79.join(candidate, "package.json"))) return candidate;
32626
+ const parent = path79.dirname(dir);
32555
32627
  if (parent === dir) return null;
32556
32628
  dir = parent;
32557
32629
  }
32558
32630
  }
32559
32631
  function runtimeDependencies(pkgDir) {
32560
32632
  try {
32561
- const manifest = JSON.parse(fs70.readFileSync(path78.join(pkgDir, "package.json"), "utf8"));
32633
+ const manifest = JSON.parse(fs71.readFileSync(path79.join(pkgDir, "package.json"), "utf8"));
32562
32634
  return Object.keys(manifest.dependencies ?? {});
32563
32635
  } catch {
32564
32636
  return [];
@@ -32577,14 +32649,14 @@ async function packageFiles(pkgDir, fsd, out2, maxFiles) {
32577
32649
  for (const entry of entries2) {
32578
32650
  if (out2.length >= maxFiles) return;
32579
32651
  if (entry.name.startsWith(".")) continue;
32580
- const full = path78.join(dir, entry.name);
32652
+ const full = path79.join(dir, entry.name);
32581
32653
  if (entry.isDirectory()) {
32582
32654
  if (entry.name !== "node_modules") stack.push(full);
32583
32655
  continue;
32584
32656
  }
32585
32657
  if (!entry.isFile()) continue;
32586
32658
  if (entry.name.endsWith(".d.ts") || entry.name.endsWith(".map")) continue;
32587
- if (LOADABLE_EXT.has(path78.extname(entry.name))) out2.push(full);
32659
+ if (LOADABLE_EXT.has(path79.extname(entry.name))) out2.push(full);
32588
32660
  }
32589
32661
  }
32590
32662
  }
@@ -32594,7 +32666,7 @@ async function collectModuleGraphFiles(rootPkgDir, limits = DEFAULT_MODULE_GRAPH
32594
32666
  const queue = [rootPkgDir];
32595
32667
  while (queue.length > 0 && files.length < limits.maxFiles) {
32596
32668
  const pkgDir = queue.shift();
32597
- const key = fs70.existsSync(pkgDir) ? fs70.realpathSync(pkgDir) : pkgDir;
32669
+ const key = fs71.existsSync(pkgDir) ? fs71.realpathSync(pkgDir) : pkgDir;
32598
32670
  if (seen2.has(key)) continue;
32599
32671
  seen2.add(key);
32600
32672
  await packageFiles(pkgDir, fsd, files, limits.maxFiles);
@@ -32706,9 +32778,9 @@ async function waitForNoAgentStarting(opts) {
32706
32778
 
32707
32779
  // src/agents/acp/runner.ts
32708
32780
  var import_node_crypto15 = require("crypto");
32709
- var fs89 = __toESM(require("fs"));
32710
- var os61 = __toESM(require("os"));
32711
- var path98 = __toESM(require("path"));
32781
+ var fs90 = __toESM(require("fs"));
32782
+ var os62 = __toESM(require("os"));
32783
+ var path99 = __toESM(require("path"));
32712
32784
 
32713
32785
  // src/agents/acp/provider-billing-signal.ts
32714
32786
  var seen = /* @__PURE__ */ new Set();
@@ -32740,8 +32812,8 @@ function noteProviderBillingSignal(opts) {
32740
32812
  }
32741
32813
 
32742
32814
  // src/services/history.service.ts
32743
- var fs72 = __toESM(require("fs"));
32744
- var path80 = __toESM(require("path"));
32815
+ var fs73 = __toESM(require("fs"));
32816
+ var path81 = __toESM(require("path"));
32745
32817
  var https6 = __toESM(require("https"));
32746
32818
  var http10 = __toESM(require("http"));
32747
32819
  var import_zod3 = require("zod");
@@ -32802,7 +32874,7 @@ function parseJsonl(filePath) {
32802
32874
  const messages = [];
32803
32875
  let raw;
32804
32876
  try {
32805
- raw = fs72.readFileSync(filePath, "utf8");
32877
+ raw = fs73.readFileSync(filePath, "utf8");
32806
32878
  } catch (err) {
32807
32879
  if (err.code !== "ENOENT") {
32808
32880
  log.warn("history:parseJsonl", `read failed for ${filePath}`, err);
@@ -32962,7 +33034,7 @@ var HistoryService = class _HistoryService {
32962
33034
  // session-start upload answered false, the active-conversation pointer was
32963
33035
  // never re-pointed after a Box wake, and the app opened an empty "New
32964
33036
  // conversation" over the resumed one (QA box, 2026-09-29).
32965
- path80.join(claudeConfigDir(), "projects", encodeCwd(this.cwd));
33037
+ path81.join(claudeConfigDir(), "projects", encodeCwd(this.cwd));
32966
33038
  }
32967
33039
  /** Set the current Claude conversation ID (extracted from /cost command or session start) */
32968
33040
  setCurrentConversationId(id) {
@@ -32974,7 +33046,7 @@ var HistoryService = class _HistoryService {
32974
33046
  /** Return the current message count in the active conversation. */
32975
33047
  getCurrentMessageCount() {
32976
33048
  if (!this.currentConversationId) return 0;
32977
- const filePath = path80.join(this.projectDir, `${this.currentConversationId}.jsonl`);
33049
+ const filePath = path81.join(this.projectDir, `${this.currentConversationId}.jsonl`);
32978
33050
  return parseJsonl(filePath).length;
32979
33051
  }
32980
33052
  /**
@@ -32985,7 +33057,7 @@ var HistoryService = class _HistoryService {
32985
33057
  const deadline = Date.now() + timeoutMs;
32986
33058
  while (Date.now() < deadline) {
32987
33059
  if (!this.currentConversationId) return null;
32988
- const filePath = path80.join(this.projectDir, `${this.currentConversationId}.jsonl`);
33060
+ const filePath = path81.join(this.projectDir, `${this.currentConversationId}.jsonl`);
32989
33061
  const messages = parseJsonl(filePath);
32990
33062
  if (messages.length > previousCount) {
32991
33063
  for (let i = messages.length - 1; i >= previousCount; i--) {
@@ -33012,18 +33084,18 @@ var HistoryService = class _HistoryService {
33012
33084
  const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
33013
33085
  const oneShots = readOneShotConversations(this.cwd);
33014
33086
  try {
33015
- const files = fs72.readdirSync(dir, { withFileTypes: true }).filter(
33016
- (e) => e.isFile() && e.name.endsWith(".jsonl") && !oneShots.has(path80.basename(e.name, ".jsonl"))
33087
+ const files = fs73.readdirSync(dir, { withFileTypes: true }).filter(
33088
+ (e) => e.isFile() && e.name.endsWith(".jsonl") && !oneShots.has(path81.basename(e.name, ".jsonl"))
33017
33089
  ).map((e) => {
33018
33090
  try {
33019
- const stat3 = fs72.statSync(path80.join(dir, e.name));
33091
+ const stat3 = fs73.statSync(path81.join(dir, e.name));
33020
33092
  return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
33021
33093
  } catch {
33022
33094
  return { name: e.name, mtime: 0, birthtime: 0 };
33023
33095
  }
33024
33096
  }).filter((f) => f.birthtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
33025
33097
  if (files.length > 0) {
33026
- this.currentConversationId = path80.basename(files[0].name, ".jsonl");
33098
+ this.currentConversationId = path81.basename(files[0].name, ".jsonl");
33027
33099
  }
33028
33100
  } catch {
33029
33101
  }
@@ -33057,13 +33129,13 @@ var HistoryService = class _HistoryService {
33057
33129
  const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
33058
33130
  let entries2;
33059
33131
  try {
33060
- entries2 = fs72.readdirSync(dir, { withFileTypes: true });
33132
+ entries2 = fs73.readdirSync(dir, { withFileTypes: true });
33061
33133
  } catch {
33062
33134
  return null;
33063
33135
  }
33064
33136
  const files = entries2.filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
33065
33137
  try {
33066
- const stat3 = fs72.statSync(path80.join(dir, e.name));
33138
+ const stat3 = fs73.statSync(path81.join(dir, e.name));
33067
33139
  return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
33068
33140
  } catch {
33069
33141
  return { name: e.name, mtime: 0, birthtime: 0 };
@@ -33072,12 +33144,12 @@ var HistoryService = class _HistoryService {
33072
33144
  if (files.length === 0) return null;
33073
33145
  const targetFile = this.currentConversationId ? `${this.currentConversationId}.jsonl` : files[0].name;
33074
33146
  if (!files.some((f) => f.name === targetFile)) return null;
33075
- return this.extractUsageFromFile(path80.join(dir, targetFile));
33147
+ return this.extractUsageFromFile(path81.join(dir, targetFile));
33076
33148
  }
33077
33149
  extractUsageFromFile(filePath) {
33078
33150
  let raw;
33079
33151
  try {
33080
- raw = fs72.readFileSync(filePath, "utf8");
33152
+ raw = fs73.readFileSync(filePath, "utf8");
33081
33153
  } catch {
33082
33154
  return null;
33083
33155
  }
@@ -33129,9 +33201,9 @@ var HistoryService = class _HistoryService {
33129
33201
  let totalCost = 0;
33130
33202
  let files;
33131
33203
  try {
33132
- files = fs72.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
33204
+ files = fs73.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
33133
33205
  try {
33134
- return fs72.statSync(path80.join(projectDir, f)).mtimeMs >= monthStartMs;
33206
+ return fs73.statSync(path81.join(projectDir, f)).mtimeMs >= monthStartMs;
33135
33207
  } catch {
33136
33208
  return false;
33137
33209
  }
@@ -33142,7 +33214,7 @@ var HistoryService = class _HistoryService {
33142
33214
  for (const file of files) {
33143
33215
  let raw;
33144
33216
  try {
33145
- raw = fs72.readFileSync(path80.join(projectDir, file), "utf8");
33217
+ raw = fs73.readFileSync(path81.join(projectDir, file), "utf8");
33146
33218
  } catch {
33147
33219
  continue;
33148
33220
  }
@@ -33221,7 +33293,7 @@ var HistoryService = class _HistoryService {
33221
33293
  if (this.runtime.resolveHistoryFile) {
33222
33294
  return this.runtime.resolveHistoryFile(this.cwd, sessionId);
33223
33295
  }
33224
- return path80.join(this.projectDir, `${sessionId}.jsonl`);
33296
+ return path81.join(this.projectDir, `${sessionId}.jsonl`);
33225
33297
  }
33226
33298
  /**
33227
33299
  * Parse a conversation's messages from disk, agent-aware. Claude uses the
@@ -33259,7 +33331,7 @@ var HistoryService = class _HistoryService {
33259
33331
  };
33260
33332
  });
33261
33333
  }
33262
- return parseJsonl(path80.join(this.projectDir, `${sessionId}.jsonl`));
33334
+ return parseJsonl(path81.join(this.projectDir, `${sessionId}.jsonl`));
33263
33335
  }
33264
33336
  /** One in-flight full upload per conversation — the baton mirror and a
33265
33337
  * `get_conversation` used to upload the same transcript concurrently. */
@@ -33341,7 +33413,7 @@ var HistoryService = class _HistoryService {
33341
33413
  if (!filePath) return false;
33342
33414
  let mtimeMs;
33343
33415
  try {
33344
- mtimeMs = fs72.statSync(filePath).mtimeMs;
33416
+ mtimeMs = fs73.statSync(filePath).mtimeMs;
33345
33417
  } catch {
33346
33418
  return false;
33347
33419
  }
@@ -33416,10 +33488,10 @@ var HistoryService = class _HistoryService {
33416
33488
 
33417
33489
  // src/agents/acp/client.ts
33418
33490
  var import_node_child_process28 = require("child_process");
33419
- var fs73 = __toESM(require("fs/promises"));
33491
+ var fs74 = __toESM(require("fs/promises"));
33420
33492
  var fsSync = __toESM(require("fs"));
33421
- var os52 = __toESM(require("os"));
33422
- var path82 = __toESM(require("path"));
33493
+ var os53 = __toESM(require("os"));
33494
+ var path83 = __toESM(require("path"));
33423
33495
  var import_node_stream = require("stream");
33424
33496
 
33425
33497
  // ../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
@@ -37445,8 +37517,8 @@ function createIdleTimeout(idleMs, makeError, activeIdleMs = idleMs) {
37445
37517
  }
37446
37518
 
37447
37519
  // src/agents/acp/internal-paths.ts
37448
- var path81 = __toESM(require("path"));
37449
- var os51 = __toESM(require("os"));
37520
+ var path82 = __toESM(require("path"));
37521
+ var os52 = __toESM(require("os"));
37450
37522
  var INTERNAL_TOKENS = [".codeam", "house-claude"];
37451
37523
  var PROSE_ONLY_TOOL_KINDS = /* @__PURE__ */ new Set(["think", "switch_mode"]);
37452
37524
  function isProseOnlyToolKind(kind) {
@@ -37458,13 +37530,13 @@ function textReferencesInternal(text) {
37458
37530
  const scrubbed = text.replace(SELF_HOSTED_WORKSPACE_RE, " ");
37459
37531
  return INTERNAL_TOKENS.some((t2) => scrubbed.includes(t2));
37460
37532
  }
37461
- function pathIsInternal(p2, homeDir2 = os51.homedir()) {
37533
+ function pathIsInternal(p2, homeDir2 = os52.homedir()) {
37462
37534
  if (!p2) return false;
37463
- const abs = path81.resolve(p2);
37464
- const home = path81.resolve(homeDir2);
37465
- const within = (root) => abs === root || abs.startsWith(root + path81.sep);
37466
- if (within(path81.join(home, ".codeam", "self-hosted"))) return false;
37467
- return within(path81.join(home, ".codeam")) || within(path81.join(home, ".beads")) || abs === path81.join(home, ".codeam-host.log") || abs.includes(`${path81.sep}house-claude${path81.sep}`) || abs.endsWith(`${path81.sep}house-claude`);
37535
+ const abs = path82.resolve(p2);
37536
+ const home = path82.resolve(homeDir2);
37537
+ const within = (root) => abs === root || abs.startsWith(root + path82.sep);
37538
+ if (within(path82.join(home, ".codeam", "self-hosted"))) return false;
37539
+ return within(path82.join(home, ".codeam")) || within(path82.join(home, ".beads")) || abs === path82.join(home, ".codeam-host.log") || abs.includes(`${path82.sep}house-claude${path82.sep}`) || abs.endsWith(`${path82.sep}house-claude`);
37468
37540
  }
37469
37541
  function toolCallReferencesInternal(call, homeDir2) {
37470
37542
  if (call.locations?.some((l) => pathIsInternal(l.path, homeDir2))) return true;
@@ -38658,7 +38730,7 @@ var AcpClient = class {
38658
38730
  throw new RequestError(-32002, GUARDRAIL_SECRET_READ_BLOCK_REASON, { uri: params.path });
38659
38731
  }
38660
38732
  try {
38661
- const content = await fs73.readFile(params.path, "utf8");
38733
+ const content = await fs74.readFile(params.path, "utf8");
38662
38734
  return applyLineRange(content, params.line ?? null, params.limit ?? null);
38663
38735
  } catch (err) {
38664
38736
  const code = err.code;
@@ -38679,7 +38751,7 @@ var AcpClient = class {
38679
38751
  throw new RequestError(-32002, INTERNAL_BLOCK_REASON, { uri: params.path });
38680
38752
  }
38681
38753
  try {
38682
- await fs73.writeFile(params.path, params.content, "utf8");
38754
+ await fs74.writeFile(params.path, params.content, "utf8");
38683
38755
  return {};
38684
38756
  } catch (err) {
38685
38757
  const code = err.code;
@@ -38767,30 +38839,30 @@ function applyLineRange(content, line, limit) {
38767
38839
  return { content: lines.slice(start2, end).join("\n") };
38768
38840
  }
38769
38841
  function knownAgentBinaryDirs() {
38770
- const home = os52.homedir();
38842
+ const home = os53.homedir();
38771
38843
  const out2 = [];
38772
38844
  out2.push("/tmp/codeam-node20/bin");
38773
38845
  for (const root of [
38774
38846
  "/usr/local/share/nvm/versions/node",
38775
- path82.join(home, ".nvm/versions/node")
38847
+ path83.join(home, ".nvm/versions/node")
38776
38848
  ]) {
38777
38849
  try {
38778
38850
  for (const child of fsSync.readdirSync(root)) {
38779
- out2.push(path82.join(root, child, "bin"));
38851
+ out2.push(path83.join(root, child, "bin"));
38780
38852
  }
38781
38853
  } catch {
38782
38854
  }
38783
38855
  }
38784
- out2.push(path82.join(home, ".volta/bin"));
38856
+ out2.push(path83.join(home, ".volta/bin"));
38785
38857
  out2.push("/usr/local/bin");
38786
38858
  out2.push("/usr/bin");
38787
- out2.push(path82.join(home, ".local/bin"));
38788
- out2.push(path82.join(home, "bin"));
38859
+ out2.push(path83.join(home, ".local/bin"));
38860
+ out2.push(path83.join(home, "bin"));
38789
38861
  out2.push(...agentInstallBinDirs());
38790
38862
  if (process.platform === "win32") {
38791
38863
  const { LOCALAPPDATA, APPDATA } = process.env;
38792
- if (LOCALAPPDATA) out2.push(path82.join(LOCALAPPDATA, "cursor-agent"));
38793
- if (APPDATA) out2.push(path82.join(APPDATA, "npm"));
38864
+ if (LOCALAPPDATA) out2.push(path83.join(LOCALAPPDATA, "cursor-agent"));
38865
+ if (APPDATA) out2.push(path83.join(APPDATA, "npm"));
38794
38866
  }
38795
38867
  return out2.filter((p2) => {
38796
38868
  try {
@@ -38801,7 +38873,7 @@ function knownAgentBinaryDirs() {
38801
38873
  });
38802
38874
  }
38803
38875
  function expandPathForAgentBinaries(existingPath) {
38804
- const existing = new Set(existingPath.split(path82.delimiter).filter((p2) => p2.length > 0));
38876
+ const existing = new Set(existingPath.split(path83.delimiter).filter((p2) => p2.length > 0));
38805
38877
  const additions = [];
38806
38878
  for (const dir of knownAgentBinaryDirs()) {
38807
38879
  if (!existing.has(dir)) {
@@ -38810,17 +38882,17 @@ function expandPathForAgentBinaries(existingPath) {
38810
38882
  }
38811
38883
  }
38812
38884
  if (additions.length === 0) return existingPath;
38813
- return [...additions, existingPath].filter((p2) => p2.length > 0).join(path82.delimiter);
38885
+ return [...additions, existingPath].filter((p2) => p2.length > 0).join(path83.delimiter);
38814
38886
  }
38815
38887
 
38816
38888
  // src/commands/host/agent-install.ts
38817
38889
  var import_child_process27 = require("child_process");
38818
- var os53 = __toESM(require("os"));
38890
+ var os54 = __toESM(require("os"));
38819
38891
  function runAgentInstallScript(script, opts = {}) {
38820
38892
  const timeoutMs = opts.timeoutMs ?? 18e4;
38821
38893
  const scope = opts.logScope ?? "agent-install";
38822
38894
  return new Promise((resolve13) => {
38823
- const home = process.env.HOME || os53.homedir();
38895
+ const home = process.env.HOME || os54.homedir();
38824
38896
  const child = (0, import_child_process27.spawn)("sh", ["-c", script], {
38825
38897
  env: { ...process.env, HOME: home },
38826
38898
  stdio: ["ignore", "pipe", "pipe"]
@@ -39082,9 +39154,9 @@ async function performAgentSwitch(deps, rawAgentId, fastPath = {}) {
39082
39154
  }
39083
39155
 
39084
39156
  // src/commands/host/agent-provisioning.ts
39085
- var fs74 = __toESM(require("fs"));
39086
- var os54 = __toESM(require("os"));
39087
- var path83 = __toESM(require("path"));
39157
+ var fs75 = __toESM(require("fs"));
39158
+ var os55 = __toESM(require("os"));
39159
+ var path84 = __toESM(require("path"));
39088
39160
  var PUBLIC_TO_INTERNAL_AGENT = {
39089
39161
  claude_code: "claude",
39090
39162
  claude: "claude",
@@ -39101,22 +39173,22 @@ function toInternalAgentId(publicAgentId) {
39101
39173
  return PUBLIC_TO_INTERNAL_AGENT[publicAgentId] ?? null;
39102
39174
  }
39103
39175
  function ensureDir(dir) {
39104
- fs74.mkdirSync(dir, { recursive: true, mode: 448 });
39176
+ fs75.mkdirSync(dir, { recursive: true, mode: 448 });
39105
39177
  }
39106
39178
  function writeFile0600(filePath, contents) {
39107
- ensureDir(path83.dirname(filePath));
39108
- fs74.writeFileSync(filePath, contents, { encoding: "utf8", mode: 384 });
39179
+ ensureDir(path84.dirname(filePath));
39180
+ fs75.writeFileSync(filePath, contents, { encoding: "utf8", mode: 384 });
39109
39181
  restrictToOwner(filePath);
39110
39182
  }
39111
39183
  function rmIfExists(filePath) {
39112
39184
  try {
39113
- fs74.rmSync(filePath, { force: true });
39185
+ fs75.rmSync(filePath, { force: true });
39114
39186
  } catch {
39115
39187
  }
39116
39188
  }
39117
39189
  var claudeProvisioner = {
39118
39190
  write(auth, home) {
39119
- const credentialsJson = path83.join(home, ".claude", ".credentials.json");
39191
+ const credentialsJson = path84.join(home, ".claude", ".credentials.json");
39120
39192
  if (auth.kind === "api_key") {
39121
39193
  rmIfExists(credentialsJson);
39122
39194
  return { ANTHROPIC_API_KEY: auth.value };
@@ -39128,8 +39200,8 @@ var claudeProvisioner = {
39128
39200
  } else {
39129
39201
  rmIfExists(credentialsJson);
39130
39202
  }
39131
- const claudeJson = path83.join(home, ".claude.json");
39132
- if (!fs74.existsSync(claudeJson)) {
39203
+ const claudeJson = path84.join(home, ".claude.json");
39204
+ if (!fs75.existsSync(claudeJson)) {
39133
39205
  writeFile0600(
39134
39206
  claudeJson,
39135
39207
  JSON.stringify({ hasCompletedOnboarding: true, customApiKeyResponses: { approved: [] } })
@@ -39140,7 +39212,7 @@ var claudeProvisioner = {
39140
39212
  };
39141
39213
  var codexProvisioner = {
39142
39214
  write(auth, home) {
39143
- const authJson = path83.join(home, ".codex", "auth.json");
39215
+ const authJson = path84.join(home, ".codex", "auth.json");
39144
39216
  if (auth.kind === "api_key") {
39145
39217
  writeFile0600(authJson, JSON.stringify({ auth_mode: "apikey", OPENAI_API_KEY: auth.value }));
39146
39218
  return { OPENAI_API_KEY: auth.value };
@@ -39163,7 +39235,7 @@ function codexLoginStamp(raw) {
39163
39235
  function keepsFresherCodexLogin(authJsonPath, incoming) {
39164
39236
  let onDisk;
39165
39237
  try {
39166
- onDisk = fs74.readFileSync(authJsonPath, "utf8");
39238
+ onDisk = fs75.readFileSync(authJsonPath, "utf8");
39167
39239
  } catch {
39168
39240
  return false;
39169
39241
  }
@@ -39174,8 +39246,8 @@ function keepsFresherCodexLogin(authJsonPath, incoming) {
39174
39246
  }
39175
39247
  var geminiProvisioner = {
39176
39248
  write(auth, home) {
39177
- const settingsJson = path83.join(home, ".gemini", "settings.json");
39178
- const oauthCreds = path83.join(home, ".gemini", "oauth_creds.json");
39249
+ const settingsJson = path84.join(home, ".gemini", "settings.json");
39250
+ const oauthCreds = path84.join(home, ".gemini", "oauth_creds.json");
39179
39251
  if (auth.kind === "api_key") {
39180
39252
  rmIfExists(oauthCreds);
39181
39253
  writeFile0600(settingsJson, '{"security":{"auth":{"selectedType":"gemini-api-key"}}}');
@@ -39188,7 +39260,7 @@ var geminiProvisioner = {
39188
39260
  };
39189
39261
  var cursorProvisioner = {
39190
39262
  write(auth, home) {
39191
- const authJson = path83.join(home, ".config", "cursor", "auth.json");
39263
+ const authJson = path84.join(home, ".config", "cursor", "auth.json");
39192
39264
  if (auth.kind === "api_key") {
39193
39265
  rmIfExists(authJson);
39194
39266
  return { CURSOR_API_KEY: auth.value };
@@ -39230,22 +39302,22 @@ max_context_size = 262144
39230
39302
  var kimiProvisioner = {
39231
39303
  write(auth, home) {
39232
39304
  const credentialsFiles = [
39233
- path83.join(home, ".kimi", "credentials", "kimi-code.json"),
39234
- path83.join(home, ".kimi-code", "credentials", "kimi-code.json")
39305
+ path84.join(home, ".kimi", "credentials", "kimi-code.json"),
39306
+ path84.join(home, ".kimi-code", "credentials", "kimi-code.json")
39235
39307
  ];
39236
39308
  if (auth.kind === "api_key") {
39237
39309
  credentialsFiles.forEach(rmIfExists);
39238
39310
  return { KIMI_API_KEY: auth.value };
39239
39311
  }
39240
39312
  credentialsFiles.forEach((f) => writeFile0600(f, auth.value));
39241
- writeFile0600(path83.join(home, ".kimi-code", "config.toml"), KIMI_MANAGED_CONFIG_TOML);
39313
+ writeFile0600(path84.join(home, ".kimi-code", "config.toml"), KIMI_MANAGED_CONFIG_TOML);
39242
39314
  return {};
39243
39315
  }
39244
39316
  };
39245
39317
  var coderabbitProvisioner = {
39246
39318
  write(auth, home) {
39247
- const dir = path83.join(home, ".coderabbit");
39248
- const authJson = path83.join(dir, "auth.json");
39319
+ const dir = path84.join(home, ".coderabbit");
39320
+ const authJson = path84.join(dir, "auth.json");
39249
39321
  if (auth.kind === "api_key") {
39250
39322
  rmIfExists(authJson);
39251
39323
  return { CODERABBIT_API_KEY: auth.value };
@@ -39257,13 +39329,13 @@ var coderabbitProvisioner = {
39257
39329
  try {
39258
39330
  const parsed = JSON.parse(value);
39259
39331
  if (typeof parsed.file === "string" && typeof parsed.contents === "string") {
39260
- file = path83.basename(parsed.file);
39332
+ file = path84.basename(parsed.file);
39261
39333
  contents = parsed.contents;
39262
39334
  }
39263
39335
  } catch {
39264
39336
  }
39265
39337
  }
39266
- writeFile0600(path83.join(dir, file), contents);
39338
+ writeFile0600(path84.join(dir, file), contents);
39267
39339
  return {};
39268
39340
  }
39269
39341
  };
@@ -39295,7 +39367,7 @@ var UnsupportedAgentError = class extends Error {
39295
39367
  this.agentId = agentId;
39296
39368
  }
39297
39369
  };
39298
- function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os54.homedir()) {
39370
+ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os55.homedir()) {
39299
39371
  const internal = toInternalAgentId(publicAgentId);
39300
39372
  if (!internal) throw new UnsupportedAgentError(publicAgentId);
39301
39373
  const provisioner = PROVISIONERS[internal];
@@ -39304,8 +39376,8 @@ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os54.homedir(
39304
39376
  }
39305
39377
 
39306
39378
  // src/beads/workflow-hint.ts
39307
- var fs75 = __toESM(require("fs"));
39308
- var path84 = __toESM(require("path"));
39379
+ var fs76 = __toESM(require("fs"));
39380
+ var path85 = __toESM(require("path"));
39309
39381
  var BEADS_HINT_MARKER = "<!-- codeam:beads-workflow -->";
39310
39382
  var BEADS_HINT = `${BEADS_HINT_MARKER}
39311
39383
  # Beads (bd) \u2014 task tracking + persistent memory (ALWAYS use it)
@@ -39332,11 +39404,11 @@ function ensureBeadsWorkflowHint(homeDir2, file = claudeMemoryFile(homeDir2)) {
39332
39404
  try {
39333
39405
  let existing = "";
39334
39406
  try {
39335
- existing = fs75.readFileSync(file, "utf8");
39407
+ existing = fs76.readFileSync(file, "utf8");
39336
39408
  } catch {
39337
39409
  }
39338
39410
  if (existing.includes(BEADS_HINT)) return;
39339
- fs75.mkdirSync(path84.dirname(file), { recursive: true });
39411
+ fs76.mkdirSync(path85.dirname(file), { recursive: true });
39340
39412
  let next;
39341
39413
  const open = existing.indexOf(BEADS_HINT_MARKER);
39342
39414
  const close = open === -1 ? -1 : existing.indexOf(BEADS_HINT_MARKER, open + BEADS_HINT_MARKER.length);
@@ -39349,40 +39421,40 @@ ${BEADS_HINT}
39349
39421
  ` : `${BEADS_HINT}
39350
39422
  `;
39351
39423
  }
39352
- fs75.writeFileSync(file, next);
39424
+ fs76.writeFileSync(file, next);
39353
39425
  } catch {
39354
39426
  }
39355
39427
  }
39356
39428
 
39357
39429
  // src/agents/agent-standard.ts
39358
- var fs76 = __toESM(require("fs"));
39359
- var path85 = __toESM(require("path"));
39360
- var os55 = __toESM(require("os"));
39430
+ var fs77 = __toESM(require("fs"));
39431
+ var path86 = __toESM(require("path"));
39432
+ var os56 = __toESM(require("os"));
39361
39433
  function ensureAgentStandard(homeDir2, file = claudeMemoryFile(homeDir2)) {
39362
39434
  try {
39363
39435
  let existing = "";
39364
39436
  try {
39365
- existing = fs76.readFileSync(file, "utf8");
39437
+ existing = fs77.readFileSync(file, "utf8");
39366
39438
  } catch {
39367
39439
  }
39368
39440
  if (existing.includes(AGENT_STANDARD_MARKER)) return;
39369
- fs76.mkdirSync(path85.dirname(file), { recursive: true });
39441
+ fs77.mkdirSync(path86.dirname(file), { recursive: true });
39370
39442
  const next = existing.trim() ? `${existing.trimEnd()}
39371
39443
 
39372
39444
  ${AGENT_STANDARD_BLOCK}
39373
39445
  ` : `${AGENT_STANDARD_BLOCK}
39374
39446
  `;
39375
- fs76.writeFileSync(file, next);
39447
+ fs77.writeFileSync(file, next);
39376
39448
  } catch {
39377
39449
  }
39378
39450
  }
39379
39451
  var _agentStandardSeam = {
39380
39452
  isLocalSession: () => isLocalSession(),
39381
- markerPath: (sessionId) => path85.join(os55.homedir(), ".codeam", "agent-standard", `${sessionId}.done`),
39382
- exists: (p2) => fs76.existsSync(p2),
39453
+ markerPath: (sessionId) => path86.join(os56.homedir(), ".codeam", "agent-standard", `${sessionId}.done`),
39454
+ exists: (p2) => fs77.existsSync(p2),
39383
39455
  write: (p2) => {
39384
- fs76.mkdirSync(path85.dirname(p2), { recursive: true });
39385
- fs76.writeFileSync(p2, "");
39456
+ fs77.mkdirSync(path86.dirname(p2), { recursive: true });
39457
+ fs77.writeFileSync(p2, "");
39386
39458
  }
39387
39459
  };
39388
39460
  function isClaude(agent) {
@@ -40243,15 +40315,15 @@ function withholdTrailingPartialFenceMarker(text) {
40243
40315
 
40244
40316
  // src/agents/acp/onboarding.ts
40245
40317
  var import_child_process28 = require("child_process");
40246
- var fs78 = __toESM(require("fs"));
40247
- var os56 = __toESM(require("os"));
40248
- var path87 = __toESM(require("path"));
40318
+ var fs79 = __toESM(require("fs"));
40319
+ var os57 = __toESM(require("os"));
40320
+ var path88 = __toESM(require("path"));
40249
40321
  var _onboardingSeam = {
40250
- markerPath: (sessionId) => path87.join(os56.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
40251
- exists: (p2) => fs78.existsSync(p2),
40322
+ markerPath: (sessionId) => path88.join(os57.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
40323
+ exists: (p2) => fs79.existsSync(p2),
40252
40324
  write: (p2) => {
40253
- fs78.mkdirSync(path87.dirname(p2), { recursive: true });
40254
- fs78.writeFileSync(p2, "");
40325
+ fs79.mkdirSync(path88.dirname(p2), { recursive: true });
40326
+ fs79.writeFileSync(p2, "");
40255
40327
  },
40256
40328
  disabled: () => {
40257
40329
  const v = process.env.CODEAM_ONBOARDING_DISABLED;
@@ -40288,7 +40360,7 @@ function resolveRepoName(cwd) {
40288
40360
  if (name) return name;
40289
40361
  }
40290
40362
  }
40291
- const base = path87.basename(cwd || "");
40363
+ const base = path88.basename(cwd || "");
40292
40364
  if (base && !isUuid(base)) return base;
40293
40365
  return "this project";
40294
40366
  }
@@ -40688,14 +40760,14 @@ var import_crypto5 = require("crypto");
40688
40760
 
40689
40761
  // src/services/turn-files/git-changeset.ts
40690
40762
  var import_child_process29 = require("child_process");
40691
- var fs80 = __toESM(require("fs/promises"));
40763
+ var fs81 = __toESM(require("fs/promises"));
40692
40764
  var import_fs10 = require("fs");
40693
- var path89 = __toESM(require("path"));
40765
+ var path90 = __toESM(require("path"));
40694
40766
 
40695
40767
  // src/services/turn-files/review-ignore.ts
40696
40768
  var import_ignore2 = __toESM(require("ignore"));
40697
- var fs79 = __toESM(require("fs"));
40698
- var path88 = __toESM(require("path"));
40769
+ var fs80 = __toESM(require("fs"));
40770
+ var path89 = __toESM(require("path"));
40699
40771
  var CURATED_REVIEW_IGNORE = [
40700
40772
  // Google Cloud SDK (the incident) — installs a huge python tree.
40701
40773
  "google-cloud-sdk/",
@@ -40739,7 +40811,7 @@ var CURATED_REVIEW_IGNORE = [
40739
40811
  function makeReviewIgnore(repoRoot) {
40740
40812
  const ig = (0, import_ignore2.default)().add(CURATED_REVIEW_IGNORE);
40741
40813
  try {
40742
- const custom = fs79.readFileSync(path88.join(repoRoot, ".codeam", "reviewignore"), "utf8");
40814
+ const custom = fs80.readFileSync(path89.join(repoRoot, ".codeam", "reviewignore"), "utf8");
40743
40815
  ig.add(custom);
40744
40816
  } catch {
40745
40817
  }
@@ -40774,7 +40846,7 @@ async function collectRepoChangeset(opts) {
40774
40846
  const rows = parseStatus(status2).filter(
40775
40847
  (row) => !isIgnoredFilePath(row.filePath) && !reviewIgnore(row.filePath) && // A socket, FIFO or device node is never a change to review (a
40776
40848
  // `cc-socks/1522.sock` reached the Files tab).
40777
- isReviewablePath(path89.join(opts.repoRoot, row.filePath))
40849
+ isReviewablePath(path90.join(opts.repoRoot, row.filePath))
40778
40850
  );
40779
40851
  const MAX_CHANGESET_FILES = Math.max(1, Number(process.env.CODEAM_MAX_CHANGESET_FILES ?? 500));
40780
40852
  const truncated = rows.length > MAX_CHANGESET_FILES;
@@ -40791,7 +40863,7 @@ async function collectRepoChangeset(opts) {
40791
40863
  let stats;
40792
40864
  if (!truncated && row.fileStatus === "added" && numstatEntry === void 0) {
40793
40865
  const lineCount = await readUntrackedLineCount(
40794
- path89.join(opts.repoRoot, row.filePath)
40866
+ path90.join(opts.repoRoot, row.filePath)
40795
40867
  );
40796
40868
  stats = { added: lineCount, removed: 0 };
40797
40869
  } else {
@@ -40822,7 +40894,7 @@ function readUntrackedLineCount(absPath) {
40822
40894
  }
40823
40895
  async function defaultReadUntrackedLineCount(absPath) {
40824
40896
  try {
40825
- const content = await fs80.readFile(absPath, "utf8");
40897
+ const content = await fs81.readFile(absPath, "utf8");
40826
40898
  let count = 0;
40827
40899
  let pos = -1;
40828
40900
  while ((pos = content.indexOf("\n", pos + 1)) !== -1) {
@@ -40914,7 +40986,7 @@ function defaultRunGit(cwd, args2) {
40914
40986
  });
40915
40987
  }
40916
40988
  async function discoverRepos(workingDir, maxDepth = 4) {
40917
- const fs103 = await import("fs/promises");
40989
+ const fs104 = await import("fs/promises");
40918
40990
  const out2 = [];
40919
40991
  await walk2(workingDir, 0);
40920
40992
  return out2;
@@ -40922,7 +40994,7 @@ async function discoverRepos(workingDir, maxDepth = 4) {
40922
40994
  if (depth2 > maxDepth) return;
40923
40995
  let entries2 = [];
40924
40996
  try {
40925
- const dirents = await fs103.readdir(dir, { withFileTypes: true });
40997
+ const dirents = await fs104.readdir(dir, { withFileTypes: true });
40926
40998
  entries2 = dirents.filter((d3) => !d3.name.startsWith(".") || d3.name === ".git").map((d3) => ({ name: d3.name, isDirectory: d3.isDirectory() }));
40927
40999
  } catch {
40928
41000
  return;
@@ -40933,8 +41005,8 @@ async function discoverRepos(workingDir, maxDepth = 4) {
40933
41005
  if (hasGit) {
40934
41006
  out2.push({
40935
41007
  repoRoot: dir,
40936
- repoPath: path89.relative(workingDir, dir),
40937
- repoName: path89.basename(dir)
41008
+ repoPath: path90.relative(workingDir, dir),
41009
+ repoName: path90.basename(dir)
40938
41010
  });
40939
41011
  return;
40940
41012
  }
@@ -40942,7 +41014,7 @@ async function discoverRepos(workingDir, maxDepth = 4) {
40942
41014
  if (!entry.isDirectory) continue;
40943
41015
  if (entry.name === "node_modules") continue;
40944
41016
  if (entry.name === "dist" || entry.name === "build") continue;
40945
- await walk2(path89.join(dir, entry.name), depth2 + 1);
41017
+ await walk2(path90.join(dir, entry.name), depth2 + 1);
40946
41018
  }
40947
41019
  }
40948
41020
  }
@@ -40956,8 +41028,8 @@ function isReviewablePath(absPath) {
40956
41028
  }
40957
41029
 
40958
41030
  // src/services/turn-files/files-outbox.ts
40959
- var fs81 = __toESM(require("fs/promises"));
40960
- var path90 = __toESM(require("path"));
41031
+ var fs82 = __toESM(require("fs/promises"));
41032
+ var path91 = __toESM(require("path"));
40961
41033
  var import_os14 = require("os");
40962
41034
  var HOME_OUTBOX_DIR = ".codeam/outbox";
40963
41035
  var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
@@ -40990,16 +41062,16 @@ var FilesOutbox = class {
40990
41062
  backoffIndex = 0;
40991
41063
  stopped = false;
40992
41064
  constructor(opts) {
40993
- const base = opts.baseDir ?? path90.join(homeDir(), HOME_OUTBOX_DIR);
40994
- this.filePath = path90.join(base, `${opts.sessionId}.jsonl`);
41065
+ const base = opts.baseDir ?? path91.join(homeDir(), HOME_OUTBOX_DIR);
41066
+ this.filePath = path91.join(base, `${opts.sessionId}.jsonl`);
40995
41067
  this.post = opts.post;
40996
41068
  this.autoSchedule = opts.autoSchedule !== false;
40997
41069
  }
40998
41070
  /** Persist the entry to disk and trigger a flush. Returns once the
40999
41071
  * line is durable on disk (not once the POST succeeds). */
41000
41072
  async enqueue(entry) {
41001
- await fs81.mkdir(path90.dirname(this.filePath), { recursive: true });
41002
- await fs81.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
41073
+ await fs82.mkdir(path91.dirname(this.filePath), { recursive: true });
41074
+ await fs82.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
41003
41075
  this.backoffIndex = 0;
41004
41076
  if (this.autoSchedule) this.scheduleFlush(0);
41005
41077
  }
@@ -41090,7 +41162,7 @@ var FilesOutbox = class {
41090
41162
  async readAll() {
41091
41163
  let raw = "";
41092
41164
  try {
41093
- raw = await fs81.readFile(this.filePath, "utf8");
41165
+ raw = await fs82.readFile(this.filePath, "utf8");
41094
41166
  } catch {
41095
41167
  return [];
41096
41168
  }
@@ -41114,12 +41186,12 @@ var FilesOutbox = class {
41114
41186
  async rewrite(entries2) {
41115
41187
  const tmpPath = `${this.filePath}.${process.pid}.tmp`;
41116
41188
  if (entries2.length === 0) {
41117
- await fs81.unlink(this.filePath).catch(() => void 0);
41189
+ await fs82.unlink(this.filePath).catch(() => void 0);
41118
41190
  return;
41119
41191
  }
41120
41192
  const payload = entries2.map((e) => JSON.stringify(e)).join("\n") + "\n";
41121
- await fs81.writeFile(tmpPath, payload, "utf8");
41122
- await fs81.rename(tmpPath, this.filePath);
41193
+ await fs82.writeFile(tmpPath, payload, "utf8");
41194
+ await fs82.rename(tmpPath, this.filePath);
41123
41195
  }
41124
41196
  };
41125
41197
  function applyJitter(ms) {
@@ -41489,8 +41561,8 @@ async function readActiveConversationMarker(cwd, homeDir2) {
41489
41561
 
41490
41562
  // src/packs/gates.ts
41491
41563
  var import_node_child_process29 = require("child_process");
41492
- var fs83 = __toESM(require("fs"));
41493
- var path92 = __toESM(require("path"));
41564
+ var fs84 = __toESM(require("fs"));
41565
+ var path93 = __toESM(require("path"));
41494
41566
  var defaultCommandRunner = (file, args2, cwd, timeoutMs, env) => new Promise((resolve13) => {
41495
41567
  (0, import_node_child_process29.execFile)(
41496
41568
  file,
@@ -41540,7 +41612,7 @@ async function changedFiles(run3, cwd, from, to) {
41540
41612
  }
41541
41613
  function readWorkspaceFile(cwd, relPath) {
41542
41614
  try {
41543
- return fs83.readFileSync(path92.join(cwd, relPath), "utf8");
41615
+ return fs84.readFileSync(path93.join(cwd, relPath), "utf8");
41544
41616
  } catch {
41545
41617
  return null;
41546
41618
  }
@@ -41549,14 +41621,14 @@ var NO_TEST_PLACEHOLDER = 'echo "Error: no test specified"';
41549
41621
  var CHECKS_TIMEOUT_MS = 5 * 6e4;
41550
41622
  function detectChecksCommand(cwd) {
41551
41623
  try {
41552
- const cfg = JSON.parse(fs83.readFileSync(path92.join(cwd, ".codeam", "pack.json"), "utf8"));
41624
+ const cfg = JSON.parse(fs84.readFileSync(path93.join(cwd, ".codeam", "pack.json"), "utf8"));
41553
41625
  if (typeof cfg.checksCommand === "string" && cfg.checksCommand.trim().length > 0) {
41554
41626
  return cfg.checksCommand.trim();
41555
41627
  }
41556
41628
  } catch {
41557
41629
  }
41558
41630
  try {
41559
- const pkg = JSON.parse(fs83.readFileSync(path92.join(cwd, "package.json"), "utf8"));
41631
+ const pkg = JSON.parse(fs84.readFileSync(path93.join(cwd, "package.json"), "utf8"));
41560
41632
  const test = pkg.scripts?.test;
41561
41633
  if (typeof test === "string" && test.trim().length > 0 && !test.includes(NO_TEST_PLACEHOLDER)) {
41562
41634
  return "npm test";
@@ -41574,39 +41646,39 @@ ${res.stderr}`.trim();
41574
41646
  }
41575
41647
 
41576
41648
  // src/packs/run-store.ts
41577
- var fs84 = __toESM(require("fs"));
41578
- var path93 = __toESM(require("path"));
41649
+ var fs85 = __toESM(require("fs"));
41650
+ var path94 = __toESM(require("path"));
41579
41651
  var crypto5 = __toESM(require("crypto"));
41580
41652
  function packsDir(cwd) {
41581
- return path93.join(cwd, ".codeam", "packs");
41653
+ return path94.join(cwd, ".codeam", "packs");
41582
41654
  }
41583
41655
  function runDir(cwd, runId) {
41584
- return path93.join(packsDir(cwd), runId);
41656
+ return path94.join(packsDir(cwd), runId);
41585
41657
  }
41586
41658
  function newRunId() {
41587
41659
  return `pk_${Date.now().toString(36)}_${crypto5.randomBytes(4).toString("hex")}`;
41588
41660
  }
41589
41661
  function writeJsonAtomic(file, value) {
41590
- fs84.mkdirSync(path93.dirname(file), { recursive: true });
41662
+ fs85.mkdirSync(path94.dirname(file), { recursive: true });
41591
41663
  const tmp = `${file}.tmp`;
41592
- fs84.writeFileSync(tmp, JSON.stringify(value, null, 2));
41593
- fs84.renameSync(tmp, file);
41664
+ fs85.writeFileSync(tmp, JSON.stringify(value, null, 2));
41665
+ fs85.renameSync(tmp, file);
41594
41666
  }
41595
41667
  function saveRun(cwd, state) {
41596
- writeJsonAtomic(path93.join(runDir(cwd, state.runId), "run.json"), state);
41668
+ writeJsonAtomic(path94.join(runDir(cwd, state.runId), "run.json"), state);
41597
41669
  }
41598
41670
  function saveStageHandoff(cwd, runId, stageIndex, role, handoff) {
41599
41671
  const name = `${String(stageIndex + 1).padStart(2, "0")}-${role}.json`;
41600
- writeJsonAtomic(path93.join(runDir(cwd, runId), name), handoff);
41672
+ writeJsonAtomic(path94.join(runDir(cwd, runId), name), handoff);
41601
41673
  }
41602
41674
  function loadLatestRun(cwd) {
41603
41675
  try {
41604
41676
  const dir = packsDir(cwd);
41605
- const entries2 = fs84.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
41677
+ const entries2 = fs85.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
41606
41678
  for (let i = entries2.length - 1; i >= 0; i--) {
41607
- const file = path93.join(dir, entries2[i], "run.json");
41679
+ const file = path94.join(dir, entries2[i], "run.json");
41608
41680
  try {
41609
- const parsed = JSON.parse(fs84.readFileSync(file, "utf8"));
41681
+ const parsed = JSON.parse(fs85.readFileSync(file, "utf8"));
41610
41682
  if (parsed && typeof parsed.runId === "string") return parsed;
41611
41683
  } catch {
41612
41684
  }
@@ -41617,17 +41689,17 @@ function loadLatestRun(cwd) {
41617
41689
  }
41618
41690
  function ensureLedgerIgnored(cwd) {
41619
41691
  try {
41620
- const gitDir = path93.join(cwd, ".git");
41621
- if (!fs84.existsSync(gitDir)) return;
41622
- const exclude = path93.join(gitDir, "info", "exclude");
41692
+ const gitDir = path94.join(cwd, ".git");
41693
+ if (!fs85.existsSync(gitDir)) return;
41694
+ const exclude = path94.join(gitDir, "info", "exclude");
41623
41695
  let existing = "";
41624
41696
  try {
41625
- existing = fs84.readFileSync(exclude, "utf8");
41697
+ existing = fs85.readFileSync(exclude, "utf8");
41626
41698
  } catch {
41627
41699
  }
41628
41700
  if (existing.includes(".codeam/packs/")) return;
41629
- fs84.mkdirSync(path93.dirname(exclude), { recursive: true });
41630
- fs84.writeFileSync(exclude, `${existing.trimEnd()}
41701
+ fs85.mkdirSync(path94.dirname(exclude), { recursive: true });
41702
+ fs85.writeFileSync(exclude, `${existing.trimEnd()}
41631
41703
  .codeam/packs/
41632
41704
  `.trimStart());
41633
41705
  } catch {
@@ -42622,20 +42694,20 @@ async function mcpRouter() {
42622
42694
  }
42623
42695
 
42624
42696
  // src/integrations/mcp-secrets.ts
42625
- var fs86 = __toESM(require("fs"));
42626
- var os59 = __toESM(require("os"));
42627
- var path95 = __toESM(require("path"));
42697
+ var fs87 = __toESM(require("fs"));
42698
+ var os60 = __toESM(require("os"));
42699
+ var path96 = __toESM(require("path"));
42628
42700
  var MCP_SECRETS_FILE_ENV = "CODEAM_MCP_SECRETS_FILE";
42629
42701
  function mcpSecretsDir() {
42630
- return path95.join(os59.homedir(), ".codeam", "mcp-secrets");
42702
+ return path96.join(os60.homedir(), ".codeam", "mcp-secrets");
42631
42703
  }
42632
42704
  function mcpSecretsPath(scope, pid = process.pid) {
42633
- return path95.join(mcpSecretsDir(), `${pid}-${scope}.json`);
42705
+ return path96.join(mcpSecretsDir(), `${pid}-${scope}.json`);
42634
42706
  }
42635
42707
  var registeredForCleanup = /* @__PURE__ */ new Set();
42636
42708
  function readFileVars(file) {
42637
42709
  try {
42638
- const parsed = JSON.parse(fs86.readFileSync(file, "utf8"));
42710
+ const parsed = JSON.parse(fs87.readFileSync(file, "utf8"));
42639
42711
  if (!parsed || typeof parsed !== "object") return {};
42640
42712
  const out2 = {};
42641
42713
  for (const [k2, v] of Object.entries(parsed)) {
@@ -42657,7 +42729,7 @@ function pidAlive2(pid) {
42657
42729
  function pruneStale(dir) {
42658
42730
  let names = [];
42659
42731
  try {
42660
- names = fs86.readdirSync(dir);
42732
+ names = fs87.readdirSync(dir);
42661
42733
  } catch {
42662
42734
  return;
42663
42735
  }
@@ -42667,25 +42739,25 @@ function pruneStale(dir) {
42667
42739
  const pid = Number(m[1]);
42668
42740
  if (pid === process.pid || pidAlive2(pid)) continue;
42669
42741
  try {
42670
- fs86.unlinkSync(path95.join(dir, name));
42742
+ fs87.unlinkSync(path96.join(dir, name));
42671
42743
  } catch {
42672
42744
  }
42673
42745
  }
42674
42746
  }
42675
42747
  function writeMcpSecrets(vars, file) {
42676
42748
  try {
42677
- const dir = path95.dirname(file);
42678
- fs86.mkdirSync(dir, { recursive: true, mode: 448 });
42749
+ const dir = path96.dirname(file);
42750
+ fs87.mkdirSync(dir, { recursive: true, mode: 448 });
42679
42751
  pruneStale(dir);
42680
42752
  const tmp = `${file}.${process.pid}.tmp`;
42681
- fs86.writeFileSync(tmp, JSON.stringify(vars), { mode: 384 });
42682
- fs86.renameSync(tmp, file);
42683
- fs86.chmodSync(file, 384);
42753
+ fs87.writeFileSync(tmp, JSON.stringify(vars), { mode: 384 });
42754
+ fs87.renameSync(tmp, file);
42755
+ fs87.chmodSync(file, 384);
42684
42756
  if (!registeredForCleanup.has(file)) {
42685
42757
  registeredForCleanup.add(file);
42686
42758
  process.once("exit", () => {
42687
42759
  try {
42688
- fs86.unlinkSync(file);
42760
+ fs87.unlinkSync(file);
42689
42761
  } catch {
42690
42762
  }
42691
42763
  });
@@ -42775,11 +42847,11 @@ function previewMcpServer(bridge) {
42775
42847
  };
42776
42848
  }
42777
42849
  function httpCall(baseUrl, token) {
42778
- return async (path116, method, body, timeoutMs) => {
42850
+ return async (path117, method, body, timeoutMs) => {
42779
42851
  const ac = new AbortController();
42780
42852
  const timer = setTimeout(() => ac.abort(), timeoutMs);
42781
42853
  try {
42782
- const res = await fetch(`${baseUrl}${path116}`, {
42854
+ const res = await fetch(`${baseUrl}${path117}`, {
42783
42855
  method,
42784
42856
  headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
42785
42857
  ...method === "POST" ? { body: JSON.stringify(body ?? {}) } : {},
@@ -42916,11 +42988,11 @@ function scratchMcpServer(bridge) {
42916
42988
  };
42917
42989
  }
42918
42990
  function httpCall2(baseUrl, token) {
42919
- return async (path116, method, body, timeoutMs) => {
42991
+ return async (path117, method, body, timeoutMs) => {
42920
42992
  const ac = new AbortController();
42921
42993
  const timer = setTimeout(() => ac.abort(), timeoutMs);
42922
42994
  try {
42923
- const res = await fetch(`${baseUrl}${path116}`, {
42995
+ const res = await fetch(`${baseUrl}${path117}`, {
42924
42996
  method,
42925
42997
  headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
42926
42998
  ...method === "POST" ? { body: JSON.stringify(body ?? {}) } : {},
@@ -46029,17 +46101,17 @@ async function runAcpSession(opts) {
46029
46101
  switchCredentialEnv = provisionAgentCredentials(agentId, auth);
46030
46102
  },
46031
46103
  provisionHouseProxy: ({ baseUrl, token, model, managedAgentId }) => {
46032
- const claudeConfigDir2 = path98.join(
46033
- os61.homedir(),
46104
+ const claudeConfigDir2 = path99.join(
46105
+ os62.homedir(),
46034
46106
  ".codeam",
46035
46107
  "house-claude",
46036
46108
  `switch-${opts.pluginId}`
46037
46109
  );
46038
46110
  try {
46039
- fs89.mkdirSync(claudeConfigDir2, { recursive: true, mode: 448 });
46111
+ fs90.mkdirSync(claudeConfigDir2, { recursive: true, mode: 448 });
46040
46112
  } catch {
46041
46113
  }
46042
- const memoryFile = path98.join(claudeConfigDir2, "CLAUDE.md");
46114
+ const memoryFile = path99.join(claudeConfigDir2, "CLAUDE.md");
46043
46115
  ensureBeadsWorkflowHint(void 0, memoryFile);
46044
46116
  ensureAgentStandard(void 0, memoryFile);
46045
46117
  if (isScratchWorkspace(process.cwd())) ensureScratchWorkflowHint(void 0, memoryFile);
@@ -47279,9 +47351,9 @@ function pickPinnedSession(pinnedId, listSessions2) {
47279
47351
  }
47280
47352
 
47281
47353
  // src/agents/retired-proxy-cleanup.ts
47282
- var fs90 = __toESM(require("fs"));
47283
- var path99 = __toESM(require("path"));
47284
- var os62 = __toESM(require("os"));
47354
+ var fs91 = __toESM(require("fs"));
47355
+ var path100 = __toESM(require("path"));
47356
+ var os63 = __toESM(require("os"));
47285
47357
  var RETIRED_PROXY_RE = /^https?:\/\/(?:127\.0\.0\.1|localhost|\[::1\]):8787(?:[/?#]|$)/i;
47286
47358
  var HEADROOM_CMD_RE = /(^|[\s/"'])headroom(\s|$)/i;
47287
47359
  var MARKETPLACE_KEY = "headroom-marketplace";
@@ -47290,12 +47362,12 @@ function isHeadroomHook(group) {
47290
47362
  (h) => typeof h?.command === "string" && HEADROOM_CMD_RE.test(h.command)
47291
47363
  );
47292
47364
  }
47293
- function sanitizeRetiredProxyConfig(homeDir2 = os62.homedir()) {
47365
+ function sanitizeRetiredProxyConfig(homeDir2 = os63.homedir()) {
47294
47366
  const out2 = { inspected: false, changed: false, removed: [] };
47295
- const file = path99.join(homeDir2, ".claude", "settings.json");
47367
+ const file = path100.join(homeDir2, ".claude", "settings.json");
47296
47368
  let parsed;
47297
47369
  try {
47298
- parsed = JSON.parse(fs90.readFileSync(file, "utf8"));
47370
+ parsed = JSON.parse(fs91.readFileSync(file, "utf8"));
47299
47371
  } catch {
47300
47372
  return out2;
47301
47373
  }
@@ -47337,9 +47409,9 @@ function sanitizeRetiredProxyConfig(homeDir2 = os62.homedir()) {
47337
47409
  if (!out2.changed) return out2;
47338
47410
  try {
47339
47411
  const tmp = `${file}.codeam.tmp`;
47340
- fs90.writeFileSync(tmp, `${JSON.stringify(parsed, null, 2)}
47412
+ fs91.writeFileSync(tmp, `${JSON.stringify(parsed, null, 2)}
47341
47413
  `, { mode: 384 });
47342
- fs90.renameSync(tmp, file);
47414
+ fs91.renameSync(tmp, file);
47343
47415
  } catch {
47344
47416
  out2.changed = false;
47345
47417
  }
@@ -47885,7 +47957,7 @@ var AcpDriver = class {
47885
47957
  };
47886
47958
 
47887
47959
  // src/baton/transcript-mirror.ts
47888
- var fs91 = __toESM(require("fs"));
47960
+ var fs92 = __toESM(require("fs"));
47889
47961
  var TranscriptMirror = class {
47890
47962
  constructor(deps) {
47891
47963
  this.deps = deps;
@@ -47979,7 +48051,7 @@ var TranscriptMirror = class {
47979
48051
  }
47980
48052
  };
47981
48053
  function defaultWatch(file, onChange) {
47982
- const w3 = fs91.watch(file, { persistent: false }, () => onChange());
48054
+ const w3 = fs92.watch(file, { persistent: false }, () => onChange());
47983
48055
  return () => w3.close();
47984
48056
  }
47985
48057
 
@@ -48479,16 +48551,16 @@ function keepDeviceAwake(deps = {}) {
48479
48551
  }
48480
48552
 
48481
48553
  // src/agents/claude/onboarding.ts
48482
- var fs92 = __toESM(require("fs"));
48483
- var os64 = __toESM(require("os"));
48484
- var path100 = __toESM(require("path"));
48554
+ var fs93 = __toESM(require("fs"));
48555
+ var os65 = __toESM(require("os"));
48556
+ var path101 = __toESM(require("path"));
48485
48557
  var ONBOARDING_VERSION_SENTINEL = "9999.0.0";
48486
48558
  function ensureClaudeOnboarded(cwd) {
48487
48559
  try {
48488
- const file = path100.join(os64.homedir(), ".claude.json");
48560
+ const file = path101.join(os65.homedir(), ".claude.json");
48489
48561
  let config = {};
48490
48562
  try {
48491
- config = JSON.parse(fs92.readFileSync(file, "utf8"));
48563
+ config = JSON.parse(fs93.readFileSync(file, "utf8"));
48492
48564
  } catch {
48493
48565
  }
48494
48566
  let changed = false;
@@ -48513,8 +48585,8 @@ function ensureClaudeOnboarded(cwd) {
48513
48585
  }
48514
48586
  }
48515
48587
  if (!changed) return;
48516
- fs92.mkdirSync(path100.dirname(file), { recursive: true });
48517
- fs92.writeFileSync(file, JSON.stringify(config, null, 2));
48588
+ fs93.mkdirSync(path101.dirname(file), { recursive: true });
48589
+ fs93.writeFileSync(file, JSON.stringify(config, null, 2));
48518
48590
  log.info(
48519
48591
  "claude",
48520
48592
  `pre-completed Claude onboarding${cwd ? ` + trusted workspace ${cwd}` : ""}`
@@ -49386,7 +49458,7 @@ var import_picocolors10 = __toESM(require("picocolors"));
49386
49458
  var import_child_process30 = require("child_process");
49387
49459
  var import_util4 = require("util");
49388
49460
  var import_picocolors8 = __toESM(require("picocolors"));
49389
- var path101 = __toESM(require("path"));
49461
+ var path102 = __toESM(require("path"));
49390
49462
  var execFileP6 = (0, import_util4.promisify)(import_child_process30.execFile);
49391
49463
  var MAX_BUFFER = 8 * 1024 * 1024;
49392
49464
  function resetStdinForChild() {
@@ -49875,7 +49947,7 @@ var GitHubCodespacesProvider = class {
49875
49947
  });
49876
49948
  }
49877
49949
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
49878
- const remoteDir = path101.posix.dirname(remotePath);
49950
+ const remoteDir = path102.posix.dirname(remotePath);
49879
49951
  const parts = [
49880
49952
  `mkdir -p ${shellQuote(remoteDir)}`,
49881
49953
  `cat > ${shellQuote(remotePath)}`
@@ -49945,7 +50017,7 @@ function shellQuote(s) {
49945
50017
  // src/services/providers/gitpod.ts
49946
50018
  var import_child_process31 = require("child_process");
49947
50019
  var import_util5 = require("util");
49948
- var path102 = __toESM(require("path"));
50020
+ var path103 = __toESM(require("path"));
49949
50021
  var import_picocolors9 = __toESM(require("picocolors"));
49950
50022
  var execFileP7 = (0, import_util5.promisify)(import_child_process31.execFile);
49951
50023
  var MAX_BUFFER2 = 8 * 1024 * 1024;
@@ -50185,7 +50257,7 @@ var GitpodProvider = class {
50185
50257
  });
50186
50258
  }
50187
50259
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
50188
- const remoteDir = path102.posix.dirname(remotePath);
50260
+ const remoteDir = path103.posix.dirname(remotePath);
50189
50261
  const parts = [
50190
50262
  `mkdir -p ${shellQuote2(remoteDir)}`,
50191
50263
  `cat > ${shellQuote2(remotePath)}`
@@ -50221,7 +50293,7 @@ function shellQuote2(s) {
50221
50293
  // src/services/providers/gitlab-workspaces.ts
50222
50294
  var import_child_process32 = require("child_process");
50223
50295
  var import_util6 = require("util");
50224
- var path103 = __toESM(require("path"));
50296
+ var path104 = __toESM(require("path"));
50225
50297
  var execFileP8 = (0, import_util6.promisify)(import_child_process32.execFile);
50226
50298
  var MAX_BUFFER3 = 8 * 1024 * 1024;
50227
50299
  var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
@@ -50481,7 +50553,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
50481
50553
  }
50482
50554
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
50483
50555
  const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
50484
- const remoteDir = path103.posix.dirname(remotePath);
50556
+ const remoteDir = path104.posix.dirname(remotePath);
50485
50557
  const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
50486
50558
  if (options.mode != null) {
50487
50559
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
@@ -50549,7 +50621,7 @@ function shellQuote3(s) {
50549
50621
  // src/services/providers/railway.ts
50550
50622
  var import_child_process33 = require("child_process");
50551
50623
  var import_util7 = require("util");
50552
- var path104 = __toESM(require("path"));
50624
+ var path105 = __toESM(require("path"));
50553
50625
  var execFileP9 = (0, import_util7.promisify)(import_child_process33.execFile);
50554
50626
  var MAX_BUFFER4 = 8 * 1024 * 1024;
50555
50627
  function resetStdinForChild4() {
@@ -50785,7 +50857,7 @@ var RailwayProvider = class {
50785
50857
  if (!projectId || !serviceId) {
50786
50858
  throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
50787
50859
  }
50788
- const remoteDir = path104.posix.dirname(remotePath);
50860
+ const remoteDir = path105.posix.dirname(remotePath);
50789
50861
  const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
50790
50862
  if (options.mode != null) {
50791
50863
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
@@ -51325,14 +51397,14 @@ async function stopWorkspaceFromLocal(target) {
51325
51397
  }
51326
51398
 
51327
51399
  // src/commands/host/host-client.ts
51328
- var fs93 = __toESM(require("fs"));
51329
- var os65 = __toESM(require("os"));
51330
- var path105 = __toESM(require("path"));
51400
+ var fs94 = __toESM(require("fs"));
51401
+ var os66 = __toESM(require("os"));
51402
+ var path106 = __toESM(require("path"));
51331
51403
  var import_node_crypto16 = require("crypto");
51332
51404
  function sampleCpuTimes() {
51333
51405
  let idle = 0;
51334
51406
  let total = 0;
51335
- for (const cpu of os65.cpus()) {
51407
+ for (const cpu of os66.cpus()) {
51336
51408
  const t2 = cpu.times;
51337
51409
  idle += t2.idle;
51338
51410
  total += t2.user + t2.nice + t2.sys + t2.idle + t2.irq;
@@ -51352,8 +51424,8 @@ var MetricsCollector = class {
51352
51424
  const prev = this.prevCpu;
51353
51425
  this.prevCpu = current2;
51354
51426
  if (!prev) {
51355
- const cores = os65.cpus().length || 1;
51356
- const proxy = os65.loadavg()[0] / cores * 100;
51427
+ const cores = os66.cpus().length || 1;
51428
+ const proxy = os66.loadavg()[0] / cores * 100;
51357
51429
  return Math.min(100, Math.max(0, Math.round(proxy)));
51358
51430
  }
51359
51431
  const idleDelta = current2.idle - prev.idle;
@@ -51366,8 +51438,8 @@ var MetricsCollector = class {
51366
51438
  collect() {
51367
51439
  return {
51368
51440
  cpuPct: this.cpuPct(),
51369
- ramUsedMb: Math.round((os65.totalmem() - os65.freemem()) / 1048576),
51370
- ramTotalMb: Math.round(os65.totalmem() / 1048576),
51441
+ ramUsedMb: Math.round((os66.totalmem() - os66.freemem()) / 1048576),
51442
+ ramTotalMb: Math.round(os66.totalmem() / 1048576),
51371
51443
  latencyMs: this.lastLatencyMs
51372
51444
  };
51373
51445
  }
@@ -51379,19 +51451,19 @@ function apiBase() {
51379
51451
  return process.env.CODEAM_API_URL ?? resolveApiBaseUrl();
51380
51452
  }
51381
51453
  function hostIdentityPath() {
51382
- return path105.join(os65.homedir(), ".codeam", "host-agent.json");
51454
+ return path106.join(os66.homedir(), ".codeam", "host-agent.json");
51383
51455
  }
51384
51456
  function collectOsInfo() {
51385
51457
  return {
51386
- distro: os65.platform(),
51387
- arch: os65.arch(),
51388
- kernel: os65.release(),
51458
+ distro: os66.platform(),
51459
+ arch: os66.arch(),
51460
+ kernel: os66.release(),
51389
51461
  nodeVersion: process.versions.node
51390
51462
  };
51391
51463
  }
51392
51464
  function loadHostIdentity() {
51393
51465
  try {
51394
- const raw = fs93.readFileSync(hostIdentityPath(), "utf8");
51466
+ const raw = fs94.readFileSync(hostIdentityPath(), "utf8");
51395
51467
  const parsed = JSON.parse(raw);
51396
51468
  if (typeof parsed === "object" && parsed !== null && typeof parsed.hostId === "string" && typeof parsed.hostToken === "string" && typeof parsed.controlPluginId === "string") {
51397
51469
  const p2 = parsed;
@@ -51420,8 +51492,8 @@ function ensureControlPollSecret(identity, save = saveHostIdentity) {
51420
51492
  }
51421
51493
  function saveHostIdentity(identity) {
51422
51494
  const file = hostIdentityPath();
51423
- fs93.mkdirSync(path105.dirname(file), { recursive: true, mode: 448 });
51424
- fs93.writeFileSync(file, JSON.stringify(identity, null, 2), {
51495
+ fs94.mkdirSync(path106.dirname(file), { recursive: true, mode: 448 });
51496
+ fs94.writeFileSync(file, JSON.stringify(identity, null, 2), {
51425
51497
  encoding: "utf8",
51426
51498
  mode: 384
51427
51499
  });
@@ -51466,7 +51538,7 @@ function isTerminalEnrollError(err) {
51466
51538
  }
51467
51539
  function deleteHostIdentity() {
51468
51540
  try {
51469
- fs93.rmSync(hostIdentityPath(), { force: true });
51541
+ fs94.rmSync(hostIdentityPath(), { force: true });
51470
51542
  } catch {
51471
51543
  }
51472
51544
  }
@@ -51490,7 +51562,7 @@ async function postJson(pathname, body) {
51490
51562
  function resolveHostLabel(label) {
51491
51563
  const explicit = label?.trim();
51492
51564
  const envLabel = process.env.CODEAM_HOST_LABEL?.trim();
51493
- const resolved = explicit || envLabel || os65.hostname();
51565
+ const resolved = explicit || envLabel || os66.hostname();
51494
51566
  return resolved.slice(0, 80);
51495
51567
  }
51496
51568
  async function redeemEnrollToken(token, label) {
@@ -51694,9 +51766,9 @@ async function host(args2) {
51694
51766
 
51695
51767
  // src/commands/host-agent.ts
51696
51768
  var import_node_child_process38 = require("child_process");
51697
- var os71 = __toESM(require("os"));
51698
- var fs100 = __toESM(require("fs"));
51699
- var path112 = __toESM(require("path"));
51769
+ var os72 = __toESM(require("os"));
51770
+ var fs101 = __toESM(require("fs"));
51771
+ var path113 = __toESM(require("path"));
51700
51772
 
51701
51773
  // src/skills/persist-from-payload.ts
51702
51774
  function persistOrClearSkillsFromPayload(skills) {
@@ -51705,13 +51777,13 @@ function persistOrClearSkillsFromPayload(skills) {
51705
51777
  }
51706
51778
 
51707
51779
  // src/commands/host/session-state.ts
51708
- var fs94 = __toESM(require("fs"));
51709
- var os66 = __toESM(require("os"));
51710
- var path106 = __toESM(require("path"));
51780
+ var fs95 = __toESM(require("fs"));
51781
+ var os67 = __toESM(require("os"));
51782
+ var path107 = __toESM(require("path"));
51711
51783
  function hostSessionStatePath(env = process.env) {
51712
51784
  const override = env.CODEAM_HOST_SESSION_STATE_FILE;
51713
51785
  if (override && override.trim()) return override.trim();
51714
- return path106.join(os66.homedir(), ".codeam", "host-agent-sessions.json");
51786
+ return path107.join(os67.homedir(), ".codeam", "host-agent-sessions.json");
51715
51787
  }
51716
51788
  function isRecord5(v) {
51717
51789
  if (typeof v !== "object" || v === null) return false;
@@ -51722,7 +51794,7 @@ function fileSessionChildStore(file = hostSessionStatePath()) {
51722
51794
  return {
51723
51795
  load() {
51724
51796
  try {
51725
- const raw = JSON.parse(fs94.readFileSync(file, "utf8"));
51797
+ const raw = JSON.parse(fs95.readFileSync(file, "utf8"));
51726
51798
  return Array.isArray(raw?.sessions) ? raw.sessions.filter(isRecord5) : null;
51727
51799
  } catch {
51728
51800
  return null;
@@ -51730,18 +51802,18 @@ function fileSessionChildStore(file = hostSessionStatePath()) {
51730
51802
  },
51731
51803
  save(list) {
51732
51804
  try {
51733
- fs94.mkdirSync(path106.dirname(file), { recursive: true, mode: 448 });
51805
+ fs95.mkdirSync(path107.dirname(file), { recursive: true, mode: 448 });
51734
51806
  const tmp = `${file}.${process.pid}.tmp`;
51735
- fs94.writeFileSync(tmp, JSON.stringify({ version: 1, sessions: list }, null, 2), {
51807
+ fs95.writeFileSync(tmp, JSON.stringify({ version: 1, sessions: list }, null, 2), {
51736
51808
  mode: 384
51737
51809
  });
51738
- fs94.renameSync(tmp, file);
51810
+ fs95.renameSync(tmp, file);
51739
51811
  } catch {
51740
51812
  }
51741
51813
  },
51742
51814
  clear() {
51743
51815
  try {
51744
- fs94.rmSync(file, { force: true });
51816
+ fs95.rmSync(file, { force: true });
51745
51817
  } catch {
51746
51818
  }
51747
51819
  }
@@ -51764,10 +51836,10 @@ function planSessionResume(records, max) {
51764
51836
  return { resume: ordered.slice(0, bound), dropped: ordered.slice(bound) };
51765
51837
  }
51766
51838
  function pickSavedSessionForWorkspace(sessions3, cwd, deployId) {
51767
- const target = path106.resolve(cwd);
51839
+ const target = path107.resolve(cwd);
51768
51840
  const reconnectable = (s) => !!s.pluginId && !!s.pollSecret && !!s.agent;
51769
51841
  const matches = sessions3.filter(
51770
- (s) => !!s.cwd && path106.resolve(s.cwd) === target && reconnectable(s)
51842
+ (s) => !!s.cwd && path107.resolve(s.cwd) === target && reconnectable(s)
51771
51843
  );
51772
51844
  if (matches.length > 0) {
51773
51845
  matches.sort((a, b) => b.pairedAt - a.pairedAt);
@@ -51779,11 +51851,11 @@ function pickSavedSessionForWorkspace(sessions3, cwd, deployId) {
51779
51851
 
51780
51852
  // src/commands/host/git-tooling.ts
51781
51853
  var import_node_child_process32 = require("child_process");
51782
- var fs95 = __toESM(require("fs"));
51783
- var os67 = __toESM(require("os"));
51784
- var path107 = __toESM(require("path"));
51854
+ var fs96 = __toESM(require("fs"));
51855
+ var os68 = __toESM(require("os"));
51856
+ var path108 = __toESM(require("path"));
51785
51857
  function codeamBinDir() {
51786
- return process.env.CODEAM_BIN_DIR ?? path107.join(os67.homedir(), ".codeam", "bin");
51858
+ return process.env.CODEAM_BIN_DIR ?? path108.join(os68.homedir(), ".codeam", "bin");
51787
51859
  }
51788
51860
  var FALLBACK_GH_VERSION = "2.62.0";
51789
51861
  var RELEASE_API = "https://api.github.com/repos/cli/cli/releases/latest";
@@ -51815,7 +51887,7 @@ async function download(url2, dest) {
51815
51887
  const res = await fetch(url2, { headers: { "User-Agent": "codeam-cli" } });
51816
51888
  if (!res.ok || !res.body) return false;
51817
51889
  const buf = Buffer.from(await res.arrayBuffer());
51818
- fs95.writeFileSync(dest, buf);
51890
+ fs96.writeFileSync(dest, buf);
51819
51891
  return true;
51820
51892
  } catch {
51821
51893
  return false;
@@ -51838,8 +51910,8 @@ async function ensureGhCli(runner, token, deps = {}) {
51838
51910
  const version3 = await resolveVersionFn(token);
51839
51911
  const asset = `gh_${version3}_${osToken}_${arch2}`;
51840
51912
  const url2 = `https://github.com/cli/cli/releases/download/v${version3}/${asset}.${ext}`;
51841
- const tmpRoot = fs95.mkdtempSync(path107.join(os67.tmpdir(), "codeam-gh-"));
51842
- const archive = path107.join(tmpRoot, `${asset}.${ext}`);
51913
+ const tmpRoot = fs96.mkdtempSync(path108.join(os68.tmpdir(), "codeam-gh-"));
51914
+ const archive = path108.join(tmpRoot, `${asset}.${ext}`);
51843
51915
  if (!await downloadFn(url2, archive)) {
51844
51916
  log.warn("host-agent", "gh download failed \u2014 skipping (git pull/push still work via the credential helper)");
51845
51917
  return null;
@@ -51849,16 +51921,16 @@ async function ensureGhCli(runner, token, deps = {}) {
51849
51921
  log.warn("host-agent", `gh archive extraction failed (code=${String(extract.code)}) \u2014 skipping`);
51850
51922
  return null;
51851
51923
  }
51852
- const extractedBin = path107.join(tmpRoot, asset, "bin", binaryName);
51853
- if (!fs95.existsSync(extractedBin)) {
51924
+ const extractedBin = path108.join(tmpRoot, asset, "bin", binaryName);
51925
+ if (!fs96.existsSync(extractedBin)) {
51854
51926
  log.warn("host-agent", "gh binary not found in the extracted archive \u2014 skipping");
51855
51927
  return null;
51856
51928
  }
51857
51929
  const binDir = codeamBinDir();
51858
- fs95.mkdirSync(binDir, { recursive: true });
51859
- const target = path107.join(binDir, binaryName);
51860
- fs95.copyFileSync(extractedBin, target);
51861
- fs95.chmodSync(target, 493);
51930
+ fs96.mkdirSync(binDir, { recursive: true });
51931
+ const target = path108.join(binDir, binaryName);
51932
+ fs96.copyFileSync(extractedBin, target);
51933
+ fs96.chmodSync(target, 493);
51862
51934
  log.info("host-agent", `gh installed to ${target} (v${version3})`);
51863
51935
  return target;
51864
51936
  } catch (e) {
@@ -51895,19 +51967,19 @@ async function ensureGhAuth(runner, ghCmd, token) {
51895
51967
  }
51896
51968
  function ghConfigDir() {
51897
51969
  if (process.env.GH_CONFIG_DIR) return process.env.GH_CONFIG_DIR;
51898
- if (process.env.XDG_CONFIG_HOME) return path107.join(process.env.XDG_CONFIG_HOME, "gh");
51970
+ if (process.env.XDG_CONFIG_HOME) return path108.join(process.env.XDG_CONFIG_HOME, "gh");
51899
51971
  if (process.platform === "win32" && process.env.APPDATA) {
51900
- return path107.join(process.env.APPDATA, "GitHub CLI");
51972
+ return path108.join(process.env.APPDATA, "GitHub CLI");
51901
51973
  }
51902
- return path107.join(os67.homedir(), ".config", "gh");
51974
+ return path108.join(os68.homedir(), ".config", "gh");
51903
51975
  }
51904
51976
  function writeGhHostsToken(token) {
51905
51977
  try {
51906
51978
  const dir = ghConfigDir();
51907
- const file = path107.join(dir, "hosts.yml");
51908
- if (fs95.existsSync(file)) return false;
51909
- fs95.mkdirSync(dir, { recursive: true, mode: 448 });
51910
- fs95.writeFileSync(
51979
+ const file = path108.join(dir, "hosts.yml");
51980
+ if (fs96.existsSync(file)) return false;
51981
+ fs96.mkdirSync(dir, { recursive: true, mode: 448 });
51982
+ fs96.writeFileSync(
51911
51983
  file,
51912
51984
  `github.com:
51913
51985
  oauth_token: ${token}
@@ -51950,8 +52022,8 @@ async function ensureGlabCli(runner, deps = {}) {
51950
52022
  const version3 = await resolveLatestGlabVersion();
51951
52023
  const asset = `glab_${version3}_${osToken}_${arch2}`;
51952
52024
  const url2 = `https://gitlab.com/gitlab-org/cli/-/releases/v${version3}/downloads/${asset}.${ext}`;
51953
- const tmpRoot = fs95.mkdtempSync(path107.join(os67.tmpdir(), "codeam-glab-"));
51954
- const archive = path107.join(tmpRoot, `${asset}.${ext}`);
52025
+ const tmpRoot = fs96.mkdtempSync(path108.join(os68.tmpdir(), "codeam-glab-"));
52026
+ const archive = path108.join(tmpRoot, `${asset}.${ext}`);
51955
52027
  if (!await downloadFn(url2, archive)) {
51956
52028
  log.warn("host-agent", "glab download failed \u2014 skipping (git push/pull still work)");
51957
52029
  return null;
@@ -51962,20 +52034,20 @@ async function ensureGlabCli(runner, deps = {}) {
51962
52034
  return null;
51963
52035
  }
51964
52036
  const candidates = [
51965
- path107.join(tmpRoot, "bin", binaryName),
51966
- path107.join(tmpRoot, asset, "bin", binaryName),
51967
- path107.join(tmpRoot, binaryName)
52037
+ path108.join(tmpRoot, "bin", binaryName),
52038
+ path108.join(tmpRoot, asset, "bin", binaryName),
52039
+ path108.join(tmpRoot, binaryName)
51968
52040
  ];
51969
- const extractedBin = candidates.find((c2) => fs95.existsSync(c2));
52041
+ const extractedBin = candidates.find((c2) => fs96.existsSync(c2));
51970
52042
  if (!extractedBin) {
51971
52043
  log.warn("host-agent", "glab binary not found in the extracted archive \u2014 skipping");
51972
52044
  return null;
51973
52045
  }
51974
52046
  const binDir = codeamBinDir();
51975
- fs95.mkdirSync(binDir, { recursive: true });
51976
- const target = path107.join(binDir, binaryName);
51977
- fs95.copyFileSync(extractedBin, target);
51978
- fs95.chmodSync(target, 493);
52047
+ fs96.mkdirSync(binDir, { recursive: true });
52048
+ const target = path108.join(binDir, binaryName);
52049
+ fs96.copyFileSync(extractedBin, target);
52050
+ fs96.chmodSync(target, 493);
51979
52051
  log.info("host-agent", `glab installed to ${target} (v${version3})`);
51980
52052
  return target;
51981
52053
  } catch (e) {
@@ -52054,14 +52126,14 @@ var defaultGitToolingRunner = {
52054
52126
  };
52055
52127
 
52056
52128
  // src/lib/cli-versions.ts
52129
+ var fs98 = __toESM(require("fs"));
52130
+ var os70 = __toESM(require("os"));
52131
+ var path110 = __toESM(require("path"));
52132
+
52133
+ // src/lib/updateNotifier.ts
52057
52134
  var fs97 = __toESM(require("fs"));
52058
52135
  var os69 = __toESM(require("os"));
52059
52136
  var path109 = __toESM(require("path"));
52060
-
52061
- // src/lib/updateNotifier.ts
52062
- var fs96 = __toESM(require("fs"));
52063
- var os68 = __toESM(require("os"));
52064
- var path108 = __toESM(require("path"));
52065
52137
  var https8 = __toESM(require("https"));
52066
52138
  var import_node_child_process33 = require("child_process");
52067
52139
  var import_picocolors12 = __toESM(require("picocolors"));
@@ -52070,12 +52142,12 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
52070
52142
  var TTL_MS = 24 * 60 * 60 * 1e3;
52071
52143
  var REQUEST_TIMEOUT_MS = 1500;
52072
52144
  function cachePath() {
52073
- const dir = path108.join(os68.homedir(), ".codeam");
52074
- return path108.join(dir, "update-check.json");
52145
+ const dir = path109.join(os69.homedir(), ".codeam");
52146
+ return path109.join(dir, "update-check.json");
52075
52147
  }
52076
52148
  function readCache() {
52077
52149
  try {
52078
- const raw = fs96.readFileSync(cachePath(), "utf8");
52150
+ const raw = fs97.readFileSync(cachePath(), "utf8");
52079
52151
  const parsed = JSON.parse(raw);
52080
52152
  if (typeof parsed.fetchedAt !== "number" || typeof parsed.latest !== "string") return null;
52081
52153
  return parsed;
@@ -52086,10 +52158,10 @@ function readCache() {
52086
52158
  function writeCache(cache) {
52087
52159
  try {
52088
52160
  const file = cachePath();
52089
- fs96.mkdirSync(path108.dirname(file), { recursive: true });
52161
+ fs97.mkdirSync(path109.dirname(file), { recursive: true });
52090
52162
  const tmp = `${file}.${process.pid}.tmp`;
52091
- fs96.writeFileSync(tmp, JSON.stringify(cache));
52092
- fs96.renameSync(tmp, file);
52163
+ fs97.writeFileSync(tmp, JSON.stringify(cache));
52164
+ fs97.renameSync(tmp, file);
52093
52165
  } catch {
52094
52166
  }
52095
52167
  }
@@ -52163,8 +52235,8 @@ function isLinkedInstall() {
52163
52235
  timeout: 2e3
52164
52236
  }).trim();
52165
52237
  if (!root) return false;
52166
- const pkgPath = path108.join(root, PKG_NAME);
52167
- return fs96.lstatSync(pkgPath).isSymbolicLink();
52238
+ const pkgPath = path109.join(root, PKG_NAME);
52239
+ return fs97.lstatSync(pkgPath).isSymbolicLink();
52168
52240
  } catch {
52169
52241
  return false;
52170
52242
  }
@@ -52200,7 +52272,7 @@ function maybeAutoUpdate(currentVersion, latest) {
52200
52272
  return;
52201
52273
  }
52202
52274
  try {
52203
- fs96.unlinkSync(cachePath());
52275
+ fs97.unlinkSync(cachePath());
52204
52276
  } catch {
52205
52277
  }
52206
52278
  process.stderr.write(` ${import_picocolors12.default.green("\u2713")} Updated. Resuming session...
@@ -52216,7 +52288,7 @@ async function autoUpgradeBeforeCriticalCommand() {
52216
52288
  if (process.env.NODE_ENV === "test") return;
52217
52289
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
52218
52290
  if (process.env.CI) return;
52219
- const current2 = true ? "2.76.42" : null;
52291
+ const current2 = true ? "2.76.43" : null;
52220
52292
  if (!current2) return;
52221
52293
  const cache = readCache();
52222
52294
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -52233,7 +52305,7 @@ function checkForUpdates() {
52233
52305
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
52234
52306
  if (process.env.CI) return;
52235
52307
  if (!process.stdout.isTTY) return;
52236
- const current2 = true ? "2.76.42" : null;
52308
+ const current2 = true ? "2.76.43" : null;
52237
52309
  if (!current2) return;
52238
52310
  const cache = readCache();
52239
52311
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -52256,10 +52328,10 @@ function versionedModeSupported(platform3 = process.platform) {
52256
52328
  return platform3 !== "win32";
52257
52329
  }
52258
52330
  function cliVersionsRoot(env = process.env) {
52259
- return env.CODEAM_CLI_VERSIONS_DIR || path109.join(os69.homedir(), ".codeam", "cli");
52331
+ return env.CODEAM_CLI_VERSIONS_DIR || path110.join(os70.homedir(), ".codeam", "cli");
52260
52332
  }
52261
52333
  function packageDirOf(versionDir) {
52262
- return path109.join(versionDir, "node_modules", CLI_PKG);
52334
+ return path110.join(versionDir, "node_modules", CLI_PKG);
52263
52335
  }
52264
52336
  function isRecord6(v) {
52265
52337
  return typeof v === "object" && v !== null;
@@ -52267,7 +52339,7 @@ function isRecord6(v) {
52267
52339
  function readPkg2(versionDir) {
52268
52340
  try {
52269
52341
  const raw = JSON.parse(
52270
- fs97.readFileSync(path109.join(packageDirOf(versionDir), "package.json"), "utf8")
52342
+ fs98.readFileSync(path110.join(packageDirOf(versionDir), "package.json"), "utf8")
52271
52343
  );
52272
52344
  return isRecord6(raw) ? raw : null;
52273
52345
  } catch {
@@ -52280,15 +52352,15 @@ function entryOf(versionDir) {
52280
52352
  const bin = pkg.bin;
52281
52353
  const named = isRecord6(bin) ? bin.codeam : void 0;
52282
52354
  const rel = typeof bin === "string" ? bin : typeof named === "string" ? named : "dist/index.js";
52283
- const entry = path109.join(packageDirOf(versionDir), rel);
52284
- return fs97.existsSync(entry) ? entry : null;
52355
+ const entry = path110.join(packageDirOf(versionDir), rel);
52356
+ return fs98.existsSync(entry) ? entry : null;
52285
52357
  }
52286
52358
  function launcherOf(versionDir) {
52287
52359
  const entry = entryOf(versionDir);
52288
52360
  if (!entry) return null;
52289
- const bin = path109.join(versionDir, "node_modules", ".bin", "codeam");
52361
+ const bin = path110.join(versionDir, "node_modules", ".bin", "codeam");
52290
52362
  try {
52291
- return fs97.realpathSync(bin) === fs97.realpathSync(entry) ? bin : entry;
52363
+ return fs98.realpathSync(bin) === fs98.realpathSync(entry) ? bin : entry;
52292
52364
  } catch {
52293
52365
  return entry;
52294
52366
  }
@@ -52301,16 +52373,16 @@ var BAD_MARKER_TTL_MS = 24 * 60 * 6e4;
52301
52373
  var PRE_READY_WINDOW_MS = 60 * 6e4;
52302
52374
  function isBad(versionDir, now = Date.now()) {
52303
52375
  try {
52304
- return now - fs97.statSync(path109.join(versionDir, ".bad")).mtimeMs < BAD_MARKER_TTL_MS;
52376
+ return now - fs98.statSync(path110.join(versionDir, ".bad")).mtimeMs < BAD_MARKER_TTL_MS;
52305
52377
  } catch {
52306
52378
  return false;
52307
52379
  }
52308
52380
  }
52309
52381
  function recordPreReadyFailure(versionDir, now = Date.now()) {
52310
- const file = path109.join(versionDir, ".prefail");
52382
+ const file = path110.join(versionDir, ".prefail");
52311
52383
  let count = 0;
52312
52384
  try {
52313
- const [n, at3] = fs97.readFileSync(file, "utf8").trim().split(" ").map(Number);
52385
+ const [n, at3] = fs98.readFileSync(file, "utf8").trim().split(" ").map(Number);
52314
52386
  if (Number.isFinite(n) && Number.isFinite(at3) && now - at3 < PRE_READY_WINDOW_MS) {
52315
52387
  count = n;
52316
52388
  }
@@ -52318,45 +52390,45 @@ function recordPreReadyFailure(versionDir, now = Date.now()) {
52318
52390
  }
52319
52391
  count += 1;
52320
52392
  try {
52321
- fs97.writeFileSync(file, `${count} ${now}`);
52393
+ fs98.writeFileSync(file, `${count} ${now}`);
52322
52394
  } catch {
52323
52395
  }
52324
52396
  return count;
52325
52397
  }
52326
52398
  function clearPreReadyFailures(versionDir) {
52327
- fs97.rmSync(path109.join(versionDir, ".prefail"), { force: true });
52399
+ fs98.rmSync(path110.join(versionDir, ".prefail"), { force: true });
52328
52400
  }
52329
52401
  function markBad(versionDir, reason) {
52330
52402
  try {
52331
- fs97.writeFileSync(path109.join(versionDir, ".bad"), `${(/* @__PURE__ */ new Date()).toISOString()} ${reason}
52403
+ fs98.writeFileSync(path110.join(versionDir, ".bad"), `${(/* @__PURE__ */ new Date()).toISOString()} ${reason}
52332
52404
  `);
52333
52405
  } catch {
52334
52406
  }
52335
52407
  }
52336
52408
  function pointerTarget(root, name) {
52337
52409
  try {
52338
- return fs97.realpathSync(path109.join(root, name));
52410
+ return fs98.realpathSync(path110.join(root, name));
52339
52411
  } catch {
52340
52412
  return null;
52341
52413
  }
52342
52414
  }
52343
52415
  function atomicPoint(root, name, targetDir) {
52344
- const realRoot = fs97.realpathSync(root);
52345
- const tmp = path109.join(realRoot, `.${name}.tmp-${process.pid}-${Date.now()}`);
52346
- fs97.symlinkSync(path109.relative(realRoot, fs97.realpathSync(targetDir)), tmp, "dir");
52416
+ const realRoot = fs98.realpathSync(root);
52417
+ const tmp = path110.join(realRoot, `.${name}.tmp-${process.pid}-${Date.now()}`);
52418
+ fs98.symlinkSync(path110.relative(realRoot, fs98.realpathSync(targetDir)), tmp, "dir");
52347
52419
  try {
52348
- fs97.renameSync(tmp, path109.join(realRoot, name));
52420
+ fs98.renameSync(tmp, path110.join(realRoot, name));
52349
52421
  } catch (err) {
52350
- fs97.rmSync(tmp, { force: true });
52422
+ fs98.rmSync(tmp, { force: true });
52351
52423
  throw err;
52352
52424
  }
52353
52425
  }
52354
52426
  function samePath(a, b) {
52355
52427
  const canon = (p2) => {
52356
52428
  try {
52357
- return fs97.realpathSync(p2);
52429
+ return fs98.realpathSync(p2);
52358
52430
  } catch {
52359
- return path109.resolve(p2);
52431
+ return path110.resolve(p2);
52360
52432
  }
52361
52433
  };
52362
52434
  return canon(a) === canon(b);
@@ -52391,15 +52463,15 @@ function versionDirContaining(root, file) {
52391
52463
  let real;
52392
52464
  let realRoot;
52393
52465
  try {
52394
- real = fs97.realpathSync(file);
52395
- realRoot = fs97.realpathSync(root);
52466
+ real = fs98.realpathSync(file);
52467
+ realRoot = fs98.realpathSync(root);
52396
52468
  } catch {
52397
52469
  return null;
52398
52470
  }
52399
- const rel = path109.relative(realRoot, real);
52400
- if (rel.startsWith("..") || path109.isAbsolute(rel)) return null;
52401
- const first = rel.split(path109.sep)[0];
52402
- return first && SEMVER_DIR.test(first) ? path109.join(realRoot, first) : null;
52471
+ const rel = path110.relative(realRoot, real);
52472
+ if (rel.startsWith("..") || path110.isAbsolute(rel)) return null;
52473
+ const first = rel.split(path110.sep)[0];
52474
+ return first && SEMVER_DIR.test(first) ? path110.join(realRoot, first) : null;
52403
52475
  }
52404
52476
  function pidAlive3(pid) {
52405
52477
  try {
@@ -52412,9 +52484,9 @@ function pidAlive3(pid) {
52412
52484
  var CLK_TCK = 100;
52413
52485
  function processStartMs(pid) {
52414
52486
  try {
52415
- const stat3 = fs97.readFileSync(`/proc/${pid}/stat`, "utf8");
52487
+ const stat3 = fs98.readFileSync(`/proc/${pid}/stat`, "utf8");
52416
52488
  const ticks = Number(stat3.slice(stat3.lastIndexOf(")") + 2).split(" ")[19]);
52417
- const btime = /^btime (\d+)$/m.exec(fs97.readFileSync("/proc/stat", "utf8"))?.[1];
52489
+ const btime = /^btime (\d+)$/m.exec(fs98.readFileSync("/proc/stat", "utf8"))?.[1];
52418
52490
  if (!Number.isFinite(ticks) || !btime) return null;
52419
52491
  return Number(btime) * 1e3 + ticks * 1e3 / CLK_TCK;
52420
52492
  } catch {
@@ -52423,10 +52495,10 @@ function processStartMs(pid) {
52423
52495
  }
52424
52496
  var PID_REUSE_SLACK_MS = 2e3;
52425
52497
  function livePids(versionDir) {
52426
- const dir = path109.join(versionDir, ".pids");
52498
+ const dir = path110.join(versionDir, ".pids");
52427
52499
  let names;
52428
52500
  try {
52429
- names = fs97.readdirSync(dir);
52501
+ names = fs98.readdirSync(dir);
52430
52502
  } catch {
52431
52503
  return [];
52432
52504
  }
@@ -52435,7 +52507,7 @@ function livePids(versionDir) {
52435
52507
  const started = processStartMs(pid);
52436
52508
  if (started === null) return true;
52437
52509
  try {
52438
- return started <= fs97.statSync(path109.join(dir, String(pid))).mtimeMs + PID_REUSE_SLACK_MS;
52510
+ return started <= fs98.statSync(path110.join(dir, String(pid))).mtimeMs + PID_REUSE_SLACK_MS;
52439
52511
  } catch {
52440
52512
  return true;
52441
52513
  }
@@ -52444,11 +52516,11 @@ function livePids(versionDir) {
52444
52516
  function registerRunningVersion(root = cliVersionsRoot(), entry = process.argv[1]) {
52445
52517
  const dir = versionDirContaining(root, entry);
52446
52518
  if (!dir) return;
52447
- const file = path109.join(dir, ".pids", String(process.pid));
52519
+ const file = path110.join(dir, ".pids", String(process.pid));
52448
52520
  try {
52449
- fs97.mkdirSync(path109.dirname(file), { recursive: true });
52450
- fs97.writeFileSync(file, "");
52451
- process.once("exit", () => fs97.rmSync(file, { force: true }));
52521
+ fs98.mkdirSync(path110.dirname(file), { recursive: true });
52522
+ fs98.writeFileSync(file, "");
52523
+ process.once("exit", () => fs98.rmSync(file, { force: true }));
52452
52524
  } catch {
52453
52525
  }
52454
52526
  }
@@ -52456,7 +52528,7 @@ function gcVersions(root) {
52456
52528
  const removed = [];
52457
52529
  let names;
52458
52530
  try {
52459
- names = fs97.readdirSync(root).filter((n) => SEMVER_DIR.test(n));
52531
+ names = fs98.readdirSync(root).filter((n) => SEMVER_DIR.test(n));
52460
52532
  } catch {
52461
52533
  return removed;
52462
52534
  }
@@ -52464,13 +52536,13 @@ function gcVersions(root) {
52464
52536
  [...names].sort((a, b) => compareSemver(b, a)).slice(0, GC_KEEP_NEWEST)
52465
52537
  );
52466
52538
  for (const p2 of [pointerTarget(root, "current"), pointerTarget(root, "previous")]) {
52467
- if (p2) keep.add(path109.basename(p2));
52539
+ if (p2) keep.add(path110.basename(p2));
52468
52540
  }
52469
52541
  for (const name of names) {
52470
- const dir = path109.join(root, name);
52542
+ const dir = path110.join(root, name);
52471
52543
  if (keep.has(name) || livePids(dir).length > 0) continue;
52472
52544
  try {
52473
- fs97.rmSync(dir, { recursive: true, force: true });
52545
+ fs98.rmSync(dir, { recursive: true, force: true });
52474
52546
  removed.push(name);
52475
52547
  } catch {
52476
52548
  }
@@ -52478,25 +52550,25 @@ function gcVersions(root) {
52478
52550
  return removed;
52479
52551
  }
52480
52552
  function acquireInstallLock(root) {
52481
- const lock = path109.join(root, ".install.lock");
52553
+ const lock = path110.join(root, ".install.lock");
52482
52554
  for (let attempt = 0; attempt < 2; attempt++) {
52483
52555
  try {
52484
- const fd = fs97.openSync(lock, "wx");
52485
- fs97.writeSync(fd, String(process.pid));
52486
- fs97.closeSync(fd);
52487
- return () => fs97.rmSync(lock, { force: true });
52556
+ const fd = fs98.openSync(lock, "wx");
52557
+ fs98.writeSync(fd, String(process.pid));
52558
+ fs98.closeSync(fd);
52559
+ return () => fs98.rmSync(lock, { force: true });
52488
52560
  } catch (err) {
52489
52561
  if (err.code !== "EEXIST") return null;
52490
52562
  let stale = false;
52491
52563
  try {
52492
- const owner = Number(fs97.readFileSync(lock, "utf8"));
52493
- const age = Date.now() - fs97.statSync(lock).mtimeMs;
52564
+ const owner = Number(fs98.readFileSync(lock, "utf8"));
52565
+ const age = Date.now() - fs98.statSync(lock).mtimeMs;
52494
52566
  stale = !Number.isInteger(owner) || !pidAlive3(owner) || age > LOCK_STALE_MS;
52495
52567
  } catch {
52496
52568
  stale = true;
52497
52569
  }
52498
52570
  if (!stale) return null;
52499
- fs97.rmSync(lock, { force: true });
52571
+ fs98.rmSync(lock, { force: true });
52500
52572
  }
52501
52573
  }
52502
52574
  return null;
@@ -52504,9 +52576,9 @@ function acquireInstallLock(root) {
52504
52576
 
52505
52577
  // src/commands/host/host-launch.ts
52506
52578
  var import_node_child_process35 = require("child_process");
52507
- var fs99 = __toESM(require("fs"));
52508
- var os70 = __toESM(require("os"));
52509
- var path111 = __toESM(require("path"));
52579
+ var fs100 = __toESM(require("fs"));
52580
+ var os71 = __toESM(require("os"));
52581
+ var path112 = __toESM(require("path"));
52510
52582
 
52511
52583
  // src/exit-codes.ts
52512
52584
  var EXIT_OK = 0;
@@ -52528,8 +52600,8 @@ var EXIT_CODE_NAMES = {
52528
52600
 
52529
52601
  // src/commands/host/self-update.ts
52530
52602
  var import_node_child_process34 = require("child_process");
52531
- var fs98 = __toESM(require("fs"));
52532
- var path110 = __toESM(require("path"));
52603
+ var fs99 = __toESM(require("fs"));
52604
+ var path111 = __toESM(require("path"));
52533
52605
  var SELF_UPDATE_PKG = "codeam-cli";
52534
52606
  var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
52535
52607
  var SELF_UPDATE_STARTUP_DELAY_MS = 5e3;
@@ -52539,7 +52611,7 @@ var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
52539
52611
  var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
52540
52612
  var SELF_UPDATE_LS_TIMEOUT_MS = 15e3;
52541
52613
  function currentCliVersion() {
52542
- return true ? "2.76.42" : null;
52614
+ return true ? "2.76.43" : null;
52543
52615
  }
52544
52616
  async function installedVersion(deps) {
52545
52617
  const ls = await deps.run(
@@ -52655,9 +52727,9 @@ function collectOldVersions(root) {
52655
52727
  var VERIFY_TIMEOUT_MS = 3e4;
52656
52728
  async function installVersioned(deps, root, latest, running2) {
52657
52729
  const node = deps.nodePath ?? process.execPath;
52658
- const target = path110.join(root, latest);
52730
+ const target = path111.join(root, latest);
52659
52731
  try {
52660
- fs98.mkdirSync(root, { recursive: true });
52732
+ fs99.mkdirSync(root, { recursive: true });
52661
52733
  } catch {
52662
52734
  return { status: "skipped" };
52663
52735
  }
@@ -52681,7 +52753,7 @@ async function installVersioned(deps, root, latest, running2) {
52681
52753
  }
52682
52754
  const reusable = entryOf(target) && versionOf(target) === latest;
52683
52755
  if (!reusable) {
52684
- fs98.rmSync(target, { recursive: true, force: true });
52756
+ fs99.rmSync(target, { recursive: true, force: true });
52685
52757
  const install = await deps.run(
52686
52758
  "npm",
52687
52759
  [
@@ -52696,7 +52768,7 @@ async function installVersioned(deps, root, latest, running2) {
52696
52768
  SELF_UPDATE_INSTALL_TIMEOUT_MS
52697
52769
  );
52698
52770
  if (install.code !== 0) {
52699
- fs98.rmSync(target, { recursive: true, force: true });
52771
+ fs99.rmSync(target, { recursive: true, force: true });
52700
52772
  log.warn(
52701
52773
  "host-agent",
52702
52774
  `self-update: versioned install exited ${String(install.code)} \u2014 staying on ${running2}: ` + install.stderr.slice(-300)
@@ -52707,7 +52779,7 @@ async function installVersioned(deps, root, latest, running2) {
52707
52779
  const entry = entryOf(target);
52708
52780
  const check = entry ? await deps.run(node, [entry, "--version"], VERIFY_TIMEOUT_MS) : { code: null, stdout: "", stderr: "no entry point" };
52709
52781
  if (check.code !== 0 || !check.stdout.includes(latest)) {
52710
- fs98.rmSync(target, { recursive: true, force: true });
52782
+ fs99.rmSync(target, { recursive: true, force: true });
52711
52783
  log.warn(
52712
52784
  "host-agent",
52713
52785
  `self-update: ${latest} failed verification (exit ${String(check.code)}: ${(check.stdout + check.stderr).trim().slice(-200)}) \u2014 staying on ${running2}`
@@ -52723,7 +52795,7 @@ async function installVersioned(deps, root, latest, running2) {
52723
52795
  return { status: "updated", version: latest };
52724
52796
  } catch (err) {
52725
52797
  const cur = pointerTarget(root, "current");
52726
- if (!cur || path110.basename(cur) !== latest) fs98.rmSync(target, { recursive: true, force: true });
52798
+ if (!cur || path111.basename(cur) !== latest) fs99.rmSync(target, { recursive: true, force: true });
52727
52799
  log.warn(
52728
52800
  "host-agent",
52729
52801
  `self-update: versioned install failed: ${err instanceof Error ? err.message : String(err)}`
@@ -52762,7 +52834,7 @@ function signalHostReady(send = process.send?.bind(process)) {
52762
52834
  }
52763
52835
  function defaultDeps() {
52764
52836
  return {
52765
- ownVersion: true ? "2.76.42" : null,
52837
+ ownVersion: true ? "2.76.43" : null,
52766
52838
  root: cliVersionsRoot(),
52767
52839
  args: process.argv.slice(3),
52768
52840
  execPath: process.execPath,
@@ -52859,13 +52931,13 @@ function needsSelfRelaunch(env = process.env, pid = process.pid, ctx = {}) {
52859
52931
  }
52860
52932
  function readPid1Cmdline() {
52861
52933
  try {
52862
- return fs99.readFileSync("/proc/1/cmdline", "utf8").split("\0").filter(Boolean);
52934
+ return fs100.readFileSync("/proc/1/cmdline", "utf8").split("\0").filter(Boolean);
52863
52935
  } catch {
52864
52936
  return [];
52865
52937
  }
52866
52938
  }
52867
52939
  function isOurTiniEntrypoint(argv) {
52868
- return argv.some((a) => path111.basename(a) === "tini") && argv.includes("host-agent");
52940
+ return argv.some((a) => path112.basename(a) === "tini") && argv.includes("host-agent");
52869
52941
  }
52870
52942
  function relaunchArgv(execPath, argv) {
52871
52943
  return ["-c", 'sleep 2; exec "$0" "$@"', execPath, ...argv.slice(1)];
@@ -52907,7 +52979,7 @@ function defaultRestartForUpdate(version3, supervised, io = {}) {
52907
52979
  }
52908
52980
  exit(0);
52909
52981
  }
52910
- function isContainerEnvironment(existsSyncFn = fs99.existsSync, readFileSyncFn = (p2) => fs99.readFileSync(p2, "utf8")) {
52982
+ function isContainerEnvironment(existsSyncFn = fs100.existsSync, readFileSyncFn = (p2) => fs100.readFileSync(p2, "utf8")) {
52911
52983
  try {
52912
52984
  if (existsSyncFn("/.dockerenv")) return true;
52913
52985
  } catch {
@@ -52919,16 +52991,16 @@ function isContainerEnvironment(existsSyncFn = fs99.existsSync, readFileSyncFn =
52919
52991
  }
52920
52992
  return false;
52921
52993
  }
52922
- function hostAgentPidFile(home = os70.homedir()) {
52923
- return path111.join(home, ".codeam", "host-agent.pid");
52994
+ function hostAgentPidFile(home = os71.homedir()) {
52995
+ return path112.join(home, ".codeam", "host-agent.pid");
52924
52996
  }
52925
52997
  function writeHostAgentPidFile(file = hostAgentPidFile(), pid = process.pid) {
52926
52998
  try {
52927
- fs99.mkdirSync(path111.dirname(file), { recursive: true });
52928
- fs99.writeFileSync(file, String(pid));
52999
+ fs100.mkdirSync(path112.dirname(file), { recursive: true });
53000
+ fs100.writeFileSync(file, String(pid));
52929
53001
  process.once("exit", () => {
52930
53002
  try {
52931
- if (fs99.readFileSync(file, "utf8").trim() === String(pid)) fs99.rmSync(file, { force: true });
53003
+ if (fs100.readFileSync(file, "utf8").trim() === String(pid)) fs100.rmSync(file, { force: true });
52932
53004
  } catch {
52933
53005
  }
52934
53006
  });
@@ -53780,13 +53852,13 @@ var HostAgentSupervisor = class {
53780
53852
  const relay = this.relay;
53781
53853
  if (!relay) return;
53782
53854
  const raw = cmd.payload?.path;
53783
- const target = typeof raw === "string" && raw.trim() ? path112.resolve(raw.trim()) : os71.homedir();
53855
+ const target = typeof raw === "string" && raw.trim() ? path113.resolve(raw.trim()) : os72.homedir();
53784
53856
  try {
53785
- const dirents = await fs100.promises.readdir(target, { withFileTypes: true });
53857
+ const dirents = await fs101.promises.readdir(target, { withFileTypes: true });
53786
53858
  const entries2 = dirents.filter((d3) => !d3.name.startsWith(".")).map((d3) => ({ name: d3.name, isDir: d3.isDirectory() })).sort(
53787
53859
  (a, b) => a.isDir === b.isDir ? a.name.localeCompare(b.name) : a.isDir ? -1 : 1
53788
53860
  );
53789
- const parent = path112.dirname(target);
53861
+ const parent = path113.dirname(target);
53790
53862
  await relay.sendResult(cmd.id, "completed", {
53791
53863
  path: target,
53792
53864
  // null at the filesystem root so the UI can hide the ".." affordance.
@@ -54264,14 +54336,14 @@ var HostAgentSupervisor = class {
54264
54336
  }),
54265
54337
  CODEAM_AUTO_TOKEN: payload.autoPairToken
54266
54338
  };
54267
- const houseConfigDir = path112.join(
54268
- os71.homedir(),
54339
+ const houseConfigDir = path113.join(
54340
+ os72.homedir(),
54269
54341
  ".codeam",
54270
54342
  "house-claude",
54271
54343
  payload.deployId
54272
54344
  );
54273
54345
  try {
54274
- fs100.mkdirSync(houseConfigDir, { recursive: true, mode: 448 });
54346
+ fs101.mkdirSync(houseConfigDir, { recursive: true, mode: 448 });
54275
54347
  } catch {
54276
54348
  }
54277
54349
  childEnv.CLAUDE_CONFIG_DIR = houseConfigDir;
@@ -54300,7 +54372,7 @@ var HostAgentSupervisor = class {
54300
54372
  report("installing", "installing agent CLI");
54301
54373
  await this.runAgentInstall(payload.agentInstallScript);
54302
54374
  }
54303
- const home = process.env.HOME || os71.homedir();
54375
+ const home = process.env.HOME || os72.homedir();
54304
54376
  childEnv.PATH = `${home}/.local/bin:${process.env.PATH ?? ""}`;
54305
54377
  if (payload.cloneToken) {
54306
54378
  try {
@@ -54308,13 +54380,13 @@ var HostAgentSupervisor = class {
54308
54380
  if ((payload.repoProvider ?? "github") === "gitlab") {
54309
54381
  const glabCmd = await ensureGlabCli(defaultGitToolingRunner);
54310
54382
  if (glabCmd) {
54311
- childEnv.PATH = `${codeamBinDir()}${path112.delimiter}${childEnv.PATH}`;
54383
+ childEnv.PATH = `${codeamBinDir()}${path113.delimiter}${childEnv.PATH}`;
54312
54384
  await ensureGlabAuth(defaultGitToolingRunner, glabCmd, payload.cloneToken);
54313
54385
  }
54314
54386
  } else {
54315
54387
  const ghCmd = await ensureGhCli(defaultGitToolingRunner, payload.cloneToken);
54316
54388
  if (ghCmd) {
54317
- childEnv.PATH = `${codeamBinDir()}${path112.delimiter}${childEnv.PATH}`;
54389
+ childEnv.PATH = `${codeamBinDir()}${path113.delimiter}${childEnv.PATH}`;
54318
54390
  await ensureGhAuth(defaultGitToolingRunner, ghCmd, payload.cloneToken);
54319
54391
  }
54320
54392
  }
@@ -54342,9 +54414,9 @@ var HostAgentSupervisor = class {
54342
54414
  );
54343
54415
  if (!payload.suppressOnboardingWelcome) {
54344
54416
  try {
54345
- const cfgDir = childEnv.CLAUDE_CONFIG_DIR || path112.join(os71.homedir(), ".claude");
54346
- const projectDir = path112.join(cfgDir, "projects", encodeCwd(cwd));
54347
- const hasPriorConversation = fs100.existsSync(projectDir) && fs100.readdirSync(projectDir).some((f) => f.endsWith(".jsonl"));
54417
+ const cfgDir = childEnv.CLAUDE_CONFIG_DIR || path113.join(os72.homedir(), ".claude");
54418
+ const projectDir = path113.join(cfgDir, "projects", encodeCwd(cwd));
54419
+ const hasPriorConversation = fs101.existsSync(projectDir) && fs101.readdirSync(projectDir).some((f) => f.endsWith(".jsonl"));
54348
54420
  if (hasPriorConversation) {
54349
54421
  childEnv.CODEAM_RESUME_LATEST = "1";
54350
54422
  log.info(
@@ -54498,7 +54570,7 @@ var HostAgentSupervisor = class {
54498
54570
  fallbackResumeTarget() {
54499
54571
  const session = getActiveSession();
54500
54572
  if (!session || !session.pluginId || !session.pollSecret || !session.agent) return null;
54501
- const cwd = session.cwd && fs100.existsSync(session.cwd) ? session.cwd : process.cwd();
54573
+ const cwd = session.cwd && fs101.existsSync(session.cwd) ? session.cwd : process.cwd();
54502
54574
  if (isFilesystemRoot(cwd)) {
54503
54575
  log.warn(
54504
54576
  "host-agent",
@@ -54545,7 +54617,7 @@ var HostAgentSupervisor = class {
54545
54617
  log.warn("host-agent", `self_hosted_resume ${sessionId.slice(0, 8)}: no saved pairing on this box`);
54546
54618
  return;
54547
54619
  }
54548
- if (!session.cwd || !fs100.existsSync(session.cwd)) {
54620
+ if (!session.cwd || !fs101.existsSync(session.cwd)) {
54549
54621
  log.warn("host-agent", `self_hosted_resume ${sessionId.slice(0, 8)}: workspace is gone`);
54550
54622
  return;
54551
54623
  }
@@ -54587,7 +54659,7 @@ var HostAgentSupervisor = class {
54587
54659
  const persisted = new Map((this.sessionStore.load() ?? []).map((r) => [r.deployId, r.agent]));
54588
54660
  for (const c2 of this.children.values()) persisted.set(c2.deployId, c2.agent);
54589
54661
  return this.listSavedSessions().map((s) => ({ s, deployId: deployIdFromWorkspace(s.cwd) })).filter(
54590
- (x) => x.deployId !== null && !!x.s.cwd && fs100.existsSync(x.s.cwd)
54662
+ (x) => x.deployId !== null && !!x.s.cwd && fs101.existsSync(x.s.cwd)
54591
54663
  ).map(({ s, deployId }) => {
54592
54664
  const agent = persisted.get(deployId);
54593
54665
  return { deployId, sessionId: s.id, ...agent ? { agent } : {} };
@@ -54672,7 +54744,7 @@ var HostAgentSupervisor = class {
54672
54744
  if (this.children.has(deployId)) return;
54673
54745
  const st3 = this.resumeStateFor(target);
54674
54746
  try {
54675
- const cwd = fs100.existsSync(target.cwd) ? target.cwd : process.cwd();
54747
+ const cwd = fs101.existsSync(target.cwd) ? target.cwd : process.cwd();
54676
54748
  if (isWrapperCheckout(cwd)) {
54677
54749
  log.warn(
54678
54750
  "host-agent",
@@ -54714,7 +54786,7 @@ var HostAgentSupervisor = class {
54714
54786
  return;
54715
54787
  }
54716
54788
  if (tracked && signal) {
54717
- this.onResumeChildExit(target, 128 + (os71.constants.signals[signal] ?? 9), `signal ${signal}`);
54789
+ this.onResumeChildExit(target, 128 + (os72.constants.signals[signal] ?? 9), `signal ${signal}`);
54718
54790
  return;
54719
54791
  }
54720
54792
  log.warn(
@@ -54757,7 +54829,7 @@ var HostAgentSupervisor = class {
54757
54829
  if (Date.now() - child.startedAt < CRASH_RESPAWN_MIN_UPTIME_MS) return false;
54758
54830
  const session = pickSavedSessionForWorkspace(this.listSavedSessions(), child.cwd);
54759
54831
  if (!session) return false;
54760
- const exitCode = typeof code === "number" ? code : 128 + (signal ? os71.constants.signals[signal] ?? 9 : 9);
54832
+ const exitCode = typeof code === "number" ? code : 128 + (signal ? os72.constants.signals[signal] ?? 9 : 9);
54761
54833
  log.warn(
54762
54834
  "host-agent",
54763
54835
  `session deploy=${child.deployId.slice(0, 8)} died (${signal ?? code}) after ${Math.round((Date.now() - child.startedAt) / 1e3)}s \u2014 respawning it (resume)`
@@ -54907,12 +54979,12 @@ var HostAgentSupervisor = class {
54907
54979
  this.untrackChild(deployId);
54908
54980
  }
54909
54981
  const dirs = [
54910
- path112.join(selfHostedWorkspaceRoot(), deployId),
54911
- path112.join(os71.homedir(), ".codeam", "house-claude", deployId)
54982
+ path113.join(selfHostedWorkspaceRoot(), deployId),
54983
+ path113.join(os72.homedir(), ".codeam", "house-claude", deployId)
54912
54984
  ];
54913
54985
  for (const dir of dirs) {
54914
54986
  try {
54915
- fs100.rmSync(dir, { recursive: true, force: true });
54987
+ fs101.rmSync(dir, { recursive: true, force: true });
54916
54988
  } catch (err) {
54917
54989
  log.warn(
54918
54990
  "host-agent",
@@ -55131,8 +55203,8 @@ async function invite() {
55131
55203
  var import_node_dns = require("dns");
55132
55204
  var import_node_util11 = require("util");
55133
55205
  var import_node_crypto17 = require("crypto");
55134
- var fs101 = __toESM(require("fs"));
55135
- var path113 = __toESM(require("path"));
55206
+ var fs102 = __toESM(require("fs"));
55207
+ var path114 = __toESM(require("path"));
55136
55208
  var import_picocolors14 = __toESM(require("picocolors"));
55137
55209
  var dnsResolveP = (0, import_node_util11.promisify)(import_node_dns.resolve);
55138
55210
  async function checkDns(apiBase2) {
@@ -55188,13 +55260,13 @@ async function checkHealth(apiBase2) {
55188
55260
  }
55189
55261
  }
55190
55262
  function checkConfigDir() {
55191
- const dir = path113.join(require("os").homedir(), ".codeam");
55263
+ const dir = path114.join(require("os").homedir(), ".codeam");
55192
55264
  try {
55193
- fs101.mkdirSync(dir, { recursive: true, mode: 448 });
55194
- const probe = path113.join(dir, ".doctor-probe");
55195
- fs101.writeFileSync(probe, "ok", { mode: 384 });
55196
- const read = fs101.readFileSync(probe, "utf8");
55197
- fs101.unlinkSync(probe);
55265
+ fs102.mkdirSync(dir, { recursive: true, mode: 448 });
55266
+ const probe = path114.join(dir, ".doctor-probe");
55267
+ fs102.writeFileSync(probe, "ok", { mode: 384 });
55268
+ const read = fs102.readFileSync(probe, "utf8");
55269
+ fs102.unlinkSync(probe);
55198
55270
  if (read !== "ok") throw new Error("write/read round-trip mismatch");
55199
55271
  return {
55200
55272
  id: "config-dir",
@@ -55234,9 +55306,9 @@ function checkSessions() {
55234
55306
  }
55235
55307
  }
55236
55308
  function checkAgentBinaries() {
55237
- const os74 = createOsStrategy();
55309
+ const os75 = createOsStrategy();
55238
55310
  return getEnabledAgents().map((meta) => {
55239
- const found = os74.findInPath(meta.binaryName);
55311
+ const found = os75.findInPath(meta.binaryName);
55240
55312
  return {
55241
55313
  id: `agent-${meta.id}`,
55242
55314
  label: `Agent binary: ${meta.displayName} (${meta.binaryName})`,
@@ -55258,7 +55330,7 @@ function checkNodePty() {
55258
55330
  detail: "not required on this platform"
55259
55331
  };
55260
55332
  }
55261
- const vendoredPath = path113.join(__dirname, "vendor", "node-pty");
55333
+ const vendoredPath = path114.join(__dirname, "vendor", "node-pty");
55262
55334
  for (const target of [vendoredPath, "node-pty"]) {
55263
55335
  try {
55264
55336
  require(target);
@@ -55300,7 +55372,7 @@ function checkChokidar() {
55300
55372
  }
55301
55373
  async function doctor(args2 = []) {
55302
55374
  const json = args2.includes("--json");
55303
- const cliVersion = true ? "2.76.42" : "0.0.0-dev";
55375
+ const cliVersion = true ? "2.76.43" : "0.0.0-dev";
55304
55376
  const apiBase2 = resolveApiBaseUrl();
55305
55377
  const diagnosticId = (0, import_node_crypto17.randomUUID)();
55306
55378
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -55836,7 +55908,7 @@ async function mcpWarm(argv = [], opts = {}) {
55836
55908
  // src/commands/version.ts
55837
55909
  var import_picocolors15 = __toESM(require("picocolors"));
55838
55910
  function version2() {
55839
- const v = true ? "2.76.42" : "unknown";
55911
+ const v = true ? "2.76.43" : "unknown";
55840
55912
  console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
55841
55913
  }
55842
55914
 
@@ -55969,10 +56041,10 @@ function tryShowSubcommandHelp(cmd, args2) {
55969
56041
  var _subcommandHelpKeys = Object.keys(HELPS);
55970
56042
 
55971
56043
  // src/index.ts
55972
- var os73 = __toESM(require("os"));
56044
+ var os74 = __toESM(require("os"));
55973
56045
  if (!process.env.HOME) {
55974
56046
  try {
55975
- const home = os73.homedir();
56047
+ const home = os74.homedir();
55976
56048
  if (home) process.env.HOME = home;
55977
56049
  } catch {
55978
56050
  }