@vicary/pi-subagents 0.84.0 → 0.85.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 (207) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +2 -2
  4. package/bundle/{chunk-F4ASL6OV.js → chunk-7MAE3DJV.js} +1 -1
  5. package/bundle/{chunk-7BWGNDNK.js → chunk-A7VJ5XXE.js} +196 -1183
  6. package/bundle/{chunk-DZDETGRJ.js → chunk-B3OOJJA6.js} +231 -182
  7. package/bundle/{chunk-4E7BKDTX.js → chunk-CS4O36CZ.js} +11 -156
  8. package/bundle/{chunk-G2Z6ZH26.js → chunk-GCSLVFCX.js} +1 -1
  9. package/bundle/{chunk-2S4K53MV.js → chunk-H2NLFTC5.js} +1 -1
  10. package/bundle/{chunk-NKQ6JNAS.js → chunk-HFTBF7SG.js} +2 -1
  11. package/bundle/{chunk-XDQORLZ5.js → chunk-HS4WPO6B.js} +15 -6
  12. package/bundle/chunk-HXRB42AF.js +108 -0
  13. package/bundle/{chunk-4NIY3BE6.js → chunk-JHBQ7N2L.js} +2 -2
  14. package/bundle/{chunk-J5YL7LYR.js → chunk-JO67XSKD.js} +59 -27
  15. package/bundle/{chunk-C5P5CHYK.js → chunk-KDMFBYFM.js} +1 -1
  16. package/bundle/{chunk-V2BZYLEP.js → chunk-KEY3UQMQ.js} +7 -2
  17. package/bundle/{chunk-NENDSQUY.js → chunk-KZ34KQQH.js} +9 -6
  18. package/bundle/{chunk-AKOIVLA5.js → chunk-L2ENOFVZ.js} +76 -58
  19. package/bundle/{chunk-CGN2TVE7.js → chunk-LGMILZNE.js} +322 -18
  20. package/bundle/{chunk-L3WFKBEI.js → chunk-LTPH2DXH.js} +247 -153
  21. package/bundle/{chunk-2D52JFLF.js → chunk-N7B2KD74.js} +41 -117
  22. package/bundle/{chunk-PV63UFUR.js → chunk-O7CPL6H4.js} +183 -28
  23. package/bundle/{chunk-D3JAFGMO.js → chunk-PHZP3KHB.js} +1 -1
  24. package/bundle/{chunk-2DHZTCOL.js → chunk-PVIVCDG2.js} +2 -2
  25. package/bundle/{chunk-LFDBD4PW.js → chunk-QO75KJBT.js} +2 -2
  26. package/bundle/{chunk-VQVVHSY6.js → chunk-QZL2ZZPM.js} +22 -11
  27. package/bundle/{chunk-PALJGGYC.js → chunk-RV5OGHLO.js} +6 -3
  28. package/bundle/chunk-T5V5BRCL.js +1067 -0
  29. package/bundle/{chunk-LNRJCP2Y.js → chunk-UX4SCV5N.js} +337 -207
  30. package/bundle/{chunk-RWPNQZHS.js → chunk-VEZMZDTW.js} +212 -102
  31. package/bundle/{chunk-RSLHTEQV.js → chunk-YZBCREP5.js} +310 -101
  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 +8 -8
  36. package/bundle/project-panes.js +3 -3
  37. package/docs/agents.md +18 -3
  38. package/docs/configuration.md +7 -7
  39. package/docs/extension-api.md +16 -1
  40. package/docs/observability.md +1 -1
  41. package/docs/tool-reference.md +1 -1
  42. package/docs/workflows.md +31 -3
  43. package/package.json +2 -2
  44. package/src/agents/agent-management.js +27 -11
  45. package/src/agents/agent-memory.d.ts +1 -4
  46. package/src/agents/agent-memory.js +1 -4
  47. package/src/agents/agents.d.ts +1 -3
  48. package/src/agents/agents.js +7 -6
  49. package/src/agents/frontmatter.js +1 -8
  50. package/src/agents/global-npm-root.d.ts +1 -0
  51. package/src/agents/global-npm-root.js +11 -3
  52. package/src/agents/skills.d.ts +0 -3
  53. package/src/agents/skills.js +0 -3
  54. package/src/extension/config.js +7 -1
  55. package/src/extension/herdr-pi-bridge.js +10 -2
  56. package/src/extension/index.d.ts +0 -13
  57. package/src/extension/index.js +43 -32
  58. package/src/extension/public-execution.d.ts +1 -0
  59. package/src/extension/public-execution.js +4 -0
  60. package/src/extension/reply-workflow-script.js +24 -4
  61. package/src/extension/schemas.d.ts +8 -3
  62. package/src/extension/schemas.js +6 -4
  63. package/src/extension/session-switch.d.ts +25 -0
  64. package/src/extension/session-switch.js +138 -0
  65. package/src/extension/subagent-guide.d.ts +1 -1
  66. package/src/extension/subagent-guide.js +1 -1
  67. package/src/extension/subagent-launch-tool.d.ts +25 -0
  68. package/src/extension/subagent-launch-tool.js +48 -0
  69. package/src/extension/tool-activation.js +25 -11
  70. package/src/extension/tool-description.js +6 -0
  71. package/src/inspectors/herdr/actions.d.ts +0 -1
  72. package/src/inspectors/herdr/actions.js +0 -1
  73. package/src/inspectors/session-roots-codec.d.ts +0 -1
  74. package/src/inspectors/session-roots-codec.js +0 -1
  75. package/src/inspectors/tmux/actions.d.ts +0 -1
  76. package/src/inspectors/tmux/actions.js +0 -1
  77. package/src/integrations/herdr-status.js +3 -8
  78. package/src/intercom/native-supervisor-channel.js +65 -9
  79. package/src/runs/background/async-execution.d.ts +5 -10
  80. package/src/runs/background/async-execution.js +63 -29
  81. package/src/runs/background/async-job-tracker.js +12 -0
  82. package/src/runs/background/async-resume.d.ts +2 -1
  83. package/src/runs/background/async-resume.js +112 -39
  84. package/src/runs/background/async-retention.js +6 -1
  85. package/src/runs/background/auto-drain.d.ts +0 -1
  86. package/src/runs/background/auto-drain.js +7 -6
  87. package/src/runs/background/boot-id.d.ts +1 -3
  88. package/src/runs/background/boot-id.js +1 -3
  89. package/src/runs/background/completion-batcher.d.ts +3 -4
  90. package/src/runs/background/completion-batcher.js +2 -3
  91. package/src/runs/background/control-channel.d.ts +0 -6
  92. package/src/runs/background/control-channel.js +0 -6
  93. package/src/runs/background/fleet-view.js +2 -3
  94. package/src/runs/background/notify.d.ts +0 -2
  95. package/src/runs/background/notify.js +0 -2
  96. package/src/runs/background/result-watcher.d.ts +1 -0
  97. package/src/runs/background/result-watcher.js +59 -29
  98. package/src/runs/background/resume-guidance.js +4 -2
  99. package/src/runs/background/retained-children.js +2 -1
  100. package/src/runs/background/run-child-session.d.ts +0 -1
  101. package/src/runs/background/run-child-session.js +1 -1
  102. package/src/runs/background/run-status.js +4 -3
  103. package/src/runs/background/scheduled-runs.d.ts +3 -1
  104. package/src/runs/background/scheduled-runs.js +13 -16
  105. package/src/runs/background/subagent-runner.d.ts +2 -4
  106. package/src/runs/background/subagent-runner.js +9 -6
  107. package/src/runs/background/subagent-wait.js +12 -15
  108. package/src/runs/background/wait-config.d.ts +2 -0
  109. package/src/runs/background/wait-config.js +17 -3
  110. package/src/runs/background/wait-tool.js +4 -2
  111. package/src/runs/background/workflow-terminal-proof.d.ts +0 -1
  112. package/src/runs/background/workflow-terminal-proof.js +0 -1
  113. package/src/runs/foreground/execution.d.ts +0 -3
  114. package/src/runs/foreground/execution.js +17 -9
  115. package/src/runs/foreground/subagent-executor.d.ts +7 -8
  116. package/src/runs/foreground/subagent-executor.js +113 -44
  117. package/src/runs/shared/child-commands.js +15 -2
  118. package/src/runs/shared/child-hooks.d.ts +1 -7
  119. package/src/runs/shared/child-hooks.js +13 -5
  120. package/src/runs/shared/child-launch.js +6 -2
  121. package/src/runs/shared/child-runtime-config.d.ts +0 -1
  122. package/src/runs/shared/child-session.d.ts +1 -1
  123. package/src/runs/shared/child-session.js +21 -2
  124. package/src/runs/shared/child-tool-plan.d.ts +0 -1
  125. package/src/runs/shared/child-tool-plan.js +0 -1
  126. package/src/runs/shared/claude-code-adapter.js +11 -0
  127. package/src/runs/shared/external-cli-runner.js +26 -6
  128. package/src/runs/shared/herdr-connection.js +2 -1
  129. package/src/runs/shared/herdr-pane-host.d.ts +2 -2
  130. package/src/runs/shared/herdr-pane-host.js +17 -1
  131. package/src/runs/shared/herdr-placed-run.js +48 -22
  132. package/src/runs/shared/lane-metadata.d.ts +0 -1
  133. package/src/runs/shared/lane-metadata.js +0 -1
  134. package/src/runs/shared/mcp-direct-tool-grant.js +8 -1
  135. package/src/runs/shared/model-resolution-diagnostic.d.ts +0 -1
  136. package/src/runs/shared/model-resolution.d.ts +2 -2
  137. package/src/runs/shared/model-resolution.js +7 -1
  138. package/src/runs/shared/model-scope.d.ts +1 -5
  139. package/src/runs/shared/model-scope.js +1 -5
  140. package/src/runs/shared/mutation-evidence.d.ts +1 -1
  141. package/src/runs/shared/mutation-evidence.js +52 -7
  142. package/src/runs/shared/nested-events.d.ts +1 -0
  143. package/src/runs/shared/nested-events.js +1 -1
  144. package/src/runs/shared/parallel-utils.d.ts +0 -1
  145. package/src/runs/shared/permissions.js +5 -3
  146. package/src/runs/shared/placement-host.d.ts +5 -1
  147. package/src/runs/shared/rex-pane-host.d.ts +0 -1
  148. package/src/runs/shared/rex-pane-host.js +0 -2
  149. package/src/runs/shared/run-launch-folder.d.ts +12 -0
  150. package/src/runs/shared/run-launch-folder.js +21 -0
  151. package/src/runs/shared/runner-launcher.d.ts +12 -1
  152. package/src/runs/shared/runner-launcher.js +16 -0
  153. package/src/runs/shared/single-output.d.ts +3 -3
  154. package/src/runs/shared/single-output.js +5 -3
  155. package/src/runs/shared/structured-output.d.ts +8 -0
  156. package/src/runs/shared/structured-output.js +30 -2
  157. package/src/runs/shared/subagent-prompt-runtime.d.ts +0 -1
  158. package/src/runs/shared/subagent-prompt-runtime.js +4 -2
  159. package/src/runs/shared/tool-timeout.js +2 -1
  160. package/src/runs/shared/worktree-cleanup-plan.d.ts +0 -1
  161. package/src/runs/shared/worktree-cleanup-plan.js +0 -1
  162. package/src/runs/shared/worktree.d.ts +3 -0
  163. package/src/runs/shared/worktree.js +20 -0
  164. package/src/shared/capacity-resilient-json.d.ts +1 -1
  165. package/src/shared/child-cache-retention.d.ts +1 -2
  166. package/src/shared/child-cache-retention.js +1 -2
  167. package/src/shared/fleet-transcript-reader.d.ts +51 -0
  168. package/src/shared/fleet-transcript-reader.js +333 -0
  169. package/src/shared/formatters.d.ts +0 -18
  170. package/src/shared/formatters.js +0 -18
  171. package/src/shared/session-succession.d.ts +16 -1
  172. package/src/shared/session-succession.js +41 -2
  173. package/src/shared/session-warnings.d.ts +7 -0
  174. package/src/shared/session-warnings.js +26 -0
  175. package/src/shared/settings.d.ts +0 -23
  176. package/src/shared/settings.js +3 -35
  177. package/src/shared/types.d.ts +33 -17
  178. package/src/shared/types.js +0 -12
  179. package/src/shared/utils.d.ts +0 -14
  180. package/src/shared/utils.js +0 -22
  181. package/src/shared/wait-tool-name.d.ts +8 -0
  182. package/src/shared/wait-tool-name.js +13 -0
  183. package/src/slash/slash-commands.js +2 -1
  184. package/src/slash/subagent-cost.d.ts +3 -2
  185. package/src/slash/subagent-cost.js +22 -3
  186. package/src/slash/subagents-admin.js +0 -1
  187. package/src/tui/fleet-status.d.ts +0 -5
  188. package/src/tui/fleet-status.js +4 -24
  189. package/src/tui/fleet-transcript.d.ts +1 -44
  190. package/src/tui/fleet-transcript.js +1 -327
  191. package/src/tui/fleet.js +6 -4
  192. package/src/tui/render.d.ts +0 -9
  193. package/src/tui/render.js +81 -47
  194. package/src/tui/subagent-messages.js +3 -2
  195. package/src/watchdog/register-child.d.ts +2 -3
  196. package/src/watchdog/register-child.js +2 -3
  197. package/src/watchdog/turn-delta.js +2 -1
  198. package/src/workflows/scripted-workflow.js +241 -20
  199. package/src/workflows/workflow-launch-record.d.ts +15 -6
  200. package/src/workflows/workflow-launch-record.js +30 -12
  201. package/src/workflows/workflow-resume-claim.js +2 -2
  202. package/src/workflows/workflow-resume.d.ts +1 -1
  203. package/src/workflows/workflow-resume.js +11 -8
  204. package/src/workflows/workflow-script-worker.d.ts +13 -0
  205. package/src/workflows/workflow-script-worker.js +79 -0
  206. package/workflow-script-process.cjs +36 -0
  207. package/workflow-script-worker.cjs +4 -1
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ const { Worker } = require("node:worker_threads");
4
+ const { join } = require("node:path");
5
+
6
+ // Windows process creation adds a standard environment even when fork receives an empty one.
7
+ for (const key of Object.keys(process.env)) {
8
+ if (process.platform !== "win32" || key.toLowerCase() !== "systemroot") delete process.env[key];
9
+ }
10
+
11
+ // Keep IPC on this thread: a busy workflow must not prevent parent-disconnect cleanup.
12
+ // The script thread has no worker permission; filesystem grants are inherited from the process.
13
+ const worker = new Worker(join(__dirname, "workflow-script-worker.cjs"), {
14
+ workerData: { acornPath: process.argv[2] },
15
+ execArgv: process.execArgv.filter((arg) => arg !== "--allow-worker"),
16
+ });
17
+
18
+ function fail(error) {
19
+ if (!process.connected) return process.exit(1);
20
+ process.send(JSON.stringify({ type: "error", errorKind: "runtime", error: String(error?.message ?? error) }), () => process.exit(1));
21
+ }
22
+
23
+ process.on("disconnect", () => process.exit(0));
24
+ process.on("message", (json) => {
25
+ try {
26
+ if (typeof json !== "string") throw new Error("Workflow process received a non-string IPC message.");
27
+ worker.postMessage(JSON.parse(json));
28
+ } catch (error) { fail(error); }
29
+ });
30
+ worker.on("message", (message) => {
31
+ try {
32
+ process.send(JSON.stringify(message), (error) => { if (error) process.exit(1); });
33
+ } catch (error) { fail(error); }
34
+ });
35
+ worker.on("error", fail);
36
+ worker.on("exit", (code) => fail(new Error(`Workflow script thread exited before returning a result (code ${code}).`)));
@@ -703,7 +703,10 @@ function describeGateAcceptanceConflict(gate, acceptance) {
703
703
  }
