pi-subagents 0.87.0 → 0.88.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +2 -2
  4. package/bundle/{chunk-3CVOAS77.js → chunk-2DIEL4WG.js} +2 -2
  5. package/bundle/{chunk-PGU4TZV3.js → chunk-3DT5X2QC.js} +406 -447
  6. package/bundle/{chunk-SIAQXPJ4.js → chunk-3MFYKBKI.js} +18 -6
  7. package/bundle/{chunk-AIL46SZU.js → chunk-47GJDBIK.js} +6 -4
  8. package/bundle/{chunk-ESWW6XSX.js → chunk-47ZN7NKR.js} +1 -1
  9. package/bundle/{chunk-C3KWLXDH.js → chunk-4MVDMA5C.js} +9 -1
  10. package/bundle/{chunk-DGTZKYIE.js → chunk-4PM6RDE5.js} +42 -29
  11. package/bundle/{chunk-EYGBK6CE.js → chunk-4UGWHREQ.js} +45 -15
  12. package/bundle/{chunk-HDICKROY.js → chunk-6EUQPQY7.js} +31 -14
  13. package/bundle/{chunk-LFKMM3UH.js → chunk-6OWNDN7R.js} +2 -2
  14. package/bundle/{chunk-M2VBGET6.js → chunk-6PR44R7E.js} +7 -2
  15. package/bundle/{chunk-OOE3R7IQ.js → chunk-CKLZ5FGU.js} +2 -2
  16. package/bundle/{chunk-W52LJANO.js → chunk-CYKNHFXB.js} +1 -1
  17. package/bundle/{chunk-6O7YH2QV.js → chunk-GDR2ILWY.js} +1 -1
  18. package/bundle/{chunk-2D2DQGC2.js → chunk-IZEKQEY4.js} +9 -9
  19. package/bundle/{chunk-C5QWQSSM.js → chunk-KXW62VBU.js} +1 -1
  20. package/bundle/{chunk-BFF6YDK6.js → chunk-L4YY2TOE.js} +1 -1
  21. package/bundle/{chunk-JLDQ6YUR.js → chunk-MTPICU4A.js} +11 -11
  22. package/bundle/{chunk-YEXKJJVS.js → chunk-PJSOS2Q4.js} +4 -4
  23. package/bundle/{chunk-2NY5PCKQ.js → chunk-RHYVKQQL.js} +4 -4
  24. package/bundle/{chunk-XV7RTWTS.js → chunk-SVIXQDIV.js} +20 -5
  25. package/bundle/{chunk-OTLDAYEQ.js → chunk-UVDLJXL6.js} +14 -5
  26. package/bundle/{chunk-VFUFOZBU.js → chunk-W6HIYD2Z.js} +1 -1
  27. package/bundle/{chunk-OZCPYJEY.js → chunk-XAOHLFJO.js} +118 -42
  28. package/bundle/{chunk-USRX7QXD.js → chunk-XIA5GSEU.js} +2 -2
  29. package/bundle/chunk-YDZ7BZD5.js +523 -0
  30. package/bundle/{chunk-LZKVUWIY.js → chunk-YZPVALSQ.js} +30 -5
  31. package/bundle/control-channel.js +2 -2
  32. package/bundle/index.js +1 -1
  33. package/bundle/intercom-bridge.js +2 -2
  34. package/bundle/preflight.js +8 -8
  35. package/bundle/project-panes.js +3 -3
  36. package/docs/agents.md +1 -1
  37. package/docs/configuration.md +7 -3
  38. package/docs/observability.md +2 -0
  39. package/docs/tool-reference.md +4 -1
  40. package/package.json +2 -2
  41. package/skills/pi-subagents/SKILL.md +8 -2
  42. package/src/agents/agent-management.d.ts +1 -0
  43. package/src/agents/agent-management.js +12 -4
  44. package/src/agents/agents.d.ts +1 -0
  45. package/src/agents/agents.js +2 -2
  46. package/src/extension/config.d.ts +1 -0
  47. package/src/extension/config.js +6 -0
  48. package/src/extension/index.js +4 -3
  49. package/src/extension/schemas.d.ts +2 -0
  50. package/src/extension/schemas.js +1 -0
  51. package/src/extension/tool-activation.js +20 -3
  52. package/src/runs/background/async-resume.js +2 -1
  53. package/src/runs/background/async-retention.d.ts +0 -2
  54. package/src/runs/background/async-retention.js +11 -5
  55. package/src/runs/background/async-status.d.ts +2 -0
  56. package/src/runs/background/async-status.js +4 -0
  57. package/src/runs/background/run-child-session.d.ts +2 -2
  58. package/src/runs/background/run-child-session.js +4 -7
  59. package/src/runs/background/steering.d.ts +2 -11
  60. package/src/runs/background/steering.js +11 -6
  61. package/src/runs/background/subagent-runner.d.ts +0 -2
  62. package/src/runs/background/subagent-runner.js +73 -58
  63. package/src/runs/foreground/async-steering-action.js +24 -9
  64. package/src/runs/foreground/execution.js +32 -15
  65. package/src/runs/foreground/prompt-audit.js +1 -0
  66. package/src/runs/foreground/subagent-executor.d.ts +1 -8
  67. package/src/runs/foreground/subagent-executor.js +6 -15
  68. package/src/runs/shared/async-status-projection.d.ts +2 -0
  69. package/src/runs/shared/async-status-projection.js +10 -0
  70. package/src/runs/shared/child-session.js +21 -3
  71. package/src/runs/shared/mcp-config-sources.d.ts +2 -0
  72. package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +0 -2
  73. package/src/runs/shared/mcp-direct-tool-allowlist.js +21 -11
  74. package/src/runs/shared/subagent-prompt-runtime.js +14 -2
  75. package/src/runs/shared/supervisor-wait-timer.d.ts +16 -0
  76. package/src/runs/shared/supervisor-wait-timer.js +61 -0
  77. package/src/shared/artifacts.d.ts +1 -0
  78. package/src/shared/artifacts.js +107 -9
  79. package/src/shared/reported-progress.d.ts +1 -0
  80. package/src/shared/reported-progress.js +12 -0
  81. package/src/shared/status-format.d.ts +1 -0
  82. package/src/shared/status-format.js +1 -1
  83. package/src/shared/types.d.ts +9 -0
  84. package/src/shared/utils.d.ts +3 -1
  85. package/src/shared/utils.js +4 -0
  86. package/src/tui/render.js +33 -2
  87. package/src/watchdog/permission-arbiter.js +1 -0
  88. package/src/watchdog/review.d.ts +0 -5
  89. package/src/watchdog/review.js +2 -1
  90. package/src/workflows/workflow-script-worker.js +3 -1
  91. package/bundle/chunk-XSDYTXHF.js +0 -242
