@workos/quickstudy 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workos/quickstudy",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "An open-source, company-agnostic eval harness for measuring whether coding agents can complete real integration tasks, across an agent x feature x framework x surface matrix.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -13,6 +13,8 @@ import type { AgentAdapter, AttemptContext, AttemptOutcome, TranscriptEvent } fr
13
13
 
14
14
  export class EchoAdapter implements AgentAdapter {
15
15
  readonly name: string;
16
+ /** Does nothing, so every eval must fail it: a scorer it passes rewards doing nothing. */
17
+ readonly role = "negative-control" as const;
16
18
  readonly identity = {
17
19
  provider: "local", model: "echo-v1", reasoning: "none", cliVersion: "built-in",
18
20
  surfacePolicies: { docs: "no-network", mcp: "no-network", cli: "no-network" },
@@ -27,6 +27,7 @@ function oracleMetrics(): AttemptMetrics {
27
27
  /** Host variant: the prepared fixture already carries the solution overlay. */
28
28
  export class OracleAdapter implements AgentAdapter {
29
29
  readonly name = "oracle";
30
+ readonly role = "positive-control" as const;
30
31
  readonly identity = ORACLE_IDENTITY;
31
32
  readonly startingState = "solution" as const;
32
33
 
@@ -50,6 +51,7 @@ export class OracleContainerAdapter implements ContainerAgentAdapter {
50
51
  readonly name = "oracle";
51
52
  readonly identity = ORACLE_IDENTITY;
52
53
  readonly startingState = "solution" as const;
54
+ readonly role = "positive-control" as const;
53
55
  readonly requiredHostEnv: readonly string[] = [];
54
56
 
55
57
  setupFiles(): Record<string, string> {
@@ -82,12 +82,24 @@ export interface AttemptOutcome {
82
82
  */
83
83
  export type StartingState = "fixture" | "solution";
84
84
 
85
+ /**
86
+ * What an adapter's attempts are for. "agent" is an arm under measurement; a
87
+ * control checks the instrument instead: "positive-control" must pass (the
88
+ * built-in oracle applies each eval's reference solution) and
89
+ * "negative-control" must fail (the built-in echo adapter does nothing). The
90
+ * runner records the role of the adapter that actually runs each experiment
91
+ * (RunConfig.roles); the report never guesses it from a name.
92
+ */
93
+ export type AdapterRole = "agent" | "positive-control" | "negative-control";
94
+
85
95
  export interface AgentAdapter {
86
96
  /** The adapter name experiments select via `agent.adapter` (e.g. "echo"). */
87
97
  name: string;
88
98
  identity?: AdapterIdentityConfig;
89
99
  /** Starting workspace the runner prepares for this adapter (default "fixture"). */
90
100
  startingState?: StartingState;
101
+ /** What the adapter's attempts are for (default "agent"). */
102
+ role?: AdapterRole;
91
103
  runAttempt(ctx: AttemptContext): Promise<AttemptOutcome>;
92
104
  }
93
105
 
@@ -128,6 +140,8 @@ export interface ContainerAgentAdapter {
128
140
  identity?: AdapterIdentityConfig;
129
141
  /** Starting workspace the runner prepares for this adapter (default "fixture"). */
130
142
  startingState?: StartingState;
143
+ /** What the adapter's attempts are for (default "agent"). */
144
+ role?: AdapterRole;
131
145
  /** Command used during preflight to record the executable's exact version. */
132
146
  versionCommand?: readonly string[];
133
147
  /**
@@ -9,7 +9,7 @@ export const EMBEDDED_BUILD_INFO: {
9
9
  // (the `x-release-please-version` marker anchors the replacement). It is
10
10
  // restored as-is after a binary build (scripts/build-binary.ts), so the
11
11
  // committed source `--version` stays in lockstep with package.json.
12
- version: "0.4.0", // x-release-please-version
12
+ version: "0.5.0", // x-release-please-version
13
13
  revision: null,
14
14
  dirty: null,
15
15
  sourceHash: null,
@@ -119,13 +119,16 @@ export function collectExperimentAggregate(
119
119
  }
120
120
 
121
121
  /**
122
- * Leaderboard order: discriminating pass rate desc (nulls last), then the
122
+ * Leaderboard order: agent arms before controls (the oracle would otherwise
123
+ * lead every board), then discriminating pass rate desc (nulls last), then the
123
124
  * all-eval pass rate desc (nulls last), then experiment id — a total order,
124
125
  * so every consumer renders the same rows in the same sequence.
125
126
  */
126
127
  export function compareLeaderboard(a: ReportExperiment, b: ReportExperiment): number {
127
128
  const rate = (value: number | null | undefined): number => (value === null || value === undefined ? -1 : value);
129
+ const control = (experiment: ReportExperiment): number => ((experiment.role ?? "agent") === "agent" ? 0 : 1);
128
130
  return (
131
+ control(a) - control(b) ||
129
132
  rate(b.aggregate?.pass_rate_discriminating) - rate(a.aggregate?.pass_rate_discriminating) ||
130
133
  rate(b.aggregate?.pass_rate_all) - rate(a.aggregate?.pass_rate_all) ||
131
134
  a.experiment_id.localeCompare(b.experiment_id)
@@ -32,10 +32,16 @@ import { activeAttempts, type AttemptRecord, type ResultsStore, type RunRecord }
32
32
  import type { SurfaceUsage } from "../surface-usage.ts";
33
33
  import { collectPassAtK, displayPassAtK, type PassAtKEntry } from "./pass-at-k.ts";
34
34
  import { estimateRunCosts, type Pricing, type RunCostEstimate } from "./costs.ts";
35
- import { collectBands, collectScorerHealth, type EvalBand, type ScorerHealth } from "./scorer-health.ts";
35
+ import {
36
+ collectBands,
37
+ collectScorerHealth,
38
+ type EvalBand,
39
+ type ExperimentRole,
40
+ type ScorerHealth,
41
+ } from "./scorer-health.ts";
36
42
  import { collectExperimentAggregate, compareLeaderboard, type ExperimentAggregate } from "./aggregate.ts";
37
43
 
38
- export type { EvalBand, ScorerHealth, ScorerHealthSuspect } from "./scorer-health.ts";
44
+ export type { EvalBand, ExperimentRole, ScorerHealth, ScorerHealthSuspect } from "./scorer-health.ts";
39
45
  export type { ExperimentAggregate } from "./aggregate.ts";
40
46
  export { compareLeaderboard } from "./aggregate.ts";
41
47
 
@@ -47,7 +53,7 @@ export class ReportError extends Error {
47
53
  }
48
54
  }
49
55
 
50
- export const REPORT_SCHEMA_VERSION = 9;
56
+ export const REPORT_SCHEMA_VERSION = 10;
51
57
 
52
58
  /**
53
59
  * Substrings that must never appear in generated report prose: at n≤5 trials
@@ -79,7 +85,10 @@ export function methodologyNote(trials: number): string {
79
85
  `recorded at least one ungraded check and recalled are those whose ungraded checks all passed. Ungraded ` +
80
86
  `checks are recorded and tallied but never enter pass/fail. Scorer health lists checks that failed in every ` +
81
87
  `scored attempt of an eval under every arm while another check in the same attempts passed: a statement ` +
82
- `about the instrument, not about any treatment.`
88
+ `about the instrument, not about any treatment. Control experiments — an oracle that applies each eval's ` +
89
+ `reference solution, a no-op that changes nothing — are reported alongside the agent experiments and ` +
90
+ `tagged as controls wherever they appear; bands and scorer health are decided over the agent experiments ` +
91
+ `only, and controls are ranked after every agent experiment.`
83
92
  );
84
93
  }
85
94
 
@@ -112,6 +121,13 @@ export interface ReportExperiment {
112
121
  experiment_id: string;
113
122
  treatment: string | null;
114
123
  agent: ReportAgentIdentity;
124
+ /**
125
+ * "agent" for an arm; "positive-control" (the oracle) and "negative-control"
126
+ * (the echo no-op) never decide a band or a scorer-health suspect. Optional on
127
+ * the wire: absent in schema_version < 10 artifacts; readers treat absence as
128
+ * "agent".
129
+ */
130
+ role?: ExperimentRole;
115
131
  /**
116
132
  * Optional on the wire: absent in schema_version < 7 artifacts, which the
117
133
  * export may still carry — readers must tolerate absence.
@@ -161,8 +177,9 @@ export interface ReportPair {
161
177
  flaky: boolean;
162
178
  checks: ReportCheck[];
163
179
  /**
164
- * The eval's band, denormalised onto each of its pairs: decided over the
165
- * eval's pairs with scored > 0; null when fewer than 2 arms scored. Absent
180
+ * The eval's band, denormalised onto each of its pairs (control pairs too):
181
+ * decided over the eval's agent pairs with scored > 0; null when fewer than 2
182
+ * agent arms scored (before schema 10, controls counted as arms). Absent
166
183
  * in schema_version < 8 artifacts; readers treat absence as unbanded.
167
184
  */
168
185
  band: EvalBand | null;
@@ -412,6 +429,21 @@ export function collectRecall(attempts: AttemptRecord[], experimentId: string):
412
429
  return { attempts: total, recalled, rate: total > 0 ? recalled / total : null };
413
430
  }
414
431
 
432
+ /**
433
+ * An experiment's role as the run recorded it (RunConfig.roles, from the
434
+ * adapter that actually ran). A run from before roles were recorded keeps no
435
+ * record of which adapter ran, so every experiment in it reads as an agent —
436
+ * exactly as before roles existed; nothing is guessed from a name or identity.
437
+ */
438
+ function roleOf(run: RunRecord, experimentId: string): ExperimentRole {
439
+ return run.config.roles?.[experimentId] ?? "agent";
440
+ }
441
+
442
+ /** The run's control experiments, from the roles it recorded. */
443
+ function controlExperiments(run: RunRecord): Set<string> {
444
+ return new Set(run.config.experimentIds.filter((id) => roleOf(run, id) !== "agent"));
445
+ }
446
+
415
447
  function collectExperiments(
416
448
  run: RunRecord,
417
449
  attempts: AttemptRecord[],
@@ -425,6 +457,7 @@ function collectExperiments(
425
457
  return {
426
458
  experiment_id: experimentId,
427
459
  treatment: treatmentOf(run, experimentId),
460
+ role: roleOf(run, experimentId),
428
461
  agent: {
429
462
  adapter: agent?.adapter ?? "unspecified",
430
463
  provider: agent?.provider ?? "unspecified",
@@ -599,9 +632,10 @@ export function buildReport(options: BuildReportOptions): ReportJson {
599
632
  if (publication && publication.eligible.length === 0) throw new ReportError(`no eligible complete samples for run ${runId}: ${publication.omitted.map((p) => `${p.eval_id} × ${p.experiment_id}: ${p.reasons.join("; ")}`).join(" | ")}`);
600
633
  const attempts = publication ? current.filter((a) => publication.eligible.some((p) => p.eval_id === a.evalId && p.experiment_id === a.experimentId)) : current;
601
634
  const pairs = collectPairs(attempts);
602
- const bands = collectBands(pairs);
635
+ const controls = controlExperiments(run);
636
+ const bands = collectBands(pairs, controls);
603
637
  for (const pair of pairs) pair.band = bands.get(pair.eval_id) ?? null;
604
- const scorerHealth = collectScorerHealth(attempts, pairs);
638
+ const scorerHealth = collectScorerHealth(attempts, pairs, controls);
605
639
  const costEstimate = options.pricing === undefined ? undefined : estimateRunCosts(run, attempts, options.resultsDir, options.pricing);
606
640
 
607
641
  const methodology = methodologyNote(run.config.trials) + (costEstimate === undefined ? "" :
@@ -674,11 +708,12 @@ function renderLeaderboard(experiments: ReportExperiment[]): string[] {
674
708
  (typeof agg.estimated_cost_usd === "number" ? ` +$${agg.estimated_cost_usd.toFixed(4)} est.` : "");
675
709
  const recall = experiment.sdk_recall;
676
710
  const recallText = recall && recall.rate !== null ? `${recall.recalled}/${recall.attempts}` : "n/a";
677
- return [experiment.experiment_id, `${model}${reasoning}`, `${all} · ${disc}`, time, tokens, cost, recallText];
711
+ const id = (experiment.role ?? "agent") === "agent" ? experiment.experiment_id : `${experiment.experiment_id} (control)`;
712
+ return [id, `${model}${reasoning}`, `${all} · ${disc}`, time, tokens, cost, recallText];
678
713
  });
679
714
  const widths = header.map((title, i) => Math.max(title.length, ...rows.map((row) => row[i]!.length)));
680
715
  const format = (cells: string[]): string => ` ${cells.map((cell, i) => cell.padEnd(widths[i]!)).join(" ").trimEnd()}`;
681
- return ["leaderboard (benchmark suite, sorted by discriminating pass rate):", format(header), ...rows.map(format)];
716
+ return ["leaderboard (benchmark suite, sorted by discriminating pass rate; controls last):", format(header), ...rows.map(format)];
682
717
  }
683
718
 
684
719
  /** Render the report as plain text. Renders FROM the JSON, never the store. */
@@ -794,7 +829,9 @@ export function renderReportText(report: ReportJson): string {
794
829
  lines.push(` ${group.group}: compared (raw counts per arm)`);
795
830
  for (const arm of group.arms) {
796
831
  const cells = arm.evals.map((entry) => `${entry.eval_id} ${entry.display}`).join(", ");
797
- lines.push(` ${arm.experiment_id}${arm.treatment !== null ? ` [${arm.treatment}]` : ""}: ${cells || "no scored attempts"}`);
832
+ const role = experiments.find((experiment) => experiment.experiment_id === arm.experiment_id)?.role ?? "agent";
833
+ const control = role === "agent" ? "" : " (control)";
834
+ lines.push(` ${arm.experiment_id}${control}${arm.treatment !== null ? ` [${arm.treatment}]` : ""}: ${cells || "no scored attempts"}`);
798
835
  }
799
836
  }
800
837
  }
@@ -13,6 +13,15 @@ import type { ReportPair } from "./report.ts";
13
13
 
14
14
  export type EvalBand = "discriminating" | "solved-by-all" | "failed-by-all";
15
15
 
16
+ /**
17
+ * What an experiment is for (the run's recorded RunConfig.roles). A control
18
+ * says whether the instrument works — the oracle must pass, the echo no-op must
19
+ * fail — so bands and scorer health are decided over agent experiments only:
20
+ * with an oracle and a no-op in the run, no eval could otherwise be solved or
21
+ * failed by all.
22
+ */
23
+ export type ExperimentRole = import("../adapters/types.ts").AdapterRole;
24
+
16
25
  export interface ScorerHealthSuspect {
17
26
  eval_id: string;
18
27
  check: string;
@@ -30,10 +39,19 @@ export interface ScorerHealth {
30
39
  summary: string;
31
40
  }
32
41
 
33
- /** Per eval: over pairs with scored > 0. null when fewer than 2 arms scored. */
34
- export function collectBands(pairs: ReportPair[]): Map<string, EvalBand | null> {
42
+ /**
43
+ * Per eval: over agent pairs with scored > 0 (`controls` names the control
44
+ * experiments, which never decide a band). null when fewer than 2 agent arms
45
+ * scored. Every eval of the run gets an entry, control-only ones as null.
46
+ */
47
+ export function collectBands(
48
+ pairs: ReportPair[],
49
+ controls: ReadonlySet<string> = new Set(),
50
+ ): Map<string, EvalBand | null> {
35
51
  const byEval = new Map<string, ReportPair[]>();
36
52
  for (const pair of pairs) {
53
+ if (!byEval.has(pair.eval_id)) byEval.set(pair.eval_id, []);
54
+ if (controls.has(pair.experiment_id)) continue;
37
55
  const list = byEval.get(pair.eval_id) ?? [];
38
56
  list.push(pair);
39
57
  byEval.set(pair.eval_id, list);
@@ -62,18 +80,25 @@ export function scorerHealthSummary(suspects: ScorerHealthSuspect[]): string {
62
80
  }
63
81
 
64
82
  /**
65
- * Suspects come only from `failed-by-all` evals (≥2 scored arms). A check is a
66
- * suspect when it is present and failing in every scored (completed) attempt
67
- * of those arms, and at least one other graded check is present and passing
68
- * in every one of them. A name flagged `graded: false` in any attempt (the
69
- * pair tally's rule) is excluded from both sides.
83
+ * Suspects come only from `failed-by-all` evals (≥2 scored agent arms). A
84
+ * check is a suspect when it is present and failing in every scored
85
+ * (completed) attempt of those arms, and at least one other graded check is
86
+ * present and passing in every one of them. A name flagged `graded: false` in
87
+ * any attempt (the pair tally's rule) is excluded from both sides. Control
88
+ * experiments (`controls`) are never arms.
70
89
  */
71
- export function collectScorerHealth(attempts: AttemptRecord[], pairs: ReportPair[]): ScorerHealth {
72
- const bands = collectBands(pairs);
90
+ export function collectScorerHealth(
91
+ attempts: AttemptRecord[],
92
+ pairs: ReportPair[],
93
+ controls: ReadonlySet<string> = new Set(),
94
+ ): ScorerHealth {
95
+ const bands = collectBands(pairs, controls);
73
96
  const suspects: ScorerHealthSuspect[] = [];
74
97
  for (const [evalId, band] of bands) {
75
98
  if (band !== "failed-by-all") continue;
76
- const arms = pairs.filter((pair) => pair.eval_id === evalId && pair.scored > 0);
99
+ const arms = pairs.filter(
100
+ (pair) => pair.eval_id === evalId && pair.scored > 0 && !controls.has(pair.experiment_id),
101
+ );
77
102
  const experiments = arms.map((pair) => pair.experiment_id).sort((a, b) => a.localeCompare(b));
78
103
  const ungraded = new Set(arms.flatMap((pair) => pair.checks.filter((check) => check.graded === false).map((check) => check.name)));
79
104
  const scored = attempts.filter(
@@ -506,6 +506,18 @@ export async function executeRunV3(options: ExecuteRunV3Options): Promise<RunSum
506
506
  // ON THE RUN: the manifest holds runtime config only as an opaque hash,
507
507
  // so the report could never recompute this after the fact.
508
508
  groups: compareGroups(options.experiments.map((entry) => entry.experiment), manifest),
509
+ // Roles come from the resolved adapter, never its name: a scripted
510
+ // container command is an agent whatever `agent.adapter` says.
511
+ roles: Object.fromEntries(
512
+ [...experimentsById.values()].map((experiment) => [
513
+ experiment.id,
514
+ experiment.runtime.kind === "host"
515
+ ? (hostAdapters[experiment.agent.adapter]?.role ?? "agent")
516
+ : (experiment.runtime.command ?? []).length > 0
517
+ ? "agent"
518
+ : (containerAgents.get(experiment.id)?.role ?? "agent"),
519
+ ]),
520
+ ),
509
521
  ...(offeredSurfaces !== undefined ? { surfaces: offeredSurfaces } : {}),
510
522
  };
511
523
 
package/src/store/db.ts CHANGED
@@ -34,6 +34,13 @@ function toLimitKind(value: string | null): LimitKind | null {
34
34
 
35
35
  /** The run-level configuration recorded in `runs.config_json`. */
36
36
  export interface RunConfig {
37
+ /**
38
+ * Each experiment's role, from the adapter that actually ran it (a scripted
39
+ * container command is always "agent"). Recorded here — NOT in the manifest —
40
+ * like `groups`, so it never perturbs run identity. Absent on older runs: every
41
+ * experiment then reads as "agent".
42
+ */
43
+ roles?: Record<string, import("../adapters/types.ts").AdapterRole>;
37
44
  scheduler?: { concurrency: number; seed: string; policy: "seeded-hash-v1"; order: import("../plan.ts").AttemptPlan[] };
38
45
  trials: number;
39
46
  evalIds: string[];
@@ -24,7 +24,7 @@ Error generating stack: `+e.message+`
24
24
  `);return t.at(-1)===``&&t.pop(),t.map((e,t)=>Ee(e,t+1))}function A({turn:e,highlighted:t,defaultExpanded:n}){let[r,i]=(0,l.useState)(n);return(0,S.jsxs)(`div`,{className:t?`turn highlight`:`turn`,id:`L${e.line}`,"data-line":e.line,children:[(0,S.jsxs)(`button`,{type:`button`,className:`turn-head`,onClick:()=>i(!r),"aria-expanded":r,children:[(0,S.jsxs)(`span`,{className:`line-no`,children:[`L`,e.line]}),(0,S.jsx)(`span`,{className:`role role-${e.role}`,children:e.role}),(0,S.jsxs)(`span`,{className:`summary`,children:[e.isError&&`⚠ `,e.summary]}),(0,S.jsx)(`span`,{"aria-hidden":`true`,children:r?`▾`:`▸`})]}),r&&(0,S.jsx)(`div`,{className:`turn-body`,children:(0,S.jsx)(`pre`,{children:e.detail})})]})}function Oe({text:e,lines:t}){let n=(0,l.useMemo)(()=>De(e),[e]),[r,i]=(0,l.useState)(!1),a=(0,l.useRef)(null),o=!r&&n.length>k,s=n,c=null;if(o){if(t){let e=Math.min(Math.max(t[0]-1,0),n.length-1),r=Math.max(0,e-Ce),i=Math.min(n.length,Math.max(e+Ce,t[1])+1);s=n.slice(r,i),c=`showing turns ${r+1}–${i} of ${n.length} (window around L${t[0]})`}else s=n.slice(0,k),c=`showing the first ${k} of ${n.length} turns`}(0,l.useEffect)(()=>{t&&(a.current?.querySelector(`#L${t[0]}`))?.scrollIntoView({block:`center`})},[t,r,e]);let u=e=>t!==void 0&&e>=t[0]&&e<=t[1];return(0,S.jsxs)(`div`,{className:`quickstudy-viewer viewer`,ref:a,"data-testid":`transcript-viewer`,children:[c!==null&&(0,S.jsxs)(`div`,{className:`viewer-note`,children:[(0,S.jsx)(`span`,{children:c}),(0,S.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),"data-testid":`load-all`,children:[`Load all `,n.length,` turns`]})]}),s.map(e=>(0,S.jsx)(A,{turn:e,highlighted:u(e.line),defaultExpanded:u(e.line)},e.line))]})}function ke({runId:e,attemptId:t,artifact:n,lines:r}){let i=C(async()=>{let r=(await _(e)).attempts.find(e=>e.id===t);if(!r)throw new d(`missing`,`data/runs/${e}/run.json`,`attempt "${t}" is not in this run's export`);let i=n===`transcript`?r.transcript:r.diff;if(i===null)throw new d(`missing`,`data/runs/${e}/attempts/${t}`,`this attempt has no ${n} artifact in the export`);return{attempt:r,text:await b(e,i)}},[e,t,n]);if(i.status===`error`)return(0,S.jsx)(ee,{error:i.error});if(i.status===`loading`)return(0,S.jsxs)(`div`,{className:`loading`,children:[`Loading `,n,`…`]});let{attempt:a,text:o}=i.value,s=n===`transcript`?`diff`:`transcript`,c=(n===`transcript`?a.diff:a.transcript)!==null,l=pe(a);return(0,S.jsxs)(`div`,{"data-testid":`attempt-view`,children:[(0,S.jsxs)(`div`,{className:`viewer-head`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`h1`,{style:{fontSize:18,margin:0},children:[a.eval_id,` × `,a.experiment_id,a.treatment===null?``:` · ${a.treatment}`,` · trial `,a.trial_index+1]}),(0,S.jsxs)(`p`,{className:`sub`,style:{margin:`2px 0 0`},children:[`attempt `,(0,S.jsx)(`code`,{children:a.id}),` · `,n,r?` · lines ${r[0]}–${r[1]}`:``]})]}),(0,S.jsxs)(`div`,{className:`controls`,children:[(0,S.jsx)(D,{tone:me(l),children:l}),(0,S.jsx)(ge,{attempt:a}),c&&(0,S.jsxs)(`a`,{href:T.attempt(e,a.id,s),children:[`view `,s]}),(0,S.jsx)(`a`,{href:T.cell(e,{evalId:a.eval_id,experimentId:a.experiment_id}),children:`open cell`})]})]}),a.error!==null&&(0,S.jsx)(`div`,{className:`notice`,children:(0,S.jsx)(`code`,{children:a.error})}),a.checks!==null&&a.checks.length>0&&(0,S.jsx)(`div`,{className:`attempt-line`,style:{margin:`8px 0`},children:a.checks.map(e=>(0,S.jsxs)(`span`,{className:e.passed?`crit pass`:`crit fail`,title:e.notes??e.name,children:[e.passed?`✓`:`✗`,` `,e.name,!E(e)&&(0,S.jsx)(`span`,{className:`tag`,"data-testid":`ungraded-tag`,title:`Recorded, not graded: never enters pass/fail`,children:`recorded`})]},e.name))}),(0,S.jsx)(Se,{treatment:a.treatment,usage:a.surface_usage}),n===`transcript`?(0,S.jsx)(Oe,{text:o,lines:r}):(0,S.jsx)(fe,{text:o,lines:r})]})}var Ae=`unspecified`;function je(e,t){return e===Ae?null:t===Ae?e:`${e} (${t})`}function Me(e){return e.model===Ae?`model unpinned`:e.reasoning===Ae?e.model:`${e.model} · ${e.reasoning}`}function Ne(e,t){let n=e.manifest.experiments[t]?.components.agent;return n===void 0?null:je(n.model,n.reasoning)}function Pe(e,t){let n=e.manifest.experiments[t]?.components.agent;if(n===void 0||n.model===Ae)return null;let r=[`adapter ${n.adapter}`,`provider ${n.provider}`,`model ${n.model}`];return n.reasoning!==Ae&&r.push(`reasoning ${n.reasoning}`),n.cliVersion!==Ae&&r.push(`cli ${n.cliVersion}`),r.join(` · `)}function Fe(e,t){let n=new Set(t.map(t=>Ne(e,t)));return n.size===1?[...n][0]??null:null}function Ie(e){let t=new Map;for(let n of e){if(n.status!==`completed`)continue;let e=t.get(n.eval_id);e||(e=new Map,t.set(n.eval_id,e));let r=e.get(n.experiment_id)??{passed:0,scored:0};r.scored+=1,n.passed===!0&&(r.passed+=1),e.set(n.experiment_id,r)}return t}function Le(e,t,n){let r=[...t.keys()].filter(n=>e.experimentIds.some(e=>t.get(n)?.has(e))),i=[...n.keys()].filter(t=>e.experimentIds.every(e=>n.get(t)?.has(e)===!0));return[...new Set([...r,...i])].sort((e,t)=>e.localeCompare(t))}var Re=e=>e.comparison===`allowed`&&e.experimentIds.length>=2;function ze(e){let t=new Map;for(let n of e){let e=t.get(n.eval_id)??new Set;e.add(n.experiment_id),t.set(n.eval_id,e)}return t}function Be(e,t,n,r){let i=t.filter(Re);if(i.length===0)return[];let a=[];return e<3&&a.push(`With fewer than 3 trials per pair (this run: ${e}), per-arm counts are listed but not comparable.`),i.some(e=>[...r.keys()].some(t=>e.experimentIds.every(e=>r.get(t)?.has(e)===!0)&&e.experimentIds.some(e=>(n.get(t)?.get(e)?.scored??0)===0)))&&a.push(`Some shared evals have an arm with nothing scored; those rows are listed but not comparable.`),a}function Ve(e,t){return e.manifest.experiments[t]?.components.treatment??null}function He({run:e,group:t}){let n=Fe(e,t.experimentIds);return n===null?(0,S.jsx)(`h3`,{children:t.group}):(0,S.jsxs)(`h3`,{children:[n,` `,(0,S.jsx)(`span`,{className:`group-sub`,children:t.group})]})}function Ue({run:e,group:t,arms:n,attempted:r}){if(t.comparison===`withheld`)return(0,S.jsxs)(`div`,{className:`card`,"data-testid":`group-${t.group}`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(He,{run:e,group:t}),(0,S.jsx)(D,{tone:`amber`,children:`comparison withheld`})]}),(0,S.jsxs)(`div`,{className:`body`,children:[(0,S.jsx)(`p`,{className:`viewer-note`,"data-testid":`group-withheld-${t.group}`,children:`Members differ beyond their declared treatment, so no automatic comparison is rendered. Raw per-experiment results remain visible in the matrix. The differing components:`}),(0,S.jsx)(`ul`,{className:`identity-diff`,"data-testid":`group-diff-${t.group}`,children:t.details.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsx)(`code`,{children:e})},e))})]})]});if(t.experimentIds.length<2)return(0,S.jsxs)(`div`,{className:`card`,"data-testid":`group-${t.group}`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(He,{run:e,group:t}),(0,S.jsx)(D,{tone:`gray`,children:`single experiment`})]}),(0,S.jsx)(`div`,{className:`body`,children:(0,S.jsx)(`p`,{className:`viewer-note`,children:`This group declares one experiment — nothing to compare. Its raw results render in the matrix.`})})]});let i=Le(t,n,r);return(0,S.jsxs)(`div`,{className:`card`,"data-testid":`group-${t.group}`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(He,{run:e,group:t}),(0,S.jsx)(D,{tone:`green`,children:`compared — raw counts`})]}),(0,S.jsxs)(`div`,{className:`body`,children:[(0,S.jsxs)(`table`,{className:`data`,"data-testid":`group-table-${t.group}`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`eval`}),t.experimentIds.map(t=>(0,S.jsxs)(`th`,{children:[(0,S.jsx)(`code`,{children:t}),Ve(e,t)!==null&&(0,S.jsx)(`div`,{className:`attribution-reason`,children:Ve(e,t)})]},t))]})}),(0,S.jsx)(`tbody`,{children:i.map(e=>(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`td`,{children:(0,S.jsx)(`code`,{children:e})}),t.experimentIds.map(t=>{let r=n.get(e)?.get(t);return(0,S.jsx)(`td`,{"data-testid":`arm-${e}-${t}`,children:r===void 0?`—`:`${r.passed}/${r.scored}`},t)})]},e))})]}),(0,S.jsx)(`p`,{className:`viewer-note`,children:`Raw passed/scored counts per arm. Incomplete and errored attempts are excluded from these counts and reported in the matrix drill-down.`})]})]})}function We({meta:e,runId:t}){let n=t??``,r=C(()=>_(n),[n]),i=(0,l.useMemo)(()=>r.status===`ready`?Ie(r.value.attempts):null,[r]);if(n===``)return(0,S.jsx)(`div`,{"data-testid":`compare-view`,children:(0,S.jsxs)(`div`,{className:`empty-state`,children:[(0,S.jsx)(`h2`,{children:`No run selected`}),(0,S.jsx)(`p`,{children:`Pick a run to see its comparison groups.`})]})});if(r.status===`error`)return(0,S.jsx)(ee,{error:r.error});if(r.status===`loading`||i===null)return(0,S.jsx)(`div`,{className:`loading`,children:`Loading run…`});let a=r.value.groups,o=ze(r.value.attempts),s=Be(r.value.run.trials,a,i,o);return(0,S.jsxs)(`div`,{"data-testid":`compare-view`,children:[(0,S.jsxs)(`div`,{className:`page-head`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{children:`Comparison groups`}),(0,S.jsx)(`p`,{className:`sub`,children:`Raw per-arm counts for experiments declared as treatments of one configuration; mismatched groups are withheld with their component diff.`})]}),(0,S.jsxs)(`div`,{className:`control`,children:[(0,S.jsx)(`label`,{htmlFor:`compare-run`,children:`Run`}),(0,S.jsx)(`select`,{id:`compare-run`,"data-testid":`compare-run-select`,value:n,onChange:e=>se(T.compare(e.currentTarget.value)),children:e.runs.map(e=>(0,S.jsxs)(`option`,{value:e.id,children:[e.id.slice(0,10),`… · `,e.started_at.slice(0,10),` · `,e.attempts,` attempts`]},e.id))})]})]}),r.value.run.finished_at===null&&(0,S.jsx)(`div`,{className:`notice`,"data-testid":`incomplete-banner`,children:`Incomplete run — this run never finished. Counts are partial.`}),s.length>0&&(0,S.jsx)(`div`,{className:`notice`,"data-testid":`compare-n-notice`,children:s.join(` `)}),a.length===0?(0,S.jsxs)(`div`,{className:`empty-state`,"data-testid":`no-groups`,children:[(0,S.jsx)(`h2`,{children:`No comparison groups in this run`}),(0,S.jsxs)(`p`,{children:[`Declare `,(0,S.jsx)(`code`,{children:`comparisonGroup`}),` on experiments meant to be treatments of one configuration, then re-run.`]})]}):a.map(e=>(0,S.jsx)(Ue,{run:r.value,group:e,arms:i,attempted:o},e.group))]})}var Ge=[`docs`,`mcp`,`cli`,`sdk`,`environment`,`eval-defect`];async function Ke(e){if(typeof navigator>`u`||!navigator.clipboard)throw Error(`the clipboard API needs a secure context (HTTPS, localhost or file://)`);await navigator.clipboard.writeText(e)}function qe({text:e,label:t=`Copy`,testId:n}){let[r,i]=(0,l.useState)({kind:`idle`});return(0,l.useEffect)(()=>{if(r.kind===`idle`)return;let e=setTimeout(()=>i({kind:`idle`}),r.kind===`failed`?4e3:1500);return()=>clearTimeout(e)},[r]),(0,S.jsx)(`button`,{type:`button`,className:`copy-button`,"data-testid":n,title:r.kind===`failed`?r.reason:void 0,onClick:()=>Ke(e()).then(()=>i({kind:`copied`}),e=>i({kind:`failed`,reason:e instanceof Error?e.message:String(e)})),children:r.kind===`idle`?t:r.kind===`copied`?`Copied`:`Copy failed`})}var Je=.25;function Ye(e,t){return`${e}\u0000${t}`}function Xe(e){let t=new Map;for(let n of e){let e=(n.checks??[]).filter(e=>E(e)&&e.passed<e.total).map(e=>e.name).sort();t.set(Ye(n.eval_id,n.experiment_id),e)}return t}function Ze(e,t){let n=t===null?new Map:Xe(t),r=new Map;for(let t of e){let e=n.get(Ye(t.eval_id,t.experiment_id))??[],i=`${t.eval_id}\u0000${e.join(`,`)}`,a=r.get(i);a===void 0&&(a={evalId:t.eval_id,failingChecks:e,findings:[],experiments:[]},r.set(i,a)),a.findings.push(t),a.experiments.includes(t.experiment_id)||a.experiments.push(t.experiment_id)}return[...r.values()].sort((e,t)=>t.findings.length-e.findings.length||(e.evalId<t.evalId?-1:+(e.evalId>t.evalId))||(e.failingChecks.join(`,`)<t.failingChecks.join(`,`)?-1:1))}function Qe(e){let t=e.filter(e=>e.target===`eval-defect`).length;return e.length===0||t/e.length<Je?[...Ge]:[`eval-defect`,...Ge.filter(e=>e!==`eval-defect`)]}function $e(e,t){let n=e.evidence.map(e=>`[${e.artifact} L${e.lines[0]}–${e.lines[1]}](${t(e)})`).join(`, `);return[`**${e.claim}** — ${e.confidence} confidence`,`\`${e.eval_id}\` × \`${e.experiment_id}\` · ${e.target}`,`Suggested change: ${e.suggested_change}`,n?`Evidence: ${n}`:`Evidence: none`].join(`
25
25
  `)}function et(e,t){let n=Ge.flatMap(n=>{let r=e.findings.filter(e=>e.target===n);return r.length===0?[]:[`## ${n} findings (${r.length})`,...r.map(e=>$e(e,t))]}),r=e.errors.length?[`## Pairs not analyzed`,...e.errors.map(e=>`- \`${e.eval_id}\` × \`${e.experiment_id}\`: ${e.error}`)]:[];return[`# Run diagnosis ${e.run_id}`,`_${e.disclaimer}_`,`Model ${e.model.requested} (resolved ${e.model.resolved??`unavailable`}) · prompt v${e.prompt_version} · generated ${e.generated_at} · ${e.pairs_diagnosed} pairs diagnosed, ${e.pairs_skipped} skipped, ${e.findings.length} findings`,...n,...r].join(`
26
26
 
27
- `)}function tt(e){return e===`high`?`green`:e===`medium`?`amber`:`gray`}function nt(e,t){return T.attempt(e,t.attempt_id,t.artifact,t.lines)}function rt(e){return t=>new URL(nt(e,t),window.location.href).href}function it({runId:e,evidence:t}){return(0,S.jsxs)(`a`,{className:`evidence-chip`,"data-testid":`evidence-link`,href:nt(e,t),children:[t.artifact,` L`,t.lines[0],`–`,t.lines[1]]})}function at({runId:e,finding:t}){return(0,S.jsxs)(`div`,{className:`card`,"data-testid":`diagnosis-finding`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(`h3`,{children:t.claim}),(0,S.jsxs)(`span`,{className:`head-actions`,children:[(0,S.jsxs)(D,{tone:tt(t.confidence),children:[t.confidence,` confidence`]}),(0,S.jsx)(qe,{testId:`copy-finding`,text:()=>$e(t,rt(e))})]})]}),(0,S.jsxs)(`div`,{className:`body`,children:[(0,S.jsxs)(`div`,{className:`attribution-reason`,children:[(0,S.jsx)(`code`,{children:t.eval_id}),` × `,(0,S.jsx)(`code`,{children:t.experiment_id})]}),(0,S.jsx)(`p`,{children:t.suggested_change}),(0,S.jsx)(`div`,{className:`evidence-row`,children:t.evidence.map((t,n)=>(0,S.jsx)(it,{runId:e,evidence:t},`${t.attempt_id}-${t.artifact}-${n}`))})]})]})}var ot=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function st(e){let t=ot(e.findings.length,`finding`);return e.failingChecks.length===0?`${e.evalId} · ${t}`:`${e.evalId} · ${e.failingChecks.join(`, `)} failed under ${ot(e.experiments.length,`arm`)} · ${t}`}function ct({runId:e,diagnosis:t,pairs:n}){let[r,i]=(0,l.useState)(null);if(t.schema_version!==1)return(0,S.jsxs)(`div`,{className:`error-banner`,"data-testid":`diagnosis-schema-banner`,role:`alert`,children:[(0,S.jsx)(`strong`,{children:`Diagnosis schema mismatch.`}),` This diagnosis.json is schema_version`,` `,String(t.schema_version),` but this UI build expects `,1,` — regenerate it with the matching quickstudy version (`,(0,S.jsxs)(`code`,{children:[`quickstudy diagnose `,e]}),`).`]});let a=new Map;for(let e of t.findings){let t=a.get(e.target);t?t.push(e):a.set(e.target,[e])}let o=Qe(t.findings),s=Ze(t.findings,n);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`notice`,"data-testid":`diagnosis-disclaimer`,children:t.disclaimer}),(0,S.jsxs)(`div`,{className:`kpi-row`,"data-testid":`diagnosis-provenance`,children:[(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Model`}),(0,S.jsx)(`div`,{className:`kpi-val`,style:{fontSize:15},children:t.model.requested}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[`resolved: `,t.model.resolved??`unavailable`]})]}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Pairs diagnosed`}),(0,S.jsx)(`div`,{className:`kpi-val`,children:t.pairs_diagnosed}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[t.pairs_skipped,` skipped`]})]}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Findings`}),(0,S.jsx)(`div`,{className:`kpi-val`,children:t.findings.length}),(0,S.jsx)(`div`,{className:`kpi-meta`,children:t.errors.length>0?`${t.errors.length} pair(s) not analyzed`:`all selected pairs analyzed`})]}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Provenance`}),(0,S.jsx)(`div`,{className:`kpi-val`,style:{fontSize:15},children:t.generated_at.slice(0,10)}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[`run `,(0,S.jsxs)(`code`,{children:[t.run_id.slice(0,10),`…`]}),` · prompt v`,t.prompt_version]})]})]}),t.findings.length===0&&(0,S.jsxs)(`div`,{className:`empty-state`,"data-testid":`diagnosis-no-findings`,children:[(0,S.jsx)(`h2`,{children:`Diagnosis ran; no findings.`}),(0,S.jsx)(`p`,{children:`The analyst drafted no hypotheses for this run's diagnosable pairs.`})]}),t.findings.length>0&&(0,S.jsx)(`div`,{className:`toolbar`,style:{justifyContent:`flex-start`},children:(0,S.jsxs)(`div`,{className:`seg`,role:`group`,"aria-label":`Finding target`,"data-testid":`diagnosis-target-filter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:r===null?`active`:``,"aria-pressed":r===null,onClick:()=>i(null),children:[`all (`,t.findings.length,`)`]}),o.filter(e=>a.has(e)).map(e=>(0,S.jsxs)(`button`,{type:`button`,className:r===e?`active`:``,"aria-pressed":r===e,onClick:()=>i(e),children:[e,` (`,a.get(e)?.length,`)`]},e))]})}),s.map(t=>{let n=o.filter(e=>(r===null||r===e)&&t.findings.some(t=>t.target===e));return n.length===0?null:(0,S.jsxs)(`section`,{className:`cluster`,"data-testid":`diagnosis-cluster`,children:[(0,S.jsx)(`h2`,{children:st(t)}),n.map(n=>(0,S.jsxs)(`section`,{"data-testid":`diagnosis-target-${n}`,children:[(0,S.jsxs)(`h3`,{children:[(0,S.jsx)(`code`,{children:n}),` findings`]}),t.findings.filter(e=>e.target===n).map((t,n)=>(0,S.jsx)(at,{runId:e,finding:t},`${t.eval_id}|${t.experiment_id}|${n}`))]},n))]},`${t.evalId}|${t.failingChecks.join(`,`)}`)}),t.errors.length>0&&(0,S.jsxs)(`div`,{className:`card`,"data-testid":`diagnosis-errors`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(`h3`,{children:`Pairs that could not be analyzed`}),(0,S.jsx)(`span`,{className:`kpi-meta`,children:`model failures are recorded, never silently dropped`})]}),(0,S.jsx)(`div`,{className:`body`,children:(0,S.jsxs)(`table`,{className:`data`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`eval`}),(0,S.jsx)(`th`,{children:`experiment`}),(0,S.jsx)(`th`,{children:`error`})]})}),(0,S.jsx)(`tbody`,{children:t.errors.map(e=>(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`td`,{children:(0,S.jsx)(`code`,{children:e.eval_id})}),(0,S.jsx)(`td`,{children:(0,S.jsx)(`code`,{children:e.experiment_id})}),(0,S.jsx)(`td`,{children:e.error})]},`${e.eval_id}|${e.experiment_id}`))})]})})]})]})}function lt({meta:e,runId:t}){let n=C(()=>y(t),[t]),r=C(()=>v(t).then(e=>e.pairs??null,()=>null),[t]);if(n.status===`error`)return(0,S.jsx)(ee,{error:n.error});if(n.status===`loading`||r.status===`loading`)return(0,S.jsx)(`div`,{className:`loading`,children:`Loading diagnosis…`});let i=r.status===`ready`?r.value:null,a=n.value;return(0,S.jsxs)(`div`,{"data-testid":`diagnosis-view`,children:[(0,S.jsxs)(`div`,{className:`page-head`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{children:`Run diagnosis`}),(0,S.jsx)(`p`,{className:`sub`,children:`Model-drafted hypotheses with harness-selected evidence — verify cited lines before acting.`})]}),(0,S.jsxs)(`div`,{className:`control`,children:[(0,S.jsx)(`label`,{htmlFor:`diagnosis-run`,children:`Run`}),(0,S.jsx)(`select`,{id:`diagnosis-run`,"data-testid":`diagnosis-run-select`,value:t,onChange:e=>se(T.diagnosis(e.currentTarget.value)),children:e.runs.map(e=>(0,S.jsxs)(`option`,{value:e.id,children:[e.id.slice(0,10),`… · `,e.started_at.slice(0,10)]},e.id))})]})]}),a!==null&&a.schema_version===1&&(0,S.jsx)(`div`,{className:`toolbar`,"data-testid":`diagnosis-toolbar`,children:(0,S.jsx)(qe,{testId:`copy-diagnosis`,label:`Copy all findings as Markdown`,text:()=>et(a,rt(t))})}),a===null?(0,S.jsxs)(`div`,{className:`empty-state`,"data-testid":`diagnosis-empty`,children:[(0,S.jsx)(`h2`,{children:`No diagnosis for this run`}),(0,S.jsx)(`p`,{children:`Generate one (requires a model API key — never done at export time), then re-export:`}),(0,S.jsx)(`pre`,{children:(0,S.jsxs)(`code`,{children:[`quickstudy diagnose `,t]})})]}):(0,S.jsx)(ct,{runId:t,diagnosis:a,pairs:i})]})}function ut({coverage:e}){return e?(0,S.jsxs)(`details`,{"data-testid":`publication-omissions`,open:e.omitted.length>0,children:[(0,S.jsxs)(`summary`,{children:[`Complete-sample publication: `,e.eligible.length,` pairs included, `,e.omitted.length,` omitted;`,` `,e.expected_trials,` trials required.`]}),(0,S.jsx)(`p`,{children:`These counts cover the included pairs. Source attempts and retry history remain available in the diagnostic artifacts.`}),e.omitted.map(e=>(0,S.jsxs)(`p`,{children:[e.eval_id,` × `,e.experiment_id,`: `,e.reasons.join(`; `)]},`${e.eval_id}:${e.experiment_id}`))]}):null}function dt(e,t){let n=e=>e??-1;return n(t.aggregate?.pass_rate_discriminating)-n(e.aggregate?.pass_rate_discriminating)||n(t.aggregate?.pass_rate_all)-n(e.aggregate?.pass_rate_all)||e.experiment_id.localeCompare(t.experiment_id)}function ft(e){if(e===null)return`—`;let t=e=>e.toFixed(1).replace(/\.0$/,``);return e>=1e6?`${t(e/1e6)}M`:e>=1e3?`${t(e/1e3)}k`:String(Math.round(e))}function pt(e){if(e===null)return`—`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function mt(e){return e===null?`—`:e>0&&e<.005?`<$0.01`:`$${e.toFixed(2)}`}function ht(e){let t=e.timedOut??0,n=e.incomplete-t,r=(e,t)=>`${e} ${t}${e===1?``:`s`}`,i=[e.unfinished?`the run never finished`:``,t>0?`${r(t,`attempt`)} timed out`:``,n>0?`${r(n,`attempt`)} incomplete`:``,e.errors>0?`${r(e.errors,`attempt`)} errored`:``].filter(Boolean);return i.length>0?i.join(`; `):`missing trial coverage`}function gt({experiment:e}){let t=e.aggregate;if(t===void 0||t.pass_rate_all===null)return`—`;let n=`${t.passed}/${t.passed+t.failed}`;return t.discriminating_evals===0?(0,S.jsxs)(S.Fragment,{children:[n,` · `,(0,S.jsx)(`span`,{className:`muted`,title:`No discriminating evals scored for this experiment`,children:`—`})]}):`${n} · ${t.discriminating_passed}/${t.discriminating_scored}`}function _t({experiment:e}){let t=e.aggregate;return t===void 0||t.attempts===0?`—`:`${t.cost_attempts>0&&t.cost_usd!==null?`${mt(t.cost_usd/t.cost_attempts)} · ${t.cost_attempts}/${t.attempts} reported`:`not reported (0/${t.attempts})`}${typeof t.estimated_cost_usd==`number`&&t.estimated_attempts?` · ${mt(t.estimated_cost_usd/t.estimated_attempts)} est.`:``}`}function vt({report:e,runId:t}){let n=Array.isArray(e.experiments)?e.experiments:[];if(n.length===0||n.some(e=>e.aggregate===void 0))return(0,S.jsxs)(`div`,{className:`notice`,"data-testid":`leaderboard-stale`,children:[`This report predates the leaderboard. Regenerate it with `,(0,S.jsxs)(`code`,{children:[`quickstudy report `,t]}),`.`]});let r=[...n].sort(dt);return(0,S.jsxs)(`div`,{className:`card`,"data-testid":`leaderboard`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(`h3`,{children:`Which experiment is best?`}),(0,S.jsx)(`span`,{className:`muted`,children:`sorted by pass rate on discriminating evals`})]}),(0,S.jsx)(`div`,{className:`body`,children:(0,S.jsxs)(`table`,{className:`data`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`Experiment`}),(0,S.jsx)(`th`,{children:`Pass rate (all · discriminating)`}),(0,S.jsx)(`th`,{children:`Agent time (median)`}),(0,S.jsx)(`th`,{children:`Tokens/run (in)`}),(0,S.jsx)(`th`,{children:`Cost/run`}),(0,S.jsx)(`th`,{children:`SDK recall`})]})}),(0,S.jsx)(`tbody`,{children:r.map(e=>{let t=e.aggregate,n=e.sdk_recall;return(0,S.jsxs)(`tr`,{"data-testid":`leaderboard-row-${e.experiment_id}`,children:[(0,S.jsxs)(`td`,{children:[Me(e.agent),(0,S.jsxs)(`span`,{className:`group-sub`,children:[(0,S.jsx)(`code`,{children:e.experiment_id}),e.treatment===null?``:` · ${e.treatment}`]})]}),(0,S.jsx)(`td`,{"data-testid":`leaderboard-pass`,children:(0,S.jsx)(gt,{experiment:e})}),(0,S.jsx)(`td`,{title:t?`median over ${t.agent_time_attempts} of ${t.completed} scored attempt(s)`:void 0,children:pt(t?.median_agent_ms??null)}),(0,S.jsx)(`td`,{title:t?`mean over ${t.token_attempts} attempt(s) that reported tokens`:void 0,children:ft(t?.mean_tokens_in??null)}),(0,S.jsx)(`td`,{"data-testid":`leaderboard-cost`,children:(0,S.jsx)(_t,{experiment:e})}),(0,S.jsx)(`td`,{children:n&&n.rate!==null?`${n.recalled}/${n.attempts}`:`n/a`})]},e.experiment_id)})})]})})]})}function yt(e){return e===null?{bg:`var(--gray-bg)`,fg:`var(--muted)`}:e>=.95?{bg:`#1a7f37`,fg:`#ffffff`}:e>=.9?{bg:`#7ecb8f`,fg:`#0f3d1e`}:e>=.8?{bg:`#ffdf80`,fg:`#5c3d00`}:e>=.5?{bg:`#ffb066`,fg:`#5c2800`}:e>0?{bg:`#f28b82`,fg:`#520f08`}:{bg:`#d93025`,fg:`#ffffff`}}function bt(e){return e===null?`—`:`${Math.round(e*100)}%`}function xt(){return(0,S.jsxs)(`div`,{className:`legend`,"aria-label":`Pass-rate color scale (fixed 0-100%)`,children:[(0,S.jsx)(`span`,{children:`0%`}),[0,.5,.8,.9,.95].map(e=>{let t=yt(e);return(0,S.jsx)(`span`,{className:`legend-sw`,style:{background:t.bg},title:`≥ ${Math.round(e*100)}%`},e)}),(0,S.jsx)(`span`,{children:`100%`}),(0,S.jsx)(`span`,{style:{marginLeft:8},children:`ticks: 80 / 90 / 95`})]})}function St(e){let t=[];for(let n of e){let e=n.group===null?`agent:${n.agentLabel??``}`:`group:${n.group}`,r=t.at(-1);r&&r.key===e?r.columns.push(n):t.push({key:e,group:n.group,columns:[n]})}return t.map(({group:e,columns:t})=>{let n=new Set(t.map(e=>e.agentLabel)),r=n.size===1?[...n][0]??null:null;return{label:r??e??``,sub:r!==null&&e!==null?e:null,title:r===null?null:t[0]?.agentTitle??null,span:t.length}})}function Ct({cells:e,rows:t,columns:n,onCellClick:r,band:i}){let a=new Map(e.map(e=>[`${e.evalId}|${e.experimentId}`,e])),o=n.some(e=>e.group!==null||e.agentLabel!==null);return(0,S.jsxs)(`div`,{className:`matrix-region`,children:[(0,S.jsx)(`div`,{className:`scroll-hint`,"aria-hidden":`true`,children:`Scroll horizontally to see every experiment →`}),(0,S.jsx)(`div`,{className:`matrix-scroll`,role:`region`,"aria-label":i===void 0?`Pass-rate matrix`:`Pass-rate matrix — ${i}`,tabIndex:0,children:(0,S.jsxs)(`table`,{className:`matrix`,children:[(0,S.jsxs)(`thead`,{children:[o&&(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{"aria-hidden":`true`}),St(n).map((e,t)=>(0,S.jsxs)(`th`,{colSpan:e.span,className:`matrix-group-head`,title:e.title??void 0,children:[e.label,e.sub!==null&&(0,S.jsx)(`span`,{className:`matrix-group-sub`,children:e.sub})]},`${e.label}-${t}`))]}),(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`eval`}),n.map(e=>(0,S.jsxs)(`th`,{children:[(0,S.jsx)(`code`,{children:e.experimentId}),e.treatment!==null&&(0,S.jsx)(`span`,{className:`matrix-row-feature`,children:e.treatment})]},e.experimentId))]})]}),(0,S.jsx)(`tbody`,{children:t.map(e=>(0,S.jsxs)(`tr`,{children:[(0,S.jsxs)(`th`,{children:[(0,S.jsx)(`code`,{children:e.evalId}),e.framework!==void 0&&(0,S.jsx)(`span`,{className:`matrix-row-feature`,children:e.framework})]}),n.map(t=>{let n=a.get(`${e.evalId}|${t.experimentId}`);if(!n)return(0,S.jsx)(`td`,{className:`cell`,style:{background:`var(--gray-bg)`,color:`var(--muted)`},children:(0,S.jsx)(`div`,{className:`cell-rate`,children:`—`})},t.experimentId);let i=yt(n.rate),o=`${n.evalId}, ${n.experimentId}: ${bt(n.rate)}, ${n.passed} of ${n.scored} scored passed${n.checks?`; ${n.checks.passed} of ${n.checks.total} checks passed`:``}${n.errors>0?`; ${n.errors} errored`:``}${n.flaky?`; flaky trials`:``}${n.incomplete?`; incomplete`:``}`;return(0,S.jsx)(`td`,{className:`cell`,style:{background:i.bg,color:i.fg},children:(0,S.jsxs)(`button`,{type:`button`,className:`cell-button`,"aria-label":o,"data-testid":`cell-${n.evalId}-${n.experimentId}`,"data-rate":n.rate===null?``:String(Math.round(n.rate*100)),"data-flaky":n.flaky?`true`:`false`,"data-incomplete":n.incomplete?`true`:`false`,onClick:()=>r(n),children:[n.flaky&&(0,S.jsx)(`span`,{className:`flaky-marker`,title:`flaky: trials disagreed`,"aria-hidden":`true`}),(0,S.jsx)(`span`,{className:`cell-rate`,children:bt(n.rate)}),(0,S.jsxs)(`span`,{className:`cell-sub`,children:[n.passed,`/`,n.scored,n.checks?` · ${n.checks.passed}/${n.checks.total} checks`:``,n.errors>0?` · ${n.errors} err`:``]}),n.incomplete&&(0,S.jsx)(`span`,{className:`incomplete-marker`,title:`incomplete: fewer attempts than planned`,"aria-hidden":`true`,children:`◌`})]})},t.experimentId)})]},e.evalId))})]})})]})}var wt=`all`,Tt=[`benchmark`,`regression`,`other`];function Et(e,t){return e.manifest.evals[t]?.metadata??{}}function Dt(e,t){for(let n of e.groups)if(n.experimentIds.includes(t))return n.group;return null}function Ot(e,t){return[...new Set(t.map(e=>e.experiment_id))].map(t=>({experimentId:t,treatment:e.manifest.experiments[t]?.components.treatment??null,group:Dt(e,t),agentLabel:Ne(e,t),agentTitle:Pe(e,t)})).sort((e,t)=>(e.group??`￿`).localeCompare(t.group??`￿`)||(e.treatment??``).localeCompare(t.treatment??``)||e.experimentId.localeCompare(t.experimentId))}function kt(e,t){let n=new Map;for(let t of e){let e=`${t.eval_id}|${t.experiment_id}`,r=n.get(e);r?r.push(t):n.set(e,[t])}let r=[];for(let e of n.values()){let n=e[0],i=e.filter(e=>e.status===`completed`),a=i.filter(e=>e.passed===!0).length,o=i.length,s=new Set(i.map(e=>e.passed===!0)),c=le(i.flatMap(e=>e.checks??[]));r.push({evalId:n.eval_id,experimentId:n.experiment_id,rate:o>0?a/o:null,passed:a,scored:o,flaky:s.size>1,incomplete:e.length<t||e.some(e=>e.status===`incomplete`),errors:e.filter(e=>e.status===`error`).length,checks:c.total>0?c:null})}return r}function At(e){if(e.started_at===null||e.finished_at===null)return`—`;let t=Math.round((Date.parse(e.finished_at)-Date.parse(e.started_at))/1e3);return`${Math.floor(t/60)}m${String(t%60).padStart(2,`0`)}s`}var jt={codex:{label:`thread turns`,title:`codex exec reports one thread turn per prompt, not per agent step — not comparable to Claude's turn count`}};function Mt(e){return e.status===`incomplete`&&e.error?.startsWith(`attempt timed out`)===!0}function Nt({attempt:e,runId:t,adapter:n}){let r=pe(e),i=n!==null&&jt[n]||{label:`turns`,title:`agent turns, as counted by the adapter`};return(0,S.jsxs)(`div`,{className:`attempt-row`,"data-testid":`drill-attempt`,children:[(0,S.jsxs)(`div`,{className:`attempt-line`,children:[(0,S.jsxs)(`span`,{className:`kpi-meta`,children:[`trial `,e.trial_index+1]}),(0,S.jsx)(D,{tone:me(r),children:r}),(0,S.jsx)(ge,{attempt:e}),(0,S.jsx)(`span`,{className:`spacer`}),e.transcript!==null&&(0,S.jsx)(`a`,{href:T.attempt(t,e.id,`transcript`),children:`transcript`}),e.diff!==null&&(0,S.jsx)(`a`,{href:T.attempt(t,e.id,`diff`),children:`diff`})]}),e.checks!==null&&e.checks.length>0&&(0,S.jsx)(`div`,{className:`attempt-line`,children:e.checks.map(e=>(0,S.jsxs)(`span`,{className:e.passed?`crit pass`:`crit fail`,title:e.notes??e.name,children:[e.passed?`✓`:`✗`,` `,e.name,!E(e)&&(0,S.jsx)(`span`,{className:`tag`,"data-testid":`ungraded-tag`,title:`Recorded, not graded: never enters pass/fail`,children:`recorded`})]},e.name))}),e.error!==null&&(0,S.jsx)(`div`,{className:`attempt-line`,children:(0,S.jsx)(`code`,{children:e.error})}),(0,S.jsxs)(`div`,{className:`telemetry`,children:[(0,S.jsxs)(`span`,{children:[`wall `,At(e)]}),(0,S.jsxs)(`span`,{children:[`tokens `,ft(e.tokens_in),` in / `,ft(e.tokens_out),` out`]}),(0,S.jsxs)(`span`,{children:[`cost `,e.cost_usd===null?`—`:`$${e.cost_usd.toFixed(2)}`]}),(0,S.jsxs)(`span`,{title:i.title,children:[i.label,` `,e.turns??`—`]})]}),(0,S.jsx)(Se,{treatment:e.treatment,usage:e.surface_usage})]})}function Pt({runId:e,run:t,cell:n,attempts:r}){let i=(0,l.useRef)(null),a=(0,l.useRef)(!1),o=(0,l.useId)(),s=r.filter(e=>e.eval_id===n.evalId&&e.experiment_id===n.experimentId).sort((e,t)=>e.trial_index-t.trial_index),c=t.manifest.experiments[n.experimentId]?.components.treatment??null,u=s.filter(e=>e.status===`completed`),d=u.filter(e=>e.passed===!0).length,f=`cell-${n.evalId}-${n.experimentId}`,p=(0,l.useCallback)(()=>{a.current=!0,se(T.matrix(e))},[e]);return(0,l.useEffect)(()=>{let e=i.current;if(!e)return;let t=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=()=>[...e.querySelectorAll(`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)].filter(e=>!e.hasAttribute(`hidden`));n()[0]?.focus();let r=t=>{if(t.key===`Escape`){t.preventDefault(),p();return}if(t.key!==`Tab`)return;let r=n();if(r.length===0){t.preventDefault(),e.focus();return}let i=r[0],a=r.at(-1);t.shiftKey&&document.activeElement===i?(t.preventDefault(),a.focus()):!t.shiftKey&&document.activeElement===a?(t.preventDefault(),i.focus()):e.contains(document.activeElement)||(t.preventDefault(),i.focus())};return document.addEventListener(`keydown`,r),()=>{if(document.removeEventListener(`keydown`,r),document.body.style.overflow=t,!a.current)return;let e=()=>{let e=[...document.querySelectorAll(`[data-testid]`)].find(e=>e.dataset.testid===f);return e?.focus(),e!==void 0};requestAnimationFrame(()=>{e()||window.setTimeout(e,0)})}},[p,f]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`drill-overlay`,"aria-hidden":`true`,onClick:p,onKeyDown:e=>e.preventDefault()}),(0,S.jsxs)(`aside`,{ref:i,className:`drill`,"data-testid":`drill-down`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":o,tabIndex:-1,children:[(0,S.jsx)(`button`,{type:`button`,className:`drill-close`,onClick:p,"data-testid":`drill-close`,children:`Close ✕`}),(0,S.jsxs)(`h2`,{id:o,children:[n.evalId,` · `,n.experimentId,c===null?``:` · ${c}`]}),(0,S.jsxs)(`p`,{className:`sub`,children:[s.length,` attempt(s) · `,d,`/`,u.length,` scored passed · `,bt(u.length>0?d/u.length:null)]}),s.length===0&&(0,S.jsx)(`div`,{className:`viewer-note`,children:`No attempts in this cell.`}),s.map(n=>(0,S.jsx)(Nt,{attempt:n,runId:e,adapter:t.manifest.experiments[n.experiment_id]?.components.agent?.adapter??null},n.id))]})]})}function Ft({id:e,label:t,values:n,value:r,onChange:i}){return n.length===0?null:(0,S.jsxs)(`div`,{className:`control`,children:[(0,S.jsx)(`label`,{htmlFor:e,children:t}),(0,S.jsxs)(`select`,{id:e,"data-testid":e,value:r,onChange:e=>i(e.currentTarget.value),children:[(0,S.jsx)(`option`,{value:wt,children:`all`}),n.map(e=>(0,S.jsx)(`option`,{value:e,children:e},e))]})]})}var It=e=>e===1?``:`s`;function Lt({meta:e,runId:t,cell:n}){let r=C(()=>_(t),[t]),i=C(()=>v(t).then(e=>e,()=>null),[t]),[a,o]=(0,l.useState)(`benchmark`),s=r.status===`ready`?Tt.filter(e=>r.value.attempts.some(t=>t.suite===e)):[],c=s.includes(a)?a:s[0]??`benchmark`,[u,d]=(0,l.useState)({product:wt,framework:wt,topic:wt});(0,l.useEffect)(()=>{d({product:wt,framework:wt,topic:wt})},[t]);let f=(0,l.useMemo)(()=>{if(r.status!==`ready`)return null;let e=r.value,t=e.attempts.filter(e=>e.suite===c).filter(t=>{let n=Et(e,t.eval_id);return!(u.product!==wt&&n.product!==u.product||u.framework!==wt&&n.framework!==u.framework||u.topic!==wt&&!(n.topics??[]).includes(u.topic))});return{rows:[...new Set(t.map(e=>e.eval_id))].sort((e,t)=>e.localeCompare(t)).map(t=>({evalId:t,...Et(e,t).framework===void 0?{}:{framework:Et(e,t).framework}})),columns:Ot(e,t),cells:kt(t,e.run.trials),attempts:t}},[r,c,u]);if(r.status===`error`)return(0,S.jsx)(ee,{error:r.error});if(r.status===`loading`||i.status===`loading`||f===null)return(0,S.jsx)(`div`,{className:`loading`,children:`Loading run…`});let p=r.value,m=p.run,h=Tt.filter(e=>p.attempts.some(t=>t.suite===e)),g=[...new Set(p.attempts.map(e=>Et(p,e.eval_id).product).filter(e=>e!==void 0))].sort(),y=[...new Set(p.attempts.map(e=>Et(p,e.eval_id).framework).filter(e=>e!==void 0))].sort(),b=[...new Set(p.attempts.flatMap(e=>Et(p,e.eval_id).topics??[]))].sort(),x={attempts:p.attempts.length,passed:p.attempts.filter(e=>e.status===`completed`&&e.passed===!0).length,failed:p.attempts.filter(e=>e.status===`completed`&&e.passed!==!0).length,incomplete:p.attempts.filter(e=>e.status===`incomplete`).length,timedOut:p.attempts.filter(e=>e.status===`completed`&&e.limit===`timeout`||Mt(e)).length,unscoredTimedOut:p.attempts.filter(Mt).length,errors:p.attempts.filter(e=>e.status===`error`).length},te=x.passed+x.failed,ne=i.status===`ready`?i.value:null,w=Array.isArray(ne?.pairs)?ne.pairs:[],re=w.some(e=>e.band!==void 0),ie=new Map(w.map(e=>[e.eval_id,e.band??null])),ae=e=>f.rows.filter(t=>(ie.get(t.evalId)??null)===e),oe=f.rows.filter(e=>{let t=ie.get(e.evalId)??null;return t===null||t===`discriminating`}),ce=ae(null).length,E=ae(`solved-by-all`),le=ae(`failed-by-all`),ue=ne?.scorer_health?.suspects??[],de=e=>se(T.cell(t,{evalId:e.evalId,experimentId:e.experimentId})),fe=e=>{o(e),n&&se(T.matrix(t))},pe=e=>r=>{d(t=>({...t,[e]:r})),n&&se(T.matrix(t))};return(0,S.jsxs)(`div`,{"data-testid":`matrix-view`,children:[(0,S.jsx)(ut,{coverage:p.publication}),(0,S.jsxs)(`div`,{className:`page-head`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{children:`Eval × experiment matrix`}),(0,S.jsx)(`p`,{className:`sub`,children:`Pass rate over scored attempts per cell; experiment columns are the treatment arms, grouped by comparison group. Select a cell for attempt evidence.`})]}),(0,S.jsxs)(`div`,{className:`controls`,children:[(0,S.jsxs)(`div`,{className:`control`,children:[(0,S.jsx)(`label`,{htmlFor:`run-select`,children:`Run`}),(0,S.jsx)(`select`,{id:`run-select`,"data-testid":`run-select`,value:t,onChange:e=>se(T.matrix(e.currentTarget.value)),children:e.runs.map(e=>(0,S.jsxs)(`option`,{value:e.id,children:[e.id.slice(0,10),`… · `,e.started_at.slice(0,10),` · `,e.attempts,` attempts`]},e.id))})]}),(0,S.jsx)(Ft,{id:`filter-product`,label:`Product`,values:g,value:u.product,onChange:pe(`product`)}),(0,S.jsx)(Ft,{id:`filter-framework`,label:`Framework`,values:y,value:u.framework,onChange:pe(`framework`)}),(0,S.jsx)(Ft,{id:`filter-topic`,label:`Topic`,values:b,value:u.topic,onChange:pe(`topic`)}),h.length>1&&(0,S.jsxs)(`div`,{className:`control`,children:[(0,S.jsx)(`label`,{children:`Suite`}),(0,S.jsx)(`div`,{className:`seg`,role:`group`,"aria-label":`Suite`,children:h.map(e=>(0,S.jsx)(`button`,{type:`button`,className:c===e?`active`:``,"aria-pressed":c===e,"data-testid":`suite-${e}`,onClick:()=>fe(e),children:e},e))})]})]})]}),(m.finished_at===null||m.incomplete)&&(0,S.jsxs)(`div`,{className:`notice`,"data-testid":`incomplete-banner`,children:[`Incomplete run — `,ht({unfinished:m.finished_at===null,incomplete:x.incomplete,errors:x.errors,timedOut:x.unscoredTimedOut}),`. Numbers are partial.`]}),(0,S.jsxs)(`div`,{className:`kpi-row`,children:[(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsxs)(`div`,{className:`kpi-label`,children:[`Overall pass rate`,h.length>1?` (all suites)`:``]}),(0,S.jsx)(`div`,{className:`kpi-val`,children:te===0?`—`:`${Math.round(x.passed/te*100)}%`}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[(0,S.jsxs)(D,{tone:`green`,children:[x.passed,` passed`]}),` `,(0,S.jsxs)(D,{tone:`red`,children:[x.failed,` failed`]}),` `,(0,S.jsxs)(D,{tone:`gray`,children:[x.incomplete,` incomplete`]}),` `,(0,S.jsxs)(D,{tone:`amber`,children:[x.errors,` errored`]}),x.timedOut>0&&(0,S.jsxs)(S.Fragment,{children:[` `,(0,S.jsxs)(D,{tone:`gray`,children:[x.timedOut,` timed out`]})]})]})]}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Evals × experiments`}),(0,S.jsxs)(`div`,{className:`kpi-val`,children:[m.eval_ids.length,` × `,m.experiment_ids.length]}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[m.attempts,` attempts`]})]}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Trials per pair`}),(0,S.jsx)(`div`,{className:`kpi-val`,children:m.trials}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[`manifest `,m.manifest_hash.slice(0,10),`…`]})]})]}),ne!==null&&(0,S.jsx)(vt,{report:ne,runId:t}),(0,S.jsxs)(`div`,{className:`card`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsxs)(`h3`,{children:[`Pass rate per eval × experiment`,c===`regression`&&(0,S.jsxs)(S.Fragment,{children:[` `,(0,S.jsx)(D,{tone:`amber`,title:`Known failure modes — tracked separately from benchmark results.`,children:`regression suite`})]})]}),(0,S.jsx)(xt,{})]}),ue.length>0&&ne?.scorer_health&&(0,S.jsxs)(`div`,{className:`notice band-notice`,"data-testid":`scorer-health-banner`,children:[ne.scorer_health.summary,(0,S.jsx)(`ul`,{children:ue.map(e=>(0,S.jsxs)(`li`,{children:[(0,S.jsx)(`code`,{children:e.eval_id}),` · `,(0,S.jsx)(`code`,{children:e.check}),` failed in `,e.attempts,` attempts under`,` `,e.experiments.length,` arms · passing: `,e.passing_checks.join(`, `)]},`${e.eval_id}|${e.check}`))})]}),re?(0,S.jsxs)(S.Fragment,{children:[oe.length>0&&(0,S.jsxs)(`section`,{className:`band`,"data-testid":`matrix-band-discriminating`,children:[(0,S.jsxs)(`h4`,{children:[`Discriminating (`,oe.length,` eval`,It(oe.length),`) — arms disagree`,ce>0&&` (${ce} eval${It(ce)} with one scored arm)`]}),(0,S.jsx)(Ct,{cells:f.cells,rows:oe,columns:f.columns,onCellClick:de,band:`discriminating`})]}),E.length>0&&(0,S.jsxs)(`details`,{className:`band`,"data-testid":`matrix-band-solved`,children:[(0,S.jsxs)(`summary`,{children:[`Solved by every arm (`,E.length,` eval`,It(E.length),`)`]}),(0,S.jsx)(Ct,{cells:f.cells,rows:E,columns:f.columns,onCellClick:de,band:`solved by every arm`})]}),le.length>0&&(0,S.jsxs)(`details`,{className:`band`,"data-testid":`matrix-band-failed`,children:[(0,S.jsxs)(`summary`,{children:[`Failed by every arm (`,le.length,` eval`,It(le.length),`) — suspect the eval`]}),(0,S.jsx)(Ct,{cells:f.cells,rows:le,columns:f.columns,onCellClick:de,band:`failed by every arm`})]})]}):(0,S.jsx)(Ct,{cells:f.cells,rows:f.rows,columns:f.columns,onCellClick:de})]}),n&&(0,S.jsx)(Pt,{runId:t,run:p,cell:n,attempts:p.attempts})]})}var Rt=[2,3,5,10];function zt(e){return(e??[]).filter(e=>Rt.includes(e.k))}function Bt({estimate:e}){return e===void 0?null:(0,S.jsxs)(`div`,{className:`kpi`,"data-testid":`cost-estimate`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Estimated token cost`}),(0,S.jsx)(`div`,{className:`kpi-val`,children:e.cost_usd===null?`—`:e.cost_usd>0&&e.cost_usd<.01?`<$0.01`:`$${e.cost_usd.toFixed(2)}`}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[`In addition to reported cost · `,e.cost_attempts,` estimated, `,e.unpriced_attempts,` unpriced attempt(s)`]}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[`Pricing: `,e.pricing.version,`. Excludes tool fees, diagnosis, infrastructure and superseded retries.`]})]})}function Vt(e){return e===null?`—`:`${Math.round(e*100)}%`}function Ht({pair:e}){let t=zt(e.pass_at_k);return t.length===0?(0,S.jsx)(S.Fragment,{children:`—`}):(0,S.jsx)(`div`,{children:t.map(e=>(0,S.jsxs)(`div`,{children:[`k=`,e.k,`: `,Vt(e.pass_at_k),` / `,Vt(e.pass_to_the_k)]},e.k))})}function Ut({pair:e}){return e.checks.length===0?(0,S.jsx)(`span`,{className:`attribution-reason`,children:`no named checks recorded`}):(0,S.jsx)(`div`,{className:`attribution-effects`,children:e.checks.map(e=>(0,S.jsxs)(`span`,{className:e.passed===e.total?`crit pass`:`crit fail`,title:e.name,children:[e.passed===e.total?`✓`:`✗`,` `,e.name,` (`,e.passed,`/`,e.total,`)`,!E(e)&&(0,S.jsx)(`span`,{className:`tag`,"data-testid":`ungraded-tag`,title:`Recorded, not graded: never enters pass/fail`,children:`recorded`})]},e.name))})}function Wt({group:e,labelOf:t}){let n=new Set(e.experiment_ids.map(t)),r=n.size===1?[...n][0]??null:null;return r===null?(0,S.jsx)(`h3`,{children:e.group}):(0,S.jsxs)(`h3`,{children:[r,` `,(0,S.jsx)(`span`,{className:`group-sub`,children:e.group})]})}function Gt({group:e,labelOf:t}){if(e.comparison===`withheld`)return(0,S.jsxs)(`div`,{className:`card`,"data-testid":`report-group-${e.group}`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(Wt,{group:e,labelOf:t}),(0,S.jsx)(D,{tone:`amber`,children:`comparison withheld`})]}),(0,S.jsxs)(`div`,{className:`body`,children:[(0,S.jsx)(`p`,{className:`viewer-note`,children:`Members differ beyond their declared treatment — the differing components:`}),(0,S.jsx)(`ul`,{children:e.details.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsx)(`code`,{children:e})},e))})]})]});let n=[...new Set(e.arms.flatMap(e=>e.evals.map(e=>e.eval_id)))].sort();return(0,S.jsxs)(`div`,{className:`card`,"data-testid":`report-group-${e.group}`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(Wt,{group:e,labelOf:t}),(0,S.jsx)(D,{tone:`green`,children:`compared — raw counts`})]}),(0,S.jsx)(`div`,{className:`body`,children:(0,S.jsxs)(`table`,{className:`data`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`eval`}),e.arms.map(e=>(0,S.jsxs)(`th`,{children:[(0,S.jsx)(`code`,{children:e.experiment_id}),e.treatment!==null&&(0,S.jsx)(`div`,{className:`attribution-reason`,children:e.treatment})]},e.experiment_id))]})}),(0,S.jsx)(`tbody`,{children:n.map(t=>(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`td`,{children:(0,S.jsx)(`code`,{children:t})}),e.arms.map(e=>{let n=e.evals.find(e=>e.eval_id===t);return(0,S.jsx)(`td`,{children:n===void 0?`—`:n.display},e.experiment_id)})]},t))})]})})]})}function Kt({meta:e,runId:t}){let n=C(()=>v(t),[t]);if(n.status===`error`)return(0,S.jsx)(ee,{error:n.error});if(n.status===`loading`)return(0,S.jsx)(`div`,{className:`loading`,children:`Loading report…`});let r=n.value,i=r.totals.passed+r.totals.failed,a=new Map((r.experiments??[]).map(e=>[e.experiment_id,je(e.agent.model,e.agent.reasoning)])),o=e=>a.get(e)??null,s=r.run.trials>1;return(0,S.jsxs)(`div`,{"data-testid":`report-view`,children:[(0,S.jsx)(ut,{coverage:n.value.publication}),(0,S.jsxs)(`div`,{className:`page-head`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{children:`Run report`}),(0,S.jsxs)(`p`,{className:`sub`,children:[r.run.eval_ids.length,` evals × `,r.run.experiment_ids.length,` experiments · `,r.run.trials,` `,`trials/pair · started `,r.run.started_at.slice(0,10)]})]}),(0,S.jsxs)(`div`,{className:`control`,children:[(0,S.jsx)(`label`,{htmlFor:`report-run`,children:`Run`}),(0,S.jsx)(`select`,{id:`report-run`,"data-testid":`report-run-select`,value:t,onChange:e=>se(T.report(e.currentTarget.value)),children:e.runs.map(e=>(0,S.jsxs)(`option`,{value:e.id,children:[e.id.slice(0,10),`… · `,e.started_at.slice(0,10)]},e.id))})]})]}),r.incomplete&&(0,S.jsxs)(`div`,{className:`notice`,"data-testid":`incomplete-banner`,children:[`⚠️ INCOMPLETE RUN — `,ht({unfinished:r.run.finished_at===null,...r.totals}),`. Numbers below are partial and NOT comparable to a full sweep.`]}),(0,S.jsxs)(`div`,{className:`kpi-row`,children:[(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Attempts`}),(0,S.jsx)(`div`,{className:`kpi-val`,children:r.totals.attempts}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[(0,S.jsxs)(D,{tone:`green`,children:[r.totals.passed,` passed`]}),` `,(0,S.jsxs)(D,{tone:`red`,children:[r.totals.failed,` failed`]}),` `,(0,S.jsxs)(D,{tone:`gray`,children:[r.totals.incomplete,` incomplete`]}),` `,(0,S.jsxs)(D,{tone:`amber`,children:[r.totals.errors,` errored`]})]})]}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Overall pass rate`}),(0,S.jsx)(`div`,{className:`kpi-val`,children:i===0?`—`:`${Math.round(r.totals.passed/i*100)}%`}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[i,` scored attempt(s)`]})]}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Reported cost`}),(0,S.jsx)(`div`,{className:`kpi-val`,children:r.telemetry.cost_usd===null?`—`:`$${r.telemetry.cost_usd.toFixed(2)}`}),(0,S.jsx)(`div`,{className:`kpi-meta`,children:r.telemetry.cost_usd===null?`unavailable`:`${r.telemetry.cost_attempts} of ${r.totals.attempts} attempts reported a cost`+(r.totals.attempts>r.telemetry.cost_attempts?` · ${r.totals.attempts-r.telemetry.cost_attempts} unpriced, so this understates the spend`:``)})]}),(0,S.jsx)(Bt,{estimate:r.cost_estimate}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Tokens`}),(0,S.jsx)(`div`,{className:`kpi-val`,style:{fontSize:15},children:r.telemetry.tokens_in===null&&r.telemetry.tokens_out===null?`unavailable`:`${ft(r.telemetry.tokens_in)} in / ${ft(r.telemetry.tokens_out)} out`}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[`from `,r.telemetry.token_attempts,` of `,r.totals.attempts,` attempts`]})]})]}),(0,S.jsxs)(`div`,{className:`card`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(`h3`,{children:`Pass rates per eval × experiment`}),(0,S.jsx)(`span`,{className:`kpi-meta`,children:`scored = passed + failed; incomplete and errored attempts never enter the denominator`})]}),(0,S.jsx)(`div`,{className:`body`,children:(0,S.jsxs)(`table`,{className:`data`,"data-testid":`pairs-table`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`eval`}),(0,S.jsx)(`th`,{children:`experiment`}),(0,S.jsx)(`th`,{children:`pass rate`}),(0,S.jsx)(`th`,{children:`raw`}),s&&(0,S.jsx)(`th`,{title:`pass@k: fraction of size-k subsets of the scored trials with ≥1 pass; pass^k: (passed/scored)^k`,children:`pass@k / pass^k`}),(0,S.jsx)(`th`,{children:`notes`}),(0,S.jsx)(`th`,{children:`checks`})]})}),(0,S.jsx)(`tbody`,{children:r.pairs.map(e=>(0,S.jsxs)(`tr`,{children:[(0,S.jsxs)(`td`,{children:[(0,S.jsx)(`code`,{children:e.eval_id}),e.suite!==`benchmark`&&(0,S.jsx)(`div`,{className:`attribution-reason`,children:e.suite})]}),(0,S.jsxs)(`td`,{children:[(0,S.jsx)(`code`,{children:e.experiment_id}),o(e.experiment_id)!==null&&(0,S.jsx)(`div`,{className:`attribution-reason`,children:o(e.experiment_id)})]}),(0,S.jsx)(`td`,{children:(0,S.jsx)(`strong`,{children:Vt(e.pass_rate)})}),(0,S.jsxs)(`td`,{children:[e.passed,`/`,e.scored]}),s&&(0,S.jsx)(`td`,{children:(0,S.jsx)(Ht,{pair:e})}),(0,S.jsx)(`td`,{children:[e.incomplete>0?`${e.incomplete} incomplete`:``,e.errors>0?`${e.errors} errored`:``,e.flaky?`trials disagreed`:``].filter(Boolean).join(`; `)||`—`}),(0,S.jsx)(`td`,{children:(0,S.jsx)(Ut,{pair:e})})]},`${e.eval_id}|${e.experiment_id}`))})]})})]}),r.groups.length>0&&(0,S.jsxs)(`section`,{"data-testid":`report-groups`,children:[(0,S.jsx)(`h2`,{children:`Comparison groups`}),r.groups.map(e=>(0,S.jsx)(Gt,{group:e,labelOf:o},e.group))]}),(r.experiments??[]).length>0&&(0,S.jsxs)(`div`,{className:`card`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(`h3`,{children:`SDK recall`}),(0,S.jsx)(`span`,{className:`kpi-meta`,children:`scored attempts whose ungraded checks all passed`})]}),(0,S.jsx)(`div`,{className:`body`,"data-testid":`sdk-recall`,children:(r.experiments??[]).map(e=>{let t=e.sdk_recall;return(0,S.jsx)(`div`,{className:`attribution-arm`,children:(0,S.jsxs)(`div`,{className:`attribution-arm-head`,children:[(0,S.jsx)(`strong`,{children:(0,S.jsx)(`code`,{children:e.experiment_id})}),e.treatment!==null&&(0,S.jsx)(D,{tone:`blue`,children:e.treatment}),(0,S.jsxs)(`span`,{children:[`SDK recall `,t&&t.rate!==null?`${t.recalled}/${t.attempts}`:`n/a`]})]})},e.experiment_id)})})]}),r.usage.length>0&&(0,S.jsxs)(`div`,{className:`card`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(`h3`,{children:`Surface usage (offered vs observed)`}),(0,S.jsx)(`span`,{className:`kpi-meta`,children:`null telemetry counts as unavailable, never as zero use`})]}),(0,S.jsx)(`div`,{className:`body`,"data-testid":`usage-summary`,children:r.usage.map(e=>(0,S.jsxs)(`div`,{className:`attribution-arm`,children:[(0,S.jsxs)(`div`,{className:`attribution-arm-head`,children:[(0,S.jsx)(`strong`,{children:(0,S.jsx)(`code`,{children:e.experiment_id})}),e.treatment!==null&&(0,S.jsxs)(D,{tone:`blue`,children:[`offered: `,e.treatment]})]}),(0,S.jsx)(O,{usage:e})]},e.experiment_id))})]}),r.egress_denials.length>0&&(0,S.jsxs)(`div`,{className:`card`,children:[(0,S.jsx)(`div`,{className:`head`,children:(0,S.jsx)(`h3`,{children:`Egress denials (proxied run)`})}),(0,S.jsx)(`div`,{className:`body`,children:(0,S.jsxs)(`table`,{className:`data`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`attempt`}),(0,S.jsx)(`th`,{children:`eval`}),(0,S.jsx)(`th`,{children:`experiment`}),(0,S.jsx)(`th`,{children:`denials`}),(0,S.jsx)(`th`,{children:`top hosts`})]})}),(0,S.jsx)(`tbody`,{children:r.egress_denials.map(e=>(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`td`,{children:(0,S.jsxs)(`code`,{children:[e.attempt_id.slice(0,8),`…`]})}),(0,S.jsx)(`td`,{children:e.eval_id}),(0,S.jsx)(`td`,{children:e.experiment_id}),(0,S.jsx)(`td`,{children:e.count}),(0,S.jsx)(`td`,{children:e.top_hosts.map(({host:e,count:t})=>`${e} (${t})`).join(`, `)})]},e.attempt_id))})]})})]}),(0,S.jsxs)(`div`,{className:`methodology`,"data-testid":`methodology`,children:[(0,S.jsx)(`strong`,{children:`Methodology`}),`: `,r.methodology]})]})}function qt(){return(0,S.jsxs)(`div`,{className:`empty-state`,"data-testid":`empty-state`,children:[(0,S.jsx)(`h2`,{children:`No runs in this data directory yet`}),(0,S.jsx)(`p`,{children:`Execute a sweep, then re-export (or restart) the UI:`}),(0,S.jsx)(`pre`,{children:(0,S.jsxs)(`code`,{children:[`quickstudy run --eval my-eval --experiment my-experiment`,`
27
+ `)}function tt(e){return e===`high`?`green`:e===`medium`?`amber`:`gray`}function nt(e,t){return T.attempt(e,t.attempt_id,t.artifact,t.lines)}function rt(e){return t=>new URL(nt(e,t),window.location.href).href}function it({runId:e,evidence:t}){return(0,S.jsxs)(`a`,{className:`evidence-chip`,"data-testid":`evidence-link`,href:nt(e,t),children:[t.artifact,` L`,t.lines[0],`–`,t.lines[1]]})}function at({runId:e,finding:t}){return(0,S.jsxs)(`div`,{className:`card`,"data-testid":`diagnosis-finding`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(`h3`,{children:t.claim}),(0,S.jsxs)(`span`,{className:`head-actions`,children:[(0,S.jsxs)(D,{tone:tt(t.confidence),children:[t.confidence,` confidence`]}),(0,S.jsx)(qe,{testId:`copy-finding`,text:()=>$e(t,rt(e))})]})]}),(0,S.jsxs)(`div`,{className:`body`,children:[(0,S.jsxs)(`div`,{className:`attribution-reason`,children:[(0,S.jsx)(`code`,{children:t.eval_id}),` × `,(0,S.jsx)(`code`,{children:t.experiment_id})]}),(0,S.jsx)(`p`,{children:t.suggested_change}),(0,S.jsx)(`div`,{className:`evidence-row`,children:t.evidence.map((t,n)=>(0,S.jsx)(it,{runId:e,evidence:t},`${t.attempt_id}-${t.artifact}-${n}`))})]})]})}var ot=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function st(e){let t=ot(e.findings.length,`finding`);return e.failingChecks.length===0?`${e.evalId} · ${t}`:`${e.evalId} · ${e.failingChecks.join(`, `)} failed under ${ot(e.experiments.length,`arm`)} · ${t}`}function ct({runId:e,diagnosis:t,pairs:n}){let[r,i]=(0,l.useState)(null);if(t.schema_version!==1)return(0,S.jsxs)(`div`,{className:`error-banner`,"data-testid":`diagnosis-schema-banner`,role:`alert`,children:[(0,S.jsx)(`strong`,{children:`Diagnosis schema mismatch.`}),` This diagnosis.json is schema_version`,` `,String(t.schema_version),` but this UI build expects `,1,` — regenerate it with the matching quickstudy version (`,(0,S.jsxs)(`code`,{children:[`quickstudy diagnose `,e]}),`).`]});let a=new Map;for(let e of t.findings){let t=a.get(e.target);t?t.push(e):a.set(e.target,[e])}let o=Qe(t.findings),s=Ze(t.findings,n);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`notice`,"data-testid":`diagnosis-disclaimer`,children:t.disclaimer}),(0,S.jsxs)(`div`,{className:`kpi-row`,"data-testid":`diagnosis-provenance`,children:[(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Model`}),(0,S.jsx)(`div`,{className:`kpi-val`,style:{fontSize:15},children:t.model.requested}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[`resolved: `,t.model.resolved??`unavailable`]})]}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Pairs diagnosed`}),(0,S.jsx)(`div`,{className:`kpi-val`,children:t.pairs_diagnosed}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[t.pairs_skipped,` skipped`]})]}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Findings`}),(0,S.jsx)(`div`,{className:`kpi-val`,children:t.findings.length}),(0,S.jsx)(`div`,{className:`kpi-meta`,children:t.errors.length>0?`${t.errors.length} pair(s) not analyzed`:`all selected pairs analyzed`})]}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Provenance`}),(0,S.jsx)(`div`,{className:`kpi-val`,style:{fontSize:15},children:t.generated_at.slice(0,10)}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[`run `,(0,S.jsxs)(`code`,{children:[t.run_id.slice(0,10),`…`]}),` · prompt v`,t.prompt_version]})]})]}),t.findings.length===0&&(0,S.jsxs)(`div`,{className:`empty-state`,"data-testid":`diagnosis-no-findings`,children:[(0,S.jsx)(`h2`,{children:`Diagnosis ran; no findings.`}),(0,S.jsx)(`p`,{children:`The analyst drafted no hypotheses for this run's diagnosable pairs.`})]}),t.findings.length>0&&(0,S.jsx)(`div`,{className:`toolbar`,style:{justifyContent:`flex-start`},children:(0,S.jsxs)(`div`,{className:`seg`,role:`group`,"aria-label":`Finding target`,"data-testid":`diagnosis-target-filter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:r===null?`active`:``,"aria-pressed":r===null,onClick:()=>i(null),children:[`all (`,t.findings.length,`)`]}),o.filter(e=>a.has(e)).map(e=>(0,S.jsxs)(`button`,{type:`button`,className:r===e?`active`:``,"aria-pressed":r===e,onClick:()=>i(e),children:[e,` (`,a.get(e)?.length,`)`]},e))]})}),s.map(t=>{let n=o.filter(e=>(r===null||r===e)&&t.findings.some(t=>t.target===e));return n.length===0?null:(0,S.jsxs)(`section`,{className:`cluster`,"data-testid":`diagnosis-cluster`,children:[(0,S.jsx)(`h2`,{children:st(t)}),n.map(n=>(0,S.jsxs)(`section`,{"data-testid":`diagnosis-target-${n}`,children:[(0,S.jsxs)(`h3`,{children:[(0,S.jsx)(`code`,{children:n}),` findings`]}),t.findings.filter(e=>e.target===n).map((t,n)=>(0,S.jsx)(at,{runId:e,finding:t},`${t.eval_id}|${t.experiment_id}|${n}`))]},n))]},`${t.evalId}|${t.failingChecks.join(`,`)}`)}),t.errors.length>0&&(0,S.jsxs)(`div`,{className:`card`,"data-testid":`diagnosis-errors`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(`h3`,{children:`Pairs that could not be analyzed`}),(0,S.jsx)(`span`,{className:`kpi-meta`,children:`model failures are recorded, never silently dropped`})]}),(0,S.jsx)(`div`,{className:`body`,children:(0,S.jsxs)(`table`,{className:`data`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`eval`}),(0,S.jsx)(`th`,{children:`experiment`}),(0,S.jsx)(`th`,{children:`error`})]})}),(0,S.jsx)(`tbody`,{children:t.errors.map(e=>(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`td`,{children:(0,S.jsx)(`code`,{children:e.eval_id})}),(0,S.jsx)(`td`,{children:(0,S.jsx)(`code`,{children:e.experiment_id})}),(0,S.jsx)(`td`,{children:e.error})]},`${e.eval_id}|${e.experiment_id}`))})]})})]})]})}function lt({meta:e,runId:t}){let n=C(()=>y(t),[t]),r=C(()=>v(t).then(e=>e.pairs??null,()=>null),[t]);if(n.status===`error`)return(0,S.jsx)(ee,{error:n.error});if(n.status===`loading`||r.status===`loading`)return(0,S.jsx)(`div`,{className:`loading`,children:`Loading diagnosis…`});let i=r.status===`ready`?r.value:null,a=n.value;return(0,S.jsxs)(`div`,{"data-testid":`diagnosis-view`,children:[(0,S.jsxs)(`div`,{className:`page-head`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{children:`Run diagnosis`}),(0,S.jsx)(`p`,{className:`sub`,children:`Model-drafted hypotheses with harness-selected evidence — verify cited lines before acting.`})]}),(0,S.jsxs)(`div`,{className:`control`,children:[(0,S.jsx)(`label`,{htmlFor:`diagnosis-run`,children:`Run`}),(0,S.jsx)(`select`,{id:`diagnosis-run`,"data-testid":`diagnosis-run-select`,value:t,onChange:e=>se(T.diagnosis(e.currentTarget.value)),children:e.runs.map(e=>(0,S.jsxs)(`option`,{value:e.id,children:[e.id.slice(0,10),`… · `,e.started_at.slice(0,10)]},e.id))})]})]}),a!==null&&a.schema_version===1&&(0,S.jsx)(`div`,{className:`toolbar`,"data-testid":`diagnosis-toolbar`,children:(0,S.jsx)(qe,{testId:`copy-diagnosis`,label:`Copy all findings as Markdown`,text:()=>et(a,rt(t))})}),a===null?(0,S.jsxs)(`div`,{className:`empty-state`,"data-testid":`diagnosis-empty`,children:[(0,S.jsx)(`h2`,{children:`No diagnosis for this run`}),(0,S.jsx)(`p`,{children:`Generate one (requires a model API key — never done at export time), then re-export:`}),(0,S.jsx)(`pre`,{children:(0,S.jsxs)(`code`,{children:[`quickstudy diagnose `,t]})})]}):(0,S.jsx)(ct,{runId:t,diagnosis:a,pairs:i})]})}function ut({coverage:e}){return e?(0,S.jsxs)(`details`,{"data-testid":`publication-omissions`,open:e.omitted.length>0,children:[(0,S.jsxs)(`summary`,{children:[`Complete-sample publication: `,e.eligible.length,` pairs included, `,e.omitted.length,` omitted;`,` `,e.expected_trials,` trials required.`]}),(0,S.jsx)(`p`,{children:`These counts cover the included pairs. Source attempts and retry history remain available in the diagnostic artifacts.`}),e.omitted.map(e=>(0,S.jsxs)(`p`,{children:[e.eval_id,` × `,e.experiment_id,`: `,e.reasons.join(`; `)]},`${e.eval_id}:${e.experiment_id}`))]}):null}function dt(e,t){let n=e=>e??-1,r=e=>(e.role??`agent`)===`agent`?0:1;return r(e)-r(t)||n(t.aggregate?.pass_rate_discriminating)-n(e.aggregate?.pass_rate_discriminating)||n(t.aggregate?.pass_rate_all)-n(e.aggregate?.pass_rate_all)||e.experiment_id.localeCompare(t.experiment_id)}function ft(e){if(e===null)return`—`;let t=e=>e.toFixed(1).replace(/\.0$/,``);return e>=1e6?`${t(e/1e6)}M`:e>=1e3?`${t(e/1e3)}k`:String(Math.round(e))}function pt(e){if(e===null)return`—`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function mt(e){return e===null?`—`:e>0&&e<.005?`<$0.01`:`$${e.toFixed(2)}`}function ht(e){let t=e.timedOut??0,n=e.incomplete-t,r=(e,t)=>`${e} ${t}${e===1?``:`s`}`,i=[e.unfinished?`the run never finished`:``,t>0?`${r(t,`attempt`)} timed out`:``,n>0?`${r(n,`attempt`)} incomplete`:``,e.errors>0?`${r(e.errors,`attempt`)} errored`:``].filter(Boolean);return i.length>0?i.join(`; `):`missing trial coverage`}function gt({experiment:e}){let t=e.aggregate;if(t===void 0||t.pass_rate_all===null)return`—`;let n=`${t.passed}/${t.passed+t.failed}`;return t.discriminating_evals===0?(0,S.jsxs)(S.Fragment,{children:[n,` · `,(0,S.jsx)(`span`,{className:`muted`,title:`No discriminating evals scored for this experiment`,children:`—`})]}):`${n} · ${t.discriminating_passed}/${t.discriminating_scored}`}function _t({experiment:e}){let t=e.aggregate;return t===void 0||t.attempts===0?`—`:`${t.cost_attempts>0&&t.cost_usd!==null?`${mt(t.cost_usd/t.cost_attempts)} · ${t.cost_attempts}/${t.attempts} reported`:`not reported (0/${t.attempts})`}${typeof t.estimated_cost_usd==`number`&&t.estimated_attempts?` · ${mt(t.estimated_cost_usd/t.estimated_attempts)} est.`:``}`}function vt({report:e,runId:t}){let n=Array.isArray(e.experiments)?e.experiments:[];if(n.length===0||n.some(e=>e.aggregate===void 0))return(0,S.jsxs)(`div`,{className:`notice`,"data-testid":`leaderboard-stale`,children:[`This report predates the leaderboard. Regenerate it with `,(0,S.jsxs)(`code`,{children:[`quickstudy report `,t]}),`.`]});let r=[...n].sort(dt);return(0,S.jsxs)(`div`,{className:`card`,"data-testid":`leaderboard`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(`h3`,{children:`Which experiment is best?`}),(0,S.jsx)(`span`,{className:`muted`,children:`sorted by pass rate on discriminating evals; controls last`})]}),(0,S.jsx)(`div`,{className:`body`,children:(0,S.jsxs)(`table`,{className:`data`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`Experiment`}),(0,S.jsx)(`th`,{children:`Pass rate (all · discriminating)`}),(0,S.jsx)(`th`,{children:`Agent time (median)`}),(0,S.jsx)(`th`,{children:`Tokens/run (in)`}),(0,S.jsx)(`th`,{children:`Cost/run`}),(0,S.jsx)(`th`,{children:`SDK recall`})]})}),(0,S.jsx)(`tbody`,{children:r.map(e=>{let t=e.aggregate,n=e.sdk_recall;return(0,S.jsxs)(`tr`,{"data-testid":`leaderboard-row-${e.experiment_id}`,children:[(0,S.jsxs)(`td`,{children:[Me(e.agent),(0,S.jsxs)(`span`,{className:`group-sub`,children:[(0,S.jsx)(`code`,{children:e.experiment_id}),e.treatment===null?``:` · ${e.treatment}`]}),(e.role??`agent`)!==`agent`&&(0,S.jsx)(`span`,{className:`tag`,"data-testid":`leaderboard-control`,title:`A control checks the instrument; it is not an arm and never decides a band.`,children:e.role===`positive-control`?`positive control`:`negative control`})]}),(0,S.jsx)(`td`,{"data-testid":`leaderboard-pass`,children:(0,S.jsx)(gt,{experiment:e})}),(0,S.jsx)(`td`,{title:t?`median over ${t.agent_time_attempts} of ${t.completed} scored attempt(s)`:void 0,children:pt(t?.median_agent_ms??null)}),(0,S.jsx)(`td`,{title:t?`mean over ${t.token_attempts} attempt(s) that reported tokens`:void 0,children:ft(t?.mean_tokens_in??null)}),(0,S.jsx)(`td`,{"data-testid":`leaderboard-cost`,children:(0,S.jsx)(_t,{experiment:e})}),(0,S.jsx)(`td`,{children:n&&n.rate!==null?`${n.recalled}/${n.attempts}`:`n/a`})]},e.experiment_id)})})]})})]})}function yt(e){return e===null?{bg:`var(--gray-bg)`,fg:`var(--muted)`}:e>=.95?{bg:`#1a7f37`,fg:`#ffffff`}:e>=.9?{bg:`#7ecb8f`,fg:`#0f3d1e`}:e>=.8?{bg:`#ffdf80`,fg:`#5c3d00`}:e>=.5?{bg:`#ffb066`,fg:`#5c2800`}:e>0?{bg:`#f28b82`,fg:`#520f08`}:{bg:`#d93025`,fg:`#ffffff`}}function bt(e){return e===null?`—`:`${Math.round(e*100)}%`}function xt(){return(0,S.jsxs)(`div`,{className:`legend`,"aria-label":`Pass-rate color scale (fixed 0-100%)`,children:[(0,S.jsx)(`span`,{children:`0%`}),[0,.5,.8,.9,.95].map(e=>{let t=yt(e);return(0,S.jsx)(`span`,{className:`legend-sw`,style:{background:t.bg},title:`≥ ${Math.round(e*100)}%`},e)}),(0,S.jsx)(`span`,{children:`100%`}),(0,S.jsx)(`span`,{style:{marginLeft:8},children:`ticks: 80 / 90 / 95`})]})}function St(e){let t=[];for(let n of e){let e=n.group===null?`agent:${n.agentLabel??``}`:`group:${n.group}`,r=t.at(-1);r&&r.key===e?r.columns.push(n):t.push({key:e,group:n.group,columns:[n]})}return t.map(({group:e,columns:t})=>{let n=new Set(t.map(e=>e.agentLabel)),r=n.size===1?[...n][0]??null:null;return{label:r??e??``,sub:r!==null&&e!==null?e:null,title:r===null?null:t[0]?.agentTitle??null,span:t.length}})}function Ct({cells:e,rows:t,columns:n,onCellClick:r,band:i}){let a=new Map(e.map(e=>[`${e.evalId}|${e.experimentId}`,e])),o=n.some(e=>e.group!==null||e.agentLabel!==null);return(0,S.jsxs)(`div`,{className:`matrix-region`,children:[(0,S.jsx)(`div`,{className:`scroll-hint`,"aria-hidden":`true`,children:`Scroll horizontally to see every experiment →`}),(0,S.jsx)(`div`,{className:`matrix-scroll`,role:`region`,"aria-label":i===void 0?`Pass-rate matrix`:`Pass-rate matrix — ${i}`,tabIndex:0,children:(0,S.jsxs)(`table`,{className:`matrix`,children:[(0,S.jsxs)(`thead`,{children:[o&&(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{"aria-hidden":`true`}),St(n).map((e,t)=>(0,S.jsxs)(`th`,{colSpan:e.span,className:`matrix-group-head`,title:e.title??void 0,children:[e.label,e.sub!==null&&(0,S.jsx)(`span`,{className:`matrix-group-sub`,children:e.sub})]},`${e.label}-${t}`))]}),(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`eval`}),n.map(e=>(0,S.jsxs)(`th`,{children:[(0,S.jsx)(`code`,{children:e.experimentId}),e.treatment!==null&&(0,S.jsx)(`span`,{className:`matrix-row-feature`,children:e.treatment})]},e.experimentId))]})]}),(0,S.jsx)(`tbody`,{children:t.map(e=>(0,S.jsxs)(`tr`,{children:[(0,S.jsxs)(`th`,{children:[(0,S.jsx)(`code`,{children:e.evalId}),e.framework!==void 0&&(0,S.jsx)(`span`,{className:`matrix-row-feature`,children:e.framework})]}),n.map(t=>{let n=a.get(`${e.evalId}|${t.experimentId}`);if(!n)return(0,S.jsx)(`td`,{className:`cell`,style:{background:`var(--gray-bg)`,color:`var(--muted)`},children:(0,S.jsx)(`div`,{className:`cell-rate`,children:`—`})},t.experimentId);let i=yt(n.rate),o=`${n.evalId}, ${n.experimentId}: ${bt(n.rate)}, ${n.passed} of ${n.scored} scored passed${n.checks?`; ${n.checks.passed} of ${n.checks.total} checks passed`:``}${n.errors>0?`; ${n.errors} errored`:``}${n.flaky?`; flaky trials`:``}${n.incomplete?`; incomplete`:``}`;return(0,S.jsx)(`td`,{className:`cell`,style:{background:i.bg,color:i.fg},children:(0,S.jsxs)(`button`,{type:`button`,className:`cell-button`,"aria-label":o,"data-testid":`cell-${n.evalId}-${n.experimentId}`,"data-rate":n.rate===null?``:String(Math.round(n.rate*100)),"data-flaky":n.flaky?`true`:`false`,"data-incomplete":n.incomplete?`true`:`false`,onClick:()=>r(n),children:[n.flaky&&(0,S.jsx)(`span`,{className:`flaky-marker`,title:`flaky: trials disagreed`,"aria-hidden":`true`}),(0,S.jsx)(`span`,{className:`cell-rate`,children:bt(n.rate)}),(0,S.jsxs)(`span`,{className:`cell-sub`,children:[n.passed,`/`,n.scored,n.checks?` · ${n.checks.passed}/${n.checks.total} checks`:``,n.errors>0?` · ${n.errors} err`:``]}),n.incomplete&&(0,S.jsx)(`span`,{className:`incomplete-marker`,title:`incomplete: fewer attempts than planned`,"aria-hidden":`true`,children:`◌`})]})},t.experimentId)})]},e.evalId))})]})})]})}var wt=`all`,Tt=[`benchmark`,`regression`,`other`];function Et(e,t){return e.manifest.evals[t]?.metadata??{}}function Dt(e,t){for(let n of e.groups)if(n.experimentIds.includes(t))return n.group;return null}function Ot(e,t){return[...new Set(t.map(e=>e.experiment_id))].map(t=>({experimentId:t,treatment:e.manifest.experiments[t]?.components.treatment??null,group:Dt(e,t),agentLabel:Ne(e,t),agentTitle:Pe(e,t)})).sort((e,t)=>(e.group??`￿`).localeCompare(t.group??`￿`)||(e.treatment??``).localeCompare(t.treatment??``)||e.experimentId.localeCompare(t.experimentId))}function kt(e,t){let n=new Map;for(let t of e){let e=`${t.eval_id}|${t.experiment_id}`,r=n.get(e);r?r.push(t):n.set(e,[t])}let r=[];for(let e of n.values()){let n=e[0],i=e.filter(e=>e.status===`completed`),a=i.filter(e=>e.passed===!0).length,o=i.length,s=new Set(i.map(e=>e.passed===!0)),c=le(i.flatMap(e=>e.checks??[]));r.push({evalId:n.eval_id,experimentId:n.experiment_id,rate:o>0?a/o:null,passed:a,scored:o,flaky:s.size>1,incomplete:e.length<t||e.some(e=>e.status===`incomplete`),errors:e.filter(e=>e.status===`error`).length,checks:c.total>0?c:null})}return r}function At(e){if(e.started_at===null||e.finished_at===null)return`—`;let t=Math.round((Date.parse(e.finished_at)-Date.parse(e.started_at))/1e3);return`${Math.floor(t/60)}m${String(t%60).padStart(2,`0`)}s`}var jt={codex:{label:`thread turns`,title:`codex exec reports one thread turn per prompt, not per agent step — not comparable to Claude's turn count`}};function Mt(e){return e.status===`incomplete`&&e.error?.startsWith(`attempt timed out`)===!0}function Nt({attempt:e,runId:t,adapter:n}){let r=pe(e),i=n!==null&&jt[n]||{label:`turns`,title:`agent turns, as counted by the adapter`};return(0,S.jsxs)(`div`,{className:`attempt-row`,"data-testid":`drill-attempt`,children:[(0,S.jsxs)(`div`,{className:`attempt-line`,children:[(0,S.jsxs)(`span`,{className:`kpi-meta`,children:[`trial `,e.trial_index+1]}),(0,S.jsx)(D,{tone:me(r),children:r}),(0,S.jsx)(ge,{attempt:e}),(0,S.jsx)(`span`,{className:`spacer`}),e.transcript!==null&&(0,S.jsx)(`a`,{href:T.attempt(t,e.id,`transcript`),children:`transcript`}),e.diff!==null&&(0,S.jsx)(`a`,{href:T.attempt(t,e.id,`diff`),children:`diff`})]}),e.checks!==null&&e.checks.length>0&&(0,S.jsx)(`div`,{className:`attempt-line`,children:e.checks.map(e=>(0,S.jsxs)(`span`,{className:e.passed?`crit pass`:`crit fail`,title:e.notes??e.name,children:[e.passed?`✓`:`✗`,` `,e.name,!E(e)&&(0,S.jsx)(`span`,{className:`tag`,"data-testid":`ungraded-tag`,title:`Recorded, not graded: never enters pass/fail`,children:`recorded`})]},e.name))}),e.error!==null&&(0,S.jsx)(`div`,{className:`attempt-line`,children:(0,S.jsx)(`code`,{children:e.error})}),(0,S.jsxs)(`div`,{className:`telemetry`,children:[(0,S.jsxs)(`span`,{children:[`wall `,At(e)]}),(0,S.jsxs)(`span`,{children:[`tokens `,ft(e.tokens_in),` in / `,ft(e.tokens_out),` out`]}),(0,S.jsxs)(`span`,{children:[`cost `,e.cost_usd===null?`—`:`$${e.cost_usd.toFixed(2)}`]}),(0,S.jsxs)(`span`,{title:i.title,children:[i.label,` `,e.turns??`—`]})]}),(0,S.jsx)(Se,{treatment:e.treatment,usage:e.surface_usage})]})}function Pt({runId:e,run:t,cell:n,attempts:r}){let i=(0,l.useRef)(null),a=(0,l.useRef)(!1),o=(0,l.useId)(),s=r.filter(e=>e.eval_id===n.evalId&&e.experiment_id===n.experimentId).sort((e,t)=>e.trial_index-t.trial_index),c=t.manifest.experiments[n.experimentId]?.components.treatment??null,u=s.filter(e=>e.status===`completed`),d=u.filter(e=>e.passed===!0).length,f=`cell-${n.evalId}-${n.experimentId}`,p=(0,l.useCallback)(()=>{a.current=!0,se(T.matrix(e))},[e]);return(0,l.useEffect)(()=>{let e=i.current;if(!e)return;let t=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=()=>[...e.querySelectorAll(`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)].filter(e=>!e.hasAttribute(`hidden`));n()[0]?.focus();let r=t=>{if(t.key===`Escape`){t.preventDefault(),p();return}if(t.key!==`Tab`)return;let r=n();if(r.length===0){t.preventDefault(),e.focus();return}let i=r[0],a=r.at(-1);t.shiftKey&&document.activeElement===i?(t.preventDefault(),a.focus()):!t.shiftKey&&document.activeElement===a?(t.preventDefault(),i.focus()):e.contains(document.activeElement)||(t.preventDefault(),i.focus())};return document.addEventListener(`keydown`,r),()=>{if(document.removeEventListener(`keydown`,r),document.body.style.overflow=t,!a.current)return;let e=()=>{let e=[...document.querySelectorAll(`[data-testid]`)].find(e=>e.dataset.testid===f);return e?.focus(),e!==void 0};requestAnimationFrame(()=>{e()||window.setTimeout(e,0)})}},[p,f]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`drill-overlay`,"aria-hidden":`true`,onClick:p,onKeyDown:e=>e.preventDefault()}),(0,S.jsxs)(`aside`,{ref:i,className:`drill`,"data-testid":`drill-down`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":o,tabIndex:-1,children:[(0,S.jsx)(`button`,{type:`button`,className:`drill-close`,onClick:p,"data-testid":`drill-close`,children:`Close ✕`}),(0,S.jsxs)(`h2`,{id:o,children:[n.evalId,` · `,n.experimentId,c===null?``:` · ${c}`]}),(0,S.jsxs)(`p`,{className:`sub`,children:[s.length,` attempt(s) · `,d,`/`,u.length,` scored passed · `,bt(u.length>0?d/u.length:null)]}),s.length===0&&(0,S.jsx)(`div`,{className:`viewer-note`,children:`No attempts in this cell.`}),s.map(n=>(0,S.jsx)(Nt,{attempt:n,runId:e,adapter:t.manifest.experiments[n.experiment_id]?.components.agent?.adapter??null},n.id))]})]})}function Ft({id:e,label:t,values:n,value:r,onChange:i}){return n.length===0?null:(0,S.jsxs)(`div`,{className:`control`,children:[(0,S.jsx)(`label`,{htmlFor:e,children:t}),(0,S.jsxs)(`select`,{id:e,"data-testid":e,value:r,onChange:e=>i(e.currentTarget.value),children:[(0,S.jsx)(`option`,{value:wt,children:`all`}),n.map(e=>(0,S.jsx)(`option`,{value:e,children:e},e))]})]})}var It=e=>e===1?``:`s`;function Lt({meta:e,runId:t,cell:n}){let r=C(()=>_(t),[t]),i=C(()=>v(t).then(e=>e,()=>null),[t]),[a,o]=(0,l.useState)(`benchmark`),s=r.status===`ready`?Tt.filter(e=>r.value.attempts.some(t=>t.suite===e)):[],c=s.includes(a)?a:s[0]??`benchmark`,[u,d]=(0,l.useState)({product:wt,framework:wt,topic:wt});(0,l.useEffect)(()=>{d({product:wt,framework:wt,topic:wt})},[t]);let f=(0,l.useMemo)(()=>{if(r.status!==`ready`)return null;let e=r.value,t=e.attempts.filter(e=>e.suite===c).filter(t=>{let n=Et(e,t.eval_id);return!(u.product!==wt&&n.product!==u.product||u.framework!==wt&&n.framework!==u.framework||u.topic!==wt&&!(n.topics??[]).includes(u.topic))});return{rows:[...new Set(t.map(e=>e.eval_id))].sort((e,t)=>e.localeCompare(t)).map(t=>({evalId:t,...Et(e,t).framework===void 0?{}:{framework:Et(e,t).framework}})),columns:Ot(e,t),cells:kt(t,e.run.trials),attempts:t}},[r,c,u]);if(r.status===`error`)return(0,S.jsx)(ee,{error:r.error});if(r.status===`loading`||i.status===`loading`||f===null)return(0,S.jsx)(`div`,{className:`loading`,children:`Loading run…`});let p=r.value,m=p.run,h=Tt.filter(e=>p.attempts.some(t=>t.suite===e)),g=[...new Set(p.attempts.map(e=>Et(p,e.eval_id).product).filter(e=>e!==void 0))].sort(),y=[...new Set(p.attempts.map(e=>Et(p,e.eval_id).framework).filter(e=>e!==void 0))].sort(),b=[...new Set(p.attempts.flatMap(e=>Et(p,e.eval_id).topics??[]))].sort(),x={attempts:p.attempts.length,passed:p.attempts.filter(e=>e.status===`completed`&&e.passed===!0).length,failed:p.attempts.filter(e=>e.status===`completed`&&e.passed!==!0).length,incomplete:p.attempts.filter(e=>e.status===`incomplete`).length,timedOut:p.attempts.filter(e=>e.status===`completed`&&e.limit===`timeout`||Mt(e)).length,unscoredTimedOut:p.attempts.filter(Mt).length,errors:p.attempts.filter(e=>e.status===`error`).length},te=x.passed+x.failed,ne=i.status===`ready`?i.value:null,w=Array.isArray(ne?.pairs)?ne.pairs:[],re=w.some(e=>e.band!==void 0),ie=new Map(w.map(e=>[e.eval_id,e.band??null])),ae=e=>f.rows.filter(t=>(ie.get(t.evalId)??null)===e),oe=f.rows.filter(e=>{let t=ie.get(e.evalId)??null;return t===null||t===`discriminating`}),ce=ae(null).length,E=ae(`solved-by-all`),le=ae(`failed-by-all`),ue=ne?.scorer_health?.suspects??[],de=e=>se(T.cell(t,{evalId:e.evalId,experimentId:e.experimentId})),fe=e=>{o(e),n&&se(T.matrix(t))},pe=e=>r=>{d(t=>({...t,[e]:r})),n&&se(T.matrix(t))};return(0,S.jsxs)(`div`,{"data-testid":`matrix-view`,children:[(0,S.jsx)(ut,{coverage:p.publication}),(0,S.jsxs)(`div`,{className:`page-head`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{children:`Eval × experiment matrix`}),(0,S.jsx)(`p`,{className:`sub`,children:`Pass rate over scored attempts per cell; experiment columns are the treatment arms, grouped by comparison group. Select a cell for attempt evidence.`})]}),(0,S.jsxs)(`div`,{className:`controls`,children:[(0,S.jsxs)(`div`,{className:`control`,children:[(0,S.jsx)(`label`,{htmlFor:`run-select`,children:`Run`}),(0,S.jsx)(`select`,{id:`run-select`,"data-testid":`run-select`,value:t,onChange:e=>se(T.matrix(e.currentTarget.value)),children:e.runs.map(e=>(0,S.jsxs)(`option`,{value:e.id,children:[e.id.slice(0,10),`… · `,e.started_at.slice(0,10),` · `,e.attempts,` attempts`]},e.id))})]}),(0,S.jsx)(Ft,{id:`filter-product`,label:`Product`,values:g,value:u.product,onChange:pe(`product`)}),(0,S.jsx)(Ft,{id:`filter-framework`,label:`Framework`,values:y,value:u.framework,onChange:pe(`framework`)}),(0,S.jsx)(Ft,{id:`filter-topic`,label:`Topic`,values:b,value:u.topic,onChange:pe(`topic`)}),h.length>1&&(0,S.jsxs)(`div`,{className:`control`,children:[(0,S.jsx)(`label`,{children:`Suite`}),(0,S.jsx)(`div`,{className:`seg`,role:`group`,"aria-label":`Suite`,children:h.map(e=>(0,S.jsx)(`button`,{type:`button`,className:c===e?`active`:``,"aria-pressed":c===e,"data-testid":`suite-${e}`,onClick:()=>fe(e),children:e},e))})]})]})]}),(m.finished_at===null||m.incomplete)&&(0,S.jsxs)(`div`,{className:`notice`,"data-testid":`incomplete-banner`,children:[`Incomplete run — `,ht({unfinished:m.finished_at===null,incomplete:x.incomplete,errors:x.errors,timedOut:x.unscoredTimedOut}),`. Numbers are partial.`]}),(0,S.jsxs)(`div`,{className:`kpi-row`,children:[(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsxs)(`div`,{className:`kpi-label`,children:[`Overall pass rate`,h.length>1?` (all suites)`:``]}),(0,S.jsx)(`div`,{className:`kpi-val`,children:te===0?`—`:`${Math.round(x.passed/te*100)}%`}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[(0,S.jsxs)(D,{tone:`green`,children:[x.passed,` passed`]}),` `,(0,S.jsxs)(D,{tone:`red`,children:[x.failed,` failed`]}),` `,(0,S.jsxs)(D,{tone:`gray`,children:[x.incomplete,` incomplete`]}),` `,(0,S.jsxs)(D,{tone:`amber`,children:[x.errors,` errored`]}),x.timedOut>0&&(0,S.jsxs)(S.Fragment,{children:[` `,(0,S.jsxs)(D,{tone:`gray`,children:[x.timedOut,` timed out`]})]})]})]}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Evals × experiments`}),(0,S.jsxs)(`div`,{className:`kpi-val`,children:[m.eval_ids.length,` × `,m.experiment_ids.length]}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[m.attempts,` attempts`]})]}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Trials per pair`}),(0,S.jsx)(`div`,{className:`kpi-val`,children:m.trials}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[`manifest `,m.manifest_hash.slice(0,10),`…`]})]})]}),ne!==null&&(0,S.jsx)(vt,{report:ne,runId:t}),(0,S.jsxs)(`div`,{className:`card`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsxs)(`h3`,{children:[`Pass rate per eval × experiment`,c===`regression`&&(0,S.jsxs)(S.Fragment,{children:[` `,(0,S.jsx)(D,{tone:`amber`,title:`Known failure modes — tracked separately from benchmark results.`,children:`regression suite`})]})]}),(0,S.jsx)(xt,{})]}),ue.length>0&&ne?.scorer_health&&(0,S.jsxs)(`div`,{className:`notice band-notice`,"data-testid":`scorer-health-banner`,children:[ne.scorer_health.summary,(0,S.jsx)(`ul`,{children:ue.map(e=>(0,S.jsxs)(`li`,{children:[(0,S.jsx)(`code`,{children:e.eval_id}),` · `,(0,S.jsx)(`code`,{children:e.check}),` failed in `,e.attempts,` attempts under`,` `,e.experiments.length,` arms · passing: `,e.passing_checks.join(`, `)]},`${e.eval_id}|${e.check}`))})]}),re?(0,S.jsxs)(S.Fragment,{children:[oe.length>0&&(0,S.jsxs)(`section`,{className:`band`,"data-testid":`matrix-band-discriminating`,children:[(0,S.jsxs)(`h4`,{children:[`Discriminating (`,oe.length,` eval`,It(oe.length),`) — arms disagree`,ce>0&&` (${ce} eval${It(ce)} with one scored arm)`]}),(0,S.jsx)(Ct,{cells:f.cells,rows:oe,columns:f.columns,onCellClick:de,band:`discriminating`})]}),E.length>0&&(0,S.jsxs)(`details`,{className:`band`,"data-testid":`matrix-band-solved`,children:[(0,S.jsxs)(`summary`,{children:[`Solved by every arm (`,E.length,` eval`,It(E.length),`)`]}),(0,S.jsx)(Ct,{cells:f.cells,rows:E,columns:f.columns,onCellClick:de,band:`solved by every arm`})]}),le.length>0&&(0,S.jsxs)(`details`,{className:`band`,"data-testid":`matrix-band-failed`,children:[(0,S.jsxs)(`summary`,{children:[`Failed by every arm (`,le.length,` eval`,It(le.length),`) — suspect the eval`]}),(0,S.jsx)(Ct,{cells:f.cells,rows:le,columns:f.columns,onCellClick:de,band:`failed by every arm`})]})]}):(0,S.jsx)(Ct,{cells:f.cells,rows:f.rows,columns:f.columns,onCellClick:de})]}),n&&(0,S.jsx)(Pt,{runId:t,run:p,cell:n,attempts:p.attempts})]})}var Rt=[2,3,5,10];function zt(e){return(e??[]).filter(e=>Rt.includes(e.k))}function Bt({estimate:e}){return e===void 0?null:(0,S.jsxs)(`div`,{className:`kpi`,"data-testid":`cost-estimate`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Estimated token cost`}),(0,S.jsx)(`div`,{className:`kpi-val`,children:e.cost_usd===null?`—`:e.cost_usd>0&&e.cost_usd<.01?`<$0.01`:`$${e.cost_usd.toFixed(2)}`}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[`In addition to reported cost · `,e.cost_attempts,` estimated, `,e.unpriced_attempts,` unpriced attempt(s)`]}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[`Pricing: `,e.pricing.version,`. Excludes tool fees, diagnosis, infrastructure and superseded retries.`]})]})}function Vt(e){return e===null?`—`:`${Math.round(e*100)}%`}function Ht({pair:e}){let t=zt(e.pass_at_k);return t.length===0?(0,S.jsx)(S.Fragment,{children:`—`}):(0,S.jsx)(`div`,{children:t.map(e=>(0,S.jsxs)(`div`,{children:[`k=`,e.k,`: `,Vt(e.pass_at_k),` / `,Vt(e.pass_to_the_k)]},e.k))})}function Ut({pair:e}){return e.checks.length===0?(0,S.jsx)(`span`,{className:`attribution-reason`,children:`no named checks recorded`}):(0,S.jsx)(`div`,{className:`attribution-effects`,children:e.checks.map(e=>(0,S.jsxs)(`span`,{className:e.passed===e.total?`crit pass`:`crit fail`,title:e.name,children:[e.passed===e.total?`✓`:`✗`,` `,e.name,` (`,e.passed,`/`,e.total,`)`,!E(e)&&(0,S.jsx)(`span`,{className:`tag`,"data-testid":`ungraded-tag`,title:`Recorded, not graded: never enters pass/fail`,children:`recorded`})]},e.name))})}function Wt({group:e,labelOf:t}){let n=new Set(e.experiment_ids.map(t)),r=n.size===1?[...n][0]??null:null;return r===null?(0,S.jsx)(`h3`,{children:e.group}):(0,S.jsxs)(`h3`,{children:[r,` `,(0,S.jsx)(`span`,{className:`group-sub`,children:e.group})]})}function Gt({group:e,labelOf:t}){if(e.comparison===`withheld`)return(0,S.jsxs)(`div`,{className:`card`,"data-testid":`report-group-${e.group}`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(Wt,{group:e,labelOf:t}),(0,S.jsx)(D,{tone:`amber`,children:`comparison withheld`})]}),(0,S.jsxs)(`div`,{className:`body`,children:[(0,S.jsx)(`p`,{className:`viewer-note`,children:`Members differ beyond their declared treatment — the differing components:`}),(0,S.jsx)(`ul`,{children:e.details.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsx)(`code`,{children:e})},e))})]})]});let n=[...new Set(e.arms.flatMap(e=>e.evals.map(e=>e.eval_id)))].sort();return(0,S.jsxs)(`div`,{className:`card`,"data-testid":`report-group-${e.group}`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(Wt,{group:e,labelOf:t}),(0,S.jsx)(D,{tone:`green`,children:`compared — raw counts`})]}),(0,S.jsx)(`div`,{className:`body`,children:(0,S.jsxs)(`table`,{className:`data`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`eval`}),e.arms.map(e=>(0,S.jsxs)(`th`,{children:[(0,S.jsx)(`code`,{children:e.experiment_id}),e.treatment!==null&&(0,S.jsx)(`div`,{className:`attribution-reason`,children:e.treatment})]},e.experiment_id))]})}),(0,S.jsx)(`tbody`,{children:n.map(t=>(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`td`,{children:(0,S.jsx)(`code`,{children:t})}),e.arms.map(e=>{let n=e.evals.find(e=>e.eval_id===t);return(0,S.jsx)(`td`,{children:n===void 0?`—`:n.display},e.experiment_id)})]},t))})]})})]})}function Kt({meta:e,runId:t}){let n=C(()=>v(t),[t]);if(n.status===`error`)return(0,S.jsx)(ee,{error:n.error});if(n.status===`loading`)return(0,S.jsx)(`div`,{className:`loading`,children:`Loading report…`});let r=n.value,i=r.totals.passed+r.totals.failed,a=new Map((r.experiments??[]).map(e=>[e.experiment_id,je(e.agent.model,e.agent.reasoning)])),o=e=>a.get(e)??null,s=r.run.trials>1;return(0,S.jsxs)(`div`,{"data-testid":`report-view`,children:[(0,S.jsx)(ut,{coverage:n.value.publication}),(0,S.jsxs)(`div`,{className:`page-head`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{children:`Run report`}),(0,S.jsxs)(`p`,{className:`sub`,children:[r.run.eval_ids.length,` evals × `,r.run.experiment_ids.length,` experiments · `,r.run.trials,` `,`trials/pair · started `,r.run.started_at.slice(0,10)]})]}),(0,S.jsxs)(`div`,{className:`control`,children:[(0,S.jsx)(`label`,{htmlFor:`report-run`,children:`Run`}),(0,S.jsx)(`select`,{id:`report-run`,"data-testid":`report-run-select`,value:t,onChange:e=>se(T.report(e.currentTarget.value)),children:e.runs.map(e=>(0,S.jsxs)(`option`,{value:e.id,children:[e.id.slice(0,10),`… · `,e.started_at.slice(0,10)]},e.id))})]})]}),r.incomplete&&(0,S.jsxs)(`div`,{className:`notice`,"data-testid":`incomplete-banner`,children:[`⚠️ INCOMPLETE RUN — `,ht({unfinished:r.run.finished_at===null,...r.totals}),`. Numbers below are partial and NOT comparable to a full sweep.`]}),(0,S.jsxs)(`div`,{className:`kpi-row`,children:[(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Attempts`}),(0,S.jsx)(`div`,{className:`kpi-val`,children:r.totals.attempts}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[(0,S.jsxs)(D,{tone:`green`,children:[r.totals.passed,` passed`]}),` `,(0,S.jsxs)(D,{tone:`red`,children:[r.totals.failed,` failed`]}),` `,(0,S.jsxs)(D,{tone:`gray`,children:[r.totals.incomplete,` incomplete`]}),` `,(0,S.jsxs)(D,{tone:`amber`,children:[r.totals.errors,` errored`]})]})]}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Overall pass rate`}),(0,S.jsx)(`div`,{className:`kpi-val`,children:i===0?`—`:`${Math.round(r.totals.passed/i*100)}%`}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[i,` scored attempt(s)`]})]}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Reported cost`}),(0,S.jsx)(`div`,{className:`kpi-val`,children:r.telemetry.cost_usd===null?`—`:`$${r.telemetry.cost_usd.toFixed(2)}`}),(0,S.jsx)(`div`,{className:`kpi-meta`,children:r.telemetry.cost_usd===null?`unavailable`:`${r.telemetry.cost_attempts} of ${r.totals.attempts} attempts reported a cost`+(r.totals.attempts>r.telemetry.cost_attempts?` · ${r.totals.attempts-r.telemetry.cost_attempts} unpriced, so this understates the spend`:``)})]}),(0,S.jsx)(Bt,{estimate:r.cost_estimate}),(0,S.jsxs)(`div`,{className:`kpi`,children:[(0,S.jsx)(`div`,{className:`kpi-label`,children:`Tokens`}),(0,S.jsx)(`div`,{className:`kpi-val`,style:{fontSize:15},children:r.telemetry.tokens_in===null&&r.telemetry.tokens_out===null?`unavailable`:`${ft(r.telemetry.tokens_in)} in / ${ft(r.telemetry.tokens_out)} out`}),(0,S.jsxs)(`div`,{className:`kpi-meta`,children:[`from `,r.telemetry.token_attempts,` of `,r.totals.attempts,` attempts`]})]})]}),(0,S.jsxs)(`div`,{className:`card`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(`h3`,{children:`Pass rates per eval × experiment`}),(0,S.jsx)(`span`,{className:`kpi-meta`,children:`scored = passed + failed; incomplete and errored attempts never enter the denominator`})]}),(0,S.jsx)(`div`,{className:`body`,children:(0,S.jsxs)(`table`,{className:`data`,"data-testid":`pairs-table`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`eval`}),(0,S.jsx)(`th`,{children:`experiment`}),(0,S.jsx)(`th`,{children:`pass rate`}),(0,S.jsx)(`th`,{children:`raw`}),s&&(0,S.jsx)(`th`,{title:`pass@k: fraction of size-k subsets of the scored trials with ≥1 pass; pass^k: (passed/scored)^k`,children:`pass@k / pass^k`}),(0,S.jsx)(`th`,{children:`notes`}),(0,S.jsx)(`th`,{children:`checks`})]})}),(0,S.jsx)(`tbody`,{children:r.pairs.map(e=>(0,S.jsxs)(`tr`,{children:[(0,S.jsxs)(`td`,{children:[(0,S.jsx)(`code`,{children:e.eval_id}),e.suite!==`benchmark`&&(0,S.jsx)(`div`,{className:`attribution-reason`,children:e.suite})]}),(0,S.jsxs)(`td`,{children:[(0,S.jsx)(`code`,{children:e.experiment_id}),o(e.experiment_id)!==null&&(0,S.jsx)(`div`,{className:`attribution-reason`,children:o(e.experiment_id)})]}),(0,S.jsx)(`td`,{children:(0,S.jsx)(`strong`,{children:Vt(e.pass_rate)})}),(0,S.jsxs)(`td`,{children:[e.passed,`/`,e.scored]}),s&&(0,S.jsx)(`td`,{children:(0,S.jsx)(Ht,{pair:e})}),(0,S.jsx)(`td`,{children:[e.incomplete>0?`${e.incomplete} incomplete`:``,e.errors>0?`${e.errors} errored`:``,e.flaky?`trials disagreed`:``].filter(Boolean).join(`; `)||`—`}),(0,S.jsx)(`td`,{children:(0,S.jsx)(Ut,{pair:e})})]},`${e.eval_id}|${e.experiment_id}`))})]})})]}),r.groups.length>0&&(0,S.jsxs)(`section`,{"data-testid":`report-groups`,children:[(0,S.jsx)(`h2`,{children:`Comparison groups`}),r.groups.map(e=>(0,S.jsx)(Gt,{group:e,labelOf:o},e.group))]}),(r.experiments??[]).length>0&&(0,S.jsxs)(`div`,{className:`card`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(`h3`,{children:`SDK recall`}),(0,S.jsx)(`span`,{className:`kpi-meta`,children:`scored attempts whose ungraded checks all passed`})]}),(0,S.jsx)(`div`,{className:`body`,"data-testid":`sdk-recall`,children:(r.experiments??[]).map(e=>{let t=e.sdk_recall;return(0,S.jsx)(`div`,{className:`attribution-arm`,children:(0,S.jsxs)(`div`,{className:`attribution-arm-head`,children:[(0,S.jsx)(`strong`,{children:(0,S.jsx)(`code`,{children:e.experiment_id})}),e.treatment!==null&&(0,S.jsx)(D,{tone:`blue`,children:e.treatment}),(0,S.jsxs)(`span`,{children:[`SDK recall `,t&&t.rate!==null?`${t.recalled}/${t.attempts}`:`n/a`]})]})},e.experiment_id)})})]}),r.usage.length>0&&(0,S.jsxs)(`div`,{className:`card`,children:[(0,S.jsxs)(`div`,{className:`head`,children:[(0,S.jsx)(`h3`,{children:`Surface usage (offered vs observed)`}),(0,S.jsx)(`span`,{className:`kpi-meta`,children:`null telemetry counts as unavailable, never as zero use`})]}),(0,S.jsx)(`div`,{className:`body`,"data-testid":`usage-summary`,children:r.usage.map(e=>(0,S.jsxs)(`div`,{className:`attribution-arm`,children:[(0,S.jsxs)(`div`,{className:`attribution-arm-head`,children:[(0,S.jsx)(`strong`,{children:(0,S.jsx)(`code`,{children:e.experiment_id})}),e.treatment!==null&&(0,S.jsxs)(D,{tone:`blue`,children:[`offered: `,e.treatment]})]}),(0,S.jsx)(O,{usage:e})]},e.experiment_id))})]}),r.egress_denials.length>0&&(0,S.jsxs)(`div`,{className:`card`,children:[(0,S.jsx)(`div`,{className:`head`,children:(0,S.jsx)(`h3`,{children:`Egress denials (proxied run)`})}),(0,S.jsx)(`div`,{className:`body`,children:(0,S.jsxs)(`table`,{className:`data`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`attempt`}),(0,S.jsx)(`th`,{children:`eval`}),(0,S.jsx)(`th`,{children:`experiment`}),(0,S.jsx)(`th`,{children:`denials`}),(0,S.jsx)(`th`,{children:`top hosts`})]})}),(0,S.jsx)(`tbody`,{children:r.egress_denials.map(e=>(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`td`,{children:(0,S.jsxs)(`code`,{children:[e.attempt_id.slice(0,8),`…`]})}),(0,S.jsx)(`td`,{children:e.eval_id}),(0,S.jsx)(`td`,{children:e.experiment_id}),(0,S.jsx)(`td`,{children:e.count}),(0,S.jsx)(`td`,{children:e.top_hosts.map(({host:e,count:t})=>`${e} (${t})`).join(`, `)})]},e.attempt_id))})]})})]}),(0,S.jsxs)(`div`,{className:`methodology`,"data-testid":`methodology`,children:[(0,S.jsx)(`strong`,{children:`Methodology`}),`: `,r.methodology]})]})}function qt(){return(0,S.jsxs)(`div`,{className:`empty-state`,"data-testid":`empty-state`,children:[(0,S.jsx)(`h2`,{children:`No runs in this data directory yet`}),(0,S.jsx)(`p`,{children:`Execute a sweep, then re-export (or restart) the UI:`}),(0,S.jsx)(`pre`,{children:(0,S.jsxs)(`code`,{children:[`quickstudy run --eval my-eval --experiment my-experiment`,`
28
28
  `,`quickstudy ui`]})}),(0,S.jsx)(`p`,{children:`The matrix, compare, report, and diagnosis views light up as soon as a run exists.`})]})}function Jt({route:e,meta:t}){let n=t.runs[0]?.id,r=e.view===`matrix`||e.view===`attempt`;return(0,S.jsxs)(`nav`,{className:`tabs`,"aria-label":`Views`,children:[(0,S.jsx)(`a`,{href:T.matrix(),className:r?`tab active`:`tab`,"aria-current":r?`page`:void 0,children:`Matrix`}),(0,S.jsx)(`a`,{href:T.compare(),className:e.view===`compare`?`tab active`:`tab`,"aria-current":e.view===`compare`?`page`:void 0,children:`Compare`}),(0,S.jsx)(`a`,{href:T.report(n),className:e.view===`report`?`tab active`:`tab`,"aria-current":e.view===`report`?`page`:void 0,children:`Report`}),(0,S.jsx)(`a`,{href:T.diagnosis(n),className:e.view===`diagnosis`?`tab active`:`tab`,"aria-current":e.view===`diagnosis`?`page`:void 0,children:`Diagnosis`})]})}function Yt({route:e,meta:t}){let n=t.runs[0]?.id;switch(e.view){case`matrix`:return(0,S.jsx)(Lt,{meta:t,runId:e.runId??n??``,cell:e.cell});case`attempt`:return(0,S.jsx)(ke,{runId:e.runId,attemptId:e.attemptId,artifact:e.artifact,lines:e.lines});case`compare`:return(0,S.jsx)(We,{meta:t,runId:e.runId??n});case`report`:return(0,S.jsx)(Kt,{meta:t,runId:e.runId??n??``});case`diagnosis`:return(0,S.jsx)(lt,{meta:t,runId:e.runId??n??``})}}function Xt(){let e=oe(),t=C(()=>h(),[]),n=(e.view===`matrix`||e.view===`compare`)&&e.legacyLink===!0;return(0,S.jsxs)(`div`,{className:`app`,children:[(0,S.jsxs)(`header`,{className:`topbar`,children:[(0,S.jsxs)(`div`,{className:`brand`,children:[(0,S.jsx)(`span`,{className:`brand-mark`,"aria-hidden":`true`}),`quickstudy`]}),t.status===`ready`&&(0,S.jsx)(Jt,{route:e,meta:t.value})]}),(0,S.jsxs)(`main`,{className:`content`,children:[n&&(0,S.jsx)(`div`,{className:`notice`,"data-testid":`legacy-link-notice`,children:`This link uses a URL format from an earlier quickstudy version — showing the closest current view.`}),t.status===`loading`&&(0,S.jsx)(`div`,{className:`loading`,children:`Loading data index…`}),t.status===`error`&&(0,S.jsx)(ee,{error:t.error}),t.status===`ready`&&(t.value.runs.length===0?(0,S.jsx)(qt,{}):(0,S.jsx)(te,{children:(0,S.jsx)(Yt,{route:e,meta:t.value})},JSON.stringify(e)))]})]})}var Zt=document.getElementById(`root`);if(Zt===null)throw Error(`missing #root element`);(0,u.createRoot)(Zt).render((0,S.jsx)(l.StrictMode,{children:(0,S.jsx)(Xt,{})}));</script>
29
29
  <style>.quickstudy-viewer.viewer{background:var(--surface);border:1px solid var(--line);border-radius:10px;overflow:hidden}.quickstudy-viewer .turn{border-bottom:1px solid var(--line)}.quickstudy-viewer .turn-head{width:100%;font:inherit;text-align:left;background:var(--surface);cursor:pointer;border:0;align-items:center;gap:8px;padding:6px 12px;display:flex}.quickstudy-viewer .turn-head:hover{background:var(--bg)}.quickstudy-viewer .turn-head .line-no{font-family:var(--mono);color:var(--muted);min-width:46px;font-size:11px}.quickstudy-viewer .turn-head .role{text-transform:uppercase;letter-spacing:.04em;min-width:72px;font-size:11px;font-weight:700}.quickstudy-viewer .role-assistant{color:var(--accent)}.quickstudy-viewer .role-user{color:var(--green)}.quickstudy-viewer .role-tool{color:var(--amber)}.quickstudy-viewer .role-system{color:var(--muted)}.quickstudy-viewer .turn-head .summary{color:var(--muted);white-space:nowrap;text-overflow:ellipsis;flex:1;font-size:12px;overflow:hidden}.quickstudy-viewer .turn-body{background:var(--bg);padding:8px 12px 12px 70px}.quickstudy-viewer .turn-body pre{white-space:pre-wrap;word-break:break-word;margin:0}.quickstudy-viewer .turn.highlight,.quickstudy-viewer .turn.highlight .turn-head{background:var(--amber-bg)}.quickstudy-viewer .viewer-note{color:var(--muted);border-bottom:1px solid var(--line);justify-content:space-between;align-items:center;gap:12px;padding:10px 14px;font-size:12px;display:flex}.quickstudy-viewer .viewer-note button{font:inherit;border:1px solid var(--line);background:var(--surface);cursor:pointer;border-radius:6px;padding:3px 10px}.quickstudy-viewer.diff{font-family:var(--mono);font-size:12px;line-height:1.45;overflow-x:auto}.quickstudy-viewer .diff-line{white-space:pre;display:flex}.quickstudy-viewer .diff-line .line-no{min-width:46px;color:var(--muted);text-align:right;-webkit-user-select:none;user-select:none;flex-shrink:0;padding:0 8px}.quickstudy-viewer .diff-line .text{flex:1;padding-right:12px}.quickstudy-viewer .diff-add{background:var(--green-bg)}.quickstudy-viewer .diff-del{background:var(--red-bg)}.quickstudy-viewer .diff-hunk{background:var(--gray-bg);color:var(--accent)}.quickstudy-viewer .diff-file{background:var(--gray-bg);font-weight:700}.quickstudy-viewer .diff-line.highlight{outline:2px solid var(--amber);outline-offset:-2px}:root{--bg:#f7f7f5;--surface:#fff;--ink:#1c1e21;--muted:#6b7280;--line:#e3e4e0;--accent:#4c5fd5;--green:#1a7f37;--green-bg:#d3f2dd;--amber:#9a6700;--amber-bg:#fff1c2;--red:#b42318;--red-bg:#ffe0dc;--gray-bg:#eceef0;--accent-bg:#e2e6f9;--mono:ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace}*{box-sizing:border-box}body{background:var(--bg);color:var(--ink);margin:0;font:14px/1.5 -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}code,pre{font-family:var(--mono);font-size:12px}a{color:var(--accent);text-decoration:none}a:hover{text-decoration:underline}:where(a,button,select,[tabindex]):focus-visible{outline:3px solid var(--accent);outline-offset:2px}.app{flex-direction:column;min-height:100vh;display:flex}.topbar{background:var(--surface);border-bottom:1px solid var(--line);z-index:20;align-items:center;gap:24px;padding:10px 20px;display:flex;position:sticky;top:0}.brand{letter-spacing:-.01em;align-items:center;gap:8px;font-weight:700;display:flex}.brand-mark{background:linear-gradient(135deg, var(--accent), var(--green));border-radius:3px;width:12px;height:12px}.tabs{gap:4px;display:flex}.tab{color:var(--muted);border-radius:6px;padding:5px 12px;font-weight:500}.tab:hover{color:var(--ink);text-decoration:none}.tab.active{background:var(--gray-bg);color:var(--ink)}.content{flex:1;width:100%;max-width:1200px;margin:0 auto;padding:24px 20px 64px}.loading{color:var(--muted);text-align:center;padding:48px 0}.error-banner{background:var(--red-bg);border:1px solid var(--red);color:var(--red);border-radius:8px;padding:14px 16px}.error-panel{background:var(--surface);border:1px solid var(--red);border-radius:8px;gap:6px;padding:16px;display:grid}.empty-state{background:var(--surface);border:1px dashed var(--line);text-align:center;border-radius:10px;padding:40px}.empty-state pre{text-align:left;background:var(--gray-bg);border-radius:8px;padding:12px 16px;display:inline-block}.notice{background:var(--amber-bg);border:1px solid var(--amber);color:var(--amber);border-radius:8px;margin-bottom:16px;padding:10px 14px}.page-head{flex-wrap:wrap;justify-content:space-between;align-items:flex-end;gap:16px;margin-bottom:16px;display:flex}.page-head h1{letter-spacing:-.01em;margin:0 0 2px;font-size:20px}.page-head .sub{color:var(--muted);margin:0}.controls{flex-wrap:wrap;align-items:center;gap:12px;display:flex}.control label{text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin-bottom:2px;font-size:11px;display:block}select{font:inherit;border:1px solid var(--line);background:var(--surface);border-radius:6px;max-width:320px;padding:5px 8px}.seg{border:1px solid var(--line);background:var(--surface);border-radius:7px;display:inline-flex;overflow:hidden}.seg button{font:inherit;cursor:pointer;color:var(--muted);background:0 0;border:0;padding:5px 12px}.seg button+button{border-left:1px solid var(--line)}.seg button.active{background:var(--ink);color:#fff}.kpi-row{grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;margin-bottom:16px;display:grid}.kpi{background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:12px 14px}.kpi-label{text-transform:uppercase;letter-spacing:.04em;color:var(--muted);font-size:11px}.kpi-val{letter-spacing:-.02em;font-size:22px;font-weight:700}.kpi-meta{color:var(--muted);font-size:12px}.badge{white-space:nowrap;border-radius:999px;align-items:center;gap:5px;padding:1px 9px;font-size:12px;font-weight:600;display:inline-flex}.badge .dot{background:currentColor;border-radius:999px;width:6px;height:6px}.badge.green{background:var(--green-bg);color:var(--green)}.badge.red{background:var(--red-bg);color:var(--red)}.badge.amber{background:var(--amber-bg);color:var(--amber)}.badge.gray{background:var(--gray-bg);color:var(--muted)}.badge.blue{background:var(--accent-bg);color:var(--accent)}.card{background:var(--surface);border:1px solid var(--line);border-radius:10px;margin-bottom:16px}.card>.head{border-bottom:1px solid var(--line);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;padding:12px 16px;display:flex}.card>.head h3{margin:0;font-size:14px}.card>.body{padding:16px;overflow-x:auto}.legend{color:var(--muted);align-items:center;gap:4px;font-size:11px;display:inline-flex}.legend-sw{border-radius:3px;width:22px;height:12px;display:inline-block}.matrix-scroll{padding:8px 16px 16px;overflow-x:auto}.band+.band{border-top:1px solid var(--line)}.band>h4,details.band>summary{margin:0;padding:10px 16px 0;font-size:13px}details.band>summary{cursor:pointer;padding-bottom:10px}.band-notice{margin:12px 16px 0}.band-notice ul{margin:6px 0 0;padding-left:18px}.scroll-hint{color:var(--muted);padding:8px 16px 0;font-size:11px;display:none}table.matrix{border-collapse:separate;border-spacing:4px}table.matrix th{color:var(--muted);text-align:left;white-space:nowrap;padding:6px 8px;font-size:12px;font-weight:600}.matrix-row-feature{color:var(--muted);text-transform:none;letter-spacing:0;margin-top:2px;font-size:10px;font-weight:400;display:block}table.matrix th.matrix-group-head{color:var(--ink);font-size:13px}.matrix-group-sub,.group-sub{color:var(--muted);margin-top:2px;font-size:10px;font-weight:400;display:block}.muted{color:var(--muted);font-size:12px}h3 .group-sub{margin-left:6px;font-size:12px;display:inline}table.matrix td.cell{border-radius:8px;min-width:110px;padding:0;transition:box-shadow .1s;position:relative}.cell-button{appearance:none;border-radius:inherit;width:100%;min-height:78px;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;flex-direction:column;align-items:flex-start;padding:8px 10px;display:flex;position:relative}table.matrix td.cell:hover,table.matrix td.cell:focus-within{outline:2px solid var(--accent);outline-offset:1px}.cell-button:focus-visible{outline:0}.cell-rate{letter-spacing:-.02em;font-size:18px;font-weight:700;display:block}.cell-sub{opacity:.75;font-size:11px;display:block}.agent-dots{gap:4px;margin-top:4px;display:flex}@media (width<=640px){.topbar{gap:8px;padding-inline:12px;overflow-x:auto}.brand,.tabs{flex:none}.content{padding:16px 12px 48px}.controls,.control,.control select{width:100%}.seg{max-width:100%;overflow-x:auto}.scroll-hint{display:block}.matrix-scroll{padding-inline:12px}table.data{min-width:640px}}.agent-dot{border:1px solid #00000040;border-radius:999px;width:9px;height:9px}.flaky-marker{border-top:12px solid var(--amber);border-left:12px solid #0000;border-top-right-radius:8px;width:0;height:0;position:absolute;top:0;right:0}.incomplete-marker{font-size:10px;font-weight:700;position:absolute;bottom:4px;right:6px}.drill-overlay{z-index:30;background:#14161a59;position:fixed;inset:0}.drill{background:var(--surface);border-left:1px solid var(--line);z-index:31;width:min(680px,92vw);padding:20px;position:fixed;top:0;bottom:0;right:0;overflow-y:auto;box-shadow:-12px 0 40px #00000026}.drill h2{margin:0 0 4px;font-size:17px}.drill .sub{color:var(--muted);margin:0 0 16px}.drill-close{border:1px solid var(--line);background:var(--surface);cursor:pointer;font:inherit;border-radius:6px;padding:4px 10px;position:absolute;top:14px;right:14px}.drill-agent{border:1px solid var(--line);border-radius:8px;margin-bottom:12px}.drill-agent>.head{border-bottom:1px solid var(--line);align-items:center;gap:10px;padding:10px 12px;font-weight:600;display:flex}.attempt-row{gap:6px;padding:10px 12px;display:grid}.attempt-row+.attempt-row{border-top:1px solid var(--line)}.attempt-line{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.attempt-line .spacer{flex:1}.crit{border-radius:5px;align-items:center;gap:4px;padding:1px 7px;font-size:11px;display:inline-flex}.crit.pass{background:var(--green-bg);color:var(--green)}.crit.fail{background:var(--red-bg);color:var(--red)}.tag{background:var(--gray-bg);color:var(--muted);border-radius:4px;padding:0 5px;font-size:10px}.telemetry{color:var(--muted);flex-wrap:wrap;gap:12px;font-size:12px;display:flex}.judge-scores{color:var(--muted);font-size:12px}.surface-usage{gap:5px;font-size:12px;display:grid}.usage-badges{flex-wrap:wrap;gap:5px;display:flex}.help-tip{border:1px solid var(--muted);width:15px;height:15px;color:var(--muted);cursor:help;-webkit-user-select:none;user-select:none;border-radius:50%;justify-content:center;align-self:center;align-items:center;font-size:10px;line-height:1;display:inline-flex}.help-tip:hover,.help-tip:focus-visible{color:var(--ink);border-color:var(--ink)}.usage-values{color:var(--muted)}.usage-values summary{cursor:pointer;width:max-content}.usage-values ul{margin:5px 0 0;padding-left:22px}.usage-values code{overflow-wrap:anywhere}table.data{border-collapse:collapse;width:100%}table.data th,table.data td{text-align:left;border-bottom:1px solid var(--line);font-variant-numeric:tabular-nums;padding:7px 10px}table.data th{text-transform:uppercase;letter-spacing:.04em;color:var(--muted);font-size:11px}td.delta-pos{background:var(--green-bg);color:var(--green);font-weight:700}td.delta-neg{background:var(--red-bg);color:var(--red);font-weight:700}td.delta-zero{color:var(--muted)}.identity-controls{border:1px solid var(--line);background:var(--surface);border-radius:8px;margin:0 0 16px;padding:12px 14px}.identity-controls legend{padding:0 5px;font-weight:700}.identity-controls p{color:var(--muted);margin:0 0 10px}.identity-choices{gap:6px;display:grid}.identity-choice{cursor:pointer;align-items:center;gap:8px;display:flex}.identity-choice>span{color:var(--muted);font-size:12px}.identity-choice.disabled{cursor:not-allowed;opacity:.7}.chip-row{flex-wrap:wrap;gap:6px;margin-bottom:12px;display:flex}.chip{font:inherit;border:1px solid var(--line);background:var(--surface);cursor:pointer;color:var(--muted);border-radius:999px;padding:3px 11px;font-size:12px}.chip.active{background:var(--ink);border-color:var(--ink);color:#fff}.rec-card{border:1px solid var(--line);background:var(--surface);border-radius:10px;margin-bottom:12px;padding:14px 16px}.rec-card h3{margin:0 0 6px;font-size:14px}.rec-meta{flex-wrap:wrap;gap:6px;margin-bottom:8px;display:flex}.attribution-arms,.attribution-effects{gap:8px;min-width:270px;display:grid}.attribution-arm,.attribution-effect{border:1px solid var(--line);background:var(--gray-bg);border-radius:7px;gap:5px;padding:8px;display:grid}.attribution-arm-head,.attribution-effect-head{flex-wrap:wrap;align-items:center;gap:7px;display:flex}.attribution-counts,.attribution-interval,.attribution-reason{color:var(--muted);font-size:12px}.evidence-row{flex-wrap:wrap;gap:6px;margin-top:8px;display:flex}.evidence-chip{font-size:12px;font-family:var(--mono);border:1px solid var(--line);background:var(--gray-bg);border-radius:6px;padding:2px 8px}.methodology{color:var(--muted);border-top:1px solid var(--line);margin-top:24px;padding-top:12px;font-size:12px}.viewer-head{flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:12px;margin-bottom:12px;display:flex}.copy-button{font:inherit;border:1px solid var(--line);background:var(--surface);cursor:pointer;border-radius:6px;padding:3px 10px;font-size:12px}.head-actions{align-items:center;gap:8px;display:inline-flex}.toolbar{justify-content:flex-end;margin-bottom:12px;display:flex}.cluster{margin-bottom:24px}
30
30
  </style>