macro-agent 0.0.17 → 0.1.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 (338) hide show
  1. package/.claude/settings.local.json +3 -1
  2. package/.sudocode/specs.jsonl +4 -0
  3. package/CLAUDE.md +16 -14
  4. package/README.md +11 -29
  5. package/dist/acp/macro-agent.d.ts +17 -0
  6. package/dist/acp/macro-agent.d.ts.map +1 -1
  7. package/dist/acp/macro-agent.js +183 -55
  8. package/dist/acp/macro-agent.js.map +1 -1
  9. package/dist/acp/types.d.ts +32 -1
  10. package/dist/acp/types.d.ts.map +1 -1
  11. package/dist/acp/types.js.map +1 -1
  12. package/dist/agent/agent-manager.d.ts +65 -1
  13. package/dist/agent/agent-manager.d.ts.map +1 -1
  14. package/dist/agent/agent-manager.js +464 -183
  15. package/dist/agent/agent-manager.js.map +1 -1
  16. package/dist/agent/types.d.ts +1 -1
  17. package/dist/agent/types.d.ts.map +1 -1
  18. package/dist/api/server.d.ts +3 -0
  19. package/dist/api/server.d.ts.map +1 -1
  20. package/dist/api/server.js +37 -6
  21. package/dist/api/server.js.map +1 -1
  22. package/dist/auth/index.d.ts +2 -0
  23. package/dist/auth/index.d.ts.map +1 -0
  24. package/dist/auth/index.js +2 -0
  25. package/dist/auth/index.js.map +1 -0
  26. package/dist/auth/token.d.ts +41 -0
  27. package/dist/auth/token.d.ts.map +1 -0
  28. package/dist/auth/token.js +73 -0
  29. package/dist/auth/token.js.map +1 -0
  30. package/dist/cli/acp.d.ts +2 -23
  31. package/dist/cli/acp.d.ts.map +1 -1
  32. package/dist/cli/acp.js +127 -61
  33. package/dist/cli/acp.js.map +1 -1
  34. package/dist/cli/index.js +147 -15
  35. package/dist/cli/index.js.map +1 -1
  36. package/dist/cli/mcp.d.ts +6 -0
  37. package/dist/cli/mcp.d.ts.map +1 -1
  38. package/dist/cli/mcp.js +268 -181
  39. package/dist/cli/mcp.js.map +1 -1
  40. package/dist/cli/parse-args.d.ts +20 -0
  41. package/dist/cli/parse-args.d.ts.map +1 -0
  42. package/dist/cli/parse-args.js +43 -0
  43. package/dist/cli/parse-args.js.map +1 -0
  44. package/dist/cli/stable-instance-id.d.ts +8 -0
  45. package/dist/cli/stable-instance-id.d.ts.map +1 -0
  46. package/dist/cli/stable-instance-id.js +14 -0
  47. package/dist/cli/stable-instance-id.js.map +1 -0
  48. package/dist/config/project-config.d.ts +74 -7
  49. package/dist/config/project-config.d.ts.map +1 -1
  50. package/dist/config/project-config.js +123 -20
  51. package/dist/config/project-config.js.map +1 -1
  52. package/dist/map/adapter/acp-over-map.d.ts +23 -0
  53. package/dist/map/adapter/acp-over-map.d.ts.map +1 -1
  54. package/dist/map/adapter/acp-over-map.js +482 -55
  55. package/dist/map/adapter/acp-over-map.js.map +1 -1
  56. package/dist/map/adapter/connection-manager.d.ts.map +1 -1
  57. package/dist/map/adapter/connection-manager.js +3 -0
  58. package/dist/map/adapter/connection-manager.js.map +1 -1
  59. package/dist/map/adapter/event-log.d.ts +87 -0
  60. package/dist/map/adapter/event-log.d.ts.map +1 -0
  61. package/dist/map/adapter/event-log.js +122 -0
  62. package/dist/map/adapter/event-log.js.map +1 -0
  63. package/dist/map/adapter/event-translator.js +6 -6
  64. package/dist/map/adapter/event-translator.js.map +1 -1
  65. package/dist/map/adapter/extensions/agent-lifecycle.d.ts +82 -0
  66. package/dist/map/adapter/extensions/agent-lifecycle.d.ts.map +1 -0
  67. package/dist/map/adapter/extensions/agent-lifecycle.js +164 -0
  68. package/dist/map/adapter/extensions/agent-lifecycle.js.map +1 -0
  69. package/dist/map/adapter/extensions/index.d.ts +10 -1
  70. package/dist/map/adapter/extensions/index.d.ts.map +1 -1
  71. package/dist/map/adapter/extensions/index.js +34 -0
  72. package/dist/map/adapter/extensions/index.js.map +1 -1
  73. package/dist/map/adapter/extensions/mcp-bridge.d.ts +57 -0
  74. package/dist/map/adapter/extensions/mcp-bridge.d.ts.map +1 -0
  75. package/dist/map/adapter/extensions/mcp-bridge.js +745 -0
  76. package/dist/map/adapter/extensions/mcp-bridge.js.map +1 -0
  77. package/dist/map/adapter/extensions/rename.d.ts +29 -0
  78. package/dist/map/adapter/extensions/rename.d.ts.map +1 -0
  79. package/dist/map/adapter/extensions/rename.js +49 -0
  80. package/dist/map/adapter/extensions/rename.js.map +1 -0
  81. package/dist/map/adapter/extensions/task.d.ts.map +1 -1
  82. package/dist/map/adapter/extensions/task.js +10 -0
  83. package/dist/map/adapter/extensions/task.js.map +1 -1
  84. package/dist/map/adapter/extensions/update-metadata.d.ts +29 -0
  85. package/dist/map/adapter/extensions/update-metadata.d.ts.map +1 -0
  86. package/dist/map/adapter/extensions/update-metadata.js +67 -0
  87. package/dist/map/adapter/extensions/update-metadata.js.map +1 -0
  88. package/dist/map/adapter/index.d.ts +2 -1
  89. package/dist/map/adapter/index.d.ts.map +1 -1
  90. package/dist/map/adapter/index.js +8 -2
  91. package/dist/map/adapter/index.js.map +1 -1
  92. package/dist/map/adapter/interface.d.ts +2 -0
  93. package/dist/map/adapter/interface.d.ts.map +1 -1
  94. package/dist/map/adapter/map-adapter.d.ts +4 -0
  95. package/dist/map/adapter/map-adapter.d.ts.map +1 -1
  96. package/dist/map/adapter/map-adapter.js +302 -30
  97. package/dist/map/adapter/map-adapter.js.map +1 -1
  98. package/dist/map/adapter/subscription-manager.d.ts.map +1 -1
  99. package/dist/map/adapter/subscription-manager.js +5 -1
  100. package/dist/map/adapter/subscription-manager.js.map +1 -1
  101. package/dist/map/adapter/types.d.ts +2 -0
  102. package/dist/map/adapter/types.d.ts.map +1 -1
  103. package/dist/mcp/map-client.d.ts +39 -0
  104. package/dist/mcp/map-client.d.ts.map +1 -0
  105. package/dist/mcp/map-client.js +129 -0
  106. package/dist/mcp/map-client.js.map +1 -0
  107. package/dist/mcp/mcp-server.d.ts +14 -0
  108. package/dist/mcp/mcp-server.d.ts.map +1 -1
  109. package/dist/mcp/mcp-server.js +113 -85
  110. package/dist/mcp/mcp-server.js.map +1 -1
  111. package/dist/mcp/types.d.ts +9 -1
  112. package/dist/mcp/types.d.ts.map +1 -1
  113. package/dist/mcp/types.js.map +1 -1
  114. package/dist/metrics/metrics.js +1 -1
  115. package/dist/metrics/metrics.js.map +1 -1
  116. package/dist/roles/capabilities.d.ts +3 -1
  117. package/dist/roles/capabilities.d.ts.map +1 -1
  118. package/dist/roles/capabilities.js +17 -7
  119. package/dist/roles/capabilities.js.map +1 -1
  120. package/dist/roles/config-loader.d.ts +6 -6
  121. package/dist/roles/config-loader.d.ts.map +1 -1
  122. package/dist/roles/config-loader.js +6 -6
  123. package/dist/roles/config-loader.js.map +1 -1
  124. package/dist/roles/registry.d.ts +2 -2
  125. package/dist/roles/registry.js +2 -2
  126. package/dist/server/combined-server.d.ts +20 -0
  127. package/dist/server/combined-server.d.ts.map +1 -1
  128. package/dist/server/combined-server.js +107 -8
  129. package/dist/server/combined-server.js.map +1 -1
  130. package/dist/store/event-store.d.ts +7 -1
  131. package/dist/store/event-store.d.ts.map +1 -1
  132. package/dist/store/event-store.js +91 -8
  133. package/dist/store/event-store.js.map +1 -1
  134. package/dist/store/types/agents.d.ts +23 -0
  135. package/dist/store/types/agents.d.ts.map +1 -1
  136. package/dist/store/types/events.d.ts +1 -1
  137. package/dist/store/types/events.d.ts.map +1 -1
  138. package/dist/task/backend/index.d.ts +47 -29
  139. package/dist/task/backend/index.d.ts.map +1 -1
  140. package/dist/task/backend/index.js +109 -71
  141. package/dist/task/backend/index.js.map +1 -1
  142. package/dist/task/backend/memory.d.ts +1 -0
  143. package/dist/task/backend/memory.d.ts.map +1 -1
  144. package/dist/task/backend/memory.js +3 -0
  145. package/dist/task/backend/memory.js.map +1 -1
  146. package/dist/task/backend/opentasks/backend.d.ts +140 -0
  147. package/dist/task/backend/opentasks/backend.d.ts.map +1 -0
  148. package/dist/task/backend/opentasks/backend.js +1023 -0
  149. package/dist/task/backend/opentasks/backend.js.map +1 -0
  150. package/dist/task/backend/opentasks/client.d.ts +337 -0
  151. package/dist/task/backend/opentasks/client.d.ts.map +1 -0
  152. package/dist/task/backend/opentasks/client.js +225 -0
  153. package/dist/task/backend/opentasks/client.js.map +1 -0
  154. package/dist/task/backend/opentasks/daemon-manager.d.ts +89 -0
  155. package/dist/task/backend/opentasks/daemon-manager.d.ts.map +1 -0
  156. package/dist/task/backend/opentasks/daemon-manager.js +195 -0
  157. package/dist/task/backend/opentasks/daemon-manager.js.map +1 -0
  158. package/dist/task/backend/opentasks/index.d.ts +21 -0
  159. package/dist/task/backend/opentasks/index.d.ts.map +1 -0
  160. package/dist/task/backend/opentasks/index.js +21 -0
  161. package/dist/task/backend/opentasks/index.js.map +1 -0
  162. package/dist/task/backend/opentasks/mapping.d.ts +48 -0
  163. package/dist/task/backend/opentasks/mapping.d.ts.map +1 -0
  164. package/dist/task/backend/opentasks/mapping.js +77 -0
  165. package/dist/task/backend/opentasks/mapping.js.map +1 -0
  166. package/dist/task/backend/types.d.ts +33 -53
  167. package/dist/task/backend/types.d.ts.map +1 -1
  168. package/dist/task/backend/types.js +7 -11
  169. package/dist/task/backend/types.js.map +1 -1
  170. package/dist/task/backend/unified-tool-provider.d.ts +57 -0
  171. package/dist/task/backend/unified-tool-provider.d.ts.map +1 -0
  172. package/dist/task/backend/unified-tool-provider.js +623 -0
  173. package/dist/task/backend/unified-tool-provider.js.map +1 -0
  174. package/dist/teams/team-loader.d.ts +2 -2
  175. package/dist/teams/team-loader.js +3 -3
  176. package/dist/teams/team-loader.js.map +1 -1
  177. package/dist/teams/team-runtime.d.ts.map +1 -1
  178. package/dist/teams/team-runtime.js +2 -0
  179. package/dist/teams/team-runtime.js.map +1 -1
  180. package/docs/architecture.md +7 -6
  181. package/docs/configuration.md +26 -62
  182. package/docs/implementation-details.md +5 -5
  183. package/docs/implementation-summary.md +17 -17
  184. package/docs/plan-self-driving-support.md +4 -4
  185. package/docs/spec-self-driving-support.md +10 -10
  186. package/docs/team-templates.md +2 -2
  187. package/docs/teams.md +3 -3
  188. package/docs/troubleshooting.md +10 -11
  189. package/package.json +6 -4
  190. package/src/__tests__/e2e/agent-spawn-visibility.e2e.test.ts +761 -0
  191. package/src/__tests__/e2e/full-agent-conflict-resolution.e2e.test.ts +2 -2
  192. package/src/__tests__/e2e/mcp-thin-client-bridge.e2e.test.ts +304 -0
  193. package/src/__tests__/e2e/mcp-tools-available.e2e.test.ts +324 -0
  194. package/src/__tests__/e2e/multi-agent.e2e.test.ts +5 -5
  195. package/src/__tests__/e2e/spawn-session-streaming.e2e.test.ts +563 -0
  196. package/src/acp/__tests__/history.test.ts +8 -4
  197. package/src/acp/__tests__/integration.test.ts +56 -31
  198. package/src/acp/__tests__/macro-agent.test.ts +16 -7
  199. package/src/acp/macro-agent.ts +230 -62
  200. package/src/acp/types.ts +46 -1
  201. package/src/agent/__tests__/agent-manager.test.ts +228 -2
  202. package/src/agent/agent-manager.ts +714 -261
  203. package/src/agent/types.ts +3 -1
  204. package/src/api/server.ts +41 -7
  205. package/src/auth/__tests__/token.test.ts +100 -0
  206. package/src/auth/index.ts +1 -0
  207. package/src/auth/token.ts +82 -0
  208. package/src/cli/__tests__/acp.test.ts +1 -1
  209. package/src/cli/__tests__/stable-instance-id.test.ts +1 -1
  210. package/src/cli/acp.ts +130 -72
  211. package/src/cli/index.ts +120 -14
  212. package/src/cli/mcp.ts +311 -207
  213. package/src/cli/parse-args.ts +54 -0
  214. package/src/cli/stable-instance-id.ts +14 -0
  215. package/src/config/project-config.ts +190 -27
  216. package/src/lifecycle/__tests__/cascade-termination.test.ts +1 -1
  217. package/src/map/adapter/__tests__/acp-over-map-cancel.test.ts +820 -0
  218. package/src/map/adapter/__tests__/acp-over-map-getmodels.test.ts +355 -0
  219. package/src/map/adapter/__tests__/acp-over-map-history.test.ts +724 -2
  220. package/src/map/adapter/__tests__/acp-over-map-persistence.e2e.test.ts +1 -1
  221. package/src/map/adapter/__tests__/event-broadcast.test.ts +420 -0
  222. package/src/map/adapter/__tests__/event-log.test.ts +527 -0
  223. package/src/map/adapter/__tests__/event-translator.test.ts +3 -3
  224. package/src/map/adapter/__tests__/extensions.test.ts +408 -0
  225. package/src/map/adapter/__tests__/map-adapter.test.ts +99 -0
  226. package/src/map/adapter/__tests__/mcp-bridge.test.ts +1187 -0
  227. package/src/map/adapter/__tests__/multi-client-broadcast.test.ts +711 -0
  228. package/src/map/adapter/__tests__/websocket-integration.test.ts +218 -0
  229. package/src/map/adapter/acp-over-map.ts +777 -92
  230. package/src/map/adapter/connection-manager.ts +3 -0
  231. package/src/map/adapter/event-log.ts +208 -0
  232. package/src/map/adapter/event-translator.ts +6 -6
  233. package/src/map/adapter/extensions/agent-lifecycle.ts +267 -0
  234. package/src/map/adapter/extensions/index.ts +60 -0
  235. package/src/map/adapter/extensions/mcp-bridge.ts +995 -0
  236. package/src/map/adapter/extensions/task.ts +11 -0
  237. package/src/map/adapter/extensions/update-metadata.ts +126 -0
  238. package/src/map/adapter/index.ts +28 -0
  239. package/src/map/adapter/interface.ts +2 -0
  240. package/src/map/adapter/map-adapter.ts +373 -38
  241. package/src/map/adapter/subscription-manager.ts +5 -1
  242. package/src/map/adapter/types.ts +2 -0
  243. package/src/mcp/__tests__/map-client.test.ts +386 -0
  244. package/src/mcp/__tests__/mcp-server-thin-client.test.ts +368 -0
  245. package/src/mcp/__tests__/mcp-server.test.ts +100 -1
  246. package/src/mcp/map-client.ts +177 -0
  247. package/src/mcp/mcp-server.ts +191 -100
  248. package/src/mcp/types.ts +6 -1
  249. package/src/metrics/metrics.ts +1 -1
  250. package/src/monitor/__tests__/stale-agent-flow.integration.test.ts +1 -1
  251. package/src/roles/__tests__/config-loader.test.ts +7 -7
  252. package/src/roles/capabilities.ts +17 -7
  253. package/src/roles/config-loader.ts +6 -6
  254. package/src/roles/registry.ts +2 -2
  255. package/src/server/__tests__/combined-server.test.ts +94 -21
  256. package/src/server/combined-server.ts +189 -33
  257. package/src/steering/__tests__/steering-integration.test.ts +1 -1
  258. package/src/store/__tests__/event-store.test.ts +236 -1
  259. package/src/store/__tests__/instance.test.ts +3 -3
  260. package/src/store/event-store.ts +109 -8
  261. package/src/store/types/agents.ts +16 -0
  262. package/src/store/types/events.ts +1 -1
  263. package/src/task/backend/__tests__/create-task-backend.test.ts +225 -0
  264. package/src/task/backend/__tests__/e2e/unified-tool-provider-opentasks.e2e.test.ts +524 -0
  265. package/src/task/backend/__tests__/unified-tool-provider.test.ts +579 -0
  266. package/src/task/backend/index.ts +156 -106
  267. package/src/task/backend/memory.ts +4 -0
  268. package/src/task/backend/opentasks/__tests__/backend.test.ts +968 -0
  269. package/src/task/backend/opentasks/__tests__/daemon-manager.test.ts +406 -0
  270. package/src/task/backend/opentasks/__tests__/mapping.test.ts +84 -0
  271. package/src/task/backend/opentasks/__tests__/opentasks-backend.e2e.test.ts +1338 -0
  272. package/src/task/backend/opentasks/backend.ts +1323 -0
  273. package/src/task/backend/opentasks/client.ts +652 -0
  274. package/src/task/backend/opentasks/daemon-manager.ts +253 -0
  275. package/src/task/backend/opentasks/index.ts +69 -0
  276. package/src/task/backend/opentasks/mapping.ts +94 -0
  277. package/src/task/backend/types.ts +42 -66
  278. package/src/task/backend/unified-tool-provider.ts +779 -0
  279. package/src/teams/__tests__/cross-subsystem.integration.test.ts +1 -1
  280. package/src/teams/team-loader.ts +3 -3
  281. package/src/teams/team-runtime.ts +2 -0
  282. package/test_fixtures/README.md +2 -3
  283. package/test_fixtures/fixtures/index.ts +0 -3
  284. package/test_fixtures/fixtures/projects/project-with-specs.ts +7 -149
  285. package/test_fixtures/fixtures/repos/index.ts +1 -3
  286. package/test_fixtures/fixtures/repos/temp-repo-factory.ts +0 -116
  287. package/test_fixtures/fixtures/repos/types.ts +0 -11
  288. package/test_fixtures/harness/__tests__/fixtures.test.ts +10 -102
  289. package/test_fixtures/harness/__tests__/temp-repo-and-simulator.test.ts +0 -33
  290. package/test_fixtures/harness/simulator/agent-simulator.ts +4 -4
  291. package/vitest.config.ts +1 -1
  292. package/vitest.e2e.config.ts +1 -1
  293. package/vitest.setup.ts +1 -30
  294. package/.macro-agent/teams/self-driving/prompts/grinder.md +0 -27
  295. package/.macro-agent/teams/self-driving/prompts/judge.md +0 -27
  296. package/.macro-agent/teams/self-driving/prompts/planner.md +0 -33
  297. package/.macro-agent/teams/self-driving/roles/grinder.yaml +0 -17
  298. package/.macro-agent/teams/self-driving/roles/judge.yaml +0 -24
  299. package/.macro-agent/teams/self-driving/roles/planner.yaml +0 -18
  300. package/.macro-agent/teams/self-driving/team.yaml +0 -103
  301. package/.macro-agent/teams/structured/prompts/developer.md +0 -26
  302. package/.macro-agent/teams/structured/prompts/lead.md +0 -25
  303. package/.macro-agent/teams/structured/prompts/reviewer.md +0 -24
  304. package/.macro-agent/teams/structured/roles/developer.yaml +0 -12
  305. package/.macro-agent/teams/structured/roles/lead.yaml +0 -11
  306. package/.macro-agent/teams/structured/roles/reviewer.yaml +0 -19
  307. package/.macro-agent/teams/structured/team.yaml +0 -89
  308. package/docs/sudocode-integration.md +0 -383
  309. package/src/task/backend/__tests__/backend-parity.test.ts +0 -451
  310. package/src/task/backend/__tests__/tool-provider-edge-cases.test.ts +0 -430
  311. package/src/task/backend/__tests__/tool-provider.test.ts +0 -983
  312. package/src/task/backend/sudocode/__tests__/backend-edge-cases.test.ts +0 -575
  313. package/src/task/backend/sudocode/__tests__/backend.test.ts +0 -1194
  314. package/src/task/backend/sudocode/__tests__/client-integration.test.ts +0 -418
  315. package/src/task/backend/sudocode/__tests__/client.test.ts +0 -345
  316. package/src/task/backend/sudocode/__tests__/e2e/backend.e2e.test.ts +0 -753
  317. package/src/task/backend/sudocode/__tests__/e2e/server-client.e2e.test.ts +0 -680
  318. package/src/task/backend/sudocode/__tests__/e2e-workflow.test.ts +0 -666
  319. package/src/task/backend/sudocode/__tests__/integration/standalone-client.integration.test.ts +0 -396
  320. package/src/task/backend/sudocode/__tests__/integration/sudocode-cli.integration.test.ts +0 -328
  321. package/src/task/backend/sudocode/__tests__/integration/test-utils.ts +0 -175
  322. package/src/task/backend/sudocode/__tests__/mapping-edge-cases.test.ts +0 -265
  323. package/src/task/backend/sudocode/__tests__/server-client.test.ts +0 -675
  324. package/src/task/backend/sudocode/__tests__/sync-policy-edge-cases.test.ts +0 -521
  325. package/src/task/backend/sudocode/__tests__/sync-policy.test.ts +0 -519
  326. package/src/task/backend/sudocode/__tests__/tools.test.ts +0 -471
  327. package/src/task/backend/sudocode/backend.ts +0 -1237
  328. package/src/task/backend/sudocode/client.ts +0 -515
  329. package/src/task/backend/sudocode/index.ts +0 -120
  330. package/src/task/backend/sudocode/mapping.ts +0 -93
  331. package/src/task/backend/sudocode/server-client.ts +0 -522
  332. package/src/task/backend/sudocode/standalone-client.ts +0 -623
  333. package/src/task/backend/sudocode/sync-policy.ts +0 -387
  334. package/src/task/backend/sudocode/tools.ts +0 -896
  335. package/src/task/backend/tool-provider.ts +0 -506
  336. package/test_fixtures/fixtures/sudocode/index.ts +0 -29
  337. package/test_fixtures/fixtures/sudocode/issues.ts +0 -185
  338. package/test_fixtures/fixtures/sudocode/specs.ts +0 -159
