herdr-pi-live
Keep Herdr's pane status shown as working while pi background subagents or workflows are still running.
Package details
Install herdr-pi-live from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:herdr-pi-live- Package
herdr-pi-live- Version
0.1.3- Published
- Nov 30, 2026
- Downloads
- 667/mo · 667/wk
- Author
- ztq
- License
- MIT
- Types
- extension
- Size
- 10.5 KB
- Dependencies
- 0 dependencies · 0 peers
Pi manifest JSON
{
"extensions": [
"./herdr-live.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
herdr-pi-live
A small pi extension that keeps Herdr's pane
status at working while pi's background subagents (or workflows) are still
running, instead of flipping to idle as soon as the spawning turn settles.
The problem
Herdr recognizes pi through its own integration (herdr-agent-state.ts, Herdr
integration v9). That integration derives the pane status from the root pi
session only:
agent_start→workingagent_settled→idle
Background subagents started through @tintinweb/pi-subagents are separate
agent runs inside the same pi process. The spawning tool call returns
immediately, the turn settles, and the pane is reported as idle while those
agents keep working. Herdr's own agent guide documents the same limitation for
other agents: "can be idle while background tasks or subagents keep running,
so a settled-state wait is not proof those jobs have finished".
Consequences: a misleading sidebar/badge, herdr agent wait <pane-id> --until idle
returning early, completion notifications firing too soon, and a pane that looks
free while it is not.
What it does
It reports working while the root session, a background subagent, or a workflow
is active. When herdr:blocked signals an approval is pending, it reports
blocked with the approval label. It reports idle after all work settles.
Install
Requirements:
- Herdr 0.9.x with its pi integration installed (
herdr integration install pi) @tintinweb/pi-subagents(the source of thesubagents:*events)- a pi TUI session inside a Herdr pane (
HERDR_ENV=1); headless pi sessions never report, and neither does this extension.
From npm:
pi install npm:herdr-pi-live
From git:
pi install git:github.com/yukinight/herdr-pi-live
Manual — copy herdr-live.ts into pi's global extension directory and restart
pi (or /reload):
| Platform | Path |
|---|---|
| Windows | %USERPROFILE%\.pi\agent\extensions\herdr-live.ts |
| macOS / Linux | ~/.pi/agent/extensions/herdr-live.ts |
The file name does not matter to pi's extension discovery, but it must not
replace Herdr's own herdr-agent-state.ts — that one is rewritten by
herdr update and herdr integration install pi, so this extension lives
beside it.
How it works
- Two id sets: agents (
subagents:started/completed/failed) and workflows (subagents:workflow_started/workflow_settled). subagents:createdis deliberately ignored: it is re-announced for resumed or already finished agents, so counting it would leave ids that never complete.- Session and state reports use the same increasing sequence for
herdr:pi. Once the extension reports, its sequence supersedes the built-in integration and it continues reporting every state transition. - On session start, it sends the path or ID to Herdr before reporting state so
Herdr can associate updates with the right session after
/newor/resume. - After a pane has switched pi sessions (
/new,/resume), Herdr 0.9.5 stops orderingherdr:pireports byseq, so the built-in integration'sidleon turn settle can land after ours. When background work is still running, the extension reports again 2.5s after the turn settles.
Verify
# Herdr's live view of the pane's agent
herdr api snapshot
# Or block until the pane is really idle
herdr agent wait <pane-id> --until idle
Watch the pane while a background subagent is running: agent_status stays
working; after the last agent finishes, it returns to idle. The extension is
a no-op outside Herdr. Run npm test for the lifecycle regression tests.
Limitations
- Agents that started before this extension was loaded are unknown, so their completion events are ignored. Reload while no background agent is running.
- Agents held in pi-subagents' queue (
maxConcurrent) count once they start. The pane can briefly showidlebetween queued agents. - Fixing this properly belongs in Herdr's own pi integration; this extension is
a stop-gap that survives
herdr update.
Uninstall
pi remove npm:herdr-pi-live # or git:github.com/yukinight/herdr-pi-live
or delete herdr-live.ts from the extension directory and restart pi.
License
MIT