@parhelia/benchmark 0.4.12903 → 0.4.13030

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.
Files changed (42) hide show
  1. package/dist/components/ActiveRunBanner.d.ts +1 -1
  2. package/dist/components/ActiveRunBanner.d.ts.map +1 -1
  3. package/dist/components/ActiveRunBanner.js +6 -4
  4. package/dist/components/BenchmarkCostCorrectnessChart.d.ts +1 -1
  5. package/dist/components/BenchmarkCostCorrectnessChart.d.ts.map +1 -1
  6. package/dist/components/BenchmarkCostCorrectnessChart.js +39 -19
  7. package/dist/components/BenchmarkLeaderboard.d.ts +2 -2
  8. package/dist/components/BenchmarkLeaderboard.d.ts.map +1 -1
  9. package/dist/components/BenchmarkLeaderboard.js +65 -18
  10. package/dist/components/BenchmarkPanel.d.ts.map +1 -1
  11. package/dist/components/BenchmarkPanel.js +87 -18
  12. package/dist/components/BenchmarkRunDetail.d.ts +1 -1
  13. package/dist/components/BenchmarkRunDetail.d.ts.map +1 -1
  14. package/dist/components/BenchmarkRunDetail.js +26 -14
  15. package/dist/components/BenchmarkRunsList.d.ts +1 -1
  16. package/dist/components/BenchmarkRunsList.d.ts.map +1 -1
  17. package/dist/components/BenchmarkRunsList.js +7 -15
  18. package/dist/components/BenchmarkTasksList.d.ts.map +1 -1
  19. package/dist/components/BenchmarkTasksList.js +4 -3
  20. package/dist/components/NotPreparedState.d.ts +1 -1
  21. package/dist/components/NotPreparedState.d.ts.map +1 -1
  22. package/dist/components/NotPreparedState.js +6 -4
  23. package/dist/components/RecoveryBanner.d.ts +1 -1
  24. package/dist/components/RecoveryBanner.d.ts.map +1 -1
  25. package/dist/components/RecoveryBanner.js +2 -2
  26. package/dist/components/RunStatus.d.ts +6 -0
  27. package/dist/components/RunStatus.d.ts.map +1 -0
  28. package/dist/components/RunStatus.js +21 -0
  29. package/dist/components/SafetyViolationsStat.d.ts +10 -2
  30. package/dist/components/SafetyViolationsStat.d.ts.map +1 -1
  31. package/dist/components/SafetyViolationsStat.js +16 -6
  32. package/dist/components/StartBenchmarkDialog.d.ts +1 -1
  33. package/dist/components/StartBenchmarkDialog.d.ts.map +1 -1
  34. package/dist/components/StartBenchmarkDialog.js +58 -22
  35. package/dist/components/TaskChecksList.d.ts +1 -1
  36. package/dist/components/TaskChecksList.d.ts.map +1 -1
  37. package/dist/components/TaskChecksList.js +24 -15
  38. package/dist/index.js +1 -1
  39. package/package.json +1 -1
  40. package/dist/components/RunStatusBadge.d.ts +0 -5
  41. package/dist/components/RunStatusBadge.d.ts.map +0 -1
  42. package/dist/components/RunStatusBadge.js +0 -9
@@ -1,5 +1,5 @@
1
1
  import type { BenchmarkRun } from "../types";
2
- export declare function ActiveRunBanner({ run, queued, open, cancel, busy }: {
2
+ export declare function ActiveRunBanner({ run, queued, open, cancel, busy, }: {
3
3
  run?: BenchmarkRun;
4
4
  queued: BenchmarkRun[];
5
5
  open: (id: string) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"ActiveRunBanner.d.ts","sourceRoot":"","sources":["../../src/components/ActiveRunBanner.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,wBAAgB,eAAe,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,YAAY,EAAE,CAAC;IAAC,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,sCAuB3L"}
1
+ {"version":3,"file":"ActiveRunBanner.d.ts","sourceRoot":"","sources":["../../src/components/ActiveRunBanner.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,wBAAgB,eAAe,CAAC,EAC9B,GAAG,EACH,MAAM,EACN,IAAI,EACJ,MAAM,EACN,IAAI,GACL,EAAE;IACD,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,IAAI,EAAE,OAAO,CAAC;CACf,sCAwDA"}
@@ -1,10 +1,12 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Alert, AlertDescription, AlertTitle, Button, Progress } from "@parhelia/core";
2
+ import { Alert, AlertDescription, AlertTitle, Button, Progress, } from "@parhelia/core";
3
3
  import { Loader2 } from "lucide-react";
4
- export function ActiveRunBanner({ run, queued, open, cancel, busy }) {
4
+ export function ActiveRunBanner({ run, queued, open, cancel, busy, }) {
5
5
  if (!run && !queued.length)
6
6
  return null;
7
7
  const progress = run && run.taskCount > 0 ? (run.tasksCompleted / run.taskCount) * 100 : 0;
8
- const queuedText = queued.length ? `${queued.length} ${queued.length === 1 ? "run" : "runs"} queued` : "";
9
- return _jsxs(Alert, { "data-testid": "benchmark-active-run", variant: "info", role: "status", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin", strokeWidth: 1.5 }), _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-6 gap-y-3", children: [_jsx("div", { className: "min-w-0 flex-1", children: run ? _jsxs(_Fragment, { children: [_jsx(AlertTitle, { children: run.modelName }), _jsxs(AlertDescription, { className: "text-neutral-grey-50", children: [run.tasksCompleted, " / ", run.taskCount, " tasks completed", queuedText && ` · ${queuedText}`] }), _jsx(Progress, { "aria-label": "Benchmark progress", value: progress, showValue: false, className: "bg-feedback-blue/15 mt-2 h-1.5 max-w-md", indicatorClassName: "bg-feedback-blue" })] }) : _jsxs(_Fragment, { children: [_jsx(AlertTitle, { children: "Benchmark queued" }), _jsxs(AlertDescription, { className: "text-neutral-grey-50", children: [queuedText, ". The first run starts as soon as the runner is free."] })] }) }), run && _jsxs("div", { className: "flex shrink-0 gap-2", children: [_jsx(Button, { size: "sm", variant: "outline", onClick: () => open(run.runId), children: "View run" }), _jsx(Button, { size: "sm", variant: "destructive", "data-testid": `benchmark-run-cancel-${run.runId}`, disabled: busy || !!run.cancelRequestedAt, onClick: () => cancel(run.runId), children: run.cancelRequestedAt ? "Stopping…" : "Cancel" })] })] })] });
8
+ const queuedText = queued.length
9
+ ? `${queued.length} ${queued.length === 1 ? "run" : "runs"} queued`
10
+ : "";
11
+ return (_jsxs(Alert, { "data-testid": "benchmark-active-run", role: "status", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin", strokeWidth: 1 }), _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-6 gap-y-3", children: [_jsx("div", { className: "min-w-0 flex-1", children: run ? (_jsxs(_Fragment, { children: [_jsx(AlertTitle, { children: run.modelName }), _jsxs(AlertDescription, { className: "text-neutral-grey-50", children: [run.tasksCompleted, " / ", run.taskCount, " tasks completed", queuedText && ` · ${queuedText}`] }), _jsx(Progress, { "aria-label": "Benchmark progress", value: progress, showValue: false, className: "bg-neutral-grey-10 mt-2 h-1.5 max-w-md", indicatorClassName: "bg-neutral-grey-50" })] })) : (_jsxs(_Fragment, { children: [_jsx(AlertTitle, { children: "Benchmark queued" }), _jsxs(AlertDescription, { className: "text-neutral-grey-50", children: [queuedText, ". The first run starts as soon as the runner is free."] })] })) }), run && (_jsxs("div", { className: "flex shrink-0 gap-2", children: [_jsx(Button, { size: "sm", variant: "outline", onClick: () => open(run.runId), children: "View run" }), _jsx(Button, { size: "sm", variant: "destructive", "data-testid": `benchmark-run-cancel-${run.runId}`, disabled: busy || !!run.cancelRequestedAt, onClick: () => cancel(run.runId), children: run.cancelRequestedAt ? "Stopping…" : "Cancel" })] }))] })] }));
10
12
  }
@@ -1,5 +1,5 @@
1
1
  import type { LeaderboardEntry } from "../types";
2
- export declare function BenchmarkCostCorrectnessChart({ entries }: {
2
+ export declare function BenchmarkCostCorrectnessChart({ entries, }: {
3
3
  entries: LeaderboardEntry[];
4
4
  }): import("react").JSX.Element;
5
5
  //# sourceMappingURL=BenchmarkCostCorrectnessChart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BenchmarkCostCorrectnessChart.d.ts","sourceRoot":"","sources":["../../src/components/BenchmarkCostCorrectnessChart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAMjD,wBAAgB,6BAA6B,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAAE,+BAmEzF"}
1
+ {"version":3,"file":"BenchmarkCostCorrectnessChart.d.ts","sourceRoot":"","sources":["../../src/components/BenchmarkCostCorrectnessChart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAajD,wBAAgB,6BAA6B,CAAC,EAC5C,OAAO,GACR,EAAE;IACD,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B,+BAwNA"}
@@ -1,36 +1,56 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useId, useState } from "react";
3
3
  import { cost, percent } from "../format";
4
- const colors = ["text-feedback-blue", "text-feedback-green", "text-highlight-100", "text-feedback-orange", "text-highlight-secondary-100"];
4
+ const colors = [
5
+ "text-feedback-blue",
6
+ "text-feedback-green",
7
+ "text-highlight-100",
8
+ "text-feedback-orange",
9
+ "text-highlight-secondary-100",
10
+ ];
5
11
  const plot = { left: 76, top: 36, width: 608, height: 224 };
6
12
  const keyOf = (entry) => `${entry.modelItemId}:${entry.modelConfigFingerprint}`;
7
- export function BenchmarkCostCorrectnessChart({ entries }) {
13
+ export function BenchmarkCostCorrectnessChart({ entries, }) {
8
14
  const titleId = useId();
9
15
  const descriptionId = useId();
10
16
  const [activeKey, setActiveKey] = useState();
11
- const points = entries.filter((entry) => entry.costKnown && entry.medianCoreCost != null && Number.isFinite(entry.medianCoreCost) && entry.medianCoreCost >= 0 &&
12
- Number.isFinite(entry.medianCorrectnessPercent) && entry.medianCorrectnessPercent >= 0 && entry.medianCorrectnessPercent <= 100);
17
+ const points = entries.filter((entry) => entry.costKnown &&
18
+ entry.medianCoreCost != null &&
19
+ Number.isFinite(entry.medianCoreCost) &&
20
+ entry.medianCoreCost >= 0 &&
21
+ Number.isFinite(entry.medianCorrectnessPercent) &&
22
+ entry.medianCorrectnessPercent >= 0 &&
23
+ entry.medianCorrectnessPercent <= 100);
13
24
  const omitted = entries.length - points.length;
14
- const maxCost = Math.max(0, ...points.map(entry => entry.medianCoreCost));
25
+ const maxCost = Math.max(0, ...points.map((entry) => entry.medianCoreCost));
15
26
  // Leave room for markers at the right edge, including when every cost is zero.
16
27
  const costLimit = maxCost > 0 ? maxCost * 1.1 : 0.01;
17
- const active = points.find(entry => keyOf(entry) === activeKey);
28
+ const active = points.find((entry) => keyOf(entry) === activeKey);
18
29
  const describe = (entry) => `${entry.modelName} · ${entry.providerName} · ${entry.configLabel}: ${cost(entry.medianCoreCost)} core cost, ${percent(entry.medianCorrectnessPercent)} correctness, ${entry.runCount} ${entry.runCount === 1 ? "run" : "runs"}, ${percent(entry.coveragePercent)} coverage`;
19
- return _jsxs("section", { "aria-labelledby": titleId, className: "border-border-default rounded-lg border p-4", "data-testid": "benchmark-cost-correctness-chart", children: [_jsx("h4", { id: titleId, className: "text-neutral-grey-100 text-sm font-medium", children: "Cost / correctness" }), _jsx("p", { id: descriptionId, className: "text-neutral-grey-50 mt-1 text-xs", children: "Median core cost and correctness per model configuration. Upper left means lower cost and higher correctness." }), !points.length ? _jsx("p", { className: "text-neutral-grey-50 py-8 text-center text-sm", children: "Complete a full-suite run with known cost to compare models here." }) : _jsxs(_Fragment, { children: [_jsx("div", { className: "overflow-x-auto", children: _jsxs("svg", { viewBox: "0 0 720 324", className: "mt-3 w-full min-w-[480px]", role: "img", "aria-labelledby": titleId, "aria-describedby": descriptionId, children: [_jsx("text", { x: plot.left, y: 16, className: "fill-current text-neutral-grey-50", fontSize: 11, children: "Correctness (%)" }), [0, 25, 50, 75, 100].map(value => {
30
+ return (_jsxs("section", { "aria-labelledby": titleId, className: "border-border-default rounded-lg border p-4", "data-testid": "benchmark-cost-correctness-chart", children: [_jsx("h4", { id: titleId, className: "text-neutral-grey-100 text-xs font-medium", children: "Cost / correctness" }), _jsx("p", { id: descriptionId, className: "text-neutral-grey-50 mt-1 text-xs", children: "Median core cost and correctness per model configuration. Upper left means lower cost and higher correctness." }), !points.length ? (_jsx("p", { className: "text-neutral-grey-50 py-8 text-center text-xs", children: "Complete a full-suite run with known cost to compare models here." })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "overflow-x-auto", children: _jsxs("svg", { viewBox: "0 0 720 324",
31
+ // Never wider than its 720-unit drawing, so the 11px labels stay 11px in a wide card.
32
+ className: "mx-auto mt-3 w-full max-w-[720px] min-w-[480px]", role: "img", "aria-labelledby": titleId, "aria-describedby": descriptionId, children: [_jsx("text", { x: plot.left, y: 16, className: "fill-current text-neutral-grey-50", fontSize: 11, children: "Correctness (%)" }), [0, 25, 50, 75, 100].map((value) => {
20
33
  const y = plot.top + plot.height * (1 - value / 100);
21
- return _jsxs("g", { children: [_jsx("line", { x1: plot.left, x2: plot.left + plot.width, y1: y, y2: y, className: "text-border-default", stroke: "currentColor", strokeDasharray: "3 4" }), _jsxs("text", { x: plot.left - 18, y: y + 4, textAnchor: "end", className: "fill-current text-neutral-grey-50", fontSize: 11, children: [value, "%"] })] }, value);
22
- }), [0, 1, 2, 3, 4].map(tick => {
23
- const x = plot.left + plot.width * tick / 4;
24
- const value = costLimit * tick / 4;
34
+ return (_jsxs("g", { children: [_jsx("line", { x1: plot.left, x2: plot.left + plot.width, y1: y, y2: y, className: "text-border-default", stroke: "currentColor", strokeDasharray: "3 4" }), _jsxs("text", { x: plot.left - 18, y: y + 4, textAnchor: "end", className: "fill-current text-neutral-grey-50", fontSize: 11, children: [value, "%"] })] }, value));
35
+ }), [0, 1, 2, 3, 4].map((tick) => {
36
+ const x = plot.left + (plot.width * tick) / 4;
37
+ const value = (costLimit * tick) / 4;
25
38
  // Preserve distinct tick labels for very small benchmark costs.
26
- const label = value > 0 && value < 0.0001 ? `$${value.toExponential(1)}` : cost(value);
27
- return _jsxs("g", { children: [_jsx("line", { x1: x, x2: x, y1: plot.top, y2: plot.top + plot.height, className: "text-border-default", stroke: "currentColor", strokeDasharray: "3 4" }), _jsx("text", { x: x, y: plot.top + plot.height + 24, textAnchor: "middle", className: "fill-current text-neutral-grey-50", fontSize: 11, children: label })] }, tick);
28
- }), _jsx("text", { x: plot.left + plot.width / 2, y: 316, textAnchor: "middle", className: "fill-current text-neutral-grey-50", fontSize: 11, children: "Core cost (USD)" }), points.map((entry, index) => ({ entry, index }))
29
- .sort((a, b) => Number(keyOf(a.entry) === activeKey) - Number(keyOf(b.entry) === activeKey))
39
+ const label = value > 0 && value < 0.0001
40
+ ? `$${value.toExponential(1)}`
41
+ : cost(value);
42
+ return (_jsxs("g", { children: [_jsx("line", { x1: x, x2: x, y1: plot.top, y2: plot.top + plot.height, className: "text-border-default", stroke: "currentColor", strokeDasharray: "3 4" }), _jsx("text", { x: x, y: plot.top + plot.height + 24, textAnchor: "middle", className: "fill-current text-neutral-grey-50", fontSize: 11, children: label })] }, tick));
43
+ }), _jsx("text", { x: plot.left + plot.width / 2, y: 316, textAnchor: "middle", className: "fill-current text-neutral-grey-50", fontSize: 11, children: "Core cost (USD)" }), points
44
+ .map((entry, index) => ({ entry, index }))
45
+ .sort((a, b) => Number(keyOf(a.entry) === activeKey) -
46
+ Number(keyOf(b.entry) === activeKey))
30
47
  .map(({ entry, index }) => {
31
48
  const key = keyOf(entry);
32
- const x = plot.left + entry.medianCoreCost / costLimit * plot.width;
33
- const y = plot.top + (1 - entry.medianCorrectnessPercent / 100) * plot.height;
34
- return _jsxs("g", { className: colors[index % colors.length], opacity: active && activeKey !== key ? 0.3 : 1, onMouseEnter: () => setActiveKey(key), onMouseLeave: () => setActiveKey(undefined), onClick: () => setActiveKey(key), children: [_jsx("title", { children: describe(entry) }), _jsx("circle", { cx: x, cy: y, r: activeKey === key ? 13 : 11, fill: "currentColor" }), _jsx("text", { x: x, y: y, dy: "0.35em", textAnchor: "middle", className: "fill-current text-white", fontSize: 10, fontWeight: 600, children: index + 1 })] }, key);
35
- })] }) }), _jsx("p", { className: "text-neutral-grey-50 mt-2 min-h-8 text-xs", "aria-live": "polite", children: active ? describe(active) : "Hover a point or focus a configuration below to inspect its results." }), _jsx("div", { className: "mt-2 grid gap-1 sm:grid-cols-2", children: points.map((entry, index) => _jsxs("button", { type: "button", "aria-label": describe(entry), className: `flex min-w-0 items-start gap-2 rounded p-2 text-left text-xs hover:bg-neutral-grey-5 focus-visible:outline-2 focus-visible:outline-offset-2 ${activeKey === keyOf(entry) ? "bg-neutral-grey-5" : ""}`, onMouseEnter: () => setActiveKey(keyOf(entry)), onMouseLeave: () => setActiveKey(undefined), onFocus: () => setActiveKey(keyOf(entry)), onBlur: () => setActiveKey(undefined), onClick: () => setActiveKey(keyOf(entry)), children: [_jsx("span", { className: `w-5 shrink-0 text-center font-semibold tabular-nums ${colors[index % colors.length]}`, children: index + 1 }), _jsxs("span", { className: "min-w-0 break-words", children: [_jsx("span", { className: "text-neutral-grey-100 font-medium", children: entry.modelName }), _jsxs("span", { className: "text-neutral-grey-50 block", children: [entry.providerName, " \u00B7 ", entry.configLabel] })] })] }, keyOf(entry))) })] }), omitted > 0 && _jsxs("p", { className: "text-neutral-grey-50 mt-3 text-xs", children: [omitted, " ", omitted === 1 ? "configuration is" : "configurations are", " not plotted because cost or correctness is unavailable."] })] });
49
+ const x = plot.left + (entry.medianCoreCost / costLimit) * plot.width;
50
+ const y = plot.top +
51
+ (1 - entry.medianCorrectnessPercent / 100) * plot.height;
52
+ return (_jsxs("g", { className: colors[index % colors.length], opacity: active && activeKey !== key ? 0.3 : 1, onMouseEnter: () => setActiveKey(key), onMouseLeave: () => setActiveKey(undefined), onClick: () => setActiveKey(key), children: [_jsx("title", { children: describe(entry) }), _jsx("circle", { cx: x, cy: y, r: activeKey === key ? 13 : 11, fill: "currentColor" }), _jsx("text", { x: x, y: y, dy: "0.35em", textAnchor: "middle", className: "fill-current text-white", fontSize: 10, fontWeight: 600, children: index + 1 })] }, key));
53
+ })] }) }), _jsx("p", { className: "text-neutral-grey-50 mt-2 min-h-8 text-xs", "aria-live": "polite", children: active
54
+ ? describe(active)
55
+ : "Hover a point or focus a configuration below to inspect its results." }), _jsx("div", { className: "mt-2 grid gap-1 sm:grid-cols-2", children: points.map((entry, index) => (_jsxs("button", { type: "button", "aria-label": describe(entry), className: `flex min-w-0 items-start gap-2 rounded p-2 text-left text-xs hover:bg-neutral-grey-5 focus-visible:outline-2 focus-visible:outline-offset-2 ${activeKey === keyOf(entry) ? "bg-neutral-grey-5" : ""}`, onMouseEnter: () => setActiveKey(keyOf(entry)), onMouseLeave: () => setActiveKey(undefined), onFocus: () => setActiveKey(keyOf(entry)), onBlur: () => setActiveKey(undefined), onClick: () => setActiveKey(keyOf(entry)), children: [_jsx("span", { className: `w-5 shrink-0 text-center font-medium tabular-nums ${colors[index % colors.length]}`, children: index + 1 }), _jsxs("span", { className: "min-w-0 break-words", children: [_jsx("span", { className: "text-neutral-grey-100 font-medium", children: entry.modelName }), _jsxs("span", { className: "text-neutral-grey-50 block", children: [entry.providerName, " \u00B7 ", entry.configLabel] })] })] }, keyOf(entry)))) })] })), omitted > 0 && (_jsxs("p", { className: "text-neutral-grey-50 mt-3 text-xs", children: [omitted, " ", omitted === 1 ? "configuration is" : "configurations are", " ", "not plotted because cost or correctness is unavailable."] }))] }));
36
56
  }
