import { useTaskChatExpansion } from "./expansion-state"; import { cn } from "@/lib/utils"; import { Check, ChevronRight, Loader2, ShieldCheck, ShieldX, X, } from "lucide-react"; import type { TaskChatToolItem } from "./task-chat-model"; import { toolTaxonomy } from "./tool-taxonomy"; 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-muted-foreground" }, failed: { Icon: X, spin: false, tone: "text-destructive" }, interrupted: { Icon: X, spin: false, tone: "text-muted-foreground" }, } as const; /** * Tool invocation as a flat activity row (v7): [glyph] [name] [mono target] … * [hover chevron] [status]. No card chrome — activity is metadata, not * content. Clicking toggles a compact result/change summary (left-rail * inset). Full diff bodies stay out of the activity feed. */ export function TaskChatToolCard({ item }: { item: TaskChatToolItem }) { const { Icon, spin, tone } = STATUS_ICON[item.status]; const RowIcon = toolTaxonomy(item.rawName ?? item.name).icon; const [showDetail, setShowDetail] = useTaskChatExpansion(item.id, false); const expandable = Boolean(item.target || item.detail || item.diff); return (
{item.target && showDetail ? (
{item.target}
) : null} {item.detail && showDetail ? (
          {item.detail}
        
) : null} {item.diff && showDetail ? (
Changed {item.diff.path ? ( {item.diff.path} ) : null} +{item.diff.added} −{item.diff.removed}
) : null}
); }