@crowandraven/evalkeeper 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ import { type RefObject } from "react";
2
+ /**
3
+ * Closes a popup on Escape or a click outside `ref`, while it's open.
4
+ */
5
+ export declare function useDismiss(open: boolean, setOpen: (open: boolean) => void, ref: RefObject<HTMLElement | null>): void;
6
+ /** The X that closes a popup. */
7
+ export declare function CloseButton({ onClick }: {
8
+ onClick: () => void;
9
+ }): import("react").JSX.Element;
10
+ /**
11
+ * An info button that opens more than a tooltip holds: a list, steps, a
12
+ * guide. Opens on press, closes with its X, Escape, or a click outside.
13
+ * For a sentence or two, use InfoTip.
14
+ */
15
+ export declare function InfoPopover({ label, children, }: {
16
+ /** What the popup is, for screen readers: "About the answer key". */
17
+ label: string;
18
+ children: React.ReactNode;
19
+ }): import("react").JSX.Element;
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { Info, X } from "lucide-react";
5
+ import { Button } from "./pieces.js";
6
+ /**
7
+ * Closes a popup on Escape or a click outside `ref`, while it's open.
8
+ */
9
+ export function useDismiss(open, setOpen, ref) {
10
+ useEffect(() => {
11
+ if (!open)
12
+ return;
13
+ const onEvent = (e) => {
14
+ if (e instanceof KeyboardEvent
15
+ ? e.key === "Escape"
16
+ : !ref.current?.contains(e.target))
17
+ setOpen(false);
18
+ };
19
+ document.addEventListener("mousedown", onEvent);
20
+ document.addEventListener("keydown", onEvent);
21
+ return () => {
22
+ document.removeEventListener("mousedown", onEvent);
23
+ document.removeEventListener("keydown", onEvent);
24
+ };
25
+ }, [open, setOpen, ref]);
26
+ }
27
+ /** The X that closes a popup. */
28
+ export function CloseButton({ onClick }) {
29
+ return (_jsx(Button, { type: "button", "aria-label": "Close", title: "Close", onClick: onClick, className: "-mr-1 -mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted hover:bg-tint hover:text-ink", children: _jsx(X, { "aria-hidden": true, className: "h-4 w-4" }) }));
30
+ }
31
+ /**
32
+ * An info button that opens more than a tooltip holds: a list, steps, a
33
+ * guide. Opens on press, closes with its X, Escape, or a click outside.
34
+ * For a sentence or two, use InfoTip.
35
+ */
36
+ export function InfoPopover({ label, children, }) {
37
+ const [open, setOpen] = useState(false);
38
+ const ref = useRef(null);
39
+ useDismiss(open, setOpen, ref);
40
+ return (_jsxs("div", { ref: ref, className: "relative ml-1 inline-flex align-middle text-sm font-normal", children: [_jsx(Button, { type: "button", "aria-haspopup": "dialog", "aria-expanded": open, "aria-label": label, onClick: () => {
41
+ setOpen(!open);
42
+ }, className: "inline-flex h-4 w-4 items-center justify-center rounded-full text-muted hover:text-ink", children: _jsx(Info, { "aria-hidden": true, className: "h-3.5 w-3.5" }) }), open && (_jsx("div", { role: "dialog", "aria-label": label, className: "absolute left-0 top-full z-20 mt-2 max-h-[70vh] w-[min(28rem,calc(100vw-2rem))] overflow-y-auto rounded-md border border-line bg-card p-4 shadow-lg", children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "min-w-0 flex-1 space-y-3", children: children }), _jsx(CloseButton, { onClick: () => {
43
+ setOpen(false);
44
+ } })] }) }))] }));
45
+ }
46
+ //# sourceMappingURL=InfoPopover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InfoPopover.js","sourceRoot":"","sources":["../../src/react/InfoPopover.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;GAEG;AACH,MAAM,UAAU,UAAU,CACxB,IAAa,EACb,OAAgC,EACh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AAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAC/B,OAAO,CACL,eACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAC,4DAA4D,aAEtE,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,mBACC,QAAQ,mBACP,IAAI,gBACP,KAAK,EACjB,OAAO,EAAE,GAAG,EAAE;oBACZ,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;gBACjB,CAAC,EACD,SAAS,EAAC,wFAAwF,YAElG,KAAC,IAAI,yBAAa,SAAS,EAAC,aAAa,GAAG,GACrC,EACR,IAAI,IAAI,CACP,cACE,IAAI,EAAC,QAAQ,gBACD,KAAK,EACjB,SAAS,EAAC,qJAAqJ,YAE/J,eAAK,SAAS,EAAC,wBAAwB,aACrC,cAAK,SAAS,EAAC,0BAA0B,YAAE,QAAQ,GAAO,EAC1D,KAAC,WAAW,IACV,OAAO,EAAE,GAAG,EAAE;gCACZ,OAAO,CAAC,KAAK,CAAC,CAAC;4BACjB,CAAC,GACD,IACE,GACF,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -1,7 +1,8 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect, useRef, useState } from "react";
4
- import { ChevronDown, X } from "lucide-react";
3
+ import { useRef, useState } from "react";
4
+ import { ChevronDown } from "lucide-react";
5
+ import { CloseButton, useDismiss } from "./InfoPopover.js";
5
6
  import { Button, Select, Submit, TextInput } from "./pieces.js";
6
7
  /** The choices when changing it: accuracy is always held. */