@@ -1,506 +0,0 @@
1
- /**
2
- * In-Memory Task Tool Provider
3
- *
4
- * Provides MCP tools for task operations using InMemoryTaskBackend.
5
- *
6
- * @module task/backend
7
- * @see s-8472 Pluggable Task Backend Integration with Sudocode
8
- */
9
-
10
- import type { AgentId } from "../../store/types/index.js";
11
- import type {
12
- TaskBackend,
13
- TaskToolProvider,
14
- MCPToolDefinition,
15
- TaskFilter,
16
- TaskStatus,
17
- } from "./types.js";
18
-
19
- // =============================================================================
20
- // Tool Provider Context
21
- // =============================================================================
22
-
23
- /**
24
- * Context needed for tool execution
25
- */
26
- export interface TaskToolContext {
27
- /** The agent making the tool call */
28
- agent_id: AgentId;
29
- }
30
-
31
- /**
32
- * Factory function type for getting context
33
- */
34
- export type GetToolContext = () => TaskToolContext;
35
-
36
- // =============================================================================
37
- // In-Memory Task Tool Provider
38
- // =============================================================================
39
-
40
- /**
41
- * InMemoryTaskToolProvider
42
- *
43
- * Provides MCP tools for task operations using the TaskBackend interface.
44
- * Tools include: create_task, get_task, list_tasks, list_ready_tasks,
45
- * get_task_blockers, update_task_status, add_blocker, remove_blocker.
46
- */
47
- export class InMemoryTaskToolProvider implements TaskToolProvider {
48
- constructor(
49
- private readonly backend: TaskBackend,
50
- private readonly getContext: GetToolContext
51
- ) {}
52
-
53
- /**
54
- * Get the MCP tools for task operations
55
- */
56
- getTools(): MCPToolDefinition[] {
57
- return [
58
- this.createTaskTool(),
59
- this.getTaskTool(),
60
- this.listTasksTool(),
61
- this.listReadyTasksTool(),
62
- this.getTaskBlockersTool(),
63
- this.updateTaskStatusTool(),
64
- this.addBlockerTool(),
65
- this.removeBlockerTool(),
66
- this.assignTaskTool(),
67
- this.completeTaskTool(),
68
- ];
69
- }
70
-
71
- /**
72
- * Tools that should be excluded when this provider is active
73
- */
74
- getExcludedTools(): string[] {
75
- // Exclude the built-in task tools from mcp-server.ts
76
- return ["create_task", "get_task"];
77
- }
78
-
79
- // ─────────────────────────────────────────────────────────────────────────────
80
- // Tool Definitions
81
- // ─────────────────────────────────────────────────────────────────────────────
82
-
83
- private createTaskTool(): MCPToolDefinition {
84
- return {
85
- name: "create_task",
86
- description: "Create a new task",
87
- schema: {
88
- type: "object",
89
- properties: {
90
- description: {
91
- type: "string",
92
- description: "Task description",
93
- },
94
- parent_task: {
95
- type: "string",
96
- description: "Parent task ID for subtasks",
97
- },
98
- external_id: {
99
- type: "string",
100
- description: "External system binding (e.g., sudocode issue ID)",
101
- },
102
- },
103
- required: ["description"],
104
- },
105
- handler: async (params: unknown) => {
106
- const args = params as {
107
- description: string;
108
- parent_task?: string;
109
- external_id?: string;
110
- };
111
- const context = this.getContext();
112
-
113
- const task = await this.backend.create({
114
- description: args.description,
115
- created_by: context.agent_id,
116
- parent_task: args.parent_task,
117
- external_id: args.external_id,
118
- });
119
-
120
- return {
121
- task_id: task.id,
122
- status: task.status,
123
- created_at: task.created_at,
124
- };
125
- },
126
- };
127
- }
128
-
129
- private getTaskTool(): MCPToolDefinition {
130
- return {
131
- name: "get_task",
132
- description: "Get details of a specific task",
133
- schema: {
134
- type: "object",
135
- properties: {
136
- task_id: {
137
- type: "string",
138
- description: "Task ID to look up",
139
- },
140
- },
141
- required: ["task_id"],
142
- },
143
- handler: async (params: unknown) => {
144
- const args = params as { task_id: string };
145
-
146
- const task = await this.backend.get(args.task_id);
147
- if (!task) {
148
- throw new Error(`Task not found: ${args.task_id}`);
149
- }
150
-
151
- return {
152
- id: task.id,
153
- description: task.description,
154
- status: task.status,
155
- isBlocked: task.isBlocked,
156
- assigned_agent: task.assigned_agent,
157
- parent_task: task.parent_task,
158
- blockers: task.blockers ?? [],
159
- created_at: task.created_at,
160
- started_at: task.started_at,
161
- completed_at: task.completed_at,
162
- outputs: task.outputs,
163
- artifacts: task.artifacts,
164
- };
165
- },
166
- };
167
- }
168
-
169
- private listTasksTool(): MCPToolDefinition {
170
- return {
171
- name: "list_tasks",
172
- description: "List tasks with optional filtering",
173
- schema: {
174
- type: "object",
175
- properties: {
176
- status: {
177
- type: "string",
178
- enum: ["pending", "assigned", "in_progress", "completed", "failed"],
179
- description: "Filter by task status",
180
- },
181
- assigned_agent: {
182
- type: "string",
183
- description: "Filter by assigned agent",
184
- },
185
- parent_task: {
186
- type: "string",
187
- description: "Filter by parent task",
188
- },
189
- root_only: {
190
- type: "boolean",
191
- description: "Only return root tasks (no parent)",
192
- },
193
- include_blocked: {
194
- type: "boolean",
195
- description: "Include blocked tasks (default: true)",
196
- },
197
- },
198
- },
199
- handler: async (params: unknown) => {
200
- const args = params as {
201
- status?: TaskStatus;
202
- assigned_agent?: string;
203
- parent_task?: string;
204
- root_only?: boolean;
205
- include_blocked?: boolean;
206
- };
207
-
208
- const filter: TaskFilter = {};
209
- if (args.status) filter.status = args.status;
210
- if (args.assigned_agent) filter.assigned_agent = args.assigned_agent;
211
- if (args.parent_task) filter.parent_task = args.parent_task;
212
- if (args.root_only) filter.rootTasksOnly = true;
213
- if (args.include_blocked !== undefined)
214
- filter.includeBlocked = args.include_blocked;
215
-
216
- const tasks = await this.backend.list(filter);
217
-
218
- return {
219
- tasks: tasks.map((t) => ({
220
- id: t.id,
221
- description: t.description,
222
- status: t.status,
223
- isBlocked: t.isBlocked,
224
- assigned_agent: t.assigned_agent,
225
- parent_task: t.parent_task,
226
- })),
227
- total: tasks.length,
228
- };
229
- },
230
- };
231
- }
232
-
233
- private listReadyTasksTool(): MCPToolDefinition {
234
- return {
235
- name: "list_ready_tasks",
236
- description:
237
- "List tasks that are ready to work on (pending/assigned, no blockers)",
238
- schema: {
239
- type: "object",
240
- properties: {
241
- assigned_agent: {
242
- type: "string",
243
- description: "Filter by assigned agent",
244
- },
245
- parent_task: {
246
- type: "string",
247
- description: "Filter by parent task",
248
- },
249
- },
250
- },
251
- handler: async (params: unknown) => {
252
- const args = params as {
253
- assigned_agent?: string;
254
- parent_task?: string;
255
- };
256
-
257
- const filter: TaskFilter = {};
258
- if (args.assigned_agent) filter.assigned_agent = args.assigned_agent;
259
- if (args.parent_task) filter.parent_task = args.parent_task;
260
-
261
- const tasks = await this.backend.listReady(filter);
262
-
263
- return {
264
- tasks: tasks.map((t) => ({
265
- id: t.id,
266
- description: t.description,
267
- status: t.status,
268
- assigned_agent: t.assigned_agent,
269
- })),
270
- total: tasks.length,
271
- };
272
- },
273
- };
274
- }
275
-
276
- private getTaskBlockersTool(): MCPToolDefinition {
277
- return {
278
- name: "get_task_blockers",
279
- description: "Get tasks that block a specific task",
280
- schema: {
281
- type: "object",
282
- properties: {
283
- task_id: {
284
- type: "string",
285
- description: "Task ID to get blockers for",
286
- },
287
- },
288
- required: ["task_id"],
289
- },
290
- handler: async (params: unknown) => {
291
- const args = params as { task_id: string };
292
-
293
- const blockers = await this.backend.getBlockers(args.task_id);
294
-
295
- return {
296
- task_id: args.task_id,
297
- blockers: blockers.map((t) => ({
298
- id: t.id,
299
- description: t.description,
300
- status: t.status,
301
- isCompleted: t.status === "completed",
302
- })),
303
- isBlocked: blockers.some((t) => t.status !== "completed"),
304
- };
305
- },
306
- };
307
- }
308
-
309
- private updateTaskStatusTool(): MCPToolDefinition {
310
- return {
311
- name: "update_task_status",
312
- description: "Update the status of a task",
313
- schema: {
314
- type: "object",
315
- properties: {
316
- task_id: {
317
- type: "string",
318
- description: "Task ID to update",
319
- },
320
- status: {
321
- type: "string",
322
- enum: ["pending", "assigned", "in_progress", "completed", "failed"],
323
- description: "New status",
324
- },
325
- },
326
- required: ["task_id", "status"],
327
- },
328
- handler: async (params: unknown) => {
329
- const args = params as { task_id: string; status: TaskStatus };
330
-
331
- const task = await this.backend.update(args.task_id, {
332
- status: args.status,
333
- });
334
-
335
- return {
336
- task_id: task.id,
337
- status: task.status,
338
- updated: true,
339
- };
340
- },
341
- };
342
- }
343
-
344
- private addBlockerTool(): MCPToolDefinition {
345
- return {
346
- name: "add_blocker",
347
- description: "Add a blocking dependency to a task",
348
- schema: {
349
- type: "object",
350
- properties: {
351
- task_id: {
352
- type: "string",
353
- description: "Task that will be blocked",
354
- },
355
- blocker_id: {
356
- type: "string",
357
- description: "Task that blocks the first task",
358
- },
359
- },
360
- required: ["task_id", "blocker_id"],
361
- },
362
- handler: async (params: unknown) => {
363
- const args = params as { task_id: string; blocker_id: string };
364
-
365
- await this.backend.addBlocker(args.task_id, args.blocker_id);
366
-
367
- return {
368
- task_id: args.task_id,
369
- blocker_id: args.blocker_id,
370
- added: true,
371
- };
372
- },
373
- };
374
- }
375
-
376
- private removeBlockerTool(): MCPToolDefinition {
377
- return {
378
- name: "remove_blocker",
379
- description: "Remove a blocking dependency from a task",
380
- schema: {
381
- type: "object",
382
- properties: {
383
- task_id: {
384
- type: "string",
385
- description: "Task to remove blocker from",
386
- },
387
- blocker_id: {
388
- type: "string",
389
- description: "Blocker task to remove",
390
- },
391
- },
392
- required: ["task_id", "blocker_id"],
393
- },
394
- handler: async (params: unknown) => {
395
- const args = params as { task_id: string; blocker_id: string };
396
-
397
- await this.backend.removeBlocker(args.task_id, args.blocker_id);
398
-
399
- return {
400
- task_id: args.task_id,
401
- blocker_id: args.blocker_id,
402
- removed: true,
403
- };
404
- },
405
- };
406
- }
407
-
408
- private assignTaskTool(): MCPToolDefinition {
409
- return {
410
- name: "assign_task",
411
- description: "Assign a task to an agent",
412
- schema: {
413
- type: "object",
414
- properties: {
415
- task_id: {
416
- type: "string",
417
- description: "Task ID to assign",
418
- },
419
- agent_id: {
420
- type: "string",
421
- description:
422
- "Agent ID to assign to (defaults to calling agent if not specified)",
423
- },
424
- role: {
425
- type: "string",
426
- description: "Optional role for the assignment",
427
- },
428
- },
429
- required: ["task_id"],
430
- },
431
- handler: async (params: unknown) => {
432
- const args = params as {
433
- task_id: string;
434
- agent_id?: string;
435
- role?: string;
436
- };
437
- const context = this.getContext();
438
-
439
- const agentId = args.agent_id ?? context.agent_id;
440
- await this.backend.assign(args.task_id, agentId, { role: args.role });
441
-
442
- return {
443
- task_id: args.task_id,
444
- assigned_agent: agentId,
445
- assigned: true,
446
- };
447
- },
448
- };
449
- }
450
-
451
- private completeTaskTool(): MCPToolDefinition {
452
- return {
453
- name: "complete_task",
454
- description: "Mark a task as completed with optional outputs",
455
- schema: {
456
- type: "object",
457
- properties: {
458
- task_id: {
459
- type: "string",
460
- description: "Task ID to complete",
461
- },
462
- summary: {
463
- type: "string",
464
- description: "Summary of work done",
465
- },
466
- outputs: {
467
- type: "object",
468
- description: "Output data from the task",
469
- },
470
- },
471
- required: ["task_id"],
472
- },
473
- handler: async (params: unknown) => {
474
- const args = params as {
475
- task_id: string;
476
- summary?: string;
477
- outputs?: Record<string, unknown>;
478
- };
479
-
480
- await this.backend.complete(args.task_id, {
481
- summary: args.summary,
482
- data: args.outputs,
483
- });
484
-
485
- return {
486
- task_id: args.task_id,
487
- completed: true,
488
- };
489
- },
490
- };
491
- }
492
- }
493
-
494
- // =============================================================================
495
- // Factory Function
496
- // =============================================================================
497
-
498
- /**
499
- * Create an InMemoryTaskToolProvider
500
- */
501
- export function createTaskToolProvider(
502
- backend: TaskBackend,
503
- getContext: GetToolContext
504
- ): InMemoryTaskToolProvider {
505
- return new InMemoryTaskToolProvider(backend, getContext);
506
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * Sudocode Fixtures exports
3
- *
4
- * @see s-1zcx Multi-Agent Orchestration Testing Strategy
5
- * @see i-7f2l Phase 4: Fixtures Library
6
- */
7
-
8
- // Specs
9
- export {
10
- SIMPLE_FEATURE_SPEC,
11
- AUTH_SPEC,
12
- API_SPEC,
13
- DATABASE_SPEC,
14
- FEATURE_SPEC_SET,
15
- DEPENDENT_SPECS,
16
- createSpec,
17
- } from "./specs.js";
18
-
19
- // Issues
20
- export {
21
- SIMPLE_ISSUE,
22
- AUTH_ISSUES,
23
- API_ISSUES,
24
- COMPLEX_ISSUE_SET,
25
- ASSIGNABLE_ISSUES,
26
- FEATURE_IMPLEMENTATION_ISSUES,
27
- createIssue,
28
- createBlockedIssueChain,
29
- } from "./issues.js";
@@ -1,185 +0,0 @@
1
- /**
2
- * Sudocode Issue Fixtures
3
- *
4
- * Predefined issues for testing.
5
- *
6
- * @see s-1zcx Multi-Agent Orchestration Testing Strategy
7
- * @see i-7f2l Phase 4: Fixtures Library
8
- */
9
-
10
- import type { PartialIssue } from "../repos/types.js";
11
-
12
- /**
13
- * Simple implementation issue
14
- */
15
- export const SIMPLE_ISSUE: PartialIssue = {
16
- id: "i-simple",
17
- title: "Implement simple feature",
18
- implements: "s-simple",
19
- };
20
-
21
- /**
22
- * Auth-related issues
23
- */
24
- export const AUTH_ISSUES: PartialIssue[] = [
25
- {
26
- id: "i-auth-login",
27
- title: "Implement login endpoint",
28
- implements: "s-auth",
29
- },
30
- {
31
- id: "i-auth-register",
32
- title: "Implement registration endpoint",
33
- implements: "s-auth",
34
- },
35
- {
36
- id: "i-auth-jwt",
37
- title: "Add JWT token handling",
38
- implements: "s-auth",
39
- blockedBy: ["i-auth-login"],
40
- },
41
- {
42
- id: "i-auth-refresh",
43
- title: "Implement token refresh",
44
- implements: "s-auth",
45
- blockedBy: ["i-auth-jwt"],
46
- },
47
- ];
48
-
49
- /**
50
- * API-related issues
51
- */
52
- export const API_ISSUES: PartialIssue[] = [
53
- {
54
- id: "i-api-users",
55
- title: "Create users CRUD",
56
- implements: "s-api",
57
- },
58
- {
59
- id: "i-api-resources",
60
- title: "Create resources CRUD",
61
- implements: "s-api",
62
- },
63
- {
64
- id: "i-api-errors",
65
- title: "Add error handling",
66
- implements: "s-api",
67
- },
68
- ];
69
-
70
- /**
71
- * Create issue with custom properties
72
- */
73
- export function createIssue(
74
- id: string,
75
- title: string,
76
- options: Partial<PartialIssue> = {}
77
- ): PartialIssue {
78
- return {
79
- id,
80
- title,
81
- ...options,
82
- };
83
- }
84
-
85
- /**
86
- * Create blocked issue chain
87
- */
88
- export function createBlockedIssueChain(
89
- specId: string,
90
- titles: string[]
91
- ): PartialIssue[] {
92
- return titles.map((title, index) => ({
93
- id: `i-${specId}-${index}`,
94
- title,
95
- implements: specId,
96
- blockedBy: index > 0 ? [`i-${specId}-${index - 1}`] : undefined,
97
- }));
98
- }
99
-
100
- /**
101
- * Issues with parallel and sequential dependencies
102
- */
103
- export const COMPLEX_ISSUE_SET: PartialIssue[] = [
104
- // Setup phase (parallel)
105
- {
106
- id: "i-setup-db",
107
- title: "Setup database",
108
- implements: "s-core",
109
- },
110
- {
111
- id: "i-setup-auth",
112
- title: "Setup auth",
113
- implements: "s-core",
114
- },
115
- // Build phase (depends on setup)
116
- {
117
- id: "i-build-models",
118
- title: "Build data models",
119
- implements: "s-core",
120
- blockedBy: ["i-setup-db"],
121
- },
122
- {
123
- id: "i-build-middleware",
124
- title: "Build middleware",
125
- implements: "s-core",
126
- blockedBy: ["i-setup-auth"],
127
- },
128
- // Integration phase (depends on build)
129
- {
130
- id: "i-integrate",
131
- title: "Integration",
132
- implements: "s-core",
133
- blockedBy: ["i-build-models", "i-build-middleware"],
134
- },
135
- ];
136
-
137
- /**
138
- * Issues for testing task assignment
139
- */
140
- export const ASSIGNABLE_ISSUES: PartialIssue[] = [
141
- {
142
- id: "i-task-1",
143
- title: "Task 1 - Easy",
144
- implements: "s-simple",
145
- },
146
- {
147
- id: "i-task-2",
148
- title: "Task 2 - Medium",
149
- implements: "s-simple",
150
- },
151
- {
152
- id: "i-task-3",
153
- title: "Task 3 - Hard",
154
- implements: "s-simple",
155
- },
156
- ];
157
-
158
- /**
159
- * Issues that represent a typical feature implementation
160
- */
161
- export const FEATURE_IMPLEMENTATION_ISSUES: PartialIssue[] = [
162
- {
163
- id: "i-feature-design",
164
- title: "Design feature architecture",
165
- implements: "s-feature-main",
166
- },
167
- {
168
- id: "i-feature-backend",
169
- title: "Implement backend",
170
- implements: "s-feature-api",
171
- blockedBy: ["i-feature-design"],
172
- },
173
- {
174
- id: "i-feature-frontend",
175
- title: "Implement frontend",
176
- implements: "s-feature-ui",
177
- blockedBy: ["i-feature-design"],
178
- },
179
- {
180
- id: "i-feature-integration",
181
- title: "Integration testing",
182
- implements: "s-feature-main",
183
- blockedBy: ["i-feature-backend", "i-feature-frontend"],
184
- },
185
- ];