pi-subagents 0.89.0 → 0.89.2

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 (79) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +2 -2
  4. package/bundle/{chunk-TGABNSG5.js → chunk-2UCFLUE4.js} +64 -12
  5. package/bundle/{chunk-7W2IQFP4.js → chunk-464OJSDP.js} +4 -4
  6. package/bundle/{chunk-ETDE2VYK.js → chunk-4KQW5R6U.js} +2 -2
  7. package/bundle/{chunk-JRO2CU4D.js → chunk-5TXWZB73.js} +1 -1
  8. package/bundle/{chunk-7J4ZXMY7.js → chunk-72334PEI.js} +6 -4
  9. package/bundle/{chunk-CHEABMO2.js → chunk-76WVWEFE.js} +33 -24
  10. package/bundle/{chunk-S77ZKDLS.js → chunk-77VQEATI.js} +1 -1
  11. package/bundle/{chunk-HZDLR73C.js → chunk-AHGJSJYY.js} +4 -3
  12. package/bundle/{chunk-4ALRHKGE.js → chunk-DGLXVN3F.js} +1 -1
  13. package/bundle/{chunk-SLLZJ5EC.js → chunk-DHY5TY2Y.js} +237 -199
  14. package/bundle/{chunk-2I6YN6ET.js → chunk-DYBRIEIF.js} +8 -8
  15. package/bundle/{chunk-NQ26PJSQ.js → chunk-FF5K5HQU.js} +11 -6
  16. package/bundle/{chunk-HSHLPYCQ.js → chunk-FO2GIU5F.js} +27 -18
  17. package/bundle/{chunk-JFACGAJT.js → chunk-JEYG7CNC.js} +8 -4
  18. package/bundle/{chunk-X5ZOTDHO.js → chunk-KA4MKMYT.js} +11 -11
  19. package/bundle/{chunk-GHJ6BH5U.js → chunk-LWH7IGI3.js} +8 -0
  20. package/bundle/{chunk-AZW4HXNU.js → chunk-ME4IS3Y3.js} +99 -30
  21. package/bundle/{chunk-UQT2EQ4U.js → chunk-Q4VH72JI.js} +2 -2
  22. package/bundle/{chunk-443LPCRI.js → chunk-RHKIP45B.js} +6 -6
  23. package/bundle/{chunk-PPPAEFRA.js → chunk-ROJH7KPK.js} +2 -2
  24. package/bundle/{chunk-WW6GQBBS.js → chunk-SRCMJY4F.js} +4 -4
  25. package/bundle/{chunk-KOLLMZ2X.js → chunk-SWGB2P5J.js} +1 -1
  26. package/bundle/{chunk-ZSCIHMUI.js → chunk-TXC7WIPL.js} +3 -2
  27. package/bundle/{chunk-6JD4XCA4.js → chunk-U753SUBC.js} +14 -6
  28. package/bundle/{chunk-YX7R55CR.js → chunk-UBPAMRVL.js} +12 -12
  29. package/bundle/{chunk-A3INCQ6Z.js → chunk-UUW7P6KJ.js} +1 -1
  30. package/bundle/{chunk-EPMRDKQT.js → chunk-VEEUXJDO.js} +1 -1
  31. package/bundle/{chunk-NONHDYXE.js → chunk-YJIU5WF4.js} +1 -1
  32. package/bundle/control-channel.js +2 -2
  33. package/bundle/index.js +1 -1
  34. package/bundle/intercom-bridge.js +2 -2
  35. package/bundle/preflight.js +12 -10
  36. package/bundle/project-panes.js +4 -4
  37. package/docs/agents.md +2 -2
  38. package/docs/observability.md +3 -1
  39. package/docs/watchdog.md +3 -2
  40. package/package.json +1 -1
  41. package/src/api/preflight.d.ts +1 -0
  42. package/src/api/preflight.js +2 -1
  43. package/src/extension/herdr-pi-bridge.js +1 -1
  44. package/src/inspectors/herdr/project-panes.d.ts +2 -0
  45. package/src/inspectors/herdr/project-panes.js +7 -1
  46. package/src/inspectors/shell-command.d.ts +2 -1
  47. package/src/inspectors/shell-command.js +7 -5
  48. package/src/runs/background/active-async-capacity.js +2 -1
  49. package/src/runs/background/active-run-index.d.ts +1 -0
  50. package/src/runs/background/active-run-index.js +3 -0
  51. package/src/runs/background/async-execution.d.ts +2 -0
  52. package/src/runs/background/async-execution.js +3 -2
  53. package/src/runs/background/async-job-tracker.js +85 -9
  54. package/src/runs/background/async-status.d.ts +2 -0
  55. package/src/runs/background/async-status.js +8 -3
  56. package/src/runs/background/process-terminal.d.ts +6 -0
  57. package/src/runs/background/process-terminal.js +34 -2
  58. package/src/runs/background/run-status.js +2 -1
  59. package/src/runs/background/stale-run-reconciler.d.ts +8 -0
  60. package/src/runs/background/stale-run-reconciler.js +38 -8
  61. package/src/runs/background/workflow-terminal-proof.d.ts +0 -1
  62. package/src/runs/background/workflow-terminal-proof.js +4 -4
  63. package/src/runs/foreground/execution.js +2 -2
  64. package/src/runs/foreground/subagent-executor.d.ts +2 -0
  65. package/src/runs/foreground/subagent-executor.js +10 -1
  66. package/src/runs/shared/herdr-machine.js +3 -1
  67. package/src/runs/shared/herdr-pane-host.js +10 -2
  68. package/src/runs/shared/mcp-config-sources.d.ts +1 -0
  69. package/src/runs/shared/mcp-config-sources.js +1 -1
  70. package/src/runs/shared/mcp-direct-tool-allowlist.js +1 -0
  71. package/src/runs/shared/subagent-prompt-runtime.js +6 -5
  72. package/src/shared/types.d.ts +2 -0
  73. package/src/shared/utils.d.ts +2 -0
  74. package/src/shared/utils.js +9 -0
  75. package/src/tui/fleet-transcript.js +21 -9
  76. package/src/watchdog/runtime.d.ts +4 -0
  77. package/src/watchdog/runtime.js +50 -12
  78. package/src/watchdog/turn-delta.d.ts +2 -0
  79. package/src/watchdog/turn-delta.js +21 -0
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  isTrustedRecordedSessionFile,
3
3
  resolveSubagentRunId
