@henryqw/pi-herdr

Shared client for interacting with Herdr from Node.js tools and Pi packages.

Packages

Package details

package

Install @henryqw/pi-herdr from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@henryqw/pi-herdr
Package
@henryqw/pi-herdr
Version
0.4.7
Published
Sep 7, 2026
Downloads
4,674/mo · 558/wk
Author
henrywang
License
MIT
Types
package
Size
9.6 KB
Dependencies
1 dependency · 0 peers

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@henryqw/pi-herdr

Call the Herdr CLI from Node through one thin client. Extension authors share process handling without copying Herdr's command catalog. Pi users normally install a Herdr companion extension instead.

Install

npm install @henryqw/pi-herdr

Install the Herdr CLI and make herdr available on the calling process's PATH. Run herdr --version to verify it.

Use

Create a client and run a command. The client returns the parsed response.

import { createHerdrClient } from "@henryqw/pi-herdr";

const herdr = createHerdrClient(pi.exec.bind(pi));
const response = await herdr.json(["agent", "list"], { cwd: ctx.cwd });

For a ready-to-use Pi workflow, see @henryqw/pi-herdr-clone.

API

Surface Type Purpose
exec function Validates string argv and returns the raw process result.
run function Requires a successful exit and returns stdout.
json function Requires a successful exit and parses a JSON object.
hasHerdrErrorCode function Detects structured CLI errors in stdout or stderr.
startPiAgent function Validates and builds the shared agent start --kind pi --pane ... -- boundary. It retries structured agent_pane_busy responses allowed by the caller's result-aware policy, with a five-attempt limit, and returns the raw final result.

Callers build Pi-specific arguments and validate responses. The client does not mirror the Herdr command catalog. Herdr remains the source of truth for supported commands and response shapes.