approve with feedback for write_to_file/replace_in_file

This commit is contained in:
Evan 2025-02-12 08:46:23 -08:00
parent 96540ddf1e
commit f096d73813

View file

@ -1547,28 +1547,13 @@ export class Cline {
// Rejection WITH feedback
await this.say("user_feedback", text, images)
pushToolResult(formatResponse.toolResult(formatResponse.toolDeniedWithFeedback(text), images))
// this.userMessageContent.push({
// type: "text",
// text: `${toolDescription()}`,
// })
// this.toolResults.push({
// type: "tool_result",
// tool_use_id: toolUseId,
// content: this.formatToolResponseWithImages(
// await this.formatToolDeniedFeedback(text),
// images
// ),
// })
this.didRejectTool = true
return false
}
// Rejection WITHOUT explicit feedback
pushToolResult(formatResponse.toolDenied())
// this.toolResults.push({
// type: "tool_result",
// tool_use_id: toolUseId,
// content: await this.formatToolDenied(),
// })
this.didRejectTool = true // Prevent further tool uses in this message
return false
}
@ -1819,11 +1804,14 @@ export class Cline {
let didApprove = true
const { response, text, images } = await this.ask("tool", completeMessage, false)
if (response !== "yesButtonClicked") {
// User did NOT approve (rejected)
// TODO: add similar context for other tool denial responses, to emphasize ie that a command was not run
const fileDeniedNote = fileExists
? "The file was not updated, and maintains its original contents."
: "The file was not created."
if (response === "messageResponse") {
// Rejection WITH feedback
await this.say("user_feedback", text, images)
pushToolResult(
formatResponse.toolResult(
@ -1838,6 +1826,16 @@ export class Cline {
this.didRejectTool = true
didApprove = false
}
} else {
// User approved
// Handle yesButtonClicked with text (Acceptance WITH feedback)
if (text) {
await this.say("user_feedback", text, images)
pushToolResult(
formatResponse.toolResult(formatResponse.toolApprovedWithFeedback(text), images),
)
}
}
if (!didApprove) {