mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-05 23:19:43 +02:00
feat: add token usage statistics with daily tracking and stats modal
- Add TokenUsageEntry and TokenStats types for daily tracking - Add state-store methods for recording and retrieving daily usage - Add /api/token-stats endpoint with daily breakdown and totals - Add token stats modal with summary cards, 7-day bar chart, and table - Record tokens periodically (5min) and on session delete - Make header tokens clickable to open stats modal - Fix subagents panel toggle icon direction (down when open) - Increase subagents panel height when expanded Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -109,6 +109,34 @@ export interface GlobalStats {
|
||||
lastUpdatedAt: number;
|
||||
}
|
||||
|
||||
// ========== Token Usage History Types ==========
|
||||
|
||||
/**
|
||||
* Daily token usage entry for historical tracking.
|
||||
*/
|
||||
export interface TokenUsageEntry {
|
||||
/** Date in YYYY-MM-DD format */
|
||||
date: string;
|
||||
/** Input tokens used on this day */
|
||||
inputTokens: number;
|
||||
/** Output tokens used on this day */
|
||||
outputTokens: number;
|
||||
/** Estimated cost in USD */
|
||||
estimatedCost: number;
|
||||
/** Number of sessions that contributed to this day's usage */
|
||||
sessions: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Token usage statistics with daily tracking.
|
||||
*/
|
||||
export interface TokenStats {
|
||||
/** Daily usage entries (most recent first) */
|
||||
daily: TokenUsageEntry[];
|
||||
/** Timestamp of last update */
|
||||
lastUpdated: number;
|
||||
}
|
||||
|
||||
// ========== Task Types ==========
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user