feat(worker): add TranscriptUsageReader for per-model token usage
Aggregates ~/.claude/projects/**/*.jsonl assistant messages by date/model/ scope (ClaudeDo worktree-or-sandbox cwd vs Other), deduped by requestId (falls back to message.id), with a per-file length+mtime cache so repeat calls skip unchanged files.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
namespace ClaudeDo.Worker.Usage;
|
||||
|
||||
public enum UsageScope
|
||||
{
|
||||
ClaudeDo,
|
||||
Other,
|
||||
}
|
||||
|
||||
public sealed record UsageAggregateRow(
|
||||
DateOnly Date,
|
||||
string Model,
|
||||
UsageScope Scope,
|
||||
long InputTokens,
|
||||
long OutputTokens,
|
||||
long CacheReadTokens,
|
||||
long CacheCreationTokens,
|
||||
int Messages);
|
||||
Reference in New Issue
Block a user