import { cn } from "@/lib/utils"; import { Check, Loader2, X, Wrench, ShieldCheck, ShieldX } from "lucide-react"; import type { TaskChatToolItem } from "./task-chat-model"; const STATUS_ICON = { pending: { Icon: Loader2, spin: false, tone: "text-muted-foreground" }, in_progress: { Icon: Loader2, spin: true, tone: "text-(--status-agent-running)" }, completed: { Icon: Check, spin: false, tone: "text-(--status-task-icon-done)" }, failed: { Icon: X, spin: false, tone: "text-destructive" }, } as const; /** * Tool invocation card. Renders the tool name + live status glyph, an optional * resolved permission-decision badge, and an inline diff when present. */ export function TaskChatToolCard({ item }: { item: TaskChatToolItem }) { const { Icon, spin, tone } = STATUS_ICON[item.status]; return (
{item.detail}
: null} {item.diff ? (
{item.diff.lines.map((l, i) => (
{l.kind === "add" ? "+" : l.kind === "remove" ? "−" : " "} {l.text}
))}
) : null}