@johpaz/hive-agents 0.0.47 → 1.0.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 (322) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -897
  3. package/dist/hive.js +222237 -206295
  4. package/dist/tool-worker.js +226 -927
  5. package/dist/ui/assets/A2UIPage-D4nzp5NV.js +8 -0
  6. package/dist/ui/assets/AgentCreateForm-M2RhjeA1.js +1 -0
  7. package/dist/ui/assets/AgentDetailPage-DkFRtj8g.js +1 -0
  8. package/dist/ui/assets/AgentNewPage-CfBU7puz.js +1 -0
  9. package/dist/ui/assets/AgentsPage-Ctzq2LWx.js +10 -0
  10. package/dist/ui/assets/ApiClientPage-DKbGO1QW.js +3 -0
  11. package/dist/ui/assets/ChannelsPage-H6rgr8DQ.js +8 -0
  12. package/dist/ui/assets/DashboardPage-BIjYGf4m.js +6 -0
  13. package/dist/ui/assets/{LoginPage-BTxJdFVG.js → LoginPage-DazoxtBJ.js} +1 -1
  14. package/dist/ui/assets/{LogsPage-DVV2eHbh.js → LogsPage-DMZ6KtQ3.js} +1 -1
  15. package/dist/ui/assets/MeetingPage-CSLFvHL7.js +1 -0
  16. package/dist/ui/assets/ModelSelector-BCfvugHB.js +1 -0
  17. package/dist/ui/assets/{NotFound-BIUDlIXU.js → NotFound-Bpr12V51.js} +1 -1
  18. package/dist/ui/assets/Office3DPage-BE6Epe0d.js +4614 -0
  19. package/dist/ui/assets/Office3DPage-C3SIzd2H.css +1 -0
  20. package/dist/ui/assets/ProvidersPage-D0cApfM1.js +1 -0
  21. package/dist/ui/assets/{RecoverPage-7YDQysBL.js → RecoverPage-BVUPHG9z.js} +1 -1
  22. package/dist/ui/assets/SettingsPage-DCZ4nql4.js +9 -0
  23. package/dist/ui/assets/SetupPage-In19p30M.js +1 -0
  24. package/dist/ui/assets/WebChatPage-ByVBSzxL.js +29 -0
  25. package/dist/ui/assets/{activity-c3pNngT_.js → activity-BIIli7ET.js} +1 -1
  26. package/dist/ui/assets/agentCapabilities-D1PD9yFH.js +1 -0
  27. package/dist/ui/assets/alert-CQlRq6sv.js +1 -0
  28. package/dist/ui/assets/arrow-left-BfcnX8Er.js +1 -0
  29. package/dist/ui/assets/arrow-right-Q-dzAn8k.js +1 -0
  30. package/dist/ui/assets/arrow-up-right-Bf-8wrUQ.js +1 -0
  31. package/dist/ui/assets/badge-DKGZbVZJ.js +1 -0
  32. package/dist/ui/assets/{calendar-B-KZ9RQO.js → calendar-S9-_Q6QR.js} +1 -1
  33. package/dist/ui/assets/{card-CNf6BS2e.js → card-D3Nw3kh3.js} +1 -1
  34. package/dist/ui/assets/check-CryV78SQ.js +1 -0
  35. package/dist/ui/assets/chevron-down-QCtMs-Af.js +1 -0
  36. package/dist/ui/assets/chevron-left-dTGbyl5G.js +1 -0
  37. package/dist/ui/assets/chevron-right-D0GjXbnO.js +1 -0
  38. package/dist/ui/assets/chevron-up-Cg0jO8uT.js +1 -0
  39. package/dist/ui/assets/{circle-alert-KuAm2FWh.js → circle-alert-DTVW4R94.js} +1 -1
  40. package/dist/ui/assets/circle-check-BAolxswA.js +1 -0
  41. package/dist/ui/assets/{circle-x-DjLkFDO8.js → circle-x-CJXbXzRh.js} +1 -1
  42. package/dist/ui/assets/{copy-Bu5d7C-0.js → copy-X_TPpA-A.js} +1 -1
  43. package/dist/ui/assets/{dialog-Jk4bieO4.js → dialog-uUBz_NIB.js} +1 -1
  44. package/dist/ui/assets/dist-CD_qfA30.js +1 -0
  45. package/dist/ui/assets/{download-Cjbk4Rek.js → download-C-fXu08w.js} +1 -1
  46. package/dist/ui/assets/earth-CTsVjCmp.js +1 -0
  47. package/dist/ui/assets/ellipsis-vertical-5zBh5yzc.js +1 -0
  48. package/dist/ui/assets/{external-link-6sTlRDUR.js → external-link-CvpRhwC_.js} +1 -1
  49. package/dist/ui/assets/{eye-Df8o0tkC.js → eye-CM-HQEWU.js} +1 -1
  50. package/dist/ui/assets/{file-text-lnxnjBp0.js → file-text-lwkvYGtA.js} +1 -1
  51. package/dist/ui/assets/{gateway-url-DwzPmoc8.js → gateway-url-BlnabM5e.js} +1 -1
  52. package/dist/ui/assets/gauge-CB-cas-h.js +1 -0
  53. package/dist/ui/assets/{history-CAF_R34_.js → history-eSHspWRr.js} +1 -1
  54. package/dist/ui/assets/index-D489S18g.css +2 -0
  55. package/dist/ui/assets/index-ZjAc-KQS.js +116 -0
  56. package/dist/ui/assets/{info-WjromB4Y.js → info-DTgFQ_jA.js} +1 -1
  57. package/dist/ui/assets/key-CeM9JJkq.js +1 -0
  58. package/dist/ui/assets/label-k0jYxoWW.js +1 -0
  59. package/dist/ui/assets/loader-circle-Dtfz4FWw.js +1 -0
  60. package/dist/ui/assets/lock-open-B089GUAJ.js +1 -0
  61. package/dist/ui/assets/mail--gNFIe4M.js +1 -0
  62. package/dist/ui/assets/{pause-VqeUmp2Z.js → pause-DjT1nwQM.js} +1 -1
  63. package/dist/ui/assets/pencil-6PRgdjiU.js +1 -0
  64. package/dist/ui/assets/play-tOrP0xUJ.js +1 -0
  65. package/dist/ui/assets/plus-Cnom3j47.js +1 -0
  66. package/dist/ui/assets/progress-DrI2UDu-.js +1 -0
  67. package/dist/ui/assets/radio-D-joO9J0.js +1 -0
  68. package/dist/ui/assets/{refresh-cw-CCzDCAuz.js → refresh-cw-BRrzoHQW.js} +1 -1
  69. package/dist/ui/assets/scroll-area-CfHn94Vb.js +1 -0
  70. package/dist/ui/assets/search-D277MUP0.js +1 -0
  71. package/dist/ui/assets/select-BOR8MsSL.js +1 -0
  72. package/dist/ui/assets/{send-BPk9XbIq.js → send-DIlj81PT.js} +1 -1
  73. package/dist/ui/assets/{settings-BGfrZ_zM.js → settings-CkBjgAEm.js} +1 -1
  74. package/dist/ui/assets/{shield-CxhcUT39.js → shield-U0hIjGzm.js} +1 -1
  75. package/dist/ui/assets/slider-CmE_z1Ii.js +1 -0
  76. package/dist/ui/assets/{sparkles-BhwlS1pc.js → sparkles-VXHGDbNh.js} +1 -1
  77. package/dist/ui/assets/{square-DMNWw4Hi.js → square-OHeetvN3.js} +1 -1
  78. package/dist/ui/assets/switch-DXcELPsM.js +1 -0
  79. package/dist/ui/assets/tabs-CxiybXcw.js +1 -0
  80. package/dist/ui/assets/terminal-C6YPcJl_.js +1 -0
  81. package/dist/ui/assets/{textarea-B6Z1Zc6W.js → textarea-rp6vsOZl.js} +1 -1
  82. package/dist/ui/assets/{trash-2-xD2o4SgX.js → trash-2-DQxm7DUM.js} +1 -1
  83. package/dist/ui/assets/{triangle-alert-pVIJGjga.js → triangle-alert-Dj8ZhmWj.js} +1 -1
  84. package/dist/ui/assets/{useHiveAgentsModelLoad-BnC4jLE-.js → useHiveAgentsModelLoad-COLvs-Ho.js} +1 -1
  85. package/dist/ui/assets/useOfficeModel-Cy7cAyEn.js +1 -0
  86. package/dist/ui/assets/useProviders-q6iROeWE.js +1 -0
  87. package/dist/ui/assets/utils-Dyb7SC2_.js +1 -0
  88. package/dist/ui/assets/vendor-charts-K3xcRl0X.js +60 -0
  89. package/dist/ui/assets/{vendor-query-DsWPbQdG.js → vendor-query-Dj8xYhQD.js} +1 -1
  90. package/dist/ui/assets/vendor-radix-D0s_k6Gp.js +63 -0
  91. package/dist/ui/assets/vendor-react-CPJEWbIG.js +1 -0
  92. package/dist/ui/assets/{vendor-router-gqiZ7xhx.js → vendor-router-zpB-76nT.js} +1 -1
  93. package/dist/ui/assets/volume-x-Bm735CXN.js +1 -0
  94. package/dist/ui/assets/wifi-DklBfOZ6.js +1 -0
  95. package/dist/ui/assets/{zap-B4RaNNO5.js → zap-BEZNJ0i0.js} +1 -1
  96. package/dist/ui/index.html +16 -13
  97. package/dist/ui/logoblack.png +0 -0
  98. package/dist/ui/logocolor-dark.png +0 -0
  99. package/dist/ui/logocolorbg.png +0 -0
  100. package/dist/ui/logodoradobg.png +0 -0
  101. package/package.json +18 -15
  102. package/packages/cli/src/adapters/config.ts +1 -80
  103. package/packages/cli/src/adapters/factory.ts +0 -45
  104. package/packages/cli/src/adapters/index.ts +0 -8
  105. package/packages/cli/src/commands/doctor.ts +156 -1
  106. package/packages/cli/src/commands/gateway.ts +2 -9
  107. package/packages/cli/src/commands/onboard.ts +126 -59
  108. package/packages/cli/src/index.ts +9 -11
  109. package/packages/cli/src/ui-bundle.generated.ts +9 -92
  110. package/packages/core/src/agent/acceptance-checks.ts +172 -0
  111. package/packages/core/src/agent/agent-catalog.ts +348 -0
  112. package/packages/core/src/agent/agent-loop.ts +204 -28
  113. package/packages/core/src/agent/capability-search.ts +5 -5
  114. package/packages/core/src/agent/catalog-selector.ts +103 -0
  115. package/packages/core/src/agent/compaction.ts +52 -42
  116. package/packages/core/src/agent/context-compiler.ts +185 -63
  117. package/packages/core/src/agent/conversation-store.ts +56 -3
  118. package/packages/core/src/agent/curator.ts +129 -34
  119. package/packages/core/src/agent/delegation-runtime.ts +241 -0
  120. package/packages/core/src/agent/goal-runner.ts +111 -32
  121. package/packages/core/src/agent/index.ts +17 -0
  122. package/packages/core/src/agent/llm-client.ts +34 -2
  123. package/packages/core/src/agent/llm-providers/anthropic.ts +10 -7
  124. package/packages/core/src/agent/llm-providers/hiveagents.ts +1 -1
  125. package/packages/core/src/agent/llm-providers/interface.ts +16 -5
  126. package/packages/core/src/agent/llm-providers/modelscope.ts +5 -0
  127. package/packages/core/src/agent/llm-providers/openai-compat-base.ts +1 -1
  128. package/packages/core/src/agent/llm-providers/z-ai.ts +5 -0
  129. package/packages/core/src/agent/minimal-loadout.ts +47 -0
  130. package/packages/core/src/agent/playbook-selector.ts +1 -1
  131. package/packages/core/src/agent/prompt-builder.ts +4 -0
  132. package/packages/core/src/agent/proof-packet.ts +6 -1
  133. package/packages/core/src/agent/providers/index.ts +9 -4
  134. package/packages/core/src/agent/routing-intent.ts +22 -0
  135. package/packages/core/src/agent/run-store.ts +24 -3
  136. package/packages/core/src/agent/service.ts +2 -2
  137. package/packages/core/src/agent/skill-selector.ts +12 -31
  138. package/packages/core/src/agent/tool-selector.ts +61 -36
  139. package/packages/core/src/agent/tracer.ts +5 -1
  140. package/packages/core/src/artifacts/store.ts +162 -0
  141. package/packages/core/src/canvas/canvas-manager.ts +5 -234
  142. package/packages/core/src/canvas/emitter.ts +121 -69
  143. package/packages/core/src/canvas/index.ts +0 -2
  144. package/packages/core/src/channels/base.ts +3 -1
  145. package/packages/core/src/channels/manager.ts +117 -25
  146. package/packages/core/src/channels/webchat.ts +4 -8
  147. package/packages/core/src/channels/whatsapp.ts +6 -1
  148. package/packages/core/src/config/loader.ts +13 -23
  149. package/packages/core/src/events/agent-bus.ts +0 -31
  150. package/packages/core/src/events/channel-narration.ts +150 -0
  151. package/packages/core/src/events/narration.ts +82 -0
  152. package/packages/core/src/events/tool-narration.ts +62 -0
  153. package/packages/core/src/gateway/channel-notify.ts +43 -10
  154. package/packages/core/src/gateway/delegation-groups.ts +258 -0
  155. package/packages/core/src/gateway/delegation-notify.ts +103 -0
  156. package/packages/core/src/gateway/durable-queue.ts +33 -2
  157. package/packages/core/src/gateway/helpers/index.ts +2 -2
  158. package/packages/core/src/gateway/helpers/narration.ts +4 -57
  159. package/packages/core/src/gateway/helpers/redact.ts +1 -1
  160. package/packages/core/src/gateway/helpers/ui-source.ts +67 -0
  161. package/packages/core/src/gateway/initializer.ts +15 -13
  162. package/packages/core/src/gateway/job-executors.ts +197 -104
  163. package/packages/core/src/gateway/lane-queue.ts +1 -1
  164. package/packages/core/src/gateway/notification-inbox.ts +57 -0
  165. package/packages/core/src/gateway/resolver.ts +11 -25
  166. package/packages/core/src/gateway/routes/agents.ts +91 -1
  167. package/packages/core/src/gateway/routes/auth.ts +21 -42
  168. package/packages/core/src/gateway/routes/channels.ts +15 -1
  169. package/packages/core/src/gateway/routes/chat.ts +6 -6
  170. package/packages/core/src/gateway/routes/cron-api.ts +0 -4
  171. package/packages/core/src/gateway/routes/mcp.ts +0 -63
  172. package/packages/core/src/gateway/routes/meeting.ts +245 -0
  173. package/packages/core/src/gateway/routes/models.ts +69 -12
  174. package/packages/core/src/gateway/routes/providers.ts +111 -28
  175. package/packages/core/src/gateway/routes/setup.ts +92 -35
  176. package/packages/core/src/gateway/routes/skills.ts +2 -2
  177. package/packages/core/src/gateway/routes/system.ts +31 -10
  178. package/packages/core/src/gateway/routes/users.ts +24 -1
  179. package/packages/core/src/gateway/routes/voice.ts +3 -0
  180. package/packages/core/src/gateway/server.ts +207 -141
  181. package/packages/core/src/gateway/session.ts +6 -4
  182. package/packages/core/src/gateway/slash-commands.ts +7 -6
  183. package/packages/core/src/gateway/webchat-turn.ts +63 -13
  184. package/packages/core/src/index.ts +3 -0
  185. package/packages/core/src/mcp/hot-reload.ts +14 -7
  186. package/packages/core/src/mcp/singleton.ts +0 -3
  187. package/packages/core/src/mcp/tool-sync.ts +2 -2
  188. package/packages/core/src/resilience/retry.ts +1 -1
  189. package/packages/core/src/scheduler/CronScheduler.ts +3 -1
  190. package/packages/core/src/scheduler/integration.ts +1 -1
  191. package/packages/core/src/storage/bootstrap.ts +34 -10
  192. package/packages/core/src/storage/collections.ts +167 -27
  193. package/packages/core/src/storage/crypto.ts +147 -58
  194. package/packages/core/src/storage/hivedb.ts +9 -0
  195. package/packages/core/src/storage/model-id.ts +53 -0
  196. package/packages/core/src/storage/onboarding.ts +160 -34
  197. package/packages/core/src/storage/reconcile.ts +2 -5
  198. package/packages/core/src/storage/seed.ts +436 -158
  199. package/packages/core/src/storage/usage.ts +61 -132
  200. package/packages/core/src/storage/user-email.ts +11 -0
  201. package/packages/core/src/tool-runtime/index.ts +69 -23
  202. package/packages/core/src/tool-runtime/worker-tools.ts +4 -2
  203. package/packages/core/src/{canvas/a2ui-tools.ts → tools/a2ui/index.ts} +17 -8
  204. package/packages/core/src/tools/agents/index.ts +566 -85
  205. package/packages/core/src/tools/core/index.ts +28 -10
  206. package/packages/core/src/tools/cron/index.ts +1 -6
  207. package/packages/core/src/tools/index.ts +19 -46
  208. package/packages/core/src/tools/types.ts +1 -1
  209. package/packages/core/src/tools/web/artifact-inspect.ts +23 -0
  210. package/packages/core/src/tools/web/browser-backend.ts +129 -0
  211. package/packages/core/src/tools/web/browser-screenshot.ts +26 -5
  212. package/packages/core/src/tools/web/browser-service.ts +75 -35
  213. package/packages/core/src/tools/web/index.ts +3 -0
  214. package/packages/core/src/tools/web/webview-backend.ts +412 -0
  215. package/packages/core/src/utils/logger.ts +58 -30
  216. package/packages/core/src/utils/toon.ts +0 -20
  217. package/packages/core/src/voice/index.ts +108 -17
  218. package/packages/mcp/src/manager.ts +8 -7
  219. package/packages/mcp/src/transports/sse.ts +0 -4
  220. package/packages/mcp/src/transports/websocket.ts +0 -6
  221. package/packages/skills/src/bundled/{canvas → a2ui}/a2ui_dashboard/SKILL.md +4 -4
  222. package/packages/skills/src/bundled/{canvas → a2ui}/a2ui_form/SKILL.md +4 -4
  223. package/packages/skills/src/bundled/{canvas → a2ui}/a2ui_interactive/SKILL.md +5 -5
  224. package/packages/skills/src/bundled/agents/agent_spawner/SKILL.md +24 -18
  225. package/packages/skills/src/bundled/agents/task_orchestrator/SKILL.md +48 -148
  226. package/packages/skills/src/bundled/cli/cli_pipeline/SKILL.md +9 -10
  227. package/packages/skills/src/bundled/cli/cli_safe_exec/SKILL.md +1 -1
  228. package/packages/skills/src/bundled/cli/software_engineering/SKILL.md +23 -0
  229. package/packages/skills/src/bundled/cron_manager/SKILL.md +2 -2
  230. package/packages/skills/src/bundled/cron_reminder/SKILL.md +7 -7
  231. package/packages/skills/src/bundled/filesystem/file_read_and_summarize/SKILL.md +11 -10
  232. package/packages/skills/src/bundled/filesystem/file_writer/SKILL.md +29 -35
  233. package/packages/skills/src/bundled/filesystem/workspace_file_operator/SKILL.md +22 -0
  234. package/packages/skills/src/bundled/search_knowledge/capability_discovery/SKILL.md +5 -4
  235. package/packages/skills/src/bundled-data.generated.ts +640 -1226
  236. package/dist/ui/assets/AgentCreateForm-DzaIT-dA.js +0 -1
  237. package/dist/ui/assets/AgentDetailPage-DgqcJceY.js +0 -1
  238. package/dist/ui/assets/AgentNewPage-CNSpoOSA.js +0 -1
  239. package/dist/ui/assets/AgentsPage-BMUJzTD6.js +0 -10
  240. package/dist/ui/assets/ApiClientPage-Cum_a_3j.js +0 -3
  241. package/dist/ui/assets/CanvasPage-o6oCP6uq.js +0 -33
  242. package/dist/ui/assets/ChannelsPage-WrB0zwLq.js +0 -8
  243. package/dist/ui/assets/DashboardPage-BCd6kNw0.js +0 -6
  244. package/dist/ui/assets/MeetingPage-BULIAWzq.js +0 -1
  245. package/dist/ui/assets/ModelSelector-BMYOChYb.js +0 -1
  246. package/dist/ui/assets/ProvidersPage-BVN5UZrI.js +0 -1
  247. package/dist/ui/assets/SettingsPage-CYmpFfDn.js +0 -9
  248. package/dist/ui/assets/SetupPage-Dnmb1Lbv.js +0 -1
  249. package/dist/ui/assets/WebChatPage-DmmdFhIC.js +0 -16
  250. package/dist/ui/assets/accordion-CnLzKNHK.js +0 -1
  251. package/dist/ui/assets/alert-B9J6KHmt.js +0 -1
  252. package/dist/ui/assets/alert-dialog-KcYQWcJ6.js +0 -1
  253. package/dist/ui/assets/arrow-left-CBcbX5EZ.js +0 -1
  254. package/dist/ui/assets/badge-88dRb4M8.js +0 -1
  255. package/dist/ui/assets/bell-8BqRYmzf.js +0 -1
  256. package/dist/ui/assets/chevron-down-DIosfU_U.js +0 -1
  257. package/dist/ui/assets/chevron-left-D4U-5A27.js +0 -1
  258. package/dist/ui/assets/chevron-right-CR4Skrf3.js +0 -1
  259. package/dist/ui/assets/chevron-up-CI-W21Fy.js +0 -1
  260. package/dist/ui/assets/circle-check-6Ard1-2z.js +0 -1
  261. package/dist/ui/assets/dropdown-menu-DDiaHg5y.js +0 -1
  262. package/dist/ui/assets/es-4I-joeZz.js +0 -1
  263. package/dist/ui/assets/folder-open-DJBLDFjv.js +0 -1
  264. package/dist/ui/assets/format-DsLPBxvt.js +0 -1
  265. package/dist/ui/assets/gauge-B8Tj43rC.js +0 -1
  266. package/dist/ui/assets/hexagon-6L79pgVK.js +0 -1
  267. package/dist/ui/assets/index-BmwTAwOF.css +0 -2
  268. package/dist/ui/assets/index-Cyw7L0Li.js +0 -116
  269. package/dist/ui/assets/key-DyKOoQh5.js +0 -1
  270. package/dist/ui/assets/label-B_15zZlR.js +0 -1
  271. package/dist/ui/assets/loader-circle-BmBOgYze.js +0 -1
  272. package/dist/ui/assets/lock-BS6OLXPv.js +0 -1
  273. package/dist/ui/assets/play-zJpWuhrr.js +0 -1
  274. package/dist/ui/assets/plus-BZQX26Dr.js +0 -1
  275. package/dist/ui/assets/progress-D5c-Eilm.js +0 -1
  276. package/dist/ui/assets/scroll-area-CihOx0cb.js +0 -1
  277. package/dist/ui/assets/search-DzDptO9s.js +0 -1
  278. package/dist/ui/assets/select-BQCOjM2j.js +0 -1
  279. package/dist/ui/assets/slider-bcUiUfx0.js +0 -14
  280. package/dist/ui/assets/switch-BR30E4ej.js +0 -1
  281. package/dist/ui/assets/table-B3aGEaVp.js +0 -1
  282. package/dist/ui/assets/tabs-LQidMKRS.js +0 -1
  283. package/dist/ui/assets/terminal--7G943As.js +0 -1
  284. package/dist/ui/assets/useProviders-C1xVKLxB.js +0 -1
  285. package/dist/ui/assets/utils-3pnRFmFe.js +0 -1
  286. package/dist/ui/assets/vendor-charts-Bu2lyBKP.js +0 -65
  287. package/dist/ui/assets/vendor-radix-D6rA7xKY.js +0 -63
  288. package/dist/ui/assets/vendor-react-BU5iQU4f.js +0 -1
  289. package/dist/ui/assets/volume-2-BekVQl6P.js +0 -1
  290. package/packages/core/src/agent/context-guard.ts +0 -91
  291. package/packages/core/src/agent/hooks.ts +0 -166
  292. package/packages/core/src/agent/providers.ts +0 -1
  293. package/packages/core/src/auth/auth.ts +0 -111
  294. package/packages/core/src/auth/index.ts +0 -1
  295. package/packages/core/src/canvas/canvas-tools.ts +0 -448
  296. package/packages/core/src/gateway/router.ts +0 -126
  297. package/packages/core/src/scheduler/dag/AgentExecutor.ts +0 -53
  298. package/packages/core/src/scheduler/dag/DAGScheduler.ts +0 -250
  299. package/packages/core/src/scheduler/dag/EventBridge.ts +0 -122
  300. package/packages/core/src/scheduler/dag/TaskGraph.ts +0 -192
  301. package/packages/core/src/scheduler/dag/TaskNode.ts +0 -97
  302. package/packages/core/src/scheduler/dag/TaskResult.ts +0 -22
  303. package/packages/core/src/scheduler/dag/errors.ts +0 -37
  304. package/packages/core/src/scheduler/dag/index.ts +0 -26
  305. package/packages/core/src/scheduler/dag/presets/ResearchPreset.ts +0 -97
  306. package/packages/core/src/scheduler/dag/strategies/ParallelStrategy.ts +0 -21
  307. package/packages/core/src/scheduler/dag/strategies/PriorityStrategy.ts +0 -46
  308. package/packages/core/src/scheduler/index.ts +0 -22
  309. package/packages/core/src/scheduler/task-driver.ts +0 -216
  310. package/packages/core/src/tools/canvas/index.ts +0 -420
  311. package/packages/core/src/tools/meeting/index.ts +0 -336
  312. package/packages/core/src/tools/projects/index.ts +0 -348
  313. package/packages/core/src/tools/voice/index.ts +0 -104
  314. package/packages/core/src/utils/index.ts +0 -5
  315. package/packages/skills/src/bundled/agents/code_delegator/SKILL.md +0 -156
  316. package/packages/skills/src/bundled/canvas/canvas_dashboard/SKILL.md +0 -146
  317. package/packages/skills/src/bundled/canvas/canvas_interact/SKILL.md +0 -148
  318. package/packages/skills/src/bundled/canvas/canvas_report/SKILL.md +0 -146
  319. package/packages/skills/src/bundled/meeting/meeting_transcription/SKILL.md +0 -213
  320. package/packages/skills/src/bundled/voice/voice_assistant/SKILL.md +0 -174
  321. package/packages/skills/src/bundled/voice/voice_input/SKILL.md +0 -146
  322. package/packages/skills/src/bundled/voice/voice_output/SKILL.md +0 -151
