@@ -26,7 +26,7 @@ import { useOpenInPreferredEditor } from "../editorPreferences";
2626import { useFileContextMenuHandler } from "../fileContextMenu" ;
2727import { type DraftId } from "../composerDraftStore" ;
2828import { openDiffFilePrimaryAction } from "../diffFileActions" ;
29- import { toolCallPatch } from "../lib/toolCallDiff" ;
29+ import { toolCallDiff } from "../lib/toolCallDiff" ;
3030import { useCheckpointDiff , useTurnItemDetail } from "~/state/queries" ;
3131import { revisionedQuery } from "~/state/revisionedQuery" ;
3232import { cn } from "~/lib/utils" ;
@@ -371,14 +371,16 @@ export default function DiffPanel({
371371 const preview = branchDiffPreview . data ;
372372 const gitDiff = selectedGitSource ?. diff ;
373373
374+ const toolCallPreview =
375+ toolCallSelection && toolCallItem ?. type === "file_change" ? toolCallDiff ( toolCallItem ) : null ;
374376 const selectedPatch = toolCallSelection
375- ? toolCallItem ?. type === "file_change"
376- ? toolCallPatch ( toolCallItem )
377- : undefined
377+ ? toolCallPreview ?. patch
378378 : selectedTurn
379379 ? activeCheckpointDiff . data ?. diff
380380 : gitDiff ;
381- const isSelectedPatchTruncated = isGitSelection && selectedGitSource ?. truncated === true ;
381+ const isSelectedPatchTruncated =
382+ toolCallPreview ?. truncated === true ||
383+ ( isGitSelection && selectedGitSource ?. truncated === true ) ;
382384 const selectedPatchQuery = toolCallSelection
383385 ? toolCallDetail
384386 : selectedTurn
@@ -404,6 +406,14 @@ export default function DiffPanel({
404406 ...( toolCallSelection ? { ignoreWhitespace : diffIgnoreWhitespace } : { } ) ,
405407 } ,
406408 ) ;
409+ const recordedToolCallFileCount =
410+ toolCallSelection && toolCallItem ?. type === "file_change"
411+ ? ( toolCallItem . changes ?. length ?? 0 )
412+ : 0 ;
413+ const omittedToolCallFiles =
414+ renderablePatch ?. kind === "files"
415+ ? Math . max ( 0 , recordedToolCallFileCount - renderablePatch . files . length )
416+ : 0 ;
407417 const fileStats = new Map ( lazySource ?. files ?. map ( ( file ) => [ file . path , file ] ) ) ;
408418 const sourceLineStat =
409419 isGitSelection && selectedGitSource ?. files
@@ -1023,15 +1033,40 @@ export default function DiffPanel({
10231033 { isSelectedPatchTruncated && ! lazySource && (
10241034 < p className = "shrink-0 border-b border-border/70 bg-muted/40 px-3 py-1.5 text-2xs text-muted-foreground" >
10251035 This preview exceeds the size limit. Changes shown are incomplete.
1026- { selectedGitSource ?. files ? " Totals include all changes." : "" }
1036+ { isGitSelection && selectedGitSource ?. files ? " Totals include all changes." : "" }
1037+ </ p >
1038+ ) }
1039+ { omittedToolCallFiles > 0 && (
1040+ < p className = "shrink-0 border-b border-border/70 bg-muted/40 px-3 py-1.5 text-2xs text-muted-foreground" >
1041+ This tool call changed { recordedToolCallFileCount } files. The recorded patch omits{ " " }
1042+ { omittedToolCallFiles } of them.
10271043 </ p >
10281044 ) }
10291045 { selectedPatchError && ! renderablePatch && (
10301046 < div className = "px-3" >
10311047 < p className = "mb-2 text-2xs text-error/80" > { selectedPatchError } </ p >
10321048 </ div >
10331049 ) }
1034- { ! renderablePatch && ! lazySource ? (
1050+ { ! renderablePatch && toolCallPreview && toolCallPreview . content . length > 0 ? (
1051+ < div className = "min-h-0 flex-1 space-y-3 overflow-auto p-3 text-xs" >
1052+ < p className = "text-muted-foreground" >
1053+ The provider recorded file content without a diff.
1054+ </ p >
1055+ { toolCallPreview . content . map ( ( { label, text } ) => (
1056+ < div key = { label } className = "space-y-1" >
1057+ < p className = "text-muted-foreground" > { label } </ p >
1058+ < pre
1059+ className = { cn (
1060+ "overflow-auto font-mono text-2xs" ,
1061+ wordWrap && "whitespace-pre-wrap wrap-break-word" ,
1062+ ) }
1063+ >
1064+ { text === "" ? "Empty content." : text }
1065+ </ pre >
1066+ </ div >
1067+ ) ) }
1068+ </ div >
1069+ ) : ! renderablePatch && ! lazySource ? (
10351070 isLoadingSelectedPatch ? (
10361071 < DiffPanelLoadingState
10371072 label = {
0 commit comments