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-ESWW6XSX.js → chunk-47ZN7NKR.js} +1 -1
  6. package/bundle/{chunk-C3KWLXDH.js → chunk-4MVDMA5C.js} +9 -1
  7. package/bundle/{chunk-XV7RTWTS.js → chunk-4ZQBZDF3.js} +21 -6
  8. package/bundle/{chunk-LZKVUWIY.js → chunk-5EMPFFO4.js} +30 -5
  9. package/bundle/{chunk-OOE3R7IQ.js → chunk-6CG2VAG4.js} +2 -2
  10. package/bundle/{chunk-LFKMM3UH.js → chunk-6OWNDN7R.js} +2 -2
  11. package/bundle/{chunk-HDICKROY.js → chunk-7OX6O7DQ.js} +31 -14
  12. package/bundle/{chunk-PGU4TZV3.js → chunk-CPSUJHZE.js} +417 -455
  13. package/bundle/{chunk-W52LJANO.js → chunk-CYKNHFXB.js} +1 -1
  14. package/bundle/{chunk-SIAQXPJ4.js → chunk-D32H53HM.js} +21 -9
  15. package/bundle/{chunk-YEXKJJVS.js → chunk-DSHQWGHO.js} +4 -4
  16. package/bundle/{chunk-DGTZKYIE.js → chunk-FLNDHNPE.js} +75 -44
  17. package/bundle/{chunk-6O7YH2QV.js → chunk-GDR2ILWY.js} +1 -1
  18. package/bundle/{chunk-C5QWQSSM.js → chunk-KXW62VBU.js} +1 -1
  19. package/bundle/{chunk-BFF6YDK6.js → chunk-L4YY2TOE.js} +1 -1
  20. package/bundle/{chunk-2NY5PCKQ.js → chunk-LV3CPYXJ.js} +4 -4
  21. package/bundle/{chunk-AIL46SZU.js → chunk-N6TAAIB3.js} +6 -4
  22. package/bundle/{chunk-EYGBK6CE.js → chunk-PCZEQQAQ.js} +114 -49
  23. package/bundle/{chunk-2D2DQGC2.js → chunk-PYKBTBY6.js} +27 -10
  24. package/bundle/{chunk-M2VBGET6.js → chunk-RMZAAXIR.js} +7 -2
  25. package/bundle/{chunk-OTLDAYEQ.js → chunk-VTUUOLM4.js} +14 -5
  26. package/bundle/{chunk-VFUFOZBU.js → chunk-W6HIYD2Z.js} +1 -1
  27. package/bundle/{chunk-USRX7QXD.js → chunk-XIA5GSEU.js} +2 -2
  28. package/bundle/{chunk-CTPAE36Y.js → chunk-YARY7JWU.js} +22 -0
  29. package/bundle/chunk-YDZ7BZD5.js +523 -0
  30. package/bundle/{chunk-JLDQ6YUR.js → chunk-YQSTGPEU.js} +12 -12
  31. package/bundle/{chunk-OZCPYJEY.js → chunk-ZJ2BT5TI.js} +130 -49
  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 +7 -3
  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 +2 -2
  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 +1 -0
  50. package/src/extension/config.js +6 -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
@@ -3,7 +3,7 @@ import {
3
3
  projectRuntimeAcknowledgedExtensions,
4
4
  registerSubagentPromptBoundary,
5
5
  registerSubagentPromptRuntime
6
- } from "./chunk-OTLDAYEQ.js";
6
+ } from "./chunk-VTUUOLM4.js";
7
7
  import {
8
8
  INSPECTOR_ACTIONS,
9
9
  canQueueRetainedAsyncFollowUp,
@@ -25,12 +25,12 @@ import {
25
25
  updateSteeringTarget,
26
26
  waitForSteeringAction,
27
27
  workflowAsyncChildSteeringGuidance
28
- } from "./chunk-HDICKROY.js";
28
+ } from "./chunk-7OX6O7DQ.js";
29
29
  import {
30
30
  PLACED_RESTORE_UNSUPPORTED,
31
31
  formatHerdrMachineRunnerUnsupported,
32
32
  resolveMachinePlacement
33
- } from "./chunk-6O7YH2QV.js";
33
+ } from "./chunk-GDR2ILWY.js";
34
34
  import {
35
35
  COMPLETION_ACTION,
36
36
  DEFAULT_CONTROL_CONFIG,
@@ -119,7 +119,7 @@ import {
119
119
  workflowScriptDigest,
120
120
  workflowStopCause,
121
121
  writeWorkflowReceipt
122
- } from "./chunk-EYGBK6CE.js";
122
+ } from "./chunk-PCZEQQAQ.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-AIL46SZU.js";
135
+ } from "./chunk-N6TAAIB3.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-2NY5PCKQ.js";
148
+ } from "./chunk-LV3CPYXJ.js";
149
149
  import {
150
150
  RunFanoutLimitError,
151
151
  annotateWorkflowPreflightTrace,
@@ -206,12 +206,12 @@ import {
206
206
  writeRunFanoutBudgetDescriptor,
207
207
  writeWorkflowLaunchRecord,
208
208
  writeWorktreeSetupHandoff
209
- } from "./chunk-XV7RTWTS.js";
209
+ } from "./chunk-4ZQBZDF3.js";
210
210
  import {
211
211
  NATIVE_SUPERVISOR_TOOL_NAME,
212
212
  createNativeSupervisorChannel,
213
213
  resolveSupervisorChannelDir
214
- } from "./chunk-W52LJANO.js";
214
+ } from "./chunk-CYKNHFXB.js";
215
215
  import {
216
216
  MODEL_ONLY_TOOL,
217
217
  inheritedSessionIds,
@@ -234,10 +234,10 @@ import {
234
234
  canPreferFork,
235
235
  createForkContextResolver,
236
236
  resolveSubagentLaunchContext
237
- } from "./chunk-LFKMM3UH.js";
237
+ } from "./chunk-6OWNDN7R.js";
238
238
  import {
239
239
  handleRefinementAction
240
- } from "./chunk-USRX7QXD.js";
240
+ } from "./chunk-XIA5GSEU.js";
241
241
  import {
242
242
  ActiveAsyncCapacityError,
243
243
  acquireActiveAsyncCapacity,
@@ -249,10 +249,11 @@ import {
249
249
  loadConfig,
250
250
  resolveAbandonedSlotReleaseAfterMs,
251
251
  resolveAsyncByDefault,
252
+ resolveConfigDefaultTimeoutMs,
252
253
  resolveDisabledFeatureSurface,
253
254
  resolveMaxActiveAsyncRunsPerSession,
254
255
  transferActiveAsyncCapacity
255
- } from "./chunk-M2VBGET6.js";
256
+ } from "./chunk-RMZAAXIR.js";
256
257
  import {
257
258
  DEFAULT_STALE_TERMINAL_ACTIVE_MARKER_MS,
258
259
  MACHINE_DIFF_OPTIONS,
@@ -338,7 +339,7 @@ import {
338
339
  writeNestedControlRequest,
339
340
  writeNestedControlResult,
340
341
  writeNestedEvent
341
- } from "./chunk-PGU4TZV3.js";
342
+ } from "./chunk-CPSUJHZE.js";
342
343
  import {
343
344
  closeSteerInbox,
344
345
  consumeSteerRequests,
@@ -346,7 +347,7 @@ import {
346
347
  readRevivalBriefs,
347
348
  requestAsyncSteer,
348
349
  watchAsyncControlInbox
349
- } from "./chunk-VFUFOZBU.js";
350
+ } from "./chunk-W6HIYD2Z.js";
350
351
  import "./chunk-NIXWDZZV.js";
