centaurus-cli 3.0.1 → 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 -5158
- 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 +1526 -1512
- 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 +601 -572
- 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 -406
- 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 -3263
- 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 -514
- 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 -204
- 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,243 @@
|
|
|
1
|
-
import React, { useEffect, useState, useRef } from
|
|
2
|
-
import { Box, Text, useInput } from
|
|
3
|
-
import Spinner from
|
|
4
|
-
import stripAnsi from
|
|
5
|
-
import { encodeKeyToAnsi } from
|
|
6
|
-
import { processTerminalOutput } from
|
|
7
|
-
import { TERMINAL_HEIGHT_CONSTANTS } from
|
|
8
|
-
import { sanitizeUnicode } from
|
|
9
|
-
/**
|
|
10
|
-
* Format CWD with remote context prefix for SSH/Docker/WSL environments.
|
|
11
|
-
*/
|
|
1
|
+
import React, { useEffect, useState, useRef } from "react";
|
|
2
|
+
import { Box, Text, useInput } from "ink";
|
|
3
|
+
import Spinner from "ink-spinner";
|
|
4
|
+
import stripAnsi from "strip-ansi";
|
|
5
|
+
import { encodeKeyToAnsi } from "../../utils/ansi-encoder.js";
|
|
6
|
+
import { processTerminalOutput } from "../../utils/terminal-output.js";
|
|
7
|
+
import { TERMINAL_HEIGHT_CONSTANTS } from "../../hooks/useTerminalDimensions.js";
|
|
8
|
+
import { sanitizeUnicode } from "../../utils/unicode-sanitizer.js";
|
|
12
9
|
function formatCwdWithContext(cwd, remoteContext) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
if (remoteContext && cwd) {
|
|
11
|
+
return `${remoteContext}:${cwd.replace(/\\/g, "/")}`;
|
|
12
|
+
}
|
|
13
|
+
return cwd;
|
|
17
14
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Truncate long commands for display to prevent rendering issues
|
|
20
|
-
* @param command - The command string to truncate
|
|
21
|
-
* @param maxLength - Maximum length before truncation (default: 80)
|
|
22
|
-
* @returns Truncated command with ellipsis if needed
|
|
23
|
-
*/
|
|
24
15
|
function truncateCommand(command, maxLength = 80) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return command.substring(0, maxLength) + '...';
|
|
16
|
+
if (!command || command.length <= maxLength) return command;
|
|
17
|
+
return command.substring(0, maxLength) + "...";
|
|
28
18
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
handleResize();
|
|
85
|
-
process.stdout.on('resize', handleResize);
|
|
86
|
-
return () => {
|
|
87
|
-
process.stdout.off('resize', handleResize);
|
|
88
|
-
};
|
|
89
|
-
}, [onResize, isRunning]);
|
|
90
|
-
// Get processed output and calculate total lines
|
|
91
|
-
// Memoize this to prevent expensive re-processing on every render/blink
|
|
92
|
-
// Only re-process if output changes or cursor state changes
|
|
93
|
-
const { lines, total } = React.useMemo(() => {
|
|
94
|
-
if (!output)
|
|
95
|
-
return { lines: [], total: 0 };
|
|
96
|
-
const highlightCursor = isFocused && showCursor && cursorVisible;
|
|
97
|
-
const processedOutput = processTerminalOutput(output, { highlightCursor });
|
|
98
|
-
const splitLines = processedOutput.split('\n');
|
|
99
|
-
return { lines: splitLines, total: splitLines.length };
|
|
100
|
-
}, [output, isFocused, showCursor, cursorVisible]);
|
|
101
|
-
// Helper to access lines (replacing getProcessedOutput call)
|
|
102
|
-
// const getProcessedOutput = () => ... REMOVED
|
|
103
|
-
// Get visible lines based on scroll offset
|
|
104
|
-
const getVisibleOutput = () => {
|
|
105
|
-
// const { lines, total } = getProcessedOutput(); // Replaced by useMemo above
|
|
106
|
-
totalLinesRef.current = total;
|
|
107
|
-
if (total === 0)
|
|
108
|
-
return '';
|
|
109
|
-
// SAFETY: Use current terminal width for wrapping calculations
|
|
110
|
-
const cols = process.stdout.columns || 80;
|
|
111
|
-
// STRICT HEIGHT CALCULATION
|
|
112
|
-
// We must count *visual* lines (how many rows a line takes up when wrapped)
|
|
113
|
-
// otherwise a single long line could blow out our height budget
|
|
114
|
-
let visualLineCount = 0;
|
|
115
|
-
const visualLinesMap = new Array(lines.length).fill(1);
|
|
116
|
-
// 1. Calculate visual height of all lines
|
|
117
|
-
// precise calculation is expensive, so we estimate: length / columns
|
|
118
|
-
for (let i = 0; i < lines.length; i++) {
|
|
119
|
-
const line = lines[i];
|
|
120
|
-
const stripped = stripAnsi(line || '');
|
|
121
|
-
// Minimum 1 row, ceil(length/cols) for wrapping
|
|
122
|
-
// We add a small buffer for safety margin in calculation logic
|
|
123
|
-
const rows = Math.max(1, Math.ceil(stripped.length / cols));
|
|
124
|
-
visualLinesMap[i] = rows;
|
|
125
|
-
}
|
|
126
|
-
// 2. Determine which lines to show based on scrollOffset
|
|
127
|
-
// We work backwards from the bottom (latest output)
|
|
128
|
-
const visibleLinesToRender = [];
|
|
129
|
-
let currentHeight = 0;
|
|
130
|
-
// Apply scroll offset - skip N visual lines from bottom
|
|
131
|
-
// This is a simplified approach: we skip logical lines until we pass the visual offset
|
|
132
|
-
// Ideally we would skip pixel-perfect but logical-line skipping is safer for now
|
|
133
|
-
let linesToSkip = scrollOffset;
|
|
134
|
-
let startIndex = lines.length - 1;
|
|
135
|
-
// Adjust start index based on scroll
|
|
136
|
-
while (linesToSkip > 0 && startIndex >= 0) {
|
|
137
|
-
// We treat scrollOffset as "logical lines" for consistency with existing UX controls
|
|
138
|
-
// or we could treat it as visual lines?
|
|
139
|
-
// Existing behavior: scrollOffset is logical lines. Let's keep that for predictable scrolling.
|
|
140
|
-
linesToSkip--;
|
|
141
|
-
startIndex--;
|
|
142
|
-
}
|
|
143
|
-
// 3. Collect lines that fit in maxVisibleLines
|
|
144
|
-
for (let i = startIndex; i >= 0; i--) {
|
|
145
|
-
const lineRows = visualLinesMap[i];
|
|
146
|
-
// If adding this line exceeds max height, we stop
|
|
147
|
-
// Exception: Always show at least one line if it's the only one
|
|
148
|
-
if (currentHeight + lineRows > maxVisibleLines && visibleLinesToRender.length > 0) {
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
visibleLinesToRender.unshift(lines[i]);
|
|
152
|
-
currentHeight += lineRows;
|
|
153
|
-
}
|
|
154
|
-
return visibleLinesToRender.join('\n');
|
|
155
|
-
};
|
|
156
|
-
// Reset scroll offset when exiting focus mode
|
|
157
|
-
useEffect(() => {
|
|
158
|
-
if (!isFocused) {
|
|
159
|
-
setScrollOffset(0);
|
|
160
|
-
isAutoFollowRef.current = true;
|
|
161
|
-
}
|
|
162
|
-
}, [isFocused]);
|
|
163
|
-
// Track previous total lines to adjust scroll offset when new output arrives
|
|
164
|
-
const prevTotalLinesRef = useRef(0);
|
|
165
|
-
// When new output comes in and user is scrolled up, adjust offset to maintain position
|
|
166
|
-
useEffect(() => {
|
|
167
|
-
// const { total } = getProcessedOutput(); // Replaced by useMemo
|
|
168
|
-
const prevTotal = prevTotalLinesRef.current;
|
|
169
|
-
if (prevTotal > 0 && total > prevTotal && !isAutoFollowRef.current && scrollOffset > 0) {
|
|
170
|
-
// New lines were added while user is scrolled up
|
|
171
|
-
// Increase scroll offset by the number of new lines to stay at the same position
|
|
172
|
-
const newLines = total - prevTotal;
|
|
173
|
-
const maxOffset = Math.max(0, total - maxVisibleLines);
|
|
174
|
-
setScrollOffset(prev => Math.min(prev + newLines, maxOffset));
|
|
175
|
-
}
|
|
176
|
-
prevTotalLinesRef.current = total;
|
|
177
|
-
}, [output, maxVisibleLines, total]);
|
|
178
|
-
// Handle input - PTY mode sends everything immediately
|
|
179
|
-
useInput((input, key) => {
|
|
180
|
-
if (!isFocused)
|
|
181
|
-
return;
|
|
182
|
-
// Alt+E: Warpify session - detect and attach to remote session
|
|
183
|
-
// Mac: Cmd+E (key.meta) OR Ctrl+E (fallback if Cmd intercepted)
|
|
184
|
-
// Win: Alt+E (key.meta)
|
|
185
|
-
// Note: Ctrl+E might come in as input='\u0005' (ASCII 5) rather than key.ctrl+e
|
|
186
|
-
const isCtrlE = (key.ctrl && input.toLowerCase() === 'e') || input === '\u0005';
|
|
187
|
-
if ((key.meta && input.toLowerCase() === 'e') || isCtrlE) {
|
|
188
|
-
if (onWarpifySession) {
|
|
189
|
-
onWarpifySession();
|
|
190
|
-
}
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
// Alt+I: Toggle agent control mode
|
|
194
|
-
// Mac: Cmd+I (key.meta)
|
|
195
|
-
if (key.meta && input.toLowerCase() === 'i') {
|
|
196
|
-
if (onToggleAgentControl) {
|
|
197
|
-
onToggleAgentControl();
|
|
198
|
-
}
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
// Global: Ctrl+F to exit focus mode
|
|
202
|
-
// BUT: Block if agent controlled AND still running
|
|
203
|
-
if (key.ctrl && input === 'f') {
|
|
204
|
-
if (isAgentControlled && isRunning) {
|
|
205
|
-
// Blocked - can't exit focus while agent controlled and running
|
|
206
|
-
// User must first disable agent control with Alt+I or wait for completion
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
onFocusChange(false);
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
// Scroll controls (only in focus mode, don't send to PTY)
|
|
213
|
-
// Shift+Up: Scroll up one line
|
|
214
|
-
if (key.shift && key.upArrow) {
|
|
215
|
-
const maxOffset = Math.max(0, totalLinesRef.current - maxVisibleLines);
|
|
216
|
-
if (scrollOffset < maxOffset) {
|
|
217
|
-
isAutoFollowRef.current = false;
|
|
218
|
-
setScrollOffset(prev => Math.min(prev + 1, maxOffset));
|
|
219
|
-
}
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
// Shift+Down: Scroll down one line
|
|
223
|
-
if (key.shift && key.downArrow) {
|
|
224
|
-
if (scrollOffset > 0) {
|
|
225
|
-
setScrollOffset(prev => {
|
|
226
|
-
const newOffset = Math.max(prev - 1, 0);
|
|
227
|
-
if (newOffset === 0) {
|
|
228
|
-
isAutoFollowRef.current = true;
|
|
229
|
-
}
|
|
230
|
-
return newOffset;
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
// Page Up: Scroll up one page
|
|
236
|
-
if (key.pageUp) {
|
|
237
|
-
const maxOffset = Math.max(0, totalLinesRef.current - maxVisibleLines);
|
|
238
|
-
if (scrollOffset < maxOffset) {
|
|
239
|
-
isAutoFollowRef.current = false;
|
|
240
|
-
setScrollOffset(prev => Math.min(prev + maxVisibleLines, maxOffset));
|
|
241
|
-
}
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
// Page Down: Scroll down one page
|
|
245
|
-
if (key.pageDown) {
|
|
246
|
-
if (scrollOffset > 0) {
|
|
247
|
-
setScrollOffset(prev => {
|
|
248
|
-
const newOffset = Math.max(prev - maxVisibleLines, 0);
|
|
249
|
-
if (newOffset === 0) {
|
|
250
|
-
isAutoFollowRef.current = true;
|
|
251
|
-
}
|
|
252
|
-
return newOffset;
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
// Below this point, we need onInput to send to PTY
|
|
258
|
-
if (!onInput)
|
|
259
|
-
return;
|
|
260
|
-
// Ctrl+C - send to PTY AND signal backend for forceful termination
|
|
261
|
-
if (key.ctrl && input === 'c') {
|
|
262
|
-
onInput('\x03');
|
|
263
|
-
if (onSignal) {
|
|
264
|
-
onSignal('SIGINT');
|
|
265
|
-
}
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
// Ctrl+D - EOF
|
|
269
|
-
if (key.ctrl && input === 'd') {
|
|
270
|
-
onInput('\x04');
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
// Ctrl+Z - Suspend
|
|
274
|
-
if (key.ctrl && input === 'z') {
|
|
275
|
-
onInput('\x1A');
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
// Encode and send all keys immediately
|
|
279
|
-
const encoded = encodeKeyToAnsi(input, key);
|
|
280
|
-
if (encoded) {
|
|
281
|
-
onInput(encoded);
|
|
282
|
-
}
|
|
283
|
-
}, { isActive: isFocused });
|
|
284
|
-
// Determine border color and icon based on status
|
|
285
|
-
const getBorderColor = () => {
|
|
286
|
-
if (isRunning)
|
|
287
|
-
return '#00ccff';
|
|
288
|
-
if (error || (exitCode !== undefined && exitCode !== 0))
|
|
289
|
-
return '#ff3366';
|
|
290
|
-
return '#00cc66';
|
|
19
|
+
const InteractiveShell = React.memo(({
|
|
20
|
+
command,
|
|
21
|
+
cwd,
|
|
22
|
+
isRunning,
|
|
23
|
+
output,
|
|
24
|
+
exitCode,
|
|
25
|
+
error,
|
|
26
|
+
onInput,
|
|
27
|
+
isFocused,
|
|
28
|
+
onFocusChange,
|
|
29
|
+
onSignal,
|
|
30
|
+
onResize,
|
|
31
|
+
remoteContext,
|
|
32
|
+
shellId,
|
|
33
|
+
isAgentControlled = false,
|
|
34
|
+
showCursor = true,
|
|
35
|
+
onToggleAgentControl,
|
|
36
|
+
onWarpifySession
|
|
37
|
+
}) => {
|
|
38
|
+
const isMac = process.platform === "darwin";
|
|
39
|
+
const [scrollOffset, setScrollOffset] = useState(0);
|
|
40
|
+
const isAutoFollowRef = useRef(true);
|
|
41
|
+
const totalLinesRef = useRef(0);
|
|
42
|
+
const [cursorVisible, setCursorVisible] = useState(true);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (!isFocused || !showCursor) return;
|
|
45
|
+
const interval = setInterval(() => {
|
|
46
|
+
setCursorVisible((v) => !v);
|
|
47
|
+
}, 530);
|
|
48
|
+
return () => clearInterval(interval);
|
|
49
|
+
}, [isFocused, showCursor]);
|
|
50
|
+
const terminalRows = process.stdout.rows || 24;
|
|
51
|
+
const {
|
|
52
|
+
INPUT_BOX_RESERVED_HEIGHT,
|
|
53
|
+
SAFETY_BUFFER,
|
|
54
|
+
MIN_STREAMING_LINES
|
|
55
|
+
} = TERMINAL_HEIGHT_CONSTANTS;
|
|
56
|
+
const shellChrome = 5;
|
|
57
|
+
const totalReservedFocused = 12;
|
|
58
|
+
const totalReservedUnfocused = INPUT_BOX_RESERVED_HEIGHT + shellChrome + SAFETY_BUFFER;
|
|
59
|
+
const maxAllowedHeight = Math.floor(terminalRows * 0.75);
|
|
60
|
+
const availableForShellFocused = Math.max(
|
|
61
|
+
MIN_STREAMING_LINES,
|
|
62
|
+
Math.min(terminalRows - totalReservedFocused, maxAllowedHeight)
|
|
63
|
+
);
|
|
64
|
+
const availableForShellUnfocused = Math.max(MIN_STREAMING_LINES, terminalRows - totalReservedUnfocused);
|
|
65
|
+
const rawAgentHeight = Math.floor(availableForShellFocused / 2);
|
|
66
|
+
const agentControlledHeight = Math.max(MIN_STREAMING_LINES, rawAgentHeight);
|
|
67
|
+
const maxVisibleLines = isFocused ? isAgentControlled ? agentControlledHeight : Math.max(MIN_STREAMING_LINES, availableForShellFocused) : Math.max(1, Math.min(5, availableForShellUnfocused));
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (!onResize || !isRunning) return;
|
|
70
|
+
const handleResize = () => {
|
|
71
|
+
const cols = process.stdout.columns || 80;
|
|
72
|
+
const rows = process.stdout.rows || 24;
|
|
73
|
+
onResize(cols, rows);
|
|
291
74
|
};
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
return '✗';
|
|
297
|
-
return '✓';
|
|
75
|
+
handleResize();
|
|
76
|
+
process.stdout.on("resize", handleResize);
|
|
77
|
+
return () => {
|
|
78
|
+
process.stdout.off("resize", handleResize);
|
|
298
79
|
};
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
const
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
80
|
+
}, [onResize, isRunning]);
|
|
81
|
+
const { lines, total } = React.useMemo(() => {
|
|
82
|
+
if (!output) return { lines: [], total: 0 };
|
|
83
|
+
const highlightCursor = isFocused && showCursor && cursorVisible;
|
|
84
|
+
const processedOutput = processTerminalOutput(output, { highlightCursor });
|
|
85
|
+
const splitLines = processedOutput.split("\n");
|
|
86
|
+
return { lines: splitLines, total: splitLines.length };
|
|
87
|
+
}, [output, isFocused, showCursor, cursorVisible]);
|
|
88
|
+
const getVisibleOutput = () => {
|
|
89
|
+
totalLinesRef.current = total;
|
|
90
|
+
if (total === 0) return "";
|
|
91
|
+
const cols = process.stdout.columns || 80;
|
|
92
|
+
let visualLineCount = 0;
|
|
93
|
+
const visualLinesMap = new Array(lines.length).fill(1);
|
|
94
|
+
for (let i = 0; i < lines.length; i++) {
|
|
95
|
+
const line = lines[i];
|
|
96
|
+
const stripped = stripAnsi(line || "");
|
|
97
|
+
const rows = Math.max(1, Math.ceil(stripped.length / cols));
|
|
98
|
+
visualLinesMap[i] = rows;
|
|
99
|
+
}
|
|
100
|
+
const visibleLinesToRender = [];
|
|
101
|
+
let currentHeight = 0;
|
|
102
|
+
let linesToSkip = scrollOffset;
|
|
103
|
+
let startIndex = lines.length - 1;
|
|
104
|
+
while (linesToSkip > 0 && startIndex >= 0) {
|
|
105
|
+
linesToSkip--;
|
|
106
|
+
startIndex--;
|
|
107
|
+
}
|
|
108
|
+
for (let i = startIndex; i >= 0; i--) {
|
|
109
|
+
const lineRows = visualLinesMap[i];
|
|
110
|
+
if (currentHeight + lineRows > maxVisibleLines && visibleLinesToRender.length > 0) {
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
visibleLinesToRender.unshift(lines[i]);
|
|
114
|
+
currentHeight += lineRows;
|
|
115
|
+
}
|
|
116
|
+
return visibleLinesToRender.join("\n");
|
|
117
|
+
};
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
if (!isFocused) {
|
|
120
|
+
setScrollOffset(0);
|
|
121
|
+
isAutoFollowRef.current = true;
|
|
122
|
+
}
|
|
123
|
+
}, [isFocused]);
|
|
124
|
+
const prevTotalLinesRef = useRef(0);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
const prevTotal = prevTotalLinesRef.current;
|
|
127
|
+
if (prevTotal > 0 && total > prevTotal && !isAutoFollowRef.current && scrollOffset > 0) {
|
|
128
|
+
const newLines = total - prevTotal;
|
|
129
|
+
const maxOffset = Math.max(0, total - maxVisibleLines);
|
|
130
|
+
setScrollOffset((prev) => Math.min(prev + newLines, maxOffset));
|
|
131
|
+
}
|
|
132
|
+
prevTotalLinesRef.current = total;
|
|
133
|
+
}, [output, maxVisibleLines, total]);
|
|
134
|
+
useInput((input, key) => {
|
|
135
|
+
if (!isFocused) return;
|
|
136
|
+
const isCtrlE = key.ctrl && input.toLowerCase() === "e" || input === "";
|
|
137
|
+
if (key.meta && input.toLowerCase() === "e" || isCtrlE) {
|
|
138
|
+
if (onWarpifySession) {
|
|
139
|
+
onWarpifySession();
|
|
140
|
+
}
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (key.meta && input.toLowerCase() === "i") {
|
|
144
|
+
if (onToggleAgentControl) {
|
|
145
|
+
onToggleAgentControl();
|
|
146
|
+
}
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (key.ctrl && input === "f") {
|
|
150
|
+
if (isAgentControlled && isRunning) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
onFocusChange(false);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (key.shift && key.upArrow) {
|
|
157
|
+
const maxOffset = Math.max(0, totalLinesRef.current - maxVisibleLines);
|
|
158
|
+
if (scrollOffset < maxOffset) {
|
|
159
|
+
isAutoFollowRef.current = false;
|
|
160
|
+
setScrollOffset((prev) => Math.min(prev + 1, maxOffset));
|
|
161
|
+
}
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (key.shift && key.downArrow) {
|
|
165
|
+
if (scrollOffset > 0) {
|
|
166
|
+
setScrollOffset((prev) => {
|
|
167
|
+
const newOffset = Math.max(prev - 1, 0);
|
|
168
|
+
if (newOffset === 0) {
|
|
169
|
+
isAutoFollowRef.current = true;
|
|
170
|
+
}
|
|
171
|
+
return newOffset;
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (key.pageUp) {
|
|
177
|
+
const maxOffset = Math.max(0, totalLinesRef.current - maxVisibleLines);
|
|
178
|
+
if (scrollOffset < maxOffset) {
|
|
179
|
+
isAutoFollowRef.current = false;
|
|
180
|
+
setScrollOffset((prev) => Math.min(prev + maxVisibleLines, maxOffset));
|
|
181
|
+
}
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (key.pageDown) {
|
|
185
|
+
if (scrollOffset > 0) {
|
|
186
|
+
setScrollOffset((prev) => {
|
|
187
|
+
const newOffset = Math.max(prev - maxVisibleLines, 0);
|
|
188
|
+
if (newOffset === 0) {
|
|
189
|
+
isAutoFollowRef.current = true;
|
|
190
|
+
}
|
|
191
|
+
return newOffset;
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if (!onInput) return;
|
|
197
|
+
if (key.ctrl && input === "c") {
|
|
198
|
+
onInput("");
|
|
199
|
+
if (onSignal) {
|
|
200
|
+
onSignal("SIGINT");
|
|
201
|
+
}
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (key.ctrl && input === "d") {
|
|
205
|
+
onInput("");
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if (key.ctrl && input === "z") {
|
|
209
|
+
onInput("");
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const encoded = encodeKeyToAnsi(input, key);
|
|
213
|
+
if (encoded) {
|
|
214
|
+
onInput(encoded);
|
|
319
215
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
React.createElement(Text, { color: "#666666" },
|
|
344
|
-
"Ctrl+F exit ",
|
|
345
|
-
onWarpifySession ? `| ${isMac ? 'Cmd+E / Ctrl+E' : 'Alt+E'} warpify ` : '',
|
|
346
|
-
"| ",
|
|
347
|
-
isMac ? 'Cmd+I' : 'Alt+I',
|
|
348
|
-
" agent | Shift+\u2191\u2193 scroll")))),
|
|
349
|
-
scrollOffset > 0 && (React.createElement(Box, null,
|
|
350
|
-
React.createElement(Text, { color: "#666666", dimColor: true },
|
|
351
|
-
"\u2191 Scrolled ",
|
|
352
|
-
scrollOffset,
|
|
353
|
-
" line",
|
|
354
|
-
scrollOffset > 1 ? 's' : '',
|
|
355
|
-
" from bottom (viewing history)"))))),
|
|
356
|
-
error && !isRunning && (React.createElement(Box, { marginTop: 1 },
|
|
357
|
-
React.createElement(Text, { color: "#ff3366", wrap: "wrap" }, error.replace(/\r/g, ''))))),
|
|
358
|
-
isRunning && !isFocused && (React.createElement(Box, { marginLeft: 1 },
|
|
359
|
-
React.createElement(Text, { color: "#666666", dimColor: true }, "ctrl + f to focus")))));
|
|
216
|
+
}, { isActive: isFocused });
|
|
217
|
+
const getBorderColor = () => {
|
|
218
|
+
if (isRunning) return "#00ccff";
|
|
219
|
+
if (error || exitCode !== void 0 && exitCode !== 0) return "#ff3366";
|
|
220
|
+
return "#00cc66";
|
|
221
|
+
};
|
|
222
|
+
const getStatusIcon = () => {
|
|
223
|
+
if (isRunning) return /* @__PURE__ */ React.createElement(Spinner, { type: "dots" });
|
|
224
|
+
if (error || exitCode !== void 0 && exitCode !== 0) return "\u2717";
|
|
225
|
+
return "\u2713";
|
|
226
|
+
};
|
|
227
|
+
const color = getBorderColor();
|
|
228
|
+
const visibleOutput = getVisibleOutput();
|
|
229
|
+
const cleanOutput = sanitizeUnicode(visibleOutput);
|
|
230
|
+
const truncatedCommand = truncateCommand(command, 80);
|
|
231
|
+
const currentCols = process.stdout.columns || 80;
|
|
232
|
+
const currentRows = process.stdout.rows || 24;
|
|
233
|
+
const SAFE_MIN_WIDTH = 15;
|
|
234
|
+
const SAFE_MIN_HEIGHT = 5;
|
|
235
|
+
if (currentCols < SAFE_MIN_WIDTH || currentRows < SAFE_MIN_HEIGHT) {
|
|
236
|
+
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "yellow" }, "Terminal too small"), /* @__PURE__ */ React.createElement(Text, { dimColor: true }, currentCols, "x", currentRows));
|
|
237
|
+
}
|
|
238
|
+
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: color, paddingX: 1 }, /* @__PURE__ */ React.createElement(Box, { marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { color, bold: true }, getStatusIcon(), " Shell"), /* @__PURE__ */ React.createElement(Text, { color: "#666666" }, " ", truncatedCommand, " "), /* @__PURE__ */ React.createElement(Text, { color: "#666666", dimColor: true }, "[current working directory ", formatCwdWithContext(cwd, remoteContext), "]")), cleanOutput && /* @__PURE__ */ React.createElement(Box, { height: maxVisibleLines, overflow: "hidden" }, /* @__PURE__ */ React.createElement(Text, { wrap: "wrap" }, cleanOutput)), isFocused && isRunning && /* @__PURE__ */ React.createElement(Box, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, null, isAgentControlled ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Text, { color: "#9945FF", bold: true }, "[ AGENT CONTROL ] "), /* @__PURE__ */ React.createElement(Text, { color: "#666666" }, isMac ? "Cmd+I" : "Alt+I", " to disable | Shift+\u2191\u2193 scroll | PgUp/PgDn page")) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Text, { color: "#ffaa00", bold: true }, "[ FOCUS MODE ] "), /* @__PURE__ */ React.createElement(Text, { color: "#666666" }, "Ctrl+F exit ", onWarpifySession ? `| ${isMac ? "Cmd+E / Ctrl+E" : "Alt+E"} warpify ` : "", "| ", isMac ? "Cmd+I" : "Alt+I", " agent | Shift+\u2191\u2193 scroll"))), scrollOffset > 0 && /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "#666666", dimColor: true }, "\u2191 Scrolled ", scrollOffset, " line", scrollOffset > 1 ? "s" : "", " from bottom (viewing history)"))), error && !isRunning && /* @__PURE__ */ React.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "#ff3366", wrap: "wrap" }, error.replace(/\r/g, "")))), isRunning && !isFocused && /* @__PURE__ */ React.createElement(Box, { marginLeft: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "#666666", dimColor: true }, "ctrl + f to focus")));
|
|
360
239
|
});
|
|
240
|
+
export {
|
|
241
|
+
InteractiveShell
|
|
242
|
+
};
|
|
361
243
|
//# sourceMappingURL=InteractiveShell.js.map
|