Expand description
The session’s runtime counters (ultron/session-stats.ts): what the runtime sees while a session runs and no
other session value keeps, for the session report (/usage, ultron usage). They are the session value
ultron.module/stats, written as the TypeScript recorder writes it, so either implementation reads the other’s.
Cells are counted where they run (every lane’s rlm tool), host requests where the kernels make them, guard
outcomes as the file hooks record them, steers as they are queued for the root, refused work as the usage ledger
refuses it, merges and subagent models as the delegation host settles them. Nothing here holds code, output,
paths or prompts: only counts, API names, task ids and times.
Recording never fails and never blocks on the store: changes are counted in memory and saved
flush_ms (500 ms) after the first unsaved one, and on SessionStats::flush. A store that cannot be written
keeps the counters in memory and the next change tries again; a stored document in a format this build does not
know is left as it is.
Structs§
- Guard
Outcome - One guard outcome (
GuardRecord, the fields counted here). - Session
Stats SessionStatsRecorder: counts in memory and saves the document shortly after a change.- Session
Store - The session value
ultron.module/statsof a session journal (createSessionModuleStore(session, "stats")).
Enums§
- Stored
- What the store holds, read as
readVersionedreads it.
Constants§
- DEFAULT_
FLUSH - How long after the first unsaved change the counters are saved.
Traits§
- Stats
Store - Where the counters are kept (
HostModuleStore).
Functions§
- empty_
session_ stats emptySessionStats(root, now).- parse_
session_ stats parseSessionStats: a stored document with every field present, or None whensavedis not one (not an object, or another version). Unknown fields are dropped and malformed counters read as zero.- read_
stored parseSessionStats(readVersioned("ultron.module/stats", saved)).
Type Aliases§
- Clock
- Milliseconds since the epoch (tests: a fake clock).