@chatpanel/bridge 0.10.18 → 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.18",
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
  }
@@ -301,6 +316,9 @@ function toolSummary(block) {
301
316
  if (i.file_path) return path.basename(i.file_path);
302
317
  if (i.pattern) return i.pattern;
303
318
  if (i.url) return i.url;
319
+ if (i.description) return String(i.description).slice(0, 80); // Task (subagent) — what it's for
320
+ if (i.query) return String(i.query).slice(0, 80); // WebSearch / search tools
321
+ if (i.prompt) return String(i.prompt).slice(0, 80); // subagent prompt fallback
304
322
  return '';
305
323
  }
306
324
 
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.18';
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