(input: {
file_path: string;
old_string?: string;
new_string?: string;
replace_all?: boolean;
edits?: unknown[];
}, options: {
columns: number;
messages: Message[];
progressMessagesForMessage: ProgressMessage[];
style?: 'condensed';
theme: ThemeName;
tools: Tools;
verbose: boolean;
})
| 90 | return <FileEditToolUpdatedMessage filePath={filePath} structuredPatch={structuredPatch} firstLine={originalFile.split('\n')[0] ?? null} fileContent={originalFile} style={style} verbose={verbose} previewHint={isPlanFile ? '/plan to preview' : undefined} />; |
| 91 | } |
| 92 | export function renderToolUseRejectedMessage(input: { |
| 93 | file_path: string; |
| 94 | old_string?: string; |
| 95 | new_string?: string; |
| 96 | replace_all?: boolean; |
| 97 | edits?: unknown[]; |
| 98 | }, options: { |
| 99 | columns: number; |
| 100 | messages: Message[]; |
| 101 | progressMessagesForMessage: ProgressMessage[]; |
| 102 | style?: 'condensed'; |
| 103 | theme: ThemeName; |
| 104 | tools: Tools; |
| 105 | verbose: boolean; |
| 106 | }): React.ReactElement { |
| 107 | const { |
| 108 | style, |
| 109 | verbose |
| 110 | } = options; |
| 111 | const filePath = input.file_path; |
| 112 | const oldString = input.old_string ?? ''; |
| 113 | const newString = input.new_string ?? ''; |
| 114 | const replaceAll = input.replace_all ?? false; |
| 115 | |
| 116 | // Defensive: if input has an unexpected shape, show a simple rejection message |
| 117 | if ('edits' in input && input.edits != null) { |
| 118 | return <FileEditToolUseRejectedMessage file_path={filePath} operation="update" firstLine={null} verbose={verbose} />; |
| 119 | } |
| 120 | const isNewFile = oldString === ''; |
| 121 | |
| 122 | // For new file creation, show content preview instead of diff |
| 123 | if (isNewFile) { |
| 124 | return <FileEditToolUseRejectedMessage file_path={filePath} operation="write" content={newString} firstLine={firstLineOf(newString)} verbose={verbose} />; |
| 125 | } |
| 126 | return <EditRejectionDiff filePath={filePath} oldString={oldString} newString={newString} replaceAll={replaceAll} style={style} verbose={verbose} />; |
| 127 | } |
| 128 | export function renderToolUseErrorMessage(result: ToolResultBlockParam['content'], options: { |
| 129 | progressMessagesForMessage: ProgressMessage[]; |
| 130 | tools: Tools; |
nothing calls this directly
no test coverage detected