@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,937 +0,0 @@
|
|
|
1
|
-
import { create } from "zustand";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import type { Provider, Model, Agent, Tool, Skill, MCPServer, ConnectedChannel } from "@/types";
|
|
4
|
-
import { apiClient } from "@/lib/api";
|
|
5
|
-
|
|
6
|
-
// ==================== PROVIDERS ====================
|
|
7
|
-
interface ProvidersState {
|
|
8
|
-
providers: Provider[];
|
|
9
|
-
activeProviders: Provider[];
|
|
10
|
-
isLoading: boolean;
|
|
11
|
-
fetchProviders: () => Promise<void>;
|
|
12
|
-
toggleProvider: (id: string, active: boolean) => Promise<void>;
|
|
13
|
-
updateProvider: (id: string, data: any) => Promise<void>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const createProvidersSlice = () => ({
|
|
17
|
-
providers: [] as Provider[],
|
|
18
|
-
activeProviders: [] as Provider[],
|
|
19
|
-
isLoading: false,
|
|
20
|
-
|
|
21
|
-
fetchProviders: async () => {
|
|
22
|
-
try {
|
|
23
|
-
const response = await apiClient<{ providers: Provider[] }>("/api/providers");
|
|
24
|
-
const providers = response.providers;
|
|
25
|
-
return {
|
|
26
|
-
providers,
|
|
27
|
-
activeProviders: providers.filter(p => p.enabled && p.active),
|
|
28
|
-
};
|
|
29
|
-
} catch (error) {
|
|
30
|
-
console.error("Failed to fetch providers:", error);
|
|
31
|
-
return { providers: [], activeProviders: [] };
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
toggleProvider: async (id: string, active: boolean) => {
|
|
36
|
-
try {
|
|
37
|
-
await apiClient(`/api/providers/${id}/toggle`, {
|
|
38
|
-
method: "POST",
|
|
39
|
-
body: { active },
|
|
40
|
-
showLoader: active ? "Activando proveedor..." : "Desactivando proveedor...",
|
|
41
|
-
showError: true
|
|
42
|
-
});
|
|
43
|
-
// Optimistic local state update - avoids a full re-fetch
|
|
44
|
-
const state = useGlobalConfigStore.getState();
|
|
45
|
-
const updatedProviders = state.providers.map(p =>
|
|
46
|
-
p.id === id ? { ...p, active, enabled: active } : p
|
|
47
|
-
);
|
|
48
|
-
useGlobalConfigStore.setState({
|
|
49
|
-
providers: updatedProviders,
|
|
50
|
-
activeProviders: updatedProviders.filter(p => p.enabled && p.active),
|
|
51
|
-
});
|
|
52
|
-
} catch (error) {
|
|
53
|
-
console.error("Failed to toggle provider:", error);
|
|
54
|
-
throw error;
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
updateProvider: async (id: string, data: any) => {
|
|
59
|
-
try {
|
|
60
|
-
const response = await apiClient<{ success: boolean; provider: Provider }>(`/api/providers/${id}`, {
|
|
61
|
-
method: "PUT",
|
|
62
|
-
body: data,
|
|
63
|
-
showLoader: "Actualizando proveedor...",
|
|
64
|
-
showError: true,
|
|
65
|
-
showSuccess: "Proveedor actualizado"
|
|
66
|
-
});
|
|
67
|
-
// Patch local state with returned provider — no full re-fetch needed
|
|
68
|
-
if (response?.provider) {
|
|
69
|
-
const state = useGlobalConfigStore.getState();
|
|
70
|
-
const updatedProviders = state.providers.map(p =>
|
|
71
|
-
p.id === id ? { ...p, ...response.provider } : p
|
|
72
|
-
);
|
|
73
|
-
useGlobalConfigStore.setState({
|
|
74
|
-
providers: updatedProviders,
|
|
75
|
-
activeProviders: updatedProviders.filter(p => p.enabled && p.active),
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
} catch (error) {
|
|
79
|
-
console.error("Failed to update provider:", error);
|
|
80
|
-
throw error;
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// ==================== MODELS ====================
|
|
86
|
-
interface ModelsState {
|
|
87
|
-
models: Model[];
|
|
88
|
-
availableModels: Model[];
|
|
89
|
-
fetchModels: () => Promise<void>;
|
|
90
|
-
toggleModel: (id: string, active: boolean) => Promise<void>;
|
|
91
|
-
createModel: (providerId: string, name: string) => Promise<void>;
|
|
92
|
-
syncModels: (providerId: string) => Promise<{ synced: number }>;
|
|
93
|
-
getModelsByProvider: (providerId: string) => Model[];
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const createModelsSlice = () => ({
|
|
97
|
-
models: [] as Model[],
|
|
98
|
-
availableModels: [] as Model[],
|
|
99
|
-
|
|
100
|
-
fetchModels: async () => {
|
|
101
|
-
try {
|
|
102
|
-
const response = await apiClient<{ models: Model[] }>("/api/models");
|
|
103
|
-
const models = response.models;
|
|
104
|
-
return {
|
|
105
|
-
models,
|
|
106
|
-
availableModels: models.filter(m => m.enabled || m.active),
|
|
107
|
-
};
|
|
108
|
-
} catch (error) {
|
|
109
|
-
console.error("Failed to fetch models:", error);
|
|
110
|
-
return { models: [], availableModels: [] };
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
toggleModel: async (id: string, active: boolean) => {
|
|
115
|
-
try {
|
|
116
|
-
await apiClient(`/api/models/${id}/toggle`, {
|
|
117
|
-
method: "POST",
|
|
118
|
-
body: { active },
|
|
119
|
-
showLoader: active ? "Activando modelo..." : "Desactivando modelo...",
|
|
120
|
-
showError: true
|
|
121
|
-
});
|
|
122
|
-
// Update local state immediately for responsive UI
|
|
123
|
-
const state = useGlobalConfigStore.getState();
|
|
124
|
-
const updatedModels = state.models.map(m =>
|
|
125
|
-
m.id === id ? { ...m, active, enabled: active } : m
|
|
126
|
-
);
|
|
127
|
-
useGlobalConfigStore.setState({
|
|
128
|
-
models: updatedModels,
|
|
129
|
-
availableModels: updatedModels.filter(m => m.enabled || m.active),
|
|
130
|
-
});
|
|
131
|
-
} catch (error) {
|
|
132
|
-
console.error("Failed to toggle model:", error);
|
|
133
|
-
throw error;
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
syncModels: async (providerId: string) => {
|
|
138
|
-
try {
|
|
139
|
-
const response = await apiClient<{ success: boolean; synced: number; models: Model[] }>(
|
|
140
|
-
`/api/providers/${providerId}/sync-models`,
|
|
141
|
-
{
|
|
142
|
-
method: "POST",
|
|
143
|
-
showLoader: "Sincronizando modelos desde Ollama...",
|
|
144
|
-
showError: true,
|
|
145
|
-
showSuccess: (r: any) => `${r.synced} modelos sincronizados`,
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
// Patch local models state with the synced list
|
|
149
|
-
const state = useGlobalConfigStore.getState();
|
|
150
|
-
const otherModels = state.models.filter(m => (m.provider_id || m.providerId) !== providerId);
|
|
151
|
-
const updatedModels = [...otherModels, ...(response.models || [])];
|
|
152
|
-
useGlobalConfigStore.setState({
|
|
153
|
-
models: updatedModels,
|
|
154
|
-
availableModels: updatedModels.filter(m => m.enabled || m.active),
|
|
155
|
-
});
|
|
156
|
-
return { synced: response.synced };
|
|
157
|
-
} catch (error) {
|
|
158
|
-
console.error("Failed to sync models:", error);
|
|
159
|
-
throw error;
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
createModel: async (providerId: string, name: string) => {
|
|
164
|
-
try {
|
|
165
|
-
const response = await apiClient<{ ok: boolean; id: string; model: any }>("/api/models", {
|
|
166
|
-
method: "POST",
|
|
167
|
-
body: { provider_id: providerId, name },
|
|
168
|
-
showLoader: "Agregando modelo...",
|
|
169
|
-
showError: true,
|
|
170
|
-
showSuccess: "Modelo agregado"
|
|
171
|
-
});
|
|
172
|
-
if (response?.model) {
|
|
173
|
-
const state = useGlobalConfigStore.getState();
|
|
174
|
-
const updatedModels = [...state.models, response.model];
|
|
175
|
-
useGlobalConfigStore.setState({
|
|
176
|
-
models: updatedModels,
|
|
177
|
-
availableModels: updatedModels.filter(m => m.enabled || m.active),
|
|
178
|
-
});
|
|
179
|
-
} else {
|
|
180
|
-
const data = await createModelsSlice().fetchModels();
|
|
181
|
-
useGlobalConfigStore.setState(data);
|
|
182
|
-
}
|
|
183
|
-
} catch (error) {
|
|
184
|
-
console.error("Failed to create model:", error);
|
|
185
|
-
throw error;
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
|
|
189
|
-
getModelsByProvider: (providerId: string) => {
|
|
190
|
-
const { models } = useGlobalConfigStore.getState();
|
|
191
|
-
return models.filter((m) => {
|
|
192
|
-
const mProviderId = m.providerId || m.provider_id;
|
|
193
|
-
return mProviderId === providerId && (m.enabled || m.active);
|
|
194
|
-
});
|
|
195
|
-
},
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
// ==================== AGENTS ====================
|
|
199
|
-
interface AgentsState {
|
|
200
|
-
agents: Agent[];
|
|
201
|
-
isLoading: boolean;
|
|
202
|
-
fetchAgents: () => Promise<void>;
|
|
203
|
-
createAgent: (data: any) => Promise<Agent>;
|
|
204
|
-
updateAgent: (id: string, data: any) => Promise<void>;
|
|
205
|
-
deleteAgent: (id: string) => Promise<void>;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const createAgentsSlice = () => ({
|
|
209
|
-
agents: [] as Agent[],
|
|
210
|
-
isLoading: false,
|
|
211
|
-
|
|
212
|
-
fetchAgents: async () => {
|
|
213
|
-
try {
|
|
214
|
-
const response = await apiClient<{ agents: Agent[] }>("/api/agents");
|
|
215
|
-
return { agents: response.agents };
|
|
216
|
-
} catch (error) {
|
|
217
|
-
console.error("Failed to fetch agents:", error);
|
|
218
|
-
return { agents: [] };
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
createAgent: async (data: any) => {
|
|
223
|
-
try {
|
|
224
|
-
const response = await apiClient<{ agent: Agent }>("/api/agents", {
|
|
225
|
-
method: "POST",
|
|
226
|
-
body: data,
|
|
227
|
-
showLoader: "Creando agente...",
|
|
228
|
-
showError: true,
|
|
229
|
-
showSuccess: "Agente creado con éxito"
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
const { fetchAgents } = useGlobalConfigStore.getState();
|
|
233
|
-
await fetchAgents();
|
|
234
|
-
|
|
235
|
-
return response.agent;
|
|
236
|
-
} catch (error) {
|
|
237
|
-
console.error("Failed to create agent:", error);
|
|
238
|
-
throw error;
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
|
|
242
|
-
updateAgent: async (id: string, data: any) => {
|
|
243
|
-
try {
|
|
244
|
-
await apiClient(`/api/agents/${id}`, {
|
|
245
|
-
method: "PUT",
|
|
246
|
-
body: data,
|
|
247
|
-
showLoader: "Guardando cambios...",
|
|
248
|
-
showError: true,
|
|
249
|
-
showSuccess: "Perfil del agente sincronizado"
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
const { fetchAgents } = useGlobalConfigStore.getState();
|
|
253
|
-
await fetchAgents();
|
|
254
|
-
} catch (error) {
|
|
255
|
-
console.error("Failed to update agent:", error);
|
|
256
|
-
throw error;
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
deleteAgent: async (id: string) => {
|
|
261
|
-
try {
|
|
262
|
-
await apiClient(`/api/agents/${id}`, {
|
|
263
|
-
method: "DELETE",
|
|
264
|
-
showLoader: "Eliminando agente...",
|
|
265
|
-
showError: true,
|
|
266
|
-
showSuccess: "Agente eliminado"
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
const { fetchAgents } = useGlobalConfigStore.getState();
|
|
270
|
-
await fetchAgents();
|
|
271
|
-
} catch (error) {
|
|
272
|
-
console.error("Failed to delete agent:", error);
|
|
273
|
-
throw error;
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
// ==================== TOOLS ====================
|
|
279
|
-
interface ToolsState {
|
|
280
|
-
tools: Array<{ id: string; name: string; description: string; category: string; enabled: boolean; active: boolean }>;
|
|
281
|
-
activeTools: Array<{ id: string; name: string; description: string; category: string }>;
|
|
282
|
-
fetchTools: () => Promise<void>;
|
|
283
|
-
toggleTool: (id: string, active: boolean) => Promise<void>;
|
|
284
|
-
updateTool: (id: string, data: Partial<Tool>) => Promise<void>;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
const createToolsSlice = () => ({
|
|
288
|
-
tools: [] as Array<{ id: string; name: string; description: string; category: string; enabled: boolean; active: boolean }>,
|
|
289
|
-
activeTools: [] as Array<{ id: string; name: string; description: string; category: string }>,
|
|
290
|
-
|
|
291
|
-
fetchTools: async () => {
|
|
292
|
-
try {
|
|
293
|
-
const response = await apiClient<{ tools: Array<{ id: string; name: string; description: string; category: string; enabled: boolean; active: boolean }> }>("/api/tools");
|
|
294
|
-
const tools = response.tools;
|
|
295
|
-
return {
|
|
296
|
-
tools,
|
|
297
|
-
activeTools: tools.filter(t => t.active).map(t => ({ id: t.id, name: t.name, description: t.description, category: t.category })),
|
|
298
|
-
};
|
|
299
|
-
} catch (error) {
|
|
300
|
-
console.error("Failed to fetch tools:", error);
|
|
301
|
-
return { tools: [], activeTools: [] };
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
|
|
305
|
-
toggleTool: async (id: string, active: boolean) => {
|
|
306
|
-
try {
|
|
307
|
-
await apiClient(`/api/tools/${id}/toggle`, {
|
|
308
|
-
method: "POST",
|
|
309
|
-
body: { active },
|
|
310
|
-
});
|
|
311
|
-
// Actualizar estado local inmediatamente
|
|
312
|
-
const state = useGlobalConfigStore.getState();
|
|
313
|
-
const currentTools = state.tools.map(t =>
|
|
314
|
-
t.id === id ? { ...t, active } : t
|
|
315
|
-
);
|
|
316
|
-
useGlobalConfigStore.setState({
|
|
317
|
-
tools: currentTools,
|
|
318
|
-
activeTools: currentTools.filter(t => t.active).map(t => ({ id: t.id, name: t.name, description: t.description, category: t.category }))
|
|
319
|
-
});
|
|
320
|
-
} catch (error) {
|
|
321
|
-
console.error("Failed to toggle tool:", error);
|
|
322
|
-
throw error;
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
|
|
326
|
-
updateTool: async (id: string, data: Partial<Tool>) => {
|
|
327
|
-
try {
|
|
328
|
-
await apiClient(`/api/tools/${id}`, {
|
|
329
|
-
method: "PUT",
|
|
330
|
-
body: data,
|
|
331
|
-
});
|
|
332
|
-
// Actualizar estado local
|
|
333
|
-
const state = useGlobalConfigStore.getState();
|
|
334
|
-
const currentTools = state.tools.map(t =>
|
|
335
|
-
t.id === id ? { ...t, ...data } : t
|
|
336
|
-
);
|
|
337
|
-
useGlobalConfigStore.setState({
|
|
338
|
-
tools: currentTools,
|
|
339
|
-
activeTools: currentTools.filter(t => t.active).map(t => ({ id: t.id, name: t.name, description: t.description, category: t.category }))
|
|
340
|
-
});
|
|
341
|
-
} catch (error) {
|
|
342
|
-
console.error("Failed to update tool:", error);
|
|
343
|
-
throw error;
|
|
344
|
-
}
|
|
345
|
-
},
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
// ==================== SKILLS ====================
|
|
349
|
-
interface SkillsState {
|
|
350
|
-
skills: Skill[];
|
|
351
|
-
activeSkills: Skill[];
|
|
352
|
-
fetchSkills: () => Promise<void>;
|
|
353
|
-
toggleSkill: (id: string, active: boolean) => Promise<void>;
|
|
354
|
-
updateSkill: (id: string, data: Partial<Skill>) => Promise<void>;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
const createSkillsSlice = () => ({
|
|
358
|
-
skills: [] as Skill[],
|
|
359
|
-
activeSkills: [] as Skill[],
|
|
360
|
-
|
|
361
|
-
fetchSkills: async () => {
|
|
362
|
-
try {
|
|
363
|
-
const response = await apiClient<{ skills: Skill[] }>("/api/skills");
|
|
364
|
-
const skills = response.skills;
|
|
365
|
-
return {
|
|
366
|
-
skills,
|
|
367
|
-
activeSkills: skills.filter(s => s.active),
|
|
368
|
-
};
|
|
369
|
-
} catch (error) {
|
|
370
|
-
console.error("Failed to fetch skills:", error);
|
|
371
|
-
return { skills: [], activeSkills: [] };
|
|
372
|
-
}
|
|
373
|
-
},
|
|
374
|
-
|
|
375
|
-
toggleSkill: async (id: string, active: boolean) => {
|
|
376
|
-
try {
|
|
377
|
-
await apiClient(`/api/skills/${id}/toggle`, {
|
|
378
|
-
method: "POST",
|
|
379
|
-
body: { active },
|
|
380
|
-
});
|
|
381
|
-
} catch (error) {
|
|
382
|
-
console.error("Failed to toggle skill:", error);
|
|
383
|
-
throw error;
|
|
384
|
-
}
|
|
385
|
-
},
|
|
386
|
-
|
|
387
|
-
updateSkill: async (id: string, data: Partial<Skill>) => {
|
|
388
|
-
try {
|
|
389
|
-
await apiClient(`/api/skills/${id}`, {
|
|
390
|
-
method: "PUT",
|
|
391
|
-
body: data,
|
|
392
|
-
});
|
|
393
|
-
} catch (error) {
|
|
394
|
-
console.error("Failed to update skill:", error);
|
|
395
|
-
throw error;
|
|
396
|
-
}
|
|
397
|
-
},
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
// ==================== MCP SERVERS ====================
|
|
401
|
-
interface MCPServerConfig {
|
|
402
|
-
transport?: string;
|
|
403
|
-
command?: string;
|
|
404
|
-
args?: string[];
|
|
405
|
-
url?: string;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
interface MCPServersState {
|
|
409
|
-
servers: Array<{ id: string; name: string; transport: string; status: string; enabled: boolean; active: boolean; builtin: boolean }>;
|
|
410
|
-
activeServers: Array<{ id: string; name: string; transport: string; status: string }>;
|
|
411
|
-
fetchMCPServers: () => Promise<void>;
|
|
412
|
-
toggleMCPServer: (id: string, active: boolean) => Promise<void>;
|
|
413
|
-
updateMCPServer: (id: string, config: MCPServerConfig) => Promise<void>;
|
|
414
|
-
deleteMCPServer: (id: string) => Promise<void>;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
const createMCPServersSlice = () => ({
|
|
418
|
-
servers: [] as Array<{ id: string; name: string; transport: string; status: string; enabled: boolean; active: boolean; builtin: boolean }>,
|
|
419
|
-
activeServers: [] as Array<{ id: string; name: string; transport: string; status: string }>,
|
|
420
|
-
|
|
421
|
-
fetchMCPServers: async () => {
|
|
422
|
-
try {
|
|
423
|
-
const response = await apiClient<any[]>("/api/mcp/servers");
|
|
424
|
-
|
|
425
|
-
// Flatten configuration from backend structure
|
|
426
|
-
const servers = response.map(s => {
|
|
427
|
-
const config = s.config || {};
|
|
428
|
-
return {
|
|
429
|
-
id: s.name, // Use name as ID if backend doesn't provide it
|
|
430
|
-
name: s.name,
|
|
431
|
-
status: s.status,
|
|
432
|
-
enabled: s.enabled,
|
|
433
|
-
active: s.enabled && s.status === "connected",
|
|
434
|
-
builtin: s.builtin || false,
|
|
435
|
-
transport: config.transport || "stdio",
|
|
436
|
-
command: config.command,
|
|
437
|
-
args: config.args,
|
|
438
|
-
url: config.url,
|
|
439
|
-
tools_count: s.tools_count || 0,
|
|
440
|
-
tools: s.tools || []
|
|
441
|
-
};
|
|
442
|
-
});
|
|
443
|
-
|
|
444
|
-
return {
|
|
445
|
-
servers,
|
|
446
|
-
activeServers: servers.filter(s => s.active).map(s => ({
|
|
447
|
-
id: s.id,
|
|
448
|
-
name: s.name,
|
|
449
|
-
transport: s.transport,
|
|
450
|
-
status: s.status
|
|
451
|
-
})),
|
|
452
|
-
};
|
|
453
|
-
} catch (error) {
|
|
454
|
-
console.error("Failed to fetch MCP servers:", error);
|
|
455
|
-
return { servers: [], activeServers: [] };
|
|
456
|
-
}
|
|
457
|
-
},
|
|
458
|
-
|
|
459
|
-
toggleMCPServer: async (id: string, active: boolean) => {
|
|
460
|
-
try {
|
|
461
|
-
await apiClient(`/api/mcp/servers/${id}`, {
|
|
462
|
-
method: "POST",
|
|
463
|
-
body: { action: active ? "connect" : "disconnect" },
|
|
464
|
-
showLoader: active ? "Conectando servidor..." : "Desconectando servidor...",
|
|
465
|
-
showError: true,
|
|
466
|
-
showSuccess: active ? "Servidor conectado" : "Servidor desconectado"
|
|
467
|
-
});
|
|
468
|
-
// Force refresh or update local state
|
|
469
|
-
const { fetchMCPServers } = useGlobalConfigStore.getState();
|
|
470
|
-
await fetchMCPServers();
|
|
471
|
-
} catch (error) {
|
|
472
|
-
console.error("Failed to toggle MCP server:", error);
|
|
473
|
-
throw error;
|
|
474
|
-
}
|
|
475
|
-
},
|
|
476
|
-
|
|
477
|
-
updateMCPServer: async (id: string, config: MCPServerConfig) => {
|
|
478
|
-
try {
|
|
479
|
-
await apiClient(`/api/mcp/servers/${id}`, {
|
|
480
|
-
method: "PUT",
|
|
481
|
-
body: { config },
|
|
482
|
-
showLoader: "Guardando configuración...",
|
|
483
|
-
showError: true,
|
|
484
|
-
showSuccess: "Configuración guardada"
|
|
485
|
-
});
|
|
486
|
-
const { fetchMCPServers } = useGlobalConfigStore.getState();
|
|
487
|
-
await fetchMCPServers();
|
|
488
|
-
} catch (error) {
|
|
489
|
-
console.error("Failed to update MCP server:", error);
|
|
490
|
-
throw error;
|
|
491
|
-
}
|
|
492
|
-
},
|
|
493
|
-
|
|
494
|
-
deleteMCPServer: async (id: string) => {
|
|
495
|
-
try {
|
|
496
|
-
await apiClient(`/api/mcp/servers/${id}`, {
|
|
497
|
-
method: "DELETE",
|
|
498
|
-
showLoader: "Eliminando servidor...",
|
|
499
|
-
showError: true,
|
|
500
|
-
showSuccess: "Servidor eliminado"
|
|
501
|
-
});
|
|
502
|
-
// Actualizar estado local
|
|
503
|
-
const state = useGlobalConfigStore.getState();
|
|
504
|
-
const currentServers = state.servers.filter(s => s.id !== id);
|
|
505
|
-
useGlobalConfigStore.setState({
|
|
506
|
-
servers: currentServers,
|
|
507
|
-
activeServers: currentServers.filter(s => s.active).map(s => ({ id: s.id, name: s.name, transport: s.transport, status: s.status }))
|
|
508
|
-
});
|
|
509
|
-
} catch (error) {
|
|
510
|
-
console.error("Failed to delete MCP server:", error);
|
|
511
|
-
throw error;
|
|
512
|
-
}
|
|
513
|
-
},
|
|
514
|
-
});
|
|
515
|
-
|
|
516
|
-
// ==================== CHANNELS ====================
|
|
517
|
-
interface ChannelsState {
|
|
518
|
-
channels: ConnectedChannel[];
|
|
519
|
-
activeChannels: ConnectedChannel[];
|
|
520
|
-
fetchChannels: () => Promise<void>;
|
|
521
|
-
toggleChannel: (id: string, active: boolean) => Promise<void>;
|
|
522
|
-
updateChannel: (id: string, data: Partial<ConnectedChannel>) => Promise<void>;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
const createChannelsSlice = () => ({
|
|
526
|
-
channels: [] as ConnectedChannel[],
|
|
527
|
-
activeChannels: [] as ConnectedChannel[],
|
|
528
|
-
|
|
529
|
-
fetchChannels: async () => {
|
|
530
|
-
try {
|
|
531
|
-
const response = await apiClient<{ channels: ConnectedChannel[] }>("/api/channels");
|
|
532
|
-
const channels = response.channels;
|
|
533
|
-
return {
|
|
534
|
-
channels,
|
|
535
|
-
activeChannels: channels.filter(c => c.active),
|
|
536
|
-
};
|
|
537
|
-
} catch (error) {
|
|
538
|
-
console.error("Failed to fetch channels:", error);
|
|
539
|
-
return { channels: [], activeChannels: [] };
|
|
540
|
-
}
|
|
541
|
-
},
|
|
542
|
-
|
|
543
|
-
toggleChannel: async (id: string, active: boolean) => {
|
|
544
|
-
try {
|
|
545
|
-
await apiClient(`/api/channels/${id}/toggle`, {
|
|
546
|
-
method: "POST",
|
|
547
|
-
body: { active },
|
|
548
|
-
});
|
|
549
|
-
} catch (error) {
|
|
550
|
-
console.error("Failed to toggle channel:", error);
|
|
551
|
-
throw error;
|
|
552
|
-
}
|
|
553
|
-
},
|
|
554
|
-
|
|
555
|
-
updateChannel: async (id: string, data: Partial<ConnectedChannel>) => {
|
|
556
|
-
try {
|
|
557
|
-
await apiClient(`/api/channels/${id}`, {
|
|
558
|
-
method: "PUT",
|
|
559
|
-
body: data,
|
|
560
|
-
});
|
|
561
|
-
// Refresh channels after update
|
|
562
|
-
const { fetchChannels } = useGlobalConfigStore.getState();
|
|
563
|
-
await fetchChannels();
|
|
564
|
-
} catch (error) {
|
|
565
|
-
console.error("Failed to update channel:", error);
|
|
566
|
-
throw error;
|
|
567
|
-
}
|
|
568
|
-
},
|
|
569
|
-
});
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
// ==================== GLOBAL STORE ====================
|
|
573
|
-
type GlobalConfigState = ProvidersState & ModelsState & AgentsState & ToolsState & SkillsState & MCPServersState & ChannelsState & {
|
|
574
|
-
isLoading: boolean;
|
|
575
|
-
isInitialized: boolean;
|
|
576
|
-
error: string | null;
|
|
577
|
-
fetchAll: () => Promise<void>;
|
|
578
|
-
refresh: (entity: string) => Promise<void>;
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
export const useGlobalConfigStore = create<GlobalConfigState>((set, get) => ({
|
|
582
|
-
// Providers
|
|
583
|
-
providers: [],
|
|
584
|
-
activeProviders: [],
|
|
585
|
-
|
|
586
|
-
// Models
|
|
587
|
-
models: [],
|
|
588
|
-
availableModels: [],
|
|
589
|
-
|
|
590
|
-
// Agents
|
|
591
|
-
agents: [],
|
|
592
|
-
|
|
593
|
-
// Tools
|
|
594
|
-
tools: [],
|
|
595
|
-
activeTools: [],
|
|
596
|
-
|
|
597
|
-
// Skills
|
|
598
|
-
skills: [],
|
|
599
|
-
activeSkills: [],
|
|
600
|
-
|
|
601
|
-
// MCP Servers
|
|
602
|
-
servers: [],
|
|
603
|
-
activeServers: [],
|
|
604
|
-
|
|
605
|
-
// Channels
|
|
606
|
-
channels: [],
|
|
607
|
-
activeChannels: [],
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
// State
|
|
611
|
-
isLoading: false,
|
|
612
|
-
isInitialized: false,
|
|
613
|
-
error: null,
|
|
614
|
-
|
|
615
|
-
fetchAll: async () => {
|
|
616
|
-
if (get().isInitialized) return;
|
|
617
|
-
|
|
618
|
-
const { showLoader, hideLoader } = (await import("@/stores/useLoaderStore")).useLoaderStore.getState();
|
|
619
|
-
showLoader("Sincronizando la Colmena...");
|
|
620
|
-
|
|
621
|
-
set({ isLoading: true, error: null });
|
|
622
|
-
|
|
623
|
-
try {
|
|
624
|
-
// Fetch all in parallel
|
|
625
|
-
const [
|
|
626
|
-
providersData,
|
|
627
|
-
modelsData,
|
|
628
|
-
agentsData,
|
|
629
|
-
toolsData,
|
|
630
|
-
skillsData,
|
|
631
|
-
mcpData,
|
|
632
|
-
channelsData,
|
|
633
|
-
] = await Promise.all([
|
|
634
|
-
createProvidersSlice().fetchProviders(),
|
|
635
|
-
createModelsSlice().fetchModels(),
|
|
636
|
-
createAgentsSlice().fetchAgents(),
|
|
637
|
-
createToolsSlice().fetchTools(),
|
|
638
|
-
createSkillsSlice().fetchSkills(),
|
|
639
|
-
createMCPServersSlice().fetchMCPServers(),
|
|
640
|
-
createChannelsSlice().fetchChannels(),
|
|
641
|
-
]);
|
|
642
|
-
|
|
643
|
-
set({
|
|
644
|
-
...providersData,
|
|
645
|
-
...modelsData,
|
|
646
|
-
...agentsData,
|
|
647
|
-
...toolsData,
|
|
648
|
-
...skillsData,
|
|
649
|
-
...mcpData,
|
|
650
|
-
...channelsData,
|
|
651
|
-
isLoading: false,
|
|
652
|
-
isInitialized: true,
|
|
653
|
-
});
|
|
654
|
-
hideLoader();
|
|
655
|
-
} catch (error) {
|
|
656
|
-
hideLoader();
|
|
657
|
-
set({
|
|
658
|
-
isLoading: false,
|
|
659
|
-
error: error instanceof Error ? error.message : "Failed to fetch config",
|
|
660
|
-
});
|
|
661
|
-
}
|
|
662
|
-
},
|
|
663
|
-
|
|
664
|
-
refresh: async (entity: string) => {
|
|
665
|
-
try {
|
|
666
|
-
let data: any;
|
|
667
|
-
switch (entity) {
|
|
668
|
-
case "providers":
|
|
669
|
-
data = await createProvidersSlice().fetchProviders();
|
|
670
|
-
set(data);
|
|
671
|
-
break;
|
|
672
|
-
case "models":
|
|
673
|
-
data = await createModelsSlice().fetchModels();
|
|
674
|
-
set(data);
|
|
675
|
-
break;
|
|
676
|
-
case "agents":
|
|
677
|
-
data = await createAgentsSlice().fetchAgents();
|
|
678
|
-
set(data);
|
|
679
|
-
break;
|
|
680
|
-
case "tools": {
|
|
681
|
-
const toolsData = await createToolsSlice().fetchTools();
|
|
682
|
-
if (toolsData) set(toolsData);
|
|
683
|
-
break;
|
|
684
|
-
}
|
|
685
|
-
case "skills":
|
|
686
|
-
data = await createSkillsSlice().fetchSkills();
|
|
687
|
-
set(data);
|
|
688
|
-
break;
|
|
689
|
-
case "mcp":
|
|
690
|
-
data = await createMCPServersSlice().fetchMCPServers();
|
|
691
|
-
set(data);
|
|
692
|
-
break;
|
|
693
|
-
case "channels":
|
|
694
|
-
data = await createChannelsSlice().fetchChannels();
|
|
695
|
-
set(data);
|
|
696
|
-
break;
|
|
697
|
-
}
|
|
698
|
-
} catch (error) {
|
|
699
|
-
console.error(`Failed to refresh ${entity}:`, error);
|
|
700
|
-
}
|
|
701
|
-
},
|
|
702
|
-
|
|
703
|
-
// Providers methods
|
|
704
|
-
fetchProviders: async () => {
|
|
705
|
-
const data = await createProvidersSlice().fetchProviders();
|
|
706
|
-
set(data);
|
|
707
|
-
},
|
|
708
|
-
toggleProvider: createProvidersSlice().toggleProvider,
|
|
709
|
-
updateProvider: createProvidersSlice().updateProvider,
|
|
710
|
-
|
|
711
|
-
// Models methods
|
|
712
|
-
fetchModels: async () => {
|
|
713
|
-
const data = await createModelsSlice().fetchModels();
|
|
714
|
-
set(data);
|
|
715
|
-
},
|
|
716
|
-
toggleModel: createModelsSlice().toggleModel,
|
|
717
|
-
createModel: createModelsSlice().createModel,
|
|
718
|
-
syncModels: createModelsSlice().syncModels,
|
|
719
|
-
getModelsByProvider: createModelsSlice().getModelsByProvider,
|
|
720
|
-
|
|
721
|
-
// Agents methods
|
|
722
|
-
fetchAgents: async () => {
|
|
723
|
-
const data = await createAgentsSlice().fetchAgents();
|
|
724
|
-
set(data);
|
|
725
|
-
},
|
|
726
|
-
createAgent: createAgentsSlice().createAgent,
|
|
727
|
-
updateAgent: createAgentsSlice().updateAgent,
|
|
728
|
-
deleteAgent: createAgentsSlice().deleteAgent,
|
|
729
|
-
|
|
730
|
-
// Tools methods
|
|
731
|
-
fetchTools: async () => {
|
|
732
|
-
const data = await createToolsSlice().fetchTools();
|
|
733
|
-
if (data) set(data);
|
|
734
|
-
},
|
|
735
|
-
toggleTool: createToolsSlice().toggleTool,
|
|
736
|
-
updateTool: createToolsSlice().updateTool,
|
|
737
|
-
|
|
738
|
-
// Skills methods
|
|
739
|
-
fetchSkills: async () => {
|
|
740
|
-
const data = await createSkillsSlice().fetchSkills();
|
|
741
|
-
set(data);
|
|
742
|
-
},
|
|
743
|
-
toggleSkill: createSkillsSlice().toggleSkill,
|
|
744
|
-
updateSkill: createSkillsSlice().updateSkill,
|
|
745
|
-
|
|
746
|
-
// MCP methods
|
|
747
|
-
fetchMCPServers: async () => {
|
|
748
|
-
const data = await createMCPServersSlice().fetchMCPServers();
|
|
749
|
-
set(data);
|
|
750
|
-
},
|
|
751
|
-
toggleMCPServer: createMCPServersSlice().toggleMCPServer,
|
|
752
|
-
updateMCPServer: createMCPServersSlice().updateMCPServer,
|
|
753
|
-
deleteMCPServer: createMCPServersSlice().deleteMCPServer,
|
|
754
|
-
|
|
755
|
-
// Channels methods
|
|
756
|
-
fetchChannels: async () => {
|
|
757
|
-
const data = await createChannelsSlice().fetchChannels();
|
|
758
|
-
set(data);
|
|
759
|
-
},
|
|
760
|
-
toggleChannel: createChannelsSlice().toggleChannel,
|
|
761
|
-
updateChannel: createChannelsSlice().updateChannel,
|
|
762
|
-
|
|
763
|
-
}));
|
|
764
|
-
|
|
765
|
-
/**
|
|
766
|
-
* Hook para inicializar toda la configuración global al montar la app
|
|
767
|
-
*/
|
|
768
|
-
export function useInitializeGlobalConfig() {
|
|
769
|
-
const fetchAll = useGlobalConfigStore((state) => state.fetchAll);
|
|
770
|
-
const isInitialized = useGlobalConfigStore((state) => state.isInitialized);
|
|
771
|
-
|
|
772
|
-
const hasRun = React.useRef(false);
|
|
773
|
-
|
|
774
|
-
React.useEffect(() => {
|
|
775
|
-
if (!isInitialized && !hasRun.current) {
|
|
776
|
-
hasRun.current = true;
|
|
777
|
-
fetchAll();
|
|
778
|
-
}
|
|
779
|
-
}, [isInitialized, fetchAll]);
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
/**
|
|
783
|
-
* Hooks específicos por entidad para usar en componentes
|
|
784
|
-
*/
|
|
785
|
-
export function useProviders() {
|
|
786
|
-
const providers = useGlobalConfigStore((state) => state.providers);
|
|
787
|
-
const activeProviders = useGlobalConfigStore((state) => state.activeProviders);
|
|
788
|
-
const models = useGlobalConfigStore((state) => state.models);
|
|
789
|
-
const availableModels = useGlobalConfigStore((state) => state.availableModels);
|
|
790
|
-
const isLoading = useGlobalConfigStore((state) => state.isLoading);
|
|
791
|
-
const fetchProviders = useGlobalConfigStore((state) => state.fetchProviders);
|
|
792
|
-
const fetchModels = useGlobalConfigStore((state) => state.fetchModels);
|
|
793
|
-
const toggleProvider = useGlobalConfigStore((state) => state.toggleProvider);
|
|
794
|
-
const updateProvider = useGlobalConfigStore((state) => state.updateProvider);
|
|
795
|
-
const getModelsByProvider = useGlobalConfigStore((state) => state.getModelsByProvider);
|
|
796
|
-
const error = useGlobalConfigStore((state) => state.error);
|
|
797
|
-
|
|
798
|
-
return {
|
|
799
|
-
providers,
|
|
800
|
-
activeProviders,
|
|
801
|
-
models,
|
|
802
|
-
availableModels,
|
|
803
|
-
isLoading,
|
|
804
|
-
error,
|
|
805
|
-
fetchProviders,
|
|
806
|
-
fetchModels,
|
|
807
|
-
toggleProvider,
|
|
808
|
-
updateProvider,
|
|
809
|
-
getModelsByProvider,
|
|
810
|
-
};
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
export function useModels() {
|
|
814
|
-
const models = useGlobalConfigStore((state) => state.models);
|
|
815
|
-
const availableModels = useGlobalConfigStore((state) => state.availableModels);
|
|
816
|
-
const isLoading = useGlobalConfigStore((state) => state.isLoading);
|
|
817
|
-
const fetchModels = useGlobalConfigStore((state) => state.fetchModels);
|
|
818
|
-
const toggleModel = useGlobalConfigStore((state) => state.toggleModel);
|
|
819
|
-
const createModel = useGlobalConfigStore((state) => state.createModel);
|
|
820
|
-
const syncModels = useGlobalConfigStore((state) => state.syncModels);
|
|
821
|
-
const getModelsByProvider = useGlobalConfigStore((state) => state.getModelsByProvider);
|
|
822
|
-
const error = useGlobalConfigStore((state) => state.error);
|
|
823
|
-
|
|
824
|
-
return {
|
|
825
|
-
models,
|
|
826
|
-
availableModels,
|
|
827
|
-
isLoading,
|
|
828
|
-
error,
|
|
829
|
-
fetchModels,
|
|
830
|
-
toggleModel,
|
|
831
|
-
createModel,
|
|
832
|
-
syncModels,
|
|
833
|
-
getModelsByProvider,
|
|
834
|
-
};
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
export function useAgents() {
|
|
838
|
-
const agents = useGlobalConfigStore((state) => state.agents);
|
|
839
|
-
const isLoading = useGlobalConfigStore((state) => state.isLoading);
|
|
840
|
-
const fetchAgents = useGlobalConfigStore((state) => state.fetchAgents);
|
|
841
|
-
const createAgent = useGlobalConfigStore((state) => state.createAgent);
|
|
842
|
-
const updateAgent = useGlobalConfigStore((state) => state.updateAgent);
|
|
843
|
-
const deleteAgent = useGlobalConfigStore((state) => state.deleteAgent);
|
|
844
|
-
const error = useGlobalConfigStore((state) => state.error);
|
|
845
|
-
|
|
846
|
-
return {
|
|
847
|
-
agents,
|
|
848
|
-
isLoading,
|
|
849
|
-
error,
|
|
850
|
-
fetchAgents,
|
|
851
|
-
createAgent,
|
|
852
|
-
updateAgent,
|
|
853
|
-
deleteAgent,
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
export function useTools() {
|
|
858
|
-
const tools = useGlobalConfigStore((state) => state.tools);
|
|
859
|
-
const activeTools = useGlobalConfigStore((state) => state.activeTools);
|
|
860
|
-
const isLoading = useGlobalConfigStore((state) => state.isLoading);
|
|
861
|
-
const fetchTools = useGlobalConfigStore((state) => state.fetchTools);
|
|
862
|
-
const toggleTool = useGlobalConfigStore((state) => state.toggleTool);
|
|
863
|
-
const updateTool = useGlobalConfigStore((state) => state.updateTool);
|
|
864
|
-
const error = useGlobalConfigStore((state) => state.error);
|
|
865
|
-
|
|
866
|
-
return {
|
|
867
|
-
tools,
|
|
868
|
-
activeTools,
|
|
869
|
-
isLoading,
|
|
870
|
-
error,
|
|
871
|
-
fetchTools,
|
|
872
|
-
toggleTool,
|
|
873
|
-
updateTool,
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
export function useSkills() {
|
|
878
|
-
const skills = useGlobalConfigStore((state) => state.skills);
|
|
879
|
-
const activeSkills = useGlobalConfigStore((state) => state.activeSkills);
|
|
880
|
-
const isLoading = useGlobalConfigStore((state) => state.isLoading);
|
|
881
|
-
const fetchSkills = useGlobalConfigStore((state) => state.fetchSkills);
|
|
882
|
-
const toggleSkill = useGlobalConfigStore((state) => state.toggleSkill);
|
|
883
|
-
const updateSkill = useGlobalConfigStore((state) => state.updateSkill);
|
|
884
|
-
const error = useGlobalConfigStore((state) => state.error);
|
|
885
|
-
|
|
886
|
-
return {
|
|
887
|
-
skills,
|
|
888
|
-
activeSkills,
|
|
889
|
-
isLoading,
|
|
890
|
-
error,
|
|
891
|
-
fetchSkills,
|
|
892
|
-
toggleSkill,
|
|
893
|
-
updateSkill,
|
|
894
|
-
};
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
export function useMCPServers() {
|
|
898
|
-
const servers = useGlobalConfigStore((state) => state.servers);
|
|
899
|
-
const activeServers = useGlobalConfigStore((state) => state.activeServers);
|
|
900
|
-
const isLoading = useGlobalConfigStore((state) => state.isLoading);
|
|
901
|
-
const fetchMCPServers = useGlobalConfigStore((state) => state.fetchMCPServers);
|
|
902
|
-
const toggleMCPServer = useGlobalConfigStore((state) => state.toggleMCPServer);
|
|
903
|
-
const updateMCPServer = useGlobalConfigStore((state) => state.updateMCPServer);
|
|
904
|
-
const deleteMCPServer = useGlobalConfigStore((state) => state.deleteMCPServer);
|
|
905
|
-
const error = useGlobalConfigStore((state) => state.error);
|
|
906
|
-
|
|
907
|
-
return {
|
|
908
|
-
servers,
|
|
909
|
-
activeServers,
|
|
910
|
-
isLoading,
|
|
911
|
-
error,
|
|
912
|
-
fetchMCPServers,
|
|
913
|
-
toggleMCPServer,
|
|
914
|
-
updateMCPServer,
|
|
915
|
-
deleteMCPServer,
|
|
916
|
-
};
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
export function useChannels() {
|
|
920
|
-
const channels = useGlobalConfigStore((state) => state.channels);
|
|
921
|
-
const activeChannels = useGlobalConfigStore((state) => state.activeChannels);
|
|
922
|
-
const isLoading = useGlobalConfigStore((state) => state.isLoading);
|
|
923
|
-
const fetchChannels = useGlobalConfigStore((state) => state.fetchChannels);
|
|
924
|
-
const toggleChannel = useGlobalConfigStore((state) => state.toggleChannel);
|
|
925
|
-
const error = useGlobalConfigStore((state) => state.error);
|
|
926
|
-
|
|
927
|
-
return {
|
|
928
|
-
channels,
|
|
929
|
-
activeChannels,
|
|
930
|
-
isLoading,
|
|
931
|
-
error,
|
|
932
|
-
fetchChannels,
|
|
933
|
-
toggleChannel,
|
|
934
|
-
updateChannel: useGlobalConfigStore((state) => state.updateChannel),
|
|
935
|
-
};
|
|
936
|
-
}
|
|
937
|
-
|