import { useAgentStore } from '@/stores/agentStore'; import { FinalStep } from '@/types/agent'; import AccessTimeIcon from '@mui/icons-material/AccessTime'; import CheckIcon from '@mui/icons-material/Check'; import CloseIcon from '@mui/icons-material/Close'; import HourglassEmptyIcon from '@mui/icons-material/HourglassEmpty'; import StopCircleIcon from '@mui/icons-material/StopCircle'; import { Box, Card, CardContent, Typography } from '@mui/material'; import React from 'react'; interface FinalStepCardProps { finalStep: FinalStep; isActive?: boolean; } export const FinalStepCard: React.FC = ({ finalStep, isActive = false }) => { const setSelectedStepIndex = useAgentStore((state) => state.setSelectedStepIndex); const getStatusConfig = () => { switch (finalStep.type) { case 'success': return { icon: , label: 'Task completed', color: 'success', }; case 'stopped': return { icon: , label: 'Task stopped', color: 'warning', }; case 'max_steps_reached': return { icon: , label: 'Max steps reached', color: 'warning', }; case 'sandbox_timeout': return { icon: , label: 'Sandbox timeout', color: 'error', }; case 'failure': default: return { icon: , label: 'Task failed', color: 'error', }; } }; const statusConfig = getStatusConfig(); const handleClick = () => { // Clicking on final step goes to live mode (null) setSelectedStepIndex(null); }; return ( `${isActive ? theme.palette[statusConfig.color].main : theme.palette.divider} !important`, borderRadius: 1.5, transition: 'all 0.2s ease', cursor: 'pointer', boxShadow: isActive ? (theme) => `0 2px 8px ${theme.palette.mode === 'dark' ? `rgba(${statusConfig.color === 'success' ? '102, 187, 106' : statusConfig.color === 'error' ? '244, 67, 54' : '255, 152, 0'}, 0.3)` : `rgba(${statusConfig.color === 'success' ? '102, 187, 106' : statusConfig.color === 'error' ? '244, 67, 54' : '255, 152, 0'}, 0.2)`}` : 'none', '&:hover': { borderColor: (theme) => `${theme.palette[statusConfig.color].main} !important`, boxShadow: (theme) => `0 2px 8px ${theme.palette.mode === 'dark' ? `rgba(${statusConfig.color === 'success' ? '102, 187, 106' : statusConfig.color === 'error' ? '244, 67, 54' : '255, 152, 0'}, 0.2)` : `rgba(${statusConfig.color === 'success' ? '102, 187, 106' : statusConfig.color === 'error' ? '244, 67, 54' : '255, 152, 0'}, 0.1)`}`, }, }} > {/* Header with icon */} {statusConfig.icon} {statusConfig.label} ); };