@vicary/pi-subagents 0.86.0 → 0.87.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 (86) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +2 -2
  4. package/bundle/{chunk-7QA7ZA46.js → chunk-2D2DQGC2.js} +9 -9
  5. package/bundle/{chunk-UR7OW5S7.js → chunk-2NY5PCKQ.js} +11 -5
  6. package/bundle/{chunk-PYOAIN3V.js → chunk-3CVOAS77.js} +2 -2
  7. package/bundle/{chunk-YK3QYNLE.js → chunk-6O7YH2QV.js} +1 -1
  8. package/bundle/{chunk-DD22RXYJ.js → chunk-75LVXBSA.js} +166 -60
  9. package/bundle/{chunk-S2Q75LP3.js → chunk-BFF6YDK6.js} +1 -1
  10. package/bundle/{chunk-QGO6HXHG.js → chunk-C3KWLXDH.js} +79 -63
  11. package/bundle/{chunk-NAFLUJ26.js → chunk-C5QWQSSM.js} +1 -1
  12. package/bundle/{chunk-77ASNIEM.js → chunk-ESWW6XSX.js} +1 -1
  13. package/bundle/{chunk-3RKFH2UZ.js → chunk-HDICKROY.js} +5 -5
  14. package/bundle/{chunk-XOFYXQKZ.js → chunk-HTI7DD5D.js} +2 -2
  15. package/bundle/{chunk-WN2E5XHN.js → chunk-LZKVUWIY.js} +4 -4
  16. package/bundle/{chunk-6VD7BGIC.js → chunk-M2VBGET6.js} +2 -2
  17. package/bundle/{chunk-2DITXA3H.js → chunk-NJTSXIMG.js} +12 -12
  18. package/bundle/{chunk-QFLPV64W.js → chunk-NMYBVCGP.js} +25 -24
  19. package/bundle/{chunk-CJHFDQFJ.js → chunk-O7A26O6B.js} +8 -6
  20. package/bundle/{chunk-7ZUFN6ME.js → chunk-OOE3R7IQ.js} +1 -1
  21. package/bundle/{chunk-GJGTMLPE.js → chunk-PGU4TZV3.js} +79 -32
  22. package/bundle/{chunk-WHC2XHGF.js → chunk-PUSTU4Q7.js} +75 -33
  23. package/bundle/{chunk-374MZFF4.js → chunk-SIAQXPJ4.js} +6 -8
  24. package/bundle/{chunk-LGINOOY5.js → chunk-USRX7QXD.js} +2 -2
  25. package/bundle/{chunk-5H4BICQZ.js → chunk-VFUFOZBU.js} +1 -1
  26. package/bundle/{chunk-NF7IEKBH.js → chunk-W2BZS6UC.js} +27 -13
  27. package/bundle/{chunk-ZPY5QZCS.js → chunk-W52LJANO.js} +1 -1
  28. package/bundle/{chunk-GRJHIXYF.js → chunk-XSDYTXHF.js} +18 -11
  29. package/bundle/{chunk-BGXEAYUM.js → chunk-XV7RTWTS.js} +3 -3
  30. package/bundle/{chunk-BU6PFPVX.js → chunk-YEXKJJVS.js} +12 -7
  31. package/bundle/{chunk-GLVJMI6R.js → chunk-Z4TR7MK6.js} +5 -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 +3 -3
  39. package/docs/configuration.md +12 -4
  40. package/docs/extension-api.md +2 -0
  41. package/docs/models.md +6 -2
  42. package/docs/tool-reference.md +1 -0
  43. package/package.json +2 -2
  44. package/skills/pi-subagents/SKILL.md +7 -4
  45. package/skills/pi-subagents/references/prompting-and-roles.md +1 -0
  46. package/src/agents/agent-management.js +10 -6
  47. package/src/agents/agent-serializer.d.ts +2 -0
  48. package/src/agents/agent-serializer.js +1 -1
  49. package/src/agents/agents.js +37 -12
  50. package/src/api/preflight.d.ts +3 -1
  51. package/src/api/preflight.js +2 -0
  52. package/src/extension/index.js +4 -2
  53. package/src/extension/schemas.d.ts +2 -0
  54. package/src/extension/schemas.js +1 -0
  55. package/src/runs/background/async-execution.d.ts +2 -1
  56. package/src/runs/background/async-execution.js +4 -2
  57. package/src/runs/background/runner-aliases.js +15 -0
  58. package/src/runs/background/wait-subscriptions.js +124 -12
  59. package/src/runs/foreground/async-stop-action.d.ts +1 -1
  60. package/src/runs/foreground/async-stop-action.js +9 -1
  61. package/src/runs/foreground/execution.js +1 -0
  62. package/src/runs/foreground/subagent-executor.d.ts +1 -0
  63. package/src/runs/foreground/subagent-executor.js +51 -8
  64. package/src/runs/shared/child-session.d.ts +5 -4
  65. package/src/runs/shared/child-session.js +43 -33
  66. package/src/runs/shared/herdr-placed-run.js +3 -2
  67. package/src/runs/shared/mcp-config-sources.d.ts +2 -1
  68. package/src/runs/shared/mcp-config-sources.js +1 -1
  69. package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +0 -1
  70. package/src/runs/shared/mcp-direct-tool-allowlist.js +5 -6
  71. package/src/runs/shared/model-resolution.d.ts +19 -4
  72. package/src/runs/shared/model-resolution.js +50 -51
  73. package/src/shared/artifacts.js +25 -13
  74. package/src/shared/pruned-fork.js +2 -2
  75. package/src/shared/types.d.ts +14 -0
  76. package/src/watchdog/model-selection.js +2 -2
  77. package/src/watchdog/review.js +2 -2
  78. package/src/workflows/scripted-workflow.d.ts +2 -0
  79. package/src/workflows/scripted-workflow.js +103 -39
  80. package/src/workflows/structured-workflow-scripts.d.ts +4 -3
  81. package/src/workflows/structured-workflow-scripts.js +32 -11
  82. package/src/workflows/workflow-resources.js +4 -4
  83. package/src/workflows/workflow-resume-claim.d.ts +2 -0
  84. package/src/workflows/workflow-resume-claim.js +1 -1
  85. package/src/workflows/workflow-resume.d.ts +1 -1
  86. package/src/workflows/workflow-resume.js +3 -1
