(text: string)
| 920 | } |
| 921 | |
| 922 | handleUserInput(text: string): void { |
| 923 | const wasBashMode = this.state.appState.inputMode === 'bash'; |
| 924 | if (wasBashMode) { |
| 925 | // A submit always exits bash mode (the `!` is consumed by this command). |
| 926 | this.state.editor.inputMode = 'prompt'; |
| 927 | this.handleInputModeChange('prompt'); |
| 928 | } |
| 929 | if (text.trim().length === 0) return; |
| 930 | if (this.state.appState.isReplaying) { |
| 931 | this.showError('Cannot send input while session history is replaying.'); |
| 932 | return; |
| 933 | } |
| 934 | // Shell commands are stored with a leading `!` so ↑ recall can tell them |
| 935 | // apart from prompts and restore bash mode (see CustomEditor's mode-aware |
| 936 | // history navigation). The `!` is stripped again when the entry is recalled. |
| 937 | const historyText = wasBashMode ? `!${text}` : text; |
| 938 | void this.persistInputHistory(historyText); |
| 939 | if (wasBashMode) { |
| 940 | // Only one foreground action at a time: queue the shell command while |
| 941 | // another shell command is running or an agent turn is in progress. |
| 942 | if (this.state.appState.streamingPhase !== 'idle') { |
| 943 | this.enqueueMessage(text, undefined, 'bash'); |
| 944 | this.updateQueueDisplay(); |
| 945 | this.state.ui.requestRender(); |
| 946 | return; |
| 947 | } |
| 948 | this.runShellCommandFromInput(text); |
| 949 | return; |
| 950 | } |
| 951 | slashCommands.dispatchInput(this, text); |
| 952 | } |
| 953 | |
| 954 | private runShellCommandFromInput(command: string): void { |
| 955 | const session = this.session; |
nothing calls this directly
no test coverage detected