@ferris1225/pi-subagents 4.3.33 → 5.0.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +32 -349
  2. package/README.md +130 -549
  3. package/index.ts +4 -2
  4. package/package.json +1 -1
  5. package/skills/workflow/SKILL.md +52 -31
  6. package/src/configuration/config.ts +4 -4
  7. package/src/configuration/setup.ts +88 -229
  8. package/src/configuration/ui.ts +107 -129
  9. package/src/delegation/builtin-agents.ts +9 -9
  10. package/src/delegation/dispatch.ts +9 -6
  11. package/src/delegation/prompt.ts +7 -8
  12. package/src/execution/cli-run.ts +364 -0
  13. package/src/execution/process-tree.ts +1 -1
  14. package/src/execution/{rpc-control.ts → run-control.ts} +15 -33
  15. package/src/execution/spawn.ts +33 -185
  16. package/src/isolation/temp-hygiene.ts +2 -3
  17. package/src/lifecycle/cancellation.ts +36 -0
  18. package/src/lifecycle/completion.ts +1 -1
  19. package/src/lifecycle/dispatch-core.ts +0 -1
  20. package/src/lifecycle/durable.ts +1 -1
  21. package/src/lifecycle/runtime.ts +42 -29
  22. package/src/lifecycle/stop.ts +175 -0
  23. package/src/lifecycle/thread-lifecycle.ts +21 -15
  24. package/src/lifecycle/thread-restore.ts +3 -3
  25. package/src/lifecycle/tools.ts +18 -173
  26. package/src/presentation/format.ts +2 -5
  27. package/src/presentation/monitor.ts +16 -1
  28. package/src/presentation/widget.ts +140 -175
  29. package/src/workflow/engine.ts +101 -32
  30. package/src/workflow/files.ts +10 -32
  31. package/src/workflow/plan.ts +61 -13
  32. package/src/workflow/state.ts +4 -3
  33. package/src/workflow/tool.ts +38 -10
  34. package/workflows/code-review.md +12 -7
  35. package/workflows/migration.md +14 -26
  36. package/workflows/research.md +6 -5
  37. package/src/execution/rpc-run.ts +0 -889
package/CHANGELOG.md CHANGED
@@ -1,351 +1,34 @@
1
1
  # Changelog
2
2
 
