codeam-cli 2.76.41 → 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 +13 -0
  2. package/dist/index.js +779 -656
  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 (fs101.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, fs101, 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
- fs101 = __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 fs68 = __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.41" : "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.41",
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.41" ? { ideVersion: "2.76.41" } : {}
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 fs67 = __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
  }
@@ -21542,14 +21542,14 @@ function defaultSdkDir() {
21542
21542
  return resolveSdkDirViaRequire();
21543
21543
  }
21544
21544
  function resolveClaudeNativeBinary(deps = {}) {
21545
- const existsSync36 = deps.existsSync ?? import_fs.default.existsSync;
21545
+ const existsSync37 = deps.existsSync ?? import_fs.default.existsSync;
21546
21546
  const platformKey = deps.platformKey ?? currentPlatformKey();
21547
21547
  const sdkDir = deps.sdkDir !== void 0 ? deps.sdkDir : defaultSdkDir();
21548
21548
  if (!sdkDir) return null;
21549
21549
  const scopeDir = import_path4.default.dirname(sdkDir);
21550
21550
  const binName = platformKey.startsWith("win32-") ? "claude.exe" : "claude";
21551
21551
  const candidate = import_path4.default.join(scopeDir, `claude-agent-sdk-${platformKey}`, binName);
21552
- return existsSync36(candidate) ? candidate : null;
21552
+ return existsSync37(candidate) ? candidate : null;
21553
21553
  }
21554
21554
  var realSleep = (ms) => new Promise((resolve13) => setTimeout(resolve13, ms));
21555
21555
  async function waitForClaudeNativeBinary(opts = {}) {
@@ -21640,18 +21640,18 @@ function augmentUserLocalBinPaths(deps = {}) {
21640
21640
  env.PATH = [...additions, ...parts].join(p2.delimiter);
21641
21641
  }
21642
21642
  function resolveCursorAgentBinary(deps = {}) {
21643
- const existsSync36 = deps.existsSync ?? import_fs.default.existsSync;
21643
+ const existsSync37 = deps.existsSync ?? import_fs.default.existsSync;
21644
21644
  const platform3 = deps.platform ?? process.platform;
21645
21645
  const env = deps.env ?? process.env;
21646
21646
  if (platform3 === "win32") {
21647
21647
  const localAppData = env.LOCALAPPDATA;
21648
21648
  if (!localAppData) return null;
21649
21649
  const exe = import_path4.default.win32.join(localAppData, "cursor-agent", "cursor-agent.exe");
21650
- return existsSync36(exe) ? exe : null;
21650
+ return existsSync37(exe) ? exe : null;
21651
21651
  }
21652
21652
  const home = deps.homedir ?? import_os4.default.homedir();
21653
21653
  const unix = import_path4.default.posix.join(home, ".local", "bin", "cursor-agent");
21654
- return existsSync36(unix) ? unix : null;
21654
+ return existsSync37(unix) ? unix : null;
21655
21655
  }
21656
21656
  async function waitForCursorAgent(opts = {}) {
21657
21657
  const timeoutMs = opts.timeoutMs ?? 18e4;
@@ -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
  }
@@ -24874,6 +24874,7 @@ function quoteIfNeeded(value) {
24874
24874
  }
24875
24875
 
24876
24876
  // src/services/preview/expo.ts
24877
+ var fs45 = __toESM(require("fs"));
24877
24878
  var http6 = __toESM(require("http"));
24878
24879
  var path52 = __toESM(require("path"));
24879
24880
  var EXPO_PACKAGER_PROXY_URL_ENV = "EXPO_PACKAGER_PROXY_URL";
@@ -24917,6 +24918,68 @@ async function waitForExpoManifest(port, opts) {
24917
24918
  await new Promise((r) => setTimeout(r, interval));
24918
24919
  }
24919
24920
  }
24921
+ var EXPO_WEB_PACKAGES = ["react-native-web", "react-dom", "@expo/metro-runtime"];
24922
+ function missingExpoWebPackages(cwd) {
24923
+ return EXPO_WEB_PACKAGES.filter(
24924
+ (p2) => !fs45.existsSync(path52.join(cwd, "node_modules", p2, "package.json"))
24925
+ );
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
+ }
24950
+ function expoWebInstallSpecs(cwd, missing) {
24951
+ let pinned = {};
24952
+ try {
24953
+ const raw = JSON.parse(
24954
+ fs45.readFileSync(path52.join(cwd, "node_modules", "expo", "bundledNativeModules.json"), "utf8")
24955
+ );
24956
+ if (raw && typeof raw === "object" && !Array.isArray(raw))
24957
+ pinned = raw;
24958
+ } catch {
24959
+ }
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
+ });
24967
+ }
24968
+ function expoWebDepsInstall(cwd) {
24969
+ const missing = missingExpoPackages(cwd);
24970
+ if (missing.length === 0) return null;
24971
+ return {
24972
+ cmd: "npm",
24973
+ args: [
24974
+ "install",
24975
+ "--no-save",
24976
+ "--legacy-peer-deps",
24977
+ "--no-audit",
24978
+ "--no-fund",
24979
+ ...expoWebInstallSpecs(cwd, missing)
24980
+ ]
24981
+ };
24982
+ }
24920
24983
 
24921
24984
  // src/services/preview/parser.ts
