pi-subagents 0.84.0 → 0.86.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 (210) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +2 -2
  4. package/bundle/{chunk-JG4QKI5M.js → chunk-2IYBCYFU.js} +214 -97
  5. package/bundle/{chunk-V2BZYLEP.js → chunk-374MZFF4.js} +7 -2
  6. package/bundle/{chunk-4E7BKDTX.js → chunk-3RKFH2UZ.js} +11 -156
  7. package/bundle/{chunk-F4ASL6OV.js → chunk-5H4BICQZ.js} +1 -1
  8. package/bundle/{chunk-PALJGGYC.js → chunk-6VD7BGIC.js} +6 -3
  9. package/bundle/{chunk-C5P5CHYK.js → chunk-77ASNIEM.js} +1 -1
  10. package/bundle/{chunk-XDQORLZ5.js → chunk-7ADDXUGF.js} +15 -6
  11. package/bundle/{chunk-PV63UFUR.js → chunk-7QA7ZA46.js} +183 -28
  12. package/bundle/{chunk-NKQ6JNAS.js → chunk-7ZUFN6ME.js} +2 -1
  13. package/bundle/{chunk-SSG7IEP5.js → chunk-A637IMAO.js} +2 -2
  14. package/bundle/{chunk-L3WFKBEI.js → chunk-BGXEAYUM.js} +247 -153
  15. package/bundle/{chunk-J5YL7LYR.js → chunk-BU6PFPVX.js} +59 -27
  16. package/bundle/{chunk-DZDETGRJ.js → chunk-BWC2LVII.js} +259 -216
  17. package/bundle/{chunk-CGN2TVE7.js → chunk-GJGTMLPE.js} +322 -18
  18. package/bundle/{chunk-D3JAFGMO.js → chunk-GRJHIXYF.js} +1 -1
  19. package/bundle/chunk-HXRB42AF.js +108 -0
  20. package/bundle/{chunk-LFDBD4PW.js → chunk-LGINOOY5.js} +2 -2
  21. package/bundle/{chunk-G2Z6ZH26.js → chunk-NAFLUJ26.js} +1 -1
  22. package/bundle/{chunk-235AWJUQ.js → chunk-O3YH7XIY.js} +324 -111
  23. package/bundle/{chunk-2DHZTCOL.js → chunk-PYOAIN3V.js} +2 -2
  24. package/bundle/{chunk-LNRJCP2Y.js → chunk-QGO6HXHG.js} +417 -242
  25. package/bundle/{chunk-VQVVHSY6.js → chunk-QM3JGE4W.js} +22 -11
  26. package/bundle/{chunk-2S4K53MV.js → chunk-S2Q75LP3.js} +1 -1
  27. package/bundle/{chunk-NENDSQUY.js → chunk-UR7OW5S7.js} +9 -6
  28. package/bundle/{chunk-AKOIVLA5.js → chunk-WN2E5XHN.js} +135 -77
  29. package/bundle/{chunk-2D52JFLF.js → chunk-YK3QYNLE.js} +41 -117
  30. package/bundle/{chunk-7BWGNDNK.js → chunk-ZJJCPV3L.js} +190 -1177
  31. package/bundle/chunk-ZPY5QZCS.js +1067 -0
  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 +8 -8
  36. package/bundle/project-panes.js +3 -3
  37. package/docs/agents.md +23 -2
  38. package/docs/configuration.md +4 -4
  39. package/docs/extension-api.md +16 -1
  40. package/docs/tool-reference.md +2 -0
  41. package/docs/workflows.md +30 -2
  42. package/package.json +1 -1
  43. package/src/agents/agent-management.js +27 -11
  44. package/src/agents/agent-memory.d.ts +1 -4
  45. package/src/agents/agent-memory.js +1 -4
  46. package/src/agents/agents.d.ts +1 -3
  47. package/src/agents/agents.js +7 -6
  48. package/src/agents/frontmatter.js +1 -8
  49. package/src/agents/global-npm-root.d.ts +1 -0
  50. package/src/agents/global-npm-root.js +11 -3
  51. package/src/agents/skills.d.ts +0 -3
  52. package/src/agents/skills.js +0 -3
  53. package/src/extension/config.js +7 -1
  54. package/src/extension/herdr-pi-bridge.js +10 -2
  55. package/src/extension/index.d.ts +0 -13
  56. package/src/extension/index.js +43 -32
  57. package/src/extension/public-execution.d.ts +1 -0
  58. package/src/extension/public-execution.js +4 -0
  59. package/src/extension/reply-workflow-script.js +24 -4
  60. package/src/extension/schemas.d.ts +8 -3
  61. package/src/extension/schemas.js +5 -3
  62. package/src/extension/session-switch.d.ts +25 -0
  63. package/src/extension/session-switch.js +138 -0
  64. package/src/extension/subagent-guide.d.ts +1 -1
  65. package/src/extension/subagent-guide.js +1 -1
  66. package/src/extension/subagent-launch-tool.d.ts +25 -0
  67. package/src/extension/subagent-launch-tool.js +48 -0
  68. package/src/extension/tool-activation.js +35 -12
  69. package/src/extension/tool-description.d.ts +1 -1
  70. package/src/extension/tool-description.js +14 -8
  71. package/src/inspectors/herdr/actions.d.ts +0 -1
  72. package/src/inspectors/herdr/actions.js +0 -1
  73. package/src/inspectors/session-roots-codec.d.ts +0 -1
  74. package/src/inspectors/session-roots-codec.js +0 -1
  75. package/src/inspectors/tmux/actions.d.ts +0 -1
  76. package/src/inspectors/tmux/actions.js +0 -1
  77. package/src/integrations/herdr-status.js +3 -8
  78. package/src/intercom/native-supervisor-channel.js +65 -9
  79. package/src/runs/background/async-execution.d.ts +5 -9
  80. package/src/runs/background/async-execution.js +62 -27
  81. package/src/runs/background/async-job-tracker.js +12 -0
  82. package/src/runs/background/async-resume.d.ts +2 -1
  83. package/src/runs/background/async-resume.js +112 -39
  84. package/src/runs/background/async-retention.js +6 -1
  85. package/src/runs/background/auto-drain.js +2 -1
  86. package/src/runs/background/boot-id.d.ts +1 -3
  87. package/src/runs/background/boot-id.js +1 -3
  88. package/src/runs/background/completion-batcher.d.ts +3 -4
  89. package/src/runs/background/completion-batcher.js +2 -3
  90. package/src/runs/background/control-channel.d.ts +0 -6
  91. package/src/runs/background/control-channel.js +0 -6
  92. package/src/runs/background/fleet-view.js +2 -3
  93. package/src/runs/background/notify.d.ts +0 -2
  94. package/src/runs/background/notify.js +0 -2
  95. package/src/runs/background/result-watcher.d.ts +1 -0
  96. package/src/runs/background/result-watcher.js +59 -29
  97. package/src/runs/background/resume-guidance.js +4 -2
  98. package/src/runs/background/retained-children.js +2 -1
  99. package/src/runs/background/run-child-session.d.ts +0 -1
  100. package/src/runs/background/run-child-session.js +1 -1
  101. package/src/runs/background/run-status.js +9 -7
  102. package/src/runs/background/scheduled-runs.d.ts +3 -1
  103. package/src/runs/background/scheduled-runs.js +13 -16
  104. package/src/runs/background/subagent-runner.d.ts +2 -4
  105. package/src/runs/background/subagent-runner.js +15 -12
  106. package/src/runs/background/subagent-wait.js +12 -15
  107. package/src/runs/background/wait-config.d.ts +2 -0
  108. package/src/runs/background/wait-config.js +17 -3
  109. package/src/runs/background/wait-tool.js +4 -2
  110. package/src/runs/background/workflow-terminal-proof.d.ts +0 -1
  111. package/src/runs/background/workflow-terminal-proof.js +0 -1
  112. package/src/runs/foreground/execution.d.ts +0 -3
  113. package/src/runs/foreground/execution.js +17 -9
  114. package/src/runs/foreground/subagent-executor.d.ts +3 -2
  115. package/src/runs/foreground/subagent-executor.js +107 -26
  116. package/src/runs/shared/acceptance.js +69 -26
  117. package/src/runs/shared/child-commands.js +15 -2
  118. package/src/runs/shared/child-hooks.d.ts +1 -7
  119. package/src/runs/shared/child-hooks.js +13 -5
  120. package/src/runs/shared/child-launch.js +6 -2
  121. package/src/runs/shared/child-runtime-config.d.ts +0 -1
  122. package/src/runs/shared/child-session.d.ts +1 -1
  123. package/src/runs/shared/child-session.js +21 -2
  124. package/src/runs/shared/child-tool-plan.d.ts +0 -1
  125. package/src/runs/shared/child-tool-plan.js +0 -1
  126. package/src/runs/shared/claude-code-adapter.js +11 -0
  127. package/src/runs/shared/external-cli-contract.d.ts +49 -0
  128. package/src/runs/shared/external-cli-contract.js +18 -13
  129. package/src/runs/shared/external-cli-runner.js +26 -6
  130. package/src/runs/shared/herdr-connection.js +2 -1
  131. package/src/runs/shared/herdr-pane-host.d.ts +2 -2
  132. package/src/runs/shared/herdr-pane-host.js +17 -1
  133. package/src/runs/shared/herdr-placed-run.js +48 -22
  134. package/src/runs/shared/lane-metadata.d.ts +0 -1
  135. package/src/runs/shared/lane-metadata.js +0 -1
  136. package/src/runs/shared/mcp-direct-tool-grant.js +8 -1
  137. package/src/runs/shared/model-resolution-diagnostic.d.ts +0 -1
  138. package/src/runs/shared/model-resolution.d.ts +2 -2
  139. package/src/runs/shared/model-resolution.js +7 -1
  140. package/src/runs/shared/model-scope.d.ts +1 -5
  141. package/src/runs/shared/model-scope.js +1 -5
  142. package/src/runs/shared/mutation-evidence.d.ts +1 -1
  143. package/src/runs/shared/mutation-evidence.js +52 -7
  144. package/src/runs/shared/nested-events.d.ts +1 -0
  145. package/src/runs/shared/nested-events.js +1 -1
  146. package/src/runs/shared/parallel-utils.d.ts +0 -1
  147. package/src/runs/shared/permissions.js +5 -3
  148. package/src/runs/shared/placement-host.d.ts +5 -1
  149. package/src/runs/shared/rex-pane-host.d.ts +0 -1
  150. package/src/runs/shared/rex-pane-host.js +0 -2
  151. package/src/runs/shared/run-launch-folder.d.ts +12 -0
  152. package/src/runs/shared/run-launch-folder.js +21 -0
  153. package/src/runs/shared/runner-launcher.d.ts +12 -1
  154. package/src/runs/shared/runner-launcher.js +16 -0
  155. package/src/runs/shared/single-output.d.ts +3 -3
  156. package/src/runs/shared/single-output.js +5 -3
  157. package/src/runs/shared/structured-output.d.ts +8 -0
  158. package/src/runs/shared/structured-output.js +40 -5
  159. package/src/runs/shared/subagent-prompt-runtime.d.ts +0 -1
  160. package/src/runs/shared/subagent-prompt-runtime.js +4 -2
  161. package/src/runs/shared/tool-timeout.js +2 -1
  162. package/src/runs/shared/worktree-cleanup-plan.d.ts +0 -1
  163. package/src/runs/shared/worktree-cleanup-plan.js +0 -1
  164. package/src/runs/shared/worktree.d.ts +3 -0
  165. package/src/runs/shared/worktree.js +20 -0
  166. package/src/shared/capacity-resilient-json.d.ts +1 -1
  167. package/src/shared/child-cache-retention.d.ts +1 -2
  168. package/src/shared/child-cache-retention.js +1 -2
  169. package/src/shared/fleet-transcript-reader.d.ts +51 -0
  170. package/src/shared/fleet-transcript-reader.js +333 -0
  171. package/src/shared/formatters.d.ts +0 -18
  172. package/src/shared/formatters.js +0 -18
  173. package/src/shared/session-succession.d.ts +16 -1
  174. package/src/shared/session-succession.js +41 -2
  175. package/src/shared/session-warnings.d.ts +7 -0
  176. package/src/shared/session-warnings.js +26 -0
  177. package/src/shared/settings.d.ts +0 -23
  178. package/src/shared/settings.js +3 -35
  179. package/src/shared/types.d.ts +85 -59
  180. package/src/shared/types.js +0 -12
  181. package/src/shared/utils.d.ts +0 -14
  182. package/src/shared/utils.js +0 -22
  183. package/src/shared/wait-tool-name.d.ts +8 -0
  184. package/src/shared/wait-tool-name.js +13 -0
  185. package/src/slash/slash-commands.js +2 -1
  186. package/src/slash/subagent-cost.d.ts +3 -2
  187. package/src/slash/subagent-cost.js +22 -3
  188. package/src/slash/subagents-admin.js +0 -1
  189. package/src/tui/fleet-status.d.ts +0 -5
  190. package/src/tui/fleet-status.js +4 -24
  191. package/src/tui/fleet-transcript.d.ts +1 -44
  192. package/src/tui/fleet-transcript.js +1 -327
  193. package/src/tui/fleet.js +6 -4
  194. package/src/tui/render.d.ts +0 -9
  195. package/src/tui/render.js +161 -66
  196. package/src/tui/subagent-messages.js +3 -2
  197. package/src/watchdog/register-child.d.ts +2 -3
  198. package/src/watchdog/register-child.js +2 -3
  199. package/src/watchdog/turn-delta.js +2 -1
  200. package/src/workflows/scripted-workflow.js +241 -20
  201. package/src/workflows/workflow-launch-record.d.ts +15 -6
  202. package/src/workflows/workflow-launch-record.js +30 -12
  203. package/src/workflows/workflow-receipt.js +36 -53
  204. package/src/workflows/workflow-resume-claim.js +2 -2
  205. package/src/workflows/workflow-resume.d.ts +1 -1
  206. package/src/workflows/workflow-resume.js +11 -8
  207. package/src/workflows/workflow-script-worker.d.ts +13 -0
  208. package/src/workflows/workflow-script-worker.js +79 -0
  209. package/workflow-script-process.cjs +36 -0
  210. package/workflow-script-worker.cjs +4 -1
