centaurus-cli 3.0.0 → 3.1.0
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/dist/ai/types.js +0 -1
- package/dist/ai/types.js.map +1 -1
- package/dist/cli-adapter.js +5047 -5037
- package/dist/cli-adapter.js.map +1 -1
- package/dist/commands/CommandParser.js +372 -315
- package/dist/commands/CommandParser.js.map +1 -1
- package/dist/config/build-config.js +11 -42
- package/dist/config/build-config.js.map +1 -1
- package/dist/config/defaultConfig.js +94 -82
- package/dist/config/defaultConfig.js.map +1 -1
- package/dist/config/manager.js +144 -160
- package/dist/config/manager.js.map +1 -1
- package/dist/config/mcp-config-manager.js +411 -364
- package/dist/config/mcp-config-manager.js.map +1 -1
- package/dist/config/models.js +118 -185
- package/dist/config/models.js.map +1 -1
- package/dist/config/slash-commands.js +186 -184
- package/dist/config/slash-commands.js.map +1 -1
- package/dist/config/types.js +33 -26
- package/dist/config/types.js.map +1 -1
- package/dist/context/command-detector.js +63 -67
- package/dist/context/command-detector.js.map +1 -1
- package/dist/context/context-manager.js +533 -518
- package/dist/context/context-manager.js.map +1 -1
- package/dist/context/handlers/docker-handler.js +518 -576
- package/dist/context/handlers/docker-handler.js.map +1 -1
- package/dist/context/handlers/ssh-handler.js +1050 -1109
- package/dist/context/handlers/ssh-handler.js.map +1 -1
- package/dist/context/handlers/wsl-handler.js +558 -630
- package/dist/context/handlers/wsl-handler.js.map +1 -1
- package/dist/context/index.js +42 -6
- package/dist/context/index.js.map +1 -1
- package/dist/context/subshell-handler.js +0 -4
- package/dist/context/subshell-handler.js.map +1 -1
- package/dist/context/types.js +20 -31
- package/dist/context/types.js.map +1 -1
- package/dist/hooks/useConnectivity.js +13 -10
- package/dist/hooks/useConnectivity.js.map +1 -1
- package/dist/hooks/useTerminalDimensions.js +67 -79
- package/dist/hooks/useTerminalDimensions.js.map +1 -1
- package/dist/index.js +228 -251
- package/dist/index.js.map +1 -1
- package/dist/mcp/mcp-command-handler.js +297 -260
- package/dist/mcp/mcp-command-handler.js.map +1 -1
- package/dist/mcp/mcp-server-manager.js +139 -155
- package/dist/mcp/mcp-server-manager.js.map +1 -1
- package/dist/mcp/mcp-tool-wrapper.js +74 -94
- package/dist/mcp/mcp-tool-wrapper.js.map +1 -1
- package/dist/services/ai-autocomplete-agent.js +169 -181
- package/dist/services/ai-autocomplete-agent.js.map +1 -1
- package/dist/services/ai-context-injector.js +180 -93
- package/dist/services/ai-context-injector.js.map +1 -1
- package/dist/services/ai-service-client.js +513 -456
- package/dist/services/ai-service-client.js.map +1 -1
- package/dist/services/api-client.js +443 -441
- package/dist/services/api-client.js.map +1 -1
- package/dist/services/auth-handler.js +162 -198
- package/dist/services/auth-handler.js.map +1 -1
- package/dist/services/background-task-manager.js +258 -282
- package/dist/services/background-task-manager.js.map +1 -1
- package/dist/services/checkpoint-manager.js +1513 -973
- package/dist/services/checkpoint-manager.js.map +1 -1
- package/dist/services/clipboard-service.js +151 -200
- package/dist/services/clipboard-service.js.map +1 -1
- package/dist/services/connectivity-manager.js +63 -65
- package/dist/services/connectivity-manager.js.map +1 -1
- package/dist/services/conversation-manager.js +118 -121
- package/dist/services/conversation-manager.js.map +1 -1
- package/dist/services/environment-context-injector.js +160 -187
- package/dist/services/environment-context-injector.js.map +1 -1
- package/dist/services/fast-context-agent.js +203 -243
- package/dist/services/fast-context-agent.js.map +1 -1
- package/dist/services/input-detection-agent.js +190 -202
- package/dist/services/input-detection-agent.js.map +1 -1
- package/dist/services/input-requirement-detector.js +155 -189
- package/dist/services/input-requirement-detector.js.map +1 -1
- package/dist/services/local-chat-storage.js +342 -365
- package/dist/services/local-chat-storage.js.map +1 -1
- package/dist/services/monitored-shell-manager.js +225 -233
- package/dist/services/monitored-shell-manager.js.map +1 -1
- package/dist/services/ollama-service.js +293 -310
- package/dist/services/ollama-service.js.map +1 -1
- package/dist/services/rules-storage.js +142 -0
- package/dist/services/rules-storage.js.map +1 -0
- package/dist/services/session-quota-manager.js +219 -235
- package/dist/services/session-quota-manager.js.map +1 -1
- package/dist/services/shell-input-agent.js +299 -334
- package/dist/services/shell-input-agent.js.map +1 -1
- package/dist/services/sub-agent-manager.js +459 -501
- package/dist/services/sub-agent-manager.js.map +1 -1
- package/dist/services/warpify-detector.js +133 -183
- package/dist/services/warpify-detector.js.map +1 -1
- package/dist/services/workflow-storage.js +202 -217
- package/dist/services/workflow-storage.js.map +1 -1
- package/dist/test-ssh-handler.js +148 -193
- package/dist/test-ssh-handler.js.map +1 -1
- package/dist/tools/add-mcp.js +161 -0
- package/dist/tools/add-mcp.js.map +1 -0
- package/dist/tools/background-command.js +240 -273
- package/dist/tools/background-command.js.map +1 -1
- package/dist/tools/command.js +447 -440
- package/dist/tools/command.js.map +1 -1
- package/dist/tools/create-image.js +172 -202
- package/dist/tools/create-image.js.map +1 -1
- package/dist/tools/enter-remote-session.js +169 -215
- package/dist/tools/enter-remote-session.js.map +1 -1
- package/dist/tools/fast-context.js +60 -67
- package/dist/tools/fast-context.js.map +1 -1
- package/dist/tools/file-ops.js +605 -537
- package/dist/tools/file-ops.js.map +1 -1
- package/dist/tools/find-files.js +262 -303
- package/dist/tools/find-files.js.map +1 -1
- package/dist/tools/get-diff.js +423 -400
- package/dist/tools/get-diff.js.map +1 -1
- package/dist/tools/grep-search.js +966 -948
- package/dist/tools/grep-search.js.map +1 -1
- package/dist/tools/inspect-symbol.js +308 -323
- package/dist/tools/inspect-symbol.js.map +1 -1
- package/dist/tools/plan-mode.js +459 -503
- package/dist/tools/plan-mode.js.map +1 -1
- package/dist/tools/read-binary-file.js +160 -190
- package/dist/tools/read-binary-file.js.map +1 -1
- package/dist/tools/registry.js +100 -84
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/reproduce_issue.js +170 -151
- package/dist/tools/reproduce_issue.js.map +1 -1
- package/dist/tools/sub-agent.js +223 -228
- package/dist/tools/sub-agent.js.map +1 -1
- package/dist/tools/task-complete.js +28 -27
- package/dist/tools/task-complete.js.map +1 -1
- package/dist/tools/types.js +0 -1
- package/dist/tools/types.js.map +1 -1
- package/dist/tools/validation.js +96 -118
- package/dist/tools/validation.js.map +1 -1
- package/dist/tools/web-search.js +194 -194
- package/dist/tools/web-search.js.map +1 -1
- package/dist/tools/workflow-tool.js +77 -82
- package/dist/tools/workflow-tool.js.map +1 -1
- package/dist/types/index.js +0 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/rule.js +1 -0
- package/dist/types/rule.js.map +1 -0
- package/dist/types/workflow.js +0 -7
- package/dist/types/workflow.js.map +1 -1
- package/dist/ui/components/AgentTimer.js +24 -25
- package/dist/ui/components/AgentTimer.js.map +1 -1
- package/dist/ui/components/App.js +3266 -3249
- package/dist/ui/components/App.js.map +1 -1
- package/dist/ui/components/AuthScreen.js +22 -34
- package/dist/ui/components/AuthScreen.js.map +1 -1
- package/dist/ui/components/AuthWelcomeScreen.js +30 -24
- package/dist/ui/components/AuthWelcomeScreen.js.map +1 -1
- package/dist/ui/components/Breadcrumbs.js +53 -82
- package/dist/ui/components/Breadcrumbs.js.map +1 -1
- package/dist/ui/components/CircularSelectInput.js +59 -67
- package/dist/ui/components/CircularSelectInput.js.map +1 -1
- package/dist/ui/components/ClipboardFileAutocomplete.js +78 -39
- package/dist/ui/components/ClipboardFileAutocomplete.js.map +1 -1
- package/dist/ui/components/CodeBlock.js +24 -42
- package/dist/ui/components/CodeBlock.js.map +1 -1
- package/dist/ui/components/ConfigViewer.js +18 -25
- package/dist/ui/components/ConfigViewer.js.map +1 -1
- package/dist/ui/components/ConfirmPrompt.js +49 -71
- package/dist/ui/components/ConfirmPrompt.js.map +1 -1
- package/dist/ui/components/ConnectionStatusMessage.js +32 -83
- package/dist/ui/components/ConnectionStatusMessage.js.map +1 -1
- package/dist/ui/components/ContextWindowIndicator.js +34 -49
- package/dist/ui/components/ContextWindowIndicator.js.map +1 -1
- package/dist/ui/components/DetailedPlanReviewScreen.js +104 -106
- package/dist/ui/components/DetailedPlanReviewScreen.js.map +1 -1
- package/dist/ui/components/DiffViewer.js +68 -121
- package/dist/ui/components/DiffViewer.js.map +1 -1
- package/dist/ui/components/ErrorBoundary.js +40 -48
- package/dist/ui/components/ErrorBoundary.js.map +1 -1
- package/dist/ui/components/FileCreationPreview.js +29 -60
- package/dist/ui/components/FileCreationPreview.js.map +1 -1
- package/dist/ui/components/FileOperation.js +34 -29
- package/dist/ui/components/FileOperation.js.map +1 -1
- package/dist/ui/components/FileTagAutocomplete.js +55 -25
- package/dist/ui/components/FileTagAutocomplete.js.map +1 -1
- package/dist/ui/components/FontRecommendation.js.map +1 -1
- package/dist/ui/components/GitDiffBreadcrumb.js +29 -0
- package/dist/ui/components/GitDiffBreadcrumb.js.map +1 -0
- package/dist/ui/components/InputBox.js +1620 -2150
- package/dist/ui/components/InputBox.js.map +1 -1
- package/dist/ui/components/InteractiveShell.js +234 -352
- package/dist/ui/components/InteractiveShell.js.map +1 -1
- package/dist/ui/components/KeyboardHelp.js +34 -35
- package/dist/ui/components/KeyboardHelp.js.map +1 -1
- package/dist/ui/components/LoadingIndicator.js +22 -25
- package/dist/ui/components/LoadingIndicator.js.map +1 -1
- package/dist/ui/components/MCPAddScreen.js +40 -51
- package/dist/ui/components/MCPAddScreen.js.map +1 -1
- package/dist/ui/components/MCPListScreen.js +40 -48
- package/dist/ui/components/MCPListScreen.js.map +1 -1
- package/dist/ui/components/MCPServerListScreen.js +49 -56
- package/dist/ui/components/MCPServerListScreen.js.map +1 -1
- package/dist/ui/components/MarkdownRenderer.js +69 -96
- package/dist/ui/components/MarkdownRenderer.js.map +1 -1
- package/dist/ui/components/MessageBox.js +66 -48
- package/dist/ui/components/MessageBox.js.map +1 -1
- package/dist/ui/components/MessageDisplay.js +150 -142
- package/dist/ui/components/MessageDisplay.js.map +1 -1
- package/dist/ui/components/MonitorModeAIPanel.js +46 -65
- package/dist/ui/components/MonitorModeAIPanel.js.map +1 -1
- package/dist/ui/components/MultiLineInput.js +243 -277
- package/dist/ui/components/MultiLineInput.js.map +1 -1
- package/dist/ui/components/PasswordPrompt.js +37 -18
- package/dist/ui/components/PasswordPrompt.js.map +1 -1
- package/dist/ui/components/PlanAcceptedMessage.js +27 -38
- package/dist/ui/components/PlanAcceptedMessage.js.map +1 -1
- package/dist/ui/components/PlanReviewScreen.js +46 -50
- package/dist/ui/components/PlanReviewScreen.js.map +1 -1
- package/dist/ui/components/RulesEditorScreen.js +81 -0
- package/dist/ui/components/RulesEditorScreen.js.map +1 -0
- package/dist/ui/components/SelectPrompt.js +19 -8
- package/dist/ui/components/SelectPrompt.js.map +1 -1
- package/dist/ui/components/ShimmerText.js +44 -0
- package/dist/ui/components/ShimmerText.js.map +1 -0
- package/dist/ui/components/SlashCommandAutocomplete.js +49 -22
- package/dist/ui/components/SlashCommandAutocomplete.js.map +1 -1
- package/dist/ui/components/StatusBar.js +56 -87
- package/dist/ui/components/StatusBar.js.map +1 -1
- package/dist/ui/components/StreamingMessageDisplay.js +116 -99
- package/dist/ui/components/StreamingMessageDisplay.js.map +1 -1
- package/dist/ui/components/TaskCompletedMessage.js +28 -23
- package/dist/ui/components/TaskCompletedMessage.js.map +1 -1
- package/dist/ui/components/TaskProgressIndicator.js +44 -70
- package/dist/ui/components/TaskProgressIndicator.js.map +1 -1
- package/dist/ui/components/ThinkingDisplay.js +44 -41
- package/dist/ui/components/ThinkingDisplay.js.map +1 -1
- package/dist/ui/components/ToolExecutionMessage.js +772 -1326
- package/dist/ui/components/ToolExecutionMessage.js.map +1 -1
- package/dist/ui/components/ToolExecutionStatus.js +53 -84
- package/dist/ui/components/ToolExecutionStatus.js.map +1 -1
- package/dist/ui/components/ToolResult.js +22 -15
- package/dist/ui/components/ToolResult.js.map +1 -1
- package/dist/ui/components/VersionUpdatePrompt.js +88 -120
- package/dist/ui/components/VersionUpdatePrompt.js.map +1 -1
- package/dist/ui/components/WelcomeBanner.js +176 -26
- package/dist/ui/components/WelcomeBanner.js.map +1 -1
- package/dist/ui/components/WorkflowCreatorScreen.js +94 -161
- package/dist/ui/components/WorkflowCreatorScreen.js.map +1 -1
- package/dist/utils/ansi-encoder.js +30 -61
- package/dist/utils/ansi-encoder.js.map +1 -1
- package/dist/utils/chat-formatter.js +327 -305
- package/dist/utils/chat-formatter.js.map +1 -1
- package/dist/utils/command-history.js +152 -174
- package/dist/utils/command-history.js.map +1 -1
- package/dist/utils/context-sanitizer.js +49 -112
- package/dist/utils/context-sanitizer.js.map +1 -1
- package/dist/utils/conversation-logger.js +292 -324
- package/dist/utils/conversation-logger.js.map +1 -1
- package/dist/utils/custom-commands-manager.js +126 -131
- package/dist/utils/custom-commands-manager.js.map +1 -1
- package/dist/utils/editor-utils.js +732 -837
- package/dist/utils/editor-utils.js.map +1 -1
- package/dist/utils/file.js +174 -213
- package/dist/utils/file.js.map +1 -1
- package/dist/utils/git-stats.js +169 -0
- package/dist/utils/git-stats.js.map +1 -0
- package/dist/utils/input-classifier.js +960 -482
- package/dist/utils/input-classifier.js.map +1 -1
- package/dist/utils/logger.js +48 -73
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/markdown-parser.js +277 -310
- package/dist/utils/markdown-parser.js.map +1 -1
- package/dist/utils/rule-reference-resolver.js +54 -0
- package/dist/utils/rule-reference-resolver.js.map +1 -0
- package/dist/utils/shell.js +144 -156
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/state.js +23 -22
- package/dist/utils/state.js.map +1 -1
- package/dist/utils/syntax-checker.js +279 -327
- package/dist/utils/syntax-checker.js.map +1 -1
- package/dist/utils/terminal-output.js +199 -302
- package/dist/utils/terminal-output.js.map +1 -1
- package/dist/utils/text-clipboard.js +47 -70
- package/dist/utils/text-clipboard.js.map +1 -1
- package/dist/utils/unicode-sanitizer.js +134 -197
- package/dist/utils/unicode-sanitizer.js.map +1 -1
- package/dist/utils/version-checker.js +46 -56
- package/dist/utils/version-checker.js.map +1 -1
- package/package.json +6 -4
- package/dist/ai/types.d.ts +0 -20
- package/dist/ai/types.d.ts.map +0 -1
- package/dist/cli-adapter.d.ts +0 -511
- package/dist/cli-adapter.d.ts.map +0 -1
- package/dist/commands/CommandParser.d.ts +0 -27
- package/dist/commands/CommandParser.d.ts.map +0 -1
- package/dist/config/build-config.d.ts +0 -42
- package/dist/config/build-config.d.ts.map +0 -1
- package/dist/config/defaultConfig.d.ts +0 -79
- package/dist/config/defaultConfig.d.ts.map +0 -1
- package/dist/config/manager.d.ts +0 -62
- package/dist/config/manager.d.ts.map +0 -1
- package/dist/config/mcp-config-manager.d.ts +0 -79
- package/dist/config/mcp-config-manager.d.ts.map +0 -1
- package/dist/config/models.d.ts +0 -83
- package/dist/config/models.d.ts.map +0 -1
- package/dist/config/slash-commands.d.ts +0 -23
- package/dist/config/slash-commands.d.ts.map +0 -1
- package/dist/config/types.d.ts +0 -35
- package/dist/config/types.d.ts.map +0 -1
- package/dist/context/command-detector.d.ts +0 -50
- package/dist/context/command-detector.d.ts.map +0 -1
- package/dist/context/context-manager.d.ts +0 -157
- package/dist/context/context-manager.d.ts.map +0 -1
- package/dist/context/handlers/docker-handler.d.ts +0 -130
- package/dist/context/handlers/docker-handler.d.ts.map +0 -1
- package/dist/context/handlers/ssh-handler.d.ts +0 -201
- package/dist/context/handlers/ssh-handler.d.ts.map +0 -1
- package/dist/context/handlers/wsl-handler.d.ts +0 -146
- package/dist/context/handlers/wsl-handler.d.ts.map +0 -1
- package/dist/context/index.d.ts +0 -8
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/subshell-handler.d.ts +0 -165
- package/dist/context/subshell-handler.d.ts.map +0 -1
- package/dist/context/types.d.ts +0 -70
- package/dist/context/types.d.ts.map +0 -1
- package/dist/hooks/useConnectivity.d.ts +0 -2
- package/dist/hooks/useConnectivity.d.ts.map +0 -1
- package/dist/hooks/useTerminalDimensions.d.ts +0 -41
- package/dist/hooks/useTerminalDimensions.d.ts.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/mcp/mcp-command-handler.d.ts +0 -47
- package/dist/mcp/mcp-command-handler.d.ts.map +0 -1
- package/dist/mcp/mcp-server-manager.d.ts +0 -30
- package/dist/mcp/mcp-server-manager.d.ts.map +0 -1
- package/dist/mcp/mcp-tool-wrapper.d.ts +0 -12
- package/dist/mcp/mcp-tool-wrapper.d.ts.map +0 -1
- package/dist/services/ai-autocomplete-agent.d.ts +0 -39
- package/dist/services/ai-autocomplete-agent.d.ts.map +0 -1
- package/dist/services/ai-context-injector.d.ts +0 -41
- package/dist/services/ai-context-injector.d.ts.map +0 -1
- package/dist/services/ai-service-client.d.ts +0 -128
- package/dist/services/ai-service-client.d.ts.map +0 -1
- package/dist/services/api-client.d.ts +0 -353
- package/dist/services/api-client.d.ts.map +0 -1
- package/dist/services/auth-handler.d.ts +0 -30
- package/dist/services/auth-handler.d.ts.map +0 -1
- package/dist/services/background-task-manager.d.ts +0 -114
- package/dist/services/background-task-manager.d.ts.map +0 -1
- package/dist/services/checkpoint-manager.d.ts +0 -167
- package/dist/services/checkpoint-manager.d.ts.map +0 -1
- package/dist/services/clipboard-service.d.ts +0 -37
- package/dist/services/clipboard-service.d.ts.map +0 -1
- package/dist/services/connectivity-manager.d.ts +0 -18
- package/dist/services/connectivity-manager.d.ts.map +0 -1
- package/dist/services/conversation-manager.d.ts +0 -73
- package/dist/services/conversation-manager.d.ts.map +0 -1
- package/dist/services/environment-context-injector.d.ts +0 -69
- package/dist/services/environment-context-injector.d.ts.map +0 -1
- package/dist/services/fast-context-agent.d.ts +0 -12
- package/dist/services/fast-context-agent.d.ts.map +0 -1
- package/dist/services/input-detection-agent.d.ts +0 -40
- package/dist/services/input-detection-agent.d.ts.map +0 -1
- package/dist/services/input-requirement-detector.d.ts +0 -28
- package/dist/services/input-requirement-detector.d.ts.map +0 -1
- package/dist/services/local-chat-storage.d.ts +0 -182
- package/dist/services/local-chat-storage.d.ts.map +0 -1
- package/dist/services/monitored-shell-manager.d.ts +0 -120
- package/dist/services/monitored-shell-manager.d.ts.map +0 -1
- package/dist/services/ollama-service.d.ts +0 -197
- package/dist/services/ollama-service.d.ts.map +0 -1
- package/dist/services/session-quota-manager.d.ts +0 -101
- package/dist/services/session-quota-manager.d.ts.map +0 -1
- package/dist/services/shell-input-agent.d.ts +0 -89
- package/dist/services/shell-input-agent.d.ts.map +0 -1
- package/dist/services/sub-agent-manager.d.ts +0 -140
- package/dist/services/sub-agent-manager.d.ts.map +0 -1
- package/dist/services/warpify-detector.d.ts +0 -43
- package/dist/services/warpify-detector.d.ts.map +0 -1
- package/dist/services/workflow-storage.d.ts +0 -72
- package/dist/services/workflow-storage.d.ts.map +0 -1
- package/dist/test-ssh-handler.d.ts +0 -8
- package/dist/test-ssh-handler.d.ts.map +0 -1
- package/dist/tools/background-command.d.ts +0 -11
- package/dist/tools/background-command.d.ts.map +0 -1
- package/dist/tools/command.d.ts +0 -3
- package/dist/tools/command.d.ts.map +0 -1
- package/dist/tools/create-image.d.ts +0 -10
- package/dist/tools/create-image.d.ts.map +0 -1
- package/dist/tools/enter-remote-session.d.ts +0 -48
- package/dist/tools/enter-remote-session.d.ts.map +0 -1
- package/dist/tools/fast-context.d.ts +0 -3
- package/dist/tools/fast-context.d.ts.map +0 -1
- package/dist/tools/file-ops.d.ts +0 -7
- package/dist/tools/file-ops.d.ts.map +0 -1
- package/dist/tools/find-files.d.ts +0 -49
- package/dist/tools/find-files.d.ts.map +0 -1
- package/dist/tools/get-diff.d.ts +0 -14
- package/dist/tools/get-diff.d.ts.map +0 -1
- package/dist/tools/grep-search.d.ts +0 -155
- package/dist/tools/grep-search.d.ts.map +0 -1
- package/dist/tools/inspect-symbol.d.ts +0 -32
- package/dist/tools/inspect-symbol.d.ts.map +0 -1
- package/dist/tools/plan-mode.d.ts +0 -140
- package/dist/tools/plan-mode.d.ts.map +0 -1
- package/dist/tools/read-binary-file.d.ts +0 -10
- package/dist/tools/read-binary-file.d.ts.map +0 -1
- package/dist/tools/registry.d.ts +0 -31
- package/dist/tools/registry.d.ts.map +0 -1
- package/dist/tools/reproduce_issue.d.ts +0 -2
- package/dist/tools/reproduce_issue.d.ts.map +0 -1
- package/dist/tools/sub-agent.d.ts +0 -9
- package/dist/tools/sub-agent.d.ts.map +0 -1
- package/dist/tools/task-complete.d.ts +0 -3
- package/dist/tools/task-complete.d.ts.map +0 -1
- package/dist/tools/types.d.ts +0 -40
- package/dist/tools/types.d.ts.map +0 -1
- package/dist/tools/validation.d.ts +0 -47
- package/dist/tools/validation.d.ts.map +0 -1
- package/dist/tools/web-search.d.ts +0 -24
- package/dist/tools/web-search.d.ts.map +0 -1
- package/dist/tools/workflow-tool.d.ts +0 -11
- package/dist/tools/workflow-tool.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -123
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/workflow.d.ts +0 -110
- package/dist/types/workflow.d.ts.map +0 -1
- package/dist/ui/components/AgentTimer.d.ts +0 -7
- package/dist/ui/components/AgentTimer.d.ts.map +0 -1
- package/dist/ui/components/App.d.ts +0 -197
- package/dist/ui/components/App.d.ts.map +0 -1
- package/dist/ui/components/AuthScreen.d.ts +0 -8
- package/dist/ui/components/AuthScreen.d.ts.map +0 -1
- package/dist/ui/components/AuthWelcomeScreen.d.ts +0 -8
- package/dist/ui/components/AuthWelcomeScreen.d.ts.map +0 -1
- package/dist/ui/components/Breadcrumbs.d.ts +0 -13
- package/dist/ui/components/Breadcrumbs.d.ts.map +0 -1
- package/dist/ui/components/CircularSelectInput.d.ts +0 -24
- package/dist/ui/components/CircularSelectInput.d.ts.map +0 -1
- package/dist/ui/components/ClipboardFileAutocomplete.d.ts +0 -10
- package/dist/ui/components/ClipboardFileAutocomplete.d.ts.map +0 -1
- package/dist/ui/components/CodeBlock.d.ts +0 -9
- package/dist/ui/components/CodeBlock.d.ts.map +0 -1
- package/dist/ui/components/ConfigViewer.d.ts +0 -11
- package/dist/ui/components/ConfigViewer.d.ts.map +0 -1
- package/dist/ui/components/ConfirmPrompt.d.ts +0 -13
- package/dist/ui/components/ConfirmPrompt.d.ts.map +0 -1
- package/dist/ui/components/ConnectionStatusMessage.d.ts +0 -17
- package/dist/ui/components/ConnectionStatusMessage.d.ts.map +0 -1
- package/dist/ui/components/ContextWindowIndicator.d.ts +0 -8
- package/dist/ui/components/ContextWindowIndicator.d.ts.map +0 -1
- package/dist/ui/components/DetailedPlanReviewScreen.d.ts +0 -17
- package/dist/ui/components/DetailedPlanReviewScreen.d.ts.map +0 -1
- package/dist/ui/components/DiffViewer.d.ts +0 -9
- package/dist/ui/components/DiffViewer.d.ts.map +0 -1
- package/dist/ui/components/ErrorBoundary.d.ts +0 -17
- package/dist/ui/components/ErrorBoundary.d.ts.map +0 -1
- package/dist/ui/components/FileCreationPreview.d.ts +0 -8
- package/dist/ui/components/FileCreationPreview.d.ts.map +0 -1
- package/dist/ui/components/FileOperation.d.ts +0 -10
- package/dist/ui/components/FileOperation.d.ts.map +0 -1
- package/dist/ui/components/FileTagAutocomplete.d.ts +0 -11
- package/dist/ui/components/FileTagAutocomplete.d.ts.map +0 -1
- package/dist/ui/components/FontRecommendation.d.ts +0 -1
- package/dist/ui/components/FontRecommendation.d.ts.map +0 -1
- package/dist/ui/components/InputBox.d.ts +0 -42
- package/dist/ui/components/InputBox.d.ts.map +0 -1
- package/dist/ui/components/InteractiveShell.d.ts +0 -30
- package/dist/ui/components/InteractiveShell.d.ts.map +0 -1
- package/dist/ui/components/KeyboardHelp.d.ts +0 -7
- package/dist/ui/components/KeyboardHelp.d.ts.map +0 -1
- package/dist/ui/components/LoadingIndicator.d.ts +0 -3
- package/dist/ui/components/LoadingIndicator.d.ts.map +0 -1
- package/dist/ui/components/MCPAddScreen.d.ts +0 -13
- package/dist/ui/components/MCPAddScreen.d.ts.map +0 -1
- package/dist/ui/components/MCPListScreen.d.ts +0 -17
- package/dist/ui/components/MCPListScreen.d.ts.map +0 -1
- package/dist/ui/components/MCPServerListScreen.d.ts +0 -16
- package/dist/ui/components/MCPServerListScreen.d.ts.map +0 -1
- package/dist/ui/components/MarkdownRenderer.d.ts +0 -8
- package/dist/ui/components/MarkdownRenderer.d.ts.map +0 -1
- package/dist/ui/components/MessageBox.d.ts +0 -10
- package/dist/ui/components/MessageBox.d.ts.map +0 -1
- package/dist/ui/components/MessageDisplay.d.ts +0 -14
- package/dist/ui/components/MessageDisplay.d.ts.map +0 -1
- package/dist/ui/components/MonitorModeAIPanel.d.ts +0 -23
- package/dist/ui/components/MonitorModeAIPanel.d.ts.map +0 -1
- package/dist/ui/components/MultiLineInput.d.ts +0 -13
- package/dist/ui/components/MultiLineInput.d.ts.map +0 -1
- package/dist/ui/components/PasswordPrompt.d.ts +0 -9
- package/dist/ui/components/PasswordPrompt.d.ts.map +0 -1
- package/dist/ui/components/PlanAcceptedMessage.d.ts +0 -20
- package/dist/ui/components/PlanAcceptedMessage.d.ts.map +0 -1
- package/dist/ui/components/PlanReviewScreen.d.ts +0 -14
- package/dist/ui/components/PlanReviewScreen.d.ts.map +0 -1
- package/dist/ui/components/SelectPrompt.d.ts +0 -12
- package/dist/ui/components/SelectPrompt.d.ts.map +0 -1
- package/dist/ui/components/SlashCommandAutocomplete.d.ts +0 -13
- package/dist/ui/components/SlashCommandAutocomplete.d.ts.map +0 -1
- package/dist/ui/components/StatusBar.d.ts +0 -14
- package/dist/ui/components/StatusBar.d.ts.map +0 -1
- package/dist/ui/components/StreamingMessageDisplay.d.ts +0 -15
- package/dist/ui/components/StreamingMessageDisplay.d.ts.map +0 -1
- package/dist/ui/components/TaskCompletedMessage.d.ts +0 -14
- package/dist/ui/components/TaskCompletedMessage.d.ts.map +0 -1
- package/dist/ui/components/TaskProgressIndicator.d.ts +0 -18
- package/dist/ui/components/TaskProgressIndicator.d.ts.map +0 -1
- package/dist/ui/components/ThinkingDisplay.d.ts +0 -15
- package/dist/ui/components/ThinkingDisplay.d.ts.map +0 -1
- package/dist/ui/components/ToolExecutionMessage.d.ts +0 -8
- package/dist/ui/components/ToolExecutionMessage.d.ts.map +0 -1
- package/dist/ui/components/ToolExecutionStatus.d.ts +0 -10
- package/dist/ui/components/ToolExecutionStatus.d.ts.map +0 -1
- package/dist/ui/components/ToolResult.d.ts +0 -10
- package/dist/ui/components/ToolResult.d.ts.map +0 -1
- package/dist/ui/components/VersionUpdatePrompt.d.ts +0 -9
- package/dist/ui/components/VersionUpdatePrompt.d.ts.map +0 -1
- package/dist/ui/components/WelcomeBanner.d.ts +0 -3
- package/dist/ui/components/WelcomeBanner.d.ts.map +0 -1
- package/dist/ui/components/WorkflowCreatorScreen.d.ts +0 -25
- package/dist/ui/components/WorkflowCreatorScreen.d.ts.map +0 -1
- package/dist/utils/ansi-encoder.d.ts +0 -7
- package/dist/utils/ansi-encoder.d.ts.map +0 -1
- package/dist/utils/chat-formatter.d.ts +0 -12
- package/dist/utils/chat-formatter.d.ts.map +0 -1
- package/dist/utils/command-history.d.ts +0 -24
- package/dist/utils/command-history.d.ts.map +0 -1
- package/dist/utils/context-sanitizer.d.ts +0 -50
- package/dist/utils/context-sanitizer.d.ts.map +0 -1
- package/dist/utils/conversation-logger.d.ts +0 -142
- package/dist/utils/conversation-logger.d.ts.map +0 -1
- package/dist/utils/custom-commands-manager.d.ts +0 -59
- package/dist/utils/custom-commands-manager.d.ts.map +0 -1
- package/dist/utils/editor-utils.d.ts +0 -101
- package/dist/utils/editor-utils.d.ts.map +0 -1
- package/dist/utils/file.d.ts +0 -61
- package/dist/utils/file.d.ts.map +0 -1
- package/dist/utils/input-classifier.d.ts +0 -25
- package/dist/utils/input-classifier.d.ts.map +0 -1
- package/dist/utils/logger.d.ts +0 -17
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/markdown-parser.d.ts +0 -60
- package/dist/utils/markdown-parser.d.ts.map +0 -1
- package/dist/utils/shell.d.ts +0 -47
- package/dist/utils/shell.d.ts.map +0 -1
- package/dist/utils/state.d.ts +0 -13
- package/dist/utils/state.d.ts.map +0 -1
- package/dist/utils/syntax-checker.d.ts +0 -24
- package/dist/utils/syntax-checker.d.ts.map +0 -1
- package/dist/utils/terminal-output.d.ts +0 -25
- package/dist/utils/terminal-output.d.ts.map +0 -1
- package/dist/utils/text-clipboard.d.ts +0 -12
- package/dist/utils/text-clipboard.d.ts.map +0 -1
- package/dist/utils/unicode-sanitizer.d.ts +0 -44
- package/dist/utils/unicode-sanitizer.d.ts.map +0 -1
- package/dist/utils/version-checker.d.ts +0 -14
- package/dist/utils/version-checker.d.ts.map +0 -1
|
@@ -1,226 +1,180 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
* Password prompts are handled by the existing password request callback,
|
|
9
|
-
* which prompts the user for input when needed.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Parse connection string from SSH command
|
|
13
|
-
* Examples:
|
|
14
|
-
* "ssh rohan@192.168.1.100" -> "rohan@192.168.1.100"
|
|
15
|
-
* "ssh -p 22 rohan@localhost" -> "rohan@localhost"
|
|
16
|
-
* "ssh -i ~/.ssh/id_rsa user@host" -> "user@host"
|
|
17
|
-
*/
|
|
18
|
-
export function parseSSHConnectionString(command) {
|
|
19
|
-
// Match user@host pattern in the command
|
|
20
|
-
const match = command.match(/(\S+)@(\S+)/);
|
|
21
|
-
if (match) {
|
|
22
|
-
return match[0];
|
|
23
|
-
}
|
|
24
|
-
return undefined;
|
|
1
|
+
function parseSSHConnectionString(command) {
|
|
2
|
+
const match = command.match(/(\S+)@(\S+)/);
|
|
3
|
+
if (match) {
|
|
4
|
+
return match[0];
|
|
5
|
+
}
|
|
6
|
+
return void 0;
|
|
25
7
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return execMatch[1];
|
|
37
|
-
}
|
|
38
|
-
// docker run pattern
|
|
39
|
-
const runMatch = command.match(/docker\s+run\s+(?:-\w+(?:\s+\S+)?\s+)*(\S+)/i);
|
|
40
|
-
if (runMatch) {
|
|
41
|
-
return runMatch[1];
|
|
42
|
-
}
|
|
43
|
-
return undefined;
|
|
8
|
+
function parseDockerContainer(command) {
|
|
9
|
+
const execMatch = command.match(/docker\s+exec\s+(?:-\w+\s+)*(\S+)/i);
|
|
10
|
+
if (execMatch) {
|
|
11
|
+
return execMatch[1];
|
|
12
|
+
}
|
|
13
|
+
const runMatch = command.match(/docker\s+run\s+(?:-\w+(?:\s+\S+)?\s+)*(\S+)/i);
|
|
14
|
+
if (runMatch) {
|
|
15
|
+
return runMatch[1];
|
|
16
|
+
}
|
|
17
|
+
return void 0;
|
|
44
18
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
export function parseWSLDistro(command) {
|
|
52
|
-
const match = command.match(/wsl\s+(?:-d|--distribution)\s+(\S+)/i);
|
|
53
|
-
if (match) {
|
|
54
|
-
return match[1];
|
|
55
|
-
}
|
|
56
|
-
return 'Ubuntu'; // Default distro
|
|
19
|
+
function parseWSLDistro(command) {
|
|
20
|
+
const match = command.match(/wsl\s+(?:-d|--distribution)\s+(\S+)/i);
|
|
21
|
+
if (match) {
|
|
22
|
+
return match[1];
|
|
23
|
+
}
|
|
24
|
+
return "Ubuntu";
|
|
57
25
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
return { valid: true };
|
|
26
|
+
function validateCommand(command, sessionType) {
|
|
27
|
+
const trimmedCommand = command.trim().toLowerCase();
|
|
28
|
+
switch (sessionType) {
|
|
29
|
+
case "ssh":
|
|
30
|
+
if (!trimmedCommand.startsWith("ssh ") && trimmedCommand !== "ssh") {
|
|
31
|
+
return { valid: false, error: 'SSH command must start with "ssh"' };
|
|
32
|
+
}
|
|
33
|
+
if (!command.match(/\S+@\S+/) && !command.match(/ssh\s+\S+/)) {
|
|
34
|
+
return { valid: false, error: 'SSH command must specify a host (e.g., "ssh user@host")' };
|
|
35
|
+
}
|
|
36
|
+
break;
|
|
37
|
+
case "docker":
|
|
38
|
+
if (!trimmedCommand.startsWith("docker ")) {
|
|
39
|
+
return { valid: false, error: 'Docker command must start with "docker"' };
|
|
40
|
+
}
|
|
41
|
+
if (!trimmedCommand.includes("exec") && !trimmedCommand.includes("run")) {
|
|
42
|
+
return { valid: false, error: 'Docker command must use "exec" or "run" (e.g., "docker exec -it container bash")' };
|
|
43
|
+
}
|
|
44
|
+
break;
|
|
45
|
+
case "wsl":
|
|
46
|
+
if (!trimmedCommand.startsWith("wsl") && trimmedCommand !== "bash") {
|
|
47
|
+
return { valid: false, error: 'WSL command must start with "wsl" or be "bash"' };
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
return { valid: true };
|
|
88
52
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
default:
|
|
101
|
-
return undefined;
|
|
102
|
-
}
|
|
53
|
+
function getConnectionString(command, sessionType) {
|
|
54
|
+
switch (sessionType) {
|
|
55
|
+
case "ssh":
|
|
56
|
+
return parseSSHConnectionString(command);
|
|
57
|
+
case "docker":
|
|
58
|
+
return parseDockerContainer(command);
|
|
59
|
+
case "wsl":
|
|
60
|
+
return parseWSLDistro(command);
|
|
61
|
+
default:
|
|
62
|
+
return void 0;
|
|
63
|
+
}
|
|
103
64
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
ACTIONS:
|
|
110
|
-
- enter: Switch context to a remote session. All subsequent commands will run in the remote environment.
|
|
111
|
-
- exit: Exit the current remote session and return to the parent environment.
|
|
112
|
-
|
|
113
|
-
**Enter action**:
|
|
114
|
-
After the tool executes successfully:
|
|
115
|
-
- All subsequent commands will run in the remote environment
|
|
116
|
-
- The working directory will change to the remote system's directory
|
|
117
|
-
- File operations will target remote files
|
|
118
|
-
|
|
119
|
-
Examples:
|
|
120
|
-
- SSH: action="enter", session_type="ssh", command="ssh rohan@192.168.1.100"
|
|
121
|
-
- Docker: action="enter", session_type="docker", command="docker exec -it mycontainer bash"
|
|
122
|
-
- WSL: action="enter", session_type="wsl", command="wsl -d Ubuntu"
|
|
123
|
-
|
|
124
|
-
**Exit action**:
|
|
125
|
-
Exits the current remote session and returns to the parent environment (local or outer remote session).
|
|
126
|
-
- Example: action="exit"
|
|
127
|
-
|
|
128
|
-
IMPORTANT:
|
|
129
|
-
- You CANNOT run raw ssh/docker/wsl commands via execute_command. Use this tool instead.
|
|
130
|
-
- To exit a remote session, use action="exit" instead of running the "exit" command.
|
|
65
|
+
const enterRemoteSessionTool = {
|
|
66
|
+
schema: {
|
|
67
|
+
name: "enter_remote_session",
|
|
68
|
+
description: `Manage remote environment sessions (SSH, Docker, or WSL).
|
|
69
|
+
|
|
70
|
+
ACTIONS:
|
|
71
|
+
- enter: Switch context to a remote session. All subsequent commands will run in the remote environment.
|
|
72
|
+
- exit: Exit the current remote session and return to the parent environment.
|
|
73
|
+
|
|
74
|
+
**Enter action**:
|
|
75
|
+
After the tool executes successfully:
|
|
76
|
+
- All subsequent commands will run in the remote environment
|
|
77
|
+
- The working directory will change to the remote system's directory
|
|
78
|
+
- File operations will target remote files
|
|
79
|
+
|
|
80
|
+
Examples:
|
|
81
|
+
- SSH: action="enter", session_type="ssh", command="ssh rohan@192.168.1.100"
|
|
82
|
+
- Docker: action="enter", session_type="docker", command="docker exec -it mycontainer bash"
|
|
83
|
+
- WSL: action="enter", session_type="wsl", command="wsl -d Ubuntu"
|
|
84
|
+
|
|
85
|
+
**Exit action**:
|
|
86
|
+
Exits the current remote session and returns to the parent environment (local or outer remote session).
|
|
87
|
+
- Example: action="exit"
|
|
88
|
+
|
|
89
|
+
IMPORTANT:
|
|
90
|
+
- You CANNOT run raw ssh/docker/wsl commands via execute_command. Use this tool instead.
|
|
91
|
+
- To exit a remote session, use action="exit" instead of running the "exit" command.
|
|
131
92
|
- Password prompts go to the user; the tool will wait for user input.`,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
required: ['action', 'reason_text']
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
async execute(args, context) {
|
|
158
|
-
const { action, session_type, command } = args;
|
|
159
|
-
// Check if cliAdapter is available
|
|
160
|
-
if (!context.cliAdapter) {
|
|
161
|
-
return 'Error: CLI adapter not available. Cannot manage remote session.';
|
|
162
|
-
}
|
|
163
|
-
// Handle exit action
|
|
164
|
-
if (action === 'exit') {
|
|
165
|
-
// Check if exitRemoteSession method exists
|
|
166
|
-
if (typeof context.cliAdapter.exitRemoteSession !== 'function') {
|
|
167
|
-
return 'Error: exitRemoteSession method not available on CLI adapter.';
|
|
168
|
-
}
|
|
169
|
-
try {
|
|
170
|
-
const success = await context.cliAdapter.exitRemoteSession();
|
|
171
|
-
if (success) {
|
|
172
|
-
return 'Successfully exited remote session. Commands will now execute in the parent environment.';
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
return 'No remote session to exit. Already in local environment.';
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
catch (error) {
|
|
179
|
-
const errorMessage = error?.message || String(error);
|
|
180
|
-
return `Error exiting remote session: ${errorMessage}`;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
// Handle enter action (default behavior)
|
|
184
|
-
// Validate session type
|
|
185
|
-
const validTypes = ['ssh', 'docker', 'wsl'];
|
|
186
|
-
if (!validTypes.includes(session_type)) {
|
|
187
|
-
return `Error: Invalid session_type "${session_type}". Must be one of: ssh, docker, wsl`;
|
|
188
|
-
}
|
|
189
|
-
if (!command) {
|
|
190
|
-
return 'Error: command is required for the "enter" action.';
|
|
191
|
-
}
|
|
192
|
-
// Validate command matches session type
|
|
193
|
-
const validation = validateCommand(command, session_type);
|
|
194
|
-
if (!validation.valid) {
|
|
195
|
-
return `Error: ${validation.error}`;
|
|
93
|
+
parameters: {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {
|
|
96
|
+
action: {
|
|
97
|
+
type: "string",
|
|
98
|
+
enum: ["enter", "exit"],
|
|
99
|
+
description: 'The action to perform: "enter" to connect to a remote session, "exit" to leave the current remote session.'
|
|
100
|
+
},
|
|
101
|
+
reason_text: {
|
|
102
|
+
type: "string",
|
|
103
|
+
description: "A short, user-facing explanation of why you are entering/exiting this remote session."
|
|
104
|
+
},
|
|
105
|
+
session_type: {
|
|
106
|
+
type: "string",
|
|
107
|
+
enum: ["ssh", "docker", "wsl"],
|
|
108
|
+
description: 'The type of remote session to enter. Required for "enter" action.'
|
|
109
|
+
},
|
|
110
|
+
command: {
|
|
111
|
+
type: "string",
|
|
112
|
+
description: 'The full command to establish the connection. Required for "enter" action. For SSH: "ssh user@host". For Docker: "docker exec -it container bash". For WSL: "wsl".'
|
|
196
113
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
else {
|
|
217
|
-
return `Failed to enter remote session. Check the connection details and try again. The connection may have been rejected or timed out.`;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
catch (error) {
|
|
221
|
-
const errorMessage = error?.message || String(error);
|
|
222
|
-
return `Error entering remote session: ${errorMessage}`;
|
|
114
|
+
},
|
|
115
|
+
required: ["action", "reason_text"]
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
async execute(args, context) {
|
|
119
|
+
const { action, session_type, command } = args;
|
|
120
|
+
if (!context.cliAdapter) {
|
|
121
|
+
return "Error: CLI adapter not available. Cannot manage remote session.";
|
|
122
|
+
}
|
|
123
|
+
if (action === "exit") {
|
|
124
|
+
if (typeof context.cliAdapter.exitRemoteSession !== "function") {
|
|
125
|
+
return "Error: exitRemoteSession method not available on CLI adapter.";
|
|
126
|
+
}
|
|
127
|
+
try {
|
|
128
|
+
const success = await context.cliAdapter.exitRemoteSession();
|
|
129
|
+
if (success) {
|
|
130
|
+
return "Successfully exited remote session. Commands will now execute in the parent environment.";
|
|
131
|
+
} else {
|
|
132
|
+
return "No remote session to exit. Already in local environment.";
|
|
223
133
|
}
|
|
134
|
+
} catch (error) {
|
|
135
|
+
const errorMessage = error?.message || String(error);
|
|
136
|
+
return `Error exiting remote session: ${errorMessage}`;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const validTypes = ["ssh", "docker", "wsl"];
|
|
140
|
+
if (!validTypes.includes(session_type)) {
|
|
141
|
+
return `Error: Invalid session_type "${session_type}". Must be one of: ssh, docker, wsl`;
|
|
224
142
|
}
|
|
143
|
+
if (!command) {
|
|
144
|
+
return 'Error: command is required for the "enter" action.';
|
|
145
|
+
}
|
|
146
|
+
const validation = validateCommand(command, session_type);
|
|
147
|
+
if (!validation.valid) {
|
|
148
|
+
return `Error: ${validation.error}`;
|
|
149
|
+
}
|
|
150
|
+
if (typeof context.cliAdapter.warpifySession !== "function") {
|
|
151
|
+
return "Error: warpifySession method not available on CLI adapter.";
|
|
152
|
+
}
|
|
153
|
+
const connectionString = getConnectionString(command, session_type);
|
|
154
|
+
try {
|
|
155
|
+
const success = await context.cliAdapter.warpifySession(
|
|
156
|
+
command,
|
|
157
|
+
session_type,
|
|
158
|
+
connectionString
|
|
159
|
+
);
|
|
160
|
+
if (success) {
|
|
161
|
+
const sessionDesc = connectionString ? `${session_type.toUpperCase()}: ${connectionString}` : session_type.toUpperCase();
|
|
162
|
+
return `Successfully entered remote session: ${sessionDesc}. All subsequent commands will now execute in this remote environment.`;
|
|
163
|
+
} else {
|
|
164
|
+
return `Failed to enter remote session. Check the connection details and try again. The connection may have been rejected or timed out.`;
|
|
165
|
+
}
|
|
166
|
+
} catch (error) {
|
|
167
|
+
const errorMessage = error?.message || String(error);
|
|
168
|
+
return `Error entering remote session: ${errorMessage}`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
export {
|
|
173
|
+
enterRemoteSessionTool,
|
|
174
|
+
getConnectionString,
|
|
175
|
+
parseDockerContainer,
|
|
176
|
+
parseSSHConnectionString,
|
|
177
|
+
parseWSLDistro,
|
|
178
|
+
validateCommand
|
|
225
179
|
};
|
|
226
180
|
//# sourceMappingURL=enter-remote-session.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enter-remote-session.js","sourceRoot":"","sources":["../../src/tools/enter-remote-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACpD,yCAAyC;IACzC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC3C,IAAI,KAAK,EAAE,CAAC;QACR,OAAO,KAAK,CAAC,CAAC,C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WAAW,wEAAwE,CAAC;YACvI,CAAC;iBAAM,CAAC;gBACJ,OAAO,iIAAiI,CAAC;YAC7I,CAAC;QACL,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YAClB,MAAM,YAAY,GAAG,KAAK,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;YACrD,OAAO,kCAAkC,YAAY,EAAE,CAAC;QAC5D,CAAC;IACL,CAAC;CACJ,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/tools/enter-remote-session.ts"],"sourcesContent":["/**\r\n * Enter Remote Session Tool\r\n * \r\n * Allows the AI agent to programmatically enter SSH, Docker, or WSL environments.\r\n * When executed, the session context automatically switches (\"auto-warpify\")\r\n * and subsequent commands run in the remote environment.\r\n * \r\n * Password prompts are handled by the existing password request callback,\r\n * which prompts the user for input when needed.\r\n */\r\n\r\nimport { Tool } from './types.js';\r\n\r\n// Valid session types\r\ntype SessionType = 'ssh' | 'docker' | 'wsl';\r\n\r\n/**\r\n * Parse connection string from SSH command\r\n * Examples:\r\n * \"ssh rohan@192.168.1.100\" -> \"rohan@192.168.1.100\"\r\n * \"ssh -p 22 rohan@localhost\" -> \"rohan@localhost\"\r\n * \"ssh -i ~/.ssh/id_rsa user@host\" -> \"user@host\"\r\n */\r\nexport function parseSSHConnectionString(command: string): string | undefined {\r\n // Match user@host pattern in the command\r\n const match = command.match(/(\\S+)@(\\S+)/);\r\n if (match) {\r\n return match[0];\r\n }\r\n return undefined;\r\n}\r\n\r\n/**\r\n * Parse container name from Docker command\r\n * Examples:\r\n * \"docker exec -it mycontainer bash\" -> \"mycontainer\"\r\n * \"docker exec mycontainer sh\" -> \"mycontainer\"\r\n */\r\nexport function parseDockerContainer(command: string): string | undefined {\r\n // docker exec pattern: look for container name after flags\r\n const execMatch = command.match(/docker\\s+exec\\s+(?:-\\w+\\s+)*(\\S+)/i);\r\n if (execMatch) {\r\n return execMatch[1];\r\n }\r\n // docker run pattern\r\n const runMatch = command.match(/docker\\s+run\\s+(?:-\\w+(?:\\s+\\S+)?\\s+)*(\\S+)/i);\r\n if (runMatch) {\r\n return runMatch[1];\r\n }\r\n return undefined;\r\n}\r\n\r\n/**\r\n * Parse WSL distro name from command\r\n * Examples:\r\n * \"wsl\" -> \"Ubuntu\" (default)\r\n * \"wsl -d Ubuntu-22.04\" -> \"Ubuntu-22.04\"\r\n */\r\nexport function parseWSLDistro(command: string): string {\r\n const match = command.match(/wsl\\s+(?:-d|--distribution)\\s+(\\S+)/i);\r\n if (match) {\r\n return match[1];\r\n }\r\n return 'Ubuntu'; // Default distro\r\n}\r\n\r\n/**\r\n * Validate that the command matches the expected session type\r\n */\r\nexport function validateCommand(command: string, sessionType: SessionType): { valid: boolean; error?: string } {\r\n const trimmedCommand = command.trim().toLowerCase();\r\n\r\n switch (sessionType) {\r\n case 'ssh':\r\n if (!trimmedCommand.startsWith('ssh ') && trimmedCommand !== 'ssh') {\r\n return { valid: false, error: 'SSH command must start with \"ssh\"' };\r\n }\r\n // Validate it has a target\r\n if (!command.match(/\\S+@\\S+/) && !command.match(/ssh\\s+\\S+/)) {\r\n return { valid: false, error: 'SSH command must specify a host (e.g., \"ssh user@host\")' };\r\n }\r\n break;\r\n\r\n case 'docker':\r\n if (!trimmedCommand.startsWith('docker ')) {\r\n return { valid: false, error: 'Docker command must start with \"docker\"' };\r\n }\r\n if (!trimmedCommand.includes('exec') && !trimmedCommand.includes('run')) {\r\n return { valid: false, error: 'Docker command must use \"exec\" or \"run\" (e.g., \"docker exec -it container bash\")' };\r\n }\r\n break;\r\n\r\n case 'wsl':\r\n if (!trimmedCommand.startsWith('wsl') && trimmedCommand !== 'bash') {\r\n return { valid: false, error: 'WSL command must start with \"wsl\" or be \"bash\"' };\r\n }\r\n break;\r\n }\r\n\r\n return { valid: true };\r\n}\r\n\r\n/**\r\n * Get connection string based on session type and command\r\n */\r\nexport function getConnectionString(command: string, sessionType: SessionType): string | undefined {\r\n switch (sessionType) {\r\n case 'ssh':\r\n return parseSSHConnectionString(command);\r\n case 'docker':\r\n return parseDockerContainer(command);\r\n case 'wsl':\r\n return parseWSLDistro(command);\r\n default:\r\n return undefined;\r\n }\r\n}\r\n\r\nexport const enterRemoteSessionTool: Tool = {\r\n schema: {\r\n name: 'enter_remote_session',\r\n description: `Manage remote environment sessions (SSH, Docker, or WSL).\r\n\r\nACTIONS:\r\n- enter: Switch context to a remote session. All subsequent commands will run in the remote environment.\r\n- exit: Exit the current remote session and return to the parent environment.\r\n\r\n**Enter action**:\r\nAfter the tool executes successfully:\r\n- All subsequent commands will run in the remote environment\r\n- The working directory will change to the remote system's directory\r\n- File operations will target remote files\r\n\r\nExamples:\r\n- SSH: action=\"enter\", session_type=\"ssh\", command=\"ssh rohan@192.168.1.100\"\r\n- Docker: action=\"enter\", session_type=\"docker\", command=\"docker exec -it mycontainer bash\"\r\n- WSL: action=\"enter\", session_type=\"wsl\", command=\"wsl -d Ubuntu\"\r\n\r\n**Exit action**:\r\nExits the current remote session and returns to the parent environment (local or outer remote session).\r\n- Example: action=\"exit\"\r\n\r\nIMPORTANT: \r\n- You CANNOT run raw ssh/docker/wsl commands via execute_command. Use this tool instead.\r\n- To exit a remote session, use action=\"exit\" instead of running the \"exit\" command.\r\n- Password prompts go to the user; the tool will wait for user input.`,\r\n parameters: {\r\n type: 'object',\r\n properties: {\r\n action: {\r\n type: 'string',\r\n enum: ['enter', 'exit'],\r\n description: 'The action to perform: \"enter\" to connect to a remote session, \"exit\" to leave the current remote session.'\r\n },\r\n reason_text: {\r\n type: 'string',\r\n description: 'A short, user-facing explanation of why you are entering/exiting this remote session.'\r\n },\r\n session_type: {\r\n type: 'string',\r\n enum: ['ssh', 'docker', 'wsl'],\r\n description: 'The type of remote session to enter. Required for \"enter\" action.'\r\n },\r\n command: {\r\n type: 'string',\r\n description: 'The full command to establish the connection. Required for \"enter\" action. For SSH: \"ssh user@host\". For Docker: \"docker exec -it container bash\". For WSL: \"wsl\".'\r\n }\r\n },\r\n required: ['action', 'reason_text']\r\n }\r\n },\r\n\r\n async execute(args, context): Promise<string> {\r\n const { action, session_type, command } = args;\r\n\r\n // Check if cliAdapter is available\r\n if (!context.cliAdapter) {\r\n return 'Error: CLI adapter not available. Cannot manage remote session.';\r\n }\r\n\r\n // Handle exit action\r\n if (action === 'exit') {\r\n // Check if exitRemoteSession method exists\r\n if (typeof context.cliAdapter.exitRemoteSession !== 'function') {\r\n return 'Error: exitRemoteSession method not available on CLI adapter.';\r\n }\r\n\r\n try {\r\n const success = await context.cliAdapter.exitRemoteSession();\r\n if (success) {\r\n return 'Successfully exited remote session. Commands will now execute in the parent environment.';\r\n } else {\r\n return 'No remote session to exit. Already in local environment.';\r\n }\r\n } catch (error: any) {\r\n const errorMessage = error?.message || String(error);\r\n return `Error exiting remote session: ${errorMessage}`;\r\n }\r\n }\r\n\r\n // Handle enter action (default behavior)\r\n // Validate session type\r\n const validTypes: SessionType[] = ['ssh', 'docker', 'wsl'];\r\n if (!validTypes.includes(session_type)) {\r\n return `Error: Invalid session_type \"${session_type}\". Must be one of: ssh, docker, wsl`;\r\n }\r\n\r\n if (!command) {\r\n return 'Error: command is required for the \"enter\" action.';\r\n }\r\n\r\n // Validate command matches session type\r\n const validation = validateCommand(command, session_type as SessionType);\r\n if (!validation.valid) {\r\n return `Error: ${validation.error}`;\r\n }\r\n\r\n // Check if warpifySession method exists\r\n if (typeof context.cliAdapter.warpifySession !== 'function') {\r\n return 'Error: warpifySession method not available on CLI adapter.';\r\n }\r\n\r\n // Get connection string for display purposes\r\n const connectionString = getConnectionString(command, session_type as SessionType);\r\n\r\n try {\r\n // Call warpifySession - this handles:\r\n // 1. Password prompting via onPasswordRequest callback\r\n // 2. Connection establishment via the appropriate handler\r\n // 3. Context switching via contextManager\r\n // 4. CWD updates\r\n const success = await context.cliAdapter.warpifySession(\r\n command,\r\n session_type as SessionType,\r\n connectionString\r\n );\r\n\r\n if (success) {\r\n const sessionDesc = connectionString\r\n ? `${session_type.toUpperCase()}: ${connectionString}`\r\n : session_type.toUpperCase();\r\n return `Successfully entered remote session: ${sessionDesc}. All subsequent commands will now execute in this remote environment.`;\r\n } else {\r\n return `Failed to enter remote session. Check the connection details and try again. The connection may have been rejected or timed out.`;\r\n }\r\n } catch (error: any) {\r\n const errorMessage = error?.message || String(error);\r\n return `Error entering remote session: ${errorMessage}`;\r\n }\r\n }\r\n};\r\n"],"mappings":"AAuBO,SAAS,yBAAyB,SAAqC;AAE1E,QAAM,QAAQ,QAAQ,MAAM,aAAa;AACzC,MAAI,OAAO;AACP,WAAO,MAAM,CAAC;AAAA,EAClB;AACA,SAAO;AACX;AAQO,SAAS,qBAAqB,SAAqC;AAEtE,QAAM,YAAY,QAAQ,MAAM,oCAAoC;AACpE,MAAI,WAAW;AACX,WAAO,UAAU,CAAC;AAAA,EACtB;AAEA,QAAM,WAAW,QAAQ,MAAM,8CAA8C;AAC7E,MAAI,UAAU;AACV,WAAO,SAAS,CAAC;AAAA,EACrB;AACA,SAAO;AACX;AAQO,SAAS,eAAe,SAAyB;AACpD,QAAM,QAAQ,QAAQ,MAAM,sCAAsC;AAClE,MAAI,OAAO;AACP,WAAO,MAAM,CAAC;AAAA,EAClB;AACA,SAAO;AACX;AAKO,SAAS,gBAAgB,SAAiB,aAA8D;AAC3G,QAAM,iBAAiB,QAAQ,KAAK,EAAE,YAAY;AAElD,UAAQ,aAAa;AAAA,IACjB,KAAK;AACD,UAAI,CAAC,eAAe,WAAW,MAAM,KAAK,mBAAmB,OAAO;AAChE,eAAO,EAAE,OAAO,OAAO,OAAO,oCAAoC;AAAA,MACtE;AAEA,UAAI,CAAC,QAAQ,MAAM,SAAS,KAAK,CAAC,QAAQ,MAAM,WAAW,GAAG;AAC1D,eAAO,EAAE,OAAO,OAAO,OAAO,0DAA0D;AAAA,MAC5F;AACA;AAAA,IAEJ,KAAK;AACD,UAAI,CAAC,eAAe,WAAW,SAAS,GAAG;AACvC,eAAO,EAAE,OAAO,OAAO,OAAO,0CAA0C;AAAA,MAC5E;AAC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AACJ;","names":[]}
|
|
@@ -1,72 +1,65 @@
|
|
|
1
|
-
import { FastContextAgent } from
|
|
2
|
-
import { ToolRegistry } from
|
|
3
|
-
import * as path from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
USE THIS TOOL WHEN:
|
|
10
|
-
- You need to understand how a feature is implemented across multiple files.
|
|
11
|
-
- You are exploring a new codebase and need a high-level overview of a component.
|
|
12
|
-
- Standard grep/find_files is too manual or you are unsure of exact terms.
|
|
13
|
-
- You want to "find where X is handled" and get a summarized answer with file pointers.
|
|
14
|
-
|
|
15
|
-
HOW IT WORKS:
|
|
16
|
-
- It uses a specialized AI agent (FastContextAgent) to perform up to 8 turns of search.
|
|
17
|
-
- It executes parallel grep/find/read operations.
|
|
18
|
-
- It returns a synthesized markdown summary with relevant snippets and file paths.
|
|
19
|
-
|
|
20
|
-
LIMITATIONS:
|
|
21
|
-
- Read-only. It cannot modify files.
|
|
1
|
+
import { FastContextAgent } from "../services/fast-context-agent.js";
|
|
2
|
+
import { ToolRegistry } from "./registry.js";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
const fastContextTool = {
|
|
5
|
+
schema: {
|
|
6
|
+
name: "fast_context_search",
|
|
7
|
+
description: `Rapidly retrieve code context using an intelligent multi-turn agent.
|
|
8
|
+
|
|
9
|
+
USE THIS TOOL WHEN:
|
|
10
|
+
- You need to understand how a feature is implemented across multiple files.
|
|
11
|
+
- You are exploring a new codebase and need a high-level overview of a component.
|
|
12
|
+
- Standard grep/find_files is too manual or you are unsure of exact terms.
|
|
13
|
+
- You want to "find where X is handled" and get a summarized answer with file pointers.
|
|
14
|
+
|
|
15
|
+
HOW IT WORKS:
|
|
16
|
+
- It uses a specialized AI agent (FastContextAgent) to perform up to 8 turns of search.
|
|
17
|
+
- It executes parallel grep/find/read operations.
|
|
18
|
+
- It returns a synthesized markdown summary with relevant snippets and file paths.
|
|
19
|
+
|
|
20
|
+
LIMITATIONS:
|
|
21
|
+
- Read-only. It cannot modify files.
|
|
22
22
|
- Optimized for speed (5s target), so it may miss deep/complex chains if not found quickly.`,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
path: {
|
|
31
|
-
type: 'string',
|
|
32
|
-
description: 'Optional. The target directory to search within. Defaults to current working directory.',
|
|
33
|
-
},
|
|
34
|
-
reason_text: {
|
|
35
|
-
type: 'string',
|
|
36
|
-
description: 'REQUIRED: Explanation of why you are using this tool.'
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
required: ['query', 'reason_text'],
|
|
23
|
+
parameters: {
|
|
24
|
+
type: "object",
|
|
25
|
+
properties: {
|
|
26
|
+
query: {
|
|
27
|
+
type: "string",
|
|
28
|
+
description: 'The search query. Be specific about what you are looking for (e.g., "how is authentication handled in the backend?", "find the implementation of the grep tool").'
|
|
40
29
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// However, FastContextAgent needs a registry to *execute* tools.
|
|
49
|
-
// If we create a new registry, it starts empty.
|
|
50
|
-
// Solution: We need access to the MAIN registry or re-register tools.
|
|
51
|
-
// Re-registering basic tools (grep, find, view, list) is safe and cheap.
|
|
52
|
-
const registry = new ToolRegistry();
|
|
53
|
-
// We lazily import standard tools to avoid circular dependencies if possible,
|
|
54
|
-
// or just import them here.
|
|
55
|
-
const { grepSearchTool } = await import('./grep-search.js');
|
|
56
|
-
const { findFilesTool } = await import('./find-files.js');
|
|
57
|
-
const { viewFileTool, listDirTool } = await import('./file-ops.js');
|
|
58
|
-
registry.register(grepSearchTool);
|
|
59
|
-
registry.register(findFilesTool);
|
|
60
|
-
registry.register(viewFileTool);
|
|
61
|
-
registry.register(listDirTool);
|
|
62
|
-
const agent = new FastContextAgent(registry);
|
|
63
|
-
try {
|
|
64
|
-
const result = await agent.search(query, cwd, context);
|
|
65
|
-
return result;
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
return `Fast Context Search Failed: ${error.message}`;
|
|
30
|
+
path: {
|
|
31
|
+
type: "string",
|
|
32
|
+
description: "Optional. The target directory to search within. Defaults to current working directory."
|
|
33
|
+
},
|
|
34
|
+
reason_text: {
|
|
35
|
+
type: "string",
|
|
36
|
+
description: "REQUIRED: Explanation of why you are using this tool."
|
|
69
37
|
}
|
|
70
|
-
|
|
38
|
+
},
|
|
39
|
+
required: ["query", "reason_text"]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
async execute(args, context) {
|
|
43
|
+
const { query, path: searchPath } = args;
|
|
44
|
+
const cwd = searchPath ? path.isAbsolute(searchPath) ? searchPath : path.resolve(context.cwd, searchPath) : context.cwd;
|
|
45
|
+
const registry = new ToolRegistry();
|
|
46
|
+
const { grepSearchTool } = await import("./grep-search.js");
|
|
47
|
+
const { findFilesTool } = await import("./find-files.js");
|
|
48
|
+
const { viewFileTool, listDirTool } = await import("./file-ops.js");
|
|
49
|
+
registry.register(grepSearchTool);
|
|
50
|
+
registry.register(findFilesTool);
|
|
51
|
+
registry.register(viewFileTool);
|
|
52
|
+
registry.register(listDirTool);
|
|
53
|
+
const agent = new FastContextAgent(registry);
|
|
54
|
+
try {
|
|
55
|
+
const result = await agent.search(query, cwd, context);
|
|
56
|
+
return result;
|
|
57
|
+
} catch (error) {
|
|
58
|
+
return `Fast Context Search Failed: ${error.message}`;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
fastContextTool
|
|
71
64
|
};
|
|
72
65
|
//# sourceMappingURL=fast-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/tools/fast-context.ts"],"sourcesContent":["import { Tool, ToolExecutionContext } from './types.js';\r\nimport { FastContextAgent } from '../services/fast-context-agent.js';\r\nimport { ToolRegistry } from './registry.js';\r\nimport * as path from 'path';\r\n\r\nexport const fastContextTool: Tool = {\r\n schema: {\r\n name: 'fast_context_search',\r\n description: `Rapidly retrieve code context using an intelligent multi-turn agent.\r\n \r\n USE THIS TOOL WHEN:\r\n - You need to understand how a feature is implemented across multiple files.\r\n - You are exploring a new codebase and need a high-level overview of a component.\r\n - Standard grep/find_files is too manual or you are unsure of exact terms.\r\n - You want to \"find where X is handled\" and get a summarized answer with file pointers.\r\n \r\n HOW IT WORKS:\r\n - It uses a specialized AI agent (FastContextAgent) to perform up to 8 turns of search.\r\n - It executes parallel grep/find/read operations.\r\n - It returns a synthesized markdown summary with relevant snippets and file paths.\r\n \r\n LIMITATIONS:\r\n - Read-only. It cannot modify files.\r\n - Optimized for speed (5s target), so it may miss deep/complex chains if not found quickly.`,\r\n parameters: {\r\n type: 'object',\r\n properties: {\r\n query: {\r\n type: 'string',\r\n description: 'The search query. Be specific about what you are looking for (e.g., \"how is authentication handled in the backend?\", \"find the implementation of the grep tool\").',\r\n },\r\n path: {\r\n type: 'string',\r\n description: 'Optional. The target directory to search within. Defaults to current working directory.',\r\n },\r\n reason_text: {\r\n type: 'string',\r\n description: 'REQUIRED: Explanation of why you are using this tool.'\r\n }\r\n },\r\n required: ['query', 'reason_text'],\r\n },\r\n },\r\n async execute(args: Record<string, any>, context: ToolExecutionContext): Promise<string> {\r\n const { query, path: searchPath } = args;\r\n const cwd = searchPath ? (path.isAbsolute(searchPath) ? searchPath : path.resolve(context.cwd, searchPath)) : context.cwd;\r\n\r\n // We need a ToolRegistry instance.\r\n // In a real dependency injection system, we'd inject it.\r\n // Here, we can instantiate a new one, but it won't have tools registered unless we register them.\r\n // However, FastContextAgent needs a registry to *execute* tools.\r\n // If we create a new registry, it starts empty.\r\n // Solution: We need access to the MAIN registry or re-register tools.\r\n // Re-registering basic tools (grep, find, view, list) is safe and cheap.\r\n\r\n const registry = new ToolRegistry();\r\n\r\n // We lazily import standard tools to avoid circular dependencies if possible, \r\n // or just import them here.\r\n const { grepSearchTool } = await import('./grep-search.js');\r\n const { findFilesTool } = await import('./find-files.js');\r\n const { viewFileTool, listDirTool } = await import('./file-ops.js');\r\n\r\n registry.register(grepSearchTool);\r\n registry.register(findFilesTool);\r\n registry.register(viewFileTool);\r\n registry.register(listDirTool);\r\n\r\n const agent = new FastContextAgent(registry);\r\n\r\n try {\r\n const result = await agent.search(query, cwd, context);\r\n return result;\r\n } catch (error: any) {\r\n return `Fast Context Search Failed: ${error.message}`;\r\n }\r\n },\r\n};\r\n"],"mappings":"AACA,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAC7B,YAAY,UAAU;AAEf,MAAM,kBAAwB;AAAA,EACjC,QAAQ;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAgBb,YAAY;AAAA,MACR,MAAM;AAAA,MACN,YAAY;AAAA,QACR,OAAO;AAAA,UACH,MAAM;AAAA,UACN,aAAa;AAAA,QACjB;AAAA,QACA,MAAM;AAAA,UACF,MAAM;AAAA,UACN,aAAa;AAAA,QACjB;AAAA,QACA,aAAa;AAAA,UACT,MAAM;AAAA,UACN,aAAa;AAAA,QACjB;AAAA,MACJ;AAAA,MACA,UAAU,CAAC,SAAS,aAAa;AAAA,IACrC;AAAA,EACJ;AAAA,EACA,MAAM,QAAQ,MAA2B,SAAgD;AACrF,UAAM,EAAE,OAAO,MAAM,WAAW,IAAI;AACpC,UAAM,MAAM,aAAc,KAAK,WAAW,UAAU,IAAI,aAAa,KAAK,QAAQ,QAAQ,KAAK,UAAU,IAAK,QAAQ;AAUtH,UAAM,WAAW,IAAI,aAAa;AAIlC,UAAM,EAAE,eAAe,IAAI,MAAM,OAAO,kBAAkB;AAC1D,UAAM,EAAE,cAAc,IAAI,MAAM,OAAO,iBAAiB;AACxD,UAAM,EAAE,cAAc,YAAY,IAAI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