@vicary/pi-subagents 0.83.1 → 0.84.0-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/bundle/{chunk-YXFJVCOL.js → chunk-4E7BKDTX.js} +3 -3
  3. package/bundle/{chunk-UFL7IYCW.js → chunk-4MDR6V46.js} +8 -8
  4. package/bundle/{chunk-AHIFYGR3.js → chunk-67ENPDDA.js} +5 -5
  5. package/bundle/{chunk-ZVOAMTUQ.js → chunk-AKOIVLA5.js} +3 -3
  6. package/bundle/{chunk-RNIZLSEA.js → chunk-CGN2TVE7.js} +1 -0
  7. package/bundle/{chunk-NPIYWVOD.js → chunk-F4AMYP5N.js} +3 -3
  8. package/bundle/{chunk-C7JMPU5F.js → chunk-HKJLSMXV.js} +1 -1
  9. package/bundle/{chunk-UYK5MZWE.js → chunk-L3WFKBEI.js} +1 -1
  10. package/bundle/{chunk-F5DBXJ2G.js → chunk-LGLEH7B6.js} +8 -5
  11. package/bundle/{chunk-VLFZIN6D.js → chunk-NENDSQUY.js} +2 -2
  12. package/bundle/{chunk-QP5ZWNIS.js → chunk-PALJGGYC.js} +1 -1
  13. package/bundle/{chunk-IPGZMQXV.js → chunk-PV63UFUR.js} +5 -5
  14. package/bundle/{chunk-MABL3FUM.js → chunk-T44HVL5U.js} +1 -1
  15. package/bundle/{chunk-V6YPYWJP.js → chunk-TE4LHYHN.js} +25 -17
  16. package/bundle/{chunk-HCSINC66.js → chunk-X2MXCSA5.js} +24 -21
  17. package/bundle/index.js +1 -1
  18. package/bundle/preflight.js +2 -2
  19. package/docs/agents.md +1 -1
  20. package/docs/configuration.md +6 -6
  21. package/docs/observability.md +1 -1
  22. package/docs/tool-reference.md +1 -1
  23. package/docs/workflows.md +1 -1
  24. package/package.json +2 -2
  25. package/src/extension/schemas.js +1 -1
  26. package/src/runs/background/async-execution.d.ts +3 -1
  27. package/src/runs/background/async-execution.js +16 -2
  28. package/src/runs/background/async-retention.d.ts +1 -0
  29. package/src/runs/background/async-retention.js +16 -10
  30. package/src/runs/background/auto-drain.d.ts +0 -1
  31. package/src/runs/background/auto-drain.js +5 -5
  32. package/src/runs/background/run-child-session.d.ts +2 -0
  33. package/src/runs/background/run-child-session.js +9 -1
  34. package/src/runs/background/subagent-runner.js +1 -0
  35. package/src/runs/foreground/subagent-executor.d.ts +4 -6
  36. package/src/runs/foreground/subagent-executor.js +11 -18
  37. package/src/runs/shared/child-session.d.ts +2 -0
  38. package/src/runs/shared/child-session.js +1 -0
  39. package/src/runs/shared/model-resolution-diagnostic.d.ts +11 -0
  40. package/src/runs/shared/model-resolution-diagnostic.js +25 -0
  41. package/src/runs/shared/parallel-utils.d.ts +2 -0
  42. package/src/shared/types.d.ts +5 -6
  43. package/src/workflows/scripted-workflow.js +2 -0
  44. package/workflow-script-worker.cjs +449 -175
