@ferris1225/pi-subagents 5.0.6 → 6.0.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/CHANGELOG.md +89 -0
- package/README.md +187 -97
- package/index.ts +1 -1
- package/package.json +4 -9
- package/src/configuration/role-migration.ts +2 -2
- package/src/configuration/setup.ts +4 -2
- package/src/configuration/ui.ts +144 -132
- package/src/delegation/agents.ts +15 -22
- package/src/delegation/dispatch.ts +17 -122
- package/src/delegation/prompt.ts +13 -12
- package/src/execution/cli-run.ts +112 -39
- package/src/execution/process-tree.ts +12 -8
- package/src/execution/run-control.ts +11 -3
- package/src/execution/spawn.ts +24 -7
- package/src/isolation/cleanup.ts +31 -12
- package/src/isolation/managed-paths.ts +6 -4
- package/src/isolation/manifest-mutation.ts +89 -0
- package/src/isolation/recovery.ts +33 -29
- package/src/isolation/temp-hygiene.ts +1 -1
- package/src/lifecycle/await-results.ts +114 -0
- package/src/lifecycle/dispatch-core.ts +7 -1
- package/src/lifecycle/durable.ts +83 -39
- package/src/lifecycle/runtime.ts +12 -4
- package/src/lifecycle/stop.ts +2 -2
- package/src/lifecycle/thread-lifecycle.ts +10 -5
- package/src/lifecycle/thread-restore.ts +26 -25
- package/src/lifecycle/thread-shared.ts +15 -3
- package/src/lifecycle/tools.ts +90 -33
- package/src/presentation/announcements.ts +8 -2
- package/src/presentation/monitor.ts +5 -3
- package/src/presentation/widget.ts +157 -113
- package/src/workflow/acceptance.ts +67 -0
- package/src/workflow/durable.ts +34 -14
- package/src/workflow/engine.ts +161 -51
- package/src/workflow/plan.ts +25 -4
- package/src/workflow/state.ts +6 -0
- package/src/workflow/templates.ts +156 -0
- package/src/workflow/tool.ts +65 -109
- package/skills/workflow/SKILL.md +0 -268
- package/src/workflow/files.ts +0 -236
- package/workflows/code-review.md +0 -38
- package/workflows/migration.md +0 -42
- package/workflows/research.md +0 -48
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,94 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 6.0.1
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- Resolve the child working directory before launching or updating its private
|
|
8
|
+
session header, preserving fallback and follow-ups through macOS path aliases
|
|
9
|
+
and Windows junctions without a cross-project fork prompt.
|
|
10
|
+
- Require Pi SDK 1.4.0 and preserve callable codemode/deferred tools in child
|
|
11
|
+
sessions, including approved read-only tools that register after startup.
|
|
12
|
+
Keep delegation controls model-only and invoke them outside codemode.
|
|
13
|
+
- Add workflow and completed-run follow-up waiting; default all dispatches to
|
|
14
|
+
waiting in one-shot print/JSON sessions. Return final evidence exactly once
|
|
15
|
+
after integration and acceptance, mark awaited failures as tool errors, and
|
|
16
|
+
cancel unfinished work without background wake-ups.
|
|
17
|
+
- Display child RPC steering acknowledgements in the tool card and status,
|
|
18
|
+
including request ID and queued/handled/unknown queue disposition. Distinguish
|
|
19
|
+
receipt from model execution instead of showing only a generic success mark.
|
|
20
|
+
- Cancel unattended RPC input dialogs with an explicit response, preventing
|
|
21
|
+
invisible confirmation or input requests from hanging child execution.
|
|
22
|
+
- Clarify that launch receipts are not task completion and that main resumes
|
|
23
|
+
from child evidence to finish fixes and final checks. Correct interrupted-run
|
|
24
|
+
retirement examples, equal-task ownership guidance, and completed-run
|
|
25
|
+
follow-up recommendations. Reuse the completion waiter across dispatch paths.
|
|
26
|
+
- Deliver unexpected workflow failures through the same final-summary route.
|
|
27
|
+
- Retry brief Windows permission/sharing errors during atomic manifest
|
|
28
|
+
replacement under the existing writer lock, preserving the last checkpoint
|
|
29
|
+
and propagating persistent errors without an unlink/copy fallback.
|
|
30
|
+
|
|
31
|
+
- Contain synchronous Windows process-termination errors and child spawn
|
|
32
|
+
failures with missing stdio, preventing resource errors such as `ENOMEM`,
|
|
33
|
+
`EMFILE`, and `ENFILE` from escaping into the parent Pi process.
|
|
34
|
+
- Default completed-run follow-ups to `context: "auto"`: reuse retained history
|
|
35
|
+
when available, otherwise dispatch with a bounded summary and report the
|
|
36
|
+
fallback. Keep explicit `session` strict, expose available follow-up context
|
|
37
|
+
in status, and give interrupted runs actionable recovery guidance.
|
|
38
|
+
- Bind private session copies to the next run's cwd so follow-ups survive
|
|
39
|
+
removal of an earlier worktree. Preserve the session ID and prior entries,
|
|
40
|
+
and remind continued agents to re-read changed files.
|
|
41
|
+
- Preserve recovery artifacts when manifests or path validation cannot be read.
|
|
42
|
+
Protect live owners during empty-session, age, budget and project cleanup.
|
|
43
|
+
Prune expired checkpoints before restore, keep checkpoints with live owners
|
|
44
|
+
or children, and retain validated paths when a session file is unavailable.
|
|
45
|
+
Recovery inspection errors warn without skipping progress-widget setup.
|
|
46
|
+
- Recheck cancellation and source state before follow-up dispatch, and handle
|
|
47
|
+
a retained transcript disappearing during copying without duplicate launches.
|
|
48
|
+
- Drain settlement-triggered cleanup during shutdown and stop launching new
|
|
49
|
+
sweeps once shutdown begins, avoiding filesystem activity after teardown.
|
|
50
|
+
- Correct the documented five-minute minimum retention under budget pressure
|
|
51
|
+
and distinguish automatic reclamation from explicit storage cleanup.
|
|
52
|
+
|
|
53
|
+
## 6.0.0
|
|
54
|
+
|
|
55
|
+
### Breaking changes
|
|
56
|
+
|
|
57
|
+
- Support only the built-in `code-review`, `research`, and `migration` workflows
|
|
58
|
+
through `workflow` plus `inputs`. Remove inline graphs, custom names, workflow
|
|
59
|
+
files, and user/project workflow discovery. Keep old interrupted records
|
|
60
|
+
readable for recovery.
|
|
61
|
+
- Embed routing guidance and workflow templates in the extension. Remove the
|
|
62
|
+
separately loaded workflow skill and root workflow resource directory.
|
|
63
|
+
|
|
64
|
+
### Changes
|
|
65
|
+
|
|
66
|
+
- Append one mandatory independent sentinel acceptance officer to every
|
|
67
|
+
workflow. Review all settled work and integration evidence, including failed
|
|
68
|
+
branches; require an explicit terminal PASS, and reject missing, ambiguous,
|
|
69
|
+
malformed, or FAIL verdicts. Cancellation skips acceptance.
|
|
70
|
+
- Replace ambiguous graph-source selection with direct built-in input errors.
|
|
71
|
+
Give different template inputs distinct phase identities while retaining
|
|
72
|
+
duplicate ownership for the same deliverable. Preserve brace syntax in task
|
|
73
|
+
inputs as literal text instead of interpreting it as graph dependencies.
|
|
74
|
+
- Redesign the terminal board around work progress, blocking reasons, and a
|
|
75
|
+
separate required-acceptance row. Keep failures visible within the 10-line
|
|
76
|
+
budget, preserve narrow-screen identity, and correct hidden-task counts.
|
|
77
|
+
- Redesign setup as a role selector with focused model/thinking details, using
|
|
78
|
+
side-by-side or stacked layouts. Preserve search, paging, focus, and default
|
|
79
|
+
versus override information. Budget setup height with the host's widget and
|
|
80
|
+
footer so required acceptance remains visible in a 24-row terminal.
|
|
81
|
+
- Preserve managed recovery references when the original checkout is temporarily
|
|
82
|
+
unavailable. Use stable durable identities and cross-process manifest locks
|
|
83
|
+
so separate windows cannot overwrite or delete each other's recovery records.
|
|
84
|
+
Match recovered workflow children by durable identity after local renumbering,
|
|
85
|
+
keep project keys stable through unavailable checkouts with aliased parent paths,
|
|
86
|
+
and exclude lock directories from project scans.
|
|
87
|
+
- Preserve concurrent recovery additions during announcements and keep newly
|
|
88
|
+
settled long-running sessions inside their follow-up retention window.
|
|
89
|
+
- Remove duplicate manifest scans and model-catalog lookups. Stop idle widget
|
|
90
|
+
refreshes and fix zero-width summaries and ANSI-contaminated task labels.
|
|
91
|
+
|
|
3
92
|
## 5.0.6
|
|
4
93
|
|
|
5
94
|
### Changes
|
package/README.md
CHANGED
|
@@ -5,19 +5,22 @@ dependency workflows, and Git worktree isolation.
|
|
|
5
5
|
|
|
6
6
|
## Install
|
|
7
7
|
|
|
8
|
-
Requires **Pi >= 1.
|
|
8
|
+
Requires **Pi >= 1.4.0** and **Node.js >= 22.19.0**. Development and native
|
|
9
|
+
integration tests use the Pi 1.4.0 SDK.
|
|
9
10
|
|
|
10
11
|
```bash
|
|
11
12
|
pi install npm:@ferris1225/pi-subagents
|
|
12
13
|
```
|
|
13
14
|
|
|
14
|
-
Run `/subagents-setup` for a role
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Esc returns without applying a picker selection
|
|
20
|
-
|
|
15
|
+
Run `/subagents-setup` for a role selector and focused settings editor. Wide
|
|
16
|
+
terminals place them side by side; narrow terminals stack them. ↑/↓ changes the
|
|
17
|
+
role, ←/→ selects **Model**, **Thinking**, or **Reset**, and Enter edits it.
|
|
18
|
+
The selected role shows its full model reference, effective reasoning level,
|
|
19
|
+
requested level when clamped, and default/override source. Each selection saves
|
|
20
|
+
immediately; Esc returns without applying a picker selection and keeps focus.
|
|
21
|
+
Model pickers support search, paste, and paging. On short terminals, PgUp/PgDn
|
|
22
|
+
scrolls the settings while the selected role and field stay pinned. Setup
|
|
23
|
+
reserves space for the workflow's required-acceptance row.
|
|
21
24
|
|
|
22
25
|
All roles follow the main model by default; thinking defaults to `low` for scout
|
|
23
26
|
and `high` for artisan, sentinel, and skeptic. The panel distinguishes defaults from overrides and
|
|
@@ -48,9 +51,8 @@ and valid checks, filling gaps rather than repeating main or upstream work.
|
|
|
48
51
|
Only `scout`, `artisan`, `sentinel`, and `skeptic` are valid runtime role names.
|
|
49
52
|
Existing model/thinking settings and interrupted run records migrate on load
|
|
50
53
|
and are saved with the new names. Explicit valid settings under the new names
|
|
51
|
-
win.
|
|
52
|
-
|
|
53
|
-
read-only. New tool calls and inline graphs using retired names are rejected.
|
|
54
|
+
win. Custom roles and user-defined workflows are not supported. Retained records
|
|
55
|
+
from older releases remain available for recovery.
|
|
54
56
|
|
|
55
57
|
Children receive a self-contained brief and project instructions, but no parent
|
|
56
58
|
conversation. They cannot delegate or release. Main owns planning, integration,
|
|
@@ -112,10 +114,21 @@ subagent({
|
|
|
112
114
|
});
|
|
113
115
|
```
|
|
114
116
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
Use `wait: true` when the next step needs the result. `subagent`,
|
|
118
|
+
`subagent_workflow`, and completed-run `subagent_message` follow-ups default to
|
|
119
|
+
waiting in one-shot `pi -p` / JSON sessions, so the parent stays alive until the
|
|
120
|
+
work finishes. TUI and RPC sessions default to background delivery; `wait: false`
|
|
121
|
+
explicitly selects it in any mode. Each result is delivered once, after
|
|
122
|
+
integration, either in the waiting tool call or as a background completion.
|
|
123
|
+
Awaited failures are tool errors with retained evidence.
|
|
124
|
+
|
|
125
|
+
A launch receipt only confirms delegation. Main continues independent work or
|
|
126
|
+
pauses until the completion wakes it, then finishes the requested outcome and
|
|
127
|
+
final checks. It does not poll or treat a successful launch as task completion.
|
|
128
|
+
Use stable `phaseId` values: completed phases stay owned for the parent session,
|
|
129
|
+
and interrupted phases retain ownership across reloads. Equal normalized tasks
|
|
130
|
+
in the same cwd are also rejected, even with a different `phaseId`. Reuse the
|
|
131
|
+
result, or use `subagent_message` for an additional bounded step.
|
|
119
132
|
|
|
120
133
|
Ownership includes main, individual runs, and workflow nodes still waiting on
|
|
121
134
|
dependencies. Main continues only disjoint work and passes its completed research
|
|
@@ -134,63 +147,80 @@ phase/scope ownership; an exact run id also retrieves its retained result for re
|
|
|
134
147
|
|
|
135
148
|
## Workflows
|
|
136
149
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
150
|
+
`subagent_workflow` runs a built-in plan with named task inputs. Its only source
|
|
151
|
+
is the catalog in [templates.ts](./src/workflow/templates.ts): no inline `nodes`,
|
|
152
|
+
`file`, custom graph name, user directory, or project directory is loaded.
|
|
153
|
+
The model's routing rules are embedded in [prompt.ts](./src/delegation/prompt.ts),
|
|
154
|
+
so no separate workflow skill needs to be loaded.
|
|
141
155
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
156
|
+
| Workflow | Work before acceptance | Required inputs |
|
|
157
|
+
| --- | --- | --- |
|
|
158
|
+
| `code-review` | Sentinel inspects the target and produces supported findings | `TARGET` |
|
|
159
|
+
| `research` | Three scouts investigate first-party sources, practice, and the repository; a fourth synthesizes the answer | `QUESTION` |
|
|
160
|
+
| `migration` | Two artisans implement disjoint slices; an integrated gate checks and fixes their combined result | `TARGET`, `CONTRACT`, `CORE_CHANGE`, `ADAPTER_CHANGE`, `CORE_SCOPE`, `CORE_TEST_SCOPE`, `ADAPTER_SCOPE`, `ADAPTER_TEST_SCOPE` |
|
|
147
161
|
|
|
148
162
|
```ts
|
|
149
163
|
subagent_workflow({
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
id: "fix",
|
|
154
|
-
agent: "artisan",
|
|
155
|
-
task: "Fix the refresh race in src/auth and add regression tests. Run the relevant checks.",
|
|
156
|
-
scope: { paths: ["src/auth", "test/auth.test.ts"] },
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
id: "review",
|
|
160
|
-
agent: "sentinel",
|
|
161
|
-
dependsOn: ["fix"],
|
|
162
|
-
task: "Inspect the implementation against the refresh contract and callers. Reuse valid checks and investigate concrete gaps. Do not edit files.\n{{fix}}",
|
|
163
|
-
},
|
|
164
|
-
],
|
|
164
|
+
workflow: "code-review",
|
|
165
|
+
inputs: { TARGET: "HEAD~1..HEAD; inspect the cache invalidation fix" },
|
|
166
|
+
wait: true,
|
|
165
167
|
});
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
`dependsOn` starts a node after its prerequisites complete and integrate.
|
|
169
|
-
`{{id}}` inserts an upstream answer; `.status`, `.runId`, and `.error` expose its
|
|
170
|
-
facts. Long answers include a full-result file. A failed node blocks its
|
|
171
|
-
dependents; independent branches continue. The graph delivers one summary.
|
|
172
168
|
|
|
173
|
-
|
|
174
|
-
|
|
169
|
+
subagent_workflow({
|
|
170
|
+
workflow: "research",
|
|
171
|
+
inputs: { QUESTION: "How should this repository invalidate its HTTP cache?" },
|
|
172
|
+
});
|
|
173
|
+
```
|
|
175
174
|
|
|
176
|
-
|
|
175
|
+
Migration inputs must name the shared interface contract, both slice briefs, and
|
|
176
|
+
exact write paths. Each slice owns its implementation and regression tests;
|
|
177
|
+
shared paths are rejected before any child starts. The integrated gate waits
|
|
178
|
+
for both slices and can edit their combined scope. For example:
|
|
177
179
|
|
|
178
180
|
```ts
|
|
179
|
-
subagent_workflow({
|
|
180
|
-
|
|
181
|
+
subagent_workflow({
|
|
182
|
+
workflow: "migration",
|
|
183
|
+
inputs: {
|
|
184
|
+
TARGET: "the version 2 cache API",
|
|
185
|
+
CONTRACT: "docs/cache-v2.md",
|
|
186
|
+
CORE_CHANGE: "Update storage and its invalidation rules",
|
|
187
|
+
ADAPTER_CHANGE: "Update HTTP callers to the new interface",
|
|
188
|
+
CORE_SCOPE: "src/core",
|
|
189
|
+
CORE_TEST_SCOPE: "test/core",
|
|
190
|
+
ADAPTER_SCOPE: "src/adapters",
|
|
191
|
+
ADAPTER_TEST_SCOPE: "test/adapters",
|
|
192
|
+
},
|
|
193
|
+
});
|
|
181
194
|
```
|
|
182
195
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
node,
|
|
192
|
-
|
|
193
|
-
|
|
196
|
+
Choose a built-in workflow when its fixed phases fit the task. For one bounded
|
|
197
|
+
phase use `subagent`; for independent work use `subagent({ tasks: [...] })`.
|
|
198
|
+
If research must determine the next task or its scope, run it first and decide
|
|
199
|
+
in main. Missing, unknown, or unused template inputs are rejected with the exact
|
|
200
|
+
parameter names before a child starts. Task inputs remain literal, including
|
|
201
|
+
`{{...}}` text.
|
|
202
|
+
|
|
203
|
+
Every workflow ends with an independent **sentinel acceptance officer**. The
|
|
204
|
+
runtime adds this node, waits until all work has settled and integrated, and
|
|
205
|
+
passes a bounded evidence brief plus the complete report. Failed and blocked
|
|
206
|
+
branches are included. The officer reviews the delivered outcome, reuses valid
|
|
207
|
+
checks, and may run focused checks to close evidence gaps. It does not edit or
|
|
208
|
+
release. A successful code review can report defects in the target; acceptance
|
|
209
|
+
judges the accuracy and completeness of that review.
|
|
210
|
+
|
|
211
|
+
The final answer must end with `WORKFLOW_ACCEPTANCE: PASS` or
|
|
212
|
+
`WORKFLOW_ACCEPTANCE: FAIL`. A missing, ambiguous, malformed, or negative verdict
|
|
213
|
+
fails the workflow even when the reviewer process exits normally. A PASS cannot
|
|
214
|
+
clear failures in earlier work. Explicit cancellation or session interruption
|
|
215
|
+
stops the graph without starting acceptance. The graph sends one final summary
|
|
216
|
+
containing its acceptance result, or returns it in the tool call with `wait: true`.
|
|
217
|
+
Waiting includes integration and acceptance, streams progress, and stops owned
|
|
218
|
+
work on parent cancellation without a background wake-up. Main still owns
|
|
219
|
+
remediation, the final gate, and release.
|
|
220
|
+
|
|
221
|
+
Phase identity includes the built-in plan and its inputs. The same deliverable
|
|
222
|
+
remains owned within its workspace; different questions or targets can run in
|
|
223
|
+
the same session. Inspect retained results instead of repeating completed work.
|
|
194
224
|
|
|
195
225
|
## Status, cancellation, and recovery
|
|
196
226
|
|
|
@@ -198,24 +228,26 @@ See the [workflow skill](./skills/workflow/SKILL.md) for graph authoring details
|
|
|
198
228
|
| --- | --- |
|
|
199
229
|
| `subagent_status({ id: 12 })` | Inspect a run's progress, result, and recovery paths |
|
|
200
230
|
| `subagent_status({ workflow: 3 })` | Inspect graph nodes and dependencies |
|
|
201
|
-
| `subagent_message({ id: 12, message: "Check the caller too" })` | Steer a running child, or
|
|
231
|
+
| `subagent_message({ id: 12, message: "Check the caller too" })` | Steer a running child, or continue a completed run using its session when available and a summary otherwise |
|
|
202
232
|
| `subagent_message({ id: 12, message: "Add the test", context: "summary" })` | Start a new next step with only a bounded summary of the earlier run |
|
|
203
233
|
| `subagent_stop({ id: "12" })` | Stop a run and retire its retained session |
|
|
204
234
|
| `subagent_stop({ workflow: 3 })` | Stop a graph and finalize its active nodes |
|
|
205
235
|
| `subagent_stop({ all: true })` | Stop all active runs and graphs |
|
|
206
236
|
|
|
207
|
-
The widget is a
|
|
208
|
-
workflow progress
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
237
|
+
The widget is a terminal task board capped at 10 lines: a quiet overview,
|
|
238
|
+
workflow identity and work progress, then task rows with status/time at the
|
|
239
|
+
right. Failures and blocked reasons get space before optional telemetry; narrow
|
|
240
|
+
terminals keep task identity visible. Model, thinking, token usage, and worktree
|
|
241
|
+
state appear as secondary detail. Each workflow has a separate **Acceptance
|
|
242
|
+
required** row showing pending, running, PASS, or FAIL. Acceptance does not
|
|
243
|
+
inflate the ordinary work count or hidden-task total. Completed work collapses
|
|
244
|
+
into progress while acceptance is pending; a successfully accepted workflow
|
|
245
|
+
hides automatically. Failed or blocked work stays until the next dispatch.
|
|
214
246
|
Completion messages and status lookups retain the results. Overflow reports
|
|
215
|
-
hidden tasks. Runs preparing their child process show `starting`.
|
|
216
|
-
|
|
217
|
-
lock: independent runs start together, including
|
|
218
|
-
another call awaits results.
|
|
247
|
+
hidden tasks. Runs preparing their child process show `starting`. The refresh
|
|
248
|
+
timer runs only while visible active work needs it. There is no process-count
|
|
249
|
+
limit or shared-checkout startup lock: independent runs start together, including
|
|
250
|
+
separate dispatch calls while another call awaits results.
|
|
219
251
|
|
|
220
252
|
Usually omit `isolation`: implementation tasks use detached Git worktrees in
|
|
221
253
|
single calls, parallel batches, and workflows. Reading and review use the current
|
|
@@ -244,22 +276,42 @@ stops unfinished work. New/resume/fork/reload ends old children and retains inte
|
|
|
244
276
|
for manual recovery. Runs do not resume automatically; main finishes incomplete
|
|
245
277
|
work from partial changes and artifacts.
|
|
246
278
|
|
|
247
|
-
A steering
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
279
|
+
A steering call waits for the child's existing RPC channel to acknowledge the
|
|
280
|
+
matching request ID. The tool card shows **Received · queued** when Pi confirms
|
|
281
|
+
queueing, **Received · handled** when an input hook consumes the message, or
|
|
282
|
+
**Accepted · queue state unconfirmed** when no disposition is available.
|
|
283
|
+
`subagent_status` retains the latest acknowledgement, request ID, age, and message
|
|
284
|
+
summary. Rejection or a missing acknowledgement is an error, not a receipt.
|
|
285
|
+
Queueing delivers at a Pi steering boundary; it does not prove that the model
|
|
286
|
+
has executed the instruction.
|
|
287
|
+
|
|
288
|
+
To continue a successfully completed run, choose the context that fits the follow-up:
|
|
289
|
+
|
|
290
|
+
- `context: "auto"` (default) continues a private copy of the retained session
|
|
291
|
+
when available. If cleanup has removed it, the follow-up starts with a bounded
|
|
292
|
+
summary and explicitly reports that full history is unavailable. No retry is
|
|
293
|
+
needed for an expired session.
|
|
294
|
+
- `context: "session"` requires full history for rework that depends on earlier
|
|
295
|
+
details. If the session is unavailable, the call fails without starting a run.
|
|
296
|
+
- `context: "summary"` always starts fresh for a new next step, with the earlier
|
|
297
|
+
objective, final result and touched files. It cannot rely on omitted details
|
|
298
|
+
or reuse the earlier provider cache.
|
|
299
|
+
|
|
300
|
+
Session continuations retain the earlier history and provider prompt-cache key
|
|
301
|
+
(`sessionId`). Their private copy is bound to the new run's working directory,
|
|
302
|
+
including when a previous temporary worktree has already been removed. Child
|
|
303
|
+
startup and the copied session header use the same physical directory, so macOS
|
|
304
|
+
path aliases and Windows junctions do not trigger a cross-project fork prompt.
|
|
305
|
+
The continuation is instructed to re-read files before editing in the current cwd.
|
|
306
|
+
|
|
307
|
+
Every follow-up preserves the role, workspace and scope and passes through normal
|
|
308
|
+
admission and isolation. Set `wait: true` to receive its final result in the same
|
|
309
|
+
call; this waiting option applies to newly started follow-ups, while steering a
|
|
310
|
+
running child returns its acknowledgement. `subagent_status` reports whether a
|
|
311
|
+
completed run has a session available or only summary context. Results and summaries remain
|
|
312
|
+
available within the current parent runtime; completed runs are not restored
|
|
313
|
+
after reload. Pending runs cannot be steered, and fixed workflow graphs cannot
|
|
314
|
+
be edited.
|
|
263
315
|
|
|
264
316
|
Children use Pi's native `--mode rpc` CLI with piped input/output, retries, and
|
|
265
317
|
session persistence. On Windows, console hiding covers the Pi child and Node
|
|
@@ -270,32 +322,70 @@ explicit child extension installs the same policy for runtimes without Node
|
|
|
270
322
|
preloading. Windows launches stay attached so detachment cannot open a console.
|
|
271
323
|
On macOS and Linux, the policy leaves shell options unchanged; the Pi child uses
|
|
272
324
|
a separate process group for cancellation and does not launch a terminal app.
|
|
273
|
-
RPC communication and process-tree cancellation remain active.
|
|
274
|
-
|
|
325
|
+
RPC communication and process-tree cancellation remain active. Child startup
|
|
326
|
+
errors are reported as failed runs. If Windows cannot launch `taskkill`,
|
|
327
|
+
termination falls back to killing the child directly. Commands that explicitly
|
|
328
|
+
open a terminal or GUI control their own windows.
|
|
275
329
|
A settled provider failure can hand off once to the main model in the same
|
|
276
330
|
session. State and full-result files live under
|
|
277
331
|
`~/.pi/agent/ferris-pi-subagents/`, grouped by project. `PI_CODING_AGENT_DIR`
|
|
278
332
|
overrides the agent directory.
|
|
279
333
|
|
|
334
|
+
## Pi codemode compatibility
|
|
335
|
+
|
|
336
|
+
Call `subagent`, `subagent_workflow`, and the control tools directly. They use
|
|
337
|
+
Pi's `model-only` exposure and are intentionally unavailable as nested
|
|
338
|
+
`tools.subagent(...)` calls inside codemode. Children can still use codemode
|
|
339
|
+
with their inherited callable tools. Indirect tools retain their exposure;
|
|
340
|
+
scout promotes approved read-only tools for direct use. It waits up to ten
|
|
341
|
+
seconds for startup registration and activates later arrivals between turns.
|
|
342
|
+
Read-only classification uses Pi tool metadata.
|
|
343
|
+
|
|
344
|
+
Child RPC dialogs that require confirmation, selection, or text input are
|
|
345
|
+
cancelled with a matching response and an explanation, so an unattended child
|
|
346
|
+
does not hang waiting for an invisible dialog. No confirmation is approved
|
|
347
|
+
automatically.
|
|
348
|
+
|
|
280
349
|
## Storage and cleanup
|
|
281
350
|
|
|
282
351
|
Each project root holds `sessions/`, `worktrees/`, `tmp/` and `results/`. Startup
|
|
283
352
|
hygiene already drops temp leftovers, artifacts whose Pi process is gone, result
|
|
284
353
|
files past their retention window, and project roots idle for three days. Parked
|
|
285
|
-
recovery work and
|
|
354
|
+
recovery work and manifest references are protected during these sweeps.
|
|
355
|
+
Interrupted checkpoints expire after 30 days when no recorded owner or child
|
|
356
|
+
from the current boot is alive; expired checkpoints are pruned before restore.
|
|
357
|
+
Missing session files do not erase validated recovery paths. Unreadable or
|
|
358
|
+
malformed manifests leave artifacts intact and skip automatic reclamation;
|
|
359
|
+
explicit cleanup reports the error. Startup warns about failed recovery inspection
|
|
360
|
+
and continues initializing the progress widget.
|
|
286
361
|
|
|
287
362
|
Reclamation is automatic: a settlement may trigger one paced sweep (at most every
|
|
288
363
|
five minutes) that drops dead-owner artifacts, expired result files, and settled
|
|
289
364
|
session copies older than 30 minutes, then trims the oldest settled sessions
|
|
290
|
-
until a project fits its 1.5 GB budget.
|
|
291
|
-
|
|
292
|
-
|
|
365
|
+
until a project fits its 1.5 GB budget. Under budget pressure, settled sessions
|
|
366
|
+
older than five minutes can be removed. Live runs, parked recovery work, and
|
|
367
|
+
manifest references remain protected. Automatic follow-ups use the retained
|
|
368
|
+
summary when a completed run's transcript has expired. Session shutdown waits
|
|
369
|
+
for cleanup already in progress and prevents new settlement sweeps.
|
|
293
370
|
|
|
294
|
-
`/subagents-cleanup`
|
|
295
|
-
and freed bytes
|
|
371
|
+
`/subagents-cleanup` immediately reclaims unclaimed dead-owner artifacts and idle
|
|
372
|
+
project roots, reporting usage and freed bytes. `/subagents-cleanup dry-run`
|
|
373
|
+
measures without deleting anything. Session age and budget reclamation runs
|
|
374
|
+
automatically on settlement.
|
|
296
375
|
|
|
297
376
|
## Development
|
|
298
377
|
|
|
378
|
+
Runtime code lives under `src/`; the package has no skill or workflow resource
|
|
379
|
+
directories. Built-in prompts and plans change with the code and its tests.
|
|
380
|
+
|
|
381
|
+
| Module | Responsibility |
|
|
382
|
+
| --- | --- |
|
|
383
|
+
| `delegation/` | Built-in roles, parent routing prompt, and phase/scope ownership |
|
|
384
|
+
| `workflow/` | Built-in templates, parameter validation, scheduling, and mandatory acceptance |
|
|
385
|
+
| `configuration/` | Model and thinking settings, plus the setup interface |
|
|
386
|
+
| `presentation/` | Running task board, activity, status, and result formatting |
|
|
387
|
+
| `execution/`, `lifecycle/`, `isolation/` | Child processes, durable state, cancellation, worktrees, and recovery |
|
|
388
|
+
|
|
299
389
|
```bash
|
|
300
390
|
npm ci
|
|
301
391
|
npm run check
|
package/index.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - configuration/ — persisted settings, model routes, and setup UI
|
|
8
8
|
* - execution/ — background tasks, native RPC transport, and model handoff
|
|
9
9
|
* - lifecycle/ — durable threads, restoration, controls, and delivery
|
|
10
|
-
* - workflow/ —
|
|
10
|
+
* - workflow/ — built-in plans, dependency runner, and acceptance
|
|
11
11
|
* - isolation/ — Git worktrees, recovery, and temporary-state hygiene
|
|
12
12
|
* - presentation/ — announcements, formatting, monitor, and the active-run
|
|
13
13
|
* widget
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ferris1225/pi-subagents",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "A managed sub-agent team for pi: research, implementation, independent review, interactive follow-ups, and Git worktree isolation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,8 +25,6 @@
|
|
|
25
25
|
"files": [
|
|
26
26
|
"index.ts",
|
|
27
27
|
"src",
|
|
28
|
-
"skills",
|
|
29
|
-
"workflows",
|
|
30
28
|
"README.md",
|
|
31
29
|
"CHANGELOG.md",
|
|
32
30
|
"LICENSE"
|
|
@@ -34,9 +32,6 @@
|
|
|
34
32
|
"pi": {
|
|
35
33
|
"extensions": [
|
|
36
34
|
"./index.ts"
|
|
37
|
-
],
|
|
38
|
-
"skills": [
|
|
39
|
-
"./skills"
|
|
40
35
|
]
|
|
41
36
|
},
|
|
42
37
|
"scripts": {
|
|
@@ -45,9 +40,9 @@
|
|
|
45
40
|
"prepack": "npm run check"
|
|
46
41
|
},
|
|
47
42
|
"peerDependencies": {
|
|
48
|
-
"@earendil-works/pi-ai": ">=1.
|
|
49
|
-
"@earendil-works/pi-coding-agent": ">=1.
|
|
50
|
-
"@earendil-works/pi-tui": ">=1.
|
|
43
|
+
"@earendil-works/pi-ai": ">=1.4.0",
|
|
44
|
+
"@earendil-works/pi-coding-agent": ">=1.4.0",
|
|
45
|
+
"@earendil-works/pi-tui": ">=1.4.0",
|
|
51
46
|
"typebox": "*"
|
|
52
47
|
},
|
|
53
48
|
"devDependencies": {
|
|
@@ -30,8 +30,8 @@ function migrateField(value: unknown, key: string): boolean {
|
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
|
|
33
|
+
/** Retained graph nodes keep their original briefs, ids, and dependencies. */
|
|
34
|
+
function migrateStoredWorkflowRoles(value: unknown): boolean {
|
|
35
35
|
const nodes = Array.isArray(value) ? value : value && typeof value === "object" ? (value as { nodes?: unknown }).nodes : undefined;
|
|
36
36
|
if (!Array.isArray(nodes)) return false;
|
|
37
37
|
let changed = false;
|
|
@@ -53,12 +53,14 @@ function roleModel(ctx: ExtensionContext, config: SubagentsConfig, name: string)
|
|
|
53
53
|
/** One row per role: every model and thinking choice stays visible together. */
|
|
54
54
|
function roleRows(ctx: ExtensionContext, config: SubagentsConfig): RoleGridRow[] {
|
|
55
55
|
const mainRef = currentModelRef(ctx) ?? "Pi default";
|
|
56
|
+
const models = availableModelsInScope(ctx);
|
|
56
57
|
return BUILTIN_AGENT_NAMES.map((name) => {
|
|
57
58
|
const profile = agentProfile(name)!;
|
|
58
59
|
const selected = config.agentModels[name];
|
|
59
|
-
const
|
|
60
|
+
const model = findModelByRef(models, selected);
|
|
61
|
+
const available = !selected || Boolean(model);
|
|
60
62
|
const preferred = config.agentThinkingLevels[name] ?? roleThinkingLevel(name);
|
|
61
|
-
const effective = resolveThinkingLevel(
|
|
63
|
+
const effective = resolveThinkingLevel(model ?? ctx.model, preferred);
|
|
62
64
|
const clamped = effective !== preferred ? " (" + preferred + " requested)" : "";
|
|
63
65
|
const overridden = Boolean(config.agentThinkingLevels[name]);
|
|
64
66
|
return {
|