@crowandraven/evalkeeper 0.8.0 → 0.9.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 (73) hide show
  1. package/dist/feedback.d.ts +3 -1
  2. package/dist/feedback.js +3 -1
  3. package/dist/feedback.js.map +1 -1
  4. package/dist/glossary.d.ts +3 -0
  5. package/dist/glossary.js +3 -0
  6. package/dist/glossary.js.map +1 -1
  7. package/dist/importCases.d.ts +15 -4
  8. package/dist/importCases.js +20 -18
  9. package/dist/importCases.js.map +1 -1
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.js +1 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/reviews.d.ts +172 -0
  14. package/dist/reviews.js +294 -0
  15. package/dist/reviews.js.map +1 -0
  16. package/dist/suiteContract.d.ts +3 -2
  17. package/dist/suiteContract.js +5 -2
  18. package/dist/suiteContract.js.map +1 -1
  19. package/dist/suites/attackImport.d.ts +99 -0
  20. package/dist/suites/attackImport.js +283 -0
  21. package/dist/suites/attackImport.js.map +1 -0
  22. package/dist/suites/crisisRisk.d.ts +9 -2
  23. package/dist/suites/crisisRisk.js +8 -3
  24. package/dist/suites/crisisRisk.js.map +1 -1
  25. package/dist/suites/crisisRiskCases.d.ts +4 -3
  26. package/dist/suites/crisisRiskCases.js +4 -3
  27. package/dist/suites/crisisRiskCases.js.map +1 -1
  28. package/dist/suites/crisisRiskReviews.d.ts +15 -0
  29. package/dist/suites/crisisRiskReviews.js +926 -0
  30. package/dist/suites/crisisRiskReviews.js.map +1 -0
  31. package/dist/suites/hopelessness.d.ts +9 -2
  32. package/dist/suites/hopelessness.js +8 -5
  33. package/dist/suites/hopelessness.js.map +1 -1
  34. package/dist/suites/hopelessnessCases.d.ts +3 -2
  35. package/dist/suites/hopelessnessCases.js +3 -2
  36. package/dist/suites/hopelessnessCases.js.map +1 -1
  37. package/dist/suites/hopelessnessReviews.d.ts +15 -0
  38. package/dist/suites/hopelessnessReviews.js +1080 -0
  39. package/dist/suites/hopelessnessReviews.js.map +1 -0
  40. package/dist/suites/index.d.ts +5 -0
  41. package/dist/suites/index.js +5 -0
  42. package/dist/suites/index.js.map +1 -1
  43. package/dist/suites/injection.d.ts +162 -0
  44. package/dist/suites/injection.js +331 -0
  45. package/dist/suites/injection.js.map +1 -0
  46. package/dist/suites/injectionAttacks.d.ts +3 -0
  47. package/dist/suites/injectionAttacks.js +34 -0
  48. package/dist/suites/injectionAttacks.js.map +1 -0
  49. package/dist/types.d.ts +21 -0
  50. package/dist/types.js +11 -0
  51. package/dist/types.js.map +1 -1
  52. package/package.json +1 -1
  53. package/src/feedback.ts +3 -1
  54. package/src/glossary.ts +6 -0
  55. package/src/importCases.ts +21 -20
  56. package/src/index.ts +1 -0
  57. package/src/reviews.ts +428 -0
  58. package/src/suiteContract.ts +5 -2
  59. package/src/suites/attackImport.ts +327 -0
  60. package/src/suites/crisisRisk.ts +15 -3
  61. package/src/suites/crisisRiskCases.ts +4 -3
  62. package/src/suites/crisisRiskReviews.ts +927 -0
  63. package/src/suites/hopelessness.ts +15 -5
  64. package/src/suites/hopelessnessCases.ts +3 -2
  65. package/src/suites/hopelessnessReviews.ts +1081 -0
  66. package/src/suites/index.ts +5 -0
  67. package/src/suites/injection.ts +463 -0
  68. package/src/suites/injectionAttacks.ts +136 -0
  69. package/src/types.ts +24 -0
  70. package/templates/app/evals/feedback/page.tsx +3 -1
  71. package/templates/app/evals/page.tsx +33 -26
  72. package/templates/components/evalkeeper/AnswerKey.tsx +23 -0
  73. package/templates/lib/evalkeeper/actions.ts +4 -1
@@ -2,6 +2,7 @@ import type { Metadata } from "next";
2
2
  import Link from "next/link";
