@vicary/pi-subagents 0.88.0 → 0.89.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 (106) hide show
  1. package/CHANGELOG.md +54 -1
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +3 -3
  4. package/bundle/{chunk-6EUQPQY7.js → chunk-443LPCRI.js} +5 -5
  5. package/bundle/{chunk-4QFZZV3O.js → chunk-4AL6LDBY.js} +3 -1
  6. package/bundle/{chunk-CKLZ5FGU.js → chunk-4ALRHKGE.js} +1 -1
  7. package/bundle/{chunk-SVIXQDIV.js → chunk-6JD4XCA4.js} +77 -19
  8. package/bundle/{chunk-XZXYPZUT.js → chunk-7JLNWAMO.js} +54 -36
  9. package/bundle/{chunk-RHYVKQQL.js → chunk-7W2IQFP4.js} +4 -4
  10. package/bundle/{chunk-W6HIYD2Z.js → chunk-A3INCQ6Z.js} +1 -1
  11. package/bundle/{chunk-JYHTDTOZ.js → chunk-CFIYO2IV.js} +5 -5
  12. package/bundle/{chunk-CYKNHFXB.js → chunk-EPMRDKQT.js} +1 -1
  13. package/bundle/{chunk-6PR44R7E.js → chunk-ETDE2VYK.js} +2 -2
  14. package/bundle/{chunk-4MVDMA5C.js → chunk-GHJ6BH5U.js} +13 -7
  15. package/bundle/{chunk-IZEKQEY4.js → chunk-HSHLPYCQ.js} +27 -10
  16. package/bundle/{chunk-3MFYKBKI.js → chunk-HZDLR73C.js} +4 -4
  17. package/bundle/{chunk-2DIEL4WG.js → chunk-JFACGAJT.js} +2 -2
  18. package/bundle/{chunk-L4YY2TOE.js → chunk-JRO2CU4D.js} +1 -1
  19. package/bundle/{chunk-KXW62VBU.js → chunk-KOLLMZ2X.js} +1 -1
  20. package/bundle/{chunk-TDJKY2NE.js → chunk-LEPIY76E.js} +34 -5
  21. package/bundle/{chunk-BW5JLKIU.js → chunk-MJHQIUU7.js} +68 -41
  22. package/bundle/{chunk-47ZN7NKR.js → chunk-NONHDYXE.js} +1 -1
  23. package/bundle/{chunk-PJSOS2Q4.js → chunk-NQ26PJSQ.js} +96 -96
  24. package/bundle/{chunk-AOSILI5R.js → chunk-OVBUEVOT.js} +95 -49
  25. package/bundle/{chunk-NVGQE2H2.js → chunk-PFZZMVD5.js} +75 -32
  26. package/bundle/{chunk-YDZ7BZD5.js → chunk-S77ZKDLS.js} +1 -1
  27. package/bundle/{chunk-3DT5X2QC.js → chunk-SLLZJ5EC.js} +50 -18
  28. package/bundle/{chunk-V7SZMS6W.js → chunk-SWL2EITY.js} +2 -2
  29. package/bundle/{chunk-XIA5GSEU.js → chunk-UQT2EQ4U.js} +2 -2
  30. package/bundle/{chunk-YZPVALSQ.js → chunk-WW6GQBBS.js} +4 -4
  31. package/bundle/{chunk-CTPAE36Y.js → chunk-YARY7JWU.js} +22 -0
  32. package/bundle/{chunk-GDR2ILWY.js → chunk-ZSCIHMUI.js} +50 -22
  33. package/bundle/control-channel.js +2 -2
  34. package/bundle/index.js +2 -2
  35. package/bundle/intercom-bridge.js +2 -2
  36. package/bundle/preflight.js +9 -9
  37. package/bundle/project-panes.js +3 -3
  38. package/bundle/required-child-extensions.js +1 -1
  39. package/docs/agents.md +14 -6
  40. package/docs/configuration.md +2 -0
  41. package/docs/extension-api.md +1 -1
  42. package/docs/tool-reference.md +1 -1
  43. package/docs/workflows.md +8 -4
  44. package/package.json +2 -2
  45. package/src/extension/herdr-pi-bridge.js +78 -22
  46. package/src/extension/index.d.ts +1 -1
  47. package/src/extension/index.js +43 -20
  48. package/src/extension/schemas.js +1 -1
  49. package/src/extension/subagent-launch-tool.d.ts +6 -2
  50. package/src/extension/subagent-launch-tool.js +13 -9
  51. package/src/extension/subagent-options.js +5 -0
  52. package/src/intercom/result-intercom.js +3 -2
  53. package/src/runs/background/notify.d.ts +3 -0
  54. package/src/runs/background/notify.js +7 -2
  55. package/src/runs/background/run-status.js +3 -2
  56. package/src/runs/background/runner-child-launch.js +1 -0
  57. package/src/runs/background/stale-run-reconciler.js +17 -8
  58. package/src/runs/background/subagent-runner.js +11 -8
  59. package/src/runs/foreground/execution.js +8 -7
  60. package/src/runs/foreground/subagent-executor.js +42 -11
  61. package/src/runs/shared/child-launch.d.ts +2 -0
  62. package/src/runs/shared/child-launch.js +7 -4
  63. package/src/runs/shared/child-session.d.ts +3 -2
  64. package/src/runs/shared/child-session.js +3 -27
  65. package/src/runs/shared/herdr-connection.d.ts +6 -0
  66. package/src/runs/shared/herdr-connection.js +11 -1
  67. package/src/runs/shared/herdr-machine.d.ts +2 -2
  68. package/src/runs/shared/herdr-machine.js +47 -22
  69. package/src/runs/shared/herdr-pane-host.d.ts +7 -19
  70. package/src/runs/shared/herdr-pane-host.js +48 -33
  71. package/src/runs/shared/herdr-pi-protocol.d.ts +1 -0
  72. package/src/runs/shared/herdr-pi-protocol.js +3 -2
  73. package/src/runs/shared/herdr-placed-run.d.ts +2 -12
  74. package/src/runs/shared/herdr-placed-run.js +10 -8
  75. package/src/runs/shared/kept-branch-text.d.ts +8 -0
  76. package/src/runs/shared/kept-branch-text.js +24 -0
  77. package/src/runs/shared/local-machine-access.d.ts +4 -1
  78. package/src/runs/shared/local-machine-access.js +6 -3
  79. package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +5 -3
  80. package/src/runs/shared/mcp-direct-tool-allowlist.js +5 -4
  81. package/src/runs/shared/mutation-evidence.d.ts +7 -1
  82. package/src/runs/shared/mutation-evidence.js +18 -2
  83. package/src/runs/shared/parallel-handoff.js +19 -7
  84. package/src/runs/shared/placed-run-owner.d.ts +4 -2
  85. package/src/runs/shared/placed-run-owner.js +15 -7
  86. package/src/runs/shared/rex-machine.d.ts +7 -3
  87. package/src/runs/shared/rex-machine.js +12 -9
  88. package/src/runs/shared/rex-pane-host.js +7 -27
  89. package/src/runs/shared/single-output.js +2 -2
  90. package/src/runs/shared/subagent-prompt-runtime.js +33 -0
  91. package/src/runs/shared/tool-availability.d.ts +4 -0
  92. package/src/runs/shared/tool-availability.js +7 -0
  93. package/src/runs/shared/worktree-cleanup-plan.js +2 -2
  94. package/src/runs/shared/worktree.d.ts +4 -14
  95. package/src/runs/shared/worktree.js +38 -8
  96. package/src/shared/compaction-interruption.d.ts +9 -0
  97. package/src/shared/compaction-interruption.js +47 -0
  98. package/src/shared/parent-wake.d.ts +3 -2
  99. package/src/shared/parent-wake.js +14 -3
  100. package/src/shared/required-child-extensions.d.ts +2 -0
  101. package/src/shared/required-child-extensions.js +27 -0
  102. package/src/shared/types.d.ts +26 -2
  103. package/src/tui/fleet.d.ts +7 -2
  104. package/src/tui/fleet.js +22 -0
  105. package/src/workflows/workflow-child-summary.d.ts +2 -1
  106. package/src/workflows/workflow-child-summary.js +14 -6