7
8
  const CHOICES = {
@@ -18,27 +19,12 @@ const CHOICES = {
18
19
  export function PriorityPicker({ action, suite, favor, own, label, why, }) {
19
20
  const [open, setOpen] = useState(false);
20
21
  const ref = useRef(null);
21
- useEffect(() => {
22
- if (!open)
23
- return;
24
- const close = (e) => {
25
- if (e instanceof KeyboardEvent
26
- ? e.key === "Escape"
27
- : !ref.current?.contains(e.target))
28
- setOpen(false);
29
- };
30
- document.addEventListener("mousedown", close);
31
- document.addEventListener("keydown", close);
32
- return () => {
33
- document.removeEventListener("mousedown", close);
34
- document.removeEventListener("keydown", close);
35
- };
36
- }, [open]);
22
+ useDismiss(open, setOpen, ref);
37
23
  return (_jsxs("div", { ref: ref, className: "relative text-sm font-normal", children: [_jsxs(Button, { type: "button", "aria-haspopup": "dialog", "aria-expanded": open, onClick: () => {
38
24
  setOpen(!open);
39
- }, className: "inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-full bg-tint px-2.5 text-xs font-medium leading-none text-muted hover:text-ink", children: [label, _jsx(ChevronDown, { "aria-hidden": true, className: "h-3 w-3" })] }), open && (_jsxs("div", { role: "dialog", "aria-label": "What this feature favors", className: "absolute left-0 z-20 mt-2 w-80 rounded-md border border-line bg-card p-4 shadow-lg", children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsx("p", { className: "text-muted", children: why }), _jsx(Button, { type: "button", "aria-label": "Close", title: "Close", onClick: () => {
25
+ }, className: "inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-full bg-tint px-2.5 text-xs font-medium leading-none text-muted hover:text-ink", children: [label, _jsx(ChevronDown, { "aria-hidden": true, className: "h-3 w-3" })] }), open && (_jsxs("div", { role: "dialog", "aria-label": "What this feature favors", className: "absolute left-0 z-20 mt-2 w-80 rounded-md border border-line bg-card p-4 shadow-lg", children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsx("p", { className: "text-muted", children: why }), _jsx(CloseButton, { onClick: () => {
40
26
  setOpen(false);
41
- }, className: "-mr-1 -mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted hover:bg-tint hover:text-ink", children: _jsx(X, { "aria-hidden": true, className: "h-4 w-4" }) })] }), _jsxs("form", { action: action,
27
+ } })] }), _jsxs("form", { action: action,
42
28
  // Closes once saved (after the submit is read).
43
29
  onSubmit: () => setTimeout(() => {
44
30
  setOpen(false);
@@ -1 +1 @@
1
- {"version":3,"file":"PriorityPicker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Z,YAAY,EAAE,KAAK,EACnB,SAAS,EAAC,6DAA6D,YAErE,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAClD,kBAAgB,KAAK,EAAE,CAAC,aACrB,OAAO,CAAC,CAAC,CAAC,EACV,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,KAF3B,CAAC,CAGL,CACV,CAAC,GACK,IACL,EACN,0BACE,iBAAO,OAAO,EAAC,cAAc,EAAC,SAAS,EAAC,mBAAmB,sBACpD,eAAM,SAAS,EAAC,wBAAwB,2BAAkB,IACzD,EACR,KAAC,SAAS,IACR,EAAE,EAAC,cAAc,EACjB,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,GAAG,EACd,SAAS,EAAC,6DAA6D,GACvE,IACE,EACN,KAAC,MAAM,wCAA+B,IACjC,IACH,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -3,7 +3,8 @@ import { type EvalAppConfig } from "./app.js";
3
3
  /**
4
4
  * A feature's settings history: every switch, newest first, with what
5
5
  * changed, who, why, and the evidence; any earlier version can be made
6
- * live again, with a reason.
6
+ * live again, with a reason. The newest and live versions show; earlier
7
+ * ones open with a toggle.
7
8
  */
8
9
  export declare function SettingsHistory({ app, suite, entries, liveId, label, defaults, }: {
9
10
  /** Your screens' configuration. */
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { LINK } from "./format.js";
3
3
  import { GLOSSARY, describeChange, } from "../index.js";
4
4
  import { RollBack } from "./RollBack.js";
5
+ import { ShowEarlier } from "./ShowEarlier.js";
5
6
  import { Link, Chip, InfoTip, Tip, LocalDate } from "./pieces.js";
6
7
  import { evalsPath } from "./app.js";
7
8
  const KIND = {
@@ -36,44 +37,51 @@ const KIND = {
36
37
  help: GLOSSARY.instructionsEdited,
37
38
  },
38
39
  };
40
+ /** A version's card, on the page's background. */
41
+ const BOX = "space-y-2 rounded-md border border-line bg-card p-3 text-sm";
39
42
  /**
40
43
  * A feature's settings history: every switch, newest first, with what
41
44
  * changed, who, why, and the evidence; any earlier version can be made
42
- * live again, with a reason.
45
+ * live again, with a reason. The newest and live versions show; earlier
46
+ * ones open with a toggle.
43
47
  */
44
48
  export function SettingsHistory({ app, suite, entries, liveId, label, defaults, }) {
45
- return (_jsxs("section", { className: "space-y-3", "aria-labelledby": "history", children: [_jsxs("h2", { id: "history", className: "text-lg font-semibold", children: ["Versions", _jsx(InfoTip, { term: "versions" })] }), _jsx(HistoryEntries, { app: app, suite: suite, entries: entries, liveId: liveId, label: label, defaults: defaults })] }));
49
+ const heading = (_jsxs("h2", { id: "history", className: "text-lg font-semibold", children: ["Versions", _jsx(InfoTip, { term: "versions" })] }));
50
+ // The newest version shows, and the live one when it's older (the first
51
+ // that points at it: a rollback points at the version it restored).
52
+ const live = entries.findIndex((e) => e.to.id === liveId);
53
+ const recent = (_e, i) => i === 0 || i === live;
54
+ const entry = (e) => (_jsx(VersionEntry, { app, suite, e, liveId, label, box: BOX }, e.id));
55
+ if (entries.some((e, i) => !recent(e, i)))
56
+ return (_jsx("section", { className: "space-y-3", "aria-labelledby": "history", children: _jsx(ShowEarlier, { heading: heading, noun: "versions", recent: entries.filter(recent).map(entry), earlier: entries.filter((e, i) => !recent(e, i)).map(entry) }) }));
57
+ return (_jsxs("section", { className: "space-y-3", "aria-labelledby": "history", children: [heading, _jsx(HistoryEntries, { app: app, suite: suite, entries: entries, liveId: liveId, label: label, defaults: defaults })] }));
46
58
  }
47
59
  /**
48
60
  * The versions in a settings history, newest first, each with a rollback
49
61
  * unless it's live. For a page's history section or a card's history toggle.
50
62
  */
51
63
  export function HistoryEntries({ app, suite, entries, liveId, label, defaults, plain = false, }) {
52
- const box = `space-y-2 text-sm ${plain ? "py-2" : "rounded-md border border-line bg-card p-3"}`;
64
+ const box = plain ? "space-y-2 py-2 text-sm" : BOX;
53
65
  if (entries.length === 0)
54
66
  return (_jsxs("article", { "aria-label": "Version 1: Defaults", className: box, children: [_jsxs("span", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "font-medium", children: "v1" }), _jsx(Chip, { tone: "neutral", children: "Defaults" }), _jsx(Chip, { tone: "live", children: "Live now" })] }), _jsxs("p", { children: [label(defaults.model), " live", defaults.fallbackModel
55
67
  ? ` · fallback ${label(defaults.fallbackModel)}`
56
68
  : " · no fallback"] }), _jsx("p", { className: "readable text-muted", children: "The settings in code. The first change records them as v1, so there's always something to roll back to." })] }));
57
- return (_jsx("div", { className: "space-y-2", children: entries.map((e) => {
58
- const kind = KIND[e.kind];
59
- const ev = (e.evidence ?? {});
60
- const testId = ev.runId ?? ev.live ?? null;
61
- const isLive = e.to.id === liveId;
62
- // Said outright: "same models" read as the app switching models.
63
- const unchanged = (v) => `Models unchanged: ${label(v.model)} live${v.fallbackModel ? `, ${label(v.fallbackModel)} fallback` : ""}`;
64
- return (_jsxs("article", { "aria-label": `Version ${e.to.number}: ${kind.text}`, className: box, children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsxs("span", { className: "flex flex-wrap items-center gap-2", children: [_jsxs("span", { className: "font-medium", children: ["v", e.to.number] }), _jsx(Tip, { text: kind.help, id: `kind-${e.id}`, children: _jsx(Chip, { tone: kind.tone, children: kind.text }) }), isLive && _jsx(Chip, { tone: "live", children: "Live now" })] }), _jsxs("span", { className: "text-xs text-muted", children: [e.by ??
65
- (e.kind === "OUTSIDE"
66
- ? "Found by the system"
67
- : "System"), " ", "\u00B7 ", _jsx(LocalDate, { date: e.createdAt, time: true })] })] }), _jsx("ul", { className: "readable list-disc pl-5", children: (e.kind === "ROLLBACK"
68
- ? [`Back to v${e.to.number}: ${label(e.to.model)} live`]
69
- : e.kind === "DEPLOY"
70
- ? [unchanged(e.to), "The instructions in code changed"]
71
- : e.kind === "INSTRUCTIONS"
72
- ? [
73
- unchanged(e.to),
74
- "The instructions were edited at runtime",
75
- ]
76
- : describeChange(e.from, e.to, label)).map((line) => (_jsx("li", { children: line }, line))) }), e.reason && _jsx("p", { className: "readable text-muted", children: e.reason }), _jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [testId && (_jsx(Link, { href: evalsPath(app, suite, "runs", testId), className: `text-xs ${LINK}`, children: "The test behind it" })), !isLive && (_jsx(RollBack, { action: app.actions.rollBackSettings, suite: suite, versionId: e.to.id, number: e.to.number, kind: e.kind }))] })] }, e.id));
77
- }) }));
69
+ return (_jsx("div", { className: "space-y-2", children: entries.map((e) => (_jsx(VersionEntry, { app, suite, e, liveId, label, box }, e.id))) }));
70
+ }
71
+ /** One version: what changed, who and when, why, its evidence, and rollback. */
72
+ function VersionEntry({ app, suite, e, liveId, label, box, }) {
73
+ const kind = KIND[e.kind];
74
+ const ev = (e.evidence ?? {});
75
+ const testId = ev.runId ?? ev.live ?? null;
76
+ const isLive = e.to.id === liveId;
77
+ // Said outright: "same models" read as the app switching models.
78
+ const unchanged = (v) => `Models unchanged: ${label(v.model)} live${v.fallbackModel ? `, ${label(v.fallbackModel)} fallback` : ""}`;
79
+ return (_jsxs("article", { "aria-label": `Version ${e.to.number}: ${kind.text}`, className: box, children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsxs("span", { className: "flex flex-wrap items-center gap-2", children: [_jsxs("span", { className: "font-medium", children: ["v", e.to.number] }), _jsx(Tip, { text: kind.help, id: `kind-${e.id}`, children: _jsx(Chip, { tone: kind.tone, children: kind.text }) }), isLive && _jsx(Chip, { tone: "live", children: "Live now" })] }), _jsxs("span", { className: "text-xs text-muted", children: [e.by ?? (e.kind === "OUTSIDE" ? "Found by the system" : "System"), " \u00B7", " ", _jsx(LocalDate, { date: e.createdAt, time: true })] })] }), _jsx("ul", { className: "readable list-disc pl-5", children: (e.kind === "ROLLBACK"
80
+ ? [`Back to v${e.to.number}: ${label(e.to.model)} live`]
81
+ : e.kind === "DEPLOY"
82
+ ? [unchanged(e.to), "The instructions in code changed"]
83
+ : e.kind === "INSTRUCTIONS"
84
+ ? [unchanged(e.to), "The instructions were edited at runtime"]
85
+ : describeChange(e.from, e.to, label)).map((line) => (_jsx("li", { children: line }, line))) }), e.reason && _jsx("p", { className: "readable text-muted", children: e.reason }), _jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [testId && (_jsx(Link, { href: evalsPath(app, suite, "runs", testId), className: `text-xs ${LINK}`, children: "The test behind it" })), !isLive && (_jsx(RollBack, { action: app.actions.rollBackSettings, suite: suite, versionId: e.to.id, number: e.to.number, kind: e.kind }))] })] }));
78
86
  }
