mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-17 23:51:08 +00:00
Merge 2712853f4e into c4547d25c5
This commit is contained in:
commit
0d0cf4d513
3 changed files with 38 additions and 2 deletions
|
|
@ -1628,8 +1628,24 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
|
|||
}
|
||||
}
|
||||
|
||||
async handleTerminalOperation(terminalOperation: "continue" | "abort") {
|
||||
/**
|
||||
* Handle terminal operations (continue/abort) with optional user message.
|
||||
*
|
||||
* When the user sends a message while a command is running (command_output ask),
|
||||
* we need to both continue the terminal AND resolve the pending ask with the
|
||||
* user's message. This prevents the UI from hanging.
|
||||
*
|
||||
* @param terminalOperation - "continue" to proceed or "abort" to kill the command
|
||||
* @param text - Optional user message text
|
||||
* @param images - Optional user message images
|
||||
*/
|
||||
async handleTerminalOperation(terminalOperation: "continue" | "abort", text?: string, images?: string[]) {
|
||||
if (terminalOperation === "continue") {
|
||||
// If user provided a message, resolve the pending ask with their message
|
||||
// This allows the user to provide feedback while the command runs
|
||||
if (text || (images && images.length > 0)) {
|
||||
this.handleWebviewAskResponse("messageResponse", text, images)
|
||||
}
|
||||
this.terminalProcess?.continue()
|
||||
} else if (terminalOperation === "abort") {
|
||||
this.terminalProcess?.abort()
|
||||
|
|
|
|||
|
|
@ -752,7 +752,11 @@ export const webviewMessageHandler = async (
|
|||
|
||||
case "terminalOperation":
|
||||
if (message.terminalOperation) {
|
||||
provider.getCurrentTask()?.handleTerminalOperation(message.terminalOperation)
|
||||
// Pass text/images if user sent a message with the terminal operation
|
||||
// This allows the user to provide additional context when continuing
|
||||
// a long-running command
|
||||
const resolved = await resolveIncomingImages({ text: message.text, images: message.images })
|
||||
provider.getCurrentTask()?.handleTerminalOperation(message.terminalOperation, resolved.text, resolved.images)
|
||||
}
|
||||
break
|
||||
case "clearTask":
|
||||
|
|
|
|||
|
|
@ -647,6 +647,22 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
|
|||
switch (
|
||||
clineAskRef.current // Use clineAskRef.current
|
||||
) {
|
||||
case "command_output":
|
||||
// For command_output, send terminalOperation with user's message
|
||||
// instead of askResponse. This allows the command to continue
|
||||
// running in the background while keeping the UI responsive.
|
||||
// The user's message is passed to the backend to be used as
|
||||
// additional context when the command finishes.
|
||||
vscode.postMessage({
|
||||
type: "terminalOperation",
|
||||
terminalOperation: "continue",
|
||||
text,
|
||||
images,
|
||||
})
|
||||
// Clear input but don't fully reset UI to avoid hang
|
||||
setInputValue("")
|
||||
setSelectedImages([])
|
||||
return // Don't call handleChatReset
|
||||
case "followup":
|
||||
case "tool":
|
||||
case "command": // User can provide feedback to a tool or command use.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue