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-UVDLJXL6.js → chunk-2I6YN6ET.js} +34 -5
  5. package/bundle/{chunk-6EUQPQY7.js → chunk-443LPCRI.js} +5 -5
  6. package/bundle/{chunk-4QFZZV3O.js → chunk-4AL6LDBY.js} +3 -1
  7. package/bundle/{chunk-CKLZ5FGU.js → chunk-4ALRHKGE.js} +1 -1
  8. package/bundle/{chunk-SVIXQDIV.js → chunk-6JD4XCA4.js} +77 -19
  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-4PM6RDE5.js → chunk-AZW4HXNU.js} +54 -36
  12. package/bundle/{chunk-XAOHLFJO.js → chunk-CHEABMO2.js} +68 -41
  13. package/bundle/{chunk-CYKNHFXB.js → chunk-EPMRDKQT.js} +1 -1
  14. package/bundle/{chunk-6PR44R7E.js → chunk-ETDE2VYK.js} +2 -2
  15. package/bundle/{chunk-4MVDMA5C.js → chunk-GHJ6BH5U.js} +13 -7
  16. package/bundle/{chunk-IZEKQEY4.js → chunk-HSHLPYCQ.js} +27 -10
  17. package/bundle/{chunk-3MFYKBKI.js → chunk-HZDLR73C.js} +4 -4
  18. package/bundle/{chunk-2DIEL4WG.js → chunk-JFACGAJT.js} +2 -2
  19. package/bundle/{chunk-L4YY2TOE.js → chunk-JRO2CU4D.js} +1 -1
  20. package/bundle/{chunk-KXW62VBU.js → chunk-KOLLMZ2X.js} +1 -1
  21. package/bundle/{chunk-47ZN7NKR.js → chunk-NONHDYXE.js} +1 -1
  22. package/bundle/{chunk-PJSOS2Q4.js → chunk-NQ26PJSQ.js} +96 -96
  23. package/bundle/{chunk-6OWNDN7R.js → chunk-PPPAEFRA.js} +2 -2
  24. package/bundle/{chunk-YDZ7BZD5.js → chunk-S77ZKDLS.js} +1 -1
  25. package/bundle/{chunk-3DT5X2QC.js → chunk-SLLZJ5EC.js} +50 -18
  26. package/bundle/{chunk-47GJDBIK.js → chunk-TGABNSG5.js} +5 -5
  27. package/bundle/{chunk-XIA5GSEU.js → chunk-UQT2EQ4U.js} +2 -2
  28. package/bundle/{chunk-YZPVALSQ.js → chunk-WW6GQBBS.js} +4 -4
  29. package/bundle/{chunk-4UGWHREQ.js → chunk-X5ZOTDHO.js} +95 -49
  30. package/bundle/{chunk-CTPAE36Y.js → chunk-YARY7JWU.js} +22 -0
  31. package/bundle/{chunk-MTPICU4A.js → chunk-YX7R55CR.js} +75 -32
  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 +1 -1
  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
