@johpaz/hive 1.7.2 → 1.7.3
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 +178 -36
- package/dist/hive.js +315124 -0
- package/package.json +11 -3
- package/packages/core/src/index.ts +0 -1
- package/.dockerignore +0 -9
- package/CONTRIBUTING.md +0 -44
- package/Dockerfile +0 -67
- package/docker-compose.yml +0 -19
- package/packages/cli/package.json +0 -28
- package/packages/cli/src/commands/agent-run.ts +0 -168
- package/packages/cli/src/commands/agents.ts +0 -398
- package/packages/cli/src/commands/chat.ts +0 -142
- package/packages/cli/src/commands/config.ts +0 -50
- package/packages/cli/src/commands/cron.ts +0 -161
- package/packages/cli/src/commands/dev.ts +0 -95
- package/packages/cli/src/commands/doctor.ts +0 -133
- package/packages/cli/src/commands/gateway.ts +0 -422
- package/packages/cli/src/commands/logs.ts +0 -57
- package/packages/cli/src/commands/mcp.ts +0 -175
- package/packages/cli/src/commands/message.ts +0 -77
- package/packages/cli/src/commands/onboard.ts +0 -1696
- package/packages/cli/src/commands/security.ts +0 -144
- package/packages/cli/src/commands/service.ts +0 -50
- package/packages/cli/src/commands/sessions.ts +0 -116
- package/packages/cli/src/commands/skills.ts +0 -187
- package/packages/cli/src/commands/update.ts +0 -25
- package/packages/cli/src/index.ts +0 -190
- package/packages/cli/src/utils/token.ts +0 -6
- package/packages/code-bridge/README.md +0 -78
- package/packages/code-bridge/package.json +0 -18
- package/packages/code-bridge/src/index.ts +0 -95
- package/packages/code-bridge/src/process-manager.ts +0 -212
- package/packages/code-bridge/src/schemas.ts +0 -133
- package/packages/core/package.json +0 -55
- package/packages/core/src/agent/agent-loop.ts +0 -520
- package/packages/core/src/agent/compaction.ts +0 -183
- package/packages/core/src/agent/context-compiler.ts +0 -544
- package/packages/core/src/agent/context-guard.ts +0 -91
- package/packages/core/src/agent/conversation-store.ts +0 -193
- package/packages/core/src/agent/curator.ts +0 -158
- package/packages/core/src/agent/hooks.ts +0 -166
- package/packages/core/src/agent/llm-client.ts +0 -503
- package/packages/core/src/agent/native-tools.ts +0 -31
- package/packages/core/src/agent/playbook-selector.ts +0 -143
- package/packages/core/src/agent/prompt-builder.ts +0 -167
- package/packages/core/src/agent/providers/index.ts +0 -186
- package/packages/core/src/agent/providers.ts +0 -1
- package/packages/core/src/agent/reflector.ts +0 -200
- package/packages/core/src/agent/service.ts +0 -266
- package/packages/core/src/agent/skill-selector.ts +0 -413
- package/packages/core/src/agent/stuck-loop.ts +0 -133
- package/packages/core/src/agent/tool-selector.ts +0 -623
- package/packages/core/src/agent/tracer.ts +0 -102
- package/packages/core/src/canvas/canvas-manager.ts +0 -319
- package/packages/core/src/canvas/canvas-tools.ts +0 -420
- package/packages/core/src/canvas/emitter.ts +0 -119
- package/packages/core/src/canvas/index.ts +0 -2
- package/packages/core/src/channels/base.ts +0 -140
- package/packages/core/src/channels/discord.ts +0 -260
- package/packages/core/src/channels/index.ts +0 -7
- package/packages/core/src/channels/manager.ts +0 -383
- package/packages/core/src/channels/slack.ts +0 -287
- package/packages/core/src/channels/telegram.ts +0 -552
- package/packages/core/src/channels/webchat.ts +0 -139
- package/packages/core/src/channels/whatsapp.ts +0 -375
- package/packages/core/src/config/index.ts +0 -12
- package/packages/core/src/config/loader.ts +0 -529
- package/packages/core/src/events/agent-bus.ts +0 -460
- package/packages/core/src/events/event-bus.ts +0 -169
- package/packages/core/src/gateway/helpers/cors.ts +0 -32
- package/packages/core/src/gateway/helpers/index.ts +0 -4
- package/packages/core/src/gateway/helpers/narration.ts +0 -60
- package/packages/core/src/gateway/helpers/path.ts +0 -13
- package/packages/core/src/gateway/helpers/redact.ts +0 -61
- package/packages/core/src/gateway/index.ts +0 -5
- package/packages/core/src/gateway/initializer.ts +0 -332
- package/packages/core/src/gateway/lane-queue.ts +0 -169
- package/packages/core/src/gateway/resolver.ts +0 -108
- package/packages/core/src/gateway/router.ts +0 -124
- package/packages/core/src/gateway/routes/agents.ts +0 -187
- package/packages/core/src/gateway/routes/channels.ts +0 -203
- package/packages/core/src/gateway/routes/chat.ts +0 -241
- package/packages/core/src/gateway/routes/config.ts +0 -12
- package/packages/core/src/gateway/routes/cron.ts +0 -42
- package/packages/core/src/gateway/routes/ethics.ts +0 -46
- package/packages/core/src/gateway/routes/mcp.ts +0 -346
- package/packages/core/src/gateway/routes/models.ts +0 -93
- package/packages/core/src/gateway/routes/projects.ts +0 -179
- package/packages/core/src/gateway/routes/providers.ts +0 -192
- package/packages/core/src/gateway/routes/setup.ts +0 -267
- package/packages/core/src/gateway/routes/skills.ts +0 -70
- package/packages/core/src/gateway/routes/system.ts +0 -165
- package/packages/core/src/gateway/routes/tasks.ts +0 -44
- package/packages/core/src/gateway/routes/tools.ts +0 -35
- package/packages/core/src/gateway/routes/users.ts +0 -118
- package/packages/core/src/gateway/routes/voice.ts +0 -73
- package/packages/core/src/gateway/routes/workspace.ts +0 -281
- package/packages/core/src/gateway/server.ts +0 -1978
- package/packages/core/src/gateway/session.ts +0 -95
- package/packages/core/src/gateway/slash-commands.ts +0 -193
- package/packages/core/src/heartbeat/index.ts +0 -157
- package/packages/core/src/mcp/hot-reload.ts +0 -213
- package/packages/core/src/mcp/singleton.ts +0 -21
- package/packages/core/src/memory/index.ts +0 -1
- package/packages/core/src/memory/notes.ts +0 -68
- package/packages/core/src/plugins/api.ts +0 -128
- package/packages/core/src/plugins/index.ts +0 -2
- package/packages/core/src/plugins/loader.ts +0 -365
- package/packages/core/src/resilience/circuit-breaker.ts +0 -225
- package/packages/core/src/security/google-chat.ts +0 -269
- package/packages/core/src/security/index.ts +0 -192
- package/packages/core/src/security/pairing.ts +0 -250
- package/packages/core/src/security/rate-limit.ts +0 -270
- package/packages/core/src/security/signal.ts +0 -321
- package/packages/core/src/state/store.ts +0 -312
- package/packages/core/src/storage/crypto.ts +0 -101
- package/packages/core/src/storage/onboarding.ts +0 -1609
- package/packages/core/src/storage/schema.ts +0 -567
- package/packages/core/src/storage/seed.ts +0 -608
- package/packages/core/src/storage/sqlite.ts +0 -363
- package/packages/core/src/storage/usage.ts +0 -270
- package/packages/core/src/tools/agents/index.ts +0 -607
- package/packages/core/src/tools/bridge-events.ts +0 -26
- package/packages/core/src/tools/canvas/index.ts +0 -281
- package/packages/core/src/tools/cli/index.ts +0 -142
- package/packages/core/src/tools/codebridge/index.ts +0 -179
- package/packages/core/src/tools/core/index.ts +0 -257
- package/packages/core/src/tools/cron/index.ts +0 -373
- package/packages/core/src/tools/filesystem/fs-delete.ts +0 -78
- package/packages/core/src/tools/filesystem/fs-edit.ts +0 -106
- package/packages/core/src/tools/filesystem/fs-exists.ts +0 -63
- package/packages/core/src/tools/filesystem/fs-glob.ts +0 -108
- package/packages/core/src/tools/filesystem/fs-list.ts +0 -129
- package/packages/core/src/tools/filesystem/fs-read.ts +0 -72
- package/packages/core/src/tools/filesystem/fs-write.ts +0 -67
- package/packages/core/src/tools/filesystem/index.ts +0 -34
- package/packages/core/src/tools/filesystem/workspace-guard.ts +0 -62
- package/packages/core/src/tools/index.ts +0 -197
- package/packages/core/src/tools/projects/index.ts +0 -37
- package/packages/core/src/tools/projects/project-create.ts +0 -94
- package/packages/core/src/tools/projects/project-done.ts +0 -66
- package/packages/core/src/tools/projects/project-fail.ts +0 -66
- package/packages/core/src/tools/projects/project-list.ts +0 -96
- package/packages/core/src/tools/projects/project-update.ts +0 -72
- package/packages/core/src/tools/projects/task-create.ts +0 -68
- package/packages/core/src/tools/projects/task-evaluate.ts +0 -93
- package/packages/core/src/tools/projects/task-update.ts +0 -93
- package/packages/core/src/tools/search-knowledge/search-knowledge.ts +0 -155
- package/packages/core/src/tools/types.ts +0 -39
- package/packages/core/src/tools/voice/index.ts +0 -104
- package/packages/core/src/tools/web/browser-click.ts +0 -54
- package/packages/core/src/tools/web/browser-navigate.ts +0 -84
- package/packages/core/src/tools/web/browser-screenshot.ts +0 -54
- package/packages/core/src/tools/web/browser-type.ts +0 -60
- package/packages/core/src/tools/web/index.ts +0 -31
- package/packages/core/src/tools/web/web-fetch.ts +0 -78
- package/packages/core/src/tools/web/web-search.ts +0 -123
- package/packages/core/src/utils/benchmark.ts +0 -80
- package/packages/core/src/utils/crypto.ts +0 -73
- package/packages/core/src/utils/date.ts +0 -42
- package/packages/core/src/utils/index.ts +0 -5
- package/packages/core/src/utils/logger.ts +0 -389
- package/packages/core/src/utils/retry.ts +0 -70
- package/packages/core/src/utils/toon.ts +0 -356
- package/packages/core/src/voice/index.ts +0 -583
- package/packages/hive-ui/README.md +0 -52
- package/packages/hive-ui/components.json +0 -20
- package/packages/hive-ui/index.html +0 -30
- package/packages/hive-ui/package.json +0 -90
- package/packages/hive-ui/public/favicon.ico +0 -0
- package/packages/hive-ui/public/placeholder.svg +0 -1
- package/packages/hive-ui/src/App.tsx +0 -115
- package/packages/hive-ui/src/components/CronJobsPanel.tsx +0 -200
- package/packages/hive-ui/src/components/NavLink.tsx +0 -34
- package/packages/hive-ui/src/components/NotesPanel.tsx +0 -79
- package/packages/hive-ui/src/components/SystemMonitor.tsx +0 -270
- package/packages/hive-ui/src/components/UsageStatsPanel.tsx +0 -334
- package/packages/hive-ui/src/components/WelcomeDialog.tsx +0 -279
- package/packages/hive-ui/src/components/ui/accordion.tsx +0 -52
- package/packages/hive-ui/src/components/ui/alert-dialog.tsx +0 -104
- package/packages/hive-ui/src/components/ui/alert.tsx +0 -45
- package/packages/hive-ui/src/components/ui/aspect-ratio.tsx +0 -5
- package/packages/hive-ui/src/components/ui/avatar.tsx +0 -38
- package/packages/hive-ui/src/components/ui/badge.tsx +0 -29
- package/packages/hive-ui/src/components/ui/bee-loader.tsx +0 -68
- package/packages/hive-ui/src/components/ui/breadcrumb.tsx +0 -90
- package/packages/hive-ui/src/components/ui/button.tsx +0 -47
- package/packages/hive-ui/src/components/ui/calendar.tsx +0 -54
- package/packages/hive-ui/src/components/ui/card.tsx +0 -45
- package/packages/hive-ui/src/components/ui/carousel.tsx +0 -224
- package/packages/hive-ui/src/components/ui/chart.tsx +0 -303
- package/packages/hive-ui/src/components/ui/checkbox.tsx +0 -26
- package/packages/hive-ui/src/components/ui/collapsible.tsx +0 -9
- package/packages/hive-ui/src/components/ui/command.tsx +0 -133
- package/packages/hive-ui/src/components/ui/context-menu.tsx +0 -178
- package/packages/hive-ui/src/components/ui/dialog.tsx +0 -95
- package/packages/hive-ui/src/components/ui/drawer.tsx +0 -87
- package/packages/hive-ui/src/components/ui/dropdown-menu.tsx +0 -179
- package/packages/hive-ui/src/components/ui/form.tsx +0 -129
- package/packages/hive-ui/src/components/ui/hover-card.tsx +0 -27
- package/packages/hive-ui/src/components/ui/input-otp.tsx +0 -61
- package/packages/hive-ui/src/components/ui/input.tsx +0 -22
- package/packages/hive-ui/src/components/ui/label.tsx +0 -17
- package/packages/hive-ui/src/components/ui/menubar.tsx +0 -207
- package/packages/hive-ui/src/components/ui/navigation-menu.tsx +0 -120
- package/packages/hive-ui/src/components/ui/pagination.tsx +0 -80
- package/packages/hive-ui/src/components/ui/popover.tsx +0 -29
- package/packages/hive-ui/src/components/ui/progress.tsx +0 -23
- package/packages/hive-ui/src/components/ui/radio-group.tsx +0 -36
- package/packages/hive-ui/src/components/ui/resizable.tsx +0 -37
- package/packages/hive-ui/src/components/ui/scroll-area.tsx +0 -38
- package/packages/hive-ui/src/components/ui/select.tsx +0 -143
- package/packages/hive-ui/src/components/ui/separator.tsx +0 -20
- package/packages/hive-ui/src/components/ui/sheet.tsx +0 -107
- package/packages/hive-ui/src/components/ui/sidebar.tsx +0 -636
- package/packages/hive-ui/src/components/ui/skeleton.tsx +0 -7
- package/packages/hive-ui/src/components/ui/slider.tsx +0 -23
- package/packages/hive-ui/src/components/ui/sonner.tsx +0 -27
- package/packages/hive-ui/src/components/ui/switch.tsx +0 -27
- package/packages/hive-ui/src/components/ui/table.tsx +0 -72
- package/packages/hive-ui/src/components/ui/tabs.tsx +0 -53
- package/packages/hive-ui/src/components/ui/textarea.tsx +0 -21
- package/packages/hive-ui/src/components/ui/toast.tsx +0 -111
- package/packages/hive-ui/src/components/ui/toaster.tsx +0 -24
- package/packages/hive-ui/src/components/ui/toggle-group.tsx +0 -49
- package/packages/hive-ui/src/components/ui/toggle.tsx +0 -37
- package/packages/hive-ui/src/components/ui/tooltip.tsx +0 -28
- package/packages/hive-ui/src/components/ui/use-toast.ts +0 -3
- package/packages/hive-ui/src/hooks/use-mobile.tsx +0 -19
- package/packages/hive-ui/src/hooks/use-toast.ts +0 -186
- package/packages/hive-ui/src/hooks/useAgentConfig.ts +0 -25
- package/packages/hive-ui/src/hooks/useAgents.ts +0 -38
- package/packages/hive-ui/src/hooks/useBridge.ts +0 -38
- package/packages/hive-ui/src/hooks/useCanvas.ts +0 -24
- package/packages/hive-ui/src/hooks/useChannels.ts +0 -2
- package/packages/hive-ui/src/hooks/useEthics.ts +0 -51
- package/packages/hive-ui/src/hooks/useProviders.ts +0 -14
- package/packages/hive-ui/src/hooks/useTheme.ts +0 -29
- package/packages/hive-ui/src/hooks/useUserConfig.ts +0 -17
- package/packages/hive-ui/src/hooks/useWebSocket.ts +0 -12
- package/packages/hive-ui/src/index.css +0 -620
- package/packages/hive-ui/src/lib/api.ts +0 -100
- package/packages/hive-ui/src/lib/constants.ts +0 -6
- package/packages/hive-ui/src/lib/models.ts +0 -64
- package/packages/hive-ui/src/lib/swal.ts +0 -30
- package/packages/hive-ui/src/lib/utils.ts +0 -6
- package/packages/hive-ui/src/lib/websocket.ts +0 -7
- package/packages/hive-ui/src/main.tsx +0 -5
- package/packages/hive-ui/src/modules/agent-config/details/AgentDetailsEditor.tsx +0 -524
- package/packages/hive-ui/src/modules/agent-config/ethics/EthicsConflictDetector.tsx +0 -18
- package/packages/hive-ui/src/modules/agent-config/ethics/EthicsEditor.tsx +0 -19
- package/packages/hive-ui/src/modules/agent-config/ethics/EthicsRulesList.tsx +0 -36
- package/packages/hive-ui/src/modules/agent-config/ethics/EthicsTemplateGallery.tsx +0 -361
- package/packages/hive-ui/src/modules/agent-config/ethics/index.ts +0 -4
- package/packages/hive-ui/src/modules/agent-config/index.ts +0 -6
- package/packages/hive-ui/src/modules/agent-config/mcp/MCPServerAdd.tsx +0 -322
- package/packages/hive-ui/src/modules/agent-config/mcp/MCPServerCard.tsx +0 -93
- package/packages/hive-ui/src/modules/agent-config/mcp/MCPServerConfig.tsx +0 -427
- package/packages/hive-ui/src/modules/agent-config/mcp/MCPServerList.tsx +0 -85
- package/packages/hive-ui/src/modules/agent-config/mcp/MCPToolExplorer.tsx +0 -79
- package/packages/hive-ui/src/modules/agent-config/mcp/index.ts +0 -5
- package/packages/hive-ui/src/modules/agent-config/shared/ConfigEditorLayout.tsx +0 -30
- package/packages/hive-ui/src/modules/agent-config/shared/ConfigExporter.tsx +0 -26
- package/packages/hive-ui/src/modules/agent-config/shared/ConfigImporter.tsx +0 -25
- package/packages/hive-ui/src/modules/agent-config/shared/DiffViewer.tsx +0 -31
- package/packages/hive-ui/src/modules/agent-config/shared/MarkdownEditor.tsx +0 -32
- package/packages/hive-ui/src/modules/agent-config/shared/SaveStatusIndicator.tsx +0 -23
- package/packages/hive-ui/src/modules/agent-config/shared/ValidationPanel.tsx +0 -36
- package/packages/hive-ui/src/modules/agent-config/shared/index.ts +0 -7
- package/packages/hive-ui/src/modules/agent-config/skills/SkillCard.tsx +0 -81
- package/packages/hive-ui/src/modules/agent-config/skills/SkillConfigEditor.tsx +0 -22
- package/packages/hive-ui/src/modules/agent-config/skills/SkillCreator.tsx +0 -60
- package/packages/hive-ui/src/modules/agent-config/skills/SkillInstaller.tsx +0 -23
- package/packages/hive-ui/src/modules/agent-config/skills/SkillList.tsx +0 -72
- package/packages/hive-ui/src/modules/agent-config/skills/SkillsTab.tsx +0 -202
- package/packages/hive-ui/src/modules/agent-config/skills/index.ts +0 -5
- package/packages/hive-ui/src/modules/agent-config/tools/ToolCard.tsx +0 -27
- package/packages/hive-ui/src/modules/agent-config/tools/ToolConfigPanel.tsx +0 -22
- package/packages/hive-ui/src/modules/agent-config/tools/ToolManager.tsx +0 -266
- package/packages/hive-ui/src/modules/agent-config/tools/ToolPermissions.tsx +0 -287
- package/packages/hive-ui/src/modules/agent-config/tools/ToolRegistry.tsx +0 -84
- package/packages/hive-ui/src/modules/agent-config/tools/ToolUsageStats.tsx +0 -52
- package/packages/hive-ui/src/modules/agent-config/tools/index.ts +0 -4
- package/packages/hive-ui/src/modules/agent-config/user/ActiveAgentsList.tsx +0 -109
- package/packages/hive-ui/src/modules/agent-config/user/GlobalConfigOverview.tsx +0 -119
- package/packages/hive-ui/src/modules/agent-config/user/UserMemoryManager.tsx +0 -54
- package/packages/hive-ui/src/modules/agent-config/user/UserPreferencesForm.tsx +0 -163
- package/packages/hive-ui/src/modules/agent-config/user/UserProfileEditor.tsx +0 -261
- package/packages/hive-ui/src/modules/agent-config/user/index.ts +0 -3
- package/packages/hive-ui/src/modules/agents/AgentActivityLog.tsx +0 -25
- package/packages/hive-ui/src/modules/agents/AgentCard.tsx +0 -305
- package/packages/hive-ui/src/modules/agents/AgentCreateForm.tsx +0 -446
- package/packages/hive-ui/src/modules/agents/AgentDetail.tsx +0 -28
- package/packages/hive-ui/src/modules/agents/AgentInternalCard.tsx +0 -162
- package/packages/hive-ui/src/modules/agents/AgentList.tsx +0 -29
- package/packages/hive-ui/src/modules/agents/AgentStatusBadge.tsx +0 -34
- package/packages/hive-ui/src/modules/agents/ModelSelector.tsx +0 -151
- package/packages/hive-ui/src/modules/bridge/BridgeLogViewer.tsx +0 -61
- package/packages/hive-ui/src/modules/bridge/BridgeProcessList.tsx +0 -77
- package/packages/hive-ui/src/modules/bridge/BridgeStatus.tsx +0 -23
- package/packages/hive-ui/src/modules/bridge/BridgeTerminal.tsx +0 -7
- package/packages/hive-ui/src/modules/canvas/CanvasButton.tsx +0 -3
- package/packages/hive-ui/src/modules/canvas/CanvasChart.tsx +0 -3
- package/packages/hive-ui/src/modules/canvas/CanvasComponentMap.tsx +0 -605
- package/packages/hive-ui/src/modules/canvas/CanvasContainer.tsx +0 -360
- package/packages/hive-ui/src/modules/canvas/CanvasForm.tsx +0 -3
- package/packages/hive-ui/src/modules/canvas/CanvasMarkdown.tsx +0 -3
- package/packages/hive-ui/src/modules/canvas/CanvasTable.tsx +0 -3
- package/packages/hive-ui/src/modules/canvas/ComponentRenderer.tsx +0 -30
- package/packages/hive-ui/src/modules/canvas/DynamicRenderer.tsx +0 -3
- package/packages/hive-ui/src/modules/channels/available/AvailableChannelsGrid.tsx +0 -89
- package/packages/hive-ui/src/modules/channels/available/ChannelAuthForm.tsx +0 -33
- package/packages/hive-ui/src/modules/channels/available/ChannelSetupWizard.tsx +0 -48
- package/packages/hive-ui/src/modules/channels/available/ChannelTestConnection.tsx +0 -37
- package/packages/hive-ui/src/modules/channels/available/ChannelTypeCard.tsx +0 -30
- package/packages/hive-ui/src/modules/channels/available/ChannelWebhookConfig.tsx +0 -30
- package/packages/hive-ui/src/modules/channels/available/index.ts +0 -6
- package/packages/hive-ui/src/modules/channels/connected/ChannelCard.tsx +0 -95
- package/packages/hive-ui/src/modules/channels/connected/ChannelConfigPanel.tsx +0 -260
- package/packages/hive-ui/src/modules/channels/connected/ChannelDisconnectButton.tsx +0 -21
- package/packages/hive-ui/src/modules/channels/connected/ChannelLogsViewer.tsx +0 -42
- package/packages/hive-ui/src/modules/channels/connected/ChannelQRCode.tsx +0 -32
- package/packages/hive-ui/src/modules/channels/connected/ChannelReconnectButton.tsx +0 -16
- package/packages/hive-ui/src/modules/channels/connected/ChannelStatusBadge.tsx +0 -26
- package/packages/hive-ui/src/modules/channels/connected/ConnectedChannelsList.tsx +0 -40
- package/packages/hive-ui/src/modules/channels/connected/index.ts +0 -8
- package/packages/hive-ui/src/modules/channels/shared/ChannelCard.tsx +0 -84
- package/packages/hive-ui/src/modules/channels/shared/ChannelConfigDialog.tsx +0 -279
- package/packages/hive-ui/src/modules/channels/shared/ChannelIcon.tsx +0 -40
- package/packages/hive-ui/src/modules/channels/shared/ChannelStats.tsx +0 -37
- package/packages/hive-ui/src/modules/channels/shared/ChannelTypeBadge.tsx +0 -23
- package/packages/hive-ui/src/modules/channels/shared/ConnectionHealthIndicator.tsx +0 -20
- package/packages/hive-ui/src/modules/channels/shared/MessagePreview.tsx +0 -19
- package/packages/hive-ui/src/modules/channels/shared/index.ts +0 -5
- package/packages/hive-ui/src/modules/chat/ChatContainer.tsx +0 -268
- package/packages/hive-ui/src/modules/chat/ChatHistory.tsx +0 -101
- package/packages/hive-ui/src/modules/chat/ChatInput.tsx +0 -108
- package/packages/hive-ui/src/modules/chat/ChatMessage.tsx +0 -137
- package/packages/hive-ui/src/modules/chat/ThinkingIndicator.tsx +0 -10
- package/packages/hive-ui/src/modules/layout/AppLayout.tsx +0 -45
- package/packages/hive-ui/src/modules/layout/ConnectionStatus.tsx +0 -19
- package/packages/hive-ui/src/modules/layout/Header.tsx +0 -20
- package/packages/hive-ui/src/modules/layout/HiveSidebar.tsx +0 -173
- package/packages/hive-ui/src/modules/layout/ThemeToggle.tsx +0 -18
- package/packages/hive-ui/src/modules/providers/ProviderCard.tsx +0 -319
- package/packages/hive-ui/src/modules/providers/ProviderConfigForm.tsx +0 -146
- package/packages/hive-ui/src/modules/providers/ProviderFailoverConfig.tsx +0 -110
- package/packages/hive-ui/src/modules/providers/ProviderList.tsx +0 -33
- package/packages/hive-ui/src/modules/providers/ProviderStatusIndicator.tsx +0 -23
- package/packages/hive-ui/src/modules/providers/configs/ProviderAPIKeyManager.tsx +0 -39
- package/packages/hive-ui/src/modules/providers/configs/ProviderEndpointConfig.tsx +0 -27
- package/packages/hive-ui/src/modules/providers/configs/ProviderRateLimits.tsx +0 -37
- package/packages/hive-ui/src/modules/providers/configs/ProviderRetryPolicy.tsx +0 -46
- package/packages/hive-ui/src/modules/providers/configs/index.ts +0 -4
- package/packages/hive-ui/src/modules/providers/index.ts +0 -5
- package/packages/hive-ui/src/modules/providers/models/ModelBenchmarkBadge.tsx +0 -21
- package/packages/hive-ui/src/modules/providers/models/ModelCapabilities.tsx +0 -44
- package/packages/hive-ui/src/modules/providers/models/ModelCard.tsx +0 -36
- package/packages/hive-ui/src/modules/providers/models/ModelComparisonTable.tsx +0 -47
- package/packages/hive-ui/src/modules/providers/models/ModelList.tsx +0 -51
- package/packages/hive-ui/src/modules/providers/models/ModelPricingInfo.tsx +0 -17
- package/packages/hive-ui/src/modules/providers/models/ModelSelector.tsx +0 -32
- package/packages/hive-ui/src/modules/providers/models/index.ts +0 -7
- package/packages/hive-ui/src/pages/AgentDetailPage.tsx +0 -74
- package/packages/hive-ui/src/pages/AgentNewPage.tsx +0 -5
- package/packages/hive-ui/src/pages/AgentsPage.tsx +0 -147
- package/packages/hive-ui/src/pages/BridgePage.tsx +0 -83
- package/packages/hive-ui/src/pages/CanvasPage.tsx +0 -32
- package/packages/hive-ui/src/pages/ChannelsPage.tsx +0 -176
- package/packages/hive-ui/src/pages/DashboardPage.tsx +0 -321
- package/packages/hive-ui/src/pages/Index.tsx +0 -14
- package/packages/hive-ui/src/pages/LogsPage.tsx +0 -252
- package/packages/hive-ui/src/pages/NotFound.tsx +0 -24
- package/packages/hive-ui/src/pages/ProjectsPage.tsx +0 -241
- package/packages/hive-ui/src/pages/ProvidersPage.tsx +0 -111
- package/packages/hive-ui/src/pages/SettingsPage.tsx +0 -147
- package/packages/hive-ui/src/pages/SetupPage.tsx +0 -1177
- package/packages/hive-ui/src/pages/WebChatPage.tsx +0 -15
- package/packages/hive-ui/src/stores/agentConfigStore.ts +0 -32
- package/packages/hive-ui/src/stores/agentStore.ts +0 -5
- package/packages/hive-ui/src/stores/bridgeStore.ts +0 -237
- package/packages/hive-ui/src/stores/canvasStore.ts +0 -250
- package/packages/hive-ui/src/stores/channelStore.ts +0 -5
- package/packages/hive-ui/src/stores/chatStore.ts +0 -42
- package/packages/hive-ui/src/stores/ethicsStore.ts +0 -141
- package/packages/hive-ui/src/stores/mcpStore.ts +0 -5
- package/packages/hive-ui/src/stores/modelStore.ts +0 -2
- package/packages/hive-ui/src/stores/projectsStore.ts +0 -141
- package/packages/hive-ui/src/stores/providerStore.ts +0 -2
- package/packages/hive-ui/src/stores/skillStore.ts +0 -5
- package/packages/hive-ui/src/stores/toolStore.ts +0 -5
- package/packages/hive-ui/src/stores/useGlobalConfigStore.ts +0 -937
- package/packages/hive-ui/src/stores/useLoaderStore.ts +0 -21
- package/packages/hive-ui/src/stores/useNotesAndCronsStore.ts +0 -144
- package/packages/hive-ui/src/stores/useWebSocketStore.ts +0 -152
- package/packages/hive-ui/src/stores/useWelcomeStore.ts +0 -37
- package/packages/hive-ui/src/stores/userConfigStore.ts +0 -23
- package/packages/hive-ui/src/stores/userStore.ts +0 -82
- package/packages/hive-ui/src/test/setup.ts +0 -15
- package/packages/hive-ui/src/types/agent-config.ts +0 -33
- package/packages/hive-ui/src/types/agent.ts +0 -65
- package/packages/hive-ui/src/types/bridge.ts +0 -27
- package/packages/hive-ui/src/types/canvas.ts +0 -76
- package/packages/hive-ui/src/types/channels.ts +0 -109
- package/packages/hive-ui/src/types/chat.ts +0 -25
- package/packages/hive-ui/src/types/connections.ts +0 -17
- package/packages/hive-ui/src/types/ethics.ts +0 -41
- package/packages/hive-ui/src/types/index.ts +0 -15
- package/packages/hive-ui/src/types/mcp.ts +0 -36
- package/packages/hive-ui/src/types/notes-crons.ts +0 -31
- package/packages/hive-ui/src/types/providers.ts +0 -145
- package/packages/hive-ui/src/types/skill.ts +0 -12
- package/packages/hive-ui/src/types/tool.ts +0 -44
- package/packages/hive-ui/src/types/user.ts +0 -26
- package/packages/hive-ui/src/types/websocket.ts +0 -14
- package/packages/hive-ui/src/vite-env.d.ts +0 -1
- package/packages/mcp/package.json +0 -26
- package/packages/mcp/src/config.ts +0 -13
- package/packages/mcp/src/index.ts +0 -1
- package/packages/mcp/src/logger.ts +0 -42
- package/packages/mcp/src/manager.ts +0 -439
- package/packages/mcp/src/transports/index.ts +0 -67
- package/packages/mcp/src/transports/sse.ts +0 -241
- package/packages/mcp/src/transports/websocket.ts +0 -159
- package/packages/skills/package.json +0 -21
- package/packages/skills/src/index.ts +0 -1
- package/packages/skills/src/loader.ts +0 -346
|
@@ -1,607 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agents Tools - 14 tools
|
|
3
|
-
*
|
|
4
|
-
* @category agents
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { Tool } from "../types.ts";
|
|
8
|
-
import { getDb } from "../../storage/sqlite.ts";
|
|
9
|
-
import { logger } from "../../utils/logger.ts";
|
|
10
|
-
|
|
11
|
-
const log = logger.child("agents");
|
|
12
|
-
|
|
13
|
-
// ─── memory_write ────────────────────────────────────────────────────────────
|
|
14
|
-
|
|
15
|
-
export const memoryWriteTool: Tool = {
|
|
16
|
-
name: "memory_write",
|
|
17
|
-
description: "Store information in persistent long-term memory. Spanish: guardar memoria, recordar, guardar dato, memoria persistente",
|
|
18
|
-
parameters: {
|
|
19
|
-
type: "object",
|
|
20
|
-
properties: {
|
|
21
|
-
title: { type: "string", description: "Descriptive title for this memory" },
|
|
22
|
-
content: { type: "string", description: "Content to store" },
|
|
23
|
-
},
|
|
24
|
-
required: ["title", "content"],
|
|
25
|
-
},
|
|
26
|
-
execute: async (params: Record<string, unknown>) => {
|
|
27
|
-
const db = getDb();
|
|
28
|
-
const title = params.title as string;
|
|
29
|
-
const content = params.content as string;
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
db.query(`
|
|
33
|
-
INSERT OR REPLACE INTO notes (id, title, content, createdAt, updatedAt)
|
|
34
|
-
VALUES (lower(hex(randomblob(16))), ?, ?, unixepoch(), unixepoch())
|
|
35
|
-
`).run(title, content);
|
|
36
|
-
|
|
37
|
-
return { ok: true, title, message: "Memory saved." };
|
|
38
|
-
} catch (error) {
|
|
39
|
-
return { ok: false, error: `Failed to save memory: ${(error as Error).message}` };
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// ─── memory_read ─────────────────────────────────────────────────────────────
|
|
45
|
-
|
|
46
|
-
export const memoryReadTool: Tool = {
|
|
47
|
-
name: "memory_read",
|
|
48
|
-
description: "Retrieve a memory entry by identifier. Spanish: leer memoria, recuperar dato, obtener memoria",
|
|
49
|
-
parameters: {
|
|
50
|
-
type: "object",
|
|
51
|
-
properties: {
|
|
52
|
-
title: { type: "string", description: "Title of the memory to retrieve" },
|
|
53
|
-
},
|
|
54
|
-
required: ["title"],
|
|
55
|
-
},
|
|
56
|
-
execute: async (params: Record<string, unknown>) => {
|
|
57
|
-
const db = getDb();
|
|
58
|
-
const title = params.title as string;
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const note = db.query<any, [string]>("SELECT * FROM notes WHERE title = ?").get(title);
|
|
62
|
-
|
|
63
|
-
if (!note) {
|
|
64
|
-
return { ok: false, error: `Memory not found: ${title}` };
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return {
|
|
68
|
-
ok: true,
|
|
69
|
-
title: note.title,
|
|
70
|
-
content: note.content,
|
|
71
|
-
createdAt: new Date(note.createdAt * 1000).toISOString(),
|
|
72
|
-
updatedAt: new Date(note.updatedAt * 1000).toISOString(),
|
|
73
|
-
};
|
|
74
|
-
} catch (error) {
|
|
75
|
-
return { ok: false, error: `Failed to read memory: ${(error as Error).message}` };
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// ─── memory_list ─────────────────────────────────────────────────────────────
|
|
81
|
-
|
|
82
|
-
export const memoryListTool: Tool = {
|
|
83
|
-
name: "memory_list",
|
|
84
|
-
description: "List all saved memory entries. Spanish: listar memorias, ver memorias, todas las memorias",
|
|
85
|
-
parameters: {
|
|
86
|
-
type: "object",
|
|
87
|
-
properties: {},
|
|
88
|
-
},
|
|
89
|
-
execute: async () => {
|
|
90
|
-
const db = getDb();
|
|
91
|
-
|
|
92
|
-
try {
|
|
93
|
-
const notes = db.query("SELECT id, title, createdAt FROM notes ORDER BY updatedAt DESC").all() as any[];
|
|
94
|
-
|
|
95
|
-
return {
|
|
96
|
-
ok: true,
|
|
97
|
-
count: notes.length,
|
|
98
|
-
entries: notes.map((n) => ({ title: n.title, createdAt: new Date(n.createdAt * 1000).toISOString() })),
|
|
99
|
-
};
|
|
100
|
-
} catch (error) {
|
|
101
|
-
return { ok: false, error: `Failed to list memories: ${(error as Error).message}` };
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
// ─── memory_search ───────────────────────────────────────────────────────────
|
|
107
|
-
|
|
108
|
-
export const memorySearchTool: Tool = {
|
|
109
|
-
name: "memory_search",
|
|
110
|
-
description: "Search memories by keyword. Spanish: buscar memoria, encontrar recuerdo, buscar dato guardado",
|
|
111
|
-
parameters: {
|
|
112
|
-
type: "object",
|
|
113
|
-
properties: {
|
|
114
|
-
query: { type: "string", description: "Search query" },
|
|
115
|
-
},
|
|
116
|
-
required: ["query"],
|
|
117
|
-
},
|
|
118
|
-
execute: async (params: Record<string, unknown>) => {
|
|
119
|
-
const db = getDb();
|
|
120
|
-
const query = params.query as string;
|
|
121
|
-
|
|
122
|
-
try {
|
|
123
|
-
const stmt = db.query<any, [string, string]>(
|
|
124
|
-
"SELECT id, title, content FROM notes WHERE content LIKE ? OR title LIKE ?"
|
|
125
|
-
);
|
|
126
|
-
const notes = stmt.all(`%${query}%`, `%${query}%`) as any[];
|
|
127
|
-
|
|
128
|
-
return {
|
|
129
|
-
ok: true,
|
|
130
|
-
query,
|
|
131
|
-
count: notes.length,
|
|
132
|
-
results: notes.map((n) => ({
|
|
133
|
-
title: n.title,
|
|
134
|
-
snippet: n.content.slice(0, 200) + (n.content.length > 200 ? "..." : ""),
|
|
135
|
-
})),
|
|
136
|
-
};
|
|
137
|
-
} catch (error) {
|
|
138
|
-
return { ok: false, error: `Failed to search memories: ${(error as Error).message}` };
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
// ─── memory_delete ───────────────────────────────────────────────────────────
|
|
144
|
-
|
|
145
|
-
export const memoryDeleteTool: Tool = {
|
|
146
|
-
name: "memory_delete",
|
|
147
|
-
description: "Delete a specific memory entry. Spanish: borrar memoria, eliminar recuerdo, quitar dato",
|
|
148
|
-
parameters: {
|
|
149
|
-
type: "object",
|
|
150
|
-
properties: {
|
|
151
|
-
title: { type: "string", description: "Title of the memory to delete" },
|
|
152
|
-
},
|
|
153
|
-
required: ["title"],
|
|
154
|
-
},
|
|
155
|
-
execute: async (params: Record<string, unknown>) => {
|
|
156
|
-
const db = getDb();
|
|
157
|
-
const title = params.title as string;
|
|
158
|
-
|
|
159
|
-
try {
|
|
160
|
-
const result = db.query("DELETE FROM notes WHERE title = ?").run(title);
|
|
161
|
-
|
|
162
|
-
if (result.changes === 0) {
|
|
163
|
-
return { ok: false, error: `Memory not found: ${title}` };
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return { ok: true, title, message: "Memory deleted." };
|
|
167
|
-
} catch (error) {
|
|
168
|
-
return { ok: false, error: `Failed to delete memory: ${(error as Error).message}` };
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
// ─── agent_create ────────────────────────────────────────────────────────────
|
|
174
|
-
|
|
175
|
-
export const agentCreateTool: Tool = {
|
|
176
|
-
name: "agent_create",
|
|
177
|
-
description: "Create a new specialized worker agent. Spanish: crear agente, nuevo worker, nuevo trabajador",
|
|
178
|
-
parameters: {
|
|
179
|
-
type: "object",
|
|
180
|
-
properties: {
|
|
181
|
-
name: { type: "string", description: "Name of the agent" },
|
|
182
|
-
description: { type: "string", description: "Description of the agent's role" },
|
|
183
|
-
system_prompt: { type: "string", description: "System prompt for the agent" },
|
|
184
|
-
tools_json: { type: "array", description: "List of tool IDs", items: { type: "string" } },
|
|
185
|
-
},
|
|
186
|
-
required: ["name"],
|
|
187
|
-
},
|
|
188
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
189
|
-
const db = getDb();
|
|
190
|
-
const userId = config?.configurable?.user_id;
|
|
191
|
-
const name = params.name as string;
|
|
192
|
-
const description = (params.description as string) ?? "";
|
|
193
|
-
const systemPrompt = (params.system_prompt as string) ?? "";
|
|
194
|
-
const toolsJson = params.tools_json ? JSON.stringify(params.tools_json) : null;
|
|
195
|
-
|
|
196
|
-
try {
|
|
197
|
-
const agentId = crypto.randomUUID().replace(/-/g, "").slice(0, 16);
|
|
198
|
-
|
|
199
|
-
db.query(`
|
|
200
|
-
INSERT INTO agents (id, user_id, name, description, system_prompt, tools_json, role, status, created_at, updated_at)
|
|
201
|
-
VALUES (?, ?, ?, ?, ?, ?, 'worker', 'idle', unixepoch(), unixepoch())
|
|
202
|
-
`).run(agentId, userId, name, description, systemPrompt, toolsJson);
|
|
203
|
-
|
|
204
|
-
return { ok: true, agentId, name, message: "Agent created." };
|
|
205
|
-
} catch (error) {
|
|
206
|
-
return { ok: false, error: `Failed to create agent: ${(error as Error).message}` };
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
// ─── agent_find ──────────────────────────────────────────────────────────────
|
|
212
|
-
|
|
213
|
-
export const agentFindTool: Tool = {
|
|
214
|
-
name: "agent_find",
|
|
215
|
-
description: "Find existing running or idle worker agents. Spanish: buscar agente, encontrar worker, localizar agente",
|
|
216
|
-
parameters: {
|
|
217
|
-
type: "object",
|
|
218
|
-
properties: {
|
|
219
|
-
search: { type: "string", description: "Search term for agent name or description" },
|
|
220
|
-
status: { type: "string", enum: ["idle", "active", "any"], description: "Filter by status" },
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
224
|
-
const db = getDb();
|
|
225
|
-
const userId = config?.configurable?.user_id;
|
|
226
|
-
const search = params.search as string | undefined;
|
|
227
|
-
const status = params.status as string | undefined;
|
|
228
|
-
|
|
229
|
-
try {
|
|
230
|
-
let query = "SELECT id, name, description, role, status FROM agents WHERE user_id = ? AND role = 'worker'";
|
|
231
|
-
const args: any[] = [userId];
|
|
232
|
-
|
|
233
|
-
if (search) {
|
|
234
|
-
query += " AND (name LIKE ? OR description LIKE ?)";
|
|
235
|
-
args.push(`%${search}%`, `%${search}%`);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
if (status && status !== "any") {
|
|
239
|
-
query += " AND status = ?";
|
|
240
|
-
args.push(status);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
const agents = db.query(query).all(...args) as any[];
|
|
244
|
-
|
|
245
|
-
return {
|
|
246
|
-
ok: true,
|
|
247
|
-
count: agents.length,
|
|
248
|
-
agents: agents.map((a) => ({
|
|
249
|
-
id: a.id,
|
|
250
|
-
name: a.name,
|
|
251
|
-
description: a.description,
|
|
252
|
-
role: a.role,
|
|
253
|
-
status: a.status,
|
|
254
|
-
})),
|
|
255
|
-
};
|
|
256
|
-
} catch (error) {
|
|
257
|
-
return { ok: false, error: `Failed to find agents: ${(error as Error).message}` };
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
// ─── agent_archive ───────────────────────────────────────────────────────────
|
|
263
|
-
|
|
264
|
-
export const agentArchiveTool: Tool = {
|
|
265
|
-
name: "agent_archive",
|
|
266
|
-
description: "Archive or terminate a worker agent. Spanish: archivar agente, terminar worker, desactivar agente",
|
|
267
|
-
parameters: {
|
|
268
|
-
type: "object",
|
|
269
|
-
properties: {
|
|
270
|
-
agentId: { type: "string", description: "ID of the agent to archive" },
|
|
271
|
-
},
|
|
272
|
-
required: ["agentId"],
|
|
273
|
-
},
|
|
274
|
-
execute: async (params: Record<string, unknown>) => {
|
|
275
|
-
const db = getDb();
|
|
276
|
-
const agentId = params.agentId as string;
|
|
277
|
-
|
|
278
|
-
try {
|
|
279
|
-
const result = db.query(`UPDATE agents SET enabled = 0, updated_at = unixepoch() WHERE id = ?`).run(agentId);
|
|
280
|
-
|
|
281
|
-
if (result.changes === 0) {
|
|
282
|
-
return { ok: false, error: `Agent not found: ${agentId}` };
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
return { ok: true, agentId, message: "Agent archived." };
|
|
286
|
-
} catch (error) {
|
|
287
|
-
return { ok: false, error: `Failed to archive agent: ${(error as Error).message}` };
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
// ─── task_delegate ───────────────────────────────────────────────────────────
|
|
293
|
-
|
|
294
|
-
export const taskDelegateTool: Tool = {
|
|
295
|
-
name: "task_delegate",
|
|
296
|
-
description: "Delegate a task to a worker agent and execute it immediately (blocking). Spanish: delegar tarea, asignar worker, ejecutar por agente, delegate_task",
|
|
297
|
-
parameters: {
|
|
298
|
-
type: "object",
|
|
299
|
-
properties: {
|
|
300
|
-
worker_id: { type: "string", description: "ID of the worker agent" },
|
|
301
|
-
task_description: { type: "string", description: "Clear, detailed instructions for the worker" },
|
|
302
|
-
task_id: { type: "number", description: "Optional task DB ID to update status automatically" },
|
|
303
|
-
project_id: { type: "string", description: "Optional project ID for progress tracking" },
|
|
304
|
-
},
|
|
305
|
-
required: ["worker_id", "task_description"],
|
|
306
|
-
},
|
|
307
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
308
|
-
const db = getDb();
|
|
309
|
-
const workerId = params.worker_id as string;
|
|
310
|
-
const taskDescription = params.task_description as string;
|
|
311
|
-
const taskId = params.task_id as number | undefined;
|
|
312
|
-
const projectId = params.project_id as string | undefined;
|
|
313
|
-
|
|
314
|
-
// Verify worker exists and is enabled
|
|
315
|
-
const worker = db.query<any, [string]>(
|
|
316
|
-
"SELECT id, name, enabled FROM agents WHERE id = ?"
|
|
317
|
-
).get(workerId);
|
|
318
|
-
|
|
319
|
-
if (!worker) {
|
|
320
|
-
return { ok: false, error: `Worker not found: ${workerId}` };
|
|
321
|
-
}
|
|
322
|
-
if (!worker.enabled) {
|
|
323
|
-
return { ok: false, error: `Worker is disabled: ${worker.name}` };
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
// Mark task in_progress if task_id provided
|
|
327
|
-
if (taskId) {
|
|
328
|
-
db.query("UPDATE tasks SET status='in_progress', agent_id=?, updated_at=unixepoch() WHERE id=?")
|
|
329
|
-
.run(workerId, taskId);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
log.info(`[task_delegate] Delegating to ${worker.name} (${workerId})`);
|
|
333
|
-
|
|
334
|
-
try {
|
|
335
|
-
// Dynamic import to avoid circular dependency (agent-loop → tools → agent-loop)
|
|
336
|
-
const { runAgentIsolated } = await import("../../agent/agent-loop.ts");
|
|
337
|
-
|
|
338
|
-
const threadId = `task-${taskId ?? Date.now()}-${workerId}`;
|
|
339
|
-
const result = await runAgentIsolated({
|
|
340
|
-
agentId: workerId,
|
|
341
|
-
taskDescription,
|
|
342
|
-
threadId,
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
// Update task to completed if task_id provided
|
|
346
|
-
if (taskId) {
|
|
347
|
-
db.query(
|
|
348
|
-
"UPDATE tasks SET status='completed', progress=100, result=?, updated_at=unixepoch() WHERE id=?"
|
|
349
|
-
).run(result, taskId);
|
|
350
|
-
|
|
351
|
-
// Recalculate project progress if project_id provided
|
|
352
|
-
if (projectId) {
|
|
353
|
-
const rows = db.query<any, [string]>(
|
|
354
|
-
"SELECT AVG(progress) as avg FROM tasks WHERE project_id=?"
|
|
355
|
-
).get(projectId);
|
|
356
|
-
const avg = Math.round(rows?.avg ?? 0);
|
|
357
|
-
db.query("UPDATE projects SET progress=?, updated_at=unixepoch() WHERE id=?")
|
|
358
|
-
.run(avg, projectId);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
return {
|
|
363
|
-
ok: true,
|
|
364
|
-
worker_id: workerId,
|
|
365
|
-
worker_name: worker.name,
|
|
366
|
-
task_id: taskId,
|
|
367
|
-
result,
|
|
368
|
-
project_progress: projectId
|
|
369
|
-
? (db.query<any, [string]>("SELECT progress FROM projects WHERE id=?").get(projectId)?.progress ?? null)
|
|
370
|
-
: null,
|
|
371
|
-
};
|
|
372
|
-
} catch (err) {
|
|
373
|
-
// Mark task failed if task_id provided
|
|
374
|
-
if (taskId) {
|
|
375
|
-
db.query(
|
|
376
|
-
"UPDATE tasks SET status='failed', result=?, updated_at=unixepoch() WHERE id=?"
|
|
377
|
-
).run((err as Error).message, taskId);
|
|
378
|
-
}
|
|
379
|
-
return {
|
|
380
|
-
ok: false,
|
|
381
|
-
worker_id: workerId,
|
|
382
|
-
task_id: taskId,
|
|
383
|
-
error: (err as Error).message,
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
},
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
// ─── task_delegate_code ──────────────────────────────────────────────────────
|
|
390
|
-
|
|
391
|
-
export const taskDelegateCodeTool: Tool = {
|
|
392
|
-
name: "task_delegate_code",
|
|
393
|
-
description: "Delegate a coding task to a CLI subagent (Qwen, Claude, etc.) via Code Bridge. Spanish: delegar código, subagente CLI, programación, Qwen",
|
|
394
|
-
parameters: {
|
|
395
|
-
type: "object",
|
|
396
|
-
properties: {
|
|
397
|
-
cli: { type: "string", enum: ["qwen", "claude", "opencode", "gemini"], description: "CLI tool to use" },
|
|
398
|
-
task_instructions: { type: "string", description: "Coding task instructions" },
|
|
399
|
-
},
|
|
400
|
-
required: ["cli", "task_instructions"],
|
|
401
|
-
},
|
|
402
|
-
execute: async (params: Record<string, unknown>) => {
|
|
403
|
-
const cli = params.cli as string;
|
|
404
|
-
const taskInstructions = params.task_instructions as string;
|
|
405
|
-
|
|
406
|
-
return {
|
|
407
|
-
ok: true,
|
|
408
|
-
cli,
|
|
409
|
-
message: `Code task delegated to ${cli}: ${taskInstructions.substring(0, 100)}...`,
|
|
410
|
-
};
|
|
411
|
-
},
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
// ─── task_status ─────────────────────────────────────────────────────────────
|
|
415
|
-
|
|
416
|
-
export const taskStatusTool: Tool = {
|
|
417
|
-
name: "task_status",
|
|
418
|
-
description: "Get execution status of one or more delegated tasks. Spanish: estado tarea delegada, verificar progreso, consultar tarea",
|
|
419
|
-
parameters: {
|
|
420
|
-
type: "object",
|
|
421
|
-
properties: {
|
|
422
|
-
task_ids: { type: "array", description: "List of task IDs", items: { type: "number" } },
|
|
423
|
-
},
|
|
424
|
-
required: ["task_ids"],
|
|
425
|
-
},
|
|
426
|
-
execute: async (params: Record<string, unknown>) => {
|
|
427
|
-
const db = getDb();
|
|
428
|
-
const taskIds = params.task_ids as number[];
|
|
429
|
-
|
|
430
|
-
try {
|
|
431
|
-
const placeholders = taskIds.map(() => "?").join(",");
|
|
432
|
-
const tasks = db.query<any, any[]>(
|
|
433
|
-
`SELECT id, name, status, progress, result FROM tasks WHERE id IN (${placeholders})`
|
|
434
|
-
).all(...taskIds) as any[];
|
|
435
|
-
|
|
436
|
-
return {
|
|
437
|
-
ok: true,
|
|
438
|
-
task_count: tasks.length,
|
|
439
|
-
tasks: tasks.map((t) => ({
|
|
440
|
-
id: t.id,
|
|
441
|
-
name: t.name,
|
|
442
|
-
status: t.status,
|
|
443
|
-
progress: t.progress,
|
|
444
|
-
result: t.result,
|
|
445
|
-
})),
|
|
446
|
-
};
|
|
447
|
-
} catch (error) {
|
|
448
|
-
return { ok: false, error: `Failed to get task status: ${(error as Error).message}` };
|
|
449
|
-
}
|
|
450
|
-
},
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
// ─── bus_publish ─────────────────────────────────────────────────────────────
|
|
454
|
-
|
|
455
|
-
export const busPublishTool: Tool = {
|
|
456
|
-
name: "bus_publish",
|
|
457
|
-
description: "Publish a message to the Agent Bus for worker-to-worker communication. Spanish: publicar mensaje, comunicar workers, enviar bus",
|
|
458
|
-
parameters: {
|
|
459
|
-
type: "object",
|
|
460
|
-
properties: {
|
|
461
|
-
event_type: { type: "string", description: "Type of event" },
|
|
462
|
-
content: { type: "string", description: "Message content" },
|
|
463
|
-
to_worker_id: { type: "string", description: "Target worker ID (optional)" },
|
|
464
|
-
},
|
|
465
|
-
required: ["event_type", "content"],
|
|
466
|
-
},
|
|
467
|
-
execute: async (params: Record<string, unknown>) => {
|
|
468
|
-
const db = getDb();
|
|
469
|
-
const eventType = params.event_type as string;
|
|
470
|
-
const content = params.content as string;
|
|
471
|
-
const toWorkerId = (params.to_worker_id as string) ?? null;
|
|
472
|
-
|
|
473
|
-
try {
|
|
474
|
-
db.query(`
|
|
475
|
-
INSERT INTO agent_bus_messages (event_type, content, to_worker_id, created_at)
|
|
476
|
-
VALUES (?, ?, ?, unixepoch())
|
|
477
|
-
`).run(eventType, content, toWorkerId);
|
|
478
|
-
|
|
479
|
-
return { ok: true, message: "Message published." };
|
|
480
|
-
} catch (error) {
|
|
481
|
-
return { ok: false, error: `Failed to publish: ${(error as Error).message}` };
|
|
482
|
-
}
|
|
483
|
-
},
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
// ─── bus_read ────────────────────────────────────────────────────────────────
|
|
487
|
-
|
|
488
|
-
export const busReadTool: Tool = {
|
|
489
|
-
name: "bus_read",
|
|
490
|
-
description: "Read unread messages from the Agent Bus. Spanish: leer mensajes bus, recibir mensajes, verificar bus",
|
|
491
|
-
parameters: {
|
|
492
|
-
type: "object",
|
|
493
|
-
properties: {
|
|
494
|
-
worker_id: { type: "string", description: "Filter by target worker ID" },
|
|
495
|
-
limit: { type: "number", description: "Maximum messages to return (default: 10)" },
|
|
496
|
-
},
|
|
497
|
-
},
|
|
498
|
-
execute: async (params: Record<string, unknown>) => {
|
|
499
|
-
const db = getDb();
|
|
500
|
-
const workerId = params.worker_id as string | undefined;
|
|
501
|
-
const limit = (params.limit as number) ?? 10;
|
|
502
|
-
|
|
503
|
-
try {
|
|
504
|
-
let query = "SELECT * FROM agent_bus_messages WHERE read = 0";
|
|
505
|
-
const args: any[] = [];
|
|
506
|
-
|
|
507
|
-
if (workerId) {
|
|
508
|
-
query += " AND (to_worker_id = ? OR to_worker_id IS NULL)";
|
|
509
|
-
args.push(workerId);
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
query += " ORDER BY created_at ASC LIMIT ?";
|
|
513
|
-
args.push(limit);
|
|
514
|
-
|
|
515
|
-
const messages = db.query(query).all(...args) as any[];
|
|
516
|
-
|
|
517
|
-
// Mark as read
|
|
518
|
-
if (messages.length > 0) {
|
|
519
|
-
const ids = messages.map((m) => m.id).join(",");
|
|
520
|
-
db.query(`UPDATE agent_bus_messages SET read = 1 WHERE id IN (${ids})`).run();
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
return {
|
|
524
|
-
ok: true,
|
|
525
|
-
count: messages.length,
|
|
526
|
-
messages: messages.map((m) => ({
|
|
527
|
-
id: m.id,
|
|
528
|
-
event_type: m.event_type,
|
|
529
|
-
content: m.content,
|
|
530
|
-
from_worker_id: m.from_worker_id,
|
|
531
|
-
created_at: new Date(m.created_at * 1000).toISOString(),
|
|
532
|
-
})),
|
|
533
|
-
};
|
|
534
|
-
} catch (error) {
|
|
535
|
-
return { ok: false, error: `Failed to read messages: ${(error as Error).message}` };
|
|
536
|
-
}
|
|
537
|
-
},
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
// ─── project_updates ─────────────────────────────────────────────────────────
|
|
541
|
-
|
|
542
|
-
export const projectUpdatesTool: Tool = {
|
|
543
|
-
name: "project_updates",
|
|
544
|
-
description: "Get recent status updates from workers in the same project. Spanish: actualizaciones proyecto, estado workers, progreso equipo",
|
|
545
|
-
parameters: {
|
|
546
|
-
type: "object",
|
|
547
|
-
properties: {
|
|
548
|
-
project_id: { type: "string", description: "Project ID to get updates from" },
|
|
549
|
-
limit: { type: "number", description: "Maximum updates to return (default: 10)" },
|
|
550
|
-
},
|
|
551
|
-
required: ["project_id"],
|
|
552
|
-
},
|
|
553
|
-
execute: async (params: Record<string, unknown>) => {
|
|
554
|
-
const db = getDb();
|
|
555
|
-
const projectId = params.project_id as string;
|
|
556
|
-
const limit = (params.limit as number) ?? 10;
|
|
557
|
-
|
|
558
|
-
try {
|
|
559
|
-
const tasks = db.query<any, [string, number]>(
|
|
560
|
-
`SELECT t.id, t.name, t.status, t.progress, t.result, t.updated_at, a.name as agent_name
|
|
561
|
-
FROM tasks t
|
|
562
|
-
LEFT JOIN agents a ON t.agent_id = a.id
|
|
563
|
-
WHERE t.project_id = ?
|
|
564
|
-
ORDER BY t.updated_at DESC
|
|
565
|
-
LIMIT ?`
|
|
566
|
-
).all(projectId, limit) as any[];
|
|
567
|
-
|
|
568
|
-
return {
|
|
569
|
-
ok: true,
|
|
570
|
-
project_id: projectId,
|
|
571
|
-
count: tasks.length,
|
|
572
|
-
updates: tasks.map((t) => ({
|
|
573
|
-
task_id: t.id,
|
|
574
|
-
task_name: t.name,
|
|
575
|
-
agent_name: t.agent_name,
|
|
576
|
-
status: t.status,
|
|
577
|
-
progress: t.progress,
|
|
578
|
-
result: t.result,
|
|
579
|
-
updated_at: new Date(t.updated_at * 1000).toISOString(),
|
|
580
|
-
})),
|
|
581
|
-
};
|
|
582
|
-
} catch (error) {
|
|
583
|
-
return { ok: false, error: `Failed to get updates: ${(error as Error).message}` };
|
|
584
|
-
}
|
|
585
|
-
},
|
|
586
|
-
};
|
|
587
|
-
|
|
588
|
-
import crypto from "crypto";
|
|
589
|
-
|
|
590
|
-
export function createTools(): Tool[] {
|
|
591
|
-
return [
|
|
592
|
-
memoryWriteTool,
|
|
593
|
-
memoryReadTool,
|
|
594
|
-
memoryListTool,
|
|
595
|
-
memorySearchTool,
|
|
596
|
-
memoryDeleteTool,
|
|
597
|
-
agentCreateTool,
|
|
598
|
-
agentFindTool,
|
|
599
|
-
agentArchiveTool,
|
|
600
|
-
taskDelegateTool,
|
|
601
|
-
taskDelegateCodeTool,
|
|
602
|
-
taskStatusTool,
|
|
603
|
-
busPublishTool,
|
|
604
|
-
busReadTool,
|
|
605
|
-
projectUpdatesTool,
|
|
606
|
-
];
|
|
607
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bridge Events - WebSocket event subscription for CodeBridge
|
|
3
|
-
*
|
|
4
|
-
* Manages WebSocket subscriptions for real-time CodeBridge events
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const bridgeSubscribers = new Set<{ send: (data: string) => void }>()
|
|
8
|
-
|
|
9
|
-
export function subscribeBridge(ws: { send: (data: string) => void }) {
|
|
10
|
-
bridgeSubscribers.add(ws)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function unsubscribeBridge(ws: { send: (data: string) => void }) {
|
|
14
|
-
bridgeSubscribers.delete(ws)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function emitBridgeEvent(event: { type: string; data: any }) {
|
|
18
|
-
const payload = JSON.stringify(event)
|
|
19
|
-
for (const ws of bridgeSubscribers) {
|
|
20
|
-
try {
|
|
21
|
-
ws.send(payload)
|
|
22
|
-
} catch {
|
|
23
|
-
bridgeSubscribers.delete(ws)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|