`).join("");
$$("#grWhy .hrow").forEach((r, j) => bindTip(r, `${groups[j][0]} (${groups[j][1].join(", ")}) ${groups[j][2]} of ${sat.length} signed-off sessions fail at least one`));
})();
/* ---------- workflow funnel ---------- */
(function () {
const STEPS = [
["The investor's strategy", "The delivered strategy is the one the investor holds", "2.1–2.7"],
["Data within the cutoff", "No delivered row is dated after the cutoff", "1.1"],
["No look-ahead", "Every fill comes after its signal", "3.1"],
["Reproducible", "Delivered trades reproduce the reported returns", "3.2 ≥ 2"],
];
const agentsN = ranked.reduce((t, a) => t + a.n, 0);
const cell = (v, n, base) => `
`;
$("#elCov").innerHTML = ORDER.map((a) => row(a, a.coverage)).join("");
$("#elAssume").innerHTML = ORDER.filter((a) => a.assume != null).map((a) => row(a, a.assume)).join("");
})();
/* ---------- learning ---------- */
(function () {
const L = D.learning, n = L.map((t) => t.sessions);
const lastCount = {}; L.forEach((t) => (lastCount[t.last_veto] = (lastCount[t.last_veto] || 0) + 1));
const [topV, topN] = Object.entries(lastCount).sort((a, b) => b[1] - a[1])[0];
const mFirst = median(L.map((t) => t.first)), mF5 = median(L.map((t) => t.first5)), mL5 = median(L.map((t) => t.last5));
$("#learnStats").innerHTML = [
[`${L.length} / ${L.length}`, "tasks learned, none passed at the first attempt"],
[median(n), "median sessions to the first acceptance"],
[n.reduce((a, b) => a + b, 0), `sessions in all, ${Math.min(...n)} to ${Math.max(...n)} per task`],
[`${f1(mFirst)} → ${f1(mL5)}`, "median failed vetoes, first session → last five"],
].map(([b, s]) => `
${b}${s}
`).join("")
+ `
The last veto to clear is most often ${topV} ${esc(vetoName[topV])}, in ${topN} of ${L.length} tasks. The leak-free rule withholds its reasons, so the agent has to infer them from the investor's words.
`;
const W = 640, H = 300, P = { l: 40, r: 70, t: 14, b: 34 }, X = ["1st session", "First 5", "Last 5", "Accepted"];
const ymax = Math.max(15, ...L.map((t) => t.first));
const x = (i) => P.l + (i * (W - P.l - P.r)) / 3, y = (v) => P.t + (1 - v / ymax) * (H - P.t - P.b);
const pts = (vals) => vals.map((v, i) => `${x(i)},${y(v)}`).join(" ");
let s = `${[0, 3, 6, 9, 12, 15].map((v) => ``).join("")}`;
s += `${[0, 3, 6, 9, 12, 15].map((v) => `${v}`).join("")}${X.map((t, i) => `${t}`).join("")}`;
s += `Failed vetoes per session`;
L.forEach((t, j) => {
const v = [t.first, t.first5, t.last5, 0];
s += `${v.map((u, i) => ``).join("")}`;
});
const mv = [mFirst, mF5, mL5, 0];
s += ``;
s += mv.map((u, i) => ``).join("");
s += mv.slice(0, 3).map((u, i) => `${f1(u)}`).join("");
s += `0 · accepted`;
const host = $("#learnChart");
host.innerHTML = ``;
$$(".tl", host).forEach((g) => {
const t = L[+g.dataset.j];
g.addEventListener("mouseenter", () => $$("polyline,circle", g).forEach((p) => { if (p.getAttribute("stroke") !== "transparent") { p.setAttribute(p.tagName === "circle" ? "fill" : "stroke", "#4a576a"); } }));
g.addEventListener("mouseleave", () => $$("polyline,circle", g).forEach((p) => { if (p.getAttribute("stroke") !== "transparent") { p.setAttribute(p.tagName === "circle" ? "fill" : "stroke", "#b8c2cf"); } }));
bindTip(g, `Difficulty ${t.difficulty} · ${t.sessions} sessions to acceptance Failed vetoes ${t.first} first → ${f1(t.first5)} first five → ${f1(t.last5)} last five Investor signed off in ${pct(t.satisfied)} of practice sessions Last to clear ${t.last_veto} ${esc(vetoName[t.last_veto] || "")}`);
});
})();
/* ---------- benchmark ---------- */
(function () {
const P = D.paper;
$("#parts").innerHTML = [
["Strategy Generator", "A hidden strategy per task", `A strategy fixes one option for each of six components: stock selection, market timing, portfolio construction, risk control, execution, and transaction cost. New tasks can be drawn whenever a released set saturates.`,
[`~${P.strategies} strategies before parameters`, "6 components", "Seeded and reproducible"]],
["User Simulator", "An investor who answers, never volunteers", `A language model plays the investor. It opens with a vague request, states a detail only when the agent asks about it or proposes it, and objects when a proposal conflicts with what it wants.`,
[`${P.personas} personas`, "Never says “point-in-time” or “cutoff”", "Signs off only with cited evidence"]],
["Evaluator", "The delivery, not the conversation", `Programs recompute numbers and check dates, an LLM judge grades only semantics, and every score carries its evidence. Feedback is leak-free: it never reveals the hidden strategy.`,
[`${P.dimensions} dimensions, ${P.vetoes} vetoes`, "No reference answer needed", "Every score tied to an evaluator version"]],
["Setup", "Frozen, so scores compare", `The released benchmark freezes the first ten sampled tasks (seeds 0 to 9) on U.S. equities. The agent receives no data: it searches the Web and calls ${P.fmp_apis} financial APIs, then must stay before each task's cutoff.`,
[`${D.tasks_n} tasks × ${D.sessions_per_task} sessions`, `${P.turns} turns of ${P.seconds_per_turn} s`, "One data cutoff per task"]],
].map(([h, k, p, li]) => `
`).join("");
const H = D.human;
$("#trust").innerHTML = [
[pct(H.agent / H.sessions), `of failed sessions are the agent's fault, according to two financial experts (${H.agent} of ${H.sessions} sampled; ${H.simulator} the simulator, ${H.evaluator} the evaluator).`],
[`κ = ${H.kappa_judge}`, `agreement between the LLM judge and the experts on the judge-graded vetoes; the experts agree with each other at ${H.kappa_experts}.`],
[`${acceptedTotal} of ${N}`, `sessions accepted. Every session the investor signed off fails at least one program check.`],
].map(([b, p]) => `