codeam-cli 2.39.72 → 2.39.74

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.39.73] — 2026-06-21
8
+
9
+ ### Fixed
10
+
11
+ - **cli:** Self-hosted Headroom Kompress on ONNX (no torch) + model pre-download
12
+
13
+ ## [2.39.72] — 2026-06-21
14
+
15
+ ### Fixed
16
+
17
+ - **host-agent:** Validate torch before enabling Kompress (never hang the proxy)
18
+
7
19
  ## [2.39.71] — 2026-06-21
8
20
 
9
21
  ### Tests
package/dist/index.js CHANGED
@@ -356,7 +356,7 @@ Return ONLY a JSON object on stdout (no prose, no markdown fences):
356
356
  "port": <number>,
357
357
  "ready_pattern": "<regex matching the server-ready stdout line>",
358
358
  "env": { "HOST": "0.0.0.0" },
359
- "setup_commands": [],
359
+ "setup_commands": [{ "cmd": "<executable>", "args": ["..."] }],
360
360
  "notes": "<one-line caveat or null>"
361
361
  }
362
362
 
@@ -378,6 +378,8 @@ CRITICAL \u2014 setup_commands:
378
378
  - ONLY include setup_commands for genuinely non-install work the project needs
379
379
  before its dev server can boot: prisma generate, codegen, prebuild scripts,
380
380
  database migrations against a local SQLite, etc.
381
+ - Each setup_commands entry MUST be an object {"cmd": "...", "args": ["..."]} \u2014
382
+ e.g. {"cmd": "npx", "args": ["prisma", "generate"]}. NOT a bare string.
381
383
  - For most projects, setup_commands should be an empty array [].
382
384
 
383
385
  OUTPUT JSON ONLY. NO MARKDOWN. NO COMMENTARY.
@@ -5388,7 +5390,7 @@ function readAnonId() {
5388
5390
  }