79
87
  //# sourceMappingURL=SettingsHistory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsHistory.js","sourceRoot":"","sources":["../../src/react/SettingsHistory.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EACL,QAAQ,EACR,cAAc,GAIf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,SAAS,EAAsB,MAAM,UAAU,CAAC;AAEzD,MAAM,IAAI,GAGN;IACF,MAAM,EAAE;QACN,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,6BAA6B;KACpC;IACD,OAAO,EAAE;QACP,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,mEAAmE;KAC1E;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,qCAAqC;KAC5C;IACD,MAAM,EAAE;QACN,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ,CAAC,eAAe;KAC/B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AC,CAAC,IAAI,EAAE,EAAE,CAAC,CACd,uBAAgB,IAAI,IAAX,IAAI,CAAa,CAC3B,CAAC,GACC,EACJ,CAAC,CAAC,MAAM,IAAI,YAAG,SAAS,EAAC,qBAAqB,YAAE,CAAC,CAAC,MAAM,GAAK,EAC9D,eAAK,SAAS,EAAC,mCAAmC,aAC/C,MAAM,IAAI,CACT,KAAC,IAAI,IACH,IAAI,EAAE,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAC3C,SAAS,EAAE,WAAW,IAAI,EAAE,mCAGvB,CACR,EACA,CAAC,MAAM,IAAI,CACV,KAAC,QAAQ,IACP,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,gBAAgB,EACpC,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAClB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,EACnB,IAAI,EAAE,CAAC,CAAC,IAAI,GACZ,CACH,IACG,IACE,CACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A section whose earlier items stay folded until asked for: the heading
