codeam-cli 2.39.33 → 2.39.34

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 (2) hide show
  1. package/dist/index.js +135 -96
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -498,7 +498,7 @@ var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
498
498
  // package.json
499
499
  var package_default = {
500
500
  name: "codeam-cli",
501
- version: "2.39.33",
501
+ version: "2.39.34",
502
502
  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.",
503
503
  type: "commonjs",
504
504
  main: "dist/index.js",
@@ -5908,7 +5908,7 @@ function readAnonId() {
5908
5908
  }
5909
5909
  function superProperties() {
5910
5910
  return {
5911
- cliVersion: true ? "2.39.33" : "0.0.0-dev",
5911
+ cliVersion: true ? "2.39.34" : "0.0.0-dev",
5912
5912
  nodeVersion: process.version,
5913
5913
  platform: process.platform,
5914
5914
  arch: process.arch,
@@ -7302,10 +7302,10 @@ function buildForPlatform(platform3) {
7302
7302
  var import_node_crypto4 = require("crypto");
7303
7303
 
7304
7304
  // src/agents/claude/resolver.ts
7305
- function buildClaudeLaunch(extraArgs = [], os36 = createOsStrategy()) {
7306
- const found = os36.findInPath("claude") ?? os36.findInPath("claude-code");
7305
+ function buildClaudeLaunch(extraArgs = [], os38 = createOsStrategy()) {
7306
+ const found = os38.findInPath("claude") ?? os38.findInPath("claude-code");
7307
7307
  if (!found) return null;
7308
- return os36.buildLaunch(found, extraArgs);
7308
+ return os38.buildLaunch(found, extraArgs);
7309
7309
  }
7310
7310
 
7311
7311
  // src/agents/claude/installer.ts
@@ -9754,8 +9754,8 @@ var ClaudeRuntimeStrategy = class {
9754
9754
  meta = getAgent("claude");
9755
9755
  mode = "interactive";
9756
9756
  os;
9757
- constructor(os36) {
9758
- this.os = os36;
9757
+ constructor(os38) {
9758
+ this.os = os38;
9759
9759
  }
9760
9760
  /**
9761
9761
  * Claude Code's react-ink TUI enables bracketed-paste mode at
@@ -10374,8 +10374,8 @@ function codexCredentialLocator() {
10374
10374
  function codexLoginLauncher() {
10375
10375
  return {
10376
10376
  async ensureInstalled() {
10377
- const os36 = createOsStrategy();
10378
- return os36.findInPath("codex") !== null;
10377
+ const os38 = createOsStrategy();
10378
+ return os38.findInPath("codex") !== null;
10379
10379
  },
10380
10380
  launch() {
10381
10381
  return (0, import_node_child_process3.spawn)("codex", ["login"], { stdio: "inherit" });
@@ -10398,8 +10398,8 @@ var CodexRuntimeStrategy = class {
10398
10398
  meta = getAgent("codex");
10399
10399
  mode = "interactive";
10400
10400
  os;
10401
- constructor(os36) {
10402
- this.os = os36;
10401
+ constructor(os38) {
10402
+ this.os = os38;
10403
10403
  }
10404
10404
  async prepareLaunch() {
10405
10405
  let binary = this.os.findInPath("codex");
@@ -10495,12 +10495,12 @@ var CodexRuntimeStrategy = class {
10495
10495
  });
10496
10496
  }
10497
10497
  };
10498
- function resolveNpm(os36) {
10499
- return os36.id === "win32" ? "npm.cmd" : "npm";
10498
+ function resolveNpm(os38) {
10499
+ return os38.id === "win32" ? "npm.cmd" : "npm";
10500
10500
  }
10501
- async function installCodexViaNpm(os36) {
10501
+ async function installCodexViaNpm(os38) {
10502
10502
  return new Promise((resolve7, reject) => {
10503
- const proc = (0, import_node_child_process4.spawn)(resolveNpm(os36), ["install", "-g", "@openai/codex"], {
10503
+ const proc = (0, import_node_child_process4.spawn)(resolveNpm(os38), ["install", "-g", "@openai/codex"], {
10504
10504
  stdio: "inherit"
10505
10505
  });
10506
10506
  proc.on("close", (code) => {
@@ -10517,16 +10517,16 @@ async function installCodexViaNpm(os36) {
10517
10517
  });
10518
10518
  });
10519
10519
  }
10520
- function augmentNpmGlobalBin(os36) {
10520
+ function augmentNpmGlobalBin(os38) {
10521
10521
  try {
10522
- const result = (0, import_node_child_process4.spawnSync)(resolveNpm(os36), ["prefix", "-g"], {
10522
+ const result = (0, import_node_child_process4.spawnSync)(resolveNpm(os38), ["prefix", "-g"], {
10523
10523
  stdio: ["ignore", "pipe", "ignore"]
10524
10524
  });
10525
10525
  if (result.status !== 0) return;
10526
10526
  const prefix = result.stdout.toString().trim();
10527
10527
  if (!prefix) return;
10528
- const binDir = os36.id === "win32" ? prefix : path17.join(prefix, "bin");
10529
- os36.augmentPath([binDir]);
10528
+ const binDir = os38.id === "win32" ? prefix : path17.join(prefix, "bin");
10529
+ os38.augmentPath([binDir]);
10530
10530
  } catch {
10531
10531
  }
10532
10532
  }
@@ -10610,9 +10610,9 @@ var import_node_child_process7 = require("child_process");
10610
10610
  // src/agents/coderabbit/installer.ts
10611
10611
  var import_node_child_process5 = require("child_process");
10612
10612
  var INSTALL_URL = "https://cli.coderabbit.ai/install.sh";
10613
- async function ensureCoderabbitInstalled(os36) {
10614
- if (os36.findInPath("coderabbit")) return true;
10615
- if (os36.id === "win32") {
10613
+ async function ensureCoderabbitInstalled(os38) {
10614
+ if (os38.findInPath("coderabbit")) return true;
10615
+ if (os38.id === "win32") {
10616
10616
  console.error(
10617
10617
  "\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"
10618
10618
  );
@@ -10627,8 +10627,8 @@ async function ensureCoderabbitInstalled(os36) {
10627
10627
  proc.on("error", () => resolve7(false));
10628
10628
  });
10629
10629
  if (!ok) return false;
10630
- os36.augmentPath([`${os36.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
10631
- return os36.findInPath("coderabbit") !== null;
10630
+ os38.augmentPath([`${os38.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
10631
+ return os38.findInPath("coderabbit") !== null;
10632
10632
  }
10633
10633
 
10634
10634
  // src/agents/coderabbit/link.ts
@@ -10655,10 +10655,10 @@ function coderabbitCredentialLocator() {
10655
10655
  extract: extractLocalCoderabbitToken
10656
10656
  };
10657
10657
  }
10658
- function coderabbitLoginLauncher(os36) {
10658
+ function coderabbitLoginLauncher(os38) {
10659
10659
  return {
10660
10660
  async ensureInstalled() {
10661
- return ensureCoderabbitInstalled(os36);
10661
+ return ensureCoderabbitInstalled(os38);
10662
10662
  },
10663
10663
  launch() {
10664
10664
  return (0, import_node_child_process6.spawn)("coderabbit", ["login"], { stdio: "inherit" });
@@ -10704,8 +10704,8 @@ var CoderabbitRuntimeStrategy = class {
10704
10704
  meta = getAgent("coderabbit");
10705
10705
  mode = "batch";
10706
10706
  os;
10707
- constructor(os36) {
10708
- this.os = os36;
10707
+ constructor(os38) {
10708
+ this.os = os38;
10709
10709
  }
10710
10710
  getDefaultArgs() {
10711
10711
  return ["review"];
@@ -10820,10 +10820,10 @@ function cursorCredentialLocator() {
10820
10820
  extract: extractLocalCursorToken
10821
10821
  };
10822
10822
  }
10823
- function cursorLoginLauncher(os36) {
10823
+ function cursorLoginLauncher(os38) {
10824
10824
  return {
10825
10825
  async ensureInstalled() {
10826
- if (os36.findInPath("cursor-agent")) return true;
10826
+ if (os38.findInPath("cursor-agent")) return true;
10827
10827
  console.error(
10828
10828
  "\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"
10829
10829
  );
@@ -10885,8 +10885,8 @@ var CursorRuntimeStrategy = class {
10885
10885
  meta = getAgent("cursor");
10886
10886
  mode = "interactive";
10887
10887
  os;
10888
- constructor(os36) {
10889
- this.os = os36;
10888
+ constructor(os38) {
10889
+ this.os = os38;
10890
10890
  }
10891
10891
  async prepareLaunch() {
10892
10892
  const binary = this.os.findInPath("cursor-agent");
@@ -11006,10 +11006,10 @@ function aiderCredentialLocator() {
11006
11006
  extract: extractLocalAiderToken
11007
11007
  };
11008
11008
  }
11009
- function aiderLoginLauncher(os36) {
11009
+ function aiderLoginLauncher(os38) {
11010
11010
  return {
11011
11011
  async ensureInstalled() {
11012
- if (os36.findInPath("aider")) return true;
11012
+ if (os38.findInPath("aider")) return true;
11013
11013
  console.error(
11014
11014
  "\n \u2717 aider binary not on PATH.\n Install Aider:\n pip install aider-chat\n then re-run `codeam link aider`.\n"
11015
11015
  );
@@ -11019,7 +11019,7 @@ function aiderLoginLauncher(os36) {
11019
11019
  console.error(
11020
11020
  "\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"
11021
11021
  );
11022
- return (0, import_node_child_process9.spawn)(os36.id === "win32" ? "cmd.exe" : "sh", os36.id === "win32" ? ["/c", "exit", "0"] : ["-c", "exit 0"], {
11022
+ return (0, import_node_child_process9.spawn)(os38.id === "win32" ? "cmd.exe" : "sh", os38.id === "win32" ? ["/c", "exit", "0"] : ["-c", "exit 0"], {
11023
11023
  stdio: "ignore"
11024
11024
  });
11025
11025
  }
@@ -11091,8 +11091,8 @@ var AiderRuntimeStrategy = class {
11091
11091
  meta = getAgent("aider");
11092
11092
  mode = "interactive";
11093
11093
  os;
11094
- constructor(os36) {
11095
- this.os = os36;
11094
+ constructor(os38) {
11095
+ this.os = os38;
11096
11096
  }
11097
11097
  async prepareLaunch() {
11098
11098
  const binary = this.os.findInPath("aider");
@@ -11221,8 +11221,8 @@ function geminiCredentialLocator() {
11221
11221
  function geminiLoginLauncher() {
11222
11222
  return {
11223
11223
  async ensureInstalled() {
11224
- const os36 = createOsStrategy();
11225
- return os36.findInPath("gemini") !== null;
11224
+ const os38 = createOsStrategy();
11225
+ return os38.findInPath("gemini") !== null;
11226
11226
  },
11227
11227
  launch() {
11228
11228
  return (0, import_node_child_process10.spawn)("gemini", ["auth", "login"], { stdio: "inherit" });
@@ -11255,8 +11255,8 @@ var GeminiRuntimeStrategy = class {
11255
11255
  meta = getAgent("gemini");
11256
11256
  mode = "interactive";
11257
11257
  os;
11258
- constructor(os36) {
11259
- this.os = os36;
11258
+ constructor(os38) {
11259
+ this.os = os38;
11260
11260
  }
11261
11261
  async prepareLaunch() {
11262
11262
  const binary = this.os.findInPath("gemini");
@@ -11355,18 +11355,18 @@ var GeminiRuntimeStrategy = class {
11355
11355
 
11356
11356
  // src/agents/registry.ts
11357
11357
  var runtimeBuilders = {
11358
- claude: (os36) => new ClaudeRuntimeStrategy(os36),
11359
- codex: (os36) => new CodexRuntimeStrategy(os36),
11360
- coderabbit: (os36) => new CoderabbitRuntimeStrategy(os36),
11361
- cursor: (os36) => new CursorRuntimeStrategy(os36),
11362
- aider: (os36) => new AiderRuntimeStrategy(os36),
11363
- gemini: (os36) => new GeminiRuntimeStrategy(os36)
11358
+ claude: (os38) => new ClaudeRuntimeStrategy(os38),
11359
+ codex: (os38) => new CodexRuntimeStrategy(os38),
11360
+ coderabbit: (os38) => new CoderabbitRuntimeStrategy(os38),
11361
+ cursor: (os38) => new CursorRuntimeStrategy(os38),
11362
+ aider: (os38) => new AiderRuntimeStrategy(os38),
11363
+ gemini: (os38) => new GeminiRuntimeStrategy(os38)
11364
11364
  };
11365
11365
  var deployBuilders = {
11366
11366
  claude: () => new ClaudeDeployStrategy(),
11367
11367
  codex: () => new CodexDeployStrategy()
11368
11368
  };
11369
- function createAgentStrategy(agent, os36 = createOsStrategy()) {
11369
+ function createAgentStrategy(agent, os38 = createOsStrategy()) {
11370
11370
  if (!AGENT_REGISTRY[agent]?.enabled) {
11371
11371
  throw new Error(
11372
11372
  `Agent "${agent}" is not supported in this codeam-cli version. Upgrade with 'npm i -g codeam-cli@latest'.`
@@ -11376,10 +11376,10 @@ function createAgentStrategy(agent, os36 = createOsStrategy()) {
11376
11376
  if (!build) {
11377
11377
  throw new Error(`No runtime strategy registered for agent "${agent}"`);
11378
11378
  }
11379
- return build(os36);
11379
+ return build(os38);
11380
11380
  }
11381
- function createInteractiveAgentStrategy(agent, os36 = createOsStrategy()) {
11382
- const s = createAgentStrategy(agent, os36);
11381
+ function createInteractiveAgentStrategy(agent, os38 = createOsStrategy()) {
11382
+ const s = createAgentStrategy(agent, os38);
11383
11383
  if (s.mode !== "interactive") {
11384
11384
  throw new Error(
11385
11385
  `Agent "${agent}" is a batch agent; use createAgentStrategy + .runOneShot for one-shot reviews.`
@@ -15256,7 +15256,7 @@ function extractSelectPrompt(text) {
15256
15256
 
15257
15257
  // src/commands/start/handlers.ts
15258
15258
  var fs35 = __toESM(require("fs"));
15259
- var os27 = __toESM(require("os"));
15259
+ var os28 = __toESM(require("os"));
15260
15260
  var path42 = __toESM(require("path"));
15261
15261
  var import_crypto3 = require("crypto");
15262
15262
  var import_child_process18 = require("child_process");
@@ -17027,6 +17027,7 @@ function activePreviewSessionIds() {
17027
17027
  // src/beads/bd-adapter.ts
17028
17028
  var import_child_process13 = require("child_process");
17029
17029
  var fs31 = __toESM(require("fs"));
17030
+ var os25 = __toESM(require("os"));
17030
17031
  var path37 = __toESM(require("path"));
17031
17032
  var BD_PACKAGE = "@beads/bd";
17032
17033
  function resolveBundledBdBinary() {
@@ -17142,6 +17143,13 @@ var BdAdapter = class {
17142
17143
  return { code: -1, stdout: "", stderr: "bd binary not resolved" };
17143
17144
  }
17144
17145
  const env = { ...process.env };
17146
+ if (!env.HOME) {
17147
+ try {
17148
+ const home = os25.homedir();
17149
+ if (home) env.HOME = home;
17150
+ } catch {
17151
+ }
17152
+ }
17145
17153
  env.BEADS_DOLT_SHARED_SERVER = "1";
17146
17154
  delete env.BEADS_DIR;
17147
17155
  log.trace(
@@ -17227,7 +17235,7 @@ function coerceIssue(row, projectKey) {
17227
17235
  // src/beads/provisioner.ts
17228
17236
  var import_child_process17 = require("child_process");
17229
17237
  var fs34 = __toESM(require("fs"));
17230
- var os26 = __toESM(require("os"));
17238
+ var os27 = __toESM(require("os"));
17231
17239
  var path40 = __toESM(require("path"));
17232
17240
 
17233
17241
  // src/beads/install-bd.ts
@@ -17294,7 +17302,7 @@ async function installBd(platform3 = process.platform) {
17294
17302
  // src/beads/install-dolt.ts
17295
17303
  var import_child_process15 = require("child_process");
17296
17304
  var fs32 = __toESM(require("fs"));
17297
- var os25 = __toESM(require("os"));
17305
+ var os26 = __toESM(require("os"));
17298
17306
  var path38 = __toESM(require("path"));
17299
17307
  var DOLT_INSTALL_SH_URL = "https://github.com/dolthub/dolt/releases/latest/download/install.sh";
17300
17308
  var DOLT_MSI_URL = "https://github.com/dolthub/dolt/releases/latest/download/dolt-windows-amd64.msi";
@@ -17335,11 +17343,11 @@ function resolveDoltInstallStrategy(platform3) {
17335
17343
  }
17336
17344
  var DOLT_RELEASE_BASE = "https://github.com/dolthub/dolt/releases/latest/download";
17337
17345
  function doltPlatformTuple(platform3, arch2) {
17338
- const os36 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
17346
+ const os38 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
17339
17347
  const a = arch2 === "x64" ? "amd64" : arch2 === "arm64" ? "arm64" : null;
17340
17348
  if (!a) return null;
17341
- if (os36 === "windows" && a !== "amd64") return null;
17342
- return `${os36}-${a}`;
17349
+ if (os38 === "windows" && a !== "amd64") return null;
17350
+ return `${os38}-${a}`;
17343
17351
  }
17344
17352
  function resolveDoltTarballStrategy(targetDir, platform3, arch2) {
17345
17353
  const tuple = doltPlatformTuple(platform3, arch2);
@@ -17384,7 +17392,7 @@ async function installDoltToDir(targetDir, platform3 = process.platform, arch2 =
17384
17392
  return result;
17385
17393
  }
17386
17394
  var _doltPathSeam = {
17387
- homedir: () => os25.homedir(),
17395
+ homedir: () => os26.homedir(),
17388
17396
  getPath: () => process.env.PATH ?? "",
17389
17397
  setPath: (p2) => {
17390
17398
  process.env.PATH = p2;
@@ -17648,7 +17656,7 @@ var _provisionSeam = {
17648
17656
  };
17649
17657
  var _linkSeam = {
17650
17658
  platform: () => process.platform,
17651
- homedir: () => os26.homedir(),
17659
+ homedir: () => os27.homedir(),
17652
17660
  isWritableDir: (dir) => {
17653
17661
  try {
17654
17662
  fs34.accessSync(dir, fs34.constants.W_OK);
@@ -18274,7 +18282,7 @@ function cleanupAttachmentTempFiles() {
18274
18282
  function saveFilesTemp(files) {
18275
18283
  return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
18276
18284
  const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
18277
- const tmpPath = path42.join(os27.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
18285
+ const tmpPath = path42.join(os28.tmpdir(), `codeam-${(0, import_crypto3.randomUUID)()}-${safeName}`);
18278
18286
  fs35.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
18279
18287
  pendingAttachmentFiles.add(tmpPath);
18280
18288
  return tmpPath;
@@ -19355,7 +19363,7 @@ async function dispatchCommand(ctx, cmd) {
19355
19363
  // src/services/file-watcher.service.ts
19356
19364
  var import_child_process19 = require("child_process");
19357
19365
  var fs36 = __toESM(require("fs"));
19358
- var os28 = __toESM(require("os"));
19366
+ var os29 = __toESM(require("os"));
19359
19367
  var path43 = __toESM(require("path"));
19360
19368
  var import_ignore = __toESM(require("ignore"));
19361
19369
 
@@ -19466,10 +19474,10 @@ var WINDOWS_LEGACY_JUNCTIONS = [
19466
19474
  /[\\/]Start Menu([\\/]|$)/i,
19467
19475
  /[\\/]Templates([\\/]|$)/i
19468
19476
  ];
19469
- function isUnsafeWindowsWatchRoot(dir, homedir29) {
19477
+ function isUnsafeWindowsWatchRoot(dir, homedir31) {
19470
19478
  const norm = (p2) => p2.replace(/\//g, "\\").replace(/\\+$/, "").toLowerCase();
19471
19479
  const cwd = norm(dir);
19472
- const home = norm(homedir29);
19480
+ const home = norm(homedir31);
19473
19481
  if (cwd === home) return true;
19474
19482
  if (/^[a-z]:$/.test(cwd)) return true;
19475
19483
  const sysRoots = [
@@ -19568,7 +19576,7 @@ var FileWatcherService = class {
19568
19576
  throw new Error("FileWatcherService has already been stopped \u2014 re-instantiate to restart.");
19569
19577
  }
19570
19578
  const isWin = process.platform === "win32";
19571
- if (isWin && isUnsafeWindowsWatchRoot(this.opts.workingDir, os28.homedir())) {
19579
+ if (isWin && isUnsafeWindowsWatchRoot(this.opts.workingDir, os29.homedir())) {
19572
19580
  log.warn(
19573
19581
  "fileWatcher",
19574
19582
  `refusing to watch ${this.opts.workingDir} \u2014 looks like a Windows user-profile or system path. Run codeam from your project folder to enable file change emission.`
@@ -20673,6 +20681,27 @@ var StreamingState = class {
20673
20681
  * chunk is done streaming.
20674
20682
  */
20675
20683
  streamingChunks = /* @__PURE__ */ new Map();
20684
+ /**
20685
+ * Stable chunkId that ALL `text` segments of the current turn collapse
20686
+ * onto (set to the first text chunk's id, reset each {@link beginTurn}).
20687
+ *
20688
+ * Why: `claude-agent-acp` (≥0.47) streams the reply live as
20689
+ * `agent_message_chunk` deltas under one message id, then — when its
20690
+ * own streamed-vs-consolidated dedupe misfires (the live path keys
20691
+ * `streamedTextIds` off the stream message id while consolidation
20692
+ * checks `messageIdForGrouping`, which can differ per gateway) —
20693
+ * RE-EMITS the complete assistant message as a fresh
20694
+ * `agent_message_chunk` under a DIFFERENT message id. Keying our buffer
20695
+ * off the adapter's chunkId then lands the two copies in two buckets,
20696
+ * and `recomputeText` concatenates them → the whole reply doubles
20697
+ * ("…del proyecto.¡Perfecto!…del proyecto."). Observed on BOTH real
20698
+ * Claude (codespace) and the MiniMax proxy (self-hosted) — anything
20699
+ * behind this adapter. Collapsing every text segment of a turn into one
20700
+ * reconcile buffer makes the re-emit a `reconcileCumulative` REPLACE
20701
+ * (identical snapshot) instead of an APPEND, so the reply can't double
20702
+ * no matter how many message ids the adapter spreads it across.
20703
+ */
20704
+ turnTextChunkId = null;
20676
20705
  /**
20677
20706
  * Register a permission Promise. The Promise stays pending until
20678
20707
  * `resolveSelection(index)` is called from the relay handler, OR
@@ -20764,6 +20793,7 @@ var StreamingState = class {
20764
20793
  async beginTurn(opts) {
20765
20794
  this.text = "";
20766
20795
  this.streamingChunks.clear();
20796
+ this.turnTextChunkId = null;
20767
20797
  if (this.pending?.kind === "permission") {
20768
20798
  clearTimeout(this.pending.timeoutTimer);
20769
20799
  }
@@ -20774,21 +20804,22 @@ var StreamingState = class {
20774
20804
  await this.publisher.publishOutput({ type: "new_turn", done: false });
20775
20805
  }
20776
20806
  append(delta) {
20777
- const existing = this.streamingChunks.get(delta.chunkId);
20807
+ const chunkId = delta.kind === "text" ? this.turnTextChunkId ??= delta.chunkId : delta.chunkId;
20808
+ const existing = this.streamingChunks.get(chunkId);
20778
20809
  if (existing && existing.kind !== delta.kind) {
20779
20810
  log.warn(
20780
20811
  "acpRunner",
20781
- `streaming-chunk kind flip chunkId=${delta.chunkId.slice(0, 8)} from=${existing.kind} to=${delta.kind}`
20812
+ `streaming-chunk kind flip chunkId=${chunkId.slice(0, 8)} from=${existing.kind} to=${delta.kind}`
20782
20813
  );
20783
20814
  }
20784
20815
  const cumulativeContent = reconcileCumulative(existing?.content ?? "", delta.delta);
20785
- this.streamingChunks.set(delta.chunkId, { kind: delta.kind, content: cumulativeContent });
20816
+ this.streamingChunks.set(chunkId, { kind: delta.kind, content: cumulativeContent });
20786
20817
  if (delta.kind === "text") {
20787
20818
  this.recomputeText();
20788
20819
  void this.publisher.publishOutput({ type: "text", content: this.text, done: false });
20789
20820
  }
20790
20821
  void this.publisher.publishStreamingChunk({
20791
- chunkId: delta.chunkId,
20822
+ chunkId,
20792
20823
  kind: delta.kind,
20793
20824
  content: cumulativeContent,
20794
20825
  isFinal: false
@@ -22335,7 +22366,7 @@ var OutputService = class _OutputService {
22335
22366
  // src/services/history.service.ts
22336
22367
  var fs38 = __toESM(require("fs"));
22337
22368
  var path46 = __toESM(require("path"));
22338
- var os29 = __toESM(require("os"));
22369
+ var os30 = __toESM(require("os"));
22339
22370
  var https7 = __toESM(require("https"));
22340
22371
  var http7 = __toESM(require("http"));
22341
22372
  var import_zod2 = require("zod");
@@ -22503,7 +22534,7 @@ var HistoryService = class _HistoryService {
22503
22534
  return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
22504
22535
  }
22505
22536
  get projectDir() {
22506
- return this.runtime.resolveHistoryDir(this.cwd) ?? path46.join(os29.homedir(), ".claude", "projects", encodeCwd(this.cwd));
22537
+ return this.runtime.resolveHistoryDir(this.cwd) ?? path46.join(os30.homedir(), ".claude", "projects", encodeCwd(this.cwd));
22507
22538
  }
22508
22539
  /** Set the current Claude conversation ID (extracted from /cost command or session start) */
22509
22540
  setCurrentConversationId(id) {
@@ -23265,11 +23296,11 @@ function buildKeepAlive(ctx) {
23265
23296
 
23266
23297
  // src/agents/claude/onboarding.ts
23267
23298
  var fs39 = __toESM(require("fs"));
23268
- var os30 = __toESM(require("os"));
23299
+ var os31 = __toESM(require("os"));
23269
23300
  var path47 = __toESM(require("path"));
23270
23301
  function ensureClaudeOnboarded() {
23271
23302
  try {
23272
- const file = path47.join(os30.homedir(), ".claude.json");
23303
+ const file = path47.join(os31.homedir(), ".claude.json");
23273
23304
  let config = {};
23274
23305
  try {
23275
23306
  config = JSON.parse(fs39.readFileSync(file, "utf8"));
@@ -23776,7 +23807,7 @@ async function autoLinkAfterPair(opts) {
23776
23807
 
23777
23808
  // src/commands/pair-auto.ts
23778
23809
  var fs40 = __toESM(require("fs"));
23779
- var os31 = __toESM(require("os"));
23810
+ var os32 = __toESM(require("os"));
23780
23811
  var path48 = __toESM(require("path"));
23781
23812
  var import_crypto7 = require("crypto");
23782
23813
 
@@ -24003,7 +24034,7 @@ async function claimOnce(token, pluginId, pluginSecretHash) {
24003
24034
  pluginId,
24004
24035
  ideName: "codeam-cli (codespace)",
24005
24036
  ideVersion: process.env.npm_package_version ?? "unknown",
24006
- hostname: os31.hostname(),
24037
+ hostname: os32.hostname(),
24007
24038
  codespaceName: process.env.CODESPACE_NAME ?? "",
24008
24039
  // Current git branch of the codespace's working directory, so the
24009
24040
  // backend can populate `PairedSession.branch` for the codespace pair.
@@ -24064,7 +24095,7 @@ async function claim(token, pluginId, pluginSecretHash) {
24064
24095
  }
24065
24096
  }
24066
24097
  function pairAutoLockPath() {
24067
- return path48.join(os31.homedir(), ".codeam", "pair-auto.lock");
24098
+ return path48.join(os32.homedir(), ".codeam", "pair-auto.lock");
24068
24099
  }
24069
24100
  function isLivePairAuto(pid) {
24070
24101
  if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) return false;
@@ -26237,12 +26268,12 @@ async function stopWorkspaceFromLocal(target) {
26237
26268
 
26238
26269
  // src/commands/host/host-client.ts
26239
26270
  var fs41 = __toESM(require("fs"));
26240
- var os32 = __toESM(require("os"));
26271
+ var os33 = __toESM(require("os"));
26241
26272
  var path53 = __toESM(require("path"));
26242
26273
  function sampleCpuTimes() {
26243
26274
  let idle = 0;
26244
26275
  let total = 0;
26245
- for (const cpu of os32.cpus()) {
26276
+ for (const cpu of os33.cpus()) {
26246
26277
  const t2 = cpu.times;
26247
26278
  idle += t2.idle;
26248
26279
  total += t2.user + t2.nice + t2.sys + t2.idle + t2.irq;
@@ -26261,8 +26292,8 @@ var MetricsCollector = class {
26261
26292
  const prev = this.prevCpu;
26262
26293
  this.prevCpu = current;
26263
26294
  if (!prev) {
26264
- const cores = os32.cpus().length || 1;
26265
- const proxy = os32.loadavg()[0] / cores * 100;
26295
+ const cores = os33.cpus().length || 1;
26296
+ const proxy = os33.loadavg()[0] / cores * 100;
26266
26297
  return Math.min(100, Math.max(0, Math.round(proxy)));
26267
26298
  }
26268
26299
  const idleDelta = current.idle - prev.idle;
@@ -26275,8 +26306,8 @@ var MetricsCollector = class {
26275
26306
  collect() {
26276
26307
  return {
26277
26308
  cpuPct: this.cpuPct(),
26278
- ramUsedMb: Math.round((os32.totalmem() - os32.freemem()) / 1048576),
26279
- ramTotalMb: Math.round(os32.totalmem() / 1048576),
26309
+ ramUsedMb: Math.round((os33.totalmem() - os33.freemem()) / 1048576),
26310
+ ramTotalMb: Math.round(os33.totalmem() / 1048576),
26280
26311
  latencyMs: this.lastLatencyMs
26281
26312
  };
26282
26313
  }
@@ -26285,13 +26316,13 @@ function apiBase() {
26285
26316
  return process.env.CODEAM_API_URL ?? resolveApiBaseUrl();
26286
26317
  }
26287
26318
  function hostIdentityPath() {
26288
- return path53.join(os32.homedir(), ".codeam", "host-agent.json");
26319
+ return path53.join(os33.homedir(), ".codeam", "host-agent.json");
26289
26320
  }
26290
26321
  function collectOsInfo() {
26291
26322
  return {
26292
- distro: os32.platform(),
26293
- arch: os32.arch(),
26294
- kernel: os32.release(),
26323
+ distro: os33.platform(),
26324
+ arch: os33.arch(),
26325
+ kernel: os33.release(),
26295
26326
  nodeVersion: process.versions.node
26296
26327
  };
26297
26328
  }
@@ -26502,7 +26533,7 @@ var import_node_child_process13 = require("child_process");
26502
26533
 
26503
26534
  // src/commands/host/workspace.ts
26504
26535
  var fs42 = __toESM(require("fs"));
26505
- var os33 = __toESM(require("os"));
26536
+ var os34 = __toESM(require("os"));
26506
26537
  var path54 = __toESM(require("path"));
26507
26538
  var import_node_child_process12 = require("child_process");
26508
26539
  var import_node_util4 = require("util");
@@ -26511,7 +26542,7 @@ function isAbsolutePathTarget(target) {
26511
26542
  return path54.isAbsolute(target);
26512
26543
  }
26513
26544
  function selfHostedWorkspaceRoot() {
26514
- return path54.join(os33.homedir(), ".codeam", "self-hosted");
26545
+ return path54.join(os34.homedir(), ".codeam", "self-hosted");
26515
26546
  }
26516
26547
  function nonInteractiveGitEnv() {
26517
26548
  return {
@@ -26580,7 +26611,7 @@ async function prepareWorkspace(repoOrPath, deployId, cloneToken) {
26580
26611
 
26581
26612
  // src/commands/host/agent-provisioning.ts
26582
26613
  var fs43 = __toESM(require("fs"));
26583
- var os34 = __toESM(require("os"));
26614
+ var os35 = __toESM(require("os"));
26584
26615
  var path55 = __toESM(require("path"));
26585
26616
  var PUBLIC_TO_INTERNAL_AGENT = {
26586
26617
  claude_code: "claude",
@@ -26640,7 +26671,7 @@ var UnsupportedAgentError = class extends Error {
26640
26671
  this.agentId = agentId;
26641
26672
  }
26642
26673
  };
26643
- function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os34.homedir()) {
26674
+ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os35.homedir()) {
26644
26675
  const internal = toInternalAgentId(publicAgentId);
26645
26676
  if (!internal) throw new UnsupportedAgentError(publicAgentId);
26646
26677
  const provisioner = PROVISIONERS[internal];
@@ -27081,9 +27112,9 @@ function checkSessions() {
27081
27112
  }
27082
27113
  }
27083
27114
  function checkAgentBinaries() {
27084
- const os36 = createOsStrategy();
27115
+ const os38 = createOsStrategy();
27085
27116
  return getEnabledAgents().map((meta) => {
27086
- const found = os36.findInPath(meta.binaryName);
27117
+ const found = os38.findInPath(meta.binaryName);
27087
27118
  return {
27088
27119
  id: `agent-${meta.id}`,
27089
27120
  label: `Agent binary: ${meta.displayName} (${meta.binaryName})`,
@@ -27147,7 +27178,7 @@ function checkChokidar() {
27147
27178
  }
27148
27179
  async function doctor(args2 = []) {
27149
27180
  const json = args2.includes("--json");
27150
- const cliVersion = true ? "2.39.33" : "0.0.0-dev";
27181
+ const cliVersion = true ? "2.39.34" : "0.0.0-dev";
27151
27182
  const apiBase2 = resolveApiBaseUrl();
27152
27183
  const diagnosticId = (0, import_node_crypto8.randomUUID)();
27153
27184
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -27346,7 +27377,7 @@ async function completion(args2) {
27346
27377
  // src/commands/version.ts
27347
27378
  var import_picocolors13 = __toESM(require("picocolors"));
27348
27379
  function version2() {
27349
- const v = true ? "2.39.33" : "unknown";
27380
+ const v = true ? "2.39.34" : "unknown";
27350
27381
  console.log(`${import_picocolors13.default.bold("codeam-cli")} ${import_picocolors13.default.cyan(v)}`);
27351
27382
  }
27352
27383
 
@@ -27475,7 +27506,7 @@ var _subcommandHelpKeys = Object.keys(HELPS);
27475
27506
 
27476
27507
  // src/lib/updateNotifier.ts
27477
27508
  var fs45 = __toESM(require("fs"));
27478
- var os35 = __toESM(require("os"));
27509
+ var os36 = __toESM(require("os"));
27479
27510
  var path57 = __toESM(require("path"));
27480
27511
  var https8 = __toESM(require("https"));
27481
27512
  var import_node_child_process14 = require("child_process");
@@ -27485,7 +27516,7 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
27485
27516
  var TTL_MS = 24 * 60 * 60 * 1e3;
27486
27517
  var REQUEST_TIMEOUT_MS = 1500;
27487
27518
  function cachePath() {
27488
- const dir = path57.join(os35.homedir(), ".codeam");
27519
+ const dir = path57.join(os36.homedir(), ".codeam");
27489
27520
  return path57.join(dir, "update-check.json");
27490
27521
  }
27491
27522
  function readCache() {
@@ -27632,7 +27663,7 @@ function checkForUpdates() {
27632
27663
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
27633
27664
  if (process.env.CI) return;
27634
27665
  if (!process.stdout.isTTY) return;
27635
- const current = true ? "2.39.33" : null;
27666
+ const current = true ? "2.39.34" : null;
27636
27667
  if (!current) return;
27637
27668
  const cache = readCache();
27638
27669
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -27663,6 +27694,14 @@ var EXIT_CODE_NAMES = {
27663
27694
  };
27664
27695
 
27665
27696
  // src/index.ts
27697
+ var os37 = __toESM(require("os"));
27698
+ if (!process.env.HOME) {
27699
+ try {
27700
+ const home = os37.homedir();
27701
+ if (home) process.env.HOME = home;
27702
+ } catch {
27703
+ }
27704
+ }
27666
27705
  var [, , command, ...args] = process.argv;
27667
27706
  async function main() {
27668
27707
  const isMetaCommand = command === "--version" || command === "-v" || command === "version" || command === "--help" || command === "-h" || command === "help";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "2.39.33",
3
+ "version": "2.39.34",
4
4
  "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 — async. The terminal companion for CodeAgent Mobile.",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",