import { useRef, useEffect } from "react"; import type { DatasetInfo, InstanceDetail, TrajectoryMode } from "../types"; import { RawBubble, AtifBubble } from "./ChatBubble"; import { StepDetail } from "./StepDetail"; interface Props { dataset: DatasetInfo; detail: InstanceDetail; mode: TrajectoryMode; isSingle: boolean; } export function TrajectoryView({ dataset, detail, mode, isSingle }: Props) { const scrollRef = useRef(null); useEffect(() => { if (scrollRef.current) { scrollRef.current.scrollTop = 0; } }, [detail.instance_id, mode]); return (
{/* Header */}
{dataset.name}
{detail.agent || detail.model} {detail.duration_seconds > 0 && ( {Math.round(detail.duration_seconds)}s )}
{/* Chat stream */}
{mode === "raw" && ( <> {detail.raw_steps.map((step) => ( ))} {detail.raw_steps.length === 0 && (
No raw trajectory data available. {detail.n_atif_steps > 0 && " Try ATIF Steps mode."}
)} )} {mode === "atif" && ( <> {detail.atif.steps.map((step) => ( ))} {detail.atif.steps.length === 0 && (
No ATIF trajectory data available. {detail.n_raw_steps > 0 && " Try Raw Messages mode."}
)} )} {/* Result badge at bottom */}
{detail.resolved ? "RESOLVED" : "FAILED"} {detail.error && ( ({detail.error}) )}
{/* Raw logs */}
); }