@vicary/pi-subagents 0.85.0 → 0.87.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 (97) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +2 -2
  4. package/bundle/{chunk-O7CPL6H4.js → chunk-2D2DQGC2.js} +9 -9
  5. package/bundle/{chunk-KZ34KQQH.js → chunk-2NY5PCKQ.js} +11 -5
  6. package/bundle/{chunk-PVIVCDG2.js → chunk-3CVOAS77.js} +2 -2
  7. package/bundle/{chunk-N7B2KD74.js → chunk-6O7YH2QV.js} +1 -1
  8. package/bundle/{chunk-B3OOJJA6.js → chunk-75LVXBSA.js} +194 -94
  9. package/bundle/{chunk-H2NLFTC5.js → chunk-BFF6YDK6.js} +1 -1
  10. package/bundle/{chunk-UX4SCV5N.js → chunk-C3KWLXDH.js} +159 -98
  11. package/bundle/{chunk-GCSLVFCX.js → chunk-C5QWQSSM.js} +1 -1
  12. package/bundle/{chunk-KDMFBYFM.js → chunk-ESWW6XSX.js} +1 -1
  13. package/bundle/{chunk-CS4O36CZ.js → chunk-HDICKROY.js} +5 -5
  14. package/bundle/{chunk-JHBQ7N2L.js → chunk-HTI7DD5D.js} +2 -2
  15. package/bundle/{chunk-L2ENOFVZ.js → chunk-LZKVUWIY.js} +66 -26
  16. package/bundle/{chunk-RV5OGHLO.js → chunk-M2VBGET6.js} +2 -2
  17. package/bundle/{chunk-QZL2ZZPM.js → chunk-NJTSXIMG.js} +12 -12
  18. package/bundle/{chunk-YZBCREP5.js → chunk-NMYBVCGP.js} +39 -34
  19. package/bundle/{chunk-A7VJ5XXE.js → chunk-O7A26O6B.js} +8 -6
  20. package/bundle/{chunk-HFTBF7SG.js → chunk-OOE3R7IQ.js} +1 -1
  21. package/bundle/{chunk-LGMILZNE.js → chunk-PGU4TZV3.js} +79 -32
  22. package/bundle/{chunk-VEZMZDTW.js → chunk-PUSTU4Q7.js} +80 -37
  23. package/bundle/{chunk-KEY3UQMQ.js → chunk-SIAQXPJ4.js} +6 -8
  24. package/bundle/{chunk-QO75KJBT.js → chunk-USRX7QXD.js} +2 -2
  25. package/bundle/{chunk-7MAE3DJV.js → chunk-VFUFOZBU.js} +1 -1
  26. package/bundle/{chunk-NF7IEKBH.js → chunk-W2BZS6UC.js} +27 -13
  27. package/bundle/{chunk-T5V5BRCL.js → chunk-W52LJANO.js} +1 -1
  28. package/bundle/{chunk-PHZP3KHB.js → chunk-XSDYTXHF.js} +18 -11
  29. package/bundle/{chunk-LTPH2DXH.js → chunk-XV7RTWTS.js} +3 -3
  30. package/bundle/{chunk-JO67XSKD.js → chunk-YEXKJJVS.js} +12 -7
  31. package/bundle/{chunk-HS4WPO6B.js → chunk-Z4TR7MK6.js} +5 -5
  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 +3 -3
  37. package/bundle/workflow-resources.js +1 -1
  38. package/docs/agents.md +9 -3
  39. package/docs/configuration.md +14 -6
  40. package/docs/extension-api.md +2 -0
  41. package/docs/models.md +6 -2
  42. package/docs/tool-reference.md +3 -0
  43. package/package.json +2 -2
  44. package/skills/pi-subagents/SKILL.md +7 -4
  45. package/skills/pi-subagents/references/prompting-and-roles.md +1 -0
  46. package/src/agents/agent-management.js +10 -6
  47. package/src/agents/agent-serializer.d.ts +2 -0
  48. package/src/agents/agent-serializer.js +1 -1
  49. package/src/agents/agents.js +37 -12
  50. package/src/api/preflight.d.ts +3 -1
  51. package/src/api/preflight.js +2 -0
  52. package/src/extension/index.js +4 -2
  53. package/src/extension/schemas.d.ts +2 -0
  54. package/src/extension/schemas.js +1 -0
  55. package/src/extension/tool-activation.js +10 -1
  56. package/src/extension/tool-description.d.ts +1 -1
  57. package/src/extension/tool-description.js +8 -8
  58. package/src/runs/background/async-execution.d.ts +2 -1
  59. package/src/runs/background/async-execution.js +4 -2
  60. package/src/runs/background/run-status.js +5 -4
  61. package/src/runs/background/runner-aliases.js +15 -0
  62. package/src/runs/background/subagent-runner.js +6 -6
  63. package/src/runs/background/wait-subscriptions.js +124 -12
  64. package/src/runs/foreground/async-stop-action.d.ts +1 -1
  65. package/src/runs/foreground/async-stop-action.js +9 -1
  66. package/src/runs/foreground/execution.js +1 -0
  67. package/src/runs/foreground/subagent-executor.d.ts +1 -0
  68. package/src/runs/foreground/subagent-executor.js +51 -8
  69. package/src/runs/shared/acceptance.js +69 -26
  70. package/src/runs/shared/child-session.d.ts +5 -4
  71. package/src/runs/shared/child-session.js +43 -33
  72. package/src/runs/shared/external-cli-contract.d.ts +49 -0
  73. package/src/runs/shared/external-cli-contract.js +18 -13
  74. package/src/runs/shared/herdr-placed-run.js +3 -2
  75. package/src/runs/shared/mcp-config-sources.d.ts +2 -1
  76. package/src/runs/shared/mcp-config-sources.js +1 -1
  77. package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +0 -1
  78. package/src/runs/shared/mcp-direct-tool-allowlist.js +5 -6
  79. package/src/runs/shared/model-resolution.d.ts +19 -4
  80. package/src/runs/shared/model-resolution.js +50 -51
  81. package/src/runs/shared/structured-output.js +10 -3
  82. package/src/shared/artifacts.js +25 -13
  83. package/src/shared/pruned-fork.js +2 -2
  84. package/src/shared/types.d.ts +71 -48
  85. package/src/tui/render.js +83 -22
  86. package/src/watchdog/model-selection.js +2 -2
  87. package/src/watchdog/review.js +2 -2
  88. package/src/workflows/scripted-workflow.d.ts +2 -0
  89. package/src/workflows/scripted-workflow.js +103 -39
  90. package/src/workflows/structured-workflow-scripts.d.ts +4 -3
  91. package/src/workflows/structured-workflow-scripts.js +32 -11
  92. package/src/workflows/workflow-receipt.js +36 -53
  93. package/src/workflows/workflow-resources.js +4 -4
  94. package/src/workflows/workflow-resume-claim.d.ts +2 -0
  95. package/src/workflows/workflow-resume-claim.js +1 -1
  96. package/src/workflows/workflow-resume.d.ts +1 -1
  97. package/src/workflows/workflow-resume.js +3 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,54 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.87.0] - 2026-11-07
