codeam-cli 2.60.56 → 2.60.58

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 +12 -0
  2. package/dist/index.js +401 -275
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -519,6 +519,38 @@ var INTEGRATION_REGISTRY = {
519
519
  staticEnv: { ATLASSIAN_OAUTH_ENABLE: "true" }
520
520
  }
521
521
  }
522
+ },
523
+ sentry: {
524
+ id: "sentry",
525
+ name: "Sentry",
526
+ icon: "sentry",
527
+ // Dark until the Sentry OAuth app is registered + a live end-to-end
528
+ // deploy is verified (CLAUDE.md non-negotiable). Flip to true in the
529
+ // same change that lands SENTRY_OAUTH_CLIENT_ID/SECRET/REDIRECT_URI.
530
+ enabled: false,
531
+ auth: {
532
+ kind: "oauth_redirect",
533
+ // Sentry OAuth scopes for the MCP's read-first surface: read orgs /
534
+ // projects / teams, read issues+events (the error→fix loop), and
535
+ // read releases. `org:read` covers org+project discovery. No write
536
+ // scopes in the MVP — writes (resolve/assign an issue) land with the
537
+ // designed Approval-Gates phase, same as Jira's write path.
538
+ scopes: ["org:read", "project:read", "team:read", "event:read", "project:releases"]
539
+ },
540
+ delivery: {
541
+ mcp: {
542
+ // Sentry's official stdio MCP server (Node). BYO-token headless: the
543
+ // OAuth access token is fed via SENTRY_ACCESS_TOKEN and the host via
544
+ // SENTRY_HOST (never argv — env only). Version PINNED; bump only
545
+ // after re-verifying headless in the mcp-shim integration test.
546
+ command: "npx",
547
+ args: ["-y", "@sentry/mcp-server@0.18.0"],
548
+ envMapping: {
549
+ SENTRY_ACCESS_TOKEN: "accessToken",
550
+ SENTRY_HOST: "host"
551
+ }
552
+ }
553
+ }
522
554
  }
523
555
  };
524
556
  function getIntegration(id) {
@@ -845,11 +877,11 @@ function quiet(fn) {
845
877
  log.debug(TAG, "ignored sync error", err);
846
878
  }
847
879
  }