@@ -21,9 +21,9 @@ declare const metrics: readonly [{
21
21
  readonly value: "medianWallDurationMs";
22
22
  readonly label: "Duration";
23
23
  }];
24
- type Metric = typeof metrics[number]["value"];
24
+ type Metric = (typeof metrics)[number]["value"];
25
25
  export declare function sortedEntries(entries: LeaderboardEntry[], metric: Metric): LeaderboardEntry[];
26
- export declare function BenchmarkLeaderboard({ entries }: {
26
+ export declare function BenchmarkLeaderboard({ entries, }: {
27
27
  entries: LeaderboardEntry[];
28
28
  }): import("react").JSX.Element;
29
29
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"BenchmarkLeaderboard.d.ts","sourceRoot":"","sources":["../../src/components/BenchmarkLeaderboard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGjD,QAAA,MAAM,OAAO;aACT,KAAK,EAAE,0BAA0B;aAAE,KAAK,EAAE,aAAa;;aAAM,KAAK,EAAE,yBAAyB;aAAE,KAAK,EAAE,YAAY;;aAClH,KAAK,EAAE,wBAAwB;aAAE,KAAK,EAAE,YAAY;;aAAM,KAAK,EAAE,gBAAgB;aAAE,KAAK,EAAE,WAAW;;aACrG,KAAK,EAAE,+BAA+B;aAAE,KAAK,EAAE,4BAA4B;;aAAM,KAAK,EAAE,cAAc;aAAE,KAAK,EAAE,QAAQ;;aAAM,KAAK,EAAE,sBAAsB;aAAE,KAAK,EAAE,UAAU;EACvK,CAAC;AACX,KAAK,MAAM,GAAG,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AAC9C,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,MAAM,EAAE,MAAM,sBAGxE;AAED,wBAAgB,oBAAoB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAAE,+BAsBhF"}
1
+ {"version":3,"file":"BenchmarkLeaderboard.d.ts","sourceRoot":"","sources":["../../src/components/BenchmarkLeaderboard.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGjD,QAAA,MAAM,OAAO;aACT,KAAK,EAAE,0BAA0B;aAAE,KAAK,EAAE,aAAa;;aACvD,KAAK,EAAE,yBAAyB;aAAE,KAAK,EAAE,YAAY;;aACrD,KAAK,EAAE,wBAAwB;aAAE,KAAK,EAAE,YAAY;;aACpD,KAAK,EAAE,gBAAgB;aAAE,KAAK,EAAE,WAAW;;aAE3C,KAAK,EAAE,+BAA+B;aACtC,KAAK,EAAE,4BAA4B;;aAEnC,KAAK,EAAE,cAAc;aAAE,KAAK,EAAE,QAAQ;;aACtC,KAAK,EAAE,sBAAsB;aAAE,KAAK,EAAE,UAAU;EAC1C,CAAC;AACX,KAAK,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AAChD,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,MAAM,EAAE,MAAM,sBAUxE;AAED,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,GACR,EAAE;IACD,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B,+BA6IA"}
@@ -1,29 +1,76 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo, useState } from "react";
3
- import { Badge, Select, SimpleTable } from "@parhelia/core";
2
+ import { Fragment, useMemo, useState } from "react";
3
+ import { Select, SettingsEmptyState, cn, settingsTable, settingsText, } from "@parhelia/core";
4
+ import { Trophy } from "lucide-react";
4
5
  import { cost, count, duration, percent } from "../format";
5
6
  import { BenchmarkCostCorrectnessChart } from "./BenchmarkCostCorrectnessChart";
6
7
  const metrics = [
7
- { value: "medianCorrectnessPercent", label: "Correctness" }, { value: "medianEfficiencyPercent", label: "Efficiency" },
8
- { value: "medianFullScorePercent", label: "Full score" }, { value: "medianCoreCost", label: "Core cost" },
9
- { value: "medianCostPerCorrectnessPoint", label: "Cost per correctness point" }, { value: "medianTokens", label: "Tokens" }, { value: "medianWallDurationMs", label: "Duration" },
8
+ { value: "medianCorrectnessPercent", label: "Correctness" },
9
+ { value: "medianEfficiencyPercent", label: "Efficiency" },
10
+ { value: "medianFullScorePercent", label: "Full score" },
11
+ { value: "medianCoreCost", label: "Core cost" },
12
+ {
13
+ value: "medianCostPerCorrectnessPoint",
14
+ label: "Cost per correctness point",
15
+ },
16
+ { value: "medianTokens", label: "Tokens" },
17
+ { value: "medianWallDurationMs", label: "Duration" },
10
18
  ];
11
19
  export function sortedEntries(entries, metric) {
12
20
  const costMetric = metric === "medianCoreCost" || metric === "medianCostPerCorrectnessPoint";
13
- return entries.filter(e => e[metric] != null && (!costMetric || e.costKnown)).sort((a, b) => ((a[metric] ?? 0) - (b[metric] ?? 0)) * (metric.endsWith("Percent") ? -1 : 1));
21
+ return entries
22
+ .filter((e) => e[metric] != null && (!costMetric || e.costKnown))
23
+ .sort((a, b) => ((a[metric] ?? 0) - (b[metric] ?? 0)) *
24
+ (metric.endsWith("Percent") ? -1 : 1));
14
25
  }
15
- const numeric = "text-neutral-grey-100 tabular-nums";
16
- export function BenchmarkLeaderboard({ entries }) {
26
+ const numeric = "text-right whitespace-nowrap tabular-nums";
27
+ export function BenchmarkLeaderboard({ entries, }) {
17
28
  const [metric, setMetric] = useState("medianCorrectnessPercent");
18
29
  const rows = useMemo(() => sortedEntries(entries, metric), [entries, metric]);
19
- const metricValue = (e) => metric.endsWith("Percent") ? percent(e[metric]) : metric === "medianTokens" ? count(e[metric]) : metric === "medianWallDurationMs" ? duration(e[metric]) : cost(e[metric], e.costKnown);
20
- return _jsxs("div", { "data-testid": "benchmark-leaderboard", className: "space-y-4", children: [_jsx(BenchmarkCostCorrectnessChart, { entries: entries }), _jsx("div", { className: "flex flex-wrap items-center justify-end gap-3", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("label", { htmlFor: "benchmark-leaderboard-metric", className: "text-neutral-grey-50 text-xs font-medium", children: "Rank by" }), _jsx(Select, { id: "benchmark-leaderboard-metric", "data-testid": "benchmark-leaderboard-metric", className: "w-56", value: metric, onValueChange: v => setMetric(v), options: [...metrics] })] }) }), !rows.length ? _jsx("p", { className: "text-neutral-grey-50 py-10 text-center text-sm", children: "No comparable runs for this metric yet. Complete a full-suite run to see models ranked here." }) : _jsx("div", { className: "overflow-x-auto", children: _jsx(SimpleTable, { items: rows, rowKey: r => r.modelItemId + r.modelConfigFingerprint, rowTestId: () => "benchmark-leaderboard-row", columns: [
21
- { header: "#", body: r => _jsx("span", { className: "text-neutral-grey-50 tabular-nums", children: rows.indexOf(r) + 1 }), className: "w-8" },
22
- { header: "Model / configuration", body: r => _jsxs("div", { children: [_jsx("p", { className: "text-neutral-grey-100 text-sm font-medium", children: r.modelName }), _jsxs("p", { className: "text-neutral-grey-50", children: [r.providerName, " \u00B7 ", r.configLabel] })] }) },
23
- { header: metrics.find(m => m.value === metric)?.label, body: r => _jsx("span", { className: `${numeric} text-sm font-medium`, children: metricValue(r) }), align: "right" },
24
- ...(metric !== "medianCorrectnessPercent" ? [{ header: "Correctness", body: (r) => _jsx("span", { className: numeric, children: percent(r.medianCorrectnessPercent) }), align: "right" }] : []),
25
- ...(metric !== "medianEfficiencyPercent" ? [{ header: "Efficiency", body: (r) => _jsx("span", { className: numeric, children: percent(r.medianEfficiencyPercent) }), align: "right" }] : []),
26
- ...(metric !== "medianCoreCost" ? [{ header: "Core cost", body: (r) => _jsx("span", { className: numeric, children: cost(r.medianCoreCost, r.costKnown) }), align: "right" }] : []),
27
- { header: "Evidence", body: r => _jsxs("div", { className: "flex flex-wrap gap-1", children: [_jsxs(Badge, { children: [r.runCount, " ", r.runCount === 1 ? "run" : "runs"] }), _jsxs(Badge, { variant: "secondary", children: [percent(r.coveragePercent), " coverage"] }), !r.costKnown && _jsx(Badge, { variant: "secondary", children: "Cost unknown" }), r.staleRunCount > 0 && _jsxs(Badge, { variant: "outline", children: [r.staleRunCount, " older suite"] })] }) },
28
- ] }) })] });
30
+ const metricValue = (e) => metric.endsWith("Percent")
31
+ ? percent(e[metric])
32
+ : metric === "medianTokens"
33
+ ? count(e[metric])
34
+ : metric === "medianWallDurationMs"
35
+ ? duration(e[metric])
36
+ : cost(e[metric], e.costKnown);
37
+ const columns = [
38
+ {
39
+ header: metrics.find((m) => m.value === metric)?.label,
40
+ body: (r) => metricValue(r),
41
+ strong: true,
42
+ },
43
+ ...(metric !== "medianCorrectnessPercent"
44
+ ? [
45
+ {
46
+ header: "Correctness",
47
+ body: (r) => percent(r.medianCorrectnessPercent),
48
+ },
49
+ ]
50
+ : []),
51
+ ...(metric !== "medianEfficiencyPercent"
52
+ ? [
53
+ {
54
+ header: "Efficiency",
55
+ body: (r) => percent(r.medianEfficiencyPercent),
56
+ },
57
+ ]
58
+ : []),
59
+ ...(metric !== "medianCoreCost"
60
+ ? [
61
+ {
62
+ header: "Core cost",
63
+ body: (r) => cost(r.medianCoreCost, r.costKnown),
64
+ },
65
+ ]
66
+ : []),
67
+ ];
68
+ return (_jsxs("div", { "data-testid": "benchmark-leaderboard", className: "flex flex-col gap-4", children: [_jsx(BenchmarkCostCorrectnessChart, { entries: entries }), _jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [_jsx("label", { htmlFor: "benchmark-leaderboard-metric", className: settingsText.caption, children: "Rank by" }), _jsx(Select, { id: "benchmark-leaderboard-metric", "data-testid": "benchmark-leaderboard-metric", className: "w-56", value: metric, onValueChange: (v) => setMetric(v), options: [...metrics] })] }), !rows.length ? (_jsx(SettingsEmptyState, { icon: Trophy, title: "No comparable runs for this metric yet.", description: "Complete a full-suite run to see models ranked here." })) : (_jsx("div", { className: "-mx-4 overflow-x-auto md:-mx-6", children: _jsxs("table", { className: cn(settingsTable.table, settingsTable.inset), children: [_jsx("thead", { className: settingsTable.head, children: _jsxs("tr", { children: [_jsx("th", { className: cn(settingsTable.th, "w-8"), children: "#" }), _jsx("th", { className: settingsTable.th, children: "Model / configuration" }), columns.map((column) => (_jsx("th", { className: cn(settingsTable.th, "text-right"), children: column.header }, column.header))), _jsx("th", { className: settingsTable.th, children: "Evidence" })] }) }), _jsx("tbody", { children: rows.map((r, index) => (_jsxs("tr", { "data-testid": "benchmark-leaderboard-row", className: settingsTable.row, children: [_jsx("td", { className: cn(settingsTable.td, "text-neutral-grey-50 tabular-nums"), children: index + 1 }), _jsxs("td", { className: settingsTable.td, children: [_jsx("div", { className: settingsText.label, children: r.modelName }), _jsxs("div", { className: settingsText.meta, children: [r.providerName, " \u00B7 ", r.configLabel] })] }), columns.map((column) => (_jsx("td", { className: cn(settingsTable.td, numeric, column.strong && "font-medium"), children: column.body(r) }, column.header))), _jsx("td", { className: cn(settingsTable.td, settingsText.meta), children: [
69
+ `${r.runCount} ${r.runCount === 1 ? "run" : "runs"}`,
70
+ `${percent(r.coveragePercent)} coverage`,
71
+ !r.costKnown && "Cost unknown",
72
+ r.staleRunCount > 0 && `${r.staleRunCount} older suite`,
73
+ ]
74
+ .filter((note) => !!note)
75
+ .map((note, index) => (_jsxs(Fragment, { children: [index > 0 && " · ", _jsx("span", { children: note })] }, note))) })] }, r.modelItemId + r.modelConfigFingerprint))) })] }) }))] }));
29
76
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BenchmarkPanel.d.ts","sourceRoot":"","sources":["../../src/components/BenchmarkPanel.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,cAAc,gCAoF7B"}
1
+ {"version":3,"file":"BenchmarkPanel.d.ts","sourceRoot":"","sources":["../../src/components/BenchmarkPanel.tsx"],"names":[],"mappings":"AAqEA,wBAAgB,cAAc,gCAiT7B"}
@@ -1,11 +1,26 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useRef, useState } from "react";
3
- import { Alert, AlertDescription, AlertTitle, Button, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, LoadingState, MultiSwitchButton, SettingsPanelLayout, useRequiredSettingsHeaderActions } from "@parhelia/core";
3
+ import { Alert, AlertDescription, AlertTitle, Button, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, LoadingState, MultiSwitchButton, SettingsCard, SettingsPanelLayout, settingsText, useRequiredSettingsHeaderActions, } from "@parhelia/core";
4
4
  import { AlertCircle, History, ListChecks, Trash2, Trophy } from "lucide-react";
