@crowandraven/evalkeeper 0.11.1 → 0.12.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.
@@ -6,15 +6,20 @@ import {
6
6
  attacksFrom,
7
7
  blindRating,
8
8
  caseFromFeedback,
9
+ draftMoreCases,
9
10
  formText,
11
+ importStarters,
10
12
  isInjectionSuite,
11
13
  leakNote,
12
14
  raterStatus,
13
15
  skipMark,
14
16
  suggest,
17
+ useDraftsProvisionally,
15
18
  withoutLeaks,
19
+ type ReasoningEffort,
16
20
  } from "../index.js";
17
21
  import { evalsPath, type EvalActions } from "../react/app.js";
22
+ import { injectionCases } from "../suites/injection.js";
18
23
  import { weeklyCheck } from "./weekly.js";
19
24
  import type { EvalWiring } from "./wiring.js";
20
25
 
@@ -92,14 +97,65 @@ export function evalActions(w: EvalWiring): Required<EvalActions> {
92
97
  }
93
98
 
94
99
  /** The current test of a model's row, for choosing it live or fallback. */
95
- async function rowOf(suiteKey: string, model: string) {
100
+ /**
101
+ * A model's row: at the feature's own setting, or with `effort` at
102
+ * another ("default": the model's own default).
103
+ */
104
+ async function rowOf(suiteKey: string, model: string, effort?: string) {
96
105
  const board = await runner.board(suiteKey);
106
+ const wanted = effort === "default" ? null : effort;
97
107
  return {
98
108
  board,
99
- row: board.rows.find((r) => r.model === model && !r.variant),
109
+ row: board.rows.find((r) =>
110
+ effort === undefined
111
+ ? r.model === model && !r.variant
112
+ : r.model === model && r.variant && r.effort === wanted,
113
+ ),
100
114
  };
101
115
  }
102
116
 
117
+ /**
118
+ * The model and reasoning setting a Test form asks for: `setting` (a
119
+ * model and setting together, from one dropdown) or `model` with an
120
+ * optional `effort`. No setting: the feature's own. "default": the
121
+ * model's own default, sending none. Any other must be one the catalog
122
+ * lists for the model.
123
+ */
124
+ function testRequest(
125
+ form: FormData,
126
+ operation: string,
127
+ ): { model: string; reasoningEffort?: ReasoningEffort | null } {
128
+ let model: string;
129
+ let effort: string | undefined;
130
+ const setting = form.get("setting");
131
+ if (typeof setting === "string" && setting) {
132
+ let parsed: unknown;
133
+ try {
134
+ parsed = JSON.parse(setting);
135
+ } catch {
136
+ throw new Error("Unknown setting");
137
+ }
138
+ if (
139
+ !Array.isArray(parsed) ||
140
+ parsed.length !== 2 ||
141
+ !parsed.every((x) => typeof x === "string")
142
+ )
143
+ throw new Error("Unknown setting");
144
+ [model, effort] = parsed as [string, string];
145
+ } else {
146
+ model = formText(form, "model");
147
+ const e = form.get("effort");
148
+ effort = typeof e === "string" && e ? e : undefined;
149
+ }
150
+ if (!runner.modelsFor(operation).includes(model))
151
+ throw new Error("Unknown model");
152
+ if (effort === undefined) return { model };
153
+ if (effort === "default") return { model, reasoningEffort: null };
154
+ if (!w.models[model]?.efforts?.includes(effort))
155
+ throw new Error(`${model} doesn't take ${effort} reasoning`);
156
+ return { model, reasoningEffort: effort };
157
+ }
158
+
103
159
  async function feedbackById(id: string) {
104
160
  const f = (await feedbackStore.listFeedback()).find((x) => x.id === id);
105
161
  if (!f) throw new Error("Unknown rating");
@@ -110,11 +166,12 @@ export function evalActions(w: EvalWiring): Required<EvalActions> {
110
166
  async testModel(form) {
111
167
  await w.requireAdmin();
112
168
  const suite = suiteFrom(form);
113
- const model = formText(form, "model");
114
- if (!runner.modelsFor(suite.operation).includes(model))
115
- throw new Error("Unknown model");
169
+ const request = testRequest(form, suite.operation);
116
170
  // The feature's cases and its attack cases, in one test.
117
- const { runs } = await runner.createTest({ suite: suite.key, model });
171
+ const { runs } = await runner.createTest({
172
+ suite: suite.key,
173
+ ...request,
174
+ });
118
175
  after(() => runAll(runs));
119
176
  revalidatePath(page(suite.key));
120
177
  },
@@ -132,14 +189,22 @@ export function evalActions(w: EvalWiring): Required<EvalActions> {
132
189
  async makeLive(form) {
133
190
  const admin = await w.requireAdmin();
134
191
  const suite = choosingSuite(form);
135
- const { board, row } = await rowOf(suite.key, formText(form, "model"));
192
+ const effort = form.get("effort");
193
+ const { board, row } = await rowOf(
194
+ suite.key,
195
+ formText(form, "model"),
196
+ typeof effort === "string" && effort ? effort : undefined,
197
+ );
136
198
  if (!row?.test || row.test.stale)
137
199
  throw new Error("Test this model on the current cases first");
138
200
  const score = { right: row.test.right, total: row.test.total };
139
201
  const attacked = attackMistakes(row.key, await attacksOn(suite.key));
140
202
  await settings.update(
141
203
  suite.operation,
142
- { model: row.model },
204
+ // A row at another setting goes live at that setting.
205
+ row.variant
206
+ ? { model: row.model, reasoningEffort: row.effort }
207
+ : { model: row.model },
143
208
  {
144
209
  by: admin.name,
145
210
  reason: `Made ${row.label} live: ${score.right}/${score.total}, ${VS[row.vsLive ?? ""] ?? "no comparison"}${attacked === null ? "" : `; ${attacked} serious ${attacked === 1 ? "mistake" : "mistakes"} under attack`}`,
@@ -327,6 +392,53 @@ export function evalActions(w: EvalWiring): Required<EvalActions> {
327
392
  revalidatePath(page(suite.key));
328
393
  },
329
394
 
395
+ async addStarters(form) {
396
+ await w.requireAdmin();
397
+ const suite = suiteFrom(form);
398
+ await importStarters(store, suite);
399
+ revalidatePath(page(suite.key));
400
+ },
401
+
402
+ async makeAttackCases(form) {
403
+ await w.requireAdmin();
404
+ const suite = suiteFrom(form);
405
+ if (!isInjectionSuite(suite))
406
+ throw new Error("This suite has no attacks");
407
+ const r = await injectionCases(
408
+ store,
409
+ // Trust boundary: isInjectionSuite means injectionSuite made it.
410
+ suite as unknown as Parameters<typeof injectionCases>[1],
411
+ );
412
+ if (!r.baseCases)
413
+ throw new Error(
414
+ `Confirm some ${suite.base.label} answers first: attack cases copy them`,
415
+ );
416
+ everyPage();
417
+ },
418
+
419
+ async draftMore(form) {
420
+ await w.requireAdmin();
421
+ const suite = suiteFrom(form);
422
+ if (!suite.draftMore) throw new Error("This suite can't draft cases");
423
+ const focus = form.get("focus");
424
+ await draftMoreCases({
425
+ store,
426
+ suite,
427
+ focus:
428
+ typeof focus === "string" && focus.trim()
429
+ ? focus.trim().slice(0, 500)
430
+ : null,
431
+ });
432
+ revalidatePath(page(suite.key));
433
+ },
434
+
435
+ async useDraftsProvisionally(form) {
436
+ await w.requireAdmin();
437
+ const suite = suiteFrom(form);
438
+ await useDraftsProvisionally({ store, suite });
439
+ everyPage();
440
+ },
441
+
330
442
  /**
331
443
  * A person rates an imported case blind: their own confirmed answer,
332
444
  * with their reason, added beside anyone else's. Tests are rescored
@@ -428,6 +428,27 @@ function SuiteCard({
428
428
  );
429
429
  }
430
430
 
431
+ /**
432
+ * The AI features no suite tests yet, from your app's `features`: where
433
+ * an eval would tell you the most next. Shows nothing without them.
434
+ */
435
+ export function NoEvalYet({ data }: { data: HubData }) {
436
+ const { app } = data;
437
+ const tested = new Set(app.suites.map((s) => s.operation));
438
+ const gaps = (app.features ?? []).filter((f) => !tested.has(f.operation));
439
+ if (!gaps.length) return null;
440
+ return (
441
+ <section aria-labelledby="no-eval-yet" className="space-y-2">
442
+ <h2 id="no-eval-yet" className="text-lg font-semibold">
443
+ No eval yet
444
+ </h2>
445
+ <p className="readable text-sm text-muted">
446
+ {new Intl.ListFormat("en-US").format(gaps.map((f) => f.label))}. Nothing
447
+ tells you yet whether {gaps.length === 1 ? "it" : "they"} got worse.
448
+ </p>
449
+ </section>
450
+ );
451
+ }
431
452
  /**
432
453
  * The hub as Evalkeeper arranges it: where each suite stands and what
433
454
  * needs attention. A hub of your own loads the same data (`loadHub`) and
@@ -441,6 +462,7 @@ export async function HubPage({ app }: { app: EvalAppConfig }) {
441
462
  <HubStats data={data} />
442
463
  <WeeklyCheck app={app} weekly={data.weekly} />
443
464
  <SuiteList data={data} />
465
+ <NoEvalYet data={data} />
444
466
  </div>
445
467
  );
446
468
  }
@@ -16,6 +16,7 @@ export function ModelMenu({
16
16
  label,
17
17
  makeLive,
18
18
  makeFallback,
19
+ effort,
19
20
  }: {
20
21
  suite: string;
21
22
  model: string;
@@ -25,6 +26,11 @@ export function ModelMenu({
25
26
  makeLive: FormAction | null;
26
27
  /** Your makeFallback action, when it can be the fallback. */
27
28
  makeFallback: FormAction | null;
29
+ /**
30
+ * The row's reasoning setting, for a row at a setting other than the
31
+ * feature's (null: the model's own default); unset for the others.
32
+ */
33
+ effort?: string | null | undefined;
28
34
  }) {
29
35
  const [open, setOpen] = useState(false);
30
36
  const ref = useRef<HTMLDivElement>(null);
@@ -54,6 +60,9 @@ export function ModelMenu({
54
60
  <form action={action}>
55
61
  <input type="hidden" name="suite" value={suite} />
56
62
  <input type="hidden" name="model" value={model} />
63
+ {effort !== undefined && (
64
+ <input type="hidden" name="effort" value={effort ?? "default"} />
65
+ )}
57
66
  <Button type="submit" role="menuitem" className={item}>
58
67
  {text}
59
68
  </Button>
@@ -2,7 +2,11 @@ import {
2
2
  FAVOR_TEXT,
3
3
  answerKeyHealth,
4
4
  attacksFrom,
5
+ barStatus,
5
6
  checkBar,
7
+ draftAnswers,
8
+ draftsToTarget,
9
+ newStarters,
6
10
  isInjectionSuite,
7
11
  meanCalibrationError,
8
12
  money,
@@ -25,12 +29,14 @@ import {
25
29
  IconSubmit,
26
30
  InfoTip,
27
31
  Score,
32
+ Select,
28
33
  Spinner,
29
34
  Submit,
35
+ TextInput,
30
36
  Tip,
31
37
  } from "./pieces.js";
32
38
  import { pct, LINK } from "./format.js";
33
- import { RotateCw } from "lucide-react";
39
+ import { ChevronDown, RotateCw, ShieldAlert, Sparkles } from "lucide-react";
34
40
  import { evalsPath, type EvalAppConfig, attacksResisted } from "./app.js";
35
41
  import { SettingsHistory } from "./SettingsHistory.js";
36
42
 
@@ -61,7 +67,8 @@ export async function loadSuitePage(app: EvalAppConfig, key: string) {
61
67
  ]),
62
68
  ),
63
69
  app.runner.casesInInstructions(key),
64
- app.store.listCases(key),
70
+ // Retired ones too: starters already added once aren't offered again.
71
+ app.store.listCases(key, { includeRetired: true }),
65
72
  ]);
66
73
  const { suite, rows } = b;
67
74
  const attacks = attacksFrom(attackBoards);
@@ -114,6 +121,7 @@ export async function loadSuitePage(app: EvalAppConfig, key: string) {
114
121
  showAttacks,
115
122
  live,
116
123
  health,
124
+ cases,
117
125
  };
118
126
  }
119
127
 
@@ -473,6 +481,14 @@ export function ModelTable({ data }: { data: SuitePageData }) {
473
481
  <form action={app.actions.testModel}>
474
482
  <input type="hidden" name="suite" value={key} />
475
483
  <input type="hidden" name="model" value={r.model} />
484
+ {/* A row at another setting tests at its own. */}
485
+ {r.variant && (
486
+ <input
487
+ type="hidden"
488
+ name="effort"
489
+ value={r.effort ?? "default"}
490
+ />
491
+ )}
476
492
  <Tip
477
493
  control
478
494
  id={`test-${r.key}`}
@@ -507,6 +523,7 @@ export function ModelTable({ data }: { data: SuitePageData }) {
507
523
  ? app.actions.makeFallback
508
524
  : null
509
525
  }
526
+ effort={r.variant ? r.effort : undefined}
510
527
  />
511
528
  )}
512
529
  </div>
@@ -533,6 +550,156 @@ export function ModelTable({ data }: { data: SuitePageData }) {
533
550
  );
534
551
  }
535
552
 
553
+ /**
554
+ * Testing a model at a reasoning setting other than the feature's: less
555
+ * reasoning is faster and cheaper, more can be more accurate. Each setting
556
+ * gets its own row in the model table. Shows only when a model the feature
557
+ * may use lists its settings in your catalog.
558
+ */
559
+ export function TestSettingSection({ data }: { data: SuitePageData }) {
560
+ const { app, key, operation, choosesHere } = data;
561
+ const tunable = app.runner.modelsFor(operation).flatMap((m) => {
562
+ const efforts = app.models[m]?.efforts;
563
+ return efforts?.length
564
+ ? [{ model: m, label: app.models[m]?.label ?? m, efforts }]
565
+ : [];
566
+ });
567
+ if (!choosesHere || !tunable.length) return null;
568
+ return (
569
+ <form
570
+ action={app.actions.testModel}
571
+ className="flex flex-wrap items-end gap-2"
572
+ >
573
+ <input type="hidden" name="suite" value={key} />
574
+ <div>
575
+ <label htmlFor="test-setting" className="block text-sm font-medium">
576
+ Test a reasoning setting
577
+ <InfoTip term="reasoningSetting" id="test-setting" />
578
+ </label>
579
+ <Select
580
+ id="test-setting"
581
+ name="setting"
582
+ className="mt-1 rounded-md border border-line bg-card px-3 py-2 text-sm"
583
+ >
584
+ {tunable.map((t) => (
585
+ <optgroup key={t.model} label={t.label}>
586
+ {t.efforts.map((e) => (
587
+ <option key={e} value={JSON.stringify([t.model, e])}>
588
+ {t.label} · {e} reasoning
589
+ </option>
590
+ ))}
591
+ </optgroup>
592
+ ))}
593
+ </Select>
594
+ </div>
595
+ <Submit variant="quiet">Test this setting</Submit>
596
+ </form>
597
+ );
598
+ }
599
+
600
+ const BAR_TONE = {
601
+ meets:
602
+ "bg-emerald-100 text-emerald-900 dark:bg-emerald-500/15 dark:text-emerald-200",
603
+ close: "bg-amber-100 text-amber-900 dark:bg-amber-500/15 dark:text-amber-200",
604
+ below: "bg-red-100 text-red-900 dark:bg-red-500/15 dark:text-red-200",
605
+ } as const;
606
+
607
+ /**
608
+ * Where the mistakes are: how often each check passed, for every model
609
+ * with a current test, beside each check's bar. Serious checks first. The
610
+ * checks section shows the live model alone; this shows which model fails
611
+ * which check.
612
+ */
613
+ export function CheckBreakdownSection({ data }: { data: SuitePageData }) {
614
+ const { suite, rows } = data;
615
+ const tested = rows.filter((r) => r.test && !r.test.stale);
616
+ if (!tested.length) return null;
617
+ const checks = [...suite.checks].sort(
618
+ (a, b) => Number(a.severity === "minor") - Number(b.severity === "minor"),
619
+ );
620
+ return (
621
+ <section aria-labelledby="check-breakdown" className="space-y-3">
622
+ <h2 id="check-breakdown" className="text-lg font-semibold">
623
+ Where the mistakes are
624
+ <InfoTip term="checkBreakdown" />
625
+ </h2>
626
+ <Card className="space-y-3">
627
+ <p className="flex flex-wrap items-center gap-x-4 gap-y-1 text-xs">
628
+ {(
629
+ [
630
+ ["meets", "Meets the bar"],
631
+ ["close", "Within 10 points"],
632
+ ["below", "Further below"],
633
+ ] as const
634
+ ).map(([k, text]) => (
635
+ <span key={k} className="flex items-center gap-1.5">
636
+ <span className={`inline-block h-3 w-3 rounded ${BAR_TONE[k]}`} />
637
+ {text}
638
+ </span>
639
+ ))}
640
+ </p>
641
+ <div className="overflow-x-auto">
642
+ <table className="w-full text-left text-sm">
643
+ <thead className="text-xs text-muted">
644
+ <tr>
645
+ <th className="py-2 pr-4 font-normal">Check</th>
646
+ <th className="py-2 pr-4 font-normal">Bar</th>
647
+ {tested.map((r) => (
648
+ <th key={r.key} className="py-2 pr-3 font-normal">
649
+ {r.label}
650
+ </th>
651
+ ))}
652
+ </tr>
653
+ </thead>
654
+ <tbody>
655
+ {checks.map((c) => (
656
+ <tr key={c.key}>
657
+ <td className="py-1.5 pr-4">
658
+ <span className="mr-2">{c.label}</span>
659
+ <Chip
660
+ tone={c.severity === "serious" ? "serious" : "neutral"}
661
+ >
662
+ {c.severity}
663
+ </Chip>
664
+ </td>
665
+ <td className="py-1.5 pr-4 tabular-nums text-muted">
666
+ {pct(checkBar(c))}
667
+ </td>
668
+ {tested.map((r) => {
669
+ const x = r.test?.byCheck[c.key];
670
+ const rate = x?.n ? x.passed / x.n : null;
671
+ return (
672
+ <td key={r.key} className="py-1 pr-2">
673
+ {rate === null ? (
674
+ <span className="text-muted">–</span>
675
+ ) : (
676
+ <span
677
+ className={`inline-block rounded px-2 py-0.5 tabular-nums ${BAR_TONE[barStatus(rate, checkBar(c))]}`}
678
+ >
679
+ {pct(rate)}
680
+ </span>
681
+ )}
682
+ </td>
683
+ );
684
+ })}
685
+ </tr>
686
+ ))}
687
+ <tr>
688
+ <td className="py-1.5 pr-4">Answers with no mistakes at all</td>
689
+ <td />
690
+ {tested.map((r) => (
691
+ <td key={r.key} className="py-1.5 pr-3 tabular-nums">
692
+ {r.test?.answersRight} of {r.test?.answers}
693
+ </td>
694
+ ))}
695
+ </tr>
696
+ </tbody>
697
+ </table>
698
+ </div>
699
+ </Card>
700
+ </section>
701
+ );
702
+ }
536
703
  /** The feature's settings history, with rollback; not on an injection suite. */
537
704
  export function Versions({ data }: { data: SuitePageData }) {
538
705
  const { app, key, history, liveSettings, choosesHere } = data;
@@ -607,6 +774,147 @@ export function ChecksSection({ data }: { data: SuitePageData }) {
607
774
  );
608
775
  }
609
776
 
777
+ /**
778
+ * Ways to fill the answer key, beside adding a case by hand: how to judge
779
+ * an answer, testing with draft answers before review, an injection
780
+ * suite's attack cases, starter cases not added yet, and more drafts from
781
+ * the suite's `draftMore`. Each shows only when it applies and your app
782
+ * passes its action.
783
+ */
784
+ export function AnswerKeyToolsSection({ data }: { data: SuitePageData }) {
785
+ const { app, key, suite, cases } = data;
786
+ const { actions } = app;
787
+ const inUse = cases.filter((c) => c.status !== "RETIRED");
788
+ const drafts = draftAnswers(cases);
789
+ const fresh = newStarters(suite.starter, cases);
790
+ const guide =
791
+ suite.answerGuide ??
792
+ (suite.labelHelp ? { points: [{ text: suite.labelHelp }] } : null);
793
+ const injection = isInjectionSuite(suite) ? suite : null;
794
+ const parts = [
795
+ guide && (
796
+ <details
797
+ key="guide"
798
+ className="group rounded-lg border border-line bg-card"
799
+ >
800
+ <summary className="flex cursor-pointer list-none items-center justify-between gap-3 p-4 text-sm font-medium">
801
+ How to judge an answer
802
+ <ChevronDown
803
+ aria-hidden
804
+ className="h-4 w-4 transition-transform group-open:rotate-180"
805
+ />
806
+ </summary>
807
+ <div className="readable space-y-2 px-4 pb-4 text-sm">
808
+ {guide.lead && <p className="font-medium">{guide.lead}</p>}
809
+ {(() => {
810
+ const items = guide.points.map((p, n) => (
811
+ <li key={n}>
812
+ {p.term && <strong>{p.term} </strong>}
813
+ {p.text}
814
+ </li>
815
+ ));
816
+ return guide.ordered ? (
817
+ <ol className="list-decimal space-y-1 pl-5">{items}</ol>
818
+ ) : (
819
+ <ul className="list-disc space-y-1 pl-5">{items}</ul>
820
+ );
821
+ })()}
822
+ {guide.note && <p className="text-muted">{guide.note}</p>}
823
+ </div>
824
+ </details>
825
+ ),
826
+ actions.useDraftsProvisionally && drafts.length > 0 && (
827
+ <Card key="provisional" className="space-y-3">
828
+ <p className="readable text-sm">
829
+ To test before you&apos;ve reviewed them, put the {drafts.length}{" "}
830
+ draft {drafts.length === 1 ? "answer" : "answers"} to use as
831
+ provisional. Scores then say they rest on unreviewed answers until you
832
+ confirm each.
833
+ <InfoTip term="provisional" />
834
+ </p>
835
+ <form action={actions.useDraftsProvisionally}>
836
+ <input type="hidden" name="suite" value={key} />
837
+ <Submit variant="quiet">Test with drafts, as provisional</Submit>
838
+ </form>
839
+ </Card>
840
+ ),
841
+ actions.makeAttackCases && injection && (
842
+ <Card key="attacks" className="space-y-3">
843
+ <p className="readable text-sm">
844
+ Each attack case is a confirmed {injection.base.label} case with an
845
+ attack planted where untrusted text goes, and keeps that case&apos;s
846
+ answer: an attack shouldn&apos;t change it. Run this again after you
847
+ confirm, change, or retire {injection.base.label} answers.
848
+ </p>
849
+ <form action={actions.makeAttackCases}>
850
+ <input type="hidden" name="suite" value={key} />
851
+ <Submit variant={inUse.length ? "quiet" : "primary"}>
852
+ <ShieldAlert aria-hidden className="mr-1.5 inline h-4 w-4" />
853
+ {inUse.length ? "Update attack cases" : "Make attack cases"}
854
+ </Submit>
855
+ </form>
856
+ </Card>
857
+ ),
858
+ actions.addStarters && fresh.length > 0 && (
859
+ <Card key="starters" className="space-y-3">
860
+ <p className="readable text-sm">
861
+ {inUse.length
862
+ ? `${fresh.length} more starter ${fresh.length === 1 ? "case is" : "cases are"} ready.`
863
+ : `No cases yet. Start with the suite's ${fresh.length} starter ${fresh.length === 1 ? "case" : "cases"}.`}{" "}
864
+ Each needs your review and counts only once you confirm it, unless the
865
+ suite&apos;s author already reviewed it.
866
+ </p>
867
+ <form action={actions.addStarters}>
868
+ <input type="hidden" name="suite" value={key} />
869
+ <Submit variant={inUse.length ? "quiet" : "primary"}>
870
+ <Sparkles aria-hidden className="mr-1.5 inline h-4 w-4" />
871
+ Add {fresh.length} starter {fresh.length === 1 ? "case" : "cases"}
872
+ </Submit>
873
+ </form>
874
+ </Card>
875
+ ),
876
+ actions.draftMore && suite.draftMore && inUse.length > 0 && (
877
+ <details
878
+ key="draft"
879
+ className="group rounded-lg border border-line bg-card"
880
+ >
881
+ <summary className="flex cursor-pointer list-none items-center justify-between gap-3 p-4 text-sm font-medium">
882
+ <span className="flex items-center gap-1.5">
883
+ <Sparkles aria-hidden className="h-4 w-4" />
884
+ Draft {draftsToTarget(inUse.length)} more cases
885
+ </span>
886
+ <ChevronDown
887
+ aria-hidden
888
+ className="h-4 w-4 transition-transform group-open:rotate-180"
889
+ />
890
+ </summary>
891
+ <form action={actions.draftMore} className="space-y-3 px-4 pb-4">
892
+ <input type="hidden" name="suite" value={key} />
893
+ <div>
894
+ <label htmlFor="draft-focus" className="block text-sm font-medium">
895
+ Anything to focus on? (optional)
896
+ </label>
897
+ <TextInput
898
+ id="draft-focus"
899
+ name="focus"
900
+ maxLength={500}
901
+ placeholder="e.g. longer, messier notes; more than one owner"
902
+ className="mt-1 w-full rounded-md border border-line bg-card px-3 py-2 text-sm"
903
+ />
904
+ <p className="readable mt-1 text-xs text-muted">
905
+ A model looks at the cases you have and covers what&apos;s
906
+ missing. Drafts need your review and count only once you confirm
907
+ them.
908
+ </p>
909
+ </div>
910
+ <Submit>Draft cases</Submit>
911
+ </form>
912
+ </details>
913
+ ),
914
+ ].filter(Boolean);
915
+ if (!parts.length) return null;
916
+ return <div className="space-y-3">{parts}</div>;
917
+ }
610
918
  /** The answer key: the cases in use and their answers, with ways to add and rate them. */
611
919
  export function AnswerKeySection({ data }: { data: SuitePageData }) {
612
920
  const { app, key, b, suite, rows, attackBoards } = data;
@@ -916,9 +1224,12 @@ export async function SuitePage({
916
1224
  <SuggestionCard data={data} />
917
1225
  <CasesInInstructions data={data} />
918
1226
  <ModelTable data={data} />
1227
+ <TestSettingSection data={data} />
1228
+ <CheckBreakdownSection data={data} />
919
1229
  <Versions data={data} />
920
1230
  <ChecksSection data={data} />
921
1231
  <AnswerKeyHealthSection data={data} />
1232
+ <AnswerKeyToolsSection data={data} />
922
1233
  <AnswerKeySection data={data} />
923
1234
  </div>
924
1235
  );
package/src/react/app.ts CHANGED
@@ -33,6 +33,14 @@ export type EvalActions = {
33
33
  retireEasy?: FormAction;
34
34
  /** Retiring drafts nobody reviewed; the health panel's button. */
35
35
  retireStaleDrafts?: FormAction;
36
+ /** Adding a suite's starter cases not in its answer key yet. */
37
+ addStarters?: FormAction;
38
+ /** Making or updating an injection suite's attack cases. */
39
+ makeAttackCases?: FormAction;
40
+ /** Having the suite's `draftMore` draft cases, with an optional focus. */
41
+ draftMore?: FormAction;
42
+ /** Putting draft answers to use before review, as provisional. */
43
+ useDraftsProvisionally?: FormAction;
36
44
  runWeeklyNow: () => Promise<void>;
37
45
  /** Blind rating; only for an app with the rate page. */
38
46
  rateBlind?: FormAction;
@@ -66,6 +74,11 @@ export type EvalApp = {
66
74
  actions: EvalActions;
67
75
  /** Where the eval pages live, as a URL path: "/evals", "/admin/evals". */
68
76
  basePath: string;
77
+ /**
78
+ * Every AI feature your app has, by the operation its suites name. The
79
+ * hub lists the ones no suite tests yet. Leave it out to skip that list.
80
+ */
81
+ features?: { operation: string; label: string }[];
69
82
  };
70
83
 
71
84
  /** An `EvalApp` with its suites by key, as the screens read it. */
package/src/types.ts CHANGED
@@ -260,6 +260,25 @@ export type Suite<Input, Output, Label> = {
260
260
  describe?(input: Input): string;
261
261
  /** Fixture suites: what the expected answer's fields mean. */
262
262
  labelHelp?: string;
263
+ /**
264
+ * How a person should judge an answer, where it takes more than each
265
+ * field's help: shown above the answer key as "How to judge an answer".
266
+ * Without it, `labelHelp` shows there. For people only: it never reaches
267
+ * the model, so it doesn't change the instructions hash.
268
+ */
269
+ answerGuide?: AnswerGuide;
270
+ };
271
+
272
+ /** How to judge a suite's answers: a lead-in, the points, and a note. */
273
+ export type AnswerGuide = {
274
+ /** A short lead-in: "When you confirm a case, check:". */
275
+ lead?: string;
276
+ /** One point each; `term`, when given, comes first in bold. */
277
+ points: { term?: string; text: string }[];
278
+ /** Steps to follow in order (numbered), or points in any order. */
279
+ ordered?: boolean;
280
+ /** A closing note, shown quieter. */
281
+ note?: string;
263
282
  };
264
283
 
265
284
  /**