mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-07 06:52:28 +00:00
feat: add cache-aware token usage dashboard (#1338)
* feat: add cache-aware token usage dashboard Track normalized Claude, Codex, and ACP usage with incremental SQLite backfill. Exclude imported transcript history, rebuild usage after history rewrites, and expose an owner-only dashboard with cache-aware totals and breakdowns. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> * fix: preserve usage model and local dates via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> * fix: normalize cached usage and timezone buckets via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> --------- Co-authored-by: HAPI <noreply@hapi.run>
This commit is contained in:
+3
-3
@@ -326,7 +326,7 @@ async function publishPiTurnUsage(
|
||||
const usageMessage = convertPiTurnUsage(event, contextUsage);
|
||||
if (!usageMessage) return;
|
||||
|
||||
const converted = convertAgentMessage(usageMessage);
|
||||
const converted = convertAgentMessage(usageMessage, session.currentModel);
|
||||
if (converted) session.sendAgentMessage(converted);
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ export function wireTransportEvents(
|
||||
const accumulated = assistantMessageAccumulator.handleEvent(event);
|
||||
if (accumulated.length > 0) {
|
||||
for (const msg of accumulated) {
|
||||
const converted = convertAgentMessage(msg);
|
||||
const converted = convertAgentMessage(msg, session.currentModel);
|
||||
if (converted) session.sendAgentMessage(converted);
|
||||
}
|
||||
}
|
||||
@@ -371,7 +371,7 @@ export function wireTransportEvents(
|
||||
if (event.type !== 'message_start' && event.type !== 'message_update' && event.type !== 'message_end') {
|
||||
const messages = convertPiEvent(event);
|
||||
for (const msg of messages) {
|
||||
const converted = convertAgentMessage(msg);
|
||||
const converted = convertAgentMessage(msg, session.currentModel);
|
||||
if (converted) session.sendAgentMessage(converted);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user