pi-subagents 0.89.1 → 0.90.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 (103) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/bundle/agents.js +4 -4
  3. package/bundle/child-tool-plan.js +3 -3
  4. package/bundle/{chunk-SG3NCWZW.js → chunk-2LEBXCLU.js} +29 -19
  5. package/bundle/{chunk-UUW7P6KJ.js → chunk-37EJGDYO.js} +2 -2
  6. package/bundle/{chunk-IGZTXGPG.js → chunk-4DA22WRU.js} +59 -30
  7. package/bundle/{chunk-77VQEATI.js → chunk-5J2RTMKW.js} +2 -2
  8. package/bundle/{chunk-7J4ZXMY7.js → chunk-72334PEI.js} +6 -4
  9. package/bundle/{chunk-F6PTAPQ3.js → chunk-7HPZIT4W.js} +13 -13
  10. package/bundle/{chunk-SWGB2P5J.js → chunk-7Y4IJMCW.js} +1 -1
  11. package/bundle/{chunk-TRN65L4F.js → chunk-ACTHBJUI.js} +1 -1
  12. package/bundle/{chunk-6D54VW3E.js → chunk-AJWRYQPH.js} +145 -76
  13. package/bundle/{chunk-TXC7WIPL.js → chunk-C45WQQZX.js} +1 -1
  14. package/bundle/{chunk-YJIU5WF4.js → chunk-CPWZN5KM.js} +1 -1
  15. package/bundle/{chunk-BERAWSQQ.js → chunk-DNJ2GHSI.js} +7 -7
  16. package/bundle/{chunk-CASL47ST.js → chunk-EBGTTJKP.js} +6 -6
  17. package/bundle/{chunk-LWH7IGI3.js → chunk-F4NSLXB2.js} +8 -6
  18. package/bundle/{chunk-URKQZHVH.js → chunk-G43SW4BT.js} +29 -19
  19. package/bundle/{chunk-Q4VH72JI.js → chunk-KNVQTRSY.js} +2 -2
  20. package/bundle/{chunk-5TXWZB73.js → chunk-P2M6RIVX.js} +1 -1
  21. package/bundle/{chunk-ROJH7KPK.js → chunk-PSB3VLMH.js} +2 -2
  22. package/bundle/{chunk-VEEUXJDO.js → chunk-PTN7XAXI.js} +2 -2
  23. package/bundle/{chunk-TDXVQPZW.js → chunk-RIBMW6V3.js} +69 -15
  24. package/bundle/{chunk-KCDPTXHT.js → chunk-SIB2GQHL.js} +238 -200
  25. package/bundle/{chunk-JEZOSEWG.js → chunk-SRWJIAIP.js} +2 -0
  26. package/bundle/{chunk-OUM6SEVD.js → chunk-UC22RDXP.js} +8 -4
  27. package/bundle/{chunk-W2BZS6UC.js → chunk-VMJGZHUL.js} +9 -5
  28. package/bundle/{chunk-MIX3MCIF.js → chunk-WANQBKAZ.js} +12 -7
  29. package/bundle/{chunk-LUNVS6KP.js → chunk-WHHRG32M.js} +27 -20
  30. package/bundle/{chunk-C22YEYFZ.js → chunk-XIQKWTFY.js} +5 -5
  31. package/bundle/{chunk-YLU5JFW2.js → chunk-XYIVVS3A.js} +7 -3
  32. package/bundle/{chunk-R3NH5XAL.js → chunk-YVDKGAEO.js} +5 -4
  33. package/bundle/{chunk-4FFKVLBG.js → chunk-ZWGOHOGI.js} +5 -5
  34. package/bundle/control-channel.js +3 -3
  35. package/bundle/index.js +1 -1
  36. package/bundle/intercom-bridge.js +3 -3
  37. package/bundle/preflight.js +13 -11
  38. package/bundle/project-panes.js +5 -5
  39. package/bundle/shared-types.js +1 -1
  40. package/bundle/workflow-resources.js +1 -1
  41. package/docs/configuration.md +12 -3
  42. package/docs/models.md +1 -1
  43. package/docs/observability.md +10 -2
  44. package/docs/tool-reference.md +5 -2
  45. package/docs/watchdog.md +3 -2
  46. package/docs/workflows.md +1 -1
  47. package/package.json +1 -1
  48. package/skills/pi-subagents/SKILL.md +1 -1
  49. package/src/agents/agents.d.ts +2 -0
  50. package/src/agents/agents.js +4 -0
  51. package/src/api/preflight.d.ts +1 -0
  52. package/src/api/preflight.js +2 -1
  53. package/src/extension/config.js +3 -0
  54. package/src/extension/public-execution.js +4 -2
  55. package/src/extension/reply-workflow-script.js +10 -1
  56. package/src/extension/schemas.d.ts +1 -0
  57. package/src/extension/schemas.js +2 -0
  58. package/src/extension/subagent-options.d.ts +2 -0
  59. package/src/extension/subagent-options.js +10 -4
  60. package/src/inspectors/herdr/project-panes.d.ts +2 -0
  61. package/src/inspectors/herdr/project-panes.js +7 -1
  62. package/src/inspectors/shell-command.d.ts +2 -1
  63. package/src/inspectors/shell-command.js +7 -5
  64. package/src/runs/background/active-async-capacity.js +2 -1
  65. package/src/runs/background/active-run-index.d.ts +1 -0
  66. package/src/runs/background/active-run-index.js +3 -0
  67. package/src/runs/background/async-execution.d.ts +2 -0
  68. package/src/runs/background/async-execution.js +6 -3
  69. package/src/runs/background/async-retention.js +48 -12
  70. package/src/runs/background/async-status.js +32 -17
  71. package/src/runs/background/process-terminal.d.ts +6 -0
  72. package/src/runs/background/process-terminal.js +34 -2
  73. package/src/runs/background/retained-children.js +1 -1
  74. package/src/runs/background/run-status.js +2 -1
  75. package/src/runs/background/stale-run-reconciler.d.ts +8 -0
  76. package/src/runs/background/stale-run-reconciler.js +38 -8
  77. package/src/runs/background/workflow-terminal-proof.d.ts +0 -1
  78. package/src/runs/background/workflow-terminal-proof.js +4 -4
  79. package/src/runs/foreground/execution.js +7 -9
  80. package/src/runs/foreground/subagent-executor.d.ts +2 -0
  81. package/src/runs/foreground/subagent-executor.js +129 -45
  82. package/src/runs/shared/fast-mode-extension.d.ts +2 -1
  83. package/src/runs/shared/fast-mode-extension.js +5 -3
  84. package/src/runs/shared/herdr-pane-host.js +10 -2
  85. package/src/runs/shared/mcp-config-sources.d.ts +1 -0
  86. package/src/runs/shared/mcp-config-sources.js +1 -1
  87. package/src/runs/shared/mcp-direct-tool-allowlist.js +1 -0
  88. package/src/shared/capacity-resilient-json.d.ts +7 -3
  89. package/src/shared/capacity-resilient-json.js +8 -6
  90. package/src/shared/disabled-features.d.ts +4 -0
  91. package/src/shared/disabled-features.js +1 -0
  92. package/src/shared/types.d.ts +19 -0
  93. package/src/shared/types.js +2 -0
  94. package/src/tui/fleet-transcript.js +21 -9
  95. package/src/tui/fleet.js +1 -0
  96. package/src/watchdog/runtime.d.ts +4 -0
  97. package/src/watchdog/runtime.js +50 -12
  98. package/src/watchdog/turn-delta.d.ts +2 -0
  99. package/src/watchdog/turn-delta.js +21 -0
  100. package/src/workflows/structured-workflow-scripts.js +6 -4
  101. package/src/workflows/workflow-resources.js +4 -2
  102. package/src/workflows/workflow-revival.d.ts +6 -0
  103. package/src/workflows/workflow-revival.js +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,54 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.90.0] - 2026-11-22