package/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.84.0] - 2026-10-28
6
+
7
+ ### Highlights
8
+
9
+ - Security fix: workflow scripts can no longer reach the Pi process outside their sandbox. Upgrade if you use workflow scripts.
10
+ - A locked-down background agent that fails because one of your extensions' providers did not load in it now says which provider and how to load it.
11
+ - Old background runs are now actually deleted from disk.
12
+
13
+ ### Security
14
+
15
+ - Workflow scripts could reach the Pi process outside their sandbox. Upgrade to this version; see [GHSA-6v8j-6w28-2w8r](https://github.com/nicobailon/pi-subagents/security/advisories/GHSA-6v8j-6w28-2w8r) for affected versions and a workaround. Workflow scripts can no longer set `Error.prepareStackTrace`, and a script that calls `import()`, which always failed inside a workflow, is now rejected before it runs.
16
+
17
+ ### Fixed
18
+
19
+ - Old background runs are now deleted from disk. Background runs are meant to be removed 30 days after they finish, but a run was kept forever while its Pi session file still existed, and session files are never deleted, so almost no run was ever removed. A run whose session still exists is now kept for 90 days, so you can still resume it for that long, and is then removed like any other finished run. Thanks to [@LCorleone](https://github.com/LCorleone) for the report and fix, and [@isjiajia01](https://github.com/isjiajia01) for reproducing it. (#3098)
20
+ - A background agent that loads no ambient extensions (for example one with `extensions: []`) now says so when it fails on a model whose provider one of your extensions registers or overrides. That extension never loaded in the child, so the child sent its requests through the built-in provider of the same name and failed with an unrelated provider error. The failure now names the provider and how to load its extension for that agent. Thanks to [@Yivas](https://github.com/Yivas) for the report. (#3100)
21
+
5
22
  ## [0.83.1] - 2026-10-27
6
23
 
7
24
  ### Highlights
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  isTrustedRecordedSessionFile,
3
3
  resolveSubagentRunId
4
- } from "./chunk-VLFZIN6D.js";
4
+ } from "./chunk-NENDSQUY.js";
5
5
  import {
6
6
  agentStreamOptions,
7
7
  opencodeSessionHeaders,
8
8
  ownsRun,
9
9
  resolveAsyncResumeTarget
10
- } from "./chunk-UYK5MZWE.js";
10
+ } from "./chunk-L3WFKBEI.js";
11
11
  import {
12
12
  currentCompletionOwnerId,
13
13
  listMissions,
@@ -16,7 +16,7 @@ import {
16
16
  reconcileAsyncRun,
17
17
  resolveAuthorityDecision,
18
18
  resolveMissionStoreLocation
19
- } from "./chunk-RNIZLSEA.js";
19
+ } from "./chunk-CGN2TVE7.js";
20
20
  import {
21
21
  deliverInterruptRequest,
22
22
  queueRevivalBrief,
@@ -11,7 +11,7 @@ import {
11
11
  projectTimeoutRecovery,
12
12
  readAsyncRecoveryDescriptor,
13
13
  utf8Tail
14
- } from "./chunk-UYK5MZWE.js";
14
+ } from "./chunk-L3WFKBEI.js";
15
15
  import {
16
16
  MAX_ARGS_BYTES,
17
17
  MAX_ARGS_DEPTH,
@@ -24,7 +24,7 @@ import {
24
24
  resultFilePath,
25
25
  resultPayloadMatchesSessionRun,
26
26
  resultPayloadPathForSessionRun
27
- } from "./chunk-RNIZLSEA.js";
27
+ } from "./chunk-CGN2TVE7.js";
28
28
  import {
29
29
  shouldUseNativeFsWatch
30
30
  } from "./chunk-NIXWDZZV.js";
@@ -1800,7 +1800,7 @@ var SubagentParamProperties = {
1800
1800
  description: "fresh/fork overrides every child; profile requires agent's declared defaultContext, ignoring config. Omitted: defaultSubagentContext wins over each agent defaultContext; implicit fork needs persisted parent + leaf, else fresh. forkContext may prune forks before spawn."
1801
1801
  })),
1802
1802
  async: Type2.Optional(Type2.Boolean({ description: "Background; default asyncByDefault. false only to block parent." })),
1803
- timeoutMs: Type2.Optional(Type2.Integer({ minimum: 1, description: "Foreground and single async runs use config timeoutMs, else 30m; async composites have no default parent deadline. Alias maxRuntimeMs; must agree." })),
1803
+ timeoutMs: Type2.Optional(Type2.Integer({ minimum: 1, description: "Foreground and single async runs use config timeoutMs when set; otherwise no runtime deadline. Async composites have no default parent deadline. Alias maxRuntimeMs; must agree." })),
1804
1804
  maxRuntimeMs: Type2.Optional(Type2.Integer({ minimum: 1, description: "Alias timeoutMs (same defaults)." })),
1805
1805
  checkpointBeforeDeadlineMs: Type2.Optional(Type2.Integer({ minimum: 1, maximum: 2147483647, description: "Async single-agent runs only: the runner requests that the child checkpoint and stop this many ms before the run deadline (best-effort; the deadline kill still applies)." })),
1806
1806
  toolTimeoutMs: Type2.Optional(Type2.Integer({ minimum: 1, description: "Per-tool deadline (ms); fast builtins default 5m." })),
@@ -3218,7 +3218,7 @@ Timeout or a user message ends the wait without error; work keeps running.${enab
3218
3218
  }
3219
3219
 
3220
3220
  // src/runs/background/auto-drain.ts
