import { motion } from 'framer-motion'; import { GitCommitHorizontal, ArrowRight } from 'lucide-react'; import type { NegotiationMessage } from '@/types'; import { cn } from '@/lib/utils'; interface ProtocolTimelineProps { messages: NegotiationMessage[]; className?: string; } interface ProtocolSnapshot { round: number; action_type: string; role: string; message: string; } export default function ProtocolTimeline({ messages, className }: ProtocolTimelineProps) { // Extract protocol-changing events const snapshots: ProtocolSnapshot[] = messages .filter((m) => m.action_type && ['propose_protocol', 'revise_protocol', 'suggest_alternative', 'accept', 'reject'].includes(m.action_type)) .map((m) => ({ round: m.round, action_type: m.action_type!, role: m.role, message: m.message.length > 100 ? m.message.slice(0, 100) + '...' : m.message, })); if (snapshots.length === 0) return null; return (
Protocol Evolution
{/* Horizontal scrollable timeline */}
{snapshots.map((snap, i) => (
{/* Node */}
R{snap.round}
{/* Action label */} {snap.action_type.replace(/_/g, ' ')} {/* Summary */}
{snap.message.slice(0, 60)}...
{/* Arrow connector */} {i < snapshots.length - 1 && (
)}
))}
); }