6
+
7
+ ### Highlights
8
+
9
+ - You can stop a long workflow without losing the work already in progress: `stop` with `drain: true` starts nothing new, lets running children finish and keeps their results.
10
+ - A model written as `provider/id` now always runs on that provider, so a subagent can no longer quietly run on, and bill, another provider's copy of the model.
11
+ - One setting, `subagents.defaultInheritGlobalContext: true`, gives every subagent your global `AGENTS.md`.
12
+ - Old artifacts in nested folders are now cleaned up too, so session artifact folders stop growing.
13
+ - Several multi-window and multi-session fixes: wait notices reach the right window, and closing one session in a host like pi-web no longer stops another session's subagents.
14
+
15
+ ### Added
16
+
17
+ - `stop` with `drain: true` ends an async workflow without killing the children already running: it starts no new children, lets the running ones finish and report, then ends as stopped. Before, stopping a workflow killed them too. Thanks to [@nnayr](https://github.com/nnayr) for the report. (#3202)
18
+ - `subagents.defaultInheritGlobalContext: true` gives every subagent your global `~/.pi/agent/AGENTS.md`, without listing each agent in `agentOverrides`. An agent that sets `inheritGlobalContext: false` still opts out. Thanks to [@imagebuilder1837](https://github.com/imagebuilder1837) for the report. (#3206)
19
+
20
+ ### Fixed
21
+
22
+ - A subagent model written as `provider/id` now always runs on that provider. Before, if you were not signed in to that provider, a similar model from another provider (for example OpenRouter's copy of an Anthropic model) could run instead and bill that account. The launch now fails with an error that names the other provider's model, so you can choose it on purpose. The bundled skill also tells the parent to leave `model` out unless you or your settings name one. Thanks to [@crusaderky](https://github.com/crusaderky) for the report. (#3203)
23
+ - When a `parallel` workflow, `tasks` or `chain` item has a field it does not accept, the error now says how to keep what that field asked for. For `output`, it explains that `output` on the outer call writes one file per child, and that exact per-child paths need a workflow script with `runs.all`. For fields such as `worktree`, the error points to the outer call and says that no child was launched. Thanks to [@cash-flow-king](https://github.com/cash-flow-king) for the report. (#3207)
24
+ - `validate` now catches a `runs.lanes` lane that starts by resuming a finished run. It reports the same error the launch would give, so the script can be fixed before it runs. (#3210)
25
+ - `mcp:` selectors now resolve for pi-mcp-adapter servers that set `directTools: "search"` or use `${NAME:-default}` in their configuration. Before, pi-subagents dropped a `"search"` server from the configuration, and a `${NAME:-default}` value gave a server a different cache hash than the adapter computed. In both cases, every selector for the server was unresolved. A server URL that used a default also failed the launch. Thanks to [@acolomba](https://github.com/acolomba) for #3201.
26
+ - In a host that runs several Pi sessions in one process, such as pi-web, closing one session no longer stops subagents that another session started. Thanks to [@Jarcis-cy](https://github.com/Jarcis-cy) for #3204.
27
+ - When two Pi windows have the same session open, a background wait notice now reaches the window that asked for it, instead of whichever window checked first. If that window has closed, the next window that opens the session takes the notice over. Thanks to [@mdrkrg](https://github.com/mdrkrg) for #3205.
28
+ - Old subagent artifacts in nested folders, such as workflow child outputs under `outputs/`, are now removed after `artifactConfig.cleanupDays` like top-level ones. Before, cleanup only looked at the top level, so session artifact folders kept growing. Worktree handoff records and their patches are kept. (#3217)
29
+ - The configuration docs now explain how to turn on delegation in a session that was recorded before pi-subagents was installed. They also no longer say that `"toolActivation": "eager"` makes `subagent` active in every resumed session. Thanks to [@dapp-whisperer](https://github.com/dapp-whisperer) for #3218.
30
+ - On a Pi 1.5 install that is missing `@earendil-works/pi-schema` (seen in a NixOS package), a background subagent launch now fails right away with an error that names the missing package. Before, the launch was accepted and the child then exited with `Cannot find module '@earendil-works/pi-schema'` before its first turn. Thanks to [@Hifive55555](https://github.com/Hifive55555) for #3220.
31
+
32
+ ## [0.86.0] - 2026-11-05
33
+
34
+ ### Highlights
35
+
36
+ - Sessions no longer lose their subagent tools after a compaction when pi-subagents had been reloaded or updated earlier in the session.
37
+ - Typed JSON checks pass on KDE desktops again, where common environment values were mistaken for secrets and broke the JSON.
38
+ - With one background agent running, the expanded widget shows its whole task instead of one line cut at 96 characters.
39
+ - Status for Claude Code, Codex and Cursor agents now says plainly that its safety settings are the adapter's defaults, not something measured from the running process.
40
+
41
+ ### Changed
42
+
43
+ - When one background child is running, the expanded background-agents widget shows its task as written: line breaks kept, wrapped to the terminal width, up to 8 lines. Before, it was squeezed onto one line and cut at 96 characters. With two or more children running, each keeps a one-line task so every running child stays on screen. The collapsed widget is unchanged. Thanks to [@marshamonkey25-hue](https://github.com/marshamonkey25-hue) for the report. (#3187)
44
+ - The safety settings shown for a Claude Code, Codex or Cursor agent are now labelled `Safety (adapter profile, not measured)`. They are what the adapter asks the CLI for, and a wrapper script set as `runner.command` can grant something different. Run status and workflow receipts also record `safetySource: { measured: false, command }`, naming the command that launched the run; runs on a Herdr saved machine record no command, because the remote machine runs its own CLI. See [Safety record and wrapper commands](docs/agents.md#safety-record-and-wrapper-commands). Thanks to [@drye](https://github.com/drye) for #3199.
45
+
46
+ ### Fixed
47
+
48
+ - A session whose subagent tools were turned off when pi-subagents was reloaded or updated now gets them back after a compaction. Before, if the reload came before the compaction, the session resumed with neither `subagent` nor `subagents_enable`, and restarting or forking it did not help. Tools you removed yourself stay removed. Thanks to [@chuducandev](https://github.com/chuducandev) for the report. (#3198)
49
+ - A passing `output: "json"` check no longer fails as "not valid JSON" when an environment variable with a secret-looking name holds a common value, such as `KDE_FULL_SESSION=true` or `XDG_SESSION_CLASS=user` on KDE. The output is now parsed first and secrets are hidden afterwards, in the parsed strings, keys and numbers, so values like `true` and `null` are left alone. Thanks to [@nhp](https://github.com/nhp) for the report. (#3191)
50
+ - A child's `structured_output` call no longer crashes with `RangeError: Maximum call stack size exceeded` when the `outputSchema` refers to itself through `$ref` (for example `{"allOf": [{"$ref": "#"}]}`). It now fails with "Structured output validation failed: outputSchema cannot be validated (cyclic or too deep)", and typed checks, dynamic fanout and saved structured output report the same error. Thanks to [@G0-0000](https://github.com/G0-0000) for the report. (#3190)
51
+ - A custom `subagent` tool description that uses `{{compactDescription}}` or `{{fullDescription}}` no longer describes features turned off with `disabledFeatures`. Before, with workflow scripts disabled, the model was still told how to write them. Thanks to [@ohlulu](https://github.com/ohlulu) for the report. (#3192)
52
+
5
53
  ## [0.85.0] - 2026-11-04
6
54
 
7
55
  ### Highlights
package/bundle/agents.js CHANGED
@@ -2,11 +2,11 @@ import {
2
2
  RUNTIME_AGENT_REGISTER_EVENT,
3
3
  RUNTIME_AGENT_REGISTER_VERSION,
4
4
  registerAgentViaEvents
5
- } from "./chunk-H2NLFTC5.js";
5
+ } from "./chunk-BFF6YDK6.js";
6
6
  import {
7
7
  registerRuntimeAgent
8
- } from "./chunk-GCSLVFCX.js";
9
- import "./chunk-UX4SCV5N.js";
8
+ } from "./chunk-C5QWQSSM.js";
9
+ import "./chunk-C3KWLXDH.js";
10
10
  import "./chunk-JEZOSEWG.js";
11
11
  import "./chunk-YFCK7H2S.js";
12
12
  import "./chunk-QXASAHIA.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  resolvePiLaunchToolPlan
3
- } from "./chunk-KEY3UQMQ.js";
3
+ } from "./chunk-SIAQXPJ4.js";
4
4
  import "./chunk-CTPAE36Y.js";
5
- import "./chunk-UX4SCV5N.js";
5
+ import "./chunk-C3KWLXDH.js";
6
6
  import "./chunk-JEZOSEWG.js";
7
7
  import "./chunk-YFCK7H2S.js";
8
8
  import "./chunk-QXASAHIA.js";
@@ -7,37 +7,37 @@ import {
7
7
  safeTranscriptEvent,
8
8
  steerAsyncRun,
9
9
  steerWorkflowForegroundTarget
10
- } from "./chunk-CS4O36CZ.js";
10
+ } from "./chunk-HDICKROY.js";
11
11
  import {
12
12
  FLEET_STATUS_WIDGET_KEY,
13
13
  runningTone,
14
14
  stepTaskSummary
15
- } from "./chunk-L2ENOFVZ.js";
15
+ } from "./chunk-LZKVUWIY.js";
16
16
  import {
17
17
  foregroundChildStateLabel,
18
18
  formatAsyncRunTranscript,
19
19
  stopAsyncRun
20
- } from "./chunk-KZ34KQQH.js";
20
+ } from "./chunk-2NY5PCKQ.js";
21
21
  import {
22
22
  contextModeBadge,
23
23
  contextModeLabel,
24
24
  decodeUtf8Tail,
25
25
  listAsyncRuns
26
- } from "./chunk-LTPH2DXH.js";
26
+ } from "./chunk-XV7RTWTS.js";
27
27
  import {
28
28
  reportSessionWarning
29
29
  } from "./chunk-HXRB42AF.js";
30
- import "./chunk-LGMILZNE.js";
31
- import "./chunk-7MAE3DJV.js";
30
+ import "./chunk-PGU4TZV3.js";
31
+ import "./chunk-VFUFOZBU.js";
32
32
  import "./chunk-NIXWDZZV.js";
33
- import "./chunk-KDMFBYFM.js";
33
+ import "./chunk-ESWW6XSX.js";
34
34
  import "./chunk-7F6RKT6W.js";
35
35
  import "./chunk-CTPAE36Y.js";
36
36
  import "./chunk-7J4ZXMY7.js";
37
37
  import {
38
38
  getArtifactPaths,
39
39
  getArtifactsDir
40
- } from "./chunk-PHZP3KHB.js";
40
+ } from "./chunk-XSDYTXHF.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-UX4SCV5N.js";
52
+ } from "./chunk-C3KWLXDH.js";
53
53
  import {
54
54
  DIRS
55
55
  } from "./chunk-JEZOSEWG.js";
@@ -12,7 +12,7 @@ import {
12
12
  summarizeContextModes,
13
13
  utf8Tail,
14
14
  workflowPreflightLaneForRuntimeKey
15
- } from "./chunk-LTPH2DXH.js";
15
+ } from "./chunk-XV7RTWTS.js";
16
16
  import {
17
17
  ownsRun
18
18
  } from "./chunk-HXRB42AF.js";
@@ -34,11 +34,11 @@ import {
34
34
  updateActiveRunIndex,
35
35
  validateModelResponseAliases,
36
36
  writeAsyncResultFile
37
- } from "./chunk-LGMILZNE.js";
37
+ } from "./chunk-PGU4TZV3.js";
38
38
  import {
39
39
  deliverStopRequest,
40
40
  stopInboxClosedPath
41
- } from "./chunk-7MAE3DJV.js";
41
+ } from "./chunk-VFUFOZBU.js";
42
42
  import {
43
43
  SUBAGENT_STOPPED_MESSAGE,
44
44
  formatDuration,
@@ -50,7 +50,7 @@ import {
50
50
  waitToolName,
51
51
  writeAtomicJson,
52
52
  writePrivateAtomicJson
53
- } from "./chunk-UX4SCV5N.js";
53
+ } from "./chunk-C3KWLXDH.js";
54
54
  import {
55
55
  DIRS
56
56
  } from "./chunk-JEZOSEWG.js";
@@ -937,13 +937,19 @@ function deliverAsyncRunStop(input) {
937
937
  if (!(pausedWholeRun && fs5.existsSync(stopInboxClosedPath(delivery.asyncDir)))) deliverStopRequest(delivery);
938
938
  if (pausedWholeRun) return sealPausedRun(delivery.asyncDir, status, resultsDir);
939
939
  }
940
- function stopAsyncRun(state, runId, kill, location, childId) {
940
+ function stopAsyncRun(state, runId, kill, location, childId, drain) {
941
941
  const target = getAsyncStopTarget(state, runId, location);
942
942
  const workflowRunId = target?.asyncId ?? runId;
943
943
  const workflowController = childId === void 0 && workflowRunId ? state.workflowControllers?.get(workflowRunId) : void 0;
944
944
  const workflowAsyncDir = workflowController && workflowRunId ? target?.asyncDir ?? state.asyncJobs.get(workflowRunId)?.asyncDir : void 0;
945
945
  const workflowStatus = workflowAsyncDir ? readStatus(workflowAsyncDir) : void 0;
946
946
  const foreignWorkflow = Boolean(state.currentSessionId && workflowStatus && workflowStatus.sessionId !== state.currentSessionId);
947
+ if (drain) {
948
+ const drained = workflowController && workflowRunId && !foreignWorkflow && !workflowController.signal.aborted ? state.workflowDrains?.get(workflowRunId)?.() : void 0;
949
+ if (!drained) return { content: [{ type: "text", text: `drain applies only to live async workflows in this session; '${runId ?? "current"}' is not one.` }], isError: true, details: { mode: "management", results: [] } };
950
+ if (!drained.ok) return { content: [{ type: "text", text: `Could not save the drain request for '${workflowRunId}'; nothing was stopped. Retry, or use stop without drain.` }], isError: true, details: { mode: "management", results: [] } };
951
+ return { content: [{ type: "text", text: `Drain requested for async workflow ${workflowRunId}: no new children will start; ${drained.started} started child(ren) will finish.` }], details: { mode: "management", results: [] } };
952
+ }
947
953
  if (workflowController && workflowRunId && !foreignWorkflow) {
948
954
  if (workflowStatus) stopStoppableAsyncStatusChildren(workflowStatus, state.workflowChildStops?.get(workflowRunId), "Workflow stopped.");
949
955
  workflowController.abort(new Error("Workflow stopped."));
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-7J4ZXMY7.js";
4
4
  import {
5
5
  getProjectSubagentsDir
6
- } from "./chunk-PHZP3KHB.js";
6
+ } from "./chunk-XSDYTXHF.js";
7
7
  import {
8
8
  getPiSpawnCommand,
9
9
  writeAtomicJson
10
- } from "./chunk-UX4SCV5N.js";
10
+ } from "./chunk-C3KWLXDH.js";
11
11
 
12
12
  // src/inspectors/herdr/project-panes.ts
13
13
  import * as fs from "node:fs";
@@ -4,7 +4,7 @@ import {
4
4
  getAgentDir,
5
5
  getProjectConfigDir,
6
6
  resolveRexLocalPlacement
7
- } from "./chunk-UX4SCV5N.js";
7
+ } from "./chunk-C3KWLXDH.js";
8
8
 
9
9
  // src/runs/shared/herdr-machine.ts
10
10
  import { spawnSync as spawnSync2 } from "node:child_process";