@@ -1,10 +1,14 @@
1
+ import { createHash } from "node:crypto";
1
2
  import * as fs from "node:fs";
2
3
  import * as path from "node:path";
3
4
  import { getAgentDir } from "../../shared/utils.js";
4
5
  /** Prints `$1/manifest.json` when it is a regular file, never through a symlink. */
5
6
  export const PLACED_MANIFEST_READ_SCRIPT = 'p="$1/manifest.json"; test -f "$p" && test ! -L "$p" && cat "$p"';
6
- export async function discoverPlacedBridgeManifest(access, runId, runtimeDir, missing = "The placed Pi's pi-subagents bridge manifest is not in its runtime directory; the Pi may have exited.") {
7
- for (let attempt = 0; attempt < 100; attempt++) {
7
+ /** A child with many extensions took about 12 s to write its manifest; a child stuck on a startup prompt holds its pane until this deadline. */
8
+ const PLACED_MANIFEST_DEADLINE_MS = 30_000;
9
+ export async function discoverPlacedBridgeManifest(access, runId, runtimeDir, missing = "The placed Pi's pi-subagents bridge manifest is not in its runtime directory; the Pi may have exited.", deadlineMs = PLACED_MANIFEST_DEADLINE_MS) {
10
+ const deadline = Date.now() + deadlineMs;
11
+ for (;;) {
8
12
  const result = await access.runAsync(access.shellCommand(PLACED_MANIFEST_READ_SCRIPT, [runtimeDir]), { timeout: 5_000, maxBuffer: 64 * 1024 });
9
13
  if (result.error)
10
14
  throw new Error(`Remote bridge manifest discovery failed: ${result.error.message}`, { cause: result.error });
@@ -21,14 +25,19 @@ export async function discoverPlacedBridgeManifest(access, runId, runtimeDir, mi
21
25
  throw new Error("Remote bridge manifest identity is incomplete or outside its owned runtime directory.");
22
26
  return { socketPath: p.socketPath, nativeSessionId: p.nativeSessionId, packageVersion: p.packageVersion, protocol: p.protocol };
23
27
  }
28
+ if (Date.now() >= deadline)
29
+ throw new Error(missing);
24
30
  await new Promise((resolve) => setTimeout(resolve, 50));
25
31
  }
26
- throw new Error(missing);
27
32
  }
33
+ /** A short hash names a runtime directory under /tmp, so /tmp/pi-subagents-herdr-<hash>-XXXXXXXX/bridge.sock (57 bytes) fits the 103-byte macOS socket path limit for any run id. */
34
+ export function hashedRuntimeDirName(runId) { return createHash("sha256").update(runId).digest("hex").slice(0, 12); }
28
35
  export async function createPlacedRuntimeDir(access, runId) { const result = await access.runAsync(access.shellCommand("umask 077; mktemp -d \"${TMPDIR:-/tmp}/pi-subagents-herdr-$1-XXXXXXXX\"", [runId]), { timeout: 10_000, maxBuffer: 4096 }); if (result.error)
29
36
  throw new Error(`Could not provision a run-private remote bridge runtime directory: ${result.error.message}`, { cause: result.error }); const value = result.stdout.trim(); if (result.status !== 0 || !path.posix.isAbsolute(value) || value.includes("\n"))
30
37
  throw new Error("Could not provision a run-private remote bridge runtime directory."); return value; }
31
- export function removePlacedRuntimeDir(access, runtimeDir) { const result = access.run(access.shellCommand("p=$1; case \"${p##*/}\" in pi-subagents-herdr-*) test -d \"$p\" && test ! -L \"$p\" && rm -rf -- \"$p\";; *) exit 64;; esac", [runtimeDir]), { timeout: 10_000, maxBuffer: 4096 }); if (result.status !== 0 || result.stdout)
38
+ // Already-gone counts as removed: the placed child deletes its own runtime directory on session
39
+ // shutdown (herdr-pi-bridge), so the parent's cleanup races it and must tolerate losing.
40
+ export function removePlacedRuntimeDir(access, runtimeDir) { const result = access.run(access.shellCommand("p=$1; case \"${p##*/}\" in pi-subagents-herdr-*) if test -d \"$p\" && test ! -L \"$p\"; then rm -rf -- \"$p\"; fi; test ! -e \"$p\" && test ! -L \"$p\";; *) exit 64;; esac", [runtimeDir]), { timeout: 10_000, maxBuffer: 4096 }); if (result.status !== 0 || result.stdout)
32
41
  throw new Error(`Could not remove the exact owned remote runtime directory: ${String(result.stderr).slice(0, 512)}`); }
33
42
  /** The single private owner for allocation shared by every pane-native backend projection. */
34
43
  export class PlacedRunOwner {
@@ -46,8 +55,7 @@ export class PlacedRunOwner {
46
55
  #unsubscribe = () => { };
47
56
  #snapshot = { connection: "connected", state: "ready", revision: 0 };
48
57
  #cleanupPromise;
49
- #removeRuntime;
50
- constructor(machine, runId, runtimeDir, connection, host, access, removeRuntime = () => removePlacedRuntimeDir(access, runtimeDir)) { this.machine = machine; this.runId = runId; this.runtimeDir = runtimeDir; this.connection = connection; this.#removeRuntime = removeRuntime; this.host = host; this.access = access; }
58
+ constructor(machine, runId, runtimeDir, connection, host, access) { this.machine = machine; this.runId = runId; this.runtimeDir = runtimeDir; this.connection = connection; this.host = host; this.access = access; }
51
59
  observeEvent(event) { const data = this.host.paneEvent(event, this.#snapshot.state); if (data && (!this.terminalId || data.terminalId === this.terminalId || data.paneId === this.owned?.paneId))
52
60
  this.#snapshot = { ...this.#snapshot, revision: this.#snapshot.revision + 1, state: data.state }; }
53
61
  markConnectionUnknown(observed) { if (this.connection !== observed)
@@ -84,7 +92,7 @@ export class PlacedRunOwner {
84
92
  } try {
85
93
  this.#unsubscribe();
86
94
  await this.connection.close();
87
- this.#removeRuntime();
95
+ removePlacedRuntimeDir(this.access, this.runtimeDir);
88
96
  }
89
97
  catch (error) {
90
98
  failure ??= error;
@@ -1,10 +1,12 @@
1
- import type { PlacementMachineReference, RexLocalMachineReference } from "../../shared/types.ts";
2
- /** `machine: "local"` is reserved: this machine, in a Rex pane of the parent's own Rex session. It never consults the Herdr catalog. */
1
+ import type { HerdrLocalMachineReference, PlacementMachineReference, RexLocalMachineReference } from "../../shared/types.ts";
2
+ /** `machine: "local"` is reserved: this machine, in a new tab of the Herdr or Rex session this Pi runs in. It never consults the Herdr catalog. */
3
3
  export declare const REX_LOCAL_MACHINE = "local";
4
4
  /** Rex CLI exit codes: 3 means the target is gone, 4 means the server is unreachable (state unknown, never "gone"). */
5
5
  export declare const REX_EXIT_GONE = 3, REX_EXIT_UNREACHABLE = 4;
6
- /** A `local` child edits this machine's disk; every other placed child edits the remote one. */
6
+ /** A Rex pane in the parent's own Rex session; the other Rex reference is an SSH machine. */
7
7
  export declare function isRexLocalMachine(machine: PlacementMachineReference | undefined): machine is RexLocalMachineReference;
8
+ /** A placed child without an SSH `target` (Rex or Herdr `local`) edits this machine's disk; every other placed child edits the remote one. */
9
+ export declare function editsLocalDisk(machine: PlacementMachineReference | undefined): machine is RexLocalMachineReference | HerdrLocalMachineReference;
8
10
  /** The Rex server bundle's CLI, relative to the home directory. */
9
11
  export declare const REX_BUNDLE_BIN = "Library/Application Support/com.superlogical.rex/RexServer/Versions/Current/Rex Server.app/Contents/MacOS/rex";
10
12
  export declare const REX_CALL_TIMEOUT_MS = 15000, REX_MAX_OUTPUT: number;
@@ -23,3 +25,5 @@ export declare function resolveRexLocalPlacement(input: {
23
25
  stepCwd?: string;
24
26
  env?: NodeJS.ProcessEnv;
25
27
  }): RexLocalMachineReference;
28
+ /** The real launch directory of a `local` child: `stepCwd` is absolute, `~`, or relative to the parent's launch directory `cwd`. */
29
+ export declare function resolveLocalLaunchCwd(parentCwd: string, stepCwd: string | undefined): string;
@@ -2,12 +2,14 @@ import { spawnSync } from "node:child_process";
2
2
  import * as fs from "node:fs";
3
3
  import * as os from "node:os";
4
4
  import * as path from "node:path";
5
- /** `machine: "local"` is reserved: this machine, in a Rex pane of the parent's own Rex session. It never consults the Herdr catalog. */
5
+ /** `machine: "local"` is reserved: this machine, in a new tab of the Herdr or Rex session this Pi runs in. It never consults the Herdr catalog. */
6
6
  export const REX_LOCAL_MACHINE = "local";
7
7
  /** Rex CLI exit codes: 3 means the target is gone, 4 means the server is unreachable (state unknown, never "gone"). */
8
8
  export const REX_EXIT_GONE = 3, REX_EXIT_UNREACHABLE = 4;
9
- /** A `local` child edits this machine's disk; every other placed child edits the remote one. */
9
+ /** A Rex pane in the parent's own Rex session; the other Rex reference is an SSH machine. */
10
10
  export function isRexLocalMachine(machine) { return machine?.provider === "rex" && !("target" in machine); }
11
+ /** A placed child without an SSH `target` (Rex or Herdr `local`) edits this machine's disk; every other placed child edits the remote one. */
12
+ export function editsLocalDisk(machine) { return machine !== undefined && !("target" in machine); }
11
13
  /** The Rex server bundle's CLI, relative to the home directory. */
12
14
  export const REX_BUNDLE_BIN = "Library/Application Support/com.superlogical.rex/RexServer/Versions/Current/Rex Server.app/Contents/MacOS/rex";
13
15
  export const REX_CALL_TIMEOUT_MS = 15_000, REX_MAX_OUTPUT = 1024 * 1024;
@@ -64,9 +66,13 @@ export function resolveRexLocalPlacement(input) {
64
66
  throw new Error(`rex session inspect exited with code ${result.status}: ${(result.stderr || result.stdout).trim().slice(0, 512)}`);
65
67
  if (!sessionConfirmed(result.stdout, session))
66
68
  throw new Error(`The Rex server did not confirm session ${session}.`);
67
- const stepCwd = input.stepCwd?.trim();
68
- const home = stepCwd === "~" || stepCwd?.startsWith("~/") ? path.join(os.homedir(), stepCwd.slice(1)) : undefined;
69
- const requested = home ?? (stepCwd ? path.resolve(input.cwd, stepCwd) : input.cwd);
69
+ return { provider: "rex", id: REX_LOCAL_MACHINE, session, cwd: resolveLocalLaunchCwd(input.cwd, input.stepCwd), ...(server ? { server } : {}) };
70
+ }
71
+ /** The real launch directory of a `local` child: `stepCwd` is absolute, `~`, or relative to the parent's launch directory `cwd`. */
72
+ export function resolveLocalLaunchCwd(parentCwd, stepCwd) {
73
+ const step = stepCwd?.trim();
74
+ const home = step === "~" || step?.startsWith("~/") ? path.join(os.homedir(), step.slice(1)) : undefined;
75
+ const requested = home ?? (step ? path.resolve(parentCwd, step) : parentCwd);
70
76
  let cwd;
71
77
  try {
72
78
  cwd = fs.realpathSync(requested);
@@ -76,8 +82,5 @@ export function resolveRexLocalPlacement(input) {
76
82
  }
77
83
  if (!fs.statSync(cwd).isDirectory())
78
84
  throw new Error(`Machine 'local' cwd is not a directory: ${requested}.`);
79
- const machine = { provider: "rex", id: REX_LOCAL_MACHINE, session, cwd };
80
- if (server)
81
- machine.server = server;
82
- return machine;
85
+ return cwd;
83
86
  }
@@ -1,11 +1,10 @@
1
- import { createHash } from "node:crypto";
2
1
  import * as path from "node:path";
3
2
  import { Type } from "typebox";
4
3
  import { Compile } from "typebox/compile";
5
- import { remoteShellCommand, sshMachineAccess } from "./herdr-connection.js";
4
+ import { sshMachineAccess } from "./herdr-connection.js";
6
5
  import { localMachineAccess } from "./local-machine-access.js";
7
6
  import { getPiSpawnCommand } from "./pi-spawn.js";
8
- import { createPlacedRuntimeDir, PLACED_MANIFEST_READ_SCRIPT, PlacedRunOwner, removePlacedRuntimeDir } from "./placed-run-owner.js";
7
+ import { createPlacedRuntimeDir, hashedRuntimeDirName, PLACED_MANIFEST_READ_SCRIPT, PlacedRunOwner, removePlacedRuntimeDir } from "./placed-run-owner.js";
9
8
  import { withHerdrPaneAllocationLock } from "./placement-host.js";
10
9
  import { isRexLocalMachine, REX_BUNDLE_BIN, REX_CALL_TIMEOUT_MS, REX_EXIT_GONE, REX_EXIT_UNREACHABLE, REX_MAX_OUTPUT, resolveRexBinary, rexCommandEnv, rexGlobalArgs } from "./rex-machine.js";
11
10
  const REX_CLOSE_POLLS = 20, REX_CLOSE_POLL_MS = 50;
@@ -20,7 +19,7 @@ const bridgeManifestPid = Compile(Type.Object({ pid: Type.Integer() }));
20
19
  /** Rex runtime directories go under /tmp: the bridge socket path inside a macOS TMPDIR exceeds the unix socket path limit. */
21
20
  function rexAccess() { return localMachineAccess({ env: { ...rexCommandEnv(), TMPDIR: "/tmp" } }); }
22
21
  /** The same /tmp rule on the remote, whatever TMPDIR its SSH session has. */
23
- function rexSshAccess(machine, access = sshMachineAccess(machine)) { return { ...access, shellCommand: (script, args) => remoteShellCommand(`TMPDIR=/tmp; export TMPDIR; ${script}`, args) }; }
22
+ function rexSshAccess(machine, access = sshMachineAccess(machine)) { return { ...access, shellCommand: (script, args) => access.shellCommand(`TMPDIR=/tmp; export TMPDIR; ${script}`, args) }; }
24
23
  function asRexMachine(machine) { if (machine.provider !== "rex")
25
24
  throw new Error("The Rex pane host only places runs on Rex machines."); return machine; }
26
25
  /** Runs one rex command on the pane machine with --autostart=false, the recorded server, and no inherited Rex selectors; exit 4 always throws. */
@@ -265,30 +264,11 @@ export const rexPaneHost = {
265
264
  reconcile: reconcileRexPlacedRun,
266
265
  closeOwnedPane: closeOwnedRexPane,
267
266
  };
268
- function runtimeDirPresent(access, runtimeDir) {
269
- const result = access.run(access.shellCommand('test -e "$1" || test -L "$1"', [runtimeDir]), { timeout: 10_000, maxBuffer: 4096 });
270
- if (result.error)
271
- throw new Error(`Could not check the owned runtime directory: ${result.error.message}`, { cause: result.error });
272
- return result.status === 0;
273
- }
274
- /** A closed local Pi removes its own runtime directory on shutdown, so already-removed counts as removed. */
275
- function removeRexRuntimeDir(access, runtimeDir) {
276
- if (!runtimeDirPresent(access, runtimeDir))
277
- return;
278
- try {
279
- removePlacedRuntimeDir(access, runtimeDir);
280
- }
281
- catch (error) {
282
- if (runtimeDirPresent(access, runtimeDir))
283
- throw error;
284
- }
285
- }
286
267
  export class RexPlacedRunOwner extends PlacedRunOwner {
287
- constructor(machine, runId, runtimeDir, connection, access, host) { super(machine, runId, runtimeDir, connection, host, access, () => removeRexRuntimeDir(access, runtimeDir)); }
268
+ constructor(machine, runId, runtimeDir, connection, access, host) { super(machine, runId, runtimeDir, connection, host, access); }
288
269
  /** A Rex SSH owner's machine carries the resolved remote cwd, and its host reconnects only to the session recorded here. */
289
270
  static async create(machine, runId, options = {}) {
290
- // A short hash names the directory, so /tmp/pi-subagents-herdr-<hash>-XXXXXXXX/bridge.sock (57 bytes) fits the 103-byte macOS socket path limit for any run id.
291
- const hash = createHash("sha256").update(runId).digest("hex").slice(0, 12);
271
+ const hash = hashedRuntimeDirName(runId);
292
272
  if (isRexLocalMachine(machine)) {
293
273
  const access = rexAccess(), runtimeDir = await createPlacedRuntimeDir(access, hash);
294
274
  try {
@@ -296,7 +276,7 @@ export class RexPlacedRunOwner extends PlacedRunOwner {
296
276
  }
297
277
  catch (error) {
298
278
  try {
299
- removeRexRuntimeDir(access, runtimeDir);
279
+ removePlacedRuntimeDir(access, runtimeDir);
300
280
  }
301
281
  catch (cleanupError) {
302
282
  throw new AggregateError([error, cleanupError], "Rex owner creation failed and runtime cleanup also failed.", { cause: error });
@@ -314,7 +294,7 @@ export class RexPlacedRunOwner extends PlacedRunOwner {
314
294
  }
315
295
  catch (error) {
316
296
  try {
317
- removeRexRuntimeDir(access, runtimeDir);
297
+ removePlacedRuntimeDir(access, runtimeDir);
318
298
  }
319
299
  catch (cleanupError) {
320
300
  throw new AggregateError([error, cleanupError], "Rex owner creation failed and runtime cleanup also failed.", { cause: error });
@@ -1,6 +1,6 @@
1
1
  import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
- import { isRexLocalMachine } from "./rex-machine.js";
3
+ import { editsLocalDisk } from "./rex-machine.js";
4
4
  const READ_ONLY_OUTPUT_TOOLS = new Set([
5
5
  "read", "grep", "find", "ls", "web_search", "fetch_content", "get_search_content",
6
6
  "source_check", "intercom", "contact_supervisor", "structured_output", "watchdog_diff",
@@ -103,7 +103,7 @@ export function outputPathMappingFromTask(task, savedPath) {
103
103
  export function injectSingleOutputInstruction(task, outputPath, capabilities, machine) {
104
104
  if (!outputPath)
105
105
  return task;
106
- const remote = machine !== undefined && !isRexLocalMachine(machine);
106
+ const remote = machine !== undefined && !editsLocalDisk(machine);
107
107
  const delivery = !remote && (!capabilities || hasOutputWriteCapability(capabilities.tools, capabilities.mcpDirectTools))
108
108
  ? `Write your findings to exactly this path: ${outputPath}`
109
109
  : [
@@ -229,8 +229,41 @@ function filterChildPromptOptions(options, inherited) {
229
229
  function rewritesChildPrompt(config) {
230
230
  return config.inheritProjectContext !== undefined || config.inheritGlobalContext !== undefined || config.inheritSkills !== undefined || Boolean(config.fanoutChild);
231
231
  }
232
+ /**
233
+ * An extension can replace the tools a request declares (pi-fabric's code mode sends only its own
234
+ * `fabric_exec`), and Pi only reports a throw from a request hook. This hook runs after every other
235
+ * extension's, so a child whose registered allowlisted tools were left out records why and stops
236
+ * before the provider gets the request. A request that declares them all passes through unchanged.
237
+ */
238
+ function registerDeclaredToolCheck(pi, config, required) {
239
+ pi.on("context_with_system", (event, ctx) => {
240
+ const declared = new Set(getCurrentTools(event.messages).map((tool) => tool.name));
241
+ if (required.every((name) => declared.has(name)))
242
+ return undefined;
243
+ const registered = new Set(pi.getAllTools().map((tool) => tool.name));
244
+ // A required tool that never registered is the agent_start diagnostic's case.
245
+ const undeclared = required.filter((name) => registered.has(name) && !declared.has(name));
246
+ if (undeclared.length === 0)
247
+ return undefined;
248
+ const active = new Set(pi.getActiveTools());
249
+ // A fork declares its parent's tools on purpose, to reuse the parent's prompt cache.
250
+ const uncallable = config.forkCacheKey ? [] : [...declared].filter((name) => !active.has(name));
251
+ config.toolDiagnostic?.({
252
+ ...(config.agent ? { agent: config.agent } : {}),
253
+ required: [...required],
254
+ available: [...registered],
255
+ missing: [],
256
+ undeclared,
257
+ ...(uncallable.length > 0 ? { uncallable } : {}),
258
+ });
259
+ ctx.abort();
260
+ return undefined;
261
+ });
262
+ }
232
263
  /** Installed after every other extension: a returned prompt freezes out sections added after it. */
233
264
  export function registerSubagentPromptBoundary(pi, config) {
265
+ if (config.requiredTools)
266
+ registerDeclaredToolCheck(pi, config, config.requiredTools);
234
267
  if (!rewritesChildPrompt(config))
235
268
  return;
236
269
  // A returned prompt replaces the whole system prompt of every request. A fork must send its
@@ -4,6 +4,10 @@ export interface ChildToolDiagnostic {
4
4
  available: string[];
5
5
  missing: string[];
6
6
  missingMcpDirectTools?: string[];
7
+ /** Registered allowlisted tools an extension left out of the tools sent to the model. */
8
+ undeclared?: string[];
9
+ /** Tools sent to the model that this child cannot call. */
10
+ uncallable?: string[];
7
11
  }
8
12
  /**
9
13
  * Explain missing child tools. Foreground children run inside the parent
@@ -6,6 +6,13 @@
6
6
  */
7
7
  export function formatChildToolDiagnostic(diagnostic, options = {}) {
8
8
  const subject = diagnostic.agent ? `Agent '${diagnostic.agent}'` : "Subagent";
9
+ if (diagnostic.undeclared?.length) {
10
+ const uncallable = diagnostic.uncallable?.length ? ` and added ${diagnostic.uncallable.join(", ")}, which this child cannot call` : "";
11
+ return [
12
+ `${subject} declares tools: ${diagnostic.required.join(", ")}, but an extension loaded in this child replaced the tools sent to the model: it left out ${diagnostic.undeclared.join(", ")}${uncallable}.`,
13
+ "The `tools` field is a strict allowlist. Set `extensions: []` or list only the extensions this child needs, or omit `tools` to use that extension's tool surface.",
14
+ ].join("\n");
15
+ }
9
16
  if (options.host === "parent") {
10
17
  return [
11
18
  `${subject} ran as a foreground child, which never loads the parent's ambient extensions, and these child tools were unavailable: ${diagnostic.missing.join(", ")}.`,
@@ -8,7 +8,7 @@ import { PROJECT_SUBAGENTS_RELATIVE_DIR } from "../../shared/artifacts.js";
8
8
  import { DEFAULT_STALE_TERMINAL_ACTIVE_MARKER_MS, activeRunMarkerAgeMs } from "../background/active-run-index.js";
9
9
  import { getAgentDir } from "../../shared/utils.js";
10
10
  import { isTerminalParallelHandoffChildStatus, readParallelHandoffManifest } from "./parallel-handoff.js";
11
- import { MACHINE_DIFF_OPTIONS, validateWorktreePatchRepresentsCurrentWorktree } from "./worktree.js";
11
+ import { MACHINE_DIFF_OPTIONS, isWorktreeCleanupTaskDone, validateWorktreePatchRepresentsCurrentWorktree } from "./worktree.js";
12
12
  export const WORKTREE_CLEANUP_PLAN_VERSION = 1;
13
13
  export const WORKTREE_CLEANUP_PLAN_TTL_MS = 30 * 60 * 1000;
14
14
  const MAX_DISCOVERED_HANDOFFS = 256;
@@ -650,7 +650,7 @@ function buildUnknownGitEntry(input) {
650
650
  return blockedEntry(entry, "unknown", "unknown", "no matching extension-owned handoff metadata was found");
651
651
  }
652
652
  function buildMissingMetadataEntry(input) {
653
- if (input.record.task.worktreeRemoved && input.record.task.branchRemoved)
653
+ if (isWorktreeCleanupTaskDone(input.record.task))
654
654
  return undefined;
655
655
  const pathValue = metadataRecordPath(input.record);
656
656
  const entry = buildEntryBase({ path: pathValue, branch: input.record.task.branch, source: "metadata", metadata: input.record, targetHead: input.targetHead });
@@ -1,6 +1,6 @@
1
1
  import { type SetupCommandOptions, type SetupCommandResult } from "./worktree-setup-command.ts";
2
2
  import { type AuthorityPolicyConfig } from "../../policy/authority.ts";
3
- import type { ManagedWorktreeProvider, WorktreeNaming, WorktreeProvider } from "../../shared/types.ts";
3
+ import type { ManagedWorktreeProvider, ParallelHandoffCleanupTask, WorktreeNaming, WorktreeProvider } from "../../shared/types.ts";
4
4
  export declare const DEFAULT_WORKTREE_PROVIDER: WorktreeProvider;
5
5
  export declare const DEFAULT_WORKTREE_BASE_REF = "HEAD";
6
6
  export declare const DEFAULT_WORKTREE_BRANCH_PREFIX = "pi-subagents/";
@@ -59,19 +59,7 @@ export interface WorktreeDiff {
59
59
  patchPath: string;
60
60
  error?: string;
61
61
  }
62
- export interface WorktreeCleanupTask {
63
- recordedBaseDir?: string;
64
- index: number;
65
- path: string;
66
- branch: string;
67
- provider?: ManagedWorktreeProvider;
68
- naming?: WorktreeNaming;
69
- worktreeRemoved: boolean;
70
- branchRemoved: boolean;
71
- preserved?: boolean;
72
- reason?: string;
73
- errors?: string[];
74
- }
62
+ export type WorktreeCleanupTask = ParallelHandoffCleanupTask;
75
63
  export type WorktreeCleanupIntent = {
76
64
  kind: "preserve";
77
65
  capturedDiffs?: WorktreeDiff[];
@@ -179,6 +167,8 @@ export declare function shouldDeferWorktreeCwd(requested: WorktreeProvider | und
179
167
  export declare function resolveExpectedWorktreeAgentCwd(cwd: string, runId: string, index: number, baseDir?: string): string;
180
168
  export declare function createWorktrees(cwd: string, runId: string, count: number, options?: CreateWorktreesOptions): Promise<WorktreeSetup>;
181
169
  export declare function diffWorktrees(setup: WorktreeSetup, agents: string[], diffsDir: string): WorktreeDiff[];
170
+ /** A branch kept for its commits is a finished cleanup, the same as a removed one. */
171
+ export declare function isWorktreeCleanupTaskDone(task: Pick<WorktreeCleanupTask, "worktreeRemoved" | "branchRemoved" | "keptBranchTip">): boolean;
182
172
  export declare function cleanupWorktrees(setup: WorktreeSetup, intent?: WorktreeCleanupIntent): WorktreeCleanupReport;
183
173
  export declare function formatWorktreeDiffSummary(diffs: WorktreeDiff[]): string;
184
174
  export {};
@@ -220,8 +220,12 @@ async function probeWorktreeSource(tx, cwd) {
220
220
  // pi-subagents writes durable runtime state under .pi/subagents/ by default;
221
221
  // that state must not make managed isolation unusable for later runs.
222
222
  const status = await tx.gitChecked(toplevel, ["status", "--porcelain", "--", `:!${PROJECT_SUBAGENTS_RELATIVE_DIR}`]);
223
- if (status.trim().length > 0) {
224
- throw new Error("worktree isolation requires a clean git working tree. Commit or stash changes first.");
223
+ const changes = status.split("\n").filter((line) => line.trim().length > 0);
224
+ if (changes.length > 0) {
225
+ const shown = changes.slice(0, 10).map((line) => ` ${line}`);
226
+ if (changes.length > shown.length)
227
+ shown.push(` … and ${changes.length - shown.length} more`);
228
+ throw new Error(`worktree isolation requires a clean git working tree: ${toplevel} has ${changes.length} uncommitted change(s):\n${shown.join("\n")}\nCommit or stash them first.`);
225
229
  }
226
230
  return toplevel;
227
231
  }
@@ -1014,6 +1018,7 @@ function cleanupSingleWorktree(setup, worktree, intent) {
1014
1018
  const errors = [];
1015
1019
  let worktreeRemoved = false;
1016
1020
  let branchRemoved = false;
1021
+ let keptBranchTip;
1017
1022
  if (intent.kind === "preserve" && intent.cleanupBlocker) {
1018
1023
  return {
1019
1024
  index: worktree.index,
@@ -1124,12 +1129,32 @@ function cleanupSingleWorktree(setup, worktree, intent) {
1124
1129
  errors.push(`worktree removal failed: ${error instanceof Error ? error.message : String(error)}`);
1125
1130
  }
1126
1131
  if (worktreeRemoved) {
1127
- try {
1128
- runGitChecked(setup.cwd, ["branch", "-D", worktree.branch]);
1129
- branchRemoved = true;
1132
+ let deleteBranch = true;
1133
+ if (intent.kind === "preserve") {
1134
+ // The handoff patch keeps the child's content but not its commits, so a branch holding the only copy of them stays.
1135
+ try {
1136
+ const tip = runGitChecked(setup.cwd, ["rev-parse", "--verify", `refs/heads/${worktree.branch}^{commit}`]).trim();
1137
+ if (tip !== setup.baseCommit) {
1138
+ const containing = runGitChecked(setup.cwd, ["for-each-ref", "--contains", tip, "--format=%(refname)", "refs/heads", "refs/remotes", "refs/tags"]);
1139
+ if (!containing.split("\n").some((ref) => ref && ref !== `refs/heads/${worktree.branch}`)) {
1140
+ keptBranchTip = tip;
1141
+ deleteBranch = false;
1142
+ }
1143
+ }
1144
+ }
1145
+ catch (error) {
1146
+ deleteBranch = false;
1147
+ errors.push(`branch check failed: ${error instanceof Error ? error.message : String(error)}`);
1148
+ }
1130
1149
  }
1131
- catch (error) {
1132
- errors.push(`branch removal failed: ${error instanceof Error ? error.message : String(error)}`);
1150
+ if (deleteBranch) {
1151
+ try {
1152
+ runGitChecked(setup.cwd, ["branch", "-D", worktree.branch]);
1153
+ branchRemoved = true;
1154
+ }
1155
+ catch (error) {
1156
+ errors.push(`branch removal failed: ${error instanceof Error ? error.message : String(error)}`);
1157
+ }
1133
1158
  }
1134
1159
  }
1135
1160
  return {
@@ -1141,6 +1166,7 @@ function cleanupSingleWorktree(setup, worktree, intent) {
1141
1166
  ...(worktree.recordedBaseDir ? { recordedBaseDir: worktree.recordedBaseDir } : {}),
1142
1167
  worktreeRemoved,
1143
1168
  branchRemoved,
1169
+ ...(keptBranchTip ? { keptBranchTip } : {}),
1144
1170
  ...(errors.length ? { errors } : {}),
1145
1171
  };
1146
1172
  }
@@ -1324,6 +1350,10 @@ export function diffWorktrees(setup, agents, diffsDir) {
1324
1350
  setup.capturedDiffs = diffs;
1325
1351
  return diffs;
1326
1352
  }
1353
+ /** A branch kept for its commits is a finished cleanup, the same as a removed one. */
1354
+ export function isWorktreeCleanupTaskDone(task) {
1355
+ return task.worktreeRemoved && (task.branchRemoved || task.keptBranchTip !== undefined);
1356
+ }
1327
1357
  export function cleanupWorktrees(setup, intent = { kind: "preserve", ...(setup.capturedDiffs ? { capturedDiffs: setup.capturedDiffs } : {}) }) {
1328
1358
  assertWorktreeMutationAllowed();
1329
1359
  const tasks = [];
@@ -1340,7 +1370,7 @@ export function cleanupWorktrees(setup, intent = { kind: "preserve", ...(setup.c
1340
1370
  catch (error) {
1341
1371
  errors.push(`worktree prune failed: ${error instanceof Error ? error.message : String(error)}`);
1342
1372
  }
1343
- const state = tasks.every((task) => task.worktreeRemoved && task.branchRemoved) && pruned ? "complete" : "partial";
1373
+ const state = tasks.every(isWorktreeCleanupTaskDone) && pruned ? "complete" : "partial";
1344
1374
  return {
1345
1375
  state,
1346
1376
  tasks,
@@ -0,0 +1,9 @@
1
+ export declare function installCompactionInterruptionCapture(sessionClass: {
2
+ prototype: object;
3
+ }): void;
4
+ /** A manual compaction of this session is in progress, until compact() returns. */
5
+ export declare function compactionInProgress(sessionManager: object): boolean;
6
+ /** A manual compaction of this session that aborted an active run is in progress. */
7
+ export declare function compactionInterruptedRun(sessionManager: object): boolean;
8
+ /** True once, for the aborted end of the run the compaction interrupted; a later run's abort is the user's. */
9
+ export declare function takeCompactionAbort(sessionManager: object): boolean;
@@ -0,0 +1,47 @@
1
+ // Pi's manual compaction (/compact, RPC, ctx.compact()) aborts the active run before any hook runs, and its
2
+ // events do not say whether it interrupted one. Record that in AgentSession.compact, their shared entry point.
3
+ const stateSymbol = Symbol.for("pi-subagents.compaction-interruption.v1");
4
+ const wrappedSymbol = Symbol.for("pi-subagents.compaction-interruption.v1.wrapped");
5
+ // Shared with the wrapper an earlier extension instance installed before a reload.
6
+ const globalStore = globalThis;
7
+ const compactions = globalStore[stateSymbol] ??= new WeakMap();
8
+ export function installCompactionInterruptionCapture(sessionClass) {
9
+ const prototype = sessionClass.prototype;
10
+ const original = prototype.compact;
11
+ if (original[wrappedSymbol])
12
+ return;
13
+ const compact = async function (...args) {
14
+ const manager = this.sessionManager;
15
+ const compaction = compactions.get(manager) ?? { calls: 0, interrupted: false, abortPending: false };
16
+ compactions.set(manager, compaction);
17
+ compaction.calls += 1;
18
+ // Overlapping calls share the record: a later idle call must not erase an earlier interruption.
19
+ if (this.isStreaming)
20
+ compaction.interrupted = compaction.abortPending = true;
21
+ try {
22
+ return await original.apply(this, args);
23
+ }
24
+ finally {
25
+ if (--compaction.calls === 0)
26
+ compactions.delete(manager);
27
+ }
28
+ };
29
+ compact[wrappedSymbol] = true;
30
+ prototype.compact = compact;
31
+ }
32
+ /** A manual compaction of this session is in progress, until compact() returns. */
33
+ export function compactionInProgress(sessionManager) {
34
+ return compactions.has(sessionManager);
35
+ }
36
+ /** A manual compaction of this session that aborted an active run is in progress. */
37
+ export function compactionInterruptedRun(sessionManager) {
38
+ return compactions.get(sessionManager)?.interrupted === true;
39
+ }
40
+ /** True once, for the aborted end of the run the compaction interrupted; a later run's abort is the user's. */
41
+ export function takeCompactionAbort(sessionManager) {
42
+ const compaction = compactions.get(sessionManager);
43
+ if (!compaction?.abortPending)
44
+ return false;
45
+ compaction.abortPending = false;
46
+ return true;
47
+ }
@@ -10,6 +10,7 @@ export interface ParentWake {
10
10
  * Returns true when the message was only appended (held, or another wake is already starting
11
11
  * the run): Pi emits no extension message_start for it.
12
12
  * After userAborted() and until the next run starts, a turn-triggering message is only appended.
13
+ * So it is during a manual compaction, which Pi does not guard against a new run; takeDeferredWake() reports it.
13
14
  */
14
15
  sendMessage(...args: Parameters<ExtensionAPI["sendMessage"]>): boolean;
15
16
  /** True from an idle wake until its run starts or the session shuts down. Past the deadline it holds only while the parent is busy, which may still be the wake's preflight (for example compacting). */
@@ -18,9 +19,9 @@ export interface ParentWake {
18
19
  agentStarted(): void;
19
20
  /** The user stopped the parent run: hold wakes until the next run starts. */
20
21
  userAborted(): void;
21
- /** A deliberate resume (manual compaction) drops the hold without touching the shared wake reservation. */
22
- releaseHold(): void;
23
22
  isHeld(): boolean;
23
+ /** True once if a wake was only appended because a manual compaction was in progress. */
24
+ takeDeferredWake(): boolean;
24
25
  sessionShutdown(reason: string | undefined): void;
25
26
  }
26
27
  export declare function createParentWake(pi: Pick<ExtensionAPI, "sendMessage">, now?: () => number): ParentWake;
@@ -1,3 +1,4 @@
1
+ import { compactionInProgress } from "./compaction-interruption.js";
1
2
  /** Ends a waking notice that reports results. */
2
3
  export const COMPLETION_ACTION = "Read the saved results above and resume the already-authorized parent task, or report completion. If approval is required, explicitly ask the user. Do not silently yield, rerun completed work, or infer new authorization.";
3
4
  /** Ends a waking notice that reports a problem or a run state rather than results. */
@@ -14,6 +15,7 @@ export function createParentWake(pi, now = Date.now) {
14
15
  // Captured at bind: Pi's ctx throws once stale, which it can be by session_shutdown.
15
16
  let session;
16
17
  let held = false;
18
+ let deferred = false;
17
19
  // Look the reservation up on every access: another extension may have created this session's entry.
18
20
  const reservation = () => {
19
21
  // Pi can shut an extension down before session_start binds it; an unbound wake reserved nothing.
@@ -42,6 +44,11 @@ export function createParentWake(pi, now = Date.now) {
42
44
  pi.sendMessage(message, { triggerTurn: false });
43
45
  return true;
44
46
  }
47
+ if (session && compactionInProgress(session.manager)) {
48
+ deferred = true;
49
+ pi.sendMessage(message, { triggerTurn: false });
50
+ return true;
51
+ }
45
52
  if (ctx.isIdle())
46
53
  reservation().sentAt = now();
47
54
  pi.sendMessage(message, options);
@@ -51,15 +58,19 @@ export function createParentWake(pi, now = Date.now) {
51
58
  bindSession(context) {
52
59
  ctx = context;
53
60
  session = { manager: context.sessionManager, id: context.sessionManager.getSessionId() };
54
- held = false;
61
+ held = deferred = false;
55
62
  },
56
63
  agentStarted() {
57
64
  reservation().sentAt = undefined;
58
- held = false;
65
+ held = deferred = false;
59
66
  },
60
67
  userAborted: () => { held = true; },
61
- releaseHold: () => { held = false; },
62
68
  isHeld: () => held,
69
+ takeDeferredWake() {
70
+ const wasDeferred = deferred;
71
+ deferred = false;
72
+ return wasDeferred;
73
+ },
63
74
  sessionShutdown(reason) {
64
75
  if (reason !== "reload")
65
76
  reservation().sentAt = undefined;
@@ -28,6 +28,8 @@ export declare function assertRequiredChildExtensionsAdmitted(snapshots: Readonl
28
28
  runnerType?: string;
29
29
  machine?: string;
30
30
  }): void;
31
+ /** Maps a path to the identity of the required extension file it names, or undefined. A required path that can't be stat'ed matches only its own spelling. */
32
+ export declare function createRequiredChildExtensionIdentity(requiredPaths: Iterable<string>): (extensionPath: string) => string | undefined;
31
33
  export declare function hasMandatoryRequiredChildExtensions(snapshot: RequiredChildExtensionSnapshot | undefined): snapshot is RequiredChildExtensionSnapshot;
32
34
  /** Persist a run's mandatory snapshot so append-step admits against it; writes nothing without a mandatory entry. */
33
35
  export declare function writeRetainedRequiredChildExtensions(asyncDir: string, snapshot: RequiredChildExtensionSnapshot): void;
@@ -87,6 +87,33 @@ export function assertRequiredChildExtensionsAdmitted(snapshots, launch) {
87
87
  if (route)
88
88
  throw new Error(`Agent '${launch.agent}' cannot run on ${route}: the host requires child extensions (${ids.join(", ")}) for every runner, and only local native Pi children load them.`);
89
89
  }
90
+ function childExtensionFileIdentity(extensionPath) {
91
+ if (!path.isAbsolute(extensionPath))
92
+ return undefined;
93
+ try {
94
+ const stat = fs.statSync(extensionPath, { bigint: true });
95
+ return stat.isFile() ? `${stat.dev}:${stat.ino}` : undefined;
96
+ }
97
+ catch {
98
+ return undefined;
99
+ }
100
+ }
101
+ /** Maps a path to the identity of the required extension file it names, or undefined. A required path that can't be stat'ed matches only its own spelling. */
102
+ export function createRequiredChildExtensionIdentity(requiredPaths) {
103
+ const aliases = new Map([...requiredPaths].map((extensionPath) => [extensionPath, childExtensionFileIdentity(extensionPath) ?? extensionPath]));
104
+ const identities = new Set(aliases.values());
105
+ return (extensionPath) => {
106
+ const known = aliases.get(extensionPath);
107
+ if (known !== undefined)
108
+ return known;
109
+ const identity = childExtensionFileIdentity(extensionPath);
110
+ if (identity === undefined || !identities.has(identity))
111
+ return undefined;
112
+ // Retain the alias even if the extension removes its file before reporting a failure.
113
+ aliases.set(extensionPath, identity);
114
+ return identity;
115
+ };
116
+ }
90
117
  export function hasMandatoryRequiredChildExtensions(snapshot) {
91
118
  return snapshot?.some((entry) => entry.requireForAllRunners) === true;
92
119
  }