codeam-cli 2.17.5 → 2.17.7

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,28 @@ All notable changes to `codeam-cli` are documented here.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.17.6] — 2026-05-23
8
+
9
+ ### Revert
10
+
11
+ - **vsc-plugin,jetbrains-plugin:** Drop install_cli_and_pair --agent forwarding
12
+
13
+ ## [2.17.5] — 2026-05-23
14
+
15
+ ### Added
16
+
17
+ - **vsc-plugin,jetbrains-plugin:** Forward selected agent to codeam pair
18
+
19
+ ### Fixed
20
+
21
+ - **vsc-plugin,jetbrains-plugin:** Npx fallback when codeam fails on PS5
22
+
23
+ ## [2.17.4] — 2026-05-23
24
+
25
+ ### Fixed
26
+
27
+ - **vsc-plugin,jetbrains-plugin:** Npx fallback when codeam fails on PS5
28
+
7
29
  ## [2.17.3] — 2026-05-23
8
30
 
9
31
  ### Fixed
package/dist/index.js CHANGED
@@ -353,7 +353,20 @@ function makeConfig(baseDir) {
353
353
  }
354
354
  function save(c2) {
355
355
  fs.mkdirSync(dir, { recursive: true, mode: 448 });
356
- fs.writeFileSync(file, JSON.stringify(c2, null, 2), { encoding: "utf-8", mode: 384 });
356
+ const tmp = `${file}.${process.pid}.${crypto.randomBytes(4).toString("hex")}.tmp`;
357
+ try {
358
+ fs.writeFileSync(tmp, JSON.stringify(c2, null, 2), {
359
+ encoding: "utf-8",
360
+ mode: 384
361
+ });
362
+ fs.renameSync(tmp, file);
363
+ } catch (err) {
364
+ try {
365
+ fs.unlinkSync(tmp);
366
+ } catch {
367
+ }
368
+ throw err;
369
+ }
357
370
  }
