@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,52 +0,0 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
3
|
-
import { BarChart3, Loader2 } from "lucide-react";
|
|
4
|
-
import { apiClient } from "@/lib/api";
|
|
5
|
-
|
|
6
|
-
export function ToolUsageStats() {
|
|
7
|
-
const { data: stats, isLoading } = useQuery({
|
|
8
|
-
queryKey: ["tool-usage-stats"],
|
|
9
|
-
queryFn: async () => {
|
|
10
|
-
const data = await apiClient<{ skills: any[] }>("/api/skills");
|
|
11
|
-
const skills = data.skills || [];
|
|
12
|
-
const bySource: Record<string, number> = {};
|
|
13
|
-
skills.forEach((s) => {
|
|
14
|
-
bySource[s.source] = (bySource[s.source] || 0) + 1;
|
|
15
|
-
});
|
|
16
|
-
return { totalSkills: skills.length, bySource };
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<Card>
|
|
22
|
-
<CardHeader className="pb-2">
|
|
23
|
-
<CardTitle className="flex items-center gap-2 text-sm">
|
|
24
|
-
<BarChart3 className="h-4 w-4" />
|
|
25
|
-
Estadísticas de skills
|
|
26
|
-
</CardTitle>
|
|
27
|
-
</CardHeader>
|
|
28
|
-
<CardContent>
|
|
29
|
-
{isLoading ? (
|
|
30
|
-
<div className="flex items-center gap-2 py-2">
|
|
31
|
-
<Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />
|
|
32
|
-
<span className="text-xs text-muted-foreground">Cargando...</span>
|
|
33
|
-
</div>
|
|
34
|
-
) : stats ? (
|
|
35
|
-
<div className="space-y-2">
|
|
36
|
-
<p className="text-sm font-medium">{stats.totalSkills} skills totales</p>
|
|
37
|
-
<div className="flex gap-3">
|
|
38
|
-
{Object.entries(stats.bySource).map(([source, count]) => (
|
|
39
|
-
<div key={source} className="rounded-md border px-3 py-1.5 text-center">
|
|
40
|
-
<p className="text-lg font-bold">{count}</p>
|
|
41
|
-
<p className="text-xs text-muted-foreground">{source}</p>
|
|
42
|
-
</div>
|
|
43
|
-
))}
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
) : (
|
|
47
|
-
<p className="text-xs text-muted-foreground">Sin datos de uso disponibles</p>
|
|
48
|
-
)}
|
|
49
|
-
</CardContent>
|
|
50
|
-
</Card>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
3
|
-
import { Badge } from "@/components/ui/badge";
|
|
4
|
-
import { useAgentStore } from "@/stores/agentStore";
|
|
5
|
-
import { Bot, Activity, type LucideProps } from "lucide-react";
|
|
6
|
-
|
|
7
|
-
// Wrapper to fix React 19 + Lucide type compatibility
|
|
8
|
-
function Icon({ icon: IconComponent, ...props }: { icon: React.ComponentType<LucideProps> } & LucideProps) {
|
|
9
|
-
return <IconComponent {...props} />;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const statusColors: Record<string, string> = {
|
|
13
|
-
active: "bg-green-500",
|
|
14
|
-
idle: "bg-yellow-500",
|
|
15
|
-
hibernated: "bg-gray-400",
|
|
16
|
-
error: "bg-red-500",
|
|
17
|
-
thinking: "bg-blue-500 animate-pulse",
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const statusLabels: Record<string, string> = {
|
|
21
|
-
active: "Activo",
|
|
22
|
-
idle: "Inactivo",
|
|
23
|
-
hibernated: "Hibernado",
|
|
24
|
-
error: "Error",
|
|
25
|
-
thinking: "Pensando",
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export function ActiveAgentsList() {
|
|
29
|
-
const { agents, isLoading, error, fetchAgents } = useAgentStore();
|
|
30
|
-
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
fetchAgents();
|
|
33
|
-
}, [fetchAgents]);
|
|
34
|
-
|
|
35
|
-
if (isLoading) {
|
|
36
|
-
return (
|
|
37
|
-
<Card>
|
|
38
|
-
<CardHeader className="pb-2">
|
|
39
|
-
<CardTitle className="flex items-center gap-2 text-sm">
|
|
40
|
-
<Icon icon={Bot as any} className="h-4 w-4 text-purple-400" />
|
|
41
|
-
Agentes activos
|
|
42
|
-
</CardTitle>
|
|
43
|
-
</CardHeader>
|
|
44
|
-
<CardContent>
|
|
45
|
-
<p className="text-xs text-muted-foreground animate-pulse">Cargando agentes...</p>
|
|
46
|
-
</CardContent>
|
|
47
|
-
</Card>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (error) {
|
|
52
|
-
return (
|
|
53
|
-
<Card>
|
|
54
|
-
<CardHeader className="pb-2">
|
|
55
|
-
<CardTitle className="flex items-center gap-2 text-sm">
|
|
56
|
-
<Icon icon={Bot as any} className="h-4 w-4 text-purple-400" />
|
|
57
|
-
Agentes activos
|
|
58
|
-
</CardTitle>
|
|
59
|
-
</CardHeader>
|
|
60
|
-
<CardContent>
|
|
61
|
-
<p className="text-xs text-destructive">Error: {error}</p>
|
|
62
|
-
</CardContent>
|
|
63
|
-
</Card>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<Card>
|
|
69
|
-
<CardHeader className="pb-2">
|
|
70
|
-
<CardTitle className="flex items-center gap-2 text-sm">
|
|
71
|
-
<Icon icon={Bot as any} className="h-4 w-4 text-purple-400" />
|
|
72
|
-
Agentes activos
|
|
73
|
-
<Badge variant="secondary" className="ml-auto text-xs">{agents.length}</Badge>
|
|
74
|
-
</CardTitle>
|
|
75
|
-
</CardHeader>
|
|
76
|
-
<CardContent>
|
|
77
|
-
{agents.length === 0 ? (
|
|
78
|
-
<p className="text-xs text-muted-foreground">No hay agentes configurados</p>
|
|
79
|
-
) : (
|
|
80
|
-
<div className="space-y-2">
|
|
81
|
-
{agents.map((agent) => (
|
|
82
|
-
<div key={agent.id} className="flex items-center justify-between rounded-md border p-2">
|
|
83
|
-
<div className="flex items-center gap-2">
|
|
84
|
-
<span className={`h-2 w-2 rounded-full ${statusColors[agent.status] || "bg-gray-400"}`} />
|
|
85
|
-
<div>
|
|
86
|
-
<p className="text-xs font-medium">{agent.name || agent.id}</p>
|
|
87
|
-
{agent.description && (
|
|
88
|
-
<p className="text-xs text-muted-foreground truncate max-w-[200px]">{agent.description}</p>
|
|
89
|
-
)}
|
|
90
|
-
</div>
|
|
91
|
-
</div>
|
|
92
|
-
<div className="flex items-center gap-2">
|
|
93
|
-
<Badge variant="outline" className="text-xs">
|
|
94
|
-
{statusLabels[agent.status] || agent.status}
|
|
95
|
-
</Badge>
|
|
96
|
-
{(agent as any).provider && (
|
|
97
|
-
<Badge variant="secondary" className="text-xs">
|
|
98
|
-
{(agent as any).provider}/{(agent as any).model}
|
|
99
|
-
</Badge>
|
|
100
|
-
)}
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
))}
|
|
104
|
-
</div>
|
|
105
|
-
)}
|
|
106
|
-
</CardContent>
|
|
107
|
-
</Card>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
3
|
-
import { Badge } from "@/components/ui/badge";
|
|
4
|
-
import { apiClient } from "@/lib/api";
|
|
5
|
-
import { Settings, type LucideProps } from "lucide-react";
|
|
6
|
-
|
|
7
|
-
// Wrapper to fix React 19 + Lucide type compatibility
|
|
8
|
-
function Icon({ icon: IconComponent, ...props }: { icon: React.ComponentType<LucideProps> } & LucideProps) {
|
|
9
|
-
return <IconComponent {...props} />;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface GlobalConfig {
|
|
13
|
-
gateway?: { host?: string; port?: number };
|
|
14
|
-
models?: {
|
|
15
|
-
defaultProvider?: string;
|
|
16
|
-
defaults?: Record<string, string>;
|
|
17
|
-
providers?: Record<string, { apiKey?: string; baseURL?: string }>;
|
|
18
|
-
};
|
|
19
|
-
agents?: { list?: Array<{ id: string; name?: string; default?: boolean; workspace?: string }> };
|
|
20
|
-
mcp?: { servers?: Record<string, unknown> };
|
|
21
|
-
skills?: { allowBundled?: string[]; managedDir?: string };
|
|
22
|
-
channels?: Record<string, unknown>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function GlobalConfigOverview() {
|
|
26
|
-
const [config, setConfig] = useState<GlobalConfig | null>(null);
|
|
27
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
28
|
-
const [error, setError] = useState<string | null>(null);
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
apiClient<GlobalConfig>("/api/config")
|
|
32
|
-
.then(setConfig)
|
|
33
|
-
.catch((e) => setError(e.message))
|
|
34
|
-
.finally(() => setIsLoading(false));
|
|
35
|
-
}, []);
|
|
36
|
-
|
|
37
|
-
if (isLoading) {
|
|
38
|
-
return (
|
|
39
|
-
<Card>
|
|
40
|
-
<CardHeader className="pb-2">
|
|
41
|
-
<CardTitle className="flex items-center gap-2 text-sm">
|
|
42
|
-
<Icon icon={Settings as any} className="h-4 w-4 text-amber-400" />
|
|
43
|
-
Configuración global
|
|
44
|
-
</CardTitle>
|
|
45
|
-
</CardHeader>
|
|
46
|
-
<CardContent>
|
|
47
|
-
<p className="text-xs text-muted-foreground animate-pulse">Cargando configuración...</p>
|
|
48
|
-
</CardContent>
|
|
49
|
-
</Card>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (error || !config) {
|
|
54
|
-
return (
|
|
55
|
-
<Card>
|
|
56
|
-
<CardHeader className="pb-2">
|
|
57
|
-
<CardTitle className="flex items-center gap-2 text-sm">
|
|
58
|
-
<Icon icon={Settings as any} className="h-4 w-4 text-amber-400" />
|
|
59
|
-
Configuración global
|
|
60
|
-
</CardTitle>
|
|
61
|
-
</CardHeader>
|
|
62
|
-
<CardContent>
|
|
63
|
-
<p className="text-xs text-destructive">Error: {error || "No se pudo cargar"}</p>
|
|
64
|
-
</CardContent>
|
|
65
|
-
</Card>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const provider = config.models?.defaultProvider ?? "—";
|
|
70
|
-
const model = config.models?.defaults?.[provider] ?? "—";
|
|
71
|
-
const agentCount = config.agents?.list?.length ?? 0;
|
|
72
|
-
const mcpCount = config.mcp?.servers ? Object.keys(config.mcp.servers).length : 0;
|
|
73
|
-
const channelCount = config.channels ? Object.keys(config.channels).length : 0;
|
|
74
|
-
const skillCount = config.skills?.allowBundled?.length ?? 0;
|
|
75
|
-
const gateway = config.gateway;
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<Card>
|
|
79
|
-
<CardHeader className="pb-2">
|
|
80
|
-
<CardTitle className="flex items-center gap-2 text-sm">
|
|
81
|
-
<Icon icon={Settings as any} className="h-4 w-4 text-amber-400" />
|
|
82
|
-
Configuración global
|
|
83
|
-
</CardTitle>
|
|
84
|
-
</CardHeader>
|
|
85
|
-
<CardContent>
|
|
86
|
-
<div className="grid grid-cols-2 gap-3">
|
|
87
|
-
<ConfigItem label="LLM Provider" value={provider} />
|
|
88
|
-
<ConfigItem label="Modelo" value={model} />
|
|
89
|
-
<ConfigItem label="Gateway" value={gateway ? `${gateway.host}:${gateway.port}` : "—"} />
|
|
90
|
-
<ConfigItem label="Agentes" value={String(agentCount)} />
|
|
91
|
-
<ConfigItem label="Canales" value={String(channelCount)} />
|
|
92
|
-
<ConfigItem label="MCP Servers" value={String(mcpCount)} />
|
|
93
|
-
<ConfigItem label="Skills activos" value={String(skillCount)} />
|
|
94
|
-
</div>
|
|
95
|
-
|
|
96
|
-
{/* Workspace files */}
|
|
97
|
-
<div className="mt-3 border-t pt-3">
|
|
98
|
-
<p className="mb-2 text-xs font-medium text-muted-foreground">Archivos del workspace</p>
|
|
99
|
-
<div className="flex flex-wrap gap-1.5">
|
|
100
|
-
{["SOUL.md", "ETHICS.md", "USER.md", "TOOLS.md", "MCP.md", "SKILLS.md"].map((file) => (
|
|
101
|
-
<Badge key={file} variant="outline" className="text-xs">
|
|
102
|
-
{file}
|
|
103
|
-
</Badge>
|
|
104
|
-
))}
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
</CardContent>
|
|
108
|
-
</Card>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function ConfigItem({ label, value }: { label: string; value: string }) {
|
|
113
|
-
return (
|
|
114
|
-
<div className="space-y-0.5">
|
|
115
|
-
<p className="text-xs text-muted-foreground">{label}</p>
|
|
116
|
-
<p className="text-xs font-medium truncate">{value}</p>
|
|
117
|
-
</div>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
3
|
-
import { Brain, Loader2 } from "lucide-react";
|
|
4
|
-
import { apiClient } from "@/lib/api";
|
|
5
|
-
|
|
6
|
-
interface MemoryEntry {
|
|
7
|
-
key: string;
|
|
8
|
-
value: string;
|
|
9
|
-
createdAt?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function UserMemoryManager() {
|
|
13
|
-
const { data: memories, isLoading, isError } = useQuery<MemoryEntry[]>({
|
|
14
|
-
queryKey: ["user-memories"],
|
|
15
|
-
queryFn: async () => {
|
|
16
|
-
const config = await apiClient<any>("/api/config");
|
|
17
|
-
const workspace = config.agents?.list?.[0]?.workspace || "~/.hive/workspace";
|
|
18
|
-
return [{ key: "workspace", value: workspace }];
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<Card>
|
|
24
|
-
<CardHeader className="pb-2">
|
|
25
|
-
<CardTitle className="flex items-center gap-2 text-sm">
|
|
26
|
-
<Brain className="h-4 w-4 text-blue-400" />
|
|
27
|
-
Memorias del usuario
|
|
28
|
-
</CardTitle>
|
|
29
|
-
</CardHeader>
|
|
30
|
-
<CardContent>
|
|
31
|
-
{isLoading ? (
|
|
32
|
-
<div className="flex items-center gap-2 py-2">
|
|
33
|
-
<Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />
|
|
34
|
-
<span className="text-xs text-muted-foreground">Cargando...</span>
|
|
35
|
-
</div>
|
|
36
|
-
) : isError ? (
|
|
37
|
-
<p className="text-xs text-muted-foreground">No se pudieron cargar las memorias</p>
|
|
38
|
-
) : !memories || memories.length === 0 ? (
|
|
39
|
-
<p className="text-xs text-muted-foreground">Sin memorias guardadas</p>
|
|
40
|
-
) : (
|
|
41
|
-
<div className="space-y-1">
|
|
42
|
-
{memories.map((m) => (
|
|
43
|
-
<div key={m.key} className="flex items-center justify-between rounded border px-2 py-1.5 text-xs">
|
|
44
|
-
<span className="font-medium">{m.key}</span>
|
|
45
|
-
<span className="text-muted-foreground">{m.value}</span>
|
|
46
|
-
</div>
|
|
47
|
-
))}
|
|
48
|
-
<p className="text-xs text-muted-foreground mt-2">Las memorias se almacenan en el directorio workspace/memory/</p>
|
|
49
|
-
</div>
|
|
50
|
-
)}
|
|
51
|
-
</CardContent>
|
|
52
|
-
</Card>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
3
|
-
import { Input } from "@/components/ui/input";
|
|
4
|
-
import { Label } from "@/components/ui/label";
|
|
5
|
-
import { Button } from "@/components/ui/button";
|
|
6
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
|
7
|
-
import { Loader2, Save } from "lucide-react";
|
|
8
|
-
import { useUserStore } from "@/stores/userStore";
|
|
9
|
-
import { useNotesAndCronsStore } from "@/stores/useNotesAndCronsStore";
|
|
10
|
-
import { Toast } from "@/lib/swal";
|
|
11
|
-
import { loader } from "@/stores/useLoaderStore";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Parses simple key: value pairs from a markdown string.
|
|
15
|
-
* Looks for patterns like "Verbosity: normal" or "Primary: English"
|
|
16
|
-
*/
|
|
17
|
-
function parseMarkdownFields(md: string): Record<string, string> {
|
|
18
|
-
const fields: Record<string, string> = {};
|
|
19
|
-
const lines = md.split("\n");
|
|
20
|
-
for (const line of lines) {
|
|
21
|
-
const match = line.match(/^(?:#{1,4}\s+)?(.+?):\s*(.+)$/);
|
|
22
|
-
if (match && !match[1].startsWith("<!--") && !match[1].startsWith("*")) {
|
|
23
|
-
const key = match[1].trim().toLowerCase().replace(/\s+/g, "_");
|
|
24
|
-
fields[key] = match[2].trim();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return fields;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function UserPreferencesForm() {
|
|
31
|
-
const { fetchUser, saveUser, isLoading } = useUserStore();
|
|
32
|
-
const { cronChannels, cronUserPreference, fetchCronChannels, saveCronChannelPreference } =
|
|
33
|
-
useNotesAndCronsStore();
|
|
34
|
-
const [state, setState] = useState({ rawContent: "", language: "", verbosity: "", codeStyle: "", loaded: false });
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
fetchUser()
|
|
38
|
-
.then((content) => {
|
|
39
|
-
const fields = parseMarkdownFields(content as any);
|
|
40
|
-
setState({
|
|
41
|
-
rawContent: content as any,
|
|
42
|
-
language: fields["primary"] || fields["language"] || "",
|
|
43
|
-
verbosity: fields["verbosity"] || "",
|
|
44
|
-
codeStyle: fields["language"] || "",
|
|
45
|
-
loaded: true,
|
|
46
|
-
});
|
|
47
|
-
})
|
|
48
|
-
.catch(console.error);
|
|
49
|
-
fetchCronChannels();
|
|
50
|
-
}, [fetchUser, fetchCronChannels]);
|
|
51
|
-
|
|
52
|
-
const handleSave = async () => {
|
|
53
|
-
let updatedContent = state.rawContent;
|
|
54
|
-
|
|
55
|
-
if (state.language) {
|
|
56
|
-
updatedContent = updatedContent.replace(
|
|
57
|
-
/^(Primary:\s*).+$/m,
|
|
58
|
-
`$1${state.language}`
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
if (state.verbosity) {
|
|
62
|
-
updatedContent = updatedContent.replace(
|
|
63
|
-
/^(Verbosity:\s*).+$/m,
|
|
64
|
-
`$1${state.verbosity}`
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
loader.show("Guardando preferencias...");
|
|
69
|
-
try {
|
|
70
|
-
await saveUser(updatedContent as any);
|
|
71
|
-
setState(prev => ({ ...prev, rawContent: updatedContent }));
|
|
72
|
-
Toast.fire({ icon: "success", title: "Preferencias guardadas" });
|
|
73
|
-
} catch {
|
|
74
|
-
Toast.fire({ icon: "error", title: "Error al guardar preferencias" });
|
|
75
|
-
} finally {
|
|
76
|
-
loader.hide();
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const handleCronChannelChange = async (value: string) => {
|
|
81
|
-
loader.show("Guardando canal...");
|
|
82
|
-
try {
|
|
83
|
-
await saveCronChannelPreference(value);
|
|
84
|
-
Toast.fire({ icon: "success", title: "Canal de notificaciones guardado" });
|
|
85
|
-
} catch {
|
|
86
|
-
Toast.fire({ icon: "error", title: "Error al guardar el canal" });
|
|
87
|
-
} finally {
|
|
88
|
-
loader.hide();
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const activeChannels = cronChannels.filter(c => c.active);
|
|
93
|
-
|
|
94
|
-
if (!state.loaded) {
|
|
95
|
-
return (
|
|
96
|
-
<Card>
|
|
97
|
-
<CardContent className="flex items-center justify-center py-6">
|
|
98
|
-
<Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />
|
|
99
|
-
<span className="ml-2 text-xs text-muted-foreground">Cargando preferencias...</span>
|
|
100
|
-
</CardContent>
|
|
101
|
-
</Card>
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<Card>
|
|
107
|
-
<CardHeader className="pb-2">
|
|
108
|
-
<CardTitle className="flex items-center justify-between text-sm">
|
|
109
|
-
Preferencias del usuario
|
|
110
|
-
<Button size="sm" variant="outline" onClick={handleSave} disabled={isLoading} className="gap-2 h-7">
|
|
111
|
-
{isLoading ? <Loader2 className="h-3 w-3 animate-spin" /> : <Save className="h-3 w-3" />}
|
|
112
|
-
Guardar
|
|
113
|
-
</Button>
|
|
114
|
-
</CardTitle>
|
|
115
|
-
</CardHeader>
|
|
116
|
-
<CardContent className="space-y-3">
|
|
117
|
-
<div className="space-y-1.5">
|
|
118
|
-
<Label className="text-xs">Idioma preferido</Label>
|
|
119
|
-
<Input value={state.language} onChange={(e) => setState(prev => ({ ...prev, language: e.target.value }))} placeholder="es" className="h-8 text-sm" />
|
|
120
|
-
</div>
|
|
121
|
-
<div className="space-y-1.5">
|
|
122
|
-
<Label className="text-xs">Verbosidad</Label>
|
|
123
|
-
<Input value={state.verbosity} onChange={(e) => setState(prev => ({ ...prev, verbosity: e.target.value }))} placeholder="normal" className="h-8 text-sm" />
|
|
124
|
-
</div>
|
|
125
|
-
<div className="space-y-1.5">
|
|
126
|
-
<Label className="text-xs">Lenguaje principal</Label>
|
|
127
|
-
<Input value={state.codeStyle} onChange={(e) => setState(prev => ({ ...prev, codeStyle: e.target.value }))} placeholder="TypeScript" className="h-8 text-sm" />
|
|
128
|
-
</div>
|
|
129
|
-
{/* Cron channel preference — only shown when multiple channels exist */}
|
|
130
|
-
{activeChannels.length > 0 && (
|
|
131
|
-
<div className="space-y-1.5 pt-1 border-t border-white/5">
|
|
132
|
-
<Label className="text-xs">Canal de notificaciones (Cron Jobs)</Label>
|
|
133
|
-
<Select value={cronUserPreference} onValueChange={handleCronChannelChange}>
|
|
134
|
-
<SelectTrigger className="h-8 text-sm">
|
|
135
|
-
<SelectValue placeholder="Seleccionar canal" />
|
|
136
|
-
</SelectTrigger>
|
|
137
|
-
<SelectContent>
|
|
138
|
-
<SelectItem value="auto" className="text-sm">
|
|
139
|
-
Auto — detectar mejor canal
|
|
140
|
-
</SelectItem>
|
|
141
|
-
{activeChannels.map(ch => (
|
|
142
|
-
<SelectItem key={ch.id} value={ch.id} className="text-sm">
|
|
143
|
-
{ch.id === 'telegram'
|
|
144
|
-
? 'Telegram'
|
|
145
|
-
: ch.id === 'webchat'
|
|
146
|
-
? 'Web Chat'
|
|
147
|
-
: ch.id}
|
|
148
|
-
{ch.recommended ? ' (recomendado)' : ''}
|
|
149
|
-
</SelectItem>
|
|
150
|
-
))}
|
|
151
|
-
</SelectContent>
|
|
152
|
-
</Select>
|
|
153
|
-
<p className="text-[10px] text-muted-foreground">
|
|
154
|
-
Canal donde el agente envía las notificaciones de tareas programadas.
|
|
155
|
-
En modo Auto se prefiere Telegram si está activo.
|
|
156
|
-
</p>
|
|
157
|
-
</div>
|
|
158
|
-
)}
|
|
159
|
-
<p className="text-xs text-muted-foreground">Estos valores se leen de USER.md del workspace.</p>
|
|
160
|
-
</CardContent>
|
|
161
|
-
</Card>
|
|
162
|
-
);
|
|
163
|
-
}
|