@henryqw/pi-herdr 0.5.0 → 0.5.2
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 +11 -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,12 @@ 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
|
|
34
|
+
| `startPiAgent` | function | Validates and runs the shared `agent start --kind pi --pane ... --` boundary after a shell-readiness probe. |
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
### `startPiAgent`
|
|
37
|
+
|
|
38
|
+
On macOS, a shell that starts or runs a prompt hook can lose Enter for a launch command longer than 1024 bytes. The pane then waits forever. To prevent this, the helper first checks `pane process-info`. When the pane shell owns the foreground process group, it runs `pane run <pane> "echo <token>"` and polls `pane read` for up to 20 seconds. The probe passes when the token appears on its own line, with a prompt after it.
|
|
39
|
+
|
|
40
|
+
The helper skips the probe when the shell does not own the group, so `agent start` reports `agent_pane_busy` for an occupied pane. If the probe fails, the helper returns its result without starting the agent. It retries `agent_pane_busy` up to five tries when the caller's policy permits it, then returns the raw final result.
|
|
41
|
+
|
|
42
|
+
Callers build Pi-specific arguments and validate responses. Herdr defines the supported commands and response shapes.
|