import { useState, useEffect } from "react"; import { useParams, useNavigate } from "react-router-dom"; import { ReplayTimeline } from "../components/ReplayTimeline"; import { fetchReplay, ReplayStep } from "../api"; export function ReplayPage() { const { threadId } = useParams<{ threadId: string }>(); const navigate = useNavigate(); const [steps, setSteps] = useState([]); const [totalSteps, setTotalSteps] = useState(0); const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { if (!threadId) return; setIsLoading(true); setError(null); fetchReplay(threadId, 1, 100) .then((result) => { setSteps(result.steps); setTotalSteps(result.total_steps); }) .catch((err: Error) => setError(err.message)) .finally(() => setIsLoading(false)); }, [threadId]); if (!threadId) return null; return (

Audit Trail: {threadId}

Detailed temporal log of agent reflections, MCP tool calls, and human overrides.

{error ? (

Failed to load replay

{error}

) : isLoading ? (
) : steps.length === 0 ? (

No replay steps found

This conversation has no recorded checkpoints.

) : (
{/* Sidebar Summary Info */}

Session Context

Thread ID
{threadId}
Total Steps
{totalSteps}
Time Range
{steps[0]?.timestamp ? new Date(steps[0].timestamp).toLocaleString() : "N/A"} {" \u2013 "} {steps[steps.length - 1]?.timestamp ? new Date(steps[steps.length - 1].timestamp).toLocaleString() : "N/A"}
{/* Timeline */}
)}
); }