import { useState } from "react"; import type { ReplayStep } from "../api"; const TYPE_COLORS: Record = { message: "#1976d2", token: "#388e3c", tool_call: "#f57c00", tool_result: "#7b1fa2", interrupt: "#d32f2f", interrupt_response: "#c2185b", error: "#c62828", }; function TypeBadge({ type }: { type: string }) { const color = TYPE_COLORS[type] ?? "#555"; return ( {type} ); } function ReplayStepItem({ step }: { step: ReplayStep }) { const [expanded, setExpanded] = useState(false); const hasDetails = step.params != null || step.result != null; return (
#{step.step} {step.agent && ( {step.agent} )} {step.tool && ( tool: {step.tool} )} {new Date(step.timestamp).toLocaleTimeString()}
{step.content && (
{step.content}
)} {hasDetails && ( )} {expanded && hasDetails && (
          {JSON.stringify({ params: step.params, result: step.result }, null, 2)}
        
)}
); } interface ReplayTimelineProps { steps: ReplayStep[]; } export function ReplayTimeline({ steps }: ReplayTimelineProps) { if (steps.length === 0) { return (
No steps recorded.
); } return (
{steps.map((step) => ( ))}
); }