feat(web): AgentPrism trace viewer for eval runs - #161
Open
JesseVent wants to merge 1 commit into
Open
Conversation
Adds an AgentPrism-based trace visualization UI (apps/web) and the core adapter that turns any EvalResult into a trace span tree. Rebased cleanly onto current main: - Kept main's regenerated regression-eval-results.json and eval-results.json instead of the stale snapshot this carried, since main has since refreshed both independently. - Dropped the "trigger" experiment-suite trace fixtures and the "trigger" entries in EXPERIMENT_SUITES/url-state, since that suite isn't merged into main's core schema yet and lands separately. - Merged the adjacent (non-conflicting) codex parser test additions from main's supabase#130 alongside this branch's usage-tracking tests. Claude-Session: https://claude.ai/code/session_01WaER4ZeRLmDSwC5GFzkeFQ
|
@JesseVent is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a trace viewer to the web results app: every result row gets a "View span tree" link that opens the full span tree for that run — system/user messages, every tool call with its input/output, assistant turns, and check results — with per-span duration, token usage, and status.
What's added
Core (
packages/core)trace-viewer.ts— adapter that turns anEvalResult(+ its raw transcript) into an AgentPrism span tree (evalResultToTraceSpans), plus tests (trace-viewer.test.ts).transcript/types.ts/parsers/adapt.ts— aTokenUsagetype andusage?/ts?fields threaded throughTranscriptEvent/TranscriptPart, so per-turn token counts and timestamps survive the transcript → trace pipeline instead of only being available as run-level aggregates.agents/{claude-code,codex,opencode}/parser.ts— each agent parser now extracts real per-turn usage (extractUsage/extractTurnUsage) from its own transcript format.index.ts— re-exports the above, plus per-step usage/timestamp capture in the AI SDK agent path.Export (
apps/framework/scripts/export-results.ts)eval-results.json, writes oneapps/web/src/data/traces/<evalId>.jsonper eval viaevalResultToTraceSpans, preferring a run that actually recorded a transcript over one that didn't (so the viewer shows a real span tree, not an empty no-skills run). Lazy/one-per-file so the aggregate bundle stays lean — the web app fetches a trace only when its row is opened. New--no-tracesflag skips writing them.Web (
apps/web)components/agent-prism/**— the AgentPrism component set (span cards, tree view, details view with Attributes/In-Out/Raw tabs, theme tokens) vendored into the repo.components/trace-panel.tsx— the integration point: fetches a trace's JSON lazily, revivesDatefields (JSON round-trips them as strings, which breaks AgentPrism's duration math), and rendersTraceViewerfull-screen with an Escape-to-close overlay.components/results/eval-details.tsx— adds the "View span tree" link.\nform); "JSON" stays available as a tab for exact, copy-pasteable output.TraceViewerto fit how we actually use it: it's built for a multi-trace list (pick between several loaded traces), but we only ever open one trace at a time, so the always-one-item trace-list sidebar (and, on mobile, its matching "back to list" dead-end button) is hidden — the span tree gets the full width instead.How to try it
Open the results table, click any row, click "View span tree".
Agent Prism Trace Visualiser
main: kept main's regeneratedeval-results.json/regression-eval-results.jsoninstead of the stale snapshot this originally carried, and dropped everything that had leaked in from an unrelated, not-yet-merged skill-trigger-suite branch (trigger trace fixtures,EXPERIMENT_SUITES/url-state.tsentries, a README section) — this PR is the viewer only.pnpm --filter core test(131/131),pnpm --filter web run typecheck, andpnpm --filter web run buildall pass. One pre-existingeval-results.test.tsdata-consistency assertion fails on this branch — confirmed it fails identically on plainmaintoday, unrelated to this change.