3221
- var DEFAULT_AUTO_DRAIN_TIMEOUT_MS = 30 * 60 * 1e3;
3221
+ var AUTO_DRAIN_WAIT_WINDOW_MS = 30 * 60 * 1e3;
3222
3222
  function resultText(value) {
3223
3223
  return value.content.map((part) => part.type === "text" ? part.text : "").join(" ").trim();
3224
3224
  }
@@ -3241,9 +3241,9 @@ async function drainOutstandingWork(deps, observation) {
3241
3241
  try {
3242
3242
  if (!sessionId) throw new Error("Cannot auto-drain background work without an active session identity.");
3243
3243
  const now = deps.now ?? Date.now;
3244
- const timeoutMs = deps.timeoutMs ?? DEFAULT_AUTO_DRAIN_TIMEOUT_MS;
3245
- if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) throw new Error("Auto-drain timeoutMs must be a positive finite number.");
3246
- const deadlineAt = now() + timeoutMs;
3244
+ const timeoutMs = deps.timeoutMs;
3245
+ if (timeoutMs !== void 0 && (!Number.isFinite(timeoutMs) || timeoutMs <= 0)) throw new Error("Auto-drain timeoutMs must be a positive finite number.");
3246
+ const deadlineAt = timeoutMs === void 0 ? void 0 : now() + timeoutMs;
3247
3247
  const hasWork = deps.hasWork ?? ((id2, time) => hasOutstandingWork(deps, id2, time, observation));
3248
3248
  const wait = deps.wait ?? waitForSubagents;
3249
3249
  while (true) {
@@ -3252,7 +3252,7 @@ async function drainOutstandingWork(deps, observation) {
3252
3252
  const work = hasWork(sessionId, now());
3253
3253
  observation?.predicate(work);
3254
3254
  if (!work) break;
3255
- const remainingMs = deadlineAt - now();
3255
+ const remainingMs = deadlineAt === void 0 ? AUTO_DRAIN_WAIT_WINDOW_MS : deadlineAt - now();
3256
3256
  if (remainingMs <= 0) {
3257
3257
  throw new Error(`Auto-drain timed out after ${timeoutMs}ms with background work still active in session '${sessionId}'.`);
3258
3258
  }
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  rewriteSubagentPrompt
3
- } from "./chunk-NPIYWVOD.js";
3
+ } from "./chunk-F4AMYP5N.js";
4
4
  import {
5
5
  package_default
6
- } from "./chunk-MABL3FUM.js";
7
- import "./chunk-UFL7IYCW.js";
6
+ } from "./chunk-T44HVL5U.js";
7
+ import "./chunk-4MDR6V46.js";
8
8
  import {
9
9
  MODEL_ONLY_TOOL
10
- } from "./chunk-UYK5MZWE.js";
10
+ } from "./chunk-L3WFKBEI.js";
11
11
  import "./chunk-NF7IEKBH.js";
12
12
  import {
13
13
  appendAgentRefinementOverlay
14
14
  } from "./chunk-LFDBD4PW.js";
15
- import "./chunk-RNIZLSEA.js";
15
+ import "./chunk-CGN2TVE7.js";
16
16
  import "./chunk-NIXWDZZV.js";
17
17
  import "./chunk-C5P5CHYK.js";
18
18
  import "./chunk-7F6RKT6W.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildWorkflowChatProgressRows
3
- } from "./chunk-VLFZIN6D.js";
3
+ } from "./chunk-NENDSQUY.js";
4
4
  import {
5
5
  aggregateStepStatus,
6
6
  contextModeBadge,
@@ -25,13 +25,13 @@ import {
25
25
  projectWorkflowChecklist,
26
26
  withCachedUiContext,
27
27
  workflowGraphStageNodes
28
- } from "./chunk-UYK5MZWE.js";
28
+ } from "./chunk-L3WFKBEI.js";
29
29
  import {
30
30
  flatToLogicalStepIndex,
31
31
  formatWorkflowJsonPreview,
32
32
  hostStepReportName,
33
33
  hostStepVerdictLabel
34
- } from "./chunk-RNIZLSEA.js";
34
+ } from "./chunk-CGN2TVE7.js";
35
35
  import {
36
36
  snapshotExternalRuns
37
37
  } from "./chunk-UKG4V45O.js";
