@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.
Files changed (149) hide show
  1. package/dist/decisions.js +1 -1
  2. package/dist/decisions.js.map +1 -1
  3. package/dist/drafts.d.ts +2 -0
  4. package/dist/drafts.js +1 -1
  5. package/dist/drafts.js.map +1 -1
  6. package/dist/glossary.d.ts +25 -14
  7. package/dist/glossary.js +25 -14
  8. package/dist/glossary.js.map +1 -1
  9. package/dist/health.js +2 -2
  10. package/dist/health.js.map +1 -1
  11. package/dist/index.d.ts +3 -0
  12. package/dist/index.js +3 -0
  13. package/dist/index.js.map +1 -1
  14. package/dist/memoryStore.d.ts +2 -1
  15. package/dist/memoryStore.js +9 -0
  16. package/dist/memoryStore.js.map +1 -1
  17. package/dist/next/actions.js +58 -3
  18. package/dist/next/actions.js.map +1 -1
  19. package/dist/prisma/contracts.d.ts +5 -2
  20. package/dist/prisma/contracts.js +7 -1
  21. package/dist/prisma/contracts.js.map +1 -1
  22. package/dist/prisma/index.d.ts +40 -1
  23. package/dist/prisma/index.js +37 -1
  24. package/dist/prisma/index.js.map +1 -1
  25. package/dist/prune.d.ts +43 -10
  26. package/dist/prune.js +42 -13
  27. package/dist/prune.js.map +1 -1
  28. package/dist/react/AddCase.js +11 -5
  29. package/dist/react/AddCase.js.map +1 -1
  30. package/dist/react/AnswerKey.js +7 -4
  31. package/dist/react/AnswerKey.js.map +1 -1
  32. package/dist/react/CaseMenu.d.ts +2 -2
  33. package/dist/react/CaseMenu.js +10 -31
  34. package/dist/react/CaseMenu.js.map +1 -1
  35. package/dist/react/CompareView.js +3 -3
  36. package/dist/react/CompareView.js.map +1 -1
  37. package/dist/react/ConfirmAnswer.js +1 -1
  38. package/dist/react/ConfirmAnswer.js.map +1 -1
  39. package/dist/react/Drawer.d.ts +32 -0
  40. package/dist/react/Drawer.js +60 -0
  41. package/dist/react/Drawer.js.map +1 -0
  42. package/dist/react/HubSections.d.ts +34 -30
  43. package/dist/react/HubSections.js +104 -103
  44. package/dist/react/HubSections.js.map +1 -1
  45. package/dist/react/Menu.d.ts +37 -0
  46. package/dist/react/Menu.js +51 -0
  47. package/dist/react/Menu.js.map +1 -0
  48. package/dist/react/ModelMenu.d.ts +1 -1
  49. package/dist/react/ModelMenu.js +8 -32
  50. package/dist/react/ModelMenu.js.map +1 -1
  51. package/dist/react/RunView.js +24 -4
  52. package/dist/react/RunView.js.map +1 -1
  53. package/dist/react/Spending.d.ts +25 -0
  54. package/dist/react/Spending.js +51 -0
  55. package/dist/react/Spending.js.map +1 -0
  56. package/dist/react/SuiteSections.d.ts +27 -14
  57. package/dist/react/SuiteSections.js +227 -61
  58. package/dist/react/SuiteSections.js.map +1 -1
  59. package/dist/react/app.d.ts +18 -0
  60. package/dist/react/app.js.map +1 -1
  61. package/dist/react/format.d.ts +13 -0
  62. package/dist/react/format.js +13 -0
  63. package/dist/react/format.js.map +1 -1
  64. package/dist/react/index.d.ts +3 -0
  65. package/dist/react/index.js +3 -0
  66. package/dist/react/index.js.map +1 -1
  67. package/dist/react/pieces.d.ts +21 -8
  68. package/dist/react/pieces.js +44 -14
  69. package/dist/react/pieces.js.map +1 -1
  70. package/dist/runner.d.ts +18 -8
  71. package/dist/runner.js +148 -12
  72. package/dist/runner.js.map +1 -1
  73. package/dist/settings.d.ts +12 -0
  74. package/dist/settings.js +18 -0
  75. package/dist/settings.js.map +1 -1
  76. package/dist/spending.d.ts +100 -0
  77. package/dist/spending.js +133 -0
  78. package/dist/spending.js.map +1 -0
  79. package/dist/stats.d.ts +3 -1
  80. package/dist/stats.js +6 -2
  81. package/dist/stats.js.map +1 -1
  82. package/dist/store.d.ts +5 -0
  83. package/dist/suggest.js +17 -12
  84. package/dist/suggest.js.map +1 -1
  85. package/dist/suiteSettings.d.ts +78 -0
  86. package/dist/suiteSettings.js +142 -0
  87. package/dist/suiteSettings.js.map +1 -0
  88. package/dist/suites/crisisRisk.js +3 -3
  89. package/dist/suites/crisisRisk.js.map +1 -1
  90. package/dist/suites/hopelessness.js +6 -6
  91. package/dist/suites/hopelessness.js.map +1 -1
  92. package/dist/suites/injection.js +2 -2
  93. package/dist/suites/injection.js.map +1 -1
  94. package/dist/summary.d.ts +41 -4
  95. package/dist/summary.js +46 -8
  96. package/dist/summary.js.map +1 -1
  97. package/dist/testing.d.ts +19 -0
  98. package/dist/testing.js +61 -0
  99. package/dist/testing.js.map +1 -1
  100. package/dist/todo.d.ts +146 -0
  101. package/dist/todo.js +198 -0
  102. package/dist/todo.js.map +1 -0
  103. package/dist/types.d.ts +46 -7
  104. package/dist/types.js +28 -4
  105. package/dist/types.js.map +1 -1
  106. package/package.json +1 -1
  107. package/schema/evalkeeper.prisma +13 -0
  108. package/src/decisions.ts +1 -1
  109. package/src/drafts.ts +3 -1
  110. package/src/glossary.ts +35 -14
  111. package/src/health.ts +3 -2
  112. package/src/index.ts +3 -0
  113. package/src/memoryStore.ts +15 -1
  114. package/src/next/actions.ts +67 -2
  115. package/src/prisma/contracts.ts +16 -1
  116. package/src/prisma/index.ts +68 -1
  117. package/src/prune.ts +71 -14
  118. package/src/react/AddCase.tsx +13 -11
  119. package/src/react/AnswerKey.tsx +17 -5
  120. package/src/react/CaseMenu.tsx +23 -77
  121. package/src/react/CompareView.tsx +4 -10
  122. package/src/react/ConfirmAnswer.tsx +1 -1
  123. package/src/react/Drawer.tsx +130 -0
  124. package/src/react/HubSections.tsx +180 -414
  125. package/src/react/Menu.tsx +155 -0
  126. package/src/react/ModelMenu.tsx +23 -74
  127. package/src/react/RunView.tsx +46 -3
  128. package/src/react/Spending.tsx +200 -0
  129. package/src/react/SuiteSections.tsx +591 -148
  130. package/src/react/app.ts +18 -0
  131. package/src/react/format.ts +15 -0
  132. package/src/react/index.ts +3 -0
  133. package/src/react/pieces.tsx +57 -18
  134. package/src/runner.ts +199 -13
  135. package/src/settings.ts +20 -0
  136. package/src/spending.ts +209 -0
  137. package/src/stats.ts +8 -2
  138. package/src/store.ts +5 -0
  139. package/src/suggest.ts +21 -14
  140. package/src/suiteSettings.ts +201 -0
  141. package/src/suites/crisisRisk.ts +3 -3
  142. package/src/suites/hopelessness.ts +6 -6
  143. package/src/suites/injection.ts +2 -2
  144. package/src/summary.ts +59 -8
  145. package/src/testing.ts +77 -0
  146. package/src/todo.ts +318 -0
  147. package/src/types.ts +63 -9
  148. package/starter/index.ts +7 -0
  149. package/templates/lib/evalkeeper/actions.ts +20 -0