5389
5391
  function superProperties() {
5390
5392
  return {
5391
- cliVersion: true ? "2.39.72" : "0.0.0-dev",
5393
+ cliVersion: true ? "2.39.74" : "0.0.0-dev",
5392
5394
  nodeVersion: process.version,
5393
5395
  platform: process.platform,
5394
5396
  arch: process.arch,
@@ -5547,7 +5549,7 @@ var os4 = __toESM(require("os"));
5547
5549
  // package.json
5548
5550
  var package_default = {
5549
5551
  name: "codeam-cli",
5550
- version: "2.39.72",
5552
+ version: "2.39.74",
5551
5553
  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.",
5552
5554
  type: "commonjs",
5553
5555
  main: "dist/index.js",
@@ -7739,10 +7741,21 @@ var startCommandSchema = import_zod.z.object({
7739
7741
  port: import_zod.z.number().int().min(1).max(65535),
7740
7742
  ready_pattern: import_zod.z.string().min(1).max(4096),
7741
7743
  env: import_zod.z.record(import_zod.z.string(), import_zod.z.string().max(8192)).optional(),
7744
+ // The agent emits entries as either {cmd,args} objects OR bare command
7745
+ // strings ("npx prisma generate"). Accept both and normalize strings to
7746
+ // {cmd,args} so a string entry doesn't reject the whole detection (which
7747
+ // would silently drop the preview) and downstream always gets objects.
7742
7748
  setup_commands: import_zod.z.array(
7743
- import_zod.z.object({
7744
- cmd: import_zod.z.string().min(1).max(256),
7745
- args: import_zod.z.array(import_zod.z.string().max(1024)).max(64)
7749
+ import_zod.z.union([
7750
+ import_zod.z.string().min(1).max(1024),
7751
+ import_zod.z.object({
7752
+ cmd: import_zod.z.string().min(1).max(256),
7753
+ args: import_zod.z.array(import_zod.z.string().max(1024)).max(64)
7754
+ })
7755
+ ]).transform((entry) => {
7756
+ if (typeof entry !== "string") return entry;
7757
+ const parts = entry.trim().split(/\s+/).filter(Boolean);
7758
+ return { cmd: parts[0] ?? "", args: parts.slice(1) };
7746
7759
  })
7747
7760
  ).max(32).optional(),
7748
7761
  notes: import_zod.z.string().max(4096).nullable().optional()
@@ -16173,9 +16186,18 @@ var previewStartH = (ctx, _cmd, parsed) => {
16173
16186
  }
16174
16187
  preflightRan = true;
16175
16188
  }
16176
- const agentSetupCommands = preflightRan ? (detection.setup_commands ?? []).filter(
16177
- (s) => !isJsInstallCommand(s.cmd, s.args)
16178
- ) : detection.setup_commands ?? [];
16189
+ const normalizedSetup = (detection.setup_commands ?? []).map((entry) => {
16190
+ if (typeof entry === "string") {
16191
+ const parts = entry.trim().split(/\s+/).filter(Boolean);
16192
+ return { cmd: parts[0] ?? "", args: parts.slice(1) };
16193
+ }
16194
+ const o = entry ?? {};
16195
+ return {
16196
+ cmd: typeof o.cmd === "string" ? o.cmd : "",
16197
+ args: Array.isArray(o.args) ? o.args.filter((a) => typeof a === "string") : []
16198
+ };
16199
+ }).filter((s) => s.cmd.length > 0);
16200
+ const agentSetupCommands = preflightRan ? normalizedSetup.filter((s) => !isJsInstallCommand(s.cmd, s.args)) : normalizedSetup;
16179
16201
  for (const setup of agentSetupCommands) {
16180
16202
  emitProgress("SETUP_RUN", `${setup.cmd} ${setup.args.join(" ")}`);
16181
16203
  const timeoutMs = isJsInstallCommand(setup.cmd, setup.args) ? INSTALL_TIMEOUT_MS : SETUP_TIMEOUT_MS;
@@ -16486,7 +16508,17 @@ var previewStartH = (ctx, _cmd, parsed) => {
16486
16508
  type: "preview_ready",
16487
16509
  payload: { url, framework: detection.framework, port: detection.port }
16488
16510
  });
16489
- })();
16511
+ })().catch((err) => {
16512
+ const message = err instanceof Error ? err.message : String(err);
16513
+ log.warn("preview", `start crashed before ready: ${message}`);
16514
+ void postPreviewEvent({
16515
+ sessionId: ctx.sessionId,
16516
+ pluginId: ctx.pluginId,
16517
+ pluginAuthToken,
16518
+ type: "preview_error",
16519
+ payload: { stage: "spawn", message: `Preview failed to start: ${message}` }
16520
+ });
16521
+ });
16490
16522
  };
16491
16523
  var previewStopH = (ctx) => {
16492
16524
  if (!ctx.pluginAuthToken) {
@@ -17406,7 +17438,7 @@ function checkForUpdates() {
17406
17438
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
17407
17439
  if (process.env.CI) return;
17408
17440
  if (!process.stdout.isTTY) return;
17409
- const current = true ? "2.39.72" : null;
17441
+ const current = true ? "2.39.74" : null;
17410
17442
  if (!current) return;
17411
17443
  const cache = readCache();
17412
17444
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -17500,7 +17532,7 @@ var CONTROL_AGENT_META = {
17500
17532
  var PEP668_MARKER = "externally-managed-environment";
17501
17533
  var PM_INSTALL_TIMEOUT_MS = 18e4;
17502
17534
  var ENGINE_INSTALL_TIMEOUT_MS = 36e4;
17503
- var HEADROOM_MIN_FREE_DISK_BYTES = 3 * 1024 * 1024 * 1024;
17535
+ var HEADROOM_MIN_FREE_DISK_BYTES = 2 * 1024 * 1024 * 1024;
17504
17536
  var defaultHeadroomRunner = {
17505
17537
  which(cmd) {
17506
17538
  try {
@@ -17736,39 +17768,25 @@ async function setupHeadroomForSelfHosted(agent, runner = defaultHeadroomRunner)
17736
17768
  }
17737
17769
  return false;
17738
17770
  };
17739
- const torchInstalled = await pipInstall(
17740
- ["torch"],
17741
- ["--index-url", "https://download.pytorch.org/whl/cpu"],
17742
- ENGINE_INSTALL_TIMEOUT_MS
17743
- );
17744
- let torchOk = false;
17745
- if (torchInstalled) {
17746
- const v = await runner.run("python3", ["-c", "import torch; import torch.export"], {
17747
- timeoutMs: 6e4
17748
- });
17749
- torchOk = v.code === 0;
17750
- if (!torchOk) {
17751
- log.warn(
17752
- "host-agent",
17753
- `torch installed but failed its deep-import validation (code=${String(v.code)}) \u2014 disabling Kompress to avoid a hung proxy; using the AST code engine only`
17754
- );
17755
- }
17756
- }
17757
- log.info(
17758
- "host-agent",
17759
- torchOk ? "PyTorch installed + validated \u2014 Kompress (ML) compressor enabled" : "Kompress unavailable (torch absent/broken) \u2014 installing the AST code engine only"
17760
- );
17761
- const headroomPkg = torchOk ? "headroom-ai[code,ml]" : "headroom-ai[code]";
17762
- const installOk = await pipInstall(
17763
- [headroomPkg, ...SERVER_DEPS],
17764
- [],
17765
- ENGINE_INSTALL_TIMEOUT_MS
17766
- );
17771
+ const headroomPkg = "headroom-ai[proxy,code]";
17772
+ const installOk = await pipInstall([headroomPkg, ...SERVER_DEPS], [], ENGINE_INSTALL_TIMEOUT_MS);
17767
17773
  if (!installOk) {
17768
17774
  log.warn("host-agent", `headroom engine install failed (${headroomPkg}) \u2014 skipping Headroom`);
17769
17775
  return false;
17770
17776
  }
17771
- log.info("host-agent", `headroom + engines installed (${headroomPkg})`);
17777
+ log.info("host-agent", `headroom + ONNX engines installed (${headroomPkg})`);
17778
+ const predownloadPy = [
17779
+ "from huggingface_hub import snapshot_download",
17780
+ 'snapshot_download("chopratejas/kompress-v2-base", allow_patterns=["*.json","onnx/*.onnx","kompress-int8-wo.onnx"])',
17781
+ 'snapshot_download("answerdotai/ModernBERT-base", allow_patterns=["*.json","tokenizer*","*.txt","vocab*","merges*"])'
17782
+ ].join("\n");
17783
+ const dl = await runner.run("python3", ["-c", predownloadPy], {
17784
+ timeoutMs: ENGINE_INSTALL_TIMEOUT_MS
17785
+ });
17786
+ log.info(
17787
+ "host-agent",
17788
+ dl.code === 0 ? "Kompress model pre-downloaded \u2014 first prompt will be fast" : "Kompress model pre-download failed (best-effort) \u2014 first prompt may be slow"
17789
+ );
17772
17790
  if (!runner.which("headroom")) {
17773
17791
  log.warn("host-agent", "headroom not found on PATH after install \u2014 skipping init");
17774
17792
  return false;
@@ -17803,7 +17821,8 @@ async function setupHeadroomForSelfHosted(agent, runner = defaultHeadroomRunner)
17803
17821
  try {
17804
17822
  const proxy = (0, import_node_child_process13.spawn)("headroom", ["proxy", "--port", "8787"], {
17805
17823
  stdio: "ignore",
17806
- detached: true
17824
+ detached: true,
17825
+ env: { ...process.env, HEADROOM_KOMPRESS_BACKEND: "onnx_cpu" }
17807
17826
  });
17808
17827
  proxy.unref();
17809
17828
  } catch (e) {
@@ -17818,7 +17837,7 @@ var defaultSpawner = (env, cwd, args2 = []) => (0, import_node_child_process13.s
17818
17837
  detached: false
17819
17838
  });
17820
17839
  function currentCliVersion() {
17821
- return true ? "2.39.72" : null;
17840
+ return true ? "2.39.74" : null;
17822
17841
  }
17823
17842
  function runCmd(cmd, args2, timeoutMs) {
17824
17843
  return new Promise((resolve7) => {
@@ -28472,7 +28491,7 @@ function checkChokidar() {
28472
28491
  }
28473
28492
  async function doctor(args2 = []) {
28474
28493
  const json = args2.includes("--json");
28475
- const cliVersion = true ? "2.39.72" : "0.0.0-dev";
28494
+ const cliVersion = true ? "2.39.74" : "0.0.0-dev";
28476
28495
  const apiBase2 = resolveApiBaseUrl();
28477
28496
  const diagnosticId = (0, import_node_crypto8.randomUUID)();
28478
28497
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -28671,7 +28690,7 @@ async function completion(args2) {
28671
28690
  // src/commands/version.ts
28672
28691
  var import_picocolors14 = __toESM(require("picocolors"));
28673
28692
  function version2() {
28674
- const v = true ? "2.39.72" : "unknown";
28693
+ const v = true ? "2.39.74" : "unknown";
28675
28694
  console.log(`${import_picocolors14.default.bold("codeam-cli")} ${import_picocolors14.default.cyan(v)}`);
28676
28695
  }
28677
28696
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "2.39.72",
3
+ "version": "2.39.74",
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",