@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,144 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import { loadConfig, getHiveDir } from "@johpaz/hive-core/config/loader";
|
|
4
|
-
|
|
5
|
-
const getHiveDirConst = () => getHiveDir();
|
|
6
|
-
const getWorkspace = () => path.join(getHiveDirConst(), "workspace");
|
|
7
|
-
|
|
8
|
-
interface CheckResult {
|
|
9
|
-
category: string;
|
|
10
|
-
name: string;
|
|
11
|
-
status: "ok" | "warn" | "error";
|
|
12
|
-
message: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export async function securityAudit(): Promise<void> {
|
|
16
|
-
console.log("\n🔒 Hive Security Audit\n");
|
|
17
|
-
|
|
18
|
-
const results: CheckResult[] = [];
|
|
19
|
-
const config = loadConfig();
|
|
20
|
-
|
|
21
|
-
// Red
|
|
22
|
-
results.push({ category: "Red", name: "Gateway bind", status: "ok", message: "127.0.0.1 (loopback)" });
|
|
23
|
-
results.push({ category: "Red", name: "Puerto", status: "ok", message: "18790 (no expuesto externamente)" });
|
|
24
|
-
|
|
25
|
-
const gateway = config.gateway as Record<string, unknown> | undefined;
|
|
26
|
-
const token = gateway?.authToken as string | undefined;
|
|
27
|
-
|
|
28
|
-
results.push({
|
|
29
|
-
category: "Red",
|
|
30
|
-
name: "Token bearer",
|
|
31
|
-
status: token && token.length > 0 ? "ok" : "warn",
|
|
32
|
-
message: token && token.length > 0 ? "configurado" : "no configurado",
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// Archivos
|
|
36
|
-
const authProfiles = path.join(getHiveDirConst(), "auth-profiles.json");
|
|
37
|
-
if (fs.existsSync(authProfiles)) {
|
|
38
|
-
const stat = fs.statSync(authProfiles);
|
|
39
|
-
const mode = stat.mode & 0o777;
|
|
40
|
-
results.push({
|
|
41
|
-
category: "Archivos",
|
|
42
|
-
name: "auth-profiles.json permisos",
|
|
43
|
-
status: mode === 0o600 ? "ok" : "warn",
|
|
44
|
-
message: mode === 0o600 ? "600 (seguro)" : `${(mode).toString(8)} — ejecuta: chmod 600 ${authProfiles}`,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const envFile = path.join(getHiveDirConst(), ".env");
|
|
49
|
-
if (fs.existsSync(envFile)) {
|
|
50
|
-
const stat = fs.statSync(envFile);
|
|
51
|
-
const mode = stat.mode & 0o777;
|
|
52
|
-
results.push({
|
|
53
|
-
category: "Archivos",
|
|
54
|
-
name: ".env permisos",
|
|
55
|
-
status: mode === 0o600 ? "ok" : "warn",
|
|
56
|
-
message: mode === 0o600 ? "600 (seguro)" : `${(mode).toString(8)} — ejecuta: chmod 600 ${envFile}`,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Configuración
|
|
61
|
-
const models = config.models as Record<string, unknown> | undefined;
|
|
62
|
-
const providers = models?.providers as Record<string, Record<string, unknown>> | undefined;
|
|
63
|
-
|
|
64
|
-
let hasHardcodedKey = false;
|
|
65
|
-
if (providers) {
|
|
66
|
-
for (const [, p] of Object.entries(providers)) {
|
|
67
|
-
const apiKey = p.apiKey as string | undefined;
|
|
68
|
-
if (apiKey && !apiKey.startsWith("${") && !apiKey.startsWith("process.env")) {
|
|
69
|
-
hasHardcodedKey = true;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
results.push({
|
|
75
|
-
category: "Configuración",
|
|
76
|
-
name: "API keys",
|
|
77
|
-
status: !hasHardcodedKey ? "ok" : "warn",
|
|
78
|
-
message: !hasHardcodedKey ? "en variables de entorno" : "hardcodeadas en config — considera usar env vars",
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
// Workspace
|
|
82
|
-
results.push({
|
|
83
|
-
category: "Workspace",
|
|
84
|
-
name: "Permisos workspace",
|
|
85
|
-
status: fs.existsSync(getWorkspace()) ? "ok" : "warn",
|
|
86
|
-
message: fs.existsSync(getWorkspace()) ? "existe" : "no existe",
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
// MCP
|
|
90
|
-
const mcp = config.mcp as Record<string, unknown> | undefined;
|
|
91
|
-
const servers = (mcp as any)?.servers as Record<string, Record<string, unknown>> | undefined;
|
|
92
|
-
|
|
93
|
-
if (servers && Object.keys(servers).length > 0) {
|
|
94
|
-
results.push({ category: "MCP", name: "Servidores", status: "ok", message: `${Object.keys(servers).length} configurado(s)` });
|
|
95
|
-
|
|
96
|
-
for (const [name, server] of Object.entries(servers)) {
|
|
97
|
-
const cmd = server.command as string | undefined;
|
|
98
|
-
const isKnown = cmd?.includes("@modelcontextprotocol") || cmd?.includes("mcp-server");
|
|
99
|
-
results.push({
|
|
100
|
-
category: "MCP",
|
|
101
|
-
name: `Servidor '${name}'`,
|
|
102
|
-
status: isKnown ? "ok" : "warn",
|
|
103
|
-
message: isKnown ? "fuente conocida" : "verificar comando manualmente",
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
} else {
|
|
107
|
-
results.push({ category: "MCP", name: "Servidores", status: "ok", message: "ninguno configurado" });
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Skills
|
|
111
|
-
const skillsDir = path.join(getHiveDirConst(), "skills");
|
|
112
|
-
if (fs.existsSync(skillsDir)) {
|
|
113
|
-
const managedSkills = fs.readdirSync(skillsDir).filter((f) => {
|
|
114
|
-
return fs.statSync(path.join(skillsDir, f)).isDirectory();
|
|
115
|
-
});
|
|
116
|
-
results.push({
|
|
117
|
-
category: "Skills",
|
|
118
|
-
name: "Skills de terceros",
|
|
119
|
-
status: managedSkills.length === 0 ? "ok" : "warn",
|
|
120
|
-
message: managedSkills.length === 0 ? "ninguna instalada" : `${managedSkills.length} instalada(s) — verificar manualmente`,
|
|
121
|
-
});
|
|
122
|
-
} else {
|
|
123
|
-
results.push({ category: "Skills", name: "Skills de terceros", status: "ok", message: "ninguna instalada" });
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Mostrar resultados
|
|
127
|
-
const categories = [...new Set(results.map((r) => r.category))];
|
|
128
|
-
|
|
129
|
-
for (const category of categories) {
|
|
130
|
-
console.log(`${category}`);
|
|
131
|
-
const catResults = results.filter((r) => r.category === category);
|
|
132
|
-
for (const result of catResults) {
|
|
133
|
-
const icon = result.status === "ok" ? "✅" : result.status === "warn" ? "⚠️ " : "❌";
|
|
134
|
-
console.log(` ${icon} ${result.name}: ${result.message}`);
|
|
135
|
-
}
|
|
136
|
-
console.log();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Resumen
|
|
140
|
-
const errors = results.filter((r) => r.status === "error");
|
|
141
|
-
const warns = results.filter((r) => r.status === "warn");
|
|
142
|
-
|
|
143
|
-
console.log(`📊 Resumen: ${results.length} checks, ${errors.length} errores, ${warns.length} advertencias`);
|
|
144
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import { execSync } from "child_process";
|
|
4
|
-
|
|
5
|
-
const HOME = process.env.HOME || "";
|
|
6
|
-
const SYSTEMD_DIR = path.join(HOME, ".config", "systemd", "user");
|
|
7
|
-
|
|
8
|
-
export async function installService(): Promise<void> {
|
|
9
|
-
console.log("🔧 Instalando servicio systemd para Hive...\n");
|
|
10
|
-
|
|
11
|
-
if (!fs.existsSync(SYSTEMD_DIR)) {
|
|
12
|
-
fs.mkdirSync(SYSTEMD_DIR, { recursive: true });
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const serviceContent = `[Unit]
|
|
16
|
-
Description=Hive Personal AI Gateway
|
|
17
|
-
After=network-online.target
|
|
18
|
-
Wants=network-online.target
|
|
19
|
-
|
|
20
|
-
[Service]
|
|
21
|
-
Type=simple
|
|
22
|
-
ExecStart=${HOME}/.bun/bin/hive start
|
|
23
|
-
ExecStop=${HOME}/.bun/bin/hive stop
|
|
24
|
-
Restart=on-failure
|
|
25
|
-
RestartSec=5
|
|
26
|
-
Environment=PATH=${HOME}/.bun/bin:${HOME}/.npm-global/bin:/usr/local/bin:/usr/bin:/bin
|
|
27
|
-
WorkingDirectory=${HOME}
|
|
28
|
-
|
|
29
|
-
[Install]
|
|
30
|
-
WantedBy=default.target
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
const servicePath = path.join(SYSTEMD_DIR, "hive.service");
|
|
34
|
-
|
|
35
|
-
fs.writeFileSync(servicePath, serviceContent, "utf-8");
|
|
36
|
-
console.log(`✅ Archivo de servicio creado: ${servicePath}\n`);
|
|
37
|
-
|
|
38
|
-
console.log("Recargando systemd...");
|
|
39
|
-
execSync("systemctl --user daemon-reload", { stdio: "inherit" });
|
|
40
|
-
|
|
41
|
-
console.log("Habilitando servicio...");
|
|
42
|
-
execSync("systemctl --user enable hive", { stdio: "inherit" });
|
|
43
|
-
|
|
44
|
-
console.log("\n✅ Servicio instalado correctamente.\n");
|
|
45
|
-
console.log("Comandos disponibles:");
|
|
46
|
-
console.log(" systemctl --user start hive # Iniciar");
|
|
47
|
-
console.log(" systemctl --user stop hive # Detener");
|
|
48
|
-
console.log(" systemctl --user status hive # Ver estado");
|
|
49
|
-
console.log(" journalctl --user -u hive -f # Ver logs");
|
|
50
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
|
|
4
|
-
const HIVE_DIR = path.join(process.env.HOME || "", ".hive");
|
|
5
|
-
const SESSIONS_DIR = path.join(HIVE_DIR, "sessions");
|
|
6
|
-
|
|
7
|
-
export async function sessions(subcommand: string | undefined, args: string[]): Promise<void> {
|
|
8
|
-
switch (subcommand) {
|
|
9
|
-
case "list":
|
|
10
|
-
await listSessions();
|
|
11
|
-
break;
|
|
12
|
-
case "view":
|
|
13
|
-
await viewSession(args[0]);
|
|
14
|
-
break;
|
|
15
|
-
case "prune":
|
|
16
|
-
await pruneSessions();
|
|
17
|
-
break;
|
|
18
|
-
default:
|
|
19
|
-
console.log(`
|
|
20
|
-
Usage: hive sessions <command>
|
|
21
|
-
|
|
22
|
-
Commands:
|
|
23
|
-
list Listar sesiones
|
|
24
|
-
view <id> Ver transcripción
|
|
25
|
-
prune Eliminar sesiones inactivas
|
|
26
|
-
`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async function listSessions(): Promise<void> {
|
|
31
|
-
if (!fs.existsSync(SESSIONS_DIR)) {
|
|
32
|
-
console.log("No hay sesiones");
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const sessions = fs.readdirSync(SESSIONS_DIR).filter((f) => f.endsWith(".json"));
|
|
37
|
-
|
|
38
|
-
if (sessions.length === 0) {
|
|
39
|
-
console.log("No hay sesiones");
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
console.log("\n📋 Sesiones:\n");
|
|
44
|
-
|
|
45
|
-
for (const session of sessions) {
|
|
46
|
-
const sessionPath = path.join(SESSIONS_DIR, session);
|
|
47
|
-
const stat = fs.statSync(sessionPath);
|
|
48
|
-
const id = session.replace(".json", "");
|
|
49
|
-
const date = stat.mtime.toLocaleDateString();
|
|
50
|
-
const time = stat.mtime.toLocaleTimeString();
|
|
51
|
-
|
|
52
|
-
let messageCount = 0;
|
|
53
|
-
try {
|
|
54
|
-
const content = JSON.parse(fs.readFileSync(sessionPath, "utf-8"));
|
|
55
|
-
messageCount = content.messages?.length || 0;
|
|
56
|
-
} catch {
|
|
57
|
-
// ignore
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
console.log(` ${id}`);
|
|
61
|
-
console.log(` Última actividad: ${date} ${time}`);
|
|
62
|
-
console.log(` Mensajes: ${messageCount}`);
|
|
63
|
-
console.log();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async function viewSession(id: string | undefined): Promise<void> {
|
|
68
|
-
if (!id) {
|
|
69
|
-
console.log("❌ Especifica el ID de la sesión: hive sessions view <id>");
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const sessionPath = path.join(SESSIONS_DIR, `${id}.json`);
|
|
74
|
-
|
|
75
|
-
if (!fs.existsSync(sessionPath)) {
|
|
76
|
-
console.log(`❌ Sesión no encontrada: ${id}`);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const content = JSON.parse(fs.readFileSync(sessionPath, "utf-8"));
|
|
81
|
-
const messages = content.messages || [];
|
|
82
|
-
|
|
83
|
-
console.log(`\n📜 Sesión: ${id}\n`);
|
|
84
|
-
|
|
85
|
-
for (const msg of messages) {
|
|
86
|
-
const role = msg.role === "user" ? "👤 Usuario" : "🤖 Agente";
|
|
87
|
-
console.log(`${role}:`);
|
|
88
|
-
console.log(` ${msg.content}`);
|
|
89
|
-
console.log();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
async function pruneSessions(): Promise<void> {
|
|
94
|
-
if (!fs.existsSync(SESSIONS_DIR)) {
|
|
95
|
-
console.log("No hay sesiones para limpiar");
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const sessions = fs.readdirSync(SESSIONS_DIR).filter((f) => f.endsWith(".json"));
|
|
100
|
-
const now = Date.now();
|
|
101
|
-
const maxAge = 7 * 24 * 60 * 60 * 1000; // 7 días
|
|
102
|
-
|
|
103
|
-
let pruned = 0;
|
|
104
|
-
|
|
105
|
-
for (const session of sessions) {
|
|
106
|
-
const sessionPath = path.join(SESSIONS_DIR, session);
|
|
107
|
-
const stat = fs.statSync(sessionPath);
|
|
108
|
-
|
|
109
|
-
if (now - stat.mtimeMs > maxAge) {
|
|
110
|
-
fs.unlinkSync(sessionPath);
|
|
111
|
-
pruned++;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
console.log(`✅ Sesiones eliminadas: ${pruned}`);
|
|
116
|
-
}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import * as p from "@clack/prompts";
|
|
2
|
-
import * as fs from "fs";
|
|
3
|
-
import * as path from "path";
|
|
4
|
-
|
|
5
|
-
const SKILLS_DIR = path.join(process.env.HOME || "", ".hive", "skills");
|
|
6
|
-
const BUNDLED_SKILLS: Array<{ slug: string; name: string; description: string }> = [
|
|
7
|
-
{ slug: "web-search", name: "Web Search", description: "Search the web using multiple search engines" },
|
|
8
|
-
{ slug: "code-exec", name: "Code Execution", description: "Execute code snippets safely" },
|
|
9
|
-
{ slug: "file-ops", name: "File Operations", description: "Read, write, and manage files" },
|
|
10
|
-
{ slug: "memory", name: "Memory", description: "Persistent memory and notes" },
|
|
11
|
-
{ slug: "cron", name: "Cron Jobs", description: "Schedule recurring tasks" },
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
export async function skills(subcommand: string | undefined, args: string[]): Promise<void> {
|
|
15
|
-
switch (subcommand) {
|
|
16
|
-
case "list":
|
|
17
|
-
await listSkills();
|
|
18
|
-
break;
|
|
19
|
-
case "search":
|
|
20
|
-
await searchSkills(args[0]);
|
|
21
|
-
break;
|
|
22
|
-
case "install":
|
|
23
|
-
await installSkill(args[0]);
|
|
24
|
-
break;
|
|
25
|
-
case "remove":
|
|
26
|
-
await removeSkill(args[0]);
|
|
27
|
-
break;
|
|
28
|
-
case "update":
|
|
29
|
-
await updateSkills();
|
|
30
|
-
break;
|
|
31
|
-
default:
|
|
32
|
-
console.log(`
|
|
33
|
-
Usage: hive skills <command>
|
|
34
|
-
|
|
35
|
-
Commands:
|
|
36
|
-
list Listar skills instaladas
|
|
37
|
-
search <query> Buscar skills
|
|
38
|
-
install <slug> Instalar skill
|
|
39
|
-
remove <nombre> Eliminar skill
|
|
40
|
-
update Actualizar skills
|
|
41
|
-
`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async function listSkills(): Promise<void> {
|
|
46
|
-
console.log("\n📚 Skills instaladas:\n");
|
|
47
|
-
|
|
48
|
-
console.log(" Bundled (incluidas):");
|
|
49
|
-
for (const skill of BUNDLED_SKILLS) {
|
|
50
|
-
console.log(` • ${skill.name} (${skill.slug})`);
|
|
51
|
-
console.log(` ${skill.description}`);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (fs.existsSync(SKILLS_DIR)) {
|
|
55
|
-
const managedSkills = fs.readdirSync(SKILLS_DIR).filter((f) => {
|
|
56
|
-
const skillPath = path.join(SKILLS_DIR, f);
|
|
57
|
-
return fs.statSync(skillPath).isDirectory();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
if (managedSkills.length > 0) {
|
|
61
|
-
console.log("\n Managed (instaladas):");
|
|
62
|
-
for (const slug of managedSkills) {
|
|
63
|
-
const skillPath = path.join(SKILLS_DIR, slug, "skill.json");
|
|
64
|
-
if (fs.existsSync(skillPath)) {
|
|
65
|
-
const meta = JSON.parse(fs.readFileSync(skillPath, "utf-8"));
|
|
66
|
-
console.log(` • ${meta.name || slug}`);
|
|
67
|
-
console.log(` ${meta.description || "Sin descripción"}`);
|
|
68
|
-
} else {
|
|
69
|
-
console.log(` • ${slug}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
console.log();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async function searchSkills(query: string | undefined): Promise<void> {
|
|
79
|
-
if (!query) {
|
|
80
|
-
console.log("❌ Especifica un término de búsqueda: hive skills search <query>");
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
console.log(`\n🔍 Buscando: "${query}"\n`);
|
|
85
|
-
|
|
86
|
-
const results = BUNDLED_SKILLS.filter(
|
|
87
|
-
(s) =>
|
|
88
|
-
s.name.toLowerCase().includes(query.toLowerCase()) ||
|
|
89
|
-
s.slug.toLowerCase().includes(query.toLowerCase()) ||
|
|
90
|
-
s.description.toLowerCase().includes(query.toLowerCase())
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
if (results.length === 0) {
|
|
94
|
-
console.log("No se encontraron skills");
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
for (const skill of results) {
|
|
99
|
-
console.log(` ${skill.slug}`);
|
|
100
|
-
console.log(` ${skill.name}`);
|
|
101
|
-
console.log(` ${skill.description}`);
|
|
102
|
-
console.log(` Tipo: bundled`);
|
|
103
|
-
console.log();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
async function installSkill(slug: string | undefined): Promise<void> {
|
|
108
|
-
if (!slug) {
|
|
109
|
-
const result = await p.text({
|
|
110
|
-
message: "Slug de la skill a instalar:",
|
|
111
|
-
placeholder: "example-skill",
|
|
112
|
-
validate: (v) => (!v ? "El slug es requerido" : undefined),
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
if (p.isCancel(result)) {
|
|
116
|
-
p.cancel("Cancelado");
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
slug = result;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
console.log(`\n📦 Instalando skill: ${slug}`);
|
|
123
|
-
|
|
124
|
-
if (!fs.existsSync(SKILLS_DIR)) {
|
|
125
|
-
fs.mkdirSync(SKILLS_DIR, { recursive: true });
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const skillPath = path.join(SKILLS_DIR, slug);
|
|
129
|
-
if (fs.existsSync(skillPath)) {
|
|
130
|
-
console.log("⚠️ La skill ya está instalada");
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
fs.mkdirSync(skillPath, { recursive: true });
|
|
135
|
-
|
|
136
|
-
const meta = {
|
|
137
|
-
name: slug,
|
|
138
|
-
version: "1.0.0",
|
|
139
|
-
description: "Skill instalada manualmente",
|
|
140
|
-
installed: new Date().toISOString(),
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
fs.writeFileSync(path.join(skillPath, "skill.json"), JSON.stringify(meta, null, 2));
|
|
144
|
-
|
|
145
|
-
console.log(`✅ Skill "${slug}" instalada`);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
async function removeSkill(slug: string | undefined): Promise<void> {
|
|
149
|
-
if (!slug) {
|
|
150
|
-
console.log("❌ Especifica la skill: hive skills remove <slug>");
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const skillPath = path.join(SKILLS_DIR, slug);
|
|
155
|
-
|
|
156
|
-
if (!fs.existsSync(skillPath)) {
|
|
157
|
-
console.log(`❌ La skill "${slug}" no está instalada`);
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const confirm = await p.confirm({
|
|
162
|
-
message: `¿Eliminar la skill "${slug}"?`,
|
|
163
|
-
initialValue: false,
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
if (p.isCancel(confirm) || !confirm) {
|
|
167
|
-
console.log("Cancelado");
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
fs.rmSync(skillPath, { recursive: true });
|
|
172
|
-
console.log(`✅ Skill "${slug}" eliminada`);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
async function updateSkills(): Promise<void> {
|
|
176
|
-
if (!fs.existsSync(SKILLS_DIR)) {
|
|
177
|
-
console.log("No hay skills instaladas para actualizar");
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const spinner = p.spinner();
|
|
182
|
-
spinner.start("Actualizando skills...");
|
|
183
|
-
|
|
184
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
185
|
-
|
|
186
|
-
spinner.stop("Skills actualizadas ✅");
|
|
187
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const PACKAGES = ["@johpaz/hive-cli"];
|
|
2
|
-
|
|
3
|
-
export async function update(): Promise<void> {
|
|
4
|
-
console.log("🔄 Actualizando Hive...\n");
|
|
5
|
-
|
|
6
|
-
for (const pkg of PACKAGES) {
|
|
7
|
-
console.log(`Actualizando ${pkg}...`);
|
|
8
|
-
try {
|
|
9
|
-
const proc = Bun.spawn(["bun", "install", "-g", `${pkg}@latest`], {
|
|
10
|
-
stdout: "inherit",
|
|
11
|
-
stderr: "inherit",
|
|
12
|
-
});
|
|
13
|
-
const exitCode = await proc.exited;
|
|
14
|
-
if (exitCode === 0) {
|
|
15
|
-
console.log(`✅ ${pkg} actualizado\n`);
|
|
16
|
-
} else {
|
|
17
|
-
console.log(`⚠️ Error actualizando ${pkg}\n`);
|
|
18
|
-
}
|
|
19
|
-
} catch (e) {
|
|
20
|
-
console.log(`⚠️ Error actualizando ${pkg}: ${(e as Error).message}\n`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
console.log("✅ Hive actualizado. Ejecuta 'hive --version' para verificar.");
|
|
25
|
-
}
|