import { memo } from 'react' import { ArrowRight, Check, ClipboardList, Circle } from 'lucide-react' import { cn } from '@/utils/cn' import { useNovaKit } from '../../context/useNovaKit' export interface TodoItem { id?: string | number title?: string status?: 'pending' | 'completed' | 'in_progress' | string [key: string]: unknown } export interface TodoListProps { items: TodoItem[] className?: string } function TodoListComponent({ items = [], className }: TodoListProps) { const { agentName } = useNovaKit() const todoItems = items const totalCount = todoItems.length const completedCount = todoItems.filter(item => item.status === 'completed').length const isAllCompleted = totalCount > 0 && completedCount === totalCount const displayCompletedCount = totalCount === 0 ? 0 : Math.min(totalCount, isAllCompleted ? completedCount : completedCount + 1) const progressRatio = totalCount === 0 ? 0 : displayCompletedCount / totalCount const progressPercent = Math.max(0, Math.min(100, progressRatio * 100)) return (
{/* Header:任务执行流水线 */}

任务执行流水线

{agentName}

Progress {displayCompletedCount} / {totalCount || 0}
{/* 列表内容:卡片列表布局 */}
{todoItems.map((item, index) => { const status = item.status as string | undefined const isCompleted = status === 'completed' const isActive = status === 'in_progress' const isPending = !isCompleted && !isActive const stepLabel = `STEP ${index + 1} OF ${totalCount || 0}` return (
{/* 左侧:状态圆点 + 文案 */}
{/* 状态圆点 */}
{isCompleted && (
)} {isActive && (
)} {isPending && !isCompleted && !isActive && (
)}
{/* 文案 */}

{item.title as string}

{typeof (item as any).description === 'string' && (

{(item as any).description as string}

)}
{isActive && ( )}
{/* 右侧:步骤标签 */} {stepLabel}
) })}
) } export const TodoList = memo(TodoListComponent) export default TodoList