fix: read token usage from ACP response instead of DB
CI / check (pull_request) Successful in 3m10s

Tokens (inputTokens, outputTokens) now come from ACP PromptResponse.usage
which is populated synchronously from run_conversation() — no WAL race.
Turns still come from DB before/after snapshot.

Previously both were read from hermes state.db after ACP prompt returned,
but WAL write lag caused incomplete token data (e.g. 235 vs actual 26,080).

Refs #91
This commit is contained in:
2026-06-05 06:07:39 +00:00
parent 8764d7bda3
commit 8085d1d6e0
5 changed files with 125 additions and 70 deletions
+3 -2
View File
@@ -1,7 +1,8 @@
export type { AcpUsage } from "./acp-client.js";
export { HermesAcpClient } from "./acp-client.js";
export {
buildHermesPrompt,
computeUsageDelta,
buildUsage,
createHermesAgent,
snapshotUsage,
snapshotTurns,
} from "./hermes.js";