codeam-cli 2.39.85 → 2.39.87

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,22 @@ 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.86] — 2026-06-23
8
+
9
+ ### Fixed
10
+
11
+ - **cli:** Report credential-invalid on mid-turn auth 401, not just adapter exit
12
+
13
+ ### Tests
14
+
15
+ - **cli:** Reproduce-first guard for self-hosted house-agent 401
16
+
17
+ ## [2.39.85] — 2026-06-23
18
+
19
+ ### Fixed
20
+
21
+ - **cli:** Isolate house agent's Claude config on self-hosted boxes
22
+
7
23
  ## [2.39.84] — 2026-06-22
8
24
 
9
25
  ### 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.39.85" : "0.0.0-dev",
5393
+ cliVersion: true ? "2.39.87" : "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.39.85",
5552
+ version: "2.39.87",
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",
@@ -11230,6 +11230,37 @@ function claudeCredentialLocator() {
11230
11230
  validate: validateClaudeToken
11231
11231
  };
11232
11232
  }
11233
+ var SETUP_TOKEN_RE = /sk-ant-oat01-[A-Za-z0-9_-]+/;
11234
+ function extractSetupTokenFromOutput(output) {
11235
+ const m = output.match(SETUP_TOKEN_RE);
11236
+ return m ? m[0] : null;
11237
+ }
11238
+ function captureClaudeSetupToken() {
11239
+ return new Promise((resolve7, reject) => {
11240
+ const child = (0, import_node_child_process2.spawn)("claude", ["setup-token"], {
11241
+ stdio: ["inherit", "pipe", "inherit"]
11242
+ });
11243
+ let out2 = "";
11244
+ child.stdout?.on("data", (chunk) => {
11245
+ const s = chunk.toString("utf8");
11246
+ out2 += s;
11247
+ process.stdout.write(s);
11248
+ });
11249
+ child.on("error", (err) => reject(err));
11250
+ child.on("exit", (code) => {
11251
+ const token = extractSetupTokenFromOutput(out2);
11252
+ if (token) {
11253
+ resolve7({ method: "setup_token", credential: token, source: "setup-token" });
11254
+ return;
11255
+ }
11256
+ reject(
11257
+ new Error(
11258
+ `\`claude setup-token\` exited (code=${code ?? "null"}) without producing a token. Complete the browser authorization and paste the code when prompted, then re-run.`
11259
+ )
11260
+ );
11261
+ });
11262
+ });
11263
+ }
11233
11264
  function claudeLoginLauncher() {
11234
11265
  return {
11235
11266
  ensureInstalled: ensureClaudeInstalled,
@@ -11237,7 +11268,11 @@ function claudeLoginLauncher() {
11237
11268
  const child = (0, import_node_child_process2.spawn)("claude", [], { stdio: ["pipe", "inherit", "inherit"] });
11238
11269
  child.stdin?.write("/login\n");
11239
11270
  return child;
11240
- }
11271
+ },
11272
+ // Preferred path for Claude: a dedicated non-rotating setup-token,
11273
+ // so the codespace credential never shares a refresh chain with the
11274
+ // user's laptop session.
11275
+ captureSetupToken: captureClaudeSetupToken
11241
11276
  };
11242
11277
  }
11243
11278
 
@@ -13448,6 +13483,16 @@ async function link(args2 = []) {
13448
13483
  process.exit(1);
13449
13484
  }
13450
13485
  installSpin.stop(`${ctx.displayName} is installed`);
13486
+ if (ctx.launcher.captureSetupToken && !parsed.reuseExisting) {
13487
+ showInfo(
13488
+ `Creating a dedicated ${ctx.displayName} token for your codespaces \u2014 complete the sign-in in your browser and paste the code when prompted.`
13489
+ );
13490
+ console.log("");
13491
+ const setupToken = await ctx.launcher.captureSetupToken();
13492
+ console.log("");
13493
+ await uploadAndSucceed(ctx, paired, pluginId, pluginAuthToken, setupToken);
13494
+ return;
13495
+ }
13451
13496
  const existing = await ctx.locator.extract();
