pi-subagents 0.86.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 (122) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +2 -2
  4. package/bundle/{chunk-PYOAIN3V.js → chunk-2DIEL4WG.js} +2 -2
  5. package/bundle/{chunk-GJGTMLPE.js → chunk-3DT5X2QC.js} +483 -477
  6. package/bundle/{chunk-374MZFF4.js → chunk-3MFYKBKI.js} +23 -13
  7. package/bundle/{chunk-ZJJCPV3L.js → chunk-47GJDBIK.js} +10 -6
  8. package/bundle/{chunk-77ASNIEM.js → chunk-47ZN7NKR.js} +1 -1
  9. package/bundle/{chunk-QGO6HXHG.js → chunk-4MVDMA5C.js} +88 -64
  10. package/bundle/{chunk-O3YH7XIY.js → chunk-4PM6RDE5.js} +46 -32
  11. package/bundle/{chunk-BWC2LVII.js → chunk-4UGWHREQ.js} +200 -64
  12. package/bundle/{chunk-3RKFH2UZ.js → chunk-6EUQPQY7.js} +31 -14
  13. package/bundle/{chunk-A637IMAO.js → chunk-6OWNDN7R.js} +2 -2
  14. package/bundle/{chunk-6VD7BGIC.js → chunk-6PR44R7E.js} +7 -2
  15. package/bundle/{chunk-7ZUFN6ME.js → chunk-CKLZ5FGU.js} +2 -2
  16. package/bundle/{chunk-ZPY5QZCS.js → chunk-CYKNHFXB.js} +1 -1
  17. package/bundle/{chunk-YK3QYNLE.js → chunk-GDR2ILWY.js} +1 -1
  18. package/bundle/{chunk-7QA7ZA46.js → chunk-IZEKQEY4.js} +9 -9
  19. package/bundle/{chunk-NAFLUJ26.js → chunk-KXW62VBU.js} +1 -1
  20. package/bundle/{chunk-S2Q75LP3.js → chunk-L4YY2TOE.js} +1 -1
  21. package/bundle/{chunk-QM3JGE4W.js → chunk-MTPICU4A.js} +12 -12
  22. package/bundle/{chunk-BU6PFPVX.js → chunk-PJSOS2Q4.js} +12 -7
  23. package/bundle/{chunk-UR7OW5S7.js → chunk-RHYVKQQL.js} +11 -5
  24. package/bundle/{chunk-BGXEAYUM.js → chunk-SVIXQDIV.js} +20 -5
  25. package/bundle/{chunk-7ADDXUGF.js → chunk-UVDLJXL6.js} +14 -5
  26. package/bundle/{chunk-NF7IEKBH.js → chunk-W2BZS6UC.js} +27 -13
  27. package/bundle/{chunk-5H4BICQZ.js → chunk-W6HIYD2Z.js} +1 -1
  28. package/bundle/{chunk-2IYBCYFU.js → chunk-XAOHLFJO.js} +174 -56
  29. package/bundle/{chunk-LGINOOY5.js → chunk-XIA5GSEU.js} +2 -2
  30. package/bundle/chunk-YDZ7BZD5.js +523 -0
  31. package/bundle/{chunk-WN2E5XHN.js → chunk-YZPVALSQ.js} +30 -5
  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 +12 -10
  36. package/bundle/project-panes.js +3 -3
  37. package/bundle/workflow-resources.js +1 -1
  38. package/docs/agents.md +4 -4
  39. package/docs/configuration.md +17 -5
  40. package/docs/extension-api.md +2 -0
  41. package/docs/models.md +6 -2
  42. package/docs/observability.md +2 -0
  43. package/docs/tool-reference.md +5 -1
  44. package/package.json +2 -2
  45. package/skills/pi-subagents/SKILL.md +15 -6
  46. package/skills/pi-subagents/references/prompting-and-roles.md +1 -0
  47. package/src/agents/agent-management.d.ts +1 -0
  48. package/src/agents/agent-management.js +22 -10
  49. package/src/agents/agent-serializer.d.ts +2 -0
  50. package/src/agents/agent-serializer.js +1 -1
  51. package/src/agents/agents.d.ts +1 -0
  52. package/src/agents/agents.js +39 -14
  53. package/src/api/preflight.d.ts +3 -1
  54. package/src/api/preflight.js +2 -0
  55. package/src/extension/config.d.ts +1 -0
  56. package/src/extension/config.js +6 -0
  57. package/src/extension/index.js +8 -5
  58. package/src/extension/schemas.d.ts +4 -0
  59. package/src/extension/schemas.js +2 -0
  60. package/src/extension/tool-activation.js +20 -3
  61. package/src/runs/background/async-execution.d.ts +2 -1
  62. package/src/runs/background/async-execution.js +4 -2
  63. package/src/runs/background/async-resume.js +2 -1
  64. package/src/runs/background/async-retention.d.ts +0 -2
  65. package/src/runs/background/async-retention.js +11 -5
  66. package/src/runs/background/async-status.d.ts +2 -0
  67. package/src/runs/background/async-status.js +4 -0
  68. package/src/runs/background/run-child-session.d.ts +2 -2
  69. package/src/runs/background/run-child-session.js +4 -7
  70. package/src/runs/background/runner-aliases.js +15 -0
  71. package/src/runs/background/steering.d.ts +2 -11
  72. package/src/runs/background/steering.js +11 -6
  73. package/src/runs/background/subagent-runner.d.ts +0 -2
  74. package/src/runs/background/subagent-runner.js +73 -58
  75. package/src/runs/background/wait-subscriptions.js +124 -12
  76. package/src/runs/foreground/async-steering-action.js +24 -9
  77. package/src/runs/foreground/async-stop-action.d.ts +1 -1
  78. package/src/runs/foreground/async-stop-action.js +9 -1
  79. package/src/runs/foreground/execution.js +33 -15
  80. package/src/runs/foreground/prompt-audit.js +1 -0
  81. package/src/runs/foreground/subagent-executor.d.ts +2 -8
  82. package/src/runs/foreground/subagent-executor.js +57 -23
  83. package/src/runs/shared/async-status-projection.d.ts +2 -0
  84. package/src/runs/shared/async-status-projection.js +10 -0
  85. package/src/runs/shared/child-session.d.ts +5 -4
  86. package/src/runs/shared/child-session.js +64 -36
  87. package/src/runs/shared/herdr-placed-run.js +3 -2
  88. package/src/runs/shared/mcp-config-sources.d.ts +4 -1
  89. package/src/runs/shared/mcp-config-sources.js +1 -1
  90. package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +0 -3
  91. package/src/runs/shared/mcp-direct-tool-allowlist.js +26 -17
  92. package/src/runs/shared/model-resolution.d.ts +19 -4
  93. package/src/runs/shared/model-resolution.js +50 -51
  94. package/src/runs/shared/subagent-prompt-runtime.js +14 -2
  95. package/src/runs/shared/supervisor-wait-timer.d.ts +16 -0
  96. package/src/runs/shared/supervisor-wait-timer.js +61 -0
  97. package/src/shared/artifacts.d.ts +1 -0
  98. package/src/shared/artifacts.js +132 -22
  99. package/src/shared/pruned-fork.js +2 -2
  100. package/src/shared/reported-progress.d.ts +1 -0
  101. package/src/shared/reported-progress.js +12 -0
  102. package/src/shared/status-format.d.ts +1 -0
  103. package/src/shared/status-format.js +1 -1
  104. package/src/shared/types.d.ts +23 -0
  105. package/src/shared/utils.d.ts +3 -1
  106. package/src/shared/utils.js +4 -0
  107. package/src/tui/render.js +33 -2
  108. package/src/watchdog/model-selection.js +2 -2
  109. package/src/watchdog/permission-arbiter.js +1 -0
  110. package/src/watchdog/review.d.ts +0 -5
  111. package/src/watchdog/review.js +4 -3
  112. package/src/workflows/scripted-workflow.d.ts +2 -0
  113. package/src/workflows/scripted-workflow.js +103 -39
  114. package/src/workflows/structured-workflow-scripts.d.ts +4 -3
  115. package/src/workflows/structured-workflow-scripts.js +32 -11
  116. package/src/workflows/workflow-resources.js +4 -4
  117. package/src/workflows/workflow-resume-claim.d.ts +2 -0
  118. package/src/workflows/workflow-resume-claim.js +1 -1
  119. package/src/workflows/workflow-resume.d.ts +1 -1
  120. package/src/workflows/workflow-resume.js +3 -1
  121. package/src/workflows/workflow-script-worker.js +3 -1
  122. package/bundle/chunk-GRJHIXYF.js +0 -235
