@srobroek/pi-herdr-core1.1.0
Opens pi-subagents inspectors in an hc side terminal under Herdr desktop, on this machine or a remote hc machine.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
herdr-core
The pi package @srobroek/pi-herdr-core adds an hc inspector to
pi-subagents. With it, the pi-subagents
inspector.open action works in Herdr desktop and other hc
(herdr-core) terminals. The built-in Herdr inspector of pi-subagents needs the Herdr TUI
(HERDR_ENV and HERDR_PANE_ID), and hc terminals set HC_TERMINAL_ID instead.
Install
pi install npm:@srobroek/pi-herdr-core
The package needs pi-subagents 0.72.0 or later, Node.js, and hc on PATH. It has no
settings.
How it works
- At each session start, the extension registers an inspector named
hcthrough thepi-subagents:inspector-register:v1event. - pi-subagents tries its built-in Herdr, Ghostty and tmux inspectors first. It uses
hcwhen none of them applies andHC_TERMINAL_IDis not blank. - In a pi-subagents child (
PI_SUBAGENT_CHILD=1), the extension registers nothing. A child inheritsHC_TERMINAL_IDbut does not own that terminal. - The first
inspector.openstarts a side terminal withhc run --bg. There is one side terminal for each parent hc terminal. Its name ispi-inspect-followed by the parent's terminal ID, in lowercase. - When the parent has both the
herdr.spaceandherdr.tablabels, the side terminal gets them too. Herdr desktop then shows it as a pane in the parent's tab. Otherwise it is a child terminal of the parent. Usehc attach <side terminal>to show it. - The side terminal runs a Node.js loop that starts the pi-subagents inspector runner
for the target in
~/.local/state/pi-herdr-core/inspect-<side terminal>.json($XDG_STATE_HOME/pi-herdr-corewhenXDG_STATE_HOMEis set). - While the side terminal is live, another
inspector.openrewrites that file, for any run or child. The loop then stops the current runner and starts the new one in the same pane. inspector.statusreports whether the side terminal is live and which run its target file names.inspector.closecloses the side terminal only when its target file still names that run. It sends no stop request to the subagent. Ctrl+C in the pane also closes it.- The steer and stop controls in the pane follow the pi-subagents authority policy.
Remote machines
hc runs each command on the core of the machine it runs on. A pi session on a remote hc
machine (hc machine add) therefore opens its side terminal on that machine, with the
remote parent's labels. Herdr desktop then shows it next to the parent. The remote
machine needs hc, Node.js and pi-subagents. The extension calls only hc.
Limits
- hc cannot focus a pane, so
focus: trueleaves focus where it is. Click the pane to type in it. - To watch two runs side by side, run
inspector.commandand start the printed command in another terminal.