@vicary/pi-subagents 0.88.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 (44) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/bundle/child-tool-plan.js +2 -2
  3. package/bundle/{chunk-AOSILI5R.js → chunk-2HKPEANZ.js} +75 -40
  4. package/bundle/{chunk-SVIXQDIV.js → chunk-4ZQBZDF3.js} +2 -2
  5. package/bundle/{chunk-YZPVALSQ.js → chunk-5EMPFFO4.js} +3 -3
  6. package/bundle/{chunk-CKLZ5FGU.js → chunk-6CG2VAG4.js} +1 -1
  7. package/bundle/{chunk-6EUQPQY7.js → chunk-7OX6O7DQ.js} +3 -3
  8. package/bundle/{chunk-TDJKY2NE.js → chunk-AZPP3G4N.js} +3 -3
  9. package/bundle/{chunk-BW5JLKIU.js → chunk-BKISQ5CJ.js} +21 -16
  10. package/bundle/{chunk-XZXYPZUT.js → chunk-CGWNA6EJ.js} +46 -28
  11. package/bundle/{chunk-3DT5X2QC.js → chunk-CPSUJHZE.js} +11 -8
  12. package/bundle/{chunk-3MFYKBKI.js → chunk-D32H53HM.js} +3 -3
  13. package/bundle/{chunk-PJSOS2Q4.js → chunk-DSHQWGHO.js} +1 -1
  14. package/bundle/{chunk-JYHTDTOZ.js → chunk-IYT7X46U.js} +2 -2
  15. package/bundle/{chunk-NVGQE2H2.js → chunk-JQTHG2ID.js} +7 -7
  16. package/bundle/{chunk-RHYVKQQL.js → chunk-LV3CPYXJ.js} +2 -2
  17. package/bundle/{chunk-IZEKQEY4.js → chunk-PYKBTBY6.js} +23 -6
  18. package/bundle/{chunk-6PR44R7E.js → chunk-RMZAAXIR.js} +1 -1
  19. package/bundle/{chunk-CTPAE36Y.js → chunk-YARY7JWU.js} +22 -0
  20. package/bundle/index.js +1 -1
  21. package/bundle/preflight.js +4 -4
  22. package/bundle/required-child-extensions.js +1 -1
  23. package/docs/agents.md +4 -2
  24. package/docs/workflows.md +3 -1
  25. package/package.json +2 -2
  26. package/src/extension/index.d.ts +1 -1
  27. package/src/extension/index.js +43 -20
  28. package/src/extension/subagent-launch-tool.d.ts +6 -2
  29. package/src/extension/subagent-launch-tool.js +13 -9
  30. package/src/runs/background/stale-run-reconciler.js +17 -8
  31. package/src/runs/foreground/subagent-executor.js +11 -6
  32. package/src/runs/shared/child-launch.js +6 -3
  33. package/src/runs/shared/child-session.d.ts +1 -1
  34. package/src/runs/shared/child-session.js +3 -27
  35. package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +5 -3
  36. package/src/runs/shared/mcp-direct-tool-allowlist.js +5 -4
  37. package/src/shared/compaction-interruption.d.ts +9 -0
  38. package/src/shared/compaction-interruption.js +47 -0
  39. package/src/shared/parent-wake.d.ts +3 -2
  40. package/src/shared/parent-wake.js +14 -3
  41. package/src/shared/required-child-extensions.d.ts +2 -0
  42. package/src/shared/required-child-extensions.js +27 -0
  43. package/src/tui/fleet.d.ts +7 -2
  44. package/src/tui/fleet.js +22 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
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
+
5
23
  ## [0.88.0] - 2026-11-10
6
24
 
7
25
  ### Highlights
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  resolvePiLaunchToolPlan
3
- } from "./chunk-3MFYKBKI.js";
4
- import "./chunk-CTPAE36Y.js";
3
+ } from "./chunk-D32H53HM.js";
4
+ import "./chunk-YARY7JWU.js";
5
5
  import "./chunk-4MVDMA5C.js";
6
6
  import "./chunk-JEZOSEWG.js";
7
7
  import "./chunk-YFCK7H2S.js";
@@ -11,10 +11,10 @@ import {
11
11
  startWatchdogDiffBaselineCapture,
12
12
  writeUserWatchdogEnabled,
13
13
  writeWatchdogModelSettings
14
- } from "./chunk-JYHTDTOZ.js";
14
+ } from "./chunk-IYT7X46U.js";
15
15
  import {
16
16
  resolveGitRepositoryIdentity
17
- } from "./chunk-RHYVKQQL.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-SVIXQDIV.js";
25
+ } from "./chunk-4ZQBZDF3.js";
26
26
  import {
27
27
  ownsRun
28
28
  } from "./chunk-HXRB42AF.js";