848
- function rmIfExistsQuiet(path73) {
880
+ function rmIfExistsQuiet(path74) {
849
881
  try {
850
- fs2.rmSync(path73, { force: true });
882
+ fs2.rmSync(path74, { force: true });
851
883
  } catch (err) {
852
- log.debug(TAG, `rmIfExists failed for ${path73}`, err);
884
+ log.debug(TAG, `rmIfExists failed for ${path74}`, err);
853
885
  }
854
886
  }
855
887
  function killQuiet(target, signal = "SIGTERM") {
@@ -995,9 +1027,9 @@ var _default = makeConfig();
995
1027
  var { getConfig, ensurePluginId, addSession, removeSession, setActiveSession, getActiveSession, getActiveSessionForAgent, setDisable1mContext, clearAll, saveCliConfig, loadCliConfig } = _default;
996
1028
 
997
1029
  // src/commands/pair-auto.ts
998
- var fs55 = __toESM(require("fs"));
999
- var os44 = __toESM(require("os"));
1000
- var path59 = __toESM(require("path"));
1030
+ var fs56 = __toESM(require("fs"));
1031
+ var os45 = __toESM(require("os"));
1032
+ var path60 = __toESM(require("path"));
1001
1033
  var import_crypto4 = require("crypto");
1002
1034
 
1003
1035
  // src/services/telemetry.service.ts
@@ -1033,8 +1065,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? (0, import_pat
1033
1065
  return decodedFile;
1034
1066
  };
1035
1067
  }
1036
- function normalizeWindowsPath(path73) {
1037
- return path73.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
1068
+ function normalizeWindowsPath(path74) {
1069
+ return path74.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
1038
1070
  }
1039
1071
 
1040
1072
  // ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
@@ -3514,9 +3546,9 @@ async function addSourceContext(frames) {
3514
3546
  LRU_FILE_CONTENTS_CACHE.reduce();
3515
3547
  return frames;
3516
3548
  }
3517
- function getContextLinesFromFile(path73, ranges, output) {
3549
+ function getContextLinesFromFile(path74, ranges, output) {
3518
3550
  return new Promise((resolve7) => {
3519
- const stream = (0, import_node_fs.createReadStream)(path73);
3551
+ const stream = (0, import_node_fs.createReadStream)(path74);
3520
3552
  const lineReaded = (0, import_node_readline.createInterface)({
3521
3553
  input: stream
3522
3554
  });
@@ -3531,7 +3563,7 @@ function getContextLinesFromFile(path73, ranges, output) {
3531
3563
  let rangeStart = range[0];
3532
3564
  let rangeEnd = range[1];
3533
3565
  function onStreamError() {
3534
- LRU_FILE_CONTENTS_FS_READ_FAILED.set(path73, 1);
3566
+ LRU_FILE_CONTENTS_FS_READ_FAILED.set(path74, 1);
3535
3567
  lineReaded.close();
3536
3568
  lineReaded.removeAllListeners();
3537
3569
  destroyStreamAndResolve();
@@ -3592,8 +3624,8 @@ function clearLineContext(frame) {
3592
3624
  delete frame.context_line;
3593
3625
  delete frame.post_context;
3594
3626
  }
3595
- function shouldSkipContextLinesForFile(path73) {
3596
- return path73.startsWith("node:") || path73.endsWith(".min.js") || path73.endsWith(".min.cjs") || path73.endsWith(".min.mjs") || path73.startsWith("data:");
3627
+ function shouldSkipContextLinesForFile(path74) {
3628
+ return path74.startsWith("node:") || path74.endsWith(".min.js") || path74.endsWith(".min.cjs") || path74.endsWith(".min.mjs") || path74.startsWith("data:");
3597
3629
  }
3598
3630
  function shouldSkipContextLinesForFrame(frame) {
3599
3631
  if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
@@ -5747,7 +5779,7 @@ function readAnonId() {
5747
5779
  }
5748
5780
  function superProperties() {
5749
5781
  return {
5750
- cliVersion: true ? "2.60.56" : "0.0.0-dev",
5782
+ cliVersion: true ? "2.60.58" : "0.0.0-dev",
5751
5783
  nodeVersion: process.version,
5752
5784
  platform: process.platform,
5753
5785
  arch: process.arch,
@@ -5928,7 +5960,7 @@ var os4 = __toESM(require("os"));
5928
5960
  // package.json
5929
5961
  var package_default = {
5930
5962
  name: "codeam-cli",
5931
- version: "2.60.56",
5963
+ version: "2.60.58",
5932
5964
  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.",
5933
5965
  type: "commonjs",
5934
5966
  main: "dist/index.js",
@@ -7037,7 +7069,7 @@ var CommandRelayService = class {
7037
7069
  // fresh + clear the "CLI update available" banner after a self-update
7038
7070
  // (a codespace that reinstalls @latest reconnects via heartbeat, not
7039
7071
  // pair/reconnect). Older backends ignore the extra field.
7040
- ..."2.60.56" ? { ideVersion: "2.60.56" } : {}
7072
+ ..."2.60.58" ? { ideVersion: "2.60.58" } : {}
7041
7073
  }).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
7042
7074
  }
7043
7075
  /**
@@ -7264,10 +7296,10 @@ var WINDOWS_LEGACY_JUNCTIONS = [
7264
7296
  /[\\/]Start Menu([\\/]|$)/i,
7265
7297
  /[\\/]Templates([\\/]|$)/i
7266
7298
  ];
7267
- function isUnsafeWindowsWatchRoot(dir, homedir43) {
7299
+ function isUnsafeWindowsWatchRoot(dir, homedir44) {
7268
7300
  const norm = (p2) => p2.replace(/\//g, "\\").replace(/\\+$/, "").toLowerCase();
7269
7301
  const cwd = norm(dir);
7270
- const home = norm(homedir43);
7302
+ const home = norm(homedir44);
7271
7303
  if (cwd === home) return true;
7272
7304
  if (/^[a-z]:$/.test(cwd)) return true;
7273
7305
  const sysRoots = [
@@ -8411,9 +8443,9 @@ function closeAllTerminals() {
8411
8443
  }
8412
8444
 
8413
8445
  // src/commands/start/handlers.ts
8414
- var fs54 = __toESM(require("fs"));
8415
- var os43 = __toESM(require("os"));
8416
- var path58 = __toESM(require("path"));
8446
+ var fs55 = __toESM(require("fs"));
8447
+ var os44 = __toESM(require("os"));
8448
+ var path59 = __toESM(require("path"));
8417
8449
  var import_crypto3 = require("crypto");
8418
8450
  var import_child_process23 = require("child_process");
8419
8451
 
@@ -11870,10 +11902,10 @@ function buildForPlatform(platform3) {
11870
11902
  var import_node_crypto4 = require("crypto");
11871
11903
 
11872
11904
  // src/agents/claude/resolver.ts
11873
- function buildClaudeLaunch(extraArgs = [], os51 = createOsStrategy()) {
11874
- const found = os51.findInPath("claude") ?? os51.findInPath("claude-code");
11905
+ function buildClaudeLaunch(extraArgs = [], os52 = createOsStrategy()) {
11906
+ const found = os52.findInPath("claude") ?? os52.findInPath("claude-code");
11875
11907
  if (!found) return null;
11876
- return os51.buildLaunch(found, extraArgs);
11908
+ return os52.buildLaunch(found, extraArgs);
11877
11909
  }
11878
11910
 
11879
11911
  // src/agents/claude/installer.ts
@@ -12463,8 +12495,8 @@ var ClaudeRuntimeStrategy = class {
12463
12495
  meta = getAgent("claude");
12464
12496
  mode = "interactive";
12465
12497
  os;
12466
- constructor(os51) {
12467
- this.os = os51;
12498
+ constructor(os52) {
12499
+ this.os = os52;
12468
12500
  }
12469
12501
  /**
12470
12502
  * Claude Code's react-ink TUI enables bracketed-paste mode at
@@ -13244,8 +13276,8 @@ function codexCredentialLocator() {
13244
13276
  function codexLoginLauncher() {
13245
13277
  return {
13246
13278
  async ensureInstalled() {
13247
- const os51 = createOsStrategy();
13248
- return os51.findInPath("codex") !== null;
13279
+ const os52 = createOsStrategy();
13280
+ return os52.findInPath("codex") !== null;
13249
13281
  },
13250
13282
  launch() {
13251
13283
  return (0, import_node_child_process4.spawn)("codex", ["login"], { stdio: "inherit" });
@@ -13268,8 +13300,8 @@ var CodexRuntimeStrategy = class {
13268
13300
  meta = getAgent("codex");
13269
13301
  mode = "interactive";
13270
13302
  os;
13271
- constructor(os51) {
13272
- this.os = os51;
13303
+ constructor(os52) {
13304
+ this.os = os52;
13273
13305
  }
13274
13306
  async prepareLaunch() {
13275
13307
  let binary = this.os.findInPath("codex");
@@ -13378,12 +13410,12 @@ var CodexRuntimeStrategy = class {
13378
13410
  });
13379
13411
  }
13380
13412
  };
13381
- function resolveNpm(os51) {
13382
- return os51.id === "win32" ? "npm.cmd" : "npm";
13413
+ function resolveNpm(os52) {
13414
+ return os52.id === "win32" ? "npm.cmd" : "npm";
13383
13415
  }
13384
- async function installCodexViaNpm(os51) {
13416
+ async function installCodexViaNpm(os52) {
13385
13417
  return new Promise((resolve7, reject) => {
13386
- const proc = (0, import_node_child_process5.spawn)(resolveNpm(os51), ["install", "-g", "@openai/codex"], {
13418
+ const proc = (0, import_node_child_process5.spawn)(resolveNpm(os52), ["install", "-g", "@openai/codex"], {
13387
13419
  stdio: "inherit"
13388
13420
  });
13389
13421
  proc.on("close", (code) => {
@@ -13400,16 +13432,16 @@ async function installCodexViaNpm(os51) {
13400
13432
  });
13401
13433
  });
13402
13434
  }
13403
- function augmentNpmGlobalBin(os51) {
13435
+ function augmentNpmGlobalBin(os52) {
13404
13436
  try {
13405
- const result = (0, import_node_child_process5.spawnSync)(resolveNpm(os51), ["prefix", "-g"], {
13437
+ const result = (0, import_node_child_process5.spawnSync)(resolveNpm(os52), ["prefix", "-g"], {
13406
13438
  stdio: ["ignore", "pipe", "ignore"]
13407
13439
  });
13408
13440
  if (result.status !== 0) return;
13409
13441
  const prefix = result.stdout.toString().trim();
13410
13442
  if (!prefix) return;
13411
- const binDir = os51.id === "win32" ? prefix : path24.join(prefix, "bin");
13412
- os51.augmentPath([binDir]);
13443
+ const binDir = os52.id === "win32" ? prefix : path24.join(prefix, "bin");
13444
+ os52.augmentPath([binDir]);
13413
13445
  } catch {
13414
13446
  }
13415
13447
  }
@@ -13493,9 +13525,9 @@ var import_node_child_process8 = require("child_process");
13493
13525
  // src/agents/coderabbit/installer.ts
13494
13526
  var import_node_child_process6 = require("child_process");
13495
13527
  var INSTALL_URL = "https://cli.coderabbit.ai/install.sh";
13496
- async function ensureCoderabbitInstalled(os51) {
13497
- if (os51.findInPath("coderabbit")) return true;
13498
- if (os51.id === "win32") {
13528
+ async function ensureCoderabbitInstalled(os52) {
13529
+ if (os52.findInPath("coderabbit")) return true;
13530
+ if (os52.id === "win32") {
13499
13531
  console.error(
13500
13532
  "\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"
13501
13533
  );
@@ -13510,8 +13542,8 @@ async function ensureCoderabbitInstalled(os51) {
13510
13542
  proc.on("error", () => resolve7(false));
13511
13543
  });
13512
13544
  if (!ok) return false;
13513
- os51.augmentPath([`${os51.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
13514
- return os51.findInPath("coderabbit") !== null;
13545
+ os52.augmentPath([`${os52.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
13546
+ return os52.findInPath("coderabbit") !== null;
13515
13547
  }
13516
13548
 
13517
13549
  // src/agents/coderabbit/link.ts
@@ -13546,10 +13578,10 @@ function coderabbitCredentialLocator() {
13546
13578
  validate: validateNonEmptyCredential
13547
13579
  };
13548
13580
  }
13549
- function coderabbitLoginLauncher(os51) {
13581
+ function coderabbitLoginLauncher(os52) {
13550
13582
  return {
13551
13583
  async ensureInstalled() {
13552
- return ensureCoderabbitInstalled(os51);
13584
+ return ensureCoderabbitInstalled(os52);
13553
13585
  },
13554
13586
  launch() {
13555
13587
  return (0, import_node_child_process7.spawn)("coderabbit", ["auth", "login"], { stdio: "inherit" });
@@ -13605,8 +13637,8 @@ function pickLine(obj) {
13605
13637
  function toHunk(raw, groupSeverity) {
13606
13638
  if (!raw || typeof raw !== "object") return null;
13607
13639
  const o = raw;
13608
- const path73 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename", "fileName"])) ?? asString(pick(o, ["location"])?.path);
13609
- if (!path73) return null;
13640
+ const path74 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename", "fileName"])) ?? asString(pick(o, ["location"])?.path);
13641
+ if (!path74) return null;
13610
13642
  const message = asString(
13611
13643
  pick(o, [
13612
13644
  "comment",
@@ -13623,7 +13655,7 @@ function toHunk(raw, groupSeverity) {
13623
13655
  const severity = normSeverity(pick(o, ["severity", "level", "priority", "impact"])) ?? normSeverity(groupSeverity);
13624
13656
  const locObj = pick(o, ["location"]) ?? o;
13625
13657
  return {
13626
- path: path73.trim(),
13658
+ path: path74.trim(),
13627
13659
  line: pickLine(o) ?? pickLine(locObj),
13628
13660
  severity,
13629
13661
  message: (title && message ? `${title}: ${message}` : title || message).trim() || "(no message)"
@@ -13706,10 +13738,10 @@ function parsePlain(stdout) {
13706
13738
  for (const line of stdout.split(/\r?\n/)) {
13707
13739
  const m = line.match(HUNK_LINE_RE);
13708
13740
  if (!m) continue;
13709
- const [, path73, lineNo, sevToken, message] = m;
13710
- if (!path73 || !lineNo || !message) continue;
13741
+ const [, path74, lineNo, sevToken, message] = m;
13742
+ if (!path74 || !lineNo || !message) continue;
13711
13743
  hunks.push({
13712
- path: path73.trim(),
13744
+ path: path74.trim(),
13713
13745
  line: Number(lineNo),
13714
13746
  severity: sevToken ? SEVERITY_MAP[sevToken.toLowerCase()] : void 0,
13715
13747
  message: message.trim().replace(/^[*-]\s+/, "")
@@ -13769,8 +13801,8 @@ var CoderabbitRuntimeStrategy = class {
13769
13801
  meta = getAgent("coderabbit");
13770
13802
  mode = "batch";
13771
13803
  os;
13772
- constructor(os51) {
13773
- this.os = os51;
13804
+ constructor(os52) {
13805
+ this.os = os52;
13774
13806
  }
13775
13807
  getDefaultArgs() {
13776
13808
  return ["review", "--agent"];
@@ -14041,10 +14073,10 @@ function cursorCredentialLocator() {
14041
14073
  validate: validateNonEmptyCredential
14042
14074
  };
14043
14075
  }
14044
- function cursorLoginLauncher(os51) {
14076
+ function cursorLoginLauncher(os52) {
14045
14077
  return {
14046
14078
  async ensureInstalled() {
14047
- if (os51.findInPath("cursor-agent")) return true;
14079
+ if (os52.findInPath("cursor-agent")) return true;
14048
14080
  console.error(
14049
14081
  "\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"
14050
14082
  );
@@ -14108,8 +14140,8 @@ var CursorRuntimeStrategy = class {
14108
14140
  meta = getAgent("cursor");
14109
14141
  mode = "interactive";
14110
14142
  os;
14111
- constructor(os51) {
14112
- this.os = os51;
14143
+ constructor(os52) {
14144
+ this.os = os52;
14113
14145
  }
14114
14146
  async prepareLaunch() {
14115
14147
  const binary = this.os.findInPath("cursor-agent");
@@ -14325,10 +14357,10 @@ function aiderCredentialLocator() {
14325
14357
  validate: validateNonEmptyCredential
14326
14358
  };
14327
14359
  }
14328
- function aiderLoginLauncher(os51) {
14360
+ function aiderLoginLauncher(os52) {
14329
14361
  return {
14330
14362
  async ensureInstalled() {
14331
- if (os51.findInPath("aider")) return true;
14363
+ if (os52.findInPath("aider")) return true;
14332
14364
  console.error(
14333
14365
  "\n \u2717 aider binary not on PATH.\n Install Aider:\n pip install aider-chat\n then re-run `codeam link aider`.\n"
14334
14366
  );
@@ -14338,7 +14370,7 @@ function aiderLoginLauncher(os51) {
14338
14370
  console.error(
14339
14371
  "\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"
14340
14372
  );
14341
- return (0, import_node_child_process11.spawn)(os51.id === "win32" ? "cmd.exe" : "sh", os51.id === "win32" ? ["/c", "exit", "0"] : ["-c", "exit 0"], {
14373
+ return (0, import_node_child_process11.spawn)(os52.id === "win32" ? "cmd.exe" : "sh", os52.id === "win32" ? ["/c", "exit", "0"] : ["-c", "exit 0"], {
14342
14374
  stdio: "ignore"
14343
14375
  });
14344
14376
  }
@@ -14410,8 +14442,8 @@ var AiderRuntimeStrategy = class {
14410
14442
  meta = getAgent("aider");
14411
14443
  mode = "interactive";
14412
14444
  os;
14413
- constructor(os51) {
14414
- this.os = os51;
14445
+ constructor(os52) {
14446
+ this.os = os52;
14415
14447
  }
14416
14448
  async prepareLaunch() {
14417
14449
  const binary = this.os.findInPath("aider");
@@ -14543,8 +14575,8 @@ function geminiCredentialLocator() {
14543
14575
  function geminiLoginLauncher() {
14544
14576
  return {
14545
14577
  async ensureInstalled() {
14546
- const os51 = createOsStrategy();
14547
- return os51.findInPath("gemini") !== null;
14578
+ const os52 = createOsStrategy();
14579
+ return os52.findInPath("gemini") !== null;
14548
14580
  },
14549
14581
  launch() {
14550
14582
  return (0, import_node_child_process12.spawn)("gemini", ["auth", "login"], { stdio: "inherit" });
@@ -14734,8 +14766,8 @@ var GeminiRuntimeStrategy = class {
14734
14766
  meta = getAgent("gemini");
14735
14767
  mode = "interactive";
14736
14768
  os;
14737
- constructor(os51) {
14738
- this.os = os51;
14769
+ constructor(os52) {
14770
+ this.os = os52;
14739
14771
  }
14740
14772
  async prepareLaunch() {
14741
14773
  const binary = this.os.findInPath("gemini");
@@ -15026,8 +15058,8 @@ var KimiRuntimeStrategy = class {
15026
15058
  meta = getAgent("kimi");
15027
15059
  mode = "interactive";
15028
15060
  os;
15029
- constructor(os51) {
15030
- this.os = os51;
15061
+ constructor(os52) {
15062
+ this.os = os52;
15031
15063
  }
15032
15064
  async prepareLaunch() {
15033
15065
  const binary = this.os.findInPath("kimi");
@@ -15140,19 +15172,19 @@ var KimiRuntimeStrategy = class {
15140
15172
 
15141
15173
  // src/agents/registry.ts
15142
15174
  var runtimeBuilders = {
15143
- claude: (os51) => new ClaudeRuntimeStrategy(os51),
15144
- codex: (os51) => new CodexRuntimeStrategy(os51),
15145
- coderabbit: (os51) => new CoderabbitRuntimeStrategy(os51),
15146
- cursor: (os51) => new CursorRuntimeStrategy(os51),
15147
- aider: (os51) => new AiderRuntimeStrategy(os51),
15148
- gemini: (os51) => new GeminiRuntimeStrategy(os51),
15149
- kimi: (os51) => new KimiRuntimeStrategy(os51)
15175
+ claude: (os52) => new ClaudeRuntimeStrategy(os52),
15176
+ codex: (os52) => new CodexRuntimeStrategy(os52),
15177
+ coderabbit: (os52) => new CoderabbitRuntimeStrategy(os52),
15178
+ cursor: (os52) => new CursorRuntimeStrategy(os52),
15179
+ aider: (os52) => new AiderRuntimeStrategy(os52),
15180
+ gemini: (os52) => new GeminiRuntimeStrategy(os52),
15181
+ kimi: (os52) => new KimiRuntimeStrategy(os52)
15150
15182
  };
15151
15183
  var deployBuilders = {
15152
15184
  claude: () => new ClaudeDeployStrategy(),
15153
15185
  codex: () => new CodexDeployStrategy()
15154
15186
  };
15155
- function createAgentStrategy(agent, os51 = createOsStrategy()) {
15187
+ function createAgentStrategy(agent, os52 = createOsStrategy()) {
15156
15188
  if (!AGENT_REGISTRY[agent]?.enabled) {
15157
15189
  throw new Error(
15158
15190
  `Agent "${agent}" is not supported in this codeam-cli version. Upgrade with 'npm i -g codeam-cli@latest'.`
@@ -15162,10 +15194,10 @@ function createAgentStrategy(agent, os51 = createOsStrategy()) {
15162
15194
  if (!build) {
15163
15195
  throw new Error(`No runtime strategy registered for agent "${agent}"`);
15164
15196
  }
15165
- return build(os51);
15197
+ return build(os52);
15166
15198
  }
15167
- function createInteractiveAgentStrategy(agent, os51 = createOsStrategy()) {
15168
- const s = createAgentStrategy(agent, os51);
15199
+ function createInteractiveAgentStrategy(agent, os52 = createOsStrategy()) {
15200
+ const s = createAgentStrategy(agent, os52);
15169
15201
  if (s.mode !== "interactive") {
15170
15202
  throw new Error(
15171
15203
  `Agent "${agent}" is a batch agent; use createAgentStrategy + .runOneShot for one-shot reviews.`
@@ -15862,26 +15894,26 @@ function restoreCoderabbitOauthBlob(value) {
15862
15894
  (0, import_node_fs5.writeFileSync)(path36.join(dir, file), contents, { mode: 384 });
15863
15895
  }
15864
15896
  async function configureCoderabbit(input, deps = {}) {
15865
- const os51 = deps.os ?? createOsStrategy();
15897
+ const os52 = deps.os ?? createOsStrategy();
15866
15898
  const ensureInstalled = deps.ensureInstalled ?? ensureCoderabbitInstalled;
15867
15899
  const isLoggedIn = deps.isLoggedIn ?? defaultIsLoggedIn;
15868
15900
  const runOAuth = deps.runOAuthLogin ?? runCoderabbitOAuthLogin;
15869
15901
  const snapshot = deps.snapshotDir ?? (() => snapshotCredentialDir());
15870
15902
  const capture2 = deps.captureCredential ?? ((b) => diffCapturedCredential(b));
15871
15903
  const loginWithApiKey = deps.loginWithApiKey ?? defaultLoginWithApiKey;
15872
- const home = os51.homeDir();
15873
- os51.augmentPath(
15874
- os51.id === "win32" ? [
15904
+ const home = os52.homeDir();
15905
+ os52.augmentPath(
15906
+ os52.id === "win32" ? [
15875
15907
  path36.join(home, ".local", "bin"),
15876
15908
  path36.join(process.env.APPDATA ?? path36.join(home, "AppData", "Roaming"), "npm"),
15877
15909
  path36.join(home, "scoop", "shims")
15878
15910
  ] : [path36.join(home, ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"]
15879
15911
  );
15880
- const installed2 = os51.findInPath("coderabbit") !== null;
15912
+ const installed2 = os52.findInPath("coderabbit") !== null;
15881
15913
  const base = () => ({
15882
15914
  action: input.action,
15883
15915
  supported: true,
15884
- installed: os51.findInPath("coderabbit") !== null,
15916
+ installed: os52.findInPath("coderabbit") !== null,
15885
15917
  loggedIn: false
15886
15918
  });
15887
15919
  if (input.action === "status") {
@@ -15895,7 +15927,7 @@ async function configureCoderabbit(input, deps = {}) {
15895
15927
  const key = (input.apiKey ?? "").trim();
15896
15928
  if (!key) return { ...res2, error: "No API key provided" };
15897
15929
  if (!res2.installed) {
15898
- const ok = await ensureInstalled(os51);
15930
+ const ok = await ensureInstalled(os52);
15899
15931
  res2.installed = ok;
15900
15932
  if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
15901
15933
  }
@@ -15919,7 +15951,7 @@ async function configureCoderabbit(input, deps = {}) {
15919
15951
  }
15920
15952
  if (!res2.installed) {
15921
15953
  deps.onEvent?.({ kind: "installing" });
15922
- const ok = await ensureInstalled(os51);
15954
+ const ok = await ensureInstalled(os52);
15923
15955
  res2.installed = ok;
15924
15956
  if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
15925
15957
  }
@@ -15949,7 +15981,7 @@ async function configureCoderabbit(input, deps = {}) {
15949
15981
  const res2 = base();
15950
15982
  if (!installed2) {
15951
15983
  deps.onEvent?.({ kind: "installing" });
15952
- const ok = await ensureInstalled(os51);
15984
+ const ok = await ensureInstalled(os52);
15953
15985
  res2.installed = ok;
15954
15986
  if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
15955
15987
  }
@@ -15989,7 +16021,7 @@ async function configureCoderabbit(input, deps = {}) {
15989
16021
  }
15990
16022
  const res = base();
15991
16023
  if (!res.installed) {
15992
- const ok = await ensureInstalled(os51);
16024
+ const ok = await ensureInstalled(os52);
15993
16025
  res.installed = ok;
15994
16026
  if (!ok) return { ...res, error: "CodeRabbit CLI is not installed" };
15995
16027
  }
@@ -17614,7 +17646,7 @@ async function autoUpgradeBeforeCriticalCommand() {
17614
17646
  if (process.env.NODE_ENV === "test") return;
17615
17647
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
17616
17648
  if (process.env.CI) return;
17617
- const current = true ? "2.60.56" : null;
17649
+ const current = true ? "2.60.58" : null;
17618
17650
  if (!current) return;
17619
17651
  const cache = readCache();
17620
17652
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -17631,7 +17663,7 @@ function checkForUpdates() {
17631
17663
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
17632
17664
  if (process.env.CI) return;
17633
17665
  if (!process.stdout.isTTY) return;
17634
- const current = true ? "2.60.56" : null;
17666
+ const current = true ? "2.60.58" : null;
17635
17667
  if (!current) return;
17636
17668
  const cache = readCache();
17637
17669
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -17651,7 +17683,7 @@ var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
17651
17683
  var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
17652
17684
  var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
17653
17685
  function currentCliVersion() {
17654
- return true ? "2.60.56" : null;
17686
+ return true ? "2.60.58" : null;
17655
17687
  }
17656
17688
  function runCmd(cmd, args2, timeoutMs) {
17657
17689
  return new Promise((resolve7) => {
@@ -18679,6 +18711,85 @@ function makeRealApplyBudgetDeps() {
18679
18711
  };
18680
18712
  }
18681
18713
 
18714
+ // src/services/preview/port-registry.ts
18715
+ var fs44 = __toESM(require("fs"));
18716
+ var os38 = __toESM(require("os"));
18717
+ var path47 = __toESM(require("path"));
18718
+ function registryPath() {
18719
+ return path47.join(os38.homedir(), ".codeam", "preview-ports.json");
18720
+ }
18721
+ function readRegistry() {
18722
+ try {
18723
+ const raw = fs44.readFileSync(registryPath(), "utf8");
18724
+ const parsed = JSON.parse(raw);
18725
+ if (parsed && typeof parsed === "object") return parsed;
18726
+ } catch {
18727
+ }
18728
+ return {};
18729
+ }
18730
+ function writeRegistry(reg) {
18731
+ try {
18732
+ const file = registryPath();
18733
+ fs44.mkdirSync(path47.dirname(file), { recursive: true });
18734
+ const tmp = `${file}.tmp`;
18735
+ fs44.writeFileSync(tmp, JSON.stringify(reg), "utf8");
18736
+ fs44.renameSync(tmp, file);
18737
+ } catch (err) {
18738
+ log.warn("preview", `port-registry write failed: ${err instanceof Error ? err.message : String(err)}`);
18739
+ }
18740
+ }
18741
+ function recordPreviewPort(port, devPid, sessionId, now) {
18742
+ if (devPid == null) return;
18743
+ const reg = readRegistry();
18744
+ reg[String(port)] = { pgid: devPid, sessionId, ts: now };
18745
+ writeRegistry(reg);
18746
+ }
18747
+ function forgetPreviewPort(port) {
18748
+ const reg = readRegistry();
18749
+ if (reg[String(port)] === void 0) return;
18750
+ delete reg[String(port)];
18751
+ writeRegistry(reg);
18752
+ }
18753
+ function groupAlive(pgid) {
18754
+ try {
18755
+ process.kill(-pgid, 0);
18756
+ return true;
18757
+ } catch (err) {
18758
+ return err.code === "EPERM";
18759
+ }
18760
+ }
18761
+ function reclaimOwnOrphanPort(port) {
18762
+ if (process.platform === "win32") return false;
18763
+ const reg = readRegistry();
18764
+ const owner = reg[String(port)];
18765
+ if (!owner) return false;
18766
+ if (!groupAlive(owner.pgid)) {
18767
+ delete reg[String(port)];
18768
+ writeRegistry(reg);
18769
+ return false;
18770
+ }
18771
+ log.info(
18772
+ "preview",
18773
+ `reclaiming OWN orphaned preview on port ${port} (pgid=${owner.pgid}, session=${owner.sessionId}) after a CLI restart`
18774
+ );
18775
+ try {
18776
+ process.kill(-owner.pgid, "SIGTERM");
18777
+ } catch {
18778
+ }
18779
+ try {
18780
+ setTimeout(() => {
18781
+ try {
18782
+ process.kill(-owner.pgid, "SIGKILL");
18783
+ } catch {
18784
+ }
18785
+ }, 300).unref?.();
18786
+ } catch {
18787
+ }
18788
+ delete reg[String(port)];
18789
+ writeRegistry(reg);
18790
+ return true;
18791
+ }
18792
+
18682
18793
  // src/services/preview/cloudflared.ts
18683
18794
  var import_child_process14 = require("child_process");
18684
18795
  var import_fs = require("fs");
@@ -19328,6 +19439,7 @@ function killProcessTree(child, signal = "SIGTERM") {
19328
19439
  async function killPreview(sessionId) {
19329
19440
  const preview = activePreviews.get(sessionId);
19330
19441
  if (!preview) return;
19442
+ forgetPreviewPort(preview.detection.port);
19331
19443
  if (preview.tunnel) {
19332
19444
  killProcessTree(preview.tunnel, "SIGTERM");
19333
19445
  }
@@ -19350,8 +19462,8 @@ function activePreviewSessionIds() {
19350
19462
 
19351
19463
  // src/services/preview/start-orchestrator.ts
19352
19464
  var import_child_process17 = require("child_process");
19353
- var fs48 = __toESM(require("fs"));
19354
- var path51 = __toESM(require("path"));
19465
+ var fs49 = __toESM(require("fs"));
19466
+ var path52 = __toESM(require("path"));
19355
19467
  var import_which2 = __toESM(require("which"));
19356
19468
  var INSTALL_TIMEOUT_MS = 5 * 6e4;
19357
19469
  var SETUP_TIMEOUT_MS = 2 * 6e4;
@@ -19418,8 +19530,8 @@ function normalizeDetectionForSpawn(detection, cwd) {
19418
19530
  if (args2.length === 0) return detection;
19419
19531
  const binName = args2[0];
19420
19532
  if (binName.startsWith("-")) return detection;
19421
- const binPath = path51.join(cwd, "node_modules", ".bin", binName);
19422
- if (!fs48.existsSync(binPath)) return detection;
19533
+ const binPath = path52.join(cwd, "node_modules", ".bin", binName);
19534
+ if (!fs49.existsSync(binPath)) return detection;
19423
19535
  return {
19424
19536
  ...detection,
19425
19537
  command: binPath,
@@ -19467,6 +19579,7 @@ async function runPreviewStart(args2) {
19467
19579
  framework: detection.framework,
19468
19580
  detection
19469
19581
  });
19582
+ recordPreviewPort(detection.port, dev.devServer.pid, sessionId, Date.now());
19470
19583
  log.info("preview", `ready: ${detection.framework} at ${tun.url}`);
19471
19584
  emit2(USER_EVENTS.PREVIEW_READY, {
19472
19585
  url: tun.url,
@@ -19602,6 +19715,19 @@ async function startDevServer(ctx) {
19602
19715
  });
19603
19716
  return null;
19604
19717
  }
19718
+ } else if (reclaimOwnOrphanPort(detection.port)) {
19719
+ log.info("preview", `reclaimed own cross-restart orphan on port ${detection.port}`);
19720
+ const freeDeadline = Date.now() + 4e3;
19721
+ while (await isPortListening(detection.port) && Date.now() < freeDeadline) {
19722
+ await new Promise((r) => setTimeout(r, 200));
19723
+ }
19724
+ if (await isPortListening(detection.port)) {
19725
+ emit2(USER_EVENTS.PREVIEW_ERROR, {
19726
+ stage: "spawn",
19727
+ message: `Port ${detection.port} is still in use after stopping the previous preview. Wait a moment and try again.`
19728
+ });
19729
+ return null;
19730
+ }
19605
19731
  } else {
19606
19732
  emit2(USER_EVENTS.PREVIEW_ERROR, {
19607
19733
  stage: "spawn",
@@ -19769,9 +19895,9 @@ async function establishTunnel(ctx, dev) {
19769
19895
 
19770
19896
  // src/beads/bd-adapter.ts
19771
19897
  var import_child_process18 = require("child_process");
19772
- var fs49 = __toESM(require("fs"));
19773
- var os39 = __toESM(require("os"));
19774
- var path52 = __toESM(require("path"));
19898
+ var fs50 = __toESM(require("fs"));
19899
+ var os40 = __toESM(require("os"));
19900
+ var path53 = __toESM(require("path"));
19775
19901
  var BD_PACKAGE = "@beads/bd";
19776
19902
  function resolveBundledBdBinary() {
19777
19903
  return _resolveSeam.resolveBundled();
@@ -19783,11 +19909,11 @@ function _defaultResolveBundled() {
19783
19909
  } catch {
19784
19910
  return null;
19785
19911
  }
19786
- const binDir = path52.join(path52.dirname(pkgJsonPath), "bin");
19912
+ const binDir = path53.join(path53.dirname(pkgJsonPath), "bin");
19787
19913
  const binaryName = process.platform === "win32" ? "bd.exe" : "bd";
19788
- const binaryPath = path52.join(binDir, binaryName);
19914
+ const binaryPath = path53.join(binDir, binaryName);
19789
19915
  try {
19790
- fs49.accessSync(binaryPath, fs49.constants.F_OK);
19916
+ fs50.accessSync(binaryPath, fs50.constants.F_OK);
19791
19917
  return binaryPath;
19792
19918
  } catch {
19793
19919
  return null;
@@ -19797,13 +19923,13 @@ function resolveBdOnPath() {
19797
19923
  return _resolveSeam.resolveOnPath();
19798
19924
  }
19799
19925
  function _defaultResolveOnPath() {
19800
- const dirs = (process.env.PATH ?? "").split(path52.delimiter).filter(Boolean);
19926
+ const dirs = (process.env.PATH ?? "").split(path53.delimiter).filter(Boolean);
19801
19927
  const candidates = process.platform === "win32" ? ["bd.exe", "bd.cmd", "bd"] : ["bd"];
19802
19928
  for (const dir of dirs) {
19803
19929
  for (const candidate of candidates) {
19804
- const full = path52.join(dir, candidate);
19930
+ const full = path53.join(dir, candidate);
19805
19931
  try {
19806
- fs49.accessSync(full, fs49.constants.F_OK);
19932
+ fs50.accessSync(full, fs50.constants.F_OK);
19807
19933
  return full;
19808
19934
  } catch {
19809
19935
  }
@@ -19888,7 +20014,7 @@ var BdAdapter = class {
19888
20014
  const env = { ...process.env };
19889
20015
  if (!env.HOME) {
19890
20016
  try {
19891
- const home = os39.homedir();
20017
+ const home = os40.homedir();
19892
20018
  if (home) env.HOME = home;
19893
20019
  } catch {
19894
20020
  }
@@ -19980,9 +20106,9 @@ function coerceIssue(row, projectKey) {
19980
20106
 
19981
20107
  // src/beads/provisioner.ts
19982
20108
  var import_child_process22 = require("child_process");
19983
- var fs52 = __toESM(require("fs"));
19984
- var os41 = __toESM(require("os"));
19985
- var path55 = __toESM(require("path"));
20109
+ var fs53 = __toESM(require("fs"));
20110
+ var os42 = __toESM(require("os"));
20111
+ var path56 = __toESM(require("path"));
19986
20112
 
19987
20113
  // src/beads/install-bd.ts
19988
20114
  var import_child_process19 = require("child_process");
@@ -20047,9 +20173,9 @@ async function installBd(platform3 = process.platform) {
20047
20173
 
20048
20174
  // src/beads/install-dolt.ts
20049
20175
  var import_child_process20 = require("child_process");
20050
- var fs50 = __toESM(require("fs"));
20051
- var os40 = __toESM(require("os"));
20052
- var path53 = __toESM(require("path"));
20176
+ var fs51 = __toESM(require("fs"));
20177
+ var os41 = __toESM(require("os"));
20178
+ var path54 = __toESM(require("path"));
20053
20179
  var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
20054
20180
  var DOLT_MSI_URL = "https://github.com/dolthub/dolt/releases/latest/download/dolt-windows-amd64.msi";
20055
20181
  function resolveDoltInstallStrategy(platform3) {
@@ -20089,11 +20215,11 @@ function resolveDoltInstallStrategy(platform3) {
20089
20215
  }
20090
20216
  var DOLT_RELEASE_BASE = "https://github.com/dolthub/dolt/releases/latest/download";
20091
20217
  function doltPlatformTuple(platform3, arch2) {
20092
- const os51 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
20218
+ const os52 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
20093
20219
  const a = arch2 === "x64" ? "amd64" : arch2 === "arm64" ? "arm64" : null;
20094
20220
  if (!a) return null;
20095
- if (os51 === "windows" && a !== "amd64") return null;
20096
- return `${os51}-${a}`;
20221
+ if (os52 === "windows" && a !== "amd64") return null;
20222
+ return `${os52}-${a}`;
20097
20223
  }
20098
20224
  function resolveDoltTarballStrategy(targetDir, platform3, arch2) {
20099
20225
  const tuple = doltPlatformTuple(platform3, arch2);
@@ -20138,14 +20264,14 @@ async function installDoltToDir(targetDir, platform3 = process.platform, arch2 =
20138
20264
  return result;
20139
20265
  }
20140
20266
  var _doltPathSeam = {
20141
- homedir: () => os40.homedir(),
20267
+ homedir: () => os41.homedir(),
20142
20268
  getPath: () => process.env.PATH ?? "",
20143
20269
  setPath: (p2) => {
20144
20270
  process.env.PATH = p2;
20145
20271
  },
20146
20272
  exists: (p2) => {
20147
20273
  try {
20148
- fs50.accessSync(p2, fs50.constants.F_OK);
20274
+ fs51.accessSync(p2, fs51.constants.F_OK);
20149
20275
  return true;
20150
20276
  } catch {
20151
20277
  return false;
@@ -20156,7 +20282,7 @@ function doltBinaryNames(platform3) {
20156
20282
  return platform3 === "win32" ? ["dolt.exe", "dolt.cmd", "dolt"] : ["dolt"];
20157
20283
  }
20158
20284
  function knownDoltDirs(platform3) {
20159
- const P3 = platform3 === "win32" ? path53.win32 : path53.posix;
20285
+ const P3 = platform3 === "win32" ? path54.win32 : path54.posix;
20160
20286
  const home = _doltPathSeam.homedir();
20161
20287
  if (platform3 === "win32") {
20162
20288
  return [
@@ -20172,7 +20298,7 @@ function knownDoltDirs(platform3) {
20172
20298
  ].filter(Boolean);
20173
20299
  }
20174
20300
  function ensureDoltResolvable(platform3 = process.platform) {
20175
- const P3 = platform3 === "win32" ? path53.win32 : path53.posix;
20301
+ const P3 = platform3 === "win32" ? path54.win32 : path54.posix;
20176
20302
  const delim = platform3 === "win32" ? ";" : ":";
20177
20303
  const names = doltBinaryNames(platform3);
20178
20304
  const pathDirs = _doltPathSeam.getPath().split(delim).filter(Boolean);
@@ -20308,8 +20434,8 @@ async function ensureSharedServer(adapter, options = {}) {
20308
20434
  // src/beads/project-key.ts
20309
20435
  var import_child_process21 = require("child_process");
20310
20436
  var crypto2 = __toESM(require("crypto"));
20311
- var fs51 = __toESM(require("fs"));
20312
- var path54 = __toESM(require("path"));
20437
+ var fs52 = __toESM(require("fs"));
20438
+ var path55 = __toESM(require("path"));
20313
20439
  function normalizeOrigin(raw) {
20314
20440
  const trimmed = raw.trim();
20315
20441
  if (!trimmed) return null;
@@ -20335,17 +20461,17 @@ function normalizeOrigin(raw) {
20335
20461
  return `${host2}/${pathPart}`;
20336
20462
  }
20337
20463
  function findRepoRoot(cwd) {
20338
- let dir = path54.resolve(cwd);
20464
+ let dir = path55.resolve(cwd);
20339
20465
  const seen = /* @__PURE__ */ new Set();
20340
20466
  for (let i = 0; i < 256; i++) {
20341
20467
  if (seen.has(dir)) return null;
20342
20468
  seen.add(dir);
20343
20469
  try {
20344
- const stat3 = fs51.statSync(path54.join(dir, ".git"), { throwIfNoEntry: false });
20470
+ const stat3 = fs52.statSync(path55.join(dir, ".git"), { throwIfNoEntry: false });
20345
20471
  if (stat3 && (stat3.isDirectory() || stat3.isFile())) return dir;
20346
20472
  } catch {
20347
20473
  }
20348
- const parent = path54.dirname(dir);
20474
+ const parent = path55.dirname(dir);
20349
20475
  if (parent === dir) return null;
20350
20476
  dir = parent;
20351
20477
  }
@@ -20356,7 +20482,7 @@ var _execSeam2 = {
20356
20482
  const out2 = (0, import_child_process21.execFileSync)(file, args2, opts);
20357
20483
  return typeof out2 === "string" ? out2 : out2.toString("utf8");
20358
20484
  },
20359
- realpath: (p2) => fs51.realpathSync(p2)
20485
+ realpath: (p2) => fs52.realpathSync(p2)
20360
20486
  };
20361
20487
  function readOrigin(cwd) {
20362
20488
  try {
@@ -20385,7 +20511,7 @@ function deriveProjectIdentity(cwd = process.cwd()) {
20385
20511
  } catch {
20386
20512
  }
20387
20513
  const hash = crypto2.createHash("sha256").update(real).digest("hex");
20388
- return { projectKey: `path:${hash}`, projectLabel: path54.basename(real) || "project" };
20514
+ return { projectKey: `path:${hash}`, projectLabel: path55.basename(real) || "project" };
20389
20515
  }
20390
20516
 
20391
20517
  // src/beads/project-prefix.ts
@@ -20430,17 +20556,17 @@ var _provisionSeam = {
20430
20556
  };
20431
20557
  var _linkSeam = {
20432
20558
  platform: () => process.platform,
20433
- homedir: () => os41.homedir(),
20559
+ homedir: () => os42.homedir(),
20434
20560
  isWritableDir: (dir) => {
20435
20561
  try {
20436
- fs52.accessSync(dir, fs52.constants.W_OK);
20562
+ fs53.accessSync(dir, fs53.constants.W_OK);
20437
20563
  return true;
20438
20564
  } catch {
20439
20565
  return false;
20440
20566
  }
20441
20567
  },
20442
20568
  ensureDir: (dir) => {
20443
- fs52.mkdirSync(dir, { recursive: true });
20569
+ fs53.mkdirSync(dir, { recursive: true });
20444
20570
  },
20445
20571
  /**
20446
20572
  * A directory to symlink `bd` into so the AGENT's shell + Claude Code's
@@ -20461,9 +20587,9 @@ var _linkSeam = {
20461
20587
  * which `linkBdOntoPath` creates if missing.
20462
20588
  */
20463
20589
  cliBinDir: () => {
20464
- const pathDirs = (process.env.PATH ?? "").split(path55.delimiter).filter(Boolean);
20590
+ const pathDirs = (process.env.PATH ?? "").split(path56.delimiter).filter(Boolean);
20465
20591
  const home = _linkSeam.homedir();
20466
- const localBin = home ? path55.join(home, ".local", "bin") : null;
20592
+ const localBin = home ? path56.join(home, ".local", "bin") : null;
20467
20593
  if (localBin) {
20468
20594
  try {
20469
20595
  _linkSeam.ensureDir(localBin);
@@ -20473,16 +20599,16 @@ var _linkSeam = {
20473
20599
  const candidates = [];
20474
20600
  if (localBin) candidates.push(localBin);
20475
20601
  try {
20476
- candidates.push(path55.dirname(process.execPath));
20602
+ candidates.push(path56.dirname(process.execPath));
20477
20603
  } catch {
20478
20604
  }
20479
20605
  candidates.push("/usr/local/bin");
20480
20606
  const entry = process.argv[1];
20481
20607
  if (entry) {
20482
20608
  try {
20483
- candidates.push(path55.dirname(fs52.realpathSync(entry)));
20609
+ candidates.push(path56.dirname(fs53.realpathSync(entry)));
20484
20610
  } catch {
20485
- candidates.push(path55.dirname(entry));
20611
+ candidates.push(path56.dirname(entry));
20486
20612
  }
20487
20613
  }
20488
20614
  const onPathWritable = candidates.find(
@@ -20494,20 +20620,20 @@ var _linkSeam = {
20494
20620
  /** Current symlink target at `linkPath`, or null when absent / not a link. */
20495
20621
  readlink: (linkPath) => {
20496
20622
  try {
20497
- return fs52.readlinkSync(linkPath);
20623
+ return fs53.readlinkSync(linkPath);
20498
20624
  } catch {
20499
20625
  return null;
20500
20626
  }
20501
20627
  },
20502
- unlink: (linkPath) => fs52.unlinkSync(linkPath),
20503
- symlink: (target, linkPath) => fs52.symlinkSync(target, linkPath)
20628
+ unlink: (linkPath) => fs53.unlinkSync(linkPath),
20629
+ symlink: (target, linkPath) => fs53.symlinkSync(target, linkPath)
20504
20630
  };
20505
20631
  function linkBdOntoPath(binaryPath) {
20506
20632
  if (_linkSeam.platform() === "win32") return;
20507
20633
  const binDir = _linkSeam.cliBinDir();
20508
20634
  if (!binDir) return;
20509
20635
  _linkSeam.ensureDir(binDir);
20510
- const linkPath = path55.join(binDir, "bd");
20636
+ const linkPath = path56.join(binDir, "bd");
20511
20637
  if (linkPath === binaryPath) return;
20512
20638
  const current = _linkSeam.readlink(linkPath);
20513
20639
  if (current === binaryPath) return;
@@ -20702,7 +20828,7 @@ function dedupeRecipes(agents) {
20702
20828
 
20703
20829
  // src/beads/watcher.ts
20704
20830
  var crypto4 = __toESM(require("crypto"));
20705
- var path56 = __toESM(require("path"));
20831
+ var path57 = __toESM(require("path"));
20706
20832
  var API_BASE6 = resolveApiBaseUrl();
20707
20833
  var DEBOUNCE_MS2 = 400;
20708
20834
  var ZERO_SUMMARY = {
@@ -20726,7 +20852,7 @@ var BeadsWatcher = class {
20726
20852
  constructor(opts) {
20727
20853
  this.opts = opts;
20728
20854
  this.bd = opts.adapter ?? new BdAdapter({ cwd: opts.cwd, beadsDir: opts.beadsDir });
20729
- this.feedPath = opts.feedPath ?? path56.join(opts.cwd ?? process.cwd(), ".beads", "last-touched");
20855
+ this.feedPath = opts.feedPath ?? path57.join(opts.cwd ?? process.cwd(), ".beads", "last-touched");
20730
20856
  this.apiBase = opts.apiBaseUrl ?? API_BASE6;
20731
20857
  }
20732
20858
  opts;
@@ -21143,8 +21269,8 @@ function cleanupAttachmentTempFiles() {
21143
21269
  function saveFilesTemp(files) {
21144
21270
  return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
21145
21271
  const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
21146
- const tmpPath = path58.join(os43.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
21147
- fs54.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
21272
+ const tmpPath = path59.join(os44.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
21273
+ fs55.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
21148
21274
  pendingAttachmentFiles.add(tmpPath);
21149
21275
  return tmpPath;
21150
21276
  });
@@ -21356,9 +21482,9 @@ var listFiles = async (ctx, cmd, parsed) => {
21356
21482
  await ctx.relay.sendResult(cmd.id, "completed", result);
21357
21483
  };
21358
21484
  var envReadH = async (ctx, cmd) => {
21359
- const envPath = path58.join(process.cwd(), ".env");
21485
+ const envPath = path59.join(process.cwd(), ".env");
21360
21486
  try {
21361
- const raw = await fs54.promises.readFile(envPath, "utf8");
21487
+ const raw = await fs55.promises.readFile(envPath, "utf8");
21362
21488
  await ctx.relay.sendResult(cmd.id, "completed", {
21363
21489
  exists: true,
21364
21490
  vars: parseDotenv(raw)
@@ -21389,14 +21515,14 @@ var envWriteH = async (ctx, cmd, parsed) => {
21389
21515
  }
21390
21516
  seen.add(v.key);
21391
21517
  }
21392
- const envPath = path58.join(process.cwd(), ".env");
21393
- const tmpPath = path58.join(process.cwd(), ".env.codeam.tmp");
21518
+ const envPath = path59.join(process.cwd(), ".env");
21519
+ const tmpPath = path59.join(process.cwd(), ".env.codeam.tmp");
21394
21520
  try {
21395
- await fs54.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
21396
- await fs54.promises.rename(tmpPath, envPath);
21521
+ await fs55.promises.writeFile(tmpPath, serializeDotenv(vars), "utf8");
21522
+ await fs55.promises.rename(tmpPath, envPath);
21397
21523
  await ctx.relay.sendResult(cmd.id, "completed", { ok: true, count: vars.length });
21398
21524
  } catch (err) {
21399
- await fs54.promises.rm(tmpPath, { force: true }).catch(() => void 0);
21525
+ await fs55.promises.rm(tmpPath, { force: true }).catch(() => void 0);
21400
21526
  await ctx.relay.sendResult(cmd.id, "failed", { error: err.message });
21401
21527
  }
21402
21528
  };
@@ -21440,7 +21566,7 @@ var headroomConfigureH = async (ctx, cmd, parsed) => {
21440
21566
  let configuredAgent = rawAgentId;
21441
21567
  if (!configuredAgent) {
21442
21568
  try {
21443
- const raw = JSON.parse(fs54.readFileSync(headroomConfigPath(), "utf8"));
21569
+ const raw = JSON.parse(fs55.readFileSync(headroomConfigPath(), "utf8"));
21444
21570
  configuredAgent = raw.agent ?? "";
21445
21571
  } catch {
21446
21572
  }
@@ -21474,7 +21600,7 @@ var headroomConfigureH = async (ctx, cmd, parsed) => {
21474
21600
  persist: persistHeadroomConfig,
21475
21601
  readEnabled: () => {
21476
21602
  try {
21477
- const raw = JSON.parse(fs54.readFileSync(headroomConfigPath(), "utf8"));
21603
+ const raw = JSON.parse(fs55.readFileSync(headroomConfigPath(), "utf8"));
21478
21604
  return raw.enabled === true;
21479
21605
  } catch {
21480
21606
  return false;
@@ -21721,7 +21847,7 @@ var headroomBudgetH = async (ctx, cmd) => {
21721
21847
  }
21722
21848
  let headroomActive = false;
21723
21849
  try {
21724
- const raw = JSON.parse(fs54.readFileSync(headroomConfigPath(), "utf8"));
21850
+ const raw = JSON.parse(fs55.readFileSync(headroomConfigPath(), "utf8"));
21725
21851
  headroomActive = raw.enabled === true;
21726
21852
  } catch {
21727
21853
  }
@@ -21731,7 +21857,7 @@ var headroomBudgetH = async (ctx, cmd) => {
21731
21857
  }
21732
21858
  let existingConfig = { enabled: true };
21733
21859
  try {
21734
- existingConfig = JSON.parse(fs54.readFileSync(headroomConfigPath(), "utf8"));
21860
+ existingConfig = JSON.parse(fs55.readFileSync(headroomConfigPath(), "utf8"));
21735
21861
  } catch {
21736
21862
  }
21737
21863
  if (payload.budgetEnabled && payload.budgetUsd != null) {
@@ -21844,13 +21970,13 @@ var CLI_UPDATE_MAX_ATTEMPTS = 3;
21844
21970
  function buildNpmInstallInvocation(opts) {
21845
21971
  const entryScript = opts?.entryScript ?? process.argv[1] ?? "";
21846
21972
  const execPath = opts?.execPath ?? process.execPath;
21847
- const exists2 = opts?.existsSync ?? fs54.existsSync;
21848
- const normalized = entryScript.split(path58.sep).join("/");
21973
+ const exists2 = opts?.existsSync ?? fs55.existsSync;
21974
+ const normalized = entryScript.split(path59.sep).join("/");
21849
21975
  const marker = "/lib/node_modules/codeam-cli/";
21850
21976
  const markerIdx = normalized.indexOf(marker);
21851
21977
  const prefix = markerIdx > 0 ? entryScript.slice(0, markerIdx) : null;
21852
- const siblingNpm = path58.join(
21853
- path58.dirname(execPath),
21978
+ const siblingNpm = path59.join(
21979
+ path59.dirname(execPath),
21854
21980
  process.platform === "win32" ? "npm.cmd" : "npm"
21855
21981
  );
21856
21982
  const command2 = exists2(siblingNpm) ? siblingNpm : "npm";
@@ -22717,11 +22843,11 @@ function resolveTokenValue(args2) {
22717
22843
  }
22718
22844
  const fileFlag = args2.find((a) => a.startsWith("--token-file="));
22719
22845
  if (fileFlag) {
22720
- const path73 = fileFlag.slice("--token-file=".length);
22846
+ const path74 = fileFlag.slice("--token-file=".length);
22721
22847
  try {
22722
- const content = fs55.readFileSync(path73, "utf8").trim();
22723
- if (content.length === 0) fail(`--token-file ${path73} is empty`);
22724
- rmIfExistsQuiet(path73);
22848
+ const content = fs56.readFileSync(path74, "utf8").trim();
22849
+ if (content.length === 0) fail(`--token-file ${path74} is empty`);
22850
+ rmIfExistsQuiet(path74);
22725
22851
  return content;
22726
22852
  } catch (err) {
22727
22853
  fail(`Could not read --token-file: ${err.message}`);
@@ -22750,7 +22876,7 @@ async function claimOnce(token, pluginId, pluginSecretHash) {
22750
22876
  pluginId,
22751
22877
  ideName: "codeam-cli (codespace)",
22752
22878
  ideVersion: process.env.npm_package_version ?? "unknown",
22753
- hostname: os44.hostname(),
22879
+ hostname: os45.hostname(),
22754
22880
  codespaceName: process.env.CODESPACE_NAME ?? "",
22755
22881
  // Current git branch of the codespace's working directory, so the
22756
22882
  // backend can populate `PairedSession.branch` for the codespace pair.
@@ -22811,7 +22937,7 @@ async function claim(token, pluginId, pluginSecretHash) {
22811
22937
  }
22812
22938
  }
22813
22939
  function pairAutoLockPath() {
22814
- return path59.join(os44.homedir(), ".codeam", "pair-auto.lock");
22940
+ return path60.join(os45.homedir(), ".codeam", "pair-auto.lock");
22815
22941
  }
22816
22942
  function isLivePairAuto(pid) {
22817
22943
  if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) return false;
@@ -22821,7 +22947,7 @@ function isLivePairAuto(pid) {
22821
22947
  if (e.code !== "EPERM") return false;
22822
22948
  }
22823
22949
  try {
22824
- return fs55.readFileSync(`/proc/${pid}/cmdline`, "utf8").includes("codeam");
22950
+ return fs56.readFileSync(`/proc/${pid}/cmdline`, "utf8").includes("codeam");
22825
22951
  } catch {
22826
22952
  return true;
22827
22953
  }
@@ -22831,24 +22957,24 @@ function isLiveCodeam(pid) {
22831
22957
  }
22832
22958
  function daemonLockPath(sessionId) {
22833
22959
  const safe = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
22834
- return path59.join(os44.homedir(), ".codeam", `daemon-${safe}.lock`);
22960
+ return path60.join(os45.homedir(), ".codeam", `daemon-${safe}.lock`);
22835
22961
  }
22836
22962
  function acquireDaemonLock(sessionId) {
22837
22963
  const lockPath = daemonLockPath(sessionId);
22838
22964
  try {
22839
- fs55.mkdirSync(path59.dirname(lockPath), { recursive: true });
22965
+ fs56.mkdirSync(path60.dirname(lockPath), { recursive: true });
22840
22966
  try {
22841
- fs55.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
22967
+ fs56.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
22842
22968
  } catch (e) {
22843
22969
  if (e.code !== "EEXIST") throw e;
22844
- const holder = Number(fs55.readFileSync(lockPath, "utf8").trim());
22970
+ const holder = Number(fs56.readFileSync(lockPath, "utf8").trim());
22845
22971
  if (holder && holder !== process.pid && isLiveCodeam(holder)) return false;
22846
- fs55.writeFileSync(lockPath, String(process.pid));
22972
+ fs56.writeFileSync(lockPath, String(process.pid));
22847
22973
  }
22848
22974
  const release3 = () => {
22849
22975
  try {
22850
- if (fs55.existsSync(lockPath) && Number(fs55.readFileSync(lockPath, "utf8").trim()) === process.pid) {
22851
- fs55.unlinkSync(lockPath);
22976
+ if (fs56.existsSync(lockPath) && Number(fs56.readFileSync(lockPath, "utf8").trim()) === process.pid) {
22977
+ fs56.unlinkSync(lockPath);
22852
22978
  }
22853
22979
  } catch {
22854
22980
  }
@@ -22870,19 +22996,19 @@ function acquireDaemonLock(sessionId) {
22870
22996
  function acquireSingletonLock() {
22871
22997
  const lockPath = pairAutoLockPath();
22872
22998
  try {
22873
- fs55.mkdirSync(path59.dirname(lockPath), { recursive: true });
22999
+ fs56.mkdirSync(path60.dirname(lockPath), { recursive: true });
22874
23000
  try {
22875
- fs55.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
23001
+ fs56.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
22876
23002
  } catch (e) {
22877
23003
  if (e.code !== "EEXIST") throw e;
22878
- const holder = Number(fs55.readFileSync(lockPath, "utf8").trim());
23004
+ const holder = Number(fs56.readFileSync(lockPath, "utf8").trim());
22879
23005
  if (isLivePairAuto(holder)) return false;
22880
- fs55.writeFileSync(lockPath, String(process.pid));
23006
+ fs56.writeFileSync(lockPath, String(process.pid));
22881
23007
  }
22882
23008
  process.once("exit", () => {
22883
23009
  try {
22884
- if (fs55.existsSync(lockPath) && Number(fs55.readFileSync(lockPath, "utf8").trim()) === process.pid) {
22885
- fs55.unlinkSync(lockPath);
23010
+ if (fs56.existsSync(lockPath) && Number(fs56.readFileSync(lockPath, "utf8").trim()) === process.pid) {
23011
+ fs56.unlinkSync(lockPath);
22886
23012
  }
22887
23013
  } catch {
22888
23014
  }
@@ -23328,7 +23454,7 @@ var AgentService = class _AgentService {
23328
23454
  };
23329
23455
 
23330
23456
  // src/agents/acp/adapters.ts
23331
- var path61 = __toESM(require("path"));
23457
+ var path62 = __toESM(require("path"));
23332
23458
 
23333
23459
  // src/agents/acp/agent-binary.ts
23334
23460
  var import_fs4 = __toESM(require("fs"));
@@ -23571,13 +23697,13 @@ function resolveBin(pkgName, binName) {
23571
23697
  try {
23572
23698
  const manifestPath = require_.resolve(`${pkgName}/package.json`);
23573
23699
  const manifest = require_(`${pkgName}/package.json`);
23574
- const pkgDir = path61.dirname(manifestPath);
23700
+ const pkgDir = path62.dirname(manifestPath);
23575
23701
  const bin = manifest.bin;
23576
23702
  if (!bin) return null;
23577
- if (typeof bin === "string") return path61.resolve(pkgDir, bin);
23703
+ if (typeof bin === "string") return path62.resolve(pkgDir, bin);
23578
23704
  const target = binName ?? Object.keys(bin)[0];
23579
23705
  if (!target || !bin[target]) return null;
23580
- return path61.resolve(pkgDir, bin[target]);
23706
+ return path62.resolve(pkgDir, bin[target]);
23581
23707
  } catch {
23582
23708
  return null;
23583
23709
  }
@@ -23681,9 +23807,9 @@ function requiresAcp(agent) {
23681
23807
  var import_node_crypto10 = require("crypto");
23682
23808
 
23683
23809
  // src/services/history.service.ts
23684
- var fs57 = __toESM(require("fs"));
23685
- var path62 = __toESM(require("path"));
23686
- var os46 = __toESM(require("os"));
23810
+ var fs58 = __toESM(require("fs"));
23811
+ var path63 = __toESM(require("path"));
23812
+ var os47 = __toESM(require("os"));
23687
23813
  var https7 = __toESM(require("https"));
23688
23814
  var http6 = __toESM(require("http"));
23689
23815
  var import_zod2 = require("zod");
@@ -23710,7 +23836,7 @@ function parseJsonl(filePath) {
23710
23836
  const messages = [];
23711
23837
  let raw;
23712
23838
  try {
23713
- raw = fs57.readFileSync(filePath, "utf8");
23839
+ raw = fs58.readFileSync(filePath, "utf8");
23714
23840
  } catch (err) {
23715
23841
  if (err.code !== "ENOENT") {
23716
23842
  log.warn("history:parseJsonl", `read failed for ${filePath}`, err);
@@ -23851,7 +23977,7 @@ var HistoryService = class _HistoryService {
23851
23977
  return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
23852
23978
  }
23853
23979
  get projectDir() {
23854
- return this.runtime.resolveHistoryDir(this.cwd) ?? path62.join(os46.homedir(), ".claude", "projects", encodeCwd(this.cwd));
23980
+ return this.runtime.resolveHistoryDir(this.cwd) ?? path63.join(os47.homedir(), ".claude", "projects", encodeCwd(this.cwd));
23855
23981
  }
23856
23982
  /** Set the current Claude conversation ID (extracted from /cost command or session start) */
23857
23983
  setCurrentConversationId(id) {
@@ -23863,7 +23989,7 @@ var HistoryService = class _HistoryService {
23863
23989
  /** Return the current message count in the active conversation. */
23864
23990
  getCurrentMessageCount() {
23865
23991
  if (!this.currentConversationId) return 0;
23866
- const filePath = path62.join(this.projectDir, `${this.currentConversationId}.jsonl`);
23992
+ const filePath = path63.join(this.projectDir, `${this.currentConversationId}.jsonl`);
23867
23993
  return parseJsonl(filePath).length;
23868
23994
  }
23869
23995
  /**
@@ -23874,7 +24000,7 @@ var HistoryService = class _HistoryService {
23874
24000
  const deadline = Date.now() + timeoutMs;
23875
24001
  while (Date.now() < deadline) {
23876
24002
  if (!this.currentConversationId) return null;
23877
- const filePath = path62.join(this.projectDir, `${this.currentConversationId}.jsonl`);
24003
+ const filePath = path63.join(this.projectDir, `${this.currentConversationId}.jsonl`);
23878
24004
  const messages = parseJsonl(filePath);
23879
24005
  if (messages.length > previousCount) {
23880
24006
  for (let i = messages.length - 1; i >= previousCount; i--) {
@@ -23900,16 +24026,16 @@ var HistoryService = class _HistoryService {
23900
24026
  const dir = this.projectDir;
23901
24027
  const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
23902
24028
  try {
23903
- const files = fs57.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
24029
+ const files = fs58.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
23904
24030
  try {
23905
- const stat3 = fs57.statSync(path62.join(dir, e.name));
24031
+ const stat3 = fs58.statSync(path63.join(dir, e.name));
23906
24032
  return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
23907
24033
  } catch {
23908
24034
  return { name: e.name, mtime: 0, birthtime: 0 };
23909
24035
  }
23910
24036
  }).filter((f) => f.birthtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
23911
24037
  if (files.length > 0) {
23912
- this.currentConversationId = path62.basename(files[0].name, ".jsonl");
24038
+ this.currentConversationId = path63.basename(files[0].name, ".jsonl");
23913
24039
  }
23914
24040
  } catch {
23915
24041
  }
@@ -23943,13 +24069,13 @@ var HistoryService = class _HistoryService {
23943
24069
  const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
23944
24070
  let entries;
23945
24071
  try {
23946
- entries = fs57.readdirSync(dir, { withFileTypes: true });
24072
+ entries = fs58.readdirSync(dir, { withFileTypes: true });
23947
24073
  } catch {
23948
24074
  return null;
23949
24075
  }
23950
24076
  const files = entries.filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
23951
24077
  try {
23952
- const stat3 = fs57.statSync(path62.join(dir, e.name));
24078
+ const stat3 = fs58.statSync(path63.join(dir, e.name));
23953
24079
  return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
23954
24080
  } catch {
23955
24081
  return { name: e.name, mtime: 0, birthtime: 0 };
@@ -23958,12 +24084,12 @@ var HistoryService = class _HistoryService {
23958
24084
  if (files.length === 0) return null;
23959
24085
  const targetFile = this.currentConversationId ? `${this.currentConversationId}.jsonl` : files[0].name;
23960
24086
  if (!files.some((f) => f.name === targetFile)) return null;
23961
- return this.extractUsageFromFile(path62.join(dir, targetFile));
24087
+ return this.extractUsageFromFile(path63.join(dir, targetFile));
23962
24088
  }
23963
24089
  extractUsageFromFile(filePath) {
23964
24090
  let raw;
23965
24091
  try {
23966
- raw = fs57.readFileSync(filePath, "utf8");
24092
+ raw = fs58.readFileSync(filePath, "utf8");
23967
24093
  } catch {
23968
24094
  return null;
23969
24095
  }
@@ -24008,9 +24134,9 @@ var HistoryService = class _HistoryService {
24008
24134
  let totalCost = 0;
24009
24135
  let files;
24010
24136
  try {
24011
- files = fs57.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
24137
+ files = fs58.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
24012
24138
  try {
24013
- return fs57.statSync(path62.join(projectDir, f)).mtimeMs >= monthStartMs;
24139
+ return fs58.statSync(path63.join(projectDir, f)).mtimeMs >= monthStartMs;
24014
24140
  } catch {
24015
24141
  return false;
24016
24142
  }
@@ -24021,7 +24147,7 @@ var HistoryService = class _HistoryService {
24021
24147
  for (const file of files) {
24022
24148
  let raw;
24023
24149
  try {
24024
- raw = fs57.readFileSync(path62.join(projectDir, file), "utf8");
24150
+ raw = fs58.readFileSync(path63.join(projectDir, file), "utf8");
24025
24151
  } catch {
24026
24152
  continue;
24027
24153
  }
@@ -24100,7 +24226,7 @@ var HistoryService = class _HistoryService {
24100
24226
  if (this.runtime.resolveHistoryFile) {
24101
24227
  return this.runtime.resolveHistoryFile(this.cwd, sessionId);
24102
24228
  }
24103
- return path62.join(this.projectDir, `${sessionId}.jsonl`);
24229
+ return path63.join(this.projectDir, `${sessionId}.jsonl`);
24104
24230
  }
24105
24231
  /**
24106
24232
  * Parse a conversation's messages from disk, agent-aware. Claude uses the
@@ -24134,7 +24260,7 @@ var HistoryService = class _HistoryService {
24134
24260
  };
24135
24261
  });
24136
24262
  }
24137
- return parseJsonl(path62.join(this.projectDir, `${sessionId}.jsonl`));
24263
+ return parseJsonl(path63.join(this.projectDir, `${sessionId}.jsonl`));
24138
24264
  }
24139
24265
  async loadConversation(sessionId) {
24140
24266
  const messages = this.readConversation(sessionId);
@@ -24190,7 +24316,7 @@ var HistoryService = class _HistoryService {
24190
24316
  if (!filePath) return false;
24191
24317
  let mtimeMs;
24192
24318
  try {
24193
- mtimeMs = fs57.statSync(filePath).mtimeMs;
24319
+ mtimeMs = fs58.statSync(filePath).mtimeMs;
24194
24320
  } catch {
24195
24321
  return false;
24196
24322
  }
@@ -24259,10 +24385,10 @@ var HistoryService = class _HistoryService {
24259
24385
 
24260
24386
  // src/agents/acp/client.ts
24261
24387
  var import_node_child_process26 = require("child_process");
24262
- var fs58 = __toESM(require("fs/promises"));
24388
+ var fs59 = __toESM(require("fs/promises"));
24263
24389
  var fsSync = __toESM(require("fs"));
24264
- var os47 = __toESM(require("os"));
24265
- var path63 = __toESM(require("path"));
24390
+ var os48 = __toESM(require("os"));
24391
+ var path64 = __toESM(require("path"));
24266
24392
  var import_node_stream = require("stream");
24267
24393
 
24268
24394
  // ../../node_modules/@agentclientprotocol/sdk/dist/acp.js
@@ -27343,7 +27469,7 @@ var AcpClient = class {
27343
27469
  },
27344
27470
  readTextFile: async (params) => {
27345
27471
  try {
27346
- const content = await fs58.readFile(params.path, "utf8");
27472
+ const content = await fs59.readFile(params.path, "utf8");
27347
27473
  return applyLineRange(content, params.line ?? null, params.limit ?? null);
27348
27474
  } catch (err) {
27349
27475
  const code = err.code;
@@ -27363,7 +27489,7 @@ var AcpClient = class {
27363
27489
  },
27364
27490
  writeTextFile: async (params) => {
27365
27491
  try {
27366
- await fs58.writeFile(params.path, params.content, "utf8");
27492
+ await fs59.writeFile(params.path, params.content, "utf8");
27367
27493
  return {};
27368
27494
  } catch (err) {
27369
27495
  const code = err.code;
@@ -27412,29 +27538,29 @@ function applyLineRange(content, line, limit) {
27412
27538
  return { content: lines.slice(start2, end).join("\n") };
27413
27539
  }
27414
27540
  function knownAgentBinaryDirs() {
27415
- const home = os47.homedir();
27541
+ const home = os48.homedir();
27416
27542
  const out2 = [];
27417
27543
  out2.push("/tmp/codeam-node20/bin");
27418
27544
  for (const root of [
27419
27545
  "/usr/local/share/nvm/versions/node",
27420
- path63.join(home, ".nvm/versions/node")
27546
+ path64.join(home, ".nvm/versions/node")
27421
27547
  ]) {
27422
27548
  try {
27423
27549
  for (const child of fsSync.readdirSync(root)) {
27424
- out2.push(path63.join(root, child, "bin"));
27550
+ out2.push(path64.join(root, child, "bin"));
27425
27551
  }
27426
27552
  } catch {
27427
27553
  }
27428
27554
  }
27429
- out2.push(path63.join(home, ".volta/bin"));
27555
+ out2.push(path64.join(home, ".volta/bin"));
27430
27556
  out2.push("/usr/local/bin");
27431
27557
  out2.push("/usr/bin");
27432
- out2.push(path63.join(home, ".local/bin"));
27433
- out2.push(path63.join(home, "bin"));
27558
+ out2.push(path64.join(home, ".local/bin"));
27559
+ out2.push(path64.join(home, "bin"));
27434
27560
  if (process.platform === "win32") {
27435
27561
  const { LOCALAPPDATA, APPDATA } = process.env;
27436
- if (LOCALAPPDATA) out2.push(path63.join(LOCALAPPDATA, "cursor-agent"));
27437
- if (APPDATA) out2.push(path63.join(APPDATA, "npm"));
27562
+ if (LOCALAPPDATA) out2.push(path64.join(LOCALAPPDATA, "cursor-agent"));
27563
+ if (APPDATA) out2.push(path64.join(APPDATA, "npm"));
27438
27564
  }
27439
27565
  return out2.filter((p2) => {
27440
27566
  try {
@@ -27446,7 +27572,7 @@ function knownAgentBinaryDirs() {
27446
27572
  }
27447
27573
  function expandPathForAgentBinaries(existingPath) {
27448
27574
  const existing = new Set(
27449
- existingPath.split(path63.delimiter).filter((p2) => p2.length > 0)
27575
+ existingPath.split(path64.delimiter).filter((p2) => p2.length > 0)
27450
27576
  );
27451
27577
  const additions = [];
27452
27578
  for (const dir of knownAgentBinaryDirs()) {
@@ -27456,7 +27582,7 @@ function expandPathForAgentBinaries(existingPath) {
27456
27582
  }
27457
27583
  }
27458
27584
  if (additions.length === 0) return existingPath;
27459
- return [...additions, existingPath].filter((p2) => p2.length > 0).join(path63.delimiter);
27585
+ return [...additions, existingPath].filter((p2) => p2.length > 0).join(path64.delimiter);
27460
27586
  }
27461
27587
 
27462
27588
  // src/agents/acp/headroom-budget-proxy.ts
@@ -27938,15 +28064,15 @@ function commonPrefixLength(a, b) {
27938
28064
 
27939
28065
  // src/agents/acp/onboarding.ts
27940
28066
  var import_child_process26 = require("child_process");
27941
- var fs59 = __toESM(require("fs"));
27942
- var os48 = __toESM(require("os"));
27943
- var path64 = __toESM(require("path"));
28067
+ var fs60 = __toESM(require("fs"));
28068
+ var os49 = __toESM(require("os"));
28069
+ var path65 = __toESM(require("path"));
27944
28070
  var _onboardingSeam = {
27945
- markerPath: (sessionId) => path64.join(os48.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
27946
- exists: (p2) => fs59.existsSync(p2),
28071
+ markerPath: (sessionId) => path65.join(os49.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
28072
+ exists: (p2) => fs60.existsSync(p2),
27947
28073
  write: (p2) => {
27948
- fs59.mkdirSync(path64.dirname(p2), { recursive: true });
27949
- fs59.writeFileSync(p2, "");
28074
+ fs60.mkdirSync(path65.dirname(p2), { recursive: true });
28075
+ fs60.writeFileSync(p2, "");
27950
28076
  },
27951
28077
  disabled: () => {
27952
28078
  const v = process.env.CODEAM_ONBOARDING_DISABLED;
@@ -27983,7 +28109,7 @@ function resolveRepoName(cwd) {
27983
28109
  if (name) return name;
27984
28110
  }
27985
28111
  }
27986
- const base = path64.basename(cwd || "");
28112
+ const base = path65.basename(cwd || "");
27987
28113
  if (base && !isUuid(base)) return base;
27988
28114
  return "this project";
27989
28115
  }
@@ -28235,8 +28361,8 @@ var import_crypto5 = require("crypto");
28235
28361
 
28236
28362
  // src/services/turn-files/git-changeset.ts
28237
28363
  var import_child_process27 = require("child_process");
28238
- var fs60 = __toESM(require("fs/promises"));
28239
- var path65 = __toESM(require("path"));
28364
+ var fs61 = __toESM(require("fs/promises"));
28365
+ var path66 = __toESM(require("path"));
28240
28366
  async function collectRepoChangeset(opts) {
28241
28367
  const status2 = await runGit3(opts.repoRoot, ["status", "--porcelain=v1", "-z"]);
28242
28368
  if (status2 === null) return null;
@@ -28254,7 +28380,7 @@ async function collectRepoChangeset(opts) {
28254
28380
  let stats;
28255
28381
  if (row.fileStatus === "added" && numstatEntry === void 0) {
28256
28382
  const lineCount = await readUntrackedLineCount(
28257
- path65.join(opts.repoRoot, row.filePath)
28383
+ path66.join(opts.repoRoot, row.filePath)
28258
28384
  );
28259
28385
  stats = { added: lineCount, removed: 0 };
28260
28386
  } else {
@@ -28285,7 +28411,7 @@ function readUntrackedLineCount(absPath) {
28285
28411
  }
28286
28412
  async function defaultReadUntrackedLineCount(absPath) {
28287
28413
  try {
28288
- const content = await fs60.readFile(absPath, "utf8");
28414
+ const content = await fs61.readFile(absPath, "utf8");
28289
28415
  let count = 0;
28290
28416
  let pos = -1;
28291
28417
  while ((pos = content.indexOf("\n", pos + 1)) !== -1) {
@@ -28377,7 +28503,7 @@ function defaultRunGit(cwd, args2) {
28377
28503
  });
28378
28504
  }
28379
28505
  async function discoverRepos(workingDir, maxDepth = 4) {
28380
- const fs65 = await import("fs/promises");
28506
+ const fs66 = await import("fs/promises");
28381
28507
  const out2 = [];
28382
28508
  await walk(workingDir, 0);
28383
28509
  return out2;
@@ -28385,7 +28511,7 @@ async function discoverRepos(workingDir, maxDepth = 4) {
28385
28511
  if (depth > maxDepth) return;
28386
28512
  let entries = [];
28387
28513
  try {
28388
- const dirents = await fs65.readdir(dir, { withFileTypes: true });
28514
+ const dirents = await fs66.readdir(dir, { withFileTypes: true });
28389
28515
  entries = dirents.filter((d3) => !d3.name.startsWith(".") || d3.name === ".git").map((d3) => ({ name: d3.name, isDirectory: d3.isDirectory() }));
28390
28516
  } catch {
28391
28517
  return;
@@ -28396,8 +28522,8 @@ async function discoverRepos(workingDir, maxDepth = 4) {
28396
28522
  if (hasGit) {
28397
28523
  out2.push({
28398
28524
  repoRoot: dir,
28399
- repoPath: path65.relative(workingDir, dir),
28400
- repoName: path65.basename(dir)
28525
+ repoPath: path66.relative(workingDir, dir),
28526
+ repoName: path66.basename(dir)
28401
28527
  });
28402
28528
  return;
28403
28529
  }
@@ -28405,14 +28531,14 @@ async function discoverRepos(workingDir, maxDepth = 4) {
28405
28531
  if (!entry.isDirectory) continue;
28406
28532
  if (entry.name === "node_modules") continue;
28407
28533
  if (entry.name === "dist" || entry.name === "build") continue;
28408
- await walk(path65.join(dir, entry.name), depth + 1);
28534
+ await walk(path66.join(dir, entry.name), depth + 1);
28409
28535
  }
28410
28536
  }
28411
28537
  }
28412
28538
 
28413
28539
  // src/services/turn-files/files-outbox.ts
28414
- var fs61 = __toESM(require("fs/promises"));
28415
- var path66 = __toESM(require("path"));
28540
+ var fs62 = __toESM(require("fs/promises"));
28541
+ var path67 = __toESM(require("path"));
28416
28542
  var import_os11 = require("os");
28417
28543
  var HOME_OUTBOX_DIR = ".codeam/outbox";
28418
28544
  var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
@@ -28445,16 +28571,16 @@ var FilesOutbox = class {
28445
28571
  backoffIndex = 0;
28446
28572
  stopped = false;
28447
28573
  constructor(opts) {
28448
- const base = opts.baseDir ?? path66.join(homeDir(), HOME_OUTBOX_DIR);
28449
- this.filePath = path66.join(base, `${opts.sessionId}.jsonl`);
28574
+ const base = opts.baseDir ?? path67.join(homeDir(), HOME_OUTBOX_DIR);
28575
+ this.filePath = path67.join(base, `${opts.sessionId}.jsonl`);
28450
28576
  this.post = opts.post;
28451
28577
  this.autoSchedule = opts.autoSchedule !== false;
28452
28578
  }
28453
28579
  /** Persist the entry to disk and trigger a flush. Returns once the
28454
28580
  * line is durable on disk (not once the POST succeeds). */
28455
28581
  async enqueue(entry) {
28456
- await fs61.mkdir(path66.dirname(this.filePath), { recursive: true });
28457
- await fs61.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
28582
+ await fs62.mkdir(path67.dirname(this.filePath), { recursive: true });
28583
+ await fs62.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
28458
28584
  this.backoffIndex = 0;
28459
28585
  if (this.autoSchedule) this.scheduleFlush(0);
28460
28586
  }
@@ -28545,7 +28671,7 @@ var FilesOutbox = class {
28545
28671
  async readAll() {
28546
28672
  let raw = "";
28547
28673
  try {
28548
- raw = await fs61.readFile(this.filePath, "utf8");
28674
+ raw = await fs62.readFile(this.filePath, "utf8");
28549
28675
  } catch {
28550
28676
  return [];
28551
28677
  }
@@ -28569,12 +28695,12 @@ var FilesOutbox = class {
28569
28695
  async rewrite(entries) {
28570
28696
  const tmpPath = `${this.filePath}.${process.pid}.tmp`;
28571
28697
  if (entries.length === 0) {
28572
- await fs61.unlink(this.filePath).catch(() => void 0);
28698
+ await fs62.unlink(this.filePath).catch(() => void 0);
28573
28699
  return;
28574
28700
  }
28575
28701
  const payload = entries.map((e) => JSON.stringify(e)).join("\n") + "\n";
28576
- await fs61.writeFile(tmpPath, payload, "utf8");
28577
- await fs61.rename(tmpPath, this.filePath);
28702
+ await fs62.writeFile(tmpPath, payload, "utf8");
28703
+ await fs62.rename(tmpPath, this.filePath);
28578
28704
  }
28579
28705
  };
28580
28706
  function applyJitter(ms) {
@@ -31724,7 +31850,7 @@ var AcpDriver = class {
31724
31850
  };
31725
31851
 
31726
31852
  // src/baton/transcript-mirror.ts
31727
- var fs62 = __toESM(require("fs"));
31853
+ var fs63 = __toESM(require("fs"));
31728
31854
  var TranscriptMirror = class {
31729
31855
  constructor(deps) {
31730
31856
  this.deps = deps;
@@ -31791,7 +31917,7 @@ var TranscriptMirror = class {
31791
31917
  }
31792
31918
  };
31793
31919
  function defaultWatch(file, onChange) {
31794
- const w3 = fs62.watch(file, { persistent: false }, () => onChange());
31920
+ const w3 = fs63.watch(file, { persistent: false }, () => onChange());
31795
31921
  return () => w3.close();
31796
31922
  }
31797
31923
 
@@ -32053,15 +32179,15 @@ function toEpochMs(ts) {
32053
32179
  }
32054
32180
 
32055
32181
  // src/agents/claude/onboarding.ts
32056
- var fs63 = __toESM(require("fs"));
32057
- var os49 = __toESM(require("os"));
32058
- var path67 = __toESM(require("path"));
32182
+ var fs64 = __toESM(require("fs"));
32183
+ var os50 = __toESM(require("os"));
32184
+ var path68 = __toESM(require("path"));
32059
32185
  function ensureClaudeOnboarded(cwd) {
32060
32186
  try {
32061
- const file = path67.join(os49.homedir(), ".claude.json");
32187
+ const file = path68.join(os50.homedir(), ".claude.json");
32062
32188
  let config = {};
32063
32189
  try {
32064
- config = JSON.parse(fs63.readFileSync(file, "utf8"));
32190
+ config = JSON.parse(fs64.readFileSync(file, "utf8"));
32065
32191
  } catch {
32066
32192
  }
32067
32193
  let changed = false;
@@ -32085,8 +32211,8 @@ function ensureClaudeOnboarded(cwd) {
32085
32211
  }
32086
32212
  }
32087
32213
  if (!changed) return;
32088
- fs63.mkdirSync(path67.dirname(file), { recursive: true });
32089
- fs63.writeFileSync(file, JSON.stringify(config, null, 2));
32214
+ fs64.mkdirSync(path68.dirname(file), { recursive: true });
32215
+ fs64.writeFileSync(file, JSON.stringify(config, null, 2));
32090
32216
  log.info(
32091
32217
  "claude",
32092
32218
  `pre-completed Claude onboarding${cwd ? ` + trusted workspace ${cwd}` : ""}`
@@ -32772,7 +32898,7 @@ var import_picocolors11 = __toESM(require("picocolors"));
32772
32898
  var import_child_process28 = require("child_process");
32773
32899
  var import_util4 = require("util");
32774
32900
  var import_picocolors9 = __toESM(require("picocolors"));
32775
- var path68 = __toESM(require("path"));
32901
+ var path69 = __toESM(require("path"));
32776
32902
  var execFileP6 = (0, import_util4.promisify)(import_child_process28.execFile);
32777
32903
  var MAX_BUFFER = 8 * 1024 * 1024;
32778
32904
  function resetStdinForChild() {
@@ -33261,7 +33387,7 @@ var GitHubCodespacesProvider = class {
33261
33387
  });
33262
33388
  }
33263
33389
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
33264
- const remoteDir = path68.posix.dirname(remotePath);
33390
+ const remoteDir = path69.posix.dirname(remotePath);
33265
33391
  const parts = [
33266
33392
  `mkdir -p ${shellQuote(remoteDir)}`,
33267
33393
  `cat > ${shellQuote(remotePath)}`
@@ -33331,7 +33457,7 @@ function shellQuote(s) {
33331
33457
  // src/services/providers/gitpod.ts
33332
33458
  var import_child_process29 = require("child_process");
33333
33459
  var import_util5 = require("util");
33334
- var path69 = __toESM(require("path"));
33460
+ var path70 = __toESM(require("path"));
33335
33461
  var import_picocolors10 = __toESM(require("picocolors"));
33336
33462
  var execFileP7 = (0, import_util5.promisify)(import_child_process29.execFile);
33337
33463
  var MAX_BUFFER2 = 8 * 1024 * 1024;
@@ -33571,7 +33697,7 @@ var GitpodProvider = class {
33571
33697
  });
33572
33698
  }
33573
33699
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
33574
- const remoteDir = path69.posix.dirname(remotePath);
33700
+ const remoteDir = path70.posix.dirname(remotePath);
33575
33701
  const parts = [
33576
33702
  `mkdir -p ${shellQuote2(remoteDir)}`,
33577
33703
  `cat > ${shellQuote2(remotePath)}`
@@ -33607,7 +33733,7 @@ function shellQuote2(s) {
33607
33733
  // src/services/providers/gitlab-workspaces.ts
33608
33734
  var import_child_process30 = require("child_process");
33609
33735
  var import_util6 = require("util");
33610
- var path70 = __toESM(require("path"));
33736
+ var path71 = __toESM(require("path"));
33611
33737
  var execFileP8 = (0, import_util6.promisify)(import_child_process30.execFile);
33612
33738
  var MAX_BUFFER3 = 8 * 1024 * 1024;
33613
33739
  var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
@@ -33867,7 +33993,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
33867
33993
  }
33868
33994
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
33869
33995
  const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
33870
- const remoteDir = path70.posix.dirname(remotePath);
33996
+ const remoteDir = path71.posix.dirname(remotePath);
33871
33997
  const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
33872
33998
  if (options.mode != null) {
33873
33999
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
@@ -33935,7 +34061,7 @@ function shellQuote3(s) {
33935
34061
  // src/services/providers/railway.ts
33936
34062
  var import_child_process31 = require("child_process");
33937
34063
  var import_util7 = require("util");
33938
- var path71 = __toESM(require("path"));
34064
+ var path72 = __toESM(require("path"));
33939
34065
  var execFileP9 = (0, import_util7.promisify)(import_child_process31.execFile);
33940
34066
  var MAX_BUFFER4 = 8 * 1024 * 1024;
33941
34067
  function resetStdinForChild4() {
@@ -34171,7 +34297,7 @@ var RailwayProvider = class {
34171
34297
  if (!projectId || !serviceId) {
34172
34298
  throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
34173
34299
  }
34174
- const remoteDir = path71.posix.dirname(remotePath);
34300
+ const remoteDir = path72.posix.dirname(remotePath);
34175
34301
  const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
34176
34302
  if (options.mode != null) {
34177
34303
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
@@ -34817,8 +34943,8 @@ async function invite() {
34817
34943
  var import_node_dns = require("dns");
34818
34944
  var import_node_util5 = require("util");
34819
34945
  var import_node_crypto12 = require("crypto");
34820
- var fs64 = __toESM(require("fs"));
34821
- var path72 = __toESM(require("path"));
34946
+ var fs65 = __toESM(require("fs"));
34947
+ var path73 = __toESM(require("path"));
34822
34948
  var import_picocolors14 = __toESM(require("picocolors"));
34823
34949
  var dnsResolveP = (0, import_node_util5.promisify)(import_node_dns.resolve);
34824
34950
  async function checkDns(apiBase2) {
@@ -34874,13 +35000,13 @@ async function checkHealth(apiBase2) {
34874
35000
  }
34875
35001
  }
34876
35002
  function checkConfigDir() {
34877
- const dir = path72.join(require("os").homedir(), ".codeam");
35003
+ const dir = path73.join(require("os").homedir(), ".codeam");
34878
35004
  try {
34879
- fs64.mkdirSync(dir, { recursive: true, mode: 448 });
34880
- const probe = path72.join(dir, ".doctor-probe");
34881
- fs64.writeFileSync(probe, "ok", { mode: 384 });
34882
- const read2 = fs64.readFileSync(probe, "utf8");
34883
- fs64.unlinkSync(probe);
35005
+ fs65.mkdirSync(dir, { recursive: true, mode: 448 });
35006
+ const probe = path73.join(dir, ".doctor-probe");
35007
+ fs65.writeFileSync(probe, "ok", { mode: 384 });
35008
+ const read2 = fs65.readFileSync(probe, "utf8");
35009
+ fs65.unlinkSync(probe);
34884
35010
  if (read2 !== "ok") throw new Error("write/read round-trip mismatch");
34885
35011
  return {
34886
35012
  id: "config-dir",
@@ -34920,9 +35046,9 @@ function checkSessions() {
34920
35046
  }
34921
35047
  }
34922
35048
  function checkAgentBinaries() {
34923
- const os51 = createOsStrategy();
35049
+ const os52 = createOsStrategy();
34924
35050
  return getEnabledAgents().map((meta) => {
34925
- const found = os51.findInPath(meta.binaryName);
35051
+ const found = os52.findInPath(meta.binaryName);
34926
35052
  return {
34927
35053
  id: `agent-${meta.id}`,
34928
35054
  label: `Agent binary: ${meta.displayName} (${meta.binaryName})`,
@@ -34944,7 +35070,7 @@ function checkNodePty() {
34944
35070
  detail: "not required on this platform"
34945
35071
  };
34946
35072
  }
34947
- const vendoredPath = path72.join(__dirname, "vendor", "node-pty");
35073
+ const vendoredPath = path73.join(__dirname, "vendor", "node-pty");
34948
35074
  for (const target of [vendoredPath, "node-pty"]) {
34949
35075
  try {
34950
35076
  require(target);
@@ -34986,7 +35112,7 @@ function checkChokidar() {
34986
35112
  }
34987
35113
  async function doctor(args2 = []) {
34988
35114
  const json = args2.includes("--json");
34989
- const cliVersion = true ? "2.60.56" : "0.0.0-dev";
35115
+ const cliVersion = true ? "2.60.58" : "0.0.0-dev";
34990
35116
  const apiBase2 = resolveApiBaseUrl();
34991
35117
  const diagnosticId = (0, import_node_crypto12.randomUUID)();
34992
35118
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -35463,7 +35589,7 @@ async function mcpRun(args2) {
35463
35589
  // src/commands/version.ts
35464
35590
  var import_picocolors15 = __toESM(require("picocolors"));
35465
35591
  function version2() {
35466
- const v = true ? "2.60.56" : "unknown";
35592
+ const v = true ? "2.60.58" : "unknown";
35467
35593
  console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
35468
35594
  }
35469
35595
 
@@ -35612,10 +35738,10 @@ var EXIT_CODE_NAMES = {
35612
35738
  };
35613
35739
 
35614
35740
  // src/index.ts
35615
- var os50 = __toESM(require("os"));
35741
+ var os51 = __toESM(require("os"));
35616
35742
  if (!process.env.HOME) {
35617
35743
  try {
35618
- const home = os50.homedir();
35744
+ const home = os51.homedir();
35619
35745
  if (home) process.env.HOME = home;
35620
35746
  } catch {
35621
35747
  }