@crowandraven/evalkeeper 0.14.0 → 0.16.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 (51) hide show
  1. package/dist/glossary.d.ts +1 -0
  2. package/dist/glossary.js +1 -0
  3. package/dist/glossary.js.map +1 -1
  4. package/dist/health.d.ts +24 -0
  5. package/dist/health.js +61 -7
  6. package/dist/health.js.map +1 -1
  7. package/dist/react/HubSections.d.ts +4 -1
  8. package/dist/react/HubSections.js +30 -12
  9. package/dist/react/HubSections.js.map +1 -1
  10. package/dist/react/InfoPopover.d.ts +19 -0
  11. package/dist/react/InfoPopover.js +46 -0
  12. package/dist/react/InfoPopover.js.map +1 -0
  13. package/dist/react/PriorityPicker.js +6 -20
  14. package/dist/react/PriorityPicker.js.map +1 -1
  15. package/dist/react/SettingsHistory.d.ts +2 -1
  16. package/dist/react/SettingsHistory.js +32 -24
  17. package/dist/react/SettingsHistory.js.map +1 -1
  18. package/dist/react/ShowEarlier.d.ts +11 -0
  19. package/dist/react/ShowEarlier.js +19 -0
  20. package/dist/react/ShowEarlier.js.map +1 -0
  21. package/dist/react/SuiteSections.d.ts +6 -8
  22. package/dist/react/SuiteSections.js +45 -25
  23. package/dist/react/SuiteSections.js.map +1 -1
  24. package/dist/react/WeeklyCheck.js +2 -2
  25. package/dist/react/WeeklyCheck.js.map +1 -1
  26. package/dist/react/app.d.ts +3 -1
  27. package/dist/react/app.js.map +1 -1
  28. package/dist/react/pieces.d.ts +18 -1
  29. package/dist/react/pieces.js +29 -0
  30. package/dist/react/pieces.js.map +1 -1
  31. package/dist/runner.js +7 -1
  32. package/dist/runner.js.map +1 -1
  33. package/dist/types.d.ts +2 -1
  34. package/dist/types.js.map +1 -1
  35. package/dist/weekly.js +4 -2
  36. package/dist/weekly.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/glossary.ts +2 -0
  39. package/src/health.ts +81 -9
  40. package/src/react/HubSections.tsx +124 -40
  41. package/src/react/InfoPopover.tsx +100 -0
  42. package/src/react/PriorityPicker.tsx +6 -27
  43. package/src/react/SettingsHistory.tsx +112 -74
  44. package/src/react/ShowEarlier.tsx +57 -0
  45. package/src/react/SuiteSections.tsx +146 -96
  46. package/src/react/WeeklyCheck.tsx +14 -3
  47. package/src/react/app.ts +3 -2
  48. package/src/react/pieces.tsx +37 -1
  49. package/src/runner.ts +7 -1
  50. package/src/types.ts +2 -1
  51. package/src/weekly.ts +7 -2
package/src/react/app.ts CHANGED
@@ -80,9 +80,10 @@ export type EvalApp = {
80
80
  basePath: string;
81
81
  /**
82
82
  * Every AI feature your app has, by the operation its suites name. The
83
- * hub lists the ones no suite tests yet. Leave it out to skip that list.
83
+ * hub lists the ones no suite tests yet, one card each, with the
84
+ * description when there is one. Leave it out to skip that list.
84
85
  */
85
- features?: { operation: string; label: string }[];
86
+ features?: { operation: string; label: string; description?: string }[];
86
87
  };
87
88
 
88
89
  /** An `EvalApp` with its suites by key, as the screens read it. */
