@narumitw/pi-subagents 0.20.0 → 0.26.0
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 +94 -50
- package/package.json +1 -1
- package/src/agents.ts +8 -4
- package/src/config-ui.ts +566 -205
- package/src/in-process-transport.ts +15 -10
- package/src/persistence.ts +4 -1
- package/src/registry.ts +33 -15
- package/src/settings.ts +113 -0
- package/src/stateful.ts +398 -254
- package/src/subagents.ts +20 -19
- package/src/subprocess-transport.ts +10 -9
- package/src/orchestration.ts +0 -164
package/README.md
CHANGED
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
`@narumitw/pi-subagents` is a native [Pi coding agent](https://pi.dev) extension for delegating work to specialized agents. The batch `subagent` tool keeps isolated Pi subprocesses, while addressable lifecycle tools can run reusable agents either as subprocess-backed logical sessions or as public-SDK in-process child sessions.
|
|
6
6
|
|
|
7
|
-
Use it to split independent research, planning, implementation, and review work across focused workers.
|
|
7
|
+
Use it to split independent research, planning, implementation, and review work across focused workers. Under the default next-turn delivery policy, background delegation is for work the current response does not depend on. Opt-in auto-resume also supports final-answer-dependent background work by requesting a synthesis turn after completion.
|
|
8
8
|
|
|
9
9
|
## ✨ Features
|
|
10
10
|
|
|
11
11
|
- Registers a `subagent` tool for single-agent, parallel, fan-in, and chained delegation.
|
|
12
12
|
- Keeps batch workers isolated in `pi --mode json -p --no-session` subprocesses.
|
|
13
|
-
- Registers detached stateful lifecycle tools by default;
|
|
13
|
+
- Registers detached stateful lifecycle tools by default; completion can stay queued for the next turn or opt into an idle root synthesis turn.
|
|
14
14
|
- Supports an opt-in public-SDK `in-process` stateful transport with one reusable child `AgentSession` per `agentId`.
|
|
15
15
|
- Supports built-in `scout`, `planner`, `reviewer`, and `worker` agents.
|
|
16
16
|
- Loads custom user agents from `~/.pi/agent/agents/*.md`.
|
|
17
17
|
- Optionally loads project agents from `.pi/agents/*.md` with confirmation.
|
|
18
|
-
- Provides `/subagents
|
|
19
|
-
- Supports per-task `cwd`, hard subprocess `timeoutMs`, `thinkingLevel`, abort propagation, and streaming progress.
|
|
18
|
+
- Provides a current-session-first `/subagents` manager, direct `settings|status|help` routes, and compatibility aliases for agent tools and retained agents.
|
|
19
|
+
- Supports per-task `cwd`, hard subprocess `timeoutMs`, task-selected `thinkingLevel`, abort propagation, and streaming progress.
|
|
20
20
|
- Bounds JSON lines, captured messages, stderr, final output, chain substitution, and fan-in context.
|
|
21
21
|
- Enforces a recursion-depth guard and deterministic process-group termination.
|
|
22
|
-
- Provides addressable stateful agents with follow-up,
|
|
22
|
+
- Provides addressable stateful agents with follow-up, mailbox, list, interrupt, close, context selection, and persistence.
|
|
23
23
|
- Publishes transient runtime status through Pi's generic extension status API while subagents are running.
|
|
24
24
|
- Returns complete bounded worker output in tool details and a concise result for the main agent.
|
|
25
25
|
|
|
@@ -43,17 +43,19 @@ pi -e ./extensions/pi-subagents
|
|
|
43
43
|
|
|
44
44
|
## 🛠️ Pi tool
|
|
45
45
|
|
|
46
|
-
`pi-subagents` registers
|
|
46
|
+
`pi-subagents` always registers the primary batch tool and registers the stateful lifecycle tools unless `stateful.enabled` is `false`:
|
|
47
47
|
|
|
48
|
-
- `subagent` — delegate blocking single, parallel, fan-in, or chained batch work.
|
|
49
|
-
- `subagent_spawn` and related lifecycle tools — start reusable detached work, return immediately, and receive bounded completion messages automatically.
|
|
48
|
+
- `subagent` — delegate blocking single, parallel, fan-in, or chained batch work. The main agent cannot process queued steering until the call returns.
|
|
49
|
+
- `subagent_spawn` and related lifecycle tools — when enabled, start reusable detached work, return immediately, and receive bounded completion messages automatically.
|
|
50
50
|
|
|
51
51
|
Choose the API by lifecycle:
|
|
52
52
|
|
|
53
53
|
| Need | Use |
|
|
54
54
|
| --- | --- |
|
|
55
|
-
|
|
|
56
|
-
|
|
|
55
|
+
| A delegated result is required before the root's next action under default next-turn delivery | One blocking `subagent` call (`tasks` for synchronous parallel work) |
|
|
56
|
+
| Broad research/review the current response does not depend on | Prefer one `subagent_spawn` covering related branches, when lifecycle tools are enabled |
|
|
57
|
+
| Final-answer-dependent broad work with `completionDelivery: "auto-resume"` | Prefer one `subagent_spawn`; completion requests a synthesis turn |
|
|
58
|
+
| Reusable history, follow-ups, or mailboxes | `subagent_spawn` and lifecycle tools, when enabled |
|
|
57
59
|
| One simple or critical-path action the root can perform directly | No subagent |
|
|
58
60
|
|
|
59
61
|
Execution modes:
|
|
@@ -67,29 +69,35 @@ Common controls:
|
|
|
67
69
|
|
|
68
70
|
- `cwd` — run a job from a different working directory.
|
|
69
71
|
- `timeoutMs` — set a hard subprocess timeout.
|
|
70
|
-
- `thinkingLevel` — request `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max` thinking for the spawned Pi process.
|
|
72
|
+
- `thinkingLevel` — request `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max` thinking for the spawned Pi process or in-process child.
|
|
73
|
+
|
|
74
|
+
For `subagent_spawn`, the root agent selects the lowest thinking level sufficient for the delegated task. This is a tool-argument decision made from the task already in context; `pi-subagents` does not run a string heuristic or an extra classifier model call.
|
|
71
75
|
|
|
72
76
|
## 🧭 Proactive use
|
|
73
77
|
|
|
74
|
-
The `subagent` tool advertises
|
|
75
|
-
|
|
78
|
+
The always-available `subagent` tool advertises only blocking guidance. When stateful lifecycle tools
|
|
79
|
+
are registered, `subagent_spawn` adds detached guidance for the active completion-delivery policy.
|
|
80
|
+
Changing the policy through `/subagents settings` refreshes that guidance immediately.
|
|
76
81
|
|
|
77
82
|
Count-selection guidance:
|
|
78
83
|
|
|
79
84
|
- Use **no subagent** for simple answers, quick targeted edits, latency-sensitive one-step work, or
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
only when
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
85
|
+
critical-path work the main agent can perform directly.
|
|
86
|
+
- `subagent` is deliberately blocking: while it runs, the main agent cannot answer queued steering.
|
|
87
|
+
Use it when delegated outputs are required before the next root action and waiting is intentional.
|
|
88
|
+
- With default `completionDelivery: "next-turn"`, prefer **one detached `subagent_spawn`** for broad
|
|
89
|
+
research or review only when the current response does not depend on its result. Keep
|
|
90
|
+
final-answer-dependent delegated work on the blocking path because an idle root is not awakened.
|
|
91
|
+
- With `completionDelivery: "auto-resume"`, prefer one detached `subagent_spawn` for broad related
|
|
92
|
+
research or review even when the final answer depends on it; completion requests a later synthesis
|
|
93
|
+
turn. Do not choose blocking parallel fan-out merely to keep delegation in one turn.
|
|
94
|
+
- Use detached `subagent_spawn` only when lifecycle tools are enabled and a bounded independent task
|
|
95
|
+
has a concrete isolation or specialization benefit. After spawning, do useful non-overlapping work
|
|
96
|
+
immediately. Do not poll lifecycle tools for progress or duplicate the delegated work.
|
|
97
|
+
- Add another detached agent only for truly independent work with safe workspace concurrency. If
|
|
98
|
+
synchronous parallel or fan-in output is genuinely required, keep blocking `subagent` tasks
|
|
99
|
+
independent, stay within the hard max of 8, and do not parallelize implementation that may edit
|
|
100
|
+
the same files or shared state.
|
|
93
101
|
- Do not use project-local agents unless the user explicitly opts into them with
|
|
94
102
|
`agentScope: "project"` or `"both"`; keep confirmation enabled for untrusted repositories.
|
|
95
103
|
|
|
@@ -101,16 +109,17 @@ No subagent for a known-file edit:
|
|
|
101
109
|
Rename one symbol in src/foo.ts.
|
|
102
110
|
```
|
|
103
111
|
|
|
104
|
-
One
|
|
112
|
+
One detached agent for a broad asynchronous review that the current response does not require, or when auto-resume is enabled (call `subagent_spawn`):
|
|
105
113
|
|
|
106
114
|
```json
|
|
107
115
|
{
|
|
108
116
|
"agent": "reviewer",
|
|
109
|
-
"task": "Review
|
|
117
|
+
"task": "Review source, tests, and integration risks for the current changes. Do not edit files. Report PASS/FAIL/PARTIAL with evidence."
|
|
110
118
|
}
|
|
111
119
|
```
|
|
112
120
|
|
|
113
|
-
|
|
121
|
+
A blocking fan-out is reserved for output that must be synthesized before the root continues (call
|
|
122
|
+
`subagent`):
|
|
114
123
|
|
|
115
124
|
```json
|
|
116
125
|
{
|
|
@@ -122,10 +131,6 @@ Two to four parallel subagents for broad independent reconnaissance:
|
|
|
122
131
|
{
|
|
123
132
|
"agent": "scout",
|
|
124
133
|
"task": "Research auth-related tests. Report coverage gaps. Do not edit files."
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
"agent": "scout",
|
|
128
|
-
"task": "Research API entry points that depend on auth. Report integration risks. Do not edit files."
|
|
129
134
|
}
|
|
130
135
|
],
|
|
131
136
|
"aggregator": {
|
|
@@ -135,7 +140,11 @@ Two to four parallel subagents for broad independent reconnaissance:
|
|
|
135
140
|
}
|
|
136
141
|
```
|
|
137
142
|
|
|
138
|
-
## 🚀
|
|
143
|
+
## 🚀 Blocking batch examples
|
|
144
|
+
|
|
145
|
+
Every example in this section calls `subagent` and keeps the main agent unavailable until the batch
|
|
146
|
+
finishes. Use `subagent_spawn` instead when the work can complete asynchronously and its configured
|
|
147
|
+
completion policy supports when synthesis is needed.
|
|
139
148
|
|
|
140
149
|
Run one read-only reconnaissance agent:
|
|
141
150
|
|
|
@@ -200,22 +209,30 @@ Run a chain where each step receives the previous output:
|
|
|
200
209
|
|
|
201
210
|
## 🔁 Stateful agents
|
|
202
211
|
|
|
203
|
-
Stateful lifecycle tools are available by default. `subagent_spawn` is detached: it schedules work, returns immediately with an opaque `agentId`, and later injects
|
|
212
|
+
Stateful lifecycle tools are available by default. `subagent_spawn` is detached: it schedules work, returns immediately with an opaque `agentId`, and later injects a bounded `pi-subagent-completion` custom message. Completions that settle in the same dispatch window are batched, and the broker allows at most one in-flight root wake until that parent turn starts.
|
|
213
|
+
|
|
214
|
+
Detached work follows a non-polling policy. With default `next-turn` delivery, prefer one bounded `subagent_spawn` for related asynchronous research or review only when the current response does not depend on its result; if it does, use blocking `subagent`. With opt-in `auto-resume`, detached broad work may be final-answer-dependent because completion requests a synthesis turn after the root settles. In either mode, do useful non-overlapping main-agent work immediately, do not poll `subagent_list` or `subagent_messages`, and do not duplicate delegated work. Add another detached agent only for truly independent work with safe workspace concurrency. Detached lifecycle work intentionally has no `subagent_wait` tool.
|
|
204
215
|
|
|
205
|
-
|
|
216
|
+
A detached agent additionally needs a concrete isolation or specialization benefit such as independent review, bounded context/output, a distinct model/tool profile, or workspace isolation. Simple work that the main agent can perform directly should not be delegated.
|
|
206
217
|
|
|
207
|
-
|
|
218
|
+
`stateful.completionDelivery` controls settled completion delivery:
|
|
208
219
|
|
|
209
|
-
|
|
220
|
+
- `"next-turn"` (default) preserves the previous behavior: use `deliverAs: "steer"` with `triggerTurn: false`. An active root can consume completion naturally; an idle root is not awakened.
|
|
221
|
+
- `"auto-resume"` holds completion while the root is active, then requests one synthesis turn after the parent settles when no user or extension messages are already pending. Simultaneous completions share that turn, active work is not interrupted, and pending input suppresses the autonomous wake.
|
|
222
|
+
|
|
223
|
+
Auto-resume is best-effort because Pi's custom-message API is fire-and-forget. Session-generation checks, shutdown cleanup, batching, and the in-flight wake guard prevent stale or duplicate scheduling pressure, but they do not make completion delivery durable across process exit.
|
|
210
224
|
|
|
211
225
|
The default `subprocess` transport preserves compatibility: each turn starts a fresh isolated `pi --mode json -p --no-session` child and receives sanitized, bounded history. Set `transport` to `in-process` to retain one public Pi SDK `AgentSession` per stateful `agentId`, avoiding repeated process startup while preserving native child history in memory.
|
|
212
226
|
|
|
213
|
-
|
|
227
|
+
Run `/subagents` in TUI mode to open the primary manager. It separates current-session lifecycle state, transport, completion delivery, and active/retained counts from user settings that persist across sessions. Its actions open completion settings, per-agent tool settings, current-session agent inspection/clear, status, and help. Escape returns from a nested screen to a newly refreshed manager and then closes it.
|
|
228
|
+
|
|
229
|
+
The direct routes remain predictable: `/subagents settings` changes user completion delivery and applies it immediately, including refreshing the model-facing spawn guidance; `/subagents status` reports current-session runtime values separately from the configured value, source, and path; `/subagents help` summarizes commands and compatibility routes. In RPC mode, bare `/subagents` emits the same bounded status through Pi's notification protocol instead of opening a custom TUI. JSON and print modes do not emit ad hoc command output. Manual edits use `~/.pi/agent/pi-subagents.json` and take effect after reloading Pi:
|
|
214
230
|
|
|
215
231
|
```json
|
|
216
232
|
{
|
|
217
233
|
"stateful": {
|
|
218
234
|
"transport": "in-process",
|
|
235
|
+
"completionDelivery": "auto-resume",
|
|
219
236
|
"maxAgents": 16,
|
|
220
237
|
"maxActiveTurns": 4,
|
|
221
238
|
"maxDepth": 3,
|
|
@@ -229,20 +246,31 @@ Configure the runtime in `~/.pi/agent/pi-subagents.json`, then reload Pi:
|
|
|
229
246
|
}
|
|
230
247
|
```
|
|
231
248
|
|
|
232
|
-
Set `"enabled": false` to remove all stateful lifecycle tools. Otherwise, the extension registers:
|
|
249
|
+
The settings UI patches the raw JSON atomically and preserves unknown fields; it refuses to overwrite malformed or invalid settings. Set `"enabled": false` to remove all stateful lifecycle tools. Otherwise, the extension registers:
|
|
233
250
|
|
|
234
251
|
| Tool | Purpose |
|
|
235
252
|
| --- | --- |
|
|
236
|
-
| `subagent_spawn` | Start detached work, return an opaque `agentId` immediately, and deliver completion asynchronously. |
|
|
253
|
+
| `subagent_spawn` | Start detached work with an optional task-selected thinking level, return an opaque `agentId` immediately, and deliver completion asynchronously. |
|
|
237
254
|
| `subagent_send` | Send follow-up work to a reusable agent; shared-workspace write conflicts are guarded unless explicitly overridden. |
|
|
238
255
|
| `subagent_message` | Queue a bounded mailbox message without starting a turn; sender IDs must be `root` or an agent in the same tree. |
|
|
239
256
|
| `subagent_messages` | Read and optionally acknowledge unread mailbox messages. |
|
|
240
|
-
| `subagent_wait` | Wait when coordination is the useful next action; timeout does not terminate the agent, and parent abort/user steering cancels only the wait. Already-terminal agents return immediately. |
|
|
241
257
|
| `subagent_list` | List retained agents and lifecycle states. |
|
|
242
258
|
| `subagent_interrupt` | Abort the current turn while retaining its identity and history. |
|
|
243
259
|
| `subagent_close` | Abort if necessary, close the agent, and remove it from retained persistence. |
|
|
244
260
|
|
|
245
|
-
Use `/subagents
|
|
261
|
+
Use the **Current-session agents** action in `/subagents` to inspect the indented agent tree, lifecycle state, unread count, and available actions, or to confirm clearing retained agents. `/subagents:agents list|clear` remains the compatibility command for the same current-session operations. Active turns are FIFO-limited by `maxActiveTurns`; excess retained work remains in `starting` state until a slot is available. `maxAgents` separately bounds running, queued, and idle records. `parentId` creates a bounded child relationship; subtree interrupt and close operate child-first.
|
|
262
|
+
|
|
263
|
+
A spawn can request a thinking level explicitly:
|
|
264
|
+
|
|
265
|
+
```json
|
|
266
|
+
{
|
|
267
|
+
"agent": "reviewer",
|
|
268
|
+
"task": "Analyze the cross-package concurrency failure and identify the safest fix",
|
|
269
|
+
"thinkingLevel": "high"
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
The requested level is stored with the stateful agent and remains in effect for all follow-ups and after persisted restore. `subagent_send` does not provide a per-turn thinking override; create a new agent when a later task needs a different level.
|
|
246
274
|
|
|
247
275
|
`subagent_spawn.context` accepts:
|
|
248
276
|
|
|
@@ -267,7 +295,7 @@ Stateful execution uses a transport boundary:
|
|
|
267
295
|
|
|
268
296
|
No private Pi imports, runtime casts, or `ExtensionAPI` monkey-patching are used. Approval policy, sandbox profile, provider-header hooks, extension state, global scheduling, and parent/child transcript switching are not inherited or provided by the in-process transport.
|
|
269
297
|
|
|
270
|
-
Write-capable agents share the workspace by default. Concurrent write-capable starts in the same cwd are rejected unless `allowConcurrentWrites` is explicitly set. Classification is intentionally conservative: an agent with `bash`, `write`, or `edit` is write-capable even when its task prompt says “read only,” because prompt wording is not a filesystem sandbox.
|
|
298
|
+
Write-capable agents share the workspace by default. Concurrent write-capable starts in the same cwd are rejected unless `allowConcurrentWrites` is explicitly set. Classification is intentionally conservative: an agent with `bash`, `write`, or `edit` is write-capable even when its task prompt says “read only,” because prompt wording is not a filesystem sandbox. Prefer one detached agent when asynchronous work can be combined. If concurrent work is genuinely required, use the blocking batch only when synchronous outputs justify making the root unavailable, explicitly accept safe detached overlap with `allowConcurrentWrites`, or use isolated worktrees when repository isolation is needed.
|
|
271
299
|
|
|
272
300
|
Set `workspaceMode: "worktree"` to opt into a disposable detached Git worktree; this requires a clean repository and the worktree is removed on close or session shutdown. Isolated worktree agents are intentionally not restored after shutdown.
|
|
273
301
|
|
|
@@ -282,7 +310,7 @@ Existing `subagent` requests remain unchanged:
|
|
|
282
310
|
| Parallel | Input order, with at most four active children. | Collects all task results; partial worker failure is reported in summaries but does not discard successful results. |
|
|
283
311
|
| Parallel + aggregator | Source input order, then aggregator. | The aggregator runs with both successful outputs and failure descriptions; aggregator failure marks the tool result as an error. |
|
|
284
312
|
|
|
285
|
-
Timeout precedence remains: task/step/aggregator → call → agent setting → `PI_SUBAGENT_TIMEOUT_MS` → 600000 ms.
|
|
313
|
+
Timeout precedence remains: task/step/aggregator → call → agent setting → `PI_SUBAGENT_TIMEOUT_MS` → 600000 ms. Blocking thinking precedence remains: task/step/aggregator → call → agent setting → child default. Stateful spawn thinking precedence is: `subagent_spawn.thinkingLevel` → agent setting → transport fallback. Project-agent resolution and confirmation behavior is unchanged.
|
|
286
314
|
|
|
287
315
|
## 🤖 Built-in agents
|
|
288
316
|
|
|
@@ -292,16 +320,17 @@ Built-in agents are available without setup and can be overridden by user or pro
|
|
|
292
320
|
| --- | --- | --- |
|
|
293
321
|
| `scout` | Read-only codebase reconnaissance. | `read`, `grep`, `find`, `ls`, `bash` |
|
|
294
322
|
| `planner` | Grounded implementation plans. | `read`, `grep`, `find`, `ls` |
|
|
295
|
-
| `reviewer` | Independent review and verification. | `read`, `grep`, `find`, `ls`, `bash` |
|
|
323
|
+
| `reviewer` | Independent review of code and existing verification evidence. | `read`, `grep`, `find`, `ls`, `bash` |
|
|
296
324
|
| `worker` | General-purpose implementation. | Pi default tools |
|
|
297
325
|
| `general`, `general-purpose` | Aliases for `worker`. | Pi default tools |
|
|
298
326
|
|
|
327
|
+
The built-in `reviewer` does not run tests, builds, benchmarks, or formatters. It recommends additional verification commands for the main agent to run instead. Custom agents can override this behavior.
|
|
328
|
+
|
|
299
329
|
Built-in agents inherit the active/default Pi model instead of forcing a provider-specific model alias, which keeps subprocesses usable across different Pi setups.
|
|
300
330
|
|
|
301
331
|
## ⚙️ Configure agent tools
|
|
302
332
|
|
|
303
|
-
|
|
304
|
-
The command stores settings in `~/.pi/agent/pi-subagents.json`.
|
|
333
|
+
Open `/subagents` and choose **Agent tool settings** in an interactive Pi session to edit the tools each subagent may use. `/subagents:config` remains a documented compatibility route to the same screen. These are user settings stored in `~/.pi/agent/pi-subagents.json` and affect future sessions.
|
|
305
334
|
|
|
306
335
|
Compatibility: a valid legacy `pi-subagents-config.json` is migrated automatically to `pi-subagents.json`. If both files exist, the new filename takes precedence.
|
|
307
336
|
|
|
@@ -381,9 +410,24 @@ Each subprocess has a hard timeout to avoid runaway workers.
|
|
|
381
410
|
- Set `timeoutMs` on a task, chain step, or aggregator to override it locally.
|
|
382
411
|
- If omitted, the default is `PI_SUBAGENT_TIMEOUT_MS`, or `600000` milliseconds (10 minutes) when unset.
|
|
383
412
|
|
|
384
|
-
Set `thinkingLevel` to
|
|
413
|
+
Set `thinkingLevel` to request one of Pi's supported levels: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`. Blocking subprocess calls pass the resolved value through `--thinking <level>`.
|
|
414
|
+
|
|
415
|
+
For `subagent_spawn`, the root agent should choose the lowest sufficient level:
|
|
416
|
+
|
|
417
|
+
| Level | Appropriate delegated work |
|
|
418
|
+
| --- | --- |
|
|
419
|
+
| `off` / `minimal` | Extraction, formatting, or mechanical work requiring almost no reasoning. |
|
|
420
|
+
| `low` | Straightforward, bounded tasks with direct steps. |
|
|
421
|
+
| `medium` | Ordinary multi-step research or implementation. |
|
|
422
|
+
| `high` | Complex debugging, design, review, or cross-file analysis. |
|
|
423
|
+
| `xhigh` | Highly ambiguous, cross-system, or high-risk analysis. |
|
|
424
|
+
| `max` | Exceptional hardest tasks where quality clearly outweighs latency and cost. |
|
|
425
|
+
|
|
426
|
+
Blocking thinking precedence is: task/chain step/aggregator `thinkingLevel` → top-level `thinkingLevel` → agent default from config or frontmatter → Pi subprocess default.
|
|
427
|
+
|
|
428
|
+
Stateful spawn precedence is: `subagent_spawn.thinkingLevel` → agent default from config or frontmatter → transport fallback. The subprocess transport then uses spawned Pi model/default resolution. The in-process transport uses a configured model thinking suffix and then the parent thinking snapshot captured when the child is created. An explicit spawn value is retained for the agent lifecycle and wins over all of those fallbacks.
|
|
385
429
|
|
|
386
|
-
|
|
430
|
+
Omit `thinkingLevel` to preserve existing behavior. Reported stateful details show the requested level, not a guarantee of the provider's effective value. Pi still owns model capability clamping; `pi-subagents` does not duplicate capability detection.
|
|
387
431
|
|
|
388
432
|
On timeout, the extension sends process-group `SIGTERM`, escalates to `SIGKILL` after a five-second grace period if the process has not actually closed, and returns partial bounded messages or stderr collected so far. Parent abort uses the same cleanup path and preserves a structured result.
|
|
389
433
|
|
package/package.json
CHANGED
package/src/agents.ts
CHANGED
|
@@ -47,9 +47,12 @@ export interface SubagentAgentConfig {
|
|
|
47
47
|
|
|
48
48
|
export type SubagentTransportKind = "subprocess" | "in-process";
|
|
49
49
|
|
|
50
|
+
export type CompletionDelivery = "next-turn" | "auto-resume";
|
|
51
|
+
|
|
50
52
|
export interface SubagentRuntimeSettings {
|
|
51
53
|
enabled?: boolean;
|
|
52
54
|
transport?: SubagentTransportKind;
|
|
55
|
+
completionDelivery?: CompletionDelivery;
|
|
53
56
|
maxAgents?: number;
|
|
54
57
|
maxActiveTurns?: number;
|
|
55
58
|
maxDepth?: number;
|
|
@@ -93,14 +96,15 @@ const BUILT_IN_AGENTS: AgentConfig[] = [
|
|
|
93
96
|
},
|
|
94
97
|
{
|
|
95
98
|
name: "reviewer",
|
|
96
|
-
description: "Independent code review
|
|
99
|
+
description: "Independent code review agent that inspects existing verification evidence.",
|
|
97
100
|
tools: ["read", "grep", "find", "ls", "bash"],
|
|
98
101
|
source: "built-in",
|
|
99
102
|
filePath: "built-in:reviewer",
|
|
100
103
|
systemPrompt: [
|
|
101
|
-
"You are a reviewer subagent. Review changes adversarially and
|
|
102
|
-
"Do not edit files
|
|
103
|
-
"
|
|
104
|
+
"You are a reviewer subagent. Review changes adversarially and assess claims against the code and existing evidence.",
|
|
105
|
+
"Do not edit files or run tests, builds, benchmarks, formatters, or other long-running verification commands.",
|
|
106
|
+
"Inspect code, diffs, test definitions, and existing verification evidence. Recommend any additional commands for the main agent to run.",
|
|
107
|
+
"Report PASS, FAIL, or PARTIAL with evidence, commands inspected, and specific follow-ups.",
|
|
104
108
|
].join("\n"),
|
|
105
109
|
},
|
|
106
110
|
{
|