@johpaz/hive-agents 0.0.35 → 0.0.36
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.
- package/README.md +64 -39
- package/dist/hive.js +3127 -3104
- package/dist/ui/assets/{AgentCreateForm-B4eK7efF.js → AgentCreateForm-tJZv9FZC.js} +1 -1
- package/dist/ui/assets/{AgentDetailPage-BD2uoJWk.js → AgentDetailPage-Du-mRcAX.js} +1 -1
- package/dist/ui/assets/AgentNewPage-DIFYd_Ys.js +1 -0
- package/dist/ui/assets/{AgentsPage-4JUZXvkA.js → AgentsPage-YvSgWRiw.js} +6 -6
- package/dist/ui/assets/CanvasPage-DtMwGvxf.js +33 -0
- package/dist/ui/assets/{ChannelsPage-BUn7-nhV.js → ChannelsPage-BdBXWHjj.js} +1 -1
- package/dist/ui/assets/DashboardPage-ghl1ZguH.js +6 -0
- package/dist/ui/assets/{LoginPage-C8j_urUD.js → LoginPage-CAmSI9Vy.js} +1 -1
- package/dist/ui/assets/LogsPage-DAPBHkwK.js +1 -0
- package/dist/ui/assets/MeetingPage-WjjGOqqU.js +1 -0
- package/dist/ui/assets/{NotFound-Drh-sJPN.js → NotFound-BMeQSGcG.js} +1 -1
- package/dist/ui/assets/ProvidersPage-Ct6HsAi1.js +1 -0
- package/dist/ui/assets/{RecoverPage-DNb1Pr8h.js → RecoverPage-DpW3l-yv.js} +1 -1
- package/dist/ui/assets/SettingsPage-DBJ7_E6C.js +9 -0
- package/dist/ui/assets/SetupPage-DKmLVUaj.js +1 -0
- package/dist/ui/assets/{WebChatPage-R-YOwA4F.js → WebChatPage-CVRcKept.js} +2 -2
- package/dist/ui/assets/accordion-C5d5Rm5z.js +1 -0
- package/dist/ui/assets/{alert-U8FsgWi7.js → alert-C-NE-P3s.js} +1 -1
- package/dist/ui/assets/{alert-dialog-CRdMkkmk.js → alert-dialog-C5mzbHdP.js} +1 -1
- package/dist/ui/assets/{badge-Cli1jnH5.js → badge-ChpACfWO.js} +1 -1
- package/dist/ui/assets/chevron-up-BYhk0K2J.js +1 -0
- package/dist/ui/assets/{dialog-DQ3s-LuO.js → dialog-QnZ0ad8O.js} +1 -1
- package/dist/ui/assets/dropdown-menu-BK-CO3Od.js +1 -0
- package/dist/ui/assets/{es-DcMjrpbA.js → es-NQNoaWDx.js} +1 -1
- package/dist/ui/assets/index-B2fCYtTS.css +2 -0
- package/dist/ui/assets/index-DMCjjdqf.js +116 -0
- package/dist/ui/assets/{label-0BvGVXvZ.js → label-D2H1IR_J.js} +1 -1
- package/dist/ui/assets/progress-BherYzY6.js +1 -0
- package/dist/ui/assets/scroll-area-DkeyX32e.js +1 -0
- package/dist/ui/assets/{slider-D47dOrRa.js → slider-CsiUDxc3.js} +1 -1
- package/dist/ui/assets/switch-BDwN8RYV.js +1 -0
- package/dist/ui/assets/{table-DhowbNxQ.js → table-CSc8ubon.js} +1 -1
- package/dist/ui/assets/terminal-DN38Q456.js +1 -0
- package/dist/ui/assets/useProviders-C6_QHsEi.js +1 -0
- package/dist/ui/assets/{vendor-radix-JY4ncZrD.js → vendor-radix-cw1bQaVC.js} +4 -4
- package/dist/ui/assets/{vendor-react-CscwQerf.js → vendor-react-D4s9E-zj.js} +1 -1
- package/dist/ui/dist/assets/AgentCreateForm-tJZv9FZC.js +1 -0
- package/dist/ui/dist/assets/AgentDetailPage-Du-mRcAX.js +1 -0
- package/dist/ui/dist/assets/AgentNewPage-DIFYd_Ys.js +1 -0
- package/dist/ui/dist/assets/AgentsPage-YvSgWRiw.js +10 -0
- package/dist/ui/dist/assets/CanvasPage-DtMwGvxf.js +33 -0
- package/dist/ui/dist/assets/ChannelsPage-BdBXWHjj.js +8 -0
- package/dist/ui/dist/assets/DashboardPage-ghl1ZguH.js +6 -0
- package/dist/ui/dist/assets/LoginPage-CAmSI9Vy.js +1 -0
- package/dist/ui/dist/assets/LogsPage-DAPBHkwK.js +1 -0
- package/dist/ui/dist/assets/MeetingPage-WjjGOqqU.js +1 -0
- package/dist/ui/dist/assets/NotFound-BMeQSGcG.js +1 -0
- package/dist/ui/dist/assets/ProvidersPage-Ct6HsAi1.js +1 -0
- package/dist/ui/dist/assets/RecoverPage-DpW3l-yv.js +1 -0
- package/dist/ui/dist/assets/SettingsPage-DBJ7_E6C.js +9 -0
- package/dist/ui/dist/assets/SetupPage-DKmLVUaj.js +1 -0
- package/dist/ui/dist/assets/WebChatPage-CVRcKept.js +16 -0
- package/dist/ui/dist/assets/accordion-C5d5Rm5z.js +1 -0
- package/dist/ui/dist/assets/activity-c3pNngT_.js +1 -0
- package/dist/ui/dist/assets/alert-C-NE-P3s.js +1 -0
- package/dist/ui/dist/assets/alert-dialog-C5mzbHdP.js +1 -0
- package/dist/ui/dist/assets/arrow-left-CBcbX5EZ.js +1 -0
- package/dist/ui/dist/assets/badge-ChpACfWO.js +1 -0
- package/dist/ui/dist/assets/calendar-B-KZ9RQO.js +1 -0
- package/dist/ui/dist/assets/card-CNf6BS2e.js +1 -0
- package/dist/ui/dist/assets/chevron-left-D4U-5A27.js +1 -0
- package/dist/ui/dist/assets/chevron-right-CR4Skrf3.js +1 -0
- package/dist/ui/dist/assets/chevron-up-BYhk0K2J.js +1 -0
- package/dist/ui/dist/assets/circle-alert-CyHDwUj8.js +1 -0
- package/dist/ui/dist/assets/circle-check-Bb54Ebmu.js +1 -0
- package/dist/ui/dist/assets/cpu-Cdgc_B1K.js +1 -0
- package/dist/ui/dist/assets/dialog-QnZ0ad8O.js +1 -0
- package/dist/ui/dist/assets/download-C3ifGMjJ.js +1 -0
- package/dist/ui/dist/assets/dropdown-menu-BK-CO3Od.js +1 -0
- package/dist/ui/dist/assets/es-NQNoaWDx.js +1 -0
- package/dist/ui/dist/assets/external-link-BvxYeTP1.js +1 -0
- package/dist/ui/dist/assets/eye-DqNTU_GD.js +1 -0
- package/dist/ui/dist/assets/file-text-BT_9S9SM.js +1 -0
- package/dist/ui/dist/assets/folder-open-BhH8y9ac.js +1 -0
- package/dist/ui/dist/assets/format-GVHeOyWI.js +1 -0
- package/dist/ui/dist/assets/gateway-url-COCbW0IR.js +1 -0
- package/dist/ui/dist/assets/gauge-D_TMa4i9.js +1 -0
- package/dist/ui/dist/assets/globe-DeCQTCDJ.js +1 -0
- package/dist/ui/dist/assets/hexagon-DsGOUl-H.js +1 -0
- package/dist/ui/dist/assets/history-BSG-Ypqf.js +1 -0
- package/dist/ui/dist/assets/index-B2fCYtTS.css +2 -0
- package/dist/ui/dist/assets/index-DMCjjdqf.js +116 -0
- package/dist/ui/dist/assets/info-NwLoa2Mj.js +1 -0
- package/dist/ui/dist/assets/key-3EP0dhkT.js +1 -0
- package/dist/ui/dist/assets/label-D2H1IR_J.js +1 -0
- package/dist/ui/dist/assets/loader-circle-CZNax6kS.js +1 -0
- package/dist/ui/dist/assets/lock-Ei1_J-Nq.js +1 -0
- package/dist/ui/dist/assets/pause-BUqah9Bi.js +1 -0
- package/dist/ui/dist/assets/play-NcZ4swwL.js +1 -0
- package/dist/ui/dist/assets/plus-CX1xyhp5.js +1 -0
- package/dist/ui/dist/assets/progress-BherYzY6.js +1 -0
- package/dist/ui/dist/assets/refresh-cw-DaYdjQFk.js +1 -0
- package/dist/ui/dist/assets/rolldown-runtime-S-ySWqyJ.js +1 -0
- package/dist/ui/dist/assets/save-CUdYyHNy.js +1 -0
- package/dist/ui/dist/assets/scroll-area-DkeyX32e.js +1 -0
- package/dist/ui/dist/assets/send-B0H5SEIE.js +1 -0
- package/dist/ui/dist/assets/settings-Ds4SqD8s.js +1 -0
- package/dist/ui/dist/assets/slider-CsiUDxc3.js +14 -0
- package/dist/ui/dist/assets/sparkles-yUEb-7oH.js +1 -0
- package/dist/ui/dist/assets/square-BD81nFtN.js +1 -0
- package/dist/ui/dist/assets/switch-BDwN8RYV.js +1 -0
- package/dist/ui/dist/assets/table-CSc8ubon.js +1 -0
- package/dist/ui/dist/assets/terminal-DN38Q456.js +1 -0
- package/dist/ui/dist/assets/textarea-CXgXWKrT.js +1 -0
- package/dist/ui/dist/assets/trash-2-CNjMkoq6.js +1 -0
- package/dist/ui/dist/assets/triangle-alert-C9Y8Ub4X.js +1 -0
- package/dist/ui/dist/assets/useProviders-C6_QHsEi.js +1 -0
- package/dist/ui/dist/assets/utils-3pnRFmFe.js +1 -0
- package/dist/ui/dist/assets/vendor-charts-Bu2lyBKP.js +65 -0
- package/dist/ui/dist/assets/vendor-query-DsWPbQdG.js +1 -0
- package/dist/ui/dist/assets/vendor-radix-cw1bQaVC.js +63 -0
- package/dist/ui/dist/assets/vendor-react-D4s9E-zj.js +1 -0
- package/dist/ui/dist/assets/vendor-router-C9pIYwbJ.js +3 -0
- package/dist/ui/dist/assets/volume-2-CeSXNDv4.js +1 -0
- package/dist/ui/dist/assets/zap-hlXjpSeA.js +1 -0
- package/dist/ui/dist/favicon.ico +0 -0
- package/dist/ui/dist/index.html +40 -0
- package/dist/ui/dist/placeholder.svg +1 -0
- package/dist/ui/index.html +6 -6
- package/package.json +137 -13
- package/packages/cli/src/adapters/binary.ts +461 -0
- package/packages/cli/src/adapters/bun-global.ts +378 -0
- package/packages/cli/src/adapters/config.ts +314 -0
- package/packages/cli/src/adapters/docker.ts +308 -0
- package/packages/cli/src/adapters/factory.ts +168 -0
- package/packages/cli/src/adapters/index.ts +80 -0
- package/packages/cli/src/adapters/types.ts +218 -0
- package/packages/cli/src/commands/agent-run.ts +168 -0
- package/packages/cli/src/commands/agents.ts +398 -0
- package/packages/cli/src/commands/chat.ts +142 -0
- package/packages/cli/src/commands/config.ts +49 -0
- package/packages/cli/src/commands/cron.ts +487 -0
- package/packages/cli/src/commands/dev.ts +58 -0
- package/packages/cli/src/commands/doctor.ts +320 -0
- package/packages/cli/src/commands/gateway.ts +719 -0
- package/packages/cli/src/commands/logs.ts +57 -0
- package/packages/cli/src/commands/mcp.ts +175 -0
- package/packages/cli/src/commands/message.ts +77 -0
- package/packages/cli/src/commands/migrate.ts +90 -0
- package/packages/cli/src/commands/onboard.ts +1656 -0
- package/packages/cli/src/commands/security.ts +144 -0
- package/packages/cli/src/commands/service.ts +50 -0
- package/packages/cli/src/commands/sessions.ts +116 -0
- package/packages/cli/src/commands/skills.ts +215 -0
- package/packages/cli/src/commands/update.ts +203 -0
- package/packages/cli/src/index.ts +210 -0
- package/packages/cli/src/ui-bundle.generated.ts +3 -0
- package/packages/cli/src/utils/token.ts +6 -0
- package/packages/core/src/agent/agent-loop.ts +691 -0
- package/packages/core/src/agent/compaction.ts +240 -0
- package/packages/core/src/agent/context-compiler.ts +467 -0
- package/packages/core/src/agent/context-guard.ts +91 -0
- package/packages/core/src/agent/conversation-store.ts +244 -0
- package/packages/core/src/agent/curator.ts +158 -0
- package/packages/core/src/agent/hooks.ts +166 -0
- package/packages/core/src/agent/llm-client.ts +167 -0
- package/packages/core/src/agent/llm-providers/anthropic.ts +212 -0
- package/packages/core/src/agent/llm-providers/deepseek.ts +8 -0
- package/packages/core/src/agent/llm-providers/gemini.ts +215 -0
- package/packages/core/src/agent/llm-providers/groq.ts +5 -0
- package/packages/core/src/agent/llm-providers/interface.ts +195 -0
- package/packages/core/src/agent/llm-providers/kimi.ts +8 -0
- package/packages/core/src/agent/llm-providers/local-llama.ts +37 -0
- package/packages/core/src/agent/llm-providers/mistral.ts +5 -0
- package/packages/core/src/agent/llm-providers/nvidia.ts +5 -0
- package/packages/core/src/agent/llm-providers/ollama.ts +175 -0
- package/packages/core/src/agent/llm-providers/openai-compat-base.ts +379 -0
- package/packages/core/src/agent/llm-providers/openai.ts +5 -0
- package/packages/core/src/agent/llm-providers/openrouter.ts +5 -0
- package/packages/core/src/agent/llm-providers/qwen.ts +5 -0
- package/packages/core/src/agent/native-tools.ts +31 -0
- package/packages/core/src/agent/playbook-selector.ts +147 -0
- package/packages/core/src/agent/prompt-builder.ts +169 -0
- package/packages/core/src/agent/providers/index.ts +204 -0
- package/packages/core/src/agent/providers.ts +1 -0
- package/packages/core/src/agent/reflector.ts +200 -0
- package/packages/core/src/agent/service.ts +267 -0
- package/packages/core/src/agent/skill-selector.ts +479 -0
- package/packages/core/src/agent/stuck-loop.ts +133 -0
- package/packages/core/src/agent/tool-selector.ts +569 -0
- package/packages/core/src/agent/tracer.ts +100 -0
- package/packages/core/src/auth/auth.ts +108 -0
- package/packages/core/src/auth/index.ts +1 -0
- package/packages/core/src/canvas/a2ui-tools.ts +255 -0
- package/packages/core/src/canvas/canvas-manager.ts +390 -0
- package/packages/core/src/canvas/canvas-tools.ts +448 -0
- package/packages/core/src/canvas/emitter.ts +149 -0
- package/packages/core/src/canvas/index.ts +3 -0
- package/packages/core/src/channels/base.ts +154 -0
- package/packages/core/src/channels/discord.ts +273 -0
- package/packages/core/src/channels/index.ts +7 -0
- package/packages/core/src/channels/manager.ts +450 -0
- package/packages/core/src/channels/slack.ts +323 -0
- package/packages/core/src/channels/telegram.ts +612 -0
- package/packages/core/src/channels/webchat.ts +139 -0
- package/packages/core/src/channels/whatsapp.ts +548 -0
- package/packages/core/src/config/index.ts +12 -0
- package/packages/core/src/config/loader.ts +569 -0
- package/packages/core/src/events/agent-bus.ts +460 -0
- package/packages/core/src/events/event-bus.ts +169 -0
- package/packages/core/src/gateway/channel-notify.ts +64 -0
- package/packages/core/src/gateway/helpers/cors.ts +32 -0
- package/packages/core/src/gateway/helpers/index.ts +4 -0
- package/packages/core/src/gateway/helpers/narration.ts +57 -0
- package/packages/core/src/gateway/helpers/path.ts +13 -0
- package/packages/core/src/gateway/helpers/redact.ts +61 -0
- package/packages/core/src/gateway/index.ts +5 -0
- package/packages/core/src/gateway/initializer.ts +363 -0
- package/packages/core/src/gateway/lane-queue.ts +169 -0
- package/packages/core/src/gateway/llm-local/client.ts +94 -0
- package/packages/core/src/gateway/llm-local/detector.ts +321 -0
- package/packages/core/src/gateway/llm-local/downloader.ts +216 -0
- package/packages/core/src/gateway/llm-local/index.ts +34 -0
- package/packages/core/src/gateway/llm-local/manager.ts +186 -0
- package/packages/core/src/gateway/llm-local/models.ts +149 -0
- package/packages/core/src/gateway/llm-local/server.ts +179 -0
- package/packages/core/src/gateway/resolver.ts +108 -0
- package/packages/core/src/gateway/router.ts +124 -0
- package/packages/core/src/gateway/routes/agents.ts +210 -0
- package/packages/core/src/gateway/routes/auth.ts +244 -0
- package/packages/core/src/gateway/routes/channels.ts +484 -0
- package/packages/core/src/gateway/routes/chat.ts +241 -0
- package/packages/core/src/gateway/routes/config.ts +12 -0
- package/packages/core/src/gateway/routes/cron-api.ts +544 -0
- package/packages/core/src/gateway/routes/ethics.ts +46 -0
- package/packages/core/src/gateway/routes/llm-local.ts +271 -0
- package/packages/core/src/gateway/routes/mcp.ts +319 -0
- package/packages/core/src/gateway/routes/meeting.ts +232 -0
- package/packages/core/src/gateway/routes/models.ts +163 -0
- package/packages/core/src/gateway/routes/multimodal.ts +93 -0
- package/packages/core/src/gateway/routes/providers.ts +220 -0
- package/packages/core/src/gateway/routes/setup.ts +441 -0
- package/packages/core/src/gateway/routes/skills.ts +115 -0
- package/packages/core/src/gateway/routes/system.ts +469 -0
- package/packages/core/src/gateway/routes/tasks.ts +44 -0
- package/packages/core/src/gateway/routes/tools.ts +59 -0
- package/packages/core/src/gateway/routes/tts-local.ts +388 -0
- package/packages/core/src/gateway/routes/users.ts +122 -0
- package/packages/core/src/gateway/routes/voice.ts +189 -0
- package/packages/core/src/gateway/routes/workspace.ts +281 -0
- package/packages/core/src/gateway/server.ts +2744 -0
- package/packages/core/src/gateway/session.ts +95 -0
- package/packages/core/src/gateway/slash-commands.ts +207 -0
- package/packages/core/src/gateway/tts/README.md +94 -0
- package/packages/core/src/gateway/tts/package.json +25 -0
- package/packages/core/src/gateway/tts/src/client.ts +59 -0
- package/packages/core/src/gateway/tts/src/detect.ts +42 -0
- package/packages/core/src/gateway/tts/src/index.ts +15 -0
- package/packages/core/src/gateway/tts/src/install.ts +129 -0
- package/packages/core/src/gateway/tts/src/models.ts +50 -0
- package/packages/core/src/gateway/tts/src/server.ts +252 -0
- package/packages/core/src/gateway/tts/voices/.gitkeep +0 -0
- package/packages/core/src/heartbeat/index.ts +157 -0
- package/packages/core/src/index.ts +56 -0
- package/packages/core/src/mcp/hot-reload.ts +148 -0
- package/packages/core/src/mcp/singleton.ts +21 -0
- package/packages/core/src/mcp/tool-sync.ts +176 -0
- package/packages/core/src/multimodal/index.ts +2 -0
- package/packages/core/src/multimodal/types.ts +28 -0
- package/packages/core/src/multimodal/vision-service.ts +283 -0
- package/packages/core/src/plugins/api.ts +128 -0
- package/packages/core/src/plugins/index.ts +2 -0
- package/packages/core/src/plugins/loader.ts +365 -0
- package/packages/core/src/resilience/circuit-breaker.ts +225 -0
- package/packages/core/src/scheduler/CronScheduler.ts +699 -0
- package/packages/core/src/scheduler/dag/AgentExecutor.ts +53 -0
- package/packages/core/src/scheduler/dag/DAGScheduler.ts +250 -0
- package/packages/core/src/scheduler/dag/EventBridge.ts +122 -0
- package/packages/core/src/scheduler/dag/TaskGraph.ts +192 -0
- package/packages/core/src/scheduler/dag/TaskNode.ts +97 -0
- package/packages/core/src/scheduler/dag/TaskResult.ts +22 -0
- package/packages/core/src/scheduler/dag/errors.ts +37 -0
- package/packages/core/src/scheduler/dag/index.ts +26 -0
- package/packages/core/src/scheduler/dag/presets/ResearchPreset.ts +97 -0
- package/packages/core/src/scheduler/dag/strategies/ParallelStrategy.ts +21 -0
- package/packages/core/src/scheduler/dag/strategies/PriorityStrategy.ts +46 -0
- package/packages/core/src/scheduler/index.ts +22 -0
- package/packages/core/src/scheduler/integration.ts +237 -0
- package/packages/core/src/scheduler/types.ts +164 -0
- package/packages/core/src/security/google-chat.ts +269 -0
- package/packages/core/src/security/index.ts +192 -0
- package/packages/core/src/security/pairing.ts +250 -0
- package/packages/core/src/security/rate-limit.ts +270 -0
- package/packages/core/src/security/signal.ts +321 -0
- package/packages/core/src/state/store.ts +312 -0
- package/packages/core/src/storage/crypto.ts +197 -0
- package/packages/core/src/storage/migrate.ts +147 -0
- package/packages/core/src/storage/onboarding.ts +1506 -0
- package/packages/core/src/storage/schema.ts +666 -0
- package/packages/core/src/storage/seed.ts +628 -0
- package/packages/core/src/storage/sqlite.ts +407 -0
- package/packages/core/src/storage/usage.ts +374 -0
- package/packages/core/src/tool-runtime/index.ts +476 -0
- package/packages/core/src/tool-runtime/tool-worker.ts +125 -0
- package/packages/core/src/tools/agents/get-available-models.ts +118 -0
- package/packages/core/src/tools/agents/index.ts +610 -0
- package/packages/core/src/tools/canvas/index.ts +420 -0
- package/packages/core/src/tools/cli/index.ts +142 -0
- package/packages/core/src/tools/core/index.ts +478 -0
- package/packages/core/src/tools/cron/index.ts +635 -0
- package/packages/core/src/tools/filesystem/fs-delete.ts +78 -0
- package/packages/core/src/tools/filesystem/fs-edit.ts +106 -0
- package/packages/core/src/tools/filesystem/fs-exists.ts +63 -0
- package/packages/core/src/tools/filesystem/fs-glob.ts +108 -0
- package/packages/core/src/tools/filesystem/fs-list.ts +129 -0
- package/packages/core/src/tools/filesystem/fs-read.ts +72 -0
- package/packages/core/src/tools/filesystem/fs-write.ts +67 -0
- package/packages/core/src/tools/filesystem/index.ts +34 -0
- package/packages/core/src/tools/filesystem/workspace-guard.ts +62 -0
- package/packages/core/src/tools/index.ts +197 -0
- package/packages/core/src/tools/meeting/index.ts +363 -0
- package/packages/core/src/tools/office/index.ts +47 -0
- package/packages/core/src/tools/office/office-escribir-docx.ts +192 -0
- package/packages/core/src/tools/office/office-escribir-pdf.ts +172 -0
- package/packages/core/src/tools/office/office-escribir-pptx.ts +174 -0
- package/packages/core/src/tools/office/office-escribir-xlsx.ts +116 -0
- package/packages/core/src/tools/office/office-leer-docx.ts +93 -0
- package/packages/core/src/tools/office/office-leer-pdf.ts +114 -0
- package/packages/core/src/tools/office/office-leer-pptx.ts +136 -0
- package/packages/core/src/tools/office/office-leer-xlsx.ts +124 -0
- package/packages/core/src/tools/types.ts +39 -0
- package/packages/core/src/tools/voice/index.ts +104 -0
- package/packages/core/src/tools/web/browser-click.ts +78 -0
- package/packages/core/src/tools/web/browser-extract.ts +139 -0
- package/packages/core/src/tools/web/browser-navigate.ts +106 -0
- package/packages/core/src/tools/web/browser-screenshot.ts +87 -0
- package/packages/core/src/tools/web/browser-script.ts +88 -0
- package/packages/core/src/tools/web/browser-service.ts +554 -0
- package/packages/core/src/tools/web/browser-type.ts +101 -0
- package/packages/core/src/tools/web/browser-wait.ts +136 -0
- package/packages/core/src/tools/web/index.ts +41 -0
- package/packages/core/src/tools/web/web-fetch.ts +78 -0
- package/packages/core/src/tools/web/web-search.ts +123 -0
- package/packages/core/src/utils/benchmark.ts +80 -0
- package/packages/core/src/utils/crypto.ts +73 -0
- package/packages/core/src/utils/date.ts +42 -0
- package/packages/core/src/utils/index.ts +5 -0
- package/packages/core/src/utils/logger.ts +389 -0
- package/packages/core/src/utils/retry.ts +70 -0
- package/packages/core/src/utils/toon.ts +253 -0
- package/packages/core/src/voice/index.ts +643 -0
- package/packages/mcp/src/config.ts +13 -0
- package/packages/mcp/src/index.ts +1 -0
- package/packages/mcp/src/logger.ts +47 -0
- package/packages/mcp/src/manager.ts +439 -0
- package/packages/mcp/src/transports/index.ts +67 -0
- package/packages/mcp/src/transports/sse.ts +238 -0
- package/packages/mcp/src/transports/websocket.ts +159 -0
- package/packages/skills/src/bundled/agents/agent_spawner/SKILL.md +167 -0
- package/packages/skills/src/bundled/agents/code_delegator/SKILL.md +156 -0
- package/packages/skills/src/bundled/agents/memory_manager/SKILL.md +143 -0
- package/packages/skills/src/bundled/agents/research_and_remember/SKILL.md +139 -0
- package/packages/skills/src/bundled/agents/task_orchestrator/SKILL.md +198 -0
- package/packages/skills/src/bundled/canvas/a2ui_dashboard/SKILL.md +176 -0
- package/packages/skills/src/bundled/canvas/a2ui_form/SKILL.md +202 -0
- package/packages/skills/src/bundled/canvas/a2ui_interactive/SKILL.md +206 -0
- package/packages/skills/src/bundled/canvas/canvas_dashboard/SKILL.md +146 -0
- package/packages/skills/src/bundled/canvas/canvas_interact/SKILL.md +148 -0
- package/packages/skills/src/bundled/canvas/canvas_report/SKILL.md +146 -0
- package/packages/skills/src/bundled/cli/cli_pipeline/SKILL.md +136 -0
- package/packages/skills/src/bundled/cli/cli_safe_exec/SKILL.md +125 -0
- package/packages/skills/src/bundled/cron_manager/SKILL.md +188 -0
- package/packages/skills/src/bundled/cron_reminder/SKILL.md +112 -0
- package/packages/skills/src/bundled/filesystem/file_manager/SKILL.md +118 -0
- package/packages/skills/src/bundled/filesystem/file_read_and_summarize/SKILL.md +108 -0
- package/packages/skills/src/bundled/filesystem/file_writer/SKILL.md +135 -0
- package/packages/skills/src/bundled/meeting/meeting_transcription/SKILL.md +213 -0
- package/packages/skills/src/bundled/office/office_document_manager/SKILL.md +262 -0
- package/packages/skills/src/bundled/search_knowledge/busqueda_fts5/SKILL.md +74 -0
- package/packages/skills/src/bundled/voice/voice_assistant/SKILL.md +174 -0
- package/packages/skills/src/bundled/voice/voice_input/SKILL.md +146 -0
- package/packages/skills/src/bundled/voice/voice_output/SKILL.md +151 -0
- package/packages/skills/src/bundled/web/browser_automate/SKILL.md +120 -0
- package/packages/skills/src/bundled/web/browser_scrape/SKILL.md +109 -0
- package/packages/skills/src/bundled/web/web_monitor/SKILL.md +127 -0
- package/packages/skills/src/bundled/web/web_research/SKILL.md +119 -0
- package/packages/skills/src/bundled-data.generated.ts +1964 -0
- package/packages/skills/src/index.ts +1 -0
- package/packages/skills/src/loader.ts +388 -0
- package/dist/ui/assets/AgentNewPage-GB-tVN50.js +0 -1
- package/dist/ui/assets/BridgePage-DDcDILKu.js +0 -1
- package/dist/ui/assets/CanvasPage-oOk2sGOD.js +0 -33
- package/dist/ui/assets/DashboardPage-DV_2qWYJ.js +0 -6
- package/dist/ui/assets/LogsPage-DayYjh01.js +0 -1
- package/dist/ui/assets/MeetingPage-C01uPuqj.js +0 -1
- package/dist/ui/assets/ProjectsPage-B8_am_Ib.js +0 -1
- package/dist/ui/assets/ProvidersPage-DBzi66e4.js +0 -1
- package/dist/ui/assets/SettingsPage-CFA_Tknl.js +0 -9
- package/dist/ui/assets/SetupPage-BrUWbhvT.js +0 -1
- package/dist/ui/assets/accordion-DdAEfIXR.js +0 -1
- package/dist/ui/assets/chevron-down-DIosfU_U.js +0 -1
- package/dist/ui/assets/chevron-up-CI-W21Fy.js +0 -1
- package/dist/ui/assets/circle-S0-ouLz-.js +0 -1
- package/dist/ui/assets/circle-minus-CE0iJrl8.js +0 -1
- package/dist/ui/assets/circle-x-jUJ5zZvQ.js +0 -1
- package/dist/ui/assets/dropdown-menu-C2CXM1VE.js +0 -1
- package/dist/ui/assets/index-BN0875JH.css +0 -2
- package/dist/ui/assets/index-CH6sBa3Q.js +0 -116
- package/dist/ui/assets/pencil-5VdSj-h5.js +0 -1
- package/dist/ui/assets/progress-JN30I5fF.js +0 -1
- package/dist/ui/assets/scroll-area-BQQPitM8.js +0 -1
- package/dist/ui/assets/search-ChPgnVKj.js +0 -1
- package/dist/ui/assets/switch-C7W2-KEx.js +0 -1
- package/dist/ui/assets/terminal-C-R5Fckz.js +0 -1
- package/dist/ui/assets/useProviders-TBnWn-Hq.js +0 -1
- /package/dist/ui/assets/{card-DFKnZ6ky.js → card-CNf6BS2e.js} +0 -0
- /package/dist/ui/assets/{circle-alert-KuAm2FWh.js → circle-alert-CyHDwUj8.js} +0 -0
- /package/dist/ui/assets/{circle-check-6Ard1-2z.js → circle-check-Bb54Ebmu.js} +0 -0
- /package/dist/ui/assets/{cpu-KDy6-FAI.js → cpu-Cdgc_B1K.js} +0 -0
- /package/dist/ui/assets/{download-Cjbk4Rek.js → download-C3ifGMjJ.js} +0 -0
- /package/dist/ui/assets/{external-link-HtrFM63g.js → external-link-BvxYeTP1.js} +0 -0
- /package/dist/ui/assets/{eye-D1dB40_o.js → eye-DqNTU_GD.js} +0 -0
- /package/dist/ui/assets/{file-text-CE58EfH0.js → file-text-BT_9S9SM.js} +0 -0
- /package/dist/ui/assets/{folder-open-DIPKeiI_.js → folder-open-BhH8y9ac.js} +0 -0
- /package/dist/ui/assets/{format-BwdV8bB5.js → format-GVHeOyWI.js} +0 -0
- /package/dist/ui/assets/{gateway-url-D5uj6Nxg.js → gateway-url-COCbW0IR.js} +0 -0
- /package/dist/ui/assets/{gauge-DmQmJHEg.js → gauge-D_TMa4i9.js} +0 -0
- /package/dist/ui/assets/{globe-_hUGxQF4.js → globe-DeCQTCDJ.js} +0 -0
- /package/dist/ui/assets/{hexagon-BaNGQlQj.js → hexagon-DsGOUl-H.js} +0 -0
- /package/dist/ui/assets/{history-BfZVGlZa.js → history-BSG-Ypqf.js} +0 -0
- /package/dist/ui/assets/{info-CBZ5-AlC.js → info-NwLoa2Mj.js} +0 -0
- /package/dist/ui/assets/{key-Bv5DdTPh.js → key-3EP0dhkT.js} +0 -0
- /package/dist/ui/assets/{loader-circle-C4hhXLgp.js → loader-circle-CZNax6kS.js} +0 -0
- /package/dist/ui/assets/{lock-CkZYexqw.js → lock-Ei1_J-Nq.js} +0 -0
- /package/dist/ui/assets/{pause-Bpy1_s7y.js → pause-BUqah9Bi.js} +0 -0
- /package/dist/ui/assets/{play-Cj4osqJZ.js → play-NcZ4swwL.js} +0 -0
- /package/dist/ui/assets/{plus-BQhgZN3A.js → plus-CX1xyhp5.js} +0 -0
- /package/dist/ui/assets/{refresh-cw-BfREHVQM.js → refresh-cw-DaYdjQFk.js} +0 -0
- /package/dist/ui/assets/{save-FFTD4dMp.js → save-CUdYyHNy.js} +0 -0
- /package/dist/ui/assets/{settings-BdHKUL92.js → settings-Ds4SqD8s.js} +0 -0
- /package/dist/ui/assets/{sparkles-r4uJbJAl.js → sparkles-yUEb-7oH.js} +0 -0
- /package/dist/ui/assets/{square-G7Hyufqm.js → square-BD81nFtN.js} +0 -0
- /package/dist/ui/assets/{textarea-5kyuD04X.js → textarea-CXgXWKrT.js} +0 -0
- /package/dist/ui/assets/{trash-2-DXVBRWfh.js → trash-2-CNjMkoq6.js} +0 -0
- /package/dist/ui/assets/{triangle-alert-Bu5seg9O.js → triangle-alert-C9Y8Ub4X.js} +0 -0
- /package/dist/ui/assets/{vendor-router-CCECILJ0.js → vendor-router-C9pIYwbJ.js} +0 -0
- /package/dist/ui/assets/{volume-2-s9DuS696.js → volume-2-CeSXNDv4.js} +0 -0
- /package/dist/ui/assets/{zap-BPHZzXKV.js → zap-hlXjpSeA.js} +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DAGScheduler — AgentExecutor
|
|
3
|
+
*
|
|
4
|
+
* Bridges the DAGScheduler to the existing runAgentIsolated() call.
|
|
5
|
+
* Adds timeout enforcement via Promise.race().
|
|
6
|
+
*
|
|
7
|
+
* NOTE: There are no Bun Worker threads in Hive OSS. "Workers" are logical
|
|
8
|
+
* agents stored in the DB and executed as async calls in the same process.
|
|
9
|
+
* Parallelism is achieved by launching multiple runAgentIsolated() calls
|
|
10
|
+
* concurrently without awaiting each one serially.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { runAgentIsolated } from "../../agent/agent-loop"
|
|
14
|
+
import { TaskNode } from "./TaskNode"
|
|
15
|
+
import { TaskTimeoutError } from "./errors"
|
|
16
|
+
|
|
17
|
+
export class AgentExecutor {
|
|
18
|
+
/**
|
|
19
|
+
* Execute a TaskNode.
|
|
20
|
+
* Injects dependency results into the task description as context.
|
|
21
|
+
* Returns the final text output from the agent.
|
|
22
|
+
*/
|
|
23
|
+
async execute(
|
|
24
|
+
node: TaskNode,
|
|
25
|
+
depResults: Record<string, string>,
|
|
26
|
+
threadId: string
|
|
27
|
+
): Promise<string> {
|
|
28
|
+
const hasDeps = Object.keys(depResults).length > 0
|
|
29
|
+
const contextBlock = hasDeps
|
|
30
|
+
? `\n\n---\nContext from completed dependencies:\n${JSON.stringify(depResults, null, 2)}\n---`
|
|
31
|
+
: ""
|
|
32
|
+
|
|
33
|
+
const taskDescription = node.taskDescription + contextBlock
|
|
34
|
+
|
|
35
|
+
const agentPromise = runAgentIsolated({
|
|
36
|
+
agentId: node.agentId,
|
|
37
|
+
taskDescription,
|
|
38
|
+
threadId,
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const timeoutPromise = new Promise<never>((_, reject) => {
|
|
42
|
+
const t = setTimeout(() => {
|
|
43
|
+
reject(new TaskTimeoutError(node.id, node.timeout))
|
|
44
|
+
}, node.timeout)
|
|
45
|
+
// Ensure the timeout timer doesn't prevent process exit
|
|
46
|
+
if (typeof t === "object" && t !== null && "unref" in t) {
|
|
47
|
+
(t as any).unref()
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
return Promise.race([agentPromise, timeoutPromise])
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
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
|
+
}
|