5
5
  const views = [
6
- { value: "leaderboard", label: "Leaderboard", icon: Trophy, description: "Medians of completed full-suite runs on the current suite. Each model configuration is ranked separately." },
7
- { value: "runs", label: "Runs", icon: History, description: "Every benchmark run, newest first. Open a run to inspect its tasks, checks and agent conversations." },
8
- { value: "tasks", label: "Tasks", icon: ListChecks, description: "The task suite. Every task runs on a fresh, isolated content copy with its own tool-call, cost and time budget." },
6
+ {
7
+ value: "leaderboard",
8
+ label: "Leaderboard",
9
+ icon: Trophy,
10
+ description: "Medians of completed full-suite runs on the current suite. Each model configuration is ranked separately.",
11
+ },
12
+ {
13
+ value: "runs",
14
+ label: "Runs",
15
+ icon: History,
16
+ description: "Every benchmark run, newest first. Open a run to inspect its tasks, checks and agent conversations.",
17
+ },
18
+ {
19
+ value: "tasks",
20
+ label: "Tasks",
21
+ icon: ListChecks,
22
+ description: "The task suite. Every task runs on a fresh, isolated content copy with its own tool-call, cost and time budget.",
23
+ },
9
24
  ];
10
25
  import { toast } from "sonner";
11
26
  import { benchmarkService } from "../services/benchmarkService";
@@ -21,7 +36,7 @@ import { BenchmarkRunsList } from "./BenchmarkRunsList";
21
36
  import { BenchmarkRunDetail } from "./BenchmarkRunDetail";
22
37
  import { BenchmarkTasksList } from "./BenchmarkTasksList";
23
38
  export function BenchmarkPanel() {
24
- const { status, error: statusError, refresh: refreshStatus } = useBenchmarkStatus();
39
+ const { status, error: statusError, refresh: refreshStatus, } = useBenchmarkStatus();
25
40
  const [entries, setEntries] = useState([]);
26
41
  const [runs, setRuns] = useState([]);
27
42
  const [tasks, setTasks] = useState([]);
@@ -37,14 +52,19 @@ export function BenchmarkPanel() {
37
52
  const setActions = useRequiredSettingsHeaderActions();
38
53
  const generation = useRef(0);
39
54
  const ready = status?.prepared.ready === true;
40
- const canStart = ready && !busy && !status?.activeRun && !status?.queuedRuns.length && !status?.tasksAwaitingRecovery.length;
55
+ const canStart = ready &&
56
+ !busy &&
57
+ !status?.activeRun &&
58
+ !status?.queuedRuns.length &&
59
+ !status?.tasksAwaitingRecovery.length;
41
60
  const refresh = useCallback(async () => {
42
61
  if (!ready)
43
62
  return;
44
63
  const version = ++generation.current;
45
64
  try {
46
65
  const [leaderboard, catalog, history, selected] = await Promise.all([
47
- benchmarkService.leaderboard(), benchmarkService.tasks(),
66
+ benchmarkService.leaderboard(),
67
+ benchmarkService.tasks(),
48
68
  Promise.all(Array.from({ length: pages }, (_, i) => benchmarkService.runs(i * 25))),
49
69
  runId ? benchmarkService.run(runId) : Promise.resolve(undefined),
50
70
  ]);
@@ -52,7 +72,7 @@ export function BenchmarkPanel() {
52
72
  return;
53
73
  setEntries(leaderboard.entries);
54
74
  setTasks(catalog.tasks);
55
- setRuns(history.flatMap(h => h.runs));
75
+ setRuns(history.flatMap((h) => h.runs));
56
76
  setTotal(history[0]?.total ?? 0);
57
77
  setDetail(selected);
58
78
  setError(undefined);
@@ -64,11 +84,19 @@ export function BenchmarkPanel() {
64
84
  }, [pages, ready, runId]);
65
85
  useEffect(() => {
66
86
  const initial = setTimeout(refresh, 0);
67
- const invalidate = () => { generation.current++; };
68
- return () => { clearTimeout(initial); invalidate(); };
87
+ const invalidate = () => {
88
+ generation.current++;
89
+ };
90
+ return () => {
91
+ clearTimeout(initial);
92
+ invalidate();
93
+ };
69
94
  }, [refresh]);
70
95
  useBenchmarkRunUpdates(refresh, !!status?.activeRun || !!status?.queuedRuns.length);
71
- useEffect(() => { setActions(_jsx(Button, { "data-testid": "benchmark-start-button", disabled: !canStart, onClick: () => setStartOpen(true), children: "Start benchmark" })); return () => setActions(null); }, [canStart, setActions]);
96
+ useEffect(() => {
97
+ setActions(_jsx(Button, { size: "sm", "data-testid": "benchmark-start-button", disabled: !canStart, onClick: () => setStartOpen(true), children: "Start benchmark" }));
98
+ return () => setActions(null);
99
+ }, [canStart, setActions]);
72
100
  const perform = async (operation) => {
73
101
  setBusy(true);
74
102
  try {
@@ -92,12 +120,53 @@ export function BenchmarkPanel() {
92
120
  }
93
121
  void perform(() => benchmarkService[action](id)).catch(() => undefined);
94
122
  };
95
- const start = async (request) => { await perform(async () => { const result = await benchmarkService.start(request); setStartOpen(false); selectRun(result.runIds[0] ?? null); toast.success("Benchmark queued"); }); };
96
- const open = (id) => { setDetail(undefined); selectRun(id); };
123
+ const start = async (request) => {
124
+ await perform(async () => {
125
+ const result = await benchmarkService.start(request);
126
+ setStartOpen(false);
127
+ selectRun(result.runIds[0] ?? null);
128
+ toast.success("Benchmark queued");
129
+ });
130
+ };
131
+ const open = (id) => {
132
+ setDetail(undefined);
133
+ selectRun(id);
134
+ };
97
135
  const purge = confirmation?.action === "purge";
98
- const current = views.find(v => v.value === view) ?? views[0];
99
- return _jsxs(SettingsPanelLayout, { testId: "benchmark-panel", contentClassName: "flex flex-col gap-4", children: [(statusError || error) && _jsxs(Alert, { variant: "destructive", children: [_jsx(AlertCircle, { className: "h-4 w-4", strokeWidth: 1.5 }), _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { children: [_jsx(AlertTitle, { children: "Benchmark unavailable" }), _jsx(AlertDescription, { children: statusError || error })] }), _jsx(Button, { size: "sm", variant: "outline", onClick: () => { void refreshStatus(); void refresh(); }, children: "Retry" })] })] }), !status && !statusError && _jsx(LoadingState, { message: "Loading benchmark\u2026" }), status && _jsxs(_Fragment, { children: [!ready && _jsx(NotPreparedState, { status: status, busy: busy, prepare: () => { void perform(benchmarkService.prepare).catch(() => undefined); } }), _jsx(RecoveryBanner, { tasks: status.tasksAwaitingRecovery, busy: busy, recover: () => { void perform(() => benchmarkService.recover()).catch(() => undefined); } }), !runId && _jsx(ActiveRunBanner, { run: status.activeRun, queued: status.queuedRuns, busy: busy, open: open, cancel: id => act("cancel", id) }), ready && (runId ? detail ? _jsx(BenchmarkRunDetail, { detail: detail, busy: busy, cancel: id => act("cancel", id), back: () => { selectRun(null); setView("runs"); } }) : _jsx(LoadingState, { message: "Loading run\u2026" }) : _jsxs("section", { className: "overflow-hidden rounded-lg bg-white", "data-testid": `benchmark-view-${view}`, children: [_jsx("div", { className: "border-border-default border-b px-4 py-3", children: _jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between", children: [_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [_jsx(current.icon, { className: "text-neutral-grey-50 h-4 w-4 shrink-0", strokeWidth: 1 }), _jsxs("div", { className: "min-w-0", children: [_jsx("h3", { className: "text-neutral-grey-100 text-sm font-medium", children: current.label }), _jsx("p", { className: "text-neutral-grey-50 text-xs", children: current.description })] })] }), _jsx(MultiSwitchButton, { value: view, onValueChange: setView, options: views.map(({ value, label }) => ({ value, label })), className: "w-full shrink-0 sm:w-80", "aria-label": "Benchmark view", testId: "benchmark-view-switch" })] }) }), _jsxs("div", { className: "p-4", children: [view === "leaderboard" && _jsx(BenchmarkLeaderboard, { entries: entries }), view === "runs" && _jsxs("div", { className: "space-y-6", children: [_jsx(BenchmarkRunsList, { runs: runs, total: total, busy: busy, open: open, act: act, more: () => setPages(p => p + 1) }), !!runs.length && _jsxs("div", { className: "border-border-default flex flex-wrap items-center justify-between gap-3 border-t pt-4", children: [_jsx("p", { className: "text-neutral-grey-50 text-xs", children: "Completed runs keep their agent conversations until they are deleted." }), _jsxs(Button, { size: "sm", variant: "outline", disabled: busy, onClick: () => setConfirmation({ action: "purge" }), children: [_jsx(Trash2, { strokeWidth: 1.5 }), "Purge completed history"] })] })] }), view === "tasks" && _jsx(BenchmarkTasksList, { tasks: tasks })] })] }))] }), _jsx(StartBenchmarkDialog, { open: startOpen, onOpenChange: setStartOpen, start: start, busy: busy }), _jsx(Dialog, { open: !!confirmation, onOpenChange: value => { if (!value)
100
- setConfirmation(undefined); }, children: _jsxs(DialogContent, { className: "max-w-lg gap-6", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: purge ? "Purge completed benchmark history?" : "Delete this benchmark run?" }), _jsx(DialogDescription, { children: purge ? "This deletes eligible completed run records and their retained agent conversations. Active runs and tasks awaiting safe cleanup are kept." : "This permanently deletes the run record and task results. Runs with retained copies must be cleaned up first." })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => setConfirmation(undefined), children: "Cancel" }), _jsx(Button, { variant: "destructive", disabled: busy, onClick: () => { const choice = confirmation; if (!choice)
101
- return; void perform(() => choice.action === "purge" ? benchmarkService.purge() : benchmarkService.deleteRun(choice.id)).then(() => { setConfirmation(undefined); if (choice.id === runId)
102
- selectRun(null); }).catch(() => undefined); }, children: purge ? "Purge history" : "Delete run" })] })] }) })] });
136
+ const current = views.find((v) => v.value === view) ?? views[0];
137
+ return (_jsxs(SettingsPanelLayout, { testId: "benchmark-panel", children: [(statusError || error) && (_jsxs(Alert, { variant: "destructive", children: [_jsx(AlertCircle, { className: "h-4 w-4", strokeWidth: 1 }), _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { children: [_jsx(AlertTitle, { children: "Benchmark unavailable" }), _jsx(AlertDescription, { children: statusError || error })] }), _jsx(Button, { size: "sm", variant: "outline", onClick: () => {
138
+ void refreshStatus();
139
+ void refresh();
140
+ }, children: "Retry" })] })] })), !status && !statusError && _jsx(LoadingState, { message: "Loading benchmark\u2026" }), status && (_jsxs(_Fragment, { children: [!ready && (_jsx(NotPreparedState, { status: status, busy: busy, prepare: () => {
141
+ void perform(benchmarkService.prepare).catch(() => undefined);
142
+ } })), _jsx(RecoveryBanner, { tasks: status.tasksAwaitingRecovery, busy: busy, recover: () => {
143
+ void perform(() => benchmarkService.recover()).catch(() => undefined);
144
+ } }), !runId && (_jsx(ActiveRunBanner, { run: status.activeRun, queued: status.queuedRuns, busy: busy, open: open, cancel: (id) => act("cancel", id) })), ready &&
145
+ (runId ? (detail ? (_jsx(BenchmarkRunDetail, { detail: detail, busy: busy, cancel: (id) => act("cancel", id), back: () => {
146
+ selectRun(null);
147
+ setView("runs");
148
+ } })) : (_jsx(LoadingState, { message: "Loading run\u2026" }))) : (_jsx(SettingsCard, { icon: _jsx(current.icon, { strokeWidth: 1 }), title: current.label, description: current.description, headerActions: _jsx(MultiSwitchButton, { value: view, onValueChange: setView, options: views.map(({ value, label }) => ({
149
+ value,
150
+ label,
151
+ })), className: "w-72 shrink-0", optionClassName: "h-6", "aria-label": "Benchmark view", testId: "benchmark-view-switch" }), children: _jsxs("div", { "data-testid": `benchmark-view-${view}`, children: [view === "leaderboard" && (_jsx(BenchmarkLeaderboard, { entries: entries })), view === "runs" && (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(BenchmarkRunsList, { runs: runs, total: total, busy: busy, open: open, act: act, more: () => setPages((p) => p + 1) }), !!runs.length && (_jsxs("div", { className: "border-border-default -mx-4 flex flex-wrap items-center justify-between gap-3 border-t px-4 pt-4 md:-mx-6 md:px-6", children: [_jsx("p", { className: settingsText.help, children: "Completed runs keep their agent conversations until they are deleted." }), _jsxs(Button, { size: "sm", variant: "outline", disabled: busy, onClick: () => setConfirmation({ action: "purge" }), children: [_jsx(Trash2, { strokeWidth: 1 }), "Purge completed history"] })] }))] })), view === "tasks" && _jsx(BenchmarkTasksList, { tasks: tasks })] }) })))] })), _jsx(StartBenchmarkDialog, { open: startOpen, onOpenChange: setStartOpen, start: start, busy: busy }), _jsx(Dialog, { open: !!confirmation, onOpenChange: (value) => {
152
+ if (!value)
153
+ setConfirmation(undefined);
154
+ }, children: _jsxs(DialogContent, { className: "max-w-lg gap-6", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: purge
155
+ ? "Purge completed benchmark history?"
156
+ : "Delete this benchmark run?" }), _jsx(DialogDescription, { children: purge
157
+ ? "This deletes eligible completed run records and their retained agent conversations. Active runs and tasks awaiting safe cleanup are kept."
158
+ : "This permanently deletes the run record and task results. Runs with retained copies must be cleaned up first." })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => setConfirmation(undefined), children: "Cancel" }), _jsx(Button, { variant: "destructive", disabled: busy, onClick: () => {
159
+ const choice = confirmation;
160
+ if (!choice)
161
+ return;
162
+ void perform(() => choice.action === "purge"
163
+ ? benchmarkService.purge()
164
+ : benchmarkService.deleteRun(choice.id))
165
+ .then(() => {
166
+ setConfirmation(undefined);
167
+ if (choice.id === runId)
168
+ selectRun(null);
169
+ })
170
+ .catch(() => undefined);
171
+ }, children: purge ? "Purge history" : "Delete run" })] })] }) })] }));
103
172
  }
@@ -1,5 +1,5 @@
1
1
  import type { RunDetail } from "../types";