13452
13497
  if (existing) {
13453
13498
  if (await refuseIfStale(ctx, paired, pluginId, pluginAuthToken, existing)) return;
@@ -17704,7 +17749,7 @@ async function autoUpgradeBeforeCriticalCommand() {
17704
17749
  if (process.env.NODE_ENV === "test") return;
17705
17750
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
17706
17751
  if (process.env.CI) return;
17707
- const current = true ? "2.39.85" : null;
17752
+ const current = true ? "2.39.87" : null;
17708
17753
  if (!current) return;
17709
17754
  const cache = readCache();
17710
17755
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -17721,7 +17766,7 @@ function checkForUpdates() {
17721
17766
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
17722
17767
  if (process.env.CI) return;
17723
17768
  if (!process.stdout.isTTY) return;
17724
- const current = true ? "2.39.85" : null;
17769
+ const current = true ? "2.39.87" : null;
17725
17770
  if (!current) return;
17726
17771
  const cache = readCache();
17727
17772
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -18159,7 +18204,7 @@ var defaultSpawner = (env, cwd, args2 = []) => (0, import_node_child_process14.s
18159
18204
  detached: false
18160
18205
  });
18161
18206
  function currentCliVersion() {
18162
- return true ? "2.39.85" : null;
18207
+ return true ? "2.39.87" : null;
18163
18208
  }
18164
18209
  function runCmd(cmd, args2, timeoutMs) {
18165
18210
  return new Promise((resolve7) => {
@@ -24531,6 +24576,22 @@ function failureBubble(opts) {
24531
24576
  if (!opts.hadText) return TURN_FAILURE_MESSAGE;
24532
24577
  return null;
24533
24578
  }
24579
+ async function reportCredentialInvalid(opts, fetchImpl = fetch) {
24580
+ try {
24581
+ await fetchImpl(
24582
+ `${resolveApiBaseUrl()}/api/plugin/agents/${encodeURIComponent(opts.agent)}/credential-invalid`,
24583
+ {
24584
+ method: "POST",
24585
+ headers: {
24586
+ "Content-Type": "application/json",
24587
+ "X-Plugin-Auth-Token": opts.pluginAuthToken
24588
+ },
24589
+ body: JSON.stringify({ sessionId: opts.sessionId, pluginId: opts.pluginId })
24590
+ }
24591
+ );
24592
+ } catch {
24593
+ }
24594
+ }
24534
24595
  async function handleGetConversation(args2) {
24535
24596
  const { relay, commandId, jsonlHistory, acpSessionId } = args2;
24536
24597
  try {
@@ -24619,17 +24680,7 @@ async function runAcpSession(opts) {
24619
24680
  log.warn("acpRunner", `adapter died code=${code} signal=${signal}; shutting down session`);
24620
24681
  const authFail = looksLikeAuthFailure(recentStderr.join("\n"));
24621
24682
  if (authFail) {
24622
- void fetch(
24623
- `${resolveApiBaseUrl()}/api/plugin/agents/${encodeURIComponent(opts.agent)}/credential-invalid`,
24624
- {
24625
- method: "POST",
24626
- headers: {
24627
- "Content-Type": "application/json",
24628
- "X-Plugin-Auth-Token": opts.pluginAuthToken
24629
- },
24630
- body: JSON.stringify({ sessionId: opts.sessionId, pluginId: opts.pluginId })
24631
- }
24632
- ).catch(() => void 0);
24683
+ void reportCredentialInvalid(opts);
24633
24684
  }
24634
24685
  void streaming.closeAll().then(
24635
24686
  () => publisher.publishOutput({
@@ -24822,6 +24873,9 @@ async function handleCommand(cmd, client2, relay, acpSessionId, models, streamin
24822
24873
  history.appendAgentReply(bubble);
24823
24874
  void history.flush();
24824
24875
  }
24876
+ if (bubble === AUTH_FAILURE_MESSAGE) {
24877
+ void reportCredentialInvalid(opts);
24878
+ }
24825
24879
  await relay.sendResult(cmd.id, "failed", { error: detail });
24826
24880
  }
24827
24881
  return;
@@ -28970,7 +29024,7 @@ function checkChokidar() {
28970
29024
  }
28971
29025
  async function doctor(args2 = []) {
28972
29026
  const json = args2.includes("--json");
28973
- const cliVersion = true ? "2.39.85" : "0.0.0-dev";
29027
+ const cliVersion = true ? "2.39.87" : "0.0.0-dev";
28974
29028
  const apiBase2 = resolveApiBaseUrl();
28975
29029
  const diagnosticId = (0, import_node_crypto8.randomUUID)();
28976
29030
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -29169,7 +29223,7 @@ async function completion(args2) {
29169
29223
  // src/commands/version.ts
29170
29224
  var import_picocolors14 = __toESM(require("picocolors"));
29171
29225
  function version2() {
29172
- const v = true ? "2.39.85" : "unknown";
29226
+ const v = true ? "2.39.87" : "unknown";
29173
29227
  console.log(`${import_picocolors14.default.bold("codeam-cli")} ${import_picocolors14.default.cyan(v)}`);
29174
29228
  }
29175
29229
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "2.39.85",
3
+ "version": "2.39.87",
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",