@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,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* fs_edit - Edit specific lines or sections of a file
|
|
3
|
-
*
|
|
4
|
-
* @category filesystem
|
|
5
|
-
* @seedId fs_edit
|
|
6
|
-
* @spanish editar archivo, modificar líneas, actualizar contenido
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { Tool } from "../types.ts";
|
|
10
|
-
import { logger } from "../../utils/logger.ts";
|
|
11
|
-
import { resolveInWorkspace, getWorkspace } from "./workspace-guard.ts";
|
|
12
|
-
import * as fs from "node:fs";
|
|
13
|
-
|
|
14
|
-
const log = logger.child("fs-edit");
|
|
15
|
-
|
|
16
|
-
export const fsEditTool: Tool = {
|
|
17
|
-
name: "fs_edit",
|
|
18
|
-
description: "Edit specific lines or sections of a file. Spanish: editar archivo, modificar líneas, actualizar contenido",
|
|
19
|
-
parameters: {
|
|
20
|
-
type: "object",
|
|
21
|
-
properties: {
|
|
22
|
-
path: {
|
|
23
|
-
type: "string",
|
|
24
|
-
description: "Path to the file to edit",
|
|
25
|
-
},
|
|
26
|
-
oldString: {
|
|
27
|
-
type: "string",
|
|
28
|
-
description: "The text to search for and replace",
|
|
29
|
-
},
|
|
30
|
-
newString: {
|
|
31
|
-
type: "string",
|
|
32
|
-
description: "The text to replace with",
|
|
33
|
-
},
|
|
34
|
-
replaceAll: {
|
|
35
|
-
type: "boolean",
|
|
36
|
-
description: "Replace all occurrences (default: false)",
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
required: ["path", "oldString", "newString"],
|
|
40
|
-
},
|
|
41
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
42
|
-
const workspace = getWorkspace(config);
|
|
43
|
-
let filePath: string;
|
|
44
|
-
try {
|
|
45
|
-
filePath = resolveInWorkspace(params.path as string, workspace);
|
|
46
|
-
} catch (e) {
|
|
47
|
-
return { ok: false, error: (e as Error).message };
|
|
48
|
-
}
|
|
49
|
-
const oldString = params.oldString as string;
|
|
50
|
-
const newString = params.newString as string;
|
|
51
|
-
const replaceAll = (params.replaceAll as boolean) ?? false;
|
|
52
|
-
|
|
53
|
-
log.debug(`Editing file: ${filePath}`);
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
if (!fs.existsSync(filePath)) {
|
|
57
|
-
return {
|
|
58
|
-
ok: false,
|
|
59
|
-
error: `File not found: ${filePath}`,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const content = fs.readFileSync(filePath, "utf-8");
|
|
64
|
-
|
|
65
|
-
if (!content.includes(oldString)) {
|
|
66
|
-
return {
|
|
67
|
-
ok: false,
|
|
68
|
-
error: `String not found in file: ${oldString.substring(0, 50)}...`,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
let newContent: string;
|
|
73
|
-
let occurrences = 0;
|
|
74
|
-
if (replaceAll) {
|
|
75
|
-
occurrences = content.split(oldString).length - 1;
|
|
76
|
-
newContent = content.split(oldString).join(newString);
|
|
77
|
-
} else {
|
|
78
|
-
const index = content.indexOf(oldString);
|
|
79
|
-
occurrences = content.split(oldString).length - 1;
|
|
80
|
-
|
|
81
|
-
if (occurrences > 1) {
|
|
82
|
-
return {
|
|
83
|
-
ok: false,
|
|
84
|
-
error: `Found ${occurrences} occurrences. Use replaceAll: true or provide more context.`,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
newContent = content.replace(oldString, newString);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
fs.writeFileSync(filePath, newContent, "utf-8");
|
|
92
|
-
|
|
93
|
-
return {
|
|
94
|
-
ok: true,
|
|
95
|
-
path: filePath,
|
|
96
|
-
replacements: replaceAll ? occurrences : 1,
|
|
97
|
-
};
|
|
98
|
-
} catch (error) {
|
|
99
|
-
log.error(`Error editing file: ${(error as Error).message}`);
|
|
100
|
-
return {
|
|
101
|
-
ok: false,
|
|
102
|
-
error: `Failed to edit file: ${(error as Error).message}`,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* fs_exists - Check if a file or directory exists
|
|
3
|
-
*
|
|
4
|
-
* @category filesystem
|
|
5
|
-
* @seedId fs_exists
|
|
6
|
-
* @spanish verificar archivo, comprobar, existe archivo
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { Tool } from "../types.ts";
|
|
10
|
-
import { logger } from "../../utils/logger.ts";
|
|
11
|
-
import { resolveInWorkspace, getWorkspace } from "./workspace-guard.ts";
|
|
12
|
-
import * as fs from "node:fs";
|
|
13
|
-
|
|
14
|
-
const log = logger.child("fs-exists");
|
|
15
|
-
|
|
16
|
-
export const fsExistsTool: Tool = {
|
|
17
|
-
name: "fs_exists",
|
|
18
|
-
description: "Check if a file or directory exists. Spanish: verificar archivo, comprobar, existe archivo",
|
|
19
|
-
parameters: {
|
|
20
|
-
type: "object",
|
|
21
|
-
properties: {
|
|
22
|
-
path: {
|
|
23
|
-
type: "string",
|
|
24
|
-
description: "Path to check for existence",
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
required: ["path"],
|
|
28
|
-
},
|
|
29
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
30
|
-
const workspace = getWorkspace(config);
|
|
31
|
-
let filePath: string;
|
|
32
|
-
try {
|
|
33
|
-
filePath = resolveInWorkspace(params.path as string, workspace);
|
|
34
|
-
} catch (e) {
|
|
35
|
-
return { ok: false, error: (e as Error).message };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
log.debug(`Checking existence: ${filePath}`);
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
const exists = fs.existsSync(filePath);
|
|
42
|
-
let type: "file" | "directory" | "none" = "none";
|
|
43
|
-
|
|
44
|
-
if (exists) {
|
|
45
|
-
const stats = fs.statSync(filePath);
|
|
46
|
-
type = stats.isDirectory() ? "directory" : "file";
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
ok: true,
|
|
51
|
-
path: filePath,
|
|
52
|
-
exists,
|
|
53
|
-
type,
|
|
54
|
-
};
|
|
55
|
-
} catch (error) {
|
|
56
|
-
log.error(`Error checking existence: ${(error as Error).message}`);
|
|
57
|
-
return {
|
|
58
|
-
ok: false,
|
|
59
|
-
error: `Failed to check existence: ${(error as Error).message}`,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* fs_glob - Find files matching wildcard patterns
|
|
3
|
-
*
|
|
4
|
-
* @category filesystem
|
|
5
|
-
* @seedId fs_glob
|
|
6
|
-
* @spanish buscar archivos, patrón, encontrar archivos
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { Tool } from "../types.ts";
|
|
10
|
-
import { logger } from "../../utils/logger.ts";
|
|
11
|
-
import { resolveInWorkspace, getWorkspace, expandPath } from "./workspace-guard.ts";
|
|
12
|
-
import * as fs from "node:fs";
|
|
13
|
-
import * as path from "node:path";
|
|
14
|
-
|
|
15
|
-
const log = logger.child("fs-glob");
|
|
16
|
-
|
|
17
|
-
export const fsGlobTool: Tool = {
|
|
18
|
-
name: "fs_glob",
|
|
19
|
-
description: "Find files matching wildcard patterns. Spanish: buscar archivos, patrón, encontrar archivos",
|
|
20
|
-
parameters: {
|
|
21
|
-
type: "object",
|
|
22
|
-
properties: {
|
|
23
|
-
pattern: {
|
|
24
|
-
type: "string",
|
|
25
|
-
description: "Glob pattern (e.g., '**/*.ts', 'src/**/*.js')",
|
|
26
|
-
},
|
|
27
|
-
basePath: {
|
|
28
|
-
type: "string",
|
|
29
|
-
description: "Base path to search from (default: current directory)",
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
required: ["pattern"],
|
|
33
|
-
},
|
|
34
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
35
|
-
const workspace = getWorkspace(config);
|
|
36
|
-
const rawBase = (params.basePath as string) ?? (workspace ? expandPath(workspace) : ".");
|
|
37
|
-
let base: string;
|
|
38
|
-
try {
|
|
39
|
-
base = resolveInWorkspace(rawBase, workspace);
|
|
40
|
-
} catch (e) {
|
|
41
|
-
return { ok: false, error: (e as Error).message };
|
|
42
|
-
}
|
|
43
|
-
const pattern = params.pattern as string;
|
|
44
|
-
|
|
45
|
-
log.debug(`Globbing: ${pattern} in ${base}`);
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
const results: string[] = [];
|
|
49
|
-
|
|
50
|
-
function matchGlob(dir: string, pat: string, depth: number): void {
|
|
51
|
-
if (depth > 10) return;
|
|
52
|
-
|
|
53
|
-
const parts = pat.split("/");
|
|
54
|
-
const firstPart = parts[0];
|
|
55
|
-
const remainingParts = parts.slice(1);
|
|
56
|
-
|
|
57
|
-
try {
|
|
58
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
59
|
-
|
|
60
|
-
for (const entry of entries) {
|
|
61
|
-
const fullPath = path.join(dir, entry.name);
|
|
62
|
-
|
|
63
|
-
if (firstPart === "**") {
|
|
64
|
-
if (entry.isDirectory()) {
|
|
65
|
-
matchGlob(fullPath, parts.slice(1).join("/"), depth + 1);
|
|
66
|
-
matchGlob(fullPath, pat, depth + 1);
|
|
67
|
-
}
|
|
68
|
-
if (remainingParts.length === 0 || matchesPattern(entry.name, remainingParts[0])) {
|
|
69
|
-
results.push(fullPath);
|
|
70
|
-
}
|
|
71
|
-
} else if (matchesPattern(entry.name, firstPart)) {
|
|
72
|
-
if (remainingParts.length === 0) {
|
|
73
|
-
results.push(fullPath);
|
|
74
|
-
} else if (entry.isDirectory()) {
|
|
75
|
-
matchGlob(fullPath, remainingParts.join("/"), depth + 1);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
} catch {
|
|
80
|
-
// Ignore permission errors
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function matchesPattern(name: string, pattern: string): boolean {
|
|
85
|
-
if (pattern === "*") return true;
|
|
86
|
-
if (pattern === "**") return true;
|
|
87
|
-
const regex = new RegExp("^" + pattern.replace(/\*/g, ".*").replace(/\?/g, ".") + "$");
|
|
88
|
-
return regex.test(name);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
matchGlob(base, pattern, 0);
|
|
92
|
-
|
|
93
|
-
return {
|
|
94
|
-
ok: true,
|
|
95
|
-
pattern,
|
|
96
|
-
basePath: base,
|
|
97
|
-
files: results.slice(0, 100),
|
|
98
|
-
count: results.length,
|
|
99
|
-
};
|
|
100
|
-
} catch (error) {
|
|
101
|
-
log.error(`Error globbing: ${(error as Error).message}`);
|
|
102
|
-
return {
|
|
103
|
-
ok: false,
|
|
104
|
-
error: `Failed to glob: ${(error as Error).message}`,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* fs_list - List files and directories in workspace
|
|
3
|
-
*
|
|
4
|
-
* @category filesystem
|
|
5
|
-
* @seedId fs_list
|
|
6
|
-
* @spanish listar archivos, ver carpeta, explorar directorio
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { Tool } from "../types.ts";
|
|
10
|
-
import { logger } from "../../utils/logger.ts";
|
|
11
|
-
import { resolveInWorkspace, getWorkspace, expandPath } from "./workspace-guard.ts";
|
|
12
|
-
import * as fs from "node:fs";
|
|
13
|
-
import * as path from "node:path";
|
|
14
|
-
|
|
15
|
-
const log = logger.child("fs-list");
|
|
16
|
-
|
|
17
|
-
export const fsListTool: Tool = {
|
|
18
|
-
name: "fs_list",
|
|
19
|
-
description: "List files and directories in workspace. Spanish: listar archivos, ver carpeta, explorar directorio",
|
|
20
|
-
parameters: {
|
|
21
|
-
type: "object",
|
|
22
|
-
properties: {
|
|
23
|
-
path: {
|
|
24
|
-
type: "string",
|
|
25
|
-
description: "Path to the directory to list (default: current directory)",
|
|
26
|
-
},
|
|
27
|
-
recursive: {
|
|
28
|
-
type: "boolean",
|
|
29
|
-
description: "List recursively (default: false)",
|
|
30
|
-
},
|
|
31
|
-
maxDepth: {
|
|
32
|
-
type: "number",
|
|
33
|
-
description: "Maximum depth for recursive listing (default: 3)",
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
required: [],
|
|
37
|
-
},
|
|
38
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
39
|
-
const workspace = getWorkspace(config);
|
|
40
|
-
// Default to workspace root when no path given and workspace is configured
|
|
41
|
-
const rawPath = (params.path as string) ?? (workspace ? expandPath(workspace) : ".");
|
|
42
|
-
let dirPath: string;
|
|
43
|
-
try {
|
|
44
|
-
dirPath = resolveInWorkspace(rawPath, workspace);
|
|
45
|
-
} catch (e) {
|
|
46
|
-
return { ok: false, error: (e as Error).message };
|
|
47
|
-
}
|
|
48
|
-
const recursive = (params.recursive as boolean) ?? false;
|
|
49
|
-
const maxDepth = (params.maxDepth as number) ?? 3;
|
|
50
|
-
|
|
51
|
-
log.debug(`Listing directory: ${dirPath}`);
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
if (!fs.existsSync(dirPath)) {
|
|
55
|
-
return {
|
|
56
|
-
ok: false,
|
|
57
|
-
error: `Directory not found: ${dirPath}`,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const stats = fs.statSync(dirPath);
|
|
62
|
-
if (!stats.isDirectory()) {
|
|
63
|
-
return {
|
|
64
|
-
ok: false,
|
|
65
|
-
error: `Not a directory: ${dirPath}`,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
interface FileEntry {
|
|
70
|
-
name: string;
|
|
71
|
-
type: "file" | "directory";
|
|
72
|
-
path: string;
|
|
73
|
-
size?: number;
|
|
74
|
-
modified?: string;
|
|
75
|
-
children?: FileEntry[];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function listDir(dir: string, depth: number): FileEntry[] {
|
|
79
|
-
if (depth > maxDepth) return [];
|
|
80
|
-
|
|
81
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
82
|
-
return entries.map((entry) => {
|
|
83
|
-
const fullPath = path.join(dir, entry.name);
|
|
84
|
-
const result: FileEntry = {
|
|
85
|
-
name: entry.name,
|
|
86
|
-
type: entry.isDirectory() ? "directory" : "file",
|
|
87
|
-
path: fullPath,
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
if (entry.isDirectory() && recursive && depth < maxDepth) {
|
|
91
|
-
try {
|
|
92
|
-
const subStats = fs.statSync(fullPath);
|
|
93
|
-
result.size = subStats.size;
|
|
94
|
-
result.modified = subStats.mtime.toISOString();
|
|
95
|
-
result.children = listDir(fullPath, depth + 1);
|
|
96
|
-
} catch {
|
|
97
|
-
// Ignore permission errors
|
|
98
|
-
}
|
|
99
|
-
} else {
|
|
100
|
-
try {
|
|
101
|
-
const subStats = fs.statSync(fullPath);
|
|
102
|
-
result.size = subStats.size;
|
|
103
|
-
result.modified = subStats.mtime.toISOString();
|
|
104
|
-
} catch {
|
|
105
|
-
// Ignore permission errors
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return result;
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const entries = listDir(dirPath, 0);
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
ok: true,
|
|
117
|
-
path: dirPath,
|
|
118
|
-
entries,
|
|
119
|
-
count: entries.length,
|
|
120
|
-
};
|
|
121
|
-
} catch (error) {
|
|
122
|
-
log.error(`Error listing directory: ${(error as Error).message}`);
|
|
123
|
-
return {
|
|
124
|
-
ok: false,
|
|
125
|
-
error: `Failed to list directory: ${(error as Error).message}`,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* fs_read - Read file content from agent workspace
|
|
3
|
-
*
|
|
4
|
-
* @category filesystem
|
|
5
|
-
* @seedId fs_read
|
|
6
|
-
* @spanish leer archivo, ver contenido, abrir archivo
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { Tool } from "../types.ts";
|
|
10
|
-
import { logger } from "../../utils/logger.ts";
|
|
11
|
-
import { resolveInWorkspace, getWorkspace } from "./workspace-guard.ts";
|
|
12
|
-
|
|
13
|
-
const log = logger.child("fs-read");
|
|
14
|
-
|
|
15
|
-
export const fsReadTool: Tool = {
|
|
16
|
-
name: "fs_read",
|
|
17
|
-
description: "Read file content from agent workspace. Spanish: leer archivo, ver contenido, abrir archivo",
|
|
18
|
-
parameters: {
|
|
19
|
-
type: "object",
|
|
20
|
-
properties: {
|
|
21
|
-
path: {
|
|
22
|
-
type: "string",
|
|
23
|
-
description: "Path to the file to read",
|
|
24
|
-
},
|
|
25
|
-
offset: {
|
|
26
|
-
type: "number",
|
|
27
|
-
description: "Line number to start reading from (1-indexed, default: 1)",
|
|
28
|
-
},
|
|
29
|
-
limit: {
|
|
30
|
-
type: "number",
|
|
31
|
-
description: "Maximum number of lines to read (default: 2000)",
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
required: ["path"],
|
|
35
|
-
},
|
|
36
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
37
|
-
const workspace = getWorkspace(config);
|
|
38
|
-
let filePath: string;
|
|
39
|
-
try {
|
|
40
|
-
filePath = resolveInWorkspace(params.path as string, workspace);
|
|
41
|
-
} catch (e) {
|
|
42
|
-
return { ok: false, error: (e as Error).message };
|
|
43
|
-
}
|
|
44
|
-
const offset = (params.offset as number) ?? 1;
|
|
45
|
-
const limit = (params.limit as number) ?? 2000;
|
|
46
|
-
|
|
47
|
-
log.debug(`Reading file: ${filePath}`);
|
|
48
|
-
|
|
49
|
-
try {
|
|
50
|
-
const content = await Bun.file(filePath).text();
|
|
51
|
-
const lines = content.split("\n");
|
|
52
|
-
|
|
53
|
-
const start = Math.max(0, offset - 1);
|
|
54
|
-
const end = Math.min(lines.length, start + limit);
|
|
55
|
-
const selected = lines.slice(start, end);
|
|
56
|
-
|
|
57
|
-
return {
|
|
58
|
-
ok: true,
|
|
59
|
-
path: filePath,
|
|
60
|
-
content: selected.map((line, i) => `${start + i + 1}: ${line}`).join("\n"),
|
|
61
|
-
totalLines: lines.length,
|
|
62
|
-
linesRead: selected.length,
|
|
63
|
-
};
|
|
64
|
-
} catch (error) {
|
|
65
|
-
log.error(`Error reading file: ${(error as Error).message}`);
|
|
66
|
-
return {
|
|
67
|
-
ok: false,
|
|
68
|
-
error: `Failed to read file: ${(error as Error).message}`,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* fs_write - Create or overwrite file in agent workspace
|
|
3
|
-
*
|
|
4
|
-
* @category filesystem
|
|
5
|
-
* @seedId fs_write
|
|
6
|
-
* @spanish crear archivo, guardar archivo, escribir archivo
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { Tool } from "../types.ts";
|
|
10
|
-
import { logger } from "../../utils/logger.ts";
|
|
11
|
-
import { resolveInWorkspace, getWorkspace } from "./workspace-guard.ts";
|
|
12
|
-
import * as path from "node:path";
|
|
13
|
-
import * as fs from "node:fs";
|
|
14
|
-
|
|
15
|
-
const log = logger.child("fs-write");
|
|
16
|
-
|
|
17
|
-
export const fsWriteTool: Tool = {
|
|
18
|
-
name: "fs_write",
|
|
19
|
-
description: "Create or overwrite file in agent workspace. Spanish: crear archivo, guardar archivo, escribir archivo",
|
|
20
|
-
parameters: {
|
|
21
|
-
type: "object",
|
|
22
|
-
properties: {
|
|
23
|
-
path: {
|
|
24
|
-
type: "string",
|
|
25
|
-
description: "Path to the file to write",
|
|
26
|
-
},
|
|
27
|
-
content: {
|
|
28
|
-
type: "string",
|
|
29
|
-
description: "Content to write to the file",
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
required: ["path", "content"],
|
|
33
|
-
},
|
|
34
|
-
execute: async (params: Record<string, unknown>, config?: any) => {
|
|
35
|
-
const workspace = getWorkspace(config);
|
|
36
|
-
let filePath: string;
|
|
37
|
-
try {
|
|
38
|
-
filePath = resolveInWorkspace(params.path as string, workspace);
|
|
39
|
-
} catch (e) {
|
|
40
|
-
return { ok: false, error: (e as Error).message };
|
|
41
|
-
}
|
|
42
|
-
const content = params.content as string;
|
|
43
|
-
|
|
44
|
-
log.debug(`Writing file: ${filePath}`);
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
const dir = path.dirname(filePath);
|
|
48
|
-
if (!fs.existsSync(dir)) {
|
|
49
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
await Bun.write(filePath, content);
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
ok: true,
|
|
56
|
-
path: filePath,
|
|
57
|
-
bytesWritten: content.length,
|
|
58
|
-
};
|
|
59
|
-
} catch (error) {
|
|
60
|
-
log.error(`Error writing file: ${(error as Error).message}`);
|
|
61
|
-
return {
|
|
62
|
-
ok: false,
|
|
63
|
-
error: `Failed to write file: ${(error as Error).message}`,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filesystem Tools - 7 tools
|
|
3
|
-
*
|
|
4
|
-
* @category filesystem
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { Tool } from "../types.ts";
|
|
8
|
-
import { fsReadTool } from "./fs-read.ts";
|
|
9
|
-
import { fsWriteTool } from "./fs-write.ts";
|
|
10
|
-
import { fsEditTool } from "./fs-edit.ts";
|
|
11
|
-
import { fsDeleteTool } from "./fs-delete.ts";
|
|
12
|
-
import { fsListTool } from "./fs-list.ts";
|
|
13
|
-
import { fsGlobTool } from "./fs-glob.ts";
|
|
14
|
-
import { fsExistsTool } from "./fs-exists.ts";
|
|
15
|
-
|
|
16
|
-
export function createTools(): Tool[] {
|
|
17
|
-
return [
|
|
18
|
-
fsReadTool,
|
|
19
|
-
fsWriteTool,
|
|
20
|
-
fsEditTool,
|
|
21
|
-
fsDeleteTool,
|
|
22
|
-
fsListTool,
|
|
23
|
-
fsGlobTool,
|
|
24
|
-
fsExistsTool,
|
|
25
|
-
];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export * from "./fs-read.ts";
|
|
29
|
-
export * from "./fs-write.ts";
|
|
30
|
-
export * from "./fs-edit.ts";
|
|
31
|
-
export * from "./fs-delete.ts";
|
|
32
|
-
export * from "./fs-list.ts";
|
|
33
|
-
export * from "./fs-glob.ts";
|
|
34
|
-
export * from "./fs-exists.ts";
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Workspace Guard — enforces that filesystem tool paths stay inside the agent workspace.
|
|
3
|
-
*
|
|
4
|
-
* If the agent has no workspace configured the guard is a no-op and all paths are allowed.
|
|
5
|
-
* If a workspace is set, any path that resolves outside it is rejected with a clear error.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as path from "node:path"
|
|
9
|
-
import * as os from "node:os"
|
|
10
|
-
|
|
11
|
-
/** Expand ~ to the home directory */
|
|
12
|
-
export function expandPath(p: string): string {
|
|
13
|
-
if (p.startsWith("~")) {
|
|
14
|
-
return path.join(os.homedir(), p.slice(1))
|
|
15
|
-
}
|
|
16
|
-
return p
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Resolve a user-supplied path against the workspace root.
|
|
21
|
-
*
|
|
22
|
-
* - If `workspace` is not set (null / undefined / empty), all paths pass through unchanged.
|
|
23
|
-
* - Relative paths are resolved relative to `workspace`.
|
|
24
|
-
* - Absolute paths must be inside `workspace`; otherwise an error is thrown.
|
|
25
|
-
*
|
|
26
|
-
* @throws Error when the resolved path is outside the workspace.
|
|
27
|
-
*/
|
|
28
|
-
export function resolveInWorkspace(
|
|
29
|
-
filePath: string,
|
|
30
|
-
workspace: string | null | undefined
|
|
31
|
-
): string {
|
|
32
|
-
if (!workspace) {
|
|
33
|
-
// No workspace configured — allow any path
|
|
34
|
-
return filePath
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const wsRoot = path.resolve(expandPath(workspace))
|
|
38
|
-
|
|
39
|
-
let resolved: string
|
|
40
|
-
if (path.isAbsolute(filePath)) {
|
|
41
|
-
resolved = path.normalize(filePath)
|
|
42
|
-
} else {
|
|
43
|
-
resolved = path.resolve(wsRoot, filePath)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Ensure the resolved path is inside the workspace
|
|
47
|
-
const relative = path.relative(wsRoot, resolved)
|
|
48
|
-
if (relative.startsWith("..") || path.isAbsolute(relative)) {
|
|
49
|
-
throw new Error(
|
|
50
|
-
`[Workspace] Access denied: '${filePath}' resolves outside workspace '${wsRoot}'.`
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return resolved
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Extract workspace from tool config (passed by agent-loop as config.configurable.workspace).
|
|
59
|
-
*/
|
|
60
|
-
export function getWorkspace(config?: any): string | null | undefined {
|
|
61
|
-
return config?.configurable?.workspace ?? null
|
|
62
|
-
}
|