Expand description
Session metadata tracking for agent panes (Phase 1.4 — ultra-long-sessions).
Tracks per-session stats as block metadata keys:
session:start_ts_ms — Unix ms when the first output line arrived
session:last_activity_ms — Unix ms of most recent output line
session:line_count — total output lines emitted this session
session:token_estimate — rough token count (chars / 4, cumulative)
To avoid a SetMeta write on every output line (which can be very frequent),
this module debounces flushes to at most once per second using a local
Instant-based timestamp. Accumulators live in SessionStatsAccumulator
which each controller instance owns privately.
Structs§
- Session
Stats Accumulator - In-memory accumulator for session stats. One per controller instance.
Constants§
- FLUSH_
DEBOUNCE 🔒 - Debounce interval: at most one WaveStore write per second.
- META_
SESSION_ LAST_ ACTIVITY_ MS - META_
SESSION_ LINE_ COUNT - META_
SESSION_ START_ TS_ MS - Keys used for session stats in block metadata.
- META_
SESSION_ TOKEN_ ESTIMATE
Functions§
- now_ms 🔒
- Returns the current Unix timestamp in milliseconds.