2
- export declare function BenchmarkRunDetail({ detail, back, cancel, busy }: {
2
+ export declare function BenchmarkRunDetail({ detail, back, cancel, busy, }: {
3
3
  detail: RunDetail;
4
4
  back: () => void;
5
5
  cancel: (id: string) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"BenchmarkRunDetail.d.ts","sourceRoot":"","sources":["../../src/components/BenchmarkRunDetail.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAoB1C,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,IAAI,CAAC;IAAC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,+BAwEtJ"}
1
+ {"version":3,"file":"BenchmarkRunDetail.d.ts","sourceRoot":"","sources":["../../src/components/BenchmarkRunDetail.tsx"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAyD1C,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,IAAI,EACJ,MAAM,EACN,IAAI,GACL,EAAE;IACD,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,IAAI,EAAE,OAAO,CAAC;CACf,+BAuTA"}
@@ -1,28 +1,40 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertAction, AlertDescription, Button, SettingsCard, Tooltip, TooltipContent, TooltipTrigger } from "@parhelia/core";
3
- import { AlertCircle, ArrowLeft, Gauge, Info, ListChecks, Loader2, MessageSquare, Square } from "lucide-react";
2
+ import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertAction, AlertDescription, Button, SettingsCard, SettingsEmptyState, SettingsStat, SettingsStatGrid, Tooltip, TooltipContent, TooltipTrigger, cn, settingsText, } from "@parhelia/core";
3
+ import { AlertCircle, AlertTriangle, ArrowLeft, Gauge, Info, ListChecks, Loader2, MessageSquare, Square, } from "lucide-react";
4
4
  import { agentLink } from "../agentLink";
5
- import { cost, count, duration, parseGraderReport, parseJson, percent } from "../format";
5
+ import { cost, count, duration, parseGraderReport, parseJson, percent, } from "../format";
6
6
  import { taskSafetyViolations } from "../safetyViolations";
7
- import { RunStatusBadge } from "./RunStatusBadge";
7
+ import { RunStatus } from "./RunStatus";
8
8
  import { SafetyViolationsStat } from "./SafetyViolationsStat";
9
9
  import { TaskChecksList } from "./TaskChecksList";
10
10
  const safetyViolationsExplanation = "Total recorded safety violations across tasks, such as attempts to modify content outside the permitted benchmark scope. A safety violation makes the affected task’s correctness zero.";
11
11
  const efficiencyExplanation = "Points for staying within tool-call and known-cost budgets: 100% at or below budget, decreasing linearly to 0% at twice the budget. A task must pass at least one work check worth points to earn efficiency points. Unknown-cost checks are excluded; — means no efficiency checks were evaluated.";
12
12
  const correctnessExplanation = "Percentage of work and preservation points earned. A critical check failure or safety violation makes that task’s correctness zero. Efficiency and judge points are separate.";
13
- function Stat({ label, value, hint, explanation }) {
14
- return _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("div", { role: "group", "aria-label": `${label}: ${value}`, tabIndex: 0, className: "bg-neutral-grey-5 focus-visible:ring-ring cursor-help rounded p-3 outline-none focus-visible:ring-2", children: [_jsxs("dt", { className: "text-neutral-grey-50 flex items-center gap-1.5 text-xs font-medium", children: [label, _jsx(Info, { "aria-hidden": "true", className: "h-3.5 w-3.5 shrink-0", strokeWidth: 1.5 })] }), _jsx("dd", { className: "text-neutral-grey-100 mt-1 text-base font-medium tabular-nums", children: value }), hint && _jsx("dd", { className: "text-neutral-grey-50 mt-0.5 text-xs", children: hint })] }) }), _jsx(TooltipContent, { className: "max-w-xs", sideOffset: 6, children: explanation })] });
13
+ /** A stat tile that explains itself in a tooltip (on hover and on keyboard focus). */
14
+ function Stat({ label, value, hint, explanation, }) {
15
+ return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("div", { role: "group", "aria-label": `${label}: ${value}`, tabIndex: 0, className: "focus-visible:ring-ring min-w-0 cursor-help rounded-md outline-none focus-visible:ring-2", children: _jsx(SettingsStat, { label: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [label, _jsx(Info, { "aria-hidden": "true", className: "size-3.5 shrink-0", strokeWidth: 1 })] }), value: value, hint: hint }) }) }), _jsx(TooltipContent, { className: "max-w-xs", sideOffset: 6, children: explanation })] }));
15
16
  }
16
- export function BenchmarkRunDetail({ detail, back, cancel, busy }) {
17
+ export function BenchmarkRunDetail({ detail, back, cancel, busy, }) {
17
18
  const run = detail.run;
18
19
  if (!run)
19
- return _jsxs(Alert, { variant: "warning", children: [_jsx(AlertCircle, { className: "h-4 w-4", strokeWidth: 1.5 }), _jsxs(AlertDescription, { children: ["This run no longer exists.", _jsx(AlertAction, { onClick: back, children: "Back to runs" })] })] });
20
- const tokens = run.inputTokens + run.outputTokens + run.cachedTokens + run.cacheWriteTokens;
21
- const completed = detail.tasks.filter(t => t.status === "Completed").length;
20
+ return (_jsxs(Alert, { variant: "warning", children: [_jsx(AlertTriangle, { className: "h-4 w-4", strokeWidth: 1 }), _jsxs(AlertDescription, { children: ["This run no longer exists.", _jsx(AlertAction, { onClick: back, children: "Back to runs" })] })] }));
21
+ const tokens = run.inputTokens +
22
+ run.outputTokens +
23
+ run.cachedTokens +
24
+ run.cacheWriteTokens;
25
+ const completed = detail.tasks.filter((t) => t.status === "Completed").length;
22
26
  const active = run.status === "Running" || run.status === "Queued";
23
27
  const violationGroups = taskSafetyViolations(detail.tasks);
24
- const violationsByTask = new Map(violationGroups.map(group => [group.task.taskKey, group.violations]));
25
- return _jsxs("div", { "data-testid": "benchmark-run-detail", className: "space-y-4", children: [_jsx("div", { children: _jsxs(Button, { variant: "ghost", size: "sm", className: "text-neutral-grey-50 hover:text-neutral-grey-100 -ml-2", onClick: back, children: [_jsx(ArrowLeft, { strokeWidth: 1.5 }), "Back to runs"] }) }), _jsx(SettingsCard, { icon: _jsx(Gauge, { className: "h-5 w-5", strokeWidth: 1 }), title: _jsxs("span", { className: "flex flex-wrap items-center gap-2", children: [run.modelName, _jsx(RunStatusBadge, { status: run.status })] }), description: `${run.providerName} · Configuration ${run.configLabel} · ${run.isFullSuite ? "Full suite" : "Task subset"} · Started ${new Date(run.createdAt).toLocaleString()}`, children: _jsxs("div", { className: "space-y-4", children: [active && _jsxs("div", { className: "bg-feedback-blue/10 flex flex-wrap items-center justify-between gap-3 rounded p-3", children: [_jsxs("div", { role: "status", className: "text-neutral-grey-100 flex items-center gap-2 text-sm", children: [_jsx(Loader2, { "aria-hidden": "true", className: "h-4 w-4 shrink-0 animate-spin", strokeWidth: 1.5 }), _jsxs("span", { children: [run.cancelRequestedAt ? "Stopping benchmark…" : run.status === "Queued" ? "Waiting for the runner…" : "Benchmark running…", " \u00B7 ", run.tasksCompleted, " / ", run.taskCount, " tasks completed"] })] }), _jsxs(Button, { size: "sm", variant: "destructive", "data-testid": `benchmark-run-cancel-${run.runId}`, disabled: busy || !!run.cancelRequestedAt, onClick: () => cancel(run.runId), children: [_jsx(Square, { "aria-hidden": "true", strokeWidth: 1.5 }), run.cancelRequestedAt ? "Stopping…" : "Stop benchmark"] })] }), _jsxs("dl", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-4", children: [_jsx(Stat, { label: "Correctness", value: percent(run.correctnessPercent), explanation: `Weighted score across graded core tasks. ${correctnessExplanation}` }), _jsx(Stat, { label: "Efficiency", value: percent(run.efficiencyPercent), explanation: `Weighted score across graded core tasks. ${efficiencyExplanation}` }), _jsx(Stat, { label: "Coverage", value: percent(run.coveragePercent), explanation: "Percentage of all possible weighted grading points in this run that have been evaluated. Unfinished tasks and skipped checks, including unknown-cost or unavailable judge checks, reduce coverage. This measures grading coverage, not correctness or the percentage of tasks completed." }), _jsx(Stat, { label: "Full score", value: percent(run.fullScorePercent), hint: run.fullScorePercent == null ? "Available at 100% grading coverage" : undefined, explanation: "Combined weighted correctness, efficiency and judge points across all selected tasks, divided by their evaluated points. Available only at 100% grading coverage; skipped checks can keep it unavailable even after the run completes." }), _jsx(Stat, { label: "Model cost", value: cost(run.totalCost, run.costKnown), explanation: "Total model cost in USD across this run\u2019s tasks, excluding judge cost. Incomplete totals show recorded charges as a lower bound; unreported charges may be missing. Cost unknown means no priced subtotal is available." }), _jsx(Stat, { label: "Judge cost", value: cost(run.judgeCost), explanation: "Recorded cost in USD of the separate AI judge used to grade task results. This is separate from model cost; $0.0000 can mean no judge was used." }), _jsx(Stat, { label: "Tokens", value: count(tokens), hint: `${count(run.cachedTokens)} cached`, explanation: "Total recorded model tokens across tasks: input, output, cache reads and cache writes. The cached count shows cache-read tokens. Judge usage is separate." }), _jsx(Stat, { label: "Tool calls", value: count(run.toolExecutions), explanation: "Total recorded tool calls across this run\u2019s tasks, including read and write operations. Each task\u2019s tool-call budget contributes to its efficiency score." }), _jsx(Stat, { label: "Duration", value: duration(run.wallDurationMs), explanation: "Elapsed wall-clock time from the run\u2019s start until it ends, or until the latest update while running. Includes task setup, execution, grading and cleanup; time queued before starting is excluded." }), run.safetyViolations > 0
26
- ? _jsx(SafetyViolationsStat, { total: run.safetyViolations, groups: violationGroups, explanation: safetyViolationsExplanation })
27
- : _jsx(Stat, { label: "Safety violations", value: count(run.safetyViolations), explanation: safetyViolationsExplanation })] }), run.errorMessage && _jsxs(Alert, { variant: "destructive", children: [_jsx(AlertCircle, { className: "h-4 w-4", strokeWidth: 1.5 }), _jsx(AlertDescription, { children: run.errorMessage })] })] }) }), _jsx(SettingsCard, { icon: _jsx(ListChecks, { className: "h-5 w-5", strokeWidth: 1 }), title: "Tasks", description: `${completed} of ${run.taskCount || detail.tasks.length} tasks completed`, children: !detail.tasks.length ? _jsx("p", { className: "text-neutral-grey-50 text-sm", children: "No task results yet." }) : _jsx(Accordion, { type: "multiple", className: "-mt-2", children: detail.tasks.map(t => _jsxs(AccordionItem, { value: t.taskKey, "data-testid": `benchmark-task-row-${t.taskKey}`, className: "border-border-default last:border-b-0", children: [_jsx(AccordionTrigger, { className: "py-3 hover:no-underline", children: _jsxs("span", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1", children: [_jsx("span", { className: "text-neutral-grey-100 text-sm font-medium", children: t.taskTitle }), _jsx(RunStatusBadge, { status: t.status }), _jsxs("span", { className: "text-neutral-grey-50 hidden text-xs md:inline", children: [cost(t.cost, t.costKnown), " \u00B7 ", count(t.toolCalls), " tool calls \u00B7 ", duration(t.wallDurationMs)] }), _jsx("span", { className: "text-neutral-grey-100 ml-auto text-sm font-medium tabular-nums", children: percent(t.correctnessPercent) })] }) }), _jsx(AccordionContent, { children: _jsxs("div", { className: "space-y-4 pb-3", children: [_jsxs("dl", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-4", children: [_jsx(Stat, { label: "Correctness", value: percent(t.correctnessPercent), explanation: correctnessExplanation }), _jsx(Stat, { label: "Efficiency", value: percent(t.efficiencyPercent), explanation: efficiencyExplanation }), _jsx(Stat, { label: "Cost", value: cost(t.cost, t.costKnown), hint: t.judgeCost ? `${cost(t.judgeCost)} judge` : undefined, explanation: "Model cost in USD for this task, excluding judge cost. Incomplete totals show recorded charges as a lower bound; the final charge may be higher. Missing usage or pricing prevents a complete total and excludes cost from efficiency scoring." }), _jsx(Stat, { label: "Tool calls", value: `${count(t.toolCalls)} · ${duration(t.wallDurationMs)}`, explanation: "Recorded tool calls for this task, followed by its elapsed wall-clock duration. Tool calls count against the task\u2019s efficiency budget; duration is reported separately and does not affect that score." })] }), t.skipReason && _jsxs(Alert, { variant: "info", children: [_jsx(Info, { className: "h-4 w-4", strokeWidth: 1.5 }), _jsx(AlertDescription, { children: t.skipReason })] }), t.errorMessage && _jsxs(Alert, { variant: "destructive", children: [_jsx(AlertCircle, { className: "h-4 w-4", strokeWidth: 1.5 }), _jsx(AlertDescription, { children: t.errorMessage })] }), !t.costKnown && _jsx("p", { className: "text-neutral-grey-50 text-xs", children: "Cost accounting is incomplete. Recorded charges are retained; this task\u2019s cost check is excluded from efficiency scoring." }), t.keptUntil && _jsxs("p", { className: "text-neutral-grey-50 text-xs", children: ["Content copy retained until ", new Date(t.keptUntil).toLocaleString(), "."] }), _jsx(TaskChecksList, { report: parseGraderReport(t.graderReportJson), violations: violationsByTask.get(t.taskKey) }), _jsxs("details", { children: [_jsx("summary", { className: "text-neutral-grey-50 hover:text-neutral-grey-100 cursor-pointer text-xs font-medium select-none", children: "Task diagnostics" }), parseGraderReport(t.graderReportJson)?.costIssues?.map((issue, index) => _jsx("p", { className: "text-neutral-grey-50 mt-2 text-xs", children: issue }, index)), _jsx("dl", { className: "mt-2", children: _jsx(Stat, { label: "Shutdown", value: t.agentId ? (t.shutdownState === "None" ? "Pending" : t.shutdownState) : "Not executed", explanation: "Whether the task\u2019s agent has stopped. Pending: shutdown has not been requested. Requested: waiting for confirmation. Confirmed: the agent has stopped. Unconfirmed: shutdown could not be verified. Not executed: no agent was created." }) }), t.auditJson && _jsxs("div", { className: "mt-3", children: [_jsx("p", { className: "text-neutral-grey-50 text-xs font-medium", children: "Mutation and tool audit" }), _jsx("pre", { className: "bg-neutral-grey-5 text-neutral-grey-100 mt-2 max-h-80 overflow-auto rounded p-3 font-mono text-xs whitespace-pre-wrap", children: JSON.stringify(parseJson(t.auditJson) ?? t.auditJson, null, 2) })] })] }), t.agentId && _jsx("div", { children: _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs("a", { "data-testid": `benchmark-task-open-agent-${t.taskKey}`, href: agentLink(t.agentId), children: [_jsx(MessageSquare, { strokeWidth: 1.5 }), "Open agent conversation"] }) }) })] }) })] }, t.taskKey)) }) })] });
28
+ const violationsByTask = new Map(violationGroups.map((group) => [group.task.taskKey, group.violations]));
29
+ return (_jsxs("div", { "data-testid": "benchmark-run-detail", className: "flex flex-col gap-4", children: [_jsx("div", { children: _jsxs(Button, { variant: "ghost", size: "sm", className: "text-neutral-grey-50 hover:text-neutral-grey-100 -ml-2", onClick: back, children: [_jsx(ArrowLeft, { strokeWidth: 1 }), "Back to runs"] }) }), _jsx(SettingsCard, { icon: _jsx(Gauge, { strokeWidth: 1 }), title: _jsxs("span", { className: "flex flex-wrap items-center gap-2", children: [run.modelName, _jsx(RunStatus, { status: run.status })] }), description: `${run.providerName} · Configuration ${run.configLabel} · ${run.isFullSuite ? "Full suite" : "Task subset"} · Started ${new Date(run.createdAt).toLocaleString()}`, children: _jsxs("div", { className: "flex flex-col gap-4", children: [active && (_jsxs(Alert, { role: "status", children: [_jsx(Loader2, { "aria-hidden": "true", className: "h-4 w-4 animate-spin", strokeWidth: 1 }), _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs(AlertDescription, { children: [run.cancelRequestedAt
30
+ ? "Stopping benchmark…"
31
+ : run.status === "Queued"
32
+ ? "Waiting for the runner…"
33
+ : "Benchmark running…", " ", "\u00B7 ", run.tasksCompleted, " / ", run.taskCount, " tasks completed"] }), _jsxs(Button, { size: "sm", variant: "destructive", "data-testid": `benchmark-run-cancel-${run.runId}`, disabled: busy || !!run.cancelRequestedAt, onClick: () => cancel(run.runId), children: [_jsx(Square, { "aria-hidden": "true", strokeWidth: 1 }), run.cancelRequestedAt ? "Stopping…" : "Stop benchmark"] })] })] })), _jsxs(SettingsStatGrid, { children: [_jsx(Stat, { label: "Correctness", value: percent(run.correctnessPercent), explanation: `Weighted score across graded core tasks. ${correctnessExplanation}` }), _jsx(Stat, { label: "Efficiency", value: percent(run.efficiencyPercent), explanation: `Weighted score across graded core tasks. ${efficiencyExplanation}` }), _jsx(Stat, { label: "Coverage", value: percent(run.coveragePercent), explanation: "Percentage of all possible weighted grading points in this run that have been evaluated. Unfinished tasks and skipped checks, including unknown-cost or unavailable judge checks, reduce coverage. This measures grading coverage, not correctness or the percentage of tasks completed." }), _jsx(Stat, { label: "Full score", value: percent(run.fullScorePercent), hint: run.fullScorePercent == null
34
+ ? "Available at 100% grading coverage"
35
+ : undefined, explanation: "Combined weighted correctness, efficiency and judge points across all selected tasks, divided by their evaluated points. Available only at 100% grading coverage; skipped checks can keep it unavailable even after the run completes." }), _jsx(Stat, { label: "Model cost", value: cost(run.totalCost, run.costKnown), explanation: "Total model cost in USD across this run\u2019s tasks, excluding judge cost. Incomplete totals show recorded charges as a lower bound; unreported charges may be missing. Cost unknown means no priced subtotal is available." }), _jsx(Stat, { label: "Judge cost", value: cost(run.judgeCost), explanation: "Recorded cost in USD of the separate AI judge used to grade task results. This is separate from model cost; $0.0000 can mean no judge was used." }), _jsx(Stat, { label: "Tokens", value: count(tokens), hint: `${count(run.cachedTokens)} cached`, explanation: "Total recorded model tokens across tasks: input, output, cache reads and cache writes. The cached count shows cache-read tokens. Judge usage is separate." }), _jsx(Stat, { label: "Tool calls", value: count(run.toolExecutions), explanation: "Total recorded tool calls across this run\u2019s tasks, including read and write operations. Each task\u2019s tool-call budget contributes to its efficiency score." }), _jsx(Stat, { label: "Duration", value: duration(run.wallDurationMs), explanation: "Elapsed wall-clock time from the run\u2019s start until it ends, or until the latest update while running. Includes task setup, execution, grading and cleanup; time queued before starting is excluded." }), run.safetyViolations > 0 ? (_jsx(SafetyViolationsStat, { total: run.safetyViolations, groups: violationGroups, explanation: safetyViolationsExplanation })) : (_jsx(Stat, { label: "Safety violations", value: count(run.safetyViolations), explanation: safetyViolationsExplanation }))] }), run.errorMessage && (_jsxs(Alert, { variant: "destructive", children: [_jsx(AlertCircle, { className: "h-4 w-4", strokeWidth: 1 }), _jsx(AlertDescription, { children: run.errorMessage })] }))] }) }), _jsx(SettingsCard, { icon: _jsx(ListChecks, { strokeWidth: 1 }), title: "Tasks", description: `${completed} of ${run.taskCount || detail.tasks.length} tasks completed`, children: !detail.tasks.length ? (_jsx(SettingsEmptyState, { icon: ListChecks, title: "No task results yet." })) : (_jsx(Accordion, { type: "multiple", className: "-mt-3", children: detail.tasks.map((t) => (_jsxs(AccordionItem, { value: t.taskKey, "data-testid": `benchmark-task-row-${t.taskKey}`, className: "border-border-default last:border-b-0", children: [_jsx(AccordionTrigger, { className: "py-3 hover:no-underline", children: _jsxs("span", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1", children: [_jsx("span", { className: settingsText.label, children: t.taskTitle }), _jsx(RunStatus, { status: t.status }), _jsxs("span", { className: cn("hidden md:inline", settingsText.meta), children: [cost(t.cost, t.costKnown), " \u00B7 ", count(t.toolCalls), " tool calls \u00B7 ", duration(t.wallDurationMs)] }), _jsx("span", { className: cn("ml-auto tabular-nums", settingsText.label), children: percent(t.correctnessPercent) })] }) }), _jsx(AccordionContent, { children: _jsxs("div", { className: "flex flex-col gap-4 pb-3", children: [_jsxs(SettingsStatGrid, { children: [_jsx(Stat, { label: "Correctness", value: percent(t.correctnessPercent), explanation: correctnessExplanation }), _jsx(Stat, { label: "Efficiency", value: percent(t.efficiencyPercent), explanation: efficiencyExplanation }), _jsx(Stat, { label: "Cost", value: cost(t.cost, t.costKnown), hint: t.judgeCost ? `${cost(t.judgeCost)} judge` : undefined, explanation: "Model cost in USD for this task, excluding judge cost. Incomplete totals show recorded charges as a lower bound; the final charge may be higher. Missing usage or pricing prevents a complete total and excludes cost from efficiency scoring." }), _jsx(Stat, { label: "Tool calls", value: `${count(t.toolCalls)} · ${duration(t.wallDurationMs)}`, explanation: "Recorded tool calls for this task, followed by its elapsed wall-clock duration. Tool calls count against the task\u2019s efficiency budget; duration is reported separately and does not affect that score." })] }), t.skipReason && (_jsxs(Alert, { children: [_jsx(Info, { className: "h-4 w-4", strokeWidth: 1 }), _jsx(AlertDescription, { children: t.skipReason })] })), t.errorMessage && (_jsxs(Alert, { variant: "destructive", children: [_jsx(AlertCircle, { className: "h-4 w-4", strokeWidth: 1 }), _jsx(AlertDescription, { children: t.errorMessage })] })), !t.costKnown && (_jsx("p", { className: settingsText.help, children: "Cost accounting is incomplete. Recorded charges are retained; this task\u2019s cost check is excluded from efficiency scoring." })), t.keptUntil && (_jsxs("p", { className: settingsText.help, children: ["Content copy retained until", " ", new Date(t.keptUntil).toLocaleString(), "."] })), _jsx(TaskChecksList, { report: parseGraderReport(t.graderReportJson), violations: violationsByTask.get(t.taskKey) }), _jsxs("details", { children: [_jsx("summary", { className: cn("hover:text-neutral-grey-100 cursor-pointer select-none", settingsText.caption), children: "Task diagnostics" }), parseGraderReport(t.graderReportJson)?.costIssues?.map((issue, index) => (_jsx("p", { className: cn("mt-2", settingsText.help), children: issue }, index))), _jsx("div", { className: "mt-2 max-w-xs", children: _jsx(Stat, { label: "Shutdown", value: t.agentId
36
+ ? t.shutdownState === "None"
37
+ ? "Pending"
38
+ : t.shutdownState
39
+ : "Not executed", explanation: "Whether the task\u2019s agent has stopped. Pending: shutdown has not been requested. Requested: waiting for confirmation. Confirmed: the agent has stopped. Unconfirmed: shutdown could not be verified. Not executed: no agent was created." }) }), t.auditJson && (_jsxs("div", { className: "mt-3", children: [_jsx("p", { className: settingsText.caption, children: "Mutation and tool audit" }), _jsx("pre", { className: cn("bg-neutral-grey-5 text-neutral-grey-100 mt-1.5 max-h-80 overflow-auto rounded-md p-3 whitespace-pre-wrap", settingsText.mono), children: JSON.stringify(parseJson(t.auditJson) ?? t.auditJson, null, 2) })] }))] }), t.agentId && (_jsx("div", { children: _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs("a", { "data-testid": `benchmark-task-open-agent-${t.taskKey}`, href: agentLink(t.agentId), children: [_jsx(MessageSquare, { strokeWidth: 1 }), "Open agent conversation"] }) }) }))] }) })] }, t.taskKey))) })) })] }));
28
40
  }
