@elizaos/plugin-agent-orchestrator 2.0.0-alpha.8 → 2.0.0-beta.1

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 (265) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/LICENSE +21 -0
  3. package/PROJECT.md +119 -0
  4. package/README.md +160 -0
  5. package/dist/browser/index.browser.js +21051 -0
  6. package/dist/browser/index.browser.js.map +29 -0
  7. package/dist/browser/index.d.ts +2 -0
  8. package/dist/cjs/index.d.ts +2 -0
  9. package/dist/cjs/index.node.cjs +20491 -0
  10. package/dist/cjs/index.node.js.map +72 -0
  11. package/dist/index.d.ts +2 -21
  12. package/dist/node/index.browser.d.ts +3 -0
  13. package/dist/node/index.browser.d.ts.map +1 -0
  14. package/dist/node/index.d.ts +2 -0
  15. package/dist/node/index.d.ts.map +1 -0
  16. package/dist/node/index.node.d.ts +4 -0
  17. package/dist/node/index.node.d.ts.map +1 -0
  18. package/dist/node/index.node.js +20471 -0
  19. package/dist/node/index.node.js.map +72 -0
  20. package/dist/node/src/actions/cancel-task.d.ts +3 -0
  21. package/dist/node/src/actions/cancel-task.d.ts.map +1 -0
  22. package/dist/node/src/actions/coding-task-handlers.d.ts +69 -0
  23. package/dist/node/src/actions/coding-task-handlers.d.ts.map +1 -0
  24. package/dist/node/src/actions/coding-task-helpers.d.ts +35 -0
  25. package/dist/node/src/actions/coding-task-helpers.d.ts.map +1 -0
  26. package/dist/node/src/actions/common.d.ts +56 -0
  27. package/dist/node/src/actions/common.d.ts.map +1 -0
  28. package/dist/node/src/actions/create-task.d.ts +8 -0
  29. package/dist/node/src/actions/create-task.d.ts.map +1 -0
  30. package/dist/node/src/actions/eval-metadata.d.ts +11 -0
  31. package/dist/node/src/actions/eval-metadata.d.ts.map +1 -0
  32. package/dist/node/src/actions/finalize-workspace.d.ts +11 -0
  33. package/dist/node/src/actions/finalize-workspace.d.ts.map +1 -0
  34. package/dist/node/src/actions/list-agents.d.ts +4 -0
  35. package/dist/node/src/actions/list-agents.d.ts.map +1 -0
  36. package/dist/node/src/actions/manage-issues.d.ts +11 -0
  37. package/dist/node/src/actions/manage-issues.d.ts.map +1 -0
  38. package/dist/node/src/actions/provision-workspace.d.ts +11 -0
  39. package/dist/node/src/actions/provision-workspace.d.ts.map +1 -0
  40. package/dist/node/src/actions/sandbox-stub.d.ts +21 -0
  41. package/dist/node/src/actions/sandbox-stub.d.ts.map +1 -0
  42. package/dist/node/src/actions/send-to-agent.d.ts +4 -0
  43. package/dist/node/src/actions/send-to-agent.d.ts.map +1 -0
  44. package/dist/node/src/actions/spawn-agent.d.ts +8 -0
  45. package/dist/node/src/actions/spawn-agent.d.ts.map +1 -0
  46. package/dist/node/src/actions/stop-agent.d.ts +4 -0
  47. package/dist/node/src/actions/stop-agent.d.ts.map +1 -0
  48. package/dist/node/src/actions/task-control.d.ts +3 -0
  49. package/dist/node/src/actions/task-control.d.ts.map +1 -0
  50. package/dist/node/src/actions/task-history.d.ts +3 -0
  51. package/dist/node/src/actions/task-history.d.ts.map +1 -0
  52. package/dist/node/src/actions/task-share.d.ts +3 -0
  53. package/dist/node/src/actions/task-share.d.ts.map +1 -0
  54. package/dist/node/src/actions/task-thread-target.d.ts +11 -0
  55. package/dist/node/src/actions/task-thread-target.d.ts.map +1 -0
  56. package/dist/node/src/actions/tasks.d.ts +88 -0
  57. package/dist/node/src/actions/tasks.d.ts.map +1 -0
  58. package/dist/node/src/api/agent-routes.d.ts +18 -0
  59. package/dist/node/src/api/agent-routes.d.ts.map +1 -0
  60. package/dist/node/src/api/bridge-routes.d.ts +32 -0
  61. package/dist/node/src/api/bridge-routes.d.ts.map +1 -0
  62. package/dist/node/src/api/coordinator-routes.d.ts +22 -0
  63. package/dist/node/src/api/coordinator-routes.d.ts.map +1 -0
  64. package/dist/node/src/api/hook-routes.d.ts +18 -0
  65. package/dist/node/src/api/hook-routes.d.ts.map +1 -0
  66. package/dist/node/src/api/issue-routes.d.ts +17 -0
  67. package/dist/node/src/api/issue-routes.d.ts.map +1 -0
  68. package/dist/node/src/api/parent-context-routes.d.ts +17 -0
  69. package/dist/node/src/api/parent-context-routes.d.ts.map +1 -0
  70. package/dist/node/src/api/route-utils.d.ts +18 -0
  71. package/dist/node/src/api/route-utils.d.ts.map +1 -0
  72. package/dist/node/src/api/routes.d.ts +23 -0
  73. package/dist/node/src/api/routes.d.ts.map +1 -0
  74. package/dist/node/src/api/workspace-routes.d.ts +17 -0
  75. package/dist/node/src/api/workspace-routes.d.ts.map +1 -0
  76. package/dist/node/src/index.d.ts +32 -0
  77. package/dist/node/src/index.d.ts.map +1 -0
  78. package/dist/node/src/providers/action-examples.d.ts +14 -0
  79. package/dist/node/src/providers/action-examples.d.ts.map +1 -0
  80. package/dist/node/src/providers/active-sub-agents.d.ts +15 -0
  81. package/dist/node/src/providers/active-sub-agents.d.ts.map +1 -0
  82. package/dist/node/src/providers/active-workspace-context.d.ts +13 -0
  83. package/dist/node/src/providers/active-workspace-context.d.ts.map +1 -0
  84. package/dist/node/src/providers/available-agents.d.ts +4 -0
  85. package/dist/node/src/providers/available-agents.d.ts.map +1 -0
  86. package/dist/node/src/register-routes.d.ts +11 -0
  87. package/dist/node/src/register-routes.d.ts.map +1 -0
  88. package/dist/node/src/routes/coding-agents-fallback-routes.d.ts +19 -0
  89. package/dist/node/src/routes/coding-agents-fallback-routes.d.ts.map +1 -0
  90. package/dist/node/src/services/acp-service.d.ts +61 -0
  91. package/dist/node/src/services/acp-service.d.ts.map +1 -0
  92. package/dist/node/src/services/acpx-subprocess.d.ts +3 -0
  93. package/dist/node/src/services/acpx-subprocess.d.ts.map +1 -0
  94. package/dist/node/src/services/agent-credentials.d.ts +23 -0
  95. package/dist/node/src/services/agent-credentials.d.ts.map +1 -0
  96. package/dist/node/src/services/agent-metrics.d.ts +30 -0
  97. package/dist/node/src/services/agent-metrics.d.ts.map +1 -0
  98. package/dist/node/src/services/agent-selection.d.ts +53 -0
  99. package/dist/node/src/services/agent-selection.d.ts.map +1 -0
  100. package/dist/node/src/services/ansi-utils.d.ts +64 -0
  101. package/dist/node/src/services/ansi-utils.d.ts.map +1 -0
  102. package/dist/node/src/services/claude-code-skill-installer.d.ts +33 -0
  103. package/dist/node/src/services/claude-code-skill-installer.d.ts.map +1 -0
  104. package/dist/node/src/services/config-env.d.ts +23 -0
  105. package/dist/node/src/services/config-env.d.ts.map +1 -0
  106. package/dist/node/src/services/coordinator-event-normalizer.d.ts +50 -0
  107. package/dist/node/src/services/coordinator-event-normalizer.d.ts.map +1 -0
  108. package/dist/node/src/services/custom-validator-runner.d.ts +66 -0
  109. package/dist/node/src/services/custom-validator-runner.d.ts.map +1 -0
  110. package/dist/node/src/services/debug-capture.d.ts +38 -0
  111. package/dist/node/src/services/debug-capture.d.ts.map +1 -0
  112. package/dist/node/src/services/json-model-output.d.ts +2 -0
  113. package/dist/node/src/services/json-model-output.d.ts.map +1 -0
  114. package/dist/node/src/services/parent-agent-broker.d.ts +21 -0
  115. package/dist/node/src/services/parent-agent-broker.d.ts.map +1 -0
  116. package/dist/node/src/services/pty-auto-response.d.ts +30 -0
  117. package/dist/node/src/services/pty-auto-response.d.ts.map +1 -0
  118. package/dist/node/src/services/pty-init.d.ts +55 -0
  119. package/dist/node/src/services/pty-init.d.ts.map +1 -0
  120. package/dist/node/src/services/pty-service.d.ts +218 -0
  121. package/dist/node/src/services/pty-service.d.ts.map +1 -0
  122. package/dist/node/src/services/pty-session-io.d.ts +49 -0
  123. package/dist/node/src/services/pty-session-io.d.ts.map +1 -0
  124. package/dist/node/src/services/pty-spawn.d.ts +104 -0
  125. package/dist/node/src/services/pty-spawn.d.ts.map +1 -0
  126. package/dist/node/src/services/pty-types.d.ts +94 -0
  127. package/dist/node/src/services/pty-types.d.ts.map +1 -0
  128. package/dist/node/src/services/repo-input.d.ts +16 -0
  129. package/dist/node/src/services/repo-input.d.ts.map +1 -0
  130. package/dist/node/src/services/session-event-queue.d.ts +25 -0
  131. package/dist/node/src/services/session-event-queue.d.ts.map +1 -0
  132. package/dist/node/src/services/session-store.d.ts +107 -0
  133. package/dist/node/src/services/session-store.d.ts.map +1 -0
  134. package/dist/node/src/services/skill-callback-bridge.d.ts +78 -0
  135. package/dist/node/src/services/skill-callback-bridge.d.ts.map +1 -0
  136. package/dist/node/src/services/skill-essentials.d.ts +16 -0
  137. package/dist/node/src/services/skill-essentials.d.ts.map +1 -0
  138. package/dist/node/src/services/skill-lifeops-context-broker.d.ts +20 -0
  139. package/dist/node/src/services/skill-lifeops-context-broker.d.ts.map +1 -0
  140. package/dist/node/src/services/skill-manifest.d.ts +48 -0
  141. package/dist/node/src/services/skill-manifest.d.ts.map +1 -0
  142. package/dist/node/src/services/skill-recommender.d.ts +51 -0
  143. package/dist/node/src/services/skill-recommender.d.ts.map +1 -0
  144. package/dist/node/src/services/spawn-trajectory.d.ts +23 -0
  145. package/dist/node/src/services/spawn-trajectory.d.ts.map +1 -0
  146. package/dist/node/src/services/stall-classifier.d.ts +69 -0
  147. package/dist/node/src/services/stall-classifier.d.ts.map +1 -0
  148. package/dist/node/src/services/structured-proof-bridge.d.ts +99 -0
  149. package/dist/node/src/services/structured-proof-bridge.d.ts.map +1 -0
  150. package/dist/node/src/services/sub-agent-router.d.ts +38 -0
  151. package/dist/node/src/services/sub-agent-router.d.ts.map +1 -0
  152. package/dist/node/src/services/swarm-coordinator-prompts.d.ts +93 -0
  153. package/dist/node/src/services/swarm-coordinator-prompts.d.ts.map +1 -0
  154. package/dist/node/src/services/swarm-coordinator.d.ts +473 -0
  155. package/dist/node/src/services/swarm-coordinator.d.ts.map +1 -0
  156. package/dist/node/src/services/swarm-decision-loop.d.ts +69 -0
  157. package/dist/node/src/services/swarm-decision-loop.d.ts.map +1 -0
  158. package/dist/node/src/services/swarm-event-triage.d.ts +49 -0
  159. package/dist/node/src/services/swarm-event-triage.d.ts.map +1 -0
  160. package/dist/node/src/services/swarm-history.d.ts +27 -0
  161. package/dist/node/src/services/swarm-history.d.ts.map +1 -0
  162. package/dist/node/src/services/swarm-idle-watchdog.d.ts +22 -0
  163. package/dist/node/src/services/swarm-idle-watchdog.d.ts.map +1 -0
  164. package/dist/node/src/services/task-acceptance.d.ts +8 -0
  165. package/dist/node/src/services/task-acceptance.d.ts.map +1 -0
  166. package/dist/node/src/services/task-agent-auth.d.ts +69 -0
  167. package/dist/node/src/services/task-agent-auth.d.ts.map +1 -0
  168. package/dist/node/src/services/task-agent-frameworks.d.ts +90 -0
  169. package/dist/node/src/services/task-agent-frameworks.d.ts.map +1 -0
  170. package/dist/node/src/services/task-kind.d.ts +3 -0
  171. package/dist/node/src/services/task-kind.d.ts.map +1 -0
  172. package/dist/node/src/services/task-policy.d.ts +17 -0
  173. package/dist/node/src/services/task-policy.d.ts.map +1 -0
  174. package/dist/node/src/services/task-registry.d.ts +550 -0
  175. package/dist/node/src/services/task-registry.d.ts.map +1 -0
  176. package/dist/node/src/services/task-share.d.ts +18 -0
  177. package/dist/node/src/services/task-share.d.ts.map +1 -0
  178. package/dist/node/src/services/task-validation.d.ts +69 -0
  179. package/dist/node/src/services/task-validation.d.ts.map +1 -0
  180. package/dist/node/src/services/task-verifier-runner.d.ts +5 -0
  181. package/dist/node/src/services/task-verifier-runner.d.ts.map +1 -0
  182. package/dist/node/src/services/trajectory-context.d.ts +73 -0
  183. package/dist/node/src/services/trajectory-context.d.ts.map +1 -0
  184. package/dist/node/src/services/trajectory-feedback.d.ts +53 -0
  185. package/dist/node/src/services/trajectory-feedback.d.ts.map +1 -0
  186. package/dist/node/src/services/types.d.ts +152 -0
  187. package/dist/node/src/services/types.d.ts.map +1 -0
  188. package/dist/node/src/services/workspace-git-ops.d.ts +28 -0
  189. package/dist/node/src/services/workspace-git-ops.d.ts.map +1 -0
  190. package/dist/node/src/services/workspace-github.d.ts +60 -0
  191. package/dist/node/src/services/workspace-github.d.ts.map +1 -0
  192. package/dist/node/src/services/workspace-lifecycle.d.ts +18 -0
  193. package/dist/node/src/services/workspace-lifecycle.d.ts.map +1 -0
  194. package/dist/node/src/services/workspace-service.d.ts +122 -0
  195. package/dist/node/src/services/workspace-service.d.ts.map +1 -0
  196. package/dist/node/src/services/workspace-types.d.ts +81 -0
  197. package/dist/node/src/services/workspace-types.d.ts.map +1 -0
  198. package/dist/node/src/setup-routes.d.ts +9 -0
  199. package/dist/node/src/setup-routes.d.ts.map +1 -0
  200. package/dist/node/vitest.config.d.ts +3 -0
  201. package/dist/node/vitest.config.d.ts.map +1 -0
  202. package/docs/default-eliza-skills-and-agent-bridge-plan.md +231 -0
  203. package/docs/sub-agent-routing.md +197 -0
  204. package/package.json +113 -37
  205. package/dist/index.d.ts.map +0 -1
  206. package/dist/index.js +0 -21110
  207. package/dist/index.js.map +0 -109
  208. package/dist/src/actions/messaging.d.ts +0 -24
  209. package/dist/src/actions/messaging.d.ts.map +0 -1
  210. package/dist/src/actions/peek-subagent.d.ts +0 -3
  211. package/dist/src/actions/peek-subagent.d.ts.map +0 -1
  212. package/dist/src/actions/subagent-management.d.ts +0 -7
  213. package/dist/src/actions/subagent-management.d.ts.map +0 -1
  214. package/dist/src/actions/task-management.d.ts +0 -9
  215. package/dist/src/actions/task-management.d.ts.map +0 -1
  216. package/dist/src/config.d.ts +0 -4
  217. package/dist/src/config.d.ts.map +0 -1
  218. package/dist/src/providers/orchestrator-config.d.ts +0 -80
  219. package/dist/src/providers/orchestrator-config.d.ts.map +0 -1
  220. package/dist/src/providers/task-context.d.ts +0 -3
  221. package/dist/src/providers/task-context.d.ts.map +0 -1
  222. package/dist/src/services/agent-orchestrator-service.d.ts +0 -59
  223. package/dist/src/services/agent-orchestrator-service.d.ts.map +0 -1
  224. package/dist/src/services/messaging-service.d.ts +0 -111
  225. package/dist/src/services/messaging-service.d.ts.map +0 -1
  226. package/dist/src/services/sandbox-service.d.ts +0 -103
  227. package/dist/src/services/sandbox-service.d.ts.map +0 -1
  228. package/dist/src/services/subagent-service.d.ts +0 -140
  229. package/dist/src/services/subagent-service.d.ts.map +0 -1
  230. package/dist/src/sub-agents/adapter.d.ts +0 -13
  231. package/dist/src/sub-agents/adapter.d.ts.map +0 -1
  232. package/dist/src/sub-agents/claude-agent-sdk-sub-agent.d.ts +0 -18
  233. package/dist/src/sub-agents/claude-agent-sdk-sub-agent.d.ts.map +0 -1
  234. package/dist/src/sub-agents/codex-sdk-sub-agent.d.ts +0 -18
  235. package/dist/src/sub-agents/codex-sdk-sub-agent.d.ts.map +0 -1
  236. package/dist/src/sub-agents/eliza-sub-agent.d.ts +0 -27
  237. package/dist/src/sub-agents/eliza-sub-agent.d.ts.map +0 -1
  238. package/dist/src/sub-agents/elizaos-native-sub-agent.d.ts +0 -61
  239. package/dist/src/sub-agents/elizaos-native-sub-agent.d.ts.map +0 -1
  240. package/dist/src/sub-agents/index.d.ts +0 -10
  241. package/dist/src/sub-agents/index.d.ts.map +0 -1
  242. package/dist/src/sub-agents/opencode-sub-agent.d.ts +0 -44
  243. package/dist/src/sub-agents/opencode-sub-agent.d.ts.map +0 -1
  244. package/dist/src/sub-agents/registry.d.ts +0 -3
  245. package/dist/src/sub-agents/registry.d.ts.map +0 -1
  246. package/dist/src/sub-agents/sweagent-sub-agent.d.ts +0 -19
  247. package/dist/src/sub-agents/sweagent-sub-agent.d.ts.map +0 -1
  248. package/dist/src/sub-agents/tools.d.ts +0 -15
  249. package/dist/src/sub-agents/tools.d.ts.map +0 -1
  250. package/dist/src/sub-agents/types.d.ts +0 -170
  251. package/dist/src/sub-agents/types.d.ts.map +0 -1
  252. package/dist/src/types/index.d.ts +0 -12
  253. package/dist/src/types/index.d.ts.map +0 -1
  254. package/dist/src/types/messaging.d.ts +0 -202
  255. package/dist/src/types/messaging.d.ts.map +0 -1
  256. package/dist/src/types/sandbox.d.ts +0 -228
  257. package/dist/src/types/sandbox.d.ts.map +0 -1
  258. package/dist/src/types/subagent.d.ts +0 -232
  259. package/dist/src/types/subagent.d.ts.map +0 -1
  260. package/dist/src/types.d.ts +0 -138
  261. package/dist/src/types.d.ts.map +0 -1
  262. package/dist/src/utils/index.d.ts +0 -7
  263. package/dist/src/utils/index.d.ts.map +0 -1
  264. package/dist/src/utils/session.d.ts +0 -184
  265. package/dist/src/utils/session.d.ts.map +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,62 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0 (unreleased)
