Add data layer support for real-time usage visualization: - MinuteStats type: holds token counts for 5-minute buckets, enabling granular recent-activity views (12 buckets covering the last hour). - AggregateTodayHourly(): computes 24 hourly token buckets for the current local day by filtering sessions to today's date boundary and slotting each into the correct hour index. Tracks prompts, sessions, and total tokens per hour. - AggregateLastHour(): computes 12 five-minute token buckets for the last 60 minutes using reverse-offset bucketing (bucket 11 = most recent 5 minutes, bucket 0 = 55-60 minutes ago). Bounds-clamped to prevent off-by-one at the edges. Both functions filter on StartTime locality and skip zero-time sessions, consistent with existing aggregation patterns in the pipeline package. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2.2 KiB
2.2 KiB