3
+ * with a toggle across from it, the recent items, then the rest when open.
4
+ */
5
+ export declare function ShowEarlier({ heading, recent, earlier, noun, }: {
6
+ heading: React.ReactNode;
7
+ recent: React.ReactNode;
8
+ earlier: React.ReactNode[];
9
+ /** What the items are, plural: "versions". */
10
+ noun: string;
11
+ }): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useId, useState } from "react";
4
+ import { ChevronDown } from "lucide-react";
5
+ import { Button } from "./pieces.js";
6
+ /**
7
+ * A section whose earlier items stay folded until asked for: the heading
8
+ * with a toggle across from it, the recent items, then the rest when open.
9
+ */
10
+ export function ShowEarlier({ heading, recent, earlier, noun, }) {
11
+ const [open, setOpen] = useState(false);
12
+ const id = useId();
13
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between gap-4", children: [heading, _jsxs(Button, { type: "button", "aria-expanded": open, "aria-controls": open ? id : undefined, onClick: () => {
14
+ setOpen(!open);
15
+ }, className: "inline-flex items-center gap-1 text-sm text-muted hover:text-ink", children: [open
16
+ ? `Hide earlier ${noun}`
17
+ : `Show ${earlier.length} earlier ${earlier.length === 1 ? noun.replace(/s$/, "") : noun}`, _jsx(ChevronDown, { "aria-hidden": true, className: `h-4 w-4 transition-transform ${open ? "rotate-180" : ""}` })] })] }), _jsxs("div", { className: "space-y-2", children: [recent, open && (_jsx("div", { id: id, className: "space-y-2", children: earlier }))] })] }));
18
+ }
19
+ //# sourceMappingURL=ShowEarlier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShowEarlier.js","sourceRoot":"","sources":["../../src/react/ShowEarlier.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,OAAO,EACP,MAAM,EACN,OAAO,EACP,IAAI,GAOL;IACC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,OAAO,CACL,8BACE,eAAK,SAAS,EAAC,yCAAyC,aACrD,OAAO,EACR,MAAC,MAAM,IACL,IAAI,EAAC,QAAQ,mBACE,IAAI,mBACJ,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EACpC,OAAO,EAAE,GAAG,EAAE;4BACZ,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;wBACjB,CAAC,EACD,SAAS,EAAC,kEAAkE,aAE3E,IAAI;gCACH,CAAC,CAAC,gBAAgB,IAAI,EAAE;gCACxB,CAAC,CAAC,QAAQ,OAAO,CAAC,MAAM,YAAY,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAC5F,KAAC,WAAW,yBAEV,SAAS,EAAE,gCAAgC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,GACrE,IACK,IACL,EACN,eAAK,SAAS,EAAC,WAAW,aACvB,MAAM,EACN,IAAI,IAAI,CACP,cAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAC,WAAW,YAC/B,OAAO,GACJ,CACP,IACG,IACL,CACJ,CAAC;AACJ,CAAC"}
@@ -87,14 +87,12 @@ export declare function ModelTable({ data }: {
87
87
  data: SuitePageData;
88
88
  }): import("react").JSX.Element;
89
89
  /**
90
- * Testing a model at a reasoning setting other than the feature's: less
91
- * reasoning is faster and cheaper, more can be more accurate. Each setting
92
- * gets its own row in the model table. Shows only when a model the feature
93
- * may use lists its settings in your catalog.
90
+ * @deprecated The model table's last row holds this now; it renders
91
+ * nothing. Remove it from your page.
94
92
  */
95
- export declare function TestSettingSection({ data }: {
93
+ export declare function TestSettingSection(_props: {
96
94
  data: SuitePageData;
97
- }): import("react").JSX.Element | null;
95
+ }): null;
98
96
  /**
99
97
  * Where the mistakes are: how often each check passed, for every model
100
98
  * with a current test, beside each check's bar. Serious checks first. The
@@ -113,8 +111,8 @@ export declare function ChecksSection({ data }: {
113
111
  data: SuitePageData;
114
112
  }): import("react").JSX.Element;
115
113
  /**
116
- * Ways to fill the answer key, beside adding a case by hand: how to judge
117
- * an answer, testing with draft answers before review, an injection
114
+ * Ways to fill the answer key, beside adding a case by hand: testing with
115
+ * draft answers before review, an injection
118
116
  * suite's attack cases, starter cases not added yet, and more drafts from
119
117
  * the suite's `draftMore`. Each shows only when it applies and your app
120
118
  * passes its action.
@@ -3,10 +3,12 @@ import { FAVOR_TEXT, allPassed, answerKeyHealth, attacksFrom, barStatus, checkBa
3
3
  import { AnswerKey } from "./AnswerKey.js";
4
4
  import { ModelMenu } from "./ModelMenu.js";
5
5
  import { PriorityPicker } from "./PriorityPicker.js";
6
+ import { InfoPopover } from "./InfoPopover.js";
7
+ import { GLOSSARY } from "../glossary.js";
6
8
  import { Tabs } from "./Tabs.js";
7
9
  import { Link, BackLink, Card, RefreshWhile, Chip, IconSubmit, InfoTip, Score, Select, Spinner, Submit, Tip, } from "./pieces.js";
8
10
  import { pct, LINK, QUIET_BUTTON } from "./format.js";
9
- import { ChevronDown, RotateCw, ShieldAlert, Sparkles } from "lucide-react";
11
+ import { Plus, RotateCw, ShieldAlert, Sparkles } from "lucide-react";
10
12
  import { evalsPath, attacksResisted } from "./app.js";
11
13
  import { SettingsHistory } from "./SettingsHistory.js";
12
14
  /**
@@ -157,6 +159,8 @@ export function ModelTable({ data }) {
157
159
  const ordered = orderRows(rows, suite.checks, priority, {
158
160
  live: suggestedLive,
159
161
  });
162
+ const tunable = tunableModels(data);
163
+ const columns = 7 + (showAttacks ? 1 : 0) + (suite.decisions ? 2 : 0);
160
164
  return (_jsx(_Fragment, { children: _jsxs("section", { className: "space-y-3", children: [_jsxs("div", { className: "flex items-center justify-between gap-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("h2", { className: "text-lg font-semibold", children: "Models" }), choosesHere && app.actions.setPriority ? (_jsx(PriorityPicker, { action: app.actions.setPriority, suite: key, favor: priority.favor, own: suite.priority.favor, label: `Favors ${FAVORS[priority.favor]}`, why: whyFavor(priority.favor) })) : (_jsx(Tip, { text: whyFavor(priority.favor), side: "bottom", id: "favors", children: _jsxs(Chip, { tone: "neutral", children: ["Favors ", FAVORS[priority.favor]] }) }))] }), _jsx("div", { className: "flex items-center gap-4", children: _jsxs("form", { action: app.actions.testAll, children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsx(Submit, { variant: "quiet", children: "Test every model" })] }) })] }), _jsx(Card, { className: "overflow-x-auto p-0 lg:overflow-visible", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "text-left text-muted", children: _jsxs("tr", { className: "border-b border-line", children: [_jsx("th", { className: "p-3 font-normal", children: "Model" }), _jsx("th", { className: "p-3 font-normal", children: _jsx(Tip, { term: "score", side: "bottom", children: "Accuracy" }) }), _jsx("th", { className: "p-3 font-normal", children: _jsx(Tip, { term: "seriousMistakes", side: "bottom", children: "Serious mistakes" }) }), showAttacks && (_jsx("th", { className: "p-3 font-normal", children: _jsx(Tip, { term: "attacksResisted", side: "bottom", children: "Attacks resisted" }) })), _jsx("th", { className: "p-3 font-normal", children: _jsx(Tip, { term: "time", side: "bottom", align: "end", children: "Speed" }) }), suite.decisions && (_jsxs(_Fragment, { children: [_jsx("th", { className: "p-3 font-normal", children: _jsx(Tip, { term: "probabilityQuality", side: "bottom", children: "Probability quality" }) }), _jsx("th", { className: "p-3 font-normal", children: _jsx(Tip, { term: "calibrationError", side: "bottom", align: "end", children: "Calibration error" }) })] })), _jsx("th", { className: "p-3 font-normal", children: _jsx(Tip, { term: "cost", side: "bottom", align: "end", children: "Cost" }) }), _jsx("th", { className: "p-3 font-normal", children: _jsx(Tip, { term: "againstLive", side: "bottom", align: "end", children: "Against live" }) }), _jsx("th", { className: "p-3" })] }) }), _jsx("tbody", { children: ordered.map((r) => (_jsxs("tr", { className: "border-b border-line last:border-0", children: [_jsx("td", { className: "p-3", children: _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: r.live ? "font-semibold" : "font-medium", children: r.label }), r.live && (_jsx(Tip, { term: "live", side: "bottom", id: `live-${r.key}`, children: _jsx(Chip, { tone: "live", children: "Live" }) })), r.fallback && (_jsx(Tip, { term: "fallback", side: "bottom", id: `fallback-${r.key}`, children: _jsx(Chip, { tone: "fallback", children: "Fallback" }) })), (r.key === suggestedLive ||
161
165
  r.key === suggestedFallback) && (_jsx(Tip, { term: "suggestion", side: "bottom", id: `suggested-${r.key}`, children: _jsx(Chip, { tone: "suggested", children: r.key === suggestedLive
162
166
  ? "Suggested"
@@ -174,25 +178,38 @@ export function ModelTable({ data }) {
174
178
  ? app.actions.makeLive
175
179
  : null, makeFallback: choosesHere && r.canMakeFallback
176
180
  ? app.actions.makeFallback
177
- : null, effort: r.variant ? r.effort : undefined }) }) })] }, r.key))) })] }) })] }) }));
181
+ : null, effort: r.variant ? r.effort : undefined }) }) })] }, r.key))) }), tunable.length > 0 && (_jsx("tfoot", { children: _jsx("tr", { children: _jsx("td", { colSpan: columns, className: "p-2", children: _jsx(TestSettingForm, { data: data, tunable: tunable }) }) }) }))] }) })] }) }));
178
182
  }
179
183
  /**
180
- * Testing a model at a reasoning setting other than the feature's: less
181
- * reasoning is faster and cheaper, more can be more accurate. Each setting
182
- * gets its own row in the model table. Shows only when a model the feature
183
- * may use lists its settings in your catalog.
184
+ * The models a feature may use that list reasoning settings in your
185
+ * catalog, each with its settings; empty when there's nothing to test.
184
186
  */