@@ -11,7 +11,7 @@ import {
11
11
  readStatus,
12
12
  writeAtomicJson,
13
13
  writePrivateAtomicJson
14
- } from "./chunk-4MVDMA5C.js";
14
+ } from "./chunk-GHJ6BH5U.js";
15
15
  import {
16
16
  ASYNC_DIR,
17
17
  INTERCOM_DETACH_REQUEST_EVENT,
@@ -11,13 +11,13 @@ import {
11
11
  validateAuthorityPolicy,
12
12
  validateMissionStoreConfig,
13
13
  validateModelResponseAliases
14
- } from "./chunk-3DT5X2QC.js";
14
+ } from "./chunk-SLLZJ5EC.js";
15
15
  import {
16
16
  getAgentDir,
17
17
  readStatus,
18
18
  validatePermissionConfig,
19
19
  writePrivateAtomicJson
20
- } from "./chunk-4MVDMA5C.js";
20
+ } from "./chunk-GHJ6BH5U.js";
21
21
  import {
22
22
  FLEET_KEYBINDING_ACTIONS,
23
23
  RUNNER_LAUNCHER_NAME_PATTERN,
@@ -6561,6 +6561,9 @@ var REX_EXIT_UNREACHABLE = 4;
6561
6561
  function isRexLocalMachine(machine) {
6562
6562
  return machine?.provider === "rex" && !("target" in machine);
6563
6563
  }
6564
+ function editsLocalDisk(machine) {
6565
+ return machine !== void 0 && !("target" in machine);
6566
+ }
6564
6567
  var REX_BUNDLE_BIN = "Library/Application Support/com.superlogical.rex/RexServer/Versions/Current/Rex Server.app/Contents/MacOS/rex";
6565
6568
  var REX_CALL_TIMEOUT_MS = 15e3;
6566
6569
  var REX_MAX_OUTPUT = 1024 * 1024;
@@ -6604,9 +6607,12 @@ function resolveRexLocalPlacement(input) {
6604
6607
  if (result.status === REX_EXIT_UNREACHABLE) throw new Error("Machine 'local' needs the Rex server, but it is unreachable.");
6605
6608
  if (result.status !== 0) throw new Error(`rex session inspect exited with code ${result.status}: ${(result.stderr || result.stdout).trim().slice(0, 512)}`);
6606
6609
  if (!sessionConfirmed(result.stdout, session)) throw new Error(`The Rex server did not confirm session ${session}.`);
6607
- const stepCwd = input.stepCwd?.trim();
6608
- const home = stepCwd === "~" || stepCwd?.startsWith("~/") ? path12.join(os4.homedir(), stepCwd.slice(1)) : void 0;
6609
- const requested = home ?? (stepCwd ? path12.resolve(input.cwd, stepCwd) : input.cwd);
6610
+ return { provider: "rex", id: REX_LOCAL_MACHINE, session, cwd: resolveLocalLaunchCwd(input.cwd, input.stepCwd), ...server ? { server } : {} };
6611
+ }
6612
+ function resolveLocalLaunchCwd(parentCwd, stepCwd) {
6613
+ const step = stepCwd?.trim();
6614
+ const home = step === "~" || step?.startsWith("~/") ? path12.join(os4.homedir(), step.slice(1)) : void 0;
6615
+ const requested = home ?? (step ? path12.resolve(parentCwd, step) : parentCwd);
6610
6616
  let cwd;
6611
6617
  try {
6612
6618
  cwd = fs12.realpathSync(requested);
@@ -6614,9 +6620,7 @@ function resolveRexLocalPlacement(input) {
6614
6620
  throw new Error(`Machine 'local' cwd does not exist: ${requested}.`, { cause: error });
6615
6621
  }
6616
6622
  if (!fs12.statSync(cwd).isDirectory()) throw new Error(`Machine 'local' cwd is not a directory: ${requested}.`);
6617
- const machine = { provider: "rex", id: REX_LOCAL_MACHINE, session, cwd };
6618
- if (server) machine.server = server;
6619
- return machine;
6623
+ return cwd;
6620
6624
  }
6621
6625
 
6622
6626
  // src/runs/shared/single-output.ts
@@ -6701,7 +6705,7 @@ function outputPathMappingFromTask(task, savedPath) {
6701
6705
  }
6702
6706
  function injectSingleOutputInstruction(task, outputPath, capabilities, machine) {
6703
6707
  if (!outputPath) return task;
6704
- const remote = machine !== void 0 && !isRexLocalMachine(machine);
6708
+ const remote = machine !== void 0 && !editsLocalDisk(machine);
6705
6709
  const delivery = !remote && (!capabilities || hasOutputWriteCapability(capabilities.tools, capabilities.mcpDirectTools)) ? `Write your findings to exactly this path: ${outputPath}` : [
6706
6710
  "Return the complete artifact in your final response.",
6707
6711
  `The runtime will persist it to exactly this path: ${outputPath}`,
@@ -8629,6 +8633,7 @@ export {
8629
8633
  REX_EXIT_GONE,
8630
8634
  REX_EXIT_UNREACHABLE,
8631
8635
  isRexLocalMachine,
8636
+ editsLocalDisk,
8632
8637
  REX_BUNDLE_BIN,
8633
8638
  REX_CALL_TIMEOUT_MS,
8634
8639
  REX_MAX_OUTPUT,
@@ -8636,6 +8641,7 @@ export {
8636
8641
  resolveRexBinary,
8637
8642
  rexCommandEnv,
8638
8643
  resolveRexLocalPlacement,
8644
+ resolveLocalLaunchCwd,
8639
8645
  extractChildWrittenOutput,
8640
8646
  normalizeSingleOutputOverride,
8641
8647
  resolveSingleOutputPath,
@@ -7,37 +7,37 @@ import {
7
7
  safeTranscriptEvent,
8
8
  steerAsyncRun,
9
9
  steerWorkflowForegroundTarget
10
- } from "./chunk-6EUQPQY7.js";
10
+ } from "./chunk-443LPCRI.js";
11
11
  import {
12
12
  FLEET_STATUS_WIDGET_KEY,
13
13
  runningTone,
14
14
  stepTaskSummary
15
- } from "./chunk-YZPVALSQ.js";
15
+ } from "./chunk-WW6GQBBS.js";
16
16
  import {
17
17
  foregroundChildStateLabel,
18
18
  formatAsyncRunTranscript,
19
19
  stopAsyncRun
20
- } from "./chunk-RHYVKQQL.js";
20
+ } from "./chunk-7W2IQFP4.js";
21
21
  import {
22
22
  contextModeBadge,
23
23
  contextModeLabel,
24
24
  decodeUtf8Tail,
25
25
  listAsyncRuns
26
- } from "./chunk-SVIXQDIV.js";
26
+ } from "./chunk-6JD4XCA4.js";
27
27
  import {
28
28
  reportSessionWarning
29
29
  } from "./chunk-HXRB42AF.js";
30
- import "./chunk-3DT5X2QC.js";
31
- import "./chunk-W6HIYD2Z.js";
30
+ import "./chunk-SLLZJ5EC.js";
31
+ import "./chunk-A3INCQ6Z.js";
32
32
  import "./chunk-NIXWDZZV.js";
33
- import "./chunk-47ZN7NKR.js";
33
+ import "./chunk-NONHDYXE.js";
34
34
  import "./chunk-7F6RKT6W.js";
35
- import "./chunk-CTPAE36Y.js";
35
+ import "./chunk-YARY7JWU.js";
36
36
  import "./chunk-7J4ZXMY7.js";
37
37
  import {
38
38
  getArtifactPaths,
39
39
  getArtifactsDir
40
- } from "./chunk-YDZ7BZD5.js";
40
+ } from "./chunk-S77ZKDLS.js";
41
41
  import {
42
42
  snapshotExternalRuns
43
43
  } from "./chunk-UKG4V45O.js";
@@ -49,7 +49,7 @@ import {
49
49
  formatTokens,
50
50
  readStatus,
51
51
  shortenPath
52
- } from "./chunk-4MVDMA5C.js";
52
+ } from "./chunk-GHJ6BH5U.js";
53
53
  import {
54
54
  DIRS
55
55
  } from "./chunk-JEZOSEWG.js";
