pi-subagents 0.80.0 → 0.82.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 (184) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/bundle/agents.js +18 -0
  3. package/bundle/background-work.js +16 -0
  4. package/bundle/capability-ceiling.js +22 -0
  5. package/bundle/child-tool-plan.js +11 -0
  6. package/bundle/chunk-43SCHIMD.js +57 -0
  7. package/bundle/chunk-4QFZZV3O.js +57 -0
  8. package/bundle/chunk-4SDU2BZX.js +1190 -0
  9. package/bundle/chunk-52UBALJL.js +753 -0
  10. package/bundle/chunk-5LFLVSTM.js +260 -0
  11. package/bundle/chunk-5TYMSZX3.js +235 -0
  12. package/bundle/chunk-62OCY2S4.js +14 -0
  13. package/bundle/chunk-7F6RKT6W.js +132 -0
  14. package/bundle/chunk-7IVSUMQQ.js +1337 -0
  15. package/bundle/chunk-7J4ZXMY7.js +18 -0
  16. package/bundle/chunk-7PCKZHR5.js +1234 -0
  17. package/bundle/chunk-7YMXOYEU.js +1373 -0
  18. package/bundle/chunk-B5EKXDHE.js +16870 -0
  19. package/bundle/chunk-CIZQXJ5Q.js +8619 -0
  20. package/bundle/chunk-CTPAE36Y.js +94 -0
  21. package/bundle/chunk-D4EHT5SJ.js +14 -0
  22. package/bundle/chunk-GC4DSPMH.js +946 -0
  23. package/bundle/chunk-GJECHSAR.js +179 -0
  24. package/bundle/chunk-M2CTFYT3.js +4164 -0
  25. package/bundle/chunk-MHZ4G23A.js +1296 -0
  26. package/bundle/chunk-N2BN7BF5.js +159 -0
  27. package/bundle/chunk-NF7IEKBH.js +490 -0
  28. package/bundle/chunk-NGGAFDL6.js +742 -0
  29. package/bundle/chunk-NIXWDZZV.js +9 -0
  30. package/bundle/chunk-NRQ75MGH.js +8327 -0
  31. package/bundle/chunk-OYF6AFDY.js +458 -0
  32. package/bundle/chunk-PLCCBLPY.js +526 -0
  33. package/bundle/chunk-RMQFMMAT.js +416 -0
  34. package/bundle/chunk-SIJ4S3EN.js +276 -0
  35. package/bundle/chunk-UKG4V45O.js +228 -0
  36. package/bundle/chunk-VH5OAWVG.js +4096 -0
  37. package/bundle/chunk-W2SZ22EM.js +5462 -0
  38. package/bundle/chunk-WVD4UEL4.js +9367 -0
  39. package/bundle/chunk-XSWOTIA3.js +175 -0
  40. package/bundle/chunk-YFCK7H2S.js +129 -0
  41. package/bundle/chunk-YKEWIB4M.js +380 -0
  42. package/bundle/chunk-YYREO77V.js +137 -0
  43. package/bundle/chunk-Z7KVHQHL.js +173 -0
  44. package/bundle/chunk-ZLINIYTP.js +8613 -0
  45. package/bundle/chunk-ZQGSDHL6.js +128 -0
  46. package/bundle/control-channel.js +11 -0
  47. package/bundle/delegation.js +14 -0
  48. package/bundle/external-job-provider.js +20 -0
  49. package/bundle/external-runs.js +21 -0
  50. package/bundle/index.js +30 -0
  51. package/bundle/inspectors.js +8 -0
  52. package/bundle/intercom-bridge.js +11 -0
  53. package/bundle/preflight.js +425 -0
  54. package/bundle/project-panes.js +28 -0
  55. package/bundle/required-child-extensions.js +6 -0
  56. package/bundle/shared-types.js +8 -0
  57. package/bundle/workflow-resources.js +7 -0
  58. package/docs/agents.md +31 -0
  59. package/docs/configuration.md +9 -1
  60. package/docs/extension-api.md +27 -0
  61. package/docs/observability.md +6 -2
  62. package/docs/tool-reference.md +3 -1
  63. package/docs/workflows.md +16 -0
  64. package/package.json +19 -19
  65. package/skills/pi-subagents/references/execution-controls.md +5 -4
  66. package/src/agents/agent-management.js +3 -3
  67. package/src/agents/agent-memory.js +3 -1
  68. package/src/agents/agents.js +6 -6
  69. package/src/agents/frontmatter.d.ts +4 -0
  70. package/src/agents/frontmatter.js +24 -3
  71. package/src/agents/skills.js +2 -1
  72. package/src/api/delegation.d.ts +20 -0
  73. package/src/extension/config.js +3 -0
  74. package/src/extension/herdr-pi-bridge.js +17 -10
  75. package/src/extension/index.js +109 -9
  76. package/src/extension/schemas.js +3 -3
  77. package/src/intercom/native-supervisor-channel.js +20 -0
  78. package/src/missions/lifecycle.js +7 -1
  79. package/src/runs/background/active-async-capacity.d.ts +1 -0
  80. package/src/runs/background/active-async-capacity.js +9 -3
  81. package/src/runs/background/async-execution.js +20 -10
  82. package/src/runs/background/async-job-tracker.d.ts +6 -1
  83. package/src/runs/background/async-job-tracker.js +9 -4
  84. package/src/runs/background/async-status.d.ts +2 -0
  85. package/src/runs/background/async-status.js +21 -2
  86. package/src/runs/background/await-async-run.js +3 -7
  87. package/src/runs/background/boot-id.d.ts +12 -0
  88. package/src/runs/background/boot-id.js +47 -0
  89. package/src/runs/background/interrupted-elsewhere.d.ts +22 -0
  90. package/src/runs/background/interrupted-elsewhere.js +68 -0
  91. package/src/runs/background/notify.d.ts +2 -0
  92. package/src/runs/background/notify.js +13 -0
  93. package/src/runs/background/result-delivery-ownership.d.ts +6 -0
  94. package/src/runs/background/result-delivery-ownership.js +19 -1
  95. package/src/runs/background/result-watcher.d.ts +3 -1
  96. package/src/runs/background/result-watcher.js +24 -8
  97. package/src/runs/background/run-child-session.d.ts +1 -6
  98. package/src/runs/background/run-child-session.js +19 -1
  99. package/src/runs/background/run-status.js +2 -1
  100. package/src/runs/background/stale-run-reconciler.d.ts +25 -0
  101. package/src/runs/background/stale-run-reconciler.js +54 -13
  102. package/src/runs/background/subagent-runner-bootstrap.js +3 -0
  103. package/src/runs/background/subagent-runner.d.ts +4 -0
  104. package/src/runs/background/subagent-runner.js +13 -5
  105. package/src/runs/background/subagent-wait.d.ts +1 -1
  106. package/src/runs/background/subagent-wait.js +6 -1
  107. package/src/runs/background/terminal-run-index.d.ts +1 -0
  108. package/src/runs/background/terminal-run-index.js +4 -2
  109. package/src/runs/foreground/async-stop-action.js +3 -1
  110. package/src/runs/foreground/execution.js +45 -5
  111. package/src/runs/foreground/foreground-history.d.ts +16 -2
  112. package/src/runs/foreground/foreground-history.js +133 -31
  113. package/src/runs/foreground/subagent-executor.d.ts +11 -0
  114. package/src/runs/foreground/subagent-executor.js +277 -74
  115. package/src/runs/shared/child-launch.d.ts +2 -2
  116. package/src/runs/shared/child-session.d.ts +3 -2
  117. package/src/runs/shared/child-session.js +51 -8
  118. package/src/runs/shared/child-tool-plan.d.ts +7 -0
  119. package/src/runs/shared/child-tool-plan.js +21 -6
  120. package/src/runs/shared/herdr-connection.d.ts +17 -8
  121. package/src/runs/shared/herdr-connection.js +19 -7
  122. package/src/runs/shared/herdr-external-adapters.d.ts +3 -2
  123. package/src/runs/shared/herdr-external-adapters.js +1 -1
  124. package/src/runs/shared/herdr-machine.d.ts +12 -2
  125. package/src/runs/shared/herdr-machine.js +55 -9
  126. package/src/runs/shared/herdr-pane-host.d.ts +88 -0
  127. package/src/runs/shared/herdr-pane-host.js +155 -0
  128. package/src/runs/shared/herdr-placed-run.d.ts +27 -150
  129. package/src/runs/shared/herdr-placed-run.js +48 -395
  130. package/src/runs/shared/local-machine-access.d.ts +5 -0
  131. package/src/runs/shared/local-machine-access.js +28 -0
  132. package/src/runs/shared/orca-progress-tabs.d.ts +0 -1
  133. package/src/runs/shared/orca-progress-tabs.js +1 -24
  134. package/src/runs/shared/parallel-utils.d.ts +1 -1
  135. package/src/runs/shared/placed-run-owner.d.ts +49 -0
  136. package/src/runs/shared/placed-run-owner.js +93 -0
  137. package/src/runs/shared/placement-host.d.ts +99 -0
  138. package/src/runs/shared/placement-host.js +157 -0
  139. package/src/runs/shared/rex-machine.d.ts +25 -0
  140. package/src/runs/shared/rex-machine.js +83 -0
  141. package/src/runs/shared/rex-pane-host.d.ts +62 -0
  142. package/src/runs/shared/rex-pane-host.js +327 -0
  143. package/src/runs/shared/structured-output.d.ts +1 -0
  144. package/src/runs/shared/structured-output.js +1 -0
  145. package/src/shared/accessible-dir.js +4 -1
  146. package/src/shared/completion-owner.d.ts +5 -0
  147. package/src/shared/completion-owner.js +5 -0
  148. package/src/shared/provider-diagnostics.d.ts +9 -0
  149. package/src/shared/provider-diagnostics.js +75 -0
  150. package/src/shared/session-identity.d.ts +2 -0
  151. package/src/shared/session-identity.js +26 -0
  152. package/src/shared/types.d.ts +48 -6
  153. package/src/slash/delegation-adapters.d.ts +3 -1
  154. package/src/slash/delegation-adapters.js +7 -0
  155. package/src/slash/prompt-template-bridge.js +3 -1
  156. package/src/slash/subagents-admin.d.ts +1 -0
  157. package/src/slash/subagents-admin.js +1 -1
  158. package/src/tui/fleet-layout.d.ts +20 -0
  159. package/src/tui/fleet-layout.js +17 -0
  160. package/src/tui/fleet-viewport.d.ts +12 -0
  161. package/src/tui/fleet-viewport.js +35 -0
  162. package/src/tui/fleet.d.ts +6 -6
  163. package/src/tui/fleet.js +93 -66
  164. package/src/tui/render.d.ts +6 -0
  165. package/src/tui/render.js +3 -3
  166. package/src/tui/subagent-messages.js +1 -0
  167. package/src/workflows/scripted-workflow.d.ts +1 -1
  168. package/src/workflows/structured-workflow-scripts.d.ts +1 -0
  169. package/src/workflows/structured-workflow-scripts.js +5 -4
  170. package/src/workflows/workflow-auto-resume.d.ts +32 -0
  171. package/src/workflows/workflow-auto-resume.js +102 -0
  172. package/src/workflows/workflow-launch-record.d.ts +27 -0
  173. package/src/workflows/workflow-launch-record.js +48 -0
  174. package/src/workflows/workflow-resources.js +2 -2
  175. package/src/workflows/workflow-resume-claim.d.ts +82 -0
  176. package/src/workflows/workflow-resume-claim.js +210 -0
  177. package/src/workflows/workflow-resume.d.ts +56 -0
  178. package/src/workflows/workflow-resume.js +106 -0
  179. package/src/workflows/workflow-reuse.d.ts +15 -9
  180. package/src/workflows/workflow-reuse.js +77 -14
  181. package/src/workflows/workflow-revival.d.ts +2 -0
  182. package/src/workflows/workflow-revival.js +2 -1
  183. package/src/workflows/workflow-stop-cause.d.ts +6 -0
  184. package/src/workflows/workflow-stop-cause.js +8 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,72 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.82.0] - 2026-10-24
