import { useEffect, useRef, useState } from "react" import { RefreshCw } from "lucide-react" import { Button } from "@/components/ui/button" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" import { Empty, Notice, Status } from "@/components/common" import { TraceView } from "@/components/trace" import { api, message, number, time, usd } from "@/lib/api" import type { RequestRow } from "@/lib/types" function description(row: RequestRow) { if (!row.detail) return "no query recorded" if (typeof row.detail === "string") return row.detail return row.detail.query || row.detail.urls?.join(", ") || "no query recorded" } export function Activity({ revision, refresh }: { revision: number; refresh: () => void }) { const [page, setPage] = useState<{ rows: RequestRow[]; nextBefore?: number } | null>(null) const [cursors, setCursors] = useState([]) const [endpoint, setEndpoint] = useState("") const [errorsOnly, setErrorsOnly] = useState(false) const [error, setError] = useState("") const [busy, setBusy] = useState(false) const [selected, setSelected] = useState(null) const inspector = useRef(null) useEffect(() => { if (selected) { inspector.current?.focus({ preventScroll: true }); inspector.current?.scrollIntoView({ block: "start" }) } }, [selected]) const before = cursors.at(-1) useEffect(() => { const abort = new AbortController() const query = new URLSearchParams({ endpoint, errors: String(errorsOnly) }) if (before) query.set("before", String(before)) setBusy(true); setError("") api<{ rows: RequestRow[]; nextBefore?: number }>(`requests?${query}`, { signal: abort.signal }) .then(setPage).catch(error => { if (!abort.signal.aborted) setError(message(error)) }) .finally(() => { if (!abort.signal.aborted) setBusy(false) }) return () => abort.abort() }, [before, endpoint, errorsOnly, revision]) return

request activity

shared history from http, mcp, and this playground.

{busy && loading…}
{error && {error}}

scroll the table horizontally for outcome, jev cost, caller, and time. keyboard: focus the table and use arrow keys.

query / urlsendpointoutcomejev costcallertime{page?.rows.map(row =>
{row.requestId.slice(0, 12)}
{row.endpoint}{row.outcome} {row.decisionCalls ? <>{usd(row.jevUsd ?? 0)}
{row.decisionCalls} calls · {number(row.inputTokens ?? 0)} tok
: —}
{row.caller || "—"}{time(row.createdAt)}
)}
{page?.rows.length === 0 && {errorsOnly ? "no matching request errors. model retries are visible inside each request." : "no matching requests yet. run a query in the playground to start a trace."}}

30 requests per page. “ok” means the request completed, not that every url succeeded.

{selected &&

request inspection

{selected.requestId}

{description(selected)}

}
}