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,361 +1,326 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* tools, and lifecycle. Terminates immediately when the shell command completes.
|
|
7
|
-
*/
|
|
8
|
-
import { aiServiceClient } from './ai-service-client.js';
|
|
9
|
-
import { sessionQuotaManager } from './session-quota-manager.js';
|
|
10
|
-
import { quickLog } from '../utils/conversation-logger.js';
|
|
11
|
-
// ==================== Constants ====================
|
|
12
|
-
const MAX_TURNS_PER_SESSION = 20; // Max AI turns per shell session
|
|
13
|
-
const MODEL = 'gemini-3-flash-preview'; // Fast model for quick responses
|
|
14
|
-
// ==================== Helper Functions ====================
|
|
15
|
-
/**
|
|
16
|
-
* Convert literal escape sequences (like \n, \r, \t) to actual control characters.
|
|
17
|
-
* The AI often returns "1\n" where \n is meant to be a newline but arrives as literal chars.
|
|
18
|
-
*/
|
|
1
|
+
import { aiServiceClient } from "./ai-service-client.js";
|
|
2
|
+
import { sessionQuotaManager } from "./session-quota-manager.js";
|
|
3
|
+
import { quickLog } from "../utils/conversation-logger.js";
|
|
4
|
+
const MAX_TURNS_PER_SESSION = 20;
|
|
5
|
+
const MODEL = "gemini-3-flash-preview";
|
|
19
6
|
function convertEscapeSequences(input) {
|
|
20
|
-
|
|
21
|
-
.replace(/\\n/g, '\n') // newline
|
|
22
|
-
.replace(/\\r/g, '\r') // carriage return
|
|
23
|
-
.replace(/\\t/g, '\t') // tab
|
|
24
|
-
.replace(/\\x1b/gi, '\x1b') // escape for arrow keys etc
|
|
25
|
-
.replace(/\\e/g, '\x1b'); // alternative escape notation
|
|
7
|
+
return input.replace(/\\n/g, "\n").replace(/\\r/g, "\r").replace(/\\t/g, " ").replace(/\\x1b/gi, "\x1B").replace(/\\e/g, "\x1B");
|
|
26
8
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
-
|
|
38
|
-
|
|
39
|
-
|
|
9
|
+
const SHELL_INPUT_SYSTEM_PROMPT = `You are a specialized AI agent that ONLY provides input to an interactive shell command.
|
|
10
|
+
|
|
11
|
+
CRITICAL RULES:
|
|
12
|
+
1. You may ONLY use the execute_command tool with shell_input parameter
|
|
13
|
+
2. NEVER try to start a new command - only send input to the EXISTING running shell
|
|
14
|
+
3. Respond with ONLY the tool call - no explanations needed
|
|
15
|
+
4. Set SafeToAutoRun: true to avoid approval prompts
|
|
16
|
+
5. For password prompts, DO NOT provide passwords - skip with a neutral response
|
|
17
|
+
6. IMPORTANT: The shell_input value will automatically have Enter pressed after it
|
|
18
|
+
- Just provide the text you want to type, the system will press Enter
|
|
19
|
+
- For example: shell_input="1" NOT shell_input="1\\n"
|
|
20
|
+
|
|
40
21
|
Your ONLY job is to analyze shell output and provide appropriate input when prompted.`;
|
|
41
|
-
// ==================== ShellInputAgent Class ====================
|
|
42
22
|
class ShellInputAgentClass {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
23
|
+
sessions = /* @__PURE__ */ new Map();
|
|
24
|
+
toolRegistry;
|
|
25
|
+
onShellInput;
|
|
26
|
+
onToolExecutionUpdate;
|
|
27
|
+
onPromptAnswered;
|
|
28
|
+
// Callback when a prompt has been answered
|
|
29
|
+
processingLock = /* @__PURE__ */ new Map();
|
|
30
|
+
// Prevent concurrent AI calls per shell
|
|
31
|
+
/**
|
|
32
|
+
* Initialize the agent with a tool registry
|
|
33
|
+
*/
|
|
34
|
+
initialize(toolRegistry) {
|
|
35
|
+
this.toolRegistry = toolRegistry;
|
|
36
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] Initialized with tool registry
|
|
37
|
+
`);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Set callback for sending input to shell (bridges to App.tsx's onShellInput)
|
|
41
|
+
*/
|
|
42
|
+
setOnShellInput(callback) {
|
|
43
|
+
this.onShellInput = callback;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Set callback for tool execution updates (for UI feedback)
|
|
47
|
+
*/
|
|
48
|
+
setOnToolExecutionUpdate(callback) {
|
|
49
|
+
this.onToolExecutionUpdate = callback;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Set callback for when a prompt has been answered
|
|
53
|
+
* This is used to update the UI to show a tick instead of spinner
|
|
54
|
+
*/
|
|
55
|
+
setOnPromptAnswered(callback) {
|
|
56
|
+
this.onPromptAnswered = callback;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Start a new shell input session
|
|
60
|
+
* @param shellId Unique identifier for this shell session
|
|
61
|
+
* @param command The command being run
|
|
62
|
+
* @param cwd Current working directory
|
|
63
|
+
* @param mainConversation Optional main agent conversation history for context
|
|
64
|
+
*/
|
|
65
|
+
startSession(shellId, command, cwd, mainConversation) {
|
|
66
|
+
this.terminateSession(shellId);
|
|
67
|
+
const session = {
|
|
68
|
+
shellId,
|
|
69
|
+
command,
|
|
70
|
+
cwd,
|
|
71
|
+
isActive: true,
|
|
72
|
+
abortController: new AbortController(),
|
|
73
|
+
conversationHistory: [],
|
|
74
|
+
mainConversationContext: mainConversation,
|
|
75
|
+
turnCount: 0,
|
|
76
|
+
startTime: /* @__PURE__ */ new Date()
|
|
77
|
+
};
|
|
78
|
+
this.sessions.set(shellId, session);
|
|
79
|
+
this.processingLock.set(shellId, false);
|
|
80
|
+
const contextInfo = mainConversation ? ` (with ${mainConversation.length} context messages)` : "";
|
|
81
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] Started session for ${shellId}: ${command}${contextInfo}
|
|
82
|
+
`);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Handle an input prompt detected in shell output
|
|
86
|
+
* Returns quickly - AI call runs in background
|
|
87
|
+
*/
|
|
88
|
+
async handleInputPrompt(shellId, shellOutput, promptContext, inputType, confidence) {
|
|
89
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] handleInputPrompt called for ${shellId}, sessions count: ${this.sessions.size}
|
|
90
|
+
`);
|
|
91
|
+
const session = this.sessions.get(shellId);
|
|
92
|
+
if (!session || !session.isActive) {
|
|
93
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] No active session for ${shellId}, ignoring prompt
|
|
94
|
+
`);
|
|
95
|
+
return;
|
|
55
96
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.onShellInput = callback;
|
|
97
|
+
if (this.processingLock.get(shellId)) {
|
|
98
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] Already processing for ${shellId}, ignoring duplicate
|
|
99
|
+
`);
|
|
100
|
+
return;
|
|
61
101
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
102
|
+
this.processingLock.set(shellId, true);
|
|
103
|
+
this.processInputPrompt(session, shellOutput, promptContext, inputType, confidence).catch((error) => {
|
|
104
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] Error processing prompt for ${shellId}: ${error.message}
|
|
105
|
+
`);
|
|
106
|
+
}).finally(() => {
|
|
107
|
+
this.processingLock.set(shellId, false);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Process an input prompt with AI
|
|
112
|
+
*/
|
|
113
|
+
async processInputPrompt(session, shellOutput, promptContext, inputType, confidence) {
|
|
114
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] processInputPrompt entry for ${session.shellId}, isActive=${session.isActive}, turnCount=${session.turnCount}
|
|
115
|
+
`);
|
|
116
|
+
if (!session.isActive) {
|
|
117
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] Session not active, returning
|
|
118
|
+
`);
|
|
119
|
+
return;
|
|
67
120
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
setOnPromptAnswered(callback) {
|
|
73
|
-
this.onPromptAnswered = callback;
|
|
121
|
+
if (session.turnCount >= MAX_TURNS_PER_SESSION) {
|
|
122
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] Session ${session.shellId} hit max turns
|
|
123
|
+
`);
|
|
124
|
+
return;
|
|
74
125
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
* @param cwd Current working directory
|
|
80
|
-
* @param mainConversation Optional main agent conversation history for context
|
|
81
|
-
*/
|
|
82
|
-
startSession(shellId, command, cwd, mainConversation) {
|
|
83
|
-
// Terminate any existing session for this shell
|
|
84
|
-
this.terminateSession(shellId);
|
|
85
|
-
const session = {
|
|
86
|
-
shellId,
|
|
87
|
-
command,
|
|
88
|
-
cwd,
|
|
89
|
-
isActive: true,
|
|
90
|
-
abortController: new AbortController(),
|
|
91
|
-
conversationHistory: [],
|
|
92
|
-
mainConversationContext: mainConversation,
|
|
93
|
-
turnCount: 0,
|
|
94
|
-
startTime: new Date()
|
|
95
|
-
};
|
|
96
|
-
this.sessions.set(shellId, session);
|
|
97
|
-
this.processingLock.set(shellId, false);
|
|
98
|
-
const contextInfo = mainConversation ? ` (with ${mainConversation.length} context messages)` : '';
|
|
99
|
-
quickLog(`[${new Date().toISOString()}] [ShellInputAgent] Started session for ${shellId}: ${command}${contextInfo}\n`);
|
|
126
|
+
if (!sessionQuotaManager.canSendMessage()) {
|
|
127
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] Session quota exhausted
|
|
128
|
+
`);
|
|
129
|
+
return;
|
|
100
130
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
async handleInputPrompt(shellId, shellOutput, promptContext, inputType, confidence) {
|
|
106
|
-
quickLog(`[${new Date().toISOString()}] [ShellInputAgent] handleInputPrompt called for ${shellId}, sessions count: ${this.sessions.size}\n`);
|
|
107
|
-
const session = this.sessions.get(shellId);
|
|
108
|
-
if (!session || !session.isActive) {
|
|
109
|
-
quickLog(`[${new Date().toISOString()}] [ShellInputAgent] No active session for ${shellId}, ignoring prompt\n`);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
// Check if already processing a prompt for this shell
|
|
113
|
-
if (this.processingLock.get(shellId)) {
|
|
114
|
-
quickLog(`[${new Date().toISOString()}] [ShellInputAgent] Already processing for ${shellId}, ignoring duplicate\n`);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
// Set lock
|
|
118
|
-
this.processingLock.set(shellId, true);
|
|
119
|
-
// Run AI call in background (don't await)
|
|
120
|
-
this.processInputPrompt(session, shellOutput, promptContext, inputType, confidence)
|
|
121
|
-
.catch(error => {
|
|
122
|
-
quickLog(`[${new Date().toISOString()}] [ShellInputAgent] Error processing prompt for ${shellId}: ${error.message}\n`);
|
|
123
|
-
})
|
|
124
|
-
.finally(() => {
|
|
125
|
-
this.processingLock.set(shellId, false);
|
|
126
|
-
});
|
|
131
|
+
if (!this.toolRegistry) {
|
|
132
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] Tool registry not initialized
|
|
133
|
+
`);
|
|
134
|
+
return;
|
|
127
135
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
136
|
+
session.turnCount++;
|
|
137
|
+
session.lastInputTime = /* @__PURE__ */ new Date();
|
|
138
|
+
const userPrompt = this.buildInputPrompt(session, shellOutput, promptContext, inputType, confidence);
|
|
139
|
+
if (session.conversationHistory.length === 0) {
|
|
140
|
+
session.conversationHistory.push({
|
|
141
|
+
role: "user",
|
|
142
|
+
content: SHELL_INPUT_SYSTEM_PROMPT + "\n\n" + userPrompt
|
|
143
|
+
});
|
|
144
|
+
} else {
|
|
145
|
+
session.conversationHistory.push({
|
|
146
|
+
role: "user",
|
|
147
|
+
content: userPrompt
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
const executeCommandSchema = this.toolRegistry.getSchemas().filter((t) => t.name === "execute_command");
|
|
151
|
+
try {
|
|
152
|
+
let assistantMessage = "";
|
|
153
|
+
let toolCalls = [];
|
|
154
|
+
sessionQuotaManager.incrementMessageCount();
|
|
155
|
+
for await (const chunk of aiServiceClient.streamChat(
|
|
156
|
+
MODEL,
|
|
157
|
+
session.conversationHistory,
|
|
158
|
+
executeCommandSchema,
|
|
159
|
+
{
|
|
160
|
+
cwd: session.cwd,
|
|
161
|
+
platform: process.platform,
|
|
162
|
+
shell: process.env.SHELL || "cmd.exe",
|
|
163
|
+
os: "windows",
|
|
164
|
+
homeDir: process.env.USERPROFILE || ""
|
|
165
|
+
},
|
|
166
|
+
void 0,
|
|
167
|
+
void 0,
|
|
168
|
+
session.abortController.signal
|
|
169
|
+
)) {
|
|
133
170
|
if (!session.isActive) {
|
|
134
|
-
|
|
135
|
-
|
|
171
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] Session ${session.shellId} terminated during streaming
|
|
172
|
+
`);
|
|
173
|
+
return;
|
|
136
174
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
quickLog(`[${new Date().toISOString()}] [ShellInputAgent] Session ${session.shellId} hit max turns\n`);
|
|
140
|
-
return;
|
|
175
|
+
if (chunk.type === "error") {
|
|
176
|
+
throw new Error(chunk.message);
|
|
141
177
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
quickLog(`[${new Date().toISOString()}] [ShellInputAgent] Session quota exhausted\n`);
|
|
145
|
-
return;
|
|
178
|
+
if (chunk.type === "text") {
|
|
179
|
+
assistantMessage += chunk.content;
|
|
146
180
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
181
|
+
if (chunk.type === "tool_call") {
|
|
182
|
+
const toolCall = chunk.toolCall;
|
|
183
|
+
if (toolCall.arguments && typeof toolCall.arguments === "string") {
|
|
184
|
+
try {
|
|
185
|
+
toolCall.arguments = JSON.parse(toolCall.arguments);
|
|
186
|
+
} catch (e) {
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
toolCalls.push(toolCall);
|
|
190
|
+
}
|
|
191
|
+
if (chunk.type === "done") {
|
|
192
|
+
break;
|
|
151
193
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
if (
|
|
158
|
-
|
|
194
|
+
}
|
|
195
|
+
if (!session.isActive) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
for (const toolCall of toolCalls) {
|
|
199
|
+
if (toolCall.name === "execute_command" && toolCall.arguments?.shell_input) {
|
|
200
|
+
const rawShellInput = toolCall.arguments.shell_input;
|
|
201
|
+
let shellInput = convertEscapeSequences(rawShellInput);
|
|
202
|
+
if (!shellInput.endsWith("\n") && !shellInput.endsWith("\r")) {
|
|
203
|
+
shellInput += "\r";
|
|
204
|
+
}
|
|
205
|
+
if (this.onShellInput) {
|
|
206
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] Sending input to ${session.shellId}: "${rawShellInput}" + Enter
|
|
207
|
+
`);
|
|
208
|
+
this.onShellInput(session.shellId, shellInput);
|
|
209
|
+
if (this.onPromptAnswered) {
|
|
210
|
+
this.onPromptAnswered(session.shellId);
|
|
211
|
+
}
|
|
159
212
|
session.conversationHistory.push({
|
|
160
|
-
|
|
161
|
-
|
|
213
|
+
role: "assistant",
|
|
214
|
+
content: "",
|
|
215
|
+
tool_calls: [toolCall]
|
|
162
216
|
});
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
217
|
session.conversationHistory.push({
|
|
166
|
-
|
|
167
|
-
|
|
218
|
+
role: "tool",
|
|
219
|
+
tool_call_id: toolCall.id,
|
|
220
|
+
content: `Sent input to shell: ${shellInput}`
|
|
168
221
|
});
|
|
222
|
+
}
|
|
169
223
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
for await (const chunk of aiServiceClient.streamChat(MODEL, session.conversationHistory, executeCommandSchema, {
|
|
179
|
-
cwd: session.cwd,
|
|
180
|
-
platform: process.platform,
|
|
181
|
-
shell: process.env.SHELL || 'cmd.exe',
|
|
182
|
-
os: 'windows',
|
|
183
|
-
homeDir: process.env.USERPROFILE || ''
|
|
184
|
-
}, undefined, undefined, session.abortController.signal)) {
|
|
185
|
-
// Check if session was terminated
|
|
186
|
-
if (!session.isActive) {
|
|
187
|
-
quickLog(`[${new Date().toISOString()}] [ShellInputAgent] Session ${session.shellId} terminated during streaming\n`);
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
if (chunk.type === 'error') {
|
|
191
|
-
throw new Error(chunk.message);
|
|
192
|
-
}
|
|
193
|
-
if (chunk.type === 'text') {
|
|
194
|
-
assistantMessage += chunk.content;
|
|
195
|
-
}
|
|
196
|
-
if (chunk.type === 'tool_call') {
|
|
197
|
-
const toolCall = chunk.toolCall;
|
|
198
|
-
// Parse string arguments if needed
|
|
199
|
-
if (toolCall.arguments && typeof toolCall.arguments === 'string') {
|
|
200
|
-
try {
|
|
201
|
-
toolCall.arguments = JSON.parse(toolCall.arguments);
|
|
202
|
-
}
|
|
203
|
-
catch (e) {
|
|
204
|
-
// Ignore parsing error
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
toolCalls.push(toolCall);
|
|
208
|
-
}
|
|
209
|
-
if (chunk.type === 'done') {
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
// Check again if session is still active
|
|
214
|
-
if (!session.isActive) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
// Process tool calls
|
|
218
|
-
for (const toolCall of toolCalls) {
|
|
219
|
-
if (toolCall.name === 'execute_command' && toolCall.arguments?.shell_input) {
|
|
220
|
-
const rawShellInput = toolCall.arguments.shell_input;
|
|
221
|
-
// Convert escape sequences like \n to actual newlines
|
|
222
|
-
let shellInput = convertEscapeSequences(rawShellInput);
|
|
223
|
-
// Automatically append Enter (carriage return) if not already present
|
|
224
|
-
// This ensures the input is actually submitted to the shell
|
|
225
|
-
if (!shellInput.endsWith('\n') && !shellInput.endsWith('\r')) {
|
|
226
|
-
shellInput += '\r';
|
|
227
|
-
}
|
|
228
|
-
// Send input to shell via callback
|
|
229
|
-
if (this.onShellInput) {
|
|
230
|
-
quickLog(`[${new Date().toISOString()}] [ShellInputAgent] Sending input to ${session.shellId}: "${rawShellInput}" + Enter\n`);
|
|
231
|
-
this.onShellInput(session.shellId, shellInput);
|
|
232
|
-
// Notify that a prompt has been answered (to update UI spinner -> tick)
|
|
233
|
-
if (this.onPromptAnswered) {
|
|
234
|
-
this.onPromptAnswered(session.shellId);
|
|
235
|
-
}
|
|
236
|
-
// Add to conversation history
|
|
237
|
-
session.conversationHistory.push({
|
|
238
|
-
role: 'assistant',
|
|
239
|
-
content: '',
|
|
240
|
-
tool_calls: [toolCall]
|
|
241
|
-
});
|
|
242
|
-
session.conversationHistory.push({
|
|
243
|
-
role: 'tool',
|
|
244
|
-
tool_call_id: toolCall.id,
|
|
245
|
-
content: `Sent input to shell: ${shellInput}`
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
catch (error) {
|
|
252
|
-
if (error.name === 'AbortError') {
|
|
253
|
-
quickLog(`[${new Date().toISOString()}] [ShellInputAgent] Session ${session.shellId} aborted\n`);
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
throw error;
|
|
257
|
-
}
|
|
224
|
+
}
|
|
225
|
+
} catch (error) {
|
|
226
|
+
if (error.name === "AbortError") {
|
|
227
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] Session ${session.shellId} aborted
|
|
228
|
+
`);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
throw error;
|
|
258
232
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
**User's Original Intent (from main conversation):**
|
|
277
|
-
\`\`\`
|
|
278
|
-
${userMessages.substring(0, 1000)}${userMessages.length > 1000 ? '...[truncated]' : ''}
|
|
279
|
-
\`\`\`
|
|
280
|
-
|
|
281
|
-
Consider the user's original intent when providing input. If the user mentioned specific values to use, prefer those.
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Build the input prompt for AI
|
|
236
|
+
*/
|
|
237
|
+
buildInputPrompt(session, shellOutput, promptContext, inputType, confidence) {
|
|
238
|
+
const lastLines = shellOutput.split("\n").slice(-30).join("\n");
|
|
239
|
+
let conversationContext = "";
|
|
240
|
+
if (session.mainConversationContext && session.mainConversationContext.length > 0) {
|
|
241
|
+
const userMessages = session.mainConversationContext.filter((msg) => msg.role === "user" && typeof msg.content === "string").map((msg) => msg.content).slice(-3).join("\n---\n");
|
|
242
|
+
if (userMessages) {
|
|
243
|
+
conversationContext = `
|
|
244
|
+
**User's Original Intent (from main conversation):**
|
|
245
|
+
\`\`\`
|
|
246
|
+
${userMessages.substring(0, 1e3)}${userMessages.length > 1e3 ? "...[truncated]" : ""}
|
|
247
|
+
\`\`\`
|
|
248
|
+
|
|
249
|
+
Consider the user's original intent when providing input. If the user mentioned specific values to use, prefer those.
|
|
282
250
|
`;
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
return `[SHELL INPUT REQUIRED]
|
|
286
|
-
|
|
287
|
-
**Running command:** ${session.command}
|
|
288
|
-
**Working directory:** ${session.cwd}
|
|
289
|
-
${conversationContext}
|
|
290
|
-
**Current shell output (last 30 lines):**
|
|
291
|
-
\`\`\`
|
|
292
|
-
${lastLines}
|
|
293
|
-
\`\`\`
|
|
294
|
-
|
|
295
|
-
**Detected prompt:** ${promptContext}
|
|
296
|
-
**Input type needed:** ${inputType}
|
|
297
|
-
**Confidence:** ${confidence}
|
|
298
|
-
|
|
299
|
-
Use execute_command with shell_input to respond. Example:
|
|
300
|
-
{
|
|
301
|
-
"tool": "execute_command",
|
|
302
|
-
"arguments": {
|
|
303
|
-
"shell_input": "YOUR_INPUT_HERE",
|
|
304
|
-
"SafeToAutoRun": true,
|
|
305
|
-
"CommandLine": "${session.command}",
|
|
306
|
-
"Cwd": "${session.cwd}"
|
|
307
|
-
}
|
|
308
|
-
}`;
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Terminate a shell input session immediately
|
|
312
|
-
*/
|
|
313
|
-
terminateSession(shellId) {
|
|
314
|
-
const session = this.sessions.get(shellId);
|
|
315
|
-
if (session) {
|
|
316
|
-
quickLog(`[${new Date().toISOString()}] [ShellInputAgent] Terminating session ${shellId}\n`);
|
|
317
|
-
// Mark as inactive first
|
|
318
|
-
session.isActive = false;
|
|
319
|
-
// Abort any running AI call
|
|
320
|
-
try {
|
|
321
|
-
session.abortController.abort();
|
|
322
|
-
}
|
|
323
|
-
catch (e) {
|
|
324
|
-
// Ignore abort errors
|
|
325
|
-
}
|
|
326
|
-
// Clean up
|
|
327
|
-
this.sessions.delete(shellId);
|
|
328
|
-
this.processingLock.delete(shellId);
|
|
329
|
-
}
|
|
251
|
+
}
|
|
330
252
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
253
|
+
return `[SHELL INPUT REQUIRED]
|
|
254
|
+
|
|
255
|
+
**Running command:** ${session.command}
|
|
256
|
+
**Working directory:** ${session.cwd}
|
|
257
|
+
${conversationContext}
|
|
258
|
+
**Current shell output (last 30 lines):**
|
|
259
|
+
\`\`\`
|
|
260
|
+
${lastLines}
|
|
261
|
+
\`\`\`
|
|
262
|
+
|
|
263
|
+
**Detected prompt:** ${promptContext}
|
|
264
|
+
**Input type needed:** ${inputType}
|
|
265
|
+
**Confidence:** ${confidence}
|
|
266
|
+
|
|
267
|
+
Use execute_command with shell_input to respond. Example:
|
|
268
|
+
{
|
|
269
|
+
"tool": "execute_command",
|
|
270
|
+
"arguments": {
|
|
271
|
+
"shell_input": "YOUR_INPUT_HERE",
|
|
272
|
+
"SafeToAutoRun": true,
|
|
273
|
+
"CommandLine": "${session.command}",
|
|
274
|
+
"Cwd": "${session.cwd}"
|
|
275
|
+
}
|
|
276
|
+
}`;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Terminate a shell input session immediately
|
|
280
|
+
*/
|
|
281
|
+
terminateSession(shellId) {
|
|
282
|
+
const session = this.sessions.get(shellId);
|
|
283
|
+
if (session) {
|
|
284
|
+
quickLog(`[${(/* @__PURE__ */ new Date()).toISOString()}] [ShellInputAgent] Terminating session ${shellId}
|
|
285
|
+
`);
|
|
286
|
+
session.isActive = false;
|
|
287
|
+
try {
|
|
288
|
+
session.abortController.abort();
|
|
289
|
+
} catch (e) {
|
|
290
|
+
}
|
|
291
|
+
this.sessions.delete(shellId);
|
|
292
|
+
this.processingLock.delete(shellId);
|
|
349
293
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Check if a session is active
|
|
297
|
+
*/
|
|
298
|
+
isSessionActive(shellId) {
|
|
299
|
+
const session = this.sessions.get(shellId);
|
|
300
|
+
return session?.isActive ?? false;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Get session info (for debugging)
|
|
304
|
+
*/
|
|
305
|
+
getSessionInfo(shellId) {
|
|
306
|
+
const session = this.sessions.get(shellId);
|
|
307
|
+
if (!session) return void 0;
|
|
308
|
+
return {
|
|
309
|
+
turnCount: session.turnCount,
|
|
310
|
+
isActive: session.isActive
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Terminate all active sessions
|
|
315
|
+
*/
|
|
316
|
+
terminateAllSessions() {
|
|
317
|
+
for (const shellId of this.sessions.keys()) {
|
|
318
|
+
this.terminateSession(shellId);
|
|
357
319
|
}
|
|
320
|
+
}
|
|
358
321
|
}
|
|
359
|
-
|
|
360
|
-
export
|
|
322
|
+
const ShellInputAgent = new ShellInputAgentClass();
|
|
323
|
+
export {
|
|
324
|
+
ShellInputAgent
|
|
325
|
+
};
|
|
361
326
|
//# sourceMappingURL=shell-input-agent.js.map
|