import * as React from 'react' import { CheckCircle, Circle, XCircle, FileText, Database, Plus, LoaderCircle, GitBranch, RotateCcw } from 'lucide-react' import { mergeClasses } from '../../utils/classNames' import { ButtonWidget } from '../Button/ButtonWidget' import { TextItem } from '../RichText/TextItem' const iconMap = { circle: Circle, xCircle: XCircle, file: FileText, database: Database, plus: Plus, loaderCircle: LoaderCircle, gitBranch: GitBranch, rotateCcw: RotateCcw, } as const type AgentStepStatus = "COMPLETED" | "ACTIVE" | "PENDING" | "ERROR" type AgentStepActionStyle = "SOLID" | "OUTLINE" | "GHOST" | "LINK" type AgentStepsSize = "SMALL" | "STANDARD" | "LARGE" export interface AgentStepAction { /** Button label */ label: string /** Lucide icon key */ icon?: keyof typeof iconMap /** Button style */ style?: AgentStepActionStyle /** Click handler */ onClick?: () => void } export interface AgentStep { /** Unique identifier for the step */ id: string /** Lucide icon key to display (used when status is PENDING; other statuses use fixed status icons) */ icon?: keyof typeof iconMap /** Step title text */ title: string /** Optional subtitle/description */ subtitle?: string /** Optional code preview block */ preview?: { type: "code" content: string } /** Optional action buttons */ actions?: AgentStepAction[] /** Step status */ status: AgentStepStatus } export interface AgentStepsProps { /** Array of steps to display */ steps: AgentStep[] /** Size of step text: SMALL (12px), STANDARD (14px), LARGE (18px) */ size?: AgentStepsSize /** Additional Tailwind classes for prototype-specific styling (not part of SAIL API) */ className?: string } /** * AgentSteps Component * Displays a vertical timeline of agent execution steps with status indicators. * Used within chat interfaces to show AI agent progress. */ export const AgentSteps: React.FC = ({ steps, size = "STANDARD", className, }) => { const sailClasses = 'relative' const finalClasses = mergeClasses(sailClasses, className) return (
{steps.map((step, index) => ( ))}
) } interface AgentStepItemProps { step: AgentStep isLast: boolean size: AgentStepsSize } const sizeConfig: Record = { SMALL: { titleSize: 'SMALL', subtitleSize: 'SMALL', iconSize: 'size-3.5', iconMt: 'mt-0.5', lineTop: 'top-4' }, STANDARD: { titleSize: 'STANDARD', subtitleSize: 'SMALL', iconSize: 'size-4', iconMt: 'mt-0.5', lineTop: 'top-5' }, LARGE: { titleSize: 'MEDIUM', subtitleSize: 'STANDARD', iconSize: 'size-5', iconMt: 'mt-1', lineTop: 'top-7' }, } const AgentStepItem: React.FC = ({ step, isLast, size }) => { const config = sizeConfig[size] const renderIcon = () => { if (step.status === "COMPLETED") { return