Expand description
JSONL transcript aggregator — terminal fallback for the rate-limit data pipeline.
Canonical spec: docs/specs/jsonl-aggregation.md. Ports the
billing-block math from ryoppippi/ccusage’s
_session-blocks.ts (MIT). Produces raw token counts and block
boundaries only; mapping to UsageBucket
without tier detection is the orchestrator’s problem.
v0.1 exposes only the currently-active 5h block. Historical
blocks are deferred per spec §Open questions — extending
JsonlAggregate with completed_blocks is a non-breaking change
under #[non_exhaustive].
Structs§
- Five
Hour Block - Active 5-hour billing block.
startis the UTC-floor-to-hour of the block’s first entry;actual_last_activitylets the caller distinguish a block where the user stopped typing 10 seconds ago from one where they stopped 4 hours ago. The block’s end time is a derivation fromstart— seeSelf::end. - Jsonl
Aggregate - Output of the aggregator.
five_hourisNonewhen no entry falls within the last [BLOCK_DURATION_HOURS] hours;seven_dayis always present (zero-valued on an empty transcript). - Seven
DayWindow - Rolling 7-day window.
window_startisnow - 7dat the time the aggregator ran. - Token
Counts - Per-category token counts aggregated from the transcript.
Enums§
Functions§
- aggregate_
jsonl - Discover project roots, scan every
*.jsonlunder them, dedupe, aggregate. Memoization is the caller’s responsibility; each call re-scans from offset zero.