Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(harness): correct viewer transcript path in benchmark HTML

Steven Enamakel969c530a92a5
diff --git a/bench/harnesses/viewer/index.html b/bench/harnesses/viewer/index.html
index 3f5505afd6..511e2f0b33 100644
--- a/bench/harnesses/viewer/index.html
+++ b/bench/harnesses/viewer/index.html
@@ -45,6 +45,8 @@ const h = (tag, attrs = {}, ...kids) => {
};
const api = async (p) => { const r = await fetch(p); if (!r.ok) throw new Error(`${p}: ${r.status}`); return r.json(); };
const e = encodeURIComponent;
+// Rough token estimate for text sizes (chars / 3); the table's measured o200k counts stay as they are.
+const estTok = (chars) => (chars == null ? null : Math.round(chars / 3));
const pct = (a, b) => (a == null || !b ? "–" : `${((100 * a) / b).toFixed(1)}%`);
const fmt = (n, d = 0) => n == null ? "–" : Number(n).toLocaleString(undefined, { maximumFractionDigits: d });
const link = (href, text) => h("a", { href }, text);
@@ -89,12 +91,12 @@ async function run(id) {
const d = await api(`/api/runs/${e(id)}`);
const kids = [h("h1", {}, id), crumbs(link("#/", "runs"), id), h("h2", {}, "Harnesses (from the meter proxy, on the wire)")];
kids.push(table(
- ["harness", "tasks", "turns", "prompt tok", "completion tok", "cached %", "cost $", "system tok", "tool schema tok", "tools", "errors", "overridden", "system prompt"],
+ ["harness", "tasks", "turns", "prompt tok", "completion tok", "cached %", "cost $", "system tok", "tool schema tok", "tools", "errors", "overridden", "system prompt (est.)"],
d.harnesses.map((x) => [
x.harness, x.tasks, x.calls, fmt(x.prompt_tokens), fmt(x.completion_tokens), fmt(x.cache_pct, 1), fmt(x.cost_usd, 4),
fmt(x.system_prompt_tokens), fmt(x.tool_schema_tokens), fmt(x.tool_count),
x.errors ? h("span", { class: "bad" }, x.errors) : 0, x.overridden,
- x.sample_task ? link(`#/call/${e(id)}/${e(x.harness)}/${e(x.sample_task)}/${x.sample_seq}`, `${fmt(x.system_chars)} chars`) : "–",
+ x.sample_task ? link(`#/call/${e(id)}/${e(x.harness)}/${e(x.sample_task)}/${x.sample_seq}`, `~${fmt(estTok(x.system_chars))} tokens`) : "–",
])));
const withTasks = d.harnesses.filter((x) => x.sample_task);
if (withTasks.length) {
@@ -204,12 +206,12 @@ async function call(id, harness, t, seq) {
const mine = nav;
const c = await api(`/api/runs/${e(id)}/call/${e(harness)}/${e(t)}/${seq}`);
const kids = [h("h1", {}, `${harness} · ${t} · turn ${seq}`),
- crumbs(link("#/", "runs"), link(`#/run/${e(id)}`, id), link(`#/task/${e(id)}/${e(harness)}/${e(t)}`, `${harness}/${t}`), `call ${seq}`),
+ crumbs(link("#/", "runs"), link(`#/run/${e(id)}`, id), link(`#/task/${e(id)}/${e(harness)}/${e(t)}`, `${harness}/${t}`), `turn ${seq}`),
h("div", {}, [["format", c.format], ["status", c.status], ["messages", c.message_shas.length], ["tools", c.tool_count],
["cache_control markers", c.cache_control_markers], ["prompt_cache_key", c.prompt_cache_key]].map(([k, v]) => h("span", { class: "tag" }, `${k}: ${v ?? "–"}`))),
h("h2", {}, "Raw transcript (Markdown)"),
transcriptBox(`/api/runs/${e(id)}/transcript/${e(harness)}/${e(t)}/${seq}`),
- h("h2", {}, `System prompt (${fmt(c.system_chars)} chars, ${c.system_sha ?? "none"})`), pre(c.system || "(no system prompt)"),
+ h("h2", {}, `System prompt (~${fmt(estTok(c.system_chars))} tokens est. from ${fmt(c.system_chars)} chars ÷ 3)`), pre(c.system || "(no system prompt)"),
h("h2", {}, "Sampling & provider params"), pre(c.params),
h("h2", {}, "Request headers"), pre(c.headers),
h("h2", {}, `Tools (${c.tool_count})`),
diff --git a/bench/harnesses/viewer/transcript.mjs b/bench/harnesses/viewer/transcript.mjs
index 83d6370ae5..b533d4b4e6 100644
--- a/bench/harnesses/viewer/transcript.mjs
+++ b/bench/harnesses/viewer/transcript.mjs
@@ -82,7 +82,7 @@ export function assembleResponse(raw) {
*/
export function toMarkdown(call) {
const out = [
- `# ${call.harness} · ${call.task} · call ${call.seq}`,
+ `# ${call.harness} · ${call.task} · turn ${call.seq}`,
"",
`- run: \`${call.run_id}\` format: \`${call.format}\` status: \`${call.status ?? "?"}\``,
`- messages: ${call.messages.length}, tools: ${call.tool_count}, request: ${((call.request_bytes ?? 0) / 1024).toFixed(1)} KB`,
@@ -91,7 +91,7 @@ export function toMarkdown(call) {
"## Request parameters (as the harness sent them)",
fence(JSON.stringify(call.params ?? {}, null, 2), "json"),
"",
- "## System prompt",
+ `## System prompt (~${Math.round((call.system_chars ?? call.system?.length ?? 0) / 3).toLocaleString("en-US")} tokens est., chars ÷ 3)`,
call.system ? fence(call.system) : "_none_",
"",
`## Tools (${call.tool_count})`,