The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: files changed bench/harnesses/charts.mjs,bench/harnesses/charts.test.mjs
Steven Enamakeldd1a513daac3
diff --git a/bench/harnesses/charts.mjs b/bench/harnesses/charts.mjsindex c97464a822..6fe8cae878 100644--- a/bench/harnesses/charts.mjs+++ b/bench/harnesses/charts.mjs@@ -29,7 +29,8 @@ export const HARNESSES = [{ id: "hermes", label: ["Hermes"] },];-const fmtMoney = (v) => (v < 0.01 ? `$${v.toFixed(4)}` : `$${v.toFixed(3)}`);+// Cents keep cost labels short enough to sit inside a column ($0.0032 -> 0.32¢).+const fmtMoney = (v) => (v >= 0.1 ? `$${v.toFixed(2)}` : v >= 0.1 / 10 ? `${(v * 100).toFixed(1)}¢` : `${(v * 100).toFixed(2)}¢`);const fmtSecs = (ms) => (ms >= 10000 ? `${(ms / 1000).toFixed(0)}s` : `${(ms / 1000).toFixed(1)}s`);const fmtTokens = (v) => (v >= 1000 ? `${(v / 1000).toFixed(1)}k` : `${Math.round(v)}`);@@ -43,8 +44,8 @@ export const METRICS = [s.swe_graded ? (100 * s.swe_resolved) / s.swe_graded : s.tasks ? (100 * s.check_passed) / s.tasks : null,format: (v) => `${v.toFixed(0)}%`,},- { id: "cost_task", title: "Cost per task", better: "lower", value: (s) => s.cost_per_task_usd, format: fmtMoney },- { id: "cost_resolved", title: "Cost per resolved task", better: "lower", value: (s) => s.cost_per_resolved_usd, format: fmtMoney },+ { id: "cost_task", title: "Cost per task (cents)", better: "lower", value: (s) => s.cost_per_task_usd, format: fmtMoney },+ { id: "cost_resolved", title: "Cost per resolved task (cents)", better: "lower", value: (s) => s.cost_per_resolved_usd, format: fmtMoney },{ id: "static_prompt", title: "System prompt + tools (tokens)", better: "lower", value: (s) => s.static_prompt_tokens, format: fmtTokens },{ id: "cache", title: "Prompt cache hit", better: "higher", value: (s) => s.cache_pct, format: (v) => `${v.toFixed(0)}%` },{ id: "ttft", title: "Time to first token (p50)", better: "lower", value: (s) => s.ttft_ms_p50, format: fmtSecs },@@ -101,12 +102,12 @@ export function renderSvg({ meta, summary }, opts = {}) {const cols = Math.min(5, metrics.length);const rows = Math.ceil(metrics.length / cols);const panelW = 396;- const panelH = 372;+ const panelH = 344;const headerH = 112;const footerH = 52;const W = cols * panelW + 80;const H = headerH + rows * panelH + footerH;- const barW = 34;+ const barW = 38;const slot = Math.min(52, (panelW - 48) / harnesses.length);const plotH = 188;const baseY = 268; // baseline within a panel@@ -125,7 +126,7 @@ export function renderSvg({ meta, summary }, opts = {}) {parts.push(`<text x="40" y="76" font-size="14" fill="${t.sub}">${esc(meta.model)} · reasoning ${esc(meta.reasoning)} · ${esc(meta.cpus)} vCPU / ${esc(meta.mem)} per task · same key, same model, same container limits</text>`,);- parts.push(`<text x="40" y="96" font-size="12" fill="${t.muted}">Each panel has its own scale from zero.★ marks the best column in a panel.</text>`);+ parts.push(`<text x="40" y="96" font-size="12" fill="${t.muted}">Each panel has its own scale from zero. ★ marks the best column in a panel.</text>`);metrics.forEach((m, i) => {const col = i % cols;diff --git a/bench/harnesses/charts.test.mjs b/bench/harnesses/charts.test.mjsnew file mode 100644index 0000000000..dc46c99b13--- /dev/null+++ b/bench/harnesses/charts.test.mjs@@ -0,0 +1,40 @@+import assert from "node:assert/strict";+import test from "node:test";+import { METRICS, renderSvg } from "./charts.mjs";++const meta = { run_id: "r", suite: "swe", model: "m", reasoning: "medium", cpus: "4", mem: "8g" };+const row = (over) => ({+ tasks: 10, swe_resolved: 5, swe_graded: 10, check_passed: 0, cost_per_task_usd: 0.0123,+ cost_per_resolved_usd: 0.0246, static_prompt_tokens: 4500, cache_pct: 80, ttft_ms_p50: 1200,+ task_wall_s_p50: 60, cold_start_ms_p50: 300, cpu_seconds_mean: 2, peak_anon_mb_max: 100, ...over,+});++test("renders one panel per metric and one column per harness, with a star on the best", () => {+ const svg = renderSvg({ meta, summary: { openhuman: row({}), codex: row({ swe_resolved: 8 }) } });+ assert.match(svg, /^<svg /);+ for (const m of METRICS) assert.ok(svg.includes(m.title.replace(/&/g, "&")), m.title);+ assert.equal((svg.match(/<path d="M/g) ?? []).length, METRICS.length * 2);+ assert.match(svg, /<polygon/);+});++test("lower-is-better metrics star the smallest value", () => {+ const svg = renderSvg(+ { meta, summary: { openhuman: row({ cpu_seconds_mean: 1 }), codex: row({ cpu_seconds_mean: 9 }) } },+ { only: ["cpu"] },+ );+ assert.equal((svg.match(/<polygon/g) ?? []).length, 1);+});++test("missing values render n/a instead of a zero-height column, and bad text is escaped", () => {+ const svg = renderSvg(+ { meta: { ...meta, model: "a<b&c" }, summary: { openhuman: row({ cost_per_resolved_usd: null }), codex: row({}) } },+ { only: ["cost_resolved"] },+ );+ assert.match(svg, />n\/a</);+ assert.ok(svg.includes("a<b&c"));+});++test("dark theme swaps the background", () => {+ const svg = renderSvg({ meta, summary: { openhuman: row({}) } }, { theme: "dark" });+ assert.match(svg, /fill="#0e1120"/);+});