@coda-console/claude 1.7.0 → 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 +7 -4
- package/package.json +1 -1
package/agent/session.mjs
CHANGED
|
@@ -452,7 +452,8 @@ export class ClaudeSession {
|
|
|
452
452
|
this.update(this.sessionId, { sessionUpdate: 'config_option_update', configOptions: this.options() });
|
|
453
453
|
}
|
|
454
454
|
if (m.status === 'compacting' && !this.compaction?.active) this.compaction = { id: m.uuid ?? randomUUID(), active: true };
|
|
455
|
-
|
|
455
|
+
// Success is the boundary: the status can finish first, before the boundary carrying the same compaction arrives.
|
|
456
|
+
if (m.status === 'compacting' || m.subtype === 'compact_boundary' || (this.compaction?.active && m.compact_result === 'failed')) {
|
|
456
457
|
this.compaction ??= { id: m.uuid ?? randomUUID(), active: false };
|
|
457
458
|
this.compaction.active = m.status === 'compacting';
|
|
458
459
|
this.update(this.sessionId, { sessionUpdate: 'compaction_update', compactionId: this.compaction.id,
|
|
@@ -570,7 +571,7 @@ export class ClaudeSession {
|
|
|
570
571
|
}
|
|
571
572
|
}
|
|
572
573
|
result(m) {
|
|
573
|
-
const
|
|
574
|
+
const windows = Object.values(m.modelUsage ?? {});
|
|
574
575
|
const ids = takenIn(m);
|
|
575
576
|
// The compaction Coda asked for (compact) is the turn that names its input. Any other is the session's own, whose cache runs
|
|
576
577
|
// from its last request. Coda is told what is known of that cache (compaction.mjs).
|
|
@@ -580,8 +581,10 @@ export class ClaudeSession {
|
|
|
580
581
|
this.turnCompaction = {};
|
|
581
582
|
if (!compaction) { this.cacheUse.ended(); for (const output of turn.outputs ?? []) this.commandOutput(output); }
|
|
582
583
|
const told = this.cacheUse.told();
|
|
583
|
-
|
|
584
|
-
|
|
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' },
|
|
585
588
|
...(Object.keys(told).length ? { _meta: { coda: told } } : {}) });
|
|
586
589
|
this.turning = false;
|
|
587
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.
|
|
6
|
+
"version": "1.7.2",
|
|
7
7
|
"categories": ["Agent"],
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@agentclientprotocol/sdk": "1.4.0",
|