185
- export function TestSettingSection({ data }) {
186
- const { app, key, operation, choosesHere } = data;
187
- const tunable = app.runner.modelsFor(operation).flatMap((m) => {
187
+ function tunableModels(data) {
188
+ const { app, operation, choosesHere } = data;
189
+ if (!choosesHere)
190
+ return [];
191
+ return app.runner.modelsFor(operation).flatMap((m) => {
188
192
  const efforts = app.models[m]?.efforts;
189
193
  return efforts?.length
190
194
  ? [{ model: m, label: app.models[m]?.label ?? m, efforts }]
191
195
  : [];
192
196
  });
193
- if (!choosesHere || !tunable.length)
194
- return null;
195
- return (_jsxs("form", { action: app.actions.testModel, className: "flex flex-wrap items-end gap-2", children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsxs("div", { children: [_jsxs("label", { htmlFor: "test-setting", className: "block text-sm font-medium", children: ["Test a reasoning setting", _jsx(InfoTip, { term: "reasoningSetting", id: "test-setting" })] }), _jsx(Select, { id: "test-setting", name: "setting", className: "mt-1 rounded-md border border-line bg-card px-3 py-2 text-sm", children: tunable.map((t) => (_jsx("optgroup", { label: t.label, children: t.efforts.map((e) => (_jsxs("option", { value: JSON.stringify([t.model, e]), children: [t.label, " \u00B7 ", e, " reasoning"] }, e))) }, t.model))) })] }), _jsx(Submit, { variant: "quiet", children: "Test this setting" })] }));
197
+ }
198
+ /**
199
+ * Testing a model at a reasoning setting other than the feature's: less
200
+ * reasoning is faster and cheaper, more can be more accurate. Each setting
201
+ * gets its own row in the model table. The table's last row, inset.
202
+ */
203
+ function TestSettingForm({ data, tunable, }) {
204
+ const { app, key } = data;
205
+ return (_jsxs("form", { action: app.actions.testModel, className: "flex flex-wrap items-center gap-x-3 gap-y-2 rounded-md bg-tint px-3 py-2.5", children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsxs("label", { htmlFor: "test-setting", className: "text-sm font-medium", children: ["Test a reasoning setting", _jsx(InfoTip, { term: "reasoningSetting", id: "test-setting" })] }), _jsx(Select, { id: "test-setting", name: "setting", className: "rounded-md border border-line bg-card px-3 py-1.5 text-sm", children: tunable.map((t) => (_jsx("optgroup", { label: t.label, children: t.efforts.map((e) => (_jsxs("option", { value: JSON.stringify([t.model, e]), children: [t.label, " \u00B7 ", e, " reasoning"] }, e))) }, t.model))) }), _jsx(Submit, { variant: "quiet", children: "Test this setting" })] }));
206
+ }
207
+ /**
208
+ * @deprecated The model table's last row holds this now; it renders
209
+ * nothing. Remove it from your page.
210
+ */
211
+ export function TestSettingSection(_props) {
212
+ return null;
196
213
  }
197
214
  const BAR_TONE = {
198
215
  meets: "bg-emerald-100 text-emerald-900 dark:bg-emerald-500/15 dark:text-emerald-200",
@@ -240,8 +257,8 @@ export function ChecksSection({ data }) {
240
257
  }) })] }) }));
241
258
  }