358
371
  function getConfig2() {
359
372
  return load();
@@ -424,7 +437,7 @@ var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
424
437
  // package.json
425
438
  var package_default = {
426
439
  name: "codeam-cli",
427
- version: "2.17.5",
440
+ version: "2.17.7",
428
441
  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.",
429
442
  type: "commonjs",
430
443
  main: "dist/index.js",
@@ -572,7 +585,7 @@ function vercelBypassHeader() {
572
585
  var import_child_process = require("child_process");
573
586
  function detectCurrentBranch(cwd = process.cwd()) {
574
587
  try {
575
- const raw = _execSeam.exec("git branch --show-current", {
588
+ const raw = _execSeam.exec("git", ["branch", "--show-current"], {
576
589
  cwd,
577
590
  // 1 s ceiling is comfortably above normal git latency (<50 ms
578
591
  // on a healthy repo) and well below the pair POST's 10 s budget.
@@ -590,8 +603,8 @@ function detectCurrentBranch(cwd = process.cwd()) {
590
603
  }
591
604
  }
592
605
  var _execSeam = {
593
- exec: (cmd, opts) => {
594
- const out = (0, import_child_process.execSync)(cmd, opts);
606
+ exec: (file, args2, opts) => {
607
+ const out = (0, import_child_process.execFileSync)(file, args2, opts);
595
608
  return typeof out === "string" ? out : out.toString("utf8");
596
609
  }
597
610
  };
@@ -863,13 +876,13 @@ function appendToFile(line) {
863
876
  try {
864
877
  if (!fileInitialized) {
865
878
  fs2.mkdirSync(path2.dirname(debugFilePath), { recursive: true });
866
- fs2.writeFileSync(
867
- debugFilePath,
868
- `=== codeam debug log \u2014 pid ${process.pid} \u2014 ${(/* @__PURE__ */ new Date()).toISOString()} ===
879
+ const header = `=== codeam debug log \u2014 pid ${process.pid} \u2014 ${(/* @__PURE__ */ new Date()).toISOString()} ===
869
880
  platform=${process.platform} node=${process.version} cwd=${process.cwd()}
870
881
 
871
- `
872
- );
882
+ `;
883
+ const tmp = `${debugFilePath}.${process.pid}.tmp`;
884
+ fs2.writeFileSync(tmp, header);
885
+ fs2.renameSync(tmp, debugFilePath);
873
886
  fileInitialized = true;
874
887
  }
875
888
  fs2.appendFileSync(debugFilePath, line);
@@ -1371,7 +1384,7 @@ var WindowsPtyStrategy = class {
1371
1384
  COLUMNS: "220",
1372
1385
  LINES: "50"
1373
1386
  },
1374
- shell: true
1387
+ shell: false
1375
1388
  });
1376
1389
  this.proc.on("error", (err) => {
1377
1390
  console.error(
@@ -8745,7 +8758,15 @@ function readTokenFromArgs(args2) {
8745
8758
  if (process.env.CODEAM_AUTO_TOKEN) return process.env.CODEAM_AUTO_TOKEN;
8746
8759
  fail("codeam pair-auto requires --token-file=<path>, --token=<value>, or CODEAM_AUTO_TOKEN env");
8747
8760
  }
8748
- async function claim(token, pluginId) {
8761
+ var CLAIM_TIMEOUT_MS = 15e3;
8762
+ var RETRY_BACKOFF_MS3 = 2e3;
8763
+ function networkError(msg, cause) {
8764
+ const err = new Error(msg);
8765
+ err.code = "NETWORK";
8766
+ if (cause !== void 0) err.cause = cause;
8767
+ return err;
8768
+ }
8769
+ async function claimOnce(token, pluginId) {
8749
8770
  const url = `${API_BASE7}/api/pairing/claim-auto-token`;
8750
8771
  const body = {
8751
8772
  token,
@@ -8759,11 +8780,28 @@ async function claim(token, pluginId) {
8759
8780
  // `null` when detached HEAD / not a git repo.
8760
8781
  branch: detectCurrentBranch()
8761
8782
  };
8762
- const res = await fetch(url, {
8763
- method: "POST",
8764
- headers: { "Content-Type": "application/json", ...vercelBypassHeader() },
8765
- body: JSON.stringify(body)
8766
- });
8783
+ const controller = new AbortController();
8784
+ const timer = setTimeout(() => controller.abort(), CLAIM_TIMEOUT_MS);
8785
+ let res;
8786
+ try {
8787
+ res = await fetch(url, {
8788
+ method: "POST",
8789
+ headers: { "Content-Type": "application/json", ...vercelBypassHeader() },
8790
+ body: JSON.stringify(body),
8791
+ signal: controller.signal
8792
+ });
8793
+ } catch (err) {
8794
+ const aborted = err.name === "AbortError";
8795
+ throw networkError(
8796
+ aborted ? `request timed out after ${CLAIM_TIMEOUT_MS}ms` : `fetch failed: ${err.message}`,
8797
+ err
8798
+ );
8799
+ } finally {
8800
+ clearTimeout(timer);
8801
+ }
8802
+ if (res.status >= 500 && res.status < 600) {
8803
+ throw networkError(`server returned ${res.status}`);
8804
+ }
8767
8805
  const json = await res.json();
8768
8806
  if (!res.ok || !("success" in json) || !json.success) {
8769
8807
  const errBody = json;
@@ -8777,6 +8815,20 @@ async function claim(token, pluginId) {
8777
8815
  }
8778
8816
  return ok.data;
8779
8817
  }
8818
+ async function claim(token, pluginId) {
8819
+ try {
8820
+ return await claimOnce(token, pluginId);
8821
+ } catch (err) {
8822
+ if (err.code !== "NETWORK") throw err;
8823
+ await new Promise((r) => setTimeout(r, RETRY_BACKOFF_MS3));
8824
+ try {
8825
+ return await claimOnce(token, pluginId);
8826
+ } catch (retryErr) {
8827
+ const netErr = retryErr;
8828
+ fail(`Auto-pair failed (NETWORK): ${netErr.message}`);
8829
+ }
8830
+ }
8831
+ }
8780
8832
  async function pairAuto(args2) {
8781
8833
  const token = readTokenFromArgs(args2);
8782
8834
  const pluginId = (0, import_crypto5.randomUUID)();
@@ -11247,7 +11299,7 @@ async function linkDryRunPreflight(meta) {
11247
11299
  // src/commands/version.ts
11248
11300
  var import_picocolors12 = __toESM(require("picocolors"));
11249
11301
  function version() {
11250
- const v = true ? "2.17.5" : "unknown";
11302
+ const v = true ? "2.17.7" : "unknown";
11251
11303
  console.log(`${import_picocolors12.default.bold("codeam-cli")} ${import_picocolors12.default.cyan(v)}`);
11252
11304
  }
11253
11305
 
@@ -11378,7 +11430,9 @@ function writeCache(cache) {
11378
11430
  try {
11379
11431
  const file = cachePath();
11380
11432
  fs19.mkdirSync(path28.dirname(file), { recursive: true });
11381
- fs19.writeFileSync(file, JSON.stringify(cache));
11433
+ const tmp = `${file}.${process.pid}.tmp`;
11434
+ fs19.writeFileSync(tmp, JSON.stringify(cache));
11435
+ fs19.renameSync(tmp, file);
11382
11436
  } catch {
11383
11437
  }
11384
11438
  }
@@ -11449,7 +11503,7 @@ function checkForUpdates() {
11449
11503
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
11450
11504
  if (process.env.CI) return;
11451
11505
  if (!process.stdout.isTTY) return;
11452
- const current = true ? "2.17.5" : null;
11506
+ const current = true ? "2.17.7" : null;
11453
11507
  if (!current) return;
11454
11508
  const cache = readCache();
11455
11509
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "2.17.5",
3
+ "version": "2.17.7",
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",