@chatpanel/bridge 0.10.19 → 0.10.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/bridge",
3
- "version": "0.10.19",
3
+ "version": "0.10.20",
4
4
  "type": "module",
5
5
  "description": "Local bridge that exposes the AI coding agents installed on your machine — Claude Code (CLI), Codex (CLI), and Antigravity CLI (formerly Gemini CLI, which remains available for business/enterprise) — to the ChatPanel Chrome extension over a localhost SSE endpoint. Bring your own agent.",
6
6
  "keywords": [
@@ -185,6 +185,21 @@ export function handleMessage(msg, emit, alreadyStreamed) {
185
185
  } else if (msg.type === 'result') {
186
186
  if (msg.subtype === 'success') out.result = msg.result || '';
187
187
  else emit({ type: 'status', text: `(${msg.subtype})` });
188
+ // Forward token usage so the client can account for CLI-agent turns. The
189
+ // result message carries cumulative usage (+ a real subscription cost).
190
+ // Additive event — older clients ignore an unknown SSE type.
191
+ const u = msg.usage || msg.message?.usage;
192
+ if (u) {
193
+ emit({
194
+ type: 'usage',
195
+ provider: 'bridge',
196
+ inputTokens: u.input_tokens || 0,
197
+ outputTokens: u.output_tokens || 0,
198
+ cacheReadTokens: u.cache_read_input_tokens || 0,
199
+ cacheWriteTokens: u.cache_creation_input_tokens || 0,
200
+ costUsd: msg.total_cost_usd != null ? msg.total_cost_usd : null,
201
+ });
202
+ }
188
203
  }
189
204
  return out;
190
205
  }
package/src/server.js CHANGED
@@ -37,7 +37,7 @@ import { assertPublicHttpUrl } from './ssrf.js';
37
37
  // Hardcoded (not read from package.json) so it survives Bun's single-file
38
38
  // --compile, where package.json isn't on a readable FS. CI fails the publish if
39
39
  // this drifts from package.json, so the two can't silently diverge.
40
- const VERSION = '0.10.19';
40
+ const VERSION = '0.10.20';
41
41
  const HOST = process.env.CHATPANEL_BRIDGE_HOST || '127.0.0.1';
42
42
  const PORT = Number(process.env.CHATPANEL_BRIDGE_PORT) || 4319;
43
43