Agent-aware live session status in /resume - #202
Merged
Merged
Conversation
/resume LIVE rows and nmsh --list now say what each live session is doing, from evidence the service already sees rather than guesses. Per session the service records when output last arrived, the title the running program set (OSC 0/2), whether it asked for attention (an OSC 9 or OSC 777 notification, or a bell, while a command runs; cleared by typing or by the command ending) and the last exit code. The foreground process name is read from node-pty only when sessions are listed, so nothing polls. A pure liveStatusParts turns that into factual clauses: running command and elapsed time, a known CLI's display name or the foreground process, active or quiet output, needs attention, fullscreen, the program's title, and the last command's result while idle. Known CLIs (Claude Code, Codex, Aider, ...) only get a display name; every program gets the same states, and nothing claims what a program is thinking or waiting for. The new SessionInfo fields are optional, so older services still decode. Paths under the home directory show as ~/... in /resume rows, sharing the startup picker's helper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #174
Behavior
/resumeLIVE rows andnmsh --listshow evidence-based status for each live session:running <command> · <elapsed>, followed by:process <name>when the foreground process differs from the command (for examplenpm test→process node).activeif the session wrote within 10 s, otherwisequiet <age>. Nothing is shown when there's no output evidence.needs attention <age>: the running program itself asked for attention with a terminal notification (OSC 9 excluding9;4progress, OSC 777notify) or a bell. It clears when someone types into the session or the command ends.fullscreenwhile the program holds the alternate screen, and the program's own title (OSC 0/2, control characters removed, at most 80 characters stored and 40 shown).idle <age>pluslast command succeededorlast command failed (exit N).~/…in/resume, sharing the startup picker's helper, so the status fits.Detection and lifecycle
SessionEvidence, one per service session, observes the output stream it already receives: the last-output time, the title, attention (only while a command runs) and the last exit. It resets on exec and prompt, andinputclears attention. Split OSC sequences are handled, and a BEL ending an OSC isn't a bell.pty.process, read only when sessions are listed. There's no polling and no process-tree walk.SessionInfofields are optional, older services decode fine, and the rows just show less.False positives and unsupported agents
Tests
tests/liveStatus.test.ts:npm testwith a node process, quietmake, fullscreenvimwith a title, no evidence means no claim)./resumeand--listtext, and the protocol round trip, including an older service without the fields.claudesets a title and sends a notification, the status survives a detach, shows in another window's/resume, and reattaching and typing clears attention and records the exit./resume, startup restore/discovery, lifecycle and service tests pass./resumepanel rows and--list.git diff --checkare clean. The full suite passed 591/591 twice locally.Limitations
cd x && claude) the name comes from the first program word or the foreground process only.sh,node,python3).nmsh --listshows the status clauses in place of the previousrunning: <command>.