@@ -2517,6 +2517,7 @@ ${script}
2517
2517
  if (node !== wrapper && node.async === true && (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression")) {
2518
2518
  errors.push({ message: "workflowScript does not support nested async functions. Use top-level await, plain helper functions that return runs.run(...), or explicit Promise chains.", ...nodeLocation(node) });
2519
2519
  }
2520
+ if (node.type === "ImportExpression") errors.push({ message: "workflowScript cannot load modules with import().", ...nodeLocation(node) });
2520
2521
  if (directRunsCall(node, "run")) {
2521
2522
  const args = Array.isArray(node.arguments) ? node.arguments : [];
2522
2523
  const keyNode = astNode(args[0]) ? args[0] : void 0;
@@ -15,15 +15,15 @@ import {
15
15
  resolveCurrentSessionId,
16
16
  resolveWatchdogReviewModel,
17
17
  startWatchdogDiffBaselineCapture
18
- } from "./chunk-UFL7IYCW.js";
18
+ } from "./chunk-4MDR6V46.js";
19
19
  import {
20
20
  MODEL_ONLY_TOOL,
21
21
  agentStreamOptions,
22
22
  opencodeSessionHeaders
23
- } from "./chunk-UYK5MZWE.js";
23
+ } from "./chunk-L3WFKBEI.js";
24
24
  import {
25
25
  inheritedNestedRouteOf
26
- } from "./chunk-RNIZLSEA.js";
26
+ } from "./chunk-CGN2TVE7.js";
27
27
  import {
28
28
  CHILD_WATCHDOG_STATUS_EVENT,
29
29
  MISSING_STRUCTURED_ACCEPTANCE_REPORT_ERROR,
@@ -16,7 +16,7 @@ import {
16
16
  } from "./chunk-2D52JFLF.js";
17
17
  import {
18
18
  package_default
19
- } from "./chunk-MABL3FUM.js";
19
+ } from "./chunk-T44HVL5U.js";
20
20
  import {
21
21
  HERDR_PI_MODE_ENV,
22
22
  HERDR_PI_PROTOCOL,
@@ -39,7 +39,7 @@ import {
39
39
  validateModelResponseAliases,
40
40
  withWorkflowChildRunModel,
41
41
  withWorktreeTransaction
42
- } from "./chunk-RNIZLSEA.js";
42
+ } from "./chunk-CGN2TVE7.js";
43
43
  import {
44
44
  validateIntercomBridgeConfig
45
45
  } from "./chunk-C5P5CHYK.js";
