You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
claudbg/.beans/claudbg-d3aj--session-stati...

15 lines
912 B
Markdown

---
# claudbg-d3aj
title: Session statistics computation
status: completed
type: task
priority: normal
created_at: 2026-03-27T19:39:15Z
updated_at: 2026-03-28T17:31:49Z
parent: claudbg-mztt
---
Given a parsed list of SessionEntries, compute: total input/output/cache tokens (sum across all assistant message usage fields), tool call counts keyed by tool name, session duration (sum of durationMs from system messages with subtype=turn_duration), model (from first assistant message). Return a SessionStats struct.
## Summary of Changes\n\nCreated src/models/stats.rs with SessionStats struct (token counts, tool_calls HashMap, duration_ms, model, message counts) and compute_stats(entries: &[RawEntry]) -> SessionStats. Accumulates usage from assistant messages, counts tool_use blocks by name, sums duration_ms from system entries, captures model from first assistant message. All 4 required unit tests pass.