fix(tui): track active processing time for time_spent status segment

The time_spent segment rendered Date.now() - sessionStartTime, so an
idle session displayed hours of "time spent" while the agent did
nothing — the only inputs were wall-clock and the unmoving session
start.

Replace sessionStartTime with activeMs in SegmentContext and accumulate
inside StatusLineComponent across agent_start -> agent_end windows.
markActivityStart/markActivityEnd are idempotent (reentrant agent_start
events and superseded agent_end events never double-count); the segment
ticks live during an open window and freezes when the agent yields.
The session-boundary hook drops the now-meaningless wall-clock argument
and is renamed setSessionStartTime -> resetActiveTime; it zeroes the
accumulator and drops any in-flight window so /clear / fresh-session /
joined-collab paths start the meter at zero.

Fixes #3681
This commit is contained in:
roboomp
2026-06-27 20:50:19 +00:00
parent 2708c1edb8
commit 68db2ce649
16 changed files with 312 additions and 20 deletions
@@ -46,7 +46,7 @@ function createPathContext(): SegmentContext {
contextWindow: 0,
autoCompactEnabled: false,
subagentCount: 0,
sessionStartTime: Date.now(),
activeMs: 0,
activeRepo: null,
git: {
branch: null,