@@ -54,14 +54,17 @@ import {
54
54
  resolveMissionStoreLocation,
55
55
  validateMissionId,
56
56
  workflowRunParamsFingerprint
57
- } from "./chunk-3DT5X2QC.js";
57
+ } from "./chunk-CPSUJHZE.js";
58
58
  import {
59
59
  requestAsyncCommand,
60
60
  watchAsyncControlInbox
61
61
  } from "./chunk-W6HIYD2Z.js";
62
62
  import {
63
63
  supervisorChannelDir
64
- } from "./chunk-3MFYKBKI.js";
64
+ } from "./chunk-D32H53HM.js";
65
+ import {
66
+ createRequiredChildExtensionIdentity
67
+ } from "./chunk-YARY7JWU.js";
65
68
  import {
66
69
  createHerdrClient,
67
70
  detectHerdr
@@ -167,6 +170,43 @@ import {
167
170
  resolveCurrentSubagentCapabilityCeiling
168
171
  } from "./chunk-QXASAHIA.js";
169
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
+
170
210
  // src/inspectors/herdr/actions.ts
171
211
  import * as fs from "node:fs";
172
212
  import * as path from "node:path";
@@ -5054,6 +5094,7 @@ function createParentWake(pi, now = Date.now) {
5054
5094
  let ctx;
5055
5095
  let session;
5056
5096
  let held = false;
5097
+ let deferred = false;
5057
5098
  const reservation = () => {
5058
5099
  if (!session) return { sessionId: "" };
5059
5100
  const current = reservations.get(session.manager);
@@ -5076,6 +5117,11 @@ function createParentWake(pi, now = Date.now) {
5076
5117
  pi.sendMessage(message, { triggerTurn: false });
5077
5118
  return true;
5078
5119
  }
5120
+ if (session && compactionInProgress(session.manager)) {
5121
+ deferred = true;
5122
+ pi.sendMessage(message, { triggerTurn: false });
5123
+ return true;
5124
+ }
5079
5125
  if (ctx.isIdle()) reservation().sentAt = now();
5080
5126
  pi.sendMessage(message, options);
5081
5127
  return false;
@@ -5084,19 +5130,21 @@ function createParentWake(pi, now = Date.now) {
5084
5130
  bindSession(context) {
5085
5131
  ctx = context;
5086
5132
  session = { manager: context.sessionManager, id: context.sessionManager.getSessionId() };
5087
- held = false;
5133
+ held = deferred = false;
5088
5134
  },
5089
5135
  agentStarted() {
5090
5136
  reservation().sentAt = void 0;
5091
- held = false;
5137
+ held = deferred = false;
5092
5138
  },
5093
5139
  userAborted: () => {
5094
5140
  held = true;
5095
5141
  },
5096
- releaseHold: () => {
5097
- held = false;
5098
- },
5099
5142
  isHeld: () => held,
5143
+ takeDeferredWake() {
5144
+ const wasDeferred = deferred;
5145
+ deferred = false;
5146
+ return wasDeferred;
5147
+ },
5100
5148
  sessionShutdown(reason) {
5101
5149
  if (reason !== "reload") reservation().sentAt = void 0;
5102
5150
  }
@@ -7335,27 +7383,6 @@ function inheritParentProviders(modelRuntime, parentProviders, claimedProviderId
7335
7383
  var CHILD_PROMPT_RUNTIME_EXTENSION_PATH = "<inline:pi-subagents:prompt-runtime>";
7336
7384
  var CHILD_PROMPT_BOUNDARY_EXTENSION_PATH = "<inline:pi-subagents:prompt-boundary>";
7337
7385
  var PI_UNICODE_SPACES = new RegExp("[\\u00A0\\u2000-\\u200A\\u202F\\u205F\\u3000]", "g");
7338
- function childExtensionFileIdentity(extensionPath) {
7339
- if (!path12.isAbsolute(extensionPath)) return void 0;
7340
- try {
7341
- const stat = fs13.statSync(extensionPath, { bigint: true });
7342
- return stat.isFile() ? `${stat.dev}:${stat.ino}` : void 0;
7343
- } catch {
7344
- return void 0;
7345
- }
7346
- }
7347
- function createRequiredChildExtensionIdentity(requiredPaths) {
7348
- const aliases = new Map([...requiredPaths].map((extensionPath) => [extensionPath, childExtensionFileIdentity(extensionPath) ?? extensionPath]));
7349
- const identities = new Set(aliases.values());
7350
- return (extensionPath) => {
7351
- const known = aliases.get(extensionPath);
7352
- if (known !== void 0) return known;
7353
- const identity = childExtensionFileIdentity(extensionPath);
7354
- if (identity === void 0 || !identities.has(identity)) return void 0;
7355
- aliases.set(extensionPath, identity);
7356
- return identity;
7357
- };
7358
- }
7359
7386
  function orderChildPromptHooks(result5) {
7360
7387
  const runtime = result5.extensions.filter(({ path: path17 }) => path17 === CHILD_PROMPT_RUNTIME_EXTENSION_PATH);
7361
7388
  const boundary = result5.extensions.filter(({ path: path17 }) => path17 === CHILD_PROMPT_BOUNDARY_EXTENSION_PATH);
@@ -7710,7 +7737,7 @@ function createDefaultChildSessionFactory(options = {}) {
7710
7737
  await session2.bindExtensions({
7711
7738
  mode: "print",
7712
7739
  onError: (error2) => {
7713
- 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}`);
7714
7741
  launch.onExtensionError?.({ extensionPath: error2.extensionPath, event: error2.event, error: error2.error });
7715
7742
  }
7716
7743
  });
@@ -7854,7 +7881,7 @@ function childSessionFactory() {
7854
7881
  }
7855
7882
  function createLazyPlacementFactory(local) {
7856
7883
  let placed;
7857
- const factory = async () => placed ??= (await import("./chunk-PJSOS2Q4.js")).createPlacementAwareChildSessionFactory(local);
7884
+ const factory = async () => placed ??= (await import("./chunk-DSHQWGHO.js")).createPlacementAwareChildSessionFactory(local);
7858
7885
  return {
7859
7886
  async create(launch) {
7860
7887
  return launch.machine ? (await factory()).create(launch) : local.create(launch);
@@ -8249,23 +8276,27 @@ function registerSubagentLaunchTool(pi) {
8249
8276
  pi.registerTool({
8250
8277
  name: SUBAGENT_LAUNCH_TOOL,
8251
8278
  label: "Subagent launch",
8252
- 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.",
8253
8280
  parameters,
8254
8281
  exposure: "deferred",
8255
- async execute() {
8256
- 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 } };
8257
8285
  }
8258
8286
  });
8259
8287
  }
8260
8288
  async function approveWorkflowChildLaunch(ctx, describe, signal) {
8261
- if (!("executeTool" in ctx)) return void 0;
8289
+ if (!("executeTool" in ctx)) return {};
8262
8290
  const toolCtx = ctx;
8263
- 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 {};
8264
8292
  const args = describe();
8265
8293
  const outcome = await toolCtx.executeTool(SUBAGENT_LAUNCH_TOOL, args, { signal });
8266
- 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
+ }
8267
8298
  const reason = outcome.result.content.flatMap((block) => block.type === "text" ? [block.text] : []).join("\n").trim();
8268
- 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}` : "."}` };
8269
8300
  }
8270
8301
 
8271
8302
  // src/runs/shared/external-job-bridge.ts
@@ -8692,6 +8723,10 @@ function sameProviderDiagnostics(left, right) {
8692
8723
  }
8693
8724
 
8694
8725
  export {
8726
+ installCompactionInterruptionCapture,
8727
+ compactionInProgress,
8728
+ compactionInterruptedRun,
8729
+ takeCompactionAbort,
8695
8730
  getInspectorPlugins,
8696
8731
  registerInspectorEventListener,
8697
8732
  effectiveToolTimeoutMs,
@@ -46,7 +46,7 @@ import {
46
46
  validateModelResponseAliases,
47
47
  withWorkflowChildRunModel,
48
48
  withWorktreeTransaction
49
- } from "./chunk-3DT5X2QC.js";
49
+ } from "./chunk-CPSUJHZE.js";
50
50
  import {
51
51
  validateIntercomBridgeConfig
52
52
  } from "./chunk-47ZN7NKR.js";
@@ -55,7 +55,7 @@ import {
55
55
  } from "./chunk-7F6RKT6W.js";
56
56
  import {
57
57
  snapshotRequiredChildExtensions
58
- } from "./chunk-CTPAE36Y.js";
58
+ } from "./chunk-YARY7JWU.js";
59
59
  import {
60
60
  missingForkCopyNote
61
61
  } from "./chunk-YDZ7BZD5.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildWorkflowChatProgressRows
3
- } from "./chunk-RHYVKQQL.js";
3
+ } from "./chunk-LV3CPYXJ.js";
4
4
  import {
5
5
  aggregateStepStatus,
6
6
  contextModeBadge,
@@ -22,7 +22,7 @@ import {
22
22
  projectAsyncWorkflowRows,
23
23
  projectWorkflowChecklist,
24
24
  workflowGraphStageNodes
25
- } from "./chunk-SVIXQDIV.js";
25
+ } from "./chunk-4ZQBZDF3.js";
26
26
  import {
27
27
  isStaleExtensionContextError,
28
28
  isUnboundExtensionRuntimeError,
@@ -34,7 +34,7 @@ import {
34
34
  formatWorkflowJsonPreview,
35
35
  hostStepReportName,
36
36
  hostStepVerdictLabel
37
- } from "./chunk-3DT5X2QC.js";
37
+ } from "./chunk-CPSUJHZE.js";
38
38
  import {
39
39
  snapshotExternalRuns
40
40
  } from "./chunk-UKG4V45O.js";
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "pi-subagents",
4
- version: "0.88.0",
4
+ version: "0.88.1",
5
5
  private: true,
6
6
  description: "Pi extension for single-agent delegation and scripted multi-agent workflows",
7
7
  author: "Nico Bailon",
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  isTrustedRecordedSessionFile,
3
3
  resolveSubagentRunId
4
- } from "./chunk-RHYVKQQL.js";
4
+ } from "./chunk-LV3CPYXJ.js";
5
5
  import {
6
6
  agentStreamOptions,
7
7
  opencodeSessionHeaders,
8
8
  resolveAsyncResumeTarget
9
- } from "./chunk-SVIXQDIV.js";
9
+ } from "./chunk-4ZQBZDF3.js";
10
10
  import {
11
11
  ownsRun
12
12
  } from "./chunk-HXRB42AF.js";
@@ -18,7 +18,7 @@ import {
18
18
  reconcileAsyncRun,
19
19
  resolveAuthorityDecision,
20
20
  resolveMissionStoreLocation
21
- } from "./chunk-3DT5X2QC.js";
21
+ } from "./chunk-CPSUJHZE.js";
22
22
  import {
23
23
  deliverInterruptRequest,
24
24
  queueRevivalBrief,
@@ -14,11 +14,11 @@ import {
14
14
  resolveCurrentSessionId,
15
15
  resolveWatchdogReviewModel,
16
16
  startWatchdogDiffBaselineCapture
17
- } from "./chunk-JYHTDTOZ.js";
17
+ } from "./chunk-IYT7X46U.js";
18
18
  import {
19
19
  agentStreamOptions,
20
20
  opencodeSessionHeaders
21
- } from "./chunk-SVIXQDIV.js";
21
+ } from "./chunk-4ZQBZDF3.js";
22
22
  import {
23
23
  registerNativeSupervisorClient
24
24
  } from "./chunk-CYKNHFXB.js";
@@ -27,7 +27,7 @@ import {
27
27
  } from "./chunk-HXRB42AF.js";
28
28
  import {
29
29
  inheritedNestedRouteOf
30
- } from "./chunk-3DT5X2QC.js";
30
+ } from "./chunk-CPSUJHZE.js";
31
31
  import {
32
32
  CHILD_WATCHDOG_STATUS_EVENT,
33
33
  DEFAULT_WAIT_TOOL_NAME,
@@ -3,7 +3,7 @@ import {
3
3
  projectRuntimeAcknowledgedExtensions,
4
4
  registerSubagentPromptBoundary,
5
5
  registerSubagentPromptRuntime
6
- } from "./chunk-TDJKY2NE.js";
6
+ } from "./chunk-AZPP3G4N.js";
7
7
  import {
8
8
  INSPECTOR_ACTIONS,
9
9
  canQueueRetainedAsyncFollowUp,
@@ -25,7 +25,7 @@ import {
25
25
  updateSteeringTarget,
26
26
  waitForSteeringAction,
27
27
  workflowAsyncChildSteeringGuidance
28
- } from "./chunk-6EUQPQY7.js";
28
+ } from "./chunk-7OX6O7DQ.js";
29
29
  import {
30
30
  PLACED_RESTORE_UNSUPPORTED,
31
31
  formatHerdrMachineRunnerUnsupported,
@@ -119,7 +119,7 @@ import {
119
119
  workflowScriptDigest,
120
120
  workflowStopCause,
121
121
  writeWorkflowReceipt
122
- } from "./chunk-AOSILI5R.js";
122
+ } from "./chunk-2HKPEANZ.js";
123
123
  import {
124
124
  SUBAGENT_PARENT_SESSION_ENV,
125
125
  applyWatchdogLaunchRules,
@@ -132,7 +132,7 @@ import {
132
132
  resolveWatchdogConfig,
133
133
  sendRuleViolationWarning,
134
134
  writeWatchdogModelSettings
135
- } from "./chunk-JYHTDTOZ.js";
135
+ } from "./chunk-IYT7X46U.js";
136
136
  import {
137
137
  MAX_REMEMBERED_FOREGROUND_RUNS,
138
138
  discardRunningForegroundRun,
@@ -145,7 +145,7 @@ import {
145
145
  resolveSubagentRunId,
146
146
  resolveWorkflowChatProgress,
147
147
  stopAsyncRun
148
- } from "./chunk-RHYVKQQL.js";
148
+ } from "./chunk-LV3CPYXJ.js";
149
149
  import {
150
150
  RunFanoutLimitError,
151
151
  annotateWorkflowPreflightTrace,
@@ -206,7 +206,7 @@ import {
206
206
  writeRunFanoutBudgetDescriptor,
207
207
  writeWorkflowLaunchRecord,
208
208
  writeWorktreeSetupHandoff
209
- } from "./chunk-SVIXQDIV.js";
209
+ } from "./chunk-4ZQBZDF3.js";
210
210
  import {
211
211
  NATIVE_SUPERVISOR_TOOL_NAME,
212
212
  createNativeSupervisorChannel,
@@ -253,7 +253,7 @@ import {
253
253
  resolveDisabledFeatureSurface,
254
254
  resolveMaxActiveAsyncRunsPerSession,
255
255
  transferActiveAsyncCapacity
256
- } from "./chunk-6PR44R7E.js";
256
+ } from "./chunk-RMZAAXIR.js";
257
257
  import {
258
258
  DEFAULT_STALE_TERMINAL_ACTIVE_MARKER_MS,
259
259
  MACHINE_DIFF_OPTIONS,
@@ -339,7 +339,7 @@ import {
339
339
  writeNestedControlRequest,
340
340
  writeNestedControlResult,
341
341
  writeNestedEvent
342
- } from "./chunk-3DT5X2QC.js";
342
+ } from "./chunk-CPSUJHZE.js";
343
343
  import {
344
344
  closeSteerInbox,
345
345
  consumeSteerRequests,
@@ -371,14 +371,15 @@ import {
371
371
  resolvePiLaunchToolPlan,
372
372
  resolveRuntimeModulePath,
373
373
  supervisorChannelDir
374
- } from "./chunk-3MFYKBKI.js";
374
+ } from "./chunk-D32H53HM.js";
375
375
  import {
376
376
  assertRequiredChildExtensionsAdmitted,
377
+ createRequiredChildExtensionIdentity,
377
378
  hasMandatoryRequiredChildExtensions,
378
379
  readRetainedRequiredChildExtensions,
379
380
  resolveRequiredChildExtensions,
380
381
  writeRetainedRequiredChildExtensions
381
- } from "./chunk-CTPAE36Y.js";
382
+ } from "./chunk-YARY7JWU.js";
382
383
  import {
383
384
  HERDR_PROJECT_PANE_ACTIONS,
384
385
  handleHerdrProjectPaneAction
@@ -1226,7 +1227,8 @@ function childProcessEnv(input, toolPlan) {
1226
1227
  else if (!toolPlan.capabilityCeiling && input.mcpDirectTools?.length) env[MCP_DIRECT_TOOLS_ENV] = input.mcpDirectTools.join(",");
1227
1228
  else if (toolPlan.capabilityCeiling && toolPlan.effectiveMcpSelections.length && !toolPlan.capabilityCeiling.denyExtensions) {
1228
1229
  env[MCP_DIRECT_TOOLS_ENV] = toolPlan.effectiveMcpSelections.map((selection) => selection.selector).join(",");
1229
- } else env[MCP_DIRECT_TOOLS_ENV] = "__none__";
1230
+ } else if (input.tools === void 0 && !toolPlan.capabilityCeiling) env[MCP_DIRECT_TOOLS_ENV] = void 0;
1231
+ else env[MCP_DIRECT_TOOLS_ENV] = "__none__";
1230
1232
  return env;
1231
1233
  }
1232
1234
  function childStorage(input) {
@@ -1268,7 +1270,8 @@ function buildInProcessChildLaunch(input) {
1268
1270
  runtimeSnapshotHost: input.runtimeSnapshotHost
1269
1271
  });
1270
1272
  if (input.host === "parent" && input.runtimeSnapshotHost && toolPlan.builtinMcpTools?.length) {
1271
- const servers = extensionOnlyMcpServers(toolPlan.effectiveMcpSelections, input.runtimeSnapshotHost, input.cwd, input.projectTrusted !== false);
1273
+ const requiredExtensionIdentity = createRequiredChildExtensionIdentity(toolPlan.requiredExtensions.map(({ path: path19 }) => path19));
1274
+ const servers = extensionOnlyMcpServers(toolPlan.effectiveMcpSelections, input.runtimeSnapshotHost, input.cwd, input.projectTrusted !== false, (extensionPath) => requiredExtensionIdentity(extensionPath) !== void 0);
1272
1275
  if (servers.length) throw new Error(`Agent '${input.childAgentName}' selects MCP tools from servers that extensions registered (${servers.join(", ")}). Only background children (async: true) load those extensions; run the agent in the background or add the server to the global mcp.json or a trusted project's .pi/mcp.json.`);
1273
1276
  }
1274
1277
  toolPlan.capabilityCeiling = intersectSubagentCapabilityCeilings(toolPlan.capabilityCeiling, agentCapabilityCeiling);
@@ -15061,8 +15064,9 @@ Parent action: ${COMPLETION_ACTION}` : content,
15061
15064
  inheritedNestedRoute(deps2)?.rootRunId
15062
15065
  );
15063
15066
  preparedChildParams = childRequest;
15064
- const launchRefusal = await approveWorkflowChildLaunch(ctx, () => workflowChildLaunchArgs(workflowRunId, key, childRequest, childParams.agent, parentCwd, discoverWorkflowAgents), workflowSignal);
15065
- if (launchRefusal) return buildRequestedModeError(childRequest, launchRefusal);
15067
+ const approval = await approveWorkflowChildLaunch(ctx, () => workflowChildLaunchArgs(workflowRunId, key, childRequest, childParams.agent, parentCwd, discoverWorkflowAgents), workflowSignal);
15068
+ if ("refusal" in approval) return buildRequestedModeError(childRequest, approval.refusal);
15069
+ if (approval.task !== void 0 && childRequest.action !== "resume") childRequest.task = approval.task;
15066
15070
  if (workflowUsageBudget.budget) workflowOwnedUsageBudgets.set(childRequest, workflowUsageBudget.budget);
15067
15071
  if (workflowRequiredExtensions) workflowRetainedRequiredExtensions.set(childRequest, workflowRequiredExtensions);
15068
15072
  workflowLaunchObservers.set(childRequest, (launch) => {
@@ -15348,8 +15352,9 @@ Parent action: ${COMPLETION_ACTION}` : content,
15348
15352
  inheritedNestedRoute(deps2)?.rootRunId
15349
15353
  );
15350
15354
  preparedChildParams = childRequest;
15351
- const launchRefusal = await approveWorkflowChildLaunch(ctx, () => workflowChildLaunchArgs(foregroundWorkflowRunId, key, childRequest, childParams.agent, ctx.cwd, discoverWorkflowAgents), workflowSignal);
15352
- if (launchRefusal) return buildRequestedModeError(childRequest, launchRefusal);
15355
+ const approval = await approveWorkflowChildLaunch(ctx, () => workflowChildLaunchArgs(foregroundWorkflowRunId, key, childRequest, childParams.agent, ctx.cwd, discoverWorkflowAgents), workflowSignal);
15356
+ if ("refusal" in approval) return buildRequestedModeError(childRequest, approval.refusal);
15357
+ if (approval.task !== void 0 && childRequest.action !== "resume") childRequest.task = approval.task;
15353
15358
  if (workflowUsageBudget.budget) workflowOwnedUsageBudgets.set(childRequest, workflowUsageBudget.budget);
15354
15359
  if (workflowRequiredExtensions) workflowRetainedRequiredExtensions.set(childRequest, workflowRequiredExtensions);
15355
15360
  if (delegatedWorkflowPermit) {