4
+
5
+ Consolidated ACP-based spawn, PTY sessions, and workspace services into
6
+ a single package at `plugins/plugin-agent-orchestrator`. Internal
7
+ `@elizaos/plugin-acpx` callers were rewritten to the consolidated package.
8
+
9
+ ### Added
10
+
11
+ - `SubAgentRouter` service: subscribes to `AcpService.onSessionEvent`,
12
+ posts terminal events (`task_complete`, `error`, `blocked`) as
13
+ synthetic inbound memories addressed to the original
14
+ `roomId`/`userId`/`messageId` captured at spawn time. Lets the main
15
+ agent's normal action layer decide `REPLY` / `SEND_TO_AGENT` / both.
16
+ - `activeSubAgentsProvider`: cache-stable view of routed sub-agent
17
+ sessions. Sorted by sessionId, structural-only fields, status bucketing
18
+ (`ready`/`running`/`busy`/`tool_running`/`authenticating` → `"active"`)
19
+ so transient flips don't invalidate the prefix cache.
20
+ - Round-trip cap: per-session inject counter; force-stops after
21
+ `ACPX_SUB_AGENT_ROUND_TRIP_CAP` (default 32) and surfaces a single
22
+ `round_trip_cap_exceeded` notice with `subAgentRoundTrip` /
23
+ `subAgentRoundTripCap` / `subAgentCapExceeded: true`.
24
+ - Live e2e test (`__tests__/live/sub-agent-router.live.test.ts`) gated on
25
+ `RUN_LIVE_ACPX=1` plus `acpx --version`.
26
+ - `spawnAgentAction` now threads `source: content.source` into spawn
27
+ metadata for parity with `createTaskAction`.
28
+
29
+ ### Changed
30
+
31
+ - Package renamed from `@elizaos/plugin-acpx` → `@elizaos/plugin-agent-orchestrator`.
32
+ - `SubAgentRouter` derives the per-session sub-agent UUID locally via SHA1
33
+ instead of importing `createUniqueUuid` from `@elizaos/core`. This keeps
34
+ the router's import surface type-only.
35
+ - Browser build dropped: this package owns Node-only services
36
+ (`PTYService`, `CodingWorkspaceService`, child_process spawn).
37
+
38
+ ### Fixed
39
+
40
+ - `task-agent-frameworks.ts` `normalizeTaskAgentAdapterForModelPrefs`:
41
+ removed three duplicate switch cases (`opencode` / `open-code` /
42
+ `open code`) that were dead code after the matching cases earlier in
43
+ the same switch.
44
+ - Greptile-flagged bugs from PR #7463 (already on develop pre-rename):
45
+ `"errored"` → `"error"` status normalization,
46
+ `listSessions`/`getSession` for FileSessionStore + RuntimeDbSessionStore,
47
+ `enforceSessionLimit` excluding both `"error"` and `"errored"`.
48
+
49
+ ### Deprecated
50
+
51
+ - `swarm-coordinator.ts` and the entire `swarm-*` / `pty-*` family are
52
+ retained for callers that still depend on `PTYService`, but are
53
+ dormant for ACP-spawned sessions. Retiring them is a follow-up
54
+ cleanup; new work should use `AcpService` + `SubAgentRouter`.
55
+
56
+ ## 0.1.0
57
+
58
+ Pre-consolidation. Bootstrap package scaffold for `@elizaos/plugin-acpx`
59
+ under its original name. Initial ACP subprocess service, session store
60
+ adapters, six canonical actions (`CREATE_TASK`, `SPAWN_AGENT`,
61
+ `SEND_TO_AGENT`, `STOP_AGENT`, `LIST_AGENTS`, `CANCEL_TASK`), and the
62
+ `availableAgentsProvider`.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 @stwd / 0xSolace
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/PROJECT.md ADDED
@@ -0,0 +1,119 @@
1
+ # @elizaos/plugin-agent-orchestrator
2
+
3
+ ElizaOS plugin: acpx-backed task and subagent backend (wraps the `acpx` CLI to spawn coding agents). Sibling, not replacement, for `@elizaos/plugin-agent-orchestrator`. Distinct from `@elizaos/plugin-acp` (Shaw's ACP gateway client).
4
+
5
+ Drop-in compatible with `@elizaos/plugin-agent-orchestrator` (PTY-based). Uses
6
+ ACPX (Agent Client Protocol CLI) under the hood for structured streaming,
7
+ named sessions, cooperative cancel, and crash-resilient sessions.
8
+
9
+ ## Why this exists
10
+
11
+ `plugin-agent-orchestrator` (sibling, PTY-based) maintains an entire
12
+ stall-classifier, ANSI-stripping, prompt-regex-dismissal, pty-state-capture
13
+ stack to extract structure out of terminal byte streams. The Agent Client Protocol (ACP) is the structured
14
+ protocol underneath, `tool_call`, `thinking`, `diff`, `done` events, typed
15
+ auth handshake, cooperative `session/cancel`. ACPX provides one CLI surface
16
+ across 15 Agent Client Protocol (ACP)-compatible coding agents (codex, claude-code, gemini, copilot,
17
+ cursor, droid, local Eliza-1 agents, etc).
18
+
19
+ This plugin is a sibling-not-replacement: deploys alongside
20
+ `plugin-agent-orchestrator`, exposes the same action names so users can switch
21
+ transports by swapping the plugin import.
22
+
23
+ ## Goals
24
+
25
+ - Drop-in action surface compatible with `plugin-agent-orchestrator`
26
+ - ACPX subprocess transport (NDJSON streaming, no pty)
27
+ - Configurable cli binary (`ELIZA_ACP_CLI=acpx`, override possible)
28
+ - Persistent named sessions (eliza-runtime-table-backed)
29
+ - Cooperative cancel + crash reconnect
30
+ - 80%+ unit test coverage
31
+ - Parity smoke vs plugin-agent-orchestrator on at least codex
32
+ - Publishable to npm under `@elizaos`
33
+
34
+ ## Non-goals
35
+
36
+ - Replace plugin-agent-orchestrator (sibling, not replacement)
37
+ - Git workspace provisioning (PROVISION_WORKSPACE / FINALIZE_WORKSPACE)
38
+ - Frontend xterm view
39
+ - Non-codex agent support in v0.1.0 (codex first; claude/gemini in 0.2.0+)
40
+
41
+ ## Action surface
42
+
43
+ Match `plugin-agent-orchestrator` exactly:
44
+
45
+ | Action | Purpose |
46
+ |---|---|
47
+ | `SPAWN_AGENT` | Spawn an acpx coding-agent session |
48
+ | `SEND_TO_AGENT` | Send prompt or input to running session |
49
+ | `LIST_AGENTS` | List active sessions |
50
+ | `STOP_AGENT` | Terminate session via session/cancel |
51
+ | `CREATE_TASK` | Async task (spawn + first prompt + return when done) |
52
+ | `CANCEL_TASK` | Cooperative cancel |
53
+
54
+ ## Provider
55
+
56
+ `availableAgents` provider exposes which Agent Client Protocol (ACP)-compatible agents are installed.
57
+
58
+ ## Architecture
59
+
60
+ ```
61
+ ┌─────────────────────────┐
62
+ │ Eliza runtime │
63
+ │ ├─ actions (SPAWN, ..) │
64
+ │ └─ provider (available)│
65
+ └──────────┬──────────────┘
66
+
67
+ ┌──────────v──────────────┐
68
+ │ AcpService │
69
+ │ - spawn `acpx` proc │
70
+ │ - parse NDJSON stream │
71
+ │ - emit typed events │
72
+ │ - cancel via session/ │
73
+ └──────────┬──────────────┘
74
+
75
+ ┌──────────v──────────────┐
76
+ │ acpx (cli subprocess) │
77
+ │ --format json │
78
+ │ codex / claude / etc │
79
+ └─────────────────────────┘
80
+ ```
81
+
82
+ ## Reference materials
83
+
84
+ - `acpx-docs/README.md`, acpx README
85
+ - `acpx-docs/docs_CLI.md`, full acpx CLI reference
86
+ - `acpx-docs/skills_acpx_SKILL.md`, skill reference
87
+
88
+ ## Layout
89
+
90
+ ```
91
+ src/
92
+ index.ts # plugin export
93
+ actions/
94
+ spawn-agent.ts
95
+ send-to-agent.ts
96
+ list-agents.ts
97
+ stop-agent.ts
98
+ create-task.ts
99
+ cancel-task.ts
100
+ providers/
101
+ available-agents.ts
102
+ services/
103
+ acp-service.ts # core ACPX wrapper
104
+ session-store.ts # persistent session state
105
+ types.ts # acpx event types
106
+ __tests__/
107
+ *.test.ts
108
+ docs/
109
+ sub-agent-routing.md
110
+ PROJECT.md # this file
111
+ ```
112
+
113
+ ## Status
114
+
115
+ 🚧 Bootstrapping, wave A in progress.
116
+
117
+ ## License
118
+
119
+ MIT
package/README.md ADDED
@@ -0,0 +1,160 @@
1
+ # @elizaos/plugin-agent-orchestrator
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@elizaos/plugin-agent-orchestrator.svg)](https://www.npmjs.com/package/@elizaos/plugin-agent-orchestrator)
4
+ [![CI](https://github.com/elizaos/eliza/actions/workflows/ci.yml/badge.svg)](https://github.com/elizaos/eliza/actions/workflows/ci.yml)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
+
7
+ The canonical orchestration plugin for ElizaOS task agents. Spawns local coding agents (codex, claude, gemini, ...) via the [`acpx`](https://github.com/0xouroboros/acp) CLI using the structured Agent Client Protocol, routes their output back through the runtime so the main agent decides what to do, and bundles workspace lifecycle, GitHub PR integration, task share, and supporting services in a single package.
8
+
9
+ > Naming: this plugin is *not* the same thing as `@elizaos/plugin-acp`. That package is Shaw's ACP gateway client (IDE bridge over a remote ACP gateway). `@elizaos/plugin-agent-orchestrator` is the *task backend* that uses `acpx` to run coding agents as subprocesses on the same host as the runtime.
10
+
11
+ ## What it does
12
+
13
+ The plugin combines three concerns:
14
+
15
+ 1. **Spawn** coding agents via ACP. The ACP path uses typed JSON-RPC events — `tool_call` / `tool_call_update`, `agent_message_chunk`, cooperative `session/cancel`, parallel sessions in the same workspace, recoverable via `session/load`.
16
+ 2. **Route** sub-agent terminal events (`task_complete`, `error`, `blocked`) back into the runtime as synthetic inbound messages addressed to the original `roomId`/`userId`/`messageId`. The main agent's normal action layer then decides whether to `REPLY` to the user, `SEND_TO_AGENT` to push the sub-agent further, or both. See [`docs/sub-agent-routing.md`](./docs/sub-agent-routing.md).
17
+ 3. **Coordinate** workspace lifecycle (clone, branch, commit, push, PR open) and GitHub issue management for repo-hosted tasks.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install @elizaos/plugin-agent-orchestrator
23
+ npm install -g acpx@latest
24
+ acpx --version
25
+ ```
26
+
27
+ You also need at least one ACP-compatible agent CLI (`codex`, `claude`, or `gemini`) installed and authenticated.
28
+
29
+ ## Quick start
30
+
31
+ ```ts
32
+ import agentOrchestratorPlugin from "@elizaos/plugin-agent-orchestrator";
33
+
34
+ export default {
35
+ plugins: [agentOrchestratorPlugin],
36
+ };
37
+ ```
38
+
39
+ ## Action surface
40
+
41
+ | Action | Purpose |
42
+ | --- | --- |
43
+ | `ACPX_CREATE_TASK` (`CREATE_TASK`) | One-shot: spawn + prompt + return. Captures origin metadata for routing. |
44
+ | `SPAWN_AGENT` | Start a long-lived ACP coding-agent session. Returns `data.agents[]`. |
45
+ | `SEND_TO_AGENT` | Send a follow-up prompt to a running session. The main agent uses this to push a sub-agent further when its proof is unsatisfying. |
46
+ | `STOP_AGENT` | Cooperatively cancel + close a session. |
47
+ | `LIST_AGENTS` | List active and persisted sessions. |
48
+ | `CANCEL_TASK` | Cancel an in-flight task while preserving history. |
49
+ | `TASK_HISTORY` / `TASK_CONTROL` / `TASK_SHARE` | Task lifecycle ops over the coordinator surface. |
50
+ | `PROVISION_WORKSPACE` / `FINALIZE_WORKSPACE` | Git workspace setup, commit, push, PR open. |
51
+ | `MANAGE_ISSUES` | GitHub issue create/list/update/close. |
52
+
53
+ ## Providers
54
+
55
+ - `AVAILABLE_AGENTS` — adapter inventory + raw session list.
56
+ - `ACTIVE_SUB_AGENTS` — cache-stable view of currently-routed sub-agent sessions; sorted by sessionId, structural fields only (no timestamps, no message excerpts), so the planner-visible block stays cached across status flips.
57
+ - `ACTIVE_WORKSPACE_CONTEXT` — live workspace/session state.
58
+ - `CODING_AGENT_EXAMPLES` — structured action call examples.
59
+
60
+ ## Services
61
+
62
+ - `AcpService` — ACP subprocess lifecycle, NDJSON parsing, session state, event emission. Registers under `ACP_SUBPROCESS_SERVICE`.
63
+ - `SubAgentRouter` (canonical) — subscribes to `AcpService.onSessionEvent`, posts terminal-event synthetic memories to `runtime.messageService.handleMessage`. Per-session round-trip cap (`ACPX_SUB_AGENT_ROUND_TRIP_CAP`, default 32) force-stops runaway loops. Disable with `ACPX_SUB_AGENT_ROUTER_DISABLED=1`.
64
+ - `PTYService` — PTY-based spawn surface. Bound to `pty-manager`.
65
+ - `CodingWorkspaceService` — git workspace lifecycle helpers.
66
+
67
+ ```ts
68
+ import { AcpService, SubAgentRouter } from "@elizaos/plugin-agent-orchestrator";
69
+
70
+ const acp = runtime.getService("ACP_SUBPROCESS_SERVICE") as AcpService;
71
+
72
+ const { sessionId } = await acp.spawnSession({
73
+ agentType: "codex",
74
+ workdir: "/tmp/my-task",
75
+ approvalPreset: "permissive",
76
+ metadata: {
77
+ roomId: message.roomId,
78
+ userId: message.entityId,
79
+ messageId: message.id,
80
+ label: "fix bug 42",
81
+ },
82
+ });
83
+
84
+ const result = await acp.sendPrompt(sessionId, "what is 7 + 8?");
85
+ console.log(result.finalText); // "15"
86
+ console.log(result.stopReason); // "end_turn"
87
+ console.log(result.durationMs); // 4864
88
+ ```
89
+
90
+ ### Subscribing to events
91
+
92
+ ```ts
93
+ acp.onSessionEvent((sessionId, eventName, data) => {
94
+ // eventName: "ready" | "message" | "tool_running" | "task_complete" | "stopped" | "error" | "blocked" | "login_required" | "reconnected"
95
+ // data shape depends on eventName, see SessionEventName in src/services/types.ts
96
+ });
97
+ ```
98
+
99
+ The `task_complete` event:
100
+
101
+ ```ts
102
+ { response: string, durationMs: number, stopReason: "end_turn" | "error" | string }
103
+ ```
104
+
105
+ You usually don't subscribe directly — `SubAgentRouter` already does, and routes terminal events into the runtime. Subscribe only if you need raw access (e.g. dashboards).
106
+
107
+ ## Configuration
108
+
109
+ All configuration is via environment variables. Sensible defaults; most users only need `ELIZA_ACP_CLI` if `acpx` is not on `PATH`.
110
+
111
+ | Variable | Default | Purpose |
112
+ | --- | --- | --- |
113
+ | `ELIZA_ACP_CLI` | `acpx` | ACPX executable name or absolute path. |
114
+ | `ELIZA_ACP_DEFAULT_AGENT` | `codex` | Default agent type. |
115
+ | `ELIZA_ACP_DEFAULT_APPROVAL` | `autonomous` | Approval preset (`read-only`, `auto`, `permissive`, `autonomous`, `full-access`). |
116
+ | `ELIZA_ACP_PROMPT_TIMEOUT_MS` / `ACPX_DEFAULT_TIMEOUT_MS` | `1800000` (30m) | Per-prompt timeout. |
117
+ | `ELIZA_ACP_AUTH_TIMEOUT_MS` | `120000` | Auth handshake timeout. |
118
+ | `ELIZA_ACP_STATE_DIR` | `~/.eliza/plugin-acpx` | Where to persist session state when no runtime DB. |
119
+ | `ACPX_DEFAULT_CWD` | runtime cwd | Base directory for spawned agent workdirs. |
120
+ | `ELIZA_ACP_LOG_LEVEL` | `info` | `debug` \| `info` \| `warn` \| `error`. |
121
+ | `ELIZA_ACP_MAX_SESSIONS` | `8` | Concurrent session cap. |
122
+ | `ACPX_SUB_AGENT_ROUTER_DISABLED` | unset | Set to `1` to keep the router service registered but unbound (test/staging). |
123
+ | `ACPX_SUB_AGENT_ROUND_TRIP_CAP` | `32` | Per-session inject cap before force-stop to prevent ping-pong loops. |
124
+
125
+ ## Persistence
126
+
127
+ Session state is persisted with a tiered backend:
128
+
129
+ 1. If `runtime.databaseAdapter` exposes SQL methods, sessions live in the `acp_sessions` table.
130
+ 2. Otherwise, JSON file at `$ELIZA_ACP_STATE_DIR/sessions.json` (atomic writes via temp+rename).
131
+ 3. Last resort: in-memory `Map` (warns that sessions won't survive restart).
132
+
133
+ ## End-to-end smoke tests
134
+
135
+ Two smokes ship with the repo:
136
+
137
+ ```bash
138
+ # Raw AcpService against installed acpx + codex:
139
+ npm install -g acpx@latest
140
+ # authenticate codex first
141
+ npm run build
142
+ node tests/e2e/acp-codex-smoke.mjs
143
+
144
+ # Full router loop (vitest, gated):
145
+ RUN_LIVE_ACPX=1 bun run test
146
+ ```
147
+
148
+ `acp-codex-smoke.mjs` spawns a real codex session, sends "what is 7 + 8?", and verifies `task_complete` fires with response `"15"`. The vitest live test (`__tests__/live/sub-agent-router.live.test.ts`) verifies the synthetic Memory routes back from a real subprocess into a fake `messageService.handleMessage` with all routing keys intact. Both no-op (skip) when `acpx` isn't installed.
149
+
150
+ ## Status
151
+
152
+ `0.2.0` — consolidated package. ACP subprocess sessions are the primary spawn path; PTY services remain available for terminal-backed route handlers and coordinator tooling.
153
+
154
+ ## Contributing
155
+
156
+ PRs welcome. Run `npm run typecheck && npm test` before opening.
157
+
158
+ ## License
159
+
160
+ MIT. See [LICENSE](./LICENSE).