@@ -9,6 +9,7 @@ import { ownsRun } from "../runs/shared/run-ownership.js";
9
9
  import { writeAtomicJson, writePrivateAtomicJson } from "../shared/atomic-json.js";
10
10
  import { shouldUseNativeFsWatch } from "../shared/watch-strategy.js";
11
11
  import { MODEL_ONLY_TOOL } from "../shared/extension-context.js";
12
+ import { reportSessionWarning } from "../shared/session-warnings.js";
12
13
  import { SUPERVISOR_REQUEST_MESSAGE_TYPE, SUPERVISOR_REPLY_ENTRY_TYPE, supervisorReplyHint, } from "./supervisor-ui.js";
13
14
  const SUPERVISOR_CHANNEL_ROOT = path.join(TEMP_ROOT_DIR, "supervisor-channels");
14
15
  const REQUESTS_DIR = "requests";
@@ -533,7 +534,22 @@ function appendSupervisorReplyEntry(pi, request, reply) {
533
534
  console.error("Failed to journal native supervisor reply:", error);
534
535
  }
535
536
  }
536
- function resolvePendingRequest(pending, params) {
537
+ function endedRequestText(ended, runState) {
538
+ const { request } = ended;
539
+ const iso = (time) => new Date(time).toISOString();
540
+ const when = ended.eventAt !== undefined ? ` at ${iso(ended.eventAt)}` : ` (noticed at ${iso(ended.endedAt)})`;
541
+ const subject = `Supervisor request '${request.id}' from ${request.agent} [${request.runId}#${request.childIndex}]`;
542
+ const runStatus = runState.asyncJobs.get(request.runId)?.status;
543
+ const runNow = runStatus && runStatus !== "queued" && runStatus !== "running" ? ` Run ${request.runId} is now ${runStatus}.` : "";
544
+ switch (ended.lifecycle) {
545
+ case "resolved": return `${subject} was already answered${when}.`;
546
+ case "expired": return `${subject} expired${when}: no reply arrived before the child's ask timeout.`;
547
+ case "deadline": return `${subject} ended around its ask deadline${when}: either no reply arrived before the child's ask timeout, or its run was stopped just before then.${runNow}`;
548
+ case "inactive": return `${subject} was closed because its child run ended${when}.${runNow}`;
549
+ case "missing": return `${subject} was withdrawn by the child before its ask deadline${when}. A child withdraws its request when its run is stopped, interrupted or times out, for example when a workflow aborts its other children after one fails.${runNow}`;
550
+ }
551
+ }
552
+ function resolvePendingRequest(pending, params, ended, runState) {
537
553
  const requests = [...pending.values()].filter((request) => request.expectsReply);
538
554
  if (params.replyTo) {
539
555
  const request = pending.get(params.replyTo);
@@ -541,6 +557,9 @@ function resolvePendingRequest(pending, params) {
541
557
  // A child stops waiting after its ask timeout and may ask again under a new id. Its first
542
558
  // notice can reach a busy parent after that, so name what can still be answered.
543
559
  const current = requests.length ? `Pending now:\n${requests.map(pendingHeader).join("\n")}` : "No pending supervisor requests.";
560
+ const endedRequest = ended.get(params.replyTo);
561
+ if (endedRequest)
562
+ throw new Error(`${endedRequestText(endedRequest, runState(endedRequest.request))} ${current}`);
544
563
  throw new Error(`No pending supervisor request found for replyTo '${params.replyTo}'. It was answered, expired or withdrawn. ${current}`);
545
564
  }
546
565
  return request;
@@ -572,7 +591,7 @@ function publicPendingRequests(pending) {
572
591
  expectsReply: request.expectsReply,
573
592
  }));
574
593
  }
