codeam-cli 2.39.49 → 2.39.51

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.50] — 2026-06-19
8
+
9
+ ### Fixed
10
+
11
+ - **cli:** Parse real headroom /stats shape so savings reach the dashboard
12
+
13
+ ## [2.39.49] — 2026-06-19
14
+
15
+ ### Fixed
16
+
17
+ - **cli:** Load codespace-env.json + start savings reporter on serving daemon
18
+
7
19
  ## [2.39.48] — 2026-06-19
8
20
 
9
21
  ### Fixed
package/dist/index.js CHANGED
@@ -5388,7 +5388,7 @@ function readAnonId() {
5388
5388
  }
5389
5389
  function superProperties() {
5390
5390
  return {
5391
- cliVersion: true ? "2.39.49" : "0.0.0-dev",
5391
+ cliVersion: true ? "2.39.51" : "0.0.0-dev",
5392
5392
  nodeVersion: process.version,
5393
5393
  platform: process.platform,
5394
5394
  arch: process.arch,
@@ -5547,7 +5547,7 @@ var os4 = __toESM(require("os"));
5547
5547
  // package.json
5548
5548
  var package_default = {
5549
5549
  name: "codeam-cli",
5550
- version: "2.39.49",
5550
+ version: "2.39.51",
5551
5551
  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
5552
  type: "commonjs",
5553
5553
  main: "dist/index.js",
@@ -16073,6 +16073,22 @@ var previewStartH = (ctx, _cmd, parsed) => {
16073
16073
  });
16074
16074
  };
16075
16075
  void (async () => {
16076
+ const existing = activePreviews.get(ctx.sessionId);
16077
+ if (existing && existing.devServer.exitCode === null) {
16078
+ log.info(
16079
+ "preview",
16080
+ `reusing running preview for session=${ctx.sessionId} url=${existing.url}`
16081
+ );
16082
+ emitProgress("READY_DETECTED", "reusing running preview");
16083
+ void postPreviewEvent({
16084
+ sessionId: ctx.sessionId,
16085
+ pluginId: ctx.pluginId,
16086
+ pluginAuthToken,
16087
+ type: "preview_ready",
16088
+ payload: { url: existing.url, framework: existing.framework, port: detection.port }
16089
+ });
16090
+ return;
16091
+ }
16076
16092
  void postPreviewEvent({
16077
16093
  sessionId: ctx.sessionId,
16078
16094
  pluginId: ctx.pluginId,
@@ -16193,6 +16209,22 @@ var previewStartH = (ctx, _cmd, parsed) => {
16193
16209
  }
16194
16210
  }
16195
16211
  if (await isPortListening(detection.port)) {
16212
+ const raceExisting = activePreviews.get(ctx.sessionId);
16213
+ if (raceExisting && raceExisting.devServer.exitCode === null) {
16214
+ log.info(
16215
+ "preview",
16216
+ `port race: reusing running preview for session=${ctx.sessionId} url=${raceExisting.url}`
16217
+ );
16218
+ emitProgress("READY_DETECTED", "reusing running preview");
16219
+ void postPreviewEvent({
16220
+ sessionId: ctx.sessionId,
16221
+ pluginId: ctx.pluginId,
16222
+ pluginAuthToken,
16223
+ type: "preview_ready",
16224
+ payload: { url: raceExisting.url, framework: raceExisting.framework, port: detection.port }
16225
+ });
16226
+ return;
16227
+ }
16196
16228
  void postPreviewEvent({
16197
16229
  sessionId: ctx.sessionId,
16198
16230
  pluginId: ctx.pluginId,
@@ -17118,12 +17150,15 @@ function provisionAgentCredentials(publicAgentId, auth, homeDir2 = os30.homedir(
17118
17150
  // src/services/headroom/stats-reporter.ts
17119
17151
  var ZERO = { rawTokensEst: 0, sentTokensEst: 0, cachedTokens: 0, retrieveHops: 0 };
17120
17152
  function read(stats) {
17121
- const p2 = stats.persistent_savings ?? {};
17153
+ const totals = stats.agent_usage?.totals;
17154
+ const compression = stats.summary?.compression;
17155
+ const rawTokensEst = totals?.before_tokens ?? compression?.total_tokens_before_with_cli_filtering ?? 0;
17156
+ const sentTokensEst = totals?.after_tokens ?? rawTokensEst - (compression?.total_tokens_removed ?? 0);
17122
17157
  return {
17123
- rawTokensEst: p2.tokens_before ?? p2.input_tokens ?? p2.tokensBefore ?? 0,
17124
- sentTokensEst: p2.tokens_after ?? p2.output_tokens ?? p2.tokensAfter ?? 0,
17125
- cachedTokens: p2.cached_tokens ?? p2.cache_read_input_tokens ?? p2.cachedTokens ?? 0,
17126
- retrieveHops: p2.retrieve_hops ?? p2.retrieveHops ?? 0
17158
+ rawTokensEst,
17159
+ sentTokensEst,
17160
+ cachedTokens: 0,
17161
+ retrieveHops: stats.summary?.mcp?.retrievals ?? 0
17127
17162
  };
17128
17163
  }
17129
17164
  function mapStatsToSavings(stats, prev) {
@@ -27564,7 +27599,7 @@ function checkChokidar() {
27564
27599
  }
27565
27600
  async function doctor(args2 = []) {
27566
27601
  const json = args2.includes("--json");
27567
- const cliVersion = true ? "2.39.49" : "0.0.0-dev";
27602
+ const cliVersion = true ? "2.39.51" : "0.0.0-dev";
27568
27603
  const apiBase2 = resolveApiBaseUrl();
27569
27604
  const diagnosticId = (0, import_node_crypto8.randomUUID)();
27570
27605
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -27763,7 +27798,7 @@ async function completion(args2) {
27763
27798
  // src/commands/version.ts
27764
27799
  var import_picocolors13 = __toESM(require("picocolors"));
27765
27800
  function version2() {
27766
- const v = true ? "2.39.49" : "unknown";
27801
+ const v = true ? "2.39.51" : "unknown";
27767
27802
  console.log(`${import_picocolors13.default.bold("codeam-cli")} ${import_picocolors13.default.cyan(v)}`);
27768
27803
  }
27769
27804
 
@@ -28049,7 +28084,7 @@ function checkForUpdates() {
28049
28084
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
28050
28085
  if (process.env.CI) return;
28051
28086
  if (!process.stdout.isTTY) return;
28052
- const current = true ? "2.39.49" : null;
28087
+ const current = true ? "2.39.51" : null;
28053
28088
  if (!current) return;
28054
28089
  const cache = readCache();
28055
28090
  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.39.49",
3
+ "version": "2.39.51",
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",