@crowandraven/evalkeeper 0.17.1 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/decisions.js +1 -1
- package/dist/decisions.js.map +1 -1
- package/dist/drafts.d.ts +2 -0
- package/dist/drafts.js +1 -1
- package/dist/drafts.js.map +1 -1
- package/dist/glossary.d.ts +25 -14
- package/dist/glossary.js +25 -14
- package/dist/glossary.js.map +1 -1
- package/dist/health.js +2 -2
- package/dist/health.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/memoryStore.d.ts +2 -1
- package/dist/memoryStore.js +9 -0
- package/dist/memoryStore.js.map +1 -1
- package/dist/next/actions.js +58 -3
- package/dist/next/actions.js.map +1 -1
- package/dist/prisma/contracts.d.ts +5 -2
- package/dist/prisma/contracts.js +7 -1
- package/dist/prisma/contracts.js.map +1 -1
- package/dist/prisma/index.d.ts +40 -1
- package/dist/prisma/index.js +37 -1
- package/dist/prisma/index.js.map +1 -1
- package/dist/prune.d.ts +43 -10
- package/dist/prune.js +42 -13
- package/dist/prune.js.map +1 -1
- package/dist/react/AddCase.js +11 -5
- package/dist/react/AddCase.js.map +1 -1
- package/dist/react/AnswerKey.js +7 -4
- package/dist/react/AnswerKey.js.map +1 -1
- package/dist/react/CaseMenu.d.ts +2 -2
- package/dist/react/CaseMenu.js +10 -31
- package/dist/react/CaseMenu.js.map +1 -1
- package/dist/react/CompareView.js +3 -3
- package/dist/react/CompareView.js.map +1 -1
- package/dist/react/ConfirmAnswer.js +1 -1
- package/dist/react/ConfirmAnswer.js.map +1 -1
- package/dist/react/Drawer.d.ts +32 -0
- package/dist/react/Drawer.js +60 -0
- package/dist/react/Drawer.js.map +1 -0
- package/dist/react/HubSections.d.ts +34 -30
- package/dist/react/HubSections.js +104 -103
- package/dist/react/HubSections.js.map +1 -1
- package/dist/react/Menu.d.ts +37 -0
- package/dist/react/Menu.js +51 -0
- package/dist/react/Menu.js.map +1 -0
- package/dist/react/ModelMenu.d.ts +1 -1
- package/dist/react/ModelMenu.js +8 -32
- package/dist/react/ModelMenu.js.map +1 -1
- package/dist/react/RunView.js +24 -4
- package/dist/react/RunView.js.map +1 -1
- package/dist/react/Spending.d.ts +25 -0
- package/dist/react/Spending.js +51 -0
- package/dist/react/Spending.js.map +1 -0
- package/dist/react/SuiteSections.d.ts +27 -14
- package/dist/react/SuiteSections.js +227 -61
- package/dist/react/SuiteSections.js.map +1 -1
- package/dist/react/app.d.ts +18 -0
- package/dist/react/app.js.map +1 -1
- package/dist/react/format.d.ts +13 -0
- package/dist/react/format.js +13 -0
- package/dist/react/format.js.map +1 -1
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.js +3 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/pieces.d.ts +21 -8
- package/dist/react/pieces.js +44 -14
- package/dist/react/pieces.js.map +1 -1
- package/dist/runner.d.ts +18 -8
- package/dist/runner.js +148 -12
- package/dist/runner.js.map +1 -1
- package/dist/settings.d.ts +12 -0
- package/dist/settings.js +18 -0
- package/dist/settings.js.map +1 -1
- package/dist/spending.d.ts +100 -0
- package/dist/spending.js +133 -0
- package/dist/spending.js.map +1 -0
- package/dist/stats.d.ts +3 -1
- package/dist/stats.js +6 -2
- package/dist/stats.js.map +1 -1
- package/dist/store.d.ts +5 -0
- package/dist/suggest.js +17 -12
- package/dist/suggest.js.map +1 -1
- package/dist/suiteSettings.d.ts +78 -0
- package/dist/suiteSettings.js +142 -0
- package/dist/suiteSettings.js.map +1 -0
- package/dist/suites/crisisRisk.js +3 -3
- package/dist/suites/crisisRisk.js.map +1 -1
- package/dist/suites/hopelessness.js +6 -6
- package/dist/suites/hopelessness.js.map +1 -1
- package/dist/suites/injection.js +2 -2
- package/dist/suites/injection.js.map +1 -1
- package/dist/summary.d.ts +41 -4
- package/dist/summary.js +46 -8
- package/dist/summary.js.map +1 -1
- package/dist/testing.d.ts +19 -0
- package/dist/testing.js +61 -0
- package/dist/testing.js.map +1 -1
- package/dist/todo.d.ts +146 -0
- package/dist/todo.js +198 -0
- package/dist/todo.js.map +1 -0
- package/dist/types.d.ts +46 -7
- package/dist/types.js +28 -4
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/schema/evalkeeper.prisma +13 -0
- package/src/decisions.ts +1 -1
- package/src/drafts.ts +3 -1
- package/src/glossary.ts +35 -14
- package/src/health.ts +3 -2
- package/src/index.ts +3 -0
- package/src/memoryStore.ts +15 -1
- package/src/next/actions.ts +67 -2
- package/src/prisma/contracts.ts +16 -1
- package/src/prisma/index.ts +68 -1
- package/src/prune.ts +71 -14
- package/src/react/AddCase.tsx +13 -11
- package/src/react/AnswerKey.tsx +17 -5
- package/src/react/CaseMenu.tsx +23 -77
- package/src/react/CompareView.tsx +4 -10
- package/src/react/ConfirmAnswer.tsx +1 -1
- package/src/react/Drawer.tsx +130 -0
- package/src/react/HubSections.tsx +180 -414
- package/src/react/Menu.tsx +155 -0
- package/src/react/ModelMenu.tsx +23 -74
- package/src/react/RunView.tsx +46 -3
- package/src/react/Spending.tsx +200 -0
- package/src/react/SuiteSections.tsx +591 -148
- package/src/react/app.ts +18 -0
- package/src/react/format.ts +15 -0
- package/src/react/index.ts +3 -0
- package/src/react/pieces.tsx +57 -18
- package/src/runner.ts +199 -13
- package/src/settings.ts +20 -0
- package/src/spending.ts +209 -0
- package/src/stats.ts +8 -2
- package/src/store.ts +5 -0
- package/src/suggest.ts +21 -14
- package/src/suiteSettings.ts +201 -0
- package/src/suites/crisisRisk.ts +3 -3
- package/src/suites/hopelessness.ts +6 -6
- package/src/suites/injection.ts +2 -2
- package/src/summary.ts +59 -8
- package/src/testing.ts +77 -0
- package/src/todo.ts +318 -0
- package/src/types.ts +63 -9
- package/starter/index.ts +7 -0
- package/templates/lib/evalkeeper/actions.ts +20 -0
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { FAVOR_TEXT, allPassed, answerKeyHealth, attacksFrom, barStatus, checkBar, draftAnswers, newStarters, orderRows, pctBeside, priorityGain, priorityOf, isInjectionSuite, meanCalibrationError, money, probabilityQuality, perAnswer, retiresLabel, seconds, seriousMistakes, suggest, } from "../index.js";
|
|
2
|
+
import { FAVOR_TEXT, allPassed, answerKeyHealth, attacksFrom, barStatus, checkBar, draftAnswers, newStarters, orderRows, pctBeside, priorityGain, priorityOf, isInjectionSuite, meanCalibrationError, money, probabilityQuality, perAnswer, retiresLabel, seconds, seriousMistakes, suggest, withRounds, EASY_MIN_ROUNDS, currentSettings, replacedStarters, suiteStatus, suiteTodos, targetCasesOf, todoText, SEVERITY_ORDER, SEVERITY_LABEL, } from "../index.js";
|
|
3
3
|
import { AnswerKey } from "./AnswerKey.js";
|
|
4
4
|
import { ModelMenu } from "./ModelMenu.js";
|
|
5
5
|
import { PriorityPicker } from "./PriorityPicker.js";
|
|
6
6
|
import { InfoPopover } from "./InfoPopover.js";
|
|
7
7
|
import { GLOSSARY } from "../glossary.js";
|
|
8
8
|
import { Tabs } from "./Tabs.js";
|
|
9
|
-
import { Link, BackLink, Card, RefreshWhile, Chip, IconSubmit, InfoTip, Score, Select, Spinner, Submit, Tip, } from "./pieces.js";
|
|
10
|
-
import { pct, LINK, QUIET_BUTTON } from "./format.js";
|
|
11
|
-
import { Plus, RotateCw, ShieldAlert, Sparkles } from "lucide-react";
|
|
12
|
-
import {
|
|
9
|
+
import { Link, BackLink, Card, RefreshWhile, Chip, SeverityChip, SuiteStatusBadge, IconSubmit, InfoTip, Score, Select, Spinner, Submit, Tip, } from "./pieces.js";
|
|
10
|
+
import { pct, LINK, QUIET_BUTTON, TINT } from "./format.js";
|
|
11
|
+
import { Check, ChevronRight, Plus, RotateCw, ShieldAlert, Sparkles, } from "lucide-react";
|
|
12
|
+
import { PageMenu } from "./Drawer.js";
|
|
13
|
+
import { SpendingAlert, SpendingForm } from "./Spending.js";
|
|
14
|
+
import { TARGET_CASES_RANGE } from "../suiteSettings.js";
|
|
15
|
+
import { evalsPath, attacksResisted, } from "./app.js";
|
|
13
16
|
import { SettingsHistory } from "./SettingsHistory.js";
|
|
14
17
|
/**
|
|
15
18
|
* Everything a suite's page shows, loaded together: on a remote database
|
|
@@ -23,28 +26,31 @@ export async function loadSuitePage(app, key) {
|
|
|
23
26
|
const operation = app.suiteByKey[key]?.operation;
|
|
24
27
|
if (!operation)
|
|
25
28
|
return null;
|
|
26
|
-
const [b, attackBoards, [history, liveSettings], inInstructions, cases] = await Promise.all([
|
|
29
|
+
const [b, attackBoards, [history, liveSettings], inInstructions, cases, savedSettings, spending,] = await Promise.all([
|
|
27
30
|
app.runner.board(key),
|
|
28
31
|
// Injection suites that attack this feature: their results count here.
|
|
29
32
|
app.runner.attackBoards(key),
|
|
30
33
|
// Records a deploy if the instructions changed under the live
|
|
31
34
|
// settings, before reading them.
|
|
32
|
-
app.settings
|
|
33
|
-
.syncPrompt(operation)
|
|
34
|
-
.then(() => Promise.all([
|
|
35
|
+
app.settings.syncPrompt(operation).then(() => Promise.all([
|
|
35
36
|
app.settings.history(operation),
|
|
36
|
-
|
|
37
|
+
// Null for a feature with no settings yet: the page still shows.
|
|
38
|
+
currentSettings(app.settings, operation),
|
|
37
39
|
])),
|
|
38
40
|
app.runner.casesInInstructions(key),
|
|
39
41
|
// Retired ones too: starters already added once aren't offered again.
|
|
40
42
|
app.store.listCases(key, { includeRetired: true }),
|
|
43
|
+
app.runner.suiteSettings(key),
|
|
44
|
+
// The page must load even when spending can't be read.
|
|
45
|
+
app.spending ? app.spending.read(operation).catch(() => null) : null,
|
|
41
46
|
]);
|
|
42
47
|
const { suite, rows } = b;
|
|
43
48
|
const attacks = attacksFrom(attackBoards);
|
|
44
49
|
// An injection suite's models are chosen on its base suite's page.
|
|
45
50
|
const choosesHere = !isInjectionSuite(suite);
|
|
46
51
|
// The suite's priority, or the one an admin chose in its settings.
|
|
47
|
-
const priority = priorityOf(suite, liveSettings
|
|
52
|
+
const priority = priorityOf(suite, liveSettings?.settings);
|
|
53
|
+
const target = targetCasesOf(suite, savedSettings);
|
|
48
54
|
const testing = rows.some((r) => r.testing) ||
|
|
49
55
|
attackBoards.some((a) => a.rows.some((r) => r.testing));
|
|
50
56
|
// No suggestion while a test runs: it would weigh half a board.
|
|
@@ -66,26 +72,72 @@ export async function loadSuitePage(app, key) {
|
|
|
66
72
|
// What would keep the answer key useful, from the same tests.
|
|
67
73
|
const current = rows.filter((r) => r.test && !r.test.stale && !r.baseline);
|
|
68
74
|
const testedAt = current.reduce((m, r) => (r.test && (!m || r.test.at > m) ? r.test.at : m), null);
|
|
69
|
-
|
|
75
|
+
// Rounds each case passed (read only past the floor of cases).
|
|
76
|
+
const rounds = await app.runner.easyRounds(key, cases, target);
|
|
77
|
+
const health = answerKeyHealth(cases, withRounds(b.caseResults, rounds), new Date(), testedAt, target);
|
|
78
|
+
const replaced = replacedStarters(suite, cases);
|
|
79
|
+
// Attack tests set up but not made yet.
|
|
80
|
+
const unmade = attackBoards.filter((a) => a.cases === 0);
|
|
81
|
+
const todoInput = {
|
|
82
|
+
rows,
|
|
83
|
+
checks: suite.checks,
|
|
84
|
+
priority,
|
|
85
|
+
models: app.models,
|
|
86
|
+
attacks,
|
|
87
|
+
cases: b.cases,
|
|
88
|
+
provisional: b.provisional,
|
|
89
|
+
target,
|
|
90
|
+
unmadeAttacks: app.actions.makeAttackCases
|
|
91
|
+
? unmade.map((a) => ({ key: a.suite.key, label: a.suite.label }))
|
|
92
|
+
: [],
|
|
93
|
+
replacedStarters: replaced.length,
|
|
94
|
+
splitCases: health.split.length,
|
|
95
|
+
};
|
|
70
96
|
// For each split case, which models got it fully right and which didn't,
|
|
71
97
|
// so a person sees the disagreement before deciding.
|
|
72
98
|
const split = new Set(health.split.map((c) => c.id));
|
|
73
99
|
const splitBy = {};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
100
|
+
// Must-pass checks every tested model misses: count the cases each
|
|
101
|
+
// misses them on, for the to-do list.
|
|
102
|
+
const fixing = new Set(suiteTodos(todoInput).flatMap((t) => t.kind === "fixCheck" ? [t.check] : []));
|
|
103
|
+
// check → case → models that missed it there
|
|
104
|
+
const missedBy = new Map();
|
|
105
|
+
const scored = current.filter((r) => !r.variant);
|
|
106
|
+
if (split.size || fixing.size)
|
|
107
|
+
await Promise.all(scored.map(async (r) => {
|
|
78
108
|
if (!r.test)
|
|
79
109
|
return;
|
|
80
110
|
for (const o of await app.store.listOutputs(r.test.runId)) {
|
|
81
|
-
if (
|
|
111
|
+
if (o.error)
|
|
82
112
|
continue;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
entry[side].
|
|
113
|
+
if (split.has(o.caseId)) {
|
|
114
|
+
const side = allPassed(o.scores) ? "right" : "wrong";
|
|
115
|
+
const entry = (splitBy[o.caseId] ??= { right: [], wrong: [] });
|
|
116
|
+
if (!entry[side].includes(r.label))
|
|
117
|
+
entry[side].push(r.label);
|
|
118
|
+
}
|
|
119
|
+
for (const x of o.scores ?? []) {
|
|
120
|
+
if (!fixing.has(x.key) || x.pass !== false)
|
|
121
|
+
continue;
|
|
122
|
+
const byCase = missedBy.get(x.key) ?? new Map();
|
|
123
|
+
const models = byCase.get(o.caseId) ?? new Set();
|
|
124
|
+
models.add(r.key);
|
|
125
|
+
byCase.set(o.caseId, models);
|
|
126
|
+
missedBy.set(x.key, byCase);
|
|
127
|
+
}
|
|
87
128
|
}
|
|
88
129
|
}));
|
|
130
|
+
const missedByCheck = Object.fromEntries([...fixing].map((k) => [
|
|
131
|
+
k,
|
|
132
|
+
[...(missedBy.get(k)?.values() ?? [])].filter((models) => models.size === scored.length).length,
|
|
133
|
+
]));
|
|
134
|
+
// The to-do list, on the page that chooses models.
|
|
135
|
+
const todos = choosesHere
|
|
136
|
+
? suiteTodos({ ...todoInput, missedByCheck })
|
|
137
|
+
: [];
|
|
138
|
+
const status = choosesHere
|
|
139
|
+
? suiteStatus({ ...todoInput, missedByCheck }, todos)
|
|
140
|
+
: null;
|
|
89
141
|
return {
|
|
90
142
|
app,
|
|
91
143
|
key,
|
|
@@ -108,6 +160,12 @@ export async function loadSuitePage(app, key) {
|
|
|
108
160
|
cases,
|
|
109
161
|
priority,
|
|
110
162
|
splitBy,
|
|
163
|
+
target,
|
|
164
|
+
savedSettings,
|
|
165
|
+
spending,
|
|
166
|
+
todos,
|
|
167
|
+
status,
|
|
168
|
+
replaced,
|
|
111
169
|
};
|
|
112
170
|
}
|
|
113
171
|
/** A share as a whole percent, or a dash when there's nothing to show. */
|
|
@@ -123,28 +181,120 @@ const whyFavor = (favor) => {
|
|
|
123
181
|
/** The suite's priority, as the page names it. */
|
|
124
182
|
const FAVORS = { cost: "cost", speed: "speed", quality: "accuracy" };
|
|
125
183
|
const VS = {
|
|
126
|
-
BETTER: "
|
|
127
|
-
SAME: "
|
|
128
|
-
WORSE: "
|
|
129
|
-
TOO_FEW: "
|
|
184
|
+
BETTER: "Better",
|
|
185
|
+
SAME: "Similar",
|
|
186
|
+
WORSE: "Worse",
|
|
187
|
+
TOO_FEW: "Can't tell",
|
|
130
188
|
};
|
|
131
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* The suite's name and status, its menu (Suite settings, Spending and
|
|
191
|
+
* daily limits), what it tests, and spending when it needs room.
|
|
192
|
+
*/
|
|
132
193
|
export function SuiteHeader({ data }) {
|
|
133
|
-
const { app, suite } = data;
|
|
134
|
-
return (
|
|
194
|
+
const { app, suite, status } = data;
|
|
195
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(BackLink, { href: app.basePath, children: "Evals" }), _jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [_jsx("h1", { className: "text-2xl font-semibold", children: suite.label }), status && (_jsxs("span", { className: "inline-flex items-center", children: [_jsx(SuiteStatusBadge, { status: status }), _jsx(InfoTip, { term: "standing", id: "suite-status", align: "end" })] }))] }), _jsx(PageMenu, { label: `${suite.label} menu`, entries: menuEntries(data) })] }), _jsx("p", { className: "readable text-muted", children: suite.description })] }), _jsx(SpendingAlert, { app: app, reading: data.spending })] }));
|
|
196
|
+
}
|
|
197
|
+
/** The title menu's entries, each opening its own drawer. */
|
|
198
|
+
function menuEntries(data) {
|
|
199
|
+
const { app, key, suite, spending, choosesHere } = data;
|
|
200
|
+
const entries = [];
|
|
201
|
+
if (choosesHere &&
|
|
202
|
+
app.runner.canSaveSuiteSettings &&
|
|
203
|
+
app.actions.saveSuiteSettings)
|
|
204
|
+
entries.push({
|
|
205
|
+
key: "settings",
|
|
206
|
+
label: "Suite settings",
|
|
207
|
+
body: _jsx(SuiteSettingsForm, { data: data }),
|
|
208
|
+
});
|
|
209
|
+
if (spending && app.actions.saveLimits)
|
|
210
|
+
entries.push({
|
|
211
|
+
key: "spending",
|
|
212
|
+
label: "Spending and daily limits",
|
|
213
|
+
body: (_jsx(SpendingForm, { app: app, reading: spending, suite: key, label: suite.label })),
|
|
214
|
+
});
|
|
215
|
+
return entries;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Suite settings: one form, one Save. Its target number of cases, and each
|
|
219
|
+
* check's level and aim, kept apart from the model versions, so changing
|
|
220
|
+
* them never makes a version.
|
|
221
|
+
*/
|
|
222
|
+
function SuiteSettingsForm({ data }) {
|
|
223
|
+
const { app, key, savedSettings, target } = data;
|
|
224
|
+
const action = app.actions.saveSuiteSettings;
|
|
225
|
+
if (!action)
|
|
226
|
+
return null;
|
|
227
|
+
// The suite as written in code: what "its own" means for each field.
|
|
228
|
+
const own = app.runner.suiteOrThrow(key);
|
|
229
|
+
const ownTarget = own.targetCases ?? 50;
|
|
230
|
+
return (_jsxs("form", { action: action, className: "space-y-4", children: [_jsxs("p", { className: "readable text-muted", children: [GLOSSARY.suiteSettings, " An empty field uses the suite's own."] }), _jsx("input", { type: "hidden", name: "suite", value: key }), _jsxs("div", { className: "space-y-1", children: [_jsxs("label", { htmlFor: "target-cases", className: "block font-medium", children: ["Target number of cases", _jsx(InfoTip, { term: "targetCases", id: "target-cases" })] }), _jsx("input", { id: "target-cases", name: "targetCases", type: "number", inputMode: "numeric", min: TARGET_CASES_RANGE.min, max: TARGET_CASES_RANGE.max, step: 1, placeholder: String(ownTarget), defaultValue: savedSettings.targetCases ?? "", className: "w-32 rounded-md border border-line bg-card px-3 py-2 tabular-nums focus:border-accent focus:outline-none" })] }), _jsxs("fieldset", { className: "space-y-3", children: [_jsxs("legend", { className: "font-medium", children: ["Checks", _jsx(InfoTip, { term: "checkLevels", id: "check-levels" })] }), _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "text-left text-xs text-muted", children: _jsxs("tr", { children: [_jsx("th", { className: "pb-1 font-normal", children: _jsx("span", { className: "sr-only", children: "Check" }) }), _jsx("th", { className: "pb-1 font-normal", children: "Level" }), _jsx("th", { className: "pb-1 font-normal", children: "Aim, %" })] }) }), _jsx("tbody", { children: own.checks.map((c) => {
|
|
231
|
+
const saved = savedSettings.checks[c.key];
|
|
232
|
+
return (_jsxs("tr", { children: [_jsx("td", { className: "py-1 pr-2", children: c.label }), _jsx("td", { className: "py-1 pr-2", children: _jsx(Select, { name: `level:${c.key}`, "aria-label": `${c.label}: level`,
|
|
233
|
+
// Starts on its level now; the code's own isn't saved.
|
|
234
|
+
defaultValue: saved?.severity ?? c.severity, className: "rounded-md border border-line bg-card px-2 py-1.5 text-sm", children: SEVERITY_ORDER.map((l) => (_jsx("option", { value: l, children: SEVERITY_LABEL[l] }, l))) }) }), _jsx("td", { className: "py-1", children: _jsx("input", { name: `aim:${c.key}`, "aria-label": `${c.label}: aim`, type: "number", inputMode: "numeric", min: 1, max: 100, step: 1, placeholder: String(Math.round(checkBar(c) * 100)), defaultValue: saved?.aim === undefined
|
|
235
|
+
? ""
|
|
236
|
+
: Math.round(saved.aim * 100), className: "w-16 rounded-md border border-line bg-card px-2 py-1.5 text-sm tabular-nums focus:border-accent focus:outline-none" }) })] }, c.key));
|
|
237
|
+
}) })] })] }), _jsx(Submit, { children: "Save" })] }, target));
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* What to do next on this suite, in order, each with why and the way to
|
|
241
|
+
* do it here. Each drops off once it's done; empty, the section says
|
|
242
|
+
* there's nothing to do. Not on an injection suite, whose models are
|
|
243
|
+
* chosen on its feature's page.
|
|
244
|
+
*/
|
|
245
|
+
export function TodoSection({ data }) {
|
|
246
|
+
const { app, key, todos, choosesHere, status } = data;
|
|
247
|
+
if (!choosesHere)
|
|
248
|
+
return null;
|
|
249
|
+
return (_jsxs("section", { "aria-labelledby": "todo", className: "space-y-3", children: [_jsxs("h2", { id: "todo", className: "text-lg font-semibold", children: ["To do", _jsx(InfoTip, { term: "todo" })] }), todos.length === 0 ? (_jsx("p", { className: "readable text-sm text-muted", children: status === "unknown"
|
|
250
|
+
? "Nothing to do here yet."
|
|
251
|
+
: "Nothing to do: every must-pass check meets its aim, and the answer key is at its target." })) : (
|
|
252
|
+
// Numbered: the list is in the order to do it. No checkbox: an item
|
|
253
|
+
// drops off on its own once it's done.
|
|
254
|
+
_jsx("ol", { className: "divide-y divide-line rounded-lg border border-line bg-card", children: todos.map((t, n) => {
|
|
255
|
+
const { what, why } = todoText(t);
|
|
256
|
+
return (_jsxs("li", { className: "flex flex-wrap items-start justify-between gap-x-4 gap-y-2 px-4 py-3 text-sm", children: [_jsxs("p", { className: "readable flex min-w-0 items-start gap-2", children: [_jsxs("span", { "aria-hidden": true, className: "w-4 shrink-0 text-right tabular-nums text-muted", children: [n + 1, "."] }), _jsxs("span", { children: [_jsx("span", { className: "font-medium", children: what }), ": ", why] })] }), _jsx(TodoAction, { app: app, suite: key, todo: t })] }, `${t.kind}-${t.kind === "fixCheck" ? t.check : ""}`));
|
|
257
|
+
}) }))] }));
|
|
258
|
+
}
|
|
259
|
+
/** Where a to-do item is done: a button for this page's action, or a link to its section. */
|
|
260
|
+
function TodoAction({ app, suite, todo: t, }) {
|
|
261
|
+
// Links look like the buttons beside them: every item's action alike.
|
|
262
|
+
const go = (href, text) => (_jsx("a", { href: href, className: `inline-flex shrink-0 items-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm ${QUIET_BUTTON}`, children: text }));
|
|
263
|
+
const button = (action, text, fields = {}) => action ? (_jsxs("form", { action: action, className: "shrink-0", children: [_jsx("input", { type: "hidden", name: "suite", value: suite }), Object.entries(fields).map(([k, v]) => (_jsx("input", { type: "hidden", name: k, value: v }, k))), _jsx(Submit, { variant: "quiet", children: text })] })) : null;
|
|
264
|
+
switch (t.kind) {
|
|
265
|
+
case "testAll":
|
|
266
|
+
return button(app.actions.testAll, "Test every model");
|
|
267
|
+
case "retest":
|
|
268
|
+
return button(app.actions.testAll, "Test every model again");
|
|
269
|
+
case "makeLive":
|
|
270
|
+
return button(app.actions.useSuggestion, "Use the suggestion");
|
|
271
|
+
case "fixCheck":
|
|
272
|
+
return t.runId
|
|
273
|
+
? go(`${evalsPath(app, suite, "runs", t.runId)}#check-${t.check}`, "See the cases")
|
|
274
|
+
: go("#checks", "See the check");
|
|
275
|
+
case "confirm":
|
|
276
|
+
return go("#answer-key", "Review them");
|
|
277
|
+
case "addCases":
|
|
278
|
+
return go("#add-case=", "Add a case");
|
|
279
|
+
case "makeAttacks":
|
|
280
|
+
return (_jsx("span", { className: "flex shrink-0 flex-wrap gap-2", children: t.suites.map((a) => (_jsxs("form", { action: app.actions.makeAttackCases, children: [_jsx("input", { type: "hidden", name: "suite", value: a.key }), _jsx(Submit, { variant: "quiet", children: t.suites.length > 1 ? `Make ${a.label}` : "Make attack cases" })] }, a.key))) }));
|
|
281
|
+
case "retireStarters":
|
|
282
|
+
return button(app.actions.retireReplacedStarters, `Retire ${t.cases}`);
|
|
283
|
+
case "reviewSplit":
|
|
284
|
+
return go("#answer-key-health", "Review them");
|
|
285
|
+
}
|
|
135
286
|
}
|
|
136
287
|
/** On an injection suite: models are chosen on its base suite, with a link there. */
|
|
137
288
|
export function ChosenOnBase({ data }) {
|
|
138
289
|
const { app, suite } = data;
|
|
139
|
-
return (_jsx(_Fragment, { children: isInjectionSuite(suite) && (_jsxs(Card, { className: "space-y-2", children: [_jsxs("h2", { className: "font-semibold", children: ["Models are chosen on ", suite.base.label, _jsx(InfoTip, { term: "attackResults" })] }), _jsxs("p", { className: "readable text-sm text-muted", children: ["This suite tests the same feature as ", suite.base.label, ", so one choice of model serves both. Its results show there as Attacks resisted, and the suggestion there never picks a model with more
|
|
290
|
+
return (_jsx(_Fragment, { children: isInjectionSuite(suite) && (_jsxs(Card, { className: "space-y-2", children: [_jsxs("h2", { className: "font-semibold", children: ["Models are chosen on ", suite.base.label, _jsx(InfoTip, { term: "attackResults" })] }), _jsxs("p", { className: "readable text-sm text-muted", children: ["This suite tests the same feature as ", suite.base.label, ", so one choice of model serves both. Its results show there as Attacks resisted, and the suggestion there never picks a model with more must-pass misses on them than live."] }), _jsxs(Link, { href: evalsPath(app, suite.base.key), className: `inline-block text-sm ${LINK}`, children: ["Choose models on ", suite.base.label] })] })) }));
|
|
140
291
|
}
|
|
141
292
|
/** Which models to make live and the fallback, and why; shown when nothing would change too. */
|
|
142
293
|
export function SuggestionCard({ data }) {
|
|
143
|
-
const {
|
|
294
|
+
const { s, choosesHere, testing } = data;
|
|
144
295
|
if (choosesHere && testing)
|
|
145
296
|
return (_jsxs("section", { className: "space-y-3", "aria-labelledby": "suggestion", children: [_jsxs("h2", { id: "suggestion", className: "text-lg font-semibold", children: ["Suggested", _jsx(InfoTip, { term: "suggestion" })] }), _jsx(Card, { children: _jsx("p", { className: "readable text-sm text-muted", children: "Waiting for the tests running now to finish. The suggestion weighs every model's finished test, so it follows then." }) })] }));
|
|
146
|
-
return (_jsx(_Fragment, { children: s && (_jsxs("section", { className: "space-y-3", "aria-labelledby": "suggestion", children: [
|
|
147
|
-
!(s.retestLive && (!s.fallback || s.fallback.fallback)) && (_jsxs("form", { action: app.actions.useSuggestion, children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsx(Submit, { children: "Use these" })] }))] }), _jsxs(Card, { className: "space-y-3", children: [!s.same && (_jsxs("p", { children: ["Live: ", _jsx("strong", { children: s.live.label }), s.fallback && (_jsxs(_Fragment, { children: [" ", "\u00B7 Fallback: ", _jsx("strong", { children: s.fallback.label })] }))] })), _jsx("ul", { className: "readable list-disc space-y-1 pl-5 text-sm text-muted", children: s.reasons.map((r) => (_jsx("li", { children: r }, r))) })] })] })) }));
|
|
297
|
+
return (_jsx(_Fragment, { children: s && (_jsxs("section", { className: "space-y-3", "aria-labelledby": "suggestion", children: [_jsx("div", { className: "flex items-center justify-between gap-4", children: _jsxs("h2", { id: "suggestion", className: "text-lg font-semibold", children: [s.same ? "No change suggested" : "Suggested", _jsx(InfoTip, { term: "suggestion" })] }) }), _jsxs(Card, { className: "space-y-3", children: [!s.same && (_jsxs("p", { children: ["Live: ", _jsx("strong", { children: s.live.label }), s.fallback && (_jsxs(_Fragment, { children: [" ", "\u00B7 Fallback: ", _jsx("strong", { children: s.fallback.label })] }))] })), _jsx("ul", { className: "readable list-disc space-y-1 pl-5 text-sm text-muted", children: s.reasons.map((r) => (_jsx("li", { children: r }, r))) })] })] })) }));
|
|
148
298
|
}
|
|
149
299
|
/** Cases whose words appear in the feature's instructions. */
|
|
150
300
|
export function CasesInInstructions({ data }) {
|
|
@@ -161,7 +311,7 @@ export function ModelTable({ data }) {
|
|
|
161
311
|
});
|
|
162
312
|
const tunable = tunableModels(data);
|
|
163
313
|
const columns = 7 + (showAttacks ? 1 : 0) + (suite.decisions ? 2 : 0);
|
|
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: "
|
|
314
|
+
return (_jsx(_Fragment, { children: _jsxs("section", { className: "space-y-3", "aria-labelledby": "models", 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", { id: "models", 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: "Must-pass misses" }) }), 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 ||
|
|
165
315
|
r.key === suggestedFallback) && (_jsx(Tip, { term: "suggestion", side: "bottom", id: `suggested-${r.key}`, children: _jsx(Chip, { tone: "suggested", children: r.key === suggestedLive
|
|
166
316
|
? "Suggested"
|
|
167
317
|
: "Suggested fallback" }) })), retiresLabel(app.models, r.model) && (_jsx(Tip, { term: "retiring", side: "bottom", id: `retiring-${r.key}`, children: _jsxs(Chip, { tone: "warn", children: ["Retires ", retiresLabel(app.models, r.model)] }) })), suite.decisions && app.models[r.model]?.decisions && (_jsx(Tip, { term: app.models[r.model]?.decisions === "native"
|
|
@@ -211,14 +361,15 @@ function TestSettingForm({ data, tunable, }) {
|
|
|
211
361
|
export function TestSettingSection(_props) {
|
|
212
362
|
return null;
|
|
213
363
|
}
|
|
364
|
+
// From the app's color names, so its evalkeeper.css decides both themes.
|
|
214
365
|
const BAR_TONE = {
|
|
215
|
-
meets:
|
|
216
|
-
close:
|
|
217
|
-
below:
|
|
366
|
+
meets: TINT.good,
|
|
367
|
+
close: TINT.warn,
|
|
368
|
+
below: TINT.bad,
|
|
218
369
|
};
|
|
219
370
|
/**
|
|
220
371
|
* Where the mistakes are: how often each check passed, for every model
|
|
221
|
-
* with a current test, beside each check's
|
|
372
|
+
* with a current test, beside each check's aim. Must-pass checks first. The
|
|
222
373
|
* checks section shows the live model alone; this shows which model fails
|
|
223
374
|
* which check.
|
|
224
375
|
*/
|
|
@@ -227,33 +378,32 @@ export function CheckBreakdownSection({ data }) {
|
|
|
227
378
|
const tested = rows.filter((r) => r.test && !r.test.stale);
|
|
228
379
|
if (!tested.length)
|
|
229
380
|
return null;
|
|
230
|
-
const checks = [...suite.checks].sort((a, b) =>
|
|
381
|
+
const checks = [...suite.checks].sort((a, b) => SEVERITY_ORDER.indexOf(a.severity) - SEVERITY_ORDER.indexOf(b.severity));
|
|
231
382
|
return (_jsxs("section", { "aria-labelledby": "check-breakdown", className: "space-y-3", children: [_jsxs("h2", { id: "check-breakdown", className: "text-lg font-semibold", children: ["Where the mistakes are", _jsx(InfoTip, { term: "checkBreakdown" })] }), _jsxs(Card, { className: "space-y-3", children: [_jsx("p", { className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-xs", children: [
|
|
232
|
-
["meets", "Meets
|
|
233
|
-
["close", "Within 10 points"],
|
|
234
|
-
["below", "Further
|
|
235
|
-
].map(([k, text]) => (_jsxs("span", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: `inline-block h-3 w-3 rounded ${BAR_TONE[k]}` }), text] }, k))) }), _jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-left text-sm", children: [_jsx("thead", { className: "text-xs text-muted", children: _jsxs("tr", { children: [_jsx("th", { className: "py-2 pr-4 font-normal", children: "Check" }), _jsx("th", { className: "py-2 pr-4 font-normal", children: "
|
|
383
|
+
["meets", "Meets its aim"],
|
|
384
|
+
["close", "Within 10 points of it"],
|
|
385
|
+
["below", "Further off"],
|
|
386
|
+
].map(([k, text]) => (_jsxs("span", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: `inline-block h-3 w-3 rounded ${BAR_TONE[k]}` }), text] }, k))) }), _jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-left text-sm", children: [_jsx("thead", { className: "text-xs text-muted", children: _jsxs("tr", { children: [_jsx("th", { className: "py-2 pr-4 font-normal", children: "Check" }), _jsx("th", { className: "py-2 pr-4 font-normal", children: _jsx(Tip, { term: "aim", side: "bottom", id: "breakdown-aim", children: "Aim" }) }), tested.map((r) => (_jsx("th", { className: "py-2 pr-3 font-normal", children: r.label }, r.key)))] }) }), _jsxs("tbody", { children: [checks.map((c) => (_jsxs("tr", { children: [_jsxs("td", { className: "py-1.5 pr-4", children: [_jsx("span", { className: "mr-2", children: c.label }), _jsx(SeverityChip, { severity: c.severity })] }), _jsx("td", { className: "py-1.5 pr-4 tabular-nums text-muted", children: pct(checkBar(c)) }), tested.map((r) => {
|
|
236
387
|
const x = r.test?.byCheck[c.key];
|
|
237
388
|
const rate = x?.n ? x.passed / x.n : null;
|
|
238
389
|
return (_jsx("td", { className: "py-1 pr-2", children: rate === null ? (_jsx("span", { className: "text-muted", children: "\u2013" })) : (_jsx("span", { className: `inline-block rounded px-2 py-0.5 tabular-nums ${BAR_TONE[barStatus(rate, checkBar(c))]}`, children: pctBeside(rate, checkBar(c)) })) }, r.key));
|
|
239
|
-
})] }, c.key))), _jsxs("tr", { children: [
|
|
390
|
+
})] }, c.key))), _jsxs("tr", { children: [_jsxs("td", { className: "py-1.5 pr-4", children: ["Answers with no mistakes at all (", Math.max(...tested.map((r) => r.test?.answers ?? 0)), " ", "answers)"] }), _jsx("td", { className: "py-1.5 pr-4 tabular-nums text-muted", children: pct(1) }), tested.map((r) => (_jsx("td", { className: "py-1 pr-2", children: r.test?.answers ? (_jsx("span", { title: `${r.test.answersRight} of ${r.test.answers} answers`, className: `inline-block rounded px-2 py-0.5 tabular-nums ${BAR_TONE[barStatus(r.test.answersRight / r.test.answers, 1)]}`, children: pct(r.test.answersRight / r.test.answers) })) : (_jsx("span", { className: "text-muted", children: "\u2013" })) }, r.key)))] })] })] }) })] })] }));
|
|
240
391
|
}
|
|
241
392
|
/** The feature's settings history, with rollback; not on an injection suite. */
|
|
242
393
|
export function Versions({ data }) {
|
|
243
|
-
const { app, key, history, liveSettings, choosesHere } = data;
|
|
244
|
-
|
|
394
|
+
const { app, key, history, liveSettings, choosesHere, suite } = data;
|
|
395
|
+
if (choosesHere && !liveSettings)
|
|
396
|
+
return (_jsxs(Card, { className: "space-y-2", children: [_jsxs("h2", { className: "font-semibold", children: ["No settings yet", _jsx(InfoTip, { term: "versions" })] }), _jsxs("p", { className: "readable text-sm text-muted", children: [suite.label, " has no settings version yet, and no default in code, so nothing says which model it runs on. Record its first version (", _jsx("code", { children: "settings.seed" }), " or ", _jsx("code", { children: "settings.change" }), "), or give it a default in your wiring. Tests still run."] })] }));
|
|
397
|
+
return (_jsx(_Fragment, { children: choosesHere && liveSettings && (_jsx(SettingsHistory, { app: app, suite: key, entries: history, liveId: liveSettings.version?.id ?? null, label: (m) => app.models[m]?.label ?? m, defaults: liveSettings.settings })) }));
|
|
245
398
|
}
|
|
246
|
-
/** Each check: what it checks,
|
|
399
|
+
/** Each check: what it checks, must pass or nice to have, its aim, and how the live model does. */
|
|
247
400
|
export function ChecksSection({ data }) {
|
|
248
401
|
const { suite, live } = data;
|
|
249
|
-
return (_jsx(_Fragment, { children: _jsxs("section", { className: "space-y-3", children: [_jsxs("h2", { className: "text-lg font-semibold", children: ["Checks", _jsx(InfoTip, { term: "checks" })] }), _jsx("div", { className: "grid gap-3 md:grid-cols-2", children:
|
|
250
|
-
...suite.checks.filter((c) => c.severity === "serious"),
|
|
251
|
-
...suite.checks.filter((c) => c.severity !== "serious"),
|
|
252
|
-
].map((c) => {
|
|
402
|
+
return (_jsx(_Fragment, { children: _jsxs("section", { id: "checks", className: "scroll-mt-4 space-y-3", children: [_jsxs("h2", { className: "text-lg font-semibold", children: ["Checks", _jsx(InfoTip, { term: "checks" })] }), _jsx("div", { className: "grid gap-3 md:grid-cols-2", children: SEVERITY_ORDER.flatMap((level) => suite.checks.filter((c) => c.severity === level)).map((c) => {
|
|
253
403
|
const rate = live?.test?.byCheck[c.key];
|
|
254
|
-
return (_jsxs(Card, { className: "space-y-1", children: [_jsxs("div", { className: "flex justify-between gap-4", children: [_jsx("h3", { className: "font-medium", children: c.label }), _jsx(Tip, { term: c.severity, id: `severity-${c.key}`, children: _jsx(
|
|
404
|
+
return (_jsxs(Card, { className: "space-y-1", children: [_jsxs("div", { className: "flex justify-between gap-4", children: [_jsx("h3", { className: "font-medium", children: c.label }), _jsx(Tip, { term: c.severity, id: `severity-${c.key}`, align: "end", children: _jsx(SeverityChip, { severity: c.severity }) })] }), _jsx("p", { className: "readable text-sm text-muted", children: c.description }), _jsxs("p", { className: "text-sm", children: [rate && rate.n > 0 && (_jsxs(_Fragment, { children: ["Live:", " ", _jsx("span", { className: rate.passed / rate.n >= checkBar(c)
|
|
255
405
|
? "text-good"
|
|
256
|
-
: "text-warn", children: pctBeside(rate.passed / rate.n, checkBar(c)) }), " ", "(", rate.passed, "/", rate.n, ") \u00B7", " "] })), _jsx(Tip, { term: "
|
|
406
|
+
: "text-warn", children: pctBeside(rate.passed / rate.n, checkBar(c)) }), " ", "(", rate.passed, "/", rate.n, ") \u00B7", " "] })), _jsx(Tip, { term: "aim", id: `aim-${c.key}`, children: _jsxs("span", { className: "text-muted", children: ["Aim: ", pct(checkBar(c))] }) })] })] }, c.key));
|
|
257
407
|
}) })] }) }));
|
|
258
408
|
}
|
|
259
409
|
/**
|
|
@@ -264,18 +414,30 @@ export function ChecksSection({ data }) {
|
|
|
264
414
|
* passes its action.
|
|
265
415
|
*/
|
|
266
416
|
export function AnswerKeyToolsSection({ data }) {
|
|
267
|
-
const { app, key, suite, cases } = data;
|
|
417
|
+
const { app, key, suite, cases, replaced } = data;
|
|
268
418
|
const { actions } = app;
|
|
269
419
|
const inUse = cases.filter((c) => c.status !== "RETIRED");
|
|
270
420
|
const drafts = draftAnswers(cases);
|
|
271
421
|
const fresh = newStarters(suite.starter, cases);
|
|
422
|
+
// New starters named like a case they replace: said up front, so nobody
|
|
423
|
+
// retires the wrong one of two cases with the same title.
|
|
424
|
+
const titleOf = (input) => {
|
|
425
|
+
const p = suite.input.safeParse(input);
|
|
426
|
+
return p.success ? suite.title(p.data) : null;
|
|
427
|
+
};
|
|
428
|
+
const oldTitles = new Set(replaced.map((c) => titleOf(c.input)));
|
|
429
|
+
const sameTitle = fresh.filter((c) => {
|
|
430
|
+
const t = titleOf(c.input);
|
|
431
|
+
return t !== null && oldTitles.has(t);
|
|
432
|
+
}).length;
|
|
272
433
|
const injection = isInjectionSuite(suite) ? suite : null;
|
|
273
434
|
const parts = [
|
|
274
435
|
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")),
|
|
275
436
|
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")),
|
|
276
437
|
actions.addStarters && fresh.length > 0 && (_jsxs(Card, { className: "space-y-3", children: [_jsxs("p", { className: "readable text-sm", children: [inUse.length
|
|
277
438
|
? `${fresh.length} more starter ${fresh.length === 1 ? "case is" : "cases are"} ready.`
|
|
278
|
-
: `No cases yet. Start with the suite's ${fresh.length} starter ${fresh.length === 1 ? "case" : "cases"}.`, " ", "Each needs your review and counts only once you confirm it, unless the suite's author already reviewed it."
|
|
439
|
+
: `No cases yet. Start with the suite's ${fresh.length} starter ${fresh.length === 1 ? "case" : "cases"}.`, " ", "Each needs your review and counts only once you confirm it, unless the suite's author already reviewed it.", sameTitle > 0 &&
|
|
440
|
+
` ${sameTitle === 1 ? "One shares its title" : `${sameTitle} share their titles`} with a starter case ${sameTitle === 1 ? "it replaces" : "they replace"}: the old ${sameTitle === 1 ? "one is" : "ones are"} marked No longer a starter in the answer key.`] }), _jsxs("form", { action: actions.addStarters, children: [_jsx("input", { type: "hidden", name: "suite", value: key }), _jsxs(Submit, { variant: inUse.length ? "quiet" : "primary", children: [_jsx(Sparkles, { "aria-hidden": true, className: "mr-1.5 inline h-4 w-4" }), "Add ", fresh.length, " starter ", fresh.length === 1 ? "case" : "cases"] })] })] }, "starters")),
|
|
279
441
|
].filter(Boolean);
|
|
280
442
|
if (!parts.length)
|
|
281
443
|
return null;
|
|
@@ -305,7 +467,7 @@ export function AnswerKeySection({ data }) {
|
|
|
305
467
|
...attacked.map((a) => ({
|
|
306
468
|
id: a.suite.key,
|
|
307
469
|
title: `Attacks (${a.cases})`,
|
|
308
|
-
panel: (_jsx(AnswerKey, { app: app, readOnly: true, suite: a.suite, rows: a.rows, heading:
|
|
470
|
+
panel: (_jsx(AnswerKey, { app: app, readOnly: true, suite: a.suite, rows: a.rows, heading: _jsxs("h2", { className: "text-lg font-semibold", children: ["Attack cases (", a.cases, " in use)", _jsx(InfoTip, { term: "attackCases", id: `attack-${a.suite.key}` })] }), tools: _jsxs(_Fragment, { children: [_jsx(Tip, { control: true, term: "addAttack", id: `add-attack-${a.suite.key}`, side: "bottom", align: "end", children: _jsxs("a", { href: "https://seanhudson.github.io/evalkeeper/guides/suites/#more-attacks", 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 an attack"] }) }), app.actions.makeAttackCases && (_jsxs("form", { action: app.actions.makeAttackCases, children: [_jsx("input", { type: "hidden", name: "suite", value: a.suite.key }), _jsx(Tip, { control: true, term: "updateAttackCases", id: `update-attacks-${a.suite.key}`, side: "bottom", align: "end", children: _jsx(IconSubmit, { label: "Update attack cases", icon: _jsx(RotateCw, { "aria-hidden": true, className: "h-4 w-4" }) }) })] }))] }) })),
|
|
309
471
|
})),
|
|
310
472
|
] })) }));
|
|
311
473
|
}
|
|
@@ -336,13 +498,14 @@ function UnderAttack({ app, attackSuite, attackLabel, row, resisted, }) {
|
|
|
336
498
|
return _jsx("span", { className: "text-muted", children: "\u2014" });
|
|
337
499
|
}
|
|
338
500
|
/**
|
|
339
|
-
* Keeping the answer key useful: easy cases to retire (
|
|
501
|
+
* Keeping the answer key useful: easy cases to retire (past the suite's
|
|
502
|
+
* target number of cases),
|
|
340
503
|
* cases models split on and near-duplicates to check, old drafts, and
|
|
341
504
|
* tags with a single case. Shows only what needs a look, and nothing on
|
|
342
505
|
* an injection suite, whose cases are made from its base suite's.
|
|
343
506
|
*/
|
|
344
507
|
export function AnswerKeyHealthSection({ data }) {
|
|
345
|
-
const { app, key, suite, health: h, choosesHere, splitBy } = data;
|
|
508
|
+
const { app, key, suite, health: h, choosesHere, splitBy, target } = data;
|
|
346
509
|
const thin = h.tags.filter(([, n]) => n === 1).map(([t]) => t);
|
|
347
510
|
const needs = h.easyToRetire.length ||
|
|
348
511
|
h.split.length ||
|
|
@@ -362,13 +525,16 @@ export function AnswerKeyHealthSection({ data }) {
|
|
|
362
525
|
const { draftMore } = app.actions;
|
|
363
526
|
const check = h.split.length > 0 || h.duplicates.length > 0;
|
|
364
527
|
const retire = h.easyToRetire.length > 0 || h.staleDrafts.length > 0;
|
|
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) => {
|
|
528
|
+
return (_jsxs("section", { className: "space-y-3", "aria-labelledby": "answer-key-health", children: [_jsxs("h2", { id: "answer-key-health", className: "scroll-mt-4 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) => {
|
|
366
529
|
const by = splitBy[c.id];
|
|
367
530
|
const names = (xs) => new Intl.ListFormat("en-US").format(xs);
|
|
368
|
-
return (
|
|
531
|
+
return (
|
|
532
|
+
// The tint spans the panel; the words keep their
|
|
533
|
+
// readable width inside it.
|
|
534
|
+
_jsxs("li", { className: "w-full space-y-2 rounded-md bg-tint p-3", children: [_jsx("div", { className: "readable font-medium", children: caseLink(c) }), by && (_jsxs("p", { className: "readable text-xs text-muted", children: [by.right.length > 0 &&
|
|
369
535
|
`Gave the answer key's answer: ${names(by.right)}. `, by.wrong.length > 0 &&
|
|
370
536
|
`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));
|
|
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:
|
|
537
|
+
}) })] })), 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) && (_jsx("p", { className: "readable text-muted", children: "Pick a topic to open Add a case with it filled in." })), 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 px-2 py-0.5 text-xs hover:underline ${TINT.warn} has-[:checked]:bg-warn/40 has-[:checked]:font-medium has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-accent`, children: [_jsx("input", { type: "checkbox", name: "topic", value: t, className: "peer sr-only" }), _jsx(Plus, { "aria-hidden": true, className: "h-3 w-3 peer-checked:hidden" }), _jsx(Check, { "aria-hidden": true, className: "hidden h-3 w-3 peer-checked:inline" }), 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." })] })) : (_jsx("ul", { className: "flex flex-wrap gap-1.5", children: thin.map((t) => (_jsx("li", { children: _jsxs("a", { href: `#add-case=${encodeURIComponent(t)}`, className: `inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs hover:underline ${TINT.warn}`, children: [_jsx(Plus, { "aria-hidden": true, className: "h-3 w-3" }), t] }) }, t))) })), _jsxs("details", { className: "group", children: [_jsxs("summary", { className: "flex cursor-pointer list-none items-center gap-1 text-xs text-muted [&::-webkit-details-marker]:hidden", children: [_jsx(ChevronRight, { "aria-hidden": true, className: "h-3.5 w-3.5 transition-transform group-open:rotate-90" }), "Every topic and its cases"] }), _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 model got ", cases(h.easyToRetire.length), " fully right in", " ", EASY_MIN_ROUNDS, " or more rounds of testing, so they no longer tell models apart. Retiring them keeps", " ", h.inUse - h.easyToRetire.length, " cases, at or above the suite's target of ", target, ". 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"] })] }))] }))] }))] })] }));
|
|
372
538
|
}
|
|
373
539
|
/**
|
|
374
540
|
* A suite's page as Evalkeeper arranges it, or null for a suite you don't
|
|
@@ -379,6 +545,6 @@ export async function SuitePage({ app, suite, }) {
|
|
|
379
545
|
const data = await loadSuitePage(app, suite);
|
|
380
546
|
if (!data)
|
|
381
547
|
return null;
|
|
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 })] }));
|
|
548
|
+
return (_jsxs("div", { className: "space-y-8", children: [_jsx(RefreshWhile, { active: data.testing }), _jsx(SuiteHeader, { data: data }), _jsx(TodoSection, { 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 })] }));
|
|
383
549
|
}
|
|
384
550
|
//# sourceMappingURL=SuiteSections.js.map
|