@@ -10,10 +10,10 @@ import {
10
10
  setInlineWorkflowCoverage,
11
11
  setMainThinkingLevelSource,
12
12
  widgetRenderKey
13
- } from "./chunk-WN2E5XHN.js";
13
+ } from "./chunk-YZPVALSQ.js";
14
14
  import {
15
15
  package_default
16
- } from "./chunk-7ZUFN6ME.js";
16
+ } from "./chunk-CKLZ5FGU.js";
17
17
  import {
18
18
  EXTERNAL_JOB_BRIDGE_REQUEST_DIR,
19
19
  REVIVAL_ORIGIN_FILE,
@@ -29,7 +29,7 @@ import {
29
29
  createWaitSubscriptionManager,
30
30
  deliverSubagentResultIntercomEvent,
31
31
  deriveChildSessionName,
32
- disposeChildSessions,
32
+ disposeChildSessionsForParent,
33
33
  editableAgentConfig,
34
34
  externalJobBridgeEligibility,
35
35
  flattenSubagentToolOptions,
@@ -62,7 +62,7 @@ import {
62
62
  snapshotProviderDiagnostics,
63
63
  workflowResumeClaimState,
64
64
  workflowResumeRefusal
65
- } from "./chunk-BWC2LVII.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-ZJJCPV3L.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-UR7OW5S7.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-BGXEAYUM.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-ZPY5QZCS.js";
118
+ } from "./chunk-CYKNHFXB.js";
119
119
  import {
120
120
  MODEL_ONLY_TOOL,
121
121
  canRenderComponents,
@@ -130,17 +130,18 @@ import {
130
130
  reportSessionWarning,
131
131
  withCachedUiContext
132
132
  } from "./chunk-HXRB42AF.js";
133
- import "./chunk-NF7IEKBH.js";
133
+ import "./chunk-W2BZS6UC.js";
134
134
  import {
135
135
  disabledFeatureUseError,
136
136
  getActiveAsyncCapacitySnapshot,
137
137
  loadConfig,
138
138
  resolveAbandonedSlotReleaseAfterMs,
139
139
  resolveAsyncByDefault,
140
+ resolveConfigDefaultTimeoutMs,
140
141
  resolveDisabledFeatureSurface,
141
142
  resolveMaxActiveAsyncRunsPerSession,
142
143
  resolveScheduledStoreRoot
143
- } from "./chunk-6VD7BGIC.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-GJGTMLPE.js";
195
- import "./chunk-5H4BICQZ.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-77ASNIEM.js";
202
+ } from "./chunk-47ZN7NKR.js";
202
203
  import "./chunk-7F6RKT6W.js";
203
- import "./chunk-374MZFF4.js";
204
+ import "./chunk-3MFYKBKI.js";
204
205
  import "./chunk-CTPAE36Y.js";
205
206
  import {
206
207
  listHerdrProjectPaneRoots,
207
208
  restoreHerdrProjectPaneSnapshots
208
- } from "./chunk-PYOAIN3V.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-GRJHIXYF.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-S2Q75LP3.js";
224
+ } from "./chunk-L4YY2TOE.js";
224
225
  import {
225
226
  clearRuntimeAgentsForPi,
226
227
  listRuntimeAgentConfigs,
227
228
  mergeRuntimeAgents
228
- } from "./chunk-NAFLUJ26.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-QGO6HXHG.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-7QA7ZA46.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-7QA7ZA46.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-2IYBCYFU.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-7QA7ZA46.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) {
@@ -9557,13 +9570,14 @@ ${close}` }]
9557
9570
  supervisorChannel.activateTransport();
9558
9571
  });
9559
9572
  pi.on("session_shutdown", async (event) => {
9573
+ const parentSessionFile = state.parentSessionFile ?? void 0;
9560
9574
  sessionSwitchGuard.sessionShutdown(event);
9561
9575
  cancelCompactionResume();
9562
9576
  completionNotifier.sessionShutdown(event?.reason);
9563
9577
  parentWake.sessionShutdown(event?.reason);
9564
9578
  runtimeEntry.cleanup(event?.reason);
9565
9579
  try {
9566
- await disposeChildSessions();
9580
+ await disposeChildSessionsForParent(parentSessionFile);
9567
9581
  } catch (error) {
9568
9582
  console.error("Failed to dispose in-process child sessions:", error);
9569
9583
  }