6
+
7
+ ### Highlights
8
+
9
+ - Give a subagent a short `label` and it shows up by that name in its session, its status row and the events host apps receive, so several runs of the same agent are easy to tell apart.
10
+ - A `parallel` workflow can run its tasks one at a time with `globalConcurrencyLimit: 1`.
11
+ - Finished workflows are now cleaned up from disk like other background runs, instead of piling up to tens of gigabytes.
12
+ - On Windows, a locked status file at the end of a workflow no longer crashes Pi.
13
+ - An install can turn off session sharing with `disabledFeatures: ["session-sharing"]`, so no run can upload a session to a GitHub Gist.
14
+
15
+ ### Added
16
+
17
+ - A direct subagent launch can now be named with a short top-level `label`, for example `subagent({ agent: "worker", task: "…", label: "Fix login redirect" })`, and so can each `args.tasks` item of `workflow: "parallel"`. The label names the child's session and status row, as a workflow child's `runs.run` label already does, and `subagent:async-started` carries it as `description`, so hosts that list running children can tell several runs of the same agent apart. Thanks to [@mmarabel](https://github.com/mmarabel) for the report (#3324).
18
+ - A foreground subagent run now emits `task:subagent:lifecycle` (`started`, then `completed`, `failed` or `aborted`) on Pi's extension event bus, so host apps that only watch `subagent:async-*` can show foreground runs. The payload carries the run id, agent name and a description (the launch's `label`, or else the agent's description), never the task prompt. `subagent:async-started` for single, chain and parallel runs now carries `description` by the same rule. Thanks to [@Andy123qq4](https://github.com/Andy123qq4) for #3318.
19
+ - A named workflow call such as `{ workflow: "parallel", args: { tasks: [...] } }` now accepts a top-level `globalConcurrencyLimit`, so `globalConcurrencyLimit: 1` runs its tasks one at a time; before, the call was refused. When `args.concurrency` is passed to `parallel`, the error now points to `globalConcurrencyLimit`. Thanks to [@mmarabel](https://github.com/mmarabel) for #3320.
20
+ - `disabledFeatures: ["session-sharing"]` now removes `share` from the `subagent` tool, so a run cannot upload a session to a GitHub Gist from that install. A resume whose saved launch enabled `share` is refused before it starts, and the run stays resumable once the setting is gone. Nothing changes when the setting is absent. Before, the only ways to stop the upload were to remove `gh` from `PATH`, revoke the `gist` OAuth scope, or block network access. Thanks to [@jpodivin](https://github.com/jpodivin) for #3323 and to [@marcfargas](https://github.com/marcfargas) for the report (#30).
21
+ - A new `fastServiceTier` setting chooses the OpenAI service tier that `fast: true` requests for native OpenAI-Codex children: `"priority"` (the default, as before) or `"ultrafast"`. Before, fast mode could only request Priority. Thanks to [@FireSpoonYZ](https://github.com/FireSpoonYZ) for #3317.
22
+
23
+ ### Fixed
24
+
25
+ - Finished workflows and their subagents are now deleted from disk like other background runs. Before, async retention kept every workflow run, workflow child and revived child forever, so `async-subagent-runs` could grow to tens of gigabytes. A workflow is now removed with its children once it has finished and passed the 30-day window; it is still kept while it, any of its children, or a revival of one is running, recent or still resumable. Thanks to [@youlikemodernart](https://github.com/youlikemodernart) for the report (#3326).
26
+ - On Windows, an async workflow whose last writes to `status.json` failed with `EPERM` no longer crashes Pi. When another process held the file locked, the error escaped the workflow's teardown and took the whole process down. The failure is now recorded as a `subagent.workflow.status_write_failed` event, the workflow's result is still delivered, and `status.json` catches up with the finished state once the lock clears (Pi keeps retrying for up to a minute without blocking). Thanks to [@M0-3del](https://github.com/M0-3del) for the report (#3325).
27
+ - A background subagent that launches its own nested subagents now shows them in the Fleet status widget, `subagent({ action: "status" })` and its completion result. Before, the nested children were filed under the wrong run id, so status never found them. Thanks to [@dvishoot](https://github.com/dvishoot) for #3316.
28
+ - A `subagent` call with `workflow: true` and `options.script` now runs the script, as `options.script` alone does, instead of failing with `options.script replaces workflow`. A named workflow or a script path together with `options.script` is still refused. Thanks to [@mmarabel](https://github.com/mmarabel) for the report (#3320).
29
+ - A foreground subagent's result in the tool details (`details.results[i]`) no longer carries hidden Symbol keys, so extensions that hash or compare tool results, such as pi-fold, see a plain JSON object. Thanks to [@xiaquwan1001](https://github.com/xiaquwan1001) for the report (#3319).
30
+ - pi-subagents now type-checks against Pi 1.6, whose components return read-only render output, without changing its dependency pins. Thanks to [@Giesch](https://github.com/Giesch) for #3322.
31
+ - The tool reference warns again that a secret Gist is unlisted, not private, and that nothing asks before the upload, and says how to turn sharing off. The warning was lost when the README was split into guides (#30).
32
+
33
+ ## [0.89.2] - 2026-11-20
34
+
35
+ ### Highlights
36
+
37
+ - Subagents in a Herdr pane (`machine: "local"`) no longer fail to start, and Herdr project panes on Windows now work in Git Bash.
38
+ - In `/subagents-fleet`, expanded tool details show a `bash` call's whole command, including multiline scripts.
39
+ - A workflow child with a `label` is named by that label in its session name, terminal title and Fleet row.
40
+ - The child watchdog no longer tells you to undo work the supervisor approved.
41
+ - Subagents can use MCP servers configured with `"openUi": false`.
42
+
43
+ ### Fixed
44
+
45
+ - A subagent placed in a Herdr pane (`machine: "local"`) no longer fails to start with `is not an active named agent`. Herdr holds a newly started agent as pending until something asks for its state, so retrying the first prompt alone never got through. pi-subagents now waits for the agent to be ready before it prompts again. Thanks to [@TheEdgeOfRage](https://github.com/TheEdgeOfRage) for #3312.
46
+ - On Windows, a Herdr project pane now starts Pi when the pane runs Git Bash or another POSIX shell. The launch command was always written for PowerShell, so a Git Bash pane failed with `syntax error near unexpected token '&'` and never started. Thanks to [@mystery4f](https://github.com/mystery4f) for #3306.
47
+ - In `/subagents-fleet`, expanding tool details (`x` or `Ctrl+O`) now shows a `bash` call's whole command, every line wrapped to the pane, while it runs and after it finishes. Before, a multiline script such as a heredoc was cut to one line. When the saved arguments were too large to keep in full, the expanded view shows what was saved and says it was truncated. Thanks to [@power22c](https://github.com/power22c) for the report (#3308).
48
+ - A subagent started from a workflow script with a short `label` (for example `runs.run("tests", { label: "Validate sanitizer tests", agent: "worker", task: "…" })`) is now named by that label: its session name and Pi terminal title read `worker: Validate sanitizer tests`, and its Fleet row reads `Validate sanitizer tests (worker)`. Before, only the workflow's own row used the label, and the subagent was named after the first words of its task, so several children of the same agent were hard to tell apart. Thanks to [@power22c](https://github.com/power22c) for the report (#3309).
49
+ - The child watchdog no longer warns that a change the supervisor approved was unauthorised. When a subagent asks its supervisor a question and follows the answer, the watchdog now always sees that question and answer, even in a long run whose earlier turns no longer fit in its review. Before, the answer could drop out, and the watchdog reported the instruction as missing and suggested undoing correct work. The watchdog is also told when earlier turns were left out, so it doesn't treat missing evidence as proof. Thanks to [@mannainsect](https://github.com/mannainsect) for the report (#3307).
50
+ - A subagent that lists `mcp:<server>` in its `tools` now starts when that server's MCP config sets `"openUi": false`. Before, it failed with `Unresolved MCP direct-tool selectors` even though the server was connected, because pi-mcp-adapter 7 counts that setting when it checks its cached tool list and pi-subagents did not (#3310). Thanks to [@carlesba](https://github.com/carlesba) for #3311.
51
+ - A workflow no longer waits forever when one of its background subagents finishes after the Pi that started it has exited, for example because Pi was restarted. Once the subagent's process is confirmed gone, the workflow treats it as finished. Thanks to [@tdslot](https://github.com/tdslot) for the report (#3304).
52
+
5
53
  ## [0.89.1] - 2026-11-18
6
54
 
7
55
  ### Highlights
package/bundle/agents.js CHANGED
@@ -2,12 +2,12 @@ import {
2
2
  RUNTIME_AGENT_REGISTER_EVENT,
3
3
  RUNTIME_AGENT_REGISTER_VERSION,
4
4
  registerAgentViaEvents
5
- } from "./chunk-5TXWZB73.js";
5
+ } from "./chunk-P2M6RIVX.js";
6
6
  import {
7
7
  registerRuntimeAgent
8
- } from "./chunk-SWGB2P5J.js";
9
- import "./chunk-LWH7IGI3.js";
10
- import "./chunk-JEZOSEWG.js";
8
+ } from "./chunk-7Y4IJMCW.js";
9
+ import "./chunk-F4NSLXB2.js";
10
+ import "./chunk-SRWJIAIP.js";
11
11
  import "./chunk-YFCK7H2S.js";
12
12
  import "./chunk-QXASAHIA.js";
13
13
  export {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  resolvePiLaunchToolPlan
3
- } from "./chunk-R3NH5XAL.js";
3
+ } from "./chunk-YVDKGAEO.js";
4
4
  import "./chunk-YARY7JWU.js";
5
- import "./chunk-LWH7IGI3.js";
6
- import "./chunk-JEZOSEWG.js";
5
+ import "./chunk-F4NSLXB2.js";
6
+ import "./chunk-SRWJIAIP.js";
7
7
  import "./chunk-YFCK7H2S.js";
8
8
  import "./chunk-QXASAHIA.js";
9
9
  export {
@@ -47,10 +47,10 @@ import {
47
47
  validateModelResponseAliases,
48
48
  withWorkflowChildRunModel,
49
49
  withWorktreeTransaction
50
- } from "./chunk-KCDPTXHT.js";
50
+ } from "./chunk-SIB2GQHL.js";
51
51
  import {
52
52
  validateIntercomBridgeConfig
53
- } from "./chunk-YJIU5WF4.js";
53
+ } from "./chunk-CPWZN5KM.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-77VQEATI.js";
62
+ } from "./chunk-5J2RTMKW.js";
63
63
  import {
64
64
  DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
65
65
  assertWorkflowLaneKey,
@@ -85,12 +85,12 @@ import {
85
85
  validateToolBudgetConfig,
86
86
  waitForFileSystemRetry,
87
87
  writeAtomicJson
88
- } from "./chunk-LWH7IGI3.js";
88
+ } from "./chunk-F4NSLXB2.js";
89
89
  import {
90
90
  DIRS,
91
91
  RUNNER_LAUNCHER_NAME_PATTERN,
92
92
  TEMP_ROOT_DIR
93
- } from "./chunk-JEZOSEWG.js";
93
+ } from "./chunk-SRWJIAIP.js";
94
94
  import {
95
95
  previewDisplayText,
96
96
  sanitizeDisplayText,
@@ -2260,7 +2260,7 @@ function deriveAsyncActivityState(asyncDir, status) {
2260
2260
  lastActivityAt: status.lastActivityAt ?? outputFileMtime(outputPath) ?? currentStep?.lastActivityAt ?? (status.mode === "workflow" ? void 0 : currentStep?.startedAt ?? status.startedAt)
2261
2261
  };
2262
2262
  }
2263
- function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
2263
+ function statusToSummary(asyncDir, status, nestedWarnings = []) {
2264
2264
  const statusPath = path3.join(asyncDir, "status.json");
2265
2265
  validateAsyncStatusLaneMetadata(status, `Invalid async status '${statusPath}'`);
2266
2266
  const workflowChildren = parseWorkflowChildSummary(status.workflowChildren);
@@ -2274,7 +2274,6 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
2274
2274
  if (status.outputFile !== void 0 && typeof status.outputFile !== "string") throw new Error(`Invalid async status '${statusPath}': outputFile must be a string.`);
2275
2275
  const { activityState, lastActivityAt } = deriveAsyncActivityState(asyncDir, status);
2276
2276
  const processTerminal = readProcessTerminal(asyncDir, { runId: status.runId, runnerProcessInstanceId: status.processTerminal?.runnerProcessInstanceId }) ?? sanitizeProcessTerminal(status.processTerminal, { runId: status.runId, runnerProcessInstanceId: status.processTerminal?.runnerProcessInstanceId }, path3.join(asyncDir, "status.json"));
2277
- const nestedProjectionAllowed = nestedWarnings.length === 0;
2278
2277
  let runFanoutBudget = status.runFanoutBudget;
2279
2278
  try {
2280
2279
  const runFanoutBudgetDescriptor = readRunFanoutBudgetDescriptor(asyncDir);
@@ -2285,14 +2284,6 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
2285
2284
  const steps = status.steps ?? [];
2286
2285
  const chainStepCount = status.chainStepCount ?? steps.length;
2287
2286
  const parallelGroups = normalizeParallelGroups(status.parallelGroups, steps.length, chainStepCount);
2288
- let nestedChildren = [];
2289
- if (nestedProjectionAllowed && nestedRoute) {
2290
- try {
2291
- nestedChildren = projectNestedEvents(nestedRoute)?.children ?? [];
2292
- } catch (error) {
2293
- nestedWarnings.push(`Nested status unavailable: ${getErrorMessage(error)}`);
2294
- }
2295
- }
2296
2287
  const summarizedSteps = steps.map((step, index) => {
2297
2288
  const stepActivityState = step.activityState;
2298
2289
  const stepLastActivityAt = step.lastActivityAt;
@@ -2368,7 +2359,7 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
2368
2359
  ...step.children?.length ? { children: step.children } : {}
2369
2360
  };
2370
2361
  });
2371
- attachRootChildrenToSteps(status.runId || path3.basename(asyncDir), summarizedSteps, nestedChildren);
2362
+ attachRootChildrenToSteps(status.runId || path3.basename(asyncDir), summarizedSteps, void 0);
2372
2363
  return {
2373
2364
  id: status.runId || path3.basename(asyncDir),
2374
2365
  asyncDir,
@@ -2405,7 +2396,6 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
2405
2396
  ...hostSteps.length ? { hostSteps } : {},
2406
2397
  ...status.mode === "workflow" && status.workflowGraph ? { workflowGraph: status.workflowGraph } : {},
2407
2398
  steps: summarizedSteps,
2408
- ...nestedChildren.length ? { nestedChildren } : {},
2409
2399
  ...nestedWarnings.length ? { nestedWarnings } : {},
2410
2400
  ...processTerminal ? { processTerminal } : {},
2411
2401
  ...runFanoutBudget ? { runFanoutBudget } : {},
@@ -2431,6 +2421,21 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
2431
2421
  function summarizeAsyncStatus(asyncDir, status) {
2432
2422
  return statusToSummary(asyncDir, status);
2433
2423
  }
2424
+ function attachNestedChildren(runs, resolveRoute = (run) => findNestedRouteForRootId(run.id)) {
2425
+ for (const run of runs) {
2426
+ let nestedChildren;
2427
+ try {
2428
+ const route = resolveRoute(run);
2429
+ nestedChildren = route ? projectNestedEvents(route).children : [];
2430
+ } catch (error) {
2431
+ run.nestedWarnings = [...run.nestedWarnings ?? [], `Nested status unavailable: ${getErrorMessage(error)}`];
2432
+ continue;
2433
+ }
2434
+ if (!nestedChildren.length) continue;
2435
+ run.nestedChildren = nestedChildren;
2436
+ attachRootChildrenToSteps(run.id, run.steps, nestedChildren);
2437
+ }
2438
+ }
2434
2439
  function sortRuns(runs) {
2435
2440
  const rank = (state) => {
2436
2441
  switch (state) {
@@ -2505,6 +2510,7 @@ function listAsyncRuns(asyncDirRoot, options = {}, observeStatus) {
2505
2510
  const allowedStates = options.states ? new Set(options.states) : void 0;
2506
2511
  const runs = [];
2507
2512
  let nestedRouteIndex;
2513
+ const reconciledRoutes = /* @__PURE__ */ new Map();
2508
2514
  const resolveNestedRoute = (rootRunId) => {
2509
2515
  if (!includeNested) return void 0;
2510
2516
  if (activeEntries.has(rootRunId)) return findNestedRouteForRootId(rootRunId);
@@ -2556,11 +2562,12 @@ function listAsyncRuns(asyncDirRoot, options = {}, observeStatus) {
2556
2562
  } catch (error) {
2557
2563
  observeStatus?.(null);
2558
2564
  nestedWarnings.push(`Nested status unavailable: ${getErrorMessage(error)}`);
2565
+ nestedRoute = void 0;
2559
2566
  }
2560
2567
  }
2561
2568
  let summary;
2562
2569
  try {
2563
- summary = statusToSummary(asyncDir, status, nestedWarnings, nestedRoute);
2570
+ summary = statusToSummary(asyncDir, status, nestedWarnings);
2564
2571
  } catch (error) {
2565
2572
  observeStatus?.(null);
2566
2573
  if (!activeEntries.has(entry) || !isAsyncStatusIsolationError(asyncDir, error)) throw error;
@@ -2568,9 +2575,12 @@ function listAsyncRuns(asyncDirRoot, options = {}, observeStatus) {
2568
2575
  continue;
2569
2576
  }
2570
2577
  runs.push(summary);
2578
+ if (nestedRoute) reconciledRoutes.set(summary, nestedRoute);
2571
2579
  }
2572
2580
  const sorted = sortRuns(runs);
2573
- return options.limit !== void 0 ? sorted.slice(0, options.limit) : sorted;
2581
+ const listed = options.limit !== void 0 ? sorted.slice(0, options.limit) : sorted;
2582
+ if (includeNested) attachNestedChildren(listed, options.reconcile === false ? void 0 : (run) => reconciledRoutes.get(run));
2583
+ return listed;
2574
2584
  }
2575
2585
  function formatActivityFacts(input) {
2576
2586
  const facts = [];
@@ -4,10 +4,10 @@ import {
4
4
  import {
5
5
  resolveWatchPath,
6
6
  writeAtomicJson
7
- } from "./chunk-LWH7IGI3.js";
7
+ } from "./chunk-F4NSLXB2.js";
8
8
  import {
9
9
  POLL_INTERVAL_MS
10
- } from "./chunk-JEZOSEWG.js";
10
+ } from "./chunk-SRWJIAIP.js";
11
11
 
12
12
  // src/runs/background/control-channel.ts
13
13
  import { randomUUID } from "node:crypto";
@@ -10,12 +10,13 @@ import {
10
10
  setInlineWorkflowCoverage,
11
11
  setMainThinkingLevelSource,
12
12
  widgetRenderKey
13
- } from "./chunk-4FFKVLBG.js";
13
+ } from "./chunk-ZWGOHOGI.js";
14
14
  import {
15
15
  package_default
16
- } from "./chunk-TRN65L4F.js";
16
+ } from "./chunk-ACTHBJUI.js";
17
17
  import {
18
18
  EXTERNAL_JOB_BRIDGE_REQUEST_DIR,
19
+ REVIVAL_LINK_FILE,
19
20
  REVIVAL_ORIGIN_FILE,
20
21
  SUBAGENT_GUIDE_TOPICS,
21
22
  attachNestedChildrenToResultChildren,
@@ -47,6 +48,7 @@ import {
47
48
  parseSubagentNotifyContent,
48
49
  prepareWorkflowResume,
49
50
  preservedAgentFrontmatterFields,
51
+ projectWorkflowKeyRevival,
50
52
  readWorkflowReceipt,
51
53
  recordWorkflowResumeRefusal,
52
54
  refusalSentence,
@@ -66,7 +68,7 @@ import {
66
68
  takeCompactionAbort,
67
69
  workflowResumeClaimState,
68
70
  workflowResumeRefusal
69
- } from "./chunk-LUNVS6KP.js";
71
+ } from "./chunk-WHHRG32M.js";
70
72
  import {
71
73
  SUBAGENT_CHILD_ENV,
72
74
  SUBAGENT_PARENT_SESSION_ENV,
@@ -86,14 +88,14 @@ import {
86
88
  resolvePiSessionId,
87
89
  resolveWaitToolConfig,
88
90
  setDeclarationPinning
89
- } from "./chunk-TDXVQPZW.js";
91
+ } from "./chunk-RIBMW6V3.js";
90
92
  import {
91
93
  deliverAsyncRunStop,
92
94
  ownerConfirmedDead,
93
95
  readSessionMessagesTail,
94
96
  resolveSubagentRunId,
95
97
  restoreForegroundRunHistory
96
- } from "./chunk-C22YEYFZ.js";
98
+ } from "./chunk-XIQKWTFY.js";
97
99
  import {
98
100
  ASYNC_STATUS_SNAPSHOT_KIND,
99
101
  ASYNC_STATUS_SNAPSHOT_VERSION,
@@ -110,7 +112,7 @@ import {
110
112
  runLaunchDir,
111
113
  stopStoppableAsyncStatusChildren,
112
114
  summarizeAsyncStatus
113
- } from "./chunk-SG3NCWZW.js";
115
+ } from "./chunk-2LEBXCLU.js";
114
116
  import {
115
117
  CONTACT_SUPERVISOR_TOOL_NAME,
116
118
  NATIVE_SUPERVISOR_TOOL_NAME,
@@ -120,7 +122,7 @@ import {
120
122
  parseSupervisorReplyData,
121
123
  parseSupervisorRequestDetails,
122
124
  topLevelSupervisorTool
123
- } from "./chunk-VEEUXJDO.js";
125
+ } from "./chunk-PTN7XAXI.js";
124
126
  import {
125
127
  MODEL_ONLY_TOOL,
126
128
  canRenderComponents,
@@ -135,7 +137,7 @@ import {
135
137
  reportSessionWarning,
136
138
  withCachedUiContext
137
139
  } from "./chunk-HXRB42AF.js";
138
- import "./chunk-W2BZS6UC.js";
140
+ import "./chunk-VMJGZHUL.js";
139
141
  import {
140
142
  disabledFeatureUseError,
141
143
  getActiveAsyncCapacitySnapshot,
@@ -146,7 +148,7 @@ import {
146
148
  resolveDisabledFeatureSurface,
147
149
  resolveMaxActiveAsyncRunsPerSession,
148
150
  resolveScheduledStoreRoot
149
- } from "./chunk-YLU5JFW2.js";
151
+ } from "./chunk-XYIVVS3A.js";
150
152
  import {
151
153
  ACTIVE_RUN_INDEX_DIR,
152
154
  MissionNotFoundError,
@@ -197,28 +199,28 @@ import {
197
199
  withWorkflowChildRunModel,
198
200
  writeAsyncResultFile,
199
201
  writeResultIndexForData
200
- } from "./chunk-KCDPTXHT.js";
201
- import "./chunk-UUW7P6KJ.js";
202
+ } from "./chunk-SIB2GQHL.js";
203
+ import "./chunk-37EJGDYO.js";
202
204
  import {
203
205
  shouldUseNativeFsWatch
204
206
  } from "./chunk-NIXWDZZV.js";
205
207
  import {
206
208
  validateIntercomBridgeConfig
207
- } from "./chunk-YJIU5WF4.js";
209
+ } from "./chunk-CPWZN5KM.js";
208
210
  import "./chunk-7F6RKT6W.js";
209
- import "./chunk-R3NH5XAL.js";
211
+ import "./chunk-YVDKGAEO.js";
210
212
  import "./chunk-YARY7JWU.js";
211
213
  import {
212
214
  listHerdrProjectPaneRoots,
213
215
  restoreHerdrProjectPaneSnapshots
214
- } from "./chunk-OUM6SEVD.js";
215
- import "./chunk-7J4ZXMY7.js";
216
+ } from "./chunk-UC22RDXP.js";
217
+ import "./chunk-72334PEI.js";
216
218
  import {
217
219
  cleanupAllArtifactDirs,
218
220
  cleanupOldArtifacts,
219
221
  getArtifactPaths,
220
222
  getArtifactsDir
221
- } from "./chunk-77VQEATI.js";
223
+ } from "./chunk-5J2RTMKW.js";
222
224
  import {
223
225
  listBackgroundWorkProviders
224
226
  } from "./chunk-XA3DY6UG.js";
@@ -226,12 +228,12 @@ import "./chunk-YYREO77V.js";
226
228
  import "./chunk-UKG4V45O.js";
227
229
  import {
228
230
  registerRuntimeAgentEventListener
229
- } from "./chunk-5TXWZB73.js";
231
+ } from "./chunk-P2M6RIVX.js";
230
232
  import {
231
233
  clearRuntimeAgentsForPi,
232
234
  listRuntimeAgentConfigs,
233
235
  mergeRuntimeAgents
234
- } from "./chunk-SWGB2P5J.js";
236
+ } from "./chunk-7Y4IJMCW.js";
235
237
  import {
236
238
  DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
237
239
  DEFAULT_WAIT_TOOL_NAME,
@@ -275,7 +277,7 @@ import {
275
277
  waitToolName,
276
278
  withSettingsFileLease,
277
279
  writeAtomicJson
278
- } from "./chunk-LWH7IGI3.js";
280
+ } from "./chunk-F4NSLXB2.js";
279
281
  import {
280
282
  DEFAULT_ARTIFACT_CONFIG,
281
283
  DIRS,
@@ -299,7 +301,7 @@ import {
299
301
  WIDGET_ANIMATION_INTERVAL_MS,
300
302
  WIDGET_KEY,
301
303
  resolveMaxSubagentSpawnsPerSession
302
- } from "./chunk-JEZOSEWG.js";
304
+ } from "./chunk-SRWJIAIP.js";
303
305
  import {
304
306
  safeTerminalText,
305
307
  sanitizeDisplayText,
@@ -1533,6 +1535,37 @@ function missionReferenceBlocksReclaim(runDir, resultsDir, runId) {
1533
1535
  return !(error instanceof MissionNotFoundError);
1534
1536
  }
1535
1537
  }
1538
+ function runKept(input, runId) {
1539
+ const runDir = path3.join(input.asyncDirRoot, runId);
1540
+ if (!fs4.existsSync(runDir)) return false;
1541
+ const status = readStatus2(runDir);
1542
+ if (status?.runId !== runId || !TERMINAL_STATES.has(status.state)) return true;
1543
+ if (input.protectedRunIds.has(runId) || input.waitRunIds.has(runId) || activeMarkerExists(input.asyncDirRoot, runId)) return true;
1544
+ const timestamp = statusTimestamp(status, runDir);
1545
+ return timestamp === void 0 || timestamp > input.cutoff || timestamp > input.resumableCutoff && hasResumableContract(runDir, status);
1546
+ }
1547
+ function workflowTreeKept(input, workflow) {
1548
+ return (workflow.steps ?? []).some((step) => {
1549
+ if (!step.runId || !validRunId(step.runId)) return false;
1550
+ const revived = step.workflowKey ? projectWorkflowKeyRevival(input.asyncDirRoot, workflow.runId, step.workflowKey, step.runId)?.revivedRunIds ?? [] : [];
1551
+ const chain = [step.runId, ...revived];
1552
+ return fs4.existsSync(path3.join(input.asyncDirRoot, chain.at(-1), REVIVAL_LINK_FILE)) || chain.some((runId) => runKept(input, runId));
1553
+ });
1554
+ }
1555
+ function workflowKeepsChildren(asyncDirRoot, workflowRunId) {
1556
+ return !validRunId(workflowRunId) || fs4.existsSync(path3.join(asyncDirRoot, workflowRunId));
1557
+ }
1558
+ function workflowReferenceBlocksReclaim(input, runDir, status) {
1559
+ if (status.mode === "workflow" && workflowTreeKept(input, status)) return true;
1560
+ let workflowRunId = status.parentWorkflowRunId;
1561
+ if (fs4.existsSync(path3.join(runDir, REVIVAL_ORIGIN_FILE))) {
1562
+ const origin = readJson(path3.join(runDir, REVIVAL_ORIGIN_FILE));
1563
+ if (typeof origin?.workflowRunId !== "string") return true;
1564
+ workflowRunId = origin.workflowRunId;
1565
+ }
1566
+ if (workflowRunId === void 0) return status.workflowKey !== void 0;
1567
+ return workflowKeepsChildren(input.asyncDirRoot, workflowRunId);
1568
+ }
1536
1569
  function runTombstoneMarkerPath(maintenanceRoot, runId) {
1537
1570
  return path3.join(maintenanceRoot, RUN_TOMBSTONE_MARKERS_DIR, `${encodeIndexSegment(runId)}.json`);
1538
1571
  }
@@ -1600,8 +1633,7 @@ function runSkipReason(input) {
1600
1633
  if (input.waitRunIds.has(status.runId)) return "wait-reference";
1601
1634
  if (activeMarkerExists(input.asyncDirRoot, status.runId)) return "active-index";
1602
1635
  if (!TERMINAL_STATES.has(status.state)) return "non-terminal";
1603
- if (status.mode === "workflow" || status.parentWorkflowRunId || status.workflowKey) return "workflow-reference";
1604
- if (fs4.existsSync(path3.join(runDir, REVIVAL_ORIGIN_FILE))) return "workflow-reference";
1636
+ if (workflowReferenceBlocksReclaim(input, runDir, status)) return "workflow-reference";
1605
1637
  if (hasNestedReferences(status)) return "nested-reference";
1606
1638
  if (missionReferenceBlocksReclaim(runDir, input.resultsDir, status.runId)) return "mission-reference";
1607
1639
  if (hasUnresolvedRunHandoff(runDir, status)) return "handoff-reference";
@@ -1763,9 +1795,6 @@ function hasUnresolvedResultHandoff(data) {
1763
1795
  const manifestPath = data.parallelHandoff.path;
1764
1796
  return typeof manifestPath !== "string" || !manifestPath || unresolvedHandoff(manifestPath);
1765
1797
  }
1766
- function completionMode(data) {
1767
- return data.completion && typeof data.completion === "object" && !Array.isArray(data.completion) ? data.completion.mode : void 0;
1768
- }
1769
1798
  function resultSkipReason(input) {
1770
1799
  if (!input.data) return "invalid-result";
1771
1800
  const runId = resultRunId(input.candidate, input.data);
@@ -1776,7 +1805,7 @@ function resultSkipReason(input) {
1776
1805
  if (activeMarkerExists(input.asyncDirRoot, runId)) return "active-index";
1777
1806
  if (fs4.existsSync(path3.join(input.asyncDirRoot, runId))) return "run-present";
1778
1807
  if (missionObserverIndexExists(input.resultsDir, runId)) return "mission-reference";
1779
- if (input.data.mode === "workflow" || completionMode(input.data) === "workflow" || typeof input.data.parentWorkflowRunId === "string" || typeof input.data.workflowKey === "string") return "workflow-reference";
1808
+ if (typeof input.data.parentWorkflowRunId === "string" ? workflowKeepsChildren(input.asyncDirRoot, input.data.parentWorkflowRunId) : typeof input.data.workflowKey === "string") return "workflow-reference";
1780
1809
  if (hasUnresolvedResultHandoff(input.data)) return "handoff-reference";
1781
1810
  const timestamp = resultTimestamp(input.data, input.candidate.path);
1782
1811
  if (resultHasResumableSession(input.data) && (timestamp === void 0 || timestamp > input.resumableCutoff)) return "resumable";
@@ -5439,7 +5468,7 @@ function registerSlashCommands(pi, state, options = {}) {
5439
5468
  }
5440
5469
  fleetOpen = true;
5441
5470
  try {
5442
- const { openSubagentFleet } = await import("./chunk-URKQZHVH.js");
5471
+ const { openSubagentFleet } = await import("./chunk-G43SW4BT.js");
5443
5472
  await openSubagentFleet(ctx, state, { asyncDirRoot: DIRS.async, inspectorPlugins: () => getInspectorPlugins(pi), resultsDir: DIRS.results, fleetKeybindings: options.fleetKeybindings });
5444
5473
  } finally {
5445
5474
  fleetOpen = false;
@@ -8853,7 +8882,7 @@ function registerSubagentExtension(pi) {
8853
8882
  const ctx = withLastUiContext((current) => current);
8854
8883
  if (!ctx) return;
8855
8884
  try {
8856
- const { openSubagentFleet } = await import("./chunk-URKQZHVH.js");
8885
+ const { openSubagentFleet } = await import("./chunk-G43SW4BT.js");
8857
8886
  await openSubagentFleet(ctx, state, { initialKey: itemKey, asyncDirRoot: DIRS.async, resultsDir: DIRS.results, fleetKeybindings: config.fleetKeybindings, inspectorPlugins: () => getInspectorPlugins(pi) });
8858
8887
  } catch (error) {
8859
8888
  if (isStaleExtensionContextError(error)) {
@@ -9062,7 +9091,7 @@ function registerSubagentExtension(pi) {
9062
9091
  let executor;
9063
9092
  let executorPromise;
9064
9093
  let executorModulePromise;
9065
- const loadExecutorModule = () => executorModulePromise ??= import("./chunk-6D54VW3E.js");
9094
+ const loadExecutorModule = () => executorModulePromise ??= import("./chunk-AJWRYQPH.js");
9066
9095
  const getExecutor = () => {
9067
9096
  executorPromise ??= loadExecutorModule().then(({ createSubagentExecutor }) => {
9068
9097
  executor = createSubagentExecutor(executorDeps);
@@ -9076,7 +9105,7 @@ function registerSubagentExtension(pi) {
9076
9105
  modulePreloadTimer = setTimeout(() => {
9077
9106
  loadExecutorModule().catch(() => {
9078
9107
  });
9079
- if (fleetViewEnabled) import("./chunk-URKQZHVH.js").catch(() => {
9108
+ if (fleetViewEnabled) import("./chunk-G43SW4BT.js").catch(() => {
9080
9109
  });
9081
9110
  }, MODULE_PRELOAD_DELAY_MS);
9082
9111
  modulePreloadTimer.unref?.();
@@ -2,12 +2,12 @@ import {
2
2
  createAtomicJsonWriter,
3
3
  getAgentDir,
4
4
  readStatus
5
- } from "./chunk-LWH7IGI3.js";
5
+ } from "./chunk-F4NSLXB2.js";
6
6
  import {
7
7
  DIRS,
8
8
  TEMP_ARTIFACTS_DIR,
9
9
  TEMP_ROOT_DIR
10
- } from "./chunk-JEZOSEWG.js";
10
+ } from "./chunk-SRWJIAIP.js";
11
11
 
12
12
  // src/shared/artifacts.ts
13
13
  import * as fs2 from "node:fs";
@@ -6,10 +6,12 @@ function shellQuote(value, platform) {
6
6
  function isBareExecutable(value) {
7
7
  return /^[\w./@:-]+$/.test(value);
8
8
  }
9
- function formatShellCommand(exe, args, platform = process.platform) {
10
- const quotedArgs = args.map((arg) => shellQuote(arg, platform));
11
- if (platform === "win32") return `& ${[shellQuote(exe, platform), ...quotedArgs].join(" ")}`;
12
- const invocation = isBareExecutable(exe) ? exe : `sh -c 'exec "$0" "$@"' ${shellQuote(exe, platform)}`;
9
+ 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) return `& ${[shellQuote(exe, quotePlatform), ...quotedArgs].join(" ")}`;
14
+ const invocation = isBareExecutable(exe) ? exe : `sh -c 'exec "$0" "$@"' ${shellQuote(exe, quotePlatform)}`;
13
15
  return [invocation, ...quotedArgs].join(" ");
14
16
  }
15
17
 
@@ -1,32 +1,32 @@
1
1
  import {
2
2
  rewriteSubagentPrompt
3
- } from "./chunk-CASL47ST.js";
3
+ } from "./chunk-EBGTTJKP.js";
4
4
  import {
5
5
  package_default
6
- } from "./chunk-TRN65L4F.js";
6
+ } from "./chunk-ACTHBJUI.js";
7
7
  import {
8
8
  WATCHDOG_DIFF_TOOL_NAME,
9
9
  captureWatchdogDiffBaseline,
10
10
  createWatchdogDiffTool
11
- } from "./chunk-TDXVQPZW.js";
12
- import "./chunk-SG3NCWZW.js";
13
- import "./chunk-VEEUXJDO.js";
11
+ } from "./chunk-RIBMW6V3.js";
12
+ import "./chunk-2LEBXCLU.js";
13
+ import "./chunk-PTN7XAXI.js";
14
14
  import {
15
15
  MODEL_ONLY_TOOL
16
16
  } from "./chunk-HXRB42AF.js";
17
- import "./chunk-W2BZS6UC.js";
17
+ import "./chunk-VMJGZHUL.js";
18
18
  import {
19
19
  appendAgentRefinementOverlay
20
- } from "./chunk-Q4VH72JI.js";
21
- import "./chunk-KCDPTXHT.js";
20
+ } from "./chunk-KNVQTRSY.js";
21
+ import "./chunk-SIB2GQHL.js";
22
22
  import "./chunk-NIXWDZZV.js";
23
- import "./chunk-YJIU5WF4.js";
23
+ import "./chunk-CPWZN5KM.js";
24
24
  import "./chunk-7F6RKT6W.js";
25
25
  import {
26
26
  assertNoToolModifierEntries
27
- } from "./chunk-R3NH5XAL.js";
27
+ } from "./chunk-YVDKGAEO.js";
28
28
  import "./chunk-YARY7JWU.js";
29
- import "./chunk-77VQEATI.js";
29
+ import "./chunk-5J2RTMKW.js";
30
30
  import {
31
31
  HERDR_PI_MAX_ACCEPTANCE_PROMPT_BYTES,
32
32
  HERDR_PI_MAX_FRAME_BYTES,
@@ -44,8 +44,8 @@ import {
44
44
  discoverAgents,
45
45
  resolveExistingReadPaths,
46
46
  resolveSkills
47
- } from "./chunk-LWH7IGI3.js";
48
- import "./chunk-JEZOSEWG.js";
47
+ } from "./chunk-F4NSLXB2.js";
48
+ import "./chunk-SRWJIAIP.js";
49
49
  import "./chunk-YFCK7H2S.js";
50
50
  import "./chunk-QXASAHIA.js";
51
51
 
@@ -8,7 +8,7 @@ import {
8
8
  validateCodeOwnedProfileRunner,
9
9
  validatePermissionRules,
10
10
  validateToolBudgetConfig
11
- } from "./chunk-LWH7IGI3.js";
11
+ } from "./chunk-F4NSLXB2.js";
12
12
 
13
13
  // src/agents/runtime-agent-registry.ts
14
14
  var RUNTIME_AGENT_REGISTRY_KEY = "pi-subagents.runtime-agents.v1";
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "pi-subagents",
4
- version: "0.89.1",
4
+ version: "0.90.0",
5
5
  private: true,
6
6
  description: "Pi extension for single-agent delegation and scripted multi-agent workflows",
7
7
  author: "Nico Bailon",