3
- Release notes for `@ferris1225/pi-subagents`. Only the most recent releases
4
- are kept here; every published version is preserved as a GitHub Release.
5
-
6
- ## 4.3.33
7
-
8
- - Add `subagent_workflow`: declare a graph of phases with `dependsOn` and the
9
- runtime dispatches each node the moment its prerequisites settle and a process
10
- slot frees, without a parent model turn between waves. The graph is validated
11
- before the first child starts (unique ids, existing dependencies, no cycles,
12
- resolvable `{{id}}` placeholders, no declared writer-scope overlap between
13
- nodes no dependency orders), so an invalid plan costs zero child processes.
14
- - Nodes are ordinary one-shot runs: same dispatcher, admission, isolation,
15
- durable checkpointing, and usage accounting. A node's result registers only
16
- after its worktree is integrated, so a dependent reads what its prerequisite
17
- actually left behind.
18
- - A node completion is quiet; the graph reports once. The summary names
19
- completed, failed, and never-ran nodes with the reason, inlines each node's
20
- answer (clipped, with a full-report artifact when anything was cut), and adds a
21
- per-model tally. A failed node blocks only its dependents.
22
- - Saved definitions: `.pi/workflows/<name>.json` or `.md` in a trusted project,
23
- `~/.pi/agent/workflows/` for the user, and `code-review`, `research`, and
24
- `migration` templates shipped with the package. Markdown definitions carry
25
- prose plus one `json` fenced block.
26
- - `subagent_status` accepts `workflow` and reports graph nodes, wait reasons, and
27
- retained graphs; `subagent_stop` accepts `workflow` and stops a graph without
28
- starting its idle dependents. An unfinished graph's shape is retained on disk
29
- for the next session's notice instead of resuming automatically.
30
- - Ship a `workflow` skill with the authoring guidance, and describe the graph
31
- tool in the delegation contract.
32
- ## 4.3.32
33
-
34
- - Derive a role's tools from the live catalog instead of a hardcoded name list.
35
- No role file names extension, MCP, or vendor tools any more: `scout` keeps
36
- every active tool the host proves read-only (`annotations.readOnlyHint`, plus
37
- pi's own `read`, `grep`, `find`, `ls`), so any retrieval extension or MCP
38
- search server works for it without being named. The former `anysearch`,
39
- `anchor_grep`, `web_search`, and `fetch_content` entries are gone.
40
- - Keep a tool that reaches other tools out of a read-only role. `codemode` and
41
- `tool_search` can reach a writer, so scout never receives them even when they
42
- are annotated read-only; broad roles still inherit the session's live surface,
43
- codemode included, and a code-mode parent therefore produces code-mode
44
- children under the same `codemode.mode`.
45
- - Reach read-only MCP tools without reconfiguring the server. A server left at
46
- pi's default `codemode` exposure keeps its tools out of the model's
47
- declarations, so scout previously got nothing from it. It now receives the
48
- read-only ones directly — exactly those, since a named MCP tool also filters the
49
- rest — so a script-only search server works for scout with no `mcp.json` edit,
50
- and the child still cannot reach an MCP writer.
51
- - Keep MCP tools out of a child that names none. pi keeps MCP tools unless a
52
- `--tools` entry names one, so a resolved child list that names none now adds
53
- `mcp__*` to the excluded tools; scout's read-only boundary can no longer leak
54
- an MCP writer.
55
- - Treat tools without a read-only annotation as write-capable for worktree and
56
- repository-lane decisions, instead of trusting a built-in name list.
57
- - Ship the two built-in role prompts as code and drop `agents/` from the
58
- package. Custom role files are gone entirely: nothing is discovered from
59
- `~/.pi/agent/agents/` or `.pi/agents/` any more, `scout` and `artisan` are
60
- always enabled, and a role can no longer declare its own tool list or
61
- isolation default.
62
- - Reduce the config file to `agentModels` and `agentThinkingLevels`.
63
- `enabledAgents`, `knownAgents`, `agentScope`, `maxConcurrentAgents`,
64
- `idleTimeoutSec`, and `maxResultLines` are removed — capacity, idle timeout,
65
- and result length are fixed constants — and obsolete keys in an older file
66
- are dropped on load. `/subagents-setup` now lists the two fixed roles with
67
- their current route and walks model then thinking for one or both.
68
- - Show a code-mode script's first meaningful line in the activity trail instead
69
- of a bare tool name, and drop the remaining vendor tool names from the
70
- formatter.
71
- - Default to delegating instead of requiring a proven benefit first. The
72
- delegation directive and the `subagent` tool description now tell main to
73
- dispatch independent or self-contained work — parallel phases usually beat a
74
- serialized main — and keep only what needs conversation context or is too
75
- small to brief.
76
- - Development dependencies track Pi 1.4.0. The unused
77
- `@earendil-works/pi-server` and `@earendil-works/pi-agent-core` peer and
78
- development dependencies are removed, and the source no longer uses parameter
79
- properties, so `npm test` runs without an experimental flag on Node 26 as well
80
- as Node 22 and 24.
81
- - Drop dead code and tighten the module surface: stale re-exports
82
- (`matchRunIds`, `runInManagedRepositoryLane`, the `rpc-run` passthroughs) and
83
- the never-read `WorktreeSetupError.retainedPaths` are gone, and internal
84
- helpers and tuning constants are no longer exported. No behavior change.
85
-
86
- ## 4.3.31
87
-
88
- - Write the config on first start instead of prompting. A missing
89
- `pi-subagents.json` is created with both roles enabled and no model overrides,
90
- so scout and artisan follow the main model immediately. Session start announces
91
- `/subagents-setup` once; the file's presence keeps later sessions silent. The
92
- first-run confirm dialog is gone.
93
-
94
- ## 4.3.30
95
-
96
- - Restore pi's own footer. The extension no longer replaces the built-in
97
- consumption line with a per-model cost footer, so session spend is shown
98
- exactly as pi reports it.
99
- - Ask for configuration on a fresh install. When `pi-subagents.json` does not
100
- exist, session start announces `/subagents-setup` and offers to open the
101
- wizard immediately instead of only printing a hint.
102
- - The full setup asks each enabled role's thinking level right after its model,
103
- the same model-then-thinking order as _Configure an agent_, instead of leaving
104
- the role default unexamined.
105
-
106
- ## 4.3.29
107
-
108
- - Remove the leftover `steward` and `sentinel` routing. Those roles are no
109
- longer shipped, yet a custom file with either name still received a special
110
- routing rule and lease label; it is now an ordinary custom role, listed by
111
- its catalog line only. Configs without adoption tracking now assume the
112
- shipped two-role catalog.
113
-
114
- ## 4.3.28
115
-
116
- - Deliver a child's whole final answer. When the last assistant message split
117
- its answer into several text blocks (for example around interleaved
118
- thinking), only the first block reached main; every block is now joined.
119
- - Keep only the newest 32k characters of a child's stderr. A chatty or
120
- crash-looping child no longer grows parent memory without bound, and error
121
- toasts are capped to one line; completion blocks and result files still carry
122
- the diagnostic tail.
123
- - Model handoff prompts put the objective in its own block, so a multi-line
124
- brief stays intact instead of being spliced mid-sentence.
125
- - The routing contract's preference line no longer restates the scout and
126
- artisan catalog descriptions word for word.
127
- - Performance: RPC stdout framing is linear in the chunk size, identical
128
- streamed thinking/text deltas no longer re-render the widget, the durable
129
- manifest is rewritten only when a run's session or child pids change instead
130
- of on every child turn, and session-start hygiene validates manifests once.
131
- - Session-start sweeps fail closed: an unreadable manifest skips the deleting
132
- sweeps instead of treating every directory as unclaimed.
133
- - Internal cleanup: one shared process-tree terminator, a single result-row
134
- renderer, and shared usage formatting.
135
-
136
- ## 4.3.27
137
-
138
- - Let `scout` use the `anysearch`/`anysearch_extract` web-retrieval tools. The
139
- role's known-safe read-only set already carried one search extension's tool
140
- ids (`web_search`/`fetch_content`); adding the AnySearch pair lets scout
141
- search and read decisive pages on installs that run that extension instead.
142
- Both tools stay behind the strict intersection with Main's active tools.
143
- - Raise the idle-watchdog default from 90 to 1800 seconds (clamp ceiling 600 →
144
- 3600). A child that goes silent on a long fetch or slow provider is no longer
145
- terminated mid-work; a saved config with the old `idleTimeoutSec` value keeps
146
- overriding the default until edited.
147
-
148
- ## 4.3.26
149
-
150
- - Track Pi 1.3.0 development dependencies. Pi 1.2.0 fires `before_agent_start`
151
- for runs triggered by `sendMessage` too, which this extension already handles
152
- idempotently, and fixes Pi 1.0.x dropping extension-installed system prompt
153
- sections after the first tool call of such a run.
154
- - Narrow `scout` to search only. Its role file and the parent routing line now
155
- say read-only code, documentation, and web lookup with no shell; work that
156
- needs execution stays in main instead of being briefed to a child that cannot
157
- run commands.
158
- - Deliver long results exactly once. A completion that exceeds
159
- `maxResultLines` (or has lines wider than 200 characters) no longer inlines a
160
- truncated copy: the notice states the true size and routes main to the full
161
- Markdown artifact, so the same content never enters the main context twice.
162
- - `subagent_status` answers progress with an activity trail of what each run
163
- has been doing, and no longer dangles child session paths in the
164
- model-facing text. Actionable paths — a truncated run's full-result file and
165
- retained worktree/patch artifacts — remain.
166
- - Remove the advisory `subagent_risk` tool. A path-name classifier cannot
167
- out-judge main reading the integrated diff, and the tool added a call without
168
- adding evidence.
169
-
170
- ## 4.3.24
171
-
172
- - Remove the live `tok/s` throughput figure from the per-model cost footer.
173
- Dividing the message's output tokens by wall-clock stream time could not be
174
- made trustworthy across providers (reasoning tokens, time-to-first-token,
175
- and per-chunk usage semantics differ), and no mainstream agent CLI ships a
176
- comparable live rate. The footer keeps exactly-reported facts only: per-model
177
- token flow, cost, context share, and thinking level.
178
-
179
- ## 4.3.23
180
-
181
- - Track Pi 1.0.3. The extension API, RPC command types, and the child
182
- `registerProvider` path are unchanged. Pi renamed the Azure provider from
183
- `azure-openai-responses` to `azure`; a stored agent model override follows
184
- whichever of those ids the live catalog still lists, and is rewritten to
185
- `azure/<id>` once that is the one Pi reports.
186
-
187
- ## 4.3.22
188
-
189
- - Use a subagent when the work can run independently in parallel, its boundary
190
- is clear, and delegation will actually reduce cost or improve completion
191
- quality. Role choice still prefers scout or artisan when that gate is met.
192
-
193
- ## 4.3.21
194
-
195
- - Ship `scout` and `artisan` only. Scout is the lightweight read-only researcher;
196
- artisan implements one substantial change. Remove the built-in steward and
197
- sentinel roles, their setup profiles, and the sentinel review gate.
198
- - Rewrite the role prompts and the parent delegation section for GPT-6 Astra:
199
- the brief outranks role text, authorized work finishes without a first-draft
200
- pause, and checks stay proportional to the change.
201
- - Ask main to prefer scout and artisan when a fresh context or an independent
202
- parallel phase would help, and to keep small understood edits. Free slots are
203
- not a reason to open another phase.
204
- - Report `subagent_risk` as elevated path risk for main to inspect.
205
-
206
- ## 4.3.20
207
-
208
- - Install the delegation contract as a `<subagents>` prompt section and live
209
- phase leases as `<subagent_leases>`. Pi 1.0 appends a section delta only when
210
- that text changes, so an unchanged turn keeps the cached system prefix.
211
- Hosts without a section map still append the combined directive.
212
- - Declare `subagent`, `subagent_status`, `subagent_stop`, and `subagent_risk`
213
- as `model-only`, with read-only or destructive annotations. Codemode scripts
214
- cannot call them, and they stay declared even when codemode hides `direct`
215
- tools. Dispatch and stop run sequentially so one assistant message cannot
216
- race phase admission.
217
- - Register the child no-retry provider override with the model's `api`. Pi 1.0
218
- rejects a `streamSimple` registration that omits it, which left provider
219
- retries at the user's setting.
220
- - Require Pi 1.0.0. Development dependencies track 1.0.2.
221
-
222
- ## 4.3.19
223
-
224
- - Scope session-start thread restore and recovery notices to the current
225
- checkout. A second pi window in another project no longer announces the first
226
- project's retained worktree, retries its leftover cleanup, or restores and
227
- stops its interrupted children.
228
- - Cover sibling-window isolation with recovery announcement, leftover-cleanup,
229
- and parked-thread restore checks across two checkouts that share one agent dir.
230
-
231
- ## 4.3.18
232
-
233
- - Keep known-context local changes in main and delegate only substantial,
234
- bounded work with a concrete context, exploration, or parallelism benefit.
235
- Available roles and process slots are capacity rather than a team-size target.
236
- - Reserve Steward for remaining cross-cutting cleanup and Sentinel for fresh
237
- verification of concrete concerns. Reuse completed local hygiene and checks.
238
- - Add `maxConcurrentAgents`: `0` preserves automatic host capacity (4–6), and
239
- `1`–`6` selects an explicit process limit. Apply changes at the next dispatch;
240
- lowering capacity drains active work without aborting it. Existing queue,
241
- write-scope, leaf, and recovery protections remain in force.
242
- - Document controlled workload comparisons that include final acceptance,
243
- parent and child costs, integration, failed attempts, and rework.
244
-
245
- ## 4.3.15
246
-
247
- - Fix the cost footer's stale-context crash after reload, new session, resume,
248
- or fork. Remove the module-global event context cache and render against
249
- the installed footer's own live session context. Existing shutdown cleanup
250
- removes the footer and its subscriptions before that context is invalidated.
251
- - Cover replacement-session rendering with Pi's real context invalidation,
252
- subscription cleanup, and live model/thinking/context/session-name updates.
253
-
254
- ## 4.3.13
255
-
256
- - Remove the `subagents N running · …` activity-count line from the footer.
257
- Live progress stays visible in the above-editor widget, per-run completion
258
- notifications, and `subagent_status`; the footer is reserved for the
259
- per-model cost tally.
260
-
261
- ## 4.3.12
262
-
263
- - Replace pi's built-in consumption line with a per-model cost footer for the
264
- main window: each `provider/model` keeps its own token flow, cost, context
265
- share, thinking level, and live `tok/s` throughput, directly under the
266
- current-project line. Settled models rank by spend, cap at three rows, and
267
- drop token flow before truncating under width pressure. The tally reseeds
268
- from the session file on reload.
269
- - Stop attaching awaited children's usage to the `subagent` tool result: pi
270
- folds tool-result usage into one session total, which merged every model's
271
- spend into the main window's consumption. Children keep reporting usage per
272
- run with their model ref when they settle.
273
- - Group parallel completion totals per model instead of summing different
274
- models' costs into one number.
275
-
276
- ## 4.3.11
277
-
278
- - Simplify parent delegation and built-in role prompts using OpenAI's GPT-6 Astra
279
- guidance and Eric Provencher's prompting experience. Keep role descriptions in
280
- the catalog and brief details in tool parameters instead of repeating both.
281
- - Replace fixed search routines, research fan-out, exhaustive cleanup itineraries,
282
- and mandatory per-test red/green demonstrations with outcome-driven work and
283
- change-appropriate verification. Required project gates and meaningful tests remain.
284
- - Clarify that children receive normal Pi project instructions in addition to their
285
- brief. Let writers resolve routine implementation details and complete authorized
286
- work, while preserving explicit scope/approval boundaries and read-only roles.
287
- - Retain one-shot phase ownership, tool restrictions, admission checks, isolation,
288
- cancellation, and recovery. Make stop's destructive, non-resumable behavior explicit
289
- in its own tool description. Model selection and thinking defaults are unchanged.
290
-
291
- ## 4.3.10
292
-
293
- - Add read-only `subagent_status`: list current-session runs or inspect an exact id,
294
- including progress, elapsed time, terminal diagnostics, and retained artifact paths.
295
- Runtime facts use Pi's existing `details.runs`; children do not need strict JSON reports.
296
- - Remove `subagent_control` and all steer/park/resume entry points, continuation
297
- admission, session forking, and resume widget markers. Main handles failed or
298
- incomplete phases; new deliverables get new briefs. Dispatch, automatic completion
299
- delivery, destructive stop, RPC cancellation, and manual worktree recovery remain.
300
- - Keep interrupted worktree edits even when the retained Pi session file is missing.
301
- Manual recovery no longer depends on model context; managed-path validation and
302
- index-preserving Git integration stay intact.
303
- - Record child exits before RPC settlement with their exit code or signal instead
304
- of returning only partial output. Clear stale provider errors after successful Pi
305
- retries, expose missing diagnostic evidence explicitly, and keep individual failed
306
- tool calls separate from a terminal run failure. Preserve safe pre-prompt startup
307
- retries and keep the last recorded cause when that retry budget is exhausted.
308
- - Require Pi 0.85.0 and reuse its exported RPC command/response types. Include its
309
- official server package as a peer and development dependency: the unbundled SDK
310
- and CLI require it at runtime, not only in tests.
311
- - Discover actual built-in/custom role definitions in setup, respecting project
312
- trust. Saving selection removes unavailable names and overrides without retired-role
313
- aliases or config migration; real disabled and never-configured custom roles remain selectable.
314
-
315
- ## 4.3.9
316
-
317
- - Add optional bounded stable `phaseId` and exact declarative write `scope` claims to single
318
- and parallel dispatches. Phase identity is immutable across task rewrites and resume; scope
319
- is monotonic across retained generations and survives durable v1 restore. Exact task+cwd
320
- remains the compatibility fallback.
321
- - Reject deterministic duplicates and declared writer-scope conflicts before parallel batch
322
- allocation. Fresh single and resumed writers also reject normalized absolute scope overlap
323
- with active leases, without requiring equal caller cwd. Parallel calls that omit scope remain
324
- compatible and explicitly report `independence not verified`; declared claims do not prove
325
- natural-language task independence. Scope is conflict metadata, not permissions or a sandbox.
326
- - Add the advisory-only `subagent_risk` tool. Without a model call it resolves the repository
327
- root, reads root-relative tracked and untracked changes from `HEAD`, and applies fixed
328
- explainable rules for concurrency, trust-boundary, persistence-compatibility, and
329
- failure-cancellation risk. It propagates cancellation, and suggests but never dispatches or
330
- requires a Sentinel review.
331
-
332
- ## 4.3.8
333
-
334
- - Restore `sentinel` as an optional fresh-context reviewer instead of the mandatory
335
- pre-commit loop retired in 4.3.5. It reads a completed diff with no memory of how the
336
- change was written, attacks behavior, trust boundaries, failure and cancellation paths,
337
- concurrency, persistence, portability, and whether each test would fail without the
338
- change, runs only the smallest check that proves a suspected defect, and returns
339
- evidence-backed findings as `SEVERITY path:line — failure scenario; evidence; smallest
340
- fix` or `No findings.`
341
- - Route sentinel by risk, not ritual: the delegation directive dispatches it after cleanup
342
- and before commit only for diffs touching concurrency, trust boundaries,
343
- persistence/compatibility, or failure/cancellation paths, or when checks cannot prove
344
- the change, and treats a finding as evidence to route back to the owning thread via
345
- `resume` or fix inline. Artisan keeps proving its own change; main keeps the final gate.
346
- - Sentinel runs on the current main model unless `/subagents-setup` picks one, defaults to
347
- `high` thinking, stays on the shared checkout whose uncommitted diff it reviews (an
348
- explicit `isolation: worktree` is rejected), and holds the repository lane while it
349
- reviews.
350
- - Drop the 4.3.5 retirement filter: configs written by 4.3.5–4.3.7 adopt `sentinel` once
351
- through the built-in adoption rule, and a deliberate disable in setup remains disabled.
3
+ ## 5.0.0
4
+
5
+ ### Breaking changes
6
+
7
+ - Run children through Pi's native `--mode json` CLI instead of the custom RPC
8
+ transport. Pi owns provider adapters, retries, and session persistence.
9
+ - Cancelling the parent stops its child work. Aborted awaited results no longer
10
+ return through background completion.
11
+ - Conversation-tree navigation stops unfinished work. New/resume/fork/reload
12
+ ends old children and retains interrupted artifacts for manual recovery.
13
+
14
+ ### Changes
15
+
16
+ - Restore ordinary subagent completion delivery.
17
+ - Fix workflow isolation, transitive result interpolation, output limits, and
18
+ failure propagation. Checkpoint live graphs and reserve pending phases.
19
+ - Share cancellation and worktree finalization across runs and graphs. Stop all
20
+ writers before waiting for cleanup.
21
+ - Redesign the widget as a 10-line task board with an overview, workflow
22
+ groups, stable status/time columns, and secondary activity/model details.
23
+ Keep task identities and failures visible before optional telemetry; collapse
24
+ completed nodes into progress and share space between groups.
25
+ - Choose delegation from task structure and coordination cost. Keep small work
26
+ in main, use parallel tasks for independent work, and proactively choose a
27
+ workflow for substantial phases with known dependencies. Reassess after
28
+ discovery instead of imposing a research/implementation/review pipeline.
29
+ Keep fixes with their tests and use command-capable roles for reproduction.
30
+ - Replace the setup wizard with a grouped role panel. Edit model and thinking
31
+ separately, restore defaults per role, preserve focus, and show effective
32
+ reasoning levels. Add native input handling for search, paste, and IME.
33
+ - Validate saved definitions before dispatch, reject unfilled templates, and
34
+ honor call-level name and description overrides.