@@ -7,7 +7,7 @@ import {
7
7
  getAgentDir,
8
8
  getConfigDirName,
9
9
  getProjectConfigDir
10
- } from "./chunk-C3KWLXDH.js";
10
+ } from "./chunk-4MVDMA5C.js";
11
11
  import {
12
12
  TEMP_ROOT_DIR
13
13
  } from "./chunk-JEZOSEWG.js";
@@ -509,17 +509,20 @@ function resolveMcpDirectToolResolution(mcpDirectTools, cwd = process.cwd(), run
509
509
  const runtimeSelectionServers = /* @__PURE__ */ new Set([...selectedServers, ...selectedTools.keys()]);
510
510
  const runtimeServers = resolveRuntimeMcpServers(config, runtimeSelectionServers, runtimeSnapshotHost);
511
511
  const resolvedConfig = Object.keys(runtimeServers).length > 0 ? mergeConfigs(config, { mcpServers: runtimeServers }) : config;
512
- validateSelectedServerDefinitions(resolvedConfig, selectors);
512
+ const enabledSelectors = selectors.filter((selector) => resolvedConfig.mcpServers[selector.split("/", 1)[0]]?.disabled !== true);
513
+ validateSelectedServerDefinitions(resolvedConfig, enabledSelectors);
513
514
  const runtime = Object.keys(runtimeServers).length > 0 ? { mcpConfig: resolvedConfig, runtimeServerNames: Object.keys(runtimeServers) } : {};
515
+ if (enabledSelectors.length === 0) return { selections: [], unresolvedSelectors: [], ...runtime };
514
516
  const cache = loadMetadataCache();
515
- if (!cache) return { selections: [], unresolvedSelectors: selectors, ...runtime };
517
+ if (!cache) return { selections: [], unresolvedSelectors: enabledSelectors, ...runtime };
516
518
  const validMetadata = {};
517
519
  for (const [serverName, definition] of Object.entries(resolvedConfig.mcpServers)) {
520
+ if (definition.disabled === true) continue;
518
521
  const serverCache = cache.servers[serverName];
519
522
  if (isServerCacheValid(serverCache, definition)) validMetadata[serverName] = serverCache;
520
523
  }
521
524
  const grant = planMcpDirectToolGrant({
522
- selectors,
525
+ selectors: enabledSelectors,
523
526
  servers: resolvedConfig.mcpServers,
524
527
  metadata: validMetadata,
525
528
  toolPrefix: resolvedConfig.settings?.toolPrefix
@@ -714,11 +717,20 @@ function parseSettings(value) {
714
717
  function mergeConfigs(base, next) {
715
718
  const imports = [...base.imports ?? [], ...next.imports ?? []];
716
719
  return {
717
- mcpServers: { ...base.mcpServers, ...next.mcpServers },
720
+ mcpServers: mergeServerDefinitions(base.mcpServers, next.mcpServers),
718
721
  imports: imports.length ? [...new Set(imports)] : void 0,
719
722
  settings: next.settings ? { ...base.settings, ...next.settings } : base.settings
720
723
  };
721
724
  }
725
+ function mergeServerDefinitions(base, next) {
726
+ const servers = { ...base };
727
+ for (const [name, definition] of Object.entries(next)) {
728
+ const previous = base[name];
729
+ if (previous && Object.keys(definition).every((key) => key === "disabled")) servers[name] = { ...previous, ...definition };
730
+ else servers[name] = previous?.disabled === void 0 ? definition : { disabled: previous.disabled, ...definition };
731
+ }
732
+ return servers;
733
+ }
722
734
  function expandImports(config, cwd) {
723
735
  if (!config.imports?.length) return config;
724
736
  const importedServers = {};
@@ -738,7 +750,7 @@ function expandImports(config, cwd) {
738
750
  return {
739
751
  imports: config.imports,
740
752
  settings: config.settings,
741
- mcpServers: { ...importedServers, ...config.mcpServers }
753
+ mcpServers: mergeServerDefinitions(importedServers, config.mcpServers)
742
754
  };
743
755
  }
744
756
  function resolveImportPath(importKind, cwd) {
@@ -8,7 +8,7 @@ import {
8
8
  projectTimeoutRecovery,
9
9
  readAsyncRecoveryDescriptor,
10
10
  utf8Tail
11
- } from "./chunk-XV7RTWTS.js";
11
+ } from "./chunk-SVIXQDIV.js";
12
12
  import {
13
13
  MAX_ARGS_BYTES,
14
14
  MAX_ARGS_DEPTH,
@@ -21,10 +21,10 @@ import {
21
21
  resultFilePath,
22
22
  resultPayloadMatchesSessionRun,
23
23
  resultPayloadPathForSessionRun
24
- } from "./chunk-PGU4TZV3.js";
24
+ } from "./chunk-3DT5X2QC.js";
25
25
  import {
26
26
  PROJECT_SUBAGENTS_RELATIVE_DIR
27
- } from "./chunk-XSDYTXHF.js";
27
+ } from "./chunk-YDZ7BZD5.js";
28
28
  import {
29
29
  listBackgroundWorkWakeChannels,
30
30
  snapshotBackgroundWork
@@ -50,7 +50,7 @@ import {
50
50
  waitToolName,
51
51
  withSettingsFileLease,
52
52
  writePrivateAtomicJson
53
- } from "./chunk-C3KWLXDH.js";
53
+ } from "./chunk-4MVDMA5C.js";
54
54
  import {
55
55
  DIRS,
56
56
  INTERCOM_DETACH_REQUEST_EVENT,
@@ -820,6 +820,7 @@ var SubagentParamProperties = {
820
820
  description: 'Management/control only; omit for execution. validate accepts workflow: true or a script path. Discover actions with {action:"guide",options:{topic:"tool-reference"}}.'
821
821
  })),
822
822
  capabilities: Type2.Optional(Type2.Boolean({ description: "list: compact capability rows/details without system prompts." })),
823
+ search: Type2.Optional(Type2.String({ minLength: 1, description: "list: case-insensitive match on agent name, alias, or description." })),
823
824
  name: Type2.Optional(Type2.String({ description: "schedule.create name." })),
824
825
  id: Type2.Optional(Type2.String({
825
826
  description: "Run id/prefix for status/control."
@@ -4401,6 +4402,7 @@ async function runWatchdogAttempt(ctx, request, options) {
4401
4402
  hasDiff: diffBaseline !== void 0
4402
4403
  });
4403
4404
  const agent2 = new Agent({
4405
+ sessionId,
4404
4406
  initialState: {
4405
4407
  systemPrompt,
4406
4408
  model: selection.model,
@@ -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,
@@ -10,10 +10,10 @@ import {
10
10
  setInlineWorkflowCoverage,
11
11
  setMainThinkingLevelSource,
12
12
  widgetRenderKey
13
- } from "./chunk-LZKVUWIY.js";
13
+ } from "./chunk-YZPVALSQ.js";
14
14
  import {
15
15
  package_default
16
- } from "./chunk-OOE3R7IQ.js";
16
+ } from "./chunk-CKLZ5FGU.js";
17
17
  import {
18
18
  EXTERNAL_JOB_BRIDGE_REQUEST_DIR,
19
19
  REVIVAL_ORIGIN_FILE,
@@ -62,7 +62,7 @@ import {
62
62
  snapshotProviderDiagnostics,
63
63
  workflowResumeClaimState,
64
64
  workflowResumeRefusal
65
- } from "./chunk-EYGBK6CE.js";
65
+ } from "./chunk-4UGWHREQ.js";
66
66
  import {
67
67
  SUBAGENT_CHILD_ENV,
68
68
  SUBAGENT_PARENT_SESSION_ENV,
@@ -82,14 +82,14 @@ import {
82
82
  resolvePiSessionId,
83
83
  resolveWaitToolConfig,
84
84
  setDeclarationPinning
85
- } from "./chunk-AIL46SZU.js";
85
+ } from "./chunk-47GJDBIK.js";
86
86
  import {
87
87
  deliverAsyncRunStop,
88
88
  ownerConfirmedDead,
89
89
  readSessionMessagesTail,
90
90
  resolveSubagentRunId,
91
91
  restoreForegroundRunHistory
92
- } from "./chunk-2NY5PCKQ.js";
92
+ } from "./chunk-RHYVKQQL.js";
93
93
  import {
94
94
  ASYNC_STATUS_SNAPSHOT_KIND,
95
95
  ASYNC_STATUS_SNAPSHOT_VERSION,
@@ -105,7 +105,7 @@ import {
105
105
  resolveAsyncStatusChild,
106
106
  runLaunchDir,
107
107
  stopStoppableAsyncStatusChildren
108
- } from "./chunk-XV7RTWTS.js";
108
+ } from "./chunk-SVIXQDIV.js";
109
109
  import {
110
110
  CONTACT_SUPERVISOR_TOOL_NAME,
111
111
  NATIVE_SUPERVISOR_TOOL_NAME,
@@ -115,7 +115,7 @@ import {
115
115
  parseSupervisorReplyData,
116
116
  parseSupervisorRequestDetails,
117
117
  topLevelSupervisorTool
118
- } from "./chunk-W52LJANO.js";
118
+ } from "./chunk-CYKNHFXB.js";
119
119
  import {
120
120
  MODEL_ONLY_TOOL,
121
121
  canRenderComponents,
@@ -137,10 +137,11 @@ import {
137
137
  loadConfig,
138
138
  resolveAbandonedSlotReleaseAfterMs,
139
139
  resolveAsyncByDefault,
140
+ resolveConfigDefaultTimeoutMs,
140
141
  resolveDisabledFeatureSurface,
141
142
  resolveMaxActiveAsyncRunsPerSession,
142
143
  resolveScheduledStoreRoot
143
- } from "./chunk-M2VBGET6.js";
144
+ } from "./chunk-6PR44R7E.js";
144
145
  import {
145
146
  ACTIVE_RUN_INDEX_DIR,
146
147
  MissionNotFoundError,
@@ -191,28 +192,28 @@ import {
191
192
  withWorkflowChildRunModel,
192
193
  writeAsyncResultFile,
193
194
  writeResultIndexForData
194
- } from "./chunk-PGU4TZV3.js";
195
- import "./chunk-VFUFOZBU.js";
195
+ } from "./chunk-3DT5X2QC.js";
196
+ import "./chunk-W6HIYD2Z.js";
196
197
  import {
197
198
  shouldUseNativeFsWatch
198
199
  } from "./chunk-NIXWDZZV.js";
199
200
  import {
200
201
  validateIntercomBridgeConfig
201
- } from "./chunk-ESWW6XSX.js";
202
+ } from "./chunk-47ZN7NKR.js";
202
203
  import "./chunk-7F6RKT6W.js";
203
- import "./chunk-SIAQXPJ4.js";
204
+ import "./chunk-3MFYKBKI.js";
204
205
  import "./chunk-CTPAE36Y.js";
205
206
  import {
206
207
  listHerdrProjectPaneRoots,
207
208
  restoreHerdrProjectPaneSnapshots
208
- } from "./chunk-3CVOAS77.js";
209
+ } from "./chunk-2DIEL4WG.js";
209
210
  import "./chunk-7J4ZXMY7.js";
210
211
  import {
211
212
  cleanupAllArtifactDirs,
212
213
  cleanupOldArtifacts,
213
214
  getArtifactPaths,
214
215
  getArtifactsDir
215
- } from "./chunk-XSDYTXHF.js";
216
+ } from "./chunk-YDZ7BZD5.js";
216
217
  import {
217
218
  listBackgroundWorkProviders
218
219
  } from "./chunk-XA3DY6UG.js";
@@ -220,12 +221,12 @@ import "./chunk-YYREO77V.js";
220
221
  import "./chunk-UKG4V45O.js";
221
222
  import {
222
223
  registerRuntimeAgentEventListener
223
- } from "./chunk-BFF6YDK6.js";
224
+ } from "./chunk-L4YY2TOE.js";
224
225
  import {
225
226
  clearRuntimeAgentsForPi,
226
227
  listRuntimeAgentConfigs,
227
228
  mergeRuntimeAgents
228
- } from "./chunk-C5QWQSSM.js";
229
+ } from "./chunk-KXW62VBU.js";
229
230
  import {
230
231
  DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
231
232
  DEFAULT_WAIT_TOOL_NAME,
@@ -268,7 +269,7 @@ import {
268
269
  waitToolName,
269
270
  withSettingsFileLease,
270
271
  writeAtomicJson
271
- } from "./chunk-C3KWLXDH.js";
272
+ } from "./chunk-4MVDMA5C.js";
272
273
  import {
273
274
  DEFAULT_ARTIFACT_CONFIG,
274
275
  DIRS,
@@ -1570,9 +1571,13 @@ async function computeProcessStartIdentity(pid) {
1570
1571
  }
1571
1572
  if (process.platform === "win32") {
1572
1573
  const started = await new Promise((resolve6) => {
1573
- execFile2("powershell.exe", ["-NoProfile", "-Command", `(Get-CimInstance Win32_Process -Filter "ProcessId=${pid}").CreationDate`], { encoding: "utf-8", windowsHide: true, timeout: 5e3 }, (error, stdout) => {
1574
- resolve6(error ? "" : stdout.trim());
1575
- });
1574
+ try {
1575
+ execFile2("powershell.exe", ["-NoProfile", "-Command", `(Get-CimInstance Win32_Process -Filter "ProcessId=${pid}").CreationDate`], { encoding: "utf-8", windowsHide: true, timeout: 5e3 }, (error, stdout) => {
1576
+ resolve6(error ? "" : stdout.trim());
1577
+ });
1578
+ } catch {
1579
+ resolve6("");
1580
+ }
1576
1581
  });
1577
1582
  return started ? `win:${started}` : void 0;
1578
1583
  }
@@ -5360,7 +5365,7 @@ function registerSlashCommands(pi, state, options = {}) {
5360
5365
  }
5361
5366
  fleetOpen = true;
5362
5367
  try {
5363
- const { openSubagentFleet } = await import("./chunk-2D2DQGC2.js");
5368
+ const { openSubagentFleet } = await import("./chunk-IZEKQEY4.js");
5364
5369
  await openSubagentFleet(ctx, state, { asyncDirRoot: DIRS.async, inspectorPlugins: () => getInspectorPlugins(pi), resultsDir: DIRS.results, fleetKeybindings: options.fleetKeybindings });
5365
5370
  } finally {
5366
5371
  fleetOpen = false;
@@ -8079,12 +8084,20 @@ ${advertised}` : ""}` }],
8079
8084
  };
