diff --git a/src/core/tools/MultiApplyDiffTool.ts b/src/core/tools/MultiApplyDiffTool.ts index 8fd893469c..6a129d8f9c 100644 --- a/src/core/tools/MultiApplyDiffTool.ts +++ b/src/core/tools/MultiApplyDiffTool.ts @@ -664,6 +664,15 @@ ${errorDetails ? `\nTechnical details:\n${errorDetails}\n` : ""} // Call saveChanges to update the DiffViewProvider properties await cline.diffViewProvider.saveChanges(diagnosticsEnabled, writeDelayMs) } + + // Send final tool message with diff stats to update the UI + const finalMessage = JSON.stringify({ + ...sharedMessageProps, + diff: diffContents, + content: unifiedPatch, + diffStats: computeDiffStats(unifiedPatch) || undefined, + } satisfies ClineSayTool) + await cline.ask("tool", finalMessage, false).catch(() => {}) } else { // Batch operations - already approved above if (isPreventFocusDisruptionEnabled) { @@ -687,6 +696,18 @@ ${errorDetails ? `\nTechnical details:\n${errorDetails}\n` : ""} // Call saveChanges to update the DiffViewProvider properties await cline.diffViewProvider.saveChanges(diagnosticsEnabled, writeDelayMs) } + + // Send final tool message with diff stats for batch operations + const diffContents = diffItems.map((item) => item.content).join("\n\n") + const unifiedPatchRaw = formatResponse.createPrettyPatch(relPath, beforeContent!, originalContent!) + const unifiedPatch = sanitizeUnifiedDiff(unifiedPatchRaw) + const finalMessage = JSON.stringify({ + ...sharedMessageProps, + diff: diffContents, + content: unifiedPatch, + diffStats: computeDiffStats(unifiedPatch) || undefined, + } satisfies ClineSayTool) + await cline.ask("tool", finalMessage, false).catch(() => {}) } // Track file edit operation