@@ -11,7 +11,12 @@ import {
11
11
  import { useFormStatus } from "react-dom";
12
12
  import { ArrowLeft, Info, LoaderCircle } from "lucide-react";
13
13
  import { GLOSSARY, type GlossaryTerm } from "../glossary.js";
14
- import type { HealthFlag, HealthStatus } from "../health.js";
14
+ import {
15
+ STANDING_LABEL,
16
+ type HealthFlag,
17
+ type HealthStanding,
18
+ type HealthStatus,
19
+ } from "../health.js";
15
20
  import { dayOf, momentOf, pct, QUIET_BUTTON } from "./format.js";
16
21
 
17
22
  /**
@@ -243,6 +248,37 @@ function flagChips(f: HealthFlag): { text: string; tone: ChipTone }[] {
243
248
  }
244
249
  }
245
250
 
251
+ const STANDING_TONE: Record<HealthStanding, ChipTone> = {
252
+ risk: "serious",
253
+ improve: "warn",
254
+ healthy: "live",
255
+ unknown: "neutral",
256
+ };
257
+
258
+ /**
259
+ * A suite's one status, colored by what it asks of you: red at risk, amber
260
+ * can improve, green healthy, gray can't tell yet. Each color means only
261
+ * that, so a glance down the hub finds what needs you.
262
+ */
263
+ export function StandingBadge({ standing }: { standing: HealthStanding }) {
264
+ return <Chip tone={STANDING_TONE[standing]}>{STANDING_LABEL[standing]}</Chip>;
265
+ }
266
+
267
+ /**
268
+ * The reasons behind a suite's standing as one plain line ("1 serious
269
+ * under bar · New fallback suggested"), for under its name. Provisional
270
+ * answers are left out: a choice, not a problem, so the card says it in a
271
+ * footnote instead.
272
+ */
273
+ export function HealthReasons({ flags }: { flags: readonly HealthFlag[] }) {
274
+ const line = flags
275
+ .filter((f) => f.kind !== "provisional" && f.kind !== "good")
276
+ .flatMap(flagChips)
277
+ .map((c) => c.text)
278
+ .join(" · ");
279
+ return line ? <p className="text-sm font-medium text-ink">{line}</p> : null;
280
+ }
281
+
246
282
  /**
247
283
  * A suite's health as chips naming each reason ("2 serious under bar",
248
284
  * "New fallback suggested", "Add cases (33 of 50)"), so a card says why at
package/src/runner.ts CHANGED
@@ -813,13 +813,19 @@ export function createRunner(opts: RunnerOptions) {
813
813
  * set on its live model, at its live reasoning setting, marked as
814
814
  * started by the schedule. Record every suite's first, so a page can show
815
815
  * them running, then run each with `runEval(id, { fresh: true })`.
816
- * Returns the test's id, or null when the suite has no cases in use.
816
+ * Returns the test's id, or null when the suite has no cases in use or
817
+ * its weekly check is already running.
817
818
  * Needs `route`.
818
819
  */
819
820
  async function startDriftCheck(suiteKey: string): Promise<string | null> {
820
821
  if (!opts.route) throw new Error("The drift check needs the route option");
821
822
  const suite = suiteOrThrow(suiteKey);
822
823
  if (!(await casesFor(suite.key, "SMOKE")).length) return null;
824
+ // One check at a time: pressing Run it now twice doesn't start two.
825
+ await stopStuckRuns(suite.key);
826
+ const running = await store.listRuns(suite.key, { status: "RUNNING" });
827
+ if (running.some((r) => r.startedBy === SCHEDULED && r.set === "SMOKE"))
828
+ return null;
823
829
  const route = await opts.route(suite.operation);
824
830
  const { run } = await createRun({
825
831
  suite: suite.key,
package/src/types.ts CHANGED
@@ -280,7 +280,8 @@ export type Suite<Input, Output, Label> = {
280
280
  rateBlind?: boolean;
281
281
  /**
282
282
  * How a person should judge an answer, where it takes more than each
283
- * field's help: shown above the answer key as "How to judge an answer".
283
+ * field's help: opened from the info button beside the answer key's
284
+ * heading, as "How to judge an answer".
284
285
  * Without it, `labelHelp` shows there. For people only: it never reaches
285
286
  * the model, so it doesn't change the instructions hash.
286
287
  */
package/src/weekly.ts CHANGED
@@ -101,9 +101,14 @@ export function weeklySummary(args: {
101
101
  .filter((r) => r.startedBy === SCHEDULED && r.set === "SMOKE")
102
102
  .sort((a, b) => +b.startedAt - +a.startedAt);
103
103
  const lastAt = scheduled[0]?.startedAt ?? null;
104
- // The last weekly batch: everything started within a day of the newest.
104
+ // The last weekly batch: each suite's newest check started within a day
105
+ // of the newest, so a suite checked again (Run it now) shows its latest.
105
106
  const batch = lastAt
106
- ? scheduled.filter((r) => +lastAt - +r.startedAt < DAY)
107
+ ? scheduled.filter(
108
+ (r, i) =>
109
+ +lastAt - +r.startedAt < DAY &&
110
+ scheduled.findIndex((x) => x.suite === r.suite) === i,
111
+ )
107
112
  : [];
108
113
 
109
114
  const drift: WeeklySummary["drift"] = [];