diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx
index 6a8a4d685c..a57328427f 100644
--- a/webview-ui/src/components/chat/ChatRow.tsx
+++ b/webview-ui/src/components/chat/ChatRow.tsx
@@ -420,24 +420,22 @@ export const ChatRowContent = ({
style={{ color: "var(--vscode-foreground)", marginBottom: "-1.5px" }}>
)
+ // Handle batch diffs for any file-edit tool type
+ if (message.type === "ask" && tool.batchDiffs && Array.isArray(tool.batchDiffs)) {
+ return (
+ <>
+
+
+ {t("chat:fileOperations.wantsToApplyBatchChanges")}
+
+
+ >
+ )
+ }
+
switch (tool.tool as string) {
case "editedExistingFile":
case "appliedDiff":
- // Check if this is a batch diff request
- if (message.type === "ask" && tool.batchDiffs && Array.isArray(tool.batchDiffs)) {
- return (
- <>
-
-
-
- {t("chat:fileOperations.wantsToApplyBatchChanges")}
-
-
-
- >
- )
- }
-
// Regular single file diff
return (
<>
diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx
index 9920ce15a9..8a01105273 100644
--- a/webview-ui/src/components/chat/ChatView.tsx
+++ b/webview-ui/src/components/chat/ChatView.tsx
@@ -1167,6 +1167,26 @@ const ChatViewComponent: React.ForwardRefRenderFunction {
+ if (msg.type !== "ask" || msg.ask !== "tool") return false
+ try {
+ const tool = JSON.parse(msg.text || "{}")
+ return editFileTools.has(tool.tool) && !tool.batchDiffs // Don't re-batch already batched
+ } catch {
+ return false
+ }
+ }
+
// Consolidate consecutive read_file ask messages into batches
const readFileBatched: ClineMessage[] = []
let i = 0
@@ -1226,7 +1246,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction 1) {
+ // Create a synthetic batch message with batchDiffs
+ const batchDiffs = batch.map((batchMsg) => {
+ try {
+ const tool = JSON.parse(batchMsg.text || "{}")
+ return {
+ path: tool.path || "",
+ changeCount: 1,
+ key: tool.path || "",
+ content: tool.content || tool.diff || "",
+ diffStats: tool.diffStats,
+ }
+ } catch {
+ return { path: "", changeCount: 0, key: "", content: "" }
+ }
+ })
+
+ // Use the first message as the base, but add batchDiffs
+ const firstTool = JSON.parse(msg.text || "{}")
+ const syntheticMessage: ClineMessage = {
+ ...msg,
+ text: JSON.stringify({
+ ...firstTool,
+ batchDiffs,
+ }),
+ // Store original messages for response handling
+ _batchedMessages: batch,
+ } as ClineMessage & { _batchedMessages: ClineMessage[] }
+
+ result.push(syntheticMessage)
+ i = j // Skip past all batched messages
+ } else {
+ // Single file-edit ask, keep as-is
result.push(msg)
i++
}