@coda-console/claude 1.7.1 → 1.7.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/agent/session.mjs CHANGED
@@ -571,7 +571,7 @@ export class ClaudeSession {
571
571
  }
572
572
  }
573
573
  result(m) {
574
- const usage = m.usage ?? {}, windows = Object.values(m.modelUsage ?? {});
574
+ const windows = Object.values(m.modelUsage ?? {});
575
575
  const ids = takenIn(m);
576
576
  // The compaction Coda asked for (compact) is the turn that names its input. Any other is the session's own, whose cache runs
577
577
  // from its last request. Coda is told what is known of that cache (compaction.mjs).
@@ -581,8 +581,10 @@ export class ClaudeSession {
581
581
  this.turnCompaction = {};
582
582
  if (!compaction) { this.cacheUse.ended(); for (const output of turn.outputs ?? []) this.commandOutput(output); }
583
583
  const told = this.cacheUse.told();
584
- this.update(this.sessionId, { sessionUpdate: 'usage_update', used: (usage.input_tokens ?? 0) + (usage.cache_read_input_tokens ?? 0) + (usage.cache_creation_input_tokens ?? 0),
585
- size: Math.max(0, ...windows.map(w => w.contextWindow ?? 0)), cost: { amount: m.total_cost_usd ?? 0, currency: 'USD' },
584
+ // The result's usage sums every request in the turn. The window holds only the last main-thread request, or what
585
+ // compaction left. With no measurement, report no usable window; lifecycle metadata is still told.
586
+ this.update(this.sessionId, { sessionUpdate: 'usage_update', used: this.cacheUse.context ?? 0,
587
+ size: this.cacheUse.context === null ? 0 : Math.max(0, ...windows.map(w => w.contextWindow ?? 0)), cost: { amount: m.total_cost_usd ?? 0, currency: 'USD' },
586
588
  ...(Object.keys(told).length ? { _meta: { coda: told } } : {}) });
587
589
  this.turning = false;
588
590
  // The compaction's: Coda is answered, and nothing is taken up.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "id": "claude",
4
4
  "displayName": "Claude",
5
5
  "description": "Claude SDK Agent:Coda 基于 Claude Agent SDK 写的 ACP 入口,一个进程一个 SDK 会话;资源页的「Claude」面板显示会话报告的额度,可从 Coda 登录。",
6
- "version": "1.7.1",
6
+ "version": "1.7.2",
7
7
  "categories": ["Agent"],
8
8
  "dependencies": {
9
9
  "@agentclientprotocol/sdk": "1.4.0",