TUI: self-report lifecycle state to the herdr agent runtime - #456
Merged
Merged
Conversation
Inside a herdr pane (HERDR_ENV markers present) the TUI claims its pane label through the socket CLI: working while a turn runs, blocked while an approval or the plan hand-off waits on the human, idle otherwise, and a release-agent goodbye on every exit path, including quits that never unmount the React tree. Sequence numbers start from epoch seconds so a restart in the same pane outranks the previous run's reports, and the release carries the next number because herdr silently drops stale-sequenced releases (both verified against herdr 0.9.0). Outside herdr the reporter is null and everything stays inert.
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.
What
When the TUI runs inside a herdr pane it now claims its own pane label through herdr's socket CLI:
workingwhile a turn is in flight,blockedwhile a tool approval or the plan hand-off waits on the human (with the tool name as the message),idleotherwise, and arelease-agentgoodbye on every exit path. Outside herdr the reporter is null and nothing changes.Why
herdr (github.com/herdrdev/herdr, the "leave them running" agent runtime, 38k stars) labels every pane with the agent's live state. Atomic already runs fine in a pane, but shows up as an unnamed process. Self-reporting makes it a first-class agent there today, for every user, without waiting on the herdr team; it also backs our pending proposal to add built-in detection on their side (herdrdev/herdr#4201).
How
src/tui/herdr-reporter.ts: env detection (HERDR_ENV/HERDR_BIN_PATH/HERDR_PANE_ID), a purederiveHerdrReportover the TUI state, and a fire-and-forget reporter (spawn, stdio ignored, errors swallowed, children unref'd).tui-app.tsx(state observation plus unmount release) and intui-command.ts(reporter creation, plus a release in the teardownfinallyfor quit paths that never unmount the tree).Testing
src/tui/herdr-reporter.test.ts;npx vitest run src/tuigreen (302 files / 3331 tests; the one unhandled error is the pre-existing llama-server EACCES flake inlocal-models-orchestrator-auto-update.test.ts, unrelated).tsc --noEmitclean.atomic · idlewith no manual calls, a turn flips it toworking, a file-write approval flips it toblocked, approve returns it toidle, and double ctrl+c quit leaves the herdr agent list empty.