Console
Browse eval runs
Register a Viewport Evals results directory and read its runs, cases, invariants and world diffs through Console.
Viewport Evals writes every run to a results directory (.viewport/evals/runs by default). The directory is the
API: index files at each level, then the run, case and attempt files. Console serves a registered directory
read-only under its auth, and the evals viewer reads it as static files.
viewport-console sources add evals .viewport/evals/runsconst { source } = await app.sources.add({ kind: "evals", dir, name: "support-agent" });const vc = await connect({ url: listening.url, token });
const json = async (file: string) => (await vc.sources.file(source.id, file)).json();
const runs = (await json("index.json")) as { items: { id: string; index: string; status: string }[] };
const run = runs.items.find((r) => r.status === "failed")!;
const cases = (await json(run.index)) as { items: { id: string; status: string; dir: string; attempts: string }[] };
const failing = cases.items.find((c) => c.status === "fail")!;
const invariants = (await json(`${run.id}/${failing.dir}/attempt-1.invariants.json`)) as {
results: { name: string; passed: boolean; message: string }[];
};
const world = (await json(`${run.id}/${failing.dir}/attempt-1.world.json`)) as {
worlds: Record<string, { changes: { op: string; path: string }[] }>;
};
console.log(`Run ${run.id}: ${run.status}; failing case ${failing.id}`);
for (const r of invariants.results) console.log(` invariant ${r.passed ? "pass" : "FAIL"} ${r.name}: ${r.message}`);
for (const [name, w] of Object.entries(world.worlds))
for (const c of w.changes) console.log(` world ${name}: ${c.op} ${c.path}`);Serving rules
GET /api/v1/sources/:source_id/files/<path>:
- Only
*.json(application/json) and*.jsonl(application/x-ndjson), withX-Content-Type-Options: nosniff, never HTML. - No dotfiles, no
... Every path is resolved withrealpathand refused outside the directory, so a symlink cannot escape. Rangeis supported, so the viewer can tail a running attempt's trajectory from the last byte it had.
// Only the layout's .json and .jsonl files are served, with nosniff, never HTML, never outside the directory.
const refused = await vc.sources.file(source.id, "../../etc/passwd.json");
console.log("Outside the directory:", refused.status);Tenant-scoped principals do not see eval sources until runs carry a tenant.