@@ -1,250 +0,0 @@
1
- /**
2
- * DAGScheduler — Main orchestrator
3
- *
4
- * Executes a TaskGraph by:
5
- * 1. Identifying all nodes with no dependencies → mark READY
6
- * 2. Launching them concurrently via AgentExecutor (respecting maxConcurrentWorkers)
7
- * 3. When a node completes, finding newly unblocked nodes and launching them
8
- * 4. Propagating failures to dependent nodes
9
- * 5. Emitting progress via EventBridge → agentBus + canvas
10
- *
11
- * Parallelism model: Promise.race() over a Set of active promises + a FIFO/priority
12
- * queue of READY nodes waiting for a slot. No Bun Worker threads — workers are async
13
- * agent calls (runAgentIsolated) running concurrently in the same process.
14
- */
15
-
16
- import { writeFileSync, mkdirSync, existsSync } from "node:fs"
17
- import * as path from "node:path"
18
- import { logger } from "../../utils/logger"
19
- import { TaskGraph } from "./TaskGraph"
20
- import { TaskNode } from "./TaskNode"
21
- import { AgentExecutor } from "./AgentExecutor"
22
- import { EventBridge } from "./EventBridge"
23
- import { TaskFailureError } from "./errors"
24
- import type { DAGResult, NodeSummary } from "./TaskResult"
25
- import type { ExecutionStrategy } from "./strategies/ParallelStrategy"
26
- import { ParallelStrategy } from "./strategies/ParallelStrategy"
27
-
28
- const log = logger.child("dag-scheduler")
29
-
30
- export interface IAgentExecutor {
31
- execute(node: TaskNode, depResults: Record<string, string>, threadId: string): Promise<string>
32
- }
33
-
34
- export interface DAGSchedulerOptions {
35
- strategy?: ExecutionStrategy
36
- maxConcurrentWorkers?: number
37
- /** Project ID for agentBus/canvas events */
38
- projectId?: string
39
- /** Coordinator agent ID for agentBus events */
40
- coordinatorId?: string
41
- /** Disables ASCII log and file logging. Default: false in development */
42
- silent?: boolean
43
- /** Custom executor — defaults to AgentExecutor (runAgentIsolated). Override to bypass context-compiler. */
44
- executor?: IAgentExecutor
45
- }
46
-
47
- export class DAGScheduler {
48
- private strategy: ExecutionStrategy
49
- private maxConcurrentWorkers: number
50
- private executor: IAgentExecutor
51
- private aborted = false
52
-
53
- constructor(options: DAGSchedulerOptions = {}) {
54
- this.strategy = options.strategy ?? new ParallelStrategy()
55
- this.maxConcurrentWorkers = options.maxConcurrentWorkers ?? 2
56
- this.executor = options.executor ?? new AgentExecutor()
57
- }
58
-
59
- abort(): void {
60
- this.aborted = true
61
- }
62
-
63
- async execute(graph: TaskGraph, options: DAGSchedulerOptions = {}): Promise<DAGResult> {
64
- this.aborted = false
65
- const swarmId = crypto.randomUUID()
66
- const startedAt = Date.now()
67
-
68
- const projectId = options.projectId ?? `swarm:${swarmId}`
69
- const coordinatorId = options.coordinatorId ?? "dag-scheduler"
70
- const silent = options.silent ?? (process.env.NODE_ENV === "production")
71
-
72
- const bridge = new EventBridge(swarmId, projectId, coordinatorId)
73
-
74
- // Allow strategy to precompute (e.g. critical path)
75
- if (this.strategy.initialize) {
76
- this.strategy.initialize(graph.nodes)
77
- }
78
-
79
- bridge.onSwarmStarted(graph.nodes.size)
80
- this.logState(swarmId, graph, startedAt, silent, swarmId)
81
-
82
- // Seed the READY queue with nodes that have no dependencies
83
- const readyQueue: TaskNode[] = []
84
- const completedIds = graph.getCompletedIds()
85
-
86
- for (const node of graph.nodes.values()) {
87
- if (node.deps.length === 0) {
88
- node.markReady()
89
- readyQueue.push(node)
90
- }
91
- }
92
-
93
- // Active promise set — we track them with a wrapper so we can drain
94
- const running = new Set<Promise<void>>()
95
-
96
- const launchNode = (node: TaskNode): void => {
97
- if (this.aborted) return
98
-
99
- node.markRunning()
100
- bridge.onTaskStarted(node)
101
- this.logState(swarmId, graph, startedAt, silent, swarmId)
102
-
103
- const depResults = graph.getDepResults(node.id)
104
- const threadId = `dag-${swarmId}-${node.id}`
105
-
106
- const p: Promise<void> = this.executor
107
- .execute(node, depResults, threadId)
108
- .then(result => {
109
- node.markCompleted(result)
110
- log.info(`[DAG] ${node.name} COMPLETED in ${node.elapsedSeconds()}s`)
111
- bridge.onTaskCompleted(node, graph.getProgress())
112
- this.logState(swarmId, graph, startedAt, silent, swarmId)
113
-
114
- // Unlock dependent nodes
115
- const newlyReady = graph.getNewlyReadyNodes(graph.getCompletedIds())
116
- for (const n of newlyReady) {
117
- n.markReady()
118
- readyQueue.push(n)
119
- }
120
- })
121
- .catch(err => {
122
- const error = err instanceof Error ? err.message : String(err)
123
-
124
- if (node.canRetry()) {
125
- node.retryCount++
126
- log.warn(`[DAG] ${node.name} failed (retry ${node.retryCount}/${node.maxRetries}): ${error}`)
127
- node.status = "PENDING"
128
- node.markReady()
129
- readyQueue.push(node)
130
- } else {
131
- node.markFailed(error)
132
- log.error(`[DAG] ${node.name} FAILED permanently: ${error}`)
133
- bridge.onTaskFailed(node, graph.getProgress())
134
- graph.propagateFailure(node.id, error)
135
- this.logState(swarmId, graph, startedAt, silent, swarmId)
136
- }
137
- })
138
- .finally(() => {
139
- running.delete(p)
140
- drain()
141
- })
142
-
143
- running.add(p)
144
- }
145
-
146
- // Drain the ready queue into available worker slots
147
- const drain = (): void => {
148
- while (readyQueue.length > 0 && running.size < this.maxConcurrentWorkers && !this.aborted) {
149
- const node = this.strategy.pick(readyQueue)
150
- if (!node) break
151
- launchNode(node)
152
- }
153
- }
154
-
155
- // Start initial drain
156
- drain()
157
-
158
- // Wait until the graph is complete
159
- while (!graph.isComplete() && !this.aborted) {
160
- if (running.size === 0 && readyQueue.length === 0) {
161
- // Deadlock guard: no running, nothing ready, but graph not done
162
- // This can happen if all remaining nodes are FAILED
163
- break
164
- }
165
- // Wait for any active promise to settle
166
- if (running.size > 0) {
167
- await Promise.race([...running])
168
- drain()
169
- } else {
170
- // Brief yield to let microtasks settle
171
- await new Promise(resolve => setTimeout(resolve, 10))
172
- }
173
- }
174
-
175
- // Collect results
176
- const completed: NodeSummary[] = []
177
- const failed: NodeSummary[] = []
178
-
179
- for (const node of graph.nodes.values()) {
180
- const summary: NodeSummary = {
181
- id: node.id,
182
- name: node.name,
183
- status: node.status === "COMPLETED" ? "COMPLETED" : "FAILED",
184
- durationMs: node.startedAt ? (node.completedAt ?? Date.now()) - node.startedAt : 0,
185
- result: node.result,
186
- error: node.error,
187
- retries: node.retryCount,
188
- }
189
- if (node.status === "COMPLETED") completed.push(summary)
190
- else failed.push(summary)
191
- }
192
-
193
- const result: DAGResult = {
194
- swarmId,
195
- totalDurationMs: Date.now() - startedAt,
196
- completed,
197
- failed,
198
- success: failed.length === 0,
199
- }
200
-
201
- bridge.onSwarmCompleted(result)
202
- this.logState(swarmId, graph, startedAt, silent, swarmId)
203
-
204
- log.info(`[DAG] swarm ${swarmId} finished. ${completed.length} completed, ${failed.length} failed. Total: ${Math.round(result.totalDurationMs / 1000)}s`)
205
-
206
- return result
207
- }
208
-
209
- // ─── ASCII log ───────────────────────────────────────────────────────────────
210
-
211
- private logState(
212
- swarmId: string,
213
- graph: TaskGraph,
214
- startedAt: number,
215
- silent: boolean,
216
- sessionId: string
217
- ): void {
218
- const elapsed = Math.round((Date.now() - startedAt) / 1000)
219
- const lines: string[] = [`[DAG] swarm:${swarmId.slice(0, 8)} T+${elapsed}s`]
220
-
221
- for (const node of graph.nodes.values()) {
222
- const icon =
223
- node.status === "COMPLETED" ? "✓" :
224
- node.status === "FAILED" ? "✗" :
225
- node.status === "RUNNING" ? "●" : "○"
226
-
227
- const depStr = node.deps.length > 0 ? ` (deps: ${node.deps.join(", ")})` : ""
228
- const timeStr = node.startedAt ? ` (${node.elapsedSeconds()}s)` : ""
229
- const statusLabel = node.status.padEnd(10)
230
-
231
- lines.push(` ${icon} ${node.name.padEnd(24)} ${statusLabel}${timeStr}${depStr}`)
232
- }
233
-
234
- const output = lines.join("\n")
235
-
236
- if (!silent) {
237
- // Write to log file (never committed — in .gitignore)
238
- try {
239
- const logDir = path.join(process.cwd(), "packages", "core", "logs")
240
- if (!existsSync(logDir)) mkdirSync(logDir, { recursive: true })
241
- const logFile = path.join(logDir, `dag-${sessionId.slice(0, 8)}.log`)
242
- writeFileSync(logFile, output + "\n\n", { flag: "a" })
243
- } catch {
244
- // Non-critical — never throw for logging
245
- }
246
- }
247
-
248
- log.debug(output)
249
- }
250
- }
@@ -1,122 +0,0 @@
1
- /**
2
- * DAGScheduler — EventBridge
3
- *
4
- * Maps DAG lifecycle events to the existing agentBus so that the rest of
5
- * Hive OSS can observe swarm progress without coupling to DAGScheduler directly.
6
- *
7
- * Also emits canvas:node_update events so the UI reflects task state in real time.
8
- */
9
-
10
- import { agentBus } from "../../events/agent-bus"
11
- import { emitCanvas } from "../../canvas/emitter"
12
- import { TaskNode } from "./TaskNode"
13
- import { DAGResult } from "./TaskResult"
14
-
15
- const STATUS_TO_CANVAS: Record<string, string> = {
16
- RUNNING: "thinking",
17
- COMPLETED: "idle",
18
- FAILED: "error",
19
- }
20
-
21
- export class EventBridge {
22
- private swarmId: string
23
- private projectId: string
24
- private coordinatorId: string
25
-
26
- constructor(swarmId: string, projectId: string, coordinatorId: string) {
27
- this.swarmId = swarmId
28
- this.projectId = projectId
29
- this.coordinatorId = coordinatorId
30
- }
31
-
32
- onSwarmStarted(totalTasks: number): void {
33
- agentBus.publish("project:started", {
34
- projectId: this.projectId,
35
- projectName: `swarm:${this.swarmId}`,
36
- coordinatorId: this.coordinatorId,
37
- timestamp: Date.now(),
38
- })
39
-
40
- emitCanvas("canvas:node_update", {
41
- nodeId: this.projectId,
42
- changes: { status: "thinking", label: `Swarm started (${totalTasks} tasks)` },
43
- })
44
- }
45
-
46
- onTaskStarted(node: TaskNode): void {
47
- agentBus.notifyTaskStarted(
48
- node.agentId,
49
- node.name,
50
- 0, // task numeric ID not tracked here — DAG uses string IDs
51
- node.name,
52
- this.projectId
53
- )
54
-
55
- emitCanvas("canvas:node_update", {
56
- nodeId: node.agentId,
57
- changes: { status: STATUS_TO_CANVAS["RUNNING"], label: node.name },
58
- })
59
- }
60
-
61
- onTaskCompleted(node: TaskNode, progress: number): void {
62
- agentBus.notifyTaskCompleted(
63
- node.agentId,
64
- node.name,
65
- 0,
66
- node.name,
67
- this.projectId,
68
- node.result ?? ""
69
- )
70
-
71
- emitCanvas("canvas:node_update", {
72
- nodeId: node.agentId,
73
- changes: { status: STATUS_TO_CANVAS["COMPLETED"], progress },
74
- })
75
-
76
- // Broadcast overall swarm progress
77
- agentBus.publish("message:custom", {
78
- fromWorkerId: this.coordinatorId,
79
- fromWorkerName: "DAGScheduler",
80
- topic: "swarm:progress",
81
- content: String(progress),
82
- timestamp: Date.now(),
83
- })
84
- }
85
-
86
- onTaskFailed(node: TaskNode, progress: number): void {
87
- agentBus.notifyTaskFailed(
88
- node.agentId,
89
- node.name,
90
- 0,
91
- node.name,
92
- this.projectId,
93
- node.error ?? "unknown error"
94
- )
95
-
96
- emitCanvas("canvas:node_update", {
97
- nodeId: node.agentId,
98
- changes: { status: STATUS_TO_CANVAS["FAILED"] },
99
- })
100
- }
101
-
102
- onSwarmCompleted(result: DAGResult): void {
103
- const summary = `Completed ${result.completed.length}/${result.completed.length + result.failed.length} tasks in ${Math.round(result.totalDurationMs / 1000)}s`
104
-
105
- agentBus.publish("project:completed", {
106
- projectId: this.projectId,
107
- projectName: `swarm:${this.swarmId}`,
108
- coordinatorId: this.coordinatorId,
109
- summary,
110
- timestamp: Date.now(),
111
- })
112
-
113
- emitCanvas("canvas:node_update", {
114
- nodeId: this.projectId,
115
- changes: {
116
- status: result.success ? "idle" : "error",
117
- progress: 100,
118
- label: summary,
119
- },
120
- })
121
- }
122
- }
@@ -1,192 +0,0 @@
1
- /**
2
- * DAGScheduler — TaskGraph
3
- *
4
- * Owns the full set of TaskNodes for one swarm execution.
5
- * Responsibilities:
6
- * 1. Validate no cyclic dependencies (DFS) at construction time
7
- * 2. Calculate the critical path (longest weighted path)
8
- * 3. Provide runtime queries: ready nodes, overall progress
9
- */
10
-
11
- import { TaskNode, type TaskNodeConfig } from "./TaskNode"
12
- import { CyclicDependencyError } from "./errors"
13
-
14
- export class TaskGraph {
15
- readonly nodes: Map<string, TaskNode>
16
- private criticalPath_: string[] | null = null
17
-
18
- constructor(configs: TaskNodeConfig[]) {
19
- this.nodes = new Map(configs.map(c => [c.id, new TaskNode(c)]))
20
- this.validateNoCycles()
21
- }
22
-
23
- // ─── Validation ─────────────────────────────────────────────────────────────
24
-
25
- private validateNoCycles(): void {
26
- // Three-color DFS: WHITE=unvisited, GRAY=in-stack, BLACK=done
27
- const WHITE = 0, GRAY = 1, BLACK = 2
28
- const color = new Map<string, number>()
29
-
30
- for (const id of this.nodes.keys()) color.set(id, WHITE)
31
-
32
- const path: string[] = []
33
-
34
- const visit = (id: string): void => {
35
- color.set(id, GRAY)
36
- path.push(id)
37
-
38
- const node = this.nodes.get(id)!
39
- for (const dep of node.deps) {
40
- if (!this.nodes.has(dep)) {
41
- throw new Error(`TaskGraph: node "${id}" depends on unknown node "${dep}"`)
42
- }
43
- const c = color.get(dep)!
44
- if (c === GRAY) {
45
- // Found back-edge: reconstruct cycle
46
- const cycleStart = path.indexOf(dep)
47
- throw new CyclicDependencyError([...path.slice(cycleStart), dep])
48
- }
49
- if (c === WHITE) visit(dep)
50
- }
51
-
52
- path.pop()
53
- color.set(id, BLACK)
54
- }
55
-
56
- for (const id of this.nodes.keys()) {
57
- if (color.get(id) === WHITE) visit(id)
58
- }
59
- }
60
-
61
- // ─── Critical Path ───────────────────────────────────────────────────────────
62
-
63
- /**
64
- * Returns the IDs of the longest dependency chain (by node count).
65
- * Nodes on this path get higher priority in PriorityStrategy.
66
- */
67
- getCriticalPath(): string[] {
68
- if (this.criticalPath_) return this.criticalPath_
69
-
70
- // longest[id] = length of longest path ending at id (inclusive)
71
- const longest = new Map<string, number>()
72
- const predecessor = new Map<string, string | null>()
73
-
74
- const compute = (id: string): number => {
75
- if (longest.has(id)) return longest.get(id)!
76
- const node = this.nodes.get(id)!
77
- if (node.deps.length === 0) {
78
- longest.set(id, 1)
79
- predecessor.set(id, null)
80
- return 1
81
- }
82
- let max = 0
83
- let maxPred: string | null = null
84
- for (const dep of node.deps) {
85
- const l = compute(dep)
86
- if (l > max) { max = l; maxPred = dep }
87
- }
88
- longest.set(id, max + 1)
89
- predecessor.set(id, maxPred)
90
- return max + 1
91
- }
92
-
93
- for (const id of this.nodes.keys()) compute(id)
94
-
95
- // Find sink with max longest
96
- let sinkId = ""
97
- let maxLen = 0
98
- for (const [id, len] of longest) {
99
- if (len > maxLen) { maxLen = len; sinkId = id }
100
- }
101
-
102
- // Reconstruct path from sink to source, then reverse
103
- const path: string[] = []
104
- let cur: string | null = sinkId
105
- while (cur !== null) {
106
- path.push(cur)
107
- cur = predecessor.get(cur) ?? null
108
- }
109
- path.reverse()
110
-
111
- this.criticalPath_ = path
112
- return path
113
- }
114
-
115
- // ─── Runtime queries ─────────────────────────────────────────────────────────
116
-
117
- /** Nodes that are still PENDING but now have all deps completed */
118
- getNewlyReadyNodes(completedIds: Set<string>): TaskNode[] {
119
- const ready: TaskNode[] = []
120
- for (const node of this.nodes.values()) {
121
- if (node.status === "PENDING" && node.canStart(completedIds)) {
122
- ready.push(node)
123
- }
124
- }
125
- return ready
126
- }
127
-
128
- /** All nodes currently in READY state */
129
- getReadyNodes(): TaskNode[] {
130
- return [...this.nodes.values()].filter(n => n.status === "READY")
131
- }
132
-
133
- /** IDs of all COMPLETED nodes */
134
- getCompletedIds(): Set<string> {
135
- const ids = new Set<string>()
136
- for (const [id, node] of this.nodes) {
137
- if (node.status === "COMPLETED") ids.add(id)
138
- }
139
- return ids
140
- }
141
-
142
- /** Collect results of all deps for a given node */
143
- getDepResults(nodeId: string): Record<string, string> {
144
- const node = this.nodes.get(nodeId)!
145
- const results: Record<string, string> = {}
146
- for (const dep of node.deps) {
147
- const depNode = this.nodes.get(dep)!
148
- if (depNode.result !== undefined) results[dep] = depNode.result
149
- }
150
- return results
151
- }
152
-
153
- /** 0–100 progress based on nodes in terminal state */
154
- getProgress(): number {
155
- const total = this.nodes.size
156
- if (total === 0) return 100
157
- let done = 0
158
- for (const node of this.nodes.values()) {
159
- if (node.status === "COMPLETED" || node.status === "FAILED") done++
160
- }
161
- return Math.round((done / total) * 100)
162
- }
163
-
164
- /** True when every node is in a terminal state */
165
- isComplete(): boolean {
166
- for (const node of this.nodes.values()) {
167
- if (node.status === "PENDING" || node.status === "READY" || node.status === "RUNNING") {
168
- return false
169
- }
170
- }
171
- return true
172
- }
173
-
174
- /** Propagate FAILED status to all nodes that depend (directly or transitively) on failedId */
175
- propagateFailure(failedId: string, reason: string): void {
176
- const failedSet = new Set<string>([failedId])
177
-
178
- let changed = true
179
- while (changed) {
180
- changed = false
181
- for (const node of this.nodes.values()) {
182
- if (node.status === "PENDING" || node.status === "READY") {
183
- if (node.deps.some(d => failedSet.has(d))) {
184
- node.markFailed(`dependency_failed: ${reason}`)
185
- failedSet.add(node.id)
186
- changed = true
187
- }
188
- }
189
- }
190
- }
191
- }
192
- }
@@ -1,97 +0,0 @@
1
- /**
2
- * DAGScheduler — TaskNode
3
- *
4
- * Represents a single node in the task graph. Tracks its own state,
5
- * retry count, timing, and the results of its dependencies.
6
- */
7
-
8
- export type NodeStatus = "PENDING" | "READY" | "RUNNING" | "COMPLETED" | "FAILED"
9
-
10
- export interface TaskNodeConfig {
11
- /** Unique ID within this graph (can match the `tasks` collection's task.id) */
12
- id: string
13
- /** agents.id of the worker agent to execute */
14
- agentId: string
15
- /** Human-readable name for logging */
16
- name: string
17
- /** Task description passed to the worker */
18
- taskDescription: string
19
- /** IDs of other TaskNodes that must complete first */
20
- deps: string[]
21
- /** Timeout in ms before the task is cancelled. Default: 120_000 */
22
- timeout?: number
23
- /** How many times to retry on failure. Default: 1 */
24
- maxRetries?: number
25
- /** Priority hint for PriorityStrategy. Higher = runs first. Default: 0 */
26
- priority?: number
27
- /** Optional arbitrary metadata forwarded to the worker */
28
- metadata?: Record<string, unknown>
29
- }
30
-
31
- export class TaskNode {
32
- readonly id: string
33
- readonly agentId: string
34
- readonly name: string
35
- readonly taskDescription: string
36
- readonly deps: string[]
37
- readonly timeout: number
38
- readonly maxRetries: number
39
- readonly priority: number
40
- readonly metadata: Record<string, unknown>
41
-
42
- status: NodeStatus = "PENDING"
43
- retryCount = 0
44
- startedAt?: number
45
- completedAt?: number
46
- result?: string
47
- error?: string
48
-
49
- constructor(config: TaskNodeConfig) {
50
- this.id = config.id
51
- this.agentId = config.agentId
52
- this.name = config.name
53
- this.taskDescription = config.taskDescription
54
- this.deps = config.deps
55
- this.timeout = config.timeout ?? 120_000
56
- this.maxRetries = config.maxRetries ?? 1
57
- this.priority = config.priority ?? 0
58
- this.metadata = config.metadata ?? {}
59
- }
60
-
61
- /** Returns true if all dependency IDs are in the completed set */
62
- canStart(completedIds: Set<string>): boolean {
63
- return this.deps.every(dep => completedIds.has(dep))
64
- }
65
-
66
- markReady(): void {
67
- this.status = "READY"
68
- }
69
-
70
- markRunning(): void {
71
- this.status = "RUNNING"
72
- this.startedAt = Date.now()
73
- }
74
-
75
- markCompleted(result: string): void {
76
- this.status = "COMPLETED"
77
- this.completedAt = Date.now()
78
- this.result = result
79
- }
80
-
81
- markFailed(error: string): void {
82
- this.status = "FAILED"
83
- this.completedAt = Date.now()
84
- this.error = error
85
- }
86
-
87
- canRetry(): boolean {
88
- return this.retryCount < this.maxRetries
89
- }
90
-
91
- /** Elapsed time in seconds since start, or total duration if done */
92
- elapsedSeconds(): number {
93
- if (!this.startedAt) return 0
94
- const end = this.completedAt ?? Date.now()
95
- return Math.round((end - this.startedAt) / 1000)
96
- }
97
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * DAGScheduler — Result types
3
- */
4
-
5
- export interface NodeSummary {
6
- id: string
7
- name: string
8
- status: "COMPLETED" | "FAILED"
9
- durationMs: number
10
- result?: string
11
- error?: string
12
- retries: number
13
- }
14
-
15
- export interface DAGResult {
16
- swarmId: string
17
- totalDurationMs: number
18
- completed: NodeSummary[]
19
- failed: NodeSummary[]
20
- /** true if all nodes completed successfully */
21
- success: boolean
22
- }