/* Copyright 2026 Marimo. All rights reserved. */ import { ChevronDownIcon, XCircleIcon } from "lucide-react"; import React from "react"; import { cn } from "@/utils/cn"; import { formatToolName } from "./shared"; import { ToolArgsRenderer } from "./tool-args"; interface ToolErrorCardProps { toolName: string; input: unknown; errorText?: string; // When false, defaults to collapsed (the conversation has moved past this). isLive: boolean; className?: string; } export const ToolErrorCard: React.FC = ({ toolName, input, errorText, isLive, className, }) => { const [open, setOpen] = React.useState(isLive); // Auto-collapse once when the conversation moves past this turn. // The user can still re-open manually afterwards; we only do this on the // live → not-live transition, never the reverse. const wasLive = React.useRef(isLive); React.useEffect(() => { if (wasLive.current && !isLive) { setOpen(false); } wasLive.current = isLive; }, [isLive]); return (
{open && (
{errorText && (

Error

                {errorText}
              
)}
)}
); };