@@ -11,10 +11,10 @@ import {
11
11
  startWatchdogDiffBaselineCapture,
12
12
  writeUserWatchdogEnabled,
13
13
  writeWatchdogModelSettings
14
- } from "./chunk-UFL7IYCW.js";
14
+ } from "./chunk-4MDR6V46.js";
15
15
  import {
16
16
  resolveGitRepositoryIdentity
17
- } from "./chunk-VLFZIN6D.js";
17
+ } from "./chunk-NENDSQUY.js";
18
18
  import {
19
19
  listAsyncRuns,
20
20
  ownsRun,
@@ -22,7 +22,7 @@ import {
22
22
  parseWorkflowChildSummary,
23
23
  readAsyncRecoveryDescriptor,
24
24
  resolveRetainedWorktreeCwd
25
- } from "./chunk-UYK5MZWE.js";
25
+ } from "./chunk-L3WFKBEI.js";
26
26
  import {
27
27
  deepFreezeWorkflowArgs,
28
28
  normalizeWorkflowArgs
@@ -50,7 +50,7 @@ import {
50
50
  resolveMissionStoreLocation,
51
51
  validateMissionId,
52
52
  workflowRunParamsFingerprint
53
- } from "./chunk-RNIZLSEA.js";
53
+ } from "./chunk-CGN2TVE7.js";
54
54
  import {
55
55
  requestAsyncCommand,
56
56
  watchAsyncControlInbox
@@ -7683,6 +7683,9 @@ function createDefaultChildSessionFactory(options = {}) {
7683
7683
  get inheritedProvider() {
7684
7684
  return session.model && inheritedProviders.has(session.model.provider) ? session.model.provider : void 0;
7685
7685
  },
7686
+ get claimedProvider() {
7687
+ return session.model && !inheritedProviders.has(session.model.provider) && modelRuntime.getRegisteredProviderIds().includes(session.model.provider) ? session.model.provider : void 0;
7688
+ },
7686
7689
  get virtualModelId() {
7687
7690
  return session.model?.api === "pi-virtual" ? `${session.model.provider}/${session.model.id}` : void 0;
7688
7691
  },
@@ -7718,7 +7721,7 @@ function childSessionFactory() {
7718
7721
  }
7719
7722
  function createLazyPlacementFactory(local) {
7720
7723
  let placed;
7721
- const factory = async () => placed ??= (await import("./chunk-C7JMPU5F.js")).createPlacementAwareChildSessionFactory(local);
7724
+ const factory = async () => placed ??= (await import("./chunk-HKJLSMXV.js")).createPlacementAwareChildSessionFactory(local);
7722
7725
  return {
7723
7726
  async create(launch) {
7724
7727
  return launch.machine ? (await factory()).create(launch) : local.create(launch);
@@ -13,7 +13,7 @@ import {
13
13
  summarizeContextModes,
14
14
  utf8Tail,
15
15
  workflowPreflightLaneForRuntimeKey
16
- } from "./chunk-UYK5MZWE.js";
16
+ } from "./chunk-L3WFKBEI.js";
17
17
  import {
18
18
  assertSafeNestedId,
19
19
  checkRecordedPidLiveness,
@@ -32,7 +32,7 @@ import {
32
32
  updateActiveRunIndex,
33
33
  validateModelResponseAliases,
34
34
  writeAsyncResultFile
35
- } from "./chunk-RNIZLSEA.js";
35
+ } from "./chunk-CGN2TVE7.js";
36
36
  import {
37
37
  deliverStopRequest,
38
38
  stopInboxClosedPath
@@ -11,7 +11,7 @@ import {
11
11
  validateAuthorityPolicy,
12
12
  validateMissionStoreConfig,
13
13
  validateModelResponseAliases
14
- } from "./chunk-RNIZLSEA.js";
14
+ } from "./chunk-CGN2TVE7.js";
15
15
  import {
16
16
  getAgentDir,
17
17
  readStatus,
@@ -6,25 +6,25 @@ import {
6
6
  resolveWorkflowForegroundSteeringTarget,
7
7
  steerAsyncRun,
8
8
  steerWorkflowForegroundTarget
9
- } from "./chunk-YXFJVCOL.js";
9
+ } from "./chunk-4E7BKDTX.js";
10
10
  import {
11
11
  FLEET_STATUS_WIDGET_KEY,
12
12
  reportFleetWarning,
13
13
  runningTone,
14
14
  stepTaskSummary
15
- } from "./chunk-ZVOAMTUQ.js";
15
+ } from "./chunk-AKOIVLA5.js";
16
16
  import {
17
17
  foregroundChildStateLabel,
18
18
  formatAsyncRunTranscript,
19
19
  stopAsyncRun
20
- } from "./chunk-VLFZIN6D.js";
20
+ } from "./chunk-NENDSQUY.js";
21
21
  import {
22
22
  contextModeBadge,
23
23
  contextModeLabel,
24
24
  decodeUtf8Tail,
25
25
  listAsyncRuns
26
- } from "./chunk-UYK5MZWE.js";
27
- import "./chunk-RNIZLSEA.js";
26
+ } from "./chunk-L3WFKBEI.js";
27
+ import "./chunk-CGN2TVE7.js";
28
28
  import "./chunk-F4ASL6OV.js";
29
29
  import "./chunk-NIXWDZZV.js";
30
30
  import "./chunk-C5P5CHYK.js";
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "pi-subagents",
4
- version: "0.83.1",
4
+ version: "0.84.0-1",
5
5
  private: true,
6
6
  description: "Pi extension for single-agent delegation and scripted multi-agent workflows",
7
7
  author: "Nico Bailon",
@@ -3,7 +3,7 @@ import {
3
3
  projectRuntimeAcknowledgedExtensions,
4
4
  registerSubagentPromptBoundary,
5
5
  registerSubagentPromptRuntime
6
- } from "./chunk-NPIYWVOD.js";
6
+ } from "./chunk-F4AMYP5N.js";
7
7
  import {
8
8
  INSPECTOR_ACTIONS,
9
9
  canQueueRetainedAsyncFollowUp,
@@ -25,7 +25,7 @@ import {
25
25
  updateSteeringTarget,
26
26
  waitForSteeringAction,
27
27
  workflowAsyncChildSteeringGuidance
28
- } from "./chunk-YXFJVCOL.js";
28
+ } from "./chunk-4E7BKDTX.js";
29
29
  import {
30
30
  PLACED_RESTORE_UNSUPPORTED,
31
31
  formatHerdrMachineRunnerUnsupported,
@@ -120,7 +120,7 @@ import {
120
120
  workflowStopCause,
121
121
  writeWorkflowLaunchRecord,
122
122
  writeWorkflowReceipt
123
- } from "./chunk-F5DBXJ2G.js";
123
+ } from "./chunk-LGLEH7B6.js";
124
124
  import {
125
125
  NATIVE_SUPERVISOR_TOOL_NAME,
126
126
  SUBAGENT_PARENT_SESSION_ENV,
@@ -136,7 +136,7 @@ import {
136
136
  resolveWatchdogConfig,
137
137
  sendRuleViolationWarning,
138
138
  writeWatchdogModelSettings
139
- } from "./chunk-UFL7IYCW.js";
139
+ } from "./chunk-4MDR6V46.js";
140
140
  import {
141
141
  MAX_REMEMBERED_FOREGROUND_RUNS,
142
142
  discardRunningForegroundRun,
@@ -149,7 +149,7 @@ import {
149
149
  resolveSubagentRunId,
150
150
  resolveWorkflowChatProgress,
151
151
  stopAsyncRun
152
- } from "./chunk-VLFZIN6D.js";
152
+ } from "./chunk-NENDSQUY.js";
153
153
  import {
154
154
  MODEL_ONLY_TOOL,
155
155
  RunFanoutLimitError,
@@ -211,7 +211,7 @@ import {
211
211
  writeParallelHandoffGroup,
212
212
  writeRunFanoutBudgetDescriptor,
213
213
  writeWorktreeSetupHandoff
214
- } from "./chunk-UYK5MZWE.js";
214
+ } from "./chunk-L3WFKBEI.js";
215
215
  import {
216
216
  authorizeWorkflowResourceHost,
217
217
  claimWorkflowChildPermit,
@@ -246,7 +246,7 @@ import {
246
246
  resolveDisabledFeatureSurface,
247
247
  resolveMaxActiveAsyncRunsPerSession,
248
248
  transferActiveAsyncCapacity
249
- } from "./chunk-QP5ZWNIS.js";
249
+ } from "./chunk-PALJGGYC.js";
250
250
  import {
251
251
  DEFAULT_STALE_TERMINAL_ACTIVE_MARKER_MS,
252
252
  MACHINE_DIFF_OPTIONS,
@@ -326,7 +326,7 @@ import {
326
326
  writeNestedControlRequest,
327
327
  writeNestedControlResult,
328
328
  writeNestedEvent
329
- } from "./chunk-RNIZLSEA.js";
329
+ } from "./chunk-CGN2TVE7.js";
330
330
  import {
331
331
  closeSteerInbox,
332
332
  consumeSteerRequests,
@@ -1649,7 +1649,11 @@ function sourceUnderNodeModules() {
1649
1649
  function supportsNativeRunner(nodeExecutable) {
1650
1650
  return Boolean(process.features.typescript) && typeof nodeModule.registerHooks === "function" && nodeExecutable === process.execPath && !sourceUnderNodeModules();
1651
1651
  }
1652
- var DEFAULT_ASYNC_TIMEOUT_MS = 30 * 60 * 1e3;
1652
+ function parentExtensionProviderForChild(ctx, disableAmbientExtensions, model, availableModels, preferredProvider) {
1653
+ if (!disableAmbientExtensions || !ctx.parentProviderRegistry) return void 0;
1654
+ const provider = findModelInfo(model, availableModels, preferredProvider)?.provider;
1655
+ return provider && ctx.parentProviderRegistry.getRegisteredProviderIds().includes(provider) ? provider : void 0;
1656
+ }
1653
1657
  function formatAsyncStartedMessage(headline, interactive) {
1654
1658
  const guidance = interactive ? [
1655
1659
  "Detached. Return control now: native completion wakes you, so do not sleep, poll, or call bg_wait for it.",
@@ -2376,6 +2380,7 @@ function buildAsyncRunnerSteps(id, params) {
2376
2380
  runtimeSnapshotHost: ctx.pi
2377
2381
  });
2378
2382
  const launchResolvedExtensions = externalRunner ? void 0 : projectLaunchResolvedChildExtensions(toolPlan);
2383
+ const parentExtensionProvider = externalRunner || machine ? void 0 : parentExtensionProviderForChild(ctx, toolPlan.disableAmbientExtensions, selectedModel, availableModels, a.modelProvider ?? ctx.currentModelProvider);
2379
2384
  if (externalRunner && permissionRules) {
2380
2385
  throw new AsyncStartValidationError(`Agent '${a.name}' uses runner.type='${externalRunnerType}', which cannot enforce native Pi child permission rules.`);
2381
2386
  }
@@ -2405,6 +2410,7 @@ function buildAsyncRunnerSteps(id, params) {
2405
2410
  thinking: resolveEffectiveThinking(selectedModel, effectiveThinking),
2406
2411
  ...thinkingCeiling ? { thinkingCeiling } : {},
2407
2412
  launchResolvedExtensions,
2413
+ ...parentExtensionProvider ? { parentExtensionProvider } : {},
2408
2414
  ...requestedModel ? { requestedModel } : {},
2409
2415
  ...primaryModelFromParent ? { skipPrimaryModelVerification: true } : {},
2410
2416
  ...availableModels && availableModels.length > 0 ? { modelVerificationRegistry: availableModels } : {},
@@ -2430,7 +2436,7 @@ function buildAsyncRunnerSteps(id, params) {
2430
2436
  outputMode: behavior.outputMode,
2431
2437
  sessionFile,
2432
2438
  maxSubagentDepth: resolveChildMaxSubagentDepth(maxSubagentDepth, a.maxSubagentDepth),
2433
- timeoutMs: a.defaultTimeoutMs ?? DEFAULT_ASYNC_TIMEOUT_MS,
2439
+ timeoutMs: a.defaultTimeoutMs,
2434
2440
  toolTimeoutMs: resolvedToolTimeout.toolTimeoutMs,
2435
2441
  waitToolEnabled: params.waitToolEnabled,
2436
2442
  waitToolDefaultTimeoutMs: params.waitToolDefaultTimeoutMs,
@@ -3161,6 +3167,7 @@ function executeAsyncSingle(id, params) {
3161
3167
  runtimeSnapshotHost: ctx.pi
3162
3168
  });
3163
3169
  const launchResolvedExtensions = externalRunner ? void 0 : projectLaunchResolvedChildExtensions(toolPlan);
3170
+ const parentExtensionProvider = externalRunner || machine ? void 0 : parentExtensionProviderForChild(ctx, toolPlan.disableAmbientExtensions, selectedModel, availableModels, agentConfig.modelProvider ?? ctx.currentModelProvider);
3164
3171
  const fast = params.fast ?? agentConfig.fast;
3165
3172
  const launchThinking = resolveEffectiveThinking(selectedModel, effectiveThinking);
3166
3173
  const { definitionDigest, launchContractDigest } = resolveLaunchBinding({
@@ -3283,6 +3290,7 @@ function executeAsyncSingle(id, params) {
3283
3290
  ...params.fast ?? agentConfig.fast ? { fast: params.fast ?? agentConfig.fast } : {},
3284
3291
  thinking: resolveEffectiveThinking(selectedModel, effectiveThinking),
3285
3292
  ...thinkingCeiling ? { thinkingCeiling } : {},
3293
+ ...parentExtensionProvider ? { parentExtensionProvider } : {},
3286
3294
  ...requestedModel ? { requestedModel } : {},
3287
3295
  ...modelOrigin === "inherited" ? { skipPrimaryModelVerification: true } : {},
3288
3296
  ...availableModels && availableModels.length > 0 ? { modelVerificationRegistry: availableModels } : {},
@@ -10557,6 +10565,7 @@ function appendStepToAsyncChain(input) {
10557
10565
  parentSessionId: input.ctx.sessionManager.getSessionId() ?? void 0,
10558
10566
  parentSessionFile: input.ctx.sessionManager.getSessionFile() ?? void 0,
10559
10567
  currentModelProvider: parentModel?.provider,
10568
+ parentProviderRegistry: input.ctx.modelRegistry,
10560
10569
  currentModel: parentModel,
10561
10570
  scopedModelIds: scopedModelIdsFromContext(input.ctx),
10562
10571
  modelScope: discoveredForAppend.modelScope,
@@ -10959,6 +10968,7 @@ async function resumeExternalJobFollowUp(input) {
10959
10968
  parentSessionId: input.ctx.sessionManager.getSessionId() ?? void 0,
10960
10969
  parentSessionFile: input.ctx.sessionManager.getSessionFile() ?? void 0,
10961
10970
  currentModelProvider: parentModel?.provider,
10971
+ parentProviderRegistry: input.ctx.modelRegistry,
10962
10972
  currentModel: parentModel,
10963
10973
  scopedModelIds: scopedModelIdsFromContext(input.ctx),
10964
10974
  modelScope: input.modelScope,
@@ -11228,6 +11238,7 @@ async function resumeAsyncRun(input) {
11228
11238
  parentSessionId: input.ctx.sessionManager.getSessionId() ?? void 0,
11229
11239
  parentSessionFile: input.ctx.sessionManager.getSessionFile() ?? void 0,
11230
11240
  currentModelProvider: parentModel2?.provider,
11241
+ parentProviderRegistry: input.ctx.modelRegistry,
11231
11242
  currentModel: parentModel2,
11232
11243
  scopedModelIds: scopedModelIdsFromContext(input.ctx),
11233
11244
  modelScope,
@@ -11351,6 +11362,7 @@ async function resumeAsyncRun(input) {
11351
11362
  parentSessionId: input.ctx.sessionManager.getSessionId() ?? void 0,
11352
11363
  parentSessionFile: input.ctx.sessionManager.getSessionFile() ?? void 0,
11353
11364
  currentModelProvider: parentModel?.provider,
11365
+ parentProviderRegistry: input.ctx.modelRegistry,
11354
11366
  currentModel: parentModel,
11355
11367
  scopedModelIds: scopedModelIdsFromContext(input.ctx),
11356
11368
  modelScope,
@@ -11972,7 +11984,6 @@ function validateLaunchOutputSchemaOverrides(params) {
11972
11984
  }
11973
11985
  return void 0;
11974
11986
  }
11975
- var DEFAULT_FOREGROUND_TIMEOUT_MS = 30 * 60 * 1e3;
11976
11987
  var MAX_TIMER_DELAY_MS = 2147483647;
11977
11988
  function timerDelayOverflowError(name, value) {
11978
11989
  return typeof value === "number" && value > MAX_TIMER_DELAY_MS ? `${name} must be a positive integer no larger than ${MAX_TIMER_DELAY_MS}.` : void 0;
@@ -12003,9 +12014,7 @@ function resolveForegroundTimeout(params, defaultTimeoutMs) {
12003
12014
  }
12004
12015
  function resolveSingleAgentLaunchTimeout(params, async, configDefaultTimeoutMs) {
12005
12016
  const isComposite = (params.chain?.length ?? 0) > 0 || (params.tasks?.length ?? 0) > 0 || params.workflowScript !== void 0;
12006
- const foregroundDefault = configDefaultTimeoutMs ?? DEFAULT_FOREGROUND_TIMEOUT_MS;
12007
- const asyncSingleDefault = configDefaultTimeoutMs ?? DEFAULT_ASYNC_TIMEOUT_MS;
12008
- const defaultTimeoutMs = !async ? foregroundDefault : isComposite ? void 0 : asyncSingleDefault;
12017
+ const defaultTimeoutMs = !async || !isComposite ? configDefaultTimeoutMs : void 0;
12009
12018
  return resolveForegroundTimeout(params, defaultTimeoutMs);
12010
12019
  }
12011
12020
  function resolveToolBudget(raw, label = "toolBudget", options) {
@@ -12412,6 +12421,7 @@ async function runAsyncPath(data, deps) {
12412
12421
  parentSessionId: data.parentPiSessionId,
12413
12422
  parentSessionFile: ctx.sessionManager.getSessionFile() ?? void 0,
12414
12423
  currentModelProvider: parentModel?.provider,
12424
+ parentProviderRegistry: ctx.modelRegistry,
12415
12425
  currentModel: parentModel,
12416
12426
  scopedModelIds: data.scopedModelIds,
12417
12427
  modelScope: data.modelScope,
@@ -14048,7 +14058,7 @@ function createSubagentExecutor(deps) {
14048
14058
  const overflowError = timerDelayOverflowError(name, value);
14049
14059
  if (overflowError) return buildRequestedModeError(requestParams, overflowError);
14050
14060
  }
14051
- const timeout = requestParams.timeoutMs ?? requestParams.maxRuntimeMs ?? (requestParams.async === false ? resolveConfigDefaultTimeoutMs(deps2.config.timeoutMs) ?? DEFAULT_FOREGROUND_TIMEOUT_MS : void 0);
14061
+ const timeout = requestParams.timeoutMs ?? requestParams.maxRuntimeMs ?? (requestParams.async === false ? resolveConfigDefaultTimeoutMs(deps2.config.timeoutMs) : void 0);
14052
14062
  const workflowUsageBudget = validateUsageBudgetConfig(requestParams.usageBudget ?? deps2.config.usageBudget, requestParams.usageBudget ? "usageBudget" : "config.usageBudget");
14053
14063
  if (workflowUsageBudget.error) return buildRequestedModeError(requestParams, workflowUsageBudget.error);
14054
14064
  const workflowCwd = resolveRequestedCwd(parentCwd, requestParams.cwd);
@@ -16626,8 +16636,6 @@ ${first.text}` };
16626
16636
  return { execute: executeWithSingleDispatchGuard, executePublic, executeDelegated, executeScheduled, executeWorkflowResume, getCurrentSupervisorOwnerStates };
16627
16637
  }
16628
16638
  export {
16629
- DEFAULT_ASYNC_TIMEOUT_MS,
16630
- DEFAULT_FOREGROUND_TIMEOUT_MS,
16631
16639
  bindMissionWorkflowChildAsyncLaunch,
16632
16640
  createSubagentExecutor,
16633
16641
  foregroundResultIntercomStatus,