@@ -612,7 +612,13 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
612612 // - Task is busy (sendingDisabled)
613613 // - API request in progress (isStreaming)
614614 // - Queue has items (preserve message order during drain)
615- if ( sendingDisabled || isStreaming || messageQueue . length > 0 ) {
615+ // - Command is running (command_output) - user's message should be queued for AI, not sent to terminal
616+ if (
617+ sendingDisabled ||
618+ isStreaming ||
619+ messageQueue . length > 0 ||
620+ clineAskRef . current === "command_output"
621+ ) {
616622 try {
617623 console . log ( "queueMessage" , text , images )
618624 vscode . postMessage ( { type : "queueMessage" , text, images } )
@@ -645,7 +651,6 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
645651 case "tool" :
646652 case "browser_action_launch" :
647653 case "command" : // User can provide feedback to a tool or command use.
648- case "command_output" : // User can send input to command stdin.
649654 case "use_mcp_server" :
650655 case "completion_result" : // If this happens then the user has feedback for the completion result.
651656 case "resume_task" :
@@ -1496,9 +1501,20 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
14961501
14971502 useImperativeHandle ( ref , ( ) => ( {
14981503 acceptInput : ( ) => {
1504+ const hasInput = inputValue . trim ( ) || selectedImages . length > 0
1505+
1506+ // Special case: during command_output, queue the message instead of
1507+ // triggering the primary button action (which would lose the message)
1508+ if ( clineAskRef . current === "command_output" && hasInput ) {
1509+ vscode . postMessage ( { type : "queueMessage" , text : inputValue . trim ( ) , images : selectedImages } )
1510+ setInputValue ( "" )
1511+ setSelectedImages ( [ ] )
1512+ return
1513+ }
1514+
14991515 if ( enableButtons && primaryButtonText ) {
15001516 handlePrimaryButtonClick ( inputValue , selectedImages )
1501- } else if ( ! sendingDisabled && ! isProfileDisabled && ( inputValue . trim ( ) || selectedImages . length > 0 ) ) {
1517+ } else if ( ! sendingDisabled && ! isProfileDisabled && hasInput ) {
15021518 handleSendMessage ( inputValue , selectedImages )
15031519 }
15041520 } ,
0 commit comments