fix: restore Anthropic token accounting

This commit is contained in:
Peter Steinberger
2026-01-06 18:51:45 +00:00
parent 672762bdd0
commit 2f24ea492b
8 changed files with 115 additions and 25 deletions

View File

@@ -17,6 +17,7 @@ import {
import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
import { buildWorkspaceSkillSnapshot } from "../agents/skills.js";
import { resolveAgentTimeoutMs } from "../agents/timeout.js";
import { hasNonzeroUsage } from "../agents/usage.js";
import {
DEFAULT_AGENT_WORKSPACE_DIR,
ensureAgentWorkspace,
@@ -482,7 +483,7 @@ export async function agentCommand(
contextTokens,
};
next.abortedLastRun = result.meta.aborted ?? false;
if (usage) {
if (hasNonzeroUsage(usage)) {
const input = usage.input ?? 0;
const output = usage.output ?? 0;
const promptTokens =