codeam-cli 2.61.50 → 2.61.51

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 +7 -0
  2. package/dist/index.js +501 -499
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -489,13 +489,12 @@ var AGENT_REGISTRY = {
489
489
  displayName: "opencode",
490
490
  binaryName: "opencode",
491
491
  enabled: true,
492
- // opencode auth = `opencode auth login` (multi-provider; API keys AND
493
- // provider OAuth), which writes a login-state file at
494
- // ~/.local/share/opencode/auth.json. The CLI captures that blob (like
495
- // claude/codex capture their local login), so the vaulted credential is
496
- // the auth.json — an `oauth_token`-kind login blob, not a bare api_key.
497
- supportedAuthKinds: ["oauth_token"],
498
- preferredAuthKind: "oauth_token",
492
+ // opencode is model-AGNOSTIC and AUTO-DETECTS provider API keys from env
493
+ // vars (ANTHROPIC_API_KEY / OPENAI_API_KEY / GEMINI_API_KEY / …) — same
494
+ // model as aider. So the credential is the user's OWN provider key; we set
495
+ // the matching env var (detected by prefix) at deploy. api_key only.
496
+ supportedAuthKinds: ["api_key"],
497
+ preferredAuthKind: "api_key",
499
498
  // Not listed by `headroom init --global` (claude/codex/copilot only) — native.
500
499
  headroomWrappable: false,
501
500
  // Native ACP server: `opencode acp` (stdio JSON-RPC).
@@ -1742,11 +1741,11 @@ function quiet(fn) {
1742
1741
  log.debug(TAG, "ignored sync error", err);
1743
1742
  }
1744
1743
  }
