@vicary/pi-subagents 0.87.0 → 0.88.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.
Files changed (108) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +3 -3
  4. package/bundle/{chunk-3CVOAS77.js → chunk-2DIEL4WG.js} +2 -2
  5. package/bundle/{chunk-75LVXBSA.js → chunk-2HKPEANZ.js} +114 -49
  6. package/bundle/{chunk-ESWW6XSX.js → chunk-47ZN7NKR.js} +1 -1
  7. package/bundle/{chunk-C3KWLXDH.js → chunk-4MVDMA5C.js} +9 -1
  8. package/bundle/{chunk-XV7RTWTS.js → chunk-4ZQBZDF3.js} +21 -6
  9. package/bundle/{chunk-LZKVUWIY.js → chunk-5EMPFFO4.js} +30 -5
  10. package/bundle/{chunk-OOE3R7IQ.js → chunk-6CG2VAG4.js} +2 -2
  11. package/bundle/{chunk-HDICKROY.js → chunk-7OX6O7DQ.js} +31 -14
  12. package/bundle/{chunk-Z4TR7MK6.js → chunk-AZPP3G4N.js} +14 -5
  13. package/bundle/{chunk-PUSTU4Q7.js → chunk-BKISQ5CJ.js} +130 -49
  14. package/bundle/{chunk-NMYBVCGP.js → chunk-CGWNA6EJ.js} +75 -44
  15. package/bundle/{chunk-PGU4TZV3.js → chunk-CPSUJHZE.js} +417 -455
  16. package/bundle/{chunk-W52LJANO.js → chunk-CYKNHFXB.js} +1 -1
  17. package/bundle/{chunk-SIAQXPJ4.js → chunk-D32H53HM.js} +21 -9
  18. package/bundle/{chunk-YEXKJJVS.js → chunk-DSHQWGHO.js} +4 -4
  19. package/bundle/{chunk-6O7YH2QV.js → chunk-GDR2ILWY.js} +1 -1
  20. package/bundle/{chunk-O7A26O6B.js → chunk-IYT7X46U.js} +6 -4
  21. package/bundle/{chunk-NJTSXIMG.js → chunk-JQTHG2ID.js} +12 -12
  22. package/bundle/{chunk-C5QWQSSM.js → chunk-KXW62VBU.js} +1 -1
  23. package/bundle/{chunk-BFF6YDK6.js → chunk-L4YY2TOE.js} +1 -1
  24. package/bundle/{chunk-2NY5PCKQ.js → chunk-LV3CPYXJ.js} +4 -4
  25. package/bundle/{chunk-2D2DQGC2.js → chunk-PYKBTBY6.js} +27 -10
  26. package/bundle/{chunk-M2VBGET6.js → chunk-RMZAAXIR.js} +7 -2
  27. package/bundle/{chunk-HTI7DD5D.js → chunk-V7SZMS6W.js} +2 -2
  28. package/bundle/{chunk-VFUFOZBU.js → chunk-W6HIYD2Z.js} +1 -1
  29. package/bundle/{chunk-USRX7QXD.js → chunk-XIA5GSEU.js} +2 -2
  30. package/bundle/{chunk-CTPAE36Y.js → chunk-YARY7JWU.js} +22 -0
  31. package/bundle/chunk-YDZ7BZD5.js +523 -0
  32. package/bundle/control-channel.js +2 -2
  33. package/bundle/index.js +1 -1
  34. package/bundle/intercom-bridge.js +2 -2
  35. package/bundle/preflight.js +9 -9
  36. package/bundle/project-panes.js +3 -3
  37. package/bundle/required-child-extensions.js +1 -1
  38. package/docs/agents.md +4 -2
  39. package/docs/configuration.md +4 -2
  40. package/docs/observability.md +2 -0
  41. package/docs/tool-reference.md +4 -1
  42. package/docs/workflows.md +3 -1
  43. package/package.json +3 -3
  44. package/skills/pi-subagents/SKILL.md +8 -2
  45. package/src/agents/agent-management.d.ts +1 -0
  46. package/src/agents/agent-management.js +12 -4
  47. package/src/agents/agents.d.ts +1 -0
  48. package/src/agents/agents.js +2 -2
  49. package/src/extension/config.d.ts +9 -0
  50. package/src/extension/config.js +13 -0
  51. package/src/extension/index.d.ts +1 -1
  52. package/src/extension/index.js +47 -23
  53. package/src/extension/schemas.d.ts +2 -0
  54. package/src/extension/schemas.js +1 -0
  55. package/src/extension/subagent-launch-tool.d.ts +6 -2
  56. package/src/extension/subagent-launch-tool.js +13 -9
  57. package/src/extension/tool-activation.js +20 -3
  58. package/src/runs/background/async-resume.js +2 -1
  59. package/src/runs/background/async-retention.d.ts +0 -2
  60. package/src/runs/background/async-retention.js +11 -5
  61. package/src/runs/background/async-status.d.ts +2 -0
  62. package/src/runs/background/async-status.js +4 -0
  63. package/src/runs/background/run-child-session.d.ts +2 -2
  64. package/src/runs/background/run-child-session.js +4 -7
  65. package/src/runs/background/stale-run-reconciler.js +17 -8
  66. package/src/runs/background/steering.d.ts +2 -11
  67. package/src/runs/background/steering.js +11 -6
  68. package/src/runs/background/subagent-runner.d.ts +0 -2
  69. package/src/runs/background/subagent-runner.js +73 -58
  70. package/src/runs/foreground/async-steering-action.js +24 -9
  71. package/src/runs/foreground/execution.js +32 -15
  72. package/src/runs/foreground/prompt-audit.js +1 -0
  73. package/src/runs/foreground/subagent-executor.d.ts +1 -8
  74. package/src/runs/foreground/subagent-executor.js +17 -21
  75. package/src/runs/shared/async-status-projection.d.ts +2 -0
  76. package/src/runs/shared/async-status-projection.js +10 -0
  77. package/src/runs/shared/child-launch.js +6 -3
  78. package/src/runs/shared/child-session.d.ts +1 -1
  79. package/src/runs/shared/child-session.js +24 -30
  80. package/src/runs/shared/mcp-config-sources.d.ts +2 -0
  81. package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +5 -5
  82. package/src/runs/shared/mcp-direct-tool-allowlist.js +26 -15
  83. package/src/runs/shared/subagent-prompt-runtime.js +14 -2
  84. package/src/runs/shared/supervisor-wait-timer.d.ts +16 -0
  85. package/src/runs/shared/supervisor-wait-timer.js +61 -0
  86. package/src/shared/artifacts.d.ts +1 -0
  87. package/src/shared/artifacts.js +107 -9
  88. package/src/shared/compaction-interruption.d.ts +9 -0
  89. package/src/shared/compaction-interruption.js +47 -0
  90. package/src/shared/parent-wake.d.ts +3 -2
  91. package/src/shared/parent-wake.js +14 -3
  92. package/src/shared/reported-progress.d.ts +1 -0
  93. package/src/shared/reported-progress.js +12 -0
  94. package/src/shared/required-child-extensions.d.ts +2 -0
  95. package/src/shared/required-child-extensions.js +27 -0
  96. package/src/shared/status-format.d.ts +1 -0
  97. package/src/shared/status-format.js +1 -1
  98. package/src/shared/types.d.ts +9 -0
  99. package/src/shared/utils.d.ts +3 -1
  100. package/src/shared/utils.js +4 -0
  101. package/src/tui/fleet.d.ts +7 -2
  102. package/src/tui/fleet.js +22 -0
  103. package/src/tui/render.js +33 -2
  104. package/src/watchdog/permission-arbiter.js +1 -0
  105. package/src/watchdog/review.d.ts +0 -5
  106. package/src/watchdog/review.js +2 -1
  107. package/src/workflows/workflow-script-worker.js +3 -1
  108. package/bundle/chunk-XSDYTXHF.js +0 -242
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.88.1] - 2026-11-12
6
+
7
+ ### Highlights
8
+
9
+ - A permission prompt or other dialog that opens while the fleet inspector is up is no longer hidden behind it.
10
+ - Background subagents whose agent has no tool list get your configured MCP tools again, and an extension that registers its own MCP server no longer stops subagents from starting.
11
+ - `status` and `stop` no longer report a cleanly finishing background subagent as having ended without proof.
12
+ - A manual `/compact` no longer wakes an idle parent while background subagents are running.
13
+
14
+ ### Fixed
15
+
16
+ - The fleet inspector no longer covers a dialog that opens while it is up, such as a permission prompt from another extension or a `select`/`confirm`. The inspector steps aside while the dialog is open and comes back, with the same child selected, when it closes. Before, the dialog sat hidden behind the inspector, so `q` seemed to do nothing and Esc answered the hidden prompt. Thanks to [@imLWY](https://github.com/imLWY) for #3254.
17
+ - Background subagents whose agent doesn't list `tools` now get the direct MCP tools you configured in pi-mcp-adapter, as long as no capability ceiling applies. Agents that only set `excludeTools` keep every tool they don't exclude. Before, these subagents lost all direct MCP tools. Thanks to [@acolomba](https://github.com/acolomba) for #3259.
18
+ - A subagent no longer fails to start when one of its required child extensions registers an MCP server with `pi.registerMcpServer()` and the agent selects no `mcp:` tools. Before, the launch stopped with "Required child extension failed during startup". The subagent now runs and shows Pi's message as a warning in its output; any other startup failure of a required extension still stops the launch. With Pi's built-in MCP, foreground subagents can also select `mcp:` tools from servers their required child extensions register; before, every server an extension registered was refused in the foreground. Thanks to [@NicholasSend](https://github.com/NicholasSend) for #3256.
19
+ - `status` and `stop` no longer report a background subagent's exit as `unknown` (`observer-unavailable`) when they are called in the moment between the subagent saving its result and saving its final status. The run now keeps showing `running` until it finishes. Before, a caller waiting for proof that the run ended could see an unverifiable end for a run that exited cleanly. Thanks to [@Ancienttwo](https://github.com/Ancienttwo) for #3258.
20
+ - An extension that changes a workflow child's `task` in its `tool_call` handler for `subagent_launch` now changes what that child is told. Before, the change was dropped and the child got the original text, although Pi applies such changes for every other tool. This covers workflow scripts, `parallel`, `tasks` and `chain`, including steps built from `{previous}`. Other fields and a resumed child's message still can't be changed.
21
+ - With background subagents running, a manual compaction (`/compact`, RPC `compact` or an extension's `ctx.compact()`) no longer starts a turn when the parent was idle or stopped with Esc. Before, every manual compaction resumed the parent, so an extension that compacts on `agent_settled` made it answer "still waiting" each time. A compaction that interrupts a working parent still resumes it. A subagent result that arrives during a compaction now wakes the parent once the compaction ends, instead of starting a run mid-compaction. Thanks to [@IdrisGit](https://github.com/IdrisGit) for #3253 and [@jyshowalter](https://github.com/jyshowalter) for the report. (#3252)
22
+
23
+ ## [0.88.0] - 2026-11-10
24
+
25
+ ### Highlights
26
+
27
+ - The widget and `status` now show the latest progress a running child reported, with how long ago it reported.
28
+ - A child waiting for your answer no longer runs out its `timeoutMs` while it waits, and a reply cut off at the model's output limit now fails instead of passing as a success.
29
+ - Forked subagents stop filling the disk: their copies of the parent session are deleted once they go unused for `cleanupDays`.
30
+ - Big agent catalogs stay small in the conversation: `list` shows at most 30 agents and has a `search` filter.
31
+ - Fixes for pi Desktop workflow scripts, Windows machines that block PowerShell, disabled MCP servers, and gateways that require a prompt cache key.
32
+
33
+ ### Added
34
+
35
+ - The subagent widget shows the latest progress a running child reported with `contact_supervisor` (`progress_update`), with how long ago it reported, and `status` lists it on the child's line. Before, the report text was not shown anywhere in the parent. Thanks to [@kodfodrasz](https://github.com/kodfodrasz) for #3230.
36
+ - `{ action: "list" }` takes an `options.search` filter that matches agent names, descriptions and aliases. Thanks to [@peskycipher](https://github.com/peskycipher) for the report. (#3225)
37
+
38
+ ### Fixed
39
+
40
+ - A run's remaining `timeoutMs` budget no longer changes when the system clock is adjusted. Before, setting the clock back or forward during a run could add that much time to the budget or end the run early. Thanks to [@Osraka](https://github.com/Osraka) for #3247.
41
+ - A subagent run's `timeoutMs` no longer counts the time a child spends waiting for its supervisor to answer a `contact_supervisor` decision or interview, or an `intercom` ask. Before, a child that asked late in a run could time out while it waited, and the run was reported as failed even though the child did the right thing. Thanks to [@adrian-ludwig](https://github.com/adrian-ludwig) for #3228.
42
+ - A subagent whose final reply was cut off at the model's maximum output length now fails with "Response was truncated: the model reached its maximum output length." and keeps the partial reply for inspection. Before, the run was reported as a success with the cut-off text as its answer. A run that already returned a valid `structured_output` still succeeds. Thanks to [@adrian-ludwig](https://github.com/adrian-ludwig) for #3226.
43
+ - With `toolActivation: "auto"`, switching models before the first message now picks the subagent tools for the model you switched to. Before, the choice was made for the startup model, so a session that switched to a model that can't add tools mid-conversation kept the loader, and calling it later made the provider miss its prompt cache. Thanks to [@IdrisGit](https://github.com/IdrisGit) for #3241.
44
+ - A subagent's final acceptance report now reaches the parent intact. Before, a steer or follow-up queued while the child was finishing started another turn after the report, and the parent received that turn's text instead of the report. A steer the child rejects now stays rejected until you resume the child, instead of the child being restarted automatically. Thanks to [@adrian-ludwig](https://github.com/adrian-ludwig) for #3227.
45
+ - The bundled `undici` dependency is now 8.12.4, which fixes the security advisories published against 8.12.3 (cache and redirect information disclosure, credential stripping, a skipped integrity check, and an uncaught exception). Thanks to [@dzervas](https://github.com/dzervas) for the report. (#3242)
46
+ - On Windows machines where policy blocks `powershell.exe`, the cleanup of old background subagent state now finishes. Before, it stopped with `spawn UNKNOWN` and printed the error over the footer every session. A cleanup failure now shows as a warning in Pi instead of raw text over the screen. Thanks to [@SuperSalsa20](https://github.com/SuperSalsa20) for the report. (#3240)
47
+ - Subagents now skip `mcp:` selectors for pi-mcp-adapter servers explicitly configured with `disabled: true`. Before, a disabled server could prevent a child from launching. Unknown servers and enabled servers without matching cached tools still fail the launch. Thanks to [@shura-v](https://github.com/shura-v) for #3238.
48
+ - Workflow scripts start on hosts that run Pi on Electron, such as pi Desktop. Before, Electron left the sandbox flags in the script process's arguments and every workflow script failed with `Cannot find module '--allow-worker'`. Thanks to [@hotsnow-sean](https://github.com/hotsnow-sean) for #3222.
49
+ - A forked subagent (`context: "fork"`) launched in another folder than the parent session now gets that folder's `AGENTS.md` / `CLAUDE.md`. Before, it kept only the parent's project instructions, so a fork started in a repository worktree never saw the repository's `AGENTS.md`.
50
+ - The copies of the parent session that forked subagents write under `<parent session>/forks/` are now deleted once nothing has written to them for `artifactConfig.cleanupDays` (default 7) and their run is no longer active. Before, nothing deleted them; one parent session of about 400 MB filled 22 GB in a day with 57 forks. Resuming a child whose copy was deleted now says so. (#3232)
51
+ - `{ action: "list" }` now shows at most 30 agents and points to `options.search` for the rest. Before, it printed every agent with its full description, so a catalog of a few hundred agents put about 160 KB into the conversation in one call.
52
+ - In a non-interactive session (`pi -p`), Pi now waits for background subagent work at the end of a turn for as long as the `timeoutMs` setting allows a run to take. Before, it always gave up after 30 minutes, so a parent that ended its turn to wait for a longer child failed and exited before the child's result arrived. Without `timeoutMs`, the wait is still 30 minutes. Thanks to [@mt-huerta](https://github.com/mt-huerta) for #3229.
53
+ - The Watchdog's own model requests (reviews and permission decisions) and Prompt Audit's task rewrite now carry the parent session id, so providers that key prompt caching on it get a `prompt_cache_key`. Before, a gateway that requires one rejected every Watchdog review with HTTP 400. Thanks to [@hetingyi](https://github.com/hetingyi) for #3223.
54
+
5
55
  ## [0.87.0] - 2026-11-07
6
56
 
7
57
  ### Highlights
package/bundle/agents.js CHANGED
@@ -2,11 +2,11 @@ import {
2
2
  RUNTIME_AGENT_REGISTER_EVENT,
3
3
  RUNTIME_AGENT_REGISTER_VERSION,
4
4
  registerAgentViaEvents
5
- } from "./chunk-BFF6YDK6.js";
5
+ } from "./chunk-L4YY2TOE.js";
6
6
  import {
7
7
  registerRuntimeAgent
8
- } from "./chunk-C5QWQSSM.js";
9
- import "./chunk-C3KWLXDH.js";
8
+ } from "./chunk-KXW62VBU.js";
9
+ import "./chunk-4MVDMA5C.js";
10
10
  import "./chunk-JEZOSEWG.js";
11
11
  import "./chunk-YFCK7H2S.js";
12
12
  import "./chunk-QXASAHIA.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  resolvePiLaunchToolPlan
3
- } from "./chunk-SIAQXPJ4.js";
4
- import "./chunk-CTPAE36Y.js";
5
- import "./chunk-C3KWLXDH.js";
3
+ } from "./chunk-D32H53HM.js";
4
+ import "./chunk-YARY7JWU.js";
5
+ import "./chunk-4MVDMA5C.js";
6
6
  import "./chunk-JEZOSEWG.js";
7
7
  import "./chunk-YFCK7H2S.js";
8
8
  import "./chunk-QXASAHIA.js";
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-7J4ZXMY7.js";
4
4
  import {
5
5
  getProjectSubagentsDir
6
- } from "./chunk-XSDYTXHF.js";
6
+ } from "./chunk-YDZ7BZD5.js";
7
7
  import {
8
8
  getPiSpawnCommand,
9
9
  writeAtomicJson
10
- } from "./chunk-C3KWLXDH.js";
10
+ } from "./chunk-4MVDMA5C.js";
11
11
 
12
12
  // src/inspectors/herdr/project-panes.ts
13
13
  import * as fs from "node:fs";
@@ -11,10 +11,10 @@ import {
11
11
  startWatchdogDiffBaselineCapture,
12
12
  writeUserWatchdogEnabled,
13
13
  writeWatchdogModelSettings
14
- } from "./chunk-O7A26O6B.js";
14
+ } from "./chunk-IYT7X46U.js";
15
15
  import {
16
16
  resolveGitRepositoryIdentity
17
- } from "./chunk-2NY5PCKQ.js";
17
+ } from "./chunk-LV3CPYXJ.js";
18
18
  import {
19
19
  listAsyncRuns,
20
20
  parallelHandoffPath,
@@ -22,7 +22,7 @@ import {
22
22
  readAsyncRecoveryDescriptor,
23
23
  readWorkflowLaunchRecord,
24
24
  resolveRetainedWorktreeCwd
25
- } from "./chunk-XV7RTWTS.js";
25
+ } from "./chunk-4ZQBZDF3.js";
26
26
  import {
27
27
  ownsRun
28
28
  } from "./chunk-HXRB42AF.js";
@@ -54,21 +54,24 @@ import {
54
54
  resolveMissionStoreLocation,
55
55
  validateMissionId,
56
56
  workflowRunParamsFingerprint
57
- } from "./chunk-PGU4TZV3.js";
57
+ } from "./chunk-CPSUJHZE.js";
58
58
  import {
59
59
  requestAsyncCommand,
60
60
  watchAsyncControlInbox
61
- } from "./chunk-VFUFOZBU.js";
61
+ } from "./chunk-W6HIYD2Z.js";
62
62
  import {
63
63
  supervisorChannelDir
64
- } from "./chunk-SIAQXPJ4.js";
64
+ } from "./chunk-D32H53HM.js";
65
+ import {
66
+ createRequiredChildExtensionIdentity
67
+ } from "./chunk-YARY7JWU.js";
65
68
  import {
66
69
  createHerdrClient,
67
70
  detectHerdr
68
- } from "./chunk-3CVOAS77.js";
71
+ } from "./chunk-2DIEL4WG.js";
69
72
  import {
70
73
  getProjectSubagentsDir
71
- } from "./chunk-XSDYTXHF.js";
74
+ } from "./chunk-YDZ7BZD5.js";
72
75
  import {
73
76
  ExternalJobProviderError,
74
77
  getExternalJobProvider,
@@ -78,10 +81,11 @@ import {
78
81
  } from "./chunk-YYREO77V.js";
79
82
  import {
80
83
  mergeRuntimeAgents
81
- } from "./chunk-C5QWQSSM.js";
84
+ } from "./chunk-KXW62VBU.js";
82
85
  import {
83
86
  CODE_OWNED_EXTERNAL_CLI_ADAPTER_LABEL,
84
87
  EXTERNAL_CLI_ADAPTER_SAFETY,
88
+ MAX_LISTED_AGENTS,
85
89
  PI_CODING_AGENT_PACKAGE,
86
90
  PI_CODING_AGENT_PACKAGE_ROOT_ENV,
87
91
  PROMPT_REDACTED,
@@ -111,6 +115,7 @@ import {
111
115
  mergeBuiltinAgentOverride,
112
116
  normalizeModelSegment,
113
117
  normalizeWorkflowLaneMetadata,
118
+ parseAcceptanceReport,
114
119
  parseFrontmatter,
115
120
  parsePackageName,
116
121
  parseUnquotedList,
@@ -137,7 +142,7 @@ import {
137
142
  withFileLease,
138
143
  writeAtomicJson,
139
144
  writePrivateAtomicJson
140
- } from "./chunk-C3KWLXDH.js";
145
+ } from "./chunk-4MVDMA5C.js";
141
146
  import {
142
147
  DIRS,
143
148
  INTERCOM_DETACH_REQUEST_EVENT,
@@ -165,6 +170,43 @@ import {
165
170
  resolveCurrentSubagentCapabilityCeiling
166
171
  } from "./chunk-QXASAHIA.js";
167
172
 
173
+ // src/shared/compaction-interruption.ts
174
+ var stateSymbol = /* @__PURE__ */ Symbol.for("pi-subagents.compaction-interruption.v1");
175
+ var wrappedSymbol = /* @__PURE__ */ Symbol.for("pi-subagents.compaction-interruption.v1.wrapped");
176
+ var globalStore = globalThis;
177
+ var compactions = globalStore[stateSymbol] ??= /* @__PURE__ */ new WeakMap();
178
+ function installCompactionInterruptionCapture(sessionClass) {
179
+ const prototype = sessionClass.prototype;
180
+ const original = prototype.compact;
181
+ if (original[wrappedSymbol]) return;
182
+ const compact = async function(...args) {
183
+ const manager = this.sessionManager;
184
+ const compaction = compactions.get(manager) ?? { calls: 0, interrupted: false, abortPending: false };
185
+ compactions.set(manager, compaction);
186
+ compaction.calls += 1;
187
+ if (this.isStreaming) compaction.interrupted = compaction.abortPending = true;
188
+ try {
189
+ return await original.apply(this, args);
190
+ } finally {
191
+ if (--compaction.calls === 0) compactions.delete(manager);
192
+ }
193
+ };
194
+ compact[wrappedSymbol] = true;
195
+ prototype.compact = compact;
196
+ }
197
+ function compactionInProgress(sessionManager) {
198
+ return compactions.has(sessionManager);
199
+ }
200
+ function compactionInterruptedRun(sessionManager) {
201
+ return compactions.get(sessionManager)?.interrupted === true;
202
+ }
203
+ function takeCompactionAbort(sessionManager) {
204
+ const compaction = compactions.get(sessionManager);
205
+ if (!compaction?.abortPending) return false;
206
+ compaction.abortPending = false;
207
+ return true;
208
+ }
209
+
168
210
  // src/inspectors/herdr/actions.ts
169
211
  import * as fs from "node:fs";
170
212
  import * as path from "node:path";
@@ -3767,7 +3809,8 @@ function handleList(params, ctx) {
3767
3809
  let scopedAgents = effectiveAgentsForScope(scope, d, ctx.runtimeAgentOwner, ctx.model?.provider);
3768
3810
  scopedAgents = scopedAgents.sort((a, b) => a.name.localeCompare(b.name));
3769
3811
  const capabilityCeiling = resolveCurrentSubagentCapabilityCeiling(ctx.piSessionId);
3770
- const visibleAgents = scopedAgents.filter((a) => !a.disabled);
3812
+ const search = typeof params.search === "string" ? params.search.trim().toLowerCase() : "";
3813
+ const visibleAgents = scopedAgents.filter((a) => !a.disabled && (!search || [a.name, a.description, ...a.aliases ?? []].some((text2) => text2.toLowerCase().includes(search))));
3771
3814
  const agents = visibleAgents.filter((a) => isAgentAllowedByCapabilityCeiling(a.name, capabilityCeiling));
3772
3815
  const restrictedAgents = visibleAgents.filter((a) => !isAgentAllowedByCapabilityCeiling(a.name, capabilityCeiling));
3773
3816
  const restrictedSources = capabilityCeilingAgentRestrictionSources(capabilityCeiling);
@@ -3784,11 +3827,15 @@ function handleList(params, ctx) {
3784
3827
  const knownProviders = knownModelProviders(ctx.modelRegistry);
3785
3828
  const unavailableModels = new Set([...agents, ...restrictedAgents].filter((agent) => (agent.runner?.type ?? "pi") === "pi" && isUnavailableSubagentModel(agent.model, availableModels, agent.modelProvider ?? ctx.model?.provider, knownProviders)));
3786
3829
  const formatLine = capabilityMode ? (agent, names) => formatAgentCapabilitiesLine(agent, names, externalCliAvailability, unavailableModels) : formatAgentListLine;
3830
+ const shownAgents = agents.slice(0, MAX_LISTED_AGENTS);
3831
+ const shownRestrictedAgents = restrictedAgents.slice(0, MAX_LISTED_AGENTS - shownAgents.length);
3832
+ const omittedCount = Math.max(0, agents.length + restrictedAgents.length - MAX_LISTED_AGENTS);
3787
3833
  const lines = [
3788
3834
  capabilityMode ? "Executable agents (capabilities):" : "Executable agents:",
3789
- ...formatAgentListSections(agents, providerNameSet, formatLine)
3835
+ ...formatAgentListSections(shownAgents, providerNameSet, formatLine)
3790
3836
  ];
3791
- appendRestrictedAgentLines({ lines, agents: restrictedAgents, sources: restrictedSources, providerNames: providerNameSet, formatLine });
3837
+ appendRestrictedAgentLines({ lines, agents: shownRestrictedAgents, sources: restrictedSources, providerNames: providerNameSet, formatLine });
3838
+ if (omittedCount > 0) lines.push("", `+${omittedCount} more; narrow with {action:"list", options:{search:"<term>"}}`);
3792
3839
  appendExternalJobRegistryLine(lines, [...agents, ...restrictedAgents], providerStatus);
3793
3840
  appendAgentDiagnosticLines(lines, d.agentDiagnostics);
3794
3841
  if (proactiveSuggestions.length) lines.push("", ...proactiveSuggestions);
@@ -5047,6 +5094,7 @@ function createParentWake(pi, now = Date.now) {
5047
5094
  let ctx;
5048
5095
  let session;
5049
5096
  let held = false;
5097
+ let deferred = false;
5050
5098
  const reservation = () => {
5051
5099
  if (!session) return { sessionId: "" };
5052
5100
  const current = reservations.get(session.manager);
@@ -5069,6 +5117,11 @@ function createParentWake(pi, now = Date.now) {
5069
5117
  pi.sendMessage(message, { triggerTurn: false });
5070
5118
  return true;
5071
5119
  }
5120
+ if (session && compactionInProgress(session.manager)) {
5121
+ deferred = true;
5122
+ pi.sendMessage(message, { triggerTurn: false });
5123
+ return true;
5124
+ }
5072
5125
  if (ctx.isIdle()) reservation().sentAt = now();
5073
5126
  pi.sendMessage(message, options);
5074
5127
  return false;
@@ -5077,19 +5130,21 @@ function createParentWake(pi, now = Date.now) {
5077
5130
  bindSession(context) {
5078
5131
  ctx = context;
5079
5132
  session = { manager: context.sessionManager, id: context.sessionManager.getSessionId() };
5080
- held = false;
5133
+ held = deferred = false;
5081
5134
  },
5082
5135
  agentStarted() {
5083
5136
  reservation().sentAt = void 0;
5084
- held = false;
5137
+ held = deferred = false;
5085
5138
  },
5086
5139
  userAborted: () => {
5087
5140
  held = true;
5088
5141
  },
5089
- releaseHold: () => {
5090
- held = false;
5091
- },
5092
5142
  isHeld: () => held,
5143
+ takeDeferredWake() {
5144
+ const wasDeferred = deferred;
5145
+ deferred = false;
5146
+ return wasDeferred;
5147
+ },
5093
5148
  sessionShutdown(reason) {
5094
5149
  if (reason !== "reload") reservation().sentAt = void 0;
5095
5150
  }
@@ -7328,27 +7383,6 @@ function inheritParentProviders(modelRuntime, parentProviders, claimedProviderId
7328
7383
  var CHILD_PROMPT_RUNTIME_EXTENSION_PATH = "<inline:pi-subagents:prompt-runtime>";
7329
7384
  var CHILD_PROMPT_BOUNDARY_EXTENSION_PATH = "<inline:pi-subagents:prompt-boundary>";
7330
7385
  var PI_UNICODE_SPACES = new RegExp("[\\u00A0\\u2000-\\u200A\\u202F\\u205F\\u3000]", "g");
7331
- function childExtensionFileIdentity(extensionPath) {
7332
- if (!path12.isAbsolute(extensionPath)) return void 0;
7333
- try {
7334
- const stat = fs13.statSync(extensionPath, { bigint: true });
7335
- return stat.isFile() ? `${stat.dev}:${stat.ino}` : void 0;
7336
- } catch {
7337
- return void 0;
7338
- }
7339
- }
7340
- function createRequiredChildExtensionIdentity(requiredPaths) {
7341
- const aliases = new Map([...requiredPaths].map((extensionPath) => [extensionPath, childExtensionFileIdentity(extensionPath) ?? extensionPath]));
7342
- const identities = new Set(aliases.values());
7343
- return (extensionPath) => {
7344
- const known = aliases.get(extensionPath);
7345
- if (known !== void 0) return known;
7346
- const identity = childExtensionFileIdentity(extensionPath);
7347
- if (identity === void 0 || !identities.has(identity)) return void 0;
7348
- aliases.set(extensionPath, identity);
7349
- return identity;
7350
- };
7351
- }
7352
7386
  function orderChildPromptHooks(result5) {
7353
7387
  const runtime = result5.extensions.filter(({ path: path17 }) => path17 === CHILD_PROMPT_RUNTIME_EXTENSION_PATH);
7354
7388
  const boundary = result5.extensions.filter(({ path: path17 }) => path17 === CHILD_PROMPT_BOUNDARY_EXTENSION_PATH);
@@ -7703,7 +7737,7 @@ function createDefaultChildSessionFactory(options = {}) {
7703
7737
  await session2.bindExtensions({
7704
7738
  mode: "print",
7705
7739
  onError: (error2) => {
7706
- if (binding && isRequiredSource(error2.extensionPath)) requiredStartupErrors.push(`${error2.extensionPath} (${error2.event}): ${error2.error}`);
7740
+ if (binding && error2.event !== "register_mcp_server" && isRequiredSource(error2.extensionPath)) requiredStartupErrors.push(`${error2.extensionPath} (${error2.event}): ${error2.error}`);
7707
7741
  launch.onExtensionError?.({ extensionPath: error2.extensionPath, event: error2.event, error: error2.error });
7708
7742
  }
7709
7743
  });
@@ -7756,14 +7790,37 @@ function createDefaultChildSessionFactory(options = {}) {
7756
7790
  mcpWaits.delete(cancel);
7757
7791
  }
7758
7792
  }
7793
+ let reportCompleted = false;
7794
+ const guidanceClosed = "Child completed its acceptance report; resume it for further guidance.";
7795
+ const assertAcceptsGuidance = () => {
7796
+ if (reportCompleted) throw new Error(guidanceClosed);
7797
+ };
7798
+ const rejectQueuedGuidance = () => {
7799
+ session.clearQueue();
7800
+ throw new Error(guidanceClosed);
7801
+ };
7759
7802
  const child = {
7760
- subscribe: (listener) => session.subscribe((event) => listener(event)),
7803
+ subscribe: (listener) => session.subscribe((event) => {
7804
+ if (event.type === "message_end" && event.message.role === "assistant" && event.message.stopReason === "stop") {
7805
+ const text2 = event.message.content.filter((part) => part.type === "text").map((part) => part.text).join("\n");
7806
+ const report = parseAcceptanceReport(text2);
7807
+ if (report.report || report.malformed) {
7808
+ reportCompleted = true;
7809
+ session.clearQueue();
7810
+ session.agent.steer = rejectQueuedGuidance;
7811
+ session.agent.followUp = rejectQueuedGuidance;
7812
+ }
7813
+ }
7814
+ listener(event);
7815
+ }),
7761
7816
  prompt: (text2) => session.prompt(text2),
7762
7817
  ...commands ? { finishCommands: () => commands.finish() } : {},
7763
7818
  steer: async (text2) => {
7819
+ assertAcceptsGuidance();
7764
7820
  await session.steer(text2);
7765
7821
  },
7766
7822
  followUp: async (text2) => {
7823
+ assertAcceptsGuidance();
7767
7824
  await session.followUp(text2);
7768
7825
  },
7769
7826
  abort: () => session.abort(),
@@ -7824,7 +7881,7 @@ function childSessionFactory() {
7824
7881
  }
7825
7882
  function createLazyPlacementFactory(local) {
7826
7883
  let placed;
7827
- const factory = async () => placed ??= (await import("./chunk-YEXKJJVS.js")).createPlacementAwareChildSessionFactory(local);
7884
+ const factory = async () => placed ??= (await import("./chunk-DSHQWGHO.js")).createPlacementAwareChildSessionFactory(local);
7828
7885
  return {
7829
7886
  async create(launch) {
7830
7887
  return launch.machine ? (await factory()).create(launch) : local.create(launch);
@@ -8219,23 +8276,27 @@ function registerSubagentLaunchTool(pi) {
8219
8276
  pi.registerTool({
8220
8277
  name: SUBAGENT_LAUNCH_TOOL,
8221
8278
  label: "Subagent launch",
8222
- description: "A workflow is about to start this subagent. Blocking this call stops that child from starting.",
8279
+ description: "A workflow is about to start this subagent. Blocking this call stops that child from starting; changing its task changes what the child is told.",
8223
8280
  parameters,
8224
8281
  exposure: "deferred",
8225
- async execute() {
8226
- return { content: [{ type: "text", text: "Records approval for a workflow child launch; it starts nothing itself." }], details: {} };
8282
+ // Pi hands execute the input after every tool_call handler ran, so a handler's change to task arrives here.
8283
+ async execute(_toolCallId, params) {
8284
+ return { content: [{ type: "text", text: "Records approval for a workflow child launch; it starts nothing itself." }], details: { task: params.task } };
8227
8285
  }
8228
8286
  });
8229
8287
  }
8230
8288
  async function approveWorkflowChildLaunch(ctx, describe, signal) {
8231
- if (!("executeTool" in ctx)) return void 0;
8289
+ if (!("executeTool" in ctx)) return {};
8232
8290
  const toolCtx = ctx;
8233
- if (!toolCtx.tools.some((tool) => tool.name === SUBAGENT_LAUNCH_TOOL)) return void 0;
8291
+ if (!toolCtx.tools.some((tool) => tool.name === SUBAGENT_LAUNCH_TOOL)) return {};
8234
8292
  const args = describe();
8235
8293
  const outcome = await toolCtx.executeTool(SUBAGENT_LAUNCH_TOOL, args, { signal });
8236
- if (!outcome.isError) return void 0;
8294
+ if (!outcome.isError) {
8295
+ const task = outcome.result.details?.task;
8296
+ return { task: typeof task === "string" ? task : void 0 };
8297
+ }
8237
8298
  const reason = outcome.result.content.flatMap((block) => block.type === "text" ? [block.text] : []).join("\n").trim();
8238
- return `Workflow child '${args.key}' was not started: the ${SUBAGENT_LAUNCH_TOOL} call was refused${reason ? `: ${reason}` : "."}`;
8299
+ return { refusal: `Workflow child '${args.key}' was not started: the ${SUBAGENT_LAUNCH_TOOL} call was refused${reason ? `: ${reason}` : "."}` };
8239
8300
  }
8240
8301
 
8241
8302
  // src/runs/shared/external-job-bridge.ts
@@ -8662,6 +8723,10 @@ function sameProviderDiagnostics(left, right) {
8662
8723
  }
8663
8724
 
8664
8725
  export {
8726
+ installCompactionInterruptionCapture,
8727
+ compactionInProgress,
8728
+ compactionInterruptedRun,
8729
+ takeCompactionAbort,
8665
8730
  getInspectorPlugins,
8666
8731
  registerInspectorEventListener,
8667
8732
  effectiveToolTimeoutMs,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-7F6RKT6W.js";
4
4
  import {
5
5
  getAgentDir
6
- } from "./chunk-C3KWLXDH.js";
6
+ } from "./chunk-4MVDMA5C.js";
7
7
 
8
8
  // src/intercom/intercom-bridge.ts
9
9
  import * as fs from "node:fs";
@@ -4382,7 +4382,7 @@ function formatAvailableAgentLines(agents) {
4382
4382
  const short = description.length > MAX_LISTED_DESCRIPTION_CHARS ? `${description.slice(0, MAX_LISTED_DESCRIPTION_CHARS - 1).trimEnd()}\u2026` : description;
4383
4383
  return `- ${agent.name} (${agent.source})${short ? ` \u2014 ${short}` : ""}`;
4384
4384
  });
4385
- if (sorted.length > MAX_LISTED_AGENTS) lines.push(`+${sorted.length - MAX_LISTED_AGENTS} more; {action:"list"}`);
4385
+ if (sorted.length > MAX_LISTED_AGENTS) lines.push(`+${sorted.length - MAX_LISTED_AGENTS} more; {action:"list", options:{search:"<term>"}}`);
4386
4386
  return lines.length ? lines : ["- (none)"];
4387
4387
  }
4388
4388
  function suggestAgentName(name, agents) {
@@ -7781,6 +7781,10 @@ function getFinalOutput(messages) {
7781
7781
  function getSingleResultOutput(result) {
7782
7782
  return result.finalOutput ?? getFinalOutput(result.messages ?? []);
7783
7783
  }
7784
+ var TRUNCATED_RESPONSE_ERROR = "Response was truncated: the model reached its maximum output length.";
7785
+ function getTerminalAssistantStopReason(messages) {
7786
+ return messages.findLast((message) => message.role === "assistant")?.stopReason;
7787
+ }
7784
7788
  function getDisplayItems(messages) {
7785
7789
  if (!messages || messages.length === 0) return [];
7786
7790
  const items = [];
@@ -8715,6 +8719,8 @@ export {
8715
8719
  assistantMessageError,
8716
8720
  getFinalOutput,
8717
8721
  getSingleResultOutput,
8722
+ TRUNCATED_RESPONSE_ERROR,
8723
+ getTerminalAssistantStopReason,
8718
8724
  getDisplayItems,
8719
8725
  sumResultsUsage,
8720
8726
  toAgentToolUsage,
@@ -8793,6 +8799,7 @@ export {
8793
8799
  resolveEffectiveAcceptance,
8794
8800
  formatReviewGateLabel,
8795
8801
  formatAcceptancePrompt,
8802
+ parseAcceptanceReport,
8796
8803
  stripAcceptanceReport,
8797
8804
  validateAcceptanceReport,
8798
8805
  captureStagedIndexBaseline,
@@ -8828,6 +8835,7 @@ export {
8828
8835
  defaultInheritSkills,
8829
8836
  findBlockingAgentDiagnostic,
8830
8837
  unknownAgentDiagnosticContext,
8838
+ MAX_LISTED_AGENTS,
8831
8839
  formatAvailableAgentLines,
8832
8840
  suggestAgentName,
8833
8841
  formatUnknownAgentError,
@@ -46,16 +46,19 @@ import {
46
46
  validateModelResponseAliases,
47
47
  withWorkflowChildRunModel,
48
48
  withWorktreeTransaction
49
- } from "./chunk-PGU4TZV3.js";
49
+ } from "./chunk-CPSUJHZE.js";
50
50
  import {
51
51
  validateIntercomBridgeConfig
52
- } from "./chunk-ESWW6XSX.js";
52
+ } from "./chunk-47ZN7NKR.js";
53
53
  import {
54
54
  stableJsonDigest
55
55
  } from "./chunk-7F6RKT6W.js";
56
56
  import {
57
57
  snapshotRequiredChildExtensions
58
- } from "./chunk-CTPAE36Y.js";
58
+ } from "./chunk-YARY7JWU.js";
59
+ import {
60
+ missingForkCopyNote
61
+ } from "./chunk-YDZ7BZD5.js";
59
62
  import {
60
63
  DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
61
64
  assertWorkflowLaneKey,
@@ -80,7 +83,7 @@ import {
80
83
  validateToolBudgetConfig,
81
84
  waitForFileSystemRetry,
82
85
  writeAtomicJson
83
- } from "./chunk-C3KWLXDH.js";
86
+ } from "./chunk-4MVDMA5C.js";
84
87
  import {
85
88
  DIRS,
86
89
  RUNNER_LAUNCHER_NAME_PATTERN,
@@ -1241,6 +1244,8 @@ function projectStep(step, index, depth, ctx) {
1241
1244
  const activity = activityFor(step, ctx);
1242
1245
  const { id, label } = stepIdentity(step, index, ctx);
1243
1246
  const agent = publicOptionalText(step.agent, ctx.caps.maxStringLength);
1247
+ const progressText = publicOptionalText(step.progressText, ctx.caps.maxStringLength);
1248
+ const progressUpdatedAt = publicTime(step.progressUpdatedAt);
1244
1249
  const node = {
1245
1250
  id,
1246
1251
  kind: "step",
@@ -1249,7 +1254,9 @@ function projectStep(step, index, depth, ctx) {
1249
1254
  ...startedAt !== void 0 ? { startedAt } : {},
1250
1255
  ...updatedAt !== void 0 ? { updatedAt } : {},
1251
1256
  ...terminalState(state) && endedAt !== void 0 ? { endedAt } : {},
1252
- ...activity ? { activity } : {}
1257
+ ...activity ? { activity } : {},
1258
+ ...progressText ? { progressText } : {},
1259
+ ...progressUpdatedAt !== void 0 ? { progressUpdatedAt } : {}
1253
1260
  };
1254
1261
  if (agent) node.agent = agent;
1255
1262
  setStepModel(node, ctx, step);
@@ -1392,6 +1399,10 @@ function projectMaterializedStep(step, index, child, depth, ctx, childrenByParen
1392
1399
  const selfActivity = selfStep ? activityFor(selfStep, ctx) : void 0;
1393
1400
  const activity = laneActivity || selfActivity || live.activity ? { ...laneActivity, ...selfActivity, ...live.activity } : void 0;
1394
1401
  const node = { ...live, id, kind: "step", label };
1402
+ const progressText = publicOptionalText(selfStep?.progressText ?? step.progressText, ctx.caps.maxStringLength);
1403
+ const progressUpdatedAt = publicTime(selfStep?.progressUpdatedAt ?? step.progressUpdatedAt);
1404
+ if (progressText) node.progressText = progressText;
1405
+ if (progressUpdatedAt !== void 0) node.progressUpdatedAt = progressUpdatedAt;
1395
1406
  const agent = publicOptionalText(selfStep?.agent || step.agent, ctx.caps.maxStringLength);
1396
1407
  if (agent) node.agent = agent;
1397
1408
  if (activity) node.activity = activity;
@@ -2291,6 +2302,8 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
2291
2302
  ...step.currentPath ? { currentPath: step.currentPath } : {},
2292
2303
  ...step.recentTools ? { recentTools: step.recentTools.map((tool) => ({ ...tool })) } : {},
2293
2304
  ...step.recentOutput ? { recentOutput: [...step.recentOutput] } : {},
2305
+ ...step.progressText ? { progressText: step.progressText } : {},
2306
+ ...step.progressUpdatedAt !== void 0 ? { progressUpdatedAt: step.progressUpdatedAt } : {},
2294
2307
  ...step.turnCount !== void 0 ? { turnCount: step.turnCount } : {},
2295
2308
  ...step.toolCount !== void 0 ? { toolCount: step.toolCount } : {},
2296
2309
  ...step.steering ? { steering: step.steering } : {},
@@ -2556,6 +2569,7 @@ function formatStepLine(step) {
2556
2569
  const modelThinking = formatModelThinking(step.model, step.thinking);
2557
2570
  if (modelThinking) parts.push(modelThinking);
2558
2571
  if (step.durationMs !== void 0) parts.push(formatDuration(step.durationMs));
2572
+ if (step.progressText && step.status === "running") parts.push(`progress: ${step.progressText}`);
2559
2573
  if (step.tokens) parts.push(`${formatTokens(step.tokens.total)} tok`);
2560
2574
  if (step.lane) parts.push(`lane ${step.lane.key}`);
2561
2575
  if (step.worktreePath) parts.push(`worktree ${shortenPath(step.worktreePath)} \xB7 branch ${step.branch ?? "unknown"}${step.provider ? ` \xB7 provider ${step.provider}` : ""}`);
@@ -3883,7 +3897,7 @@ function launchedWorktreeCwdWithoutHandoff(runId, launchCwd, launched) {
3883
3897
  function validateResumeSessionFile(runId, sessionFile) {
3884
3898
  if (path8.extname(sessionFile) !== ".jsonl") throw new Error(`Async run '${runId}' session file must be a .jsonl file: ${sessionFile}`);
3885
3899
  const resolved = path8.resolve(sessionFile);
3886
- if (!fs7.existsSync(resolved)) throw new Error(`Async run '${runId}' session file does not exist: ${sessionFile}`);
3900
+ if (!fs7.existsSync(resolved)) throw new Error(`Async run '${runId}' session file does not exist: ${sessionFile}${missingForkCopyNote(resolved)}`);
3887
3901
  return resolved;
3888
3902
  }
3889
3903
  function validateResumeCwd(runId, cwd) {
@@ -4109,6 +4123,7 @@ function opencodeSessionHeaders(model, sessionId) {
4109
4123
  export {
4110
4124
  agentStreamOptions,
4111
4125
  opencodeSessionHeaders,
4126
+ formatActivityAge,
4112
4127
  formatActivityLabel,
4113
4128
  aggregateStepStatus,
4114
4129
  formatAgentRunningLabel,