codeam-cli 2.75.40 → 2.75.42

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,18 @@ 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.75.41] — 2026-09-27
8
+
9
+ ### Fixed
10
+
11
+ - **cli:** Prune debug logs of dead processes (7 days / 200 MB) (#845)
12
+
13
+ ## [2.75.40] — 2026-09-27
14
+
15
+ ### Fixed
16
+
17
+ - **cli:** Guardrail_configure read/write reach their handler (#843)
18
+
7
19
  ## [2.75.39] — 2026-09-27
8
20
 
9
21
  ### Fixed
package/dist/index.js CHANGED
@@ -3437,6 +3437,41 @@ function resolveLogDir() {
3437
3437
  var LOG_DIR = resolveLogDir();
3438
3438
  var debugFilePath = path.join(LOG_DIR, `debug-${process.pid}.log`);
3439
3439
  var fileInitialized = false;
3440
+ var LOG_RETENTION_MS = 7 * 24 * 60 * 60 * 1e3;
3441
+ var LOG_DIR_BUDGET_BYTES = 200 * 1024 * 1024;
3442
+ function pidAlive(pid) {
3443
+ try {
3444
+ process.kill(pid, 0);
3445
+ return true;
3446
+ } catch (err) {
3447
+ return err.code === "EPERM";
3448
+ }
3449
+ }
3450
+ function pruneStaleLogs(dir, now = Date.now(), isAlive = pidAlive) {
3451
+ let removed = 0;
3452
+ try {
3453
+ const entries = fs.readdirSync(dir).map((name) => ({ name, m: /^debug-(\d+)\.log/.exec(name) })).filter((e) => e.m !== null).map(({ name, m }) => {
3454
+ const full = path.join(dir, name);
3455
+ const st3 = fs.statSync(full);
3456
+ return { full, pid: Number(m[1]), mtime: st3.mtimeMs, size: st3.size };
3457
+ }).sort((a, b) => b.mtime - a.mtime);
3458
+ let used = 0;
3459
+ for (const e of entries) {
3460
+ used += e.size;
3461
+ if (e.pid === process.pid || isAlive(e.pid)) continue;
3462
+ if (now - e.mtime > LOG_RETENTION_MS || used > LOG_DIR_BUDGET_BYTES) {
3463
+ try {
3464
+ fs.unlinkSync(e.full);
3465
+ removed++;
3466
+ used -= e.size;
3467
+ } catch {
3468
+ }
3469
+ }
3470
+ }
3471
+ } catch {
3472
+ }
3473
+ return removed;
3474
+ }
3440
3475
  function maybeRotate() {
3441
3476
  try {
3442
3477
  const st3 = fs.statSync(debugFilePath);
@@ -3470,6 +3505,7 @@ function appendToFile(line) {
3470
3505
  try {
3471
3506
  if (!fileInitialized) {
3472
3507
  fs.mkdirSync(path.dirname(debugFilePath), { recursive: true, mode: 448 });
3508
+ pruneStaleLogs(path.dirname(debugFilePath));
3473
3509
  if (fs.existsSync(debugFilePath)) rotateNow();
3474
3510
  const header = jsonMode ? `${JSON.stringify({
3475
3511
  ts: (/* @__PURE__ */ new Date()).toISOString(),
@@ -10529,7 +10565,7 @@ function readAnonId() {
10529
10565
  }
10530
10566
  function superProperties() {
10531
10567
  return {
10532
- cliVersion: true ? "2.75.40" : "0.0.0-dev",
10568
+ cliVersion: true ? "2.75.42" : "0.0.0-dev",
10533
10569
  nodeVersion: process.version,
10534
10570
  platform: process.platform,
10535
10571
  arch: process.arch,
@@ -10704,7 +10740,10 @@ var path4 = __toESM(require("path"));
10704
10740
  var import_child_process2 = require("child_process");
10705
10741
  var WRAPPER_REPO_NAME = "codeam-codespace";
10706
10742
  function resolveSessionHostname(cwd = process.cwd()) {
10707
- if (process.env.CODESPACES !== "true") return _osSeam.hostname();
10743
+ if (process.env.CODESPACES !== "true") {
10744
+ const label = process.env.CODEAM_HOST_LABEL?.trim();
10745
+ return label ? label.slice(0, 80) : _osSeam.hostname();
10746
+ }
10708
10747
  return codespaceSessionLabel(cwd) ?? _osSeam.hostname();
10709
10748
  }
10710
10749
  var _osSeam = {
@@ -10771,7 +10810,7 @@ var http = __toESM(require("http"));
10771
10810
  // package.json
10772
10811
  var package_default = {
10773
10812
  name: "codeam-cli",
10774
- version: "2.75.40",
10813
+ version: "2.75.42",
10775
10814
  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.",
10776
10815
  type: "commonjs",
10777
10816
  main: "dist/index.js",
@@ -10944,7 +10983,11 @@ async function fetchCurrentPluginAuthToken(sessionId, pluginId, pollSecret) {
10944
10983
  // after the CLI restarted on a new release and took the reconnect
10945
10984
  // path (which previously never updated ideVersion). Backends older
10946
10985
  // than the matching fix ignore the unknown field (backward-compat).
10947
- ideVersion: package_default.version
10986
+ ideVersion: package_default.version,
10987
+ // Same for the machine label: a session paired while a CodeAgent Box
10988
+ // reported its container id picks up the box label on reconnect.
10989
+ // Older backends strip the unknown field (whitelist, not forbid).
10990
+ hostname: resolveSessionHostname()
10948
10991
  },
10949
10992
  // SEC: prove possession so the gated /reconnect returns the token.
10950
10993
  // Omitted for legacy sessions (no secret) → backend legacy path.
@@ -12101,7 +12144,7 @@ var CommandRelayService = class _CommandRelayService {
12101
12144
  // fresh + clear the "CLI update available" banner after a self-update
12102
12145
  // (a codespace that reinstalls @latest reconnects via heartbeat, not
12103
12146
  // pair/reconnect). Older backends ignore the extra field.
12104
- ..."2.75.40" ? { ideVersion: "2.75.40" } : {}
12147
+ ..."2.75.42" ? { ideVersion: "2.75.42" } : {}
12105
12148
  };
12106
12149
  try {
12107
12150
  const res = await _postJson(`${API_BASE2}/api/plugin/heartbeat`, body);
@@ -27663,13 +27706,13 @@ function resolveGlobalNodeModulesDir(opts) {
27663
27706
  var STALE_STAGING_AGE_MS = CLI_UPDATE_INSTALL_TIMEOUT_MS;
27664
27707
  function sweepStaleCliStagingDirs(nodeModulesDir, now = Date.now(), deps) {
27665
27708
  if (!nodeModulesDir) return 0;
27666
- const readdirSync14 = deps?.readdirSync ?? fs51.readdirSync;
27709
+ const readdirSync15 = deps?.readdirSync ?? fs51.readdirSync;
27667
27710
  const statSync16 = deps?.statSync ?? fs51.statSync;
27668
27711
  const rmSync10 = deps?.rmSync ?? fs51.rmSync;
27669
27712
  let removed = 0;
27670
27713
  let entries;
27671
27714
  try {
27672
- entries = readdirSync14(nodeModulesDir);
27715
+ entries = readdirSync15(nodeModulesDir);
27673
27716
  } catch {
27674
27717
  return 0;
27675
27718
  }
@@ -39932,7 +39975,7 @@ function readFileVars(file) {
39932
39975
  return {};
39933
39976
  }
39934
39977
  }
39935
- function pidAlive(pid) {
39978
+ function pidAlive2(pid) {
39936
39979
  try {
39937
39980
  process.kill(pid, 0);
39938
39981
  return true;
@@ -39951,7 +39994,7 @@ function pruneStale(dir) {
39951
39994
  const m = /^(\d+)-[a-z]+\.json$/.exec(name);
39952
39995
  if (!m) continue;
39953
39996
  const pid = Number(m[1]);
39954
- if (pid === process.pid || pidAlive(pid)) continue;
39997
+ if (pid === process.pid || pidAlive2(pid)) continue;
39955
39998
  try {
39956
39999
  fs69.unlinkSync(path80.join(dir, name));
39957
40000
  } catch {
@@ -48852,7 +48895,7 @@ async function autoUpgradeBeforeCriticalCommand() {
48852
48895
  if (process.env.NODE_ENV === "test") return;
48853
48896
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
48854
48897
  if (process.env.CI) return;
48855
- const current2 = true ? "2.75.40" : null;
48898
+ const current2 = true ? "2.75.42" : null;
48856
48899
  if (!current2) return;
48857
48900
  const cache = readCache();
48858
48901
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -48869,7 +48912,7 @@ function checkForUpdates() {
48869
48912
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
48870
48913
  if (process.env.CI) return;
48871
48914
  if (!process.stdout.isTTY) return;
48872
- const current2 = true ? "2.75.40" : null;
48915
+ const current2 = true ? "2.75.42" : null;
48873
48916
  if (!current2) return;
48874
48917
  const cache = readCache();
48875
48918
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -48892,7 +48935,7 @@ var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
48892
48935
  var SELF_UPDATE_LS_TIMEOUT_MS = 15e3;
48893
48936
  var SUDO_PREFLIGHT_TIMEOUT_MS = 5e3;
48894
48937
  function currentCliVersion() {
48895
- return true ? "2.75.40" : null;
48938
+ return true ? "2.75.42" : null;
48896
48939
  }
48897
48940
  async function installedVersion(deps) {
48898
48941
  const ls = await deps.run(
@@ -50868,7 +50911,7 @@ function checkChokidar() {
50868
50911
  }
50869
50912
  async function doctor(args2 = []) {
50870
50913
  const json = args2.includes("--json");
50871
- const cliVersion = true ? "2.75.40" : "0.0.0-dev";
50914
+ const cliVersion = true ? "2.75.42" : "0.0.0-dev";
50872
50915
  const apiBase2 = resolveApiBaseUrl();
50873
50916
  const diagnosticId = (0, import_node_crypto13.randomUUID)();
50874
50917
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -51392,7 +51435,7 @@ async function mcpWarm(argv = [], opts = {}) {
51392
51435
  // src/commands/version.ts
51393
51436
  var import_picocolors15 = __toESM(require("picocolors"));
51394
51437
  function version2() {
51395
- const v = true ? "2.75.40" : "unknown";
51438
+ const v = true ? "2.75.42" : "unknown";
51396
51439
  console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
51397
51440
  }
51398
51441
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "2.75.40",
3
+ "version": "2.75.42",
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",