242
259
  /**
243
- * Ways to fill the answer key, beside adding a case by hand: how to judge
244
- * an answer, testing with draft answers before review, an injection
260
+ * Ways to fill the answer key, beside adding a case by hand: testing with
261
+ * draft answers before review, an injection
245
262
  * suite's attack cases, starter cases not added yet, and more drafts from
246
263
  * the suite's `draftMore`. Each shows only when it applies and your app
247
264
  * passes its action.
@@ -252,14 +269,8 @@ export function AnswerKeyToolsSection({ data }) {
252
269
  const inUse = cases.filter((c) => c.status !== "RETIRED");
253
270
  const drafts = draftAnswers(cases);
254
271
  const fresh = newStarters(suite.starter, cases);
255
- const guide = suite.answerGuide ??
256
- (suite.labelHelp ? { points: [{ text: suite.labelHelp }] } : null);
257
272
  const injection = isInjectionSuite(suite) ? suite : null;
258
273
  const parts = [
259
- guide && (_jsxs("details", { className: "group rounded-lg border border-line bg-card", children: [_jsxs("summary", { className: "flex cursor-pointer list-none items-center justify-between gap-3 p-4 text-sm font-medium", children: ["How to judge an answer", _jsx(ChevronDown, { "aria-hidden": true, className: "h-4 w-4 transition-transform group-open:rotate-180" })] }), _jsxs("div", { className: "readable space-y-2 px-4 pb-4 text-sm", children: [guide.lead && _jsx("p", { className: "font-medium", children: guide.lead }), (() => {
260
- const items = guide.points.map((p, n) => (_jsxs("li", { children: [p.term && _jsxs("strong", { children: [p.term, " "] }), p.text] }, n)));
261
- return guide.ordered ? (_jsx("ol", { className: "list-decimal space-y-1 pl-5", children: items })) : (_jsx("ul", { className: "list-disc space-y-1 pl-5", children: items }));
262
- })(), guide.note && _jsx("p", { className: "text-muted", children: guide.note })] })] }, "guide")),
263
274
  actions.useDraftsProvisionally && drafts.length > 0 && (_jsxs(Card, { className: "space-y-3", children: [_jsxs("p", { className: "readable text-sm", children: ["To test before you've reviewed them, put the ", drafts.length, " ", "draft ", drafts.length === 1 ? "answer" : "answers", " to use as provisional. Scores then say they rest on unreviewed answers until you confirm each.", _jsx(InfoTip, { term: "provisional" })] }), _jsxs("form", { action: actions.useDraftsProvisionally, children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsx(Submit, { variant: "quiet", children: "Test with drafts, as provisional" })] })] }, "provisional")),
264
275
  actions.makeAttackCases && injection && (_jsxs(Card, { className: "space-y-3", children: [_jsxs("p", { className: "readable text-sm", children: ["Each attack case is a confirmed ", injection.base.label, " case with an attack planted where untrusted text goes, and keeps that case's answer: an attack shouldn't change it. Run this again after you confirm, change, or retire ", injection.base.label, " answers."] }), _jsxs("form", { action: actions.makeAttackCases, children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsxs(Submit, { variant: inUse.length ? "quiet" : "primary", children: [_jsx(ShieldAlert, { "aria-hidden": true, className: "mr-1.5 inline h-4 w-4" }), inUse.length ? "Update attack cases" : "Make attack cases"] })] })] }, "attacks")),
265
276
  actions.addStarters && fresh.length > 0 && (_jsxs(Card, { className: "space-y-3", children: [_jsxs("p", { className: "readable text-sm", children: [inUse.length
@@ -270,12 +281,21 @@ export function AnswerKeyToolsSection({ data }) {
270
281
  return null;
271
282
  return _jsx("div", { className: "space-y-3", children: parts });
272
283
  }
284
+ /** A suite's answer guide: its lead-in, points (numbered when in order), and note. */
285
+ function AnswerGuideText({ guide }) {
286
+ const items = guide.points.map((p, n) => (_jsxs("li", { children: [p.term && _jsxs("strong", { children: [p.term, " "] }), p.text] }, n)));
287
+ return (_jsxs("div", { className: "space-y-2", children: [guide.lead && _jsx("p", { children: guide.lead }), guide.ordered ? (_jsx("ol", { className: "list-decimal space-y-1 pl-5", children: items })) : (_jsx("ul", { className: "list-disc space-y-1 pl-5", children: items })), guide.note && _jsx("p", { className: "text-muted", children: guide.note })] }));
288
+ }
273
289
  /** The answer key: the cases in use and their answers, with ways to add and rate them. */