package/dist/types.js CHANGED
@@ -1,6 +1,30 @@
1
- /** The pass rate a check should reach: its own, else 95% serious, 75% minor. */
1
+ /**
2
+ * Each level's aim when a check sets none: must pass 95%, should pass 85%,
3
+ * nice to have 75%.
4
+ */
5
+ export const DEFAULT_AIM = {
6
+ serious: 0.95,
7
+ moderate: 0.85,
8
+ minor: 0.75,
9
+ };
10
+ /** The levels in order, most important first, for sorting checks. */
11
+ export const SEVERITY_ORDER = [
12
+ "serious",
13
+ "moderate",
14
+ "minor",
15
+ ];
16
+ /**
17
+ * What the pages call each level: a serious check must pass, a moderate
18
+ * one should pass, a minor one is nice to have.
19
+ */
20
+ export const SEVERITY_LABEL = {
21
+ serious: "Must pass",
22
+ moderate: "Should pass",
23
+ minor: "Nice to have",
24
+ };
25
+ /** The pass rate a check should reach: its own, else its level's (DEFAULT_AIM). */
2
26
  export function checkBar(c) {
3
- return c.bar ?? (c.severity === "serious" ? 0.95 : 0.75);
27
+ return c.bar ?? DEFAULT_AIM[c.severity];
4
28
  }