351
352
  import {
352
353
  INTERCOM_BRIDGE_MARKER,
@@ -355,7 +356,7 @@ import {
355
356
  resolveIntercomBridge,
356
357
  resolveIntercomSessionTarget,
357
358
  resolveSubagentIntercomTarget
358
- } from "./chunk-ESWW6XSX.js";
359
+ } from "./chunk-47ZN7NKR.js";
359
360
  import {
360
361
  agentDefinitionDigest,
361
362
  resolveLaunchBinding,
@@ -370,18 +371,19 @@ import {
370
371
  resolvePiLaunchToolPlan,
371
372
  resolveRuntimeModulePath,
372
373
  supervisorChannelDir
373
- } from "./chunk-SIAQXPJ4.js";
374
+ } from "./chunk-D32H53HM.js";
374
375
  import {
375
376
  assertRequiredChildExtensionsAdmitted,
377
+ createRequiredChildExtensionIdentity,
376
378
  hasMandatoryRequiredChildExtensions,
377
379
  readRetainedRequiredChildExtensions,
378
380
  resolveRequiredChildExtensions,
379
381
  writeRetainedRequiredChildExtensions
380
- } from "./chunk-CTPAE36Y.js";
382
+ } from "./chunk-YARY7JWU.js";
381
383
  import {
382
384
  HERDR_PROJECT_PANE_ACTIONS,
383
385
  handleHerdrProjectPaneAction
384
- } from "./chunk-3CVOAS77.js";
386
+ } from "./chunk-2DIEL4WG.js";
385
387
  import "./chunk-7J4ZXMY7.js";
386
388
  import {
387
389
  PROJECT_SUBAGENTS_RELATIVE_DIR,
@@ -392,14 +394,15 @@ import {
392
394
  getArtifactsDir,
393
395
  getProjectArtifactPackagingWarning,
394
396
  getProjectSubagentsDir,
397
+ missingForkCopyNote,
395
398
  writeArtifact,
396
399
  writeMetadata
397
- } from "./chunk-XSDYTXHF.js";
400
+ } from "./chunk-YDZ7BZD5.js";
398
401
  import "./chunk-XA3DY6UG.js";
399
402
  import {
400
403
  getExternalJobProvider
401
404
  } from "./chunk-YYREO77V.js";
