@crowandraven/evalkeeper 0.11.1 → 0.13.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.
Files changed (66) hide show
  1. package/dist/drafts.d.ts +49 -0
  2. package/dist/drafts.js +105 -0
  3. package/dist/drafts.js.map +1 -0
  4. package/dist/glossary.d.ts +6 -2
  5. package/dist/glossary.js +6 -2
  6. package/dist/glossary.js.map +1 -1
  7. package/dist/health.d.ts +35 -2
  8. package/dist/health.js +29 -5
  9. package/dist/health.js.map +1 -1
  10. package/dist/index.d.ts +2 -0
  11. package/dist/index.js +2 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/next/actions.js +128 -15
  14. package/dist/next/actions.js.map +1 -1
  15. package/dist/next/wiring.d.ts +6 -0
  16. package/dist/order.d.ts +18 -0
  17. package/dist/order.js +53 -0
  18. package/dist/order.js.map +1 -0
  19. package/dist/prisma/index.d.ts +1 -0
  20. package/dist/prisma/index.js +3 -0
  21. package/dist/prisma/index.js.map +1 -1
  22. package/dist/react/HubSections.d.ts +7 -0
  23. package/dist/react/HubSections.js +22 -8
  24. package/dist/react/HubSections.js.map +1 -1
  25. package/dist/react/ModelMenu.d.ts +18 -4
  26. package/dist/react/ModelMenu.js +12 -7
  27. package/dist/react/ModelMenu.js.map +1 -1
  28. package/dist/react/RateView.js +1 -0
  29. package/dist/react/RateView.js.map +1 -1
  30. package/dist/react/SuiteSections.d.ts +31 -0
  31. package/dist/react/SuiteSections.js +148 -32
  32. package/dist/react/SuiteSections.js.map +1 -1
  33. package/dist/react/app.d.ts +18 -0
  34. package/dist/react/app.js.map +1 -1
  35. package/dist/react/pieces.d.ts +10 -1
  36. package/dist/react/pieces.js +50 -0
  37. package/dist/react/pieces.js.map +1 -1
  38. package/dist/settings.d.ts +14 -0
  39. package/dist/settings.js +24 -2
  40. package/dist/settings.js.map +1 -1
  41. package/dist/testing.d.ts +1 -1
  42. package/dist/testing.js +32 -0
  43. package/dist/testing.js.map +1 -1
  44. package/dist/types.d.ts +33 -0
  45. package/dist/types.js +11 -0
  46. package/dist/types.js.map +1 -1
  47. package/package.json +1 -1
  48. package/schema/evalkeeper.prisma +3 -0
  49. package/src/drafts.ts +123 -0
  50. package/src/glossary.ts +10 -2
  51. package/src/health.ts +53 -6
  52. package/src/index.ts +2 -0
  53. package/src/next/actions.ts +162 -16
  54. package/src/next/wiring.ts +6 -0
  55. package/src/order.ts +64 -0
  56. package/src/prisma/index.ts +5 -0
  57. package/src/react/HubSections.tsx +31 -7
  58. package/src/react/ModelMenu.tsx +33 -7
  59. package/src/react/RateView.tsx +1 -0
  60. package/src/react/SuiteSections.tsx +640 -170
  61. package/src/react/app.ts +15 -0
  62. package/src/react/pieces.tsx +62 -1
  63. package/src/settings.ts +37 -2
  64. package/src/testing.ts +35 -1
  65. package/src/types.ts +37 -0
  66. package/templates/lib/evalkeeper/actions.ts +20 -0