4
- } from "./chunk-7W2IQFP4.js";
4
+ } from "./chunk-464OJSDP.js";
5
5
  import {
6
6
  agentStreamOptions,
7
7
  opencodeSessionHeaders,
8
8
  resolveAsyncResumeTarget
9
- } from "./chunk-6JD4XCA4.js";
9
+ } from "./chunk-U753SUBC.js";
10
10
  import {
11
11
  ownsRun
12
12
  } from "./chunk-HXRB42AF.js";
@@ -18,15 +18,15 @@ import {
18
18
  reconcileAsyncRun,
19
19
  resolveAuthorityDecision,
20
20
  resolveMissionStoreLocation
21
- } from "./chunk-SLLZJ5EC.js";
21
+ } from "./chunk-DHY5TY2Y.js";
22
22
  import {
23
23
  deliverInterruptRequest,
24
24
  queueRevivalBrief,
25
25
  requestAsyncSteer
26
- } from "./chunk-A3INCQ6Z.js";
26
+ } from "./chunk-UUW7P6KJ.js";
27
27
  import {
28
28
  formatShellCommand
29
- } from "./chunk-7J4ZXMY7.js";
29
+ } from "./chunk-72334PEI.js";
30
30
  import {
31
31
  readStatus,
32
32
  redactSecretValues,
@@ -34,7 +34,7 @@ import {
34
34
  tryLease,
35
35
  writeAtomicJson,
36
36
  writePrivateAtomicJson
37
- } from "./chunk-GHJ6BH5U.js";
37
+ } from "./chunk-LWH7IGI3.js";
38
38
  import {
39
39
  DIRS
40
40
  } from "./chunk-JEZOSEWG.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  appendAgentRefinementOverlay
3
- } from "./chunk-UQT2EQ4U.js";
3
+ } from "./chunk-Q4VH72JI.js";
4
4
  import {
5
5
  buildAgentMemoryInjection,
6
6
  buildSkillInjection
7
- } from "./chunk-GHJ6BH5U.js";
7
+ } from "./chunk-LWH7IGI3.js";
8
8
 
9
9
  // src/runs/shared/effective-system-prompt.ts
10
10
  function appendSection(prompt, section) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildWorkflowChatProgressRows
3
- } from "./chunk-7W2IQFP4.js";
3
+ } from "./chunk-464OJSDP.js";
4
4
  import {
5
5
  aggregateStepStatus,
6
6
  contextModeBadge,
@@ -22,7 +22,7 @@ import {
22
22
  projectAsyncWorkflowRows,
23
23
  projectWorkflowChecklist,
24
24
  workflowGraphStageNodes
25
- } from "./chunk-6JD4XCA4.js";
25
+ } from "./chunk-U753SUBC.js";
26
26
  import {
27
27
  isStaleExtensionContextError,
28
28
  isUnboundExtensionRuntimeError,
@@ -34,7 +34,7 @@ import {
34
34
  formatWorkflowJsonPreview,
35
35
  hostStepReportName,
36
36
  hostStepVerdictLabel
37
- } from "./chunk-SLLZJ5EC.js";
37
+ } from "./chunk-DHY5TY2Y.js";
38
38
  import {
39
39
  snapshotExternalRuns
40
40
  } from "./chunk-UKG4V45O.js";
@@ -52,7 +52,7 @@ import {
52
52
  getSingleResultOutput,
53
53
  shortenPath,
54
54
  unresolvedChildWatchdogBlockers
55
- } from "./chunk-GHJ6BH5U.js";
55
+ } from "./chunk-LWH7IGI3.js";
56
56
  import {
57
57
  MAX_WIDGET_JOBS,
58
58
  WIDGET_ANIMATION_INTERVAL_MS,
@@ -8,7 +8,7 @@ import {
8
8
  validateCodeOwnedProfileRunner,
9
9
  validatePermissionRules,
10
10
  validateToolBudgetConfig
11
- } from "./chunk-GHJ6BH5U.js";
11
+ } from "./chunk-LWH7IGI3.js";
12
12
 
13
13
  // src/agents/runtime-agent-registry.ts
14
14
  var RUNTIME_AGENT_REGISTRY_KEY = "pi-subagents.runtime-agents.v1";
@@ -5,7 +5,7 @@ import {
5
5
  getProjectConfigDir,
6
6
  resolveLocalLaunchCwd,
7
7
  resolveRexLocalPlacement
8
- } from "./chunk-GHJ6BH5U.js";
8
+ } from "./chunk-LWH7IGI3.js";
9
9
 
10
10
  // src/runs/shared/herdr-machine.ts
11
11
  import { spawnSync as spawnSync2 } from "node:child_process";
@@ -542,7 +542,8 @@ function resolveMachinePlacement(input) {
542
542
  const env = input.env ?? process.env;
543
543
  if (env.HERDR_ENV === "1" && env.HERDR_PANE_ID?.trim()) return { machine: resolveHerdrLocalPlacement({ cwd: input.cwd, stepCwd: input.stepCwd, env, herdrBin: input.herdrBin }) };
544
544
  if (env.REX_SESSION?.trim()) return { machine: resolveRexLocalPlacement({ cwd: input.cwd, stepCwd: input.stepCwd, env }) };
545
- throw new Error("Machine 'local' opens the child in a new tab of the terminal this Pi runs in, but this Pi is running in neither Herdr (HERDR_ENV=1 with HERDR_PANE_ID) nor Rex (REX_SESSION).");
545
+ const core = env.HC_TERMINAL_ID?.trim() ? " It runs in a Herdr Core terminal (HC_TERMINAL_ID), which machine 'local' does not support." : "";
546
+ throw new Error(`Machine 'local' opens the child in a new tab of the terminal this Pi runs in, but this Pi is running in neither Herdr (HERDR_ENV=1 with HERDR_PANE_ID) nor Rex (REX_SESSION).${core}`);
546
547
  }