274
290
  export function AnswerKeySection({ data }) {
275
291
  const { app, key, b, suite, rows, attackBoards } = data;
276
292
  // A feature's attack cases are a tab of its answer key.
277
293
  const attacked = attackBoards.filter((a) => a.cases > 0);
278
- const cases = (_jsx(AnswerKey, { app: app, suite: suite, rows: rows, heading: _jsxs("h2", { className: "text-lg font-semibold", children: ["Answer key (", b.cases, " cases in use)", _jsx(InfoTip, { term: "answerKey" })] }), tools: _jsxs(_Fragment, { children: [suite.caseKind === "imported" &&
294
+ const guide = suite.answerGuide ??
295
+ (suite.labelHelp ? { points: [{ text: suite.labelHelp }] } : null);
296
+ const cases = (_jsx(AnswerKey, { app: app, suite: suite, rows: rows, heading: guide ? (
297
+ // The guide's list can't sit inside the heading; its button sits beside it.
298
+ _jsxs("div", { className: "flex items-center", children: [_jsxs("h2", { className: "text-lg font-semibold", children: ["Answer key (", b.cases, " cases in use)"] }), _jsxs(InfoPopover, { label: "About the answer key", children: [_jsx("p", { className: "text-muted", children: GLOSSARY.answerKey }), _jsx("p", { className: "font-medium", children: "How to judge an answer" }), _jsx(AnswerGuideText, { guide: guide })] })] })) : (_jsxs("h2", { className: "text-lg font-semibold", children: ["Answer key (", b.cases, " cases in use)", _jsx(InfoTip, { term: "answerKey" })] })), tools: _jsxs(_Fragment, { children: [suite.caseKind === "imported" &&
279
299
  suite.rateBlind !== false &&
280
300
  (suite.labelFromForm || app.answerEditors[key]) && (_jsx(Tip, { control: true, term: "rateBlind", side: "bottom", align: "end", children: _jsx(Link, { href: evalsPath(app, key, "rate"), className: "inline-flex items-center rounded-md border border-accent/40 bg-card px-3 py-1.5 text-sm text-accent hover:bg-accent/10", children: "Rate blind" }) })), _jsxs("form", { action: app.actions.rescore, children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsx(Tip, { control: true, term: "rescore", side: "bottom", align: "end", children: _jsx(IconSubmit, { label: "Rescore tests", icon: _jsx(RotateCw, { "aria-hidden": true, className: "h-4 w-4" }) }) })] })] }) }));
281
301
  return (
@@ -342,13 +362,13 @@ export function AnswerKeyHealthSection({ data }) {
342
362
  const { draftMore } = app.actions;
343
363
  const check = h.split.length > 0 || h.duplicates.length > 0;
344
364
  const retire = h.easyToRetire.length > 0 || h.staleDrafts.length > 0;
345
- return (_jsxs("section", { className: "space-y-3", "aria-labelledby": "answer-key-health", children: [_jsxs("h2", { id: "answer-key-health", className: "text-lg font-semibold", children: ["Answer key health", _jsx(InfoTip, { term: "answerKeyHealth" })] }), _jsxs(Card, { className: "space-y-6 text-sm", children: [check && (_jsxs("div", { className: "readable space-y-3", children: [_jsx("h3", { className: "font-medium", children: "Check these answers" }), h.split.length > 0 && (_jsxs("div", { className: "space-y-2", children: [_jsxs("p", { children: ["Models split about evenly on ", cases(h.split.length), ": some give the answer key's answer, some don't. For each, decide who's right. Keep the answer if it's right, fix it if the models were, or retire the case if there's no right answer.", _jsx(InfoTip, { term: "splitCases" })] }), _jsx("ul", { className: "space-y-2", children: h.split.map((c) => {
365
+ return (_jsxs("section", { className: "space-y-3", "aria-labelledby": "answer-key-health", children: [_jsxs("h2", { id: "answer-key-health", className: "text-lg font-semibold", children: ["Answer key health", _jsx(InfoTip, { term: "answerKeyHealth" })] }), _jsxs(Card, { className: "space-y-6 text-sm", children: [check && (_jsxs("div", { className: "space-y-3", children: [_jsx("h3", { className: "font-medium", children: "Answers worth a second look" }), h.split.length > 0 && (_jsxs("div", { className: "space-y-2", children: [_jsxs("p", { className: "readable", children: ["Models split about evenly on ", cases(h.split.length), ": some give the answer key's answer, some don't. That often means the answer is wrong or the case is unclear, and either one makes every score less trustworthy. For each, decide who's right: keep the answer, fix it, or retire the case if there's no right answer.", _jsx(InfoTip, { term: "splitCases" })] }), _jsx("ul", { className: "space-y-2", children: h.split.map((c) => {
346
366
  const by = splitBy[c.id];
347
367
  const names = (xs) => new Intl.ListFormat("en-US").format(xs);
348
- return (_jsxs("li", { className: "space-y-2 rounded-md bg-tint p-3", children: [_jsx("div", { className: "font-medium", children: caseLink(c) }), by && (_jsxs("p", { className: "text-xs text-muted", children: [by.right.length > 0 &&
368
+ return (_jsxs("li", { className: "space-y-2 rounded-md bg-tint p-3", children: [_jsx("div", { className: "font-medium", children: caseLink(c) }), by && (_jsxs("p", { className: "readable text-xs text-muted", children: [by.right.length > 0 &&
349
369
  `Gave the answer key's answer: ${names(by.right)}. `, by.wrong.length > 0 &&
350
370
  `Didn't: ${names(by.wrong)}.`] })), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [keepAnswer && (_jsxs("form", { action: keepAnswer, children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsx("input", { type: "hidden", name: "case", value: c.id }), _jsx(Submit, { variant: "quiet", children: "The answer is right" })] })), _jsx("a", { href: `#case-${c.id}`, className: `inline-flex items-center rounded-md px-3 py-1.5 text-sm ${QUIET_BUTTON}`, children: "Fix the answer" }), _jsxs("form", { action: app.actions.retireCase, children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsx("input", { type: "hidden", name: "case", value: c.id }), _jsx(Submit, { variant: "quiet", children: "Retire it" })] })] })] }, c.id));
351
- }) })] })), h.duplicates.length > 0 && (_jsxs("div", { className: "space-y-1", children: [_jsxs("p", { children: ["These pairs share nearly all their words, so each counts twice. Keep the clearer one and retire the other.", _jsx(InfoTip, { term: "nearDuplicates" })] }), _jsx("ul", { className: "list-disc space-y-0.5 pl-5", children: h.duplicates.map(([a, b]) => (_jsxs("li", { children: [caseLink(a), " and ", caseLink(b)] }, `${a.id}-${b.id}`))) })] }))] })), thin.length > 0 && (_jsxs("div", { className: "space-y-2", children: [_jsx("h3", { className: "font-medium", children: "Add cases here" }), _jsxs("p", { className: "readable", children: [thin.length, " ", thin.length === 1 ? "topic has" : "topics have", " ", "only one case, so the score on each rests on a single example: one mistake swings it, and a fix can't be confirmed. Add a case or two to each.", _jsx(InfoTip, { term: "tagCoverage" })] }), draftMore && suite.draftMore ? (_jsxs("form", { action: draftMore, className: "space-y-2", children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsx("ul", { className: "flex flex-wrap gap-1.5", children: thin.map((t) => (_jsx("li", { children: _jsxs("label", { className: "inline-flex cursor-pointer items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-xs text-amber-800 has-[:checked]:bg-amber-300 dark:bg-amber-500/15 dark:text-amber-200 dark:has-[:checked]:bg-amber-500/40", children: [_jsx("input", { type: "checkbox", name: "topic", value: t, className: "h-3 w-3 accent-amber-700" }), t] }) }, t))) }), _jsx(Submit, { variant: "quiet", children: "Draft cases for the topics you picked" }), _jsx("p", { className: "readable text-xs text-muted", children: "Two drafts a topic, to confirm like any draft. Pick none to cover them all." })] })) : (_jsxs(_Fragment, { children: [_jsx("ul", { className: "flex flex-wrap gap-1.5", children: thin.map((t) => (_jsx("li", { children: _jsx("a", { href: `#add-case=${encodeURIComponent(t)}`, className: "inline-flex rounded-full bg-amber-100 px-2 py-0.5 text-xs text-amber-800 hover:underline dark:bg-amber-500/15 dark:text-amber-200", children: t }) }, t))) }), _jsx("p", { className: "readable text-xs text-muted", children: "Pick a topic to add a case with it already tagged." })] })), _jsxs("details", { className: "group", children: [_jsx("summary", { className: "cursor-pointer text-muted", children: "Show all topics" }), _jsx("ul", { className: "mt-2 flex flex-wrap gap-1.5", children: h.tags.map(([t, n]) => (_jsx("li", { children: _jsxs(Chip, { tone: n === 1 ? "warn" : "neutral", children: [t, " \u00B7 ", n] }) }, t))) })] })] })), retire && (_jsxs("div", { className: "readable space-y-3", children: [_jsx("h3", { className: "font-medium", children: "Retire these" }), h.easyToRetire.length > 0 && (_jsxs("div", { className: "space-y-2", children: [_jsxs("p", { children: ["Every current model gets ", cases(h.easy.length), " fully right, so they no longer tell models apart. Retire", " ", h.easyToRetire.length, " and keep", " ", h.easy.length - h.easyToRetire.length, " as a floor, so a test still catches a model that breaks the basics. Recent tests are rescored for free.", _jsx(InfoTip, { term: "easyCases" })] }), retireEasy && (_jsxs("form", { action: retireEasy, children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsxs(Submit, { variant: "quiet", children: ["Retire ", h.easyToRetire.length, " easy", " ", h.easyToRetire.length === 1 ? "case" : "cases"] })] }))] })), h.staleDrafts.length > 0 && (_jsxs("div", { className: "space-y-2", children: [_jsxs("p", { children: [drafts(h.staleDrafts.length), " nobody reviewed in 30 days. The weekly check retires them on its own.", _jsx(InfoTip, { term: "oldDrafts" })] }), retireStaleDrafts && (_jsxs("form", { action: retireStaleDrafts, children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsxs(Submit, { variant: "quiet", children: ["Retire ", h.staleDrafts.length, " old", " ", h.staleDrafts.length === 1 ? "draft" : "drafts", " now"] })] }))] }))] }))] })] }));
371
+ }) })] })), h.duplicates.length > 0 && (_jsxs("div", { className: "readable space-y-1", children: [_jsxs("p", { children: ["These pairs share nearly all their words, so each counts twice. Keep the clearer one and retire the other.", _jsx(InfoTip, { term: "nearDuplicates" })] }), _jsx("ul", { className: "list-disc space-y-0.5 pl-5", children: h.duplicates.map(([a, b]) => (_jsxs("li", { children: [caseLink(a), " and ", caseLink(b)] }, `${a.id}-${b.id}`))) })] }))] })), thin.length > 0 && (_jsxs("div", { className: "space-y-2", children: [_jsx("h3", { className: "font-medium", children: "Add cases here" }), _jsxs("p", { className: "readable", children: [thin.length, " ", thin.length === 1 ? "topic has" : "topics have", " ", "only one case, so the score on each rests on a single example: one mistake swings it, and a fix can't be confirmed. Add a case or two to each.", _jsx(InfoTip, { term: "tagCoverage" })] }), draftMore && suite.draftMore ? (_jsxs("form", { action: draftMore, className: "space-y-2", children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsx("ul", { className: "flex flex-wrap gap-1.5", children: thin.map((t) => (_jsx("li", { children: _jsxs("label", { className: "inline-flex cursor-pointer items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-xs text-amber-800 has-[:checked]:bg-amber-300 dark:bg-amber-500/15 dark:text-amber-200 dark:has-[:checked]:bg-amber-500/40", children: [_jsx("input", { type: "checkbox", name: "topic", value: t, className: "h-3 w-3 accent-amber-700" }), t] }) }, t))) }), _jsx(Submit, { variant: "quiet", children: "Draft cases for the topics you picked" }), _jsx("p", { className: "readable text-xs text-muted", children: "Two drafts a topic, to confirm like any draft. Pick none to cover them all." })] })) : (_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "readable text-muted", children: "Pick a topic to open Add a case with it already tagged." }), _jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [_jsx("ul", { className: "flex flex-wrap gap-1.5", children: thin.map((t) => (_jsx("li", { children: _jsx("a", { href: `#add-case=${encodeURIComponent(t)}`, className: "inline-flex rounded-full bg-amber-100 px-2 py-0.5 text-xs text-amber-800 hover:underline dark:bg-amber-500/15 dark:text-amber-200", children: t }) }, t))) }), _jsxs("a", { href: "#add-case=", className: `inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm ${QUIET_BUTTON}`, children: [_jsx(Plus, { "aria-hidden": true, className: "h-4 w-4" }), "Add a case"] })] }), _jsxs("p", { className: "readable text-xs text-muted", children: ["A suite with ", _jsx("code", { children: "draftMore" }), " drafts whole cases for the topics you pick instead."] })] })), _jsxs("details", { className: "group", children: [_jsx("summary", { className: "cursor-pointer text-muted", children: "Show all topics" }), _jsx("ul", { className: "mt-2 flex flex-wrap gap-1.5", children: h.tags.map(([t, n]) => (_jsx("li", { children: _jsxs(Chip, { tone: n === 1 ? "warn" : "neutral", children: [t, " \u00B7 ", n] }) }, t))) })] })] })), retire && (_jsxs("div", { className: "readable space-y-3", children: [_jsx("h3", { className: "font-medium", children: "Retire these" }), h.easyToRetire.length > 0 && (_jsxs("div", { className: "space-y-2", children: [_jsxs("p", { children: ["Every current model gets ", cases(h.easy.length), " fully right, so they no longer tell models apart. Retire", " ", h.easyToRetire.length, " and keep", " ", h.easy.length - h.easyToRetire.length, " as a floor, so a test still catches a model that breaks the basics. Recent tests are rescored for free.", _jsx(InfoTip, { term: "easyCases" })] }), retireEasy && (_jsxs("form", { action: retireEasy, children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsxs(Submit, { variant: "quiet", children: ["Retire ", h.easyToRetire.length, " easy", " ", h.easyToRetire.length === 1 ? "case" : "cases"] })] }))] })), h.staleDrafts.length > 0 && (_jsxs("div", { className: "space-y-2", children: [_jsxs("p", { children: [drafts(h.staleDrafts.length), " nobody reviewed in 30 days. The weekly check retires them on its own.", _jsx(InfoTip, { term: "oldDrafts" })] }), retireStaleDrafts && (_jsxs("form", { action: retireStaleDrafts, children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsxs(Submit, { variant: "quiet", children: ["Retire ", h.staleDrafts.length, " old", " ", h.staleDrafts.length === 1 ? "draft" : "drafts", " now"] })] }))] }))] }))] })] }));
352
372
  }