@@ -3,6 +3,7 @@ import {
3
3
  attention,
4
4
  isInjectionSuite,
5
5
  perAnswer,
6
+ priorityOf,
6
7
  seconds,
7
8
  suiteHealth,
8
9
  thumbsSummary,
@@ -11,7 +12,7 @@ import {
11
12
  type Settings,
12
13
  type SettingsVersion,
13
14
  } from "../index.js";
14
- import { Link, Card, InfoTip, StatusBadge } from "./pieces.js";
15
+ import { Link, Card, InfoTip, HealthChips } from "./pieces.js";
15
16
  import { pct, dayOf } from "./format.js";
16
17
  import { HistoryEntries } from "./SettingsHistory.js";
17
18
  import {
@@ -134,7 +135,7 @@ export function HubStats({ data }: { data: HubData }) {
134
135
  : "—"
135
136
  }
136
137
  />
137
- <Link href={evalsPath(app, "feedback")}>
138
+ <Link href={evalsPath(app, "feedback")} className="block h-full">
138
139
  <Stat
139
140
  title="Thumbs down this week"
140
141
  term="thumbs"
@@ -165,16 +166,16 @@ export function SuiteList({ data }: { data: HubData }) {
165
166
  <div className="space-y-4">
166
167
  {cards.map(({ b, i }) => {
167
168
  const attacked = attacksOn(b.suite.key);
169
+ const [history, current] = histories[i] ?? [[], null];
168
170
  const h = suiteHealth(
169
171
  b.rows,
170
172
  b.suite.checks,
171
- b.suite.priority,
173
+ priorityOf(b.suite, current?.settings),
172
174
  b.cases,
173
175
  b.provisional,
174
176
  app.models,
175
177
  { attacks: attacksFrom(attacked) },
176
178
  );
177
- const [history, current] = histories[i] ?? [[], null];
178
179
  return (
179
180
  <SuiteCard
180
181
  app={app}
@@ -244,7 +245,8 @@ function Stat({
244
245
  detail: string;
245
246
  }) {
246
247
  return (
247
- <Card className="space-y-1">
248
+ // Full height, so the four cards line up however much each says.
249
+ <Card className="h-full space-y-1">
248
250
  <p className="text-sm text-muted">
249
251
  {title}
250
252
  <InfoTip term={term} />
@@ -308,7 +310,7 @@ function SuiteCard({
308
310
  {b.suite.label}
309
311
  </Link>
310
312
  </h2>
311
- <StatusBadge status={h.status} />
313
+ <HealthChips flags={h.flags} />
312
314
  </div>
313
315
  <p className="readable text-sm text-muted">{b.suite.description}</p>
314
316
  </div>
@@ -351,7 +353,7 @@ function SuiteCard({
351
353
  <p className="text-sm">
352
354
  {t ? (
353
355
  <>
354
- Score{" "}
356
+ Accuracy{" "}
355
357
  <span className={`font-semibold ${scoreTone(t.right / t.total)}`}>
356
358
  {pct(t.right / t.total)}
357
359
  </span>
@@ -428,6 +430,27 @@ function SuiteCard({
428
430
  );
429
431
  }
430
432
 
433
+ /**
434
+ * The AI features no suite tests yet, from your app's `features`: where
435
+ * an eval would tell you the most next. Shows nothing without them.
436
+ */
437
+ export function NoEvalYet({ data }: { data: HubData }) {
438
+ const { app } = data;
439
+ const tested = new Set(app.suites.map((s) => s.operation));
440
+ const gaps = (app.features ?? []).filter((f) => !tested.has(f.operation));
441
+ if (!gaps.length) return null;
442
+ return (
443
+ <section aria-labelledby="no-eval-yet" className="space-y-2">
444
+ <h2 id="no-eval-yet" className="text-lg font-semibold">
445
+ No eval yet
446
+ </h2>
447
+ <p className="readable text-sm text-muted">
448
+ {new Intl.ListFormat("en-US").format(gaps.map((f) => f.label))}. Nothing
449
+ tells you yet whether {gaps.length === 1 ? "it" : "they"} got worse.
450
+ </p>
451
+ </section>
452
+ );
453
+ }
431
454
  /**
432
455
  * The hub as Evalkeeper arranges it: where each suite stands and what
433
456
  * needs attention. A hub of your own loads the same data (`loadHub`) and
@@ -441,6 +464,7 @@ export async function HubPage({ app }: { app: EvalAppConfig }) {
441
464
  <HubStats data={data} />
442
465
  <WeeklyCheck app={app} weekly={data.weekly} />
443
466
  <SuiteList data={data} />
467
+ <NoEvalYet data={data} />
444
468
  </div>
445
469
  );
446
470
  }
@@ -6,25 +6,37 @@ import { Button } from "./pieces.js";
6
6
  import type { FormAction } from "./app.js";
7
7
 
8
8
  /**
9
- * A model row's menu: make it live, or make it the fallback, where the
10
- * row allows either. Keeps the model table narrow. Closes on a click
11
- * outside or Escape.
9
+ * A model row's menu: test it (with what that costs now), make it live,
10
+ * or make it the fallback, where the row allows either. Keeps the model
11
+ * table narrow. Closes on a click outside or Escape.
12
12
  */
13
13
  export function ModelMenu({
14
14
  suite,
15
15
  model,
16
16
  label,
17
+ test,
17
18
  makeLive,
18
19
  makeFallback,
20
+ effort,
19
21
  }: {
20
22
  suite: string;
21
23
  model: string;
22
24
  /** The model's name, for the button's accessible name. */
23
25
  label: string;
26
+ /**
27
+ * Your testModel action, its words ("Test", "Test again"), and what
28
+ * testing costs now ("free, all 34 reused"), when known.
29
+ */
30
+ test?: { action: FormAction; text: string; note: string | null };
24
31
  /** Your makeLive action, when the model can be made live. */
25
32
  makeLive: FormAction | null;
26
33
  /** Your makeFallback action, when it can be the fallback. */
27
34
  makeFallback: FormAction | null;
35
+ /**
36
+ * The row's reasoning setting, for a row at a setting other than the
37
+ * feature's (null: the model's own default); unset for the others.
38
+ */
39
+ effort?: string | null | undefined;
28
40
  }) {
29
41
  const [open, setOpen] = useState(false);
30
42
  const ref = useRef<HTMLDivElement>(null);
@@ -47,15 +59,28 @@ export function ModelMenu({
47
59
  };
48
60
  }, [open]);
49
61
 
50
- if (!makeLive && !makeFallback) return null;
62
+ if (!test && !makeLive && !makeFallback) return null;
51
63
  const item =
52
64
  "block w-full rounded px-3 py-1.5 text-left text-sm hover:bg-tint";
53
- const choice = (action: FormAction, text: string) => (
54
- <form action={action}>
65
+ const choice = (action: FormAction, text: string, note?: string | null) => (
66
+ // Closes once chosen (after the submit is read), so the open menu
67
+ // doesn't cover the rows below it.
68
+ <form
69
+ action={action}
70
+ onSubmit={() =>
71
+ setTimeout(() => {
72
+ setOpen(false);
73
+ })
74
+ }
75
+ >
55
76
  <input type="hidden" name="suite" value={suite} />
56
77
  <input type="hidden" name="model" value={model} />
78
+ {effort !== undefined && (
79
+ <input type="hidden" name="effort" value={effort ?? "default"} />
80
+ )}
57
81
  <Button type="submit" role="menuitem" className={item}>
58
82
  {text}
83
+ {note && <span className="block text-xs text-muted">{note}</span>}
59
84
  </Button>
60
85
  </form>
61
86
  );
@@ -78,8 +103,9 @@ export function ModelMenu({
78
103
  {open && (
79
104
  <div
80
105
  role="menu"
81
- className="absolute right-0 z-20 mt-1 w-40 rounded-md border border-line bg-card p-1 shadow-lg"
106
+ className="absolute right-0 z-20 mt-1 w-56 rounded-md border border-line bg-card p-1 shadow-lg"
82
107
  >
108
+ {test && choice(test.action, test.text, test.note)}
83
109
  {makeLive && choice(makeLive, "Make live")}
84
110
  {makeFallback && choice(makeFallback, "Make fallback")}
85
111
  </div>
@@ -30,6 +30,7 @@ export async function RateView({
30
30
  if (
31
31
  !suite ||
32
32
  suite.caseKind !== "imported" ||
33
+ suite.rateBlind === false ||
33
34
  !fields ||
34
35
  !(suite.labelFromForm || app.answerEditors[key])
35
36
  )