import { Box, Stack, Typography, IconButton, Tooltip } from '@mui/material'; import CloseIcon from '@mui/icons-material/Close'; import type { Message } from '@/types/agent'; interface UserMessageProps { message: Message; /** True if this message starts the last turn. */ isLastTurn?: boolean; /** Callback to remove the last turn. */ onUndoTurn?: () => void; /** Whether the agent is currently processing (disables undo). */ isProcessing?: boolean; } export default function UserMessage({ message, isLastTurn = false, onUndoTurn, isProcessing = false, }: UserMessageProps) { const showUndo = isLastTurn && !isProcessing && !!onUndoTurn; return ( {/* Undo button — visible on hover, left of the bubble */} {showUndo && ( )} {message.content} {new Date(message.timestamp).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })} ); }