Files
Kaname/src/app/api/v1/benchmarks/[id]/route.ts
T
Pascal LinxweilerandClaude Opus 5.5 716bd8f2f0
Release / release (push) Successful in 3m0s
Release 0.13.0: agent API for deployments and benchmarks
Scopes deployments:read/write and benchmarks:read/run; /api/v1 endpoints
for runtimes, deployments (create with dry run, edit, start, stop, delete
own ones), benchmark runs, A/B, sweeps and comparisons; ?wait= on all
status endpoints. Guardrails: approval, agent deployments at once, one
GPU job at a time, time limits, sweep variants, runtime and argument
allowlists, host port range, memory/CPU caps, protected deployments with
a VRAM check. Requested-by filters, approval bars, per-token activity log,
scope editing, docs/agent/SKILL-tuning.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 15:11:06 +02:00

24 lines
1.1 KiB
TypeScript

import { runSettled, runView } from "@/lib/agent-runs";
import { withToken } from "@/lib/api-tokens";
import { v1Catch, v1Error, v1Json } from "@/lib/api-v1";
import { getBenchmark } from "@/lib/benchmarks";
import { parseWait, waitFor } from "@/lib/wait";
export const dynamic = "force-dynamic";
/**
* A run's state and compact result (headline numbers, setup, resources). ?wait=<s> (max 900) blocks
* until it is finished or waits for approval; ?full=1 adds BetterBench's full summary.
*/
export const GET = withToken<RouteContext<"/api/v1/benchmarks/[id]">>("benchmarks:read", async (req, { params, token }) => {
try {
const id = (await params).id;
const q = new URL(req.url).searchParams;
const { value: run, waitedS, timedOut } = await waitFor(() => getBenchmark(id), (r) => !r || runSettled(r.state), parseWait(q), { signal: req.signal });
if (!run) return v1Error(404, "not_found", "No benchmark run with this id.");
return v1Json({ ...runView(run, token, q.get("full") === "1"), ...(waitedS ? { waitedSeconds: waitedS, timedOut } : {}) });
} catch (err) {
return v1Catch(err);
}
});