@@ -57,7 +57,7 @@ import registerSubagentNotify from "../runs/background/notify.js";
57
57
  import { createParentWake } from "../shared/parent-wake.js";
58
58
  import { handleSubagentSteeringNotice } from "./steering-notices.js";
59
59
  import { SUBAGENT_CHILD_ENV, SUBAGENT_PARENT_SESSION_ENV } from "../runs/shared/child-runtime-config.js";
60
- import { disposeChildSessions } from "../runs/shared/child-session.js";
60
+ import { disposeChildSessionsForParent } from "../runs/shared/child-session.js";
61
61
  import { resolveCurrentSubagentCapabilityCeiling } from "../runs/shared/capability-ceiling.js";
62
62
  import { loadConfig, resolveAsyncByDefault, resolveScheduledStoreRoot } from "./config.js";
63
63
  import { buildSubagentToolDescription, buildSubagentToolPromptMetadata } from "./tool-description.js";
@@ -1196,13 +1196,15 @@ export default function registerSubagentExtension(pi) {
1196
1196
  supervisorChannel.activateTransport();
1197
1197
  });
1198
1198
  pi.on("session_shutdown", async (event) => {
1199
+ // Captured first: runtimeEntry.cleanup() below clears state.parentSessionFile.
1200
+ const parentSessionFile = state.parentSessionFile ?? undefined;
1199
1201
  sessionSwitchGuard.sessionShutdown(event);
1200
1202
  cancelCompactionResume();
1201
1203
  completionNotifier.sessionShutdown(event?.reason);
1202
1204
  parentWake.sessionShutdown(event?.reason);
1203
1205
  runtimeEntry.cleanup(event?.reason);
1204
1206
  try {
1205
- await disposeChildSessions();
1207
+ await disposeChildSessionsForParent(parentSessionFile);
1206
1208
  }
1207
1209
  catch (error) {
1208
1210
  console.error("Failed to dispose in-process child sessions:", error);
@@ -19,6 +19,7 @@ export declare const SubagentFlatParams: Type.TObject<{
19
19
  supersession: Type.TOptional<Type.TUnsafe<unknown>>;
20
20
  index: Type.TOptional<Type.TInteger>;
21
21
  childId: Type.TOptional<Type.TString>;
22
+ drain: Type.TOptional<Type.TBoolean>;
22
23
  toolCallId: Type.TOptional<Type.TString>;
23
24
  view: Type.TOptional<Type.TString>;
24
25
  lines: Type.TOptional<Type.TInteger>;
@@ -150,6 +151,7 @@ export declare const SubagentOptionParams: Type.TObject<{
150
151
  supersession: Type.TOptional<Type.TUnsafe<unknown>>;
151
152
  index: Type.TOptional<Type.TInteger>;
152
153
  childId: Type.TOptional<Type.TString>;
154
+ drain: Type.TOptional<Type.TBoolean>;
153
155
  toolCallId: Type.TOptional<Type.TString>;
154
156
  view: Type.TOptional<Type.TString>;
155
157
  lines: Type.TOptional<Type.TInteger>;
@@ -159,6 +159,7 @@ const SubagentParamProperties = {
159
159
  supersession: Type.Optional(Type.Unsafe({ type: "object", additionalProperties: true, description: "lane.recordSupersession evidence; read guide tool-reference." })),
160
160
  index: Type.Optional(Type.Integer({ minimum: 0, description: "Zero-based child/transcript index." })),
161
161
  childId: Type.Optional(Type.String({ minLength: 1, maxLength: 256, description: "Child-scoped stop identity." })),
162
+ drain: Type.Optional(Type.Boolean({ description: "stop: a live async workflow starts no new children; started ones finish." })),
162
163
  toolCallId: Type.Optional(Type.String({ description: "Command tool-call id." })),
163
164
  view: Type.Optional(Type.String({
164
165
  enum: ["fleet", "transcript"],
@@ -5,7 +5,7 @@ import { type ClaudeCodeOverride } from "../shared/claude-code-adapter.ts";
5
5
  import { type ChainStep } from "../../shared/settings.ts";
6
6
  import { type RunnerStep } from "../shared/parallel-utils.ts";
7
7
  import type { ContextMode } from "../shared/context-mode.ts";
8
- import { type AvailableModelInfo, type ModelOrigin, type ParentModel } from "../shared/model-resolution.ts";
8
+ import { type AvailableModelInfo, type KnownProviders, type ModelOrigin, type ParentModel } from "../shared/model-resolution.ts";
9
9
  import { type ModelScopeConfig } from "../shared/model-scope.ts";
10
10
  import { type ThinkingLevel } from "../../shared/thinking-ceiling.ts";
11
11
  import { buildWorkflowGraphSnapshot } from "../shared/workflow-graph.ts";
@@ -32,6 +32,7 @@ interface AsyncExecutionContext {
32
32
  currentModelProvider?: string;
33
33
  currentModel?: ParentModel;
34
34
  scopedModelIds?: string[];
35
+ knownProviders?: KnownProviders;
35
36
  /** Optional model-scope enforcement resolved from subagent settings. */
36
37
  modelScope?: ModelScopeConfig;
37
38
  modelResponseAliases?: Record<string, string[]>;
@@ -956,7 +956,7 @@ export function buildAsyncRunnerSteps(id, params) {
956
956
  const modelScopes = resolveModelScopesForAgent(ctx.modelScope, a.name, ctx.currentModel, ctx.scopedModelIds);
957
957
  const modelOrigin = resolveModelOrigin({ explicitModel: s.model, agentModel: a.model, parentModel: ctx.currentModel });
958
958
  const primaryModelFromParent = modelOrigin === "inherited";
959
- const primaryModel = externalRunner ? undefined : resolveEffectiveSubagentModel(s.model, a.model, ctx.currentModel, availableModels, a.modelProvider ?? ctx.currentModelProvider, { scope: modelScopes, source: modelOrigin === "explicit" ? "explicit" : "inherited" });
959
+ const primaryModel = externalRunner ? undefined : resolveEffectiveSubagentModel(s.model, a.model, ctx.currentModel, availableModels, a.modelProvider ?? ctx.currentModelProvider, { scope: modelScopes, source: modelOrigin === "explicit" ? "explicit" : "inherited", knownProviders: ctx.knownProviders });
960
960
  const thinkingOverride = flatIndex === undefined ? undefined : thinkingOverridesByFlatIndex?.[flatIndex];
961
961
  let claudeCodeOverride;
962
962
  if (claudeCodeAdapter) {
@@ -998,6 +998,7 @@ export function buildAsyncRunnerSteps(id, params) {
998
998
  scope: modelScopes,
999
999
  primaryModelFromParent,
1000
1000
  origin: modelOrigin,
1001
+ knownProviders: ctx.knownProviders,
1001
1002
  });
1002
1003
  requestedModel = modelEvidence.requestedModel;
1003
1004
  selectedModel = applyThinkingSuffix(modelEvidence.model, effectiveThinking, thinkingOverride !== undefined);
@@ -1754,7 +1755,7 @@ export function executeAsyncSingle(id, params) {
1754
1755
  try {
1755
1756
  primaryModel = externalRunner ? undefined : modelOrigin === "inherited"
1756
1757
  ? params.modelOverride ?? (ctx.currentModel ? `${ctx.currentModel.provider}/${ctx.currentModel.id}` : undefined)
1757
- : resolveSubagentModelOverride(params.modelOverride ?? agentConfig.model, ctx.currentModel, availableModels, ctx.currentModelProvider, { scope: modelScopes, source: modelOrigin === "explicit" ? "explicit" : "inherited" });
1758
+ : resolveSubagentModelOverride(params.modelOverride ?? agentConfig.model, ctx.currentModel, availableModels, ctx.currentModelProvider, { scope: modelScopes, source: modelOrigin === "explicit" ? "explicit" : "inherited", knownProviders: ctx.knownProviders });
1758
1759
  }
1759
1760
  catch (error) {
1760
1761
  return formatAsyncStartError("single", error instanceof Error ? error.message : String(error));
@@ -1821,6 +1822,7 @@ export function executeAsyncSingle(id, params) {
1821
1822
  scope: modelScopes,
1822
1823
  primaryModelFromParent: modelOrigin === "inherited",
1823
1824
  origin: modelOrigin,
1825
+ knownProviders: ctx.knownProviders,
1824
1826
  });
1825
1827
  requestedModel = modelEvidence.requestedModel;
1826
1828
  selectedModel = applyThinkingSuffix(modelEvidence.model, effectiveThinking, params.thinkingOverride !== undefined);
@@ -33,6 +33,7 @@ const CHORD_PEER_ALIASES = [
33
33
  { specifier: "@earendil-works/chord", pkg: "@earendil-works/chord", subpath: "." },
34
34
  { specifier: "@earendil-works/chord/context", pkg: "@earendil-works/chord", subpath: "./context" },
35
35
  ];
36
+ const SCHEMA_PACKAGE = "@earendil-works/pi-schema";
36
37
  function readManifest(packageDir) {
37
38
  try {
38
39
  return JSON.parse(fs.readFileSync(path.join(packageDir, "package.json"), "utf-8"));
@@ -155,5 +156,19 @@ export function resolveHostPeerAliases(piPackageRoot) {
155
156
  else if (pkg !== CHORD_PACKAGE || chordRequired)
156
157
  missing.push(specifier);
157
158
  }
159
+ // Pi 1.5+ pi-ai imports pi-schema; without it a child dies after its launch was accepted. pi-ai's
160
+ // own import already reaches the right copy, so this is only a presence check, never an alias:
161
+ // an alias would also redirect extensions that ship their own copy.
162
+ const piAiDir = findPeerPackageDir(piPackageRoot, "@earendil-works/pi-ai", hostManifest?.name);
163
+ const piAiManifest = piAiDir ? readManifest(piAiDir) : undefined;
164
+ if (piAiDir && piAiManifest && declaresDependency(piAiManifest, SCHEMA_PACKAGE)) {
165
+ // Resolve from pi-ai's real path, as Node does, so nested, hoisted and pnpm-sibling copies count.
166
+ const schemaDir = findPeerPackageDir(fs.realpathSync(piAiDir), SCHEMA_PACKAGE, undefined);
167
+ for (const subpath of [".", "./formats"]) {
168
+ const target = schemaDir ? resolvePackageSubpath(schemaDir, subpath) : undefined;
169
+ if (!target || !fs.existsSync(target))
170
+ missing.push(subpath === "." ? SCHEMA_PACKAGE : `${SCHEMA_PACKAGE}/formats`);
171
+ }
172
+ }
158
173
  return { aliases, missing };
159
174
  }
@@ -1,12 +1,16 @@
1
1
  import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
- import { randomUUID } from "node:crypto";
3
+ import { createHash, randomUUID } from "node:crypto";
4
4
  import { listAsyncRuns } from "./async-status.js";
5
5
  import { formatResumeFirstFailedRunDetail } from "./resume-guidance.js";
6
6
  import { readCompletionReplay } from "./completion-replay.js";
7
7
  import { writeAtomicJson } from "../../shared/atomic-json.js";
8
8
  import { COMPLETION_ACTION, STATUS_ACTION } from "../../shared/parent-wake.js";
9
9
  import { DIRS, INTERCOM_DETACH_REQUEST_EVENT, SUBAGENT_ASYNC_COMPLETE_EVENT, SUBAGENT_CONTROL_EVENT, SUBAGENT_CONTROL_INTERCOM_EVENT, SUBAGENT_FOREGROUND_COMPLETE_EVENT, SUBAGENT_RESULT_INTERCOM_EVENT, } from "../../shared/types.js";
10
+ import { currentBootId, currentRecordedPid } from "./boot-id.js";
11
+ import { currentPidNamespaceScope } from "./pid-namespace.js";
12
+ import { checkRecordedPidLiveness, isRecordedPid } from "./stale-run-reconciler.js";
13
+ import { createClaimFile } from "../../workflows/workflow-resume-claim.js";
10
14
  const SUBSCRIPTION_VERSION = 1;
11
15
  // Outcomes that report no saved results, so the notice points the parent at the run status instead.
12
16
  const STATUS_OUTCOMES = new Set(["timed out", "could not be reconciled", "needs attention", "reconciliation failed"]);
@@ -36,6 +40,8 @@ function parseRecord(value) {
36
40
  || typeof record.token !== "string"
37
41
  || !/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(record.token)
38
42
  || typeof record.sessionId !== "string"
43
+ || (record.completionOwnerId !== undefined && typeof record.completionOwnerId !== "string")
44
+ || (record.completionOwnerProcess !== undefined && !isRecordedPid(record.completionOwnerProcess))
39
45
  || (record.targetKind !== "async" && record.targetKind !== "foreground")
40
46
  || typeof record.runId !== "string"
41
47
  || typeof record.requestedId !== "string"
@@ -50,6 +56,40 @@ function needsAttention(run) {
50
56
  function subscriptionFile(dir, token) {
51
57
  return path.join(dir, `${token}.json`);
52
58
  }
59
+ /**
60
+ * Takeover claims are `<token>.claim-<owner hash>.<generation>`, not `.json`, so record scans skip them.
61
+ * Each generation is created exclusively, so one process takes over from a dead owner per generation;
62
+ * a dead claimant's generation is superseded by the next one.
63
+ */
64
+ function claimPrefix(token, replacedOwnerId) {
65
+ return `${token}.claim-${createHash("sha256").update(replacedOwnerId).digest("hex").slice(0, 16)}.`;
66
+ }
67
+ function latestClaimGeneration(files, prefix) {
68
+ let latest = 0;
69
+ for (const file of files) {
70
+ const generation = file.startsWith(prefix) ? file.slice(prefix.length) : "";
71
+ // Exact digits only: leftover `<claim>.<pid>.<uuid>.tmp` files from a crashed create are not generations.
72
+ if (/^[1-9][0-9]*$/.test(generation))
73
+ latest = Math.max(latest, Number(generation));
74
+ }
75
+ return latest;
76
+ }
77
+ /**
78
+ * Call only after the record file is gone, so a late claimer that wins a freed claim finds no record to bring back.
79
+ * Never throws: a leftover claim cannot bring a removed record back.
80
+ */
81
+ function removeClaimFiles(dir, token) {
82
+ try {
83
+ for (const file of fs.readdirSync(dir)) {
84
+ if (file.startsWith(`${token}.claim-`))
85
+ fs.rmSync(path.join(dir, file), { force: true });
86
+ }
87
+ }
88
+ catch (error) {
89
+ if (!isNotFound(error))
90
+ console.error(`Failed to remove claims of wait subscription '${token}':`, error);
91
+ }
92
+ }
53
93
  export function formatWaitSubscriptions(state, now = Date.now()) {
54
94
  const subscriptions = [...(state.waitSubscriptions?.values() ?? [])].sort((left, right) => left.createdAt - right.createdAt);
55
95
  if (subscriptions.length === 0)
@@ -71,6 +111,64 @@ export function createWaitSubscriptionManager(pi, state, options = {}) {
71
111
  let disposed = false;
72
112
  let interval;
73
113
  let lastForeignSweepAt = 0;
114
+ const readRecordFile = (filePath) => {
115
+ try {
116
+ return parseRecord(JSON.parse(fs.readFileSync(filePath, "utf-8")));
117
+ }
118
+ catch (error) {
119
+ if (isNotFound(error))
120
+ return undefined;
121
+ throw error;
122
+ }
123
+ };
124
+ const isDead = (recorded) => recorded !== undefined && checkRecordedPidLiveness(recorded, {
125
+ observedScope: currentPidNamespaceScope(),
126
+ observedBootId: currentBootId(),
127
+ kill: options.kill,
128
+ }) === "dead";
129
+ const latestClaimantHolds = (claimPath) => {
130
+ let body;
131
+ try {
132
+ body = JSON.parse(fs.readFileSync(claimPath, "utf-8"));
133
+ }
134
+ catch (error) {
135
+ // Claims are created whole, so a body that does not parse is damage; a claim that cannot be read counts as held.
136
+ return !(error instanceof SyntaxError);
137
+ }
138
+ const claimant = body?.process;
139
+ return isRecordedPid(claimant) && !isDead(claimant);
140
+ };
141
+ // Two Pi processes can share one session. The arming process owns the wake while it lives;
142
+ // after it dies, the next process to open the session claims the record and becomes its owner.
143
+ const claimRecord = (filePath, record) => {
144
+ if (!record.completionOwnerId || record.completionOwnerId === state.completionOwnerId)
145
+ return record;
146
+ if (!isDead(record.completionOwnerProcess))
147
+ return undefined;
148
+ if (!state.completionOwnerId)
149
+ return record;
150
+ const prefix = claimPrefix(record.token, record.completionOwnerId);
151
+ const latest = latestClaimGeneration(fs.readdirSync(subscriptionsDir), prefix);
152
+ if (latest > 0 && latestClaimantHolds(path.join(subscriptionsDir, `${prefix}${latest}`)))
153
+ return undefined;
154
+ const claimPath = path.join(subscriptionsDir, `${prefix}${latest + 1}`);
155
+ if (!createClaimFile(claimPath, { ownerId: state.completionOwnerId, process: currentRecordedPid() }))
156
+ return undefined;
157
+ try {
158
+ // The record may have been settled (and its claims removed) after this process first read it.
159
+ if (readRecordFile(filePath)?.completionOwnerId !== record.completionOwnerId) {
160
+ fs.rmSync(claimPath, { force: true });
161
+ return undefined;
162
+ }
163
+ const claimed = { ...record, completionOwnerId: state.completionOwnerId, completionOwnerProcess: currentRecordedPid() };
164
+ writeAtomicJson(filePath, claimed);
165
+ return claimed;
166
+ }
167
+ catch (error) {
168
+ fs.rmSync(claimPath, { force: true });
169
+ throw error;
170
+ }
171
+ };
74
172
  /**
75
173
  * Remove expired records armed by another session.
76
174
  *
@@ -109,7 +207,7 @@ export function createWaitSubscriptionManager(pi, state, options = {}) {
109
207
  const filePath = path.join(subscriptionsDir, file);
110
208
  let record;
111
209
  try {
112
- record = parseRecord(JSON.parse(fs.readFileSync(filePath, "utf-8")));
210
+ record = readRecordFile(filePath);
113
211
  }
114
212
  catch (error) {
115
213
  console.error(`Ignoring invalid wait subscription '${filePath}':`, error);
@@ -130,27 +228,36 @@ export function createWaitSubscriptionManager(pi, state, options = {}) {
130
228
  // Losing this race is harmless: another session may have swept the
131
229
  // same expired record. Anything else is reported and retried on the
132
230
  // next sweep rather than interrupting the caller.
133
- if (!isNotFound(error))
231
+ if (!isNotFound(error)) {
134
232
  console.error(`Failed to remove expired wait subscription '${filePath}':`, error);
233
+ continue;
234
+ }
135
235
  }
236
+ removeClaimFiles(subscriptionsDir, record.token);
136
237
  }
137
238
  };
138
239
  const remove = (record) => {
240
+ let removed = true;
139
241
  try {
140
242
  fs.unlinkSync(subscriptionFile(subscriptionsDir, record.token));
141
243
  }
142
244
  catch (error) {
143
245
  if (!isNotFound(error))
144
246
  throw error;
247
+ removed = false;
145
248
  }
146
249
  subscriptions.delete(record.token);
147
250
  unresolvedRestoredForegroundTokens.delete(record.token);
251
+ removeClaimFiles(subscriptionsDir, record.token);
252
+ return removed;
148
253
  };
149
254
  const settle = (record, outcome, detail, completion) => {
150
255
  if (disposed || state.currentSessionId !== record.sessionId)
151
256
  return;
152
257
  try {
153
- remove(record);
258
+ // Only the process that removes the record may deliver its wake.
259
+ if (!remove(record))
260
+ return;
154
261
  }
155
262
  catch (error) {
156
263
  console.error(`Failed to clear wait subscription '${record.token}'; it remains armed:`, error);
@@ -274,6 +381,7 @@ export function createWaitSubscriptionManager(pi, state, options = {}) {
274
381
  version: SUBSCRIPTION_VERSION,
275
382
  token: randomUUID(),
276
383
  sessionId,
384
+ ...(state.completionOwnerId ? { completionOwnerId: state.completionOwnerId, completionOwnerProcess: currentRecordedPid() } : {}),
277
385
  targetKind: input.targetKind,
278
386
  runId: input.runId,
279
387
  requestedId: input.requestedId,
@@ -303,19 +411,23 @@ export function createWaitSubscriptionManager(pi, state, options = {}) {
303
411
  throw error;
304
412
  }
305
413
  for (const file of files) {
414
+ const filePath = path.join(subscriptionsDir, file);
415
+ let record;
306
416
  try {
307
- const record = parseRecord(JSON.parse(fs.readFileSync(path.join(subscriptionsDir, file), "utf-8")));
308
- if (!record || file !== `${record.token}.json`)
417
+ const found = readRecordFile(filePath);
418
+ if (!found || file !== `${found.token}.json` || found.sessionId !== state.currentSessionId)
309
419
  continue;
310
- if (record.sessionId === state.currentSessionId) {
311
- subscriptions.set(record.token, record);
312
- if (record.targetKind === "foreground" && !state.foregroundRuns?.has(record.runId))
313
- unresolvedRestoredForegroundTokens.add(record.token);
314
- }
420
+ record = claimRecord(filePath, found);
315
421
  }
316
422
  catch (error) {
317
- console.error(`Ignoring invalid wait subscription '${path.join(subscriptionsDir, file)}':`, error);
423
+ console.error(`Failed to restore wait subscription '${filePath}':`, error);
424
+ continue;
318
425
  }
426
+ if (!record)
427
+ continue;
428
+ subscriptions.set(record.token, record);
429
+ if (record.targetKind === "foreground" && !state.foregroundRuns?.has(record.runId))
430
+ unresolvedRestoredForegroundTokens.add(record.token);
319
431
  }
320
432
  reconcile();
321
433
  },
@@ -10,4 +10,4 @@ export declare function stopAsyncRun(state: SubagentState, runId: string | undef
10
10
  asyncDir: string | null;
11
11
  resolvedId?: string;
12
12
  reattachedRunId?: string;
13
- }, childId?: string): AgentToolResult<Details> | null;
13
+ }, childId?: string, drain?: boolean): AgentToolResult<Details> | null;
@@ -130,7 +130,7 @@ export function deliverAsyncRunStop(input) {
130
130
  if (pausedWholeRun)
131
131
  return sealPausedRun(delivery.asyncDir, status, resultsDir);
132
132
  }
133
- export function stopAsyncRun(state, runId, kill, location, childId) {
133
+ export function stopAsyncRun(state, runId, kill, location, childId, drain) {
134
134
  const target = getAsyncStopTarget(state, runId, location);
135
135
  // An async workflow runs in this process: it has no runner to read a stop request, so stop it through its controller.
136
136
  const workflowRunId = target?.asyncId ?? runId;
@@ -139,6 +139,14 @@ export function stopAsyncRun(state, runId, kill, location, childId) {
139
139
  const workflowStatus = workflowAsyncDir ? readStatus(workflowAsyncDir) : undefined;
140
140
  // Controllers outlive a session switch; a workflow owned by another session falls through to the ownership check below.
141
141
  const foreignWorkflow = Boolean(state.currentSessionId && workflowStatus && workflowStatus.sessionId !== state.currentSessionId);
142
+ if (drain) {
143
+ const drained = workflowController && workflowRunId && !foreignWorkflow && !workflowController.signal.aborted ? state.workflowDrains?.get(workflowRunId)?.() : undefined;
144
+ if (!drained)
145
+ return { content: [{ type: "text", text: `drain applies only to live async workflows in this session; '${runId ?? "current"}' is not one.` }], isError: true, details: { mode: "management", results: [] } };
146
+ if (!drained.ok)
147
+ return { content: [{ type: "text", text: `Could not save the drain request for '${workflowRunId}'; nothing was stopped. Retry, or use stop without drain.` }], isError: true, details: { mode: "management", results: [] } };
148
+ return { content: [{ type: "text", text: `Drain requested for async workflow ${workflowRunId}: no new children will start; ${drained.started} started child(ren) will finish.` }], details: { mode: "management", results: [] } };
149
+ }
142
150
  if (workflowController && workflowRunId && !foreignWorkflow) {
143
151
  if (workflowStatus)
144
152
  stopStoppableAsyncStatusChildren(workflowStatus, state.workflowChildStops?.get(workflowRunId), "Workflow stopped.");
@@ -1796,6 +1796,7 @@ async function runSyncCompletionInner(runtimeCwd, agents, agentName, task, optio
1796
1796
  scope: options.modelScope,
1797
1797
  primaryModelFromParent: options.modelOverrideFromParent,
1798
1798
  origin: options.modelOrigin ?? (options.modelOverrideFromParent ? "inherited" : "configured"),
1799
+ knownProviders: options.knownProviders,
1799
1800
  });
1800
1801
  try {
1801
1802
  const model = applyThinkingSuffix(selectedModel, options.thinkingOverride ?? agent.thinking, options.thinkingOverride !== undefined);
@@ -47,6 +47,7 @@ export interface SubagentParamsLike {
47
47
  index?: number;
48
48
  toolCallId?: string;
49
49
  childId?: string;
50
+ drain?: boolean;
50
51
  view?: "fleet" | "transcript";
51
52
  lines?: number;
52
53
  topic?: string;
@@ -24,7 +24,7 @@ import { commandAction } from "./command-action.js";
24
24
  import { handleWatchdogToolAction, WATCHDOG_TOOL_ACTIONS } from "../../watchdog/tool-actions.js";
25
25
  import { applyWatchdogLaunchRules } from "../../watchdog/rules.js";
26
26
  import { childWatchdogProgressForModel } from "../../watchdog/child-status.js";
27
- import { normalizeParentModel, resolveEffectiveSubagentModel, resolveModelOrigin, scopedModelIdsFromContext } from "../shared/model-resolution.js";
27
+ import { knownModelProviders, normalizeParentModel, resolveEffectiveSubagentModel, resolveModelOrigin, scopedModelIdsFromContext } from "../shared/model-resolution.js";
28
28
  import { projectChainOutputSchemas, resolveEffectiveOutputSchema } from "../shared/child-launch-plan.js";
29
29
  import { formatRetainedChildren, listRetainedChildren } from "../background/retained-children.js";
30
30
  import { resolveModelScopesForAgent } from "../shared/model-scope.js";
@@ -1063,6 +1063,7 @@ function appendStepToAsyncChain(input) {
1063
1063
  parentProviderRegistry: input.ctx.modelRegistry,
1064
1064
  currentModel: parentModel,
1065
1065
  scopedModelIds: scopedModelIdsFromContext(input.ctx),
1066
+ knownProviders: knownModelProviders(input.ctx.modelRegistry),
1066
1067
  modelScope: discoveredForAppend.modelScope,
1067
1068
  modelResponseAliases: input.deps.config.modelResponseAliases,
1068
1069
  interactive: input.ctx.hasUI,
@@ -1551,6 +1552,7 @@ async function resumeExternalJobFollowUp(input) {
1551
1552
  parentProviderRegistry: input.ctx.modelRegistry,
1552
1553
  currentModel: parentModel,
1553
1554
  scopedModelIds: scopedModelIdsFromContext(input.ctx),
1555
+ knownProviders: knownModelProviders(input.ctx.modelRegistry),
1554
1556
  modelScope: input.modelScope,
1555
1557
  modelResponseAliases: input.deps.config.modelResponseAliases,
1556
1558
  interactive: input.ctx.hasUI,
@@ -1855,6 +1857,7 @@ async function resumeAsyncRun(input) {
1855
1857
  parentProviderRegistry: input.ctx.modelRegistry,
1856
1858
  currentModel: parentModel,
1857
1859
  scopedModelIds: scopedModelIdsFromContext(input.ctx),
1860
+ knownProviders: knownModelProviders(input.ctx.modelRegistry),
1858
1861
  modelScope,
1859
1862
  modelResponseAliases: input.deps.config.modelResponseAliases,
1860
1863
  runnerLaunchers: input.deps.config.runnerLaunchers,
@@ -1998,6 +2001,7 @@ async function resumeAsyncRun(input) {
1998
2001
  parentProviderRegistry: input.ctx.modelRegistry,
1999
2002
  currentModel: parentModel,
2000
2003
  scopedModelIds: scopedModelIdsFromContext(input.ctx),
2004
+ knownProviders: knownModelProviders(input.ctx.modelRegistry),
2001
2005
  modelScope,
2002
2006
  // Absence in the retained contract is meaningful; never acquire current aliases.
2003
2007
  modelResponseAliases: recoveryDescriptor ? recoveryDescriptor.modelResponseAliases : foregroundContract?.modelResponseAliases,
@@ -2862,7 +2866,7 @@ function resolveStaticLaunchSummary(input) {
2862
2866
  const modelScopes = resolveModelScopesForAgent(input.modelScope, input.agent, input.parentModel, input.scopedModelIds);
2863
2867
  const model = externalRunner
2864
2868
  ? undefined
2865
- : resolveEffectiveSubagentModel(input.explicitModel, agentConfig?.model, input.parentModel, input.availableModels, agentConfig?.modelProvider ?? input.currentProvider, modelScopes.length === 0 ? {} : { scope: modelScopes });
2869
+ : resolveEffectiveSubagentModel(input.explicitModel, agentConfig?.model, input.parentModel, input.availableModels, agentConfig?.modelProvider ?? input.currentProvider, { scope: modelScopes, knownProviders: input.knownProviders });
2866
2870
  const thinkingOverride = externalRunner ? undefined : input.thinkingOverrideForTask();
2867
2871
  const thinking = externalRunner ? undefined : resolveEffectiveThinking(model, thinkingOverride ?? agentConfig?.thinking);
2868
2872
  return {
@@ -2880,6 +2884,7 @@ function collectStaticLaunchSummaries(input) {
2880
2884
  parentModel: input.parentModel,
2881
2885
  scopedModelIds: input.scopedModelIds,
2882
2886
  availableModels: input.availableModels,
2887
+ knownProviders: input.knownProviders,
2883
2888
  currentProvider: input.currentProvider,
2884
2889
  modelScope: input.modelScope,
2885
2890
  thinkingOverrideForTask: input.thinkingOverrideForTask,
@@ -3159,6 +3164,7 @@ async function runAsyncPath(data, deps) {
3159
3164
  parentProviderRegistry: ctx.modelRegistry,
3160
3165
  currentModel: parentModel,
3161
3166
  scopedModelIds: data.scopedModelIds,
3167
+ knownProviders: knownModelProviders(ctx.modelRegistry),
3162
3168
  modelScope: data.modelScope,
3163
3169
  modelResponseAliases: deps.config.modelResponseAliases,
3164
3170
  runnerLaunchers: deps.config.runnerLaunchers,
@@ -3203,8 +3209,9 @@ async function runAsyncPath(data, deps) {
3203
3209
  const modelOverride = a.runner?.type === "external-cli" || a.runner?.type === "external-job"
3204
3210
  ? params.model ?? (externalRunnerWithoutExplicitModel ? undefined : a.model)
3205
3211
  : resolveEffectiveSubagentModel(params.model, a.model, parentModel, availableModels, a.modelProvider ?? currentProvider, {
3206
- ...(modelScopes.length === 0 ? {} : { scope: modelScopes }),
3212
+ scope: modelScopes,
3207
3213
  source: modelOrigin === "explicit" ? "explicit" : "inherited",
3214
+ knownProviders: asyncCtx.knownProviders,
3208
3215
  });
3209
3216
  const modelOverrideFromParent = modelOrigin === "inherited";
3210
3217
  const launchRuleError = applyWatchdogLaunchRules({ cwd: effectiveCwd, agent: a.name, model: modelOverride ?? (parentModel && `${parentModel.provider}/${parentModel.id}`), warn: (violation) => deps.watchdog?.displayRuleWarning(violation) });
@@ -3632,6 +3639,7 @@ async function runSinglePath(data, deps) {
3632
3639
  const parentModel = data.parentModel;
3633
3640
  const currentProvider = parentModel?.provider;
3634
3641
  const availableModels = ctx.modelRegistry.getAvailable().map(toModelInfo);
3642
+ const knownProviders = knownModelProviders(ctx.modelRegistry);
3635
3643
  const modelScopes = resolveModelScopesForAgent(data.modelScope, agentConfig.name, parentModel, data.scopedModelIds);
3636
3644
  let task = typeof params.task === "string" ? params.task : "";
3637
3645
  const modelOrigin = resolveModelOrigin({
@@ -3641,8 +3649,9 @@ async function runSinglePath(data, deps) {
3641
3649
  parentModel,
3642
3650
  });
3643
3651
  let modelOverride = resolveEffectiveSubagentModel(params.model, agentConfig.model, parentModel, availableModels, agentConfig.modelProvider ?? currentProvider, {
3644
- ...(modelScopes.length === 0 ? {} : { scope: modelScopes }),
3652
+ scope: modelScopes,
3645
3653
  source: modelOrigin === "explicit" ? "explicit" : "inherited",
3654
+ knownProviders,
3646
3655
  });
3647
3656
  const modelOverrideFromParent = modelOrigin === "inherited";
3648
3657
  const launchRuleError = applyWatchdogLaunchRules({ cwd: effectiveCwd, agent: agentConfig.name, model: modelOverride ?? (parentModel && `${parentModel.provider}/${parentModel.id}`), warn: (violation) => deps.watchdog?.displayRuleWarning(violation) });
@@ -3890,6 +3899,7 @@ async function runSinglePath(data, deps) {
3890
3899
  thinkingCeiling: agentConfig.maxThinking,
3891
3900
  extensionBindings: params.extensionBindings,
3892
3901
  availableModels,
3902
+ knownProviders,
3893
3903
  modelResponseAliases,
3894
3904
  preferredModelProvider: currentProvider,
3895
3905
  modelScope: modelScopes,
@@ -5167,6 +5177,7 @@ export function createSubagentExecutor(deps) {
5167
5177
  const controller = new AbortController();
5168
5178
  deps.state.workflowControllers ??= new Map();
5169
5179
  deps.state.workflowChildStops ??= new Map();
5180
+ deps.state.workflowDrains ??= new Map();
5170
5181
  deps.state.workflowControllers.set(workflowRunId, controller);
5171
5182
  workflowCapacity?.markWorkflowStarted();
5172
5183
  if (workflowCapacity)
@@ -5797,6 +5808,36 @@ export function createSubagentExecutor(deps) {
5797
5808
  else
5798
5809
  deps.state.workflowChildStops?.delete(workflowRunId);
5799
5810
  },
5811
+ registerDrain: (drain) => {
5812
+ if (!drain)
5813
+ deps.state.workflowDrains?.delete(workflowRunId);
5814
+ else
5815
+ deps.state.workflowDrains?.set(workflowRunId, () => {
5816
+ if (workflowRunEvidence.drainRequestedAt === undefined) {
5817
+ // The marker must be on disk before anything is stopped: without it a reload during the drain would resume the run.
5818
+ const previousWorkflow = status.workflow;
5819
+ workflowRunEvidence.drainRequestedAt = Date.now();
5820
+ status.workflow = { ...(previousWorkflow ?? { trace: [], emits: [], console: [] }), drainRequestedAt: workflowRunEvidence.drainRequestedAt };
5821
+ let saved = false;
5822
+ try {
5823
+ persist();
5824
+ saved = runPersistence.pendingCount() === 0;
5825
+ }
5826
+ catch (error) {
5827
+ console.error(`Failed to save the drain request for async workflow '${workflowRunId}':`, error);
5828
+ }
5829
+ if (!saved) {
5830
+ delete workflowRunEvidence.drainRequestedAt;
5831
+ status.workflow = previousWorkflow;
5832
+ // Replaces a queued write that still carries the marker.
5833
+ persist({ tolerateStatusWriteFailure: true });
5834
+ return { ok: false };
5835
+ }
5836
+ }
5837
+ // Deferred so a full stop that stops the last running child aborts with its own reason first.
5838
+ return { ok: true, started: drain(() => queueMicrotask(() => controller.abort(new Error("Workflow drained: started children finished; no new children were started.")))) };
5839
+ });
5840
+ },
5800
5841
  ...(workflowState ? { state: workflowState } : {}),
5801
5842
  onTrace: updateTrace,
5802
5843
  onChildSettled: (notification) => {
@@ -6139,8 +6180,7 @@ export function createSubagentExecutor(deps) {
6139
6180
  const workflowOutput = typeof workflowChildDefaults.output === "string" || typeof workflowChildDefaults.output === "boolean" ? workflowChildDefaults.output : undefined;
6140
6181
  const configuredOutputBaseDir = resolveConfiguredSingleRunOutputBaseDir(deps);
6141
6182
  const workflowAggregateOutputPath = resolveSingleOutputPath(workflowOutput, ctx.cwd, workflowCwd, resolveSingleRunOutputBaseDir(deps, workflowArtifactsDir, foregroundWorkflowRunId));
6142
- // A top-level artifact file: outside outputs/, where children save their reports, and
6143
- // within artifact retention, which only removes top-level files.
6183
+ // Outside outputs/ so it cannot overwrite a child's report.
6144
6184
  const workflowFullResultPath = path.join(workflowArtifactsDir, `${sanitizeRunPathSegment(foregroundWorkflowRunId)}_workflow-result.md`);
6145
6185
  const claimedOutputPaths = new Map();
6146
6186
  const childOutputOverrides = new Map();
@@ -7027,6 +7067,8 @@ export function createSubagentExecutor(deps) {
7027
7067
  }
7028
7068
  if (action === "stop") {
7029
7069
  const targetRunId = paramsWithResolvedCwd.runId ?? paramsWithResolvedCwd.id;
7070
+ if (paramsWithResolvedCwd.drain && paramsWithResolvedCwd.childId !== undefined)
7071
+ return { content: [{ type: "text", text: "action='stop' drain applies to a whole workflow; omit childId." }], isError: true, details: { mode: "management", results: [] } };
7030
7072
  // Whole-workflow stops reach stopAsyncRun below, which stops a live workflow in-process.
7031
7073
  const workflowRunId = targetRunId && paramsWithResolvedCwd.childId !== undefined ? resolveLiveWorkflowRunId(deps, targetRunId) : undefined;
7032
7074
  if (workflowRunId && paramsWithResolvedCwd.childId !== undefined) {
@@ -7073,7 +7115,7 @@ export function createSubagentExecutor(deps) {
7073
7115
  if (paramsWithResolvedCwd.dir) {
7074
7116
  try {
7075
7117
  const location = resolveAsyncRunLocation(paramsWithResolvedCwd, DIRS.async, DIRS.results);
7076
- const stopResult = stopAsyncRun(deps.state, location.resolvedId ?? targetRunId ?? path.basename(location.asyncDir ?? paramsWithResolvedCwd.dir), deps.kill, location, paramsWithResolvedCwd.childId);
7118
+ const stopResult = stopAsyncRun(deps.state, location.resolvedId ?? targetRunId ?? path.basename(location.asyncDir ?? paramsWithResolvedCwd.dir), deps.kill, location, paramsWithResolvedCwd.childId, paramsWithResolvedCwd.drain);
7077
7119
  return stopResult ?? { content: [{ type: "text", text: `No running or queued async run was found for '${targetRunId ?? paramsWithResolvedCwd.dir}'.` }], isError: true, details: { mode: "management", results: [] } };
7078
7120
  }
7079
7121
  catch (error) {
@@ -7094,7 +7136,7 @@ export function createSubagentExecutor(deps) {
7094
7136
  return { content: [{ type: "text", text: "action='stop' supports current-session top-level async runs only." }], isError: true, details: { mode: "management", results: [] } };
7095
7137
  if (resolved?.kind === "foreground")
7096
7138
  return { content: [{ type: "text", text: "action='stop' supports async runs only. Use action='interrupt' for foreground runs." }], isError: true, details: { mode: "management", results: [] } };
7097
- const stopResult = stopAsyncRun(deps.state, resolved?.kind === "async" ? resolved.id : targetRunId, deps.kill, resolved?.kind === "async" ? resolved.location : undefined, paramsWithResolvedCwd.childId);
7139
+ const stopResult = stopAsyncRun(deps.state, resolved?.kind === "async" ? resolved.id : targetRunId, deps.kill, resolved?.kind === "async" ? resolved.location : undefined, paramsWithResolvedCwd.childId, paramsWithResolvedCwd.drain);
7098
7140
  if (stopResult)
7099
7141
  return stopResult;
7100
7142
  return {
@@ -7643,6 +7685,7 @@ export function createSubagentExecutor(deps) {
7643
7685
  parentModel: requestParentModel,
7644
7686
  scopedModelIds: scopedModelIdsFromContext(ctx),
7645
7687
  availableModels: ctx.modelRegistry.getAvailable().map(toModelInfo),
7688
+ knownProviders: knownModelProviders(ctx.modelRegistry),
7646
7689
  currentProvider: requestParentModel?.provider,
7647
7690
  modelScope,
7648
7691
  thinkingOverrideForTask,
@@ -122,9 +122,9 @@ export interface ChildSession {
122
122
  };
123
123
  /** Event-updated pane-native status; reading it performs no network work. */
124
124
  readonly placementSnapshot?: unknown;
125
- /** Set by the foreground host once the run detached; `factory.dispose()` leaves such children running. */
125
+ /** Set by the foreground host once the run detached; factory disposal leaves such children running. */
126
126
  detached?: boolean;
127
- /** Set by `factory.dispose()` before it aborts the child, so the host can report the stop truthfully. */
127
+ /** Set by factory disposal before it aborts the child, so the host can report the stop truthfully. */
128
128
  shutDown?: boolean;
129
129
  }
130
130
  export declare function childSessionHasQueuedMessages(session: ChildSession | undefined): boolean;
@@ -132,6 +132,8 @@ export interface ChildSessionFactory {
132
132
  create(launch: ChildSessionLaunch): Promise<ChildSession>;
133
133
  /** Abort and dispose every live attached child; detached children keep running and hold the shared runtime. */
134
134
  dispose(): Promise<void>;
135
+ /** `dispose()` for only the children `parentSessionFile`'s session launched (undefined: sessions without a file); pi-web shuts sessions down one at a time. */
136
+ disposeForParent(parentSessionFile: string | undefined): Promise<void>;
135
137
  }
136
138
  export type PiCodingAgentModule = typeof import("@earendil-works/pi-coding-agent");
137
139
  export interface DefaultChildSessionFactoryOptions {
@@ -175,6 +177,5 @@ export declare function setChildSessionFactory(factory: ChildSessionFactory | un
175
177
  */
176
178
  export declare function childSessionFactoryModule(): string | undefined;
177
179
  export declare function setChildSessionFactoryModule(modulePath: string | undefined): void;
178
- /** Abort and dispose every live in-process child and release the shared runtime. */
179
- export declare function disposeChildSessions(): Promise<void>;
180
+ export declare function disposeChildSessionsForParent(parentSessionFile: string | undefined): Promise<void>;
180
181
  export {};