402
- import "./chunk-C5QWQSSM.js";
405
+ import "./chunk-KXW62VBU.js";
403
406
  import {
404
407
  ChainOutputValidationError,
405
408
  DEFAULT_WAIT_TOOL_NAME,
@@ -414,6 +417,7 @@ import {
414
417
  SUBAGENT_STOPPED_MESSAGE,
415
418
  SUBAGENT_TIMED_OUT_MESSAGE,
416
419
  THINKING_LEVELS,
420
+ TRUNCATED_RESPONSE_ERROR,
417
421
  TYPED_VERIFY_OUTPUT_SCHEMA_CONFLICT,
418
422
  acceptChildWatchdogEvent,
419
423
  acceptanceFailureMessage,
@@ -467,6 +471,7 @@ import {
467
471
  getFinalOutput,
468
472
  getSingleResultOutput,
469
473
  getStepAgents,
474
+ getTerminalAssistantStopReason,
470
475
  hasEmptyTerminalAssistantResponse,
471
476
  hasSingleAdjacentTransposition,
472
477
  hasSingleOutputChangedSinceSnapshot,
@@ -551,7 +556,7 @@ import {
551
556
  writeAtomicJson,
552
557
  writeInitialProgressFile,
553
558
  writePrivateAtomicJson
554
- } from "./chunk-C3KWLXDH.js";
559
+ } from "./chunk-4MVDMA5C.js";
555
560
  import {
556
561
  CHAIN_RUNS_DIR,
557
562
  DEFAULT_ARTIFACT_CONFIG,
@@ -582,7 +587,8 @@ import {
582
587
  wrapForkTask
583
588
  } from "./chunk-JEZOSEWG.js";
584
589
  import {
585
- safeTerminalText
590
+ safeTerminalText,
591
+ sanitizeDisplayText
586
592
  } from "./chunk-YFCK7H2S.js";
587
593
  import "./chunk-62OCY2S4.js";
588
594
  import {
@@ -1221,7 +1227,8 @@ function childProcessEnv(input, toolPlan) {
1221
1227
  else if (!toolPlan.capabilityCeiling && input.mcpDirectTools?.length) env[MCP_DIRECT_TOOLS_ENV] = input.mcpDirectTools.join(",");
1222
1228
  else if (toolPlan.capabilityCeiling && toolPlan.effectiveMcpSelections.length && !toolPlan.capabilityCeiling.denyExtensions) {
1223
1229
  env[MCP_DIRECT_TOOLS_ENV] = toolPlan.effectiveMcpSelections.map((selection) => selection.selector).join(",");
1224
- } 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__";
1225
1232
  return env;
1226
1233
  }
1227
1234
  function childStorage(input) {
@@ -1263,7 +1270,8 @@ function buildInProcessChildLaunch(input) {
1263
1270
  runtimeSnapshotHost: input.runtimeSnapshotHost
1264
1271
  });
1265
1272
  if (input.host === "parent" && input.runtimeSnapshotHost && toolPlan.builtinMcpTools?.length) {
1266
- 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);
1267
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.`);
1268
1276
  }
1269
1277
  toolPlan.capabilityCeiling = intersectSubagentCapabilityCeilings(toolPlan.capabilityCeiling, agentCapabilityCeiling);
@@ -4129,6 +4137,17 @@ function createChildTranscriptWriter(input) {
4129
4137
  };
4130
4138
  }
4131
4139
 
4140
+ // src/shared/reported-progress.ts
4141
+ var MAX_REPORTED_PROGRESS_LENGTH = 512;
4142
+ function extractReportedProgress(toolName, args) {
4143
+ if (toolName !== "contact_supervisor" || typeof args !== "object" || args === null) return void 0;
4144
+ const call = args;
4145
+ if (call.reason !== "progress_update" || typeof call.message !== "string") return void 0;
4146
+ const firstLine = call.message.split(/\r?\n/, 1)[0] ?? "";
4147
+ const sanitized = sanitizeDisplayText(firstLine).replace(/^(?:progress|update):\s*/i, "");
4148
+ return sanitized ? sanitized.slice(0, MAX_REPORTED_PROGRESS_LENGTH) : void 0;
4149
+ }
4150
+
4132
4151
  // src/runs/shared/partial-output.ts
4133
4152
  function isAssistant(message) {
4134
4153
  return !!message && typeof message === "object" && message.role === "assistant";
@@ -5124,6 +5143,59 @@ function reconcileAttemptUsage(live, messages, baseline) {
5124
5143
  return reconciled;
5125
5144
  }
5126
5145
 
5146
+ // src/runs/shared/supervisor-wait-timer.ts
5147
+ function isBlockingSupervisorTool(toolName, args) {
5148
+ if (!args || typeof args !== "object") return false;
5149
+ const call = args;
5150
+ if (toolName === "contact_supervisor") return call.reason === "need_decision" || call.reason === "interview_request";
5151
+ return toolName === "intercom" && call.action === "ask";
5152
+ }
5153
+ function startPausableTimer(delayMs, onFire) {
5154
+ let remaining = Math.max(0, delayMs);
5155
+ let runningSince;
5156
+ let timer;
5157
+ let done = false;
5158
+ const pausedBy = /* @__PURE__ */ new Set();
5159
+ const remainingMs = () => runningSince === void 0 ? remaining : Math.max(0, remaining - (performance.now() - runningSince));
5160
+ const run = () => {
5161
+ runningSince = performance.now();
5162
+ timer = setTimeout(() => {
5163
+ done = true;
5164
+ runningSince = void 0;
5165
+ remaining = 0;
5166
+ onFire();
5167
+ }, remaining);
5168
+ timer.unref?.();
5169
+ };
5170
+ const stop = () => {
5171
+ clearTimeout(timer);
5172
+ remaining = remainingMs();
5173
+ runningSince = void 0;
5174
+ };
5175
+ run();
5176
+ return {
5177
+ pause(key) {
5178
+ if (done) return;
5179
+ if (pausedBy.size === 0) stop();
5180
+ pausedBy.add(key);
5181
+ },
5182
+ resume(key) {
5183
+ if (done || !pausedBy.delete(key) || pausedBy.size > 0) return;
5184
+ run();
5185
+ },
5186
+ remainingMs,
5187
+ clear() {
5188
+ done = true;
5189
+ stop();
5190
+ }
5191
+ };
5192
+ }
5193
+ function pauseForSupervisorWait(timer, event) {
5194
+ if (!timer || typeof event.toolCallId !== "string") return;
5195
+ if (event.type === "tool_execution_start" && isBlockingSupervisorTool(event.toolName, event.args)) timer.pause(event.toolCallId);
5196
+ else if (event.type === "tool_execution_end") timer.resume(event.toolCallId);
5197
+ }
5198
+
5127
5199
  // src/runs/foreground/execution.ts
5128
5200
  var artifactOutputByResult = /* @__PURE__ */ new WeakMap();
5129
5201
  var acceptanceOutputByResult = /* @__PURE__ */ new WeakMap();
@@ -5272,6 +5344,8 @@ function captureStructuredDelegationProgressState(progress, result2) {
5272
5344
  recentOutput: [...progress.recentOutput],
5273
5345
  recentTools: progress.recentTools.slice(-MAX_STREAMED_RECENT_TOOLS).map(({ tool, args }) => ({ tool, args })),
5274
5346
  activityState: progress.activityState,
5347
+ progressText: progress.progressText,
5348
+ progressUpdatedAt: progress.progressUpdatedAt,
5275
5349
  model: progress.model ?? result2.model,
5276
5350
  toolCount: progress.toolCount,
5277
5351
  tokens: progress.tokens,
@@ -5279,7 +5353,7 @@ function captureStructuredDelegationProgressState(progress, result2) {
5279
5353
  };
5280
5354
  }
5281
5355
  function structuredDelegationProgressChanged(previous, progress, result2) {
5282
- if (previous.providerDiagnostics !== progress.providerDiagnostics || previous.currentTool !== progress.currentTool || previous.currentToolArgs !== progress.currentToolArgs || previous.activityState !== progress.activityState || previous.model !== (progress.model ?? result2.model) || previous.toolCount !== progress.toolCount || previous.tokens !== progress.tokens || previous.turnCount !== progress.turnCount || previous.recentOutput.length !== progress.recentOutput.length) return true;
5356
+ if (previous.providerDiagnostics !== progress.providerDiagnostics || previous.currentTool !== progress.currentTool || previous.currentToolArgs !== progress.currentToolArgs || previous.activityState !== progress.activityState || previous.progressText !== progress.progressText || previous.progressUpdatedAt !== progress.progressUpdatedAt || previous.model !== (progress.model ?? result2.model) || previous.toolCount !== progress.toolCount || previous.tokens !== progress.tokens || previous.turnCount !== progress.turnCount || previous.recentOutput.length !== progress.recentOutput.length) return true;
5283
5357
  for (let index = 0; index < progress.recentOutput.length; index++) {
5284
5358
  if (previous.recentOutput[index] !== progress.recentOutput[index]) return true;
5285
5359
  }
@@ -5297,6 +5371,7 @@ function isCompleteUsageCounter(value) {
5297
5371
  }
5298
5372
  var STOPPED_BEFORE_COMPLETION_ERROR = "Subagent stopped before completion.";
5299
5373
  var AFTER_COMPACTION_SETTLEMENT = /* @__PURE__ */ Symbol("afterCompactionSettlement");
5374
+ var REMAINING_TIMEOUT_MS = /* @__PURE__ */ Symbol("remainingTimeoutMs");
5300
5375
  async function runSingleAttempt(runtimeCwd, agent, task, model, options, shared) {
5301
5376
  const effectiveThinking = options.thinkingOverride ?? agent.thinking;
5302
5377
  const modelArg = applyThinkingSuffix(model, effectiveThinking, options.thinkingOverride !== void 0);
@@ -5482,6 +5557,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
5482
5557
  let toolAvailabilityError;
5483
5558
  let abortedBySignal = options.signal?.aborted === true;
5484
5559
  let afterCompactionSettlement = false;
5560
+ let remainingTimeoutMs;
5485
5561
  if (options.workflowChildPermitLaunch) {
5486
5562
  const permitError = consumeWorkflowChildPermit(options.workflowChildPermitLaunch.permit, {
5487
5563
  workflowRunId: options.workflowChildPermitLaunch.workflowRunId,
@@ -5523,7 +5599,8 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
5523
5599
  let timeoutHardFinishTimer;
5524
5600
  const clearTimeoutTimers = () => {
5525
5601
  if (timeoutTimer) {
5526
- clearTimeout(timeoutTimer);
5602
+ remainingTimeoutMs = timeoutTimer.remainingMs();
5603
+ timeoutTimer.clear();
5527
5604
  timeoutTimer = void 0;
5528
5605
  }
5529
5606
  if (timeoutHardFinishTimer) {
@@ -5981,6 +6058,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
5981
6058
  progress.durationMs = now - startTime;
5982
6059
  progress.lastActivityAt = now;
5983
6060
  updateActivityState(now);
6061
+ pauseForSupervisorWait(timeoutTimer, evt);
5984
6062
  if (evt.type === "tool_execution_start") {
5985
6063
  const toolArgs = evt.args && typeof evt.args === "object" && !Array.isArray(evt.args) ? evt.args : {};
5986
6064
  const activeTool = evt.toolName !== void 0 ? recordActiveToolCall(evt, toolArgs, now) : void 0;
@@ -5997,7 +6075,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
5997
6075
  result2.toolBudget = toolBudgetState(options.toolBudget, progress.toolCount, result2.toolBudget?.blockedTool);
5998
6076
  }
5999
6077
  const mutates = isMutatingTool(evt.toolName, toolArgs, agent.mutationTools);
6000
- pendingToolResult = { tool: evt.toolName ?? "tool", path: activeTool?.path, mutates, startedAt: now };
6078
+ pendingToolResult = { tool: evt.toolName ?? "tool", path: activeTool?.path, mutates, startedAt: now, progressText: extractReportedProgress(evt.toolName ?? "", evt.args) };
6001
6079
  if (typeof evt.toolCallId === "string" && evt.toolCallId) pendingToolResultsByCallId.set(evt.toolCallId, pendingToolResult);
6002
6080
  fireUpdate();
6003
6081
  }
@@ -6087,6 +6165,10 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
6087
6165
  );
6088
6166
  }
6089
6167
  appendRecentOutput(progress, resultText.split("\n").slice(-10));
6168
+ if (evt.message.isError !== true && resultToolName === toolSnapshot?.tool && toolSnapshot?.progressText) {
6169
+ progress.progressText = toolSnapshot.progressText;
6170
+ progress.progressUpdatedAt = now;
6171
+ }
6090
6172
  if (toolSnapshot?.mutates && !budgetBlocked && didMutatingToolFail(evt.message)) {
6091
6173
  recordMutatingFailure(mutatingFailures, {
6092
6174
  tool: toolSnapshot.tool,
@@ -6125,7 +6207,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
6125
6207
  activityTimer.unref?.();
6126
6208
  }
6127
6209
  if (attemptTimeout) {
6128
- timeoutTimer = setTimeout(() => {
6210
+ timeoutTimer = startPausableTimer(attemptTimeout.remainingMs, () => {
6129
6211
  if (sessionSettled || lifecycleFinished || interruptedByControl || result2.timedOut) return;
6130
6212
  result2.timedOut = true;
6131
6213
  timeoutCause = attemptTimeout.message;
@@ -6142,8 +6224,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
6142
6224
  settle(void 0, true);
6143
6225
  }, 4e3);
6144
6226
  timeoutHardFinishTimer.unref?.();
6145
- }, attemptTimeout.remainingMs);
6146
- timeoutTimer.unref?.();
6227
+ });
6147
6228
  }
6148
6229
  let toolTimeoutSequence = 0;
6149
6230
  const activeToolTimeouts = /* @__PURE__ */ new Map();
@@ -6171,7 +6252,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
6171
6252
  };
6172
6253
  const terminateForToolTimeout = (message) => {
6173
6254
  if (sessionSettled || lifecycleFinished || interruptedByControl || result2.timedOut) return;
6174
- clearTimeout(timeoutTimer);
6255
+ timeoutTimer?.clear();
6175
6256
  result2.timedOut = true;
6176
6257
  timeoutCause = message;
6177
6258
  result2.error = message;
@@ -6190,9 +6271,6 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
6190
6271
  const armToolTimeout = (event) => {
6191
6272
  const timeoutForTool = effectiveToolTimeoutMs(event.toolName, options.toolTimeoutMs);
6192
6273
  if (timeoutForTool === void 0) return;
6193
- const elapsed = Date.now() - startTime;
6194
- const runRemaining = attemptTimeout ? Math.max(0, attemptTimeout.remainingMs - elapsed) : void 0;
6195
- if (runRemaining !== void 0 && timeoutForTool >= runRemaining) return;
6196
6274
  const key = toolTimeoutCallKey(event, ++toolTimeoutSequence);
6197
6275
  const toolName = event.toolName;
6198
6276
  const timer = setTimeout(() => {
@@ -6310,12 +6388,12 @@ ${formatInheritedProviderDiagnostic({ agent: agent.name, model: launch.session.m
6310
6388
  const steer = created.steer.bind(created);
6311
6389
  const followUp = created.followUp.bind(created);
6312
6390
  created.steer = async (text) => {
6391
+ await steer(text);
6313
6392
  if (cleanTerminalAssistantStopReceived || agentSettledReceived) queuedDrainHold = true;
6314
- return steer(text);
6315
6393
  };
6316
6394
  created.followUp = async (text) => {
6395
+ await followUp(text);
6317
6396
  if (cleanTerminalAssistantStopReceived || agentSettledReceived) queuedDrainHold = true;
6318
- return followUp(text);
6319
6397
  };
6320
6398
  created.detached = detached;
6321
6399
  unsubscribe = created.subscribe((event) => processEvent(event));
@@ -6346,9 +6424,8 @@ ${formatInheritedProviderDiagnostic({ agent: agent.name, model: launch.session.m
6346
6424
  result2.exitCode = exitCode;
6347
6425
  result2.providerDiagnostics = clearProviderRetry(result2.providerDiagnostics);
6348
6426
  progress.providerDiagnostics = result2.providerDiagnostics;
6349
- if (afterCompactionSettlement) {
6350
- result2[AFTER_COMPACTION_SETTLEMENT] = true;
6351
- }
6427
+ if (afterCompactionSettlement) result2[AFTER_COMPACTION_SETTLEMENT] = true;
6428
+ result2[REMAINING_TIMEOUT_MS] = remainingTimeoutMs;
6352
6429
  if (interruptedByControl) {
6353
6430
  result2.exitCode = 0;
6354
6431
  result2.interrupted = true;
@@ -6403,6 +6480,9 @@ ${formatInheritedProviderDiagnostic({ agent: agent.name, model: launch.session.m
6403
6480
  } else if (errInfo.hasError) {
6404
6481
  result2.exitCode = errInfo.exitCode ?? 1;
6405
6482
  result2.error = errInfo.details ? `${errInfo.errorType} failed (exit ${errInfo.exitCode}): ${errInfo.details}` : `${errInfo.errorType} failed with exit code ${errInfo.exitCode}`;
6483
+ } else if (!validatedStructuredOutput && getTerminalAssistantStopReason(messages) === "length") {
6484
+ result2.exitCode = 1;
6485
+ result2.error = TRUNCATED_RESPONSE_ERROR;
6406
6486
  }
6407
6487
  }
6408
6488
  progress.status = result2.exitCode === 0 ? "completed" : "failed";
@@ -6804,6 +6884,8 @@ ${PROMPT_REDACTED}; live Prompt Audit only.
6804
6884
  });
6805
6885
  if (recovery.action === "resume") {
6806
6886
  recoveryPrompt = recovery.prompt;
6887
+ const remainingMs = attemptResult[REMAINING_TIMEOUT_MS];
6888
+ if (remainingMs !== void 0) attemptOptions.deadlineAt = Date.now() + remainingMs;
6807
6889
  attemptNotes.push("[abort-recovery] compaction abort after useful progress; resuming the retained child session once on the same model.");
6808
6890
  continue;
6809
6891
  }
@@ -10340,7 +10422,7 @@ function resolveForegroundResumeTarget(params, state, options = {}) {
10340
10422
  if (!child.sessionFile) throw new Error(`Foreground run '${run.runId}' child ${index} does not have a persisted session file to resume from.`);
10341
10423
  if (path18.extname(child.sessionFile) !== ".jsonl") throw new Error(`Foreground run '${run.runId}' child ${index} session file must be a .jsonl file: ${child.sessionFile}`);
10342
10424
  const sessionFile = path18.resolve(child.sessionFile);
10343
- if (!fs20.existsSync(sessionFile)) throw new Error(`Foreground run '${run.runId}' child ${index} session file does not exist: ${child.sessionFile}`);
10425
+ if (!fs20.existsSync(sessionFile)) throw new Error(`Foreground run '${run.runId}' child ${index} session file does not exist: ${child.sessionFile}${missingForkCopyNote(sessionFile)}`);
10344
10426
  return {
10345
10427
  runId: run.runId,
10346
10428
  mode: run.mode,
@@ -10782,7 +10864,7 @@ function validateNestedSessionFile(run, trustedSessionRoots2, resolveSource, vis
10782
10864
  if (path18.extname(sessionFile) !== ".jsonl") throw new Error(`Nested run '${run.id}' session file must be a .jsonl file: ${sessionFile}`);
10783
10865
  const resolved = path18.resolve(sessionFile);
10784
10866
  if (!path18.isAbsolute(sessionFile)) throw new Error(`Nested run '${run.id}' session file must be absolute: ${sessionFile}`);
10785
- if (!fs20.existsSync(resolved)) throw new Error(`Nested run '${run.id}' session file does not exist: ${sessionFile}`);
10867
+ if (!fs20.existsSync(resolved)) throw new Error(`Nested run '${run.id}' session file does not exist: ${sessionFile}${missingForkCopyNote(resolved)}`);
10786
10868
  const stat = fs20.lstatSync(resolved);
10787
10869
  if (!stat.isFile() || stat.isSymbolicLink()) throw new Error(`Nested run '${run.id}' session file is not a regular file: ${sessionFile}`);
10788
10870
  const realSessionFile = fs20.realpathSync(resolved);
@@ -12101,10 +12183,6 @@ var MAX_TIMER_DELAY_MS = 2147483647;
12101
12183
  function timerDelayOverflowError(name, value) {
12102
12184
  return typeof value === "number" && value > MAX_TIMER_DELAY_MS ? `${name} must be a positive integer no larger than ${MAX_TIMER_DELAY_MS}.` : void 0;
12103
12185
  }
12104
- function resolveConfigDefaultTimeoutMs(raw) {
12105
- if (typeof raw !== "number" || !Number.isInteger(raw) || raw <= 0 || raw > MAX_TIMER_DELAY_MS) return void 0;
12106
- return raw;
12107
- }
12108
12186
  function resolveForegroundTimeout(params, defaultTimeoutMs) {
12109
12187
  const rawTimeout = params.timeoutMs;
12110
12188
  const rawMaxRuntime = params.maxRuntimeMs;
@@ -14990,8 +15068,9 @@ Parent action: ${COMPLETION_ACTION}` : content,
14990
15068
  inheritedNestedRoute(deps2)?.rootRunId
14991
15069
  );
14992
15070
  preparedChildParams = childRequest;
14993
- const launchRefusal = await approveWorkflowChildLaunch(ctx, () => workflowChildLaunchArgs(workflowRunId, key, childRequest, childParams.agent, parentCwd, discoverWorkflowAgents), workflowSignal);
14994
- if (launchRefusal) return buildRequestedModeError(childRequest, launchRefusal);
15071
+ const approval = await approveWorkflowChildLaunch(ctx, () => workflowChildLaunchArgs(workflowRunId, key, childRequest, childParams.agent, parentCwd, discoverWorkflowAgents), workflowSignal);
15072
+ if ("refusal" in approval) return buildRequestedModeError(childRequest, approval.refusal);
15073
+ if (approval.task !== void 0 && childRequest.action !== "resume") childRequest.task = approval.task;
14995
15074
  if (workflowUsageBudget.budget) workflowOwnedUsageBudgets.set(childRequest, workflowUsageBudget.budget);
14996
15075
  if (workflowRequiredExtensions) workflowRetainedRequiredExtensions.set(childRequest, workflowRequiredExtensions);
14997
15076
  workflowLaunchObservers.set(childRequest, (launch) => {
@@ -15020,6 +15099,8 @@ Parent action: ${COMPLETION_ACTION}` : content,
15020
15099
  step2.currentToolArgs = progress.currentToolArgs;
15021
15100
  step2.currentToolStartedAt = progress.currentToolStartedAt;
15022
15101
  step2.currentPath = progress.currentPath;
15102
+ step2.progressText = progress.progressText;
15103
+ step2.progressUpdatedAt = progress.progressUpdatedAt;
15023
15104
  step2.recentTools = progress.recentTools.map((tool) => ({ ...tool }));
15024
15105
  step2.recentOutput = [...progress.recentOutput];
15025
15106
  step2.turnCount = progress.turnCount;
@@ -15275,8 +15356,9 @@ Parent action: ${COMPLETION_ACTION}` : content,
15275
15356
  inheritedNestedRoute(deps2)?.rootRunId
15276
15357
  );
15277
15358
  preparedChildParams = childRequest;
15278
- const launchRefusal = await approveWorkflowChildLaunch(ctx, () => workflowChildLaunchArgs(foregroundWorkflowRunId, key, childRequest, childParams.agent, ctx.cwd, discoverWorkflowAgents), workflowSignal);
15279
- if (launchRefusal) return buildRequestedModeError(childRequest, launchRefusal);
15359
+ const approval = await approveWorkflowChildLaunch(ctx, () => workflowChildLaunchArgs(foregroundWorkflowRunId, key, childRequest, childParams.agent, ctx.cwd, discoverWorkflowAgents), workflowSignal);
15360
+ if ("refusal" in approval) return buildRequestedModeError(childRequest, approval.refusal);
15361
+ if (approval.task !== void 0 && childRequest.action !== "resume") childRequest.task = approval.task;
15280
15362
  if (workflowUsageBudget.budget) workflowOwnedUsageBudgets.set(childRequest, workflowUsageBudget.budget);
15281
15363
  if (workflowRequiredExtensions) workflowRetainedRequiredExtensions.set(childRequest, workflowRequiredExtensions);
15282
15364
  if (delegatedWorkflowPermit) {
@@ -16808,7 +16890,6 @@ export {
16808
16890
  promptAuditRedoParams,
16809
16891
  readNestedRecoveryDescriptor,
16810
16892
  removeForegroundControlIfIdle,
16811
- resolveConfigDefaultTimeoutMs,
16812
16893
  resolveForegroundTimeout,
16813
16894
  resolveRevivalControlConfig,
16814
16895
  resolveSingleAgentLaunchTimeout,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  requestAsyncStop
3
- } from "./chunk-VFUFOZBU.js";
3
+ } from "./chunk-W6HIYD2Z.js";
4
4
  import "./chunk-NIXWDZZV.js";
5
- import "./chunk-C3KWLXDH.js";
5
+ import "./chunk-4MVDMA5C.js";
6
6
  import "./chunk-JEZOSEWG.js";
7
7
  import "./chunk-YFCK7H2S.js";
8
8
  import "./chunk-QXASAHIA.js";
package/bundle/index.js CHANGED
@@ -17,7 +17,7 @@ function readInstalledPackageVersion() {
17
17
  var loadedPackageVersion = readInstalledPackageVersion();
18
18
 
19
19
  // index.ts
20
- var registerExtension = process.env[HERDR_PI_MODE_ENV] === "1" ? (await import("./chunk-JLDQ6YUR.js")).default : process.env.PI_SUBAGENT_CHILD === "1" ? void 0 : (await import("./chunk-DGTZKYIE.js")).default;
20
+ var registerExtension = process.env[HERDR_PI_MODE_ENV] === "1" ? (await import("./chunk-YQSTGPEU.js")).default : process.env.PI_SUBAGENT_CHILD === "1" ? void 0 : (await import("./chunk-FLNDHNPE.js")).default;
21
21
  function registerSubagentExtension(pi) {
22
22
  const installedVersion = readInstalledPackageVersion();
23
23
  if (installedVersion !== loadedPackageVersion) {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  resolveIntercomSessionTarget
3
- } from "./chunk-ESWW6XSX.js";
3
+ } from "./chunk-47ZN7NKR.js";
4
4
  import "./chunk-7F6RKT6W.js";
5
- import "./chunk-C3KWLXDH.js";
5
+ import "./chunk-4MVDMA5C.js";
6
6
  import "./chunk-JEZOSEWG.js";
7
7
  import "./chunk-YFCK7H2S.js";
8
8
  import "./chunk-QXASAHIA.js";
@@ -2,22 +2,22 @@ import {
2
2
  buildEffectiveSystemPrompt,
3
3
  canPreferForkFromSnapshot,
4
4
  resolveSubagentLaunchContext
5
- } from "./chunk-LFKMM3UH.js";
6
- import "./chunk-USRX7QXD.js";
5
+ } from "./chunk-6OWNDN7R.js";
6
+ import "./chunk-XIA5GSEU.js";
7
7
  import {
8
8
  loadConfig
9
- } from "./chunk-M2VBGET6.js";
9
+ } from "./chunk-RMZAAXIR.js";
10
10
  import {
11
11
  nestedResultsPath,
12
12
  processTerminalCandidatePath,
13
13
  processTerminalPath,
14
14
  resultFilePath
15
- } from "./chunk-PGU4TZV3.js";
15
+ } from "./chunk-CPSUJHZE.js";
16
16
  import {
17
17
  applyIntercomBridgeToAgent,
18
18
  resolveIntercomBridge,
19
19
  validateIntercomBridgeConfig
20
- } from "./chunk-ESWW6XSX.js";
20
+ } from "./chunk-47ZN7NKR.js";
21
21
  import {
22
22
  AGENT_DEFINITION_PROJECTION_VERSION,
23
23
  resolveLaunchBinding,
@@ -26,15 +26,15 @@ import {
26
26
  import {
27
27
  applyThinkingSuffix,
28
28
  resolvePiLaunchToolPlan
29
- } from "./chunk-SIAQXPJ4.js";
29
+ } from "./chunk-D32H53HM.js";
30
30
  import {
31
31
  assertRequiredChildExtensionsAdmitted,
32
32
  resolveRequiredChildExtensions
33
- } from "./chunk-CTPAE36Y.js";
33
+ } from "./chunk-YARY7JWU.js";
34
34
  import {
35
35
  getArtifactPaths,
36
36
  getArtifactsDir
37
- } from "./chunk-XSDYTXHF.js";
37
+ } from "./chunk-YDZ7BZD5.js";
38
38
  import {
39
39
  assertClaudeCodeModelScope,
40
40
  assertThinkingWithinCeiling,
@@ -61,7 +61,7 @@ import {
61
61
  resolveSkillsWithFallback,
62
62
  resolveStepBehavior,
63
63
  unknownAgentDiagnosticContext
64
- } from "./chunk-C3KWLXDH.js";
64
+ } from "./chunk-4MVDMA5C.js";
65
65
  import {
66
66
  DIRS,
67
67
  SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
@@ -8,10 +8,10 @@ import {
8
8
  openProjectPane,
9
9
  projectPaneBindingPath,
10
10
  readProjectPaneBinding
11
- } from "./chunk-3CVOAS77.js";
11
+ } from "./chunk-2DIEL4WG.js";
12
12
  import "./chunk-7J4ZXMY7.js";
