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,290 +1,257 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
USE CASES:
|
|
17
|
-
- Running development servers (npm run dev, python -m http.server, etc.)
|
|
18
|
-
- Running long-running processes (builds, tests, watchers)
|
|
19
|
-
- Running multiple commands concurrently
|
|
20
|
-
|
|
21
|
-
ACTIONS:
|
|
22
|
-
1. "start" - Start a new background command. Returns a task_id immediately.
|
|
23
|
-
2. "status" - Check the status and output of a background task. Use this to monitor progress.
|
|
24
|
-
3. "kill" - Terminate a running background task.
|
|
25
|
-
4. "wait" - Pause execution for a specified duration. Use this instead of repeatedly checking status.
|
|
26
|
-
|
|
27
|
-
IMPORTANT:
|
|
28
|
-
- After starting a task, you can continue with other work while it runs.
|
|
29
|
-
- Use "status" periodically to check on long-running tasks.
|
|
30
|
-
- Use "wait" to pause before checking status again (e.g., wait 30 seconds for a build to complete).
|
|
31
|
-
- Always clean up tasks with "kill" when they're no longer needed.
|
|
1
|
+
import { BackgroundTaskManager } from "../services/background-task-manager.js";
|
|
2
|
+
import { runSSHCommand, runLocalPty } from "../utils/editor-utils.js";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
function resolveBackgroundCommandCwd(currentContext, contextCwd, commandCwd) {
|
|
5
|
+
if (currentContext.type === "local") {
|
|
6
|
+
return path.resolve(contextCwd, commandCwd);
|
|
7
|
+
}
|
|
8
|
+
const remoteBase = currentContext.metadata?.workingDirectory || contextCwd || "~";
|
|
9
|
+
return path.posix.isAbsolute(commandCwd) ? commandCwd : path.posix.join(remoteBase, commandCwd);
|
|
10
|
+
}
|
|
11
|
+
const backgroundCommandTool = {
|
|
12
|
+
schema: {
|
|
13
|
+
name: "background_command",
|
|
14
|
+
description: `Execute shell commands in the background, check their status, or kill them. This tool is NON-BLOCKING - when you start a command, the tool returns immediately with a task ID while the command continues running in the background.
|
|
15
|
+
|
|
16
|
+
USE CASES:
|
|
17
|
+
- Running development servers (npm run dev, python -m http.server, etc.)
|
|
18
|
+
- Running long-running processes (builds, tests, watchers)
|
|
19
|
+
- Running multiple commands concurrently
|
|
20
|
+
|
|
21
|
+
ACTIONS:
|
|
22
|
+
1. "start" - Start a new background command. Returns a task_id immediately.
|
|
23
|
+
2. "status" - Check the status and output of a background task. Use this to monitor progress.
|
|
24
|
+
3. "kill" - Terminate a running background task.
|
|
25
|
+
4. "wait" - Pause execution for a specified duration. Use this instead of repeatedly checking status.
|
|
26
|
+
|
|
27
|
+
IMPORTANT:
|
|
28
|
+
- After starting a task, you can continue with other work while it runs.
|
|
29
|
+
- Use "status" periodically to check on long-running tasks.
|
|
30
|
+
- Use "wait" to pause before checking status again (e.g., wait 30 seconds for a build to complete).
|
|
31
|
+
- Always clean up tasks with "kill" when they're no longer needed.
|
|
32
32
|
- The task_id returned from "start" must be saved to use with "status" or "kill".`,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
output_lines: {
|
|
58
|
-
type: 'integer',
|
|
59
|
-
description: 'Number of lines of output to return (from the end). Default: 50. Only used with "status" action.',
|
|
60
|
-
},
|
|
61
|
-
wait_seconds: {
|
|
62
|
-
type: 'integer',
|
|
63
|
-
description: 'Number of seconds to wait. REQUIRED when action is "wait". Use this to pause before checking task status again.',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
required: ['reason_text', 'action'],
|
|
33
|
+
parameters: {
|
|
34
|
+
type: "object",
|
|
35
|
+
properties: {
|
|
36
|
+
reason_text: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: "REQUIRED: A brief explanation of what you are doing with this background command."
|
|
39
|
+
},
|
|
40
|
+
action: {
|
|
41
|
+
type: "string",
|
|
42
|
+
enum: ["start", "status", "kill", "wait"],
|
|
43
|
+
description: 'The action to perform: "start" to run a new command, "status" to check a task, "kill" to terminate a task, "wait" to pause execution.'
|
|
44
|
+
},
|
|
45
|
+
command: {
|
|
46
|
+
type: "string",
|
|
47
|
+
description: 'The shell command to execute. REQUIRED when action is "start".'
|
|
48
|
+
},
|
|
49
|
+
cwd: {
|
|
50
|
+
type: "string",
|
|
51
|
+
description: 'The working directory for the command. REQUIRED when action is "start".'
|
|
52
|
+
},
|
|
53
|
+
task_id: {
|
|
54
|
+
type: "string",
|
|
55
|
+
description: 'The task ID to check or kill. REQUIRED when action is "status" or "kill".'
|
|
67
56
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
**
|
|
194
|
-
**
|
|
195
|
-
${
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
57
|
+
output_lines: {
|
|
58
|
+
type: "integer",
|
|
59
|
+
description: 'Number of lines of output to return (from the end). Default: 50. Only used with "status" action.'
|
|
60
|
+
},
|
|
61
|
+
wait_seconds: {
|
|
62
|
+
type: "integer",
|
|
63
|
+
description: 'Number of seconds to wait. REQUIRED when action is "wait". Use this to pause before checking task status again.'
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
required: ["reason_text", "action"]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
async execute(args, context) {
|
|
70
|
+
const { action, command, cwd, task_id, output_lines = 50, wait_seconds } = args;
|
|
71
|
+
switch (action) {
|
|
72
|
+
case "start": {
|
|
73
|
+
if (!command) {
|
|
74
|
+
throw new Error('Missing required parameter "command" for action "start"');
|
|
75
|
+
}
|
|
76
|
+
if (!cwd) {
|
|
77
|
+
throw new Error('Missing required parameter "cwd" for action "start"');
|
|
78
|
+
}
|
|
79
|
+
const contextManager = context.contextManager;
|
|
80
|
+
const activeContext = contextManager.getCurrentContext();
|
|
81
|
+
let stack = [];
|
|
82
|
+
if (typeof contextManager.getContextStack === "function") {
|
|
83
|
+
stack = contextManager.getContextStack();
|
|
84
|
+
} else {
|
|
85
|
+
const current = contextManager.getCurrentContext();
|
|
86
|
+
if (current) stack = [current];
|
|
87
|
+
}
|
|
88
|
+
let currentCommand = command;
|
|
89
|
+
for (let i = stack.length - 1; i >= 0; i--) {
|
|
90
|
+
const ctx = stack[i];
|
|
91
|
+
const isTarget = i === stack.length - 1;
|
|
92
|
+
const executionCwd = isTarget ? cwd : ctx.metadata.workingDirectory;
|
|
93
|
+
if (ctx.type === "ssh" && ctx.handler?.client) {
|
|
94
|
+
const sshClient = ctx.handler.client;
|
|
95
|
+
const remoteTask = BackgroundTaskManager.startRemoteTask(
|
|
96
|
+
command,
|
|
97
|
+
// Original command for display
|
|
98
|
+
cwd,
|
|
99
|
+
// Original CWD for display
|
|
100
|
+
ctx.type
|
|
101
|
+
// Context type
|
|
102
|
+
);
|
|
103
|
+
const sshPty = runSSHCommand(
|
|
104
|
+
sshClient,
|
|
105
|
+
currentCommand,
|
|
106
|
+
// The accumulated (possibly wrapped) command
|
|
107
|
+
executionCwd,
|
|
108
|
+
remoteTask.onData,
|
|
109
|
+
remoteTask.onExit
|
|
110
|
+
);
|
|
111
|
+
remoteTask.setRemotePty(sshPty);
|
|
112
|
+
return formatStartResponse(remoteTask.id, command, cwd, ctx.type);
|
|
113
|
+
}
|
|
114
|
+
if (ctx.type === "local") {
|
|
115
|
+
const remoteTask = BackgroundTaskManager.startRemoteTask(
|
|
116
|
+
command,
|
|
117
|
+
cwd,
|
|
118
|
+
"local"
|
|
119
|
+
);
|
|
120
|
+
const localPty = runLocalPty(
|
|
121
|
+
currentCommand,
|
|
122
|
+
executionCwd,
|
|
123
|
+
// Use the local CWD
|
|
124
|
+
remoteTask.onData,
|
|
125
|
+
remoteTask.onExit
|
|
126
|
+
);
|
|
127
|
+
remoteTask.setRemotePty(localPty);
|
|
128
|
+
return formatStartResponse(remoteTask.id, command, cwd, "local");
|
|
129
|
+
}
|
|
130
|
+
if (ctx.type === "docker") {
|
|
131
|
+
const containerId = ctx.metadata.containerId;
|
|
132
|
+
if (!containerId) throw new Error("Docker context missing containerId");
|
|
133
|
+
currentCommand = buildDockerCommand(containerId, executionCwd, currentCommand);
|
|
134
|
+
} else if (ctx.type === "wsl") {
|
|
135
|
+
const distro = ctx.metadata.distroName || "Ubuntu";
|
|
136
|
+
currentCommand = buildWSLCommand(distro, executionCwd, currentCommand);
|
|
137
|
+
} else if (ctx.type === "ssh") {
|
|
138
|
+
currentCommand = buildSSHCommand(ctx.metadata, executionCwd, currentCommand);
|
|
139
|
+
} else {
|
|
140
|
+
throw new Error(`Unsupported context type for wrapping: ${ctx.type}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
throw new Error("Failed to execute command: Reached end of context stack without execution.");
|
|
144
|
+
}
|
|
145
|
+
case "status": {
|
|
146
|
+
if (!task_id) {
|
|
147
|
+
throw new Error('Missing required parameter "task_id" for action "status"');
|
|
148
|
+
}
|
|
149
|
+
const task = BackgroundTaskManager.getTask(task_id);
|
|
150
|
+
if (!task) {
|
|
151
|
+
const allTasks = BackgroundTaskManager.getAllTasks();
|
|
152
|
+
if (allTasks.length === 0) {
|
|
153
|
+
throw new Error(`Task "${task_id}" not found. There are no background tasks currently tracked.`);
|
|
154
|
+
}
|
|
155
|
+
const taskList = allTasks.map((t) => `- ${t.id} (${t.isRunning ? "running" : "completed"}): ${t.command}`).join("\n");
|
|
156
|
+
throw new Error(`Task "${task_id}" not found.
|
|
157
|
+
|
|
158
|
+
Available tasks:
|
|
159
|
+
${taskList}`);
|
|
160
|
+
}
|
|
161
|
+
const fullOutput = task.output;
|
|
162
|
+
const lines = fullOutput.split("\n");
|
|
163
|
+
const outputToShow = lines.slice(-output_lines).join("\n");
|
|
164
|
+
const truncated = lines.length > output_lines;
|
|
165
|
+
const durationMs = Date.now() - task.startTime.getTime();
|
|
166
|
+
const durationSec = Math.round(durationMs / 1e3);
|
|
167
|
+
let statusText = "";
|
|
168
|
+
if (task.isRunning) {
|
|
169
|
+
statusText = `**Status:** \u{1F504} Running (${durationSec}s)`;
|
|
170
|
+
} else if (task.exitCode === 0) {
|
|
171
|
+
statusText = `**Status:** \u2705 Completed successfully (exit code: 0)`;
|
|
172
|
+
} else if (task.exitCode !== void 0) {
|
|
173
|
+
statusText = `**Status:** \u274C Failed (exit code: ${task.exitCode})`;
|
|
174
|
+
} else if (task.error) {
|
|
175
|
+
statusText = `**Status:** \u274C Error: ${task.error}`;
|
|
176
|
+
} else {
|
|
177
|
+
statusText = `**Status:** \u23F9\uFE0F Stopped`;
|
|
178
|
+
}
|
|
179
|
+
const remoteLabel = task.remoteContext ? ` [${task.remoteContext}]` : "";
|
|
180
|
+
return `Background Task Status${remoteLabel}
|
|
181
|
+
|
|
182
|
+
**Task ID:** ${task_id}
|
|
183
|
+
**Command:** ${task.command}
|
|
184
|
+
**Working Directory:** ${task.cwd}
|
|
185
|
+
${statusText}
|
|
186
|
+
|
|
187
|
+
**Output${truncated ? ` (last ${output_lines} lines)` : ""}:**
|
|
188
|
+
\`\`\`
|
|
189
|
+
${outputToShow || "(no output yet)"}
|
|
200
190
|
\`\`\``;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
// Try to find if it was recently killed or doesn't exist
|
|
210
|
-
throw new Error(`Task "${task_id}" not found.`);
|
|
211
|
-
}
|
|
212
|
-
if (!task.isRunning) {
|
|
213
|
-
return `Task "${task_id}" is not running (already completed or stopped). No action taken.`;
|
|
214
|
-
}
|
|
215
|
-
// For remote tasks, we might need to do special cleanup,
|
|
216
|
-
// but BackgroundTaskManager.cancelTask() handles calling the pty.kill()
|
|
217
|
-
const success = BackgroundTaskManager.cancelTask(task_id);
|
|
218
|
-
if (success) {
|
|
219
|
-
return `Background task "${task_id}" has been terminated.
|
|
220
|
-
|
|
221
|
-
**Command:** ${task.command}
|
|
222
|
-
**Status:** ā¹ļø Killed by request`;
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
throw new Error(`Failed to kill task "${task_id}". The task may have already completed.`);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
case 'wait': {
|
|
229
|
-
// Validate required parameters for wait
|
|
230
|
-
if (!wait_seconds) {
|
|
231
|
-
throw new Error('Missing required parameter "wait_seconds" for action "wait"');
|
|
232
|
-
}
|
|
233
|
-
if (wait_seconds < 1 || wait_seconds > 300) {
|
|
234
|
-
throw new Error('wait_seconds must be between 1 and 300 (5 minutes)');
|
|
235
|
-
}
|
|
236
|
-
// Create a promise that resolves after the specified duration
|
|
237
|
-
await new Promise(resolve => setTimeout(resolve, wait_seconds * 1000));
|
|
238
|
-
return `Waited for ${wait_seconds} second${wait_seconds !== 1 ? 's' : ''}.
|
|
239
|
-
|
|
240
|
-
ā±ļø The execution has been paused for the requested duration. You can now continue with the next action.`;
|
|
241
|
-
}
|
|
242
|
-
default:
|
|
243
|
-
throw new Error(`Unknown action "${action}". Valid actions are: "start", "status", "kill", "wait".`);
|
|
191
|
+
}
|
|
192
|
+
case "kill": {
|
|
193
|
+
if (!task_id) {
|
|
194
|
+
throw new Error('Missing required parameter "task_id" for action "kill"');
|
|
195
|
+
}
|
|
196
|
+
const task = BackgroundTaskManager.getTask(task_id);
|
|
197
|
+
if (!task) {
|
|
198
|
+
throw new Error(`Task "${task_id}" not found.`);
|
|
244
199
|
}
|
|
245
|
-
|
|
200
|
+
if (!task.isRunning) {
|
|
201
|
+
return `Task "${task_id}" is not running (already completed or stopped). No action taken.`;
|
|
202
|
+
}
|
|
203
|
+
const success = BackgroundTaskManager.cancelTask(task_id);
|
|
204
|
+
if (success) {
|
|
205
|
+
return `Background task "${task_id}" has been terminated.
|
|
206
|
+
|
|
207
|
+
**Command:** ${task.command}
|
|
208
|
+
**Status:** \u23F9\uFE0F Killed by request`;
|
|
209
|
+
} else {
|
|
210
|
+
throw new Error(`Failed to kill task "${task_id}". The task may have already completed.`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
case "wait": {
|
|
214
|
+
if (!wait_seconds) {
|
|
215
|
+
throw new Error('Missing required parameter "wait_seconds" for action "wait"');
|
|
216
|
+
}
|
|
217
|
+
if (wait_seconds < 1 || wait_seconds > 300) {
|
|
218
|
+
throw new Error("wait_seconds must be between 1 and 300 (5 minutes)");
|
|
219
|
+
}
|
|
220
|
+
await new Promise((resolve) => setTimeout(resolve, wait_seconds * 1e3));
|
|
221
|
+
return `Waited for ${wait_seconds} second${wait_seconds !== 1 ? "s" : ""}.
|
|
222
|
+
|
|
223
|
+
\u23F1\uFE0F The execution has been paused for the requested duration. You can now continue with the next action.`;
|
|
224
|
+
}
|
|
225
|
+
default:
|
|
226
|
+
throw new Error(`Unknown action "${action}". Valid actions are: "start", "status", "kill", "wait".`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
246
229
|
};
|
|
247
|
-
/**
|
|
248
|
-
* Format the successful start response
|
|
249
|
-
*/
|
|
250
230
|
function formatStartResponse(taskId, command, cwd, contextType) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
**Task ID:** ${taskId}
|
|
254
|
-
**Command:** ${command}
|
|
255
|
-
**Working Directory:** ${cwd}
|
|
256
|
-
**Context:** ${contextType}
|
|
257
|
-
|
|
231
|
+
return `Background task started successfully in ${contextType}.
|
|
232
|
+
|
|
233
|
+
**Task ID:** ${taskId}
|
|
234
|
+
**Command:** ${command}
|
|
235
|
+
**Working Directory:** ${cwd}
|
|
236
|
+
**Context:** ${contextType}
|
|
237
|
+
|
|
258
238
|
The command is now running in the background. Use action="status" with task_id="${taskId}" to check progress, or action="kill" to terminate it.`;
|
|
259
239
|
}
|
|
260
|
-
/**
|
|
261
|
-
* Helper to escape a command for use in "sh -c" or similar
|
|
262
|
-
*/
|
|
263
240
|
function escapeCmd(cmd) {
|
|
264
|
-
|
|
265
|
-
return cmd.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
241
|
+
return cmd.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
266
242
|
}
|
|
267
|
-
/**
|
|
268
|
-
* Build a Docker execution command
|
|
269
|
-
*/
|
|
270
243
|
function buildDockerCommand(containerId, cwd, command) {
|
|
271
|
-
|
|
272
|
-
return `docker exec -w "${cwd}" ${containerId} sh -c "${escapeCmd(command)}"`;
|
|
244
|
+
return `docker exec -w "${cwd}" ${containerId} sh -c "${escapeCmd(command)}"`;
|
|
273
245
|
}
|
|
274
|
-
/**
|
|
275
|
-
* Build a WSL execution command
|
|
276
|
-
*/
|
|
277
246
|
function buildWSLCommand(distro, cwd, command) {
|
|
278
|
-
|
|
279
|
-
return `wsl -d ${distro} -- bash -c "cd \\"${cwd}\\" && ${escapeCmd(command)}"`;
|
|
247
|
+
return `wsl -d ${distro} -- bash -c "cd \\"${cwd}\\" && ${escapeCmd(command)}"`;
|
|
280
248
|
}
|
|
281
|
-
/**
|
|
282
|
-
* Build an SSH execution command (for wrapping)
|
|
283
|
-
*/
|
|
284
249
|
function buildSSHCommand(metadata, cwd, command) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
return `ssh ${portFlag} ${userHost} "cd \\"${cwd}\\" && ${escapeCmd(command)}"`;
|
|
250
|
+
const portFlag = metadata.port ? `-p ${metadata.port}` : "";
|
|
251
|
+
const userHost = `${metadata.username}@${metadata.hostname}`;
|
|
252
|
+
return `ssh ${portFlag} ${userHost} "cd \\"${cwd}\\" && ${escapeCmd(command)}"`;
|
|
289
253
|
}
|
|
254
|
+
export {
|
|
255
|
+
backgroundCommandTool
|
|
256
|
+
};
|
|
290
257
|
//# sourceMappingURL=background-command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background-command.js","sourceRoot":"","sources":["../../src/tools/background-command.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGtE,MAAM,CAAC,MAAM,qBAAqB,GAAS;IACvC,MAAM,EAAE;QACJ,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE;;;;;;;;;;;;;;;;;;kFAkB6D;QAC1E,UAAU,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACR,WAAW,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,mFAAmF;iBACnG;gBACD,MAAM,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;oBACzC,WAAW,EAAE,uIAAuI;iBACvJ;gBACD,OAAO,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,gEAAgE;iBAChF;gBACD,GAAG,EAAE;oBACD,IA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Ae,EAAE,GAAW,EAAE,WAAmB;IAC1F,OAAO,2CAA2C,WAAW;;eAElD,MAAM;eACN,OAAO;yBACG,GAAG;eACb,WAAW;;kFAEwD,MAAM,wDAAwD,CAAC;AACjJ,CAAC;AAED;;GAEG;AACH,SAAS,SAAS,CAAC,GAAW;IAC1B,wCAAwC;IACxC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,WAAmB,EAAE,GAAW,EAAE,OAAe;IACzE,0CAA0C;IAC1C,OAAO,mBAAmB,GAAG,KAAK,WAAW,WAAW,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC;AAClF,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,MAAc,EAAE,GAAW,EAAE,OAAe;IACjE,iDAAiD;IACjD,OAAO,UAAU,MAAM,sBAAsB,GAAG,UAAU,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC;AACpF,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,QAAa,EAAE,GAAW,EAAE,OAAe;IAChE,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5D,MAAM,QAAQ,GAAG,GAAG,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7D,8CAA8C;IAC9C,OAAO,OAAO,QAAQ,IAAI,QAAQ,WAAW,GAAG,UAAU,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC;AACpF,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/tools/background-command.ts"],"sourcesContent":["/**\r\n * Background Command Tool\r\n * \r\n * Allows the AI to execute commands in the background (non-blocking),\r\n * check their status, and kill/terminate them.\r\n * \r\n * Uses the existing BackgroundTaskManager singleton.\r\n */\r\n\r\nimport { Tool } from './types.js';\r\nimport { BackgroundTaskManager } from '../services/background-task-manager.js';\r\nimport { runSSHCommand, runLocalPty } from '../utils/editor-utils.js';\r\nimport { ContextManager } from '../context/context-manager.js';\r\nimport * as path from 'path';\r\n\r\nfunction resolveBackgroundCommandCwd(currentContext: any, contextCwd: string, commandCwd: string): string {\r\n if (currentContext.type === 'local') {\r\n return path.resolve(contextCwd, commandCwd);\r\n }\r\n\r\n const remoteBase = currentContext.metadata?.workingDirectory || contextCwd || '~';\r\n return path.posix.isAbsolute(commandCwd)\r\n ? commandCwd\r\n : path.posix.join(remoteBase, commandCwd);\r\n}\r\n\r\n\r\nexport const backgroundCommandTool: Tool = {\r\n schema: {\r\n name: 'background_command',\r\n description: `Execute shell commands in the background, check their status, or kill them. This tool is NON-BLOCKING - when you start a command, the tool returns immediately with a task ID while the command continues running in the background.\r\n\r\nUSE CASES:\r\n- Running development servers (npm run dev, python -m http.server, etc.)\r\n- Running long-running processes (builds, tests, watchers)\r\n- Running multiple commands concurrently\r\n\r\nACTIONS:\r\n1. \"start\" - Start a new background command. Returns a task_id immediately.\r\n2. \"status\" - Check the status and output of a background task. Use this to monitor progress.\r\n3. \"kill\" - Terminate a running background task.\r\n4. \"wait\" - Pause execution for a specified duration. Use this instead of repeatedly checking status.\r\n\r\nIMPORTANT:\r\n- After starting a task, you can continue with other work while it runs.\r\n- Use \"status\" periodically to check on long-running tasks.\r\n- Use \"wait\" to pause before checking status again (e.g., wait 30 seconds for a build to complete).\r\n- Always clean up tasks with \"kill\" when they're no longer needed.\r\n- The task_id returned from \"start\" must be saved to use with \"status\" or \"kill\".`,\r\n parameters: {\r\n type: 'object',\r\n properties: {\r\n reason_text: {\r\n type: 'string',\r\n description: 'REQUIRED: A brief explanation of what you are doing with this background command.',\r\n },\r\n action: {\r\n type: 'string',\r\n enum: ['start', 'status', 'kill', 'wait'],\r\n description: 'The action to perform: \"start\" to run a new command, \"status\" to check a task, \"kill\" to terminate a task, \"wait\" to pause execution.',\r\n },\r\n command: {\r\n type: 'string',\r\n description: 'The shell command to execute. REQUIRED when action is \"start\".',\r\n },\r\n cwd: {\r\n type: 'string',\r\n description: 'The working directory for the command. REQUIRED when action is \"start\".',\r\n },\r\n task_id: {\r\n type: 'string',\r\n description: 'The task ID to check or kill. REQUIRED when action is \"status\" or \"kill\".',\r\n },\r\n output_lines: {\r\n type: 'integer',\r\n description: 'Number of lines of output to return (from the end). Default: 50. Only used with \"status\" action.',\r\n },\r\n wait_seconds: {\r\n type: 'integer',\r\n description: 'Number of seconds to wait. REQUIRED when action is \"wait\". Use this to pause before checking task status again.',\r\n },\r\n },\r\n required: ['reason_text', 'action'],\r\n },\r\n },\r\n async execute(args, context) {\r\n const { action, command, cwd, task_id, output_lines = 50, wait_seconds } = args;\r\n\r\n switch (action) {\r\n case 'start': {\r\n // Validate required parameters for start\r\n if (!command) {\r\n throw new Error('Missing required parameter \"command\" for action \"start\"');\r\n }\r\n if (!cwd) {\r\n throw new Error('Missing required parameter \"cwd\" for action \"start\"');\r\n }\r\n\r\n // Check for remote context\r\n const contextManager = context.contextManager as ContextManager;\r\n const activeContext = contextManager.getCurrentContext();\r\n\r\n // Get the full context stack to handle nested environments\r\n // If getContextStack is not available (older version), fall back to checking current context\r\n let stack: any[] = [];\r\n if (typeof contextManager.getContextStack === 'function') {\r\n stack = contextManager.getContextStack();\r\n } else {\r\n // Fallback for safety\r\n const current = contextManager.getCurrentContext();\r\n if (current) stack = [current];\r\n }\r\n\r\n let currentCommand = command;\r\n\r\n // Iterate from the target context (top of stack) down to the root\r\n for (let i = stack.length - 1; i >= 0; i--) {\r\n const ctx = stack[i];\r\n const isTarget = i === stack.length - 1;\r\n\r\n // Determine the working directory to use for this execution layer\r\n // If this is the target layer, use the user-provided cwd\r\n // If this is an intermediate layer, use its tracked working directory\r\n const executionCwd = isTarget ? cwd : ctx.metadata.workingDirectory;\r\n\r\n // 1. Check if this context has a direct protocol executor (e.g. active SSH client)\r\n if (ctx.type === 'ssh' && ctx.handler?.client) {\r\n const sshClient = ctx.handler.client;\r\n\r\n // Start task tracking\r\n const remoteTask = BackgroundTaskManager.startRemoteTask(\r\n command, // Original command for display\r\n cwd, // Original CWD for display\r\n ctx.type // Context type\r\n );\r\n\r\n // Execute via SSH PTY\r\n const sshPty = runSSHCommand(\r\n sshClient,\r\n currentCommand, // The accumulated (possibly wrapped) command\r\n executionCwd,\r\n remoteTask.onData,\r\n remoteTask.onExit\r\n );\r\n remoteTask.setRemotePty(sshPty);\r\n\r\n return formatStartResponse(remoteTask.id, command, cwd, ctx.type);\r\n }\r\n\r\n // 2. Check if this is the local root context\r\n if (ctx.type === 'local') {\r\n // Start task tracking\r\n const remoteTask = BackgroundTaskManager.startRemoteTask(\r\n command,\r\n cwd,\r\n 'local'\r\n );\r\n\r\n // Execute via Local PTY (which might be running a wrapped command like \"wsl ...\" or \"docker ...\")\r\n const localPty = runLocalPty(\r\n currentCommand,\r\n executionCwd, // Use the local CWD\r\n remoteTask.onData,\r\n remoteTask.onExit\r\n );\r\n remoteTask.setRemotePty(localPty);\r\n\r\n return formatStartResponse(remoteTask.id, command, cwd, 'local');\r\n }\r\n\r\n // 3. Otherwise, WRAP the command for the next iteration (parent)\r\n if (ctx.type === 'docker') {\r\n const containerId = ctx.metadata.containerId;\r\n if (!containerId) throw new Error('Docker context missing containerId');\r\n currentCommand = buildDockerCommand(containerId, executionCwd, currentCommand);\r\n } else if (ctx.type === 'wsl') {\r\n const distro = ctx.metadata.distroName || 'Ubuntu';\r\n currentCommand = buildWSLCommand(distro, executionCwd, currentCommand);\r\n } else if (ctx.type === 'ssh') {\r\n // Fallback for SSH without accessible client (e.g. wrapped command)\r\n currentCommand = buildSSHCommand(ctx.metadata, executionCwd, currentCommand);\r\n } else {\r\n // Unknown context type, try to pass through or error?\r\n // For now we error to be safe, or just wrap in sh -c?\r\n throw new Error(`Unsupported context type for wrapping: ${ctx.type}`);\r\n }\r\n }\r\n\r\n throw new Error('Failed to execute command: Reached end of context stack without execution.');\r\n }\r\n\r\n case 'status': {\r\n // Validate required parameters for status\r\n if (!task_id) {\r\n throw new Error('Missing required parameter \"task_id\" for action \"status\"');\r\n }\r\n\r\n const task = BackgroundTaskManager.getTask(task_id);\r\n if (!task) {\r\n // List all available tasks to help the AI\r\n const allTasks = BackgroundTaskManager.getAllTasks();\r\n if (allTasks.length === 0) {\r\n throw new Error(`Task \"${task_id}\" not found. There are no background tasks currently tracked.`);\r\n }\r\n const taskList = allTasks.map(t => `- ${t.id} (${t.isRunning ? 'running' : 'completed'}): ${t.command}`).join('\\n');\r\n throw new Error(`Task \"${task_id}\" not found.\\n\\nAvailable tasks:\\n${taskList}`);\r\n }\r\n\r\n // Get the output (last N lines)\r\n const fullOutput = task.output;\r\n const lines = fullOutput.split('\\n');\r\n const outputToShow = lines.slice(-output_lines).join('\\n');\r\n const truncated = lines.length > output_lines;\r\n\r\n const durationMs = Date.now() - task.startTime.getTime();\r\n const durationSec = Math.round(durationMs / 1000);\r\n\r\n let statusText = '';\r\n if (task.isRunning) {\r\n statusText = `**Status:** š Running (${durationSec}s)`;\r\n } else if (task.exitCode === 0) {\r\n statusText = `**Status:** ā
Completed successfully (exit code: 0)`;\r\n } else if (task.exitCode !== undefined) {\r\n statusText = `**Status:** ā Failed (exit code: ${task.exitCode})`;\r\n } else if (task.error) {\r\n statusText = `**Status:** ā Error: ${task.error}`;\r\n } else {\r\n statusText = `**Status:** ā¹ļø Stopped`;\r\n }\r\n\r\n const remoteLabel = task.remoteContext ? ` [${task.remoteContext}]` : '';\r\n\r\n return `Background Task Status${remoteLabel}\r\n\r\n**Task ID:** ${task_id}\r\n**Command:** ${task.command}\r\n**Working Directory:** ${task.cwd}\r\n${statusText}\r\n\r\n**Output${truncated ? ` (last ${output_lines} lines)` : ''}:**\r\n\\`\\`\\`\r\n${outputToShow || '(no output yet)'}\r\n\\`\\`\\``;\r\n }\r\n\r\n case 'kill': {\r\n // Validate required parameters for kill\r\n if (!task_id) {\r\n throw new Error('Missing required parameter \"task_id\" for action \"kill\"');\r\n }\r\n\r\n const task = BackgroundTaskManager.getTask(task_id);\r\n if (!task) {\r\n // Try to find if it was recently killed or doesn't exist\r\n throw new Error(`Task \"${task_id}\" not found.`);\r\n }\r\n\r\n if (!task.isRunning) {\r\n return `Task \"${task_id}\" is not running (already completed or stopped). No action taken.`;\r\n }\r\n\r\n // For remote tasks, we might need to do special cleanup, \r\n // but BackgroundTaskManager.cancelTask() handles calling the pty.kill()\r\n const success = BackgroundTaskManager.cancelTask(task_id);\r\n if (success) {\r\n return `Background task \"${task_id}\" has been terminated.\r\n\r\n**Command:** ${task.command}\r\n**Status:** ā¹ļø Killed by request`;\r\n } else {\r\n throw new Error(`Failed to kill task \"${task_id}\". The task may have already completed.`);\r\n }\r\n }\r\n\r\n case 'wait': {\r\n // Validate required parameters for wait\r\n if (!wait_seconds) {\r\n throw new Error('Missing required parameter \"wait_seconds\" for action \"wait\"');\r\n }\r\n\r\n if (wait_seconds < 1 || wait_seconds > 300) {\r\n throw new Error('wait_seconds must be between 1 and 300 (5 minutes)');\r\n }\r\n\r\n // Create a promise that resolves after the specified duration\r\n await new Promise(resolve => setTimeout(resolve, wait_seconds * 1000));\r\n\r\n return `Waited for ${wait_seconds} second${wait_seconds !== 1 ? 's' : ''}.\r\n\r\nā±ļø The execution has been paused for the requested duration. You can now continue with the next action.`;\r\n }\r\n\r\n default:\r\n throw new Error(`Unknown action \"${action}\". Valid actions are: \"start\", \"status\", \"kill\", \"wait\".`);\r\n }\r\n },\r\n};\r\n\r\n/**\r\n * Format the successful start response\r\n */\r\nfunction formatStartResponse(taskId: string, command: string, cwd: string, contextType: string): string {\r\n return `Background task started successfully in ${contextType}.\r\n\r\n**Task ID:** ${taskId}\r\n**Command:** ${command}\r\n**Working Directory:** ${cwd}\r\n**Context:** ${contextType}\r\n\r\nThe command is now running in the background. Use action=\"status\" with task_id=\"${taskId}\" to check progress, or action=\"kill\" to terminate it.`;\r\n}\r\n\r\n/**\r\n * Helper to escape a command for use in \"sh -c\" or similar\r\n */\r\nfunction escapeCmd(cmd: string): string {\r\n // Escape backslashes first, then quotes\r\n return cmd.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\r\n}\r\n\r\n/**\r\n * Build a Docker execution command\r\n */\r\nfunction buildDockerCommand(containerId: string, cwd: string, command: string): string {\r\n // docker exec -w <cwd> <id> sh -c \"<cmd>\"\r\n return `docker exec -w \"${cwd}\" ${containerId} sh -c \"${escapeCmd(command)}\"`;\r\n}\r\n\r\n/**\r\n * Build a WSL execution command\r\n */\r\nfunction buildWSLCommand(distro: string, cwd: string, command: string): string {\r\n // wsl -d <distro> -- bash -c \"cd <cwd> && <cmd>\"\r\n return `wsl -d ${distro} -- bash -c \"cd \\\\\"${cwd}\\\\\" && ${escapeCmd(command)}\"`;\r\n}\r\n\r\n/**\r\n * Build an SSH execution command (for wrapping)\r\n */\r\nfunction buildSSHCommand(metadata: any, cwd: string, command: string): string {\r\n const portFlag = metadata.port ? `-p ${metadata.port}` : '';\r\n const userHost = `${metadata.username}@${metadata.hostname}`;\r\n // ssh -p <port> user@host \"cd <cwd> && <cmd>\"\r\n return `ssh ${portFlag} ${userHost} \"cd \\\\\"${cwd}\\\\\" && ${escapeCmd(command)}\"`;\r\n}\r\n"],"mappings":"AAUA,SAAS,6BAA6B;AACtC,SAAS,eAAe,mBAAmB;AAE3C,YAAY,UAAU;AAEtB,SAAS,4BAA4B,gBAAqB,YAAoB,YAA4B;AACtG,MAAI,eAAe,SAAS,SAAS;AACjC,WAAO,KAAK,QAAQ,YAAY,UAAU;AAAA,EAC9C;AAEA,QAAM,aAAa,eAAe,UAAU,oBAAoB,cAAc;AAC9E,SAAO,KAAK,MAAM,WAAW,UAAU,IACjC,aACA,KAAK,MAAM,KAAK,YAAY,UAAU;AAChD;AAGO,MAAM,wBAA8B;AAAA,EACvC,QAAQ;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA;AA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