@henryqw/pi-subagent 15.0.1 → 15.0.3
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
CHANGED
|
@@ -12,11 +12,13 @@ pi install npm:@henryqw/pi-task-models
|
|
|
12
12
|
pi install npm:@henryqw/pi-subagent
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Run `/task-models` and configure the `fast` profile before delegating.
|
|
15
|
+
Run `/task-models` and configure the `fast` profile before delegating. Open `/task-models` again and verify that `fast` no longer says `not configured`.
|
|
16
16
|
|
|
17
17
|
## Works with
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
| Package | Relationship | Purpose |
|
|
20
|
+
| --- | --- | --- |
|
|
21
|
+
| [`@henryqw/pi-task-models`](https://pi.henry.wang/extensions/pi-task-models) | Required | Supplies `fast`, `balanced`, `frontier`, and `fav` model routes. |
|
|
20
22
|
|
|
21
23
|
Routes come from `~/.pi/agent/config/pi-task-models/config.json`. It stores explicit task overrides. Missing shared model config warns once because delegation needs a route.
|
|
22
24
|
|
|
@@ -94,6 +96,12 @@ A Flow has 1–8 units with unique non-empty IDs and allows one active Flow. It
|
|
|
94
96
|
- Without `review`, Flow fast-forwards the exact validated tip.
|
|
95
97
|
- With `review`, the Reviewer receives the exact `{base, tip, patchPath}` packet and must return exactly `PASS` before the same integration path. Use `review` only for stated judgment that validation cannot decide.
|
|
96
98
|
|
|
99
|
+
A Role selects base tools, extensions, named Skills, instructions, and optional worktree isolation. Named Skills resolve from Main's effective Pi registry. Unavailable names warn and skip.
|
|
100
|
+
|
|
101
|
+
Children disable ambient extension and Skill discovery. `tools: []` adds no base tools, but selected extension tools and caller tools still activate. `extensions: []` adds no Role extension bundle. `skills: []` adds no separately named Role Skills, but selected extension Skills still load.
|
|
102
|
+
|
|
103
|
+
Parent-only delegation tools and `ask_question` are always excluded. Requested Role or caller tool names are checked after provider loading. Unavailable tools fail before the first model turn.
|
|
104
|
+
|
|
97
105
|
An explicit unit `modelClass` overrides both frozen Roles. Without one, each Role uses its own `modelClass`, configured `pi-subagent/delegateTask` assignment, or declared default.
|
|
98
106
|
|
|
99
107
|
One `delegate_flow_continue` can repair an Implementer, validation, or review block in the same worktree. Omitting its class keeps the unit's explicit class and frozen Role defaults. Supplying one replaces both Role defaults for that repair and its later Reviewer launch.
|
|
@@ -106,14 +114,12 @@ Flow has no dependency graph, saved recovery, automatic retry, aggregate review,
|
|
|
106
114
|
|
|
107
115
|
pi-subagent owns `~/.pi/agent/config/pi-subagent/config.json`. It is optional. A missing file uses these defaults without a warning.
|
|
108
116
|
|
|
109
|
-
|
|
|
110
|
-
| --- | --- | --- |
|
|
111
|
-
| `maxSubagents` | Safe integer
|
|
112
|
-
| `maxTurns` | Safe integer
|
|
113
|
-
| `timeout.idleMinutes` |
|
|
114
|
-
| `timeout.maxMinutes` | Positive minutes greater than `idleMinutes
|
|
115
|
-
|
|
116
|
-
`maxTurns` defaults to 50.
|
|
117
|
+
| Name | Description | Values | Default |
|
|
118
|
+
| --- | --- | --- | --- |
|
|
119
|
+
| `maxSubagents` | Sets the maximum number of active child processes. | Safe integer of at least 1. | `5` |
|
|
120
|
+
| `maxTurns` | Sets the hard provider-turn limit for each child. | Safe integer of at least 1. | `50` |
|
|
121
|
+
| `timeout.idleMinutes` | Sets the idle timeout for a child. | Positive minutes. | `10` |
|
|
122
|
+
| `timeout.maxMinutes` | Sets the maximum runtime for a child. | Positive minutes greater than `idleMinutes`. | `30` |
|
|
117
123
|
|
|
118
124
|
Excess children wait FIFO without using a child timeout. A terminal response on turn 50 succeeds; an attempted continuation rejects with `turn_limit`.
|
|
119
125
|
|
|
@@ -164,7 +170,16 @@ Flow uses the effective Implementer and, only when requested, Reviewer. The Scou
|
|
|
164
170
|
|
|
165
171
|
## API
|
|
166
172
|
|
|
167
|
-
The package root
|
|
173
|
+
The package root includes these main exports:
|
|
174
|
+
|
|
175
|
+
| Surface | Type | Purpose |
|
|
176
|
+
| --- | --- | --- |
|
|
177
|
+
| `loadRoles` | function | Loads built-in and user Role definitions. |
|
|
178
|
+
| `resolveRoleSkills` | function | Resolves a Role's named Skills from Pi's effective registry. |
|
|
179
|
+
| `resolveRoleLaunch` | function | Resolves a Role, route, and launch resources. |
|
|
180
|
+
| `createRoleLaunch` | function | Builds launch arguments from a resolved route. |
|
|
181
|
+
| `createEphemeralSubagentExecutor` | function | Creates the bounded child-process executor. |
|
|
182
|
+
| Worktree helpers | functions | Create, inspect, finalize, and report child worktrees. |
|
|
168
183
|
|
|
169
184
|
The executor works only inside the active Pi process. It does not discover or start a standalone Node.js Pi installation.
|
|
170
185
|
|
|
@@ -172,22 +187,10 @@ The executor works only inside the active Pi process. It does not discover or st
|
|
|
172
187
|
|
|
173
188
|
See the [public Role and executor API](./docs/orchestration.md#public-role-and-executor-api) for contracts and a `prepare` example. Pass `modelClass` to `resolveRoleLaunch` to override a Role default.
|
|
174
189
|
|
|
175
|
-
##
|
|
176
|
-
|
|
177
|
-
Flow state is memory-only.
|
|
178
|
-
|
|
179
|
-
## Data, cost, and privacy
|
|
180
|
-
|
|
181
|
-
A Role selects base tools, extensions, named Skills, instructions, and optional worktree isolation. Named Skills resolve from Main's effective Pi registry. Unavailable names warn and skip.
|
|
182
|
-
|
|
183
|
-
Children disable ambient extension and Skill discovery. `tools: []` adds no base tools, but selected extension tools and caller tools still activate. `extensions: []` adds no Role extension bundle. `skills: []` adds no separately named Role Skills, but selected extension Skills still load.
|
|
190
|
+
## Limits and recovery
|
|
184
191
|
|
|
185
192
|
An explicitly selected extension is trusted, not sandboxed. Its tools, Skills, and executable behavior load together. Select fewer trusted extensions to reduce scope. pi-subagent does not guess or remove undocumented dependencies.
|
|
186
193
|
|
|
187
|
-
Parent-only delegation tools and `ask_question` are always excluded. Requested Role or caller tool names are checked after provider loading. Unavailable tools fail before the first model turn.
|
|
188
|
-
|
|
189
|
-
## Limits and recovery
|
|
190
|
-
|
|
191
194
|
Flow never force-deletes recoverable work. Failed or uncertain units, and cleanup refusals after integration, retain their worktree path or branch for recovery.
|
|
192
195
|
|
|
193
196
|
See [Flow mechanics and recovery](./docs/orchestration.md#delegate_flow) for retained-work recovery.
|
package/extensions/subagent.ts
CHANGED
|
@@ -369,13 +369,6 @@ export default function subagentExtension(
|
|
|
369
369
|
widgetItems.delete(oldestId);
|
|
370
370
|
if (widgetItems.size < MAX_WIDGET_ITEMS) break;
|
|
371
371
|
}
|
|
372
|
-
if (widgetItems.size >= MAX_WIDGET_ITEMS) {
|
|
373
|
-
for (const [oldestId, item] of widgetItems) {
|
|
374
|
-
if (item.status === "working" || retainedWidgetTaskIds.has(item.taskId)) continue;
|
|
375
|
-
widgetItems.delete(oldestId);
|
|
376
|
-
if (widgetItems.size < MAX_WIDGET_ITEMS) break;
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
372
|
}
|
|
380
373
|
widgetItems.set(id, {
|
|
381
374
|
role: roleBadge(role),
|
package/package.json
CHANGED
|
@@ -13,7 +13,9 @@ Before slicing, identify applicable repository prohibitions. If the request or p
|
|
|
13
13
|
|
|
14
14
|
Use the fewest cohesive units. `delegate_flow` is for independent units expected to commute: split independent outcomes into units, combine or sequence work that overlaps files, APIs, schemas, generated output, package metadata, lockfiles, or invariants, and never divide one invariant across multiple units. Dependent work remains outside Flow; sequence it in one task or ordinary caller-controlled sequencing.
|
|
15
15
|
|
|
16
|
-
Give every unit a bounded objective, owned scope and exclusions, and its direct validation command/argument array
|
|
16
|
+
Give every unit a bounded objective, owned scope and exclusions, and its direct validation command/argument array. Each task packet must name the neighboring behavior that must stay unchanged. Include the exact test name or error when known CI evidence exists. Never claim a validation command matches unknown CI.
|
|
17
|
+
|
|
18
|
+
Each delegation must own one concrete outcome with one focused validation story. Order declared validation from the cheapest focused check to broader required checks. If the affected flow or scope is not yet known, perform bounded read-only discovery first. Do not pass the parent request unchanged. Choose `modelClass` according to the delegation tool's guidance. Add non-empty `review` only for an explicit judgment that automated validation cannot establish. Call `delegate_flow` with 1–8 units; the runtime always supplies the effective Implementer and supplies the Reviewer only when a unit needs review.
|
|
17
19
|
|
|
18
20
|
## Runtime Flow
|
|
19
21
|
|
|
@@ -27,7 +29,9 @@ A successful Flow owns integration and cleanup. A blocked outcome is repairable
|
|
|
27
29
|
delegate_flow_continue({ guidance: "Address the reported block and complete the bounded unit.", modelClass: "balanced" })
|
|
28
30
|
```
|
|
29
31
|
|
|
30
|
-
Make the guidance specific to the reported implementation, validation, or review failure. Omit `modelClass` to retain an explicit blocked-unit class or otherwise use each frozen Role's default; supply it only to replace both defaults for that one repair. Do not call continuation unless Flow reports a repairable block. If continuation or Flow returns a terminal failure, inspect every retained path reported by the runtime, then reslice or manually recover from Main; do not retry the Flow or guess a rebase resolution.
|
|
32
|
+
Make the guidance specific to the reported implementation, validation, or review failure. Omit `modelClass` to retain an explicit blocked-unit class or otherwise use each frozen Role's default; supply it only to replace both defaults for that one repair. Do not call continuation unless Flow reports a repairable block. If continuation or Flow returns a terminal failure, inspect every retained path reported by the runtime, then reslice or manually recover from Main; do not retry the Flow or guess a rebase resolution.
|
|
33
|
+
|
|
34
|
+
A cleanup warning does not undo successful integration. Report a cleanup warning from a successful Flow as-is. Do not investigate it unless the user asks or cleanup is part of acceptance.
|
|
31
35
|
|
|
32
36
|
## Ordinary delegation
|
|
33
37
|
|