"use client"; import { ChevronRight } from "lucide-react"; import { FileIcon } from "./FileIcon"; import { DiffView } from "./DiffView"; import { getLanguageFromPath } from "./SyntaxHighlight"; import { ToolUseBlock } from "./ToolUseBlock"; interface ToolFileEditProps { input: { file_path: string; old_string: string; new_string: string; replace_all?: boolean; }; result?: string; isError?: boolean; isRunning?: boolean; startedAt?: number; completedAt?: number; } function FileBreadcrumb({ filePath }: { filePath: string }) { const parts = filePath.replace(/^\//, "").split("/"); return (
{parts.map((part, i) => ( {i > 0 && } {part} ))}
); } export function ToolFileEdit({ input, result, isError = false, isRunning = false, startedAt, completedAt, }: ToolFileEditProps) { const lang = getLanguageFromPath(input.file_path); return ( {/* File path header */}
{input.replace_all && ( replace all )}
{/* Content */} {isRunning ? (
Editing…
) : isError ? (
{result}
) : (
)}
); }