1745
- function rmIfExistsQuiet(path80) {
1744
+ function rmIfExistsQuiet(path79) {
1746
1745
  try {
1747
- fs2.rmSync(path80, { force: true });
1746
+ fs2.rmSync(path79, { force: true });
1748
1747
  } catch (err) {
1749
- log.debug(TAG, `rmIfExists failed for ${path80}`, err);
1748
+ log.debug(TAG, `rmIfExists failed for ${path79}`, err);
1750
1749
  }
1751
1750
  }
1752
1751
  function killQuiet(target, signal = "SIGTERM") {
@@ -1892,9 +1891,9 @@ var _default = makeConfig();
1892
1891
  var { getConfig, ensurePluginId, addSession, removeSession, setActiveSession, getActiveSession, getActiveSessionForAgent, setDisable1mContext, clearAll, saveCliConfig, loadCliConfig } = _default;
1893
1892
 
1894
1893
  // src/commands/pair-auto.ts
1895
- var fs59 = __toESM(require("fs"));
1896
- var os50 = __toESM(require("os"));
1897
- var path63 = __toESM(require("path"));
1894
+ var fs58 = __toESM(require("fs"));
1895
+ var os49 = __toESM(require("os"));
1896
+ var path62 = __toESM(require("path"));
1898
1897
  var import_crypto4 = require("crypto");
1899
1898
 
1900
1899
  // src/services/telemetry.service.ts
@@ -1930,8 +1929,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? (0, import_pat
1930
1929
  return decodedFile;
1931
1930
  };
1932
1931
  }
1933
- function normalizeWindowsPath(path80) {
1934
- return path80.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
1932
+ function normalizeWindowsPath(path79) {
1933
+ return path79.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
1935
1934
  }
1936
1935
 
1937
1936
  // ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
@@ -4411,9 +4410,9 @@ async function addSourceContext(frames) {
4411
4410
  LRU_FILE_CONTENTS_CACHE.reduce();
4412
4411
  return frames;
4413
4412
  }
4414
- function getContextLinesFromFile(path80, ranges, output) {
4413
+ function getContextLinesFromFile(path79, ranges, output) {
4415
4414
  return new Promise((resolve8) => {
4416
- const stream = (0, import_node_fs.createReadStream)(path80);
4415
+ const stream = (0, import_node_fs.createReadStream)(path79);
4417
4416
  const lineReaded = (0, import_node_readline.createInterface)({
4418
4417
  input: stream
4419
4418
  });
@@ -4428,7 +4427,7 @@ function getContextLinesFromFile(path80, ranges, output) {
4428
4427
  let rangeStart = range[0];
4429
4428
  let rangeEnd = range[1];
4430
4429
  function onStreamError() {
4431
- LRU_FILE_CONTENTS_FS_READ_FAILED.set(path80, 1);
4430
+ LRU_FILE_CONTENTS_FS_READ_FAILED.set(path79, 1);
4432
4431
  lineReaded.close();
4433
4432
  lineReaded.removeAllListeners();
4434
4433
  destroyStreamAndResolve();
@@ -4489,8 +4488,8 @@ function clearLineContext(frame) {
4489
4488
  delete frame.context_line;
4490
4489
  delete frame.post_context;
4491
4490
  }
4492
- function shouldSkipContextLinesForFile(path80) {
4493
- return path80.startsWith("node:") || path80.endsWith(".min.js") || path80.endsWith(".min.cjs") || path80.endsWith(".min.mjs") || path80.startsWith("data:");
4491
+ function shouldSkipContextLinesForFile(path79) {
4492
+ return path79.startsWith("node:") || path79.endsWith(".min.js") || path79.endsWith(".min.cjs") || path79.endsWith(".min.mjs") || path79.startsWith("data:");
4494
4493
  }
4495
4494
  function shouldSkipContextLinesForFrame(frame) {
4496
4495
  if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
@@ -6644,7 +6643,7 @@ function readAnonId() {
6644
6643
  }
6645
6644
  function superProperties() {
6646
6645
  return {
6647
- cliVersion: true ? "2.61.50" : "0.0.0-dev",
6646
+ cliVersion: true ? "2.61.51" : "0.0.0-dev",
6648
6647
  nodeVersion: process.version,
6649
6648
  platform: process.platform,
6650
6649
  arch: process.arch,
@@ -6825,7 +6824,7 @@ var os4 = __toESM(require("os"));
6825
6824
  // package.json
6826
6825
  var package_default = {
6827
6826
  name: "codeam-cli",
6828
- version: "2.61.50",
6827
+ version: "2.61.51",
6829
6828
  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.",
6830
6829
  type: "commonjs",
6831
6830
  main: "dist/index.js",
@@ -7997,7 +7996,7 @@ var CommandRelayService = class _CommandRelayService {
7997
7996
  // fresh + clear the "CLI update available" banner after a self-update
7998
7997
  // (a codespace that reinstalls @latest reconnects via heartbeat, not
7999
7998
  // pair/reconnect). Older backends ignore the extra field.
8000
- ..."2.61.50" ? { ideVersion: "2.61.50" } : {}
7999
+ ..."2.61.51" ? { ideVersion: "2.61.51" } : {}
8001
8000
  }).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
8002
8001
  }
8003
8002
  /**
@@ -8224,10 +8223,10 @@ var WINDOWS_LEGACY_JUNCTIONS = [
8224
8223
  /[\\/]Start Menu([\\/]|$)/i,
8225
8224
  /[\\/]Templates([\\/]|$)/i
8226
8225
  ];
8227
- function isUnsafeWindowsWatchRoot(dir, homedir48) {
8226
+ function isUnsafeWindowsWatchRoot(dir, homedir47) {
8228
8227
  const norm = (p2) => p2.replace(/\//g, "\\").replace(/\\+$/, "").toLowerCase();
8229
8228
  const cwd = norm(dir);
8230
- const home = norm(homedir48);
8229
+ const home = norm(homedir47);
8231
8230
  if (cwd === home) return true;
8232
8231
  if (/^[a-z]:$/.test(cwd)) return true;
8233
8232
  const sysRoots = [
@@ -9371,9 +9370,9 @@ function closeAllTerminals() {
9371
9370
  }
9372
9371
 
9373
9372
  // src/commands/start/handlers.ts
9374
- var fs58 = __toESM(require("fs"));
9375
- var os49 = __toESM(require("os"));
9376
- var path62 = __toESM(require("path"));
9373
+ var fs57 = __toESM(require("fs"));
9374
+ var os48 = __toESM(require("os"));
9375
+ var path61 = __toESM(require("path"));
9377
9376
  var import_crypto3 = require("crypto");
9378
9377
  var import_child_process24 = require("child_process");
9379
9378
 
@@ -10205,8 +10204,8 @@ function findGitRoot2(startDir) {
10205
10204
 
10206
10205
  // src/commands/link.ts
10207
10206
  var import_node_crypto8 = require("crypto");
10208
- var fs31 = __toESM(require("fs"));
10209
- var path35 = __toESM(require("path"));
10207
+ var fs30 = __toESM(require("fs"));
10208
+ var path34 = __toESM(require("path"));
10210
10209
  var import_chokidar = __toESM(require("chokidar"));
10211
10210
  var import_picocolors2 = __toESM(require("picocolors"));
10212
10211
 
@@ -12853,10 +12852,10 @@ function buildForPlatform(platform3) {
12853
12852
  var import_node_crypto4 = require("crypto");
12854
12853
 
12855
12854
  // src/agents/claude/resolver.ts
12856
- function buildClaudeLaunch(extraArgs = [], os60 = createOsStrategy()) {
12857
- const found = os60.findInPath("claude") ?? os60.findInPath("claude-code");
12855
+ function buildClaudeLaunch(extraArgs = [], os59 = createOsStrategy()) {
12856
+ const found = os59.findInPath("claude") ?? os59.findInPath("claude-code");
12858
12857
  if (!found) return null;
12859
- return os60.buildLaunch(found, extraArgs);
12858
+ return os59.buildLaunch(found, extraArgs);
12860
12859
  }
12861
12860
 
12862
12861
  // src/agents/claude/installer.ts
@@ -13446,8 +13445,8 @@ var ClaudeRuntimeStrategy = class {
13446
13445
  meta = getAgent("claude");
13447
13446
  mode = "interactive";
13448
13447
  os;
13449
- constructor(os60) {
13450
- this.os = os60;
13448
+ constructor(os59) {
13449
+ this.os = os59;
13451
13450
  }
13452
13451
  /**
13453
13452
  * Claude Code's react-ink TUI enables bracketed-paste mode at
@@ -14227,8 +14226,8 @@ function codexCredentialLocator() {
14227
14226
  function codexLoginLauncher() {
14228
14227
  return {
14229
14228
  async ensureInstalled() {
14230
- const os60 = createOsStrategy();
14231
- return os60.findInPath("codex") !== null;
14229
+ const os59 = createOsStrategy();
14230
+ return os59.findInPath("codex") !== null;
14232
14231
  },
14233
14232
  launch() {
14234
14233
  return (0, import_node_child_process4.spawn)("codex", ["login"], { stdio: "inherit" });
@@ -14251,8 +14250,8 @@ var CodexRuntimeStrategy = class {
14251
14250
  meta = getAgent("codex");
14252
14251
  mode = "interactive";
14253
14252
  os;
14254
- constructor(os60) {
14255
- this.os = os60;
14253
+ constructor(os59) {
14254
+ this.os = os59;
14256
14255
  }
14257
14256
  async prepareLaunch() {
14258
14257
  let binary = this.os.findInPath("codex");
@@ -14361,12 +14360,12 @@ var CodexRuntimeStrategy = class {
14361
14360
  });
14362
14361
  }
14363
14362
  };
14364
- function resolveNpm(os60) {
14365
- return os60.id === "win32" ? "npm.cmd" : "npm";
14363
+ function resolveNpm(os59) {
14364
+ return os59.id === "win32" ? "npm.cmd" : "npm";
14366
14365
  }
14367
- async function installCodexViaNpm(os60) {
14366
+ async function installCodexViaNpm(os59) {
14368
14367
  return new Promise((resolve8, reject) => {
14369
- const proc = (0, import_node_child_process5.spawn)(resolveNpm(os60), ["install", "-g", "@openai/codex"], {
14368
+ const proc = (0, import_node_child_process5.spawn)(resolveNpm(os59), ["install", "-g", "@openai/codex"], {
14370
14369
  stdio: "inherit"
14371
14370
  });
14372
14371
  proc.on("close", (code) => {
@@ -14383,16 +14382,16 @@ async function installCodexViaNpm(os60) {
14383
14382
  });
14384
14383
  });
14385
14384
  }
14386
- function augmentNpmGlobalBin(os60) {
14385
+ function augmentNpmGlobalBin(os59) {
14387
14386
  try {
14388
- const result = (0, import_node_child_process5.spawnSync)(resolveNpm(os60), ["prefix", "-g"], {
14387
+ const result = (0, import_node_child_process5.spawnSync)(resolveNpm(os59), ["prefix", "-g"], {
14389
14388
  stdio: ["ignore", "pipe", "ignore"]
14390
14389
  });
14391
14390
  if (result.status !== 0) return;
14392
14391
  const prefix = result.stdout.toString().trim();
14393
14392
  if (!prefix) return;
14394
- const binDir = os60.id === "win32" ? prefix : path24.join(prefix, "bin");
14395
- os60.augmentPath([binDir]);
14393
+ const binDir = os59.id === "win32" ? prefix : path24.join(prefix, "bin");
14394
+ os59.augmentPath([binDir]);
14396
14395
  } catch {
14397
14396
  }
14398
14397
  }
@@ -14476,9 +14475,9 @@ var import_node_child_process8 = require("child_process");
14476
14475
  // src/agents/coderabbit/installer.ts
14477
14476
  var import_node_child_process6 = require("child_process");
14478
14477
  var INSTALL_URL = "https://cli.coderabbit.ai/install.sh";
14479
- async function ensureCoderabbitInstalled(os60) {
14480
- if (os60.findInPath("coderabbit")) return true;
14481
- if (os60.id === "win32") {
14478
+ async function ensureCoderabbitInstalled(os59) {
14479
+ if (os59.findInPath("coderabbit")) return true;
14480
+ if (os59.id === "win32") {
14482
14481
  console.error(
14483
14482
  "\n \u2717 CodeRabbit on Windows requires WSL.\n Install the CLI inside your WSL distribution\n (curl -fsSL https://cli.coderabbit.ai/install.sh | sh)\n then re-run `codeam link coderabbit` from WSL.\n"
14484
14483
  );
@@ -14511,8 +14510,8 @@ async function ensureCoderabbitInstalled(os60) {
14511
14510
  proc.on("error", () => finish(false));
14512
14511
  });
14513
14512
  if (!ok) return false;
14514
- os60.augmentPath([`${os60.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
14515
- return os60.findInPath("coderabbit") !== null;
14513
+ os59.augmentPath([`${os59.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
14514
+ return os59.findInPath("coderabbit") !== null;
14516
14515
  }
14517
14516
 
14518
14517
  // src/agents/coderabbit/link.ts
@@ -14547,10 +14546,10 @@ function coderabbitCredentialLocator() {
14547
14546
  validate: validateNonEmptyCredential
14548
14547
  };
14549
14548
  }
14550
- function coderabbitLoginLauncher(os60) {
14549
+ function coderabbitLoginLauncher(os59) {
14551
14550
  return {
14552
14551
  async ensureInstalled() {
14553
- return ensureCoderabbitInstalled(os60);
14552
+ return ensureCoderabbitInstalled(os59);
14554
14553
  },
14555
14554
  launch() {
14556
14555
  return (0, import_node_child_process7.spawn)("coderabbit", ["auth", "login"], { stdio: "inherit" });
@@ -14606,8 +14605,8 @@ function pickLine(obj) {
14606
14605
  function toHunk(raw, groupSeverity) {
14607
14606
  if (!raw || typeof raw !== "object") return null;
14608
14607
  const o = raw;
14609
- const path80 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename", "fileName"])) ?? asString(pick(o, ["location"])?.path);
14610
- if (!path80) return null;
14608
+ const path79 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename", "fileName"])) ?? asString(pick(o, ["location"])?.path);
14609
+ if (!path79) return null;
14611
14610
  const message = asString(
14612
14611
  pick(o, [
14613
14612
  "comment",
@@ -14624,7 +14623,7 @@ function toHunk(raw, groupSeverity) {
14624
14623
  const severity = normSeverity(pick(o, ["severity", "level", "priority", "impact"])) ?? normSeverity(groupSeverity);
14625
14624
  const locObj = pick(o, ["location"]) ?? o;
14626
14625
  return {
14627
- path: path80.trim(),
14626
+ path: path79.trim(),
14628
14627
  line: pickLine(o) ?? pickLine(locObj),
14629
14628
  severity,
14630
14629
  message: (title && message ? `${title}: ${message}` : title || message).trim() || "(no message)"
@@ -14707,10 +14706,10 @@ function parsePlain(stdout) {
14707
14706
  for (const line of stdout.split(/\r?\n/)) {
14708
14707
  const m = line.match(HUNK_LINE_RE);
14709
14708
  if (!m) continue;
14710
- const [, path80, lineNo, sevToken, message] = m;
14711
- if (!path80 || !lineNo || !message) continue;
14709
+ const [, path79, lineNo, sevToken, message] = m;
14710
+ if (!path79 || !lineNo || !message) continue;
14712
14711
  hunks.push({
14713
- path: path80.trim(),
14712
+ path: path79.trim(),
14714
14713
  line: Number(lineNo),
14715
14714
  severity: sevToken ? SEVERITY_MAP[sevToken.toLowerCase()] : void 0,
14716
14715
  message: message.trim().replace(/^[*-]\s+/, "")
@@ -14770,8 +14769,8 @@ var CoderabbitRuntimeStrategy = class {
14770
14769
  meta = getAgent("coderabbit");
14771
14770
  mode = "batch";
14772
14771
  os;
14773
- constructor(os60) {
14774
- this.os = os60;
14772
+ constructor(os59) {
14773
+ this.os = os59;
14775
14774
  }
14776
14775
  getDefaultArgs() {
14777
14776
  return ["review", "--agent"];
@@ -15042,10 +15041,10 @@ function cursorCredentialLocator() {
15042
15041
  validate: validateNonEmptyCredential
15043
15042
  };
15044
15043
  }
15045
- function cursorLoginLauncher(os60) {
15044
+ function cursorLoginLauncher(os59) {
15046
15045
  return {
15047
15046
  async ensureInstalled() {
15048
- if (os60.findInPath("cursor-agent")) return true;
15047
+ if (os59.findInPath("cursor-agent")) return true;
15049
15048
  console.error(
15050
15049
  "\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"
15051
15050
  );
@@ -15109,8 +15108,8 @@ var CursorRuntimeStrategy = class {
15109
15108
  meta = getAgent("cursor");
15110
15109
  mode = "interactive";
15111
15110
  os;
15112
- constructor(os60) {
15113
- this.os = os60;
15111
+ constructor(os59) {
15112
+ this.os = os59;
15114
15113
  }
15115
15114
  async prepareLaunch() {
15116
15115
  const binary = this.os.findInPath("cursor-agent");
@@ -15326,10 +15325,10 @@ function aiderCredentialLocator() {
15326
15325
  validate: validateNonEmptyCredential
15327
15326
  };
15328
15327
  }
15329
- function aiderLoginLauncher(os60) {
15328
+ function aiderLoginLauncher(os59) {
15330
15329
  return {
15331
15330
  async ensureInstalled() {
15332
- if (os60.findInPath("aider")) return true;
15331
+ if (os59.findInPath("aider")) return true;
15333
15332
  console.error(
15334
15333
  "\n \u2717 aider binary not on PATH.\n Install Aider:\n pip install aider-chat\n then re-run `codeam link aider`.\n"
15335
15334
  );
@@ -15339,7 +15338,7 @@ function aiderLoginLauncher(os60) {
15339
15338
  console.error(
15340
15339
  "\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"
15341
15340
  );
15342
- return (0, import_node_child_process11.spawn)(os60.id === "win32" ? "cmd.exe" : "sh", os60.id === "win32" ? ["/c", "exit", "0"] : ["-c", "exit 0"], {
15341
+ return (0, import_node_child_process11.spawn)(os59.id === "win32" ? "cmd.exe" : "sh", os59.id === "win32" ? ["/c", "exit", "0"] : ["-c", "exit 0"], {
15343
15342
  stdio: "ignore"
15344
15343
  });
15345
15344
  }
@@ -15411,8 +15410,8 @@ var AiderRuntimeStrategy = class {
15411
15410
  meta = getAgent("aider");
15412
15411
  mode = "interactive";
15413
15412
  os;
15414
- constructor(os60) {
15415
- this.os = os60;
15413
+ constructor(os59) {
15414
+ this.os = os59;
15416
15415
  }
15417
15416
  async prepareLaunch() {
15418
15417
  const binary = this.os.findInPath("aider");
@@ -15544,8 +15543,8 @@ function geminiCredentialLocator() {
15544
15543
  function geminiLoginLauncher() {
15545
15544
  return {
15546
15545
  async ensureInstalled() {
15547
- const os60 = createOsStrategy();
15548
- return os60.findInPath("gemini") !== null;
15546
+ const os59 = createOsStrategy();
15547
+ return os59.findInPath("gemini") !== null;
15549
15548
  },
15550
15549
  launch() {
15551
15550
  return (0, import_node_child_process12.spawn)("gemini", ["auth", "login"], { stdio: "inherit" });
@@ -15735,8 +15734,8 @@ var GeminiRuntimeStrategy = class {
15735
15734
  meta = getAgent("gemini");
15736
15735
  mode = "interactive";
15737
15736
  os;
15738
- constructor(os60) {
15739
- this.os = os60;
15737
+ constructor(os59) {
15738
+ this.os = os59;
15740
15739
  }
15741
15740
  async prepareLaunch() {
15742
15741
  const binary = this.os.findInPath("gemini");
@@ -16027,8 +16026,8 @@ var KimiRuntimeStrategy = class {
16027
16026
  meta = getAgent("kimi");
16028
16027
  mode = "interactive";
16029
16028
  os;
16030
- constructor(os60) {
16031
- this.os = os60;
16029
+ constructor(os59) {
16030
+ this.os = os59;
16032
16031
  }
16033
16032
  async prepareLaunch() {
16034
16033
  const binary = this.os.findInPath("kimi");
@@ -16143,22 +16142,25 @@ var KimiRuntimeStrategy = class {
16143
16142
  var import_node_child_process14 = require("child_process");
16144
16143
 
16145
16144
  // src/agents/opencode/local-token.ts
16146
- var fs30 = __toESM(require("fs"));
16147
- var os27 = __toESM(require("os"));
16148
- var path34 = __toESM(require("path"));
16149
- function opencodeCredentialsPath() {
16150
- const xdgData = process.env.XDG_DATA_HOME || path34.join(os27.homedir(), ".local", "share");
16151
- return path34.join(xdgData, "opencode", "auth.json");
16152
- }
16145
+ var API_KEY_ENV_VARS2 = [
16146
+ "ANTHROPIC_API_KEY",
16147
+ "OPENAI_API_KEY",
16148
+ "GEMINI_API_KEY",
16149
+ "GROQ_API_KEY",
16150
+ "OPENROUTER_API_KEY",
16151
+ "DEEPSEEK_API_KEY"
16152
+ ];
16153
16153
  async function extractLocalOpencodeToken() {
16154
- const file = opencodeCredentialsPath();
16155
- if (!fs30.existsSync(file)) return null;
16156
- const credential = fs30.readFileSync(file, "utf8").trim();
16157
- if (credential.length === 0) return null;
16158
- return { method: "oauth", credential, source: "flat-file" };
16154
+ for (const name of API_KEY_ENV_VARS2) {
16155
+ const value = process.env[name];
16156
+ if (value && value.trim().length > 0) {
16157
+ return { method: "api_key", credential: value.trim(), source: "flat-file" };
16158
+ }
16159
+ }
16160
+ return null;
16159
16161
  }
16160
16162
  function opencodeCredentialsPaths() {
16161
- return [opencodeCredentialsPath()];
16163
+ return [];
16162
16164
  }
16163
16165
 
16164
16166
  // src/agents/opencode/runtime.ts
@@ -16167,8 +16169,8 @@ var OpencodeRuntimeStrategy = class {
16167
16169
  meta = getAgent("opencode");
16168
16170
  mode = "interactive";
16169
16171
  os;
16170
- constructor(os60) {
16171
- this.os = os60;
16172
+ constructor(os59) {
16173
+ this.os = os59;
16172
16174
  }
16173
16175
  async prepareLaunch() {
16174
16176
  const binary = this.os.findInPath("opencode");
@@ -16232,7 +16234,7 @@ var OpencodeRuntimeStrategy = class {
16232
16234
  return {
16233
16235
  publicId: "opencode",
16234
16236
  vendor: "opencode",
16235
- hint: "~/.local/share/opencode/auth.json",
16237
+ hint: "ANTHROPIC_API_KEY / OPENAI_API_KEY / \u2026 env var (opencode auto-detects)",
16236
16238
  watchPaths: opencodeCredentialsPaths,
16237
16239
  extract: extractLocalOpencodeToken,
16238
16240
  validate: validateNonEmptyCredential
@@ -16252,20 +16254,20 @@ var OpencodeRuntimeStrategy = class {
16252
16254
 
16253
16255
  // src/agents/registry.ts
16254
16256
  var runtimeBuilders = {
16255
- claude: (os60) => new ClaudeRuntimeStrategy(os60),
16256
- codex: (os60) => new CodexRuntimeStrategy(os60),
16257
- coderabbit: (os60) => new CoderabbitRuntimeStrategy(os60),
16258
- cursor: (os60) => new CursorRuntimeStrategy(os60),
16259
- aider: (os60) => new AiderRuntimeStrategy(os60),
16260
- gemini: (os60) => new GeminiRuntimeStrategy(os60),
16261
- kimi: (os60) => new KimiRuntimeStrategy(os60),
16262
- opencode: (os60) => new OpencodeRuntimeStrategy(os60)
16257
+ claude: (os59) => new ClaudeRuntimeStrategy(os59),
16258
+ codex: (os59) => new CodexRuntimeStrategy(os59),
16259
+ coderabbit: (os59) => new CoderabbitRuntimeStrategy(os59),
16260
+ cursor: (os59) => new CursorRuntimeStrategy(os59),
16261
+ aider: (os59) => new AiderRuntimeStrategy(os59),
16262
+ gemini: (os59) => new GeminiRuntimeStrategy(os59),
16263
+ kimi: (os59) => new KimiRuntimeStrategy(os59),
16264
+ opencode: (os59) => new OpencodeRuntimeStrategy(os59)
16263
16265
  };
16264
16266
  var deployBuilders = {
16265
16267
  claude: () => new ClaudeDeployStrategy(),
16266
16268
  codex: () => new CodexDeployStrategy()
16267
16269
  };
16268
- function createAgentStrategy(agent, os60 = createOsStrategy()) {
16270
+ function createAgentStrategy(agent, os59 = createOsStrategy()) {
16269
16271
  if (!AGENT_REGISTRY[agent]?.enabled) {
16270
16272
  throw new Error(
16271
16273
  `Agent "${agent}" is not supported in this codeam-cli version. Upgrade with 'npm i -g codeam-cli@latest'.`
@@ -16275,10 +16277,10 @@ function createAgentStrategy(agent, os60 = createOsStrategy()) {
16275
16277
  if (!build) {
16276
16278
  throw new Error(`No runtime strategy registered for agent "${agent}"`);
16277
16279
  }
16278
- return build(os60);
16280
+ return build(os59);
16279
16281
  }
16280
- function createInteractiveAgentStrategy(agent, os60 = createOsStrategy()) {
16281
- const s = createAgentStrategy(agent, os60);
16282
+ function createInteractiveAgentStrategy(agent, os59 = createOsStrategy()) {
16283
+ const s = createAgentStrategy(agent, os59);
16282
16284
  if (s.mode !== "interactive") {
16283
16285
  throw new Error(
16284
16286
  `Agent "${agent}" is a batch agent; use createAgentStrategy + .runOneShot for one-shot reviews.`
@@ -16334,7 +16336,7 @@ function parseLinkArgs(args2) {
16334
16336
  if (apiKeyFileArg) {
16335
16337
  const filePath = apiKeyFileArg.slice("--api-key-file=".length);
16336
16338
  try {
16337
- apiKey = fs31.readFileSync(path35.resolve(filePath), "utf8").trim();
16339
+ apiKey = fs30.readFileSync(path34.resolve(filePath), "utf8").trim();
16338
16340
  } catch (err) {
16339
16341
  throw new Error(`Could not read --api-key-file ${filePath}: ${err.message}`);
16340
16342
  }
@@ -16461,7 +16463,7 @@ async function link(args2 = []) {
16461
16463
  return;
16462
16464
  }
16463
16465
  if (parsed.tokenFile) {
16464
- const credential = fs31.readFileSync(path35.resolve(parsed.tokenFile), "utf8").trim();
16466
+ const credential = fs30.readFileSync(path34.resolve(parsed.tokenFile), "utf8").trim();
16465
16467
  if (!credential) {
16466
16468
  showError(`--token-file ${parsed.tokenFile} is empty.`);
16467
16469
  process.exit(1);
@@ -16681,13 +16683,13 @@ async function linkDryRunPreflight(ctx) {
16681
16683
  var import_node_child_process16 = require("child_process");
16682
16684
  var import_node_os4 = require("os");
16683
16685
  var import_node_fs5 = require("fs");
16684
- var path37 = __toESM(require("path"));
16686
+ var path36 = __toESM(require("path"));
16685
16687
 
16686
16688
  // src/agents/coderabbit/oauth.ts
16687
16689
  var import_node_child_process15 = require("child_process");
16688
- var fs32 = __toESM(require("fs"));
16689
- var os28 = __toESM(require("os"));
16690
- var path36 = __toESM(require("path"));
16690
+ var fs31 = __toESM(require("fs"));
16691
+ var os27 = __toESM(require("os"));
16692
+ var path35 = __toESM(require("path"));
16691
16693
  function parseCoderabbitAuthEvent(line) {
16692
16694
  const l = line.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "").trim();
16693
16695
  if (!l || l[0] !== "{") return null;
@@ -16736,8 +16738,8 @@ function resolvePython() {
16736
16738
  function spawnCoderabbitLoginProc(cmd, args2) {
16737
16739
  const python = resolvePython();
16738
16740
  if (python) {
16739
- const helper = path36.join(os28.tmpdir(), "codeam-cr-pty.py");
16740
- fs32.writeFileSync(helper, PYTHON_PTY_HELPER, { mode: 420 });
16741
+ const helper = path35.join(os27.tmpdir(), "codeam-cr-pty.py");
16742
+ fs31.writeFileSync(helper, PYTHON_PTY_HELPER, { mode: 420 });
16741
16743
  return (0, import_node_child_process15.spawn)(python, [helper, cmd, ...args2], {
16742
16744
  stdio: ["pipe", "pipe", "pipe"],
16743
16745
  env: { ...process.env, TERM: "xterm-256color", COLUMNS: "220", LINES: "50" },
@@ -16848,7 +16850,7 @@ function runCoderabbitOAuthLogin(deps) {
16848
16850
  });
16849
16851
  }
16850
16852
  function coderabbitDir(home) {
16851
- return path36.join(home ?? os28.homedir(), ".coderabbit");
16853
+ return path35.join(home ?? os27.homedir(), ".coderabbit");
16852
16854
  }
16853
16855
  var NON_CREDENTIAL = /* @__PURE__ */ new Set(["doctor.json", "machine-id"]);
16854
16856
  function snapshotCredentialDir(home) {
@@ -16856,14 +16858,14 @@ function snapshotCredentialDir(home) {
16856
16858
  const snap = {};
16857
16859
  let entries;
16858
16860
  try {
16859
- entries = fs32.readdirSync(dir, { withFileTypes: true });
16861
+ entries = fs31.readdirSync(dir, { withFileTypes: true });
16860
16862
  } catch {
16861
16863
  return snap;
16862
16864
  }
16863
16865
  for (const e of entries) {
16864
16866
  if (!e.isFile() || NON_CREDENTIAL.has(e.name)) continue;
16865
16867
  try {
16866
- const st3 = fs32.statSync(path36.join(dir, e.name));
16868
+ const st3 = fs31.statSync(path35.join(dir, e.name));
16867
16869
  snap[e.name] = `${st3.mtimeMs}:${st3.size}`;
16868
16870
  } catch {
16869
16871
  }
@@ -16881,7 +16883,7 @@ function diffCapturedCredential(before, home) {
16881
16883
  }
16882
16884
  if (!best) return null;
16883
16885
  try {
16884
- return { file: best.file, contents: fs32.readFileSync(path36.join(dir, best.file), "utf8") };
16886
+ return { file: best.file, contents: fs31.readFileSync(path35.join(dir, best.file), "utf8") };
16885
16887
  } catch {
16886
16888
  return null;
16887
16889
  }
@@ -16958,7 +16960,7 @@ function collectChangedFiles(cwd) {
16958
16960
  return [...byPath.values()];
16959
16961
  }
16960
16962
  function restoreCoderabbitOauthBlob(value) {
16961
- const dir = path37.join((0, import_node_os4.homedir)(), ".coderabbit");
16963
+ const dir = path36.join((0, import_node_os4.homedir)(), ".coderabbit");
16962
16964
  (0, import_node_fs5.mkdirSync)(dir, { recursive: true });
16963
16965
  let file = "auth.json";
16964
16966
  let contents = value.trim();
@@ -16966,35 +16968,35 @@ function restoreCoderabbitOauthBlob(value) {
16966
16968
  try {
16967
16969
  const parsed = JSON.parse(contents);
16968
16970
  if (typeof parsed.file === "string" && typeof parsed.contents === "string") {
16969
- file = path37.basename(parsed.file);
16971
+ file = path36.basename(parsed.file);
16970
16972
  contents = parsed.contents;
16971
16973
  }
16972
16974
  } catch {
16973
16975
  }
16974
16976
  }
16975
- (0, import_node_fs5.writeFileSync)(path37.join(dir, file), contents, { mode: 384 });
16977
+ (0, import_node_fs5.writeFileSync)(path36.join(dir, file), contents, { mode: 384 });
16976
16978
  }
16977
16979
  async function configureCoderabbit(input, deps = {}) {
16978
- const os60 = deps.os ?? createOsStrategy();
16980
+ const os59 = deps.os ?? createOsStrategy();
16979
16981
  const ensureInstalled = deps.ensureInstalled ?? ensureCoderabbitInstalled;
16980
16982
  const isLoggedIn = deps.isLoggedIn ?? defaultIsLoggedIn;
16981
16983
  const runOAuth = deps.runOAuthLogin ?? runCoderabbitOAuthLogin;
16982
16984
  const snapshot = deps.snapshotDir ?? (() => snapshotCredentialDir());
16983
16985
  const capture2 = deps.captureCredential ?? ((b) => diffCapturedCredential(b));
16984
16986
  const loginWithApiKey = deps.loginWithApiKey ?? defaultLoginWithApiKey;
16985
- const home = os60.homeDir();
16986
- os60.augmentPath(
16987
- os60.id === "win32" ? [
16988
- path37.join(home, ".local", "bin"),
16989
- path37.join(process.env.APPDATA ?? path37.join(home, "AppData", "Roaming"), "npm"),
16990
- path37.join(home, "scoop", "shims")
16991
- ] : [path37.join(home, ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"]
16987
+ const home = os59.homeDir();
16988
+ os59.augmentPath(
16989
+ os59.id === "win32" ? [
16990
+ path36.join(home, ".local", "bin"),
16991
+ path36.join(process.env.APPDATA ?? path36.join(home, "AppData", "Roaming"), "npm"),
16992
+ path36.join(home, "scoop", "shims")
16993
+ ] : [path36.join(home, ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"]
16992
16994
  );
16993
- const installed2 = os60.findInPath("coderabbit") !== null;
16995
+ const installed2 = os59.findInPath("coderabbit") !== null;
16994
16996
  const base = () => ({
16995
16997
  action: input.action,
16996
16998
  supported: true,
16997
- installed: os60.findInPath("coderabbit") !== null,
16999
+ installed: os59.findInPath("coderabbit") !== null,
16998
17000
  loggedIn: false
16999
17001
  });
17000
17002
  if (input.action === "status") {
@@ -17008,7 +17010,7 @@ async function configureCoderabbit(input, deps = {}) {
17008
17010
  const key = (input.apiKey ?? "").trim();
17009
17011
  if (!key) return { ...res2, error: "No API key provided" };
17010
17012
  if (!res2.installed) {
17011
- const ok = await ensureInstalled(os60);
17013
+ const ok = await ensureInstalled(os59);
17012
17014
  res2.installed = ok;
17013
17015
  if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
17014
17016
  }
@@ -17032,7 +17034,7 @@ async function configureCoderabbit(input, deps = {}) {
17032
17034
  }
17033
17035
  if (!res2.installed) {
17034
17036
  deps.onEvent?.({ kind: "installing" });
17035
- const ok = await ensureInstalled(os60);
17037
+ const ok = await ensureInstalled(os59);
17036
17038
  res2.installed = ok;
17037
17039
  if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
17038
17040
  }
@@ -17062,7 +17064,7 @@ async function configureCoderabbit(input, deps = {}) {
17062
17064
  const res2 = base();
17063
17065
  if (!installed2) {
17064
17066
  deps.onEvent?.({ kind: "installing" });
17065
- const ok = await ensureInstalled(os60);
17067
+ const ok = await ensureInstalled(os59);
17066
17068
  res2.installed = ok;
17067
17069
  if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
17068
17070
  }
@@ -17102,7 +17104,7 @@ async function configureCoderabbit(input, deps = {}) {
17102
17104
  }
17103
17105
  const res = base();
17104
17106
  if (!res.installed) {
17105
- const ok = await ensureInstalled(os60);
17107
+ const ok = await ensureInstalled(os59);
17106
17108
  res.installed = ok;
17107
17109
  if (!ok) return { ...res, error: "CodeRabbit CLI is not installed" };
17108
17110
  }
@@ -17286,9 +17288,9 @@ function defaultRunGh(args2) {
17286
17288
 
17287
17289
  // src/commands/host-agent.ts
17288
17290
  var import_node_child_process25 = require("child_process");
17289
- var os39 = __toESM(require("os"));
17290
- var fs44 = __toESM(require("fs"));
17291
- var path47 = __toESM(require("path"));
17291
+ var os38 = __toESM(require("os"));
17292
+ var fs43 = __toESM(require("fs"));
17293
+ var path46 = __toESM(require("path"));
17292
17294
 
17293
17295
  // src/integrations/manifest.ts
17294
17296
  var import_node_fs7 = __toESM(require("fs"));
@@ -17434,14 +17436,14 @@ function describeReason(reason) {
17434
17436
  }
17435
17437
 
17436
17438
  // src/commands/host/host-client.ts
17437
- var fs36 = __toESM(require("fs"));
17438
- var os32 = __toESM(require("os"));
17439
- var path40 = __toESM(require("path"));
17439
+ var fs35 = __toESM(require("fs"));
17440
+ var os31 = __toESM(require("os"));
17441
+ var path39 = __toESM(require("path"));
17440
17442
  var import_node_crypto9 = require("crypto");
17441
17443
  function sampleCpuTimes() {
17442
17444
  let idle = 0;
17443
17445
  let total = 0;
17444
- for (const cpu of os32.cpus()) {
17446
+ for (const cpu of os31.cpus()) {
17445
17447
  const t2 = cpu.times;
17446
17448
  idle += t2.idle;
17447
17449
  total += t2.user + t2.nice + t2.sys + t2.idle + t2.irq;
@@ -17460,8 +17462,8 @@ var MetricsCollector = class {
17460
17462
  const prev = this.prevCpu;
17461
17463
  this.prevCpu = current;
17462
17464
  if (!prev) {
17463
- const cores = os32.cpus().length || 1;
17464
- const proxy = os32.loadavg()[0] / cores * 100;
17465
+ const cores = os31.cpus().length || 1;
17466
+ const proxy = os31.loadavg()[0] / cores * 100;
17465
17467
  return Math.min(100, Math.max(0, Math.round(proxy)));
17466
17468
  }
17467
17469
  const idleDelta = current.idle - prev.idle;
@@ -17474,8 +17476,8 @@ var MetricsCollector = class {
17474
17476
  collect() {
17475
17477
  return {
17476
17478
  cpuPct: this.cpuPct(),
17477
- ramUsedMb: Math.round((os32.totalmem() - os32.freemem()) / 1048576),
17478
- ramTotalMb: Math.round(os32.totalmem() / 1048576),
17479
+ ramUsedMb: Math.round((os31.totalmem() - os31.freemem()) / 1048576),
17480
+ ramTotalMb: Math.round(os31.totalmem() / 1048576),
17479
17481
  latencyMs: this.lastLatencyMs
17480
17482
  };
17481
17483
  }
@@ -17484,19 +17486,19 @@ function apiBase() {
17484
17486
  return process.env.CODEAM_API_URL ?? resolveApiBaseUrl();
17485
17487
  }
17486
17488
  function hostIdentityPath() {
17487
- return path40.join(os32.homedir(), ".codeam", "host-agent.json");
17489
+ return path39.join(os31.homedir(), ".codeam", "host-agent.json");
17488
17490
  }
17489
17491
  function collectOsInfo() {
17490
17492
  return {
17491
- distro: os32.platform(),
17492
- arch: os32.arch(),
17493
- kernel: os32.release(),
17493
+ distro: os31.platform(),
17494
+ arch: os31.arch(),
17495
+ kernel: os31.release(),
17494
17496
  nodeVersion: process.versions.node
17495
17497
  };
17496
17498
  }
17497
17499
  function loadHostIdentity() {
17498
17500
  try {
17499
- const raw = fs36.readFileSync(hostIdentityPath(), "utf8");
17501
+ const raw = fs35.readFileSync(hostIdentityPath(), "utf8");
17500
17502
  const parsed = JSON.parse(raw);
17501
17503
  if (typeof parsed === "object" && parsed !== null && typeof parsed.hostId === "string" && typeof parsed.hostToken === "string" && typeof parsed.controlPluginId === "string") {
17502
17504
  const p2 = parsed;
@@ -17515,8 +17517,8 @@ function loadHostIdentity() {
17515
17517
  }
17516
17518
  function saveHostIdentity(identity) {
17517
17519
  const file = hostIdentityPath();
17518
- fs36.mkdirSync(path40.dirname(file), { recursive: true, mode: 448 });
17519
- fs36.writeFileSync(file, JSON.stringify(identity, null, 2), {
17520
+ fs35.mkdirSync(path39.dirname(file), { recursive: true, mode: 448 });
17521
+ fs35.writeFileSync(file, JSON.stringify(identity, null, 2), {
17520
17522
  encoding: "utf8",
17521
17523
  mode: 384
17522
17524
  });
@@ -17561,7 +17563,7 @@ function isTerminalEnrollError(err) {
17561
17563
  }
17562
17564
  function deleteHostIdentity() {
17563
17565
  try {
17564
- fs36.rmSync(hostIdentityPath(), { force: true });
17566
+ fs35.rmSync(hostIdentityPath(), { force: true });
17565
17567
  } catch {
17566
17568
  }
17567
17569
  }
@@ -17585,7 +17587,7 @@ async function postJson(pathname, body) {
17585
17587
  function resolveHostLabel(label) {
17586
17588
  const explicit = label?.trim();
17587
17589
  const envLabel = process.env.CODEAM_HOST_LABEL?.trim();
17588
- const resolved = explicit || envLabel || os32.hostname();
17590
+ const resolved = explicit || envLabel || os31.hostname();
17589
17591
  return resolved.slice(0, 80);
17590
17592
  }
17591
17593
  async function redeemEnrollToken(token, label) {
@@ -17696,17 +17698,17 @@ async function reportDeployProgress(auth, deployId, step, message, sessionId) {
17696
17698
  }
17697
17699
 
17698
17700
  // src/commands/host/workspace.ts
17699
- var fs37 = __toESM(require("fs"));
17700
- var os33 = __toESM(require("os"));
17701
- var path41 = __toESM(require("path"));
17701
+ var fs36 = __toESM(require("fs"));
17702
+ var os32 = __toESM(require("os"));
17703
+ var path40 = __toESM(require("path"));
17702
17704
  var import_node_child_process19 = require("child_process");
17703
17705
  var import_node_util4 = require("util");
17704
17706
  var execFileP4 = (0, import_node_util4.promisify)(import_node_child_process19.execFile);
17705
17707
  function isAbsolutePathTarget(target) {
17706
- return path41.isAbsolute(target);
17708
+ return path40.isAbsolute(target);
17707
17709
  }
17708
17710
  function selfHostedWorkspaceRoot() {
17709
- return path41.join(os33.homedir(), ".codeam", "self-hosted");
17711
+ return path40.join(os32.homedir(), ".codeam", "self-hosted");
17710
17712
  }
17711
17713
  function nonInteractiveGitEnv() {
17712
17714
  return {
@@ -17776,15 +17778,15 @@ async function configureGitCredentials(dest, repoRef, cloneToken, provider = "gi
17776
17778
  const isGitlab = provider === "gitlab";
17777
17779
  if (isGitlab ? !gitlabProjectPath(repoRef.trim()) : !githubOwnerRepo(repoRef.trim())) return;
17778
17780
  if (!cloneToken) return;
17779
- const credFile = path41.join(dest, ".git", "codeam-credentials");
17781
+ const credFile = path40.join(dest, ".git", "codeam-credentials");
17780
17782
  const credLine = isGitlab ? `https://oauth2:${cloneToken}@gitlab.com
17781
17783
  ` : `https://x-access-token:${cloneToken}@github.com
17782
17784
  `;
17783
- fs37.writeFileSync(credFile, credLine, { mode: 384 });
17785
+ fs36.writeFileSync(credFile, credLine, { mode: 384 });
17784
17786
  restrictToOwner(credFile);
17785
17787
  const env = nonInteractiveGitEnv();
17786
17788
  const git2 = (args2) => execFileP4("git", ["-C", dest, ...args2], { timeout: 3e4, env });
17787
- const credFilePosix = credFile.split(path41.sep).join("/");
17789
+ const credFilePosix = credFile.split(path40.sep).join("/");
17788
17790
  await git2(["config", "--local", "--replace-all", "credential.helper", ""]).catch(() => {
17789
17791
  });
17790
17792
  await git2([
@@ -17817,17 +17819,17 @@ function maskToken(text, cloneToken) {
17817
17819
  }
17818
17820
  async function prepareWorkspace(repoOrPath, deployId, cloneToken, provider = "github", branch) {
17819
17821
  if (isAbsolutePathTarget(repoOrPath)) {
17820
- if (!fs37.existsSync(repoOrPath)) {
17822
+ if (!fs36.existsSync(repoOrPath)) {
17821
17823
  throw new Error(`deploy target path does not exist: ${repoOrPath}`);
17822
17824
  }
17823
17825
  return repoOrPath;
17824
17826
  }
17825
- const dest = path41.join(selfHostedWorkspaceRoot(), deployId);
17826
- if (fs37.existsSync(path41.join(dest, ".git"))) {
17827
+ const dest = path40.join(selfHostedWorkspaceRoot(), deployId);
17828
+ if (fs36.existsSync(path40.join(dest, ".git"))) {
17827
17829
  if (cloneToken) await configureGitCredentials(dest, repoOrPath, cloneToken, provider);
17828
17830
  return dest;
17829
17831
  }
17830
- fs37.mkdirSync(selfHostedWorkspaceRoot(), { recursive: true, mode: 448 });
17832
+ fs36.mkdirSync(selfHostedWorkspaceRoot(), { recursive: true, mode: 448 });
17831
17833
  const cloneUrl = repoCloneUrl(repoOrPath, cloneToken, provider);
17832
17834
  const cloneArgs = branch ? ["clone", "--depth", "1", "--branch", branch, cloneUrl, dest] : ["clone", "--depth", "1", cloneUrl, dest];
17833
17835
  try {
@@ -17845,9 +17847,9 @@ async function prepareWorkspace(repoOrPath, deployId, cloneToken, provider = "gi
17845
17847
  }
17846
17848
 
17847
17849
  // src/commands/host/agent-provisioning.ts
17848
- var fs38 = __toESM(require("fs"));
17849
- var os34 = __toESM(require("os"));
17850
- var path42 = __toESM(require("path"));
17850
+ var fs37 = __toESM(require("fs"));
17851
+ var os33 = __toESM(require("os"));
17852
+ var path41 = __toESM(require("path"));
17851
17853
  var PUBLIC_TO_INTERNAL_AGENT = {
17852
17854
  claude_code: "claude",
17853
17855
  claude: "claude",
@@ -17864,22 +17866,22 @@ function toInternalAgentId(publicAgentId) {
17864
17866
  return PUBLIC_TO_INTERNAL_AGENT[publicAgentId] ?? null;
17865
17867
  }
17866
17868
  function ensureDir(dir) {
17867
- fs38.mkdirSync(dir, { recursive: true, mode: 448 });
17869
+ fs37.mkdirSync(dir, { recursive: true, mode: 448 });
17868
17870
  }
17869
17871
  function writeFile0600(filePath, contents) {
17870
- ensureDir(path42.dirname(filePath));
17871
- fs38.writeFileSync(filePath, contents, { encoding: "utf8", mode: 384 });
17872
+ ensureDir(path41.dirname(filePath));
17873
+ fs37.writeFileSync(filePath, contents, { encoding: "utf8", mode: 384 });
17872
17874
  restrictToOwner(filePath);
17873
17875
  }
17874
17876
  function rmIfExists(filePath) {
17875
17877
  try {
17876
- fs38.rmSync(filePath, { force: true });
17878
+ fs37.rmSync(filePath, { force: true });
17877
17879
  } catch {
17878
17880
  }
17879
17881
  }
17880
17882
  var claudeProvisioner = {
17881
17883
  write(auth, home) {
17882
- const credentialsJson = path42.join(home, ".claude", ".credentials.json");
17884
+ const credentialsJson = path41.join(home, ".claude", ".credentials.json");
17883
17885
  if (auth.kind === "api_key") {
17884
17886
  rmIfExists(credentialsJson);
17885
17887
  return { ANTHROPIC_API_KEY: auth.value };
@@ -17891,8 +17893,8 @@ var claudeProvisioner = {
17891
17893
  } else {
17892
17894
  rmIfExists(credentialsJson);
17893
17895
  }
17894
- const claudeJson = path42.join(home, ".claude.json");
17895
- if (!fs38.existsSync(claudeJson)) {
17896
+ const claudeJson = path41.join(home, ".claude.json");
17897
+ if (!fs37.existsSync(claudeJson)) {
17896
17898
  writeFile0600(
17897
17899
  claudeJson,
17898
17900
  JSON.stringify({ hasCompletedOnboarding: true, customApiKeyResponses: { approved: [] } })
@@ -17903,7 +17905,7 @@ var claudeProvisioner = {
17903
17905
  };
17904
17906
  var codexProvisioner = {
17905
17907
  write(auth, home) {
17906
- const authJson = path42.join(home, ".codex", "auth.json");
17908
+ const authJson = path41.join(home, ".codex", "auth.json");
17907
17909
  if (auth.kind === "api_key") {
17908
17910
  rmIfExists(authJson);
17909
17911
  return { OPENAI_API_KEY: auth.value };
@@ -17914,8 +17916,8 @@ var codexProvisioner = {
17914
17916
  };
17915
17917
  var geminiProvisioner = {
17916
17918
  write(auth, home) {
17917
- const settingsJson = path42.join(home, ".gemini", "settings.json");
17918
- const oauthCreds = path42.join(home, ".gemini", "oauth_creds.json");
17919
+ const settingsJson = path41.join(home, ".gemini", "settings.json");
17920
+ const oauthCreds = path41.join(home, ".gemini", "oauth_creds.json");
17919
17921
  if (auth.kind === "api_key") {
17920
17922
  rmIfExists(oauthCreds);
17921
17923
  writeFile0600(settingsJson, '{"security":{"auth":{"selectedType":"gemini-api-key"}}}');
@@ -17928,7 +17930,7 @@ var geminiProvisioner = {
17928
17930
  };
17929
17931
  var cursorProvisioner = {
17930
17932
  write(auth, home) {
17931
- const authJson = path42.join(home, ".config", "cursor", "auth.json");
17933
+ const authJson = path41.join(home, ".config", "cursor", "auth.json");
17932
17934
  if (auth.kind === "api_key") {
17933
17935
  rmIfExists(authJson);
17934
17936
  return { CURSOR_API_KEY: auth.value };
@@ -17970,22 +17972,22 @@ max_context_size = 262144
17970
17972
  var kimiProvisioner = {
17971
17973
  write(auth, home) {
17972
17974
  const credentialsFiles = [
17973
- path42.join(home, ".kimi", "credentials", "kimi-code.json"),
17974
- path42.join(home, ".kimi-code", "credentials", "kimi-code.json")
17975
+ path41.join(home, ".kimi", "credentials", "kimi-code.json"),
17976
+ path41.join(home, ".kimi-code", "credentials", "kimi-code.json")
17975
17977
  ];
17976
17978
  if (auth.kind === "api_key") {
17977
17979
  credentialsFiles.forEach(rmIfExists);
17978
17980
  return { KIMI_API_KEY: auth.value };
17979
17981
  }
17980
17982
  credentialsFiles.forEach((f) => writeFile0600(f, auth.value));
17981
- writeFile0600(path42.join(home, ".kimi-code", "config.toml"), KIMI_MANAGED_CONFIG_TOML);
17983
+ writeFile0600(path41.join(home, ".kimi-code", "config.toml"), KIMI_MANAGED_CONFIG_TOML);
17982
17984
  return {};
17983
17985
  }
17984
17986
  };
17985
17987
  var coderabbitProvisioner = {
17986
17988
  write(auth, home) {
17987
- const dir = path42.join(home, ".coderabbit");
17988
- const authJson = path42.join(dir, "auth.json");
17989
+ const dir = path41.join(home, ".coderabbit");
17990
+ const authJson = path41.join(dir, "auth.json");
17989
17991
  if (auth.kind === "api_key") {
17990
17992
  rmIfExists(authJson);
17991
17993
  return { CODERABBIT_API_KEY: auth.value };
@@ -17997,21 +17999,21 @@ var coderabbitProvisioner = {
17997
17999
  try {
17998
18000
  const parsed = JSON.parse(value);
17999
18001
  if (typeof parsed.file === "string" && typeof parsed.contents === "string") {
18000
- file = path42.basename(parsed.file);
18002
+ file = path41.basename(parsed.file);
18001
18003
  contents = parsed.contents;
18002
18004
  }
18003
18005
  } catch {
18004
18006
  }
18005
18007
  }
18006
- writeFile0600(path42.join(dir, file), contents);
18008
+ writeFile0600(path41.join(dir, file), contents);
18007
18009
  return {};
18008
18010
  }
18009
18011
  };
18010
18012
  var opencodeProvisioner = {
18011
- write(auth, home) {
18012
- const authJson = path42.join(home, ".local", "share", "opencode", "auth.json");
18013
- writeFile0600(authJson, auth.value);
18014
- return {};
18013
+ write(auth) {
18014
+ const key = auth.value.trim();
18015
+ const envName = key.startsWith("sk-ant-") ? "ANTHROPIC_API_KEY" : key.startsWith("AIza") ? "GEMINI_API_KEY" : "OPENAI_API_KEY";
18016
+ return { [envName]: key };
18015
18017
  }
18016
18018
  };
18017
18019
  var PROVISIONERS = {
@@ -18031,7 +18033,7 @@ var UnsupportedAgentError = class extends Error {
18031
18033
  this.agentId = agentId;
18032
18034
  }
18033
18035
  };
18034
- function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os34.homedir()) {
18036
+ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os33.homedir()) {
18035
18037
  const internal = toInternalAgentId(publicAgentId);
18036
18038
  if (!internal) throw new UnsupportedAgentError(publicAgentId);
18037
18039
  const provisioner = PROVISIONERS[internal];
@@ -18041,11 +18043,11 @@ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os34.homedir(
18041
18043
 
18042
18044
  // src/commands/host/git-tooling.ts
18043
18045
  var import_node_child_process20 = require("child_process");
18044
- var fs39 = __toESM(require("fs"));
18045
- var os35 = __toESM(require("os"));
18046
- var path43 = __toESM(require("path"));
18046
+ var fs38 = __toESM(require("fs"));
18047
+ var os34 = __toESM(require("os"));
18048
+ var path42 = __toESM(require("path"));
18047
18049
  function codeamBinDir() {
18048
- return process.env.CODEAM_BIN_DIR ?? path43.join(os35.homedir(), ".codeam", "bin");
18050
+ return process.env.CODEAM_BIN_DIR ?? path42.join(os34.homedir(), ".codeam", "bin");
18049
18051
  }
18050
18052
  var FALLBACK_GH_VERSION = "2.62.0";
18051
18053
  var RELEASE_API = "https://api.github.com/repos/cli/cli/releases/latest";
@@ -18077,7 +18079,7 @@ async function download(url2, dest) {
18077
18079
  const res = await fetch(url2, { headers: { "User-Agent": "codeam-cli" } });
18078
18080
  if (!res.ok || !res.body) return false;
18079
18081
  const buf = Buffer.from(await res.arrayBuffer());
18080
- fs39.writeFileSync(dest, buf);
18082
+ fs38.writeFileSync(dest, buf);
18081
18083
  return true;
18082
18084
  } catch {
18083
18085
  return false;
@@ -18100,8 +18102,8 @@ async function ensureGhCli(runner, token, deps = {}) {
18100
18102
  const version3 = await resolveVersionFn(token);
18101
18103
  const asset = `gh_${version3}_${osToken}_${arch2}`;
18102
18104
  const url2 = `https://github.com/cli/cli/releases/download/v${version3}/${asset}.${ext}`;
18103
- const tmpRoot = fs39.mkdtempSync(path43.join(os35.tmpdir(), "codeam-gh-"));
18104
- const archive = path43.join(tmpRoot, `${asset}.${ext}`);
18105
+ const tmpRoot = fs38.mkdtempSync(path42.join(os34.tmpdir(), "codeam-gh-"));
18106
+ const archive = path42.join(tmpRoot, `${asset}.${ext}`);
18105
18107
  if (!await downloadFn(url2, archive)) {
18106
18108
  log.warn("host-agent", "gh download failed \u2014 skipping (git pull/push still work via the credential helper)");
18107
18109
  return null;
@@ -18111,16 +18113,16 @@ async function ensureGhCli(runner, token, deps = {}) {
18111
18113
  log.warn("host-agent", `gh archive extraction failed (code=${String(extract.code)}) \u2014 skipping`);
18112
18114
  return null;
18113
18115
  }
18114
- const extractedBin = path43.join(tmpRoot, asset, "bin", binaryName);
18115
- if (!fs39.existsSync(extractedBin)) {
18116
+ const extractedBin = path42.join(tmpRoot, asset, "bin", binaryName);
18117
+ if (!fs38.existsSync(extractedBin)) {
18116
18118
  log.warn("host-agent", "gh binary not found in the extracted archive \u2014 skipping");
18117
18119
  return null;
18118
18120
  }
18119
18121
  const binDir = codeamBinDir();
18120
- fs39.mkdirSync(binDir, { recursive: true });
18121
- const target = path43.join(binDir, binaryName);
18122
- fs39.copyFileSync(extractedBin, target);
18123
- fs39.chmodSync(target, 493);
18122
+ fs38.mkdirSync(binDir, { recursive: true });
18123
+ const target = path42.join(binDir, binaryName);
18124
+ fs38.copyFileSync(extractedBin, target);
18125
+ fs38.chmodSync(target, 493);
18124
18126
  log.info("host-agent", `gh installed to ${target} (v${version3})`);
18125
18127
  return target;
18126
18128
  } catch (e) {
@@ -18180,8 +18182,8 @@ async function ensureGlabCli(runner, deps = {}) {
18180
18182
  const version3 = await resolveLatestGlabVersion();
18181
18183
  const asset = `glab_${version3}_${osToken}_${arch2}`;
18182
18184
  const url2 = `https://gitlab.com/gitlab-org/cli/-/releases/v${version3}/downloads/${asset}.${ext}`;
18183
- const tmpRoot = fs39.mkdtempSync(path43.join(os35.tmpdir(), "codeam-glab-"));
18184
- const archive = path43.join(tmpRoot, `${asset}.${ext}`);
18185
+ const tmpRoot = fs38.mkdtempSync(path42.join(os34.tmpdir(), "codeam-glab-"));
18186
+ const archive = path42.join(tmpRoot, `${asset}.${ext}`);
18185
18187
  if (!await downloadFn(url2, archive)) {
18186
18188
  log.warn("host-agent", "glab download failed \u2014 skipping (git push/pull still work)");
18187
18189
  return null;
@@ -18192,20 +18194,20 @@ async function ensureGlabCli(runner, deps = {}) {
18192
18194
  return null;
18193
18195
  }
18194
18196
  const candidates = [
18195
- path43.join(tmpRoot, "bin", binaryName),
18196
- path43.join(tmpRoot, asset, "bin", binaryName),
18197
- path43.join(tmpRoot, binaryName)
18197
+ path42.join(tmpRoot, "bin", binaryName),
18198
+ path42.join(tmpRoot, asset, "bin", binaryName),
18199
+ path42.join(tmpRoot, binaryName)
18198
18200
  ];
18199
- const extractedBin = candidates.find((c2) => fs39.existsSync(c2));
18201
+ const extractedBin = candidates.find((c2) => fs38.existsSync(c2));
18200
18202
  if (!extractedBin) {
18201
18203
  log.warn("host-agent", "glab binary not found in the extracted archive \u2014 skipping");
18202
18204
  return null;
18203
18205
  }
18204
18206
  const binDir = codeamBinDir();
18205
- fs39.mkdirSync(binDir, { recursive: true });
18206
- const target = path43.join(binDir, binaryName);
18207
- fs39.copyFileSync(extractedBin, target);
18208
- fs39.chmodSync(target, 493);
18207
+ fs38.mkdirSync(binDir, { recursive: true });
18208
+ const target = path42.join(binDir, binaryName);
18209
+ fs38.copyFileSync(extractedBin, target);
18210
+ fs38.chmodSync(target, 493);
18209
18211
  log.info("host-agent", `glab installed to ${target} (v${version3})`);
18210
18212
  return target;
18211
18213
  } catch (e) {
@@ -18693,24 +18695,24 @@ async function ensureModernPython(runner) {
18693
18695
  }
18694
18696
 
18695
18697
  // src/commands/host/headroom-bootstrap.ts
18696
- var fs41 = __toESM(require("fs"));
18697
- var path45 = __toESM(require("path"));
18698
- var os37 = __toESM(require("os"));
18699
-
18700
- // src/commands/host/headroom-config.ts
18701
18698
  var fs40 = __toESM(require("fs"));
18702
- var os36 = __toESM(require("os"));
18703
18699
  var path44 = __toESM(require("path"));
18700
+ var os36 = __toESM(require("os"));
18701
+
18702
+ // src/commands/host/headroom-config.ts
18703
+ var fs39 = __toESM(require("fs"));
18704
+ var os35 = __toESM(require("os"));
18705
+ var path43 = __toESM(require("path"));
18704
18706
  function headroomConfigPath() {
18705
- return path44.join(os36.homedir(), ".codeam", "headroom-config.json");
18707
+ return path43.join(os35.homedir(), ".codeam", "headroom-config.json");
18706
18708
  }
18707
18709
  function persistHeadroomConfig(config) {
18708
18710
  try {
18709
18711
  const file = headroomConfigPath();
18710
- fs40.mkdirSync(path44.dirname(file), { recursive: true, mode: 448 });
18712
+ fs39.mkdirSync(path43.dirname(file), { recursive: true, mode: 448 });
18711
18713
  const tmp = `${file}.tmp-${process.pid}`;
18712
- fs40.writeFileSync(tmp, JSON.stringify(config, null, 2), { encoding: "utf8", mode: 384 });
18713
- fs40.renameSync(tmp, file);
18714
+ fs39.writeFileSync(tmp, JSON.stringify(config, null, 2), { encoding: "utf8", mode: 384 });
18715
+ fs39.renameSync(tmp, file);
18714
18716
  restrictToOwner(file);
18715
18717
  } catch (err) {
18716
18718
  log.warn(
@@ -18720,21 +18722,21 @@ function persistHeadroomConfig(config) {
18720
18722
  }
18721
18723
  }
18722
18724
  function agentSettingsPath(kind) {
18723
- const home = os36.homedir();
18724
- if (kind === "claude") return path44.join(home, ".claude", "settings.json");
18725
- if (kind === "codex") return path44.join(home, ".codex", "auth.json");
18726
- if (kind === "copilot") return path44.join(home, ".config", "github-copilot", "hosts.json");
18725
+ const home = os35.homedir();
18726
+ if (kind === "claude") return path43.join(home, ".claude", "settings.json");
18727
+ if (kind === "codex") return path43.join(home, ".codex", "auth.json");
18728
+ if (kind === "copilot") return path43.join(home, ".config", "github-copilot", "hosts.json");
18727
18729
  return null;
18728
18730
  }
18729
18731
  function backupAgentHeadroomConfig(kind) {
18730
18732
  const src = agentSettingsPath(kind);
18731
18733
  if (!src) return;
18732
18734
  try {
18733
- if (!fs40.existsSync(src)) return;
18734
- const dest = path44.join(os36.homedir(), ".codeam", `headroom-backup-${kind}.json`);
18735
- fs40.mkdirSync(path44.dirname(dest), { recursive: true, mode: 448 });
18736
- fs40.copyFileSync(src, dest);
18737
- fs40.chmodSync(dest, 384);
18735
+ if (!fs39.existsSync(src)) return;
18736
+ const dest = path43.join(os35.homedir(), ".codeam", `headroom-backup-${kind}.json`);
18737
+ fs39.mkdirSync(path43.dirname(dest), { recursive: true, mode: 448 });
18738
+ fs39.copyFileSync(src, dest);
18739
+ fs39.chmodSync(dest, 384);
18738
18740
  log.info("host-agent", `headroom config backup: ${src} \u2192 ${dest}`);
18739
18741
  } catch (err) {
18740
18742
  log.warn(
@@ -18746,12 +18748,12 @@ function backupAgentHeadroomConfig(kind) {
18746
18748
  function restoreAgentHeadroomConfig(kind) {
18747
18749
  const dest = agentSettingsPath(kind);
18748
18750
  if (!dest) return false;
18749
- const src = path44.join(os36.homedir(), ".codeam", `headroom-backup-${kind}.json`);
18750
- if (!fs40.existsSync(src)) return false;
18751
+ const src = path43.join(os35.homedir(), ".codeam", `headroom-backup-${kind}.json`);
18752
+ if (!fs39.existsSync(src)) return false;
18751
18753
  try {
18752
- fs40.mkdirSync(path44.dirname(dest), { recursive: true, mode: 448 });
18753
- fs40.copyFileSync(src, dest);
18754
- fs40.chmodSync(dest, 384);
18754
+ fs39.mkdirSync(path43.dirname(dest), { recursive: true, mode: 448 });
18755
+ fs39.copyFileSync(src, dest);
18756
+ fs39.chmodSync(dest, 384);
18755
18757
  log.info("host-agent", `headroom config restored: ${src} \u2192 ${dest}`);
18756
18758
  return true;
18757
18759
  } catch (err) {
@@ -18764,7 +18766,7 @@ function restoreAgentHeadroomConfig(kind) {
18764
18766
  }
18765
18767
  function readHeadroomChildEnv() {
18766
18768
  try {
18767
- const raw = fs40.readFileSync(headroomConfigPath(), "utf8");
18769
+ const raw = fs39.readFileSync(headroomConfigPath(), "utf8");
18768
18770
  const parsed = JSON.parse(raw);
18769
18771
  if (typeof parsed !== "object" || parsed === null) return {};
18770
18772
  const o = parsed;
@@ -18800,49 +18802,49 @@ function bundledClaudeBinDir() {
18800
18802
  const roots = /* @__PURE__ */ new Set();
18801
18803
  let dir = __dirname;
18802
18804
  for (let i = 0; i < 6; i++) {
18803
- roots.add(path45.join(dir, "node_modules"));
18804
- const parent = path45.dirname(dir);
18805
+ roots.add(path44.join(dir, "node_modules"));
18806
+ const parent = path44.dirname(dir);
18805
18807
  if (parent === dir) break;
18806
18808
  dir = parent;
18807
18809
  }
18808
18810
  try {
18809
18811
  const main2 = require.resolve("@anthropic-ai/claude-agent-sdk");
18810
- const marker = `${path45.sep}@anthropic-ai${path45.sep}`;
18812
+ const marker = `${path44.sep}@anthropic-ai${path44.sep}`;
18811
18813
  const idx = main2.lastIndexOf(marker);
18812
18814
  if (idx !== -1) roots.add(main2.slice(0, idx));
18813
18815
  } catch {
18814
18816
  }
18815
18817
  for (const nm of roots) {
18816
- const atAnthropic = path45.join(nm, "@anthropic-ai");
18818
+ const atAnthropic = path44.join(nm, "@anthropic-ai");
18817
18819
  let entries;
18818
18820
  try {
18819
- entries = fs41.readdirSync(atAnthropic);
18821
+ entries = fs40.readdirSync(atAnthropic);
18820
18822
  } catch {
18821
18823
  continue;
18822
18824
  }
18823
18825
  for (const entry of entries) {
18824
18826
  if (!entry.startsWith("claude-agent-sdk-")) continue;
18825
- const bin = path45.join(atAnthropic, entry, "claude");
18826
- if (fs41.existsSync(bin)) return path45.dirname(bin);
18827
+ const bin = path44.join(atAnthropic, entry, "claude");
18828
+ if (fs40.existsSync(bin)) return path44.dirname(bin);
18827
18829
  }
18828
18830
  }
18829
18831
  return null;
18830
18832
  }
18831
18833
  async function getFreeDiskBytes(dir) {
18832
18834
  try {
18833
- const s = await fs41.promises.statfs(dir);
18835
+ const s = await fs40.promises.statfs(dir);
18834
18836
  return s.bsize * s.bavail;
18835
18837
  } catch {
18836
18838
  return null;
18837
18839
  }
18838
18840
  }
18839
18841
  function headroomModelsCached() {
18840
- const hubDir = process.env.HUGGINGFACE_HUB_CACHE || path45.join(
18841
- process.env.HF_HOME || path45.join(os37.homedir(), ".cache", "huggingface"),
18842
+ const hubDir = process.env.HUGGINGFACE_HUB_CACHE || path44.join(
18843
+ process.env.HF_HOME || path44.join(os36.homedir(), ".cache", "huggingface"),
18842
18844
  "hub"
18843
18845
  );
18844
18846
  return HEADROOM_MODELS.every(
18845
- (m) => fs41.existsSync(path45.join(hubDir, `models--${m.repo.replace("/", "--")}`))
18847
+ (m) => fs40.existsSync(path44.join(hubDir, `models--${m.repo.replace("/", "--")}`))
18846
18848
  );
18847
18849
  }
18848
18850
  async function setupHeadroomForSelfHosted(agent, runner = defaultHeadroomRunner, opts = {}) {
@@ -18911,7 +18913,7 @@ async function setupHeadroomForSelfHosted(agent, runner = defaultHeadroomRunner,
18911
18913
  if (initKind === "claude") {
18912
18914
  const claudeDir = bundledClaudeBinDir();
18913
18915
  if (claudeDir) {
18914
- initEnv.PATH = `${claudeDir}${path45.delimiter}${process.env["PATH"] ?? ""}`;
18916
+ initEnv.PATH = `${claudeDir}${path44.delimiter}${process.env["PATH"] ?? ""}`;
18915
18917
  log.info("host-agent", `headroom init: bundled claude on PATH (${claudeDir})`);
18916
18918
  } else {
18917
18919
  log.warn("host-agent", "headroom init: bundled claude binary not found \u2014 init may fail");
@@ -18946,9 +18948,9 @@ async function setupHeadroomForSelfHosted(agent, runner = defaultHeadroomRunner,
18946
18948
  var import_node_child_process23 = require("child_process");
18947
18949
 
18948
18950
  // src/lib/updateNotifier.ts
18949
- var fs42 = __toESM(require("fs"));
18950
- var os38 = __toESM(require("os"));
18951
- var path46 = __toESM(require("path"));
18951
+ var fs41 = __toESM(require("fs"));
18952
+ var os37 = __toESM(require("os"));
18953
+ var path45 = __toESM(require("path"));
18952
18954
  var https6 = __toESM(require("https"));
18953
18955
  var import_node_child_process22 = require("child_process");
18954
18956
  var import_picocolors3 = __toESM(require("picocolors"));
@@ -18957,12 +18959,12 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
18957
18959
  var TTL_MS = 24 * 60 * 60 * 1e3;
18958
18960
  var REQUEST_TIMEOUT_MS = 1500;
18959
18961
  function cachePath() {
18960
- const dir = path46.join(os38.homedir(), ".codeam");
18961
- return path46.join(dir, "update-check.json");
18962
+ const dir = path45.join(os37.homedir(), ".codeam");
18963
+ return path45.join(dir, "update-check.json");
18962
18964
  }
18963
18965
  function readCache() {
18964
18966
  try {
18965
- const raw = fs42.readFileSync(cachePath(), "utf8");
18967
+ const raw = fs41.readFileSync(cachePath(), "utf8");
18966
18968
  const parsed = JSON.parse(raw);
18967
18969
  if (typeof parsed.fetchedAt !== "number" || typeof parsed.latest !== "string") return null;
18968
18970
  return parsed;
@@ -18973,10 +18975,10 @@ function readCache() {
18973
18975
  function writeCache(cache) {
18974
18976
  try {
18975
18977
  const file = cachePath();
18976
- fs42.mkdirSync(path46.dirname(file), { recursive: true });
18978
+ fs41.mkdirSync(path45.dirname(file), { recursive: true });
18977
18979
  const tmp = `${file}.${process.pid}.tmp`;
18978
- fs42.writeFileSync(tmp, JSON.stringify(cache));
18979
- fs42.renameSync(tmp, file);
18980
+ fs41.writeFileSync(tmp, JSON.stringify(cache));
18981
+ fs41.renameSync(tmp, file);
18980
18982
  } catch {
18981
18983
  }
18982
18984
  }
@@ -19050,8 +19052,8 @@ function isLinkedInstall() {
19050
19052
  timeout: 2e3
19051
19053
  }).trim();
19052
19054
  if (!root) return false;
19053
- const pkgPath = path46.join(root, PKG_NAME);
19054
- return fs42.lstatSync(pkgPath).isSymbolicLink();
19055
+ const pkgPath = path45.join(root, PKG_NAME);
19056
+ return fs41.lstatSync(pkgPath).isSymbolicLink();
19055
19057
  } catch {
19056
19058
  return false;
19057
19059
  }
@@ -19087,7 +19089,7 @@ function maybeAutoUpdate(currentVersion, latest) {
19087
19089
  return;
19088
19090
  }
19089
19091
  try {
19090
- fs42.unlinkSync(cachePath());
19092
+ fs41.unlinkSync(cachePath());
19091
19093
  } catch {
19092
19094
  }
19093
19095
  process.stderr.write(` ${import_picocolors3.default.green("\u2713")} Updated. Resuming session...
@@ -19103,7 +19105,7 @@ async function autoUpgradeBeforeCriticalCommand() {
19103
19105
  if (process.env.NODE_ENV === "test") return;
19104
19106
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
19105
19107
  if (process.env.CI) return;
19106
- const current = true ? "2.61.50" : null;
19108
+ const current = true ? "2.61.51" : null;
19107
19109
  if (!current) return;
19108
19110
  const cache = readCache();
19109
19111
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -19120,7 +19122,7 @@ function checkForUpdates() {
19120
19122
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
19121
19123
  if (process.env.CI) return;
19122
19124
  if (!process.stdout.isTTY) return;
19123
- const current = true ? "2.61.50" : null;
19125
+ const current = true ? "2.61.51" : null;
19124
19126
  if (!current) return;
19125
19127
  const cache = readCache();
19126
19128
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -19140,7 +19142,7 @@ var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
19140
19142
  var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
19141
19143
  var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
19142
19144
  function currentCliVersion() {
19143
- return true ? "2.61.50" : null;
19145
+ return true ? "2.61.51" : null;
19144
19146
  }
19145
19147
  function runCmd(cmd, args2, timeoutMs) {
19146
19148
  return new Promise((resolve8) => {
@@ -19207,7 +19209,7 @@ async function runSelfUpdate() {
19207
19209
 
19208
19210
  // src/commands/host/teardown.ts
19209
19211
  var import_node_child_process24 = require("child_process");
19210
- var fs43 = __toESM(require("fs"));
19212
+ var fs42 = __toESM(require("fs"));
19211
19213
  var defaultDisableService = () => {
19212
19214
  try {
19213
19215
  (0, import_node_child_process24.execFileSync)("systemctl", ["disable", "--now", "codeam-host-agent"], { stdio: "ignore" });
@@ -19216,7 +19218,7 @@ var defaultDisableService = () => {
19216
19218
  };
19217
19219
  var defaultTeardownHeadroom = () => {
19218
19220
  try {
19219
- const kind = JSON.parse(fs43.readFileSync(headroomConfigPath(), "utf8")).agent;
19221
+ const kind = JSON.parse(fs42.readFileSync(headroomConfigPath(), "utf8")).agent;
19220
19222
  if (kind) {
19221
19223
  (0, import_node_child_process24.execFileSync)("headroom", ["unwrap", kind], { stdio: "ignore", timeout: 15e3 });
19222
19224
  }
@@ -19284,8 +19286,8 @@ function maybeResumeLocalHeadroomReporter(ctx) {
19284
19286
  if (process.env["HEADROOM_ENABLED"] === "1") return null;
19285
19287
  try {
19286
19288
  const file = headroomConfigPath();
19287
- if (!fs44.existsSync(file)) return null;
19288
- const cfg = JSON.parse(fs44.readFileSync(file, "utf8"));
19289
+ if (!fs43.existsSync(file)) return null;
19290
+ const cfg = JSON.parse(fs43.readFileSync(file, "utf8"));
19289
19291
  if (!cfg?.enabled) return null;
19290
19292
  const agent = cfg.agent ?? "claude";
19291
19293
  const ingestUrl = `${resolveApiBaseUrl()}/api/sessions/${ctx.sessionId}/headroom-savings`;
@@ -19856,13 +19858,13 @@ var HostAgentSupervisor = class {
19856
19858
  const relay = this.relay;
19857
19859
  if (!relay) return;
19858
19860
  const raw = cmd.payload?.path;
19859
- const target = typeof raw === "string" && raw.trim() ? path47.resolve(raw.trim()) : os39.homedir();
19861
+ const target = typeof raw === "string" && raw.trim() ? path46.resolve(raw.trim()) : os38.homedir();
19860
19862
  try {
19861
- const dirents = await fs44.promises.readdir(target, { withFileTypes: true });
19863
+ const dirents = await fs43.promises.readdir(target, { withFileTypes: true });
19862
19864
  const entries = dirents.filter((d3) => !d3.name.startsWith(".")).map((d3) => ({ name: d3.name, isDir: d3.isDirectory() })).sort(
19863
19865
  (a, b) => a.isDir === b.isDir ? a.name.localeCompare(b.name) : a.isDir ? -1 : 1
19864
19866
  );
19865
- const parent = path47.dirname(target);
19867
+ const parent = path46.dirname(target);
19866
19868
  await relay.sendResult(cmd.id, "completed", {
19867
19869
  path: target,
19868
19870
  // null at the filesystem root so the UI can hide the ".." affordance.
@@ -20090,14 +20092,14 @@ var HostAgentSupervisor = class {
20090
20092
  API_TIMEOUT_MS: "3000000",
20091
20093
  CODEAM_AUTO_TOKEN: payload.autoPairToken
20092
20094
  };
20093
- const houseConfigDir = path47.join(
20094
- os39.homedir(),
20095
+ const houseConfigDir = path46.join(
20096
+ os38.homedir(),
20095
20097
  ".codeam",
20096
20098
  "house-claude",
20097
20099
  payload.deployId
20098
20100
  );
20099
20101
  try {
20100
- fs44.mkdirSync(houseConfigDir, { recursive: true, mode: 448 });
20102
+ fs43.mkdirSync(houseConfigDir, { recursive: true, mode: 448 });
20101
20103
  } catch {
20102
20104
  }
20103
20105
  childEnv.CLAUDE_CONFIG_DIR = houseConfigDir;
@@ -20116,7 +20118,7 @@ var HostAgentSupervisor = class {
20116
20118
  report("installing", "installing agent CLI");
20117
20119
  await this.runAgentInstall(payload.agentInstallScript);
20118
20120
  }
20119
- const home = process.env.HOME || os39.homedir();
20121
+ const home = process.env.HOME || os38.homedir();
20120
20122
  childEnv.PATH = `${home}/.local/bin:${process.env.PATH ?? ""}`;
20121
20123
  if (payload.cloneToken) {
20122
20124
  try {
@@ -20124,13 +20126,13 @@ var HostAgentSupervisor = class {
20124
20126
  if ((payload.repoProvider ?? "github") === "gitlab") {
20125
20127
  const glabCmd = await ensureGlabCli(defaultGitToolingRunner);
20126
20128
  if (glabCmd) {
20127
- childEnv.PATH = `${codeamBinDir()}${path47.delimiter}${childEnv.PATH}`;
20129
+ childEnv.PATH = `${codeamBinDir()}${path46.delimiter}${childEnv.PATH}`;
20128
20130
  await ensureGlabAuth(defaultGitToolingRunner, glabCmd, payload.cloneToken);
20129
20131
  }
20130
20132
  } else {
20131
20133
  const ghCmd = await ensureGhCli(defaultGitToolingRunner, payload.cloneToken);
20132
20134
  if (ghCmd) {
20133
- childEnv.PATH = `${codeamBinDir()}${path47.delimiter}${childEnv.PATH}`;
20135
+ childEnv.PATH = `${codeamBinDir()}${path46.delimiter}${childEnv.PATH}`;
20134
20136
  await ensureGhAuth(defaultGitToolingRunner, ghCmd, payload.cloneToken);
20135
20137
  }
20136
20138
  }
@@ -20147,7 +20149,7 @@ var HostAgentSupervisor = class {
20147
20149
  }
20148
20150
  if (payload.headroomEnabled && payload.headroomAgent && payload.headroomSavingsIngestUrl && isHeadroomSupportedAgent(payload.headroomAgent)) {
20149
20151
  report("headroom", "setting up Headroom proxy");
20150
- const freeBytes = await this.getFreeDisk(os39.homedir());
20152
+ const freeBytes = await this.getFreeDisk(os38.homedir());
20151
20153
  const alreadyInstalled = this.isHeadroomInstalled();
20152
20154
  if (!alreadyInstalled && freeBytes !== null && freeBytes < HEADROOM_MIN_FREE_DISK_BYTES) {
20153
20155
  const freeGb = (freeBytes / 1e9).toFixed(1);
@@ -20338,7 +20340,7 @@ var HostAgentSupervisor = class {
20338
20340
  */
20339
20341
  runAgentInstall(script) {
20340
20342
  return new Promise((resolve8) => {
20341
- const home = process.env.HOME || os39.homedir();
20343
+ const home = process.env.HOME || os38.homedir();
20342
20344
  const child = (0, import_node_child_process25.spawn)("sh", ["-c", script], {
20343
20345
  env: { ...process.env, HOME: home },
20344
20346
  stdio: ["ignore", "pipe", "pipe"]
@@ -20530,9 +20532,9 @@ async function configureHeadroom(action, ctx, deps) {
20530
20532
  }
20531
20533
 
20532
20534
  // src/services/headroom/budget-relaunch.ts
20533
- var fs45 = __toESM(require("fs"));
20534
- var os40 = __toESM(require("os"));
20535
- var path48 = __toESM(require("path"));
20535
+ var fs44 = __toESM(require("fs"));
20536
+ var os39 = __toESM(require("os"));
20537
+ var path47 = __toESM(require("path"));
20536
20538
  var import_child_process13 = require("child_process");
20537
20539
  function amendDeploymentManifestBudget(manifest, budget) {
20538
20540
  const rawArgs = manifest.proxy_args ?? [];
@@ -20566,7 +20568,7 @@ function amendDeploymentManifestBudget(manifest, budget) {
20566
20568
  return { ...manifest, proxy_args: newArgs, base_env: newEnv };
20567
20569
  }
20568
20570
  function findHeadroomDeployments(homeDir2, deps) {
20569
- const deployDir = path48.join(homeDir2, ".headroom", "deploy");
20571
+ const deployDir = path47.join(homeDir2, ".headroom", "deploy");
20570
20572
  let profiles;
20571
20573
  try {
20572
20574
  profiles = deps.readDir(deployDir);
@@ -20575,7 +20577,7 @@ function findHeadroomDeployments(homeDir2, deps) {
20575
20577
  }
20576
20578
  const results = [];
20577
20579
  for (const profile of profiles) {
20578
- const manifestPath = path48.join(deployDir, profile, "manifest.json");
20580
+ const manifestPath = path47.join(deployDir, profile, "manifest.json");
20579
20581
  let raw;
20580
20582
  try {
20581
20583
  raw = deps.readJson(manifestPath);
@@ -20607,8 +20609,8 @@ async function applyBudgetToHeadroom(budget, deps) {
20607
20609
  }
20608
20610
  function writeManifestReal(manifestPath, manifest) {
20609
20611
  const tmp = manifestPath + ".codeam.tmp";
20610
- fs45.writeFileSync(tmp, JSON.stringify(manifest, null, 2) + "\n", { mode: 384 });
20611
- fs45.renameSync(tmp, manifestPath);
20612
+ fs44.writeFileSync(tmp, JSON.stringify(manifest, null, 2) + "\n", { mode: 384 });
20613
+ fs44.renameSync(tmp, manifestPath);
20612
20614
  }
20613
20615
  function restartDeploymentReal(profile) {
20614
20616
  try {
@@ -20638,11 +20640,11 @@ function spawnProxyReal2(_budget) {
20638
20640
  });
20639
20641
  }
20640
20642
  function makeRealApplyBudgetDeps() {
20641
- const homeDir2 = os40.homedir();
20643
+ const homeDir2 = os39.homedir();
20642
20644
  return {
20643
20645
  findDeployments: () => findHeadroomDeployments(homeDir2, {
20644
- readDir: (dir) => fs45.readdirSync(dir),
20645
- readJson: (filePath) => JSON.parse(fs45.readFileSync(filePath, "utf8"))
20646
+ readDir: (dir) => fs44.readdirSync(dir),
20647
+ readJson: (filePath) => JSON.parse(fs44.readFileSync(filePath, "utf8"))
20646
20648
  }),
20647
20649
  writeManifest: writeManifestReal,
20648
20650
  restartDeployment: restartDeploymentReal,
@@ -20652,16 +20654,16 @@ function makeRealApplyBudgetDeps() {
20652
20654
  }
20653
20655
 
20654
20656
  // src/services/preview/port-registry.ts
20655
- var fs46 = __toESM(require("fs"));
20656
- var os41 = __toESM(require("os"));
20657
- var path49 = __toESM(require("path"));
20657
+ var fs45 = __toESM(require("fs"));
20658
+ var os40 = __toESM(require("os"));
20659
+ var path48 = __toESM(require("path"));
20658
20660
  var import_child_process14 = require("child_process");
20659
20661
  function registryPath() {
20660
- return path49.join(os41.homedir(), ".codeam", "preview-ports.json");
20662
+ return path48.join(os40.homedir(), ".codeam", "preview-ports.json");
20661
20663
  }
20662
20664
  function readRegistry() {
20663
20665
  try {
20664
- const raw = fs46.readFileSync(registryPath(), "utf8");
20666
+ const raw = fs45.readFileSync(registryPath(), "utf8");
20665
20667
  const parsed = JSON.parse(raw);
20666
20668
  if (parsed && typeof parsed === "object") return parsed;
20667
20669
  } catch {
@@ -20671,10 +20673,10 @@ function readRegistry() {
20671
20673
  function writeRegistry(reg) {
20672
20674
  try {
20673
20675
  const file = registryPath();
20674
- fs46.mkdirSync(path49.dirname(file), { recursive: true });
20676
+ fs45.mkdirSync(path48.dirname(file), { recursive: true });
20675
20677
  const tmp = `${file}.tmp`;
20676
- fs46.writeFileSync(tmp, JSON.stringify(reg), "utf8");
20677
- fs46.renameSync(tmp, file);
20678
+ fs45.writeFileSync(tmp, JSON.stringify(reg), "utf8");
20679
+ fs45.renameSync(tmp, file);
20678
20680
  } catch (err) {
20679
20681
  log.warn("preview", `port-registry write failed: ${err instanceof Error ? err.message : String(err)}`);
20680
20682
  }
@@ -21410,8 +21412,8 @@ function activePreviewSessionIds() {
21410
21412
 
21411
21413
  // src/services/preview/start-orchestrator.ts
21412
21414
  var import_child_process18 = require("child_process");
21413
- var fs51 = __toESM(require("fs"));
21414
- var path54 = __toESM(require("path"));
21415
+ var fs50 = __toESM(require("fs"));
21416
+ var path53 = __toESM(require("path"));
21415
21417
  var import_which2 = __toESM(require("which"));
21416
21418
  var INSTALL_TIMEOUT_MS = 5 * 6e4;
21417
21419
  var SETUP_TIMEOUT_MS = 2 * 6e4;
@@ -21478,8 +21480,8 @@ function normalizeDetectionForSpawn(detection, cwd) {
21478
21480
  if (args2.length === 0) return detection;
21479
21481
  const binName = args2[0];
21480
21482
  if (binName.startsWith("-")) return detection;
21481
- const binPath = path54.join(cwd, "node_modules", ".bin", binName);
21482
- if (!fs51.existsSync(binPath)) return detection;
21483
+ const binPath = path53.join(cwd, "node_modules", ".bin", binName);
21484
+ if (!fs50.existsSync(binPath)) return detection;
21483
21485
  return {
21484
21486
  ...detection,
21485
21487
  command: binPath,
@@ -21843,9 +21845,9 @@ async function establishTunnel(ctx, dev) {
21843
21845
 
21844
21846
  // src/beads/bd-adapter.ts
21845
21847
  var import_child_process19 = require("child_process");
21846
- var fs52 = __toESM(require("fs"));
21847
- var os43 = __toESM(require("os"));
21848
- var path55 = __toESM(require("path"));
21848
+ var fs51 = __toESM(require("fs"));
21849
+ var os42 = __toESM(require("os"));
21850
+ var path54 = __toESM(require("path"));
21849
21851
  var BD_PACKAGE = "@beads/bd";
21850
21852
  function resolveBundledBdBinary() {
21851
21853
  return _resolveSeam.resolveBundled();
@@ -21857,11 +21859,11 @@ function _defaultResolveBundled() {
21857
21859
  } catch {
21858
21860
  return null;
21859
21861
  }
21860
- const binDir = path55.join(path55.dirname(pkgJsonPath), "bin");
21862
+ const binDir = path54.join(path54.dirname(pkgJsonPath), "bin");
21861
21863
  const binaryName = process.platform === "win32" ? "bd.exe" : "bd";
21862
- const binaryPath = path55.join(binDir, binaryName);
21864
+ const binaryPath = path54.join(binDir, binaryName);
21863
21865
  try {
21864
- fs52.accessSync(binaryPath, fs52.constants.F_OK);
21866
+ fs51.accessSync(binaryPath, fs51.constants.F_OK);
21865
21867
  return binaryPath;
21866
21868
  } catch {
21867
21869
  return null;
@@ -21871,13 +21873,13 @@ function resolveBdOnPath() {
21871
21873
  return _resolveSeam.resolveOnPath();
21872
21874
  }
21873
21875
  function _defaultResolveOnPath() {
21874
- const dirs = (process.env.PATH ?? "").split(path55.delimiter).filter(Boolean);
21876
+ const dirs = (process.env.PATH ?? "").split(path54.delimiter).filter(Boolean);
21875
21877
  const candidates = process.platform === "win32" ? ["bd.exe", "bd.cmd", "bd"] : ["bd"];
21876
21878
  for (const dir of dirs) {
21877
21879
  for (const candidate of candidates) {
21878
- const full = path55.join(dir, candidate);
21880
+ const full = path54.join(dir, candidate);
21879
21881
  try {
21880
- fs52.accessSync(full, fs52.constants.F_OK);
21882
+ fs51.accessSync(full, fs51.constants.F_OK);
21881
21883
  return full;
21882
21884
  } catch {
21883
21885
  }
@@ -21962,7 +21964,7 @@ var BdAdapter = class {
21962
21964
  const env = { ...process.env };
21963
21965
  if (!env.HOME) {
21964
21966
  try {
21965
- const home = os43.homedir();
21967
+ const home = os42.homedir();
21966
21968
  if (home) env.HOME = home;
21967
21969
  } catch {
21968
21970
  }
@@ -22054,9 +22056,9 @@ function coerceIssue(row, projectKey) {
22054
22056
 
22055
22057
  // src/beads/provisioner.ts
22056
22058
  var import_child_process23 = require("child_process");
22057
- var fs55 = __toESM(require("fs"));
22058
- var os45 = __toESM(require("os"));
22059
- var path58 = __toESM(require("path"));
22059
+ var fs54 = __toESM(require("fs"));
22060
+ var os44 = __toESM(require("os"));
22061
+ var path57 = __toESM(require("path"));
22060
22062
 
22061
22063
  // src/beads/install-bd.ts
22062
22064
  var import_child_process20 = require("child_process");
@@ -22121,9 +22123,9 @@ async function installBd(platform3 = process.platform) {
22121
22123
 
22122
22124
  // src/beads/install-dolt.ts
22123
22125
  var import_child_process21 = require("child_process");
22124
- var fs53 = __toESM(require("fs"));
22125
- var os44 = __toESM(require("os"));
22126
- var path56 = __toESM(require("path"));
22126
+ var fs52 = __toESM(require("fs"));
22127
+ var os43 = __toESM(require("os"));
22128
+ var path55 = __toESM(require("path"));
22127
22129
  var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
22128
22130
  var DOLT_MSI_URL = "https://github.com/dolthub/dolt/releases/latest/download/dolt-windows-amd64.msi";
22129
22131
  function resolveDoltInstallStrategy(platform3) {
@@ -22163,11 +22165,11 @@ function resolveDoltInstallStrategy(platform3) {
22163
22165
  }
22164
22166
  var DOLT_RELEASE_BASE = "https://github.com/dolthub/dolt/releases/latest/download";
22165
22167
  function doltPlatformTuple(platform3, arch2) {
22166
- const os60 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
22168
+ const os59 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
22167
22169
  const a = arch2 === "x64" ? "amd64" : arch2 === "arm64" ? "arm64" : null;
22168
22170
  if (!a) return null;
22169
- if (os60 === "windows" && a !== "amd64") return null;
22170
- return `${os60}-${a}`;
22171
+ if (os59 === "windows" && a !== "amd64") return null;
22172
+ return `${os59}-${a}`;
22171
22173
  }
22172
22174
  function resolveDoltTarballStrategy(targetDir, platform3, arch2) {
22173
22175
  const tuple = doltPlatformTuple(platform3, arch2);
@@ -22212,14 +22214,14 @@ async function installDoltToDir(targetDir, platform3 = process.platform, arch2 =
22212
22214
  return result;
22213
22215
  }
22214
22216
  var _doltPathSeam = {
22215
- homedir: () => os44.homedir(),
22217
+ homedir: () => os43.homedir(),
22216
22218
  getPath: () => process.env.PATH ?? "",
22217
22219
  setPath: (p2) => {
22218
22220
  process.env.PATH = p2;
22219
22221
  },
22220
22222
  exists: (p2) => {
22221
22223
  try {
22222
- fs53.accessSync(p2, fs53.constants.F_OK);
22224
+ fs52.accessSync(p2, fs52.constants.F_OK);
22223
22225
  return true;
22224
22226
  } catch {
22225
22227
  return false;
@@ -22230,7 +22232,7 @@ function doltBinaryNames(platform3) {
22230
22232
  return platform3 === "win32" ? ["dolt.exe", "dolt.cmd", "dolt"] : ["dolt"];
22231
22233
  }
22232
22234
  function knownDoltDirs(platform3) {
22233
- const P3 = platform3 === "win32" ? path56.win32 : path56.posix;
22235
+ const P3 = platform3 === "win32" ? path55.win32 : path55.posix;
22234
22236
  const home = _doltPathSeam.homedir();
22235
22237
  if (platform3 === "win32") {
22236
22238
  return [
@@ -22246,7 +22248,7 @@ function knownDoltDirs(platform3) {
22246
22248
  ].filter(Boolean);
22247
22249
  }
22248
22250
  function ensureDoltResolvable(platform3 = process.platform) {
22249
- const P3 = platform3 === "win32" ? path56.win32 : path56.posix;
22251
+ const P3 = platform3 === "win32" ? path55.win32 : path55.posix;
22250
22252
  const delim = platform3 === "win32" ? ";" : ":";
22251
22253
  const names = doltBinaryNames(platform3);
22252
22254
  const pathDirs = _doltPathSeam.getPath().split(delim).filter(Boolean);
@@ -22382,8 +22384,8 @@ async function ensureSharedServer(adapter, options = {}) {
22382
22384
  // src/beads/project-key.ts
22383
22385
  var import_child_process22 = require("child_process");
22384
22386
  var crypto2 = __toESM(require("crypto"));
22385
- var fs54 = __toESM(require("fs"));
22386
- var path57 = __toESM(require("path"));
22387
+ var fs53 = __toESM(require("fs"));
22388
+ var path56 = __toESM(require("path"));
22387
22389
  function normalizeOrigin(raw) {
22388
22390
  const trimmed = raw.trim();
22389
22391
  if (!trimmed) return null;
@@ -22409,17 +22411,17 @@ function normalizeOrigin(raw) {
22409
22411
  return `${host2}/${pathPart}`;
22410
22412
  }
22411
22413
  function findRepoRoot(cwd) {
22412
- let dir = path57.resolve(cwd);
22414
+ let dir = path56.resolve(cwd);
22413
22415
  const seen = /* @__PURE__ */ new Set();
22414
22416
  for (let i = 0; i < 256; i++) {
22415
22417
  if (seen.has(dir)) return null;
22416
22418
  seen.add(dir);
22417
22419
  try {
22418
- const stat3 = fs54.statSync(path57.join(dir, ".git"), { throwIfNoEntry: false });
22420
+ const stat3 = fs53.statSync(path56.join(dir, ".git"), { throwIfNoEntry: false });
22419
22421
  if (stat3 && (stat3.isDirectory() || stat3.isFile())) return dir;
22420
22422
  } catch {
22421
22423
  }
22422
- const parent = path57.dirname(dir);
22424
+ const parent = path56.dirname(dir);
22423
22425
  if (parent === dir) return null;
22424
22426
  dir = parent;
22425
22427
  }
@@ -22430,7 +22432,7 @@ var _execSeam2 = {
22430
22432
  const out2 = (0, import_child_process22.execFileSync)(file, args2, opts);
22431
22433
  return typeof out2 === "string" ? out2 : out2.toString("utf8");
22432
22434
  },
22433
- realpath: (p2) => fs54.realpathSync(p2)
22435
+ realpath: (p2) => fs53.realpathSync(p2)
22434
22436
  };
22435
22437
  function readOrigin(cwd) {
22436
22438
  try {
@@ -22459,7 +22461,7 @@ function deriveProjectIdentity(cwd = process.cwd()) {
22459
22461
  } catch {
22460
22462
  }
22461
22463
  const hash = crypto2.createHash("sha256").update(real).digest("hex");
22462
- return { projectKey: `path:${hash}`, projectLabel: path57.basename(real) || "project" };
22464
+ return { projectKey: `path:${hash}`, projectLabel: path56.basename(real) || "project" };
22463
22465
  }
22464
22466
 
22465
22467
  // src/beads/project-prefix.ts
@@ -22506,17 +22508,17 @@ var _provisionSeam = {
22506
22508
  };
22507
22509
  var _linkSeam = {
22508
22510
  platform: () => process.platform,
22509
- homedir: () => os45.homedir(),
22511
+ homedir: () => os44.homedir(),
22510
22512
  isWritableDir: (dir) => {
22511
22513
  try {
22512
- fs55.accessSync(dir, fs55.constants.W_OK);
22514
+ fs54.accessSync(dir, fs54.constants.W_OK);
22513
22515
  return true;
22514
22516
  } catch {
22515
22517
  return false;
22516
22518
  }
22517
22519
  },
22518
22520
  ensureDir: (dir) => {
22519
- fs55.mkdirSync(dir, { recursive: true });
22521
+ fs54.mkdirSync(dir, { recursive: true });
22520
22522
  },
22521
22523
  /**
22522
22524
  * A directory to symlink `bd` into so the AGENT's shell + Claude Code's
@@ -22537,9 +22539,9 @@ var _linkSeam = {
22537
22539
  * which `linkBdOntoPath` creates if missing.
22538
22540
  */
22539
22541
  cliBinDir: () => {
22540
- const pathDirs = (process.env.PATH ?? "").split(path58.delimiter).filter(Boolean);
22542
+ const pathDirs = (process.env.PATH ?? "").split(path57.delimiter).filter(Boolean);
22541
22543
  const home = _linkSeam.homedir();
22542
- const localBin = home ? path58.join(home, ".local", "bin") : null;
22544
+ const localBin = home ? path57.join(home, ".local", "bin") : null;
22543
22545
  if (localBin) {
22544
22546
  try {
22545
22547
  _linkSeam.ensureDir(localBin);
@@ -22549,16 +22551,16 @@ var _linkSeam = {
22549
22551
  const candidates = [];
22550
22552
  if (localBin) candidates.push(localBin);
22551
22553
  try {
22552
- candidates.push(path58.dirname(process.execPath));
22554
+ candidates.push(path57.dirname(process.execPath));
22553
22555
  } catch {
22554
22556
  }
22555
22557
  candidates.push("/usr/local/bin");
22556
22558
  const entry = process.argv[1];
22557
22559
  if (entry) {
22558
22560
  try {
22559
- candidates.push(path58.dirname(fs55.realpathSync(entry)));
22561
+ candidates.push(path57.dirname(fs54.realpathSync(entry)));
22560
22562
  } catch {
22561
- candidates.push(path58.dirname(entry));
22563
+ candidates.push(path57.dirname(entry));
22562
22564
  }
22563
22565
  }
22564
22566
  const onPathWritable = candidates.find(
@@ -22570,20 +22572,20 @@ var _linkSeam = {
22570
22572
  /** Current symlink target at `linkPath`, or null when absent / not a link. */
22571
22573
  readlink: (linkPath) => {
22572
22574
  try {
22573
- return fs55.readlinkSync(linkPath);
22575
+ return fs54.readlinkSync(linkPath);
22574
22576
  } catch {
22575
22577
  return null;
22576
22578
  }
22577
22579
  },
22578
- unlink: (linkPath) => fs55.unlinkSync(linkPath),
22579
- symlink: (target, linkPath) => fs55.symlinkSync(target, linkPath)
22580
+ unlink: (linkPath) => fs54.unlinkSync(linkPath),
22581
+ symlink: (target, linkPath) => fs54.symlinkSync(target, linkPath)
22580
22582
  };
22581
22583
  function linkBdOntoPath(binaryPath) {
22582
22584
  if (_linkSeam.platform() === "win32") return;
22583
22585
  const binDir = _linkSeam.cliBinDir();
22584
22586
  if (!binDir) return;
22585
22587
  _linkSeam.ensureDir(binDir);
22586
- const linkPath = path58.join(binDir, "bd");
22588
+ const linkPath = path57.join(binDir, "bd");
22587
22589
  if (linkPath === binaryPath) return;
22588
22590
  const current = _linkSeam.readlink(linkPath);
22589
22591
  if (current === binaryPath) return;
@@ -22778,7 +22780,7 @@ function dedupeRecipes(agents) {
22778
22780
 
22779
22781
  // src/beads/watcher.ts
22780
22782
  var crypto4 = __toESM(require("crypto"));
22781
- var path59 = __toESM(require("path"));
22783
+ var path58 = __toESM(require("path"));
22782
22784
  var API_BASE6 = resolveApiBaseUrl();
22783
22785
  var DEBOUNCE_MS2 = 400;
22784
22786
  var ZERO_SUMMARY = {
@@ -22802,7 +22804,7 @@ var BeadsWatcher = class {
22802
22804
  constructor(opts) {
22803
22805
  this.opts = opts;
22804
22806
  this.bd = opts.adapter ?? new BdAdapter({ cwd: opts.cwd, beadsDir: opts.beadsDir });
22805
- this.feedPath = opts.feedPath ?? path59.join(opts.cwd ?? process.cwd(), ".beads", "last-touched");
22807
+ this.feedPath = opts.feedPath ?? path58.join(opts.cwd ?? process.cwd(), ".beads", "last-touched");
22806
22808
  this.apiBase = opts.apiBaseUrl ?? API_BASE6;
22807
22809
  }
22808
22810
  opts;
@@ -23301,8 +23303,8 @@ function cleanupAttachmentTempFiles() {
23301
23303
  function saveFilesTemp(files) {
23302
23304
  return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
23303
23305
  const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
23304
- const tmpPath = path62.join(os49.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
23305
- fs58.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
23306
+ const tmpPath = path61.join(os48.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
23307
+ fs57.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
23306
23308
  pendingAttachmentFiles.add(tmpPath);
23307
23309
  return tmpPath;
23308
23310
  });
@@ -23514,9 +23516,9 @@ var listFiles = async (ctx, cmd, parsed) => {
23514
23516
  await ctx.relay.sendResult(cmd.id, "completed", result);
23515
23517
  };
23516
23518
  var envReadH = async (ctx, cmd) => {
23517
- const envPath = path62.join(process.cwd(), ".env");
23519
+ const envPath = path61.join(process.cwd(), ".env");
23518
23520
  try {
23519
- const raw = await fs58.promises.readFile(envPath, "utf8");
23521
+ const raw = await fs57.promises.readFile(envPath, "utf8");
23520
23522
  await ctx.relay.sendResult(cmd.id, "completed", {
23521
23523
  exists: true,
23522
23524
  vars: parseDotenv(raw)
@@ -23547,14 +23549,14 @@ var envWriteH = async (ctx, cmd, parsed) => {
23547
23549
  }
23548
23550
  seen.add(v.key);
23549
23551
  }
23550
- const envPath = path62.join(process.cwd(), ".env");
23551
- const tmpPath = path62.join(process.cwd(), ".env.codeam.tmp");
23552
+ const envPath = path61.join(process.cwd(), ".env");
23553
+ const tmpPath = path61.join(process.cwd(), ".env.codeam.tmp");
23552
23554
  try {
23553
- await fs58.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
23554
- await fs58.promises.rename(tmpPath, envPath);
23555
+ await fs57.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
23556
+ await fs57.promises.rename(tmpPath, envPath);
23555
23557
  await ctx.relay.sendResult(cmd.id, "completed", { ok: true, count: vars.length });
23556
23558
  } catch (err) {
23557
- await fs58.promises.rm(tmpPath, { force: true }).catch(() => void 0);
23559
+ await fs57.promises.rm(tmpPath, { force: true }).catch(() => void 0);
23558
23560
  await ctx.relay.sendResult(cmd.id, "failed", { error: err.message });
23559
23561
  }
23560
23562
  };
@@ -23603,7 +23605,7 @@ var headroomConfigureH = async (ctx, cmd, parsed) => {
23603
23605
  let configuredAgent = rawAgentId;
23604
23606
  if (!configuredAgent) {
23605
23607
  try {
23606
- const raw = JSON.parse(fs58.readFileSync(headroomConfigPath(), "utf8"));
23608
+ const raw = JSON.parse(fs57.readFileSync(headroomConfigPath(), "utf8"));
23607
23609
  configuredAgent = raw.agent ?? "";
23608
23610
  } catch {
23609
23611
  }
@@ -23637,7 +23639,7 @@ var headroomConfigureH = async (ctx, cmd, parsed) => {
23637
23639
  persist: persistHeadroomConfig,
23638
23640
  readEnabled: () => {
23639
23641
  try {
23640
- const raw = JSON.parse(fs58.readFileSync(headroomConfigPath(), "utf8"));
23642
+ const raw = JSON.parse(fs57.readFileSync(headroomConfigPath(), "utf8"));
23641
23643
  return raw.enabled === true;
23642
23644
  } catch {
23643
23645
  return false;
@@ -23894,7 +23896,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
23894
23896
  });
23895
23897
  const token = ctx.pluginAuthToken;
23896
23898
  void (async () => {
23897
- const os60 = createOsStrategy();
23899
+ const os59 = createOsStrategy();
23898
23900
  try {
23899
23901
  const report = await reviewPullRequest(
23900
23902
  {
@@ -23903,7 +23905,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
23903
23905
  baseBranch: parsed.baseBranch
23904
23906
  },
23905
23907
  {
23906
- runReview: (input) => new CoderabbitRuntimeStrategy(os60).runOneShot(input),
23908
+ runReview: (input) => new CoderabbitRuntimeStrategy(os59).runOneShot(input),
23907
23909
  runGh: (args2) => defaultRunGh(args2),
23908
23910
  postReport: async (r) => {
23909
23911
  if (!token) return;
@@ -23941,7 +23943,7 @@ var headroomBudgetH = async (ctx, cmd) => {
23941
23943
  }
23942
23944
  let headroomActive = false;
23943
23945
  try {
23944
- const raw = JSON.parse(fs58.readFileSync(headroomConfigPath(), "utf8"));
23946
+ const raw = JSON.parse(fs57.readFileSync(headroomConfigPath(), "utf8"));
23945
23947
  headroomActive = raw.enabled === true;
23946
23948
  } catch {
23947
23949
  }
@@ -23951,7 +23953,7 @@ var headroomBudgetH = async (ctx, cmd) => {
23951
23953
  }
23952
23954
  let existingConfig = { enabled: true };
23953
23955
  try {
23954
- existingConfig = JSON.parse(fs58.readFileSync(headroomConfigPath(), "utf8"));
23956
+ existingConfig = JSON.parse(fs57.readFileSync(headroomConfigPath(), "utf8"));
23955
23957
  } catch {
23956
23958
  }
23957
23959
  if (payload.budgetEnabled && payload.budgetUsd != null) {
@@ -24064,9 +24066,9 @@ var CLI_UPDATE_MAX_ATTEMPTS = 3;
24064
24066
  function buildNpmInstallInvocation(opts) {
24065
24067
  const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
24066
24068
  const execPath = opts?.execPath ?? process.execPath;
24067
- const exists2 = opts?.existsSync ?? fs58.existsSync;
24069
+ const exists2 = opts?.existsSync ?? fs57.existsSync;
24068
24070
  const platform3 = opts?.platform ?? process.platform;
24069
- const p2 = platform3 === "win32" ? path62.win32 : path62.posix;
24071
+ const p2 = platform3 === "win32" ? path61.win32 : path61.posix;
24070
24072
  const normalized = entryScript.split(/[\\/]/).join("/");
24071
24073
  const marker = "/lib/node_modules/codeam-cli/";
24072
24074
  const markerIdx = normalized.indexOf(marker);
@@ -24929,11 +24931,11 @@ function resolveTokenValue(args2) {
24929
24931
  }
24930
24932
  const fileFlag = args2.find((a) => a.startsWith("--token-file="));
24931
24933
  if (fileFlag) {
24932
- const path80 = fileFlag.slice("--token-file=".length);
24934
+ const path79 = fileFlag.slice("--token-file=".length);
24933
24935
  try {
24934
- const content = fs59.readFileSync(path80, "utf8").trim();
24935
- if (content.length === 0) fail(`--token-file ${path80} is empty`);
24936
- rmIfExistsQuiet(path80);
24936
+ const content = fs58.readFileSync(path79, "utf8").trim();
24937
+ if (content.length === 0) fail(`--token-file ${path79} is empty`);
24938
+ rmIfExistsQuiet(path79);
24937
24939
  return content;
24938
24940
  } catch (err) {
24939
24941
  fail(`Could not read --token-file: ${err.message}`);
@@ -24962,7 +24964,7 @@ async function claimOnce(token, pluginId, pluginSecretHash) {
24962
24964
  pluginId,
24963
24965
  ideName: "codeam-cli (codespace)",
24964
24966
  ideVersion: process.env.npm_package_version ?? "unknown",
24965
- hostname: os50.hostname(),
24967
+ hostname: os49.hostname(),
24966
24968
  codespaceName: process.env.CODESPACE_NAME ?? "",
24967
24969
  // Current git branch of the codespace's working directory, so the
24968
24970
  // backend can populate `PairedSession.branch` for the codespace pair.
@@ -25023,7 +25025,7 @@ async function claim(token, pluginId, pluginSecretHash) {
25023
25025
  }
25024
25026
  }
25025
25027
  function pairAutoLockPath() {
25026
- return path63.join(os50.homedir(), ".codeam", "pair-auto.lock");
25028
+ return path62.join(os49.homedir(), ".codeam", "pair-auto.lock");
25027
25029
  }
25028
25030
  function isLivePairAuto(pid) {
25029
25031
  if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) return false;
@@ -25033,7 +25035,7 @@ function isLivePairAuto(pid) {
25033
25035
  if (e.code !== "EPERM") return false;
25034
25036
  }
25035
25037
  try {
25036
- return fs59.readFileSync(`/proc/${pid}/cmdline`, "utf8").includes("codeam");
25038
+ return fs58.readFileSync(`/proc/${pid}/cmdline`, "utf8").includes("codeam");
25037
25039
  } catch {
25038
25040
  return true;
25039
25041
  }
@@ -25043,24 +25045,24 @@ function isLiveCodeam(pid) {
25043
25045
  }
25044
25046
  function daemonLockPath(sessionId) {
25045
25047
  const safe = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
25046
- return path63.join(os50.homedir(), ".codeam", `daemon-${safe}.lock`);
25048
+ return path62.join(os49.homedir(), ".codeam", `daemon-${safe}.lock`);
25047
25049
  }
25048
25050
  function acquireDaemonLock(sessionId) {
25049
25051
  const lockPath = daemonLockPath(sessionId);
25050
25052
  try {
25051
- fs59.mkdirSync(path63.dirname(lockPath), { recursive: true });
25053
+ fs58.mkdirSync(path62.dirname(lockPath), { recursive: true });
25052
25054
  try {
25053
- fs59.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
25055
+ fs58.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
25054
25056
  } catch (e) {
25055
25057
  if (e.code !== "EEXIST") throw e;
25056
- const holder = Number(fs59.readFileSync(lockPath, "utf8").trim());
25058
+ const holder = Number(fs58.readFileSync(lockPath, "utf8").trim());
25057
25059
  if (holder && holder !== process.pid && isLiveCodeam(holder)) return false;
25058
- fs59.writeFileSync(lockPath, String(process.pid));
25060
+ fs58.writeFileSync(lockPath, String(process.pid));
25059
25061
  }
25060
25062
  const release3 = () => {
25061
25063
  try {
25062
- if (fs59.existsSync(lockPath) && Number(fs59.readFileSync(lockPath, "utf8").trim()) === process.pid) {
25063
- fs59.unlinkSync(lockPath);
25064
+ if (fs58.existsSync(lockPath) && Number(fs58.readFileSync(lockPath, "utf8").trim()) === process.pid) {
25065
+ fs58.unlinkSync(lockPath);
25064
25066
  }
25065
25067
  } catch {
25066
25068
  }
@@ -25082,19 +25084,19 @@ function acquireDaemonLock(sessionId) {
25082
25084
  function acquireSingletonLock() {
25083
25085
  const lockPath = pairAutoLockPath();
25084
25086
  try {
25085
- fs59.mkdirSync(path63.dirname(lockPath), { recursive: true });
25087
+ fs58.mkdirSync(path62.dirname(lockPath), { recursive: true });
25086
25088
  try {
25087
- fs59.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
25089
+ fs58.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
25088
25090
  } catch (e) {
25089
25091
  if (e.code !== "EEXIST") throw e;
25090
- const holder = Number(fs59.readFileSync(lockPath, "utf8").trim());
25092
+ const holder = Number(fs58.readFileSync(lockPath, "utf8").trim());
25091
25093
  if (isLivePairAuto(holder)) return false;
25092
- fs59.writeFileSync(lockPath, String(process.pid));
25094
+ fs58.writeFileSync(lockPath, String(process.pid));
25093
25095
  }
25094
25096
  process.once("exit", () => {
25095
25097
  try {
25096
- if (fs59.existsSync(lockPath) && Number(fs59.readFileSync(lockPath, "utf8").trim()) === process.pid) {
25097
- fs59.unlinkSync(lockPath);
25098
+ if (fs58.existsSync(lockPath) && Number(fs58.readFileSync(lockPath, "utf8").trim()) === process.pid) {
25099
+ fs58.unlinkSync(lockPath);
25098
25100
  }
25099
25101
  } catch {
25100
25102
  }
@@ -25541,7 +25543,7 @@ var AgentService = class _AgentService {
25541
25543
  };
25542
25544
 
25543
25545
  // src/agents/acp/adapters.ts
25544
- var path65 = __toESM(require("path"));
25546
+ var path64 = __toESM(require("path"));
25545
25547
 
25546
25548
  // src/agents/acp/agent-binary.ts
25547
25549
  var import_fs4 = __toESM(require("fs"));
@@ -25574,14 +25576,14 @@ function defaultSdkDir() {
25574
25576
  return resolveSdkDirViaRequire();
25575
25577
  }
25576
25578
  function resolveClaudeNativeBinary(deps = {}) {
25577
- const existsSync28 = deps.existsSync ?? import_fs4.default.existsSync;
25579
+ const existsSync27 = deps.existsSync ?? import_fs4.default.existsSync;
25578
25580
  const platformKey = deps.platformKey ?? currentPlatformKey();
25579
25581
  const sdkDir = deps.sdkDir !== void 0 ? deps.sdkDir : defaultSdkDir();
25580
25582
  if (!sdkDir) return null;
25581
25583
  const scopeDir = import_path8.default.dirname(sdkDir);
25582
25584
  const binName = platformKey.startsWith("win32-") ? "claude.exe" : "claude";
25583
25585
  const candidate = import_path8.default.join(scopeDir, `claude-agent-sdk-${platformKey}`, binName);
25584
- return existsSync28(candidate) ? candidate : null;
25586
+ return existsSync27(candidate) ? candidate : null;
25585
25587
  }
25586
25588
  var realSleep = (ms) => new Promise((resolve8) => setTimeout(resolve8, ms));
25587
25589
  async function waitForClaudeNativeBinary(opts = {}) {
@@ -25632,18 +25634,18 @@ async function waitForCommandOnPath(cmd, opts = {}) {
25632
25634
  return check();
25633
25635
  }
25634
25636
  function resolveCursorAgentBinary(deps = {}) {
25635
- const existsSync28 = deps.existsSync ?? import_fs4.default.existsSync;
25637
+ const existsSync27 = deps.existsSync ?? import_fs4.default.existsSync;
25636
25638
  const platform3 = deps.platform ?? process.platform;
25637
25639
  const env = deps.env ?? process.env;
25638
25640
  if (platform3 === "win32") {
25639
25641
  const localAppData = env.LOCALAPPDATA;
25640
25642
  if (!localAppData) return null;
25641
25643
  const exe = import_path8.default.win32.join(localAppData, "cursor-agent", "cursor-agent.exe");
25642
- return existsSync28(exe) ? exe : null;
25644
+ return existsSync27(exe) ? exe : null;
25643
25645
  }
25644
25646
  const home = deps.homedir ?? import_os11.default.homedir();
25645
25647
  const unix = import_path8.default.posix.join(home, ".local", "bin", "cursor-agent");
25646
- return existsSync28(unix) ? unix : null;
25648
+ return existsSync27(unix) ? unix : null;
25647
25649
  }
25648
25650
  async function waitForCursorAgent(opts = {}) {
25649
25651
  const timeoutMs = opts.timeoutMs ?? 18e4;
@@ -25831,13 +25833,13 @@ function resolveBin(pkgName, binName) {
25831
25833
  try {
25832
25834
  const manifestPath = require_.resolve(`${pkgName}/package.json`);
25833
25835
  const manifest = require_(`${pkgName}/package.json`);
25834
- const pkgDir = path65.dirname(manifestPath);
25836
+ const pkgDir = path64.dirname(manifestPath);
25835
25837
  const bin = manifest.bin;
25836
25838
  if (!bin) return null;
25837
- if (typeof bin === "string") return path65.resolve(pkgDir, bin);
25839
+ if (typeof bin === "string") return path64.resolve(pkgDir, bin);
25838
25840
  const target = binName ?? Object.keys(bin)[0];
25839
25841
  if (!target || !bin[target]) return null;
25840
- return path65.resolve(pkgDir, bin[target]);
25842
+ return path64.resolve(pkgDir, bin[target]);
25841
25843
  } catch {
25842
25844
  return null;
25843
25845
  }
@@ -25987,9 +25989,9 @@ async function resolveAcpAdapterWithRetry(agent, opts = {}) {
25987
25989
  var import_node_crypto11 = require("crypto");
25988
25990
 
25989
25991
  // src/services/history.service.ts
25990
- var fs61 = __toESM(require("fs"));
25991
- var path66 = __toESM(require("path"));
25992
- var os52 = __toESM(require("os"));
25992
+ var fs60 = __toESM(require("fs"));
25993
+ var path65 = __toESM(require("path"));
25994
+ var os51 = __toESM(require("os"));
25993
25995
  var https7 = __toESM(require("https"));
25994
25996
  var http6 = __toESM(require("http"));
25995
25997
  var import_zod2 = require("zod");
@@ -26016,7 +26018,7 @@ function parseJsonl(filePath) {
26016
26018
  const messages = [];
26017
26019
  let raw;
26018
26020
  try {
26019
- raw = fs61.readFileSync(filePath, "utf8");
26021
+ raw = fs60.readFileSync(filePath, "utf8");
26020
26022
  } catch (err) {
26021
26023
  if (err.code !== "ENOENT") {
26022
26024
  log.warn("history:parseJsonl", `read failed for ${filePath}`, err);
@@ -26157,7 +26159,7 @@ var HistoryService = class _HistoryService {
26157
26159
  return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
26158
26160
  }
26159
26161
  get projectDir() {
26160
- return this.runtime.resolveHistoryDir(this.cwd) ?? path66.join(os52.homedir(), ".claude", "projects", encodeCwd(this.cwd));
26162
+ return this.runtime.resolveHistoryDir(this.cwd) ?? path65.join(os51.homedir(), ".claude", "projects", encodeCwd(this.cwd));
26161
26163
  }
26162
26164
  /** Set the current Claude conversation ID (extracted from /cost command or session start) */
26163
26165
  setCurrentConversationId(id) {
@@ -26169,7 +26171,7 @@ var HistoryService = class _HistoryService {
26169
26171
  /** Return the current message count in the active conversation. */
26170
26172
  getCurrentMessageCount() {
26171
26173
  if (!this.currentConversationId) return 0;
26172
- const filePath = path66.join(this.projectDir, `${this.currentConversationId}.jsonl`);
26174
+ const filePath = path65.join(this.projectDir, `${this.currentConversationId}.jsonl`);
26173
26175
  return parseJsonl(filePath).length;
26174
26176
  }
26175
26177
  /**
@@ -26180,7 +26182,7 @@ var HistoryService = class _HistoryService {
26180
26182
  const deadline = Date.now() + timeoutMs;
26181
26183
  while (Date.now() < deadline) {
26182
26184
  if (!this.currentConversationId) return null;
26183
- const filePath = path66.join(this.projectDir, `${this.currentConversationId}.jsonl`);
26185
+ const filePath = path65.join(this.projectDir, `${this.currentConversationId}.jsonl`);
26184
26186
  const messages = parseJsonl(filePath);
26185
26187
  if (messages.length > previousCount) {
26186
26188
  for (let i = messages.length - 1; i >= previousCount; i--) {
@@ -26206,16 +26208,16 @@ var HistoryService = class _HistoryService {
26206
26208
  const dir = this.projectDir;
26207
26209
  const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
26208
26210
  try {
26209
- const files = fs61.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
26211
+ const files = fs60.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
26210
26212
  try {
26211
- const stat3 = fs61.statSync(path66.join(dir, e.name));
26213
+ const stat3 = fs60.statSync(path65.join(dir, e.name));
26212
26214
  return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
26213
26215
  } catch {
26214
26216
  return { name: e.name, mtime: 0, birthtime: 0 };
26215
26217
  }
26216
26218
  }).filter((f) => f.birthtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
26217
26219
  if (files.length > 0) {
26218
- this.currentConversationId = path66.basename(files[0].name, ".jsonl");
26220
+ this.currentConversationId = path65.basename(files[0].name, ".jsonl");
26219
26221
  }
26220
26222
  } catch {
26221
26223
  }
@@ -26249,13 +26251,13 @@ var HistoryService = class _HistoryService {
26249
26251
  const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
26250
26252
  let entries;
26251
26253
  try {
26252
- entries = fs61.readdirSync(dir, { withFileTypes: true });
26254
+ entries = fs60.readdirSync(dir, { withFileTypes: true });
26253
26255
  } catch {
26254
26256
  return null;
26255
26257
  }
26256
26258
  const files = entries.filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
26257
26259
  try {
26258
- const stat3 = fs61.statSync(path66.join(dir, e.name));
26260
+ const stat3 = fs60.statSync(path65.join(dir, e.name));
26259
26261
  return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
26260
26262
  } catch {
26261
26263
  return { name: e.name, mtime: 0, birthtime: 0 };
@@ -26264,12 +26266,12 @@ var HistoryService = class _HistoryService {
26264
26266
  if (files.length === 0) return null;
26265
26267
  const targetFile = this.currentConversationId ? `${this.currentConversationId}.jsonl` : files[0].name;
26266
26268
  if (!files.some((f) => f.name === targetFile)) return null;
26267
- return this.extractUsageFromFile(path66.join(dir, targetFile));
26269
+ return this.extractUsageFromFile(path65.join(dir, targetFile));
26268
26270
  }
26269
26271
  extractUsageFromFile(filePath) {
26270
26272
  let raw;
26271
26273
  try {
26272
- raw = fs61.readFileSync(filePath, "utf8");
26274
+ raw = fs60.readFileSync(filePath, "utf8");
26273
26275
  } catch {
26274
26276
  return null;
26275
26277
  }
@@ -26314,9 +26316,9 @@ var HistoryService = class _HistoryService {
26314
26316
  let totalCost = 0;
26315
26317
  let files;
26316
26318
  try {
26317
- files = fs61.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
26319
+ files = fs60.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
26318
26320
  try {
26319
- return fs61.statSync(path66.join(projectDir, f)).mtimeMs >= monthStartMs;
26321
+ return fs60.statSync(path65.join(projectDir, f)).mtimeMs >= monthStartMs;
26320
26322
  } catch {
26321
26323
  return false;
26322
26324
  }
@@ -26327,7 +26329,7 @@ var HistoryService = class _HistoryService {
26327
26329
  for (const file of files) {
26328
26330
  let raw;
26329
26331
  try {
26330
- raw = fs61.readFileSync(path66.join(projectDir, file), "utf8");
26332
+ raw = fs60.readFileSync(path65.join(projectDir, file), "utf8");
26331
26333
  } catch {
26332
26334
  continue;
26333
26335
  }
@@ -26406,7 +26408,7 @@ var HistoryService = class _HistoryService {
26406
26408
  if (this.runtime.resolveHistoryFile) {
26407
26409
  return this.runtime.resolveHistoryFile(this.cwd, sessionId);
26408
26410
  }
26409
- return path66.join(this.projectDir, `${sessionId}.jsonl`);
26411
+ return path65.join(this.projectDir, `${sessionId}.jsonl`);
26410
26412
  }
26411
26413
  /**
26412
26414
  * Parse a conversation's messages from disk, agent-aware. Claude uses the
@@ -26440,7 +26442,7 @@ var HistoryService = class _HistoryService {
26440
26442
  };
26441
26443
  });
26442
26444
  }
26443
- return parseJsonl(path66.join(this.projectDir, `${sessionId}.jsonl`));
26445
+ return parseJsonl(path65.join(this.projectDir, `${sessionId}.jsonl`));
26444
26446
  }
26445
26447
  async loadConversation(sessionId) {
26446
26448
  const messages = this.readConversation(sessionId);
@@ -26508,7 +26510,7 @@ var HistoryService = class _HistoryService {
26508
26510
  if (!filePath) return false;
26509
26511
  let mtimeMs;
26510
26512
  try {
26511
- mtimeMs = fs61.statSync(filePath).mtimeMs;
26513
+ mtimeMs = fs60.statSync(filePath).mtimeMs;
26512
26514
  } catch {
26513
26515
  return false;
26514
26516
  }
@@ -26583,10 +26585,10 @@ var HistoryService = class _HistoryService {
26583
26585
 
26584
26586
  // src/agents/acp/client.ts
26585
26587
  var import_node_child_process29 = require("child_process");
26586
- var fs62 = __toESM(require("fs/promises"));
26588
+ var fs61 = __toESM(require("fs/promises"));
26587
26589
  var fsSync = __toESM(require("fs"));
26588
- var os53 = __toESM(require("os"));
26589
- var path67 = __toESM(require("path"));
26590
+ var os52 = __toESM(require("os"));
26591
+ var path66 = __toESM(require("path"));
26590
26592
  var import_node_stream = require("stream");
26591
26593
 
26592
26594
  // ../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
@@ -31371,7 +31373,7 @@ var AcpClient = class {
31371
31373
  },
31372
31374
  readTextFile: async (params) => {
31373
31375
  try {
31374
- const content = await fs62.readFile(params.path, "utf8");
31376
+ const content = await fs61.readFile(params.path, "utf8");
31375
31377
  return applyLineRange(content, params.line ?? null, params.limit ?? null);
31376
31378
  } catch (err) {
31377
31379
  const code = err.code;
@@ -31391,7 +31393,7 @@ var AcpClient = class {
31391
31393
  },
31392
31394
  writeTextFile: async (params) => {
31393
31395
  try {
31394
- await fs62.writeFile(params.path, params.content, "utf8");
31396
+ await fs61.writeFile(params.path, params.content, "utf8");
31395
31397
  return {};
31396
31398
  } catch (err) {
31397
31399
  const code = err.code;
@@ -31451,29 +31453,29 @@ function applyLineRange(content, line, limit) {
31451
31453
  return { content: lines.slice(start2, end).join("\n") };
31452
31454
  }
31453
31455
  function knownAgentBinaryDirs() {
31454
- const home = os53.homedir();
31456
+ const home = os52.homedir();
31455
31457
  const out2 = [];
31456
31458
  out2.push("/tmp/codeam-node20/bin");
31457
31459
  for (const root of [
31458
31460
  "/usr/local/share/nvm/versions/node",
31459
- path67.join(home, ".nvm/versions/node")
31461
+ path66.join(home, ".nvm/versions/node")
31460
31462
  ]) {
31461
31463
  try {
31462
31464
  for (const child of fsSync.readdirSync(root)) {
31463
- out2.push(path67.join(root, child, "bin"));
31465
+ out2.push(path66.join(root, child, "bin"));
31464
31466
  }
31465
31467
  } catch {
31466
31468
  }
31467
31469
  }
31468
- out2.push(path67.join(home, ".volta/bin"));
31470
+ out2.push(path66.join(home, ".volta/bin"));
31469
31471
  out2.push("/usr/local/bin");
31470
31472
  out2.push("/usr/bin");
31471
- out2.push(path67.join(home, ".local/bin"));
31472
- out2.push(path67.join(home, "bin"));
31473
+ out2.push(path66.join(home, ".local/bin"));
31474
+ out2.push(path66.join(home, "bin"));
31473
31475
  if (process.platform === "win32") {
31474
31476
  const { LOCALAPPDATA, APPDATA } = process.env;
31475
- if (LOCALAPPDATA) out2.push(path67.join(LOCALAPPDATA, "cursor-agent"));
31476
- if (APPDATA) out2.push(path67.join(APPDATA, "npm"));
31477
+ if (LOCALAPPDATA) out2.push(path66.join(LOCALAPPDATA, "cursor-agent"));
31478
+ if (APPDATA) out2.push(path66.join(APPDATA, "npm"));
31477
31479
  }
31478
31480
  return out2.filter((p2) => {
31479
31481
  try {
@@ -31485,7 +31487,7 @@ function knownAgentBinaryDirs() {
31485
31487
  }
31486
31488
  function expandPathForAgentBinaries(existingPath) {
31487
31489
  const existing = new Set(
31488
- existingPath.split(path67.delimiter).filter((p2) => p2.length > 0)
31490
+ existingPath.split(path66.delimiter).filter((p2) => p2.length > 0)
31489
31491
  );
31490
31492
  const additions = [];
31491
31493
  for (const dir of knownAgentBinaryDirs()) {
@@ -31495,7 +31497,7 @@ function expandPathForAgentBinaries(existingPath) {
31495
31497
  }
31496
31498
  }
31497
31499
  if (additions.length === 0) return existingPath;
31498
- return [...additions, existingPath].filter((p2) => p2.length > 0).join(path67.delimiter);
31500
+ return [...additions, existingPath].filter((p2) => p2.length > 0).join(path66.delimiter);
31499
31501
  }
31500
31502
 
31501
31503
  // src/agents/acp/headroom-budget-proxy.ts
@@ -31977,15 +31979,15 @@ function commonPrefixLength(a, b) {
31977
31979
 
31978
31980
  // src/agents/acp/onboarding.ts
31979
31981
  var import_child_process27 = require("child_process");
31980
- var fs63 = __toESM(require("fs"));
31981
- var os54 = __toESM(require("os"));
31982
- var path68 = __toESM(require("path"));
31982
+ var fs62 = __toESM(require("fs"));
31983
+ var os53 = __toESM(require("os"));
31984
+ var path67 = __toESM(require("path"));
31983
31985
  var _onboardingSeam = {
31984
- markerPath: (sessionId) => path68.join(os54.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
31985
- exists: (p2) => fs63.existsSync(p2),
31986
+ markerPath: (sessionId) => path67.join(os53.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
31987
+ exists: (p2) => fs62.existsSync(p2),
31986
31988
  write: (p2) => {
31987
- fs63.mkdirSync(path68.dirname(p2), { recursive: true });
31988
- fs63.writeFileSync(p2, "");
31989
+ fs62.mkdirSync(path67.dirname(p2), { recursive: true });
31990
+ fs62.writeFileSync(p2, "");
31989
31991
  },
31990
31992
  disabled: () => {
31991
31993
  const v = process.env.CODEAM_ONBOARDING_DISABLED;
@@ -32022,7 +32024,7 @@ function resolveRepoName(cwd) {
32022
32024
  if (name) return name;
32023
32025
  }
32024
32026
  }
32025
- const base = path68.basename(cwd || "");
32027
+ const base = path67.basename(cwd || "");
32026
32028
  if (base && !isUuid(base)) return base;
32027
32029
  return "this project";
32028
32030
  }
@@ -32274,13 +32276,13 @@ var import_crypto5 = require("crypto");
32274
32276
 
32275
32277
  // src/services/turn-files/git-changeset.ts
32276
32278
  var import_child_process28 = require("child_process");
32277
- var fs65 = __toESM(require("fs/promises"));
32278
- var path70 = __toESM(require("path"));
32279
+ var fs64 = __toESM(require("fs/promises"));
32280
+ var path69 = __toESM(require("path"));
32279
32281
 
32280
32282
  // src/services/turn-files/review-ignore.ts
32281
32283
  var import_ignore2 = __toESM(require("ignore"));
32282
- var fs64 = __toESM(require("fs"));
32283
- var path69 = __toESM(require("path"));
32284
+ var fs63 = __toESM(require("fs"));
32285
+ var path68 = __toESM(require("path"));
32284
32286
  var CURATED_REVIEW_IGNORE = [
32285
32287
  // Google Cloud SDK (the incident) — installs a huge python tree.
32286
32288
  "google-cloud-sdk/",
@@ -32319,7 +32321,7 @@ var CURATED_REVIEW_IGNORE = [
32319
32321
  function makeReviewIgnore(repoRoot) {
32320
32322
  const ig = (0, import_ignore2.default)().add(CURATED_REVIEW_IGNORE);
32321
32323
  try {
32322
- const custom = fs64.readFileSync(path69.join(repoRoot, ".codeam", "reviewignore"), "utf8");
32324
+ const custom = fs63.readFileSync(path68.join(repoRoot, ".codeam", "reviewignore"), "utf8");
32323
32325
  ig.add(custom);
32324
32326
  } catch {
32325
32327
  }
@@ -32364,7 +32366,7 @@ async function collectRepoChangeset(opts) {
32364
32366
  let stats;
32365
32367
  if (!truncated && row.fileStatus === "added" && numstatEntry === void 0) {
32366
32368
  const lineCount = await readUntrackedLineCount(
32367
- path70.join(opts.repoRoot, row.filePath)
32369
+ path69.join(opts.repoRoot, row.filePath)
32368
32370
  );
32369
32371
  stats = { added: lineCount, removed: 0 };
32370
32372
  } else {
@@ -32395,7 +32397,7 @@ function readUntrackedLineCount(absPath) {
32395
32397
  }
32396
32398
  async function defaultReadUntrackedLineCount(absPath) {
32397
32399
  try {
32398
- const content = await fs65.readFile(absPath, "utf8");
32400
+ const content = await fs64.readFile(absPath, "utf8");
32399
32401
  let count = 0;
32400
32402
  let pos = -1;
32401
32403
  while ((pos = content.indexOf("\n", pos + 1)) !== -1) {
@@ -32487,7 +32489,7 @@ function defaultRunGit(cwd, args2) {
32487
32489
  });
32488
32490
  }
32489
32491
  async function discoverRepos(workingDir, maxDepth = 4) {
32490
- const fs71 = await import("fs/promises");
32492
+ const fs70 = await import("fs/promises");
32491
32493
  const out2 = [];
32492
32494
  await walk(workingDir, 0);
32493
32495
  return out2;
@@ -32495,7 +32497,7 @@ async function discoverRepos(workingDir, maxDepth = 4) {
32495
32497
  if (depth > maxDepth) return;
32496
32498
  let entries = [];
32497
32499
  try {
32498
- const dirents = await fs71.readdir(dir, { withFileTypes: true });
32500
+ const dirents = await fs70.readdir(dir, { withFileTypes: true });
32499
32501
  entries = dirents.filter((d3) => !d3.name.startsWith(".") || d3.name === ".git").map((d3) => ({ name: d3.name, isDirectory: d3.isDirectory() }));
32500
32502
  } catch {
32501
32503
  return;
@@ -32506,8 +32508,8 @@ async function discoverRepos(workingDir, maxDepth = 4) {
32506
32508
  if (hasGit) {
32507
32509
  out2.push({
32508
32510
  repoRoot: dir,
32509
- repoPath: path70.relative(workingDir, dir),
32510
- repoName: path70.basename(dir)
32511
+ repoPath: path69.relative(workingDir, dir),
32512
+ repoName: path69.basename(dir)
32511
32513
  });
32512
32514
  return;
32513
32515
  }
@@ -32515,14 +32517,14 @@ async function discoverRepos(workingDir, maxDepth = 4) {
32515
32517
  if (!entry.isDirectory) continue;
32516
32518
  if (entry.name === "node_modules") continue;
32517
32519
  if (entry.name === "dist" || entry.name === "build") continue;
32518
- await walk(path70.join(dir, entry.name), depth + 1);
32520
+ await walk(path69.join(dir, entry.name), depth + 1);
32519
32521
  }
32520
32522
  }
32521
32523
  }
32522
32524
 
32523
32525
  // src/services/turn-files/files-outbox.ts
32524
- var fs66 = __toESM(require("fs/promises"));
32525
- var path71 = __toESM(require("path"));
32526
+ var fs65 = __toESM(require("fs/promises"));
32527
+ var path70 = __toESM(require("path"));
32526
32528
  var import_os12 = require("os");
32527
32529
  var HOME_OUTBOX_DIR = ".codeam/outbox";
32528
32530
  var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
@@ -32555,16 +32557,16 @@ var FilesOutbox = class {
32555
32557
  backoffIndex = 0;
32556
32558
  stopped = false;
32557
32559
  constructor(opts) {
32558
- const base = opts.baseDir ?? path71.join(homeDir(), HOME_OUTBOX_DIR);
32559
- this.filePath = path71.join(base, `${opts.sessionId}.jsonl`);
32560
+ const base = opts.baseDir ?? path70.join(homeDir(), HOME_OUTBOX_DIR);
32561
+ this.filePath = path70.join(base, `${opts.sessionId}.jsonl`);
32560
32562
  this.post = opts.post;
32561
32563
  this.autoSchedule = opts.autoSchedule !== false;
32562
32564
  }
32563
32565
  /** Persist the entry to disk and trigger a flush. Returns once the
32564
32566
  * line is durable on disk (not once the POST succeeds). */
32565
32567
  async enqueue(entry) {
32566
- await fs66.mkdir(path71.dirname(this.filePath), { recursive: true });
32567
- await fs66.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
32568
+ await fs65.mkdir(path70.dirname(this.filePath), { recursive: true });
32569
+ await fs65.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
32568
32570
  this.backoffIndex = 0;
32569
32571
  if (this.autoSchedule) this.scheduleFlush(0);
32570
32572
  }
@@ -32655,7 +32657,7 @@ var FilesOutbox = class {
32655
32657
  async readAll() {
32656
32658
  let raw = "";
32657
32659
  try {
32658
- raw = await fs66.readFile(this.filePath, "utf8");
32660
+ raw = await fs65.readFile(this.filePath, "utf8");
32659
32661
  } catch {
32660
32662
  return [];
32661
32663
  }
@@ -32679,12 +32681,12 @@ var FilesOutbox = class {
32679
32681
  async rewrite(entries) {
32680
32682
  const tmpPath = `${this.filePath}.${process.pid}.tmp`;
32681
32683
  if (entries.length === 0) {
32682
- await fs66.unlink(this.filePath).catch(() => void 0);
32684
+ await fs65.unlink(this.filePath).catch(() => void 0);
32683
32685
  return;
32684
32686
  }
32685
32687
  const payload = entries.map((e) => JSON.stringify(e)).join("\n") + "\n";
32686
- await fs66.writeFile(tmpPath, payload, "utf8");
32687
- await fs66.rename(tmpPath, this.filePath);
32688
+ await fs65.writeFile(tmpPath, payload, "utf8");
32689
+ await fs65.rename(tmpPath, this.filePath);
32688
32690
  }
32689
32691
  };
32690
32692
  function applyJitter(ms) {
@@ -35598,9 +35600,9 @@ function fetchQuotaUsage(runtime, historySvc) {
35598
35600
  }
35599
35601
 
35600
35602
  // src/beads/workflow-hint.ts
35601
- var fs67 = __toESM(require("fs"));
35602
- var path72 = __toESM(require("path"));
35603
- var os55 = __toESM(require("os"));
35603
+ var fs66 = __toESM(require("fs"));
35604
+ var path71 = __toESM(require("path"));
35605
+ var os54 = __toESM(require("os"));
35604
35606
  var BEADS_HINT_MARKER = "<!-- codeam:beads-workflow -->";
35605
35607
  var BEADS_HINT = `${BEADS_HINT_MARKER}
35606
35608
  # Beads (bd) \u2014 task tracking + persistent memory (ALWAYS use it)
@@ -35614,22 +35616,22 @@ This environment uses **bd (beads)** for issue/task tracking and persistent memo
35614
35616
  - \`bd ready\` (available work) \xB7 \`bd show <id>\` \xB7 \`bd update <id> --claim\` \xB7 \`bd close <id>\`.
35615
35617
  - Use \`bd remember "..."\` for persistent knowledge \u2014 do NOT use MEMORY.md files.
35616
35618
  ${BEADS_HINT_MARKER}`;
35617
- function ensureBeadsWorkflowHint(homeDir2 = os55.homedir()) {
35619
+ function ensureBeadsWorkflowHint(homeDir2 = os54.homedir()) {
35618
35620
  try {
35619
- const file = path72.join(homeDir2, ".claude", "CLAUDE.md");
35621
+ const file = path71.join(homeDir2, ".claude", "CLAUDE.md");
35620
35622
  let existing = "";
35621
35623
  try {
35622
- existing = fs67.readFileSync(file, "utf8");
35624
+ existing = fs66.readFileSync(file, "utf8");
35623
35625
  } catch {
35624
35626
  }
35625
35627
  if (existing.includes(BEADS_HINT_MARKER)) return;
35626
- fs67.mkdirSync(path72.dirname(file), { recursive: true });
35628
+ fs66.mkdirSync(path71.dirname(file), { recursive: true });
35627
35629
  const next = existing.trim() ? `${existing.trimEnd()}
35628
35630
 
35629
35631
  ${BEADS_HINT}
35630
35632
  ` : `${BEADS_HINT}
35631
35633
  `;
35632
- fs67.writeFileSync(file, next);
35634
+ fs66.writeFileSync(file, next);
35633
35635
  } catch {
35634
35636
  }
35635
35637
  }
@@ -36038,7 +36040,7 @@ var AcpDriver = class {
36038
36040
  };
36039
36041
 
36040
36042
  // src/baton/transcript-mirror.ts
36041
- var fs68 = __toESM(require("fs"));
36043
+ var fs67 = __toESM(require("fs"));
36042
36044
  var TranscriptMirror = class {
36043
36045
  constructor(deps) {
36044
36046
  this.deps = deps;
@@ -36105,7 +36107,7 @@ var TranscriptMirror = class {
36105
36107
  }
36106
36108
  };
36107
36109
  function defaultWatch(file, onChange) {
36108
- const w3 = fs68.watch(file, { persistent: false }, () => onChange());
36110
+ const w3 = fs67.watch(file, { persistent: false }, () => onChange());
36109
36111
  return () => w3.close();
36110
36112
  }
36111
36113
 
@@ -36367,16 +36369,16 @@ function toEpochMs(ts) {
36367
36369
  }
36368
36370
 
36369
36371
  // src/agents/claude/onboarding.ts
36370
- var fs69 = __toESM(require("fs"));
36371
- var os57 = __toESM(require("os"));
36372
- var path73 = __toESM(require("path"));
36372
+ var fs68 = __toESM(require("fs"));
36373
+ var os56 = __toESM(require("os"));
36374
+ var path72 = __toESM(require("path"));
36373
36375
  var ONBOARDING_VERSION_SENTINEL = "9999.0.0";
36374
36376
  function ensureClaudeOnboarded(cwd) {
36375
36377
  try {
36376
- const file = path73.join(os57.homedir(), ".claude.json");
36378
+ const file = path72.join(os56.homedir(), ".claude.json");
36377
36379
  let config = {};
36378
36380
  try {
36379
- config = JSON.parse(fs69.readFileSync(file, "utf8"));
36381
+ config = JSON.parse(fs68.readFileSync(file, "utf8"));
36380
36382
  } catch {
36381
36383
  }
36382
36384
  let changed = false;
@@ -36401,8 +36403,8 @@ function ensureClaudeOnboarded(cwd) {
36401
36403
  }
36402
36404
  }
36403
36405
  if (!changed) return;
36404
- fs69.mkdirSync(path73.dirname(file), { recursive: true });
36405
- fs69.writeFileSync(file, JSON.stringify(config, null, 2));
36406
+ fs68.mkdirSync(path72.dirname(file), { recursive: true });
36407
+ fs68.writeFileSync(file, JSON.stringify(config, null, 2));
36406
36408
  log.info(
36407
36409
  "claude",
36408
36410
  `pre-completed Claude onboarding${cwd ? ` + trusted workspace ${cwd}` : ""}`
@@ -37120,7 +37122,7 @@ var import_picocolors11 = __toESM(require("picocolors"));
37120
37122
  var import_child_process29 = require("child_process");
37121
37123
  var import_util4 = require("util");
37122
37124
  var import_picocolors9 = __toESM(require("picocolors"));
37123
- var path74 = __toESM(require("path"));
37125
+ var path73 = __toESM(require("path"));
37124
37126
  var execFileP6 = (0, import_util4.promisify)(import_child_process29.execFile);
37125
37127
  var MAX_BUFFER = 8 * 1024 * 1024;
37126
37128
  function resetStdinForChild() {
@@ -37609,7 +37611,7 @@ var GitHubCodespacesProvider = class {
37609
37611
  });
37610
37612
  }
37611
37613
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
37612
- const remoteDir = path74.posix.dirname(remotePath);
37614
+ const remoteDir = path73.posix.dirname(remotePath);
37613
37615
  const parts = [
37614
37616
  `mkdir -p ${shellQuote(remoteDir)}`,
37615
37617
  `cat > ${shellQuote(remotePath)}`
@@ -37679,7 +37681,7 @@ function shellQuote(s) {
37679
37681
  // src/services/providers/gitpod.ts
37680
37682
  var import_child_process30 = require("child_process");
37681
37683
  var import_util5 = require("util");
37682
- var path75 = __toESM(require("path"));
37684
+ var path74 = __toESM(require("path"));
37683
37685
  var import_picocolors10 = __toESM(require("picocolors"));
37684
37686
  var execFileP7 = (0, import_util5.promisify)(import_child_process30.execFile);
37685
37687
  var MAX_BUFFER2 = 8 * 1024 * 1024;
@@ -37919,7 +37921,7 @@ var GitpodProvider = class {
37919
37921
  });
37920
37922
  }
37921
37923
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
37922
- const remoteDir = path75.posix.dirname(remotePath);
37924
+ const remoteDir = path74.posix.dirname(remotePath);
37923
37925
  const parts = [
37924
37926
  `mkdir -p ${shellQuote2(remoteDir)}`,
37925
37927
  `cat > ${shellQuote2(remotePath)}`
@@ -37955,7 +37957,7 @@ function shellQuote2(s) {
37955
37957
  // src/services/providers/gitlab-workspaces.ts
37956
37958
  var import_child_process31 = require("child_process");
37957
37959
  var import_util6 = require("util");
37958
- var path76 = __toESM(require("path"));
37960
+ var path75 = __toESM(require("path"));
37959
37961
  var execFileP8 = (0, import_util6.promisify)(import_child_process31.execFile);
37960
37962
  var MAX_BUFFER3 = 8 * 1024 * 1024;
37961
37963
  var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
@@ -38215,7 +38217,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
38215
38217
  }
38216
38218
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
38217
38219
  const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
38218
- const remoteDir = path76.posix.dirname(remotePath);
38220
+ const remoteDir = path75.posix.dirname(remotePath);
38219
38221
  const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
38220
38222
  if (options.mode != null) {
38221
38223
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
@@ -38283,7 +38285,7 @@ function shellQuote3(s) {
38283
38285
  // src/services/providers/railway.ts
38284
38286
  var import_child_process32 = require("child_process");
38285
38287
  var import_util7 = require("util");
38286
- var path77 = __toESM(require("path"));
38288
+ var path76 = __toESM(require("path"));
38287
38289
  var execFileP9 = (0, import_util7.promisify)(import_child_process32.execFile);
38288
38290
  var MAX_BUFFER4 = 8 * 1024 * 1024;
38289
38291
  function resetStdinForChild4() {
@@ -38519,7 +38521,7 @@ var RailwayProvider = class {
38519
38521
  if (!projectId || !serviceId) {
38520
38522
  throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
38521
38523
  }
38522
- const remoteDir = path77.posix.dirname(remotePath);
38524
+ const remoteDir = path76.posix.dirname(remotePath);
38523
38525
  const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
38524
38526
  if (options.mode != null) {
38525
38527
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
@@ -39165,8 +39167,8 @@ async function invite() {
39165
39167
  var import_node_dns = require("dns");
39166
39168
  var import_node_util5 = require("util");
39167
39169
  var import_node_crypto13 = require("crypto");
39168
- var fs70 = __toESM(require("fs"));
39169
- var path78 = __toESM(require("path"));
39170
+ var fs69 = __toESM(require("fs"));
39171
+ var path77 = __toESM(require("path"));
39170
39172
  var import_picocolors14 = __toESM(require("picocolors"));
39171
39173
  var dnsResolveP = (0, import_node_util5.promisify)(import_node_dns.resolve);
39172
39174
  async function checkDns(apiBase2) {
@@ -39222,13 +39224,13 @@ async function checkHealth(apiBase2) {
39222
39224
  }
39223
39225
  }
39224
39226
  function checkConfigDir() {
39225
- const dir = path78.join(require("os").homedir(), ".codeam");
39227
+ const dir = path77.join(require("os").homedir(), ".codeam");
39226
39228
  try {
39227
- fs70.mkdirSync(dir, { recursive: true, mode: 448 });
39228
- const probe = path78.join(dir, ".doctor-probe");
39229
- fs70.writeFileSync(probe, "ok", { mode: 384 });
39230
- const read2 = fs70.readFileSync(probe, "utf8");
39231
- fs70.unlinkSync(probe);
39229
+ fs69.mkdirSync(dir, { recursive: true, mode: 448 });
39230
+ const probe = path77.join(dir, ".doctor-probe");
39231
+ fs69.writeFileSync(probe, "ok", { mode: 384 });
39232
+ const read2 = fs69.readFileSync(probe, "utf8");
39233
+ fs69.unlinkSync(probe);
39232
39234
  if (read2 !== "ok") throw new Error("write/read round-trip mismatch");
39233
39235
  return {
39234
39236
  id: "config-dir",
@@ -39268,9 +39270,9 @@ function checkSessions() {
39268
39270
  }
39269
39271
  }
39270
39272
  function checkAgentBinaries() {
39271
- const os60 = createOsStrategy();
39273
+ const os59 = createOsStrategy();
39272
39274
  return getEnabledAgents().map((meta) => {
39273
- const found = os60.findInPath(meta.binaryName);
39275
+ const found = os59.findInPath(meta.binaryName);
39274
39276
  return {
39275
39277
  id: `agent-${meta.id}`,
39276
39278
  label: `Agent binary: ${meta.displayName} (${meta.binaryName})`,
@@ -39292,7 +39294,7 @@ function checkNodePty() {
39292
39294
  detail: "not required on this platform"
39293
39295
  };
39294
39296
  }
39295
- const vendoredPath = path78.join(__dirname, "vendor", "node-pty");
39297
+ const vendoredPath = path77.join(__dirname, "vendor", "node-pty");
39296
39298
  for (const target of [vendoredPath, "node-pty"]) {
39297
39299
  try {
39298
39300
  require(target);
@@ -39334,7 +39336,7 @@ function checkChokidar() {
39334
39336
  }
39335
39337
  async function doctor(args2 = []) {
39336
39338
  const json = args2.includes("--json");
39337
- const cliVersion = true ? "2.61.50" : "0.0.0-dev";
39339
+ const cliVersion = true ? "2.61.51" : "0.0.0-dev";
39338
39340
  const apiBase2 = resolveApiBaseUrl();
39339
39341
  const diagnosticId = (0, import_node_crypto13.randomUUID)();
39340
39342
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -39856,7 +39858,7 @@ async function mcpRun(args2) {
39856
39858
  // src/commands/version.ts
39857
39859
  var import_picocolors15 = __toESM(require("picocolors"));
39858
39860
  function version2() {
39859
- const v = true ? "2.61.50" : "unknown";
39861
+ const v = true ? "2.61.51" : "unknown";
39860
39862
  console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
39861
39863
  }
39862
39864
 
@@ -40005,10 +40007,10 @@ var EXIT_CODE_NAMES = {
40005
40007
  };
40006
40008
 
40007
40009
  // src/index.ts
40008
- var os59 = __toESM(require("os"));
40010
+ var os58 = __toESM(require("os"));
40009
40011
  if (!process.env.HOME) {
40010
40012
  try {
40011
- const home = os59.homedir();
40013
+ const home = os58.homedir();
40012
40014
  if (home) process.env.HOME = home;
40013
40015
  } catch {
40014
40016
  }