353
373
  /**
354
374
  * A suite's page as Evalkeeper arranges it, or null for a suite you don't
@@ -359,6 +379,6 @@ export async function SuitePage({ app, suite, }) {
359
379
  const data = await loadSuitePage(app, suite);
360
380
  if (!data)
361
381
  return null;
362
- return (_jsxs("div", { className: "space-y-8", children: [_jsx(RefreshWhile, { active: data.testing }), _jsx(SuiteHeader, { data: data }), _jsx(ChosenOnBase, { data: data }), _jsx(SuggestionCard, { data: data }), _jsx(CasesInInstructions, { data: data }), _jsx(ModelTable, { data: data }), _jsx(TestSettingSection, { data: data }), _jsx(CheckBreakdownSection, { data: data }), _jsx(Versions, { data: data }), _jsx(ChecksSection, { data: data }), _jsx(AnswerKeyHealthSection, { data: data }), _jsx(AnswerKeyToolsSection, { data: data }), _jsx(AnswerKeySection, { data: data })] }));
382
+ return (_jsxs("div", { className: "space-y-8", children: [_jsx(RefreshWhile, { active: data.testing }), _jsx(SuiteHeader, { data: data }), _jsx(ChosenOnBase, { data: data }), _jsx(SuggestionCard, { data: data }), _jsx(CasesInInstructions, { data: data }), _jsx(ModelTable, { data: data }), _jsx(CheckBreakdownSection, { data: data }), _jsx(Versions, { data: data }), _jsx(ChecksSection, { data: data }), _jsx(AnswerKeyHealthSection, { data: data }), _jsx(AnswerKeyToolsSection, { data: data }), _jsx(AnswerKeySection, { data: data })] }));
363
383
  }
364
384
  //# sourceMappingURL=SuiteSections.js.map