@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,398 @@
|
|
|
1
|
+
import * as p from "@clack/prompts";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
import { loadConfig, getHiveDir } from "@johpaz/hive-agents-core/config/loader";
|
|
5
|
+
|
|
6
|
+
const getAgentsPath = () => path.join(getHiveDir(), "agents");
|
|
7
|
+
|
|
8
|
+
interface AgentConfig {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
default?: boolean;
|
|
12
|
+
workspace: string;
|
|
13
|
+
agentDir: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface AgentState {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
type: "primary" | "child" | "sibling";
|
|
20
|
+
state: "active" | "hibernated" | "terminated";
|
|
21
|
+
purpose: string;
|
|
22
|
+
parentId?: string;
|
|
23
|
+
childrenIds: string[];
|
|
24
|
+
workspacePath: string;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
lastActivity: string;
|
|
27
|
+
capabilities: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function loadLifecycleAgents(): Promise<AgentState[]> {
|
|
31
|
+
const agents: AgentState[] = [];
|
|
32
|
+
try {
|
|
33
|
+
if (!fs.existsSync(getAgentsPath())) return [];
|
|
34
|
+
const entries = fs.readdirSync(getAgentsPath(), { withFileTypes: true });
|
|
35
|
+
for (const entry of entries) {
|
|
36
|
+
if (!entry.isDirectory()) continue;
|
|
37
|
+
const statePath = path.join(getAgentsPath(), entry.name, "state.json");
|
|
38
|
+
try {
|
|
39
|
+
const content = fs.readFileSync(statePath, "utf-8");
|
|
40
|
+
agents.push(JSON.parse(content) as AgentState);
|
|
41
|
+
} catch { }
|
|
42
|
+
}
|
|
43
|
+
} catch { }
|
|
44
|
+
return agents;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export async function agents(subcommand: string | undefined, args: string[]): Promise<void> {
|
|
48
|
+
switch (subcommand) {
|
|
49
|
+
case "add":
|
|
50
|
+
await addAgent(args[0]);
|
|
51
|
+
break;
|
|
52
|
+
case "create":
|
|
53
|
+
await createAgent(args);
|
|
54
|
+
break;
|
|
55
|
+
case "list":
|
|
56
|
+
case "ls":
|
|
57
|
+
await listAgents(args.includes("--bindings"));
|
|
58
|
+
break;
|
|
59
|
+
case "logs":
|
|
60
|
+
await showLogs(args[0]);
|
|
61
|
+
break;
|
|
62
|
+
case "hibernate":
|
|
63
|
+
await hibernateAgent(args[0]);
|
|
64
|
+
break;
|
|
65
|
+
case "wake":
|
|
66
|
+
await wakeAgent(args[0]);
|
|
67
|
+
break;
|
|
68
|
+
case "terminate":
|
|
69
|
+
case "kill":
|
|
70
|
+
await terminateAgent(args[0], args.includes("--cascade"));
|
|
71
|
+
break;
|
|
72
|
+
case "tree":
|
|
73
|
+
await showTree();
|
|
74
|
+
break;
|
|
75
|
+
case "remove":
|
|
76
|
+
await removeAgent(args[0]);
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
console.log(`
|
|
80
|
+
Usage: hive agents <command> [arguments]
|
|
81
|
+
|
|
82
|
+
Commands:
|
|
83
|
+
list, ls List all agents
|
|
84
|
+
add <id> Create agent (legacy)
|
|
85
|
+
create Create agent with new lifecycle system
|
|
86
|
+
logs <agent-id> Show agent logs
|
|
87
|
+
hibernate <agent-id> Put agent to sleep
|
|
88
|
+
wake <agent-id> Wake a hibernated agent
|
|
89
|
+
terminate <agent-id> [--cascade] Terminate an agent
|
|
90
|
+
tree Show agent hierarchy tree
|
|
91
|
+
remove <id> Remove agent (legacy)
|
|
92
|
+
|
|
93
|
+
Examples:
|
|
94
|
+
hive agents list
|
|
95
|
+
hive agents create
|
|
96
|
+
hive agents tree
|
|
97
|
+
hive agents hibernate agent-abc123
|
|
98
|
+
hive agents wake agent-abc123
|
|
99
|
+
hive agents terminate agent-abc123 --cascade
|
|
100
|
+
`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function createAgent(args: string[]): Promise<void> {
|
|
105
|
+
const name = args[0] || await promptInput("Agent name:", `agent-${Date.now()}`);
|
|
106
|
+
const purpose = args[1] || await promptInput("Purpose:", "General AI assistant");
|
|
107
|
+
|
|
108
|
+
const agentId = `agent-${crypto.randomUUID().slice(0, 8)}`;
|
|
109
|
+
const workspacePath = path.join(getAgentsPath(), agentId);
|
|
110
|
+
|
|
111
|
+
fs.mkdirSync(path.join(workspacePath, "memory"), { recursive: true });
|
|
112
|
+
fs.mkdirSync(path.join(workspacePath, "skills"), { recursive: true });
|
|
113
|
+
fs.mkdirSync(path.join(workspacePath, "logs"), { recursive: true });
|
|
114
|
+
|
|
115
|
+
const soulMd = `# SOUL.md - ${name}
|
|
116
|
+
|
|
117
|
+
## Identity
|
|
118
|
+
|
|
119
|
+
I am ${name}, created to ${purpose.toLowerCase()}.
|
|
120
|
+
|
|
121
|
+
## Personality
|
|
122
|
+
|
|
123
|
+
- Helpful and responsive
|
|
124
|
+
- Clear communicator
|
|
125
|
+
- Adaptable to user needs
|
|
126
|
+
`;
|
|
127
|
+
|
|
128
|
+
const ethicsMd = `# ETHICS.md
|
|
129
|
+
|
|
130
|
+
## Core Principles
|
|
131
|
+
|
|
132
|
+
1. Honesty - Never deceive the user
|
|
133
|
+
2. Privacy - Protect user data
|
|
134
|
+
3. Safety - Prevent harm
|
|
135
|
+
4. Consent - Ask before significant actions
|
|
136
|
+
`;
|
|
137
|
+
|
|
138
|
+
fs.writeFileSync(path.join(workspacePath, "SOUL.md"), soulMd);
|
|
139
|
+
fs.writeFileSync(path.join(workspacePath, "ETHICS.md"), ethicsMd);
|
|
140
|
+
fs.writeFileSync(path.join(workspacePath, "USER.md"), "# USER.md\n\n## Preferences\n\n");
|
|
141
|
+
|
|
142
|
+
const state: AgentState = {
|
|
143
|
+
id: agentId,
|
|
144
|
+
name,
|
|
145
|
+
type: "sibling",
|
|
146
|
+
state: "active",
|
|
147
|
+
purpose,
|
|
148
|
+
childrenIds: [],
|
|
149
|
+
workspacePath,
|
|
150
|
+
createdAt: new Date().toISOString(),
|
|
151
|
+
lastActivity: new Date().toISOString(),
|
|
152
|
+
capabilities: ["general"],
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
fs.writeFileSync(path.join(workspacePath, "state.json"), JSON.stringify(state, null, 2));
|
|
156
|
+
|
|
157
|
+
console.log(`\n✅ Agent created: ${name} (${agentId})`);
|
|
158
|
+
console.log(` Workspace: ${workspacePath}\n`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async function promptInput(message: string, defaultVal: string): Promise<string> {
|
|
162
|
+
const result = await p.text({
|
|
163
|
+
message,
|
|
164
|
+
placeholder: defaultVal,
|
|
165
|
+
defaultValue: defaultVal,
|
|
166
|
+
});
|
|
167
|
+
if (p.isCancel(result)) {
|
|
168
|
+
p.cancel("Cancelled");
|
|
169
|
+
process.exit(0);
|
|
170
|
+
}
|
|
171
|
+
return result as string;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async function showLogs(agentId: string | undefined): Promise<void> {
|
|
175
|
+
if (!agentId) {
|
|
176
|
+
console.log("Usage: hive agents logs <agent-id>");
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const logPath = path.join(getAgentsPath(), agentId, "logs");
|
|
181
|
+
try {
|
|
182
|
+
const files = fs.readdirSync(logPath).filter((f) => f.endsWith(".log")).sort().reverse();
|
|
183
|
+
if (files.length === 0) {
|
|
184
|
+
console.log("\n📋 No logs found.\n");
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const content = fs.readFileSync(path.join(logPath, files[0]!), "utf-8");
|
|
188
|
+
console.log(`\n📋 Logs for ${agentId}:\n`);
|
|
189
|
+
console.log(content.slice(-3000));
|
|
190
|
+
} catch {
|
|
191
|
+
console.log(`\n❌ Agent not found: ${agentId}\n`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
async function hibernateAgent(agentId: string | undefined): Promise<void> {
|
|
196
|
+
if (!agentId) {
|
|
197
|
+
console.log("Usage: hive agents hibernate <agent-id>");
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const statePath = path.join(getAgentsPath(), agentId, "state.json");
|
|
202
|
+
try {
|
|
203
|
+
const state = JSON.parse(fs.readFileSync(statePath, "utf-8")) as AgentState;
|
|
204
|
+
state.state = "hibernated";
|
|
205
|
+
(state as any).hibernatedAt = new Date().toISOString();
|
|
206
|
+
fs.writeFileSync(statePath, JSON.stringify(state, null, 2));
|
|
207
|
+
console.log(`\n💤 Agent ${state.name} hibernated.\n`);
|
|
208
|
+
} catch {
|
|
209
|
+
console.log(`\n❌ Agent not found: ${agentId}\n`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
async function wakeAgent(agentId: string | undefined): Promise<void> {
|
|
214
|
+
if (!agentId) {
|
|
215
|
+
console.log("Usage: hive agents wake <agent-id>");
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const statePath = path.join(getAgentsPath(), agentId, "state.json");
|
|
220
|
+
try {
|
|
221
|
+
const state = JSON.parse(fs.readFileSync(statePath, "utf-8")) as AgentState;
|
|
222
|
+
state.state = "active";
|
|
223
|
+
state.lastActivity = new Date().toISOString();
|
|
224
|
+
fs.writeFileSync(statePath, JSON.stringify(state, null, 2));
|
|
225
|
+
console.log(`\n⚡ Agent ${state.name} activated.\n`);
|
|
226
|
+
} catch {
|
|
227
|
+
console.log(`\n❌ Agent not found: ${agentId}\n`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async function terminateAgent(agentId: string | undefined, cascade: boolean): Promise<void> {
|
|
232
|
+
if (!agentId) {
|
|
233
|
+
console.log("Usage: hive agents terminate <agent-id> [--cascade]");
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const statePath = path.join(getAgentsPath(), agentId, "state.json");
|
|
238
|
+
try {
|
|
239
|
+
const state = JSON.parse(fs.readFileSync(statePath, "utf-8")) as AgentState;
|
|
240
|
+
state.state = "terminated";
|
|
241
|
+
(state as any).terminatedAt = new Date().toISOString();
|
|
242
|
+
(state as any).terminationReason = "User requested";
|
|
243
|
+
fs.writeFileSync(statePath, JSON.stringify(state, null, 2));
|
|
244
|
+
console.log(`\n⚫ Agent ${state.name} terminated.\n`);
|
|
245
|
+
|
|
246
|
+
if (cascade && state.childrenIds?.length > 0) {
|
|
247
|
+
for (const childId of state.childrenIds) {
|
|
248
|
+
await terminateAgent(childId, true);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
} catch {
|
|
252
|
+
console.log(`\n❌ Agent not found: ${agentId}\n`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
async function showTree(): Promise<void> {
|
|
257
|
+
const agents = await loadLifecycleAgents();
|
|
258
|
+
if (agents.length === 0) {
|
|
259
|
+
console.log("\n📋 No agents found. Run 'hive onboard' to create your first agent.\n");
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const primaries = agents.filter((a) => a.type === "primary" && a.state !== "terminated");
|
|
264
|
+
|
|
265
|
+
const printTree = (agent: AgentState, indent = "") => {
|
|
266
|
+
const icon = agent.state === "active" ? "🟢" : agent.state === "hibernated" ? "💤" : "⚫";
|
|
267
|
+
console.log(`${indent}${icon} ${agent.name} (${agent.id.slice(0, 12)}...)`);
|
|
268
|
+
const children = agents.filter((a) => a.parentId === agent.id);
|
|
269
|
+
for (const child of children) {
|
|
270
|
+
printTree(child, indent + " ");
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
console.log("\n🌳 Agent Hierarchy:\n");
|
|
275
|
+
for (const primary of primaries) {
|
|
276
|
+
printTree(primary);
|
|
277
|
+
}
|
|
278
|
+
console.log("");
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
async function addAgent(id: string | undefined): Promise<void> {
|
|
282
|
+
const config = loadConfig();
|
|
283
|
+
|
|
284
|
+
if (!id) {
|
|
285
|
+
const result = await p.text({
|
|
286
|
+
message: "ID del nuevo agente:",
|
|
287
|
+
placeholder: "work",
|
|
288
|
+
validate: (v) => (!v ? "El ID es requerido" : undefined),
|
|
289
|
+
});
|
|
290
|
+
if (p.isCancel(result)) {
|
|
291
|
+
p.cancel("Cancelado");
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
id = result;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const agentsList = ((config.agents as Record<string, unknown>)?.list as AgentConfig[]) || [];
|
|
298
|
+
if (agentsList.find((a) => a.id === id)) {
|
|
299
|
+
console.log(`❌ Ya existe un agente con ID "${id}"`);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const name = await p.text({
|
|
304
|
+
message: "Nombre del agente:",
|
|
305
|
+
placeholder: id,
|
|
306
|
+
defaultValue: id,
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
if (p.isCancel(name)) {
|
|
310
|
+
p.cancel("Cancelado");
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const workspace = path.join(getHiveDir(), "agents", id as string, "workspace");
|
|
315
|
+
const agentDir = path.join(getHiveDir(), "agents", id as string, "agent");
|
|
316
|
+
|
|
317
|
+
const newAgent: AgentConfig = {
|
|
318
|
+
id: id as string,
|
|
319
|
+
name: name as string,
|
|
320
|
+
workspace,
|
|
321
|
+
agentDir,
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
fs.mkdirSync(workspace, { recursive: true });
|
|
325
|
+
fs.mkdirSync(agentDir, { recursive: true });
|
|
326
|
+
|
|
327
|
+
const soulPath = path.join(agentDir, "SOUL.md");
|
|
328
|
+
if (!fs.existsSync(soulPath)) {
|
|
329
|
+
fs.writeFileSync(soulPath, `# ${name} — Soul\n\nEres ${name}, un agente especializado.\n`, "utf-8");
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
const userPath = path.join(agentDir, "USER.md");
|
|
333
|
+
if (!fs.existsSync(userPath)) {
|
|
334
|
+
fs.writeFileSync(userPath, `# User Profile\n\nNotas sobre el usuario.\n`, "utf-8");
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
agentsList.push(newAgent);
|
|
338
|
+
|
|
339
|
+
console.log(`✅ Agente "${id}" creado`);
|
|
340
|
+
console.log(` Workspace: ${workspace}`);
|
|
341
|
+
console.log(` AgentDir: ${agentDir}`);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
async function listAgents(showBindings: boolean): Promise<void> {
|
|
345
|
+
const config = loadConfig();
|
|
346
|
+
const agentsList = ((config.agents as Record<string, unknown>)?.list as AgentConfig[]) || [];
|
|
347
|
+
|
|
348
|
+
if (agentsList.length === 0) {
|
|
349
|
+
console.log("No hay agentes configurados");
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
console.log("\n🐝 Agentes:\n");
|
|
354
|
+
for (const agent of agentsList) {
|
|
355
|
+
const defaultTag = agent.default ? " (default)" : "";
|
|
356
|
+
console.log(` ${agent.id}${defaultTag}`);
|
|
357
|
+
console.log(` Nombre: ${agent.name}`);
|
|
358
|
+
console.log(` Workspace: ${agent.workspace}`);
|
|
359
|
+
if (showBindings) {
|
|
360
|
+
const bindings = ((config as any).bindings as any[])?.filter((b: any) => (b.agentId || b.agent) === agent.id) || [];
|
|
361
|
+
console.log(` Bindings: ${bindings.length}`);
|
|
362
|
+
}
|
|
363
|
+
console.log();
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
async function removeAgent(id: string | undefined): Promise<void> {
|
|
368
|
+
if (!id) {
|
|
369
|
+
console.log("❌ Especifica el ID del agente: hive agents remove <id>");
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const config = loadConfig();
|
|
374
|
+
const agentsList = ((config.agents as Record<string, unknown>)?.list as AgentConfig[]) || [];
|
|
375
|
+
const agent = agentsList.find((a) => a.id === id);
|
|
376
|
+
|
|
377
|
+
if (!agent) {
|
|
378
|
+
console.log(`❌ No existe el agente "${id}"`);
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
if (agent.default) {
|
|
383
|
+
console.log("❌ No puedes eliminar el agente por defecto");
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const confirm = await p.confirm({
|
|
388
|
+
message: `¿Eliminar el agente "${id}"?`,
|
|
389
|
+
initialValue: false,
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
if (p.isCancel(confirm) || !confirm) {
|
|
393
|
+
console.log("Cancelado");
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
console.log(`✅ Agente "${id}" eliminado`);
|
|
398
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import * as p from "@clack/prompts";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
import { spawn } from "child_process";
|
|
5
|
+
import * as readline from "readline";
|
|
6
|
+
import { loadConfig, getHiveDir } from "@johpaz/hive-agents-core/config/loader";
|
|
7
|
+
|
|
8
|
+
const getHiveDirConst = () => getHiveDir();
|
|
9
|
+
|
|
10
|
+
export async function chat(flags: string[]): Promise<void> {
|
|
11
|
+
const config = loadConfig();
|
|
12
|
+
const HIVE_DIR = getHiveDirConst();
|
|
13
|
+
|
|
14
|
+
if (!fs.existsSync(HIVE_DIR)) {
|
|
15
|
+
console.log("❌ Directorio Hive no encontrado. Ejecuta: hive onboard");
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const agentId = flags.find((f) => f.startsWith("--agent"))?.split("=")[1] ||
|
|
20
|
+
flags[flags.indexOf("--agent") + 1] ||
|
|
21
|
+
"main";
|
|
22
|
+
|
|
23
|
+
console.log(`\n🐝 Chat con agente: ${agentId}`);
|
|
24
|
+
console.log(" Escribe /exit para salir, /new para nueva sesión\n");
|
|
25
|
+
|
|
26
|
+
const rl = readline.createInterface({
|
|
27
|
+
input: process.stdin,
|
|
28
|
+
output: process.stdout,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const question = (prompt: string): Promise<string> => {
|
|
32
|
+
return new Promise((resolve) => {
|
|
33
|
+
rl.question(prompt, resolve);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const messages: Array<{ role: string; content: string }> = [];
|
|
38
|
+
|
|
39
|
+
while (true) {
|
|
40
|
+
const input = await question("> ");
|
|
41
|
+
const trimmed = input.trim();
|
|
42
|
+
|
|
43
|
+
if (!trimmed) continue;
|
|
44
|
+
|
|
45
|
+
if (trimmed === "/exit" || trimmed === "/quit") {
|
|
46
|
+
console.log("👋 ¡Hasta luego!");
|
|
47
|
+
rl.close();
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (trimmed === "/new") {
|
|
52
|
+
messages.length = 0;
|
|
53
|
+
console.log("📝 Nueva sesión iniciada\n");
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (trimmed === "/help") {
|
|
58
|
+
console.log(`
|
|
59
|
+
Comandos disponibles:
|
|
60
|
+
/exit, /quit - Salir del chat
|
|
61
|
+
/new - Iniciar nueva sesión
|
|
62
|
+
/help - Mostrar esta ayuda
|
|
63
|
+
`);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
messages.push({ role: "user", content: trimmed });
|
|
68
|
+
|
|
69
|
+
console.log("\n🤖 Pensando...\n");
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
const response = await callLLM(config, messages);
|
|
73
|
+
messages.push({ role: "assistant", content: response });
|
|
74
|
+
console.log(`\n${response}\n`);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
console.log(`❌ Error: ${(error as Error).message}\n`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async function callLLM(config: any, messages: Array<{ role: string; content: string }>): Promise<string> {
|
|
82
|
+
const models = config.models as Record<string, unknown> | undefined;
|
|
83
|
+
const provider = models?.defaultProvider as string || "anthropic";
|
|
84
|
+
const defaults = (models as any)?.defaults as Record<string, string> | undefined;
|
|
85
|
+
const model = defaults?.default || (defaults as any)?.[provider] || "claude-sonnet-4-5";
|
|
86
|
+
const providers = models?.providers as Record<string, Record<string, unknown>> | undefined;
|
|
87
|
+
const providerConfig = providers?.[provider] as Record<string, unknown> | undefined;
|
|
88
|
+
|
|
89
|
+
// Try to get API key from config, then process.env
|
|
90
|
+
const apiKey = (providerConfig?.apiKey as string) ||
|
|
91
|
+
process.env[`${provider.toUpperCase()}_API_KEY`] ||
|
|
92
|
+
"";
|
|
93
|
+
|
|
94
|
+
if (provider === "anthropic") {
|
|
95
|
+
const response = await fetch("https://api.anthropic.com/v1/messages", {
|
|
96
|
+
method: "POST",
|
|
97
|
+
headers: {
|
|
98
|
+
"Content-Type": "application/json",
|
|
99
|
+
"x-api-key": apiKey,
|
|
100
|
+
"anthropic-version": "2023-06-01",
|
|
101
|
+
"anthropic-dangerous-direct-browser-access": "true",
|
|
102
|
+
},
|
|
103
|
+
body: JSON.stringify({
|
|
104
|
+
model,
|
|
105
|
+
max_tokens: 4096,
|
|
106
|
+
messages: messages.map((m) => ({ role: m.role, content: m.content })),
|
|
107
|
+
}),
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
if (!response.ok) {
|
|
111
|
+
const errorData = await response.json().catch(() => ({}));
|
|
112
|
+
throw new Error(`Anthropic API error: ${response.status} - ${JSON.stringify(errorData)}`);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const data = (await response.json()) as { content: Array<{ text: string }> };
|
|
116
|
+
return data.content[0]?.text || "Sin respuesta";
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (provider === "openai") {
|
|
120
|
+
const response = await fetch("https://api.openai.com/v1/chat/completions", {
|
|
121
|
+
method: "POST",
|
|
122
|
+
headers: {
|
|
123
|
+
"Content-Type": "application/json",
|
|
124
|
+
Authorization: `Bearer ${apiKey}`,
|
|
125
|
+
},
|
|
126
|
+
body: JSON.stringify({
|
|
127
|
+
model,
|
|
128
|
+
messages: messages.map((m) => ({ role: m.role, content: m.content })),
|
|
129
|
+
}),
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
if (!response.ok) {
|
|
133
|
+
const errorData = await response.json().catch(() => ({}));
|
|
134
|
+
throw new Error(`OpenAI API error: ${response.status} - ${JSON.stringify(errorData)}`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const data = (await response.json()) as { choices: Array<{ message: { content: string } }> };
|
|
138
|
+
return data.choices[0]?.message?.content || "Sin respuesta";
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return `Proveedor '${provider}' no soportado en modo chat CLI. Usa 'hive start' para el Gateway completo.`;
|
|
142
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as p from "@clack/prompts";
|
|
2
|
+
import { loadConfig } from "@johpaz/hive-agents-core/config/loader";
|
|
3
|
+
|
|
4
|
+
export async function config(subcommand: string | undefined, args: string[]): Promise<void> {
|
|
5
|
+
switch (subcommand) {
|
|
6
|
+
case "show":
|
|
7
|
+
await showConfig();
|
|
8
|
+
break;
|
|
9
|
+
case "edit":
|
|
10
|
+
console.log("Configura Hive a través de variables de entorno o la base de datos.");
|
|
11
|
+
break;
|
|
12
|
+
default:
|
|
13
|
+
console.log(`
|
|
14
|
+
Usage: hive config <command>
|
|
15
|
+
|
|
16
|
+
Commands:
|
|
17
|
+
show Mostrar la configuración actual (redactada)
|
|
18
|
+
edit (Deshabilitado) Edición manual de configuración
|
|
19
|
+
`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function redactSecrets(obj: any, depth = 0): any {
|
|
24
|
+
if (depth > 10) return obj;
|
|
25
|
+
if (typeof obj !== "object" || obj === null) return obj;
|
|
26
|
+
|
|
27
|
+
const sensitiveKeys = ["apiKey", "token", "botToken", "password", "secret", "key"];
|
|
28
|
+
|
|
29
|
+
if (Array.isArray(obj)) {
|
|
30
|
+
return obj.map((item) => redactSecrets(item, depth + 1));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const result: any = {};
|
|
34
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
35
|
+
if (sensitiveKeys.some((sk) => key.toLowerCase().includes(sk.toLowerCase()))) {
|
|
36
|
+
result[key] = "***REDACTED***";
|
|
37
|
+
} else {
|
|
38
|
+
result[key] = redactSecrets(value, depth + 1);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function showConfig(): Promise<void> {
|
|
45
|
+
const config = loadConfig();
|
|
46
|
+
console.log("\n⚙️ Configuración Actual (Redactada):\n");
|
|
47
|
+
console.log(JSON.stringify(redactSecrets(config), null, 2));
|
|
48
|
+
console.log();
|
|
49
|
+
}
|