8080
8085
  registerPinnedTool(pi, loader);
8081
8086
  let loaderSelected = true;
8087
+ let undeclared;
8088
+ const activationState = () => [LOADER_NAME, SUBAGENT_NAME].map((name) => pi.getActiveTools().includes(name)).join();
8082
8089
  const replyOwed = () => options.hasPendingSupervisorRequest?.() === true;
8083
- pi.on("session_start", (_event, ctx) => {
8090
+ const decide = (ctx) => {
8084
8091
  loaderSelected = applyRecordedSelection(pi, ctx, mode, replyOwed());
8092
+ undeclared = Array.isArray(pi.getActiveTools()) ? activationState() : void 0;
8093
+ };
8094
+ pi.on("session_start", (_event, ctx) => decide(ctx));
8095
+ pi.on("session_tree", (_event, ctx) => decide(ctx));
8096
+ pi.on("agent_start", () => {
8097
+ undeclared = void 0;
8085
8098
  });
8086
- pi.on("session_tree", (_event, ctx) => {
8087
- loaderSelected = applyRecordedSelection(pi, ctx, mode, replyOwed());
8099
+ pi.on("model_select", (_event, ctx) => {
8100
+ if (mode === "auto" && ctx.isIdle() && undeclared === activationState() && loaderSelected !== addsToolsWithoutCheckpoint(ctx.model) && ctx.sessionManager.buildSessionContext().messages.length === 0) decide(ctx);
8088
8101
  });
8089
8102
  pi.on("before_agent_start", (event) => {
8090
8103
  const available = pi.getAllTools();
@@ -8765,7 +8778,7 @@ function registerSubagentExtension(pi) {
8765
8778
  const ctx = withLastUiContext((current) => current);
8766
8779
  if (!ctx) return;
8767
8780
  try {
8768
- const { openSubagentFleet } = await import("./chunk-2D2DQGC2.js");
8781
+ const { openSubagentFleet } = await import("./chunk-IZEKQEY4.js");
8769
8782
  await openSubagentFleet(ctx, state, { initialKey: itemKey, asyncDirRoot: DIRS.async, resultsDir: DIRS.results, fleetKeybindings: config.fleetKeybindings, inspectorPlugins: () => getInspectorPlugins(pi) });
8770
8783
  } catch (error) {
8771
8784
  if (isStaleExtensionContextError(error)) {
@@ -8938,7 +8951,7 @@ function registerSubagentExtension(pi) {
8938
8951
  ])
8939
8952
  });
8940
8953
  } catch (error) {
8941
- console.error("Failed to clean retained async subagent state:", error);
8954
+ reportSessionWarning(state, `Failed to clean retained async subagent state: ${error instanceof Error ? error.message : String(error)}`, "async-retention-cleanup");
8942
8955
  }
8943
8956
  }, ASYNC_RETENTION_DELAY_MS);
8944
8957
  asyncRetentionTimer.unref?.();
@@ -8974,7 +8987,7 @@ function registerSubagentExtension(pi) {
8974
8987
  let executor;
8975
8988
  let executorPromise;
8976
8989
  let executorModulePromise;
8977
- const loadExecutorModule = () => executorModulePromise ??= import("./chunk-OZCPYJEY.js");
8990
+ const loadExecutorModule = () => executorModulePromise ??= import("./chunk-XAOHLFJO.js");
8978
8991
  const getExecutor = () => {
8979
8992
  executorPromise ??= loadExecutorModule().then(({ createSubagentExecutor }) => {
8980
8993
  executor = createSubagentExecutor(executorDeps);
@@ -8988,7 +9001,7 @@ function registerSubagentExtension(pi) {
8988
9001
  modulePreloadTimer = setTimeout(() => {
8989
9002
  loadExecutorModule().catch(() => {
8990
9003
  });
8991
- if (fleetViewEnabled) import("./chunk-2D2DQGC2.js").catch(() => {
9004
+ if (fleetViewEnabled) import("./chunk-IZEKQEY4.js").catch(() => {
8992
9005
  });
8993
9006
  }, MODULE_PRELOAD_DELAY_MS);
8994
9007
  modulePreloadTimer.unref?.();
@@ -9166,7 +9179,7 @@ ${close}` }]
9166
9179
  const active = activeAsyncJobCount();
9167
9180
  if (active > 0) ctx.ui.notify(`${active} background subagent run${active === 1 ? " is" : "s are"} still active${slashCommandsEnabled ? " \xB7 /subagents-stop" : ""}`, "info");
9168
9181
  }
9169
- if (!ctx.hasUI) await drainOutstandingWork({ state, events: pi.events, hasPendingSupervisorRequest: supervisorChannel.hasPendingRequests }).then(resultWatcher.deliverPendingResults);
9182
+ if (!ctx.hasUI) await drainOutstandingWork({ state, events: pi.events, hasPendingSupervisorRequest: supervisorChannel.hasPendingRequests, timeoutMs: resolveConfigDefaultTimeoutMs(config.timeoutMs) }).then(resultWatcher.deliverPendingResults);
9170
9183
  } finally {
9171
9184
  const ownerSessionId = state.currentSessionId;
9172
9185
  if (ownerSessionId) {
@@ -11,10 +11,10 @@ import {
11
11
  startWatchdogDiffBaselineCapture,
12
12
  writeUserWatchdogEnabled,
13
13
  writeWatchdogModelSettings
14
- } from "./chunk-AIL46SZU.js";
14
+ } from "./chunk-47GJDBIK.js";
15
15
  import {
16
16
  resolveGitRepositoryIdentity
17
- } from "./chunk-2NY5PCKQ.js";
17
+ } from "./chunk-RHYVKQQL.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-SVIXQDIV.js";
26
26
  import {
27
27
  ownsRun
28
28
  } from "./chunk-HXRB42AF.js";
@@ -54,21 +54,21 @@ import {
54
54
  resolveMissionStoreLocation,
55
55
  validateMissionId,
56
56
  workflowRunParamsFingerprint
57
- } from "./chunk-PGU4TZV3.js";
57
+ } from "./chunk-3DT5X2QC.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-3MFYKBKI.js";
65
65
  import {
66
66
  createHerdrClient,
67
67
  detectHerdr
68
- } from "./chunk-3CVOAS77.js";
68
+ } from "./chunk-2DIEL4WG.js";
69
69
  import {
70
70
  getProjectSubagentsDir
71
- } from "./chunk-XSDYTXHF.js";
71
+ } from "./chunk-YDZ7BZD5.js";
72
72
  import {
73
73
  ExternalJobProviderError,
74
74
  getExternalJobProvider,
@@ -78,10 +78,11 @@ import {
78
78
  } from "./chunk-YYREO77V.js";
79
79
  import {
80
80
  mergeRuntimeAgents
81
- } from "./chunk-C5QWQSSM.js";
81
+ } from "./chunk-KXW62VBU.js";
82
82
  import {
83
83
  CODE_OWNED_EXTERNAL_CLI_ADAPTER_LABEL,
84
84
  EXTERNAL_CLI_ADAPTER_SAFETY,
85
+ MAX_LISTED_AGENTS,
85
86
  PI_CODING_AGENT_PACKAGE,
86
87
  PI_CODING_AGENT_PACKAGE_ROOT_ENV,
87
88
  PROMPT_REDACTED,
@@ -111,6 +112,7 @@ import {
111
112
  mergeBuiltinAgentOverride,
112
113
  normalizeModelSegment,
113
114
  normalizeWorkflowLaneMetadata,
115
+ parseAcceptanceReport,
114
116
  parseFrontmatter,
115
117
  parsePackageName,
116
118
  parseUnquotedList,
@@ -137,7 +139,7 @@ import {
137
139
  withFileLease,
138
140
  writeAtomicJson,
139
141
  writePrivateAtomicJson
140
- } from "./chunk-C3KWLXDH.js";
142
+ } from "./chunk-4MVDMA5C.js";
141
143
  import {
142
144
  DIRS,
143
145
  INTERCOM_DETACH_REQUEST_EVENT,
@@ -3767,7 +3769,8 @@ function handleList(params, ctx) {
3767
3769
  let scopedAgents = effectiveAgentsForScope(scope, d, ctx.runtimeAgentOwner, ctx.model?.provider);
3768
3770
  scopedAgents = scopedAgents.sort((a, b) => a.name.localeCompare(b.name));
3769
3771
  const capabilityCeiling = resolveCurrentSubagentCapabilityCeiling(ctx.piSessionId);
3770
- const visibleAgents = scopedAgents.filter((a) => !a.disabled);
3772
+ const search = typeof params.search === "string" ? params.search.trim().toLowerCase() : "";
3773
+ const visibleAgents = scopedAgents.filter((a) => !a.disabled && (!search || [a.name, a.description, ...a.aliases ?? []].some((text2) => text2.toLowerCase().includes(search))));
3771
3774
  const agents = visibleAgents.filter((a) => isAgentAllowedByCapabilityCeiling(a.name, capabilityCeiling));
3772
3775
  const restrictedAgents = visibleAgents.filter((a) => !isAgentAllowedByCapabilityCeiling(a.name, capabilityCeiling));
3773
3776
  const restrictedSources = capabilityCeilingAgentRestrictionSources(capabilityCeiling);
@@ -3784,11 +3787,15 @@ function handleList(params, ctx) {
3784
3787
  const knownProviders = knownModelProviders(ctx.modelRegistry);
3785
3788
  const unavailableModels = new Set([...agents, ...restrictedAgents].filter((agent) => (agent.runner?.type ?? "pi") === "pi" && isUnavailableSubagentModel(agent.model, availableModels, agent.modelProvider ?? ctx.model?.provider, knownProviders)));
3786
3789
  const formatLine = capabilityMode ? (agent, names) => formatAgentCapabilitiesLine(agent, names, externalCliAvailability, unavailableModels) : formatAgentListLine;
3790
+ const shownAgents = agents.slice(0, MAX_LISTED_AGENTS);
3791
+ const shownRestrictedAgents = restrictedAgents.slice(0, MAX_LISTED_AGENTS - shownAgents.length);
3792
+ const omittedCount = Math.max(0, agents.length + restrictedAgents.length - MAX_LISTED_AGENTS);
3787
3793
  const lines = [
3788
3794
  capabilityMode ? "Executable agents (capabilities):" : "Executable agents:",
3789
- ...formatAgentListSections(agents, providerNameSet, formatLine)
3795
+ ...formatAgentListSections(shownAgents, providerNameSet, formatLine)
3790
3796
  ];
3791
- appendRestrictedAgentLines({ lines, agents: restrictedAgents, sources: restrictedSources, providerNames: providerNameSet, formatLine });
3797
+ appendRestrictedAgentLines({ lines, agents: shownRestrictedAgents, sources: restrictedSources, providerNames: providerNameSet, formatLine });
3798
+ if (omittedCount > 0) lines.push("", `+${omittedCount} more; narrow with {action:"list", options:{search:"<term>"}}`);
3792
3799
  appendExternalJobRegistryLine(lines, [...agents, ...restrictedAgents], providerStatus);
3793
3800
  appendAgentDiagnosticLines(lines, d.agentDiagnostics);
3794
3801
  if (proactiveSuggestions.length) lines.push("", ...proactiveSuggestions);
@@ -7756,14 +7763,37 @@ function createDefaultChildSessionFactory(options = {}) {
7756
7763
  mcpWaits.delete(cancel);
7757
7764
  }
7758
7765
  }
7766
+ let reportCompleted = false;
7767
+ const guidanceClosed = "Child completed its acceptance report; resume it for further guidance.";
7768
+ const assertAcceptsGuidance = () => {
7769
+ if (reportCompleted) throw new Error(guidanceClosed);
7770
+ };
7771
+ const rejectQueuedGuidance = () => {
7772
+ session.clearQueue();
7773
+ throw new Error(guidanceClosed);
7774
+ };
7759
7775
  const child = {
7760
- subscribe: (listener) => session.subscribe((event) => listener(event)),
7776
+ subscribe: (listener) => session.subscribe((event) => {
7777
+ if (event.type === "message_end" && event.message.role === "assistant" && event.message.stopReason === "stop") {
7778
+ const text2 = event.message.content.filter((part) => part.type === "text").map((part) => part.text).join("\n");
7779
+ const report = parseAcceptanceReport(text2);
7780
+ if (report.report || report.malformed) {
7781
+ reportCompleted = true;
7782
+ session.clearQueue();
7783
+ session.agent.steer = rejectQueuedGuidance;
7784
+ session.agent.followUp = rejectQueuedGuidance;
7785
+ }
7786
+ }
7787
+ listener(event);
7788
+ }),
7761
7789
  prompt: (text2) => session.prompt(text2),
7762
7790
  ...commands ? { finishCommands: () => commands.finish() } : {},
7763
7791
  steer: async (text2) => {
7792
+ assertAcceptsGuidance();
7764
7793
  await session.steer(text2);
7765
7794
  },
7766
7795
  followUp: async (text2) => {
7796
+ assertAcceptsGuidance();
7767
7797
  await session.followUp(text2);
7768
7798
  },
7769
7799
  abort: () => session.abort(),
@@ -7824,7 +7854,7 @@ function childSessionFactory() {
7824
7854
  }
7825
7855
  function createLazyPlacementFactory(local) {
7826
7856
  let placed;
7827
- const factory = async () => placed ??= (await import("./chunk-YEXKJJVS.js")).createPlacementAwareChildSessionFactory(local);
7857
+ const factory = async () => placed ??= (await import("./chunk-PJSOS2Q4.js")).createPlacementAwareChildSessionFactory(local);
7828
7858
  return {
7829
7859
  async create(launch) {
7830
7860
  return launch.machine ? (await factory()).create(launch) : local.create(launch);