13
- import "./chunk-XSDYTXHF.js";
14
- import "./chunk-C3KWLXDH.js";
13
+ import "./chunk-YDZ7BZD5.js";
14
+ import "./chunk-4MVDMA5C.js";
15
15
  import "./chunk-JEZOSEWG.js";
16
16
  import "./chunk-YFCK7H2S.js";
17
17
  import "./chunk-QXASAHIA.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  registerRequiredChildExtensions
3
- } from "./chunk-CTPAE36Y.js";
3
+ } from "./chunk-YARY7JWU.js";
4
4
  export {
5
5
  registerRequiredChildExtensions
6
6
  };
package/docs/agents.md CHANGED
@@ -591,9 +591,11 @@ Examples:
591
591
 
592
592
  ### MCP tools
593
593
 
594
- When [pi-mcp-adapter](https://github.com/nicobailon/pi-mcp-adapter) is not installed, `mcp:server` and `mcp:server/tool` entries resolve against Pi's built-in MCP. Name the server and tool as the server reports them: `mcp:my-docs/get-item` selects the tool Pi registers as `mcp__my_docs__get_item`. The server part may also use the `-`→`_` form of its name that Pi's MCP namespace uses, such as `mcp:my_docs`. The child connects the servers in Pi's `mcp.json` (the project's `.pi/mcp.json` only when the parent trusts the project) and gets only the selected tools, as direct tools, whatever exposure the server is configured with; tools configured as `hidden` cannot be selected. Servers that an extension adds with `pi.registerMcpServer()` work in background children, because the registering extension loads there too. They do not work in foreground children, which load no ambient extensions, so a foreground launch that selects one fails and says to use `async: true`. The child waits for the selected servers' current MCP connection attempts before its first prompt, then rejects the launch if any selected tool is missing or not available as a direct tool. Pi's MCP request timeout still bounds each connection; stopping, interrupting, timing out, or shutting down the child cancels the startup wait. An unrelated server does not delay this check.
594
+ When [pi-mcp-adapter](https://github.com/nicobailon/pi-mcp-adapter) is not installed, `mcp:server` and `mcp:server/tool` entries resolve against Pi's built-in MCP. Name the server and tool as the server reports them: `mcp:my-docs/get-item` selects the tool Pi registers as `mcp__my_docs__get_item`. The server part may also use the `-`→`_` form of its name that Pi's MCP namespace uses, such as `mcp:my_docs`. The child connects the servers in Pi's `mcp.json` (the project's `.pi/mcp.json` only when the parent trusts the project) and gets only the selected tools, as direct tools, whatever exposure the server is configured with; tools configured as `hidden` cannot be selected. Servers that an extension adds with `pi.registerMcpServer()` work in background children, because the registering extension loads there too. Foreground children load no ambient extensions, so they get only the servers their required child extensions (see Required host extensions) register, and a foreground launch that selects a server from any other extension fails and says to use `async: true`. The child waits for the selected servers' current MCP connection attempts before its first prompt, then rejects the launch if any selected tool is missing or not available as a direct tool. Pi's MCP request timeout still bounds each connection; stopping, interrupting, timing out, or shutting down the child cancels the startup wait. An unrelated server does not delay this check.
595
595
 
596
- When pi-mcp-adapter is installed, it keeps priority and provides the direct MCP tools. Subagents only receive direct MCP tools when `mcp:` entries are listed in their frontmatter; global `directTools: true` in the adapter's MCP config is not enough by itself. The generic `mcp` proxy tool can still be used for discovery when available. The adapter caches tool metadata at startup, so after connecting a new MCP server for the first time, restart Pi before relying on direct tools. Server `includeTools` and `excludeTools` policies are enforced while resolving cached metadata for children: both accept exact names and `*`/`?` glob patterns against raw, generated-resource, and server/short/mcp/none-prefixed names, with `excludeTools` taking precedence. `mcp:` entries must name servers from the adapter's configuration files. A server that exists only in the adapter's runtime snapshot (registered at runtime, not persisted) cannot be provided to a child: children are pi sessions inside the parent or the runner process, not `pi` processes that could receive an MCP config argument, so such a launch fails with an error saying that MCP tools must come from an ambient adapter extension in a background child. An `mcp:` entry named `subagent` does not authorize nested fanout; declare the builtin `subagent` tool or set `allowNestedSubagents: true`. If a resolved direct MCP name is missing from the child registry, pi-subagents keeps the launch failed under the strict allowlist and reports the registration mismatch; check the resolved names against what the host or pi-mcp-adapter actually registers before child startup.
596
+ When pi-mcp-adapter is installed, it keeps priority and provides the direct MCP tools. A background child with omitted `tools` and no capability ceiling uses the adapter's configured direct tools, including `directTools: true`. This also applies to agents that set only `excludeTools`: the child loads the configured tools, then excludes the listed names.
597
+
598
+ With an explicit `tools` allowlist, include `mcp:` entries for the direct MCP tools the child needs. A capability ceiling continues to restrict the child's MCP selections. The generic `mcp` proxy tool can still be used for discovery when available. The adapter caches tool metadata at startup, so after connecting a new MCP server for the first time, restart Pi before relying on direct tools. Selectors for servers explicitly configured with `disabled: true` are skipped; unknown servers and enabled servers without matching cached tools still fail the launch. Server `includeTools` and `excludeTools` policies are enforced while resolving cached metadata for children: both accept exact names and `*`/`?` glob patterns against raw, generated-resource, and server/short/mcp/none-prefixed names, with `excludeTools` taking precedence. `mcp:` entries must name servers from the adapter's configuration files. A server that exists only in the adapter's runtime snapshot (registered at runtime, not persisted) cannot be provided to a child: children are pi sessions inside the parent or the runner process, not `pi` processes that could receive an MCP config argument, so such a launch fails with an error saying that MCP tools must come from an ambient adapter extension in a background child. An `mcp:` entry named `subagent` does not authorize nested fanout; declare the builtin `subagent` tool or set `allowNestedSubagents: true`. If a resolved direct MCP name is missing from the child registry, pi-subagents keeps the launch failed under the strict allowlist and reports the registration mismatch; check the resolved names against what the host or pi-mcp-adapter actually registers before child startup.
597
599
 
598
600
  ### Extension loading
599
601