@henryqw/pi-herdr 0.4.9 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@henryqw/pi-herdr`
|
|
2
2
|
|
|
3
|
-
Call the Herdr CLI from Node through one
|
|
3
|
+
Call the Herdr CLI from Node through one Herdr Client. Extension authors share process handling without copying the list of Herdr commands. Pi users usually install a Herdr companion extension instead.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -8,11 +8,11 @@ Call the Herdr CLI from Node through one thin client. Extension authors share pr
|
|
|
8
8
|
npm install @henryqw/pi-herdr
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
Install the Herdr CLI
|
|
11
|
+
Install the Herdr CLI. Make `herdr` available on the calling process's `PATH`. The client requires Herdr 0.9.3 or later. Run `herdr --version` to verify the version.
|
|
12
12
|
|
|
13
13
|
## Use
|
|
14
14
|
|
|
15
|
-
Create a
|
|
15
|
+
Create a Herdr Client. Run a command. The client returns the parsed response.
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
import { createHerdrClient } from "@henryqw/pi-herdr";
|
|
@@ -31,6 +31,6 @@ For a ready-to-use Pi workflow, see [`@henryqw/pi-herdr-tools`](https://pi.henry
|
|
|
31
31
|
| `run` | function | Requires a successful exit and returns stdout. |
|
|
32
32
|
| `json` | function | Requires a successful exit and parses a JSON object. |
|
|
33
33
|
| `hasHerdrErrorCode` | function | Detects structured CLI errors in stdout or stderr. |
|
|
34
|
-
| `startPiAgent` | function | Validates and builds the shared `agent start --kind pi --pane ... --` boundary. Before each start it checks
|
|
34
|
+
| `startPiAgent` | function | Validates and builds the shared `agent start --kind pi --pane ... --` boundary. Before each start, it checks `pane process-info`. The pane shell must still own the foreground process group. It runs `pane run <pane> "echo <token>"`. It then polls `pane read` for up to 20 seconds. The token must appear as its own output line, with a prompt after it. This proves that the shell is reading input. Without this check, a shell on macOS can lose Enter for a launch command longer than 1024 bytes. This occurs while the shell starts or runs a prompt hook. The pane then waits forever. The helper does not probe an occupied pane, so `agent start` still reports `agent_pane_busy`. If the probe fails, the helper returns its result without starting the agent. It retries structured `agent_pane_busy` responses when the caller's result-aware policy permits it. The limit is five tries. It returns the raw final result. |
|
|
35
35
|
|
|
36
|
-
Callers build Pi-specific arguments and validate responses. The
|
|
36
|
+
Callers build Pi-specific arguments and validate responses. The Herdr Client does not copy the list of Herdr commands. Herdr defines the supported commands and response shapes.
|