@@ -940,6 +940,10 @@ var SubagentFleetComponent = class {
940
940
  actionBusy = false;
941
941
  transcriptCache;
942
942
  disposed = false;
943
+ // Undefined until a TUI first focuses the overlay, so a fleet rendered outside one still draws.
944
+ hasFocus;
945
+ // The component focused when the fleet opened (the overlay's preFocus).
946
+ openedOver;
943
947
  refreshTimer;
944
948
  refreshMs;
945
949
  tui;
@@ -951,6 +955,7 @@ var SubagentFleetComponent = class {
951
955
  keybindings;
952
956
  constructor(tui, theme, state, done, options = {}) {
953
957
  this.tui = tui;
958
+ this.openedOver = tui.getFocusedComponent?.();
954
959
  this.viewport = new FleetViewport(() => this.tui.requestRender());
955
960
  this.theme = theme;
956
961
  this.markdownTheme = options.markdownTheme ?? getMarkdownTheme();
@@ -1120,6 +1125,14 @@ var SubagentFleetComponent = class {
1120
1125
  scrollDetail(delta) {
1121
1126
  this.viewport.scroll.scrollBy(delta);
1122
1127
  }
1128
+ get focused() {
1129
+ return this.hasFocus === true;
1130
+ }
1131
+ set focused(value) {
1132
+ if (value === this.hasFocus) return;
1133
+ this.hasFocus = value;
1134
+ this.tui.requestRender();
1135
+ }
1123
1136
  handleMouse(event) {
1124
1137
  if (this.steerDraft !== void 0 || this.redoGuidanceDraft !== void 0 || this.stopConfirming || this.actionBusy) {
1125
1138
  return { handled: true, render: false };
@@ -1417,6 +1430,10 @@ var SubagentFleetComponent = class {
1417
1430
  return { header: [], body: this.withActionLines(lines) };
1418
1431
  }
1419
1432
  render(width) {
1433
+ if (this.hasFocus === false && this.tui.getFocusedComponent?.() !== this.openedOver) {
1434
+ this.renderedLayout = void 0;
1435
+ return [];
1436
+ }
1420
1437
  const layout = fleetLayout(width, this.tui.terminal?.rows ?? 32, this.selected, this.snapshot.items);
1421
1438
  this.renderedLayout = layout;
1422
1439
  if (!layout) return [truncateToWidth2("Subagent fleet needs at least 36 columns. Esc closes.", width)];
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  snapshotRequiredChildExtensions
3
- } from "./chunk-CTPAE36Y.js";
3
+ } from "./chunk-YARY7JWU.js";
4
4
  import {
5
5
  THINKING_LEVELS,
6
6
  findConfiguredProjectRoot,
7
7
  getAgentDir,
8
8
  getConfigDirName,
9
9
  getProjectConfigDir
10
- } from "./chunk-4MVDMA5C.js";
10
+ } from "./chunk-GHJ6BH5U.js";
11
11
  import {
12
12
  TEMP_ROOT_DIR
13
13
  } from "./chunk-JEZOSEWG.js";
@@ -563,8 +563,8 @@ function formatUnresolvedBuiltinMcpSelectors(agentName, selectors) {
563
563
  const subject = agentName ? `Agent '${agentName}'` : "Subagent";
564
564
  return `${subject} selects MCP tools that Pi's built-in MCP does not offer: ${selectors.map((selector) => `mcp:${selector}`).join(", ")}. The server may be missing, disconnected, still connecting, or its tools hidden; check /mcp.`;
565
565
  }
566
- function extensionOnlyMcpServers(selections, host, cwd, projectTrusted) {
567
- const registered = new Set(host.getMcpServers?.().map(({ name }) => name));
566
+ function extensionOnlyMcpServers(selections, host, cwd, projectTrusted, loadedByChild) {
567
+ const registered = new Set(host.getMcpServers?.().filter(({ extensionPath }) => !loadedByChild(extensionPath)).map(({ name }) => name));
568
568
  const servers = [...new Set(selections.map(({ selector }) => selector.split("/")[0]))].filter((server) => registered.has(server));
569
569
  if (servers.length === 0) return [];
570
570
  const files = [path2.join(getAgentDir(), "mcp.json"), ...projectTrusted ? [path2.join(cwd, ".pi", "mcp.json")] : []];
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-7J4ZXMY7.js";
4
4
  import {
5
5
  getProjectSubagentsDir
6
- } from "./chunk-YDZ7BZD5.js";
6
+ } from "./chunk-S77ZKDLS.js";
7
7
  import {
8
8
  getPiSpawnCommand,
9
9
  writeAtomicJson
10
- } from "./chunk-4MVDMA5C.js";
10
+ } from "./chunk-GHJ6BH5U.js";
11
11
 
12
12
  // src/inspectors/herdr/project-panes.ts
13
13
  import * as fs from "node:fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  registerRuntimeAgent
3
- } from "./chunk-KXW62VBU.js";
3
+ } from "./chunk-KOLLMZ2X.js";
4
4
 
5
5
  // src/agents/runtime-agent-events.ts
6
6
  var RUNTIME_AGENT_REGISTER_EVENT = "pi-subagents:runtime-agent-register:v1";
@@ -8,7 +8,7 @@ import {
8
8
  validateCodeOwnedProfileRunner,
9
9
  validatePermissionRules,
10
10
  validateToolBudgetConfig
11
- } from "./chunk-4MVDMA5C.js";
11
+ } from "./chunk-GHJ6BH5U.js";
12
12
 
13
13
  // src/agents/runtime-agent-registry.ts
14
14
  var RUNTIME_AGENT_REGISTRY_KEY = "pi-subagents.runtime-agents.v1";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-7F6RKT6W.js";
4
4
  import {
5
5
  getAgentDir
6
- } from "./chunk-4MVDMA5C.js";
6
+ } from "./chunk-GHJ6BH5U.js";
7
7
 
8
8
  // src/intercom/intercom-bridge.ts
9
9
  import * as fs from "node:fs";