codeam-cli 2.40.0 → 2.40.2

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,33 @@ 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.40.1] — 2026-06-24
8
+
9
+ ### Fixed
10
+
11
+ - **cli:** Refresh plugin-auth token on 401 in reportCredentialInvalid
12
+
13
+ ### Merge
14
+
15
+ - ReportCredentialInvalid refreshes plugin-auth token on 401 (codeagent-niu)
16
+
17
+ ## [2.40.0] — 2026-06-24
18
+
19
+ ### Added
20
+
21
+ - **cli:** Add formatAgentReplyLine for the pair full-thread echo
22
+ - **cli:** Echo agent reply in codeam pair so the full thread is visible
23
+
24
+ ### Fixed
25
+
26
+ - **cli:** Refresh plugin-auth token and retry once on 401/403 output POST
27
+ - **cli:** Wire plugin-auth token refresh into ACP publisher
28
+ - **cli:** Await bounded terminal-frame flush before adapter-exit teardown
29
+
30
+ ### Merge
31
+
32
+ - Session-hang CLI fix (token self-heal + flush-before-exit) + codeam pair agent-reply echo
33
+
7
34
  ## [2.39.87] — 2026-06-23
8
35
 
9
36
  ### Added
package/dist/index.js CHANGED
@@ -5390,7 +5390,7 @@ function readAnonId() {
5390
5390
  }
5391
5391
  function superProperties() {
5392
5392
  return {
5393
- cliVersion: true ? "2.40.0" : "0.0.0-dev",
5393
+ cliVersion: true ? "2.40.2" : "0.0.0-dev",
5394
5394
  nodeVersion: process.version,
5395
5395
  platform: process.platform,
5396
5396
  arch: process.arch,
@@ -5549,7 +5549,7 @@ var os4 = __toESM(require("os"));
5549
5549
  // package.json
5550
5550
  var package_default = {
5551
5551
  name: "codeam-cli",
5552
- version: "2.40.0",
5552
+ version: "2.40.2",
5553
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.",
5554
5554
  type: "commonjs",
5555
5555
  main: "dist/index.js",
@@ -17308,7 +17308,11 @@ var claudeProvisioner = {
17308
17308
  if (auth.kind === "api_key") {
17309
17309
  return { ANTHROPIC_API_KEY: auth.value };
17310
17310
  }
17311
- writeFile0600(path43.join(home, ".claude", ".credentials.json"), auth.value);
17311
+ const value = auth.value.trim();
17312
+ const isJsonBlob = value.startsWith("{");
17313
+ if (isJsonBlob) {
17314
+ writeFile0600(path43.join(home, ".claude", ".credentials.json"), value);
17315
+ }
17312
17316
  const claudeJson = path43.join(home, ".claude.json");
17313
17317
  if (!fs37.existsSync(claudeJson)) {
17314
17318
  writeFile0600(
@@ -17316,7 +17320,7 @@ var claudeProvisioner = {
17316
17320
  JSON.stringify({ hasCompletedOnboarding: true, customApiKeyResponses: { approved: [] } })
17317
17321
  );
17318
17322
  }
17319
- return {};
17323
+ return isJsonBlob ? {} : { CLAUDE_CODE_OAUTH_TOKEN: value };
17320
17324
  }
17321
17325
  };
17322
17326
  var codexProvisioner = {
@@ -17749,7 +17753,7 @@ async function autoUpgradeBeforeCriticalCommand() {
17749
17753
  if (process.env.NODE_ENV === "test") return;
17750
17754
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
17751
17755
  if (process.env.CI) return;
17752
- const current = true ? "2.40.0" : null;
17756
+ const current = true ? "2.40.2" : null;
17753
17757
  if (!current) return;
17754
17758
  const cache = readCache();
17755
17759
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -17766,7 +17770,7 @@ function checkForUpdates() {
17766
17770
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
17767
17771
  if (process.env.CI) return;
17768
17772
  if (!process.stdout.isTTY) return;
17769
- const current = true ? "2.40.0" : null;
17773
+ const current = true ? "2.40.2" : null;
17770
17774
  if (!current) return;
17771
17775
  const cache = readCache();
17772
17776
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -18204,7 +18208,7 @@ var defaultSpawner = (env, cwd, args2 = []) => (0, import_node_child_process14.s
18204
18208
  detached: false
18205
18209
  });
18206
18210
  function currentCliVersion() {
18207
- return true ? "2.40.0" : null;
18211
+ return true ? "2.40.2" : null;
18208
18212
  }
18209
18213
  function runCmd(cmd, args2, timeoutMs) {
18210
18214
  return new Promise((resolve7) => {
@@ -24623,18 +24627,28 @@ function failureBubble(opts) {
24623
24627
  return null;
24624
24628
  }
24625
24629
  async function reportCredentialInvalid(opts, fetchImpl = fetch) {
24630
+ const url = `${resolveApiBaseUrl()}/api/plugin/agents/${encodeURIComponent(opts.agent)}/credential-invalid`;
24631
+ const body = JSON.stringify({ sessionId: opts.sessionId, pluginId: opts.pluginId });
24626
24632
  try {
24627
- await fetchImpl(
24628
- `${resolveApiBaseUrl()}/api/plugin/agents/${encodeURIComponent(opts.agent)}/credential-invalid`,
24629
- {
24630
- method: "POST",
24631
- headers: {
24632
- "Content-Type": "application/json",
24633
- "X-Plugin-Auth-Token": opts.pluginAuthToken
24634
- },
24635
- body: JSON.stringify({ sessionId: opts.sessionId, pluginId: opts.pluginId })
24633
+ const makeHeaders = (token) => ({
24634
+ "Content-Type": "application/json",
24635
+ "X-Plugin-Auth-Token": token
24636
+ });
24637
+ const response = await fetchImpl(url, {
24638
+ method: "POST",
24639
+ headers: makeHeaders(opts.pluginAuthToken),
24640
+ body
24641
+ });
24642
+ if (response.status === 401 || response.status === 403) {
24643
+ const freshToken = await fetchCurrentPluginAuthToken(
24644
+ opts.sessionId,
24645
+ opts.pluginId,
24646
+ opts.pollSecret
24647
+ );
24648
+ if (freshToken !== null) {
24649
+ await fetchImpl(url, { method: "POST", headers: makeHeaders(freshToken), body });
24636
24650
  }
24637
- );
24651
+ }
24638
24652
  } catch {
24639
24653
  }
24640
24654
  }
@@ -29082,7 +29096,7 @@ function checkChokidar() {
29082
29096
  }
29083
29097
  async function doctor(args2 = []) {
29084
29098
  const json = args2.includes("--json");
29085
- const cliVersion = true ? "2.40.0" : "0.0.0-dev";
29099
+ const cliVersion = true ? "2.40.2" : "0.0.0-dev";
29086
29100
  const apiBase2 = resolveApiBaseUrl();
29087
29101
  const diagnosticId = (0, import_node_crypto8.randomUUID)();
29088
29102
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -29281,7 +29295,7 @@ async function completion(args2) {
29281
29295
  // src/commands/version.ts
29282
29296
  var import_picocolors14 = __toESM(require("picocolors"));
29283
29297
  function version2() {
29284
- const v = true ? "2.40.0" : "unknown";
29298
+ const v = true ? "2.40.2" : "unknown";
29285
29299
  console.log(`${import_picocolors14.default.bold("codeam-cli")} ${import_picocolors14.default.cyan(v)}`);
29286
29300
  }
29287
29301
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "2.40.0",
3
+ "version": "2.40.2",
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",