575
- function buildParentSupervisorTool(pi, pending, state, onLifecycle, discover, runState) {
594
+ function buildParentSupervisorTool(pi, pending, state, onLifecycle, discover, runState, ended) {
576
595
  return {
577
596
  name: NATIVE_SUPERVISOR_TOOL_NAME,
578
597
  ...MODEL_ONLY_TOOL,
@@ -592,11 +611,11 @@ function buildParentSupervisorTool(pi, pending, state, onLifecycle, discover, ru
592
611
  return { content: [{ type: "text", text: lines.length ? lines.join("\n") : "No pending supervisor requests." }], details: { pending: publicPendingRequests(pending) } };
593
612
  }
594
613
  if (input.action === "reply") {
595
- const request = resolvePendingRequest(pending, input);
614
+ const request = resolvePendingRequest(pending, input, ended, runState);
596
615
  const reply = writeReply(request, input.message ?? "");
597
616
  appendSupervisorReplyEntry(pi, request, reply);
598
617
  pending.delete(request.id);
599
- onLifecycle(request, "resolved");
618
+ onLifecycle(request, "resolved", reply.createdAt);
600
619
  clearForegroundSupervisorAttention(request, pending, state);
601
620
  return { content: [{ type: "text", text: `Replied to supervisor request ${request.id}.` }], details: { replyTo: request.id, runId: request.runId, agent: request.agent } };
602
621
  }
@@ -654,12 +673,37 @@ export function createNativeSupervisorChannel(pi, state, deps = {}) {
654
673
  requestCorrelations.set(key, { request, state: "resolved", updatedAt: Date.now() });
655
674
  pruneRequestCorrelations();
656
675
  };
657
- const observeRequestLifecycle = (request, lifecycle) => {
676
+ // How each request ended, so a late reply can say why it is gone instead of a generic miss.
677
+ const endedRequests = new Map();
678
+ const rememberEndedRequest = (request, lifecycle, eventAt) => {
679
+ if (!request.expectsReply)
680
+ return;
681
+ const now = Date.now();
682
+ endedRequests.delete(request.id);
683
+ endedRequests.set(request.id, { request, lifecycle, endedAt: now, ...(eventAt !== undefined ? { eventAt } : {}) });
684
+ for (const [id, ended] of endedRequests) {
685
+ if (now - ended.endedAt <= SUPERVISOR_REQUEST_CORRELATION_RETENTION_MS && endedRequests.size <= MAX_SUPERVISOR_REQUEST_CORRELATIONS)
686
+ break;
687
+ endedRequests.delete(id);
688
+ }
689
+ };
690
+ const observeRequestLifecycle = (request, lifecycle, eventAt) => {
658
691
  settleNotices.delete(request.id);
659
692
  if (queuedNotices.delete(request.id))
660
693
  updateDeliverySubscription();
661
694
  if (lifecycle !== "wrong-session")
662
695
  rememberResolvedRequest(request);
696
+ // A child that hits its ask deadline deletes its own request file, so a missing file past the deadline can be
697
+ // that timeout or a stop just before it. The parent extends a queued ask's expiresAt in memory too, so a live
698
+ // ask never reads as past it.
699
+ if (lifecycle !== "wrong-session" && lifecycle !== "pending") {
700
+ const now = Date.now();
701
+ const expiresAt = requestExpiresAt(request, now);
702
+ if (lifecycle === "missing" && now > expiresAt)
703
+ rememberEndedRequest(request, "deadline", expiresAt);
704
+ else
705
+ rememberEndedRequest(request, lifecycle, lifecycle === "expired" ? expiresAt : eventAt);
706
+ }
663
707
  updateSettleSubscription();
664
708
  };
665
709
  const getSupervisorRequestState = (event) => {
@@ -716,7 +760,7 @@ export function createNativeSupervisorChannel(pi, state, deps = {}) {
716
760
  };
717
761
  const registerParentTools = () => {
718
762
  if (!hasTool(pi, NATIVE_SUPERVISOR_TOOL_NAME))
719
- pi.registerTool(buildParentSupervisorTool(pi, pending, state, observeRequestLifecycle, () => poll(), runState));
763
+ pi.registerTool(buildParentSupervisorTool(pi, pending, state, observeRequestLifecycle, () => pollOnce(), runState, endedRequests));
720
764
  };
721
765
  // A session that never delegated through `subagent` does not declare the reply tool (scheduled runs, runs
722
766
  // adopted after a resume), so declare it before the model is asked to use it.
@@ -742,7 +786,7 @@ export function createNativeSupervisorChannel(pi, state, deps = {}) {
742
786
  // Supervisor delivery must not fail because best-effort temp cleanup failed.
743
787
  }
744
788
  };
745
- const poll = () => {
789
+ const pollOnce = () => {
746
790
  cleanupStaleChannelsIfDue();
747
791
  // Only display notifications require a live UI context, not request registration.
748
792
  refreshPendingRequests(pending, state, observeRequestLifecycle, runState);
@@ -777,7 +821,7 @@ export function createNativeSupervisorChannel(pi, state, deps = {}) {
777
821
  continue;
778
822
  }
779
823
  seenFiles.add(file);
780
- observeRequestLifecycle(request, "resolved");
824
+ observeRequestLifecycle(request, "resolved", now);
781
825
  cleanupRequestLifecycle(request, "resolved");
782
826
  continue;
783
827
  }
@@ -835,6 +879,17 @@ export function createNativeSupervisorChannel(pi, state, deps = {}) {
835
879
  channels?.retire?.();
836
880
  updateSettleSubscription();
837
881
  };
882
+ // Never throws: this runs from timers, watchers, setImmediate and event handlers, and Pi exits the process on an
883
+ // uncaught exception, so one unreadable temp directory must not end the session. Callers whose answer a model or a
884
+ // drain decision reads use pollOnce, so a failed scan is not mistaken for "no pending requests".
885
+ const poll = () => {
886
+ try {
887
+ pollOnce();
888
+ }
889
+ catch (error) {
890
+ reportSessionWarning(state, `Supervisor channel poll failed: ${error instanceof Error ? error.message : String(error)}`, "supervisor-channel-poll");
891
+ }
892
+ };
838
893
  const handleBeforeSettle = (event) => {
839
894
  if (!started || event.outcome !== "completed")
840
895
  return;
@@ -1048,7 +1103,7 @@ export function createNativeSupervisorChannel(pi, state, deps = {}) {
1048
1103
  hasPendingRequests: () => {
1049
1104
  if (!started)
1050
1105
  return false;
1051
- poll();
1106
+ pollOnce();
1052
1107
  return pending.size > 0;
1053
1108
  },
1054
1109
  start: () => {
@@ -1111,6 +1166,7 @@ export function createNativeSupervisorChannel(pi, state, deps = {}) {
1111
1166
  pending.clear();
1112
1167
  settleNotices.clear();
1113
1168
  requestCorrelations.clear();
1169
+ endedRequests.clear();
1114
1170
  seenFiles.clear();
1115
1171
  },
1116
1172
  pending,
@@ -1,6 +1,3 @@
1
- /**
2
- * Async execution logic for subagent tool
3
- */
4
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
5
2
  import type { ParentProviderRegistry } from "../shared/child-session.ts";
6
3
  import { type AgentConfig, type UnknownAgentDiagnosticContext } from "../../agents/agents.ts";
@@ -17,6 +14,7 @@ import { type ChildRuntimeConfig } from "../shared/child-runtime-config.ts";
17
14
  import type { ImportedAsyncRoot } from "./chain-root-attachment.ts";
18
15
  import type { SessionLeaseRequest } from "../shared/session-lease.ts";
19
16
  import type { ActiveAsyncCapacityHandle } from "./active-async-capacity.ts";
17
+ import { type RequiredRunnerLauncher } from "../../shared/types.ts";
20
18
  import { type ResolvedSubagentCapabilityCeiling } from "../shared/capability-ceiling.ts";
21
19
  import { type PermissionConfig } from "../shared/permissions.ts";
22
20
  import { type ExtensionBindings } from "../shared/extension-bindings.ts";
@@ -134,6 +132,10 @@ interface AsyncSingleParams {
134
132
  machine?: string;
135
133
  /** Launch cwd as typed when a machine is set: a path on that machine, never resolved locally. */
136
134
  machineCwd?: string;
135
+ /** The launcher and agent definition digest the call requires; checked here, on what this launch spawns. */
136
+ requireLauncher?: RequiredRunnerLauncher;
137
+ /** A revived run's inherited requirement: recorded for its own resumes, not checked here (resume already checked it). */
138
+ carriedRequiredLauncher?: RequiredRunnerLauncher;
137
139
  maxOutput?: MaxOutputConfig;
138
140
  artifactsDir?: string;
139
141
  artifactConfig: ArtifactConfig;
@@ -288,13 +290,7 @@ export declare function resolveClaudeCodeThinking(source: string | false | undef
288
290
  * owns the remote model registry, so the combination fails instead of losing both flags. */
289
291
  export declare function assertClaudeCodeOverrideIsLocal(agent: string, machine: string | undefined, override: ClaudeCodeOverride | undefined): void;
290
292
  export declare function buildAsyncRunnerSteps(id: string, params: AsyncRunnerStepBuildParams): AsyncRunnerStepBuildResult;
291
- /**
292
- * Execute a chain asynchronously
293
- */
294
293
  export declare function executeAsyncChain(id: string, params: AsyncChainParams): AsyncExecutionResult | Promise<AsyncExecutionResult>;
295
- /**
296
- * Execute a single agent asynchronously
297
- */
298
294
  export declare function workflowAwaitedAsyncResultPath(asyncDir: string): string;
299
295
  export declare function executeAsyncSingle(id: string, params: AsyncSingleParams): AsyncExecutionResult | Promise<AsyncExecutionResult>;
300
296
  export {};
@@ -1,7 +1,4 @@
1
- /**
2
- * Async execution logic for subagent tool
3
- */
4
- import { spawn } from "node:child_process";
1
+ import { spawn, spawnSync } from "node:child_process";
5
2
  import { randomUUID } from "node:crypto";
6
3
  import * as fs from "node:fs";
7
4
  import * as path from "node:path";
@@ -33,7 +30,7 @@ import { resolveToolTimeoutMs, toolTimeoutFromEnv } from "../shared/tool-timeout
33
30
  import { resolveModelScopesForAgent } from "../shared/model-scope.js";
34
31
  import { findModelInfo, resolveEffectiveThinking } from "../../shared/model-info.js";
35
32
  import { assertThinkingWithinCeiling, intersectThinkingCeilings } from "../../shared/thinking-ceiling.js";
36
- import { resolveExpectedWorktreeAgentCwd, resolveWorktreeProvider, shouldDeferWorktreeCwd, WORKTREE_AGENT_CWD_PLACEHOLDER } from "../shared/worktree.js";
33
+ import { buildWorktreeNaming, resolveExpectedWorktreeAgentCwd, resolveWorktreeProvider, shouldDeferWorktreeCwd, WORKTREE_AGENT_CWD_PLACEHOLDER } from "../shared/worktree.js";
37
34
  import { buildWorkflowGraphSnapshot } from "../shared/workflow-graph.js";
38
35
  import { ChainOutputValidationError, validateChainOutputBindings } from "../shared/chain-outputs.js";
39
36
  import { createStructuredOutputRuntime } from "../shared/structured-output.js";
@@ -54,7 +51,7 @@ import { statusStepDescription } from "./chain-append.js";
54
51
  import { currentBootId, currentRecordedPid } from "./boot-id.js";
55
52
  import { currentPidNamespaceScope } from "./pid-namespace.js";
56
53
  import { checkRecordedPidLiveness } from "./stale-run-reconciler.js";
57
- import { lookupRunnerLauncher, resolveAgentRunnerLauncher, runnerLauncherPlacementError } from "../shared/runner-launcher.js";
54
+ import { checkRequiredRunnerLauncher, lookupRunnerLauncher, resolveAgentRunnerLauncher, runnerLauncherPlacementError } from "../shared/runner-launcher.js";
58
55
  import { SUBAGENT_PROCESS_TERMINAL_EVENT } from "../../shared/types.js";
59
56
  import { assertAgentAllowedByCapabilityCeiling, intersectSubagentCapabilityCeilings, resolveCurrentSubagentCapabilityCeiling } from "../shared/capability-ceiling.js";
60
57
  import { resolveLaunchBinding } from "../../shared/launch-contract.js";
@@ -62,7 +59,9 @@ import { resolvePermissionRules } from "../shared/permissions.js";
62
59
  import { normalizeExtensionBindings, omitExtensionBindingsEnv } from "../shared/extension-bindings.js";
63
60
  import { omitGitRoutingEnv } from "../shared/git-environment.js";
64
61
  import { assertWorkflowLaneKey, normalizeWorkflowLaneMetadata } from "../shared/lane-metadata.js";
62
+ import { recoveryDescriptorPath } from "../shared/run-launch-folder.js";
65
63
  import { assertRequiredChildExtensionsAdmitted, resolveRequiredChildExtensions, writeRetainedRequiredChildExtensions } from "../../shared/required-child-extensions.js";
64
+ import { DEFAULT_WAIT_TOOL_NAME, waitToolName } from "../../shared/wait-tool-name.js";
66
65
  const require = nodeModule.createRequire(import.meta.url);
67
66
  // Cache failures as well as roots: management must remain loadable, and launches must not retry another SDK.
68
67
  const piPackageSelection = (() => {
@@ -150,11 +149,11 @@ export const DEFAULT_ASYNC_TIMEOUT_MS = 30 * 60 * 1000;
150
149
  export function formatAsyncStartedMessage(headline, interactive) {
151
150
  const guidance = interactive
152
151
  ? [
153
- "Detached. Return control now: native completion wakes you, so do not sleep, poll, or call bg_wait for it.",
152
+ `Detached. Return control now: native completion wakes you, so do not sleep, poll, or call ${waitToolName()} for it.`,
154
153
  "One-shot check: subagent({ action: \"status\", id: \"...\" }).",
155
154
  ]
156
155
  : [
157
- "Detached non-interactive run: Pi auto-drains current-session subagent work at agent_end. Do not run sleep timers or polling loops. Use bg_wait only for results this turn needs from work without native notification, and subagent({ action: \"status\", id: \"...\" }) for a one-shot check.",
156
+ `Detached non-interactive run: Pi auto-drains current-session subagent work at agent_end. Do not run sleep timers or polling loops. Use ${waitToolName()} only for results this turn needs from work without native notification, and subagent({ action: \"status\", id: \"...\" }) for a one-shot check.`,
158
157
  ];
159
158
  return [headline, "", ...guidance].join("\n");
160
159
  }
@@ -183,9 +182,6 @@ function closeFd(fd) {
183
182
  // Best-effort cleanup; child process already owns its duplicated stdio fd.
184
183
  }
185
184
  }
186
- /**
187
- * Spawn the async runner process
188
- */
189
185
  const RUNNER_STARTUP_TIMEOUT_MS = 10_000;
190
186
  function waitForStartupInterval(delayMs = 20) {
191
187
  return new Promise((resolve) => setTimeout(resolve, delayMs));
@@ -287,6 +283,33 @@ function terminateRunnerBeforeProceed(pid) {
287
283
  }
288
284
  return !runnerIsAlive(pid);
289
285
  }
286
+ function parentPid(pid) {
287
+ let ppid;
288
+ if (process.platform === "linux") {
289
+ try {
290
+ const stat = fs.readFileSync(`/proc/${pid}/stat`, "utf-8");
291
+ ppid = Number(stat.slice(stat.lastIndexOf(")") + 1).trim().split(/\s+/)[1]);
292
+ }
293
+ catch {
294
+ return undefined;
295
+ }
296
+ }
297
+ else {
298
+ const result = spawnSync("ps", ["-o", "ppid=", "-p", String(pid)], { encoding: "utf-8" });
299
+ if (result.error || result.status !== 0)
300
+ return undefined;
301
+ ppid = Number(result.stdout.trim());
302
+ }
303
+ return Number.isSafeInteger(ppid) && ppid > 0 ? ppid : undefined;
304
+ }
305
+ /** The runner reports its own pid, so behind a launcher only a pid inside the spawned launcher's tree may be signalled. */
306
+ function isInProcessTree(pid, rootPid) {
307
+ for (let current = pid; current !== undefined && current > 1; current = parentPid(current)) {
308
+ if (current === rootPid)
309
+ return true;
310
+ }
311
+ return false;
312
+ }
290
313
  async function terminateRunnerBeforeProceedAsyncDefault(proc, processClosed) {
291
314
  for (const signal of ["SIGTERM", "SIGKILL"]) {
292
315
  if (proc.pid === undefined || !runnerIsAlive(proc.pid))
@@ -449,7 +472,7 @@ function spawnRunner(cfg, suffix, cwd, initialStatus, initialStatusPath, launchP
449
472
  // its own identity before it is allowed to proceed.
450
473
  const launcher = cfg.launcher;
451
474
  const bootId = launcher ? undefined : currentBootId();
452
- const launchConfig = { ...cfg, runnerProcessInstanceId, ...(launchBarrierToken ? { launchBarrierToken } : {}), ...(bootId ? { bootId } : {}) };
475
+ const launchConfig = { ...cfg, runnerProcessInstanceId, ...(launchBarrierToken ? { launchBarrierToken } : {}), ...(bootId ? { bootId } : {}), ...(waitToolName() !== DEFAULT_WAIT_TOOL_NAME ? { waitToolName: waitToolName() } : {}) };
453
476
  writePrivateAtomicJson(cfgPath, launchConfig);
454
477
  const command = binaryHost ?? nodeExecutable;
455
478
  const launchForStartup = launchConfig;
@@ -477,10 +500,12 @@ function spawnRunner(cfg, suffix, cwd, initialStatus, initialStatusPath, launchP
477
500
  if (identityPath)
478
501
  fs.rmSync(identityPath, { force: true });
479
502
  let runnerIdentity;
480
- // Wrapper exit is not runner exit, so only a reported runner in this namespace may be signalled.
503
+ // Wrapper exit is not runner exit, so only a reported runner in this namespace may be signalled, and only
504
+ // inside the spawned launcher's process tree. Otherwise the runner exits when proceed never arrives.
481
505
  const terminateBeforeProceed = (pid) => !launcher
482
506
  ? terminateRunnerBeforeProceed(pid)
483
- : runnerIdentity !== undefined && runnerIdentity.pidNamespaceScope === currentPidNamespaceScope() && terminateRunnerBeforeProceed(runnerIdentity.pid);
507
+ : runnerIdentity !== undefined && runnerIdentity.pidNamespaceScope === currentPidNamespaceScope()
508
+ && isInProcessTree(runnerIdentity.pid, pid) && terminateRunnerBeforeProceed(runnerIdentity.pid);
484
509
  const adoptRunnerIdentity = (pid, pidNamespaceScope) => {
485
510
  if (typeof pid !== "number" || !Number.isSafeInteger(pid) || pid < 1)
486
511
  return `Async runner reported an invalid process identity in '${launchAsyncDir}'.`;
@@ -928,7 +953,7 @@ export function buildAsyncRunnerSteps(id, params) {
928
953
  taskTemplate = taskTemplate.replace(/\{chain_dir\}/g, behaviorCwd ?? runnerCwd);
929
954
  const taskText = `${readInstructions.prefix}${taskTemplate}${progressInstructions.suffix}`;
930
955
  // A namespaced parallel output path is added to each child's task by the runner.
931
- const task = namespaceOutputPath ? taskText : injectSingleOutputInstruction(taskText, outputPath, a);
956
+ const task = namespaceOutputPath ? taskText : injectSingleOutputInstruction(taskText, outputPath, a, machine);
932
957
  const modelScopes = resolveModelScopesForAgent(ctx.modelScope, a.name, ctx.currentModel, ctx.scopedModelIds);
933
958
  const modelOrigin = resolveModelOrigin({ explicitModel: s.model, agentModel: a.model, parentModel: ctx.currentModel });
934
959
  const primaryModelFromParent = modelOrigin === "inherited";
@@ -987,7 +1012,8 @@ export function buildAsyncRunnerSteps(id, params) {
987
1012
  if (launchRuleError)
988
1013
  throw new AsyncStartValidationError(launchRuleError);
989
1014
  const fast = s.fast ?? params.fast ?? a.fast;
990
- const requiredExtensions = externalRunner ? [] : params.requiredExtensions ?? ctx.childRuntime?.requiredExtensions ?? registeredExtensions;
1015
+ // Admission already refused mandatory entries for a placed child, which skips the rest.
1016
+ const requiredExtensions = externalRunner || machine ? [] : params.requiredExtensions ?? ctx.childRuntime?.requiredExtensions ?? registeredExtensions;
991
1017
  const toolPlan = resolvePiLaunchToolPlan({
992
1018
  tools: a.tools,
993
1019
  excludeTools: a.excludeTools,
@@ -1230,9 +1256,6 @@ export function buildAsyncRunnerSteps(id, params) {
1230
1256
  throw error;
1231
1257
  }
1232
1258
  }
1233
- /**
1234
- * Execute a chain asynchronously
1235
- */
1236
1259
  export function executeAsyncChain(id, params) {
1237
1260
  const { chain, agents, ctx, cwd, maxOutput, artifactsDir, artifactConfig, shareEnabled, sessionRoot, sessionFilesByFlatIndex, thinkingOverridesByFlatIndex, maxSubagentDepth, worktreeSetupHook, worktreeSetupHookTimeoutMs, worktreeBaseDir, baseRef, worktreeProvider, worktreeBranchPrefix, controlConfig, controlIntercomTarget, childIntercomTarget, nestedRoute, } = params;
1238
1261
  const resultMode = params.resultMode ?? "chain";
@@ -1555,14 +1578,12 @@ export function executeAsyncChain(id, params) {
1555
1578
  };
1556
1579
  return spawnResultOrPromise instanceof Promise ? spawnResultOrPromise.then(finishSpawnResult) : finishSpawnResult(spawnResultOrPromise);
1557
1580
  }
1558
- /**
1559
- * Execute a single agent asynchronously
1560
- */
1561
1581
  export function workflowAwaitedAsyncResultPath(asyncDir) {
1562
1582
  return path.join(asyncDir, "workflow-result.json");
1563
1583
  }
1564
1584
  export function executeAsyncSingle(id, params) {
1565
- const { agent, agentConfig, ctx, cwd, maxOutput, artifactsDir, artifactConfig, shareEnabled, sessionRoot, sessionFile, maxSubagentDepth, worktreeSetupHook, worktreeSetupHookTimeoutMs, worktreeBaseDir, baseRef, worktreeProvider, worktreeBranchPrefix, controlConfig, controlIntercomTarget, childIntercomTarget, nestedRoute, } = params;
1585
+ const { agent, ctx, cwd, maxOutput, artifactsDir, artifactConfig, shareEnabled, sessionRoot, sessionFile, maxSubagentDepth, worktreeSetupHook, worktreeSetupHookTimeoutMs, worktreeBaseDir, baseRef, worktreeProvider, worktreeBranchPrefix, controlConfig, controlIntercomTarget, childIntercomTarget, nestedRoute, } = params;
1586
+ let agentConfig = params.agentConfig;
1566
1587
  let lane;
1567
1588
  try {
1568
1589
  lane = normalizeWorkflowLaneMetadata(params.lane, "lane");
@@ -1632,6 +1653,13 @@ export function executeAsyncSingle(id, params) {
1632
1653
  if (resolvedLauncher.error)
1633
1654
  return formatAsyncStartError("single", resolvedLauncher.error);
1634
1655
  const launcher = resolvedLauncher.launcher;
1656
+ if (params.requireLauncher) {
1657
+ const required = checkRequiredRunnerLauncher(agentConfig, launcher?.name, params.requireLauncher);
1658
+ if (required.error !== undefined)
1659
+ return formatAsyncStartError("single", required.error);
1660
+ // The launch records the digest it checked, not a second hash of an agent file that may have changed since.
1661
+ agentConfig = { ...agentConfig, definitionDigest: required.definitionDigest };
1662
+ }
1635
1663
  const registeredExtensions = resolveRequiredChildExtensions(ctx.parentSessionId ?? ctx.currentSessionId ?? undefined);
1636
1664
  try {
1637
1665
  assertRequiredChildExtensionsAdmitted([params.requiredExtensions, ctx.childRuntime?.requiredExtensions, registeredExtensions], { agent: agentConfig.name, runnerType: agentConfig.runner?.type, machine: requestedMachine });
@@ -1698,7 +1726,7 @@ export function executeAsyncSingle(id, params) {
1698
1726
  const validationError = validateFileOnlyOutputMode(outputMode, outputPath, `Async single run (${agent})`);
1699
1727
  if (validationError)
1700
1728
  return formatAsyncStartError("single", validationError);
1701
- const taskWithOutputInstruction = injectSingleOutputInstruction(task, outputPath, agentConfig);
1729
+ const taskWithOutputInstruction = injectSingleOutputInstruction(task, outputPath, agentConfig, machine);
1702
1730
  // Reads: caller override > agent defaultReads > none. `~`/`~/` expand to home;
1703
1731
  // absolute paths pass through; relative paths resolve against the child cwd.
1704
1732
  const reads = params.reads !== undefined ? params.reads : agentConfig.defaultReads ?? false;
@@ -1803,7 +1831,8 @@ export function executeAsyncSingle(id, params) {
1803
1831
  return formatAsyncStartError("single", error instanceof Error ? error.message : String(error));
1804
1832
  }
1805
1833
  }
1806
- const requiredExtensions = externalRunner ? [] : params.requiredExtensions ?? ctx.childRuntime?.requiredExtensions ?? registeredExtensions;
1834
+ // Admission already refused mandatory entries for a placed child, which skips the rest.
1835
+ const requiredExtensions = externalRunner || machine ? [] : params.requiredExtensions ?? ctx.childRuntime?.requiredExtensions ?? registeredExtensions;
1807
1836
  const toolPlan = resolvePiLaunchToolPlan({
1808
1837
  tools: agentConfig.tools,
1809
1838
  excludeTools: agentConfig.excludeTools,
@@ -1851,6 +1880,7 @@ export function executeAsyncSingle(id, params) {
1851
1880
  agentContract: params.agentContract,
1852
1881
  });
1853
1882
  const recoveryAgentConfig = params.recoveryAgentConfig ?? agentConfig;
1883
+ const requiredLauncher = params.requireLauncher ?? params.carriedRequiredLauncher;
1854
1884
  const recoveryDescriptor = {
1855
1885
  ...(ctx.modelResponseAliases ? { modelResponseAliases: ctx.modelResponseAliases } : {}),
1856
1886
  version: 1,
@@ -1860,6 +1890,10 @@ export function executeAsyncSingle(id, params) {
1860
1890
  ...(requiredExtensions.length > 0 ? { requiredExtensions } : {}),
1861
1891
  runFanoutBudget,
1862
1892
  sourceRunId: id,
1893
+ ...(ctx.currentSessionId ? { sessionId: ctx.currentSessionId } : {}),
1894
+ // The worktree the runner will create, fixed here from launch inputs (the runner's own naming call).
1895
+ ...(managedWorktreeProvider === "native" ? { managedWorktree: { provider: "native", cwd: instructionCwd } } : {}),
1896
+ ...(managedWorktreeProvider === "worktrunk" ? { managedWorktree: { provider: "worktrunk", branch: buildWorktreeNaming({ runId: `${id}-s0`, index: 0, agent, label: lane?.key ?? params.workflowKey, task: taskText, branchPrefix: worktreeBranchPrefix }).requestedBranch } } : {}),
1863
1897
  ...(params.agentContract ? { agentContract: params.agentContract } : {}),
1864
1898
  agent,
1865
1899
  launchResolvedExtensions,
@@ -1897,7 +1931,8 @@ export function executeAsyncSingle(id, params) {
1897
1931
  ...(params.context ? { context: params.context } : {}),
1898
1932
  ...(params.intercomBridge !== undefined ? { intercomBridge: params.intercomBridge } : {}),
1899
1933
  ...(params.baseRef !== undefined ? { baseRef: params.baseRef } : {}),
1900
- ...(launcher ? { launcher: launcher.name } : {}),
1934
+ launcher: launcher ? launcher.name : null,
1935
+ ...(requiredLauncher ? { requiredLauncher } : {}),
1901
1936
  ...(deadlineAt !== undefined ? { absoluteDeadlineAt: deadlineAt } : {}),
1902
1937
  ...(resolvedToolBudget.budget ? { initialToolBudget: resolvedToolBudget.budget } : {}),
1903
1938
  maxSubagentDepth: resolveChildMaxSubagentDepth(maxSubagentDepth, recoveryAgentConfig.maxSubagentDepth),
@@ -1910,7 +1945,7 @@ export function executeAsyncSingle(id, params) {
1910
1945
  };
1911
1946
  if (!externalRunner) {
1912
1947
  try {
1913
- writePrivateAtomicJson(path.join(asyncDir, "recovery-descriptor.json"), recoveryDescriptor);
1948
+ writePrivateAtomicJson(recoveryDescriptorPath(path.dirname(asyncDir), id), recoveryDescriptor);
1914
1949
  }
1915
1950
  catch (error) {
1916
1951
  return formatAsyncStartError("single", `Failed to persist async recovery descriptor for '${id}': ${error instanceof Error ? error.message : String(error)}`);
@@ -16,6 +16,7 @@ import { validHostStepNodes } from "../shared/host-step-status.js";
16
16
  import { readProcessTerminal } from "./process-terminal.js";
17
17
  import { withCachedUiContext } from "../../shared/extension-context.js";
18
18
  import { OWNING_SESSION_COMPLETION_OWNER } from "../../shared/completion-owner.js";
19
+ import { ownerSessionIds } from "../shared/run-ownership.js";
19
20
  const CONTROL_EVENT_READ_CHUNK_BYTES = 64 * 1024;
20
21
  const MAX_CONTROL_EVENT_LINE_BYTES = 1024 * 1024;
21
22
  const CONTROL_EVENT_SCAN_WINDOW_BYTES = 2 * 1024 * 1024;
@@ -746,7 +747,18 @@ export function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
746
747
  if (now >= nextLivenessAt) {
747
748
  nextLivenessAt = now + livenessIntervalMs;
748
749
  let widgetChanged = false;
750
+ // A session reopened in this process takes its runs back from the session that replaced it.
751
+ const owners = state.currentSessionId ? ownerSessionIds(state.currentSessionId) : undefined;
749
752
  for (const job of state.asyncJobs.values()) {
753
+ if (owners && job.sessionId !== undefined && !owners.has(job.sessionId)) {
754
+ cancelCleanup(job.asyncId);
755
+ closeJobWatcher(job.asyncId);
756
+ state.asyncJobs.delete(job.asyncId);
757
+ state.fleetJobs?.delete(job.asyncId);
758
+ options.onJobCleanup?.(job.asyncId);
759
+ widgetChanged = true;
760
+ continue;
761
+ }
750
762
  watchJob(job);
751
763
  if (refreshJob(job))
752
764
  widgetChanged = true;
@@ -51,8 +51,9 @@ export declare function findAsyncRunPrefixMatches(prefix: string, asyncDirRoot:
51
51
  location: AsyncRunLocation;
52
52
  }>;
53
53
  export declare function resolveAsyncRunLocation(params: AsyncResumeParams, asyncDirRoot: string, resultsDir: string): AsyncRunLocation;
54
+ /** A workflow-mode target has a ceiling only when its parent-owned launch record exists (resolveAsyncResumeTarget). */
54
55
  export declare function asyncReviveRequiresRecoveryDescriptor(target: Pick<AsyncResumeTarget, "recoveryDescriptor" | "mode" | "sessionFile" | "capabilityCeiling">): boolean;
55
- export declare function readAsyncRecoveryDescriptor(asyncDir: string | undefined): SteeringRecoveryDescriptor | undefined;
56
+ export declare function readAsyncRecoveryDescriptor(runsRoot: string, runId: string): SteeringRecoveryDescriptor | undefined;
56
57
  export declare function resolveAsyncResumeTarget(params: AsyncResumeParams, deps?: AsyncResumeDeps, options?: AsyncResumeOptions): AsyncResumeTarget;
57
58
  export declare function applySteeringRecoveryAgentConfig(agentConfig: AgentConfig, descriptor: SteeringRecoveryDescriptor): AgentConfig;
58
59
  export declare function buildRevivedAsyncTask(target: AsyncResumeTarget, message: string): string;