24922
24985
  var REQUIRED_FIELDS2 = [
@@ -25154,11 +25217,41 @@ function stopChild(child) {
25154
25217
 
25155
25218
  // src/services/preview/run-setup.ts
25156
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
+ }
25157
25250
  function runSetupCommand(cmd, args2, cwd, env, opts) {
25158
25251
  return new Promise((resolve13) => {
25159
25252
  const child = (0, import_child_process18.spawn)(cmd, args2, {
25160
25253
  cwd,
25161
- env: { ...process.env, ...env ?? {} },
25254
+ env: { ...process.env, ...npmCacheOverride(), ...env ?? {} },
25162
25255
  stdio: ["ignore", "pipe", "pipe"]
25163
25256
  });
25164
25257
  let settled = false;
@@ -25542,8 +25635,8 @@ function isComposerInstallCommand(cmd, args2) {
25542
25635
  }
25543
25636
 
25544
25637
  // src/services/preview/script-candidates.ts
25545
- var fs47 = __toESM(require("fs"));
25546
- var path55 = __toESM(require("path"));
25638
+ var fs49 = __toESM(require("fs"));
25639
+ var path56 = __toESM(require("path"));
25547
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;
25548
25641
  var EXCLUDE_BODY_RE = /\b(run:android|run:ios|gradlew|fastlane|xcodebuild|eas build|eas submit)\b/i;
25549
25642
  var MAX_APPS = 40;
@@ -25561,7 +25654,7 @@ function frameworkFor(pkg, body) {
25561
25654
  }
25562
25655
  function readPkg(file) {
25563
25656
  try {
25564
- return JSON.parse(fs47.readFileSync(file, "utf8"));
25657
+ return JSON.parse(fs49.readFileSync(file, "utf8"));
25565
25658
  } catch {
25566
25659
  return null;
25567
25660
  }
@@ -25571,7 +25664,7 @@ function expandGlob(root, pattern) {
25571
25664
  if (!clean.endsWith("/*")) return [clean];
25572
25665
  const base = clean.slice(0, -2);
25573
25666
  try {
25574
- return fs47.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));
25575
25668
  } catch {
25576
25669
  return [];
25577
25670
  }
@@ -25580,7 +25673,7 @@ function workspaceDirs(root, rootPkg) {
25580
25673
  const ws = rootPkg?.workspaces;
25581
25674
  const patterns = Array.isArray(ws) ? ws : ws?.packages ?? [];
25582
25675
  try {
25583
- const pnpm = fs47.readFileSync(path55.join(root, "pnpm-workspace.yaml"), "utf8");
25676
+ const pnpm = fs49.readFileSync(path56.join(root, "pnpm-workspace.yaml"), "utf8");
25584
25677
  for (const m of pnpm.matchAll(/^\s*-\s*['"]?([^'"\n]+)['"]?\s*$/gm)) patterns.push(m[1]);
25585
25678
  } catch {
25586
25679
  }
@@ -25591,14 +25684,14 @@ function workspaceDirs(root, rootPkg) {
25591
25684
  }
25592
25685
  function listScriptCandidates(root) {
25593
25686
  const out2 = [];
25594
- const rootPkg = readPkg(path55.join(root, "package.json"));
25687
+ const rootPkg = readPkg(path56.join(root, "package.json"));
25595
25688
  const add = (pkg, appDir) => {
25596
25689
  for (const [script, body] of Object.entries(pkg.scripts ?? {})) {
25597
25690
  if (out2.length >= MAX_CANDIDATES) return;
25598
25691
  if (EXCLUDE_RE.test(script) || EXCLUDE_BODY_RE.test(body)) continue;
25599
25692
  const fw = frameworkFor(pkg, body);
25600
25693
  out2.push({
25601
- app: pkg.name ?? (appDir === "." ? path55.basename(root) : appDir),
25694
+ app: pkg.name ?? (appDir === "." ? path56.basename(root) : appDir),
25602
25695
  appDir,
25603
25696
  script,
25604
25697
  body,
@@ -25612,8 +25705,8 @@ function listScriptCandidates(root) {
25612
25705
  };
25613
25706
  if (rootPkg) add(rootPkg, ".");
25614
25707
  for (const dir of workspaceDirs(root, rootPkg)) {
25615
- const pkg = readPkg(path55.join(root, dir, "package.json"));
25616
- 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("/"));
25617
25710
  }
25618
25711
  return out2;
25619
25712
  }
@@ -26365,31 +26458,31 @@ async function readActivePreviewMarker(cwd, homeDir2) {
26365
26458
  }
26366
26459
 
26367
26460
  // src/agents/acp/guardrail-config.ts
26368
- var fs52 = __toESM(require("fs"));
26369
- var path60 = __toESM(require("path"));
26370
- var os37 = __toESM(require("os"));
26461
+ var fs54 = __toESM(require("fs"));
26462
+ var path61 = __toESM(require("path"));
26463
+ var os38 = __toESM(require("os"));
26371
26464
  var current = null;
26372
- function guardrailConfigPath(homeDir2 = os37.homedir()) {
26373
- return path60.join(homeDir2, ".codeam", "guardrails.json");
26465
+ function guardrailConfigPath(homeDir2 = os38.homedir()) {
26466
+ return path61.join(homeDir2, ".codeam", "guardrails.json");
26374
26467
  }
26375
- function loadGuardrailPolicy(homeDir2 = os37.homedir()) {
26468
+ function loadGuardrailPolicy(homeDir2 = os38.homedir()) {
26376
26469
  try {
26377
- current = normalizeGuardrailPolicy(JSON.parse(fs52.readFileSync(guardrailConfigPath(homeDir2), "utf8")));
26470
+ current = normalizeGuardrailPolicy(JSON.parse(fs54.readFileSync(guardrailConfigPath(homeDir2), "utf8")));
26378
26471
  } catch {
26379
26472
  current = { ...DEFAULT_GUARDRAIL_POLICY };
26380
26473
  }
26381
26474
  return current;
26382
26475
  }
26383
- function getGuardrailPolicy(homeDir2 = os37.homedir()) {
26476
+ function getGuardrailPolicy(homeDir2 = os38.homedir()) {
26384
26477
  return current ?? loadGuardrailPolicy(homeDir2);
26385
26478
  }
26386
- function setGuardrailPolicy(raw, homeDir2 = os37.homedir()) {
26479
+ function setGuardrailPolicy(raw, homeDir2 = os38.homedir()) {
26387
26480
  const next = normalizeGuardrailPolicy(raw);
26388
26481
  current = next;
26389
26482
  try {
26390
26483
  const p2 = guardrailConfigPath(homeDir2);
26391
- fs52.mkdirSync(path60.dirname(p2), { recursive: true });
26392
- fs52.writeFileSync(p2, JSON.stringify(next, null, 2));
26484
+ fs54.mkdirSync(path61.dirname(p2), { recursive: true });
26485
+ fs54.writeFileSync(p2, JSON.stringify(next, null, 2));
26393
26486
  } catch {
26394
26487
  }
26395
26488
  return next;
@@ -26405,22 +26498,22 @@ function shouldOfferOneMRecovery(opts) {
26405
26498
  }
26406
26499
 
26407
26500
  // src/commands/host/house-proxy-config.ts
26408
- var fs53 = __toESM(require("fs"));
26409
- var os38 = __toESM(require("os"));
26410
- var path61 = __toESM(require("path"));
26501
+ var fs55 = __toESM(require("fs"));
26502
+ var os39 = __toESM(require("os"));
26503
+ var path62 = __toESM(require("path"));
26411
26504
  function houseProxyConfigPath() {
26412
- return path61.join(os38.homedir(), ".codeam", "house-proxy.json");
26505
+ return path62.join(os39.homedir(), ".codeam", "house-proxy.json");
26413
26506
  }
26414
26507
  var DEPLOY_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
26415
26508
  function deployHouseProxyConfigPath(deployId) {
26416
26509
  if (!DEPLOY_ID_RE.test(deployId) || deployId.includes("..")) return null;
26417
- return path61.join(os38.homedir(), ".codeam", "house-proxy", `${deployId}.json`);
26510
+ return path62.join(os39.homedir(), ".codeam", "house-proxy", `${deployId}.json`);
26418
26511
  }
26419
26512
  function writeJson0600(file, value) {
26420
- fs53.mkdirSync(path61.dirname(file), { recursive: true, mode: 448 });
26513
+ fs55.mkdirSync(path62.dirname(file), { recursive: true, mode: 448 });
26421
26514
  const tmp = `${file}.tmp-${process.pid}`;
26422
- fs53.writeFileSync(tmp, JSON.stringify(value, null, 2), { encoding: "utf8", mode: 384 });
26423
- fs53.renameSync(tmp, file);
26515
+ fs55.writeFileSync(tmp, JSON.stringify(value, null, 2), { encoding: "utf8", mode: 384 });
26516
+ fs55.renameSync(tmp, file);
26424
26517
  restrictToOwner(file);
26425
26518
  }
26426
26519
  function persistHouseProxyConfig(config, deployId) {
@@ -26437,7 +26530,7 @@ function persistHouseProxyConfig(config, deployId) {
26437
26530
  }
26438
26531
  function clearHouseProxyConfig(deployId) {
26439
26532
  try {
26440
- fs53.rmSync(houseProxyConfigPath(), { force: true });
26533
+ fs55.rmSync(houseProxyConfigPath(), { force: true });
26441
26534
  const perDeploy = deployId ? deployHouseProxyConfigPath(deployId) : null;
26442
26535
  if (perDeploy) writeJson0600(perDeploy, { none: true });
26443
26536
  } catch {
@@ -26460,12 +26553,12 @@ function houseProxyTokenExpiring(token, nowSec, windowSec = HOUSE_PROXY_REFRESH_
26460
26553
  }
26461
26554
  function persistedConfigFile(deployId) {
26462
26555
  const perDeploy = deployId ? deployHouseProxyConfigPath(deployId) : null;
26463
- const file = perDeploy && fs53.existsSync(perDeploy) ? perDeploy : houseProxyConfigPath();
26464
- return fs53.existsSync(file) ? file : null;
26556
+ const file = perDeploy && fs55.existsSync(perDeploy) ? perDeploy : houseProxyConfigPath();
26557
+ return fs55.existsSync(file) ? file : null;
26465
26558
  }
26466
26559
  function readConfigObject(file) {
26467
26560
  try {
26468
- const parsed = JSON.parse(fs53.readFileSync(file, "utf8"));
26561
+ const parsed = JSON.parse(fs55.readFileSync(file, "utf8"));
26469
26562
  return typeof parsed === "object" && parsed !== null ? parsed : null;
26470
26563
  } catch {
26471
26564
  return null;
@@ -26498,8 +26591,8 @@ function rewriteHouseProxyToken(deployId, freshToken) {
26498
26591
  function readHouseProxyChildEnv(deployId) {
26499
26592
  try {
26500
26593
  const perDeploy = deployId ? deployHouseProxyConfigPath(deployId) : null;
26501
- const file = perDeploy && fs53.existsSync(perDeploy) ? perDeploy : houseProxyConfigPath();
26502
- const raw = fs53.readFileSync(file, "utf8");
26594
+ const file = perDeploy && fs55.existsSync(perDeploy) ? perDeploy : houseProxyConfigPath();
26595
+ const raw = fs55.readFileSync(file, "utf8");
26503
26596
  const parsed = JSON.parse(raw);
26504
26597
  if (typeof parsed !== "object" || parsed === null) return {};
26505
26598
  const o = parsed;
@@ -26609,9 +26702,9 @@ function pickHouseProxyEnv(env) {
26609
26702
  }
26610
26703
 
26611
26704
  // src/lib/provider-routing.ts
26612
- var fs54 = __toESM(require("fs"));
26613
- var os39 = __toESM(require("os"));
26614
- var path62 = __toESM(require("path"));
26705
+ var fs56 = __toESM(require("fs"));
26706
+ var os40 = __toESM(require("os"));
26707
+ var path63 = __toESM(require("path"));
26615
26708
  var PROVIDER_BASE_URL_ENV_KEYS = [
26616
26709
  "ANTHROPIC_BASE_URL",
26617
26710
  "OPENAI_BASE_URL",
@@ -26633,15 +26726,15 @@ function redactUrlToOrigin(raw) {
26633
26726
  }
26634
26727
  }
26635
26728
  function readOpencodeProviderOrigins(opts = {}) {
26636
- const home = opts.homeDir ?? os39.homedir();
26637
- const readFile8 = opts.readFile ?? ((f) => fs54.readFileSync(f, "utf8"));
26729
+ const home = opts.homeDir ?? os40.homedir();
26730
+ const readFile8 = opts.readFile ?? ((f) => fs56.readFileSync(f, "utf8"));
26638
26731
  const candidates = [];
26639
26732
  if (opts.cwd) {
26640
- 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"));
26641
26734
  }
26642
26735
  candidates.push(
26643
- path62.join(home, ".config", "opencode", "opencode.json"),
26644
- path62.join(home, ".config", "opencode", "opencode.jsonc")
26736
+ path63.join(home, ".config", "opencode", "opencode.json"),
26737
+ path63.join(home, ".config", "opencode", "opencode.jsonc")
26645
26738
  );
26646
26739
  const out2 = [];
26647
26740
  const seen2 = /* @__PURE__ */ new Set();
@@ -26995,8 +27088,8 @@ function adapterExitMessage(opts) {
26995
27088
 
26996
27089
  // src/services/preview/start-orchestrator.ts
26997
27090
  var import_child_process20 = require("child_process");
26998
- var fs58 = __toESM(require("fs"));
26999
- var path66 = __toESM(require("path"));
27091
+ var fs60 = __toESM(require("fs"));
27092
+ var path67 = __toESM(require("path"));
27000
27093
  var import_which3 = __toESM(require("which"));
27001
27094
 
27002
27095
  // src/services/preview/detection-cwd.ts
@@ -27030,13 +27123,13 @@ function resolveDetectionCwd(root, cwd) {
27030
27123
 
27031
27124
  // src/services/project-env/index.ts
27032
27125
  var import_fs6 = require("fs");
27033
- var path65 = __toESM(require("path"));
27126
+ var path66 = __toESM(require("path"));
27034
27127
 
27035
27128
  // src/beads/project-key.ts
27036
27129
  var import_child_process19 = require("child_process");
27037
27130
  var crypto2 = __toESM(require("crypto"));
27038
- var fs56 = __toESM(require("fs"));
27039
- var path64 = __toESM(require("path"));
27131
+ var fs58 = __toESM(require("fs"));
27132
+ var path65 = __toESM(require("path"));
27040
27133
  function normalizeOrigin(raw) {
27041
27134
  const trimmed = raw.trim();
27042
27135
  if (!trimmed) return null;
@@ -27062,17 +27155,17 @@ function normalizeOrigin(raw) {
27062
27155
  return `${host2}/${pathPart}`;
27063
27156
  }
27064
27157
  function findRepoRoot(cwd) {
27065
- let dir = path64.resolve(cwd);
27158
+ let dir = path65.resolve(cwd);
27066
27159
  const seen2 = /* @__PURE__ */ new Set();
27067
27160
  for (let i = 0; i < 256; i++) {
27068
27161
  if (seen2.has(dir)) return null;
27069
27162
  seen2.add(dir);
27070
27163
  try {
27071
- const stat3 = fs56.statSync(path64.join(dir, ".git"), { throwIfNoEntry: false });
27164
+ const stat3 = fs58.statSync(path65.join(dir, ".git"), { throwIfNoEntry: false });
27072
27165
  if (stat3 && (stat3.isDirectory() || stat3.isFile())) return dir;
27073
27166
  } catch {
27074
27167
  }
27075
- const parent = path64.dirname(dir);
27168
+ const parent = path65.dirname(dir);
27076
27169
  if (parent === dir) return null;
27077
27170
  dir = parent;
27078
27171
  }
@@ -27083,7 +27176,7 @@ var _execSeam3 = {
27083
27176
  const out2 = (0, import_child_process19.execFileSync)(file, args2, opts);
27084
27177
  return typeof out2 === "string" ? out2 : out2.toString("utf8");
27085
27178
  },
27086
- realpath: (p2) => fs56.realpathSync(p2)
27179
+ realpath: (p2) => fs58.realpathSync(p2)
27087
27180
  };
27088
27181
  function readOrigin(cwd) {
27089
27182
  try {
@@ -27112,7 +27205,7 @@ function deriveProjectIdentity(cwd = process.cwd()) {
27112
27205
  } catch {
27113
27206
  }
27114
27207
  const hash = crypto2.createHash("sha256").update(real).digest("hex");
27115
- return { projectKey: `path:${hash}`, projectLabel: path64.basename(real) || "project" };
27208
+ return { projectKey: `path:${hash}`, projectLabel: path65.basename(real) || "project" };
27116
27209
  }
27117
27210
 
27118
27211
  // src/services/project-env/index.ts
@@ -27125,7 +27218,7 @@ async function readIfExists(p2) {
27125
27218
  }
27126
27219
  async function syncProjectEnvUp(cwd, ctx) {
27127
27220
  if (!ctx.pluginAuthToken) return;
27128
- const content = await readIfExists(path65.join(cwd, ".env"));
27221
+ const content = await readIfExists(path66.join(cwd, ".env"));
27129
27222
  if (content == null) return;
27130
27223
  try {
27131
27224
  const { projectKey, projectLabel } = deriveProjectIdentity(cwd);
@@ -27147,7 +27240,7 @@ async function syncProjectEnvUp(cwd, ctx) {
27147
27240
  }
27148
27241
  async function restoreProjectEnvIfMissing(cwd, ctx) {
27149
27242
  if (!ctx.pluginAuthToken) return false;
27150
- const envPath = path65.join(cwd, ".env");
27243
+ const envPath = path66.join(cwd, ".env");
27151
27244
  if (await readIfExists(envPath) != null) return false;
27152
27245
  try {
27153
27246
  const { projectKey, projectLabel } = deriveProjectIdentity(cwd);
@@ -27158,7 +27251,7 @@ async function restoreProjectEnvIfMissing(cwd, ctx) {
27158
27251
  projectKey
27159
27252
  });
27160
27253
  if (!stored) return false;
27161
- const tmp = path65.join(cwd, ".env.codeam-restore.tmp");
27254
+ const tmp = path66.join(cwd, ".env.codeam-restore.tmp");
27162
27255
  await import_fs6.promises.writeFile(tmp, stored.content, { encoding: "utf8", mode: 384 });
27163
27256
  await import_fs6.promises.rename(tmp, envPath);
27164
27257
  log.info("project-env", `restored .env (${stored.keyCount} vars) for ${projectLabel}`);
@@ -27474,8 +27567,8 @@ function normalizeDetectionForSpawn(detection, cwd) {
27474
27567
  if (args2.length === 0) return detection;
27475
27568
  const binName = args2[0];
27476
27569
  if (binName.startsWith("-")) return detection;
27477
- const binPath = path66.join(cwd, "node_modules", ".bin", binName);
27478
- if (!fs58.existsSync(binPath)) return detection;
27570
+ const binPath = path67.join(cwd, "node_modules", ".bin", binName);
27571
+ if (!fs60.existsSync(binPath)) return detection;
27479
27572
  return {
27480
27573
  ...detection,
27481
27574
  command: binPath,
@@ -27499,7 +27592,8 @@ async function runPreviewStart(args2) {
27499
27592
  emit2(USER_EVENTS.PREVIEW_READY, {
27500
27593
  url: existing.url,
27501
27594
  framework: existing.framework,
27502
- port: detection.port
27595
+ port: detection.port,
27596
+ ...existing.expoGoUrl ? { expoGoUrl: existing.expoGoUrl } : {}
27503
27597
  });
27504
27598
  return;
27505
27599
  }
@@ -27527,6 +27621,22 @@ async function runPreviewStart(args2) {
27527
27621
  }
27528
27622
  async function runExpoBringUp(ctx) {
27529
27623
  const { detection, emit: emit2, emitProgress } = ctx;
27624
+ const webInstall = expoWebDepsInstall(ctx.cwd);
27625
+ let web = webInstall === null;
27626
+ if (webInstall) {
27627
+ emitProgress("SETUP_RUN", `${webInstall.cmd} ${webInstall.args.join(" ")} (Expo web preview)`);
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
+ );
27637
+ web = r.status === "ok";
27638
+ if (!web) emitProgress("SETUP_RUN", `web packages not installed (${r.status}) \u2014 Expo Go only`);
27639
+ }
27530
27640
  emitProgress("TUNNEL_STARTING", `cloudflared quick tunnel \u2192 Expo :${detection.port}`);
27531
27641
  const pub = await bringUpPublicUrl(ctx, detection.port);
27532
27642
  if (!pub.ok) {
@@ -27538,8 +27648,11 @@ async function runExpoBringUp(ctx) {
27538
27648
  killQuiet(pub.tunnel);
27539
27649
  return;
27540
27650
  }
27651
+ const expoGoUrl = expoGoDeepLink(pub.url);
27541
27652
  announceReady(ctx, dev, {
27542
- url: expoGoDeepLink(pub.url),
27653
+ // The web build in the frame + Expo Go beside it; an SDK without web deps keeps the QR alone.
27654
+ url: web ? pub.url : expoGoUrl,
27655
+ expoGoUrl: web ? expoGoUrl : void 0,
27543
27656
  tunnel: pub.tunnel,
27544
27657
  // No inspector: a DOM inspector means nothing against a native app.
27545
27658
  inspector: null
@@ -27554,6 +27667,7 @@ function announceReady(ctx, dev, tun) {
27554
27667
  tunnel: tun.tunnel,
27555
27668
  inspector: tun.inspector,
27556
27669
  url: tun.url,
27670
+ expoGoUrl: tun.expoGoUrl,
27557
27671
  framework: detection.framework,
27558
27672
  detection,
27559
27673
  cwd: ctx.cwd
@@ -27566,7 +27680,8 @@ function announceReady(ctx, dev, tun) {
27566
27680
  emit2(USER_EVENTS.PREVIEW_READY, {
27567
27681
  url: tun.url,
27568
27682
  framework: detection.framework,
27569
- port: detection.port
27683
+ port: detection.port,
27684
+ ...tun.expoGoUrl ? { expoGoUrl: tun.expoGoUrl } : {}
27570
27685
  });
27571
27686
  }
27572
27687
  async function runPreflightInstall(ctx, install, why) {
@@ -27694,7 +27809,8 @@ async function startDevServer(ctx, extraEnv = {}) {
27694
27809
  emit2(USER_EVENTS.PREVIEW_READY, {
27695
27810
  url: raceExisting.url,
27696
27811
  framework: raceExisting.framework,
27697
- port: detection.port
27812
+ port: detection.port,
27813
+ ...raceExisting.expoGoUrl ? { expoGoUrl: raceExisting.expoGoUrl } : {}
27698
27814
  });
27699
27815
  return null;
27700
27816
  }
@@ -27760,7 +27876,13 @@ async function startDevServer(ctx, extraEnv = {}) {
27760
27876
  // never shows its "Serving HTTP on … (http://0.0.0.0:8000/)" line while it
27761
27877
  // already serves — every such preview ended in a 120 s ready_timeout
27762
27878
  // (codeagent-nczt.9). First, so the project's own env can still override it.
27763
- env: { PYTHONUNBUFFERED: "1", ...process.env, ...spawnable.env ?? {}, ...extraEnv },
27879
+ env: {
27880
+ PYTHONUNBUFFERED: "1",
27881
+ ...process.env,
27882
+ ...npmCacheOverride(),
27883
+ ...spawnable.env ?? {},
27884
+ ...extraEnv
27885
+ },
27764
27886
  stdio: ["ignore", "pipe", "pipe"],
27765
27887
  // POSIX: lead a new process group so teardown can SIGTERM the whole
27766
27888
  // tree. Dev servers fork worker children that bind the port; killing
@@ -27794,7 +27916,7 @@ async function startDevServer(ctx, extraEnv = {}) {
27794
27916
  killProcessTree(devServer, "SIGTERM");
27795
27917
  emit2(USER_EVENTS.PREVIEW_ERROR, {
27796
27918
  stage: "spawn",
27797
- 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.`,
27798
27920
  stderrTail: stripAnsi(outputTail).slice(-8e3)
27799
27921
  });
27800
27922
  return null;
@@ -27929,9 +28051,9 @@ function describeSpawnFailure(err, command2, relDir) {
27929
28051
 
27930
28052
  // src/beads/bd-adapter.ts
27931
28053
  var import_child_process21 = require("child_process");
27932
- var fs59 = __toESM(require("fs"));
27933
- var os40 = __toESM(require("os"));
27934
- var path67 = __toESM(require("path"));
28054
+ var fs61 = __toESM(require("fs"));
28055
+ var os41 = __toESM(require("os"));
28056
+ var path68 = __toESM(require("path"));
27935
28057
 
27936
28058
  // src/beads/schema-migrate.ts
27937
28059
  var SCHEMA_SKEW_RE = /Error 1146|table not found|refusing to auto-apply \d+ pending schema migration/i;
@@ -27980,11 +28102,11 @@ function _defaultResolveBundled() {
27980
28102
  } catch {
27981
28103
  return null;
27982
28104
  }
27983
- const binDir = path67.join(path67.dirname(pkgJsonPath), "bin");
28105
+ const binDir = path68.join(path68.dirname(pkgJsonPath), "bin");
27984
28106
  const binaryName = process.platform === "win32" ? "bd.exe" : "bd";
27985
- const binaryPath = path67.join(binDir, binaryName);
28107
+ const binaryPath = path68.join(binDir, binaryName);
27986
28108
  try {
27987
- fs59.accessSync(binaryPath, fs59.constants.F_OK);
28109
+ fs61.accessSync(binaryPath, fs61.constants.F_OK);
27988
28110
  return binaryPath;
27989
28111
  } catch {
27990
28112
  return null;
@@ -27994,13 +28116,13 @@ function resolveBdOnPath() {
27994
28116
  return _resolveSeam.resolveOnPath();
27995
28117
  }
27996
28118
  function _defaultResolveOnPath() {
27997
- const dirs = (process.env.PATH ?? "").split(path67.delimiter).filter(Boolean);
28119
+ const dirs = (process.env.PATH ?? "").split(path68.delimiter).filter(Boolean);
27998
28120
  const candidates = process.platform === "win32" ? ["bd.exe", "bd.cmd", "bd"] : ["bd"];
27999
28121
  for (const dir of dirs) {
28000
28122
  for (const candidate of candidates) {
28001
- const full = path67.join(dir, candidate);
28123
+ const full = path68.join(dir, candidate);
28002
28124
  try {
28003
- fs59.accessSync(full, fs59.constants.F_OK);
28125
+ fs61.accessSync(full, fs61.constants.F_OK);
28004
28126
  return full;
28005
28127
  } catch {
28006
28128
  }
@@ -28087,7 +28209,7 @@ var BdAdapter = class {
28087
28209
  const env = { ...process.env };
28088
28210
  if (!env.HOME) {
28089
28211
  try {
28090
- const home = os40.homedir();
28212
+ const home = os41.homedir();
28091
28213
  if (home) env.HOME = home;
28092
28214
  } catch {
28093
28215
  }
@@ -28189,9 +28311,9 @@ function coerceIssue(row, projectKey) {
28189
28311
 
28190
28312
  // src/beads/provisioner.ts
28191
28313
  var import_child_process24 = require("child_process");
28192
- var fs61 = __toESM(require("fs"));
28193
- var os42 = __toESM(require("os"));
28194
- var path69 = __toESM(require("path"));
28314
+ var fs63 = __toESM(require("fs"));
28315
+ var os43 = __toESM(require("os"));
28316
+ var path70 = __toESM(require("path"));
28195
28317
 
28196
28318
  // src/beads/install-bd.ts
28197
28319
  var import_child_process22 = require("child_process");
@@ -28256,9 +28378,9 @@ async function installBd(platform3 = process.platform) {
28256
28378
 
28257
28379
  // src/beads/install-dolt.ts
28258
28380
  var import_child_process23 = require("child_process");
28259
- var fs60 = __toESM(require("fs"));
28260
- var os41 = __toESM(require("os"));
28261
- var path68 = __toESM(require("path"));
28381
+ var fs62 = __toESM(require("fs"));
28382
+ var os42 = __toESM(require("os"));
28383
+ var path69 = __toESM(require("path"));
28262
28384
  var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
28263
28385
  var DOLT_MSI_URL = "https://github.com/dolthub/dolt/releases/latest/download/dolt-windows-amd64.msi";
28264
28386
  function resolveDoltInstallStrategy(platform3) {
@@ -28298,11 +28420,11 @@ function resolveDoltInstallStrategy(platform3) {
28298
28420
  }
28299
28421
  var DOLT_RELEASE_BASE = "https://github.com/dolthub/dolt/releases/latest/download";
28300
28422
  function doltPlatformTuple(platform3, arch2) {
28301
- const os74 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
28423
+ const os75 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
28302
28424
  const a = arch2 === "x64" ? "amd64" : arch2 === "arm64" ? "arm64" : null;
28303
28425
  if (!a) return null;
28304
- if (os74 === "windows" && a !== "amd64") return null;
28305
- return `${os74}-${a}`;
28426
+ if (os75 === "windows" && a !== "amd64") return null;
28427
+ return `${os75}-${a}`;
28306
28428
  }
28307
28429
  function resolveDoltTarballStrategy(targetDir, platform3, arch2) {
28308
28430
  const tuple = doltPlatformTuple(platform3, arch2);
@@ -28347,14 +28469,14 @@ async function installDoltToDir(targetDir, platform3 = process.platform, arch2 =
28347
28469
  return result;
28348
28470
  }
28349
28471
  var _doltPathSeam = {
28350
- homedir: () => os41.homedir(),
28472
+ homedir: () => os42.homedir(),
28351
28473
  getPath: () => process.env.PATH ?? "",
28352
28474
  setPath: (p2) => {
28353
28475
  process.env.PATH = p2;
28354
28476
  },
28355
28477
  exists: (p2) => {
28356
28478
  try {
28357
- fs60.accessSync(p2, fs60.constants.F_OK);
28479
+ fs62.accessSync(p2, fs62.constants.F_OK);
28358
28480
  return true;
28359
28481
  } catch {
28360
28482
  return false;
@@ -28365,7 +28487,7 @@ function doltBinaryNames(platform3) {
28365
28487
  return platform3 === "win32" ? ["dolt.exe", "dolt.cmd", "dolt"] : ["dolt"];
28366
28488
  }
28367
28489
  function knownDoltDirs(platform3) {
28368
- const P3 = platform3 === "win32" ? path68.win32 : path68.posix;
28490
+ const P3 = platform3 === "win32" ? path69.win32 : path69.posix;
28369
28491
  const home = _doltPathSeam.homedir();
28370
28492
  if (platform3 === "win32") {
28371
28493
  return [
@@ -28381,7 +28503,7 @@ function knownDoltDirs(platform3) {
28381
28503
  ].filter(Boolean);
28382
28504
  }
28383
28505
  function ensureDoltResolvable(platform3 = process.platform) {
28384
- const P3 = platform3 === "win32" ? path68.win32 : path68.posix;
28506
+ const P3 = platform3 === "win32" ? path69.win32 : path69.posix;
28385
28507
  const delim = platform3 === "win32" ? ";" : ":";
28386
28508
  const names = doltBinaryNames(platform3);
28387
28509
  const pathDirs = _doltPathSeam.getPath().split(delim).filter(Boolean);
@@ -28558,10 +28680,10 @@ var _provisionSeam = {
28558
28680
  /** Does the project's git remote carry Dolt data (`refs/dolt/data`)? */
28559
28681
  remoteHasDoltData,
28560
28682
  /** Throwaway cwd for a user-level-only `bd setup` (see GLOBAL_ONLY_RECIPES). */
28561
- makeSetupCwd: () => fs61.mkdtempSync(path69.join(os42.tmpdir(), "codeam-bd-setup-")),
28683
+ makeSetupCwd: () => fs63.mkdtempSync(path70.join(os43.tmpdir(), "codeam-bd-setup-")),
28562
28684
  removeSetupCwd: (dir) => {
28563
28685
  try {
28564
- fs61.rmSync(dir, { recursive: true, force: true });
28686
+ fs63.rmSync(dir, { recursive: true, force: true });
28565
28687
  } catch {
28566
28688
  }
28567
28689
  }
@@ -28583,17 +28705,17 @@ function remoteHasDoltData(cwd) {
28583
28705
  }
28584
28706
  var _linkSeam = {
28585
28707
  platform: () => process.platform,
28586
- homedir: () => os42.homedir(),
28708
+ homedir: () => os43.homedir(),
28587
28709
  isWritableDir: (dir) => {
28588
28710
  try {
28589
- fs61.accessSync(dir, fs61.constants.W_OK);
28711
+ fs63.accessSync(dir, fs63.constants.W_OK);
28590
28712
  return true;
28591
28713
  } catch {
28592
28714
  return false;
28593
28715
  }
28594
28716
  },
28595
28717
  ensureDir: (dir) => {
28596
- fs61.mkdirSync(dir, { recursive: true });
28718
+ fs63.mkdirSync(dir, { recursive: true });
28597
28719
  },
28598
28720
  /**
28599
28721
  * A directory to symlink `bd` into so the AGENT's shell + Claude Code's
@@ -28614,9 +28736,9 @@ var _linkSeam = {
28614
28736
  * which `linkBdOntoPath` creates if missing.
28615
28737
  */
28616
28738
  cliBinDir: () => {
28617
- const pathDirs = (process.env.PATH ?? "").split(path69.delimiter).filter(Boolean);
28739
+ const pathDirs = (process.env.PATH ?? "").split(path70.delimiter).filter(Boolean);
28618
28740
  const home = _linkSeam.homedir();
28619
- const localBin = home ? path69.join(home, ".local", "bin") : null;
28741
+ const localBin = home ? path70.join(home, ".local", "bin") : null;
28620
28742
  if (localBin) {
28621
28743
  try {
28622
28744
  _linkSeam.ensureDir(localBin);
@@ -28626,16 +28748,16 @@ var _linkSeam = {
28626
28748
  const candidates = [];
28627
28749
  if (localBin) candidates.push(localBin);
28628
28750
  try {
28629
- candidates.push(path69.dirname(process.execPath));
28751
+ candidates.push(path70.dirname(process.execPath));
28630
28752
  } catch {
28631
28753
  }
28632
28754
  candidates.push("/usr/local/bin");
28633
28755
  const entry = process.argv[1];
28634
28756
  if (entry) {
28635
28757
  try {
28636
- candidates.push(path69.dirname(fs61.realpathSync(entry)));
28758
+ candidates.push(path70.dirname(fs63.realpathSync(entry)));
28637
28759
  } catch {
28638
- candidates.push(path69.dirname(entry));
28760
+ candidates.push(path70.dirname(entry));
28639
28761
  }
28640
28762
  }
28641
28763
  const onPathWritable = candidates.find(
@@ -28647,20 +28769,20 @@ var _linkSeam = {
28647
28769
  /** Current symlink target at `linkPath`, or null when absent / not a link. */
28648
28770
  readlink: (linkPath) => {
28649
28771
  try {
28650
- return fs61.readlinkSync(linkPath);
28772
+ return fs63.readlinkSync(linkPath);
28651
28773
  } catch {
28652
28774
  return null;
28653
28775
  }
28654
28776
  },
28655
- unlink: (linkPath) => fs61.unlinkSync(linkPath),
28656
- symlink: (target, linkPath) => fs61.symlinkSync(target, linkPath)
28777
+ unlink: (linkPath) => fs63.unlinkSync(linkPath),
28778
+ symlink: (target, linkPath) => fs63.symlinkSync(target, linkPath)
28657
28779
  };
28658
28780
  function linkBdOntoPath(binaryPath) {
28659
28781
  if (_linkSeam.platform() === "win32") return;
28660
28782
  const binDir = _linkSeam.cliBinDir();
28661
28783
  if (!binDir) return;
28662
28784
  _linkSeam.ensureDir(binDir);
28663
- const linkPath = path69.join(binDir, "bd");
28785
+ const linkPath = path70.join(binDir, "bd");
28664
28786
  if (linkPath === binaryPath) return;
28665
28787
  const current2 = _linkSeam.readlink(linkPath);
28666
28788
  if (current2 === binaryPath) return;
@@ -28898,16 +29020,16 @@ function dedupeRecipes(agents) {
28898
29020
  }
28899
29021
  function ensureLocalGitExclude(cwd, patterns) {
28900
29022
  try {
28901
- const gitDir = path69.join(cwd, ".git");
28902
- if (!fs61.statSync(gitDir).isDirectory()) return;
28903
- const file = path69.join(gitDir, "info", "exclude");
28904
- fs61.mkdirSync(path69.dirname(file), { recursive: true });
28905
- const current2 = fs61.existsSync(file) ? fs61.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") : "";
28906
29028
  const have = new Set(current2.split(/\r?\n/).map((l) => l.trim()));
28907
29029
  const missing = patterns.filter((p2) => !have.has(p2));
28908
29030
  if (missing.length === 0) return;
28909
29031
  const prefix = current2.length > 0 && !current2.endsWith("\n") ? "\n" : "";
28910
- fs61.appendFileSync(file, `${prefix}# CodeAgent: beads state stays local
29032
+ fs63.appendFileSync(file, `${prefix}# CodeAgent: beads state stays local
28911
29033
  ${missing.join("\n")}
28912
29034
  `);
28913
29035
  } catch {
@@ -28916,7 +29038,7 @@ ${missing.join("\n")}
28916
29038
 
28917
29039
  // src/beads/watcher.ts
28918
29040
  var crypto4 = __toESM(require("crypto"));
28919
- var path70 = __toESM(require("path"));
29041
+ var path71 = __toESM(require("path"));
28920
29042
  var API_BASE5 = resolveApiBaseUrl();
28921
29043
  var DEBOUNCE_MS2 = 400;
28922
29044
  var ZERO_SUMMARY = {
@@ -28940,7 +29062,7 @@ var BeadsWatcher = class {
28940
29062
  constructor(opts) {
28941
29063
  this.opts = opts;
28942
29064
  this.bd = opts.adapter ?? new BdAdapter({ cwd: opts.cwd, beadsDir: opts.beadsDir });
28943
- 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");
28944
29066
  this.apiBase = opts.apiBaseUrl ?? API_BASE5;
28945
29067
  }
28946
29068
  opts;
@@ -29595,8 +29717,8 @@ function cleanupAttachmentTempFiles() {
29595
29717
  function saveFilesTemp(files) {
29596
29718
  return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
29597
29719
  const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
29598
- const tmpPath = path75.join(os48.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
29599
- fs67.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"));
29600
29722
  pendingAttachmentFiles.add(tmpPath);
29601
29723
  return tmpPath;
29602
29724
  });
@@ -29842,10 +29964,10 @@ var listFiles = async (ctx, cmd, parsed) => {
29842
29964
  await ctx.relay.sendResult(cmd.id, "completed", result);
29843
29965
  };
29844
29966
  var envReadH = async (ctx, cmd) => {
29845
- const envPath = path75.join(process.cwd(), ".env");
29967
+ const envPath = path76.join(process.cwd(), ".env");
29846
29968
  await restoreProjectEnvIfMissing(process.cwd(), ctx);
29847
29969
  try {
29848
- const raw = await fs67.promises.readFile(envPath, "utf8");
29970
+ const raw = await fs69.promises.readFile(envPath, "utf8");
29849
29971
  await ctx.relay.sendResult(cmd.id, "completed", {
29850
29972
  exists: true,
29851
29973
  vars: parseDotenv(raw)
@@ -29874,7 +29996,7 @@ var envParseH = async (ctx, cmd, parsed) => {
29874
29996
  const existing = /* @__PURE__ */ new Map();
29875
29997
  if (!replace) {
29876
29998
  try {
29877
- const raw = await fs67.promises.readFile(path75.join(process.cwd(), ".env"), "utf8");
29999
+ const raw = await fs69.promises.readFile(path76.join(process.cwd(), ".env"), "utf8");
29878
30000
  for (const v of parseDotenv(raw)) existing.set(v.key, v.value);
29879
30001
  } catch {
29880
30002
  }
@@ -29914,15 +30036,15 @@ var envWriteH = async (ctx, cmd, parsed) => {
29914
30036
  }
29915
30037
  seen2.add(v.key);
29916
30038
  }
29917
- const envPath = path75.join(process.cwd(), ".env");
29918
- 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");
29919
30041
  try {
29920
- await fs67.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
29921
- await fs67.promises.rename(tmpPath, envPath);
30042
+ await fs69.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
30043
+ await fs69.promises.rename(tmpPath, envPath);
29922
30044
  await ctx.relay.sendResult(cmd.id, "completed", { ok: true, count: vars.length });
29923
30045
  void syncProjectEnvUp(process.cwd(), ctx);
29924
30046
  } catch (err) {
29925
- await fs67.promises.rm(tmpPath, { force: true }).catch(() => void 0);
30047
+ await fs69.promises.rm(tmpPath, { force: true }).catch(() => void 0);
29926
30048
  await ctx.relay.sendResult(cmd.id, "failed", { error: err.message });
29927
30049
  }
29928
30050
  };
@@ -30148,7 +30270,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
30148
30270
  });
30149
30271
  const token = ctx.pluginAuthToken;
30150
30272
  void (async () => {
30151
- const os74 = createOsStrategy();
30273
+ const os75 = createOsStrategy();
30152
30274
  try {
30153
30275
  const report = await reviewPullRequest(
30154
30276
  {
@@ -30157,7 +30279,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
30157
30279
  baseBranch: parsed.baseBranch
30158
30280
  },
30159
30281
  {
30160
- runReview: (input) => new CoderabbitRuntimeStrategy(os74).runOneShot(input),
30282
+ runReview: (input) => new CoderabbitRuntimeStrategy(os75).runOneShot(input),
30161
30283
  runGh: (args2) => defaultRunGh(args2),
30162
30284
  postReport: async (r) => {
30163
30285
  if (!token) return;
@@ -30271,9 +30393,9 @@ var CLI_UPDATE_MAX_ATTEMPTS = 3;
30271
30393
  function buildNpmInstallInvocation(opts) {
30272
30394
  const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
30273
30395
  const execPath = opts?.execPath ?? process.execPath;
30274
- const exists2 = opts?.existsSync ?? fs67.existsSync;
30396
+ const exists2 = opts?.existsSync ?? fs69.existsSync;
30275
30397
  const platform3 = opts?.platform ?? process.platform;
30276
- const p2 = platform3 === "win32" ? path75.win32 : path75.posix;
30398
+ const p2 = platform3 === "win32" ? path76.win32 : path76.posix;
30277
30399
  const normalized = entryScript.split(/[\\/]/).join("/");
30278
30400
  const marker = "/lib/node_modules/codeam-cli/";
30279
30401
  const markerIdx = normalized.indexOf(marker);
@@ -30292,7 +30414,7 @@ function isPermissionError(stderr) {
30292
30414
  function resolveGlobalNodeModulesDir(opts) {
30293
30415
  const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
30294
30416
  const platform3 = opts?.platform ?? process.platform;
30295
- const p2 = platform3 === "win32" ? path75.win32 : path75.posix;
30417
+ const p2 = platform3 === "win32" ? path76.win32 : path76.posix;
30296
30418
  const marker = "/lib/node_modules/codeam-cli/";
30297
30419
  const markerIdx = entryScript.split(/[\\/]/).join("/").indexOf(marker);
30298
30420
  if (markerIdx <= 0) return null;
@@ -30302,21 +30424,21 @@ function resolveGlobalNodeModulesDir(opts) {
30302
30424
  var STALE_STAGING_AGE_MS = CLI_UPDATE_INSTALL_TIMEOUT_MS;
30303
30425
  function sweepStaleCliStagingDirs(nodeModulesDir, now = Date.now(), deps) {
30304
30426
  if (!nodeModulesDir) return 0;
30305
- const readdirSync18 = deps?.readdirSync ?? fs67.readdirSync;
30306
- const statSync17 = deps?.statSync ?? fs67.statSync;
30307
- const rmSync15 = deps?.rmSync ?? fs67.rmSync;
30427
+ const readdirSync19 = deps?.readdirSync ?? fs69.readdirSync;
30428
+ const statSync18 = deps?.statSync ?? fs69.statSync;
30429
+ const rmSync15 = deps?.rmSync ?? fs69.rmSync;
30308
30430
  let removed = 0;
30309
30431
  let entries2;
30310
30432
  try {
30311
- entries2 = readdirSync18(nodeModulesDir);
30433
+ entries2 = readdirSync19(nodeModulesDir);
30312
30434
  } catch {
30313
30435
  return 0;
30314
30436
  }
30315
30437
  for (const name of entries2) {
30316
30438
  if (!/^\.codeam-cli-/.test(name)) continue;
30317
- const full = path75.join(nodeModulesDir, name);
30439
+ const full = path76.join(nodeModulesDir, name);
30318
30440
  try {
30319
- const st3 = statSync17(full);
30441
+ const st3 = statSync18(full);
30320
30442
  if (now - st3.mtimeMs < STALE_STAGING_AGE_MS) continue;
30321
30443
  rmSync15(full, { recursive: true, force: true });
30322
30444
  removed++;
@@ -30869,7 +30991,8 @@ function makePreviewReaffirm(args2) {
30869
30991
  return {
30870
30992
  url: active2.url,
30871
30993
  framework: active2.framework,
30872
- port: active2.detection.port
30994
+ port: active2.detection.port,
30995
+ ...active2.expoGoUrl ? { expoGoUrl: active2.expoGoUrl } : {}
30873
30996
  };
30874
30997
  },
30875
30998
  emitReady: (payload) => {
@@ -31462,11 +31585,11 @@ function resolveTokenValue(args2) {
31462
31585
  }
31463
31586
  const fileFlag = args2.find((a) => a.startsWith("--token-file="));
31464
31587
  if (fileFlag) {
31465
- const path116 = fileFlag.slice("--token-file=".length);
31588
+ const path117 = fileFlag.slice("--token-file=".length);
31466
31589
  try {
31467
- const content = fs68.readFileSync(path116, "utf8").trim();
31468
- if (content.length === 0) fail(`--token-file ${path116} is empty`);
31469
- rmIfExistsQuiet(path116);
31590
+ const content = fs70.readFileSync(path117, "utf8").trim();
31591
+ if (content.length === 0) fail(`--token-file ${path117} is empty`);
31592
+ rmIfExistsQuiet(path117);
31470
31593
  return content;
31471
31594
  } catch (err) {
31472
31595
  fail(`Could not read --token-file: ${err.message}`);
@@ -31558,12 +31681,12 @@ async function claim(token, pluginId, pluginSecretHash) {
31558
31681
  }
31559
31682
  }
31560
31683
  function pairAutoLockPath() {
31561
- return path76.join(os49.homedir(), ".codeam", "pair-auto.lock");
31684
+ return path77.join(os50.homedir(), ".codeam", "pair-auto.lock");
31562
31685
  }
31563
31686
  var procRoot = "/proc";
31564
31687
  function readProcFile(rel) {
31565
31688
  try {
31566
- return fs68.readFileSync(path76.join(procRoot, rel), "utf8");
31689
+ return fs70.readFileSync(path77.join(procRoot, rel), "utf8");
31567
31690
  } catch {
31568
31691
  return void 0;
31569
31692
  }
@@ -31584,7 +31707,7 @@ function currentBootId() {
31584
31707
  function readLockRecord(lockPath) {
31585
31708
  let raw;
31586
31709
  try {
31587
- raw = fs68.readFileSync(lockPath, "utf8");
31710
+ raw = fs70.readFileSync(lockPath, "utf8");
31588
31711
  } catch {
31589
31712
  return void 0;
31590
31713
  }
@@ -31633,7 +31756,7 @@ function isLiveLockHolder(rec) {
31633
31756
  }
31634
31757
  function releaseOwnLock(lockPath) {
31635
31758
  try {
31636
- if (readLockRecord(lockPath)?.pid === process.pid) fs68.unlinkSync(lockPath);
31759
+ if (readLockRecord(lockPath)?.pid === process.pid) fs70.unlinkSync(lockPath);
31637
31760
  } catch {
31638
31761
  }
31639
31762
  }
@@ -31657,7 +31780,7 @@ function snapshotProcessTree(root) {
31657
31780
  const children = /* @__PURE__ */ new Map();
31658
31781
  let entries2 = [];
31659
31782
  try {
31660
- entries2 = fs68.readdirSync(procRoot).filter((e) => /^\d+$/.test(e));
31783
+ entries2 = fs70.readdirSync(procRoot).filter((e) => /^\d+$/.test(e));
31661
31784
  } catch {
31662
31785
  }
31663
31786
  for (const e of entries2) {
@@ -31692,18 +31815,18 @@ function signalProcessTree(refs, signal) {
31692
31815
  }
31693
31816
  function daemonLockPath(sessionId) {
31694
31817
  const safe = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
31695
- return path76.join(os49.homedir(), ".codeam", `daemon-${safe}.lock`);
31818
+ return path77.join(os50.homedir(), ".codeam", `daemon-${safe}.lock`);
31696
31819
  }
31697
31820
  function acquireDaemonLock(sessionId) {
31698
31821
  const lockPath = daemonLockPath(sessionId);
31699
31822
  try {
31700
- fs68.mkdirSync(path76.dirname(lockPath), { recursive: true });
31823
+ fs70.mkdirSync(path77.dirname(lockPath), { recursive: true });
31701
31824
  try {
31702
- fs68.writeFileSync(lockPath, ownLockBody(), { flag: "wx" });
31825
+ fs70.writeFileSync(lockPath, ownLockBody(), { flag: "wx" });
31703
31826
  } catch (e) {
31704
31827
  if (e.code !== "EEXIST") throw e;
31705
31828
  if (isLiveLockHolder(readLockRecord(lockPath))) return false;
31706
- fs68.writeFileSync(lockPath, ownLockBody());
31829
+ fs70.writeFileSync(lockPath, ownLockBody());
31707
31830
  }
31708
31831
  const release3 = () => releaseOwnLock(lockPath);
31709
31832
  process.once("exit", release3);
@@ -31723,13 +31846,13 @@ function acquireDaemonLock(sessionId) {
31723
31846
  function acquireSingletonLock() {
31724
31847
  const lockPath = pairAutoLockPath();
31725
31848
  try {
31726
- fs68.mkdirSync(path76.dirname(lockPath), { recursive: true });
31849
+ fs70.mkdirSync(path77.dirname(lockPath), { recursive: true });
31727
31850
  try {
31728
- fs68.writeFileSync(lockPath, ownLockBody(), { flag: "wx" });
31851
+ fs70.writeFileSync(lockPath, ownLockBody(), { flag: "wx" });
31729
31852
  } catch (e) {
31730
31853
  if (e.code !== "EEXIST") throw e;
31731
31854
  if (isLiveLockHolder(readLockRecord(lockPath))) return false;
31732
- fs68.writeFileSync(lockPath, ownLockBody());
31855
+ fs70.writeFileSync(lockPath, ownLockBody());
31733
31856
  }
31734
31857
  process.once("exit", () => releaseOwnLock(lockPath));
31735
31858
  return true;
@@ -32155,7 +32278,7 @@ var AgentService = class _AgentService {
32155
32278
  };
32156
32279
 
32157
32280
  // src/agents/acp/adapters.ts
32158
- var path77 = __toESM(require("path"));
32281
+ var path78 = __toESM(require("path"));
32159
32282
 
32160
32283
  // src/agents/kimi/installer.ts
32161
32284
  var import_node_child_process26 = require("child_process");
@@ -32276,13 +32399,13 @@ function resolveBin(pkgName, binName) {
32276
32399
  try {
32277
32400
  const manifestPath = require_.resolve(`${pkgName}/package.json`);
32278
32401
  const manifest = require_(`${pkgName}/package.json`);
32279
- const pkgDir = path77.dirname(manifestPath);
32402
+ const pkgDir = path78.dirname(manifestPath);
32280
32403
  const bin = manifest.bin;
32281
32404
  if (!bin) return null;
32282
- if (typeof bin === "string") return path77.resolve(pkgDir, bin);
32405
+ if (typeof bin === "string") return path78.resolve(pkgDir, bin);
32283
32406
  const target = binName ?? Object.keys(bin)[0];
32284
32407
  if (!target || !bin[target]) return null;
32285
- return path77.resolve(pkgDir, bin[target]);
32408
+ return path78.resolve(pkgDir, bin[target]);
32286
32409
  } catch {
32287
32410
  return null;
32288
32411
  }
@@ -32297,7 +32420,7 @@ function npmAdapterPackageDir(agent) {
32297
32420
  const pkg = NPM_ADAPTER_PACKAGES[agent];
32298
32421
  if (!pkg) return null;
32299
32422
  try {
32300
- return path77.dirname(require_.resolve(`${pkg}/package.json`));
32423
+ return path78.dirname(require_.resolve(`${pkg}/package.json`));
32301
32424
  } catch {
32302
32425
  return null;
32303
32426
  }
@@ -32481,8 +32604,8 @@ async function resolveAcpAdapterWithRetry(agent, opts = {}) {
32481
32604
  }
32482
32605
 
32483
32606
  // src/agents/acp/prefetch-module-graph.ts
32484
- var fs69 = __toESM(require("fs"));
32485
- var path78 = __toESM(require("path"));
32607
+ var fs71 = __toESM(require("fs"));
32608
+ var path79 = __toESM(require("path"));
32486
32609
  var LOADABLE_EXT = /* @__PURE__ */ new Set([".js", ".mjs", ".cjs", ".json", ".node"]);
32487
32610
  var DEFAULT_MODULE_GRAPH_LIMITS = {
32488
32611
  maxFiles: 2e3,
@@ -32491,23 +32614,23 @@ var DEFAULT_MODULE_GRAPH_LIMITS = {
32491
32614
  concurrency: 16
32492
32615
  };
32493
32616
  var realFs = {
32494
- readdir: (dir) => fs69.promises.readdir(dir, { withFileTypes: true }),
32495
- readFile: (file) => fs69.promises.readFile(file),
32496
- stat: (file) => fs69.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)
32497
32620
  };
32498
32621
  function findPackageDir(dep, fromDir) {
32499
32622
  let dir = fromDir;
32500
32623
  for (; ; ) {
32501
- const candidate = path78.join(dir, "node_modules", dep);
32502
- if (fs69.existsSync(path78.join(candidate, "package.json"))) return candidate;
32503
- 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);
32504
32627
  if (parent === dir) return null;
32505
32628
  dir = parent;
32506
32629
  }
32507
32630
  }
32508
32631
  function runtimeDependencies(pkgDir) {
32509
32632
  try {
32510
- const manifest = JSON.parse(fs69.readFileSync(path78.join(pkgDir, "package.json"), "utf8"));
32633
+ const manifest = JSON.parse(fs71.readFileSync(path79.join(pkgDir, "package.json"), "utf8"));
32511
32634
  return Object.keys(manifest.dependencies ?? {});
32512
32635
  } catch {
32513
32636
  return [];
@@ -32526,14 +32649,14 @@ async function packageFiles(pkgDir, fsd, out2, maxFiles) {
32526
32649
  for (const entry of entries2) {
32527
32650
  if (out2.length >= maxFiles) return;
32528
32651
  if (entry.name.startsWith(".")) continue;
32529
- const full = path78.join(dir, entry.name);
32652
+ const full = path79.join(dir, entry.name);
32530
32653
  if (entry.isDirectory()) {
32531
32654
  if (entry.name !== "node_modules") stack.push(full);
32532
32655
  continue;
32533
32656
  }
32534
32657
  if (!entry.isFile()) continue;
32535
32658
  if (entry.name.endsWith(".d.ts") || entry.name.endsWith(".map")) continue;
32536
- if (LOADABLE_EXT.has(path78.extname(entry.name))) out2.push(full);
32659
+ if (LOADABLE_EXT.has(path79.extname(entry.name))) out2.push(full);
32537
32660
  }
32538
32661
  }
32539
32662
  }
@@ -32543,7 +32666,7 @@ async function collectModuleGraphFiles(rootPkgDir, limits = DEFAULT_MODULE_GRAPH
32543
32666
  const queue = [rootPkgDir];
32544
32667
  while (queue.length > 0 && files.length < limits.maxFiles) {
32545
32668
  const pkgDir = queue.shift();
32546
- const key = fs69.existsSync(pkgDir) ? fs69.realpathSync(pkgDir) : pkgDir;
32669
+ const key = fs71.existsSync(pkgDir) ? fs71.realpathSync(pkgDir) : pkgDir;
32547
32670
  if (seen2.has(key)) continue;
32548
32671
  seen2.add(key);
32549
32672
  await packageFiles(pkgDir, fsd, files, limits.maxFiles);
@@ -32655,9 +32778,9 @@ async function waitForNoAgentStarting(opts) {
32655
32778
 
32656
32779
  // src/agents/acp/runner.ts
32657
32780
  var import_node_crypto15 = require("crypto");
32658
- var fs88 = __toESM(require("fs"));
32659
- var os61 = __toESM(require("os"));
32660
- var path98 = __toESM(require("path"));
32781
+ var fs90 = __toESM(require("fs"));
32782
+ var os62 = __toESM(require("os"));
32783
+ var path99 = __toESM(require("path"));
32661
32784
 
32662
32785
  // src/agents/acp/provider-billing-signal.ts
32663
32786
  var seen = /* @__PURE__ */ new Set();
@@ -32689,8 +32812,8 @@ function noteProviderBillingSignal(opts) {
32689
32812
  }
32690
32813
 
32691
32814
  // src/services/history.service.ts
32692
- var fs71 = __toESM(require("fs"));
32693
- var path80 = __toESM(require("path"));
32815
+ var fs73 = __toESM(require("fs"));
32816
+ var path81 = __toESM(require("path"));
32694
32817
  var https6 = __toESM(require("https"));
32695
32818
  var http10 = __toESM(require("http"));
32696
32819
  var import_zod3 = require("zod");
@@ -32751,7 +32874,7 @@ function parseJsonl(filePath) {
32751
32874
  const messages = [];
32752
32875
  let raw;
32753
32876
  try {
32754
- raw = fs71.readFileSync(filePath, "utf8");
32877
+ raw = fs73.readFileSync(filePath, "utf8");
32755
32878
  } catch (err) {
32756
32879
  if (err.code !== "ENOENT") {
32757
32880
  log.warn("history:parseJsonl", `read failed for ${filePath}`, err);
@@ -32911,7 +33034,7 @@ var HistoryService = class _HistoryService {
32911
33034
  // session-start upload answered false, the active-conversation pointer was
32912
33035
  // never re-pointed after a Box wake, and the app opened an empty "New
32913
33036
  // conversation" over the resumed one (QA box, 2026-09-29).
32914
- path80.join(claudeConfigDir(), "projects", encodeCwd(this.cwd));
33037
+ path81.join(claudeConfigDir(), "projects", encodeCwd(this.cwd));
32915
33038
  }
32916
33039
  /** Set the current Claude conversation ID (extracted from /cost command or session start) */
32917
33040
  setCurrentConversationId(id) {
@@ -32923,7 +33046,7 @@ var HistoryService = class _HistoryService {
32923
33046
  /** Return the current message count in the active conversation. */
32924
33047
  getCurrentMessageCount() {
32925
33048
  if (!this.currentConversationId) return 0;
32926
- const filePath = path80.join(this.projectDir, `${this.currentConversationId}.jsonl`);
33049
+ const filePath = path81.join(this.projectDir, `${this.currentConversationId}.jsonl`);
32927
33050
  return parseJsonl(filePath).length;
32928
33051
  }
32929
33052
  /**
@@ -32934,7 +33057,7 @@ var HistoryService = class _HistoryService {
32934
33057
  const deadline = Date.now() + timeoutMs;
32935
33058
  while (Date.now() < deadline) {
32936
33059
  if (!this.currentConversationId) return null;
32937
- const filePath = path80.join(this.projectDir, `${this.currentConversationId}.jsonl`);
33060
+ const filePath = path81.join(this.projectDir, `${this.currentConversationId}.jsonl`);
32938
33061
  const messages = parseJsonl(filePath);
32939
33062
  if (messages.length > previousCount) {
32940
33063
  for (let i = messages.length - 1; i >= previousCount; i--) {
@@ -32961,18 +33084,18 @@ var HistoryService = class _HistoryService {
32961
33084
  const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
32962
33085
  const oneShots = readOneShotConversations(this.cwd);
32963
33086
  try {
32964
- const files = fs71.readdirSync(dir, { withFileTypes: true }).filter(
32965
- (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"))
32966
33089
  ).map((e) => {
32967
33090
  try {
32968
- const stat3 = fs71.statSync(path80.join(dir, e.name));
33091
+ const stat3 = fs73.statSync(path81.join(dir, e.name));
32969
33092
  return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
32970
33093
  } catch {
32971
33094
  return { name: e.name, mtime: 0, birthtime: 0 };
32972
33095
  }
32973
33096
  }).filter((f) => f.birthtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
32974
33097
  if (files.length > 0) {
32975
- this.currentConversationId = path80.basename(files[0].name, ".jsonl");
33098
+ this.currentConversationId = path81.basename(files[0].name, ".jsonl");
32976
33099
  }
32977
33100
  } catch {
32978
33101
  }
@@ -33006,13 +33129,13 @@ var HistoryService = class _HistoryService {
33006
33129
  const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
33007
33130
  let entries2;
33008
33131
  try {
33009
- entries2 = fs71.readdirSync(dir, { withFileTypes: true });
33132
+ entries2 = fs73.readdirSync(dir, { withFileTypes: true });
33010
33133
  } catch {
33011
33134
  return null;
33012
33135
  }
33013
33136
  const files = entries2.filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
33014
33137
  try {
33015
- const stat3 = fs71.statSync(path80.join(dir, e.name));
33138
+ const stat3 = fs73.statSync(path81.join(dir, e.name));
33016
33139
  return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
33017
33140
  } catch {
33018
33141
  return { name: e.name, mtime: 0, birthtime: 0 };
@@ -33021,12 +33144,12 @@ var HistoryService = class _HistoryService {
33021
33144
  if (files.length === 0) return null;
33022
33145
  const targetFile = this.currentConversationId ? `${this.currentConversationId}.jsonl` : files[0].name;
33023
33146
  if (!files.some((f) => f.name === targetFile)) return null;
33024
- return this.extractUsageFromFile(path80.join(dir, targetFile));
33147
+ return this.extractUsageFromFile(path81.join(dir, targetFile));
33025
33148
  }
33026
33149
  extractUsageFromFile(filePath) {
33027
33150
  let raw;
33028
33151
  try {
33029
- raw = fs71.readFileSync(filePath, "utf8");
33152
+ raw = fs73.readFileSync(filePath, "utf8");
33030
33153
  } catch {
33031
33154
  return null;
33032
33155
  }
@@ -33078,9 +33201,9 @@ var HistoryService = class _HistoryService {
33078
33201
  let totalCost = 0;
33079
33202
  let files;
33080
33203
  try {
33081
- files = fs71.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
33204
+ files = fs73.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
33082
33205
  try {
33083
- return fs71.statSync(path80.join(projectDir, f)).mtimeMs >= monthStartMs;
33206
+ return fs73.statSync(path81.join(projectDir, f)).mtimeMs >= monthStartMs;
33084
33207
  } catch {
33085
33208
  return false;
33086
33209
  }
@@ -33091,7 +33214,7 @@ var HistoryService = class _HistoryService {
33091
33214
  for (const file of files) {
33092
33215
  let raw;
33093
33216
  try {
33094
- raw = fs71.readFileSync(path80.join(projectDir, file), "utf8");
33217
+ raw = fs73.readFileSync(path81.join(projectDir, file), "utf8");
33095
33218
  } catch {
33096
33219
  continue;
33097
33220
  }
@@ -33170,7 +33293,7 @@ var HistoryService = class _HistoryService {
33170
33293
  if (this.runtime.resolveHistoryFile) {
33171
33294
  return this.runtime.resolveHistoryFile(this.cwd, sessionId);
33172
33295
  }
33173
- return path80.join(this.projectDir, `${sessionId}.jsonl`);
33296
+ return path81.join(this.projectDir, `${sessionId}.jsonl`);
33174
33297
  }
33175
33298
  /**
33176
33299
  * Parse a conversation's messages from disk, agent-aware. Claude uses the
@@ -33208,7 +33331,7 @@ var HistoryService = class _HistoryService {
33208
33331
  };
33209
33332
  });
33210
33333
  }
33211
- return parseJsonl(path80.join(this.projectDir, `${sessionId}.jsonl`));
33334
+ return parseJsonl(path81.join(this.projectDir, `${sessionId}.jsonl`));
33212
33335
  }
33213
33336
  /** One in-flight full upload per conversation — the baton mirror and a
33214
33337
  * `get_conversation` used to upload the same transcript concurrently. */
@@ -33290,7 +33413,7 @@ var HistoryService = class _HistoryService {
33290
33413
  if (!filePath) return false;
33291
33414
  let mtimeMs;
33292
33415
  try {
33293
- mtimeMs = fs71.statSync(filePath).mtimeMs;
33416
+ mtimeMs = fs73.statSync(filePath).mtimeMs;
33294
33417
  } catch {
33295
33418
  return false;
33296
33419
  }
@@ -33365,10 +33488,10 @@ var HistoryService = class _HistoryService {
33365
33488
 
33366
33489
  // src/agents/acp/client.ts
33367
33490
  var import_node_child_process28 = require("child_process");
33368
- var fs72 = __toESM(require("fs/promises"));
33491
+ var fs74 = __toESM(require("fs/promises"));
33369
33492
  var fsSync = __toESM(require("fs"));
33370
- var os52 = __toESM(require("os"));
33371
- var path82 = __toESM(require("path"));
33493
+ var os53 = __toESM(require("os"));
33494
+ var path83 = __toESM(require("path"));
33372
33495
  var import_node_stream = require("stream");
33373
33496
 
33374
33497
  // ../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
@@ -37394,8 +37517,8 @@ function createIdleTimeout(idleMs, makeError, activeIdleMs = idleMs) {
37394
37517
  }
37395
37518
 
37396
37519
  // src/agents/acp/internal-paths.ts
37397
- var path81 = __toESM(require("path"));
37398
- var os51 = __toESM(require("os"));
37520
+ var path82 = __toESM(require("path"));
37521
+ var os52 = __toESM(require("os"));
37399
37522
  var INTERNAL_TOKENS = [".codeam", "house-claude"];
37400
37523
  var PROSE_ONLY_TOOL_KINDS = /* @__PURE__ */ new Set(["think", "switch_mode"]);
37401
37524
  function isProseOnlyToolKind(kind) {
@@ -37407,13 +37530,13 @@ function textReferencesInternal(text) {
37407
37530
  const scrubbed = text.replace(SELF_HOSTED_WORKSPACE_RE, " ");
37408
37531
  return INTERNAL_TOKENS.some((t2) => scrubbed.includes(t2));
37409
37532
  }
37410
- function pathIsInternal(p2, homeDir2 = os51.homedir()) {
37533
+ function pathIsInternal(p2, homeDir2 = os52.homedir()) {
37411
37534
  if (!p2) return false;
37412
- const abs = path81.resolve(p2);
37413
- const home = path81.resolve(homeDir2);
37414
- const within = (root) => abs === root || abs.startsWith(root + path81.sep);
37415
- if (within(path81.join(home, ".codeam", "self-hosted"))) return false;
37416
- 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`);
37417
37540
  }
37418
37541
  function toolCallReferencesInternal(call, homeDir2) {
37419
37542
  if (call.locations?.some((l) => pathIsInternal(l.path, homeDir2))) return true;
@@ -38607,7 +38730,7 @@ var AcpClient = class {
38607
38730
  throw new RequestError(-32002, GUARDRAIL_SECRET_READ_BLOCK_REASON, { uri: params.path });
38608
38731
  }
38609
38732
  try {
38610
- const content = await fs72.readFile(params.path, "utf8");
38733
+ const content = await fs74.readFile(params.path, "utf8");
38611
38734
  return applyLineRange(content, params.line ?? null, params.limit ?? null);
38612
38735
  } catch (err) {
38613
38736
  const code = err.code;
@@ -38628,7 +38751,7 @@ var AcpClient = class {
38628
38751
  throw new RequestError(-32002, INTERNAL_BLOCK_REASON, { uri: params.path });
38629
38752
  }
38630
38753
  try {
38631
- await fs72.writeFile(params.path, params.content, "utf8");
38754
+ await fs74.writeFile(params.path, params.content, "utf8");
38632
38755
  return {};
38633
38756
  } catch (err) {
38634
38757
  const code = err.code;
@@ -38716,30 +38839,30 @@ function applyLineRange(content, line, limit) {
38716
38839
  return { content: lines.slice(start2, end).join("\n") };
38717
38840
  }
38718
38841
  function knownAgentBinaryDirs() {
38719
- const home = os52.homedir();
38842
+ const home = os53.homedir();
38720
38843
  const out2 = [];
38721
38844
  out2.push("/tmp/codeam-node20/bin");
38722
38845
  for (const root of [
38723
38846
  "/usr/local/share/nvm/versions/node",
38724
- path82.join(home, ".nvm/versions/node")
38847
+ path83.join(home, ".nvm/versions/node")
38725
38848
  ]) {
38726
38849
  try {
38727
38850
  for (const child of fsSync.readdirSync(root)) {
38728
- out2.push(path82.join(root, child, "bin"));
38851
+ out2.push(path83.join(root, child, "bin"));
38729
38852
  }
38730
38853
  } catch {
38731
38854
  }
38732
38855
  }
38733
- out2.push(path82.join(home, ".volta/bin"));
38856
+ out2.push(path83.join(home, ".volta/bin"));
38734
38857
  out2.push("/usr/local/bin");
38735
38858
  out2.push("/usr/bin");
38736
- out2.push(path82.join(home, ".local/bin"));
38737
- out2.push(path82.join(home, "bin"));
38859
+ out2.push(path83.join(home, ".local/bin"));
38860
+ out2.push(path83.join(home, "bin"));
38738
38861
  out2.push(...agentInstallBinDirs());
38739
38862
  if (process.platform === "win32") {
38740
38863
  const { LOCALAPPDATA, APPDATA } = process.env;
38741
- if (LOCALAPPDATA) out2.push(path82.join(LOCALAPPDATA, "cursor-agent"));
38742
- 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"));
38743
38866
  }
38744
38867
  return out2.filter((p2) => {
38745
38868
  try {
@@ -38750,7 +38873,7 @@ function knownAgentBinaryDirs() {
38750
38873
  });
38751
38874
  }
38752
38875
  function expandPathForAgentBinaries(existingPath) {
38753
- 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));
38754
38877
  const additions = [];
38755
38878
  for (const dir of knownAgentBinaryDirs()) {
38756
38879
  if (!existing.has(dir)) {
@@ -38759,17 +38882,17 @@ function expandPathForAgentBinaries(existingPath) {
38759
38882
  }
38760
38883
  }
38761
38884
  if (additions.length === 0) return existingPath;
38762
- return [...additions, existingPath].filter((p2) => p2.length > 0).join(path82.delimiter);
38885
+ return [...additions, existingPath].filter((p2) => p2.length > 0).join(path83.delimiter);
38763
38886
  }
38764
38887
 
38765
38888
  // src/commands/host/agent-install.ts
38766
38889
  var import_child_process27 = require("child_process");
38767
- var os53 = __toESM(require("os"));
38890
+ var os54 = __toESM(require("os"));
38768
38891
  function runAgentInstallScript(script, opts = {}) {
38769
38892
  const timeoutMs = opts.timeoutMs ?? 18e4;
38770
38893
  const scope = opts.logScope ?? "agent-install";
38771
38894
  return new Promise((resolve13) => {
38772
- const home = process.env.HOME || os53.homedir();
38895
+ const home = process.env.HOME || os54.homedir();
38773
38896
  const child = (0, import_child_process27.spawn)("sh", ["-c", script], {
38774
38897
  env: { ...process.env, HOME: home },
38775
38898
  stdio: ["ignore", "pipe", "pipe"]
@@ -39031,9 +39154,9 @@ async function performAgentSwitch(deps, rawAgentId, fastPath = {}) {
39031
39154
  }
39032
39155
 
39033
39156
  // src/commands/host/agent-provisioning.ts
39034
- var fs73 = __toESM(require("fs"));
39035
- var os54 = __toESM(require("os"));
39036
- var path83 = __toESM(require("path"));
39157
+ var fs75 = __toESM(require("fs"));
39158
+ var os55 = __toESM(require("os"));
39159
+ var path84 = __toESM(require("path"));
39037
39160
  var PUBLIC_TO_INTERNAL_AGENT = {
39038
39161
  claude_code: "claude",
39039
39162
  claude: "claude",
@@ -39050,22 +39173,22 @@ function toInternalAgentId(publicAgentId) {
39050
39173
  return PUBLIC_TO_INTERNAL_AGENT[publicAgentId] ?? null;
39051
39174
  }
39052
39175
  function ensureDir(dir) {
39053
- fs73.mkdirSync(dir, { recursive: true, mode: 448 });
39176
+ fs75.mkdirSync(dir, { recursive: true, mode: 448 });
39054
39177
  }
39055
39178
  function writeFile0600(filePath, contents) {
39056
- ensureDir(path83.dirname(filePath));
39057
- fs73.writeFileSync(filePath, contents, { encoding: "utf8", mode: 384 });
39179
+ ensureDir(path84.dirname(filePath));
39180
+ fs75.writeFileSync(filePath, contents, { encoding: "utf8", mode: 384 });
39058
39181
  restrictToOwner(filePath);
39059
39182
  }
39060
39183
  function rmIfExists(filePath) {
39061
39184
  try {
39062
- fs73.rmSync(filePath, { force: true });
39185
+ fs75.rmSync(filePath, { force: true });
39063
39186
  } catch {
39064
39187
  }
39065
39188
  }
39066
39189
  var claudeProvisioner = {
39067
39190
  write(auth, home) {
39068
- const credentialsJson = path83.join(home, ".claude", ".credentials.json");
39191
+ const credentialsJson = path84.join(home, ".claude", ".credentials.json");
39069
39192
  if (auth.kind === "api_key") {
39070
39193
  rmIfExists(credentialsJson);
39071
39194
  return { ANTHROPIC_API_KEY: auth.value };
@@ -39077,8 +39200,8 @@ var claudeProvisioner = {
39077
39200
  } else {
39078
39201
  rmIfExists(credentialsJson);
39079
39202
  }
39080
- const claudeJson = path83.join(home, ".claude.json");
39081
- if (!fs73.existsSync(claudeJson)) {
39203
+ const claudeJson = path84.join(home, ".claude.json");
39204
+ if (!fs75.existsSync(claudeJson)) {
39082
39205
  writeFile0600(
39083
39206
  claudeJson,
39084
39207
  JSON.stringify({ hasCompletedOnboarding: true, customApiKeyResponses: { approved: [] } })
@@ -39089,7 +39212,7 @@ var claudeProvisioner = {
39089
39212
  };
39090
39213
  var codexProvisioner = {
39091
39214
  write(auth, home) {
39092
- const authJson = path83.join(home, ".codex", "auth.json");
39215
+ const authJson = path84.join(home, ".codex", "auth.json");
39093
39216
  if (auth.kind === "api_key") {
39094
39217
  writeFile0600(authJson, JSON.stringify({ auth_mode: "apikey", OPENAI_API_KEY: auth.value }));
39095
39218
  return { OPENAI_API_KEY: auth.value };
@@ -39112,7 +39235,7 @@ function codexLoginStamp(raw) {
39112
39235
  function keepsFresherCodexLogin(authJsonPath, incoming) {
39113
39236
  let onDisk;
39114
39237
  try {
39115
- onDisk = fs73.readFileSync(authJsonPath, "utf8");
39238
+ onDisk = fs75.readFileSync(authJsonPath, "utf8");
39116
39239
  } catch {
39117
39240
  return false;
39118
39241
  }
@@ -39123,8 +39246,8 @@ function keepsFresherCodexLogin(authJsonPath, incoming) {
39123
39246
  }
39124
39247
  var geminiProvisioner = {
39125
39248
  write(auth, home) {
39126
- const settingsJson = path83.join(home, ".gemini", "settings.json");
39127
- 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");
39128
39251
  if (auth.kind === "api_key") {
39129
39252
  rmIfExists(oauthCreds);
39130
39253
  writeFile0600(settingsJson, '{"security":{"auth":{"selectedType":"gemini-api-key"}}}');
@@ -39137,7 +39260,7 @@ var geminiProvisioner = {
39137
39260
  };
39138
39261
  var cursorProvisioner = {
39139
39262
  write(auth, home) {
39140
- const authJson = path83.join(home, ".config", "cursor", "auth.json");
39263
+ const authJson = path84.join(home, ".config", "cursor", "auth.json");
39141
39264
  if (auth.kind === "api_key") {
39142
39265
  rmIfExists(authJson);
39143
39266
  return { CURSOR_API_KEY: auth.value };
@@ -39179,22 +39302,22 @@ max_context_size = 262144
39179
39302
  var kimiProvisioner = {
39180
39303
  write(auth, home) {
39181
39304
  const credentialsFiles = [
39182
- path83.join(home, ".kimi", "credentials", "kimi-code.json"),
39183
- 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")
39184
39307
  ];
39185
39308
  if (auth.kind === "api_key") {
39186
39309
  credentialsFiles.forEach(rmIfExists);
39187
39310
  return { KIMI_API_KEY: auth.value };
39188
39311
  }
39189
39312
  credentialsFiles.forEach((f) => writeFile0600(f, auth.value));
39190
- 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);
39191
39314
  return {};
39192
39315
  }
39193
39316
  };
39194
39317
  var coderabbitProvisioner = {
39195
39318
  write(auth, home) {
39196
- const dir = path83.join(home, ".coderabbit");
39197
- const authJson = path83.join(dir, "auth.json");
39319
+ const dir = path84.join(home, ".coderabbit");
39320
+ const authJson = path84.join(dir, "auth.json");
39198
39321
  if (auth.kind === "api_key") {
39199
39322
  rmIfExists(authJson);
39200
39323
  return { CODERABBIT_API_KEY: auth.value };
@@ -39206,13 +39329,13 @@ var coderabbitProvisioner = {
39206
39329
  try {
39207
39330
  const parsed = JSON.parse(value);
39208
39331
  if (typeof parsed.file === "string" && typeof parsed.contents === "string") {
39209
- file = path83.basename(parsed.file);
39332
+ file = path84.basename(parsed.file);
39210
39333
  contents = parsed.contents;
39211
39334
  }
39212
39335
  } catch {
39213
39336
  }
39214
39337
  }
39215
- writeFile0600(path83.join(dir, file), contents);
39338
+ writeFile0600(path84.join(dir, file), contents);
39216
39339
  return {};
39217
39340
  }
39218
39341
  };
@@ -39244,7 +39367,7 @@ var UnsupportedAgentError = class extends Error {
39244
39367
  this.agentId = agentId;
39245
39368
  }
39246
39369
  };
39247
- function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os54.homedir()) {
39370
+ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os55.homedir()) {
39248
39371
  const internal = toInternalAgentId(publicAgentId);
39249
39372
  if (!internal) throw new UnsupportedAgentError(publicAgentId);
39250
39373
  const provisioner = PROVISIONERS[internal];
@@ -39253,8 +39376,8 @@ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os54.homedir(
39253
39376
  }
39254
39377
 
39255
39378
  // src/beads/workflow-hint.ts
39256
- var fs74 = __toESM(require("fs"));
39257
- var path84 = __toESM(require("path"));
39379
+ var fs76 = __toESM(require("fs"));
39380
+ var path85 = __toESM(require("path"));
39258
39381
  var BEADS_HINT_MARKER = "<!-- codeam:beads-workflow -->";
39259
39382
  var BEADS_HINT = `${BEADS_HINT_MARKER}
39260
39383
  # Beads (bd) \u2014 task tracking + persistent memory (ALWAYS use it)
@@ -39281,11 +39404,11 @@ function ensureBeadsWorkflowHint(homeDir2, file = claudeMemoryFile(homeDir2)) {
39281
39404
  try {
39282
39405
  let existing = "";
39283
39406
  try {
39284
- existing = fs74.readFileSync(file, "utf8");
39407
+ existing = fs76.readFileSync(file, "utf8");
39285
39408
  } catch {
39286
39409
  }
39287
39410
  if (existing.includes(BEADS_HINT)) return;
39288
- fs74.mkdirSync(path84.dirname(file), { recursive: true });
39411
+ fs76.mkdirSync(path85.dirname(file), { recursive: true });
39289
39412
  let next;
39290
39413
  const open = existing.indexOf(BEADS_HINT_MARKER);
39291
39414
  const close = open === -1 ? -1 : existing.indexOf(BEADS_HINT_MARKER, open + BEADS_HINT_MARKER.length);
@@ -39298,40 +39421,40 @@ ${BEADS_HINT}
39298
39421
  ` : `${BEADS_HINT}
39299
39422
  `;
39300
39423
  }
39301
- fs74.writeFileSync(file, next);
39424
+ fs76.writeFileSync(file, next);
39302
39425
  } catch {
39303
39426
  }
39304
39427
  }
39305
39428
 
39306
39429
  // src/agents/agent-standard.ts
39307
- var fs75 = __toESM(require("fs"));
39308
- var path85 = __toESM(require("path"));
39309
- var os55 = __toESM(require("os"));
39430
+ var fs77 = __toESM(require("fs"));
39431
+ var path86 = __toESM(require("path"));
39432
+ var os56 = __toESM(require("os"));
39310
39433
  function ensureAgentStandard(homeDir2, file = claudeMemoryFile(homeDir2)) {
39311
39434
  try {
39312
39435
  let existing = "";
39313
39436
  try {
39314
- existing = fs75.readFileSync(file, "utf8");
39437
+ existing = fs77.readFileSync(file, "utf8");
39315
39438
  } catch {
39316
39439
  }
39317
39440
  if (existing.includes(AGENT_STANDARD_MARKER)) return;
39318
- fs75.mkdirSync(path85.dirname(file), { recursive: true });
39441
+ fs77.mkdirSync(path86.dirname(file), { recursive: true });
39319
39442
  const next = existing.trim() ? `${existing.trimEnd()}
39320
39443
 
39321
39444
  ${AGENT_STANDARD_BLOCK}
39322
39445
  ` : `${AGENT_STANDARD_BLOCK}
39323
39446
  `;
39324
- fs75.writeFileSync(file, next);
39447
+ fs77.writeFileSync(file, next);
39325
39448
  } catch {
39326
39449
  }
39327
39450
  }
39328
39451
  var _agentStandardSeam = {
39329
39452
  isLocalSession: () => isLocalSession(),
39330
- markerPath: (sessionId) => path85.join(os55.homedir(), ".codeam", "agent-standard", `${sessionId}.done`),
39331
- exists: (p2) => fs75.existsSync(p2),
39453
+ markerPath: (sessionId) => path86.join(os56.homedir(), ".codeam", "agent-standard", `${sessionId}.done`),
39454
+ exists: (p2) => fs77.existsSync(p2),
39332
39455
  write: (p2) => {
39333
- fs75.mkdirSync(path85.dirname(p2), { recursive: true });
39334
- fs75.writeFileSync(p2, "");
39456
+ fs77.mkdirSync(path86.dirname(p2), { recursive: true });
39457
+ fs77.writeFileSync(p2, "");
39335
39458
  }
39336
39459
  };
39337
39460
  function isClaude(agent) {
@@ -40192,15 +40315,15 @@ function withholdTrailingPartialFenceMarker(text) {
40192
40315
 
40193
40316
  // src/agents/acp/onboarding.ts
40194
40317
  var import_child_process28 = require("child_process");
40195
- var fs77 = __toESM(require("fs"));
40196
- var os56 = __toESM(require("os"));
40197
- var path87 = __toESM(require("path"));
40318
+ var fs79 = __toESM(require("fs"));
40319
+ var os57 = __toESM(require("os"));
40320
+ var path88 = __toESM(require("path"));
40198
40321
  var _onboardingSeam = {
40199
- markerPath: (sessionId) => path87.join(os56.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
40200
- exists: (p2) => fs77.existsSync(p2),
40322
+ markerPath: (sessionId) => path88.join(os57.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
40323
+ exists: (p2) => fs79.existsSync(p2),
40201
40324
  write: (p2) => {
40202
- fs77.mkdirSync(path87.dirname(p2), { recursive: true });
40203
- fs77.writeFileSync(p2, "");
40325
+ fs79.mkdirSync(path88.dirname(p2), { recursive: true });
40326
+ fs79.writeFileSync(p2, "");
40204
40327
  },
40205
40328
  disabled: () => {
40206
40329
  const v = process.env.CODEAM_ONBOARDING_DISABLED;
@@ -40237,7 +40360,7 @@ function resolveRepoName(cwd) {
40237
40360
  if (name) return name;
40238
40361
  }
40239
40362
  }
40240
- const base = path87.basename(cwd || "");
40363
+ const base = path88.basename(cwd || "");
40241
40364
  if (base && !isUuid(base)) return base;
40242
40365
  return "this project";
40243
40366
  }
@@ -40637,14 +40760,14 @@ var import_crypto5 = require("crypto");
40637
40760
 
40638
40761
  // src/services/turn-files/git-changeset.ts
40639
40762
  var import_child_process29 = require("child_process");
40640
- var fs79 = __toESM(require("fs/promises"));
40763
+ var fs81 = __toESM(require("fs/promises"));
40641
40764
  var import_fs10 = require("fs");
40642
- var path89 = __toESM(require("path"));
40765
+ var path90 = __toESM(require("path"));
40643
40766
 
40644
40767
  // src/services/turn-files/review-ignore.ts
40645
40768
  var import_ignore2 = __toESM(require("ignore"));
40646
- var fs78 = __toESM(require("fs"));
40647
- var path88 = __toESM(require("path"));
40769
+ var fs80 = __toESM(require("fs"));
40770
+ var path89 = __toESM(require("path"));
40648
40771
  var CURATED_REVIEW_IGNORE = [
40649
40772
  // Google Cloud SDK (the incident) — installs a huge python tree.
40650
40773
  "google-cloud-sdk/",
@@ -40688,7 +40811,7 @@ var CURATED_REVIEW_IGNORE = [
40688
40811
  function makeReviewIgnore(repoRoot) {
40689
40812
  const ig = (0, import_ignore2.default)().add(CURATED_REVIEW_IGNORE);
40690
40813
  try {
40691
- const custom = fs78.readFileSync(path88.join(repoRoot, ".codeam", "reviewignore"), "utf8");
40814
+ const custom = fs80.readFileSync(path89.join(repoRoot, ".codeam", "reviewignore"), "utf8");
40692
40815
  ig.add(custom);
40693
40816
  } catch {
40694
40817
  }
@@ -40723,7 +40846,7 @@ async function collectRepoChangeset(opts) {
40723
40846
  const rows = parseStatus(status2).filter(
40724
40847
  (row) => !isIgnoredFilePath(row.filePath) && !reviewIgnore(row.filePath) && // A socket, FIFO or device node is never a change to review (a
40725
40848
  // `cc-socks/1522.sock` reached the Files tab).
40726
- isReviewablePath(path89.join(opts.repoRoot, row.filePath))
40849
+ isReviewablePath(path90.join(opts.repoRoot, row.filePath))
40727
40850
  );
40728
40851
  const MAX_CHANGESET_FILES = Math.max(1, Number(process.env.CODEAM_MAX_CHANGESET_FILES ?? 500));
40729
40852
  const truncated = rows.length > MAX_CHANGESET_FILES;
@@ -40740,7 +40863,7 @@ async function collectRepoChangeset(opts) {
40740
40863
  let stats;
40741
40864
  if (!truncated && row.fileStatus === "added" && numstatEntry === void 0) {
40742
40865
  const lineCount = await readUntrackedLineCount(
40743
- path89.join(opts.repoRoot, row.filePath)
40866
+ path90.join(opts.repoRoot, row.filePath)
40744
40867
  );
40745
40868
  stats = { added: lineCount, removed: 0 };
40746
40869
  } else {
@@ -40771,7 +40894,7 @@ function readUntrackedLineCount(absPath) {
40771
40894
  }
40772
40895
  async function defaultReadUntrackedLineCount(absPath) {
40773
40896
  try {
40774
- const content = await fs79.readFile(absPath, "utf8");
40897
+ const content = await fs81.readFile(absPath, "utf8");
40775
40898
  let count = 0;
40776
40899
  let pos = -1;
40777
40900
  while ((pos = content.indexOf("\n", pos + 1)) !== -1) {
@@ -40863,7 +40986,7 @@ function defaultRunGit(cwd, args2) {
40863
40986
  });
40864
40987
  }
40865
40988
  async function discoverRepos(workingDir, maxDepth = 4) {
40866
- const fs102 = await import("fs/promises");
40989
+ const fs104 = await import("fs/promises");
40867
40990
  const out2 = [];
40868
40991
  await walk2(workingDir, 0);
40869
40992
  return out2;
@@ -40871,7 +40994,7 @@ async function discoverRepos(workingDir, maxDepth = 4) {
40871
40994
  if (depth2 > maxDepth) return;
40872
40995
  let entries2 = [];
40873
40996
  try {
40874
- const dirents = await fs102.readdir(dir, { withFileTypes: true });
40997
+ const dirents = await fs104.readdir(dir, { withFileTypes: true });
40875
40998
  entries2 = dirents.filter((d3) => !d3.name.startsWith(".") || d3.name === ".git").map((d3) => ({ name: d3.name, isDirectory: d3.isDirectory() }));
40876
40999
  } catch {
40877
41000
  return;
@@ -40882,8 +41005,8 @@ async function discoverRepos(workingDir, maxDepth = 4) {
40882
41005
  if (hasGit) {
40883
41006
  out2.push({
40884
41007
  repoRoot: dir,
40885
- repoPath: path89.relative(workingDir, dir),
40886
- repoName: path89.basename(dir)
41008
+ repoPath: path90.relative(workingDir, dir),
41009
+ repoName: path90.basename(dir)
40887
41010
  });
40888
41011
  return;
40889
41012
  }
@@ -40891,7 +41014,7 @@ async function discoverRepos(workingDir, maxDepth = 4) {
40891
41014
  if (!entry.isDirectory) continue;
40892
41015
  if (entry.name === "node_modules") continue;
40893
41016
  if (entry.name === "dist" || entry.name === "build") continue;
40894
- await walk2(path89.join(dir, entry.name), depth2 + 1);
41017
+ await walk2(path90.join(dir, entry.name), depth2 + 1);
40895
41018
  }
40896
41019
  }
40897
41020
  }
@@ -40905,8 +41028,8 @@ function isReviewablePath(absPath) {
40905
41028
  }
40906
41029
 
40907
41030
  // src/services/turn-files/files-outbox.ts
40908
- var fs80 = __toESM(require("fs/promises"));
40909
- var path90 = __toESM(require("path"));
41031
+ var fs82 = __toESM(require("fs/promises"));
41032
+ var path91 = __toESM(require("path"));
40910
41033
  var import_os14 = require("os");
40911
41034
  var HOME_OUTBOX_DIR = ".codeam/outbox";
40912
41035
  var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
@@ -40939,16 +41062,16 @@ var FilesOutbox = class {
40939
41062
  backoffIndex = 0;
40940
41063
  stopped = false;
40941
41064
  constructor(opts) {
40942
- const base = opts.baseDir ?? path90.join(homeDir(), HOME_OUTBOX_DIR);
40943
- 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`);
40944
41067
  this.post = opts.post;
40945
41068
  this.autoSchedule = opts.autoSchedule !== false;
40946
41069
  }
40947
41070
  /** Persist the entry to disk and trigger a flush. Returns once the
40948
41071
  * line is durable on disk (not once the POST succeeds). */
40949
41072
  async enqueue(entry) {
40950
- await fs80.mkdir(path90.dirname(this.filePath), { recursive: true });
40951
- await fs80.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");
40952
41075
  this.backoffIndex = 0;
40953
41076
  if (this.autoSchedule) this.scheduleFlush(0);
40954
41077
  }
@@ -41039,7 +41162,7 @@ var FilesOutbox = class {
41039
41162
  async readAll() {
41040
41163
  let raw = "";
41041
41164
  try {
41042
- raw = await fs80.readFile(this.filePath, "utf8");
41165
+ raw = await fs82.readFile(this.filePath, "utf8");
41043
41166
  } catch {
41044
41167
  return [];
41045
41168
  }
@@ -41063,12 +41186,12 @@ var FilesOutbox = class {
41063
41186
  async rewrite(entries2) {
41064
41187
  const tmpPath = `${this.filePath}.${process.pid}.tmp`;
41065
41188
  if (entries2.length === 0) {
41066
- await fs80.unlink(this.filePath).catch(() => void 0);
41189
+ await fs82.unlink(this.filePath).catch(() => void 0);
41067
41190
  return;
41068
41191
  }
41069
41192
  const payload = entries2.map((e) => JSON.stringify(e)).join("\n") + "\n";
41070
- await fs80.writeFile(tmpPath, payload, "utf8");
41071
- await fs80.rename(tmpPath, this.filePath);
41193
+ await fs82.writeFile(tmpPath, payload, "utf8");
41194
+ await fs82.rename(tmpPath, this.filePath);
41072
41195
  }
41073
41196
  };
41074
41197
  function applyJitter(ms) {
@@ -41438,8 +41561,8 @@ async function readActiveConversationMarker(cwd, homeDir2) {
41438
41561
 
41439
41562
  // src/packs/gates.ts
41440
41563
  var import_node_child_process29 = require("child_process");
41441
- var fs82 = __toESM(require("fs"));
41442
- var path92 = __toESM(require("path"));
41564
+ var fs84 = __toESM(require("fs"));
41565
+ var path93 = __toESM(require("path"));
41443
41566
  var defaultCommandRunner = (file, args2, cwd, timeoutMs, env) => new Promise((resolve13) => {
41444
41567
  (0, import_node_child_process29.execFile)(
41445
41568
  file,
@@ -41489,7 +41612,7 @@ async function changedFiles(run3, cwd, from, to) {
41489
41612
  }
41490
41613
  function readWorkspaceFile(cwd, relPath) {
41491
41614
  try {
41492
- return fs82.readFileSync(path92.join(cwd, relPath), "utf8");
41615
+ return fs84.readFileSync(path93.join(cwd, relPath), "utf8");
41493
41616
  } catch {
41494
41617
  return null;
41495
41618
  }
@@ -41498,14 +41621,14 @@ var NO_TEST_PLACEHOLDER = 'echo "Error: no test specified"';
41498
41621
  var CHECKS_TIMEOUT_MS = 5 * 6e4;
41499
41622
  function detectChecksCommand(cwd) {
41500
41623
  try {
41501
- const cfg = JSON.parse(fs82.readFileSync(path92.join(cwd, ".codeam", "pack.json"), "utf8"));
41624
+ const cfg = JSON.parse(fs84.readFileSync(path93.join(cwd, ".codeam", "pack.json"), "utf8"));
41502
41625
  if (typeof cfg.checksCommand === "string" && cfg.checksCommand.trim().length > 0) {
41503
41626
  return cfg.checksCommand.trim();
41504
41627
  }
41505
41628
  } catch {
41506
41629
  }
41507
41630
  try {
41508
- const pkg = JSON.parse(fs82.readFileSync(path92.join(cwd, "package.json"), "utf8"));
41631
+ const pkg = JSON.parse(fs84.readFileSync(path93.join(cwd, "package.json"), "utf8"));
41509
41632
  const test = pkg.scripts?.test;
41510
41633
  if (typeof test === "string" && test.trim().length > 0 && !test.includes(NO_TEST_PLACEHOLDER)) {
41511
41634
  return "npm test";
@@ -41523,39 +41646,39 @@ ${res.stderr}`.trim();
41523
41646
  }
41524
41647
 
41525
41648
  // src/packs/run-store.ts
41526
- var fs83 = __toESM(require("fs"));
41527
- var path93 = __toESM(require("path"));
41649
+ var fs85 = __toESM(require("fs"));
41650
+ var path94 = __toESM(require("path"));
41528
41651
  var crypto5 = __toESM(require("crypto"));
41529
41652
  function packsDir(cwd) {
41530
- return path93.join(cwd, ".codeam", "packs");
41653
+ return path94.join(cwd, ".codeam", "packs");
41531
41654
  }
41532
41655
  function runDir(cwd, runId) {
41533
- return path93.join(packsDir(cwd), runId);
41656
+ return path94.join(packsDir(cwd), runId);
41534
41657
  }
41535
41658
  function newRunId() {
41536
41659
  return `pk_${Date.now().toString(36)}_${crypto5.randomBytes(4).toString("hex")}`;
41537
41660
  }
41538
41661
  function writeJsonAtomic(file, value) {
41539
- fs83.mkdirSync(path93.dirname(file), { recursive: true });
41662
+ fs85.mkdirSync(path94.dirname(file), { recursive: true });
41540
41663
  const tmp = `${file}.tmp`;
41541
- fs83.writeFileSync(tmp, JSON.stringify(value, null, 2));
41542
- fs83.renameSync(tmp, file);
41664
+ fs85.writeFileSync(tmp, JSON.stringify(value, null, 2));
41665
+ fs85.renameSync(tmp, file);
41543
41666
  }
41544
41667
  function saveRun(cwd, state) {
41545
- writeJsonAtomic(path93.join(runDir(cwd, state.runId), "run.json"), state);
41668
+ writeJsonAtomic(path94.join(runDir(cwd, state.runId), "run.json"), state);
41546
41669
  }
41547
41670
  function saveStageHandoff(cwd, runId, stageIndex, role, handoff) {
41548
41671
  const name = `${String(stageIndex + 1).padStart(2, "0")}-${role}.json`;
41549
- writeJsonAtomic(path93.join(runDir(cwd, runId), name), handoff);
41672
+ writeJsonAtomic(path94.join(runDir(cwd, runId), name), handoff);
41550
41673
  }
41551
41674
  function loadLatestRun(cwd) {
41552
41675
  try {
41553
41676
  const dir = packsDir(cwd);
41554
- const entries2 = fs83.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();
41555
41678
  for (let i = entries2.length - 1; i >= 0; i--) {
41556
- const file = path93.join(dir, entries2[i], "run.json");
41679
+ const file = path94.join(dir, entries2[i], "run.json");
41557
41680
  try {
41558
- const parsed = JSON.parse(fs83.readFileSync(file, "utf8"));
41681
+ const parsed = JSON.parse(fs85.readFileSync(file, "utf8"));
41559
41682
  if (parsed && typeof parsed.runId === "string") return parsed;
41560
41683
  } catch {
41561
41684
  }
@@ -41566,17 +41689,17 @@ function loadLatestRun(cwd) {
41566
41689
  }
41567
41690
  function ensureLedgerIgnored(cwd) {
41568
41691
  try {
41569
- const gitDir = path93.join(cwd, ".git");
41570
- if (!fs83.existsSync(gitDir)) return;
41571
- 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");
41572
41695
  let existing = "";
41573
41696
  try {
41574
- existing = fs83.readFileSync(exclude, "utf8");
41697
+ existing = fs85.readFileSync(exclude, "utf8");
41575
41698
  } catch {
41576
41699
  }
41577
41700
  if (existing.includes(".codeam/packs/")) return;
41578
- fs83.mkdirSync(path93.dirname(exclude), { recursive: true });
41579
- fs83.writeFileSync(exclude, `${existing.trimEnd()}
41701
+ fs85.mkdirSync(path94.dirname(exclude), { recursive: true });
41702
+ fs85.writeFileSync(exclude, `${existing.trimEnd()}
41580
41703
  .codeam/packs/
41581
41704
  `.trimStart());
41582
41705
  } catch {
@@ -42571,20 +42694,20 @@ async function mcpRouter() {
42571
42694
  }
42572
42695
 
42573
42696
  // src/integrations/mcp-secrets.ts
42574
- var fs85 = __toESM(require("fs"));
42575
- var os59 = __toESM(require("os"));
42576
- var path95 = __toESM(require("path"));
42697
+ var fs87 = __toESM(require("fs"));
42698
+ var os60 = __toESM(require("os"));
42699
+ var path96 = __toESM(require("path"));
42577
42700
  var MCP_SECRETS_FILE_ENV = "CODEAM_MCP_SECRETS_FILE";
42578
42701
  function mcpSecretsDir() {
42579
- return path95.join(os59.homedir(), ".codeam", "mcp-secrets");
42702
+ return path96.join(os60.homedir(), ".codeam", "mcp-secrets");
42580
42703
  }
42581
42704
  function mcpSecretsPath(scope, pid = process.pid) {
42582
- return path95.join(mcpSecretsDir(), `${pid}-${scope}.json`);
42705
+ return path96.join(mcpSecretsDir(), `${pid}-${scope}.json`);
42583
42706
  }
42584
42707
  var registeredForCleanup = /* @__PURE__ */ new Set();
42585
42708
  function readFileVars(file) {
42586
42709
  try {
42587
- const parsed = JSON.parse(fs85.readFileSync(file, "utf8"));
42710
+ const parsed = JSON.parse(fs87.readFileSync(file, "utf8"));
42588
42711
  if (!parsed || typeof parsed !== "object") return {};
42589
42712
  const out2 = {};
42590
42713
  for (const [k2, v] of Object.entries(parsed)) {
@@ -42606,7 +42729,7 @@ function pidAlive2(pid) {
42606
42729
  function pruneStale(dir) {
42607
42730
  let names = [];
42608
42731
  try {
42609
- names = fs85.readdirSync(dir);
42732
+ names = fs87.readdirSync(dir);
42610
42733
  } catch {
42611
42734
  return;
42612
42735
  }
@@ -42616,25 +42739,25 @@ function pruneStale(dir) {
42616
42739
  const pid = Number(m[1]);
42617
42740
  if (pid === process.pid || pidAlive2(pid)) continue;
42618
42741
  try {
42619
- fs85.unlinkSync(path95.join(dir, name));
42742
+ fs87.unlinkSync(path96.join(dir, name));
42620
42743
  } catch {
42621
42744
  }
42622
42745
  }
42623
42746
  }
42624
42747
  function writeMcpSecrets(vars, file) {
42625
42748
  try {
42626
- const dir = path95.dirname(file);
42627
- fs85.mkdirSync(dir, { recursive: true, mode: 448 });
42749
+ const dir = path96.dirname(file);
42750
+ fs87.mkdirSync(dir, { recursive: true, mode: 448 });
42628
42751
  pruneStale(dir);
42629
42752
  const tmp = `${file}.${process.pid}.tmp`;
42630
- fs85.writeFileSync(tmp, JSON.stringify(vars), { mode: 384 });
42631
- fs85.renameSync(tmp, file);
42632
- fs85.chmodSync(file, 384);
42753
+ fs87.writeFileSync(tmp, JSON.stringify(vars), { mode: 384 });
42754
+ fs87.renameSync(tmp, file);
42755
+ fs87.chmodSync(file, 384);
42633
42756
  if (!registeredForCleanup.has(file)) {
42634
42757
  registeredForCleanup.add(file);
42635
42758
  process.once("exit", () => {
42636
42759
  try {
42637
- fs85.unlinkSync(file);
42760
+ fs87.unlinkSync(file);
42638
42761
  } catch {
42639
42762
  }
42640
42763
  });
@@ -42724,11 +42847,11 @@ function previewMcpServer(bridge) {
42724
42847
  };
42725
42848
  }
42726
42849
  function httpCall(baseUrl, token) {
42727
- return async (path116, method, body, timeoutMs) => {
42850
+ return async (path117, method, body, timeoutMs) => {
42728
42851
  const ac = new AbortController();
42729
42852
  const timer = setTimeout(() => ac.abort(), timeoutMs);
42730
42853
  try {
42731
- const res = await fetch(`${baseUrl}${path116}`, {
42854
+ const res = await fetch(`${baseUrl}${path117}`, {
42732
42855
  method,
42733
42856
  headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
42734
42857
  ...method === "POST" ? { body: JSON.stringify(body ?? {}) } : {},
@@ -42865,11 +42988,11 @@ function scratchMcpServer(bridge) {
42865
42988
  };
42866
42989
  }
42867
42990
  function httpCall2(baseUrl, token) {
42868
- return async (path116, method, body, timeoutMs) => {
42991
+ return async (path117, method, body, timeoutMs) => {
42869
42992
  const ac = new AbortController();
42870
42993
  const timer = setTimeout(() => ac.abort(), timeoutMs);
42871
42994
  try {
42872
- const res = await fetch(`${baseUrl}${path116}`, {
42995
+ const res = await fetch(`${baseUrl}${path117}`, {
42873
42996
  method,
42874
42997
  headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
42875
42998
  ...method === "POST" ? { body: JSON.stringify(body ?? {}) } : {},
@@ -45978,17 +46101,17 @@ async function runAcpSession(opts) {
45978
46101
  switchCredentialEnv = provisionAgentCredentials(agentId, auth);
45979
46102
  },
45980
46103
  provisionHouseProxy: ({ baseUrl, token, model, managedAgentId }) => {
45981
- const claudeConfigDir2 = path98.join(
45982
- os61.homedir(),
46104
+ const claudeConfigDir2 = path99.join(
46105
+ os62.homedir(),
45983
46106
  ".codeam",
45984
46107
  "house-claude",
45985
46108
  `switch-${opts.pluginId}`
45986
46109
  );
45987
46110
  try {
45988
- fs88.mkdirSync(claudeConfigDir2, { recursive: true, mode: 448 });
46111
+ fs90.mkdirSync(claudeConfigDir2, { recursive: true, mode: 448 });
45989
46112
  } catch {
45990
46113
  }
45991
- const memoryFile = path98.join(claudeConfigDir2, "CLAUDE.md");
46114
+ const memoryFile = path99.join(claudeConfigDir2, "CLAUDE.md");
45992
46115
  ensureBeadsWorkflowHint(void 0, memoryFile);
45993
46116
  ensureAgentStandard(void 0, memoryFile);
45994
46117
  if (isScratchWorkspace(process.cwd())) ensureScratchWorkflowHint(void 0, memoryFile);
@@ -47228,9 +47351,9 @@ function pickPinnedSession(pinnedId, listSessions2) {
47228
47351
  }
47229
47352
 
47230
47353
  // src/agents/retired-proxy-cleanup.ts
47231
- var fs89 = __toESM(require("fs"));
47232
- var path99 = __toESM(require("path"));
47233
- var os62 = __toESM(require("os"));
47354
+ var fs91 = __toESM(require("fs"));
47355
+ var path100 = __toESM(require("path"));
47356
+ var os63 = __toESM(require("os"));
47234
47357
  var RETIRED_PROXY_RE = /^https?:\/\/(?:127\.0\.0\.1|localhost|\[::1\]):8787(?:[/?#]|$)/i;
47235
47358
  var HEADROOM_CMD_RE = /(^|[\s/"'])headroom(\s|$)/i;
47236
47359
  var MARKETPLACE_KEY = "headroom-marketplace";
@@ -47239,12 +47362,12 @@ function isHeadroomHook(group) {
47239
47362
  (h) => typeof h?.command === "string" && HEADROOM_CMD_RE.test(h.command)
47240
47363
  );
47241
47364
  }
47242
- function sanitizeRetiredProxyConfig(homeDir2 = os62.homedir()) {
47365
+ function sanitizeRetiredProxyConfig(homeDir2 = os63.homedir()) {
47243
47366
  const out2 = { inspected: false, changed: false, removed: [] };
47244
- const file = path99.join(homeDir2, ".claude", "settings.json");
47367
+ const file = path100.join(homeDir2, ".claude", "settings.json");
47245
47368
  let parsed;
47246
47369
  try {
47247
- parsed = JSON.parse(fs89.readFileSync(file, "utf8"));
47370
+ parsed = JSON.parse(fs91.readFileSync(file, "utf8"));
47248
47371
  } catch {
47249
47372
  return out2;
47250
47373
  }
@@ -47286,9 +47409,9 @@ function sanitizeRetiredProxyConfig(homeDir2 = os62.homedir()) {
47286
47409
  if (!out2.changed) return out2;
47287
47410
  try {
47288
47411
  const tmp = `${file}.codeam.tmp`;
47289
- fs89.writeFileSync(tmp, `${JSON.stringify(parsed, null, 2)}
47412
+ fs91.writeFileSync(tmp, `${JSON.stringify(parsed, null, 2)}
47290
47413
  `, { mode: 384 });
47291
- fs89.renameSync(tmp, file);
47414
+ fs91.renameSync(tmp, file);
47292
47415
  } catch {
47293
47416
  out2.changed = false;
47294
47417
  }
@@ -47834,7 +47957,7 @@ var AcpDriver = class {
47834
47957
  };
47835
47958
 
47836
47959
  // src/baton/transcript-mirror.ts
47837
- var fs90 = __toESM(require("fs"));
47960
+ var fs92 = __toESM(require("fs"));
47838
47961
  var TranscriptMirror = class {
47839
47962
  constructor(deps) {
47840
47963
  this.deps = deps;
@@ -47928,7 +48051,7 @@ var TranscriptMirror = class {
47928
48051
  }
47929
48052
  };
47930
48053
  function defaultWatch(file, onChange) {
47931
- const w3 = fs90.watch(file, { persistent: false }, () => onChange());
48054
+ const w3 = fs92.watch(file, { persistent: false }, () => onChange());
47932
48055
  return () => w3.close();
47933
48056
  }
47934
48057
 
@@ -48428,16 +48551,16 @@ function keepDeviceAwake(deps = {}) {
48428
48551
  }
48429
48552
 
48430
48553
  // src/agents/claude/onboarding.ts
48431
- var fs91 = __toESM(require("fs"));
48432
- var os64 = __toESM(require("os"));
48433
- var path100 = __toESM(require("path"));
48554
+ var fs93 = __toESM(require("fs"));
48555
+ var os65 = __toESM(require("os"));
48556
+ var path101 = __toESM(require("path"));
48434
48557
  var ONBOARDING_VERSION_SENTINEL = "9999.0.0";
48435
48558
  function ensureClaudeOnboarded(cwd) {
48436
48559
  try {
48437
- const file = path100.join(os64.homedir(), ".claude.json");
48560
+ const file = path101.join(os65.homedir(), ".claude.json");
48438
48561
  let config = {};
48439
48562
  try {
48440
- config = JSON.parse(fs91.readFileSync(file, "utf8"));
48563
+ config = JSON.parse(fs93.readFileSync(file, "utf8"));
48441
48564
  } catch {
48442
48565
  }
48443
48566
  let changed = false;
@@ -48462,8 +48585,8 @@ function ensureClaudeOnboarded(cwd) {
48462
48585
  }
48463
48586
  }
48464
48587
  if (!changed) return;
48465
- fs91.mkdirSync(path100.dirname(file), { recursive: true });
48466
- fs91.writeFileSync(file, JSON.stringify(config, null, 2));
48588
+ fs93.mkdirSync(path101.dirname(file), { recursive: true });
48589
+ fs93.writeFileSync(file, JSON.stringify(config, null, 2));
48467
48590
  log.info(
48468
48591
  "claude",
48469
48592
  `pre-completed Claude onboarding${cwd ? ` + trusted workspace ${cwd}` : ""}`
@@ -49335,7 +49458,7 @@ var import_picocolors10 = __toESM(require("picocolors"));
49335
49458
  var import_child_process30 = require("child_process");
49336
49459
  var import_util4 = require("util");
49337
49460
  var import_picocolors8 = __toESM(require("picocolors"));
49338
- var path101 = __toESM(require("path"));
49461
+ var path102 = __toESM(require("path"));
49339
49462
  var execFileP6 = (0, import_util4.promisify)(import_child_process30.execFile);
49340
49463
  var MAX_BUFFER = 8 * 1024 * 1024;
49341
49464
  function resetStdinForChild() {
@@ -49824,7 +49947,7 @@ var GitHubCodespacesProvider = class {
49824
49947
  });
49825
49948
  }
49826
49949
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
49827
- const remoteDir = path101.posix.dirname(remotePath);
49950
+ const remoteDir = path102.posix.dirname(remotePath);
49828
49951
  const parts = [
49829
49952
  `mkdir -p ${shellQuote(remoteDir)}`,
49830
49953
  `cat > ${shellQuote(remotePath)}`
@@ -49894,7 +50017,7 @@ function shellQuote(s) {
49894
50017
  // src/services/providers/gitpod.ts
49895
50018
  var import_child_process31 = require("child_process");
49896
50019
  var import_util5 = require("util");
49897
- var path102 = __toESM(require("path"));
50020
+ var path103 = __toESM(require("path"));
49898
50021
  var import_picocolors9 = __toESM(require("picocolors"));
49899
50022
  var execFileP7 = (0, import_util5.promisify)(import_child_process31.execFile);
49900
50023
  var MAX_BUFFER2 = 8 * 1024 * 1024;
@@ -50134,7 +50257,7 @@ var GitpodProvider = class {
50134
50257
  });
50135
50258
  }
50136
50259
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
50137
- const remoteDir = path102.posix.dirname(remotePath);
50260
+ const remoteDir = path103.posix.dirname(remotePath);
50138
50261
  const parts = [
50139
50262
  `mkdir -p ${shellQuote2(remoteDir)}`,
50140
50263
  `cat > ${shellQuote2(remotePath)}`
@@ -50170,7 +50293,7 @@ function shellQuote2(s) {
50170
50293
  // src/services/providers/gitlab-workspaces.ts
50171
50294
  var import_child_process32 = require("child_process");
50172
50295
  var import_util6 = require("util");
50173
- var path103 = __toESM(require("path"));
50296
+ var path104 = __toESM(require("path"));
50174
50297
  var execFileP8 = (0, import_util6.promisify)(import_child_process32.execFile);
50175
50298
  var MAX_BUFFER3 = 8 * 1024 * 1024;
50176
50299
  var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
@@ -50430,7 +50553,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
50430
50553
  }
50431
50554
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
50432
50555
  const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
50433
- const remoteDir = path103.posix.dirname(remotePath);
50556
+ const remoteDir = path104.posix.dirname(remotePath);
50434
50557
  const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
50435
50558
  if (options.mode != null) {
50436
50559
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
@@ -50498,7 +50621,7 @@ function shellQuote3(s) {
50498
50621
  // src/services/providers/railway.ts
50499
50622
  var import_child_process33 = require("child_process");
50500
50623
  var import_util7 = require("util");
50501
- var path104 = __toESM(require("path"));
50624
+ var path105 = __toESM(require("path"));
50502
50625
  var execFileP9 = (0, import_util7.promisify)(import_child_process33.execFile);
50503
50626
  var MAX_BUFFER4 = 8 * 1024 * 1024;
50504
50627
  function resetStdinForChild4() {
@@ -50734,7 +50857,7 @@ var RailwayProvider = class {
50734
50857
  if (!projectId || !serviceId) {
50735
50858
  throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
50736
50859
  }
50737
- const remoteDir = path104.posix.dirname(remotePath);
50860
+ const remoteDir = path105.posix.dirname(remotePath);
50738
50861
  const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
50739
50862
  if (options.mode != null) {
50740
50863
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
@@ -51274,14 +51397,14 @@ async function stopWorkspaceFromLocal(target) {
51274
51397
  }
51275
51398
 
51276
51399
  // src/commands/host/host-client.ts
51277
- var fs92 = __toESM(require("fs"));
51278
- var os65 = __toESM(require("os"));
51279
- var path105 = __toESM(require("path"));
51400
+ var fs94 = __toESM(require("fs"));
51401
+ var os66 = __toESM(require("os"));
51402
+ var path106 = __toESM(require("path"));
51280
51403
  var import_node_crypto16 = require("crypto");
51281
51404
  function sampleCpuTimes() {
51282
51405
  let idle = 0;
51283
51406
  let total = 0;
51284
- for (const cpu of os65.cpus()) {
51407
+ for (const cpu of os66.cpus()) {
51285
51408
  const t2 = cpu.times;
51286
51409
  idle += t2.idle;
51287
51410
  total += t2.user + t2.nice + t2.sys + t2.idle + t2.irq;
@@ -51301,8 +51424,8 @@ var MetricsCollector = class {
51301
51424
  const prev = this.prevCpu;
51302
51425
  this.prevCpu = current2;
51303
51426
  if (!prev) {
51304
- const cores = os65.cpus().length || 1;
51305
- const proxy = os65.loadavg()[0] / cores * 100;
51427
+ const cores = os66.cpus().length || 1;
51428
+ const proxy = os66.loadavg()[0] / cores * 100;
51306
51429
  return Math.min(100, Math.max(0, Math.round(proxy)));
51307
51430
  }
51308
51431
  const idleDelta = current2.idle - prev.idle;
@@ -51315,8 +51438,8 @@ var MetricsCollector = class {
51315
51438
  collect() {
51316
51439
  return {
51317
51440
  cpuPct: this.cpuPct(),
51318
- ramUsedMb: Math.round((os65.totalmem() - os65.freemem()) / 1048576),
51319
- ramTotalMb: Math.round(os65.totalmem() / 1048576),
51441
+ ramUsedMb: Math.round((os66.totalmem() - os66.freemem()) / 1048576),
51442
+ ramTotalMb: Math.round(os66.totalmem() / 1048576),
51320
51443
  latencyMs: this.lastLatencyMs
51321
51444
  };
51322
51445
  }
@@ -51328,19 +51451,19 @@ function apiBase() {
51328
51451
  return process.env.CODEAM_API_URL ?? resolveApiBaseUrl();
51329
51452
  }
51330
51453
  function hostIdentityPath() {
51331
- return path105.join(os65.homedir(), ".codeam", "host-agent.json");
51454
+ return path106.join(os66.homedir(), ".codeam", "host-agent.json");
51332
51455
  }
51333
51456
  function collectOsInfo() {
51334
51457
  return {
51335
- distro: os65.platform(),
51336
- arch: os65.arch(),
51337
- kernel: os65.release(),
51458
+ distro: os66.platform(),
51459
+ arch: os66.arch(),
51460
+ kernel: os66.release(),
51338
51461
  nodeVersion: process.versions.node
51339
51462
  };
51340
51463
  }
51341
51464
  function loadHostIdentity() {
51342
51465
  try {
51343
- const raw = fs92.readFileSync(hostIdentityPath(), "utf8");
51466
+ const raw = fs94.readFileSync(hostIdentityPath(), "utf8");
51344
51467
  const parsed = JSON.parse(raw);
51345
51468
  if (typeof parsed === "object" && parsed !== null && typeof parsed.hostId === "string" && typeof parsed.hostToken === "string" && typeof parsed.controlPluginId === "string") {
51346
51469
  const p2 = parsed;
@@ -51369,8 +51492,8 @@ function ensureControlPollSecret(identity, save = saveHostIdentity) {
51369
51492
  }
51370
51493
  function saveHostIdentity(identity) {
51371
51494
  const file = hostIdentityPath();
51372
- fs92.mkdirSync(path105.dirname(file), { recursive: true, mode: 448 });
51373
- fs92.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), {
51374
51497
  encoding: "utf8",
51375
51498
  mode: 384
51376
51499
  });
@@ -51415,7 +51538,7 @@ function isTerminalEnrollError(err) {
51415
51538
  }
51416
51539
  function deleteHostIdentity() {
51417
51540
  try {
51418
- fs92.rmSync(hostIdentityPath(), { force: true });
51541
+ fs94.rmSync(hostIdentityPath(), { force: true });
51419
51542
  } catch {
51420
51543
  }
51421
51544
  }
@@ -51439,7 +51562,7 @@ async function postJson(pathname, body) {
51439
51562
  function resolveHostLabel(label) {
51440
51563
  const explicit = label?.trim();
51441
51564
  const envLabel = process.env.CODEAM_HOST_LABEL?.trim();
51442
- const resolved = explicit || envLabel || os65.hostname();
51565
+ const resolved = explicit || envLabel || os66.hostname();
51443
51566
  return resolved.slice(0, 80);
51444
51567
  }
51445
51568
  async function redeemEnrollToken(token, label) {
@@ -51643,9 +51766,9 @@ async function host(args2) {
51643
51766
 
51644
51767
  // src/commands/host-agent.ts
51645
51768
  var import_node_child_process38 = require("child_process");
51646
- var os71 = __toESM(require("os"));
51647
- var fs99 = __toESM(require("fs"));
51648
- var path112 = __toESM(require("path"));
51769
+ var os72 = __toESM(require("os"));
51770
+ var fs101 = __toESM(require("fs"));
51771
+ var path113 = __toESM(require("path"));
51649
51772
 
51650
51773
  // src/skills/persist-from-payload.ts
51651
51774
  function persistOrClearSkillsFromPayload(skills) {
@@ -51654,13 +51777,13 @@ function persistOrClearSkillsFromPayload(skills) {
51654
51777
  }
51655
51778
 
51656
51779
  // src/commands/host/session-state.ts
51657
- var fs93 = __toESM(require("fs"));
51658
- var os66 = __toESM(require("os"));
51659
- var path106 = __toESM(require("path"));
51780
+ var fs95 = __toESM(require("fs"));
51781
+ var os67 = __toESM(require("os"));
51782
+ var path107 = __toESM(require("path"));
51660
51783
  function hostSessionStatePath(env = process.env) {
51661
51784
  const override = env.CODEAM_HOST_SESSION_STATE_FILE;
51662
51785
  if (override && override.trim()) return override.trim();
51663
- return path106.join(os66.homedir(), ".codeam", "host-agent-sessions.json");
51786
+ return path107.join(os67.homedir(), ".codeam", "host-agent-sessions.json");
51664
51787
  }
51665
51788
  function isRecord5(v) {
51666
51789
  if (typeof v !== "object" || v === null) return false;
@@ -51671,7 +51794,7 @@ function fileSessionChildStore(file = hostSessionStatePath()) {
51671
51794
  return {
51672
51795
  load() {
51673
51796
  try {
51674
- const raw = JSON.parse(fs93.readFileSync(file, "utf8"));
51797
+ const raw = JSON.parse(fs95.readFileSync(file, "utf8"));
51675
51798
  return Array.isArray(raw?.sessions) ? raw.sessions.filter(isRecord5) : null;
51676
51799
  } catch {
51677
51800
  return null;
@@ -51679,18 +51802,18 @@ function fileSessionChildStore(file = hostSessionStatePath()) {
51679
51802
  },
51680
51803
  save(list) {
51681
51804
  try {
51682
- fs93.mkdirSync(path106.dirname(file), { recursive: true, mode: 448 });
51805
+ fs95.mkdirSync(path107.dirname(file), { recursive: true, mode: 448 });
51683
51806
  const tmp = `${file}.${process.pid}.tmp`;
51684
- fs93.writeFileSync(tmp, JSON.stringify({ version: 1, sessions: list }, null, 2), {
51807
+ fs95.writeFileSync(tmp, JSON.stringify({ version: 1, sessions: list }, null, 2), {
51685
51808
  mode: 384
51686
51809
  });
51687
- fs93.renameSync(tmp, file);
51810
+ fs95.renameSync(tmp, file);
51688
51811
  } catch {
51689
51812
  }
51690
51813
  },
51691
51814
  clear() {
51692
51815
  try {
51693
- fs93.rmSync(file, { force: true });
51816
+ fs95.rmSync(file, { force: true });
51694
51817
  } catch {
51695
51818
  }
51696
51819
  }
@@ -51713,10 +51836,10 @@ function planSessionResume(records, max) {
51713
51836
  return { resume: ordered.slice(0, bound), dropped: ordered.slice(bound) };
51714
51837
  }
51715
51838
  function pickSavedSessionForWorkspace(sessions3, cwd, deployId) {
51716
- const target = path106.resolve(cwd);
51839
+ const target = path107.resolve(cwd);
51717
51840
  const reconnectable = (s) => !!s.pluginId && !!s.pollSecret && !!s.agent;
51718
51841
  const matches = sessions3.filter(
51719
- (s) => !!s.cwd && path106.resolve(s.cwd) === target && reconnectable(s)
51842
+ (s) => !!s.cwd && path107.resolve(s.cwd) === target && reconnectable(s)
51720
51843
  );
51721
51844
  if (matches.length > 0) {
51722
51845
  matches.sort((a, b) => b.pairedAt - a.pairedAt);
@@ -51728,11 +51851,11 @@ function pickSavedSessionForWorkspace(sessions3, cwd, deployId) {
51728
51851
 
51729
51852
  // src/commands/host/git-tooling.ts
51730
51853
  var import_node_child_process32 = require("child_process");
51731
- var fs94 = __toESM(require("fs"));
51732
- var os67 = __toESM(require("os"));
51733
- var path107 = __toESM(require("path"));
51854
+ var fs96 = __toESM(require("fs"));
51855
+ var os68 = __toESM(require("os"));
51856
+ var path108 = __toESM(require("path"));
51734
51857
  function codeamBinDir() {
51735
- 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");
51736
51859
  }
51737
51860
  var FALLBACK_GH_VERSION = "2.62.0";
51738
51861
  var RELEASE_API = "https://api.github.com/repos/cli/cli/releases/latest";
@@ -51764,7 +51887,7 @@ async function download(url2, dest) {
51764
51887
  const res = await fetch(url2, { headers: { "User-Agent": "codeam-cli" } });
51765
51888
  if (!res.ok || !res.body) return false;
51766
51889
  const buf = Buffer.from(await res.arrayBuffer());
51767
- fs94.writeFileSync(dest, buf);
51890
+ fs96.writeFileSync(dest, buf);
51768
51891
  return true;
51769
51892
  } catch {
51770
51893
  return false;
@@ -51787,8 +51910,8 @@ async function ensureGhCli(runner, token, deps = {}) {
51787
51910
  const version3 = await resolveVersionFn(token);
51788
51911
  const asset = `gh_${version3}_${osToken}_${arch2}`;
51789
51912
  const url2 = `https://github.com/cli/cli/releases/download/v${version3}/${asset}.${ext}`;
51790
- const tmpRoot = fs94.mkdtempSync(path107.join(os67.tmpdir(), "codeam-gh-"));
51791
- 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}`);
51792
51915
  if (!await downloadFn(url2, archive)) {
51793
51916
  log.warn("host-agent", "gh download failed \u2014 skipping (git pull/push still work via the credential helper)");
51794
51917
  return null;
@@ -51798,16 +51921,16 @@ async function ensureGhCli(runner, token, deps = {}) {
51798
51921
  log.warn("host-agent", `gh archive extraction failed (code=${String(extract.code)}) \u2014 skipping`);
51799
51922
  return null;
51800
51923
  }
51801
- const extractedBin = path107.join(tmpRoot, asset, "bin", binaryName);
51802
- if (!fs94.existsSync(extractedBin)) {
51924
+ const extractedBin = path108.join(tmpRoot, asset, "bin", binaryName);
51925
+ if (!fs96.existsSync(extractedBin)) {
51803
51926
  log.warn("host-agent", "gh binary not found in the extracted archive \u2014 skipping");
51804
51927
  return null;
51805
51928
  }
51806
51929
  const binDir = codeamBinDir();
51807
- fs94.mkdirSync(binDir, { recursive: true });
51808
- const target = path107.join(binDir, binaryName);
51809
- fs94.copyFileSync(extractedBin, target);
51810
- fs94.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);
51811
51934
  log.info("host-agent", `gh installed to ${target} (v${version3})`);
51812
51935
  return target;
51813
51936
  } catch (e) {
@@ -51844,19 +51967,19 @@ async function ensureGhAuth(runner, ghCmd, token) {
51844
51967
  }
51845
51968
  function ghConfigDir() {
51846
51969
  if (process.env.GH_CONFIG_DIR) return process.env.GH_CONFIG_DIR;
51847
- 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");
51848
51971
  if (process.platform === "win32" && process.env.APPDATA) {
51849
- return path107.join(process.env.APPDATA, "GitHub CLI");
51972
+ return path108.join(process.env.APPDATA, "GitHub CLI");
51850
51973
  }
51851
- return path107.join(os67.homedir(), ".config", "gh");
51974
+ return path108.join(os68.homedir(), ".config", "gh");
51852
51975
  }
51853
51976
  function writeGhHostsToken(token) {
51854
51977
  try {
51855
51978
  const dir = ghConfigDir();
51856
- const file = path107.join(dir, "hosts.yml");
51857
- if (fs94.existsSync(file)) return false;
51858
- fs94.mkdirSync(dir, { recursive: true, mode: 448 });
51859
- fs94.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(
51860
51983
  file,
51861
51984
  `github.com:
51862
51985
  oauth_token: ${token}
@@ -51899,8 +52022,8 @@ async function ensureGlabCli(runner, deps = {}) {
51899
52022
  const version3 = await resolveLatestGlabVersion();
51900
52023
  const asset = `glab_${version3}_${osToken}_${arch2}`;
51901
52024
  const url2 = `https://gitlab.com/gitlab-org/cli/-/releases/v${version3}/downloads/${asset}.${ext}`;
51902
- const tmpRoot = fs94.mkdtempSync(path107.join(os67.tmpdir(), "codeam-glab-"));
51903
- 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}`);
51904
52027
  if (!await downloadFn(url2, archive)) {
51905
52028
  log.warn("host-agent", "glab download failed \u2014 skipping (git push/pull still work)");
51906
52029
  return null;
@@ -51911,20 +52034,20 @@ async function ensureGlabCli(runner, deps = {}) {
51911
52034
  return null;
51912
52035
  }
51913
52036
  const candidates = [
51914
- path107.join(tmpRoot, "bin", binaryName),
51915
- path107.join(tmpRoot, asset, "bin", binaryName),
51916
- path107.join(tmpRoot, binaryName)
52037
+ path108.join(tmpRoot, "bin", binaryName),
52038
+ path108.join(tmpRoot, asset, "bin", binaryName),
52039
+ path108.join(tmpRoot, binaryName)
51917
52040
  ];
51918
- const extractedBin = candidates.find((c2) => fs94.existsSync(c2));
52041
+ const extractedBin = candidates.find((c2) => fs96.existsSync(c2));
51919
52042
  if (!extractedBin) {
51920
52043
  log.warn("host-agent", "glab binary not found in the extracted archive \u2014 skipping");
51921
52044
  return null;
51922
52045
  }
51923
52046
  const binDir = codeamBinDir();
51924
- fs94.mkdirSync(binDir, { recursive: true });
51925
- const target = path107.join(binDir, binaryName);
51926
- fs94.copyFileSync(extractedBin, target);
51927
- fs94.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);
51928
52051
  log.info("host-agent", `glab installed to ${target} (v${version3})`);
51929
52052
  return target;
51930
52053
  } catch (e) {
@@ -52003,14 +52126,14 @@ var defaultGitToolingRunner = {
52003
52126
  };
52004
52127
 
52005
52128
  // src/lib/cli-versions.ts
52006
- var fs96 = __toESM(require("fs"));
52007
- var os69 = __toESM(require("os"));
52008
- var path109 = __toESM(require("path"));
52129
+ var fs98 = __toESM(require("fs"));
52130
+ var os70 = __toESM(require("os"));
52131
+ var path110 = __toESM(require("path"));
52009
52132
 
52010
52133
  // src/lib/updateNotifier.ts
52011
- var fs95 = __toESM(require("fs"));
52012
- var os68 = __toESM(require("os"));
52013
- var path108 = __toESM(require("path"));
52134
+ var fs97 = __toESM(require("fs"));
52135
+ var os69 = __toESM(require("os"));
52136
+ var path109 = __toESM(require("path"));
52014
52137
  var https8 = __toESM(require("https"));
52015
52138
  var import_node_child_process33 = require("child_process");
52016
52139
  var import_picocolors12 = __toESM(require("picocolors"));
@@ -52019,12 +52142,12 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
52019
52142
  var TTL_MS = 24 * 60 * 60 * 1e3;
52020
52143
  var REQUEST_TIMEOUT_MS = 1500;
52021
52144
  function cachePath() {
52022
- const dir = path108.join(os68.homedir(), ".codeam");
52023
- return path108.join(dir, "update-check.json");
52145
+ const dir = path109.join(os69.homedir(), ".codeam");
52146
+ return path109.join(dir, "update-check.json");
52024
52147
  }
52025
52148
  function readCache() {
52026
52149
  try {
52027
- const raw = fs95.readFileSync(cachePath(), "utf8");
52150
+ const raw = fs97.readFileSync(cachePath(), "utf8");
52028
52151
  const parsed = JSON.parse(raw);
52029
52152
  if (typeof parsed.fetchedAt !== "number" || typeof parsed.latest !== "string") return null;
52030
52153
  return parsed;
@@ -52035,10 +52158,10 @@ function readCache() {
52035
52158
  function writeCache(cache) {
52036
52159
  try {
52037
52160
  const file = cachePath();
52038
- fs95.mkdirSync(path108.dirname(file), { recursive: true });
52161
+ fs97.mkdirSync(path109.dirname(file), { recursive: true });
52039
52162
  const tmp = `${file}.${process.pid}.tmp`;
52040
- fs95.writeFileSync(tmp, JSON.stringify(cache));
52041
- fs95.renameSync(tmp, file);
52163
+ fs97.writeFileSync(tmp, JSON.stringify(cache));
52164
+ fs97.renameSync(tmp, file);
52042
52165
  } catch {
52043
52166
  }
52044
52167
  }
@@ -52112,8 +52235,8 @@ function isLinkedInstall() {
52112
52235
  timeout: 2e3
52113
52236
  }).trim();
52114
52237
  if (!root) return false;
52115
- const pkgPath = path108.join(root, PKG_NAME);
52116
- return fs95.lstatSync(pkgPath).isSymbolicLink();
52238
+ const pkgPath = path109.join(root, PKG_NAME);
52239
+ return fs97.lstatSync(pkgPath).isSymbolicLink();
52117
52240
  } catch {
52118
52241
  return false;
52119
52242
  }
@@ -52149,7 +52272,7 @@ function maybeAutoUpdate(currentVersion, latest) {
52149
52272
  return;
52150
52273
  }
52151
52274
  try {
52152
- fs95.unlinkSync(cachePath());
52275
+ fs97.unlinkSync(cachePath());
52153
52276
  } catch {
52154
52277
  }
52155
52278
  process.stderr.write(` ${import_picocolors12.default.green("\u2713")} Updated. Resuming session...
@@ -52165,7 +52288,7 @@ async function autoUpgradeBeforeCriticalCommand() {
52165
52288
  if (process.env.NODE_ENV === "test") return;
52166
52289
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
52167
52290
  if (process.env.CI) return;
52168
- const current2 = true ? "2.76.41" : null;
52291
+ const current2 = true ? "2.76.43" : null;
52169
52292
  if (!current2) return;
52170
52293
  const cache = readCache();
52171
52294
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -52182,7 +52305,7 @@ function checkForUpdates() {
52182
52305
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
52183
52306
  if (process.env.CI) return;
52184
52307
  if (!process.stdout.isTTY) return;
52185
- const current2 = true ? "2.76.41" : null;
52308
+ const current2 = true ? "2.76.43" : null;
52186
52309
  if (!current2) return;
52187
52310
  const cache = readCache();
52188
52311
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -52205,10 +52328,10 @@ function versionedModeSupported(platform3 = process.platform) {
52205
52328
  return platform3 !== "win32";
52206
52329
  }
52207
52330
  function cliVersionsRoot(env = process.env) {
52208
- 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");
52209
52332
  }
52210
52333
  function packageDirOf(versionDir) {
52211
- return path109.join(versionDir, "node_modules", CLI_PKG);
52334
+ return path110.join(versionDir, "node_modules", CLI_PKG);
52212
52335
  }
52213
52336
  function isRecord6(v) {
52214
52337
  return typeof v === "object" && v !== null;
@@ -52216,7 +52339,7 @@ function isRecord6(v) {
52216
52339
  function readPkg2(versionDir) {
52217
52340
  try {
52218
52341
  const raw = JSON.parse(
52219
- fs96.readFileSync(path109.join(packageDirOf(versionDir), "package.json"), "utf8")
52342
+ fs98.readFileSync(path110.join(packageDirOf(versionDir), "package.json"), "utf8")
52220
52343
  );
52221
52344
  return isRecord6(raw) ? raw : null;
52222
52345
  } catch {
@@ -52229,15 +52352,15 @@ function entryOf(versionDir) {
52229
52352
  const bin = pkg.bin;
52230
52353
  const named = isRecord6(bin) ? bin.codeam : void 0;
52231
52354
  const rel = typeof bin === "string" ? bin : typeof named === "string" ? named : "dist/index.js";
52232
- const entry = path109.join(packageDirOf(versionDir), rel);
52233
- return fs96.existsSync(entry) ? entry : null;
52355
+ const entry = path110.join(packageDirOf(versionDir), rel);
52356
+ return fs98.existsSync(entry) ? entry : null;
52234
52357
  }
52235
52358
  function launcherOf(versionDir) {
52236
52359
  const entry = entryOf(versionDir);
52237
52360
  if (!entry) return null;
52238
- const bin = path109.join(versionDir, "node_modules", ".bin", "codeam");
52361
+ const bin = path110.join(versionDir, "node_modules", ".bin", "codeam");
52239
52362
  try {
52240
- return fs96.realpathSync(bin) === fs96.realpathSync(entry) ? bin : entry;
52363
+ return fs98.realpathSync(bin) === fs98.realpathSync(entry) ? bin : entry;
52241
52364
  } catch {
52242
52365
  return entry;
52243
52366
  }
@@ -52250,16 +52373,16 @@ var BAD_MARKER_TTL_MS = 24 * 60 * 6e4;
52250
52373
  var PRE_READY_WINDOW_MS = 60 * 6e4;
52251
52374
  function isBad(versionDir, now = Date.now()) {
52252
52375
  try {
52253
- return now - fs96.statSync(path109.join(versionDir, ".bad")).mtimeMs < BAD_MARKER_TTL_MS;
52376
+ return now - fs98.statSync(path110.join(versionDir, ".bad")).mtimeMs < BAD_MARKER_TTL_MS;
52254
52377
  } catch {
52255
52378
  return false;
52256
52379
  }
52257
52380
  }
52258
52381
  function recordPreReadyFailure(versionDir, now = Date.now()) {
52259
- const file = path109.join(versionDir, ".prefail");
52382
+ const file = path110.join(versionDir, ".prefail");
52260
52383
  let count = 0;
52261
52384
  try {
52262
- const [n, at3] = fs96.readFileSync(file, "utf8").trim().split(" ").map(Number);
52385
+ const [n, at3] = fs98.readFileSync(file, "utf8").trim().split(" ").map(Number);
52263
52386
  if (Number.isFinite(n) && Number.isFinite(at3) && now - at3 < PRE_READY_WINDOW_MS) {
52264
52387
  count = n;
52265
52388
  }
@@ -52267,45 +52390,45 @@ function recordPreReadyFailure(versionDir, now = Date.now()) {
52267
52390
  }
52268
52391
  count += 1;
52269
52392
  try {
52270
- fs96.writeFileSync(file, `${count} ${now}`);
52393
+ fs98.writeFileSync(file, `${count} ${now}`);
52271
52394
  } catch {
52272
52395
  }
52273
52396
  return count;
52274
52397
  }
52275
52398
  function clearPreReadyFailures(versionDir) {
52276
- fs96.rmSync(path109.join(versionDir, ".prefail"), { force: true });
52399
+ fs98.rmSync(path110.join(versionDir, ".prefail"), { force: true });
52277
52400
  }
52278
52401
  function markBad(versionDir, reason) {
52279
52402
  try {
52280
- fs96.writeFileSync(path109.join(versionDir, ".bad"), `${(/* @__PURE__ */ new Date()).toISOString()} ${reason}
52403
+ fs98.writeFileSync(path110.join(versionDir, ".bad"), `${(/* @__PURE__ */ new Date()).toISOString()} ${reason}
52281
52404
  `);
52282
52405
  } catch {
52283
52406
  }
52284
52407
  }
52285
52408
  function pointerTarget(root, name) {
52286
52409
  try {
52287
- return fs96.realpathSync(path109.join(root, name));
52410
+ return fs98.realpathSync(path110.join(root, name));
52288
52411
  } catch {
52289
52412
  return null;
52290
52413
  }
52291
52414
  }
52292
52415
  function atomicPoint(root, name, targetDir) {
52293
- const realRoot = fs96.realpathSync(root);
52294
- const tmp = path109.join(realRoot, `.${name}.tmp-${process.pid}-${Date.now()}`);
52295
- fs96.symlinkSync(path109.relative(realRoot, fs96.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");
52296
52419
  try {
52297
- fs96.renameSync(tmp, path109.join(realRoot, name));
52420
+ fs98.renameSync(tmp, path110.join(realRoot, name));
52298
52421
  } catch (err) {
52299
- fs96.rmSync(tmp, { force: true });
52422
+ fs98.rmSync(tmp, { force: true });
52300
52423
  throw err;
52301
52424
  }
52302
52425
  }
52303
52426
  function samePath(a, b) {
52304
52427
  const canon = (p2) => {
52305
52428
  try {
52306
- return fs96.realpathSync(p2);
52429
+ return fs98.realpathSync(p2);
52307
52430
  } catch {
52308
- return path109.resolve(p2);
52431
+ return path110.resolve(p2);
52309
52432
  }
52310
52433
  };
52311
52434
  return canon(a) === canon(b);
@@ -52340,15 +52463,15 @@ function versionDirContaining(root, file) {
52340
52463
  let real;
52341
52464
  let realRoot;
52342
52465
  try {
52343
- real = fs96.realpathSync(file);
52344
- realRoot = fs96.realpathSync(root);
52466
+ real = fs98.realpathSync(file);
52467
+ realRoot = fs98.realpathSync(root);
52345
52468
  } catch {
52346
52469
  return null;
52347
52470
  }
52348
- const rel = path109.relative(realRoot, real);
52349
- if (rel.startsWith("..") || path109.isAbsolute(rel)) return null;
52350
- const first = rel.split(path109.sep)[0];
52351
- 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;
52352
52475
  }
52353
52476
  function pidAlive3(pid) {
52354
52477
  try {
@@ -52361,9 +52484,9 @@ function pidAlive3(pid) {
52361
52484
  var CLK_TCK = 100;
52362
52485
  function processStartMs(pid) {
52363
52486
  try {
52364
- const stat3 = fs96.readFileSync(`/proc/${pid}/stat`, "utf8");
52487
+ const stat3 = fs98.readFileSync(`/proc/${pid}/stat`, "utf8");
52365
52488
  const ticks = Number(stat3.slice(stat3.lastIndexOf(")") + 2).split(" ")[19]);
52366
- const btime = /^btime (\d+)$/m.exec(fs96.readFileSync("/proc/stat", "utf8"))?.[1];
52489
+ const btime = /^btime (\d+)$/m.exec(fs98.readFileSync("/proc/stat", "utf8"))?.[1];
52367
52490
  if (!Number.isFinite(ticks) || !btime) return null;
52368
52491
  return Number(btime) * 1e3 + ticks * 1e3 / CLK_TCK;
52369
52492
  } catch {
@@ -52372,10 +52495,10 @@ function processStartMs(pid) {
52372
52495
  }
52373
52496
  var PID_REUSE_SLACK_MS = 2e3;
52374
52497
  function livePids(versionDir) {
52375
- const dir = path109.join(versionDir, ".pids");
52498
+ const dir = path110.join(versionDir, ".pids");
52376
52499
  let names;
52377
52500
  try {
52378
- names = fs96.readdirSync(dir);
52501
+ names = fs98.readdirSync(dir);
52379
52502
  } catch {
52380
52503
  return [];
52381
52504
  }
@@ -52384,7 +52507,7 @@ function livePids(versionDir) {
52384
52507
  const started = processStartMs(pid);
52385
52508
  if (started === null) return true;
52386
52509
  try {
52387
- return started <= fs96.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;
52388
52511
  } catch {
52389
52512
  return true;
52390
52513
  }
@@ -52393,11 +52516,11 @@ function livePids(versionDir) {
52393
52516
  function registerRunningVersion(root = cliVersionsRoot(), entry = process.argv[1]) {
52394
52517
  const dir = versionDirContaining(root, entry);
52395
52518
  if (!dir) return;
52396
- const file = path109.join(dir, ".pids", String(process.pid));
52519
+ const file = path110.join(dir, ".pids", String(process.pid));
52397
52520
  try {
52398
- fs96.mkdirSync(path109.dirname(file), { recursive: true });
52399
- fs96.writeFileSync(file, "");
52400
- process.once("exit", () => fs96.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 }));
52401
52524
  } catch {
52402
52525
  }
52403
52526
  }
@@ -52405,7 +52528,7 @@ function gcVersions(root) {
52405
52528
  const removed = [];
52406
52529
  let names;
52407
52530
  try {
52408
- names = fs96.readdirSync(root).filter((n) => SEMVER_DIR.test(n));
52531
+ names = fs98.readdirSync(root).filter((n) => SEMVER_DIR.test(n));
52409
52532
  } catch {
52410
52533
  return removed;
52411
52534
  }
@@ -52413,13 +52536,13 @@ function gcVersions(root) {
52413
52536
  [...names].sort((a, b) => compareSemver(b, a)).slice(0, GC_KEEP_NEWEST)
52414
52537
  );
52415
52538
  for (const p2 of [pointerTarget(root, "current"), pointerTarget(root, "previous")]) {
52416
- if (p2) keep.add(path109.basename(p2));
52539
+ if (p2) keep.add(path110.basename(p2));
52417
52540
  }
52418
52541
  for (const name of names) {
52419
- const dir = path109.join(root, name);
52542
+ const dir = path110.join(root, name);
52420
52543
  if (keep.has(name) || livePids(dir).length > 0) continue;
52421
52544
  try {
52422
- fs96.rmSync(dir, { recursive: true, force: true });
52545
+ fs98.rmSync(dir, { recursive: true, force: true });
52423
52546
  removed.push(name);
52424
52547
  } catch {
52425
52548
  }
@@ -52427,25 +52550,25 @@ function gcVersions(root) {
52427
52550
  return removed;
52428
52551
  }
52429
52552
  function acquireInstallLock(root) {
52430
- const lock = path109.join(root, ".install.lock");
52553
+ const lock = path110.join(root, ".install.lock");
52431
52554
  for (let attempt = 0; attempt < 2; attempt++) {
52432
52555
  try {
52433
- const fd = fs96.openSync(lock, "wx");
52434
- fs96.writeSync(fd, String(process.pid));
52435
- fs96.closeSync(fd);
52436
- return () => fs96.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 });
52437
52560
  } catch (err) {
52438
52561
  if (err.code !== "EEXIST") return null;
52439
52562
  let stale = false;
52440
52563
  try {
52441
- const owner = Number(fs96.readFileSync(lock, "utf8"));
52442
- const age = Date.now() - fs96.statSync(lock).mtimeMs;
52564
+ const owner = Number(fs98.readFileSync(lock, "utf8"));
52565
+ const age = Date.now() - fs98.statSync(lock).mtimeMs;
52443
52566
  stale = !Number.isInteger(owner) || !pidAlive3(owner) || age > LOCK_STALE_MS;
52444
52567
  } catch {
52445
52568
  stale = true;
52446
52569
  }
52447
52570
  if (!stale) return null;
52448
- fs96.rmSync(lock, { force: true });
52571
+ fs98.rmSync(lock, { force: true });
52449
52572
  }
52450
52573
  }
52451
52574
  return null;
@@ -52453,9 +52576,9 @@ function acquireInstallLock(root) {
52453
52576
 
52454
52577
  // src/commands/host/host-launch.ts
52455
52578
  var import_node_child_process35 = require("child_process");
52456
- var fs98 = __toESM(require("fs"));
52457
- var os70 = __toESM(require("os"));
52458
- var path111 = __toESM(require("path"));
52579
+ var fs100 = __toESM(require("fs"));
52580
+ var os71 = __toESM(require("os"));
52581
+ var path112 = __toESM(require("path"));
52459
52582
 
52460
52583
  // src/exit-codes.ts
52461
52584
  var EXIT_OK = 0;
@@ -52477,8 +52600,8 @@ var EXIT_CODE_NAMES = {
52477
52600
 
52478
52601
  // src/commands/host/self-update.ts
52479
52602
  var import_node_child_process34 = require("child_process");
52480
- var fs97 = __toESM(require("fs"));
52481
- var path110 = __toESM(require("path"));
52603
+ var fs99 = __toESM(require("fs"));
52604
+ var path111 = __toESM(require("path"));
52482
52605
  var SELF_UPDATE_PKG = "codeam-cli";
52483
52606
  var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
52484
52607
  var SELF_UPDATE_STARTUP_DELAY_MS = 5e3;
@@ -52488,7 +52611,7 @@ var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
52488
52611
  var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
52489
52612
  var SELF_UPDATE_LS_TIMEOUT_MS = 15e3;
52490
52613
  function currentCliVersion() {
52491
- return true ? "2.76.41" : null;
52614
+ return true ? "2.76.43" : null;
52492
52615
  }
52493
52616
  async function installedVersion(deps) {
52494
52617
  const ls = await deps.run(
@@ -52604,9 +52727,9 @@ function collectOldVersions(root) {
52604
52727
  var VERIFY_TIMEOUT_MS = 3e4;
52605
52728
  async function installVersioned(deps, root, latest, running2) {
52606
52729
  const node = deps.nodePath ?? process.execPath;
52607
- const target = path110.join(root, latest);
52730
+ const target = path111.join(root, latest);
52608
52731
  try {
52609
- fs97.mkdirSync(root, { recursive: true });
52732
+ fs99.mkdirSync(root, { recursive: true });
52610
52733
  } catch {
52611
52734
  return { status: "skipped" };
52612
52735
  }
@@ -52630,7 +52753,7 @@ async function installVersioned(deps, root, latest, running2) {
52630
52753
  }
52631
52754
  const reusable = entryOf(target) && versionOf(target) === latest;
52632
52755
  if (!reusable) {
52633
- fs97.rmSync(target, { recursive: true, force: true });
52756
+ fs99.rmSync(target, { recursive: true, force: true });
52634
52757
  const install = await deps.run(
52635
52758
  "npm",
52636
52759
  [
@@ -52645,7 +52768,7 @@ async function installVersioned(deps, root, latest, running2) {
52645
52768
  SELF_UPDATE_INSTALL_TIMEOUT_MS
52646
52769
  );
52647
52770
  if (install.code !== 0) {
52648
- fs97.rmSync(target, { recursive: true, force: true });
52771
+ fs99.rmSync(target, { recursive: true, force: true });
52649
52772
  log.warn(
52650
52773
  "host-agent",
52651
52774
  `self-update: versioned install exited ${String(install.code)} \u2014 staying on ${running2}: ` + install.stderr.slice(-300)
@@ -52656,7 +52779,7 @@ async function installVersioned(deps, root, latest, running2) {
52656
52779
  const entry = entryOf(target);
52657
52780
  const check = entry ? await deps.run(node, [entry, "--version"], VERIFY_TIMEOUT_MS) : { code: null, stdout: "", stderr: "no entry point" };
52658
52781
  if (check.code !== 0 || !check.stdout.includes(latest)) {
52659
- fs97.rmSync(target, { recursive: true, force: true });
52782
+ fs99.rmSync(target, { recursive: true, force: true });
52660
52783
  log.warn(
52661
52784
  "host-agent",
52662
52785
  `self-update: ${latest} failed verification (exit ${String(check.code)}: ${(check.stdout + check.stderr).trim().slice(-200)}) \u2014 staying on ${running2}`
@@ -52672,7 +52795,7 @@ async function installVersioned(deps, root, latest, running2) {
52672
52795
  return { status: "updated", version: latest };
52673
52796
  } catch (err) {
52674
52797
  const cur = pointerTarget(root, "current");
52675
- if (!cur || path110.basename(cur) !== latest) fs97.rmSync(target, { recursive: true, force: true });
52798
+ if (!cur || path111.basename(cur) !== latest) fs99.rmSync(target, { recursive: true, force: true });
52676
52799
  log.warn(
52677
52800
  "host-agent",
52678
52801
  `self-update: versioned install failed: ${err instanceof Error ? err.message : String(err)}`
@@ -52711,7 +52834,7 @@ function signalHostReady(send = process.send?.bind(process)) {
52711
52834
  }
52712
52835
  function defaultDeps() {
52713
52836
  return {
52714
- ownVersion: true ? "2.76.41" : null,
52837
+ ownVersion: true ? "2.76.43" : null,
52715
52838
  root: cliVersionsRoot(),
52716
52839
  args: process.argv.slice(3),
52717
52840
  execPath: process.execPath,
@@ -52808,13 +52931,13 @@ function needsSelfRelaunch(env = process.env, pid = process.pid, ctx = {}) {
52808
52931
  }
52809
52932
  function readPid1Cmdline() {
52810
52933
  try {
52811
- return fs98.readFileSync("/proc/1/cmdline", "utf8").split("\0").filter(Boolean);
52934
+ return fs100.readFileSync("/proc/1/cmdline", "utf8").split("\0").filter(Boolean);
52812
52935
  } catch {
52813
52936
  return [];
52814
52937
  }
52815
52938
  }
52816
52939
  function isOurTiniEntrypoint(argv) {
52817
- 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");
52818
52941
  }
52819
52942
  function relaunchArgv(execPath, argv) {
52820
52943
  return ["-c", 'sleep 2; exec "$0" "$@"', execPath, ...argv.slice(1)];
@@ -52856,7 +52979,7 @@ function defaultRestartForUpdate(version3, supervised, io = {}) {
52856
52979
  }
52857
52980
  exit(0);
52858
52981
  }
52859
- function isContainerEnvironment(existsSyncFn = fs98.existsSync, readFileSyncFn = (p2) => fs98.readFileSync(p2, "utf8")) {
52982
+ function isContainerEnvironment(existsSyncFn = fs100.existsSync, readFileSyncFn = (p2) => fs100.readFileSync(p2, "utf8")) {
52860
52983
  try {
52861
52984
  if (existsSyncFn("/.dockerenv")) return true;
52862
52985
  } catch {
@@ -52868,16 +52991,16 @@ function isContainerEnvironment(existsSyncFn = fs98.existsSync, readFileSyncFn =
52868
52991
  }
52869
52992
  return false;
52870
52993
  }
52871
- function hostAgentPidFile(home = os70.homedir()) {
52872
- return path111.join(home, ".codeam", "host-agent.pid");
52994
+ function hostAgentPidFile(home = os71.homedir()) {
52995
+ return path112.join(home, ".codeam", "host-agent.pid");
52873
52996
  }
52874
52997
  function writeHostAgentPidFile(file = hostAgentPidFile(), pid = process.pid) {
52875
52998
  try {
52876
- fs98.mkdirSync(path111.dirname(file), { recursive: true });
52877
- fs98.writeFileSync(file, String(pid));
52999
+ fs100.mkdirSync(path112.dirname(file), { recursive: true });
53000
+ fs100.writeFileSync(file, String(pid));
52878
53001
  process.once("exit", () => {
52879
53002
  try {
52880
- if (fs98.readFileSync(file, "utf8").trim() === String(pid)) fs98.rmSync(file, { force: true });
53003
+ if (fs100.readFileSync(file, "utf8").trim() === String(pid)) fs100.rmSync(file, { force: true });
52881
53004
  } catch {
52882
53005
  }
52883
53006
  });
@@ -53729,13 +53852,13 @@ var HostAgentSupervisor = class {
53729
53852
  const relay = this.relay;
53730
53853
  if (!relay) return;
53731
53854
  const raw = cmd.payload?.path;
53732
- 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();
53733
53856
  try {
53734
- const dirents = await fs99.promises.readdir(target, { withFileTypes: true });
53857
+ const dirents = await fs101.promises.readdir(target, { withFileTypes: true });
53735
53858
  const entries2 = dirents.filter((d3) => !d3.name.startsWith(".")).map((d3) => ({ name: d3.name, isDir: d3.isDirectory() })).sort(
53736
53859
  (a, b) => a.isDir === b.isDir ? a.name.localeCompare(b.name) : a.isDir ? -1 : 1
53737
53860
  );
53738
- const parent = path112.dirname(target);
53861
+ const parent = path113.dirname(target);
53739
53862
  await relay.sendResult(cmd.id, "completed", {
53740
53863
  path: target,
53741
53864
  // null at the filesystem root so the UI can hide the ".." affordance.
@@ -54213,14 +54336,14 @@ var HostAgentSupervisor = class {
54213
54336
  }),
54214
54337
  CODEAM_AUTO_TOKEN: payload.autoPairToken
54215
54338
  };
54216
- const houseConfigDir = path112.join(
54217
- os71.homedir(),
54339
+ const houseConfigDir = path113.join(
54340
+ os72.homedir(),
54218
54341
  ".codeam",
54219
54342
  "house-claude",
54220
54343
  payload.deployId
54221
54344
  );
54222
54345
  try {
54223
- fs99.mkdirSync(houseConfigDir, { recursive: true, mode: 448 });
54346
+ fs101.mkdirSync(houseConfigDir, { recursive: true, mode: 448 });
54224
54347
  } catch {
54225
54348
  }
54226
54349
  childEnv.CLAUDE_CONFIG_DIR = houseConfigDir;
@@ -54249,7 +54372,7 @@ var HostAgentSupervisor = class {
54249
54372
  report("installing", "installing agent CLI");
54250
54373
  await this.runAgentInstall(payload.agentInstallScript);
54251
54374
  }
54252
- const home = process.env.HOME || os71.homedir();
54375
+ const home = process.env.HOME || os72.homedir();
54253
54376
  childEnv.PATH = `${home}/.local/bin:${process.env.PATH ?? ""}`;
54254
54377
  if (payload.cloneToken) {
54255
54378
  try {
@@ -54257,13 +54380,13 @@ var HostAgentSupervisor = class {
54257
54380
  if ((payload.repoProvider ?? "github") === "gitlab") {
54258
54381
  const glabCmd = await ensureGlabCli(defaultGitToolingRunner);
54259
54382
  if (glabCmd) {
54260
- childEnv.PATH = `${codeamBinDir()}${path112.delimiter}${childEnv.PATH}`;
54383
+ childEnv.PATH = `${codeamBinDir()}${path113.delimiter}${childEnv.PATH}`;
54261
54384
  await ensureGlabAuth(defaultGitToolingRunner, glabCmd, payload.cloneToken);
54262
54385
  }
54263
54386
  } else {
54264
54387
  const ghCmd = await ensureGhCli(defaultGitToolingRunner, payload.cloneToken);
54265
54388
  if (ghCmd) {
54266
- childEnv.PATH = `${codeamBinDir()}${path112.delimiter}${childEnv.PATH}`;
54389
+ childEnv.PATH = `${codeamBinDir()}${path113.delimiter}${childEnv.PATH}`;
54267
54390
  await ensureGhAuth(defaultGitToolingRunner, ghCmd, payload.cloneToken);
54268
54391
  }
54269
54392
  }
@@ -54291,9 +54414,9 @@ var HostAgentSupervisor = class {
54291
54414
  );
54292
54415
  if (!payload.suppressOnboardingWelcome) {
54293
54416
  try {
54294
- const cfgDir = childEnv.CLAUDE_CONFIG_DIR || path112.join(os71.homedir(), ".claude");
54295
- const projectDir = path112.join(cfgDir, "projects", encodeCwd(cwd));
54296
- const hasPriorConversation = fs99.existsSync(projectDir) && fs99.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"));
54297
54420
  if (hasPriorConversation) {
54298
54421
  childEnv.CODEAM_RESUME_LATEST = "1";
54299
54422
  log.info(
@@ -54447,7 +54570,7 @@ var HostAgentSupervisor = class {
54447
54570
  fallbackResumeTarget() {
54448
54571
  const session = getActiveSession();
54449
54572
  if (!session || !session.pluginId || !session.pollSecret || !session.agent) return null;
54450
- const cwd = session.cwd && fs99.existsSync(session.cwd) ? session.cwd : process.cwd();
54573
+ const cwd = session.cwd && fs101.existsSync(session.cwd) ? session.cwd : process.cwd();
54451
54574
  if (isFilesystemRoot(cwd)) {
54452
54575
  log.warn(
54453
54576
  "host-agent",
@@ -54494,7 +54617,7 @@ var HostAgentSupervisor = class {
54494
54617
  log.warn("host-agent", `self_hosted_resume ${sessionId.slice(0, 8)}: no saved pairing on this box`);
54495
54618
  return;
54496
54619
  }
54497
- if (!session.cwd || !fs99.existsSync(session.cwd)) {
54620
+ if (!session.cwd || !fs101.existsSync(session.cwd)) {
54498
54621
  log.warn("host-agent", `self_hosted_resume ${sessionId.slice(0, 8)}: workspace is gone`);
54499
54622
  return;
54500
54623
  }
@@ -54536,7 +54659,7 @@ var HostAgentSupervisor = class {
54536
54659
  const persisted = new Map((this.sessionStore.load() ?? []).map((r) => [r.deployId, r.agent]));
54537
54660
  for (const c2 of this.children.values()) persisted.set(c2.deployId, c2.agent);
54538
54661
  return this.listSavedSessions().map((s) => ({ s, deployId: deployIdFromWorkspace(s.cwd) })).filter(
54539
- (x) => x.deployId !== null && !!x.s.cwd && fs99.existsSync(x.s.cwd)
54662
+ (x) => x.deployId !== null && !!x.s.cwd && fs101.existsSync(x.s.cwd)
54540
54663
  ).map(({ s, deployId }) => {
54541
54664
  const agent = persisted.get(deployId);
54542
54665
  return { deployId, sessionId: s.id, ...agent ? { agent } : {} };
@@ -54621,7 +54744,7 @@ var HostAgentSupervisor = class {
54621
54744
  if (this.children.has(deployId)) return;
54622
54745
  const st3 = this.resumeStateFor(target);
54623
54746
  try {
54624
- const cwd = fs99.existsSync(target.cwd) ? target.cwd : process.cwd();
54747
+ const cwd = fs101.existsSync(target.cwd) ? target.cwd : process.cwd();
54625
54748
  if (isWrapperCheckout(cwd)) {
54626
54749
  log.warn(
54627
54750
  "host-agent",
@@ -54663,7 +54786,7 @@ var HostAgentSupervisor = class {
54663
54786
  return;
54664
54787
  }
54665
54788
  if (tracked && signal) {
54666
- this.onResumeChildExit(target, 128 + (os71.constants.signals[signal] ?? 9), `signal ${signal}`);
54789
+ this.onResumeChildExit(target, 128 + (os72.constants.signals[signal] ?? 9), `signal ${signal}`);
54667
54790
  return;
54668
54791
  }
54669
54792
  log.warn(
@@ -54706,7 +54829,7 @@ var HostAgentSupervisor = class {
54706
54829
  if (Date.now() - child.startedAt < CRASH_RESPAWN_MIN_UPTIME_MS) return false;
54707
54830
  const session = pickSavedSessionForWorkspace(this.listSavedSessions(), child.cwd);
54708
54831
  if (!session) return false;
54709
- 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);
54710
54833
  log.warn(
54711
54834
  "host-agent",
54712
54835
  `session deploy=${child.deployId.slice(0, 8)} died (${signal ?? code}) after ${Math.round((Date.now() - child.startedAt) / 1e3)}s \u2014 respawning it (resume)`
@@ -54856,12 +54979,12 @@ var HostAgentSupervisor = class {
54856
54979
  this.untrackChild(deployId);
54857
54980
  }
54858
54981
  const dirs = [
54859
- path112.join(selfHostedWorkspaceRoot(), deployId),
54860
- path112.join(os71.homedir(), ".codeam", "house-claude", deployId)
54982
+ path113.join(selfHostedWorkspaceRoot(), deployId),
54983
+ path113.join(os72.homedir(), ".codeam", "house-claude", deployId)
54861
54984
  ];
54862
54985
  for (const dir of dirs) {
54863
54986
  try {
54864
- fs99.rmSync(dir, { recursive: true, force: true });
54987
+ fs101.rmSync(dir, { recursive: true, force: true });
54865
54988
  } catch (err) {
54866
54989
  log.warn(
54867
54990
  "host-agent",
@@ -55080,8 +55203,8 @@ async function invite() {
55080
55203
  var import_node_dns = require("dns");
55081
55204
  var import_node_util11 = require("util");
55082
55205
  var import_node_crypto17 = require("crypto");
55083
- var fs100 = __toESM(require("fs"));
55084
- var path113 = __toESM(require("path"));
55206
+ var fs102 = __toESM(require("fs"));
55207
+ var path114 = __toESM(require("path"));
55085
55208
  var import_picocolors14 = __toESM(require("picocolors"));
55086
55209
  var dnsResolveP = (0, import_node_util11.promisify)(import_node_dns.resolve);
55087
55210
  async function checkDns(apiBase2) {
@@ -55137,13 +55260,13 @@ async function checkHealth(apiBase2) {
55137
55260
  }
55138
55261
  }
55139
55262
  function checkConfigDir() {
55140
- const dir = path113.join(require("os").homedir(), ".codeam");
55263
+ const dir = path114.join(require("os").homedir(), ".codeam");
55141
55264
  try {
55142
- fs100.mkdirSync(dir, { recursive: true, mode: 448 });
55143
- const probe = path113.join(dir, ".doctor-probe");
55144
- fs100.writeFileSync(probe, "ok", { mode: 384 });
55145
- const read = fs100.readFileSync(probe, "utf8");
55146
- fs100.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);
55147
55270
  if (read !== "ok") throw new Error("write/read round-trip mismatch");
55148
55271
  return {
55149
55272
  id: "config-dir",
@@ -55183,9 +55306,9 @@ function checkSessions() {
55183
55306
  }
55184
55307
  }
55185
55308
  function checkAgentBinaries() {
55186
- const os74 = createOsStrategy();
55309
+ const os75 = createOsStrategy();
55187
55310
  return getEnabledAgents().map((meta) => {
55188
- const found = os74.findInPath(meta.binaryName);
55311
+ const found = os75.findInPath(meta.binaryName);
55189
55312
  return {
55190
55313
  id: `agent-${meta.id}`,
55191
55314
  label: `Agent binary: ${meta.displayName} (${meta.binaryName})`,
@@ -55207,7 +55330,7 @@ function checkNodePty() {
55207
55330
  detail: "not required on this platform"
55208
55331
  };
55209
55332
  }
55210
- const vendoredPath = path113.join(__dirname, "vendor", "node-pty");
55333
+ const vendoredPath = path114.join(__dirname, "vendor", "node-pty");
55211
55334
  for (const target of [vendoredPath, "node-pty"]) {
55212
55335
  try {
55213
55336
  require(target);
@@ -55249,7 +55372,7 @@ function checkChokidar() {
55249
55372
  }
55250
55373
  async function doctor(args2 = []) {
55251
55374
  const json = args2.includes("--json");
55252
- const cliVersion = true ? "2.76.41" : "0.0.0-dev";
55375
+ const cliVersion = true ? "2.76.43" : "0.0.0-dev";
55253
55376
  const apiBase2 = resolveApiBaseUrl();
55254
55377
  const diagnosticId = (0, import_node_crypto17.randomUUID)();
55255
55378
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -55785,7 +55908,7 @@ async function mcpWarm(argv = [], opts = {}) {
55785
55908
  // src/commands/version.ts
55786
55909
  var import_picocolors15 = __toESM(require("picocolors"));
55787
55910
  function version2() {
55788
- const v = true ? "2.76.41" : "unknown";
55911
+ const v = true ? "2.76.43" : "unknown";
55789
55912
  console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
55790
55913
  }
55791
55914
 
@@ -55918,10 +56041,10 @@ function tryShowSubcommandHelp(cmd, args2) {
55918
56041
  var _subcommandHelpKeys = Object.keys(HELPS);
55919
56042
 
55920
56043
  // src/index.ts
55921
- var os73 = __toESM(require("os"));
56044
+ var os74 = __toESM(require("os"));
55922
56045
  if (!process.env.HOME) {
55923
56046
  try {
55924
- const home = os73.homedir();
56047
+ const home = os74.homedir();
55925
56048
  if (home) process.env.HOME = home;
55926
56049
  } catch {
55927
56050
  }