@@ -1,5 +1,5 @@
1
1
  import type { BenchmarkRun } from "../types";
2
- export declare function BenchmarkRunsList({ runs, total, busy, open, act, more }: {
2
+ export declare function BenchmarkRunsList({ runs, total, busy, open, act, more, }: {
3
3
  runs: BenchmarkRun[];
4
4
  total: number;
5
5
  busy: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"BenchmarkRunsList.d.ts","sourceRoot":"","sources":["../../src/components/BenchmarkRunsList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI7C,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,GAAG,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,IAAI,CAAA;CAAE,+BAcpP"}
1
+ {"version":3,"file":"BenchmarkRunsList.d.ts","sourceRoot":"","sources":["../../src/components/BenchmarkRunsList.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI7C,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,IAAI,GACL,EAAE;IACD,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B,GAAG,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,+BAoHA"}
@@ -1,19 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Badge, Button, SimpleTable } from "@parhelia/core";
2
+ import { Button, DeleteButton, SettingsEmptyState, SimpleIconButton, cn, settingsTable, settingsText, } from "@parhelia/core";
3
+ import { History, LifeBuoy, Square } from "lucide-react";
3
4
  import { cost, duration, percent } from "../format";
4
- import { RunStatusBadge } from "./RunStatusBadge";
5
- const numeric = "text-neutral-grey-100 tabular-nums";
6
- export function BenchmarkRunsList({ runs, total, busy, open, act, more }) {
5
+ import { RunStatus } from "./RunStatus";
6
+ const numeric = "text-right whitespace-nowrap tabular-nums";
7
+ export function BenchmarkRunsList({ runs, total, busy, open, act, more, }) {
7
8
  if (!runs.length)
8
- return _jsx("p", { "data-testid": "benchmark-runs-table", className: "text-neutral-grey-50 py-10 text-center text-sm", children: "No benchmark runs yet. Start one from the button above." });
9
- return _jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "overflow-x-auto", children: _jsx(SimpleTable, { "data-testid": "benchmark-runs-table", items: runs, rowKey: r => r.runId, columns: [
10
- { header: "Model / configuration", body: r => _jsxs("div", { children: [_jsx(Button, { variant: "link", size: "sm", className: "h-auto p-0 text-sm font-medium", onClick: () => open(r.runId), children: r.modelName }), _jsxs("p", { className: "text-neutral-grey-50", children: [r.providerName, " \u00B7 ", r.configLabel] })] }) },
11
- { header: "Started", body: r => _jsx("span", { className: "text-neutral-grey-100", children: new Date(r.createdAt).toLocaleString() }), className: "whitespace-nowrap" },
12
- { header: "Status", body: r => _jsxs("div", { className: "flex flex-wrap gap-1", children: [_jsx(RunStatusBadge, { status: r.status }), !r.isFullSuite && _jsx(Badge, { variant: "secondary", children: "Subset" })] }) },
13
- { header: "Tasks", body: r => _jsxs("span", { className: numeric, children: [r.tasksCompleted, " / ", r.taskCount] }), align: "right", className: "whitespace-nowrap" },
14
- { header: "Correctness", body: r => _jsx("span", { className: `${numeric} font-medium`, children: percent(r.correctnessPercent) }), align: "right", className: "whitespace-nowrap" },
15
- { header: "Cost", body: r => _jsx("span", { className: numeric, children: cost(r.totalCost, r.costKnown) }), align: "right", className: "whitespace-nowrap" },
16
- { header: "Duration", body: r => _jsx("span", { className: numeric, children: duration(r.wallDurationMs) }), align: "right", className: "whitespace-nowrap" },
17
- { header: "", body: r => _jsx("div", { className: "flex justify-end gap-2", children: ["Queued", "Running"].includes(r.status) ? _jsx(Button, { size: "xs", variant: "destructive", "data-testid": `benchmark-run-cancel-${r.runId}`, disabled: busy || !!r.cancelRequestedAt, onClick: () => act("cancel", r.runId), children: r.cancelRequestedAt ? "Stopping…" : "Cancel" }) : r.status === "NeedsRecovery" ? _jsx(Button, { size: "xs", "data-testid": `benchmark-run-recover-${r.runId}`, disabled: busy, onClick: () => act("recover", r.runId), children: "Recover" }) : _jsx(Button, { size: "xs", variant: "outline", "data-testid": `benchmark-run-delete-${r.runId}`, disabled: busy, onClick: () => act("deleteRun", r.runId), children: "Delete" }) }), align: "right" },
18
- ] }) }), runs.length < total && _jsx("div", { className: "flex justify-center", children: _jsxs(Button, { size: "sm", variant: "outline", disabled: busy, onClick: more, children: ["Load more (", total - runs.length, " remaining)"] }) })] });
9
+ return (_jsx(SettingsEmptyState, { "data-testid": "benchmark-runs-table", icon: History, title: "No benchmark runs yet. Start one from the button above." }));
10
+ return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx("div", { className: "-mx-4 overflow-x-auto md:-mx-6", children: _jsxs("table", { "data-testid": "benchmark-runs-table", className: cn(settingsTable.table, settingsTable.inset), children: [_jsx("thead", { className: settingsTable.head, children: _jsxs("tr", { children: [_jsx("th", { className: settingsTable.th, children: "Model / configuration" }), _jsx("th", { className: settingsTable.th, children: "Started" }), _jsx("th", { className: settingsTable.th, children: "Status" }), _jsx("th", { className: cn(settingsTable.th, "text-right"), children: "Tasks" }), _jsx("th", { className: cn(settingsTable.th, "text-right"), children: "Correctness" }), _jsx("th", { className: cn(settingsTable.th, "text-right"), children: "Cost" }), _jsx("th", { className: cn(settingsTable.th, "text-right"), children: "Duration" }), _jsx("th", { className: settingsTable.th, children: _jsx("span", { className: "sr-only", children: "Actions" }) })] }) }), _jsx("tbody", { children: runs.map((r) => (_jsxs("tr", { className: settingsTable.row, children: [_jsxs("td", { className: settingsTable.td, children: [_jsx(Button, { variant: "link", size: "sm", className: "h-auto p-0 text-xs font-medium", onClick: () => open(r.runId), children: r.modelName }), _jsxs("div", { className: settingsText.meta, children: [r.providerName, " \u00B7 ", r.configLabel] })] }), _jsx("td", { className: cn(settingsTable.td, "whitespace-nowrap"), children: new Date(r.createdAt).toLocaleString() }), _jsx("td", { className: settingsTable.td, children: _jsxs("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [_jsx(RunStatus, { status: r.status }), !r.isFullSuite && (_jsx("span", { className: settingsText.meta, children: "Subset" }))] }) }), _jsxs("td", { className: cn(settingsTable.td, numeric), children: [r.tasksCompleted, " / ", r.taskCount] }), _jsx("td", { className: cn(settingsTable.td, numeric, "font-medium"), children: percent(r.correctnessPercent) }), _jsx("td", { className: cn(settingsTable.td, numeric), children: cost(r.totalCost, r.costKnown) }), _jsx("td", { className: cn(settingsTable.td, numeric), children: duration(r.wallDurationMs) }), _jsx("td", { className: settingsTable.td, children: _jsx("div", { className: "flex justify-end gap-1", children: ["Queued", "Running"].includes(r.status) ? (_jsx(SimpleIconButton, { label: r.cancelRequestedAt ? "Stopping…" : "Cancel", icon: _jsx(Square, { className: "size-4", strokeWidth: 1 }), className: "size-7 p-0", "data-testid": `benchmark-run-cancel-${r.runId}`, disabled: busy || !!r.cancelRequestedAt, onClick: () => act("cancel", r.runId) })) : r.status === "NeedsRecovery" ? (_jsx(SimpleIconButton, { label: "Recover", icon: _jsx(LifeBuoy, { className: "size-4", strokeWidth: 1 }), className: "size-7 p-0", "data-testid": `benchmark-run-recover-${r.runId}`, disabled: busy, onClick: () => act("recover", r.runId) })) : (_jsx(DeleteButton, { label: "Delete", "data-testid": `benchmark-run-delete-${r.runId}`, disabled: busy, onClick: () => act("deleteRun", r.runId) })) }) })] }, r.runId))) })] }) }), runs.length < total && (_jsx("div", { className: "flex justify-center", children: _jsxs(Button, { size: "sm", variant: "outline", disabled: busy, onClick: more, children: ["Load more (", total - runs.length, " remaining)"] }) }))] }));
19
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BenchmarkTasksList.d.ts","sourceRoot":"","sources":["../../src/components/BenchmarkTasksList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,aAAa,EAAE,CAAA;CAAE,+BA0BvE"}
1
+ {"version":3,"file":"BenchmarkTasksList.d.ts","sourceRoot":"","sources":["../../src/components/BenchmarkTasksList.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,aAAa,EAAE,CAAA;CAAE,+BAkEvE"}
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Badge } from "@parhelia/core";
2
+ import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, SettingsEmptyState, SettingsStat, SettingsStatGrid, cn, settingsText, } from "@parhelia/core";
3
+ import { ListChecks } from "lucide-react";
3
4
  import { cost, duration } from "../format";
4
5
  export function BenchmarkTasksList({ tasks }) {
5
6
  if (!tasks.length)
6
- return _jsx("p", { className: "text-neutral-grey-50 py-10 text-center text-sm", children: "No tasks are defined in the current suite." });
7
- return _jsx("div", { className: "space-y-4", children: _jsx(Accordion, { type: "multiple", className: "-mt-2", children: tasks.map(t => _jsxs(AccordionItem, { value: t.key, className: "border-border-default last:border-b-0", children: [_jsx(AccordionTrigger, { className: "py-3 hover:no-underline", children: _jsxs("span", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1", children: [_jsx("span", { className: "text-neutral-grey-100 text-sm font-medium", children: t.title }), _jsx(Badge, { variant: "secondary", children: t.isCore ? "Core" : "Vision" }), t.requiresJudge && _jsx(Badge, { variant: "outline", children: "Optional judge" }), _jsx("span", { className: "text-neutral-grey-50 ml-auto hidden text-xs md:inline", children: t.category })] }) }), _jsx(AccordionContent, { children: _jsxs("div", { className: "space-y-3 pb-3", children: [t.description && t.description !== t.category && _jsx("p", { className: "text-neutral-grey-100 text-sm", children: t.description }), _jsxs("dl", { className: "grid gap-3 sm:grid-cols-3", children: [_jsxs("div", { className: "bg-neutral-grey-5 rounded p-3", children: [_jsx("dt", { className: "text-neutral-grey-50 text-xs font-medium", children: "Tool-call budget" }), _jsxs("dd", { className: "text-neutral-grey-100 mt-1 text-sm font-medium tabular-nums", children: [t.toolCallBudget, " calls"] })] }), _jsxs("div", { className: "bg-neutral-grey-5 rounded p-3", children: [_jsx("dt", { className: "text-neutral-grey-50 text-xs font-medium", children: "Cost budget" }), _jsx("dd", { className: "text-neutral-grey-100 mt-1 text-sm font-medium tabular-nums", children: cost(t.costBudgetUsd) })] }), _jsxs("div", { className: "bg-neutral-grey-5 rounded p-3", children: [_jsx("dt", { className: "text-neutral-grey-50 text-xs font-medium", children: "Timeout" }), _jsx("dd", { className: "text-neutral-grey-100 mt-1 text-sm font-medium tabular-nums", children: duration(t.timeoutSeconds * 1000) })] })] }), _jsxs("div", { children: [_jsx("h4", { className: "text-neutral-grey-50 mb-1.5 text-xs font-medium tracking-wide uppercase", children: "Prompt" }), _jsx("p", { className: "bg-neutral-grey-5 text-neutral-grey-100 rounded p-3 text-sm whitespace-pre-wrap", children: t.prompt })] })] }) })] }, t.key)) }) });
7
+ return (_jsx(SettingsEmptyState, { icon: ListChecks, title: "No tasks are defined in the current suite." }));
8
+ return (_jsx(Accordion, { type: "multiple", className: "-mt-3", children: tasks.map((t) => (_jsxs(AccordionItem, { value: t.key, className: "border-border-default last:border-b-0", children: [_jsx(AccordionTrigger, { className: "py-3 hover:no-underline", children: _jsxs("span", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1", children: [_jsx("span", { className: settingsText.label, children: t.title }), _jsxs("span", { className: settingsText.meta, children: [t.isCore ? "Core" : "Vision", t.requiresJudge && " · optional judge"] }), _jsx("span", { className: cn("ml-auto hidden md:inline", settingsText.meta), children: t.category })] }) }), _jsx(AccordionContent, { children: _jsxs("div", { className: "flex flex-col gap-4 pb-3", children: [t.description && t.description !== t.category && (_jsx("p", { className: settingsText.body, children: t.description })), _jsxs(SettingsStatGrid, { children: [_jsx(SettingsStat, { label: "Tool-call budget", value: `${t.toolCallBudget} calls` }), _jsx(SettingsStat, { label: "Cost budget", value: cost(t.costBudgetUsd) }), _jsx(SettingsStat, { label: "Timeout", value: duration(t.timeoutSeconds * 1000) })] }), _jsxs("div", { children: [_jsx("h4", { className: settingsText.caption, children: "Prompt" }), _jsx("p", { className: cn("bg-neutral-grey-5 mt-1.5 rounded-md p-3 whitespace-pre-wrap", settingsText.body), children: t.prompt })] })] }) })] }, t.key))) }));
8
9
  }
@@ -1,5 +1,5 @@
1
1
  import type { BenchmarkStatus } from "../types";
2
- export declare function NotPreparedState({ status, busy, prepare }: {
2
+ export declare function NotPreparedState({ status, busy, prepare, }: {
3
3
  status: BenchmarkStatus;
4
4
  busy: boolean;
5
5
  prepare: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"NotPreparedState.d.ts","sourceRoot":"","sources":["../../src/components/NotPreparedState.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAAE,MAAM,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,+BAS1H"}
1
+ {"version":3,"file":"NotPreparedState.d.ts","sourceRoot":"","sources":["../../src/components/NotPreparedState.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,IAAI,EACJ,OAAO,GACR,EAAE;IACD,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,+BA2CA"}
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Alert, AlertDescription, Button, SettingsCard } from "@parhelia/core";
3
- import { AlertCircle, ShieldCheck } from "lucide-react";
4
- export function NotPreparedState({ status, busy, prepare }) {
5
- return _jsx("div", { "data-testid": "benchmark-not-prepared", children: _jsx(SettingsCard, { icon: _jsx(ShieldCheck, { className: "h-5 w-5", strokeWidth: 1 }), title: "Prepare the benchmark environment", description: "Create the restricted service account, permissions, quota and folders used for isolated task copies.", children: _jsxs("div", { className: "space-y-4", children: [status.prepared.error && _jsxs(Alert, { variant: "destructive", children: [_jsx(AlertCircle, { className: "h-4 w-4", strokeWidth: 1.5 }), _jsx(AlertDescription, { children: status.prepared.error })] }), !status.migrationsApplied && _jsxs(Alert, { variant: "warning", children: [_jsx(AlertCircle, { className: "h-4 w-4", strokeWidth: 1.5 }), _jsxs(AlertDescription, { children: ["Missing database tables: ", status.missingTables.join(", "), ". Apply the module migrations before preparing."] })] }), _jsxs("p", { className: "text-neutral-grey-50 text-sm", children: ["Preparation runs once per environment", status.runnerUser ? ` and creates the runner user ${status.runnerUser}` : "", ". Existing content is not touched."] }), _jsx("div", { children: _jsx(Button, { "data-testid": "benchmark-prepare-button", disabled: busy || !status.migrationsApplied, onClick: prepare, children: "Prepare environment" }) })] }) }) });
2
+ import { Alert, AlertDescription, Button, SettingsCard, settingsText, } from "@parhelia/core";
3
+ import { AlertCircle, AlertTriangle, ShieldCheck } from "lucide-react";
4
+ export function NotPreparedState({ status, busy, prepare, }) {
5
+ return (_jsx(SettingsCard, { icon: _jsx(ShieldCheck, { strokeWidth: 1 }), title: "Prepare the benchmark environment", description: "Create the restricted service account, permissions, quota and folders used for isolated task copies.", headerActions: _jsx(Button, { size: "sm", "data-testid": "benchmark-prepare-button", disabled: busy || !status.migrationsApplied, onClick: prepare, children: "Prepare environment" }), children: _jsxs("div", { "data-testid": "benchmark-not-prepared", className: "flex flex-col gap-4", children: [status.prepared.error && (_jsxs(Alert, { variant: "destructive", children: [_jsx(AlertCircle, { className: "h-4 w-4", strokeWidth: 1 }), _jsx(AlertDescription, { children: status.prepared.error })] })), !status.migrationsApplied && (_jsxs(Alert, { variant: "warning", children: [_jsx(AlertTriangle, { className: "h-4 w-4", strokeWidth: 1 }), _jsxs(AlertDescription, { children: ["Missing database tables: ", status.missingTables.join(", "), ". Apply the module migrations before preparing."] })] })), _jsxs("p", { className: settingsText.help, children: ["Preparation runs once per environment", status.runnerUser
6
+ ? ` and creates the runner user ${status.runnerUser}`
7
+ : "", ". Existing content is not touched."] })] }) }));
6
8
  }
@@ -1,5 +1,5 @@
1
1
  import type { BenchmarkTaskResult } from "../types";
2
- export declare function RecoveryBanner({ tasks, busy, recover }: {
2
+ export declare function RecoveryBanner({ tasks, busy, recover, }: {
3
3
  tasks: BenchmarkTaskResult[];
4
4
  busy: boolean;
5
5
  recover: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"RecoveryBanner.d.ts","sourceRoot":"","sources":["../../src/components/RecoveryBanner.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAiB,MAAM,UAAU,CAAC;AAOnE,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,sCAe5H"}
1
+ {"version":3,"file":"RecoveryBanner.d.ts","sourceRoot":"","sources":["../../src/components/RecoveryBanner.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAiB,MAAM,UAAU,CAAC;AAOnE,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,IAAI,EACJ,OAAO,GACR,EAAE;IACD,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,sCAoCA"}
@@ -7,8 +7,8 @@ const recoveryReasons = {
7
7
  Unconfirmed: "Agent could not be confirmed stopped",
8
8
  Confirmed: "Agent stopped; test data cleanup required",
9
9
  };
10
- export function RecoveryBanner({ tasks, busy, recover }) {
10
+ export function RecoveryBanner({ tasks, busy, recover, }) {
11
11
  if (!tasks.length)
12
12
  return null;
13
- return _jsxs(Alert, { "data-testid": "benchmark-recovery-banner", variant: "warning", role: "status", children: [_jsx(AlertTriangle, { className: "h-4 w-4", strokeWidth: 1.5 }), _jsxs("div", { className: "flex flex-wrap items-start justify-between gap-x-6 gap-y-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs(AlertTitle, { children: [tasks.length, " ", tasks.length === 1 ? "task needs" : "tasks need", " recovery"] }), _jsxs(AlertDescription, { children: [_jsx("p", { children: "Recover these tasks to safely stop any remaining agents and clean up their test data before starting another benchmark." }), _jsx("ul", { className: "mt-2 space-y-0.5", children: tasks.map(t => _jsxs("li", { children: [_jsx("span", { className: "font-medium", children: t.taskTitle }), " \u00B7 ", recoveryReasons[t.shutdownState]] }, t.taskResultId)) })] })] }), _jsx(Button, { size: "sm", disabled: busy, onClick: recover, children: "Recover now" })] })] });
13
+ return (_jsxs(Alert, { "data-testid": "benchmark-recovery-banner", variant: "warning", role: "status", children: [_jsx(AlertTriangle, { className: "h-4 w-4", strokeWidth: 1 }), _jsxs("div", { className: "flex flex-wrap items-start justify-between gap-x-6 gap-y-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs(AlertTitle, { children: [tasks.length, " ", tasks.length === 1 ? "task needs" : "tasks need", " ", "recovery"] }), _jsxs(AlertDescription, { children: [_jsx("p", { children: "Recover these tasks to safely stop any remaining agents and clean up their test data before starting another benchmark." }), _jsx("ul", { className: "mt-2 space-y-0.5", children: tasks.map((t) => (_jsxs("li", { children: [_jsx("span", { className: "font-medium", children: t.taskTitle }), " \u00B7", " ", recoveryReasons[t.shutdownState]] }, t.taskResultId))) })] })] }), _jsx(Button, { size: "sm", disabled: busy, onClick: recover, children: "Recover now" })] })] }));
14
14
  }
@@ -0,0 +1,6 @@
1
+ /** A run's status: badged only when the run failed; any other state is a plain note. */
2
+ export declare function RunStatus({ status, className, }: {
3
+ status: string;
4
+ className?: string;
5
+ }): import("react").JSX.Element;
6
+ //# sourceMappingURL=RunStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunStatus.d.ts","sourceRoot":"","sources":["../../src/components/RunStatus.tsx"],"names":[],"mappings":"AAeA,wFAAwF;AACxF,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,SAAS,GACV,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,+BASA"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Badge, capitalizeFirstLetter, cn, settingsText } from "@parhelia/core";
3
+ const labels = {
4
+ NeedsRecovery: "Needs recovery",
5
+ TimedOut: "Timed out",
6
+ CostLimit: "Cost limit",
7
+ TokenLimit: "Token limit",
8
+ };
9
+ const failed = [
10
+ "Failed",
11
+ "NeedsRecovery",
12
+ "Unconfirmed",
13
+ "TimedOut",
14
+ "CostLimit",
15
+ "TokenLimit",
16
+ ];
17
+ /** A run's status: badged only when the run failed; any other state is a plain note. */
18
+ export function RunStatus({ status, className, }) {
19
+ const label = capitalizeFirstLetter(labels[status] ?? status);
20
+ return failed.includes(status) ? (_jsx(Badge, { variant: "destructive", className: className, children: label })) : (_jsx("span", { className: cn(settingsText.meta, className), children: label }));
21
+ }
@@ -1,10 +1,18 @@
1
1
  import { type SafetyViolation, type TaskSafetyViolations } from "../safetyViolations";
2
+ /** The tool and its message. */
3
+ export declare function SafetyViolationMessage({ violation, }: {
4
+ violation: SafetyViolation;
5
+ }): import("react").JSX.Element;
6
+ /** The write's target item (shortened; the full path in a tooltip), language, version and fields. */
7
+ export declare function SafetyViolationTarget({ violation, }: {
8
+ violation: SafetyViolation;
9
+ }): import("react").JSX.Element | null;
2
10
  /** Tool and message, then the write's target item, language, version and fields. */
3
- export declare function SafetyViolationText({ violation }: {
11
+ export declare function SafetyViolationText({ violation, }: {
4
12
  violation: SafetyViolation;
5
13
  }): import("react").JSX.Element;
6
14
  /** Stat tile for a run with safety violations; opens a popover listing each violation by task. */
7
- export declare function SafetyViolationsStat({ total, groups, explanation }: {
15
+ export declare function SafetyViolationsStat({ total, groups, explanation, }: {
8
16
  total: number;
9
17
  groups: TaskSafetyViolations[];
10
18
  explanation: string;
@@ -1 +1 @@
1
- {"version":3,"file":"SafetyViolationsStat.d.ts","sourceRoot":"","sources":["../../src/components/SafetyViolationsStat.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEjG,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,eAAe,CAAA;CAAE,+BAQhF;AAED,kGAAkG;AAClG,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,+BA4B1I"}
1
+ {"version":3,"file":"SafetyViolationsStat.d.ts","sourceRoot":"","sources":["../../src/components/SafetyViolationsStat.tsx"],"names":[],"mappings":"AAeA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAE7B,gCAAgC;AAChC,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,GACV,EAAE;IACD,SAAS,EAAE,eAAe,CAAC;CAC5B,+BASA;AAED,qGAAqG;AACrG,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,GACV,EAAE;IACD,SAAS,EAAE,eAAe,CAAC;CAC5B,sCAsBA;AAED,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,GACV,EAAE;IACD,SAAS,EAAE,eAAe,CAAC;CAC5B,+BAaA;AAED,kGAAkG;AAClG,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,MAAM,EACN,WAAW,GACZ,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,oBAAoB,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB,+BAqGA"}
@@ -1,14 +1,24 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "@parhelia/core";
2
+ import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger, SettingsStat, Tooltip, TooltipContent, TooltipTrigger, cn, settingsText, } from "@parhelia/core";
3
3
  import { ChevronDown, Info, MessageSquare } from "lucide-react";
4
4
  import { agentLink } from "../agentLink";
5
5
  import { count } from "../format";
6
- import { shortPath } from "../safetyViolations";
6
+ import { shortPath, } from "../safetyViolations";
7
+ /** The tool and its message. */
8
+ export function SafetyViolationMessage({ violation, }) {
9
+ return (_jsxs("span", { className: "flex flex-wrap items-baseline gap-x-1.5", children: [violation.tool && (_jsx("code", { className: settingsText.mono, children: violation.tool })), _jsx("span", { className: "break-words", children: violation.message })] }));
10
+ }
11
+ /** The write's target item (shortened; the full path in a tooltip), language, version and fields. */
12
+ export function SafetyViolationTarget({ violation, }) {
13
+ if (!violation.target && !violation.details.length)
14
+ return null;
15
+ return (_jsxs("span", { className: "break-words", children: [violation.target && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("span", { children: shortPath(violation.target) }) }), _jsx(TooltipContent, { className: "max-w-sm break-all", children: violation.target })] })), violation.details.map((detail, index) => (_jsxs("span", { children: [(violation.target || index > 0) && " · ", detail] }, index)))] }));
16
+ }
7
17
  /** Tool and message, then the write's target item, language, version and fields. */
8
- export function SafetyViolationText({ violation }) {
9
- return _jsxs(_Fragment, { children: [_jsxs("p", { className: "text-neutral-grey-100 flex flex-wrap items-baseline gap-x-1.5", children: [violation.tool && _jsx("code", { className: "font-mono", children: violation.tool }), _jsx("span", { className: "break-words", children: violation.message })] }), (violation.target || violation.details.length > 0) && _jsxs("p", { className: "text-neutral-grey-50 mt-0.5 text-xs break-words", children: [violation.target && _jsx("span", { title: violation.target, children: shortPath(violation.target) }), violation.details.map((detail, index) => _jsxs("span", { children: [(violation.target || index > 0) && " · ", detail] }, index))] })] });
18
+ export function SafetyViolationText({ violation, }) {
19
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: settingsText.body, children: _jsx(SafetyViolationMessage, { violation: violation }) }), (violation.target || violation.details.length > 0) && (_jsx("div", { className: cn("mt-0.5", settingsText.meta), children: _jsx(SafetyViolationTarget, { violation: violation }) }))] }));
10
20
  }
11
21
  /** Stat tile for a run with safety violations; opens a popover listing each violation by task. */
12
- export function SafetyViolationsStat({ total, groups, explanation }) {
13
- return _jsxs(Popover, { children: [_jsx(PopoverAnchor, { asChild: true, children: _jsxs("div", { role: "group", "aria-label": `Safety violations: ${count(total)}`, className: "bg-neutral-grey-5 hover:bg-neutral-grey-10 focus-within:ring-ring relative rounded p-3 transition-colors focus-within:ring-2", children: [_jsxs("dt", { className: "text-neutral-grey-50 flex items-center gap-1.5 text-xs font-medium", children: ["Safety violations", _jsx(Info, { "aria-hidden": "true", className: "h-3.5 w-3.5 shrink-0", strokeWidth: 1.5 })] }), _jsx("dd", { className: "text-feedback-red mt-1 text-base font-medium tabular-nums", children: count(total) }), _jsx("dd", { className: "mt-0.5 text-xs", children: _jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", "data-testid": "benchmark-safety-violations-trigger", className: "text-neutral-grey-50 hover:text-neutral-grey-100 inline-flex cursor-pointer items-center gap-0.5 outline-none after:absolute after:inset-0 after:rounded", children: ["View details", _jsx(ChevronDown, { "aria-hidden": "true", className: "h-3.5 w-3.5", strokeWidth: 1.5 })] }) }) })] }) }), _jsxs(PopoverContent, { align: "start", sideOffset: 6, "data-testid": "benchmark-safety-violations", className: "w-96 max-w-[calc(100vw-2rem)] p-0", children: [_jsxs("div", { className: "border-border-default border-b px-4 py-3", children: [_jsxs("p", { className: "text-neutral-grey-100 text-sm font-medium", children: [count(total), " safety ", total === 1 ? "violation" : "violations"] }), _jsx("p", { className: "text-neutral-grey-50 mt-0.5 text-xs", children: explanation })] }), _jsx("div", { className: "max-h-80 space-y-3 overflow-y-auto px-4 py-3", children: groups.length ? groups.map(({ task, violations }) => _jsxs("section", { "data-testid": `benchmark-safety-violations-${task.taskKey}`, children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("h4", { className: "text-neutral-grey-100 text-xs font-medium", children: task.taskTitle }), task.agentId && _jsxs("a", { href: agentLink(task.agentId), className: "text-neutral-grey-50 hover:text-neutral-grey-100 inline-flex shrink-0 items-center gap-1 text-xs", children: [_jsx(MessageSquare, { "aria-hidden": "true", className: "h-3.5 w-3.5", strokeWidth: 1.5 }), "Conversation"] })] }), _jsx("ul", { className: "mt-1.5 space-y-1.5", children: violations.map((violation, index) => _jsx("li", { className: "bg-neutral-grey-5 rounded px-2.5 py-2 text-xs", children: _jsx(SafetyViolationText, { violation: violation }) }, index)) })] }, task.taskKey)) : _jsx("p", { className: "text-neutral-grey-50 text-xs", children: "No violation details were recorded for this run." }) })] })] });
22
+ export function SafetyViolationsStat({ total, groups, explanation, }) {
23
+ return (_jsxs(Popover, { children: [_jsx(PopoverAnchor, { asChild: true, children: _jsx("div", { role: "group", "aria-label": `Safety violations: ${count(total)}`, className: "focus-within:ring-ring hover:[&>div]:bg-neutral-grey-10 relative min-w-0 rounded-md focus-within:ring-2 [&>div]:transition-colors", children: _jsx(SettingsStat, { tone: "danger", label: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: ["Safety violations", _jsx(Info, { "aria-hidden": "true", className: "size-3.5 shrink-0", strokeWidth: 1 })] }), value: count(total), hint: _jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", "data-testid": "benchmark-safety-violations-trigger", className: "hover:text-neutral-grey-100 inline-flex cursor-pointer items-center gap-0.5 outline-none after:absolute after:inset-0 after:rounded-md", children: ["View details", _jsx(ChevronDown, { "aria-hidden": "true", className: "size-3.5", strokeWidth: 1 })] }) }) }) }) }), _jsxs(PopoverContent, { align: "start", sideOffset: 6, "data-testid": "benchmark-safety-violations", className: "w-96 max-w-[calc(100vw-2rem)] p-0", children: [_jsxs("div", { className: "border-border-default border-b px-4 py-3", children: [_jsxs("p", { className: settingsText.label, children: [count(total), " safety ", total === 1 ? "violation" : "violations"] }), _jsx("p", { className: cn("mt-0.5", settingsText.help), children: explanation })] }), _jsx("div", { className: "flex max-h-80 flex-col gap-4 overflow-y-auto px-4 py-3", children: groups.length ? (groups.map(({ task, violations }) => (_jsxs("section", { "data-testid": `benchmark-safety-violations-${task.taskKey}`, children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("h4", { className: settingsText.label, children: task.taskTitle }), task.agentId && (_jsxs("a", { href: agentLink(task.agentId), className: cn("hover:text-neutral-grey-100 inline-flex shrink-0 items-center gap-1", settingsText.meta), children: [_jsx(MessageSquare, { "aria-hidden": "true", className: "size-3.5", strokeWidth: 1 }), "Conversation"] }))] }), _jsx("ul", { className: "mt-1.5 flex flex-col gap-1.5", children: violations.map((violation, index) => (_jsx("li", { className: "bg-neutral-grey-5 rounded-md px-3 py-2", children: _jsx(SafetyViolationText, { violation: violation }) }, index))) })] }, task.taskKey)))) : (_jsx("p", { className: settingsText.meta, children: "No violation details were recorded for this run." })) })] })] }));
14
24
  }
@@ -2,7 +2,7 @@ import type { BenchmarkModel, StartRequest } from "../types";
2
2
  export declare function VisionNote({ model }: {
3
3
  model: BenchmarkModel;
4
4
  }): import("react").JSX.Element;
5
- export declare function StartBenchmarkDialog({ open, onOpenChange, start, busy }: {
5
+ export declare function StartBenchmarkDialog({ open, onOpenChange, start, busy, }: {
6
6
  open: boolean;
7
7
  onOpenChange: (open: boolean) => void;
8
8
  start: (request: StartRequest) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"StartBenchmarkDialog.d.ts","sourceRoot":"","sources":["../../src/components/StartBenchmarkDialog.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAiB,YAAY,EAAE,MAAM,UAAU,CAAC;AAc5E,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,cAAc,CAAA;CAAE,+BAU9D;AAED,wBAAgB,oBAAoB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,+BAmGjM"}
1
+ {"version":3,"file":"StartBenchmarkDialog.d.ts","sourceRoot":"","sources":["../../src/components/StartBenchmarkDialog.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,cAAc,EAAiB,YAAY,EAAE,MAAM,UAAU,CAAC;AAS5E,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,cAAc,CAAA;CAAE,+BAkB9D;AAED,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,IAAI,GACL,EAAE;IACD,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,EAAE,OAAO,CAAC;CACf,+BAuSA"}
@@ -1,22 +1,23 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from "react";
3
- import { Alert, AlertDescription, Button, Checkbox, Dialog, DialogContent, DialogFooter, Input, Label, MultiSwitchButton, Select, StyledDialogTitle, Switch } from "@parhelia/core";
4
- import { AlertCircle, CircleHelp, Gauge, Image, ImageOff } from "lucide-react";
3
+ import { Alert, AlertDescription, Button, Checkbox, Dialog, DialogContent, DialogFooter, FormField, Input, Label, MultiSwitchButton, Select, SettingsRow, SettingsStat, SettingsStatGrid, StyledDialogTitle, Switch, cn, settingsTable, settingsText, } from "@parhelia/core";
4
+ import { AlertCircle, AlertTriangle, CircleHelp, Gauge, Image, ImageOff, } from "lucide-react";
5
5
  import { benchmarkService } from "../services/benchmarkService";
6
6
  const runPresets = ["1", "2", "3", "5", "10"];
7
- function formatUsd(value) { return value == null ? "–" : `$${value}`; }
8
- function PriceTile({ label, value }) {
9
- return _jsxs("div", { className: "min-w-0 px-4 py-3", children: [_jsx("p", { className: "text-neutral-grey-50 text-2xs font-medium tracking-wide uppercase", children: label }), _jsx("p", { className: "text-neutral-grey-100 mt-0.5 truncate text-base font-semibold tabular-nums", children: formatUsd(value) })] });
7
+ function formatUsd(value) {
8
+ return value == null ? "–" : `$${value}`;
10
9
  }
11
10
  export function VisionNote({ model }) {
12
11
  const state = model.supportsImageInput;
13
12
  const Icon = state === true ? Image : state === false ? ImageOff : CircleHelp;
14
- const text = state === true ? "Accepts image input. The hero image task will run."
15
- : state === false ? "Does not accept images. The hero image task will be skipped."
13
+ const text = state === true
14
+ ? "Accepts image input. The hero image task will run."
15
+ : state === false
16
+ ? "Does not accept images. The hero image task will be skipped."
16
17
  : "Image input capability is not recorded in Parhelia. The hero image task will still run.";
17
- return _jsxs("div", { className: "text-neutral-grey-50 flex items-start gap-2 text-xs", children: [_jsx(Icon, { className: "mt-px h-3.5 w-3.5 shrink-0", strokeWidth: 1.5 }), _jsx("p", { children: text })] });
18
+ return (_jsxs("div", { className: cn("flex items-start gap-2", settingsText.help), children: [_jsx("span", { className: "flex h-5 shrink-0 items-center", children: _jsx(Icon, { className: "size-3.5", strokeWidth: 1 }) }), _jsx("p", { children: text })] }));
18
19
  }
19
- export function StartBenchmarkDialog({ open, onOpenChange, start, busy }) {
20
+ export function StartBenchmarkDialog({ open, onOpenChange, start, busy, }) {
20
21
  const [models, setModels] = useState([]);
21
22
  const [tasks, setTasks] = useState([]);
22
23
  const [modelId, setModelId] = useState("");
@@ -29,20 +30,55 @@ export function StartBenchmarkDialog({ open, onOpenChange, start, busy }) {
29
30
  if (!open)
30
31
  return;
31
32
  let alive = true;
32
- Promise.all([benchmarkService.models(), benchmarkService.tasks()]).then(([m, t]) => { if (alive) {
33
- setModels(m.models);
34
- setTasks(t.tasks);
35
- setSelected(t.tasks.map(x => x.id));
36
- setError(undefined);
37
- } }).catch(e => { if (alive)
38
- setError(String(e)); });
39
- return () => { alive = false; };
33
+ Promise.all([benchmarkService.models(), benchmarkService.tasks()])
34
+ .then(([m, t]) => {
35
+ if (alive) {
36
+ setModels(m.models);
37
+ setTasks(t.tasks);
38
+ setSelected(t.tasks.map((x) => x.id));
39
+ setError(undefined);
40
+ }
41
+ })
42
+ .catch((e) => {
43
+ if (alive)
44
+ setError(String(e));
45
+ });
46
+ return () => {
47
+ alive = false;
48
+ };
40
49
  }, [open]);
41
- const model = models.find(m => m.id === modelId);
42
- const valid = !!model && (model.hasPricing || allowUnknown) && runCount >= 1 && runCount <= 10 && Number.isInteger(runCount) && (!subset || selected.length > 0);
50
+ const model = models.find((m) => m.id === modelId);
51
+ const valid = !!model &&
52
+ (model.hasPricing || allowUnknown) &&
53
+ runCount >= 1 &&
54
+ runCount <= 10 &&
55
+ Number.isInteger(runCount) &&
56
+ (!subset || selected.length > 0);
43
57
  const pricing = model?.pricing;
44
- const preset = runPresets.find(p => Number(p) === runCount);
58
+ const preset = runPresets.find((p) => Number(p) === runCount);
45
59
  const taskCount = subset ? selected.length : tasks.length;
46
- const summary = model ? `${taskCount} task${taskCount === 1 ? "" : "s"} × ${runCount} run${runCount === 1 ? "" : "s"}` : undefined;
47
- return _jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { "data-testid": "benchmark-start-dialog", className: "flex max-h-[85vh] max-w-xl flex-col gap-0 overflow-hidden p-0", children: [_jsx(StyledDialogTitle, { icon: _jsx(Gauge, { strokeWidth: 1 }), title: "Start benchmark", subtitle: "Every task runs on a fresh content and media copy with the same model and configuration" }), _jsxs("div", { className: "min-h-0 flex-1 space-y-6 overflow-y-auto px-6 py-5", children: [error && _jsxs(Alert, { variant: "destructive", children: [_jsx(AlertCircle, { className: "h-4 w-4", strokeWidth: 1.5 }), _jsx(AlertDescription, { children: error })] }), _jsxs("section", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "benchmark-model", children: "Model" }), _jsx(Select, { id: "benchmark-model", "data-testid": "benchmark-start-model-select", searchable: true, placeholder: "Choose a model", value: modelId, options: models.map(m => ({ value: m.id, label: `${m.name} · ${m.providerName}`, description: m.hasPricing ? "Pricing available" : "Cost unknown" })), onValueChange: id => { setModelId(id); setAllowUnknown(false); } }), model && _jsxs("div", { className: "border-border-default overflow-hidden rounded-lg border", children: [model.hasPricing ? _jsxs(_Fragment, { children: [_jsxs("div", { className: "border-border-default flex items-center justify-between border-b px-4 py-2", children: [_jsx("p", { className: "text-neutral-grey-100 text-xs font-medium", children: "Pricing" }), _jsx("p", { className: "text-neutral-grey-50 text-xs", children: "USD per million tokens" })] }), _jsxs("div", { className: "divide-border-default grid grid-cols-3 divide-x", children: [_jsx(PriceTile, { label: "Input", value: pricing?.inputCostPer1MTokens }), _jsx(PriceTile, { label: "Output", value: pricing?.outputCostPer1MTokens }), _jsx(PriceTile, { label: "Cached input", value: pricing?.cachedInputCostPer1MTokens })] })] }) : _jsxs("div", { className: "space-y-3 px-4 py-3", children: [_jsxs("div", { className: "text-neutral-grey-100 flex items-start gap-2 text-xs", children: [_jsx(AlertCircle, { className: "text-feedback-orange mt-px h-3.5 w-3.5 shrink-0", strokeWidth: 1.5 }), _jsx("p", { children: "No pricing is configured for this model, so cost cannot be tracked. Token and time limits still apply." })] }), _jsxs("label", { className: "text-neutral-grey-100 flex items-center gap-2 text-sm", children: [_jsx(Checkbox, { "data-testid": "benchmark-start-allow-unknown-cost", checked: allowUnknown, onCheckedChange: v => setAllowUnknown(v === true) }), "Run without cost tracking"] })] }), _jsx("div", { className: "border-border-default bg-neutral-grey-5 border-t px-4 py-2.5", children: _jsx(VisionNote, { model: model }) })] })] }), _jsxs("section", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "benchmark-count", children: "Runs" }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(MultiSwitchButton, { value: preset ?? "", options: runPresets.map(value => ({ value, label: value })), onValueChange: value => setRunCount(Number(value)), className: "w-56 shrink-0", "aria-label": "Number of runs", testId: "benchmark-start-run-presets" }), _jsx("span", { className: "text-neutral-grey-50 text-xs", children: "or" }), _jsx(Input, { id: "benchmark-count", className: "w-16 text-center tabular-nums", type: "number", min: 1, max: 10, value: runCount, onChange: e => setRunCount(Number(e.target.value)), "aria-label": "Custom number of runs" })] }), _jsx("p", { className: "text-neutral-grey-50 text-xs", children: "Between 1 and 10. Repeated runs improve the leaderboard median." })] }), _jsxs("section", { className: "border-border-default overflow-hidden rounded-lg border", children: [_jsxs("label", { className: "flex cursor-pointer items-center justify-between gap-4 px-4 py-3", children: [_jsxs("span", { className: "min-w-0", children: [_jsx("span", { className: "text-neutral-grey-100 block text-sm font-medium", children: "Choose a task subset" }), _jsx("span", { className: "text-neutral-grey-50 block text-xs", children: "Run only selected tasks. Subset runs are excluded from the leaderboard." })] }), _jsx(Switch, { checked: subset, onCheckedChange: setSubset, "data-testid": "benchmark-start-subset" })] }), subset && _jsxs("div", { className: "border-border-default bg-neutral-grey-5 space-y-3 border-t px-4 py-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("p", { className: "text-neutral-grey-50 text-xs tabular-nums", children: [selected.length, " of ", tasks.length, " selected"] }), _jsxs("div", { className: "flex gap-1", children: [_jsx(Button, { size: "xs", variant: "ghost", onClick: () => setSelected(tasks.map(t => t.id)), disabled: selected.length === tasks.length, children: "Select all" }), _jsx(Button, { size: "xs", variant: "ghost", onClick: () => setSelected([]), disabled: !selected.length, children: "Clear" })] })] }), _jsxs("table", { "aria-label": "Task subset", className: "w-full table-fixed border-collapse text-left", children: [_jsx("thead", { className: "text-neutral-grey-50 text-xs", children: _jsxs("tr", { className: "border-border-default border-b", children: [_jsx("th", { scope: "col", className: "w-1/2 px-2 py-2 font-medium", children: "Task" }), _jsx("th", { scope: "col", className: "px-2 py-2 font-medium", children: "Category" })] }) }), _jsx("tbody", { children: tasks.map(t => _jsxs("tr", { className: "border-border-default border-b last:border-b-0", children: [_jsx("td", { className: "px-2 py-2 align-top", children: _jsxs("label", { className: "text-neutral-grey-100 flex cursor-pointer items-start gap-2 text-sm", children: [_jsx(Checkbox, { className: "mt-0.5 shrink-0", checked: selected.includes(t.id), onCheckedChange: v => setSelected(old => v === true ? [...old, t.id] : old.filter(id => id !== t.id)) }), _jsx("span", { className: "min-w-0 break-words", children: t.title })] }) }), _jsxs("td", { className: "text-neutral-grey-50 break-words px-2 py-2 align-top text-xs", children: [t.category, t.requiresVision ? " · vision" : "", t.isCore ? "" : " · optional"] })] }, t.id)) })] })] })] })] }), _jsxs(DialogFooter, { className: "border-border-default shrink-0 items-center border-t px-6 py-4 sm:justify-between", children: [_jsx("p", { className: "text-neutral-grey-50 text-xs tabular-nums", children: summary }), _jsxs("div", { className: "flex flex-col-reverse gap-3 sm:flex-row", children: [_jsx(Button, { variant: "outline", onClick: () => onOpenChange(false), disabled: busy, children: "Cancel" }), _jsx(Button, { "data-testid": "benchmark-start-submit", disabled: !valid || busy, onClick: () => { setError(undefined); void start({ modelItemId: modelId, runCount, taskIds: subset ? selected : undefined, allowUnknownCost: allowUnknown }).catch(e => setError(String(e))); }, children: busy ? "Starting…" : "Start benchmark" })] })] })] }) });
60
+ const summary = model
61
+ ? `${taskCount} task${taskCount === 1 ? "" : "s"} × ${runCount} run${runCount === 1 ? "" : "s"}`
62
+ : undefined;
63
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { "data-testid": "benchmark-start-dialog", className: "flex max-h-[85vh] max-w-xl flex-col gap-0 overflow-hidden p-0", children: [_jsx(StyledDialogTitle, { icon: _jsx(Gauge, { strokeWidth: 1 }), title: "Start benchmark", subtitle: "Every task runs on a fresh content and media copy with the same model and configuration" }), _jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto px-6 py-5", children: [error && (_jsxs(Alert, { variant: "destructive", children: [_jsx(AlertCircle, { className: "h-4 w-4", strokeWidth: 1 }), _jsx(AlertDescription, { children: error })] })), _jsxs("div", { className: "flex flex-col gap-3", children: [_jsx(FormField, { label: "Model", children: _jsx(Select, { id: "benchmark-model", "data-testid": "benchmark-start-model-select", searchable: true, placeholder: "Choose a model", value: modelId, options: models.map((m) => ({
64
+ value: m.id,
65
+ label: `${m.name} · ${m.providerName}`,
66
+ description: m.hasPricing
67
+ ? "Pricing available"
68
+ : "Cost unknown",
69
+ })), onValueChange: (id) => {
70
+ setModelId(id);
71
+ setAllowUnknown(false);
72
+ } }) }), model &&
73
+ (model.hasPricing ? (_jsxs("div", { children: [_jsxs("div", { className: "flex items-baseline justify-between gap-3", children: [_jsx("p", { className: settingsText.caption, children: "Pricing" }), _jsx("p", { className: settingsText.meta, children: "USD per million tokens" })] }), _jsxs(SettingsStatGrid, { className: "mt-1.5 grid-cols-3", children: [_jsx(SettingsStat, { label: "Input", value: formatUsd(pricing?.inputCostPer1MTokens) }), _jsx(SettingsStat, { label: "Output", value: formatUsd(pricing?.outputCostPer1MTokens) }), _jsx(SettingsStat, { label: "Cached input", value: formatUsd(pricing?.cachedInputCostPer1MTokens) })] })] })) : (_jsxs(_Fragment, { children: [_jsxs(Alert, { variant: "warning", children: [_jsx(AlertTriangle, { className: "h-4 w-4", strokeWidth: 1 }), _jsx(AlertDescription, { children: "No pricing is configured for this model, so cost cannot be tracked. Token and time limits still apply." })] }), _jsxs("label", { className: cn("flex items-center gap-2", settingsText.body), children: [_jsx(Checkbox, { "data-testid": "benchmark-start-allow-unknown-cost", checked: allowUnknown, onCheckedChange: (v) => setAllowUnknown(v === true) }), "Run without cost tracking"] })] }))), model && _jsx(VisionNote, { model: model })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "benchmark-count", className: settingsText.label, children: "Runs" }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(MultiSwitchButton, { value: preset ?? "", options: runPresets.map((value) => ({ value, label: value })), onValueChange: (value) => setRunCount(Number(value)), className: "w-56 shrink-0", "aria-label": "Number of runs", testId: "benchmark-start-run-presets" }), _jsx("span", { className: settingsText.meta, children: "or" }), _jsx(Input, { id: "benchmark-count", className: "w-16 text-center tabular-nums", type: "number", min: 1, max: 10, value: runCount, onChange: (e) => setRunCount(Number(e.target.value)), "aria-label": "Custom number of runs" })] }), _jsx("p", { className: settingsText.help, children: "Between 1 and 10. Repeated runs improve the leaderboard median." })] }), _jsx("div", { children: _jsx(SettingsRow, { label: "Choose a task subset", htmlFor: "benchmark-start-subset", description: "Run only selected tasks. Subset runs are excluded from the leaderboard.", toggle: _jsx(Switch, { id: "benchmark-start-subset", checked: subset, onCheckedChange: setSubset, "data-testid": "benchmark-start-subset" }), children: subset && (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("p", { className: cn("tabular-nums", settingsText.meta), children: [selected.length, " of ", tasks.length, " selected"] }), _jsxs("div", { className: "flex gap-1", children: [_jsx(Button, { size: "xs", variant: "ghost", onClick: () => setSelected(tasks.map((t) => t.id)), disabled: selected.length === tasks.length, children: "Select all" }), _jsx(Button, { size: "xs", variant: "ghost", onClick: () => setSelected([]), disabled: !selected.length, children: "Clear" })] })] }), _jsxs("table", { "aria-label": "Task subset", className: cn(settingsTable.table, "table-fixed"), children: [_jsx("thead", { className: settingsTable.head, children: _jsxs("tr", { children: [_jsx("th", { scope: "col", className: cn(settingsTable.th, "w-1/2 pl-0"), children: "Task" }), _jsx("th", { scope: "col", className: cn(settingsTable.th, "pr-0"), children: "Category" })] }) }), _jsx("tbody", { children: tasks.map((t) => (_jsxs("tr", { className: settingsTable.row, children: [_jsx("td", { className: cn(settingsTable.td, "py-2 pl-0 align-top"), children: _jsxs("label", { className: "flex cursor-pointer items-start gap-2", children: [_jsx("span", { className: "flex h-5 shrink-0 items-center", children: _jsx(Checkbox, { checked: selected.includes(t.id), onCheckedChange: (v) => setSelected((old) => v === true
74
+ ? [...old, t.id]
75
+ : old.filter((id) => id !== t.id)) }) }), _jsx("span", { className: "min-w-0 break-words", children: t.title })] }) }), _jsxs("td", { className: cn(settingsTable.td, "py-2 pr-0 align-top break-words", settingsText.meta), children: [t.category, t.requiresVision ? " · vision" : "", t.isCore ? "" : " · optional"] })] }, t.id))) })] })] })) }) })] }), _jsxs(DialogFooter, { className: "border-border-default shrink-0 items-center border-t px-6 py-4 sm:justify-between", children: [_jsx("p", { className: cn("tabular-nums", settingsText.meta), children: summary }), _jsxs("div", { className: "flex flex-col-reverse gap-3 sm:flex-row", children: [_jsx(Button, { variant: "outline", onClick: () => onOpenChange(false), disabled: busy, children: "Cancel" }), _jsx(Button, { "data-testid": "benchmark-start-submit", disabled: !valid || busy, onClick: () => {
76
+ setError(undefined);
77
+ void start({
78
+ modelItemId: modelId,
79
+ runCount,
80
+ taskIds: subset ? selected : undefined,
81
+ allowUnknownCost: allowUnknown,
82
+ }).catch((e) => setError(String(e)));
83
+ }, children: busy ? "Starting…" : "Start benchmark" })] })] })] }) }));
48
84
  }
@@ -1,6 +1,6 @@
1
1
  import type { SafetyViolation } from "../safetyViolations";
2
2
  import type { GraderReport } from "../types";
3
- export declare function TaskChecksList({ report, violations }: {
3
+ export declare function TaskChecksList({ report, violations, }: {
4
4
  report?: GraderReport;
5
5
  violations?: SafetyViolation[];
6
6
  }): import("react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"TaskChecksList.d.ts","sourceRoot":"","sources":["../../src/components/TaskChecksList.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,UAAU,CAAC;AAgBxD,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,UAAe,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,YAAY,CAAC;IAAC,UAAU,CAAC,EAAE,eAAe,EAAE,CAAA;CAAE,+BAyBpH"}
1
+ {"version":3,"file":"TaskChecksList.d.ts","sourceRoot":"","sources":["../../src/components/TaskChecksList.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,UAAU,CAAC;AAqDxD,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,UAAe,GAChB,EAAE;IACD,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;CAChC,+BAsFA"}
@@ -1,32 +1,41 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Alert, AlertDescription, Badge } from "@parhelia/core";
3
- import { AlertCircle, CheckCircle2, MinusCircle, ShieldAlert, XCircle } from "lucide-react";
4
- import { SafetyViolationText } from "./SafetyViolationsStat";
5
- const groups = [{ key: "work", label: "Work" }, { key: "preservation", label: "Preservation" }, { key: "efficiency", label: "Efficiency" }, { key: "judge", label: "Judge" }];
2
+ import { Alert, AlertDescription, SettingsGroup, SettingsList, SettingsListItem, cn, settingsText, } from "@parhelia/core";
3
+ import { AlertCircle, CheckCircle2, MinusCircle, ShieldAlert, XCircle, } from "lucide-react";
4
+ import { SafetyViolationMessage, SafetyViolationTarget, } from "./SafetyViolationsStat";
5
+ const groups = [
6
+ { key: "work", label: "Work" },
7
+ { key: "preservation", label: "Preservation" },
8
+ { key: "efficiency", label: "Efficiency" },
9
+ { key: "judge", label: "Judge" },
10
+ ];
6
11
  const points = (value) => Number.isInteger(value) ? String(value) : value.toFixed(1);
12
+ /** List item titles truncate to one line; check descriptions and violation messages wrap instead. */
13
+ const wrap = "block whitespace-normal break-words";
7
14
  function CheckIcon({ check }) {
8
15
  if (check.skipped)
9
- return _jsx(MinusCircle, { "aria-label": "Skipped", className: "text-neutral-grey-50 mt-0.5 h-4 w-4 shrink-0", strokeWidth: 1.5 });
16
+ return (_jsx(MinusCircle, { "aria-label": "Skipped", className: "text-neutral-grey-50", strokeWidth: 1 }));
10
17
  if (check.passed)
11
- return _jsx(CheckCircle2, { "aria-label": "Passed", className: "text-feedback-green mt-0.5 h-4 w-4 shrink-0", strokeWidth: 1.5 });
12
- return _jsx(XCircle, { "aria-label": "Failed", className: "text-feedback-red mt-0.5 h-4 w-4 shrink-0", strokeWidth: 1.5 });
18
+ return (_jsx(CheckCircle2, { "aria-label": "Passed", className: "text-feedback-green", strokeWidth: 1 }));
19
+ return (_jsx(XCircle, { "aria-label": "Failed", className: "text-feedback-red", strokeWidth: 1 }));
13
20
  }
14
21
  /** Grading zeroes correctness for a failed critical check and for any safety violation; name whichever applied. */
15
22
  function zeroReason(report, violations) {
16
- const criticalCheck = report.checks.some(c => c.critical && !c.passed && !c.skipped);
23
+ const criticalCheck = report.checks.some((c) => c.critical && !c.passed && !c.skipped);
17
24
  if (violations && criticalCheck)
18
25
  return "A critical check failed and safety violations were recorded.";
19
26
  if (violations)
20
- return violations === 1 ? "A safety violation was recorded." : `${violations} safety violations were recorded.`;
27
+ return violations === 1
28
+ ? "A safety violation was recorded."
29
+ : `${violations} safety violations were recorded.`;
21
30
  return "A critical check failed.";
22
31
  }
23
- export function TaskChecksList({ report, violations = [] }) {
32
+ export function TaskChecksList({ report, violations = [], }) {
24
33
  if (!report)
25
- return _jsx("p", { className: "text-neutral-grey-50 text-sm", children: "Grading is not available for this task." });
26
- return _jsxs("div", { className: "space-y-4", children: [report.criticalFailed && _jsxs(Alert, { variant: "destructive", children: [_jsx(AlertCircle, { className: "h-4 w-4", strokeWidth: 1.5 }), _jsxs(AlertDescription, { children: [zeroReason(report, violations.length), " Correctness is zero."] })] }), violations.length > 0 && _jsxs("section", { "data-testid": "benchmark-task-safety-violations", children: [_jsx("h4", { className: "text-neutral-grey-50 mb-1.5 text-xs font-medium tracking-wide uppercase", children: "Safety violations" }), _jsx("ul", { className: "border-border-default divide-border-default divide-y rounded border", children: violations.map((violation, index) => _jsxs("li", { className: "flex items-start gap-3 px-3 py-2 text-sm", children: [_jsx(ShieldAlert, { "aria-hidden": "true", className: "text-feedback-red mt-0.5 h-4 w-4 shrink-0", strokeWidth: 1.5 }), _jsx("div", { className: "min-w-0 flex-1", children: _jsx(SafetyViolationText, { violation: violation }) })] }, index)) })] }), groups.map(group => {
27
- const checks = report.checks.filter(c => c.class === group.key);
34
+ return (_jsx("p", { className: settingsText.help, children: "Grading is not available for this task." }));
35
+ return (_jsxs("div", { className: "flex flex-col gap-6", children: [report.criticalFailed && (_jsxs(Alert, { variant: "destructive", children: [_jsx(AlertCircle, { className: "h-4 w-4", strokeWidth: 1 }), _jsxs(AlertDescription, { children: [zeroReason(report, violations.length), " Correctness is zero."] })] })), violations.length > 0 && (_jsx(SettingsGroup, { title: "Safety violations", "data-testid": "benchmark-task-safety-violations", children: _jsx(SettingsList, { children: violations.map((violation, index) => (_jsx(SettingsListItem, { icon: _jsx(ShieldAlert, { "aria-hidden": "true", className: "text-feedback-red", strokeWidth: 1 }), title: _jsx("span", { className: wrap, children: _jsx(SafetyViolationMessage, { violation: violation }) }), meta: (violation.target || violation.details.length > 0) && (_jsx("div", { children: _jsx(SafetyViolationTarget, { violation: violation }) })) }, index))) }) })), groups.map((group) => {
36
+ const checks = report.checks.filter((c) => c.class === group.key);
28
37
  if (!checks.length)
29
38
  return null;
30
- return _jsxs("section", { children: [_jsx("h4", { className: "text-neutral-grey-50 mb-1.5 text-xs font-medium tracking-wide uppercase", children: group.label }), _jsx("ul", { className: "border-border-default divide-border-default divide-y rounded border", children: checks.map(c => _jsxs("li", { "data-testid": `benchmark-task-check-${c.key}`, className: "flex items-start gap-3 px-3 py-2 text-sm", children: [_jsx(CheckIcon, { check: c }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "text-neutral-grey-100", children: c.description }), c.reason && _jsx("span", { className: "text-neutral-grey-50 mt-0.5 block text-xs", children: c.reason })] }), c.critical && _jsx(Badge, { variant: "outline", size: "sm", children: "Critical" }), _jsxs("span", { className: "text-neutral-grey-50 w-16 shrink-0 text-right text-xs whitespace-nowrap tabular-nums", children: [points(c.awarded), " / ", points(c.points)] })] }, c.key)) })] }, group.key);
31
- })] });
39
+ return (_jsx(SettingsGroup, { title: group.label, children: _jsx(SettingsList, { children: checks.map((c) => (_jsx(SettingsListItem, { "data-testid": `benchmark-task-check-${c.key}`, icon: _jsx(CheckIcon, { check: c }), title: _jsx("span", { className: wrap, children: c.description }), badges: c.critical && (_jsx("span", { className: settingsText.meta, children: "critical" })), meta: c.reason && _jsx("div", { children: c.reason }), actions: _jsxs("span", { className: cn("w-16 text-right whitespace-nowrap tabular-nums", settingsText.meta), children: [points(c.awarded), " / ", points(c.points)] }) }, c.key))) }) }, group.key));
40
+ })] }));
32
41
  }
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ export function configureBenchmark(configuration) {
8
8
  return configuration;
9
9
  const panel = { id: "model-benchmark", title: "Model Benchmark", subtitle: "Compare models on isolated content editing tasks", icon: _jsx(Gauge, { strokeWidth: 1 }), content: _jsx(BenchmarkPanel, {}), requiresAdministrator: true, requiresModule: "benchmark" };
10
10
  const groups = configuration.settings.groups.map(g => ({ ...g, panels: [...g.panels] }));
11
- const ai = groups.find(g => g.title === "AI");
11
+ const ai = groups.find(g => g.panels.some(p => p.id === "ai-quota"));
12
12
  if (ai) {
13
13
  const quota = ai.panels.findIndex(p => p.id === "ai-quota");
14
14
  ai.panels.splice(quota >= 0 ? quota + 1 : ai.panels.length, 0, panel);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parhelia/benchmark",
3
- "version": "0.4.12903",
3
+ "version": "0.4.13030",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,5 +0,0 @@
1
- export declare function RunStatusBadge({ status, className }: {
2
- status: string;
3
- className?: string;
4
- }): import("react").JSX.Element;
5
- //# sourceMappingURL=RunStatusBadge.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RunStatusBadge.d.ts","sourceRoot":"","sources":["../../src/components/RunStatusBadge.tsx"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAG3F"}
@@ -1,9 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Badge, capitalizeFirstLetter, cn } from "@parhelia/core";
3
- const labels = { NeedsRecovery: "Needs recovery", TimedOut: "Timed out", CostLimit: "Cost limit", TokenLimit: "Token limit" };
4
- const failed = ["Failed", "NeedsRecovery", "Unconfirmed", "TimedOut", "CostLimit", "TokenLimit"];
5
- const active = ["Running", "Queued"];
6
- export function RunStatusBadge({ status, className }) {
7
- const variant = failed.includes(status) ? "destructive" : active.includes(status) ? "default" : "secondary";
8
- return _jsx(Badge, { variant: variant, className: cn(status === "Completed" && "bg-feedback-green-light text-feedback-green", className), children: capitalizeFirstLetter(labels[status] ?? status) });
9
- }