feat(subagents): add herdr terminal multiplexer support#57
Open
0xRichardH wants to merge 1 commit into
Open
Conversation
Extract herdr into its own backend module (herdr.ts) and wire it into the mux dispatcher (cmux.ts). Herdr surfaces are created as new tabs with --no-focus so parallel subagent spawns get full tabs instead of ever-narrower splits, and focus stays on the parent pane. herdr.ts owns all herdr-specific CLI integration: - Runtime detection (HERDR_ENV + herdr in PATH) - Surface creation (tab create / pane split) - Command delivery (pane run — atomic text + Enter) - Screen reading (pane read --source visible) - Escape delivery, pane close, tab/workspace rename - Env-var-first current pane info with subprocess fallback cmux.ts adds herdr to MuxBackend, getMuxBackend(), muxSetupHint(), and dispatches to herdr.ts in createSurface, createSurfaceSplit, sendCommand, sendEscape, readScreen, readScreenAsync, closeSurface, renameCurrentTab, and renameWorkspace. Integration harness probes herdr and implements focus/focused-surface helpers. The focus-preservation test is skipped for herdr/wezterm because neither exposes absolute pane focusing via CLI. README documents herdr as a supported multiplexer. Tested: 133 unit tests pass, 8/8 herdr mux-surface integration tests pass in a live herdr session.
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
Adds herdr as a first-class mux backend alongside cmux/tmux/zellij/wezterm.
How
New file:
pi-extension/subagents/herdr.ts— all herdr-specific CLI integration, extracted into its own module per SRP.HERDR_ENV=1+herdrin PATH)herdr tab create --no-focus) so parallel spawns get full tabs instead of ever-narrower splitsherdr pane run(atomic text + Enter in one socket request)herdr pane read --source visible(reliable for freshly-created panes)HERDR_PANE_ID/HERDR_TAB_ID/HERDR_WORKSPACE_ID) with subprocess fallbackpi-extension/subagents/cmux.ts— adds"herdr"toMuxBackend,getMuxBackend(),muxSetupHint(), and dispatches toherdr.tsin all mux operations. No herdr logic leaks into the dispatcher.test/integration/harness.ts— probes herdr ingetAvailableBackends(), implementsfocusSurface/getFocusedSurface/getSurfacePanefor herdr.test/integration/mux-surface.test.ts— skips the focus-preservation test for herdr/wezterm (neither exposes absolute pane focusing via CLI).test/test.ts— herdr detection and JSON response parsing unit tests in a dedicateddescribe("herdr.ts")block.README.md— documents herdr as a supported multiplexer.Bug found and fixed during development
hasCommandinherdr.tsinitially usedexecFileSync("command", ["-v", ...])which fails becausecommandis a shell builtin, not a binary — Node'sexecFileSyncdoesn't invoke a shell. This silently broke herdr detection (returnedfalseeven inside a live herdr session). Fixed to useexecSync(\command -v ...`)(shell form) matchingcmux.ts`.Test results
Verified end-to-end in a live herdr 0.7.1 session: create → send → read → close, rename tab/workspace, escape delivery.