@deathbeam/pi-delegate 0.0.1 → 0.0.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 +37 -1
- package/format.ts +1 -1
- package/index.ts +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @deathbeam/pi-delegate
|
|
1
|
+
# [@deathbeam/pi-delegate](https://www.npmjs.com/package/@deathbeam/pi-delegate)
|
|
2
2
|
|
|
3
3
|
Run focused subagents with `delegate`, `delegate_list`, `delegate_steer`, and `delegate_cancel`.
|
|
4
4
|
|
|
@@ -10,6 +10,42 @@ pi install npm:@deathbeam/pi-delegate # this package
|
|
|
10
10
|
pi install git:github.com/deathbeam/pi-packages # all four packages
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
## Configuration
|
|
14
|
+
|
|
15
|
+
Optional `delegate` settings live in `~/.pi/agent/settings.json` or `.pi/settings.json`:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"delegate": {
|
|
20
|
+
"agentDirs": ["./.pi/agents"],
|
|
21
|
+
"models": {
|
|
22
|
+
"cheap": "anthropic/claude-haiku-latest",
|
|
23
|
+
"balanced": "anthropic/claude-sonnet-latest",
|
|
24
|
+
"strong": "anthropic/claude-opus-latest"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Relative `agentDirs` resolve against the project cwd, later same-name definitions win. Project `models` override global
|
|
31
|
+
tiers (`cheap`, `balanced`, `strong`), otherwise the child uses the current session model.
|
|
32
|
+
|
|
33
|
+
Agents are Markdown files with frontmatter, the body becomes the child's system prompt:
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
---
|
|
37
|
+
name: scout
|
|
38
|
+
description: Explore the codebase
|
|
39
|
+
tools: read, grep
|
|
40
|
+
model: cheap
|
|
41
|
+
thinking: low
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
Explore the codebase and report relevant paths.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Omit `tools` to inherit active tools. `model` can also be an explicit `provider/model`.
|
|
48
|
+
|
|
13
49
|
## Development
|
|
14
50
|
|
|
15
51
|
From this package directory:
|
package/format.ts
CHANGED
|
@@ -4,7 +4,7 @@ export const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦",
|
|
|
4
4
|
export const SPINNER_INTERVAL_MS = 100;
|
|
5
5
|
/** pi slices extension widgets at ten lines and appends its own truncation note. */
|
|
6
6
|
export const WIDGET_MAX_LINES = 10;
|
|
7
|
-
/** Only a few jobs still fit with their tool-call and tool-result lines: 1 tally + 3
|
|
7
|
+
/** Only a few jobs still fit with their tool-call and tool-result lines: 1 tally + 3*3 lines. */
|
|
8
8
|
const WIDGET_MAX_DETAIL_JOBS = 3;
|
|
9
9
|
/** In bulk, one row per job: 1 tally + 8 rows + 1 "more running" footer. */
|
|
10
10
|
const WIDGET_MAX_JOBS = 8;
|
package/index.ts
CHANGED
|
@@ -227,7 +227,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
227
227
|
output,
|
|
228
228
|
error,
|
|
229
229
|
};
|
|
230
|
-
// Idle: this starts a new turn. Streaming: steer the report in at the next turn boundary
|
|
230
|
+
// Idle: this starts a new turn. Streaming: steer the report in at the next turn boundary;
|
|
231
231
|
// a follow-up waits for a run end that a parent stuck polling may never reach.
|
|
232
232
|
pi.sendMessage(
|
|
233
233
|
{ customType: RESULT_MESSAGE, content: reportText(report), display: true, details: report },
|
|
@@ -339,7 +339,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
339
339
|
const thinking = agent.thinking ?? ctx.thinkingLevel;
|
|
340
340
|
if (thinking) args.push("--thinking", thinking);
|
|
341
341
|
if (agent.prompt) args.push("--append-system-prompt", agent.prompt);
|
|
342
|
-
const
|
|
342
|
+
const entrypoint = process.argv[1];
|
|
343
|
+
if (!entrypoint) throw new Error("Pi CLI entrypoint missing; start Pi from its CLI to delegate.");
|
|
344
|
+
const child = spawn(process.execPath, [entrypoint, "--mode", "rpc", "--no-session", ...args], {
|
|
343
345
|
cwd: ctx.cwd,
|
|
344
346
|
shell: false,
|
|
345
347
|
stdio: "pipe",
|