mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-08 07:17:39 +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:
@@ -681,6 +681,7 @@ class CodexRemoteLauncher extends RemoteLauncherBase {
|
||||
let scheduleReadyAfterTurn: (() => void) | null = null;
|
||||
let clearReadyAfterTurnTimer: (() => void) | null = null;
|
||||
let turnInFlight = false;
|
||||
let usageModel: string | null = null;
|
||||
let allowAnonymousTerminalEvent = false;
|
||||
let invalidThreadId: string | null = null;
|
||||
let childAgentActivityInCurrentTurn = false;
|
||||
@@ -2874,6 +2875,7 @@ class CodexRemoteLauncher extends RemoteLauncherBase {
|
||||
const threadId = eventThreadId ?? this.currentThreadId;
|
||||
session.sendAgentMessage({
|
||||
...addCodexEventScope(msg, 'parent', threadId),
|
||||
model: asString(msg.model) ?? usageModel,
|
||||
id: randomUUID()
|
||||
});
|
||||
}
|
||||
@@ -3784,6 +3786,9 @@ class CodexRemoteLauncher extends RemoteLauncherBase {
|
||||
...message.mode,
|
||||
model: session.getModel() ?? message.mode.model
|
||||
};
|
||||
usageModel = typeof mode.model === 'string' && mode.model.trim()
|
||||
? mode.model.trim()
|
||||
: null;
|
||||
const shouldSendCollaborationMode = supportsTurnCollaborationMode
|
||||
&& Boolean(mode.collaborationMode);
|
||||
const clientUserMessageId = message.items
|
||||
|
||||
Reference in New Issue
Block a user