547
548
  if (settings?.rex) return { machine: { provider: "rex", id: requested, target: settings.rex.ssh, cwd: validateRemoteCwd(remoteMachineCwd(input.stepCwd, settings.cwd, requested), requested) } };
548
549
  return resolveHerdrMachinePlacement(input);
@@ -47,10 +47,10 @@ import {
47
47
  validateModelResponseAliases,
48
48
  withWorkflowChildRunModel,
49
49
  withWorktreeTransaction
50
- } from "./chunk-SLLZJ5EC.js";
50
+ } from "./chunk-DHY5TY2Y.js";
51
51
  import {
52
52
  validateIntercomBridgeConfig
53
- } from "./chunk-NONHDYXE.js";
53
+ } from "./chunk-YJIU5WF4.js";
54
54
  import {
55
55
  stableJsonDigest
56
56
  } from "./chunk-7F6RKT6W.js";
@@ -59,7 +59,7 @@ import {
59
59
  } from "./chunk-YARY7JWU.js";
60
60
  import {
61
61
  missingForkCopyNote
62
- } from "./chunk-S77ZKDLS.js";
62
+ } from "./chunk-77VQEATI.js";
63
63
  import {
64
64
  DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
65
65
  assertWorkflowLaneKey,
@@ -72,6 +72,7 @@ import {
72
72
  intersectThinkingCeilings,
73
73
  isDynamicParallelStep,
74
74
  isParallelStep,
75
+ isStatusAccessError,
75
76
  normalizeExtensionBindings,
76
77
  normalizeWorkflowLaneMetadata,
77
78
  parseThinkingLevel,
@@ -84,7 +85,7 @@ import {
84
85
  validateToolBudgetConfig,
85
86
  waitForFileSystemRetry,
86
87
  writeAtomicJson
87
- } from "./chunk-GHJ6BH5U.js";
88
+ } from "./chunk-LWH7IGI3.js";
88
89
  import {
89
90
  DIRS,
90
91
  RUNNER_LAUNCHER_NAME_PATTERN,
@@ -2172,9 +2173,11 @@ function isolateCorruptActiveRun(asyncDir, runId, error, now) {
2172
2173
  }
2173
2174
  const markerCanBeReleased = processTerminal?.state === "observed" || markerAge !== void 0 && markerAge > DEFAULT_STALE_TERMINAL_ACTIVE_MARKER_MS;
2174
2175
  let markerAction = "active marker retained because runner liveness is unknown";
2176
+ let retained = true;
2175
2177
  if (markerCanBeReleased) {
2176
2178
  try {
2177
2179
  releaseActiveRunIndex(asyncDir);
2180
+ retained = false;
2178
2181
  markerAction = processTerminal?.state === "observed" ? "active marker released after observed process-terminal proof" : "stale active marker released";
2179
2182
  } catch (releaseError) {
2180
2183
  markerAction = `failed to release active marker: ${getErrorMessage(releaseError)}`;
@@ -2189,9 +2192,10 @@ function isolateCorruptActiveRun(asyncDir, runId, error, now) {
2189
2192
  }
2190
2193
  const signature = `${fileSignature}
2191
2194
  ${line}`;
2192
- if (reportedCorruptStatus.get(statusPath) === signature) return;
2195
+ if (reportedCorruptStatus.get(statusPath) === signature) return retained;
2193
2196
  reportedCorruptStatus.set(statusPath, signature);
2194
2197
  console.error(line);
2198
+ return retained;
2195
2199
  }
2196
2200
  function isNotFoundError(error) {
2197
2201
  return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
@@ -2424,6 +2428,9 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
2424
2428
  ...status.sessionFile ? { sessionFile: status.sessionFile } : {}
2425
2429
  };
2426
2430
  }
2431
+ function summarizeAsyncStatus(asyncDir, status) {
2432
+ return statusToSummary(asyncDir, status);
2433
+ }
2427
2434
  function sortRuns(runs) {
2428
2435
  const rank = (state) => {
2429
2436
  switch (state) {
@@ -2523,7 +2530,7 @@ function listAsyncRuns(asyncDirRoot, options = {}, observeStatus) {
2523
2530
  } catch (error) {
2524
2531
  observeStatus?.(null);
2525
2532
  if (!activeEntries.has(entry) || !isAsyncStatusIsolationError(asyncDir, error)) throw error;
2526
- isolateCorruptActiveRun(asyncDir, entry, error, options.now);
2533
+ if (isolateCorruptActiveRun(asyncDir, entry, error, options.now) && isStatusAccessError(error, asyncDir)) options.onUnreadableActiveRun?.(entry, asyncDir);
2527
2534
  continue;
2528
2535
  }
2529
2536
  if (!status) {
@@ -4228,6 +4235,7 @@ export {
4228
4235
  formatWorkflowChecklistPhase,
4229
4236
  formatWorkflowChecklistBottleneck,
4230
4237
  formatWorkflowChecklistText,
4238
+ summarizeAsyncStatus,
4231
4239
  listAsyncRuns,
4232
4240
  formatWorkflowStageLine,
4233
4241
  formatAsyncRunOutputPath,
@@ -1,32 +1,32 @@
1
1
  import {
2
2
  rewriteSubagentPrompt
3
- } from "./chunk-2I6YN6ET.js";
3
+ } from "./chunk-DYBRIEIF.js";
4
4
  import {
5
5
  package_default
6
- } from "./chunk-4ALRHKGE.js";
6
+ } from "./chunk-DGLXVN3F.js";
7
7
  import {
8
8
  WATCHDOG_DIFF_TOOL_NAME,
9
9
  captureWatchdogDiffBaseline,
10
10
  createWatchdogDiffTool
11
- } from "./chunk-TGABNSG5.js";
12
- import "./chunk-6JD4XCA4.js";
13
- import "./chunk-EPMRDKQT.js";
11
+ } from "./chunk-2UCFLUE4.js";
12
+ import "./chunk-U753SUBC.js";
13
+ import "./chunk-VEEUXJDO.js";
14
14
  import {
15
15
  MODEL_ONLY_TOOL
16
16
  } from "./chunk-HXRB42AF.js";
17
17
  import "./chunk-W2BZS6UC.js";
18
18
  import {
19
19
  appendAgentRefinementOverlay
20
- } from "./chunk-UQT2EQ4U.js";
21
- import "./chunk-SLLZJ5EC.js";
20
+ } from "./chunk-Q4VH72JI.js";
21
+ import "./chunk-DHY5TY2Y.js";
22
22
  import "./chunk-NIXWDZZV.js";
23
- import "./chunk-NONHDYXE.js";
23
+ import "./chunk-YJIU5WF4.js";
24
24
  import "./chunk-7F6RKT6W.js";
25
25
  import {
26
26
  assertNoToolModifierEntries
27
- } from "./chunk-HZDLR73C.js";
27
+ } from "./chunk-AHGJSJYY.js";
28
28
  import "./chunk-YARY7JWU.js";
29
- import "./chunk-S77ZKDLS.js";
29
+ import "./chunk-77VQEATI.js";
30
30
  import {
31
31
  HERDR_PI_MAX_ACCEPTANCE_PROMPT_BYTES,
32
32
  HERDR_PI_MAX_FRAME_BYTES,
@@ -44,7 +44,7 @@ import {
44
44
  discoverAgents,
45
45
  resolveExistingReadPaths,
46
46
  resolveSkills
47
- } from "./chunk-GHJ6BH5U.js";
47
+ } from "./chunk-LWH7IGI3.js";
48
48
  import "./chunk-JEZOSEWG.js";
49
49
  import "./chunk-YFCK7H2S.js";
50
50
  import "./chunk-QXASAHIA.js";
@@ -188,7 +188,7 @@ ${answer}` }], details };
188
188
  api.sendUserMessage(request.text ?? "");
189
189
  } else if (request.operation === "steer") api.sendUserMessage(request.text ?? "", { deliverAs: "steer" });
190
190
  else if (request.operation === "follow-up") api.sendUserMessage(request.text ?? "", { deliverAs: "followUp" });
191
- else if (request.operation === "abort") api.abort();
191
+ else if (request.operation === "abort") ctx.abort();
192
192
  else {
193
193
  const entry = request.supervisorId ? supervisor.get(request.supervisorId) : void 0;
194
194
  if (!entry) throw new Error("Unknown supervisor request.");
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  resolveWatchPath,
6
6
  writeAtomicJson
7
- } from "./chunk-GHJ6BH5U.js";
7
+ } from "./chunk-LWH7IGI3.js";
8
8
  import {
9
9
  POLL_INTERVAL_MS
10
10
  } from "./chunk-JEZOSEWG.js";
@@ -11,7 +11,7 @@ import {
11
11
  readStatus,
12
12
  writeAtomicJson,
13
13
  writePrivateAtomicJson
14
- } from "./chunk-GHJ6BH5U.js";
14
+ } from "./chunk-LWH7IGI3.js";
15
15
  import {
16
16
  ASYNC_DIR,
17
17
  INTERCOM_DETACH_REQUEST_EVENT,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-7F6RKT6W.js";
4
4
  import {
5
5
  getAgentDir
6
- } from "./chunk-GHJ6BH5U.js";
6
+ } from "./chunk-LWH7IGI3.js";
7
7
 
8
8
  // src/intercom/intercom-bridge.ts
9
9
  import * as fs from "node:fs";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  requestAsyncStop
3
- } from "./chunk-A3INCQ6Z.js";
3
+ } from "./chunk-UUW7P6KJ.js";
4
4
  import "./chunk-NIXWDZZV.js";
5
- import "./chunk-GHJ6BH5U.js";
5
+ import "./chunk-LWH7IGI3.js";
6
6
  import "./chunk-JEZOSEWG.js";
7
7
  import "./chunk-YFCK7H2S.js";
8
8
  import "./chunk-QXASAHIA.js";
package/bundle/index.js CHANGED
@@ -17,7 +17,7 @@ function readInstalledPackageVersion() {
17
17
  var loadedPackageVersion = readInstalledPackageVersion();
18
18
 
19
19
  // index.ts
20
- var registerExtension = process.env[HERDR_PI_MODE_ENV] === "1" ? (await import("./chunk-YX7R55CR.js")).default : process.env.PI_SUBAGENT_CHILD === "1" ? void 0 : (await import("./chunk-AZW4HXNU.js")).default;
20
+ var registerExtension = process.env[HERDR_PI_MODE_ENV] === "1" ? (await import("./chunk-UBPAMRVL.js")).default : process.env.PI_SUBAGENT_CHILD === "1" ? void 0 : (await import("./chunk-ME4IS3Y3.js")).default;
21
21
  function registerSubagentExtension(pi) {
22
22
  const installedVersion = readInstalledPackageVersion();
23
23
  if (installedVersion !== loadedPackageVersion) {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  resolveIntercomSessionTarget
3
- } from "./chunk-NONHDYXE.js";
3
+ } from "./chunk-YJIU5WF4.js";
4
4
  import "./chunk-7F6RKT6W.js";
5
- import "./chunk-GHJ6BH5U.js";
5
+ import "./chunk-LWH7IGI3.js";
6
6
  import "./chunk-JEZOSEWG.js";
7
7
  import "./chunk-YFCK7H2S.js";
8
8
  import "./chunk-QXASAHIA.js";
@@ -2,22 +2,23 @@ import {
2
2
  buildEffectiveSystemPrompt,
3
3
  canPreferForkFromSnapshot,
4
4
  resolveSubagentLaunchContext
5
- } from "./chunk-PPPAEFRA.js";
6
- import "./chunk-UQT2EQ4U.js";
5
+ } from "./chunk-ROJH7KPK.js";
6
+ import "./chunk-Q4VH72JI.js";
7
7
  import {
8
8
  loadConfig
9
- } from "./chunk-ETDE2VYK.js";
9
+ } from "./chunk-4KQW5R6U.js";
10
10
  import {
11
11
  nestedResultsPath,
12
12
  processTerminalCandidatePath,
13
13
  processTerminalPath,
14
- resultFilePath
15
- } from "./chunk-SLLZJ5EC.js";
14
+ resultFilePath,
15
+ unobservedRunnerExitPath
16
+ } from "./chunk-DHY5TY2Y.js";
16
17
  import {
17
18
  applyIntercomBridgeToAgent,
18
19
  resolveIntercomBridge,
19
20
  validateIntercomBridgeConfig
20
- } from "./chunk-NONHDYXE.js";
21
+ } from "./chunk-YJIU5WF4.js";
21
22
  import {
22
23
  AGENT_DEFINITION_PROJECTION_VERSION,
23
24
  resolveLaunchBinding,
@@ -26,7 +27,7 @@ import {
26
27
  import {
27
28
  applyThinkingSuffix,
28
29
  resolvePiLaunchToolPlan
29
- } from "./chunk-HZDLR73C.js";
30
+ } from "./chunk-AHGJSJYY.js";
30
31
  import {
31
32
  assertRequiredChildExtensionsAdmitted,
32
33
  resolveRequiredChildExtensions
@@ -34,7 +35,7 @@ import {
34
35
  import {
35
36
  getArtifactPaths,
36
37
  getArtifactsDir
37
- } from "./chunk-S77ZKDLS.js";
38
+ } from "./chunk-77VQEATI.js";
38
39
  import {
39
40
  assertClaudeCodeModelScope,
40
41
  assertThinkingWithinCeiling,
@@ -61,7 +62,7 @@ import {
61
62
  resolveSkillsWithFallback,
62
63
  resolveStepBehavior,
63
64
  unknownAgentDiagnosticContext
64
- } from "./chunk-GHJ6BH5U.js";
65
+ } from "./chunk-LWH7IGI3.js";
65
66
  import {
66
67
  DIRS,
67
68
  SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
@@ -409,7 +410,8 @@ async function resolveSubagentLaunchContract(input) {
409
410
  statusPath: path.join(lifecycleAsyncDir, "status.json"),
410
411
  eventsPath: path.join(lifecycleAsyncDir, "events.jsonl"),
411
412
  processTerminalPath: processTerminalPath(lifecycleAsyncDir),
412
- processTerminalCandidatePath: processTerminalCandidatePath(lifecycleAsyncDir)
413
+ processTerminalCandidatePath: processTerminalCandidatePath(lifecycleAsyncDir),
414
+ unobservedRunnerExitPath: unobservedRunnerExitPath(lifecycleAsyncDir)
413
415
  }
414
416
  },
415
417
  protocol: {
@@ -8,10 +8,10 @@ import {
8
8
  openProjectPane,
9
9
  projectPaneBindingPath,
10
10
  readProjectPaneBinding
11
- } from "./chunk-JFACGAJT.js";
12
- import "./chunk-7J4ZXMY7.js";
13
- import "./chunk-S77ZKDLS.js";
14
- import "./chunk-GHJ6BH5U.js";
11
+ } from "./chunk-JEYG7CNC.js";
12
+ import "./chunk-72334PEI.js";
13
+ import "./chunk-77VQEATI.js";
14
+ import "./chunk-LWH7IGI3.js";
15
15
  import "./chunk-JEZOSEWG.js";
16
16
  import "./chunk-YFCK7H2S.js";
17
17
  import "./chunk-QXASAHIA.js";
package/docs/agents.md CHANGED
@@ -269,7 +269,7 @@ A custom agent file that shadows a bundled agent replaces the bundled definition
269
269
 
270
270
  Native Pi and the six code-owned Claude Code, Codex, and Cursor profiles can run on a Herdr machine (`herdr machine add <target> --label <name>`). Herdr owns each visible agent process in a fresh no-focus pane; SSH is used only as bounded transport for Herdr RPC and ownership checks. Herdr's catalog is the host allowlist; raw ssh targets are rejected.
271
271
 
272
- For a pane on this machine you don't need a saved machine: run Pi inside Herdr and use `machine: "local"`.
272
+ For a pane on this machine you don't need a saved machine: run Pi inside Herdr and use `machine: "local"`. This means the herdr terminal multiplexer; terminals of Herdr Core (`hc`, the Herdr app's terminal server) are not supported.
273
273
 
274
274
  `machine` is a top-level frontmatter key, a settings override (`subagents.agentOverrides.<agent>.machine`, project beats user, `false` clears a pin), and a launch option on the `subagent` tool, workflow `runs.run`, chain, parallel, and dynamic-fanout steps. The launch option wins. Placement survives `subagent({ action: "disable" })`, `reset`, and model profile switches.
275
275
 
@@ -575,7 +575,7 @@ How `tools` behaves:
575
575
 
576
576
  An allowlisted name does not load the extension that registers it. Load that provider through `extensions`, `subagentOnlyExtensions`, a path-like `tools` entry, or (background children only) normal Pi extension discovery. Pi's built-in `codemode` is the exception: native children register the host SDK's official factory when codemode is permitted, without enabling it in the main session. On older Pi hosts without that factory, a child that requests codemode still reports it as unavailable; a capability ceiling that denies extensions prevents its registration.
577
577
 
578
- An extension loaded in the child can also replace the tools sent to the model, as pi-fabric's code mode does when it offers only `fabric_exec`. A child with a `tools` allowlist then fails before its first model request, and the error names the allowlisted tools the request left out. Set `extensions: []` or list only the extensions the child needs, or omit `tools` to use that extension's tool surface.
578
+ An extension loaded in the child can also replace the tools sent to the model, as pi-fabric's code mode does when it offers only `fabric_exec`. A child with a `tools` allowlist then fails before its first model request, and the error names the active allowlisted tools the request left out. Set `extensions: []` or list only the extensions the child needs, or omit `tools` to use that extension's tool surface. An allowlisted tool that an extension keeps inactive, such as pi-web-access's `web_enable` loader, can be left out of a request without failing the child.
579
579
 
580
580
  Ambient extensions depend on where the child runs. Local foreground children are sessions inside the parent Pi process and never load the parent's ambient extensions; otherwise the parent would start a second copy of each ambient extension, including this one. Background children are sessions inside the detached runner process and load the ambient extensions unless the agent sets `extensions` or the capability ceiling denies extensions. Local foreground children do inherit the providers the parent's extensions registered (`pi.registerProvider`), so their models resolve without loading those extensions again. The child gets the provider but not the registering extension's session hooks, so a provider that relies on its own hooks (for example to record each session's system prompt) can fail the child's first request; the foreground error then says so. Use `async: true` or list that extension in the agent's `subagentOnlyExtensions` or `extensions`. Pane-native remote foreground children instead use the remote machine's provider discovery and configuration. Agents that need MCP tools from an ambient adapter such as pi-mcp-adapter (including `mcp:` entries the adapter resolves) must therefore run as background children (`async: true`). A foreground launch of such an agent fails with a diagnostic that says exactly that.
581
581
 
@@ -120,7 +120,7 @@ Default keys:
120
120
  - `↑`/`↓` or `j`/`k` — select a child
121
121
  - `K`/`J` (Shift+k / Shift+j) — scroll output one line
122
122
  - `PgUp`/`PgDn` — scroll output one body viewport page (structured headers stay pinned)
123
- - `x`/`Ctrl+O` — toggle tool details
123
+ - `x`/`Ctrl+O` — toggle tool details, including the full `bash` command (multiline commands show every line)
124
124
  - `r` — refresh
125
125
  - `Esc` — close
126
126
  - `Enter` — open the selected inspectable async child through the available Inspect plugin
@@ -271,6 +271,8 @@ Lifecycle artifacts include `process-terminal-candidate.json` (private runner ev
271
271
 
272
272
  A proof is `observed` only after the live parent observes the exact detached runner's `close` event and any tracked canonical-session lease is free. Children run inside the runner process, so the candidate records no separate writer processes. If the observer is unavailable, the proof is `unknown`; do not infer process exit from `endedAt`, result-file existence, PID disappearance, or lease-directory absence.
273
273
 
274
+ When a finished run's runner PID is confirmed dead and `process-terminal.json` is still `pending`, for example because the Pi that launched it has exited, a status read writes `process-terminal-unobserved.json` with an `unknown` proof (reason `observer-unavailable`). It never touches `process-terminal.json`; status readers report it only while `process-terminal.json` is still `pending` for the same runner, so a close that is observed later still wins.
275
+
274
276
  The `subagent:process-terminal` event and RPC `ping.capabilities.processTerminalProof` expose this status. Process proof is point-in-time evidence and remains separate from execution success or stopped/non-resumable state.
275
277
 
276
278
  ### Child session events
package/docs/watchdog.md CHANGED
@@ -69,8 +69,9 @@ Child watchdog findings are lifted into the parent in three ways:
69
69
 
70
70
  ## What the reviewer is given
71
71
 
72
- - **Turn delta** with changed repo paths. Over-long input keeps the first 6,000 characters and the tail.
72
+ - **Turn delta** with changed repo paths. Over-long input keeps up to the first 6,000 characters and the tail. Whenever any of the run's turn text was left out to fit (whole turns dropped, or one long turn or the delta cut), the delta starts with a note saying how much, and the reviewer is told not to report an instruction as missing when it may be in an omitted part.
73
73
  - **Current scope** (`scope.enabled`, default on): bounded real user prompts. Side questions are additive; only explicit changes supersede older requirements. Scope survives compaction within the current session.
74
+ - **Supervisor replies** (with scope, child watchdogs): paired `contact_supervisor` decision and interview requests with their non-error replies, kept outside the turn delta so a long run cannot drop them. Each entry is bounded to 3,000 characters, with a 6,000-character recent tail kept for the session like scope.
74
75
  - **`watchdog_diff`** when inside git: diff since the session-start commit, including later commits, plus untracked paths to inspect with `read`; accepts `path` and `stat:true`.
75
76
  - **`WATCHDOG.md`** standing instructions, read fresh on every review: `<project>/.pi/WATCHDOG.md` first, then `~/.pi/agent/WATCHDOG.md`, capped at 8,000 characters. Set `guidance.watchdogMd: false` to ignore them.
76
77
  - **LSP diagnostics** from `typescript-language-server`, auto-detected in `node_modules/.bin` or `PATH`; it is never installed and never run over the whole workspace. Errors become blockers, warnings concerns, and info/hints stay in status.
@@ -122,7 +123,7 @@ With this opt-in, completed `turn_end` events retain a recent actual-activity ta
122
123
 
123
124
  New unreviewed activity permits at most one additional boundary review per user prompt even with no local edit. Side questions keep earlier authorized task evidence available; they do not themselves trigger a model call. Activity gathered after that prompt's extra review remains available for the next prompt. Warning continuations cannot supply fresh triggering activity. No polling, task scheduling, cross-worktree scans or idle calls are added.
124
125
 
125
- **Visibility limit:** external task/gate completions are visible when returned through those parent tool results. Standalone native completion notifications, arbitrary custom messages, direct shell/CI output, and events not delivered to the parent through these contracts are not ingested by this activity tail. Existing scope retains at most eight prompts (2,000 characters each); new streaming user input cancels an active review but is not added to scope unless `before_agent_start` fires. Reminders depend on retained evidence and model judgment, not an exhaustive view of running work.
126
+ **Visibility limit:** external task/gate completions are visible when returned through those parent tool results. Standalone native completion notifications, arbitrary custom messages, direct shell/CI output, and events not delivered to the parent through these contracts are not ingested by this activity tail. Existing scope retains at most eight prompts (2,000 characters each); new streaming user input cancels an active review and is added to scope. Reminders depend on retained evidence and model judgment, not an exhaustive view of running work.
126
127
 
127
128
  Set `subagents.watchdog.clarification: true` in Pi settings alongside `enabled: true`. It defaults to `false` and applies **only to the main watchdog**, not child watchdogs or child permission arbitration.
128
129
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "pi-subagents",
4
- "version": "0.89.0",
4
+ "version": "0.89.2",
5
5
  "description": "Pi extension for single-agent delegation and scripted multi-agent workflows",
6
6
  "author": "Nico Bailon",
7
7
  "license": "MIT",
@@ -141,6 +141,7 @@ export interface SubagentLaunchContractRoots {
141
141
  eventsPath: string;
142
142
  processTerminalPath: string;
143
143
  processTerminalCandidatePath: string;
144
+ unobservedRunnerExitPath: string;
144
145
  };
145
146
  }
146
147
  export interface SubagentLaunchContract {
@@ -22,7 +22,7 @@ import { loadConfig } from "../extension/config.js";
22
22
  import { applyIntercomBridgeToAgent, resolveIntercomBridge, validateIntercomBridgeConfig } from "../intercom/intercom-bridge.js";
23
23
  import { AGENT_DEFINITION_PROJECTION_VERSION, resolveLaunchBinding, stableJsonDigest } from "../shared/launch-contract.js";
24
24
  import { DIRS, TEMP_ROOT_DIR } from "../shared/types.js";
25
- import { processTerminalCandidatePath, processTerminalPath } from "../runs/background/process-terminal.js";
25
+ import { processTerminalCandidatePath, processTerminalPath, unobservedRunnerExitPath } from "../runs/background/process-terminal.js";
26
26
  import { resultFilePath } from "../runs/background/result-files.js";
27
27
  import { nestedResultsPath } from "../runs/shared/nested-events.js";
28
28
  import { normalizeExtensionBindings } from "../runs/shared/extension-bindings.js";
@@ -398,6 +398,7 @@ export async function resolveSubagentLaunchContract(input) {
398
398
  eventsPath: path.join(lifecycleAsyncDir, "events.jsonl"),
399
399
  processTerminalPath: processTerminalPath(lifecycleAsyncDir),
400
400
  processTerminalCandidatePath: processTerminalCandidatePath(lifecycleAsyncDir),
401
+ unobservedRunnerExitPath: unobservedRunnerExitPath(lifecycleAsyncDir),
401
402
  },
402
403
  },
403
404
  protocol: {
@@ -171,7 +171,7 @@ export default function registerHerdrPiBridge(pi) {
171
171
  else if (request.operation === "follow-up")
172
172
  api.sendUserMessage(request.text ?? "", { deliverAs: "followUp" });
173
173
  else if (request.operation === "abort")
174
- api.abort();
174
+ ctx.abort();
175
175
  else {
176
176
  const entry = request.supervisorId ? supervisor.get(request.supervisorId) : undefined;
177
177
  if (!entry)
@@ -1,6 +1,7 @@
1
1
  import type { AgentToolResult } from "@earendil-works/pi-agent-core";
2
2
  import type { Details, SubagentState } from "../../shared/types.ts";
3
3
  import { type HerdrClient, type HerdrErrorCode } from "./client.ts";
4
+ import { type ShellFlavor } from "../shell-command.ts";
4
5
  export declare const HERDR_PROJECT_PANE_ACTIONS: readonly ["project.open", "project.status", "project.close"];
5
6
  export type HerdrProjectPaneAction = typeof HERDR_PROJECT_PANE_ACTIONS[number];
6
7
  /** Versioned public contract exported through `pi-subagents/project-panes`. */
@@ -127,6 +128,7 @@ export declare function readHerdrProjectPaneBinding(projectRoot: string): HerdrP
127
128
  /** Strict public reader for extension integrations. */
128
129
  export declare function readProjectPaneBinding(projectRoot: string): ProjectPaneResult<HerdrProjectPaneBinding | undefined>;
129
130
  export declare function restoreHerdrProjectPaneSnapshots(state: SubagentState, projectRoots: Iterable<string>, now?: number): void;
131
+ export declare function projectPaneShellFlavor(platform: NodeJS.Platform, shell: string | undefined): ShellFlavor;
130
132
  export declare function createProjectPaneManager(options?: ProjectPaneManagerOptions): ProjectPaneManager;
131
133
  export declare function openProjectPane(options: OpenProjectPaneOptions): Promise<ProjectPaneResult<OpenProjectPaneData>>;
132
134
  export declare function getProjectPaneStatus(options: GetProjectPaneStatusOptions): Promise<ProjectPaneResult<ProjectPaneStatusData>>;
@@ -254,10 +254,16 @@ async function inspectPane(client, paneId, signal) {
254
254
  return projectPaneError("INVALID_PANE_RESPONSE", `Herdr pane get returned no pane runtime for '${paneId}'.`, { details: live.data });
255
255
  return { ok: true, data: runtime };
256
256
  }
257
+ export function projectPaneShellFlavor(platform, shell) {
258
+ // Herdr types the command into the pane's own shell: Git Bash on Windows cannot parse PowerShell's `&` call operator.
259
+ if (platform !== "win32")
260
+ return "auto";
261
+ return /(^|[\\/])(bash|zsh|sh|dash|ksh)(\.exe)?$/i.test(shell ?? "") ? "posix" : "auto";
262
+ }
257
263
  function projectPaneCommand(message) {
258
264
  const args = message?.trim() ? [message.trim()] : [];
259
265
  const command = getPiSpawnCommand(args);
260
- return formatShellCommand(command.command, command.args);
266
+ return formatShellCommand(command.command, command.args, process.platform, projectPaneShellFlavor(process.platform, process.env.SHELL));
261
267
  }
262
268
  function canonicalRuntimePath(value) {
263
269
  if (!value)
@@ -1 +1,2 @@
1
- export declare function formatShellCommand(exe: string, args: readonly string[], platform?: NodeJS.Platform): string;
1
+ export type ShellFlavor = "auto" | "posix";
2
+ export declare function formatShellCommand(exe: string, args: readonly string[], platform?: NodeJS.Platform, flavor?: ShellFlavor): string;
@@ -6,11 +6,13 @@ function shellQuote(value, platform) {
6
6
  function isBareExecutable(value) {
7
7
  return /^[\w./@:-]+$/.test(value);
8
8
  }
9
- export function formatShellCommand(exe, args, platform = process.platform) {
10
- const quotedArgs = args.map((arg) => shellQuote(arg, platform));
11
- if (platform === "win32")
12
- return `& ${[shellQuote(exe, platform), ...quotedArgs].join(" ")}`;
9
+ export function formatShellCommand(exe, args, platform = process.platform, flavor = "auto") {
10
+ const posix = flavor === "posix" || (flavor === "auto" && platform !== "win32");
11
+ const quotePlatform = posix ? "linux" : platform;
12
+ const quotedArgs = args.map((arg) => shellQuote(arg, quotePlatform));
13
+ if (!posix)
14
+ return `& ${[shellQuote(exe, quotePlatform), ...quotedArgs].join(" ")}`;
13
15
  // Nushell treats a leading quoted token as a string, so use a bare invoker for paths that need quoting.
14
- const invocation = isBareExecutable(exe) ? exe : `sh -c 'exec "$0" "$@"' ${shellQuote(exe, platform)}`;
16
+ const invocation = isBareExecutable(exe) ? exe : `sh -c 'exec "$0" "$@"' ${shellQuote(exe, quotePlatform)}`;
15
17
  return [invocation, ...quotedArgs].join(" ");
16
18
  }
@@ -8,7 +8,8 @@ import { checkPidLiveness, checkRecordedPidLiveness } from "./stale-run-reconcil
8
8
  import { currentBootId } from "./boot-id.js";
9
9
  import { currentPidNamespaceScope } from "./pid-namespace.js";
10
10
  import { readProcessTerminal } from "./process-terminal.js";
11
- import { isTerminalAsyncState as terminalState, readWorkflowChildEvidence, readWorkflowChildProcessEvidence } from "./workflow-terminal-proof.js";
11
+ import { readWorkflowChildEvidence, readWorkflowChildProcessEvidence } from "./workflow-terminal-proof.js";
12
+ import { isTerminalAsyncState as terminalState } from "./active-run-index.js";
12
13
  export const ACTIVE_ASYNC_CAPACITY_DIR = path.join(TEMP_ROOT_DIR, "session-active-async-capacity");
13
14
  export const DEFAULT_ABANDONED_SLOT_RELEASE_AFTER_MS = 20 * 60 * 1000;
14
15
  export const MIN_ABANDONED_SLOT_RELEASE_AFTER_MS = 5 * 60 * 1000;
@@ -2,6 +2,7 @@ import type { AsyncStatus } from "../../shared/types.ts";
2
2
  export declare const ACTIVE_RUN_INDEX_DIR = ".active-runs";
3
3
  export declare const DEFAULT_STALE_TERMINAL_ACTIVE_MARKER_MS: number;
4
4
  export declare function isActiveAsyncState(state: AsyncStatus["state"]): boolean;
5
+ export declare function isTerminalAsyncState(state: AsyncStatus["state"]): state is Exclude<AsyncStatus["state"], "queued" | "running" | "paused">;
5
6
  export declare function releaseActiveRunIndex(asyncDir: string): void;
6
7
  export declare function updateActiveRunIndex(asyncDir: string, state: AsyncStatus["state"], toolCallId?: string, options?: {
7
8
  retryCapacityErrors?: boolean;
@@ -34,6 +34,9 @@ function removeEmptyAncestors(start, stop) {
34
34
  export function isActiveAsyncState(state) {
35
35
  return state === "queued" || state === "running";
36
36
  }
37
+ export function isTerminalAsyncState(state) {
38
+ return state !== "queued" && state !== "running" && state !== "paused";
39
+ }
37
40
  function releaseToolCallAliases(asyncDir) {
38
41
  const root = path.join(indexDir(path.dirname(asyncDir)), TOOL_CALL_INDEX_DIR);
39
42
  let entries;
@@ -195,6 +195,8 @@ interface AsyncSingleParams {
195
195
  runFanoutBudget?: RunFanoutBudgetDescriptor;
196
196
  parentWorkflowRunId?: string;
197
197
  workflowKey?: string;
198
+ /** Workflow child label; names the child session and its status step. */
199
+ label?: string;
198
200
  lane?: WorkflowLaneMetadata;
199
201
  workflowAwaitAsync?: boolean;
200
202
  activeAsyncCapacity?: ActiveAsyncCapacityHandle;