3
3
  import {
4
4
  attention,
5
+ isInjectionSuite,
5
6
  perAnswer,
6
7
  seconds,
7
8
  suiteHealth,
@@ -327,33 +328,39 @@ function SuiteCard({
327
328
  </ul>
328
329
  )}
329
330
 
330
- {s && (
331
- <details className="group/history relative rounded-md bg-tint">
332
- <summary className="flex list-none items-center justify-between gap-2 p-3 text-sm font-medium">
333
- Versions
334
- <span className="flex items-center gap-1 text-xs font-normal text-muted">
335
- <span className="font-medium text-ink">
336
- v{version?.number ?? 1}
337
- </span>{" "}
338
- {since ? `live since ${day(since)}` : "defaults from code"} ·{" "}
339
- {versions} version{versions === 1 ? "" : "s"}
340
- <ChevronDown
341
- aria-hidden
342
- className="h-4 w-4 transition-transform group-open/history:rotate-180"
331
+ {isInjectionSuite(b.suite) ? (
332
+ <p className="readable text-sm text-muted">
333
+ Shares {b.suite.base.label}&apos;s settings and versions history.
334
+ </p>
335
+ ) : (
336
+ s && (
337
+ <details className="group/history relative rounded-md bg-tint">
338
+ <summary className="flex list-none items-center justify-between gap-2 p-3 text-sm font-medium">
339
+ Versions
340
+ <span className="flex items-center gap-1 text-xs font-normal text-muted">
341
+ <span className="font-medium text-ink">
342
+ v{version?.number ?? 1}
343
+ </span>{" "}
344
+ {since ? `live since ${day(since)}` : "defaults from code"} ·{" "}
345
+ {versions} version{versions === 1 ? "" : "s"}
346
+ <ChevronDown
347
+ aria-hidden
348
+ className="h-4 w-4 transition-transform group-open/history:rotate-180"
349
+ />
350
+ </span>
351
+ </summary>
352
+ <div className="px-3 pb-3">
353
+ <HistoryEntries
354
+ suite={b.suite.key}
355
+ entries={history}
356
+ liveId={version?.id ?? null}
357
+ label={label}
358
+ defaults={s}
359
+ plain
343
360
  />
344
- </span>
345
- </summary>
346
- <div className="px-3 pb-3">
347
- <HistoryEntries
348
- suite={b.suite.key}
349
- entries={history}
350
- liveId={version?.id ?? null}
351
- label={label}
352
- defaults={s}
353
- plain
354
- />
355
- </div>
356
- </details>
361
+ </div>
362
+ </details>
363
+ )
357
364
  )}
358
365
  </Card>
359
366
  );
@@ -6,6 +6,9 @@ import {
6
6
  type AnySuite,
7
7
  type BoardRow,
8
8
  type CheckResult,
9
+ EXPERT_REVIEWED,
10
+ FROM_BASE_CASE,
11
+ isShippedReview,
9
12
  } from "@crowandraven/evalkeeper";
10
13
  import { addCase, editAnswer, retireCase } from "@/lib/evalkeeper/actions";
11
14
  import { Check, ChevronRight, CircleAlert, X } from "lucide-react";
@@ -173,6 +176,18 @@ function CaseItem({
173
176
  c.labels.find((l) => l.status === "CONFIRMED") ??
174
177
  c.labels.find((l) => l.status === "PROVISIONAL") ??
175
178
  c.labels.find((l) => l.status === "PENDING");
179
+ // A confirmation from outside the app: shipped with the suite, or
180
+ // carried from the case an attack case was made from.
181
+ const shipped =
182
+ answer?.status !== "CONFIRMED"
183
+ ? null
184
+ : answer.raterRole === FROM_BASE_CASE
185
+ ? { text: "From base case", term: "fromBaseCase" as const }
186
+ : !isShippedReview(answer)
187
+ ? null
188
+ : answer.raterRole === EXPERT_REVIEWED
189
+ ? { text: "Expert reviewed", term: "expertReviewed" as const }
190
+ : { text: "Author reviewed", term: "authorReviewed" as const };
176
191
  const status = (answer && STATUS[answer.status]) ?? {
177
192
  text: "No answer",
178
193
  tone: "warn" as const,
@@ -206,6 +221,11 @@ function CaseItem({
206
221
  <Tip term={status.term} id={`status-${c.id}`}>
207
222
  <Chip tone={status.tone}>{status.text}</Chip>
208
223
  </Tip>
224
+ {shipped && (
225
+ <Tip term={shipped.term} id={`reviewed-${c.id}`}>
226
+ <Chip tone="neutral">{shipped.text}</Chip>
227
+ </Tip>
228
+ )}
209
229
  <Tip term={c.split === "TEST" ? "test" : "dev"} id={`split-${c.id}`}>
210
230
  <Chip tone="neutral">{c.split === "TEST" ? "Test" : "Dev"}</Chip>
211
231
  </Tip>
@@ -259,6 +279,9 @@ function CaseItem({
259
279
  {JSON.stringify(answer?.value ?? null, null, 2)}
260
280
  </pre>
261
281
  )}
282
+ {shipped && answer?.note && (
283
+ <p className="readable text-xs text-muted">{answer.note}</p>
284
+ )}
262
285
  {(tags.length > 0 || c.note) && (
263
286
  <p className="readable text-xs text-muted">
264
287
  {tags.length > 0 && `Tags: ${tags.join(", ")}. `}
@@ -6,6 +6,7 @@ import {
6
6
  blindRating,
7
7
  caseFromFeedback,
8
8
  formText,
9
+ isInjectionSuite,
9
10
  leakNote,
10
11
  raterStatus,
11
12
  skipMark,
@@ -317,7 +318,9 @@ async function find(id: string) {
317
318
  export async function makeCase(form: FormData) {
318
319
  await requireAdmin();
319
320
  const f = await find(formText(form, "feedback"));
320
- const suite = SUITES.find((s) => s.operation === f.operation);
321
+ const suite = SUITES.find(
322
+ (s) => s.operation === f.operation && !isInjectionSuite(s),
323
+ );
321
324
  const draft = suite ? caseFromFeedback(f, suite) : null;
322
325
  if (!draft || !suite) throw new Error("This rating can't become a case");
323
326
  const c = await store.createCase(draft);