codeam-cli 2.26.6 → 2.26.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,12 @@ 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.26.6] — 2026-06-03
8
+
9
+ ### Fixed
10
+
11
+ - **cli:** Preview shutdown is graceful + parser tolerates prose-wrapped JSON (#239)
12
+
7
13
  ## [2.26.5] — 2026-06-03
8
14
 
9
15
  ### Fixed
package/dist/index.js CHANGED
@@ -472,7 +472,7 @@ var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
472
472
  // package.json
473
473
  var package_default = {
474
474
  name: "codeam-cli",
475
- version: "2.26.6",
475
+ version: "2.26.7",
476
476
  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.",
477
477
  type: "commonjs",
478
478
  main: "dist/index.js",
@@ -5829,7 +5829,7 @@ function readAnonId() {
5829
5829
  }
5830
5830
  function superProperties() {
5831
5831
  return {
5832
- cliVersion: true ? "2.26.6" : "0.0.0-dev",
5832
+ cliVersion: true ? "2.26.7" : "0.0.0-dev",
5833
5833
  nodeVersion: process.version,
5834
5834
  platform: process.platform,
5835
5835
  arch: process.arch,
@@ -15944,6 +15944,20 @@ var import_path4 = __toESM(require("path"));
15944
15944
  var import_promises2 = require("stream/promises");
15945
15945
  var import_which = __toESM(require("which"));
15946
15946
  var CACHED_BINARY = import_path4.default.join(import_os7.default.homedir(), ".codeam", "bin", "cloudflared");
15947
+ async function waitForCloudflaredReady(url, timeoutMs = 3e4) {
15948
+ const start2 = Date.now();
15949
+ while (Date.now() - start2 < timeoutMs) {
15950
+ try {
15951
+ const res = await fetch(url, { method: "HEAD" });
15952
+ if (res.status < 500) return;
15953
+ } catch {
15954
+ }
15955
+ await new Promise((r) => setTimeout(r, 500));
15956
+ }
15957
+ throw new Error(
15958
+ `Tunnel URL ${url} not reachable after ${timeoutMs}ms (DNS may still be propagating).`
15959
+ );
15960
+ }
15947
15961
  async function resolveCloudflared(opts = {}) {
15948
15962
  try {
15949
15963
  return await (0, import_which.default)("cloudflared");
@@ -16919,10 +16933,12 @@ var previewStartH = (ctx, _cmd, parsed) => {
16919
16933
  const onTunnelChunk = (chunk) => {
16920
16934
  const s = chunk.toString();
16921
16935
  if (!parsedUrl) parsedUrl = parseCloudflaredUrl(s);
16936
+ const trimmed = s.replace(/\n+$/g, "");
16937
+ if (trimmed.length > 0) log.info("preview", `cloudflared: ${trimmed}`);
16922
16938
  };
16923
16939
  tunnel.stderr.on("data", onTunnelChunk);
16924
16940
  tunnel.stdout.on("data", onTunnelChunk);
16925
- const tunnelDeadline = Date.now() + 15e3;
16941
+ const tunnelDeadline = Date.now() + 45e3;
16926
16942
  while (!parsedUrl && Date.now() < tunnelDeadline) {
16927
16943
  await new Promise((r) => setTimeout(r, 250));
16928
16944
  }
@@ -16940,7 +16956,27 @@ var previewStartH = (ctx, _cmd, parsed) => {
16940
16956
  pluginId: ctx.pluginId,
16941
16957
  pluginAuthToken,
16942
16958
  type: "preview_error",
16943
- payload: { stage: "tunnel", message: "cloudflared did not emit a URL within 15s." }
16959
+ payload: { stage: "tunnel", message: "cloudflared did not emit a URL within 45s." }
16960
+ });
16961
+ return;
16962
+ }
16963
+ try {
16964
+ await waitForCloudflaredReady(parsedUrl, 3e4);
16965
+ } catch (e) {
16966
+ try {
16967
+ tunnel.kill("SIGTERM");
16968
+ } catch {
16969
+ }
16970
+ try {
16971
+ devServer.kill("SIGTERM");
16972
+ } catch {
16973
+ }
16974
+ void postPreviewEvent({
16975
+ sessionId: ctx.sessionId,
16976
+ pluginId: ctx.pluginId,
16977
+ pluginAuthToken,
16978
+ type: "preview_error",
16979
+ payload: { stage: "tunnel", message: e.message }
16944
16980
  });
16945
16981
  return;
16946
16982
  }
@@ -16986,8 +17022,16 @@ function runOnce(cmd, args2, cwd, env) {
16986
17022
  const child = (0, import_child_process15.spawn)(cmd, args2, {
16987
17023
  cwd,
16988
17024
  env: { ...process.env, ...env ?? {} },
16989
- stdio: "inherit"
17025
+ stdio: ["ignore", "pipe", "pipe"]
16990
17026
  });
17027
+ const tag = `setup:${cmd}`;
17028
+ const onChunk = (chunk) => {
17029
+ const text = chunk.toString().replace(/\n+$/g, "");
17030
+ if (text.length === 0) return;
17031
+ log.info("preview", `${tag}: ${text}`);
17032
+ };
17033
+ child.stdout?.on("data", onChunk);
17034
+ child.stderr?.on("data", onChunk);
16991
17035
  child.once("exit", (code) => resolve5(code));
16992
17036
  child.once("error", () => resolve5(-1));
16993
17037
  });
@@ -19992,7 +20036,7 @@ function checkChokidar() {
19992
20036
  }
19993
20037
  async function doctor(args2 = []) {
19994
20038
  const json = args2.includes("--json");
19995
- const cliVersion = true ? "2.26.6" : "0.0.0-dev";
20039
+ const cliVersion = true ? "2.26.7" : "0.0.0-dev";
19996
20040
  const apiBase = resolveApiBaseUrl();
19997
20041
  const diagnosticId = (0, import_node_crypto6.randomUUID)();
19998
20042
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -20191,7 +20235,7 @@ async function completion(args2) {
20191
20235
  // src/commands/version.ts
20192
20236
  var import_picocolors13 = __toESM(require("picocolors"));
20193
20237
  function version2() {
20194
- const v = true ? "2.26.6" : "unknown";
20238
+ const v = true ? "2.26.7" : "unknown";
20195
20239
  console.log(`${import_picocolors13.default.bold("codeam-cli")} ${import_picocolors13.default.cyan(v)}`);
20196
20240
  }
20197
20241
 
@@ -20419,7 +20463,7 @@ function checkForUpdates() {
20419
20463
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
20420
20464
  if (process.env.CI) return;
20421
20465
  if (!process.stdout.isTTY) return;
20422
- const current = true ? "2.26.6" : null;
20466
+ const current = true ? "2.26.7" : null;
20423
20467
  if (!current) return;
20424
20468
  const cache = readCache();
20425
20469
  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.26.6",
3
+ "version": "2.26.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",