SIGN IN SIGN UP

feat(usage): source tokens and cost from TokenUsage events exclusively

git-ai usage previously re-parsed raw transcript JSON embedded in
SessionEvents (per-message Claude usage, cumulative codex totals) and
priced it with a flat "rough display estimate". The v2 token-usage
dataset (TokenUsage events, id 9) already carries deduplicated
per-bucket token splits and authoritatively priced costs, so the usage
command now aggregates those instead: revisions of a bucket are folded
by keeping the highest emitted_seq per (session, model, speed,
bucket_ts), zeroed corrections drop out, and late re-emissions of
buckets older than the query window are excluded.

The legacy token-counting path (aggregate_session_tokens,
aggregate_codex_tokens, TokenAccum, CodexSessionAccum, estimate_cost,
cost_for_message_slice) is removed; SessionEvents still drive session
counts, tool breakdowns, yield stats, and session durations. The
models.dev cache refresh in the usage command stays: it is what keeps
the on-disk pricing cache fresh for the daemon-side pricer.

Token/cost figures now cover only data collected by the v2 pipeline
(on by default as of the previous commit).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
S
Sasha Varlamov committed
c555675e86b7f390baa9c56d3191d27974a875fe
Parent: 3444b05