@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,420 +0,0 @@
|
|
|
1
|
-
import type { Tool } from "../agent/native-tools.ts";
|
|
2
|
-
import type { Config } from "../config/loader.ts";
|
|
3
|
-
import { canvasManager } from "./canvas-manager.ts";
|
|
4
|
-
import { logger } from "../utils/logger.ts";
|
|
5
|
-
|
|
6
|
-
export function createCanvasRenderTool(_config: Config): Tool {
|
|
7
|
-
const log = logger.child("canvas-render");
|
|
8
|
-
|
|
9
|
-
return {
|
|
10
|
-
name: "canvas_render",
|
|
11
|
-
description: "Render a component on the user's canvas",
|
|
12
|
-
parameters: {
|
|
13
|
-
type: "object",
|
|
14
|
-
properties: {
|
|
15
|
-
sessionId: {
|
|
16
|
-
type: "string",
|
|
17
|
-
description: "Session ID to render to (auto-resolved from user context if omitted)",
|
|
18
|
-
},
|
|
19
|
-
component: {
|
|
20
|
-
type: "object",
|
|
21
|
-
properties: {
|
|
22
|
-
id: {
|
|
23
|
-
type: "string",
|
|
24
|
-
description: "Unique component ID",
|
|
25
|
-
},
|
|
26
|
-
type: {
|
|
27
|
-
type: "string",
|
|
28
|
-
enum: ["button", "form", "chart", "table", "markdown", "text", "image"],
|
|
29
|
-
description: "Component type",
|
|
30
|
-
},
|
|
31
|
-
props: {
|
|
32
|
-
type: "object",
|
|
33
|
-
description: "Component properties",
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
required: ["id", "type", "props"],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
required: ["component"],
|
|
40
|
-
},
|
|
41
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
42
|
-
const userId = config?.configurable?.user_id;
|
|
43
|
-
const rawSessionId = params.sessionId as string;
|
|
44
|
-
const sessionId = rawSessionId
|
|
45
|
-
? (rawSessionId.startsWith("canvas:") ? rawSessionId : `canvas:${rawSessionId}`)
|
|
46
|
-
: (userId ? `canvas:${userId}` : (() => { throw new Error("No session or user ID provided"); })());
|
|
47
|
-
const component = params.component as {
|
|
48
|
-
id: string;
|
|
49
|
-
type: "button" | "form" | "chart" | "table" | "markdown" | "text" | "image" | "card" | "progress" | "list" | "confirm";
|
|
50
|
-
props: Record<string, unknown>;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
log.debug(`Rendering component ${component.id} to session ${sessionId}`);
|
|
54
|
-
|
|
55
|
-
// Check if session is connected, if not try to render to any available session
|
|
56
|
-
if (!canvasManager.isSessionConnected(sessionId)) {
|
|
57
|
-
const connectedSessions = canvasManager.getConnectedSessions();
|
|
58
|
-
if (connectedSessions.length > 0) {
|
|
59
|
-
log.warn(`Session ${sessionId} not connected, using first available: ${connectedSessions[0]}`);
|
|
60
|
-
} else {
|
|
61
|
-
log.warn(`No canvas sessions connected. Rendering to ${sessionId} anyway.`);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
await canvasManager.render(sessionId, {
|
|
66
|
-
id: component.id,
|
|
67
|
-
type: component.type as any,
|
|
68
|
-
props: component.props,
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
return {
|
|
72
|
-
success: true,
|
|
73
|
-
componentId: component.id,
|
|
74
|
-
sessionId,
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export function createCanvasAskTool(_config: Config): Tool {
|
|
81
|
-
const log = logger.child("canvas-ask");
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
name: "canvas_ask",
|
|
85
|
-
description: "Display a form and wait for user response",
|
|
86
|
-
parameters: {
|
|
87
|
-
type: "object",
|
|
88
|
-
properties: {
|
|
89
|
-
sessionId: {
|
|
90
|
-
type: "string",
|
|
91
|
-
description: "Session ID",
|
|
92
|
-
},
|
|
93
|
-
title: {
|
|
94
|
-
type: "string",
|
|
95
|
-
description: "Form title",
|
|
96
|
-
},
|
|
97
|
-
fields: {
|
|
98
|
-
type: "array",
|
|
99
|
-
items: {
|
|
100
|
-
type: "object",
|
|
101
|
-
properties: {
|
|
102
|
-
name: { type: "string" },
|
|
103
|
-
label: { type: "string" },
|
|
104
|
-
type: { type: "string", enum: ["text", "email", "textarea", "select"] },
|
|
105
|
-
required: { type: "boolean" },
|
|
106
|
-
options: {
|
|
107
|
-
type: "array",
|
|
108
|
-
items: {
|
|
109
|
-
type: "object",
|
|
110
|
-
properties: {
|
|
111
|
-
label: { type: "string" },
|
|
112
|
-
value: { type: "string" },
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
required: ["name", "label", "type"],
|
|
118
|
-
},
|
|
119
|
-
description: "Form fields",
|
|
120
|
-
},
|
|
121
|
-
timeout: {
|
|
122
|
-
type: "number",
|
|
123
|
-
description: "Timeout in milliseconds (default: 300000)",
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
required: ["fields"],
|
|
127
|
-
},
|
|
128
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
129
|
-
const userId = config?.configurable?.user_id;
|
|
130
|
-
const rawSessionId = params.sessionId as string;
|
|
131
|
-
const sessionId = rawSessionId
|
|
132
|
-
? (rawSessionId.startsWith("canvas:") ? rawSessionId : `canvas:${rawSessionId}`)
|
|
133
|
-
: (userId ? `canvas:${userId}` : (() => { throw new Error("No session or user ID provided"); })());
|
|
134
|
-
const title = (params.title as string) ?? "Form";
|
|
135
|
-
const fields = params.fields as Array<{
|
|
136
|
-
name: string;
|
|
137
|
-
label: string;
|
|
138
|
-
type: string;
|
|
139
|
-
required?: boolean;
|
|
140
|
-
options?: Array<{ label: string; value: string }>;
|
|
141
|
-
}>;
|
|
142
|
-
const timeout = (params.timeout as number) ?? 300000;
|
|
143
|
-
|
|
144
|
-
const formId = `form-${Date.now()}`;
|
|
145
|
-
|
|
146
|
-
log.debug(`Asking user via form ${formId}`);
|
|
147
|
-
|
|
148
|
-
await canvasManager.render(sessionId, {
|
|
149
|
-
id: formId,
|
|
150
|
-
type: "form",
|
|
151
|
-
props: { title, fields },
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
try {
|
|
155
|
-
const response = await canvasManager.waitForInteraction(sessionId, formId, timeout);
|
|
156
|
-
|
|
157
|
-
return {
|
|
158
|
-
success: true,
|
|
159
|
-
formId,
|
|
160
|
-
data: response,
|
|
161
|
-
};
|
|
162
|
-
} catch (error) {
|
|
163
|
-
return {
|
|
164
|
-
success: false,
|
|
165
|
-
formId,
|
|
166
|
-
error: (error as Error).message,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export function createCanvasClearTool(_config: Config): Tool {
|
|
174
|
-
const log = logger.child("canvas-clear");
|
|
175
|
-
|
|
176
|
-
return {
|
|
177
|
-
name: "canvas_clear",
|
|
178
|
-
description: "Clear the canvas for a session",
|
|
179
|
-
parameters: {
|
|
180
|
-
type: "object",
|
|
181
|
-
properties: {
|
|
182
|
-
sessionId: {
|
|
183
|
-
type: "string",
|
|
184
|
-
description: "Session ID to clear",
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
required: [],
|
|
188
|
-
},
|
|
189
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
190
|
-
const userId = config?.configurable?.user_id;
|
|
191
|
-
const rawSessionId = params.sessionId as string;
|
|
192
|
-
const sessionId = rawSessionId
|
|
193
|
-
? (rawSessionId.startsWith("canvas:") ? rawSessionId : `canvas:${rawSessionId}`)
|
|
194
|
-
: (userId ? `canvas:${userId}` : (() => { throw new Error("No session or user ID provided"); })());
|
|
195
|
-
|
|
196
|
-
log.debug(`Clearing canvas for session ${sessionId}`);
|
|
197
|
-
|
|
198
|
-
await canvasManager.clear(sessionId);
|
|
199
|
-
|
|
200
|
-
return { success: true, sessionId };
|
|
201
|
-
},
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
export function createCanvasTools(config: Config): Tool[] {
|
|
206
|
-
return [
|
|
207
|
-
createCanvasRenderTool(config),
|
|
208
|
-
createCanvasAskTool(config),
|
|
209
|
-
createCanvasClearTool(config),
|
|
210
|
-
createCanvasCardTool(config),
|
|
211
|
-
createCanvasProgressTool(config),
|
|
212
|
-
createCanvasListTool(config),
|
|
213
|
-
createCanvasConfirmTool(config),
|
|
214
|
-
];
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
218
|
-
// Extended Canvas Tools for A2UI
|
|
219
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
220
|
-
|
|
221
|
-
export function createCanvasCardTool(_config: Config): Tool {
|
|
222
|
-
const log = logger.child("canvas-card");
|
|
223
|
-
|
|
224
|
-
return {
|
|
225
|
-
name: "canvas_show_card",
|
|
226
|
-
description: "Display a card with labeled items (useful for showing status, summaries)",
|
|
227
|
-
parameters: {
|
|
228
|
-
type: "object",
|
|
229
|
-
properties: {
|
|
230
|
-
sessionId: { type: "string", description: "Session ID" },
|
|
231
|
-
title: { type: "string", description: "Card title" },
|
|
232
|
-
items: {
|
|
233
|
-
type: "array",
|
|
234
|
-
items: {
|
|
235
|
-
type: "object",
|
|
236
|
-
properties: {
|
|
237
|
-
label: { type: "string" },
|
|
238
|
-
value: { type: "string" },
|
|
239
|
-
variant: { type: "string", enum: ["default", "success", "warning", "danger"] },
|
|
240
|
-
},
|
|
241
|
-
},
|
|
242
|
-
},
|
|
243
|
-
actions: {
|
|
244
|
-
type: "array",
|
|
245
|
-
items: {
|
|
246
|
-
type: "object",
|
|
247
|
-
properties: {
|
|
248
|
-
id: { type: "string" },
|
|
249
|
-
label: { type: "string" },
|
|
250
|
-
variant: { type: "string", enum: ["primary", "secondary", "danger", "success"] },
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
},
|
|
254
|
-
},
|
|
255
|
-
required: ["items"],
|
|
256
|
-
},
|
|
257
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
258
|
-
const userId = config?.configurable?.user_id;
|
|
259
|
-
const rawSessionId = params.sessionId as string;
|
|
260
|
-
const sessionId = rawSessionId
|
|
261
|
-
? (rawSessionId.startsWith("canvas:") ? rawSessionId : `canvas:${rawSessionId}`)
|
|
262
|
-
: (userId ? `canvas:${userId}` : (() => { throw new Error("No session or user ID provided"); })());
|
|
263
|
-
const title = (params.title as string) ?? "Information";
|
|
264
|
-
const items = (params.items as Array<{ label: string; value: string; variant?: string }>) ?? [];
|
|
265
|
-
const actions = (params.actions as Array<{ id: string; label: string; variant?: string }>) ?? [];
|
|
266
|
-
|
|
267
|
-
const cardId = `card-${Date.now()}`;
|
|
268
|
-
|
|
269
|
-
await canvasManager.render(sessionId, {
|
|
270
|
-
id: cardId,
|
|
271
|
-
type: "card",
|
|
272
|
-
props: { title, items, actions },
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
return { success: true, cardId, sessionId };
|
|
276
|
-
},
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
export function createCanvasProgressTool(_config: Config): Tool {
|
|
281
|
-
const log = logger.child("canvas-progress");
|
|
282
|
-
|
|
283
|
-
return {
|
|
284
|
-
name: "canvas_show_progress",
|
|
285
|
-
description: "Display progress bars for tasks (useful for multi-step operations)",
|
|
286
|
-
parameters: {
|
|
287
|
-
type: "object",
|
|
288
|
-
properties: {
|
|
289
|
-
sessionId: { type: "string", description: "Session ID" },
|
|
290
|
-
tasks: {
|
|
291
|
-
type: "array",
|
|
292
|
-
items: {
|
|
293
|
-
type: "object",
|
|
294
|
-
properties: {
|
|
295
|
-
id: { type: "string" },
|
|
296
|
-
name: { type: "string" },
|
|
297
|
-
progress: { type: "number" },
|
|
298
|
-
status: { type: "string", enum: ["pending", "running", "completed", "error"] },
|
|
299
|
-
},
|
|
300
|
-
},
|
|
301
|
-
},
|
|
302
|
-
},
|
|
303
|
-
required: ["tasks"],
|
|
304
|
-
},
|
|
305
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
306
|
-
const userId = config?.configurable?.user_id;
|
|
307
|
-
const rawSessionId = params.sessionId as string;
|
|
308
|
-
const sessionId = rawSessionId
|
|
309
|
-
? (rawSessionId.startsWith("canvas:") ? rawSessionId : `canvas:${rawSessionId}`)
|
|
310
|
-
: (userId ? `canvas:${userId}` : (() => { throw new Error("No session or user ID provided"); })());
|
|
311
|
-
const tasks = (params.tasks as Array<{ id: string; name: string; progress: number; status?: string }>) ?? [];
|
|
312
|
-
|
|
313
|
-
const progressId = `progress-${Date.now()}`;
|
|
314
|
-
|
|
315
|
-
await canvasManager.render(sessionId, {
|
|
316
|
-
id: progressId,
|
|
317
|
-
type: "progress",
|
|
318
|
-
props: { tasks },
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
return { success: true, progressId, sessionId };
|
|
322
|
-
},
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
export function createCanvasListTool(_config: Config): Tool {
|
|
327
|
-
const log = logger.child("canvas-list");
|
|
328
|
-
|
|
329
|
-
return {
|
|
330
|
-
name: "canvas_show_list",
|
|
331
|
-
description: "Display a list of key-value pairs (useful for configuration display)",
|
|
332
|
-
parameters: {
|
|
333
|
-
type: "object",
|
|
334
|
-
properties: {
|
|
335
|
-
sessionId: { type: "string", description: "Session ID" },
|
|
336
|
-
title: { type: "string", description: "List title" },
|
|
337
|
-
items: {
|
|
338
|
-
type: "array",
|
|
339
|
-
items: {
|
|
340
|
-
type: "object",
|
|
341
|
-
properties: {
|
|
342
|
-
key: { type: "string" },
|
|
343
|
-
value: { type: "string" },
|
|
344
|
-
},
|
|
345
|
-
},
|
|
346
|
-
},
|
|
347
|
-
},
|
|
348
|
-
required: ["items"],
|
|
349
|
-
},
|
|
350
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
351
|
-
const userId = config?.configurable?.user_id;
|
|
352
|
-
const rawSessionId = params.sessionId as string;
|
|
353
|
-
const sessionId = rawSessionId
|
|
354
|
-
? (rawSessionId.startsWith("canvas:") ? rawSessionId : `canvas:${rawSessionId}`)
|
|
355
|
-
: (userId ? `canvas:${userId}` : (() => { throw new Error("No session or user ID provided"); })());
|
|
356
|
-
const title = (params.title as string) ?? "Details";
|
|
357
|
-
const items = (params.items as Array<{ key: string; value: string }>) ?? [];
|
|
358
|
-
|
|
359
|
-
const listId = `list-${Date.now()}`;
|
|
360
|
-
|
|
361
|
-
await canvasManager.render(sessionId, {
|
|
362
|
-
id: listId,
|
|
363
|
-
type: "list",
|
|
364
|
-
props: { title, items },
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
return { success: true, listId, sessionId };
|
|
368
|
-
},
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
export function createCanvasConfirmTool(_config: Config): Tool {
|
|
373
|
-
const log = logger.child("canvas-confirm");
|
|
374
|
-
|
|
375
|
-
return {
|
|
376
|
-
name: "canvas_confirm",
|
|
377
|
-
description: "Show a confirmation dialog and wait for user response",
|
|
378
|
-
parameters: {
|
|
379
|
-
type: "object",
|
|
380
|
-
properties: {
|
|
381
|
-
sessionId: { type: "string", description: "Session ID" },
|
|
382
|
-
title: { type: "string", description: "Dialog title" },
|
|
383
|
-
message: { type: "string", description: "Confirmation message" },
|
|
384
|
-
confirmLabel: { type: "string", description: "Confirm button label" },
|
|
385
|
-
cancelLabel: { type: "string", description: "Cancel button label" },
|
|
386
|
-
danger: { type: "boolean", description: "Show as dangerous action" },
|
|
387
|
-
timeout: { type: "number", description: "Timeout in ms (default: 60000)" },
|
|
388
|
-
},
|
|
389
|
-
required: ["message"],
|
|
390
|
-
},
|
|
391
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
392
|
-
const userId = config?.configurable?.user_id;
|
|
393
|
-
const rawSessionId = params.sessionId as string;
|
|
394
|
-
const sessionId = rawSessionId
|
|
395
|
-
? (rawSessionId.startsWith("canvas:") ? rawSessionId : `canvas:${rawSessionId}`)
|
|
396
|
-
: (userId ? `canvas:${userId}` : (() => { throw new Error("No session or user ID provided"); })());
|
|
397
|
-
const title = (params.title as string) ?? "Confirm";
|
|
398
|
-
const message = params.message as string;
|
|
399
|
-
const confirmLabel = (params.confirmLabel as string) ?? "Confirm";
|
|
400
|
-
const cancelLabel = (params.cancelLabel as string) ?? "Cancel";
|
|
401
|
-
const danger = (params.danger as boolean) ?? false;
|
|
402
|
-
const timeout = (params.timeout as number) ?? 60000;
|
|
403
|
-
|
|
404
|
-
const confirmId = `confirm-${Date.now()}`;
|
|
405
|
-
|
|
406
|
-
await canvasManager.render(sessionId, {
|
|
407
|
-
id: confirmId,
|
|
408
|
-
type: "confirm",
|
|
409
|
-
props: { title, message, confirmLabel, cancelLabel, danger },
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
try {
|
|
413
|
-
const response = await canvasManager.waitForInteraction(sessionId, confirmId, timeout);
|
|
414
|
-
return { success: true, confirmed: response === true, confirmId, sessionId };
|
|
415
|
-
} catch (error) {
|
|
416
|
-
return { success: false, confirmed: false, confirmId, error: (error as Error).message, sessionId };
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
};
|
|
420
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { getDb } from "../storage/sqlite"
|
|
2
|
-
|
|
3
|
-
export interface CanvasEvent {
|
|
4
|
-
type: CanvasEventType
|
|
5
|
-
data: any
|
|
6
|
-
timestamp: number
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type CanvasEventType =
|
|
10
|
-
| "canvas:snapshot"
|
|
11
|
-
| "canvas:node_add"
|
|
12
|
-
| "canvas:node_update"
|
|
13
|
-
| "canvas:node_remove"
|
|
14
|
-
| "canvas:edge_add"
|
|
15
|
-
| "canvas:edge_remove"
|
|
16
|
-
| "canvas:render"
|
|
17
|
-
| "canvas:ask"
|
|
18
|
-
| "canvas:confirm"
|
|
19
|
-
| "canvas:clear"
|
|
20
|
-
| "ag-ui:event"
|
|
21
|
-
|
|
22
|
-
const subscribers = new Set<{ send: (data: string) => void }>()
|
|
23
|
-
|
|
24
|
-
export function subscribeCanvas(ws: { send: (data: string) => void }) {
|
|
25
|
-
subscribers.add(ws)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function unsubscribeCanvas(ws: { send: (data: string) => void }) {
|
|
29
|
-
subscribers.delete(ws)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function emitCanvas(type: CanvasEventType, data: any) {
|
|
33
|
-
const event: CanvasEvent = { type, data, timestamp: Date.now() }
|
|
34
|
-
const payload = JSON.stringify(event)
|
|
35
|
-
for (const ws of subscribers) {
|
|
36
|
-
try {
|
|
37
|
-
ws.send(payload)
|
|
38
|
-
} catch {
|
|
39
|
-
subscribers.delete(ws)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function getCanvasSnapshot() {
|
|
45
|
-
const db = getDb()
|
|
46
|
-
|
|
47
|
-
const agentNodes = db
|
|
48
|
-
.query<any, []>("SELECT id, name, description, status FROM agents")
|
|
49
|
-
.all()
|
|
50
|
-
.map((a: any) => ({
|
|
51
|
-
id: a.id,
|
|
52
|
-
name: a.name,
|
|
53
|
-
description: a.description,
|
|
54
|
-
status: a.status,
|
|
55
|
-
type: "agent",
|
|
56
|
-
}))
|
|
57
|
-
|
|
58
|
-
const mcpNodes = db
|
|
59
|
-
.query<any, []>("SELECT id, name, status FROM mcp_servers WHERE enabled = 1")
|
|
60
|
-
.all()
|
|
61
|
-
.map((m: any) => ({
|
|
62
|
-
id: `mcp:${m.id}`,
|
|
63
|
-
name: m.name,
|
|
64
|
-
status: m.status,
|
|
65
|
-
type: "mcp",
|
|
66
|
-
}))
|
|
67
|
-
|
|
68
|
-
// Proyectos activos
|
|
69
|
-
const projectNodes = db
|
|
70
|
-
.query<any, []>("SELECT id, name, type, status, progress, agent_id FROM projects WHERE status IN ('active','pending','paused')")
|
|
71
|
-
.all()
|
|
72
|
-
.map((p: any) => ({
|
|
73
|
-
id: `project_${p.id}`,
|
|
74
|
-
name: p.name,
|
|
75
|
-
status: p.status,
|
|
76
|
-
type: "project",
|
|
77
|
-
data: { progress: p.progress, projectType: p.type, agentId: p.agent_id },
|
|
78
|
-
}))
|
|
79
|
-
|
|
80
|
-
// Tareas de proyectos activos
|
|
81
|
-
const taskNodes = db
|
|
82
|
-
.query<any, []>(`
|
|
83
|
-
SELECT t.id, t.name, t.status, t.progress, t.agent_id, t.project_id
|
|
84
|
-
FROM tasks t
|
|
85
|
-
INNER JOIN projects p ON t.project_id = p.id
|
|
86
|
-
WHERE p.status IN ('active','pending','paused')
|
|
87
|
-
`)
|
|
88
|
-
.all()
|
|
89
|
-
.map((t: any) => ({
|
|
90
|
-
id: `task_${t.id}`,
|
|
91
|
-
name: t.name,
|
|
92
|
-
status: t.status,
|
|
93
|
-
type: "task",
|
|
94
|
-
data: { progress: t.progress, agentId: t.agent_id, projectId: t.project_id },
|
|
95
|
-
}))
|
|
96
|
-
|
|
97
|
-
// Edges: proyecto → tarea
|
|
98
|
-
const projectTaskEdges = taskNodes.map((t: any) => ({
|
|
99
|
-
id: `edge_proj_task_${t.id.replace("task_", "")}`,
|
|
100
|
-
source: `project_${t.data.projectId}`,
|
|
101
|
-
target: t.id,
|
|
102
|
-
edgeType: "contains",
|
|
103
|
-
}))
|
|
104
|
-
|
|
105
|
-
// Edges: tarea → agente asignado
|
|
106
|
-
const taskAgentEdges = taskNodes
|
|
107
|
-
.filter((t: any) => t.data.agentId)
|
|
108
|
-
.map((t: any) => ({
|
|
109
|
-
id: `edge_task_agent_${t.id.replace("task_", "")}`,
|
|
110
|
-
source: t.id,
|
|
111
|
-
target: t.data.agentId,
|
|
112
|
-
edgeType: "assigned_to",
|
|
113
|
-
}))
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
nodes: [...agentNodes, ...mcpNodes, ...projectNodes, ...taskNodes],
|
|
117
|
-
edges: [...projectTaskEdges, ...taskAgentEdges],
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
export interface OutboundMessage {
|
|
2
|
-
type: "message" | "stream" | "status" | "error" | "pong" | "command_result" | "log" | "typing" | "audio";
|
|
3
|
-
sessionId: string;
|
|
4
|
-
id?: string; // Message ID for streaming
|
|
5
|
-
content?: string;
|
|
6
|
-
chunk?: string;
|
|
7
|
-
isChunk?: boolean; // True if this is a streaming chunk
|
|
8
|
-
isLast?: boolean;
|
|
9
|
-
isStep?: boolean;
|
|
10
|
-
stepType?: "plan" | "tool_call" | "tool_result" | "text";
|
|
11
|
-
audio?: {
|
|
12
|
-
buffer?: Buffer;
|
|
13
|
-
base64?: string;
|
|
14
|
-
mimeType?: string;
|
|
15
|
-
};
|
|
16
|
-
status?: {
|
|
17
|
-
state: string;
|
|
18
|
-
model?: string;
|
|
19
|
-
tokens?: number;
|
|
20
|
-
};
|
|
21
|
-
error?: string;
|
|
22
|
-
result?: unknown;
|
|
23
|
-
logEntry?: {
|
|
24
|
-
timestamp: string;
|
|
25
|
-
level: string;
|
|
26
|
-
source: string;
|
|
27
|
-
message: string;
|
|
28
|
-
meta?: Record<string, unknown>;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface IncomingMessage {
|
|
33
|
-
sessionId: string;
|
|
34
|
-
channel: string;
|
|
35
|
-
accountId: string;
|
|
36
|
-
peerId: string;
|
|
37
|
-
peerKind: "direct" | "group";
|
|
38
|
-
content: string;
|
|
39
|
-
audio?: {
|
|
40
|
-
buffer?: Buffer;
|
|
41
|
-
url?: string;
|
|
42
|
-
base64?: string;
|
|
43
|
-
mimeType?: string;
|
|
44
|
-
};
|
|
45
|
-
metadata?: Record<string, unknown>;
|
|
46
|
-
replyToId?: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface ChannelConfig {
|
|
50
|
-
enabled: boolean;
|
|
51
|
-
dmPolicy: "open" | "pairing" | "allowlist";
|
|
52
|
-
allowFrom: string[];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface IChannel {
|
|
56
|
-
name: string;
|
|
57
|
-
accountId: string;
|
|
58
|
-
config: ChannelConfig;
|
|
59
|
-
start(): Promise<void>;
|
|
60
|
-
stop(): Promise<void>;
|
|
61
|
-
send(sessionId: string, message: OutboundMessage): Promise<void>;
|
|
62
|
-
sendAudio?(sessionId: string, audio: Buffer, mimeType: string): Promise<void>;
|
|
63
|
-
onMessage(handler: MessageHandler): void;
|
|
64
|
-
isRunning(): boolean;
|
|
65
|
-
startTyping?(sessionId: string): Promise<void>;
|
|
66
|
-
stopTyping?(sessionId: string): Promise<void>;
|
|
67
|
-
markAsRead?(sessionId: string, messageId?: string): Promise<void>;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export type MessageHandler = (message: IncomingMessage) => Promise<void>;
|
|
71
|
-
|
|
72
|
-
export abstract class BaseChannel implements IChannel {
|
|
73
|
-
abstract name: string;
|
|
74
|
-
abstract accountId: string;
|
|
75
|
-
abstract config: ChannelConfig;
|
|
76
|
-
|
|
77
|
-
protected messageHandler?: MessageHandler;
|
|
78
|
-
protected running = false;
|
|
79
|
-
protected typingIntervals: Map<string, Timer> = new Map();
|
|
80
|
-
|
|
81
|
-
abstract start(): Promise<void>;
|
|
82
|
-
abstract stop(): Promise<void>;
|
|
83
|
-
abstract send(sessionId: string, message: OutboundMessage): Promise<void>;
|
|
84
|
-
|
|
85
|
-
onMessage(handler: MessageHandler): void {
|
|
86
|
-
this.messageHandler = handler;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
isRunning(): boolean {
|
|
90
|
-
return this.running;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
async startTyping(_sessionId: string): Promise<void> {
|
|
94
|
-
// Default: no-op, override in subclasses
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
async stopTyping(sessionId: string): Promise<void> {
|
|
98
|
-
const interval = this.typingIntervals.get(sessionId);
|
|
99
|
-
if (interval) {
|
|
100
|
-
clearInterval(interval);
|
|
101
|
-
this.typingIntervals.delete(sessionId);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
async markAsRead(_sessionId: string, _messageId?: string): Promise<void> {
|
|
106
|
-
// Default: no-op, override in subclasses
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
protected async handleMessage(message: IncomingMessage): Promise<void> {
|
|
110
|
-
if (this.messageHandler) {
|
|
111
|
-
await this.messageHandler(message);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
protected isUserAllowed(peerId: string): boolean {
|
|
116
|
-
if (this.config.dmPolicy === "open") {
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const normalizedPeerId = `tg:${peerId}`;
|
|
121
|
-
|
|
122
|
-
if (this.config.dmPolicy === "allowlist") {
|
|
123
|
-
return this.config.allowFrom.some(
|
|
124
|
-
(allowed) => allowed === peerId || allowed === normalizedPeerId
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (this.config.dmPolicy === "pairing") {
|
|
129
|
-
return this.config.allowFrom.some(
|
|
130
|
-
(allowed) => allowed === peerId || allowed === normalizedPeerId
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
protected formatSessionId(peerId: string, _kind: "direct" | "group"): string {
|
|
138
|
-
return peerId;
|
|
139
|
-
}
|
|
140
|
-
}
|