'use client'; import { useState, memo } from 'react'; import { IconCheck, IconX, IconTerminal, IconChevronDown, IconChevronRight } from '@tabler/icons-react'; import { GridSpinner } from '@/components/grid-spinner'; import { cn } from '@/lib/utils'; import type { Message } from '@/lib/types/http'; import { Badge } from '@kandev/ui/badge'; interface ScriptExecutionMetadata { script_type: 'setup' | 'cleanup'; command: string; status: 'starting' | 'running' | 'exited' | 'failed'; exit_code?: number; started_at?: string; completed_at?: string; process_id?: string; error?: string; } export const ScriptExecutionMessage = memo(function ScriptExecutionMessage({ comment }: { comment: Message }) { const [isExpanded, setIsExpanded] = useState(false); const metadata = comment.metadata as ScriptExecutionMetadata | undefined; // Show fallback if metadata is missing or incomplete if (!metadata || !metadata.script_type) { const hasExpandableContent = !!comment.content; return (
{comment.content}
{comment.content}