@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,268 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { useChatStore } from "@/stores/chatStore";
|
|
3
|
-
import { useWebSocket } from "@/hooks/useWebSocket";
|
|
4
|
-
import { useUserStore } from "@/stores/userStore";
|
|
5
|
-
import { useGlobalConfigStore } from "@/stores/useGlobalConfigStore";
|
|
6
|
-
import { ChatHistory } from "./ChatHistory";
|
|
7
|
-
import { ChatInput } from "./ChatInput";
|
|
8
|
-
import { apiClient } from "@/lib/api";
|
|
9
|
-
import { Bot, User } from "lucide-react";
|
|
10
|
-
|
|
11
|
-
interface ChatContainerProps {
|
|
12
|
-
agentId?: string;
|
|
13
|
-
sessionId?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function getInitials(name: string) {
|
|
17
|
-
return name.split(" ").map(w => w[0]).slice(0, 2).join("").toUpperCase() || "?";
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function ChatContainer({ agentId = "agent_id", sessionId = "user_id" }: ChatContainerProps) {
|
|
21
|
-
const { messages, addMessage, setMessages, isLoading, setLoading, currentSteps, addStep, clearSteps } = useChatStore();
|
|
22
|
-
const { status, send, subscribe } = useWebSocket();
|
|
23
|
-
const { currentUser, fetchUser } = useUserStore();
|
|
24
|
-
const agents = useGlobalConfigStore(s => s.agents);
|
|
25
|
-
const fetchAgents = useGlobalConfigStore(s => s.fetchAgents);
|
|
26
|
-
|
|
27
|
-
const isConnected = status === "connected";
|
|
28
|
-
const isConnecting = status === "connecting";
|
|
29
|
-
|
|
30
|
-
const coordinator = agents.find(a => a.role === 'coordinator' && a.enabled);
|
|
31
|
-
const agentName = coordinator?.name ?? "Coordinador";
|
|
32
|
-
const userName = currentUser?.name ?? "Usuario";
|
|
33
|
-
|
|
34
|
-
// Load user and agents if needed
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (!currentUser) fetchUser();
|
|
37
|
-
if (agents.length === 0) fetchAgents();
|
|
38
|
-
}, []);
|
|
39
|
-
|
|
40
|
-
// Load history
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
if (!sessionId) return;
|
|
43
|
-
const fetchHistory = async () => {
|
|
44
|
-
try {
|
|
45
|
-
const response = await apiClient<{ messages: any[] }>(`/api/chat/history?sessionId=${sessionId}`);
|
|
46
|
-
if (response.messages) {
|
|
47
|
-
const formattedMessages = response.messages.map((m: any) => ({
|
|
48
|
-
id: m.id,
|
|
49
|
-
conversationId: m.session_id,
|
|
50
|
-
type: (m.role === "user" ? "user" : "agent") as any,
|
|
51
|
-
content: m.content,
|
|
52
|
-
agentId: agentId,
|
|
53
|
-
timestamp: m.created_at,
|
|
54
|
-
}));
|
|
55
|
-
setMessages(formattedMessages);
|
|
56
|
-
}
|
|
57
|
-
} catch (error) {
|
|
58
|
-
console.error("Failed to fetch chat history:", error);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
fetchHistory();
|
|
62
|
-
}, [sessionId, agentId, setMessages]);
|
|
63
|
-
|
|
64
|
-
// Subscribe to messages/responses/steps
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
const handleMessage = (data: any) => {
|
|
67
|
-
const messageId = data.id || "agent-streaming-id";
|
|
68
|
-
const { messages, addMessage, updateMessage, setLoading, clearSteps } = useChatStore.getState();
|
|
69
|
-
const existingMessage = messages.find(m => m.id === messageId);
|
|
70
|
-
|
|
71
|
-
// Handle streaming chunks
|
|
72
|
-
if (data.isChunk && existingMessage) {
|
|
73
|
-
// Append chunk to existing message
|
|
74
|
-
updateMessage(messageId, {
|
|
75
|
-
content: (existingMessage.content || "") + data.content,
|
|
76
|
-
timestamp: data.timestamp || existingMessage.timestamp,
|
|
77
|
-
});
|
|
78
|
-
} else if (data.isChunk && !existingMessage) {
|
|
79
|
-
// First chunk - create new message
|
|
80
|
-
addMessage({
|
|
81
|
-
id: messageId,
|
|
82
|
-
conversationId: sessionId,
|
|
83
|
-
type: "agent" as const,
|
|
84
|
-
content: data.content || "",
|
|
85
|
-
agentId: agentId,
|
|
86
|
-
timestamp: data.timestamp || new Date().toISOString(),
|
|
87
|
-
});
|
|
88
|
-
} else if (existingMessage) {
|
|
89
|
-
// Replace content (non-chunk update)
|
|
90
|
-
updateMessage(messageId, {
|
|
91
|
-
content: data.content || existingMessage.content,
|
|
92
|
-
timestamp: data.timestamp || existingMessage.timestamp,
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
// New message (non-streaming)
|
|
96
|
-
addMessage({
|
|
97
|
-
id: messageId,
|
|
98
|
-
conversationId: sessionId,
|
|
99
|
-
type: "agent" as const,
|
|
100
|
-
content: data.content || data.message || JSON.stringify(data),
|
|
101
|
-
agentId: agentId,
|
|
102
|
-
timestamp: data.timestamp || new Date().toISOString(),
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Finalize when not a chunk
|
|
107
|
-
if (!data.isChunk) {
|
|
108
|
-
clearSteps();
|
|
109
|
-
setLoading(false);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
const handleAudioMessage = (data: any) => {
|
|
114
|
-
const messageId = data.id || crypto.randomUUID();
|
|
115
|
-
const { addMessage, setLoading, clearSteps } = useChatStore.getState();
|
|
116
|
-
|
|
117
|
-
addMessage({
|
|
118
|
-
id: messageId,
|
|
119
|
-
conversationId: sessionId,
|
|
120
|
-
type: "agent" as const,
|
|
121
|
-
content: data.content || "",
|
|
122
|
-
agentId: agentId,
|
|
123
|
-
timestamp: data.timestamp || new Date().toISOString(),
|
|
124
|
-
audio: data.audio ? { base64: data.audio, mimeType: data.mimeType } : undefined,
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
clearSteps();
|
|
128
|
-
setLoading(false);
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const handleProgress = (data: any) => {
|
|
132
|
-
if (data.content) {
|
|
133
|
-
useChatStore.getState().addStep(data.content);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
const handleTyping = (data: any) => {
|
|
138
|
-
const { setLoading, clearSteps } = useChatStore.getState();
|
|
139
|
-
if (data.isTyping === false) {
|
|
140
|
-
clearSteps();
|
|
141
|
-
setLoading(false);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const unsubMsg = subscribe("message", handleMessage);
|
|
146
|
-
const unsubResp = subscribe("response", handleMessage);
|
|
147
|
-
const unsubAudio = subscribe("audio", handleAudioMessage);
|
|
148
|
-
const unsubProgress = subscribe("progress", handleProgress);
|
|
149
|
-
const unsubTyping = subscribe("typing", handleTyping);
|
|
150
|
-
return () => { unsubMsg(); unsubResp(); unsubAudio(); unsubProgress(); unsubTyping(); };
|
|
151
|
-
}, [subscribe, sessionId, agentId, addMessage, setLoading]);
|
|
152
|
-
|
|
153
|
-
const handleSendMessage = (content: string, audioBase64?: string) => {
|
|
154
|
-
const messageId = crypto.randomUUID();
|
|
155
|
-
|
|
156
|
-
if (audioBase64) {
|
|
157
|
-
addMessage({
|
|
158
|
-
id: messageId,
|
|
159
|
-
conversationId: sessionId,
|
|
160
|
-
type: "user" as const,
|
|
161
|
-
content,
|
|
162
|
-
agentId,
|
|
163
|
-
timestamp: new Date().toISOString(),
|
|
164
|
-
audio: { base64: audioBase64, mimeType: "audio/webm" },
|
|
165
|
-
});
|
|
166
|
-
} else {
|
|
167
|
-
addMessage({
|
|
168
|
-
id: messageId,
|
|
169
|
-
conversationId: sessionId,
|
|
170
|
-
type: "user" as const,
|
|
171
|
-
content,
|
|
172
|
-
agentId,
|
|
173
|
-
timestamp: new Date().toISOString(),
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
setLoading(true);
|
|
178
|
-
|
|
179
|
-
if (isConnected) {
|
|
180
|
-
if (audioBase64) {
|
|
181
|
-
send({ type: "audio", audio: audioBase64, sessionId, timestamp: new Date().toISOString() });
|
|
182
|
-
} else {
|
|
183
|
-
send({ type: "message", content, sessionId, timestamp: new Date().toISOString() });
|
|
184
|
-
}
|
|
185
|
-
} else {
|
|
186
|
-
setTimeout(() => {
|
|
187
|
-
if (isLoading) {
|
|
188
|
-
setLoading(false);
|
|
189
|
-
addMessage({
|
|
190
|
-
id: crypto.randomUUID(),
|
|
191
|
-
conversationId: sessionId,
|
|
192
|
-
type: "error" as const,
|
|
193
|
-
content: "No se pudo conectar al agente. Verifica que el gateway esté funcionando.",
|
|
194
|
-
timestamp: new Date().toISOString(),
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
}, 3000);
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
return (
|
|
202
|
-
<div className="flex h-full flex-col min-h-0">
|
|
203
|
-
|
|
204
|
-
{/* ── Header ──────────────────────────────────────────────────────── */}
|
|
205
|
-
<div className="flex items-center justify-between border-b border-white/5 px-5 py-3 shrink-0 bg-zinc-950/80 backdrop-blur-sm z-10">
|
|
206
|
-
|
|
207
|
-
{/* Agent info */}
|
|
208
|
-
<div className="flex items-center gap-3">
|
|
209
|
-
<div className="relative">
|
|
210
|
-
<div className="h-9 w-9 rounded-xl bg-zinc-900 border border-cyan-500/20 flex items-center justify-center shadow">
|
|
211
|
-
<Bot className="h-4.5 w-4.5 text-cyan-400" />
|
|
212
|
-
</div>
|
|
213
|
-
<span className={`absolute -bottom-0.5 -right-0.5 h-2.5 w-2.5 rounded-full border-2 border-zinc-950 ${
|
|
214
|
-
isConnected ? "bg-emerald-500" : isConnecting ? "bg-yellow-500 animate-pulse" : "bg-zinc-600"
|
|
215
|
-
}`} />
|
|
216
|
-
</div>
|
|
217
|
-
<div>
|
|
218
|
-
<p className="text-sm font-bold text-white leading-tight">{agentName}</p>
|
|
219
|
-
<p className="text-[10px] text-zinc-500 font-mono uppercase tracking-wider">Coordinador</p>
|
|
220
|
-
</div>
|
|
221
|
-
<div className={`flex items-center gap-1.5 px-2 py-0.5 rounded-full border text-[10px] font-bold uppercase tracking-wider ml-1 ${
|
|
222
|
-
isConnected
|
|
223
|
-
? "bg-emerald-500/10 border-emerald-500/20 text-emerald-400"
|
|
224
|
-
: isConnecting
|
|
225
|
-
? "bg-yellow-500/10 border-yellow-500/20 text-yellow-400"
|
|
226
|
-
: "bg-zinc-800 border-zinc-700 text-zinc-500"
|
|
227
|
-
}`}>
|
|
228
|
-
<span className={`h-1.5 w-1.5 rounded-full ${
|
|
229
|
-
isConnected ? "bg-emerald-500 animate-pulse" : isConnecting ? "bg-yellow-500 animate-pulse" : "bg-zinc-600"
|
|
230
|
-
}`} />
|
|
231
|
-
{isConnected ? "En línea" : isConnecting ? "Conectando" : "Desconectado"}
|
|
232
|
-
</div>
|
|
233
|
-
</div>
|
|
234
|
-
|
|
235
|
-
{/* User info */}
|
|
236
|
-
<div className="flex items-center gap-2.5">
|
|
237
|
-
<div className="text-right">
|
|
238
|
-
<p className="text-sm font-semibold text-zinc-200 leading-tight">{userName}</p>
|
|
239
|
-
<p className="text-[10px] text-zinc-600 font-mono">Usuario</p>
|
|
240
|
-
</div>
|
|
241
|
-
<div className="h-9 w-9 rounded-xl bg-gradient-to-br from-blue-500 to-indigo-600 flex items-center justify-center text-[12px] font-bold text-white shadow ring-2 ring-zinc-950">
|
|
242
|
-
{currentUser?.name ? getInitials(currentUser.name) : <User className="h-4 w-4" />}
|
|
243
|
-
</div>
|
|
244
|
-
</div>
|
|
245
|
-
</div>
|
|
246
|
-
|
|
247
|
-
{/* ── Messages ────────────────────────────────────────────────────── */}
|
|
248
|
-
<div className="flex-1 overflow-y-auto min-h-0 bg-zinc-950/30">
|
|
249
|
-
<ChatHistory
|
|
250
|
-
messages={messages}
|
|
251
|
-
isLoading={isLoading}
|
|
252
|
-
currentSteps={currentSteps}
|
|
253
|
-
userName={userName}
|
|
254
|
-
agentName={agentName}
|
|
255
|
-
/>
|
|
256
|
-
</div>
|
|
257
|
-
|
|
258
|
-
{/* ── Input ───────────────────────────────────────────────────────── */}
|
|
259
|
-
<div className="shrink-0 border-t border-white/5 bg-zinc-950/80 backdrop-blur-sm">
|
|
260
|
-
<ChatInput
|
|
261
|
-
onSendMessage={handleSendMessage}
|
|
262
|
-
disabled={!isConnected && !isConnecting}
|
|
263
|
-
/>
|
|
264
|
-
</div>
|
|
265
|
-
|
|
266
|
-
</div>
|
|
267
|
-
);
|
|
268
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import type { Message } from "@/types";
|
|
2
|
-
import { ChatMessage } from "./ChatMessage";
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
4
|
-
import { Bot, Zap } from "lucide-react";
|
|
5
|
-
|
|
6
|
-
interface ChatHistoryProps {
|
|
7
|
-
messages: Message[];
|
|
8
|
-
isLoading?: boolean;
|
|
9
|
-
currentSteps?: string[];
|
|
10
|
-
userName?: string;
|
|
11
|
-
agentName?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function ChatHistory({ messages, isLoading = false, currentSteps = [], userName, agentName }: ChatHistoryProps) {
|
|
15
|
-
const messagesEndRef = useRef<HTMLDivElement>(null);
|
|
16
|
-
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
19
|
-
}, [messages, isLoading, currentSteps]);
|
|
20
|
-
|
|
21
|
-
if (messages.length === 0 && !isLoading) {
|
|
22
|
-
return (
|
|
23
|
-
<div className="flex flex-1 flex-col items-center justify-center p-8 gap-4">
|
|
24
|
-
<div className="relative">
|
|
25
|
-
<div className="h-16 w-16 rounded-2xl bg-zinc-900 border border-cyan-500/20 flex items-center justify-center shadow-xl">
|
|
26
|
-
<Bot className="h-8 w-8 text-cyan-400" />
|
|
27
|
-
</div>
|
|
28
|
-
<span className="absolute -bottom-1 -right-1 h-4 w-4 rounded-full bg-emerald-500 border-2 border-zinc-950 shadow" />
|
|
29
|
-
</div>
|
|
30
|
-
<div className="text-center space-y-1">
|
|
31
|
-
<p className="text-sm font-semibold text-zinc-300">
|
|
32
|
-
{agentName ? `${agentName} está listo` : "Agente listo"}
|
|
33
|
-
</p>
|
|
34
|
-
<p className="text-xs text-zinc-600">Inicia la conversación escribiendo un mensaje</p>
|
|
35
|
-
</div>
|
|
36
|
-
<div className="flex items-center gap-2 mt-2">
|
|
37
|
-
{["¿Qué puedes hacer?", "Dame un resumen", "Ayúdame con una tarea"].map(hint => (
|
|
38
|
-
<span
|
|
39
|
-
key={hint}
|
|
40
|
-
className="text-[11px] text-zinc-600 border border-white/5 bg-zinc-900/50 px-3 py-1 rounded-full"
|
|
41
|
-
>
|
|
42
|
-
{hint}
|
|
43
|
-
</span>
|
|
44
|
-
))}
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<div className="flex flex-1 flex-col gap-4 p-4 min-h-0">
|
|
52
|
-
{messages.map(message => (
|
|
53
|
-
<ChatMessage
|
|
54
|
-
key={message.id}
|
|
55
|
-
message={message}
|
|
56
|
-
userName={userName}
|
|
57
|
-
agentName={agentName}
|
|
58
|
-
/>
|
|
59
|
-
))}
|
|
60
|
-
|
|
61
|
-
{isLoading && (
|
|
62
|
-
<div className="flex items-end gap-2">
|
|
63
|
-
<div className="h-8 w-8 rounded-full bg-zinc-900 border border-cyan-500/20 flex items-center justify-center shrink-0 ring-2 ring-zinc-950">
|
|
64
|
-
<Bot className="h-4 w-4 text-cyan-400" />
|
|
65
|
-
</div>
|
|
66
|
-
<div className="flex flex-col gap-1.5 max-w-[72%]">
|
|
67
|
-
{/* Step narrations */}
|
|
68
|
-
{currentSteps.length > 0 && (
|
|
69
|
-
<div className="flex flex-col gap-1">
|
|
70
|
-
{currentSteps.map((step, i) => {
|
|
71
|
-
const isLatest = i === currentSteps.length - 1;
|
|
72
|
-
return (
|
|
73
|
-
<div
|
|
74
|
-
key={i}
|
|
75
|
-
className={`flex items-center gap-1.5 px-3 py-1.5 rounded-xl border text-xs transition-all ${
|
|
76
|
-
isLatest
|
|
77
|
-
? "bg-zinc-900 border-cyan-500/20 text-cyan-300"
|
|
78
|
-
: "bg-zinc-950/50 border-white/5 text-zinc-600"
|
|
79
|
-
}`}
|
|
80
|
-
>
|
|
81
|
-
<Zap className={`h-3 w-3 shrink-0 ${isLatest ? "text-cyan-500 animate-pulse" : "text-zinc-700"}`} />
|
|
82
|
-
<span className="leading-tight">{step}</span>
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
})}
|
|
86
|
-
</div>
|
|
87
|
-
)}
|
|
88
|
-
{/* Typing dots */}
|
|
89
|
-
<div className="bg-zinc-900 border border-white/5 px-4 py-3 rounded-2xl rounded-tl-sm flex items-center gap-1.5 w-fit">
|
|
90
|
-
<span className="h-1.5 w-1.5 rounded-full bg-cyan-500 animate-bounce [animation-delay:0ms]" />
|
|
91
|
-
<span className="h-1.5 w-1.5 rounded-full bg-cyan-500 animate-bounce [animation-delay:150ms]" />
|
|
92
|
-
<span className="h-1.5 w-1.5 rounded-full bg-cyan-500 animate-bounce [animation-delay:300ms]" />
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
)}
|
|
97
|
-
|
|
98
|
-
<div ref={messagesEndRef} className="h-0" />
|
|
99
|
-
</div>
|
|
100
|
-
);
|
|
101
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { useState, useRef, type KeyboardEvent } from "react";
|
|
2
|
-
import { Textarea } from "@/components/ui/textarea";
|
|
3
|
-
import { SendHorizontal, Mic, Square } from "lucide-react";
|
|
4
|
-
|
|
5
|
-
interface ChatInputProps {
|
|
6
|
-
onSendMessage: (content: string, audioBase64?: string) => void;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function ChatInput({ onSendMessage, disabled = false }: ChatInputProps) {
|
|
11
|
-
const [message, setMessage] = useState("");
|
|
12
|
-
const [isRecording, setIsRecording] = useState(false);
|
|
13
|
-
const mediaRecorderRef = useRef<MediaRecorder | null>(null);
|
|
14
|
-
const chunksRef = useRef<Blob[]>([]);
|
|
15
|
-
|
|
16
|
-
const handleSend = () => {
|
|
17
|
-
if (message.trim() && !disabled) {
|
|
18
|
-
onSendMessage(message.trim());
|
|
19
|
-
setMessage("");
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {
|
|
24
|
-
if (e.key === "Enter" && !e.shiftKey) {
|
|
25
|
-
e.preventDefault();
|
|
26
|
-
handleSend();
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const startRecording = async () => {
|
|
31
|
-
try {
|
|
32
|
-
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
33
|
-
const mediaRecorder = new MediaRecorder(stream, { mimeType: "audio/webm" });
|
|
34
|
-
mediaRecorderRef.current = mediaRecorder;
|
|
35
|
-
chunksRef.current = [];
|
|
36
|
-
|
|
37
|
-
mediaRecorder.ondataavailable = (e) => {
|
|
38
|
-
if (e.data.size > 0) {
|
|
39
|
-
chunksRef.current.push(e.data);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
mediaRecorder.onstop = async () => {
|
|
44
|
-
const blob = new Blob(chunksRef.current, { type: "audio/webm" });
|
|
45
|
-
const reader = new FileReader();
|
|
46
|
-
reader.readAsDataURL(blob);
|
|
47
|
-
reader.onloadend = () => {
|
|
48
|
-
const base64 = (reader.result as string).split(",")[1];
|
|
49
|
-
onSendMessage("[Audio mensaje]", base64);
|
|
50
|
-
};
|
|
51
|
-
stream.getTracks().forEach(track => track.stop());
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
mediaRecorder.start();
|
|
55
|
-
setIsRecording(true);
|
|
56
|
-
} catch (error) {
|
|
57
|
-
console.error("Error accessing microphone:", error);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const stopRecording = () => {
|
|
62
|
-
if (mediaRecorderRef.current && isRecording) {
|
|
63
|
-
mediaRecorderRef.current.stop();
|
|
64
|
-
setIsRecording(false);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<div className="px-4 py-3">
|
|
70
|
-
<div className={`flex items-end gap-2 rounded-2xl border bg-zinc-900/50 backdrop-blur-sm px-3 py-2 transition-all ${
|
|
71
|
-
disabled
|
|
72
|
-
? "border-white/5 opacity-60"
|
|
73
|
-
: "border-white/10 focus-within:border-blue-500/40 focus-within:shadow-lg focus-within:shadow-blue-500/5"
|
|
74
|
-
}`}>
|
|
75
|
-
<button
|
|
76
|
-
onClick={isRecording ? stopRecording : startRecording}
|
|
77
|
-
disabled={disabled}
|
|
78
|
-
className={`h-8 w-8 rounded-xl flex items-center justify-center shrink-0 mb-0.5 transition-all ${
|
|
79
|
-
isRecording
|
|
80
|
-
? "bg-red-600 hover:bg-red-500 animate-pulse"
|
|
81
|
-
: "bg-zinc-700 hover:bg-zinc-600"
|
|
82
|
-
} disabled:opacity-30 disabled:cursor-not-allowed text-white`}
|
|
83
|
-
>
|
|
84
|
-
{isRecording ? <Square className="h-3.5 w-3.5" /> : <Mic className="h-3.5 w-3.5" />}
|
|
85
|
-
</button>
|
|
86
|
-
<Textarea
|
|
87
|
-
value={message}
|
|
88
|
-
onChange={e => setMessage(e.target.value)}
|
|
89
|
-
onKeyDown={handleKeyDown}
|
|
90
|
-
placeholder={disabled ? "Conectando al agente..." : "Escribe un mensaje..."}
|
|
91
|
-
disabled={disabled}
|
|
92
|
-
className="flex-1 min-h-[36px] max-h-[160px] resize-none border-0 bg-transparent p-0 text-sm text-zinc-100 placeholder:text-zinc-600 focus-visible:ring-0 focus-visible:ring-offset-0 leading-relaxed"
|
|
93
|
-
rows={1}
|
|
94
|
-
/>
|
|
95
|
-
<button
|
|
96
|
-
onClick={handleSend}
|
|
97
|
-
disabled={!message.trim() || disabled}
|
|
98
|
-
className="h-8 w-8 rounded-xl flex items-center justify-center shrink-0 mb-0.5 transition-all disabled:opacity-30 disabled:cursor-not-allowed bg-blue-600 hover:bg-blue-500 disabled:bg-zinc-800 text-white shadow shadow-blue-600/20"
|
|
99
|
-
>
|
|
100
|
-
<SendHorizontal className="h-3.5 w-3.5" />
|
|
101
|
-
</button>
|
|
102
|
-
</div>
|
|
103
|
-
<p className="text-[10px] text-zinc-700 mt-1.5 text-center">
|
|
104
|
-
{isRecording ? "Grabando... haz clic en ■ para enviar" : "Enter para enviar · Shift+Enter nueva línea · 🎤 para audio"}
|
|
105
|
-
</p>
|
|
106
|
-
</div>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import type { Message } from "@/types";
|
|
3
|
-
import { Bot, AlertTriangle, Play, Pause, Volume2 } from "lucide-react";
|
|
4
|
-
import ReactMarkdown from "react-markdown";
|
|
5
|
-
import remarkGfm from "remark-gfm";
|
|
6
|
-
|
|
7
|
-
interface ChatMessageProps {
|
|
8
|
-
message: Message;
|
|
9
|
-
userName?: string;
|
|
10
|
-
agentName?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function getInitials(name: string) {
|
|
14
|
-
return name.split(" ").map(w => w[0]).slice(0, 2).join("").toUpperCase() || "?";
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function formatTime(ts: string) {
|
|
18
|
-
return new Date(ts).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function AudioPlayer({ audio, mimeType = "audio/webm" }: { audio: string; mimeType?: string }) {
|
|
22
|
-
const [isPlaying, setIsPlaying] = useState(false);
|
|
23
|
-
const [audioUrl, setAudioUrl] = useState<string | null>(null);
|
|
24
|
-
|
|
25
|
-
const playAudio = () => {
|
|
26
|
-
if (!audioUrl) {
|
|
27
|
-
const url = `data:${mimeType};base64,${audio}`;
|
|
28
|
-
setAudioUrl(url);
|
|
29
|
-
}
|
|
30
|
-
setIsPlaying(true);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const pauseAudio = () => {
|
|
34
|
-
setIsPlaying(false);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
if (!audio) return null;
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<div className="flex items-center gap-2 mt-2">
|
|
41
|
-
<button
|
|
42
|
-
onClick={isPlaying ? pauseAudio : playAudio}
|
|
43
|
-
className="h-8 w-8 rounded-full bg-cyan-600 hover:bg-cyan-500 flex items-center justify-center transition-colors"
|
|
44
|
-
>
|
|
45
|
-
{isPlaying ? <Pause className="h-4 w-4 text-white" /> : <Play className="h-4 w-4 text-white ml-0.5" />}
|
|
46
|
-
</button>
|
|
47
|
-
{audioUrl && (
|
|
48
|
-
<audio
|
|
49
|
-
src={audioUrl}
|
|
50
|
-
onEnded={() => setIsPlaying(false)}
|
|
51
|
-
autoPlay={isPlaying}
|
|
52
|
-
className="hidden"
|
|
53
|
-
/>
|
|
54
|
-
)}
|
|
55
|
-
<div className="flex-1 h-8 bg-zinc-800 rounded-lg overflow-hidden">
|
|
56
|
-
<div className="h-full w-full flex items-center px-2">
|
|
57
|
-
<Volume2 className="h-4 w-4 text-zinc-400 mr-2" />
|
|
58
|
-
<div className="flex-1 h-1.5 bg-zinc-700 rounded-full overflow-hidden">
|
|
59
|
-
<div className="h-full w-1/3 bg-cyan-500 rounded-full animate-pulse" />
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function ChatMessage({ message, userName = "Tú", agentName = "Agente" }: ChatMessageProps) {
|
|
68
|
-
const isUser = message.type === "user";
|
|
69
|
-
const isError = message.type === "error";
|
|
70
|
-
const isSystem = message.type === "system";
|
|
71
|
-
const hasAudio = !!message.audio?.base64 || !!message.audio?.url;
|
|
72
|
-
|
|
73
|
-
if (isSystem) {
|
|
74
|
-
return (
|
|
75
|
-
<div className="flex justify-center my-1">
|
|
76
|
-
<span className="text-[10px] text-zinc-600 bg-zinc-900/50 border border-white/5 px-3 py-1 rounded-full font-mono">
|
|
77
|
-
{message.content}
|
|
78
|
-
</span>
|
|
79
|
-
</div>
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (isError) {
|
|
84
|
-
return (
|
|
85
|
-
<div className="flex items-center gap-2 justify-center my-1">
|
|
86
|
-
<div className="flex items-center gap-2 text-[11px] text-red-400 bg-red-500/10 border border-red-500/20 px-3 py-1.5 rounded-xl">
|
|
87
|
-
<AlertTriangle className="h-3 w-3 shrink-0" />
|
|
88
|
-
{message.content}
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (isUser) {
|
|
95
|
-
return (
|
|
96
|
-
<div className="flex items-end justify-end gap-2 group">
|
|
97
|
-
<div className="flex flex-col items-end gap-1 max-w-[72%]">
|
|
98
|
-
<div className="bg-gradient-to-br from-blue-600 to-indigo-600 text-white px-4 py-2.5 rounded-2xl rounded-tr-sm shadow-lg shadow-blue-600/10 text-sm leading-relaxed whitespace-pre-wrap">
|
|
99
|
-
{message.content}
|
|
100
|
-
</div>
|
|
101
|
-
{hasAudio && message.audio?.base64 && (
|
|
102
|
-
<AudioPlayer audio={message.audio.base64} mimeType={message.audio.mimeType} />
|
|
103
|
-
)}
|
|
104
|
-
<span className="text-[10px] text-zinc-600 pr-1 opacity-0 group-hover:opacity-100 transition-opacity">
|
|
105
|
-
{formatTime(message.timestamp)}
|
|
106
|
-
</span>
|
|
107
|
-
</div>
|
|
108
|
-
<div className="h-8 w-8 rounded-full bg-gradient-to-br from-blue-500 to-indigo-600 flex items-center justify-center text-[11px] font-bold text-white shrink-0 shadow ring-2 ring-zinc-950">
|
|
109
|
-
{getInitials(userName)}
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Agent message
|
|
116
|
-
return (
|
|
117
|
-
<div className="flex items-end gap-2 group">
|
|
118
|
-
<div className="h-8 w-8 rounded-full bg-zinc-900 border border-cyan-500/20 flex items-center justify-center shrink-0 shadow ring-2 ring-zinc-950">
|
|
119
|
-
<Bot className="h-4 w-4 text-cyan-400" />
|
|
120
|
-
</div>
|
|
121
|
-
<div className="flex flex-col gap-1 max-w-[72%]">
|
|
122
|
-
<span className="text-[10px] font-semibold text-cyan-500 pl-1 uppercase tracking-wider">{agentName}</span>
|
|
123
|
-
<div className="bg-zinc-900 border border-white/5 text-zinc-100 px-4 py-2.5 rounded-2xl rounded-tl-sm text-sm leading-relaxed shadow prose prose-invert prose-p:leading-relaxed prose-pre:bg-black/50 prose-pre:border prose-pre:border-white/10 max-w-none prose-sm">
|
|
124
|
-
<ReactMarkdown remarkPlugins={[remarkGfm]}>
|
|
125
|
-
{message.content}
|
|
126
|
-
</ReactMarkdown>
|
|
127
|
-
</div>
|
|
128
|
-
{hasAudio && message.audio?.base64 && (
|
|
129
|
-
<AudioPlayer audio={message.audio.base64} mimeType={message.audio.mimeType} />
|
|
130
|
-
)}
|
|
131
|
-
<span className="text-[10px] text-zinc-600 pl-1 opacity-0 group-hover:opacity-100 transition-opacity">
|
|
132
|
-
{formatTime(message.timestamp)}
|
|
133
|
-
</span>
|
|
134
|
-
</div>
|
|
135
|
-
</div>
|
|
136
|
-
);
|
|
137
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export function ThinkingIndicator() {
|
|
2
|
-
return (
|
|
3
|
-
<div className="flex items-center gap-1.5 text-sm text-hive-thinking">
|
|
4
|
-
<span className="inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-hive-thinking" />
|
|
5
|
-
<span className="inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-hive-thinking [animation-delay:0.2s]" />
|
|
6
|
-
<span className="inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-hive-thinking [animation-delay:0.4s]" />
|
|
7
|
-
<span className="ml-1">Agente pensando…</span>
|
|
8
|
-
</div>
|
|
9
|
-
);
|
|
10
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Outlet } from "react-router-dom";
|
|
2
|
-
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
|
|
3
|
-
import { Header } from "./Header";
|
|
4
|
-
import { AppSidebar } from "./HiveSidebar";
|
|
5
|
-
import { useWebSocket } from "@/hooks/useWebSocket";
|
|
6
|
-
import { useUserStore } from "@/stores/userStore";
|
|
7
|
-
import { useEffect } from "react";
|
|
8
|
-
|
|
9
|
-
// Workaround for React Router v7 + React 18 type incompatibility
|
|
10
|
-
// Using type assertion to bypass the JSX element type mismatch
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
const OutletComponent = Outlet as any;
|
|
13
|
-
|
|
14
|
-
export function AppLayout() {
|
|
15
|
-
const { connect } = useWebSocket();
|
|
16
|
-
const { currentUser, fetchUser } = useUserStore();
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
fetchUser();
|
|
20
|
-
}, [fetchUser]);
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (currentUser?.id) {
|
|
24
|
-
connect(currentUser.id);
|
|
25
|
-
}
|
|
26
|
-
}, [connect, currentUser?.id]);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<SidebarProvider>
|
|
30
|
-
<AppSidebar />
|
|
31
|
-
<SidebarInset className="bg-background relative overflow-hidden">
|
|
32
|
-
{/* Ambient Glows Globales */}
|
|
33
|
-
<div className="hive-glow-blob hive-glow-blob--blue -top-20 -left-20 h-[500px] w-[500px] opacity-20" />
|
|
34
|
-
<div className="hive-glow-blob hive-glow-blob--purple -bottom-20 -right-20 h-[500px] w-[500px] opacity-20" />
|
|
35
|
-
|
|
36
|
-
<div className="flex flex-1 flex-col overflow-hidden relative z-10">
|
|
37
|
-
<Header />
|
|
38
|
-
<main className="hive-page flex-1 min-h-0 p-4 animate-fade-in flex flex-col overflow-auto">
|
|
39
|
-
<OutletComponent />
|
|
40
|
-
</main>
|
|
41
|
-
</div>
|
|
42
|
-
</SidebarInset>
|
|
43
|
-
</SidebarProvider>
|
|
44
|
-
);
|
|
45
|
-
}
|