${escapeHtml(c.id.split("_")[0])}${escapeHtml(c.title)}
${escapeHtml(c.description)}
import data from "./data.js"; const STATUS_LABEL = { pass: ["pass", "pass"], fail_crash: ["crash", "crash"], fail_clear: ["clear", "clear"], fail_double_encoded: ["double", "double"], fail_dropped: ["dropped", "dropped"], fail_raw_name: ["raw", "verbatim"], }; const CASE_COLS = data.cases.map((c) => ({ key: c.short, label: c.id.split("_")[0], // C1, C2, ... title: `${c.id}: ${c.title}`, })); const resultMap = new Map(); for (const r of data.results) { resultMap.set(`${r.repo_id}::${r.short}`, r); } function escapeHtml(value) { return String(value ?? "") .replaceAll("&", "&") .replaceAll("<", "<") .replaceAll(">", ">") .replaceAll('"', """); } function fmtNum(n) { if (n === null || n === undefined) return "—"; return Number(n).toLocaleString("en-US"); } function pill(status) { if (!status) return `n/a`; const pair = STATUS_LABEL[status]; if (!pair) return `${escapeHtml(status)}`; return `${pair[1]}`; } function uniqueBest(models) { const seen = new Map(); for (const m of models) { const key = m.template_sha1 || `solo:${m.repo_id}`; const prev = seen.get(key); if (!prev || (m.downloads || 0) > (prev.downloads || 0)) seen.set(key, m); } return [...seen.values()]; } const state = { q: "", unique: false, sortKey: "n_pass", sortDir: "desc", open: null, }; function filtered() { let rows = data.models.slice(); if (state.unique) rows = uniqueBest(rows); const q = state.q.trim().toLowerCase(); if (q) { rows = rows.filter((m) => m.repo_id.toLowerCase().includes(q) || (m.template_sha1 || "").toLowerCase().includes(q) ); } const dir = state.sortDir === "asc" ? 1 : -1; const key = state.sortKey; rows.sort((a, b) => { let av; let bv; if (key === "repo_id" || key === "template_sha1") { av = (a[key] || "").toLowerCase(); bv = (b[key] || "").toLowerCase(); if (av < bv) return -1 * dir; if (av > bv) return 1 * dir; } else if (key.startsWith("case:")) { const short = key.slice(5); av = a.cases?.[short] || ""; bv = b.cases?.[short] || ""; if (av === bv) { /* fall through to n_pass / downloads */ } else { // pass first when descending const rank = (s) => { if (s === "pass") return 5; if (s === "fail_clear") return 3; if (s === "fail_double_encoded") return 2; if (s === "fail_raw_name") return 1; if (s === "fail_crash") return 0; return -1; }; return (rank(av) - rank(bv)) * dir; } } else { av = a[key]; bv = b[key]; if (av == null && bv == null) { /* equal */ } else if (av == null) return 1; else if (bv == null) return -1; else if (av !== bv) return (av < bv ? -1 : 1) * dir; } // stable-ish tie breakers if ((b.n_pass || 0) !== (a.n_pass || 0)) return (b.n_pass || 0) - (a.n_pass || 0); if ((b.downloads || 0) !== (a.downloads || 0)) return (b.downloads || 0) - (a.downloads || 0); return a.repo_id.localeCompare(b.repo_id); }); return rows; } function renderStats() { const s = data.summary; const items = [ [String(s.n_repos_measured), "repos measured"], [`${s.of_dict_pass_string_crash}/${s.n_dict_pass}`, "crash on OpenAI string args"], [String(s.of_dict_pass_string_ok), "render string args correctly"], [`${s.C10_name_escape_raw}/${s.n_dict_pass}`, "paste the tool name verbatim"], ]; document.getElementById("stats").innerHTML = items.map(([n, l]) => `
${escapeHtml(c.description)}
${escapeHtml(r.detail)}
`); if (r.error_type) bits.push(`${escapeHtml(r.error_type)}${r.error_message ? ": " + escapeHtml(r.error_message) : ""}
`); if (r.snippet) bits.push(`${escapeHtml(r.snippet)}`);
if (r.value_style) bits.push(`value style: ${escapeHtml(r.value_style)}
`); return `No detail recorded.
"}