704
704
 
705
705
  function validateRunCall(key, params, label, fingerprints) {
706
- if (typeof key !== "string" || !runKeyPattern.test(key)) throw new Error(label + " has an invalid key.");
706
+ if (typeof key !== "string" || !runKeyPattern.test(key)) {
707
+ const problem = key === undefined ? " has no key" : typeof key === "string" ? " has an invalid key '" + (key.length > 80 ? key.slice(0, 80) + "..." : key) + "'" : " has a key of type " + (key === null ? "null" : typeof key);
708
+ throw new Error(label + problem + "; keys must be 1-128 characters using letters, numbers, '.', '_' or '-', and start with a letter or number.");
709
+ }
707
710
  if (hostKeys.has(key)) throw new Error("Workflow key '" + key + "' is already used by runs.host.");
708
711
  if (!params || typeof params !== "object" || Array.isArray(params)) throw new Error(label + " requires a params object.");
709
712
  if (Object.prototype.hasOwnProperty.call(params, "action") || Object.prototype.hasOwnProperty.call(params, "workflowScript") || Object.prototype.hasOwnProperty.call(params, "globalConcurrencyLimit") || Object.prototype.hasOwnProperty.call(params, "maxSubagentSpawnsPerRun") || Object.prototype.hasOwnProperty.call(params, "tasks") || Object.prototype.hasOwnProperty.call(params, "chain") || Object.prototype.hasOwnProperty.call(params, "parallel") || Object.prototype.hasOwnProperty.call(params, "concurrency") || Object.prototype.hasOwnProperty.call(params, "chainDir")) {