5
29
  /**
6
30
  * A rate as a whole percent, except when it's under its bar but would
@@ -13,7 +37,7 @@ export function pctBeside(rate, bar) {
13
37
  ? `${(Math.floor(rate * 1000) / 10).toFixed(1)}%`
14
38
  : `${whole}%`;
15
39
  }
16
- /** Meets the bar, is within 10 points of it, or is further below. */
40
+ /** Meets the aim (bar), is within 10 points of it, or is further below. */
17
41
  export function barStatus(rate, bar) {
18
42
  return rate >= bar ? "meets" : rate >= bar - 0.1 ? "close" : "below";
19
43
  }
@@ -21,7 +45,7 @@ export function barStatus(rate, bar) {
21
45
  export const FAVOR_TEXT = {
22
46
  speed: "speed: someone waits on this, so a model that scores as well and answers clearly faster is worth switching to, and so is one about as accurate (within 10 points) in half the time",
23
47
  cost: "cost: this runs in the background, often, so a model that scores as well and is clearly cheaper is worth switching to, and so is one about as accurate (within 10 points) at half the cost",
24
- quality: "quality: people read and act on this, so only clearly better accuracy or fewer serious mistakes is worth switching for",
48
+ quality: "quality: people read and act on this, so only clearly better accuracy or fewer must-pass misses is worth switching for",
25
49
  };
26
50
  /** A value as plain text: strings as they are, other values as JSON. */
27
51
  export function asText(v) {
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA2DA,gFAAgF;AAChF,MAAM,UAAU,QAAQ,CAAC,CAAW;IAClC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,GAAW;IACjD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;IACrC,OAAO,IAAI,GAAG,GAAG,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;QACjD,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;QACjD,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;AAClB,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,SAAS,CACvB,IAAY,EACZ,GAAW;IAEX,OAAO,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC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M,iBAAiB,GAAG,YAAY,CAAC;AAyB9C;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,KAAe,EAAE,IAAc;IAC5D,IAAI,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;QACnC,OAAO,QAAQ,CAAC,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACvE,IAAI,KAAK,CAAC,aAAa;QAAE,OAAO,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;AACnD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowandraven/evalkeeper",
3
- "version": "0.17.1",
3
+ "version": "0.19.0",
4
4
  "description": "An open-source eval harness for TypeScript apps: test each AI feature against answers people confirm, compare models on accuracy, cost, and speed, and choose the live model on evidence.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -197,3 +197,16 @@ model EvalSettingsChange {
197
197
 
198
198
  @@index([operation, createdAt])
199
199
  }
200
+
201
+ // Suite settings (optional): add this to let people change a suite's
202
+ // target number of cases on its page. Skip it to keep the targets in code.
203
+
204
+ /// Settings a person changed on a suite's page, by suite, as JSON (its
205
+ /// target number of cases). Apart from the versioned model settings.
206
+ model EvalSuiteSetting {
207
+ suite String @id
208
+ values Json
209
+ /// Who saved them; null for the system.
210
+ updatedBy String?
211
+ updatedAt DateTime @updatedAt
212
+ }
package/src/decisions.ts CHANGED
@@ -174,7 +174,7 @@ export function decisionCheck(
174
174
  ...(s.correct ? {} : { note: `Expected ${say(expected)}, got ${given}` }),
175
175
  given:
176
176
  answer.type === "boolean"
177
- ? `${given}, bar ${pct(opts.threshold ?? 0.5)}`
177
+ ? `${given}, cutoff ${pct(opts.threshold ?? 0.5)}`
178
178
  : `${given}${sure}`,
179
179
  measures,
180
180
  };
package/src/drafts.ts CHANGED
@@ -34,6 +34,8 @@ export async function draftMoreCases(opts: {
34
34
  focus: string | null;
35
35
  /** How many to draft (1 to 10); default enough to near the target. */
36
36
  count?: number;
37
+ /** The suite's target number of cases (`targetCasesOf`); default 50. */
38
+ target?: number;
37
39
  }): Promise<DraftMoreResult> {
38
40
  const { store, suite } = opts;
39
41
  const result: DraftMoreResult = { drafted: 0, rejected: [] };
@@ -44,7 +46,7 @@ export async function draftMoreCases(opts: {
44
46
  existing: all.map((c) => ({ input: c.input, tags: c.tags })),
45
47
  count:
46
48
  opts.count === undefined
47
- ? draftsToTarget(inUse.length)
49
+ ? draftsToTarget(inUse.length, opts.target)
48
50
  : Math.min(10, Math.max(1, Math.round(opts.count))),
49
51
  focus: opts.focus,
50
52
  });
package/src/glossary.ts CHANGED
@@ -7,15 +7,15 @@ export const GLOSSARY = {
7
7
  score:
8
8
  "Accuracy: how much the model got right on every case in use. With partial credit, parts right of parts expected; otherwise answers with every check passed.",
9
9
  seriousMistakes:
10
- "Failed serious checks: mistakes that change what your product does. Models are compared on these first.",
10
+ "Answers that missed a must-pass check: mistakes that change what your product does. Models are compared on these first.",
11
11
  time: "Speed: average seconds per answer, so lower is faster, from answers the model actually made (reused answers keep their original time).",
12
12
  favors:
13
- "What the suggestion weighs once accuracy holds. It never suggests a model with more serious mistakes, and only trades accuracy for a clear gain: accuracy alone, or the same accuracy at half the cost or time.",
13
+ "What the suggestion weighs once accuracy holds. It never suggests a model with more must-pass misses, and only trades accuracy for a clear gain: accuracy alone, or the same accuracy at half the cost or time.",
14
14
  attackFailures:
15
15
  "Answers on the attack cases that never came back (an error or a timeout, not a wrong answer). Attacks resisted counts only complete tests: test again.",
16
16
  cost: "Average cost per answer on this model, from your catalog's prices.",
17
17
  againstLive:
18
- "A paired comparison with the live model on the same cases: more accurate, about as accurate, less accurate, or too few cases to tell.",
18
+ "Accuracy against the live model, paired on the same cases: better, similar (closer than these cases can tell apart), or worse. Can't tell: too few cases.",
19
19
  live: "The model this feature runs on now.",
20
20
  fallback:
21
21
  "The model that answers when the live model's provider is down. Any model can be chosen; the suggestion recommends the most accurate one from another provider.",
@@ -24,14 +24,16 @@ export const GLOSSARY = {
24
24
  outOfDate:
25
25
  "Cases, answers, or instructions changed since this test ran. Test again, or rescore for free if only answers changed.",
26
26
  serious:
27
- "A mistake that changes what the product does. Serious checks should pass 95% of the time unless the check sets its own bar.",
27
+ "Must pass: missing it changes what the product does. A must-pass check aims to pass 95% of the time unless it sets its own aim.",
28
+ moderate:
29
+ "Should pass: it matters, but less than a must-pass check. It aims to pass 85% of the time unless it sets its own aim, and a miss fails the answer.",
28
30
  minor:
29
- "A fair difference of judgment. Minor checks should pass 75% of the time unless the check sets its own bar.",
30
- bar: "The pass rate this check should reach.",
31
+ "Nice to have: a fair difference of judgment. It aims to pass 75% of the time unless it sets its own aim, and a miss never fails the answer.",
32
+ aim: "The pass rate this check aims for. Under it, the check needs work.",
31
33
  reasoningSetting:
32
34
  "Some models think before answering, and how much is a setting. Less is faster and cheaper; more can be more accurate. Each setting you test gets its own row.",
33
35
  checkBreakdown:
34
- "How often each check passed, for every model with a current test. Serious checks come first; minor ones are fair differences of judgment, so their bar is lower.",
36
+ "How often each check passed, for every model with a current test. Must-pass checks come first; nice-to-have ones are fair differences of judgment, so they aim lower.",
35
37
  confirmed: "A person said this answer is right. Tests grade against it.",
36
38
  provisional:
37
39
  "Put to use before anyone reviewed it. Tests use it, and every score says it rests on unreviewed answers.",
@@ -43,12 +45,18 @@ export const GLOSSARY = {
43
45
  "An attack case's answer, carried from the case it was made from and the person who confirmed that one. An attack shouldn't change the right answer.",
44
46
  expertReviewed:
45
47
  "Confirmed by an expert in what the suite judges, such as a crisis line counselor, once for every app that uses the suite. Your own confirmed answer replaces it.",
46
- dev: "Cases you tune against: change prompts and checks while looking at these.",
47
- test: "Cases you only check: never tune against them, so they show how a change does on cases it wasn't fitted to.",
48
+ dev: "A case you can look at while you change the instructions. Most cases are.",
49
+ test: "A held-out case: kept out of sight while you change the instructions, so it shows whether a change works on cases nobody tuned it on.",
48
50
  suggestion:
49
51
  "Fixed rules pick it, so the reason given is the real one: accuracy first, then the suite's priority. Nothing changes until you choose.",
50
52
  attacksResisted:
51
- "Of the attacks planted where untrusted text goes, the share answered with no serious mistake. A model's Test runs them with its cases.",
53
+ "Of the attacks planted where untrusted text goes, the share answered with no must-pass miss. A model's Test runs them with its cases.",
54
+ attackCases:
55
+ "Each is a confirmed case with an attack planted where untrusted text goes, and keeps that case's answer. A model's Test runs them, and they follow the cases as answers change.",
56
+ updateAttackCases:
57
+ "Brings attack cases in step with the answer key: new confirmed cases get attacks, changed answers carry over, and retired cases' attacks retire. No model calls, so it's free.",
58
+ addAttack:
59
+ "Attacks are written in code, in the suite's setup. This guide shows how.",
52
60
  attackResults:
53
61
  "This suite attacks another feature's cases. Its results show on that feature's page, where its models are chosen, so one choice weighs both.",
54
62
  priority:
@@ -88,14 +96,27 @@ export const GLOSSARY = {
88
96
  "The instructions changed in code and were recorded under the same models. No model was switched.",
89
97
  instructionsEdited:
90
98
  "Instructions edited at runtime (an admin override or added guidance) were recorded under the same models. No model was switched. Dated when noticed, which can be after the edit.",
99
+ noEvalYet:
100
+ "AI features no suite tests yet, so nothing tells you when one gets worse. Ask your coding agent to write a suite for each: Evalkeeper's guide for adding a suite tells it how.",
91
101
  suites:
92
102
  "One suite per AI feature: its cases, the answers people confirmed, and the checks that grade any model against them. Open one to compare models and choose the live one.",
93
103
  standing:
94
- "Where a suite stands. At risk: a serious check is under its bar. Can improve: a minor one is, a better model is suggested, or a retest is due. Healthy: meets every bar. Can't tell yet: too few cases or untested.",
104
+ "Where a suite stands. Needs attention: its to-do list has something on it. Can't tell yet: no model tested, or too few cases to judge. Healthy: nothing to do.",
105
+ checkLevels:
106
+ "Each check's level and aim, in place of the suite's own. Grading and the suggestion use them, a nice-to-have miss never fails an answer, and saving rescores recent tests for free.",
107
+ todo: "What to do next on this suite, in order, each with why. Each is done on this page, and drops off once it's done.",
108
+ replacedStarter:
109
+ "Added from the suite's starter cases, which have changed since: this input is no longer one of them. Retire it, unless you want it as a case of your own.",
110
+ targetCases:
111
+ "How many cases this answer key aims for: when to ask for more, how many to draft, and the fewest retiring leaves. Fewer make scores less certain; when every case costs real money, about 10 can be right.",
112
+ suiteSettings:
113
+ "This suite's own settings, kept apart from its model versions: changing them never makes a new version.",
114
+ spending:
115
+ "What eval tests spent in the last 24 hours against the daily limits. At a limit, tests stop until earlier spending is more than 24 hours old.",
95
116
  answerKey:
96
117
  "The cases and the answers tests grade against. Only confirmed answers count: a model can draft answers, but they stay pending until a person confirms them. Open a case to see how each model did on it.",
97
118
  checks:
98
- "What a good answer gets right, one thing per check. Serious checks catch mistakes that change what your product does; minor ones, fair differences of judgment. Each has a bar its pass rate should reach.",
119
+ "What a good answer gets right, one thing per check. Must-pass checks catch mistakes that change what your product does; nice-to-have ones, fair differences of judgment. Each has an aim for its pass rate.",
99
120
  probabilityQuality:
100
121
  "How good the probabilities were: 100% minus the Brier score. High means sure when right and unsure when wrong; picking right with careless probabilities scores lower.",
101
122
  calibrationError:
@@ -130,9 +151,9 @@ export const GLOSSARY = {
130
151
  answerKeyHealth:
131
152
  "What would keep this answer key useful: cases that no longer tell models apart, cases to check, near-duplicates, old drafts, and thin tags.",
132
153
  easyCases:
133
- "Cases every current model gets fully right, with at least 3 models tested. They no longer tell models apart, and they make scores look closer than they are.",
154
+ "Cases 3 or more models got fully right in 4 rounds of testing (days), since the answer last changed. Suggested only past the suite's target number of cases; never a case a ranking compares.",
134
155
  easyFloor:
135
- "Easy cases kept so a test still catches a model that breaks the basics: about a tenth of the cases in use, quick set first.",
156
+ "A suite keeps at least its target number of cases (50 unless it sets one): easy ones are never retired below that, or suggested at or under it.",
136
157
  splitCases:
137
158
  "Cases models divide about evenly on. Often the answer is unclear, so check it. Once it's right, it's the most useful kind of case.",
138
159
  nearDuplicates:
package/src/health.ts CHANGED
@@ -173,9 +173,10 @@ export function suiteHealth(
173
173
  );
174
174
  for (const { c, rate } of below.slice(0, 3))
175
175
  details.push(
176
- `${c.label}: ${pctBeside(rate, checkBar(c))}, under the ${pct(checkBar(c))} bar${c.severity === "serious" ? " (serious)" : ""}.`,
176
+ `${c.label}: ${pctBeside(rate, checkBar(c))}, under its ${pct(checkBar(c))} aim${c.severity === "serious" ? " (must pass)" : ""}.`,
177
177
  );
178
- if (below.length > 3) details.push(`${below.length - 3} more under the bar.`);
178
+ if (below.length > 3)
179
+ details.push(`${below.length - 3} more under their aim.`);
179
180
 
180
181
  const s = suggest(rows, checks, priority, models, opts);
181
182
  // Not while a test runs: the suggestion would weigh half a board.
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@ export * from "./compare.js";
13
13
  export * from "./summary.js";
14
14
  export * from "./suggest.js";
15
15
  export * from "./health.js";
16
+ export * from "./todo.js";
16
17
  export * from "./attention.js";
17
18
  export * from "./common.js";
18
19
  export { failureHints, failureKind, type FailureKind } from "./failures.js";
@@ -27,6 +28,8 @@ export * from "./glossary.js";
27
28
  export * from "./feedback.js";
28
29
  export * from "./weekly.js";
29
30
  export * from "./settings.js";
31
+ export * from "./suiteSettings.js";
32
+ export * from "./spending.js";
30
33
  export * from "./decisions.js";
31
34
  export * from "./store.js";
32
35
  export * from "./suiteContract.js";
@@ -18,6 +18,11 @@ import type {
18
18
  OutputRecord,
19
19
  RunRecord,
20
20
  } from "./store.js";
21
+ import {
22
+ NO_SUITE_SETTINGS,
23
+ type SuiteSettings,
24
+ type SuiteSettingsStore,
25
+ } from "./suiteSettings.js";
21
26
 
22
27
  /**
23
28
  * An EvalStore in memory: for tests, demos, and trying Evalkeeper before
@@ -25,7 +30,8 @@ import type {
25
30
  */
26
31
  export function memoryStore(): EvalStore &
27
32
  FeedbackStore &
28
- SettingsStore & {
33
+ SettingsStore &
34
+ SuiteSettingsStore & {
29
35
  cases: CaseRecord[];
30
36
  runs: RunRecord[];
31
37
  outputs: OutputRecord[];
@@ -40,6 +46,7 @@ export function memoryStore(): EvalStore &
40
46
  const versions: SettingsVersion[] = [];
41
47
  const changes: SettingsChange[] = [];
42
48
  const live = new Map<string, string>();
49
+ const suiteSettings = new Map<string, SuiteSettings>();
43
50
  let n = 0;
44
51
  const id = (prefix: string) => `${prefix}_${(++n).toString(36)}`;
45
52
  const now = () => new Date();
@@ -51,6 +58,13 @@ export function memoryStore(): EvalStore &
51
58
  feedback,
52
59
  versions,
53
60
  changes,
61
+ async getSuiteSettings(suite) {
62
+ // A copy, so a caller can't change what's kept.
63
+ return structuredClone(suiteSettings.get(suite) ?? NO_SUITE_SETTINGS);
64
+ },
65
+ async saveSuiteSettings(suite, settings) {
66
+ suiteSettings.set(suite, structuredClone(settings));
67
+ },
54
68
  async liveVersion(operation) {
55
69
  const id = live.get(operation);
56
70
  return versions.find((v) => v.id === id) ?? null;
@@ -18,6 +18,10 @@ import {
18
18
  useDraftsProvisionally,
19
19
  withoutLeaks,
20
20
  priorityOf,
21
+ limitsFromForm,
22
+ currentSettings,
23
+ replacedStarters,
24
+ suiteSettingsFromForm,
21
25
  type ReasoningEffort,
22
26
  } from "../index.js";
23
27
  import { evalsPath, type EvalActions } from "../react/app.js";
@@ -262,10 +266,16 @@ export function evalActions(w: EvalWiring): Required<EvalActions> {
262
266
  ]);
263
267
  if (board.rows.some((r) => r.testing))
264
268
  throw new Error("Wait for the tests running now to finish");
265
- const { settings: live } = await settings.current(suite.operation);
269
+ const current = await currentSettings(settings, suite.operation);
270
+ if (!current)
271
+ throw new Error(
272
+ `Set ${suite.label}'s settings first: it has no version yet, and no default in code.`,
273
+ );
274
+ const live = current.settings;
266
275
  const s = suggest(
267
276
  board.rows,
268
- suite.checks,
277
+ // With a person's levels, as the page showed them.
278
+ board.suite.checks,
269
279
  priorityOf(suite, live),
270
280
  w.models,
271
281
  {
@@ -433,6 +443,60 @@ export function evalActions(w: EvalWiring): Required<EvalActions> {
433
443
  revalidatePath(page(suite.key));
434
444
  },
435
445
 
446
+ /**
447
+ * Retires the starter cases a starter update replaced (their input is
448
+ * no longer among the suite's starters). Reversible, like any retire.
449
+ */
450
+ async retireReplacedStarters(form) {
451
+ await w.requireAdmin();
452
+ const suite = suiteFrom(form);
453
+ const cases = await store.listCases(suite.key);
454
+ for (const c of replacedStarters(suite, cases))
455
+ await store.setCaseStatus(c.id, "RETIRED");
456
+ revalidatePath(page(suite.key));
457
+ },
458
+
459
+ /** Saves a suite's settings: its target number of cases. */
460
+ async saveSuiteSettings(form) {
461
+ const admin = await w.requireAdmin();
462
+ const suite = suiteFrom(form);
463
+ await runner.saveSuiteSettings(
464
+ suite.key,
465
+ suiteSettingsFromForm(form, suite.checks),
466
+ changer(admin),
467
+ );
468
+ // Levels and aims change what passed: recent tests are rescored with
469
+ // them now (free), so no test reads as out of date.
470
+ await runner.rescoreRecent(suite.key);
471
+ everyPage();
472
+ },
473
+
474
+ /** Saves the daily spending limits: all tests, and a feature's. */
475
+ async saveLimits(form) {
476
+ const admin = await w.requireAdmin();
477
+ if (!w.spending) throw new Error("This app keeps no spending limits");
478
+ const limits = limitsFromForm(form);
479
+ if (limits.feature) runner.suiteOrThrow(formText(form, "suite"));
480
+ await w.spending.saveLimits(limits, changer(admin));
481
+ everyPage();
482
+ },
483
+
484
+ /** Stops every test now; answers already given are kept. */
485
+ async stopTests() {
486
+ const admin = await w.requireAdmin();
487
+ if (!w.spending?.stopAll) throw new Error("This app has no stop");
488
+ await w.spending.stopAll(changer(admin));
489
+ everyPage();
490
+ },
491
+
492
+ /** Lifts a stop early; the daily limits still apply. */
493
+ async allowTests() {
494
+ await w.requireAdmin();
495
+ if (!w.spending?.allow) throw new Error("This app has no stop");
496
+ await w.spending.allow();
497
+ everyPage();
498
+ },
499
+
436
500
  async addStarters(form) {
437
501
  await w.requireAdmin();
438
502
  const suite = suiteFrom(form);
@@ -476,6 +540,7 @@ export function evalActions(w: EvalWiring): Required<EvalActions> {
476
540
  await draftMoreCases({
477
541
  store,
478
542
  suite,
543
+ target: await runner.targetCases(suite.key),
479
544
  focus: focus ? focus.slice(0, 500) : null,
480
545
  ...(Number.isFinite(asked) && asked > 0
481
546
  ? { count: asked }
@@ -14,6 +14,7 @@ import type {
14
14
  PrismaFeedbackMap,
15
15
  PrismaSettingsMap,
16
16
  PrismaStoreMap,
17
+ PrismaSuiteSettingsMap,
17
18
  } from "./index.js";
18
19
  import { Table, isRow, type Row } from "./mapping.js";
19
20
 
@@ -48,6 +49,7 @@ export type ScopedRowsDeleted = {
48
49
  versions: number;
49
50
  live: number;
50
51
  changes: number;
52
+ suiteSettings: number;
51
53
  };
52
54
 
53
55
  /** The maps for `deleteScopedRows`: the ones you pass the stores. */
@@ -58,12 +60,14 @@ export type ScopedRowsMaps = {
58
60
  settingsMap?: PrismaSettingsMap;
59
61
  /** The map you pass `prismaFeedbackStore`, if any. */
60
62
  feedbackMap?: PrismaFeedbackMap;
63
+ /** The map you pass `prismaSuiteSettingsStore`, if any. */
64
+ suiteSettingsMap?: PrismaSuiteSettingsMap;
61
65
  };
62
66
 
63
67
  /**
64
68
  * Deletes the rows a scoped store contract wrote, and nothing else: cases
65
69
  * and tests whose suite starts with `scope` (with their answers and
66
- * outputs), and ratings, versions, live pointers, and changes whose
70
+ * outputs) and its suite settings, and ratings, versions, live pointers, and changes whose
67
71
  * feature starts with it. Each row's name is compared exactly in code,
68
72
  * not by the database's pattern matching (which may ignore case), so a
69
73
  * row whose name only looks like the scope stays. Tables your client
@@ -99,6 +103,7 @@ export async function deleteScopedRows(
99
103
  versions: 0,
100
104
  live: 0,
101
105
  changes: 0,
106
+ suiteSettings: 0,
102
107
  };
103
108
 
104
109
  /**
@@ -172,6 +177,16 @@ export async function deleteScopedRows(
172
177
  if (lv) deleted.live = await remove(lives, lv.d, "operation", lv.ids);
173
178
  const vs = await scoped(versions, "operation");
174
179
  if (vs) deleted.versions = await remove(versions, vs.d, "id", vs.ids);
180
+
181
+ const sm = maps.suiteSettingsMap ?? {};
182
+ const suiteSettings = new Table(
183
+ "evalSuiteSetting",
184
+ sm.models?.evalSuiteSetting ?? "evalSuiteSetting",
185
+ sm.fields?.evalSuiteSetting,
186
+ );
187
+ const ss = await scoped(suiteSettings, "suite", "suite");
188
+ if (ss)
189
+ deleted.suiteSettings = await remove(suiteSettings, ss.d, "suite", ss.ids);
175
190
  return deleted;
176
191
  }
177
192
 
@@ -3,7 +3,12 @@
3
3
  *
4
4
  * @module evalkeeper/prisma
5
5
  */
6
- import { CHANGE_KINDS, SettingsConflict, cleanRating } from "../index.js";
6
+ import {
7
+ CHANGE_KINDS,
8
+ SettingsConflict,
9
+ cleanRating,
10
+ readSuiteSettings,
11
+ } from "../index.js";
7
12
  import type {
8
13
  CaseRecord,
9
14
  FeedbackRecord,
@@ -23,6 +28,7 @@ import type {
23
28
  SettingsChange,
24
29
  SettingsStore,
25
30
  SettingsVersion,
31
+ SuiteSettingsStore,
26
32
  } from "../index.js";
27
33
  import {
28
34
  Table,
@@ -1171,4 +1177,65 @@ export function prismaSettingsStore(
1171
1177
  },
1172
1178
  };
1173
1179
  }
1180
+ /** An EvalSuiteSetting row. */
1181
+ export type EvalSuiteSettingRow = {
1182
+ suite: string;
1183
+ values: Json;
1184
+ updatedBy: string | null;
1185
+ updatedAt: Date;
1186
+ };
1187
+
1188
+ /** Where your suite settings table differs from Evalkeeper's. */
1189
+ export type PrismaSuiteSettingsMap = {
1190
+ /**
1191
+ * The table's model on the Prisma client, as the client spells it
1192
+ * (`prisma.evalSuiteSetting` is `"evalSuiteSetting"`).
1193
+ */
1194
+ models?: { evalSuiteSetting?: string };
1195
+ /** Column names, keyed by Evalkeeper's field (`updatedBy: "userId"`). */
1196
+ fields?: { evalSuiteSetting?: ColumnMap<EvalSuiteSettingRow> };
1197
+ };
1198
+
1199
+ /**
1200
+ * A SuiteSettingsStore on the EvalSuiteSetting table: one row per suite,
1201
+ * its settings as JSON. Give it to `createRunner` as `suiteSettings`, so
1202
+ * people can change a suite's target number of cases on its page. A row
1203
+ * that doesn't parse reads as nothing saved.
1204
+ *
1205
+ * @param db - Your Prisma client.
1206
+ * @param map - Where your table differs from Evalkeeper's, if it does.
1207
+ *
1208
+ * @example
1209
+ * ```ts
1210
+ * const runner = createRunner({
1211
+ * store, suites, models, promptVersion,
1212
+ * suiteSettings: prismaSuiteSettingsStore(prisma),
1213
+ * });
1214
+ * ```
1215
+ */
1216
+ export function prismaSuiteSettingsStore(
1217
+ db: object,
1218
+ map: PrismaSuiteSettingsMap = {},
1219
+ ): SuiteSettingsStore {
1220
+ const t = new Table(
1221
+ "evalSuiteSetting",
1222
+ map.models?.evalSuiteSetting ?? "evalSuiteSetting",
1223
+ map.fields?.evalSuiteSetting,
1224
+ );
1225
+ return {
1226
+ async getSuiteSettings(suite) {
1227
+ const row = await t.on(db).findUnique({ where: t.out({ suite }) });
1228
+ return readSuiteSettings(row ? t.in(row).values : null);
1229
+ },
1230
+ async saveSuiteSettings(suite, settings, by) {
1231
+ const d = t.on(db);
1232
+ const data = { values: { ...settings }, updatedBy: by };
1233
+ // No upsert on every client a map can point at: find, then write.
1234
+ const found = await d.findUnique({ where: t.out({ suite }) });
1235
+ if (found) await d.update({ where: t.out({ suite }), data: t.out(data) });
1236
+ else await d.create({ data: t.out({ suite, ...data }) });
1237
+ },
1238
+ };
1239
+ }
1240
+
1174
1241
  export * from "./moveIn.js";