@bumaociyuan/pi-herd-mirror-adapter
Mirror observation adapter that bridges upstream pi-subagents events to pi-herd without forking pi-subagents.
Package details
Install @bumaociyuan/pi-herd-mirror-adapter from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@bumaociyuan/pi-herd-mirror-adapter- Package
@bumaociyuan/pi-herd-mirror-adapter- Version
0.1.1- Published
- Aug 22, 2026
- Downloads
- 339/mo · 6/wk
- Author
- bumaociyuan
- License
- MIT
- Types
- extension
- Size
- 17.9 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./extensions/mirror-adapter.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@bumaociyuan/pi-herd-mirror-adapter
Bridge that connects upstream pi-subagents (v0.54+) events to @weshipwork/pi-herd mirror mode without forking pi-subagents.
Why
The original @weshipwork/pi-subagents fork adds a globalThis.__piSubagentsMirrorService observation seam by patching the subagent runner. That fork tracks an old upstream version (v0.12.0) and misses 40+ releases of features.
This adapter provides the same __piSubagentsMirrorService interface by consuming the upstream pi-subagents event bus — no fork needed. It works with any pi-subagents version that emits subagent:async-started, subagent:async-complete, and subagent:foreground-complete events.
Install
# Install all three: upstream subagents, mirror adapter, and herd viewer
pi install npm:pi-subagents
pi install npm:@bumaociyuan/pi-herd-mirror-adapter
pi install npm:@weshipwork/pi-herd
Or for one run:
pi -e npm:pi-subagents -e npm:@bumaociyuan/pi-herd-mirror-adapter -e npm:@weshipwork/pi-herd
How it works
┌─ pi-subagents (upstream, any version) ─┐
│ pi.events: │
│ subagent:async-started │
│ subagent:async-complete │
│ subagent:foreground-complete │
│ .pi/output/agent-*.jsonl │
└────────────┬───────────────────────────┘
│
┌─ pi-herd-mirror-adapter (this pkg) ────┐
│ globalThis.__piSubagentsMirrorService │
│ ├─ translates events → snapshots │
│ ├─ tail session files → text deltas │
│ └─ subscribeToMirrorEvents() │
└────────────┬───────────────────────────┘
│
┌─ pi-herd (unchanged) ──────────────────┐
│ PiSubagentsObservationSource │
│ → MirrorRuntime → Unix socket │
│ → pi-herd-viewer Herdr pane │
└────────────────────────────────────────┘
License
MIT — part of the threeonefour monorepo.