({
input,
result,
isError = false,
isRunning = false,
startedAt,
completedAt,
}: ToolFileEditProps)
| 39 | } |
| 40 | |
| 41 | export function ToolFileEdit({ |
| 42 | input, |
| 43 | result, |
| 44 | isError = false, |
| 45 | isRunning = false, |
| 46 | startedAt, |
| 47 | completedAt, |
| 48 | }: ToolFileEditProps) { |
| 49 | const lang = getLanguageFromPath(input.file_path); |
| 50 | |
| 51 | return ( |
| 52 | <ToolUseBlock |
| 53 | toolName="edit" |
| 54 | toolInput={input} |
| 55 | toolResult={result} |
| 56 | isError={isError} |
| 57 | isRunning={isRunning} |
| 58 | startedAt={startedAt} |
| 59 | completedAt={completedAt} |
| 60 | > |
| 61 | {/* File path header */} |
| 62 | <div className="flex items-center gap-2 px-3 py-2 border-b border-surface-700/50 bg-surface-850"> |
| 63 | <FileIcon |
| 64 | filePath={input.file_path} |
| 65 | className="w-3.5 h-3.5 text-surface-400 flex-shrink-0" |
| 66 | /> |
| 67 | <FileBreadcrumb filePath={input.file_path} /> |
| 68 | {input.replace_all && ( |
| 69 | <span className="ml-auto text-xs px-1.5 py-0.5 rounded bg-surface-700 text-surface-300"> |
| 70 | replace all |
| 71 | </span> |
| 72 | )} |
| 73 | </div> |
| 74 | |
| 75 | {/* Content */} |
| 76 | {isRunning ? ( |
| 77 | <div className="px-3 py-4 text-surface-500 text-xs animate-pulse"> |
| 78 | Editing… |
| 79 | </div> |
| 80 | ) : isError ? ( |
| 81 | <div className="px-3 py-3 text-red-400 text-xs font-mono whitespace-pre-wrap"> |
| 82 | {result} |
| 83 | </div> |
| 84 | ) : ( |
| 85 | <div className="p-3"> |
| 86 | <DiffView |
| 87 | oldContent={input.old_string} |
| 88 | newContent={input.new_string} |
| 89 | lang={lang} |
| 90 | /> |
| 91 | </div> |
| 92 | )} |
| 93 | </ToolUseBlock> |
| 94 | ); |
| 95 | } |
nothing calls this directly
no test coverage detected