6
+
7
+ ### Highlights
8
+
9
+ - Background workflows cut off by Pi crashing, quitting or reloading resume where they stopped when you reopen their session, without running finished steps again.
10
+ - Background runs that finished while Pi was closed report their results when you reopen their session, and a foreground run cut off by a crash can be resumed by id.
11
+ - Pi children can run in their own Rex terminal tabs, on this Mac or on another Mac over SSH.
12
+ - After a machine restart, runs that died with it no longer show as running or hold a capacity slot.
13
+ - `/subagents-fleet` shows each child's task next to its agent name, so children of one run are easy to tell apart.
14
+
15
+ ### Added
16
+
17
+ - Background workflows cut off by Pi exiting, crashing or reloading now resume on their own when you reopen or reload their session within a day, and steps that already finished are not run again. You can also resume one yourself with `subagent({ action: "resume", id })`, or set `autoResume: false` to resume them only by hand. A stopped workflow is resumed only once, and its notice says how it resumed. If you start a new Pi in the same folder instead, it tells you which session to reopen. See [docs/workflows.md](docs/workflows.md).
18
+ - `machine: "local"` runs a native Pi child in a new background tab of your own Rex session, with the same controls as a Herdr-placed Pi child: prompts, steering, follow-ups, abort, `contact_supervisor` and results. The launch fails if the parent Pi is not running inside Rex, and Claude Code, Codex, Cursor and generic `external-cli` agents are rejected. A finished child's tab stays open until you close it; an aborted or stopped child's tab is closed. See [docs/agents.md](docs/agents.md#running-a-pi-child-in-a-rex-pane-on-this-machine).
19
+ - A native Pi child can also run in a Rex tab on another Mac over SSH. Name the Mac in your user settings with `subagents.machines.<name>.rex.ssh`, then pass `machine: "<name>"`. The child opens in that Mac's `subagents` Rex session, which is created the first time it is needed. These machines do not need Herdr, and project settings cannot name a Rex host. See [docs/agents.md](docs/agents.md#running-a-pi-child-in-a-rex-pane-on-another-mac).
20
+
21
+ ### Changed
22
+
23
+ - Each background child's row in `/subagents-fleet` now shows its task after the agent name, for example `worker · Fix two Cycode Python SAST findings…`, so you can tell children of one run apart without opening each one. The selected child's header still shows the run id. Thanks to [@MattDavisRV](https://github.com/MattDavisRV) for #3020.
24
+
25
+ ### Fixed
26
+
27
+ - A background run that was still working when Pi exited or crashed never reported its result, even after you reopened its session. Its result now shows once in the reopened session: right away if the run already finished, or as soon as it finishes.
28
+ - A foreground single run cut off by a Pi crash can now be resumed by id. It used to be recorded only when it ended, so nothing pointed to its transcript. It is now recorded when it starts, shows as `interrupted when Pi exited · resume <id>` when its session reopens, and `subagent({ action: "resume", id, message })` continues it from its transcript. Foreground runs remembered by earlier versions are not carried over and can no longer be resumed by id.
29
+ - After Pi crashed or was killed while an async workflow ran, relaunching the same workflow ran every child again. The workflow is now marked `stopCause: "owner-exited"` when its session reopens, or when `options.reuseFrom` names it from another session, and a relaunch reuses the children that already finished, the same as after `/reload`. Its failed result says the Pi process exited. See [docs/workflows.md](docs/workflows.md).
30
+ - A workflow relaunched more than once could start a second copy of a child that was still running, or run a finished child again. A relaunch only looked at the run it reused, and that run had no record of children still waiting for a concurrency slot when it stopped. A relaunch now looks at every earlier run in its relaunch chain and takes each child from the newest run that recorded it. Thanks to [@wireknight](https://github.com/wireknight) for the report on #3021.
31
+ - After a machine restart, a background run or workflow that died with the machine could show as running, and hold its capacity slot, for up to a day, because its old process id could now belong to another process. On Linux and macOS, Pi now saves a boot id next to each process id and treats a process id from an earlier boot as dead. Runs started through a `launcher` are unchanged.
32
+ - A background child awaited by an `async: false` workflow now gets an immediate `contact_supervisor` tool error when it asks a question, because its blocked parent cannot answer. The error tells it to report partial results or use an async workflow. Before, the question could wait until the run deadline and reach the parent after the child had timed out. Async workflows and children that are not awaited still get normal supervisor replies. Thanks to [@XLi-hub](https://github.com/XLi-hub) for #3028 and [@isjiajia01](https://github.com/isjiajia01) for the report in #3018.
33
+ - Agents called `bg_wait` in a loop when it returned early because a run that was still working needed attention, such as a long `bash` command or a quiet stretch. The result now says the run is still running and that `stopOnAttention: false` waits through this, and the option's description says it still stops for supervisor requests. Thanks to [@jettoblack](https://github.com/jettoblack) for #3019.
34
+ - A quoted name in an agent's `tools`, `excludeTools`, `mutationTools`, `extensions` or `subagentOnlyExtensions` list, such as `tools: "read", "bash"` or a `- "read"` list item, is no longer read with its quote marks. A quoted tool name made the child fail to start, and a quoted extension path pointed at a file that doesn't exist. Thanks to [@HerbertGao](https://github.com/HerbertGao) for #3017.
35
+ - An agent whose `tools` list has a Pi `+name` or `-name` entry, such as `tools: +codemode`, now fails before launch with an error that names the agent and the entry. Before, the entry was kept as a literal tool name, so the child required a tool named `+codemode` that no child has, and adding `read` for skills, MCP tools or `structured_output` produced a list that Pi rejects. A Herdr- or Rex-placed child whose agent definition on that machine has such an entry fails the same way before its first prompt. `tools` is a complete list: name every tool the child needs, or omit `tools` and use `excludeTools` to drop one. See [docs/agents.md](docs/agents.md#tool-and-extension-selection). Thanks to [@Nyarlathoteppppp](https://github.com/Nyarlathoteppppp) for #3029.
36
+ - A host-required child extension (`registerRequiredChildExtensions`) is now recognized when Pi loads it through another spelling of its path, such as a symlink, a different letter case, or a path with a Unicode space, so its load, provider-registration and startup failures still stop the launch. A required extension that Pi did not load at all now stops the launch instead of letting the child start without it. Thanks to [@pandalaohe](https://github.com/pandalaohe) for #3012.
37
+ - A child agent's `MEMORY.md` that is a named pipe (FIFO) no longer stalls its launch while the prompt is built; it is skipped like any other file that is not a regular file. Thanks to [@XLi-hub](https://github.com/XLi-hub) for #3027.
38
+ - Skill discovery no longer fails with `ENOTDIR` when a `settings.json` `packages` entry names a single extension file. Thanks to [@tara-marchand](https://github.com/tara-marchand) for #3011.
39
+ - Herdr-placed native Pi children no longer fail before their first prompt. The child's pane bridge looked for its active tools where Pi does not provide them, found none, and rejected every launch.
40
+ - A corrupt saved run status or mission file no longer prints the same warning on every status refresh or retry. The warning prints once, and again only when the file or its outcome changes. The run is still skipped or retried as before, and the file is left as it is. Thanks to [@ozand](https://github.com/ozand) for #3037 and the report in #3036.
41
+ - Updated `undici` from 8.10.2 to 8.12.3, outside the range of [GHSA-xjj6-f33q-929c](https://github.com/advisories/GHSA-xjj6-f33q-929c), so projects that install pi-subagents no longer fail `npm audit` because of it. Thanks to [@setanta00](https://github.com/setanta00) for #3022.
42
+
43
+ ## [0.81.0] - 2026-10-22
44
+
45
+ ### Highlights
46
+
47
+ - Pi starts faster on Windows. pi-subagents now loads from about 30 files instead of about 240, which cut its load time from about 2.0 s to about 1.1 s on a Windows machine with Defender.
48
+ - Pi no longer freezes for about 8 seconds on every Windows start when the subagent temp folder has broken permissions.
49
+ - A child with an `outputSchema` that forgets to call `structured_output` gets one more turn to call it instead of failing and losing its work.
50
+ - The parent model can tell subagent notices apart from text you typed.
51
+ - In fullscreen FleetView you can click a child to select it and scroll its output with the mouse wheel or trackpad.
52
+
53
+ ### Added
54
+
55
+ - In fullscreen mode, the FleetView inspector now selects a child when you click its roster row and scrolls the output pane with the mouse wheel or trackpad, without scrolling the conversation behind it. Keyboard controls are unchanged. Thanks to [@IdrisGit](https://github.com/IdrisGit) for #2992.
56
+ - Structured delegation `:update` and `:response` events now carry an optional `providerDiagnostics` field, so a host extension can tell a child stuck in provider retry backoff (for example HTTP 429) from a long model turn. It reports the count and kind of failed requests and Pi's current retry phase, never the raw provider error. See [docs/extension-api.md](docs/extension-api.md). Thanks to [@IdrisGit](https://github.com/IdrisGit) for #2999 and [@legendtang](https://github.com/legendtang) for [#2991](https://github.com/nicobailon/pi-subagents/issues/2991).
57
+
58
+ ### Changed
59
+
60
+ - A native Pi child with an `outputSchema` that ends its run without calling `structured_output` now gets one follow-up turn in the same session asking it to call `structured_output` without repeating the work. Before, the run failed at once with "Missing structured_output call" and all of the child's work was lost. If the child still does not call it, the run fails with the same error as before. The extra turn counts toward the run's usage and is still bounded by the run's timeout. A call that `structured_output` rejects does not get this turn, because the tool already returns the validation error to the child. Thanks to [@legendtang](https://github.com/legendtang) for [#2997](https://github.com/nicobailon/pi-subagents/issues/2997).
61
+ - When the `parallel` workflow's args or tasks, a `tasks` item, or a chain step include `worktree` or another setting that only works for the whole call, the error now says to put it on the `subagent` call itself, where it applies to every child. The tool description is unchanged, so ordinary requests use no extra tokens. Thanks to [@jinglebiscuits](https://github.com/jinglebiscuits) for [#3009](https://github.com/nicobailon/pi-subagents/issues/3009) and #3010.
62
+
63
+ ### Fixed
64
+
65
+ - Loading pi-subagents at Pi startup took 0.3 to 2.7 s on Windows, because Pi loaded about 240 separate files and Windows security software scanned each one. The npm package now ships the extension and its subpath exports as a bundle of about 30 files. On a Windows machine with Defender, loading drops from about 2.0 s to about 1.1 s; on macOS it is about 8% faster. Child processes still run from the unbundled files, and the subagent executor still loads after startup. The unpacked package grows from 6.9 MB to 10.8 MB. Thanks to [@kiote](https://github.com/kiote) for #3006, and to [@tututuhehehe](https://github.com/tututuhehehe) and [@localhedge](https://github.com/localhedge) for the measurements in [#2980](https://github.com/nicobailon/pi-subagents/issues/2980).
66
+ - On Windows, Pi could freeze for about 8 seconds on every start when the subagent temp results folder had broken permissions (`EPERM`/`EACCES`), because the startup check kept retrying before it switched to a fallback folder. The startup check now gives up after at most 85 ms per operation; result writes and other file operations keep their full retries. Thanks to [@821869798](https://github.com/821869798) for [#2998](https://github.com/nicobailon/pi-subagents/issues/2998).
67
+ - The parent model can now tell subagent notices from text you typed. Pi sends extension messages to the model as ordinary user messages, so a completion notice that started a turn on its own looked like a user request. pi-subagents notices the model sees, including completion and supervisor notices, wait results and `/run` results, are now wrapped in a `<pi_subagents_notice>` tag that names the message type and says it is an automated message from pi-subagents. Only the model request changes; the stored transcript and the chat view stay the same. Thanks to [@ktheunlikedoll](https://github.com/ktheunlikedoll) for [#2994](https://github.com/nicobailon/pi-subagents/issues/2994) and [@isjiajia01](https://github.com/isjiajia01) for the context-hook approach.
68
+ - YAML comments in agent frontmatter lists changed the parsed values. An indented `# note` in a `tools:` list became a tool name, a column-zero comment dropped every item after it, and a trailing `# why` stayed on a `- item` line. Comments are now ignored in frontmatter lists; `#` inside quoted values and `|`/`>` block scalars is kept. Thanks to [@builtroller](https://github.com/builtroller) for [#2995](https://github.com/nicobailon/pi-subagents/issues/2995).
69
+ - When a workflow child's process died without writing a result, `mission.show` listed that child as failed in the mission's runs but still running in its workflow children. The failed result recorded for the dead child now keeps its workflow id and key, so the mission marks it failed in both places. Thanks to [@isjiajia01](https://github.com/isjiajia01) for [#3005](https://github.com/nicobailon/pi-subagents/issues/3005).
70
+
5
71
  ## [0.80.0] - 2026-10-21
6
72
 
7
73
  ### Highlights
@@ -0,0 +1,18 @@
1
+ import {
2
+ RUNTIME_AGENT_REGISTER_EVENT,
3
+ RUNTIME_AGENT_REGISTER_VERSION,
4
+ registerAgentViaEvents
5
+ } from "./chunk-43SCHIMD.js";
6
+ import {
7
+ registerRuntimeAgent
8
+ } from "./chunk-YKEWIB4M.js";
9
+ import "./chunk-CIZQXJ5Q.js";
10
+ import "./chunk-5LFLVSTM.js";
11
+ import "./chunk-YFCK7H2S.js";
12
+ import "./chunk-Z7KVHQHL.js";
13
+ export {
14
+ RUNTIME_AGENT_REGISTER_EVENT,
15
+ RUNTIME_AGENT_REGISTER_VERSION,
16
+ registerRuntimeAgent as registerAgent,
17
+ registerAgentViaEvents
18
+ };
@@ -0,0 +1,16 @@
1
+ import {
2
+ BACKGROUND_WORK_PROTOCOL_VERSION,
3
+ BACKGROUND_WORK_REGISTRY_KEY,
4
+ listBackgroundWorkProviders,
5
+ listBackgroundWorkWakeChannels,
6
+ registerBackgroundWorkProvider,
7
+ snapshotBackgroundWork
8
+ } from "./chunk-N2BN7BF5.js";
9
+ export {
10
+ BACKGROUND_WORK_PROTOCOL_VERSION,
11
+ BACKGROUND_WORK_REGISTRY_KEY,
12
+ listBackgroundWorkProviders,
13
+ listBackgroundWorkWakeChannels,
14
+ registerBackgroundWorkProvider,
15
+ snapshotBackgroundWork
16
+ };
@@ -0,0 +1,22 @@
1
+ import {
2
+ SUBAGENT_CAPABILITY_CEILING_REGISTRY_KEY,
3
+ SUBAGENT_CAPABILITY_CEILING_VERSION,
4
+ decodeSubagentCapabilityCeiling,
5
+ encodeSubagentCapabilityCeiling,
6
+ intersectSubagentCapabilityCeilings,
7
+ parseSubagentCapabilityCeiling,
8
+ registerSubagentCapabilityCeiling,
9
+ resolveCurrentSubagentCapabilityCeiling,
10
+ resolveSubagentCapabilityCeiling
11
+ } from "./chunk-Z7KVHQHL.js";
12
+ export {
13
+ SUBAGENT_CAPABILITY_CEILING_REGISTRY_KEY,
14
+ SUBAGENT_CAPABILITY_CEILING_VERSION,
15
+ decodeSubagentCapabilityCeiling,
16
+ encodeSubagentCapabilityCeiling,
17
+ intersectSubagentCapabilityCeilings,
18
+ parseSubagentCapabilityCeiling,
19
+ registerSubagentCapabilityCeiling,
20
+ resolveCurrentSubagentCapabilityCeiling,
21
+ resolveSubagentCapabilityCeiling
22
+ };
@@ -0,0 +1,11 @@
1
+ import {
2
+ resolvePiLaunchToolPlan
3
+ } from "./chunk-4SDU2BZX.js";
4
+ import "./chunk-CTPAE36Y.js";
5
+ import "./chunk-CIZQXJ5Q.js";
6
+ import "./chunk-5LFLVSTM.js";
7
+ import "./chunk-YFCK7H2S.js";
8
+ import "./chunk-Z7KVHQHL.js";
9
+ export {
10
+ resolvePiLaunchToolPlan
11
+ };
@@ -0,0 +1,57 @@
1
+ import {
2
+ registerRuntimeAgent
3
+ } from "./chunk-YKEWIB4M.js";
4
+
5
+ // src/agents/runtime-agent-events.ts
6
+ var RUNTIME_AGENT_REGISTER_EVENT = "pi-subagents:runtime-agent-register:v1";
7
+ var RUNTIME_AGENT_REGISTER_VERSION = 1;
8
+ function errorFrom(value) {
9
+ return value instanceof Error ? value : new Error(String(value));
10
+ }
11
+ function registerAgentViaEvents(input) {
12
+ const request = {
13
+ version: RUNTIME_AGENT_REGISTER_VERSION,
14
+ name: input.name,
15
+ definition: input.definition
16
+ };
17
+ input.pi.events.emit(RUNTIME_AGENT_REGISTER_EVENT, request);
18
+ const result = request.result;
19
+ if (result === void 0) {
20
+ throw new Error("pi-subagents is not installed, not ready, or does not support runtime agent event registration.");
21
+ }
22
+ if (result && typeof result === "object" && !Array.isArray(result)) {
23
+ const candidate = result;
24
+ if (candidate.ok === true && candidate.registration && typeof candidate.registration === "object" && typeof candidate.registration.dispose === "function") {
25
+ return candidate.registration;
26
+ }
27
+ if (candidate.ok === false && candidate.error instanceof Error) throw candidate.error;
28
+ }
29
+ throw new Error("pi-subagents returned a malformed runtime agent registration result.");
30
+ }
31
+ function registerRuntimeAgentEventListener(pi) {
32
+ return pi.events.on(RUNTIME_AGENT_REGISTER_EVENT, (rawRequest) => {
33
+ if (!rawRequest || typeof rawRequest !== "object" || Array.isArray(rawRequest)) return;
34
+ const request = rawRequest;
35
+ if (request.result !== void 0) return;
36
+ try {
37
+ if (request.version !== RUNTIME_AGENT_REGISTER_VERSION) {
38
+ throw new Error(`Unsupported runtime agent registration event version '${String(request.version)}'.`);
39
+ }
40
+ const registration = registerRuntimeAgent({
41
+ pi,
42
+ name: request.name,
43
+ definition: request.definition
44
+ });
45
+ request.result = { ok: true, registration };
46
+ } catch (error) {
47
+ request.result = { ok: false, error: errorFrom(error) };
48
+ }
49
+ });
50
+ }
51
+
52
+ export {
53
+ RUNTIME_AGENT_REGISTER_EVENT,
54
+ RUNTIME_AGENT_REGISTER_VERSION,
55
+ registerAgentViaEvents,
56
+ registerRuntimeAgentEventListener
57
+ };
@@ -0,0 +1,57 @@
1
+ // src/runs/shared/herdr-pi-protocol.ts
2
+ var HERDR_PI_PROTOCOL = 1;
3
+ var HERDR_PI_MAX_FRAME_BYTES = 1024 * 1024;
4
+ var HERDR_PI_MODE_ENV = "PI_SUBAGENTS_HERDR_BRIDGE";
5
+ var HERDR_PI_RUN_ENV = "PI_SUBAGENTS_HERDR_RUN_ID";
6
+ var HERDR_PI_RUNTIME_DIR_ENV = "PI_SUBAGENTS_HERDR_RUNTIME_DIR";
7
+ var SAFE_ID = /^[A-Za-z0-9_-]{8,96}$/u;
8
+ function validateHerdrPiRunId(value) {
9
+ if (typeof value !== "string" || !SAFE_ID.test(value)) throw new Error("Herdr Pi bridge run identity is invalid.");
10
+ return value;
11
+ }
12
+ function encodeHerdrPiFrame(frame) {
13
+ const data = Buffer.from(`${JSON.stringify(frame)}
14
+ `, "utf8");
15
+ if (data.byteLength > HERDR_PI_MAX_FRAME_BYTES) throw new Error(`Herdr Pi frame exceeds ${HERDR_PI_MAX_FRAME_BYTES} bytes.`);
16
+ return data;
17
+ }
18
+ var HerdrPiFrameDecoder = class {
19
+ #buffer = Buffer.alloc(0);
20
+ push(chunk) {
21
+ this.#buffer = Buffer.concat([this.#buffer, chunk]);
22
+ if (this.#buffer.byteLength > HERDR_PI_MAX_FRAME_BYTES) throw new Error(`Herdr Pi frame exceeds ${HERDR_PI_MAX_FRAME_BYTES} bytes.`);
23
+ const frames = [];
24
+ for (; ; ) {
25
+ const newline = this.#buffer.indexOf(10);
26
+ if (newline < 0) break;
27
+ const line = this.#buffer.subarray(0, newline);
28
+ this.#buffer = this.#buffer.subarray(newline + 1);
29
+ let value;
30
+ try {
31
+ value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(line));
32
+ } catch {
33
+ throw new Error("Herdr Pi bridge emitted malformed JSON or UTF-8.");
34
+ }
35
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("Herdr Pi bridge frame must be an object.");
36
+ const frame = value;
37
+ if (frame.protocol !== HERDR_PI_PROTOCOL || typeof frame.type !== "string") throw new Error("Herdr Pi bridge protocol mismatch.");
38
+ validateHerdrPiRunId(frame.runId);
39
+ frames.push(frame);
40
+ }
41
+ return frames;
42
+ }
43
+ end() {
44
+ if (this.#buffer.byteLength) throw new Error("Herdr Pi bridge ended with a partial frame.");
45
+ }
46
+ };
47
+
48
+ export {
49
+ HERDR_PI_PROTOCOL,
50
+ HERDR_PI_MAX_FRAME_BYTES,
51
+ HERDR_PI_MODE_ENV,
52
+ HERDR_PI_RUN_ENV,
53
+ HERDR_PI_RUNTIME_DIR_ENV,
54
+ validateHerdrPiRunId,
55
+ encodeHerdrPiFrame,
56
+ HerdrPiFrameDecoder
57
+ };