@crowandraven/evalkeeper 0.7.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.
- package/README.md +9 -0
- package/dist/cli/addPages.d.ts +5 -0
- package/dist/cli/addPages.js +15 -3
- package/dist/cli/addPages.js.map +1 -1
- package/dist/decisions.js +8 -0
- package/dist/decisions.js.map +1 -1
- package/dist/feedback.d.ts +20 -3
- package/dist/feedback.js +16 -3
- package/dist/feedback.js.map +1 -1
- package/dist/glossary.d.ts +6 -1
- package/dist/glossary.js +6 -1
- package/dist/glossary.js.map +1 -1
- package/dist/importCases.d.ts +15 -4
- package/dist/importCases.js +20 -18
- package/dist/importCases.js.map +1 -1
- package/dist/inInstructions.d.ts +47 -0
- package/dist/inInstructions.js +95 -0
- package/dist/inInstructions.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/reviews.d.ts +172 -0
- package/dist/reviews.js +294 -0
- package/dist/reviews.js.map +1 -0
- package/dist/runner.d.ts +9 -0
- package/dist/runner.js +26 -0
- package/dist/runner.js.map +1 -1
- package/dist/suiteContract.d.ts +12 -5
- package/dist/suiteContract.js +47 -7
- package/dist/suiteContract.js.map +1 -1
- package/dist/suites/attackImport.d.ts +99 -0
- package/dist/suites/attackImport.js +283 -0
- package/dist/suites/attackImport.js.map +1 -0
- package/dist/suites/crisisRisk.d.ts +9 -2
- package/dist/suites/crisisRisk.js +8 -3
- package/dist/suites/crisisRisk.js.map +1 -1
- package/dist/suites/crisisRiskCases.d.ts +4 -3
- package/dist/suites/crisisRiskCases.js +4 -3
- package/dist/suites/crisisRiskCases.js.map +1 -1
- package/dist/suites/crisisRiskReviews.d.ts +15 -0
- package/dist/suites/crisisRiskReviews.js +926 -0
- package/dist/suites/crisisRiskReviews.js.map +1 -0
- package/dist/suites/hopelessness.d.ts +123 -0
- package/dist/suites/hopelessness.js +296 -0
- package/dist/suites/hopelessness.js.map +1 -0
- package/dist/suites/hopelessnessCases.d.ts +62 -0
- package/dist/suites/hopelessnessCases.js +243 -0
- package/dist/suites/hopelessnessCases.js.map +1 -0
- package/dist/suites/hopelessnessReviews.d.ts +15 -0
- package/dist/suites/hopelessnessReviews.js +1080 -0
- package/dist/suites/hopelessnessReviews.js.map +1 -0
- package/dist/suites/index.d.ts +7 -0
- package/dist/suites/index.js +7 -0
- package/dist/suites/index.js.map +1 -1
- package/dist/suites/injection.d.ts +162 -0
- package/dist/suites/injection.js +331 -0
- package/dist/suites/injection.js.map +1 -0
- package/dist/suites/injectionAttacks.d.ts +3 -0
- package/dist/suites/injectionAttacks.js +34 -0
- package/dist/suites/injectionAttacks.js.map +1 -0
- package/dist/testing.d.ts +36 -2
- package/dist/testing.js +104 -14
- package/dist/testing.js.map +1 -1
- package/dist/types.d.ts +27 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/addPages.ts +16 -3
- package/src/decisions.ts +10 -0
- package/src/feedback.ts +23 -3
- package/src/glossary.ts +11 -1
- package/src/importCases.ts +21 -20
- package/src/inInstructions.ts +105 -0
- package/src/index.ts +2 -0
- package/src/reviews.ts +428 -0
- package/src/runner.ts +41 -0
- package/src/suiteContract.ts +56 -7
- package/src/suites/attackImport.ts +327 -0
- package/src/suites/crisisRisk.ts +15 -3
- package/src/suites/crisisRiskCases.ts +4 -3
- package/src/suites/crisisRiskReviews.ts +927 -0
- package/src/suites/hopelessness.ts +420 -0
- package/src/suites/hopelessnessCases.ts +287 -0
- package/src/suites/hopelessnessReviews.ts +1081 -0
- package/src/suites/index.ts +7 -0
- package/src/suites/injection.ts +463 -0
- package/src/suites/injectionAttacks.ts +136 -0
- package/src/testing.ts +144 -18
- package/src/types.ts +30 -0
- package/starter/index.ts +8 -0
- package/templates/app/evals/[suite]/compare/page.tsx +10 -0
- package/templates/app/evals/[suite]/page.tsx +55 -18
- package/templates/app/evals/[suite]/rate/page.tsx +10 -0
- package/templates/app/evals/[suite]/runs/[runId]/page.tsx +72 -3
- package/templates/app/evals/[suite]/side-by-side/page.tsx +37 -17
- package/templates/app/evals/feedback/page.tsx +6 -1
- package/templates/app/evals/page.tsx +36 -26
- package/templates/components/evalkeeper/AnswerKey.tsx +25 -1
- package/templates/components/evalkeeper/ReadableOutput.tsx +97 -0
- package/templates/components/evalkeeper/SettingsHistory.tsx +10 -4
- package/templates/lib/evalkeeper/actions.ts +4 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Metadata } from "next";
|
|
1
2
|
import Link from "next/link";
|
|
2
3
|
import { notFound } from "next/navigation";
|
|
3
4
|
import { ArrowLeft, ArrowRight, Check, Minus, X } from "lucide-react";
|
|
@@ -10,13 +11,29 @@ import {
|
|
|
10
11
|
} from "@crowandraven/evalkeeper";
|
|
11
12
|
import { DisagreementChip } from "@/components/evalkeeper/DisagreementChip";
|
|
12
13
|
import { FieldValues } from "@/components/evalkeeper/Fields";
|
|
14
|
+
import { ReadableOutput } from "@/components/evalkeeper/ReadableOutput";
|
|
13
15
|
import { InfoTip, Tip } from "@/components/evalkeeper/Tip";
|
|
14
16
|
import { BackLink, Card, pct } from "@/components/evalkeeper/ui";
|
|
15
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
MODELS,
|
|
19
|
+
requireAdmin,
|
|
20
|
+
runner,
|
|
21
|
+
store,
|
|
22
|
+
SUITE_BY_KEY,
|
|
23
|
+
} from "@/lib/evalkeeper";
|
|
16
24
|
import { evalsPath } from "@/lib/evalkeeper/paths";
|
|
17
25
|
|
|
18
26
|
export const dynamic = "force-dynamic";
|
|
19
27
|
|
|
28
|
+
export async function generateMetadata({
|
|
29
|
+
params,
|
|
30
|
+
}: {
|
|
31
|
+
params: Promise<{ suite: string }>;
|
|
32
|
+
}): Promise<Metadata> {
|
|
33
|
+
const { suite } = await params;
|
|
34
|
+
return { title: `Side by side: ${SUITE_BY_KEY[suite]?.label ?? "Evals"}` };
|
|
35
|
+
}
|
|
36
|
+
|
|
20
37
|
/** A search parameter as one string, or null when it's missing or repeated. */
|
|
21
38
|
const one = (v: string | string[] | undefined) =>
|
|
22
39
|
typeof v === "string" && v ? v : null;
|
|
@@ -118,23 +135,28 @@ export default async function SideBySidePage({
|
|
|
118
135
|
</div>
|
|
119
136
|
|
|
120
137
|
<Card className="grid gap-5 text-sm md:grid-cols-2">
|
|
121
|
-
<section className="space-y-2">
|
|
138
|
+
<section className="min-w-0 space-y-2">
|
|
122
139
|
<h2 className="text-xs font-semibold uppercase tracking-wide text-muted">
|
|
123
140
|
Input
|
|
124
141
|
</h2>
|
|
125
|
-
{suite
|
|
142
|
+
{/* A suite's own readable input (describe) reads best. */}
|
|
143
|
+
{suite.describe ? (
|
|
144
|
+
<pre className="readable text-xs whitespace-pre-wrap">
|
|
145
|
+
{suite.describe(input)}
|
|
146
|
+
</pre>
|
|
147
|
+
) : suite.fields ? (
|
|
126
148
|
<FieldValues
|
|
127
149
|
fields={suite.fields.input}
|
|
128
150
|
values={c.input}
|
|
129
151
|
prefix="in-"
|
|
130
152
|
/>
|
|
131
153
|
) : (
|
|
132
|
-
<pre className="readable whitespace-pre-wrap
|
|
133
|
-
{
|
|
154
|
+
<pre className="readable text-xs whitespace-pre-wrap">
|
|
155
|
+
{JSON.stringify(c.input, null, 2)}
|
|
134
156
|
</pre>
|
|
135
157
|
)}
|
|
136
158
|
</section>
|
|
137
|
-
<section className="space-y-2">
|
|
159
|
+
<section className="min-w-0 space-y-2">
|
|
138
160
|
<h2 className="text-xs font-semibold uppercase tracking-wide text-muted">
|
|
139
161
|
Expected answer
|
|
140
162
|
<InfoTip term="expectedAnswer" />
|
|
@@ -157,7 +179,7 @@ export default async function SideBySidePage({
|
|
|
157
179
|
|
|
158
180
|
<div className="grid gap-4 md:grid-cols-2">
|
|
159
181
|
<Side
|
|
160
|
-
|
|
182
|
+
side="inPlace"
|
|
161
183
|
run={result.a}
|
|
162
184
|
outputs={byRepeat(outA)}
|
|
163
185
|
suite={suite}
|
|
@@ -165,7 +187,7 @@ export default async function SideBySidePage({
|
|
|
165
187
|
runHref={evalsPath(key, "runs", a)}
|
|
166
188
|
/>
|
|
167
189
|
<Side
|
|
168
|
-
|
|
190
|
+
side="challenger"
|
|
169
191
|
run={result.b}
|
|
170
192
|
outputs={byRepeat(outB)}
|
|
171
193
|
suite={suite}
|
|
@@ -207,14 +229,14 @@ function StepLink({ href, dir }: { href?: string; dir: "previous" | "next" }) {
|
|
|
207
229
|
|
|
208
230
|
/** One test's answers to the case, with what each check found. */
|
|
209
231
|
function Side({
|
|
210
|
-
|
|
232
|
+
side,
|
|
211
233
|
run,
|
|
212
234
|
outputs,
|
|
213
235
|
suite,
|
|
214
236
|
score,
|
|
215
237
|
runHref,
|
|
216
238
|
}: {
|
|
217
|
-
|
|
239
|
+
side: "inPlace" | "challenger";
|
|
218
240
|
run: RunRecord;
|
|
219
241
|
outputs: OutputRecord[];
|
|
220
242
|
suite: AnySuite;
|
|
@@ -227,8 +249,8 @@ function Side({
|
|
|
227
249
|
<Card className="space-y-4 text-sm">
|
|
228
250
|
<div className="space-y-1">
|
|
229
251
|
<p className="text-xs font-semibold uppercase tracking-wide text-muted">
|
|
230
|
-
{
|
|
231
|
-
<InfoTip term={
|
|
252
|
+
{side === "inPlace" ? "In place" : "Challenger"}
|
|
253
|
+
<InfoTip term={side} id={`${side}-side`} />
|
|
232
254
|
</p>
|
|
233
255
|
<h2 className="text-lg font-semibold">
|
|
234
256
|
<Link href={runHref} className="hover:underline">
|
|
@@ -236,7 +258,7 @@ function Side({
|
|
|
236
258
|
</Link>
|
|
237
259
|
</h2>
|
|
238
260
|
{score !== null && (
|
|
239
|
-
<Tip term="caseScore" id={`${
|
|
261
|
+
<Tip term="caseScore" id={`${side}-score`}>
|
|
240
262
|
<span className="text-muted">Scored {pct(score)} on this case</span>
|
|
241
263
|
</Tip>
|
|
242
264
|
)}
|
|
@@ -257,12 +279,10 @@ function Side({
|
|
|
257
279
|
<FieldValues
|
|
258
280
|
fields={suite.fields.label}
|
|
259
281
|
values={suite.labelFromOutput(o.output)}
|
|
260
|
-
prefix={`${
|
|
282
|
+
prefix={`${side}-${o.repeat}-`}
|
|
261
283
|
/>
|
|
262
284
|
) : (
|
|
263
|
-
<
|
|
264
|
-
{JSON.stringify(o.output, null, 2)}
|
|
265
|
-
</pre>
|
|
285
|
+
<ReadableOutput value={o.output} />
|
|
266
286
|
)}
|
|
267
287
|
{checks.length > 0 && (
|
|
268
288
|
<ul className="space-y-1">
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { Metadata } from "next";
|
|
1
2
|
import {
|
|
2
3
|
asText,
|
|
4
|
+
isInjectionSuite,
|
|
3
5
|
thumbsSummary,
|
|
4
6
|
whyNotACase,
|
|
5
7
|
type AnySuite,
|
|
@@ -17,6 +19,8 @@ import { EVALS_BASE } from "@/lib/evalkeeper/paths";
|
|
|
17
19
|
|
|
18
20
|
export const dynamic = "force-dynamic";
|
|
19
21
|
|
|
22
|
+
export const metadata: Metadata = { title: "Feedback: Evals" };
|
|
23
|
+
|
|
20
24
|
/**
|
|
21
25
|
* What people thought of the AI's answers: thumbs per feature this week,
|
|
22
26
|
* and each rating waiting for a look, to make into a case or dismiss.
|
|
@@ -28,7 +32,8 @@ export default async function FeedbackPage() {
|
|
|
28
32
|
const open = all
|
|
29
33
|
.filter((f) => f.status === "OPEN")
|
|
30
34
|
.sort((a, b) => Number(b.rating === "DOWN") - Number(a.rating === "DOWN"));
|
|
31
|
-
const suiteFor = (op: string) =>
|
|
35
|
+
const suiteFor = (op: string) =>
|
|
36
|
+
SUITES.find((s) => s.operation === op && !isInjectionSuite(s));
|
|
32
37
|
const label = (op: string) => suiteFor(op)?.label ?? op;
|
|
33
38
|
|
|
34
39
|
return (
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { Metadata } from "next";
|
|
1
2
|
import Link from "next/link";
|
|
2
3
|
import {
|
|
3
4
|
attention,
|
|
5
|
+
isInjectionSuite,
|
|
4
6
|
perAnswer,
|
|
5
7
|
seconds,
|
|
6
8
|
suiteHealth,
|
|
@@ -29,6 +31,8 @@ import { ChevronDown } from "lucide-react";
|
|
|
29
31
|
|
|
30
32
|
export const dynamic = "force-dynamic";
|
|
31
33
|
|
|
34
|
+
export const metadata: Metadata = { title: "Evals" };
|
|
35
|
+
|
|
32
36
|
/** The evals hub: where each suite stands, and what needs attention. */
|
|
33
37
|
export default async function EvalsHub() {
|
|
34
38
|
await requireAdmin();
|
|
@@ -324,33 +328,39 @@ function SuiteCard({
|
|
|
324
328
|
</ul>
|
|
325
329
|
)}
|
|
326
330
|
|
|
327
|
-
{
|
|
328
|
-
<
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
331
|
+
{isInjectionSuite(b.suite) ? (
|
|
332
|
+
<p className="readable text-sm text-muted">
|
|
333
|
+
Shares {b.suite.base.label}'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
|
|
340
360
|
/>
|
|
341
|
-
</
|
|
342
|
-
</
|
|
343
|
-
|
|
344
|
-
<HistoryEntries
|
|
345
|
-
suite={b.suite.key}
|
|
346
|
-
entries={history}
|
|
347
|
-
liveId={version?.id ?? null}
|
|
348
|
-
label={label}
|
|
349
|
-
defaults={s}
|
|
350
|
-
plain
|
|
351
|
-
/>
|
|
352
|
-
</div>
|
|
353
|
-
</details>
|
|
361
|
+
</div>
|
|
362
|
+
</details>
|
|
363
|
+
)
|
|
354
364
|
)}
|
|
355
365
|
</Card>
|
|
356
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,
|
|
@@ -189,7 +204,8 @@ function CaseItem({
|
|
|
189
204
|
|
|
190
205
|
return (
|
|
191
206
|
<details
|
|
192
|
-
|
|
207
|
+
id={`case-${c.id}`}
|
|
208
|
+
className="group scroll-mt-4 rounded-md border border-line bg-card"
|
|
193
209
|
// Where ConfirmAnswer moves on to after confirming the case above.
|
|
194
210
|
data-pending={answer?.status === "PENDING" ? "true" : undefined}
|
|
195
211
|
>
|
|
@@ -205,6 +221,11 @@ function CaseItem({
|
|
|
205
221
|
<Tip term={status.term} id={`status-${c.id}`}>
|
|
206
222
|
<Chip tone={status.tone}>{status.text}</Chip>
|
|
207
223
|
</Tip>
|
|
224
|
+
{shipped && (
|
|
225
|
+
<Tip term={shipped.term} id={`reviewed-${c.id}`}>
|
|
226
|
+
<Chip tone="neutral">{shipped.text}</Chip>
|
|
227
|
+
</Tip>
|
|
228
|
+
)}
|
|
208
229
|
<Tip term={c.split === "TEST" ? "test" : "dev"} id={`split-${c.id}`}>
|
|
209
230
|
<Chip tone="neutral">{c.split === "TEST" ? "Test" : "Dev"}</Chip>
|
|
210
231
|
</Tip>
|
|
@@ -258,6 +279,9 @@ function CaseItem({
|
|
|
258
279
|
{JSON.stringify(answer?.value ?? null, null, 2)}
|
|
259
280
|
</pre>
|
|
260
281
|
)}
|
|
282
|
+
{shipped && answer?.note && (
|
|
283
|
+
<p className="readable text-xs text-muted">{answer.note}</p>
|
|
284
|
+
)}
|
|
261
285
|
{(tags.length > 0 || c.note) && (
|
|
262
286
|
<p className="readable text-xs text-muted">
|
|
263
287
|
{tags.length > 0 && `Tags: ${tags.join(", ")}. `}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { asText } from "@crowandraven/evalkeeper";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Any answer, readable, for suites without their own way to show it (no
|
|
5
|
+
* `labelFromOutput`): text as paragraphs, lists as bullets, small objects
|
|
6
|
+
* as one line each, and fields with their names, never raw JSON.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const label = (key: string) =>
|
|
10
|
+
key
|
|
11
|
+
.replace(/([a-z])([A-Z])/g, "$1 $2")
|
|
12
|
+
.replace(/_/g, " ")
|
|
13
|
+
.replace(/^./, (c) => c.toUpperCase());
|
|
14
|
+
|
|
15
|
+
function isPlain(v: unknown): v is string | number | boolean | null {
|
|
16
|
+
return v === null || ["string", "number", "boolean"].includes(typeof v);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function Inline({ value }: { value: unknown }) {
|
|
20
|
+
if (value === null || value === undefined || value === "")
|
|
21
|
+
return <span className="text-muted">–</span>;
|
|
22
|
+
if (typeof value === "boolean") return <>{value ? "Yes" : "No"}</>;
|
|
23
|
+
return <>{asText(value)}</>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** One line for a small object: its longest text first, then the rest. */
|
|
27
|
+
function Row({ value }: { value: Record<string, unknown> }) {
|
|
28
|
+
const entries = Object.entries(value);
|
|
29
|
+
const main = entries.find(([, v]) => typeof v === "string" && v.length > 20);
|
|
30
|
+
const rest = entries.filter(([k, v]) => k !== main?.[0] && isPlain(v));
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
{main ? asText(main[1]) : null}
|
|
34
|
+
{rest.length > 0 && (
|
|
35
|
+
<span className="text-xs text-muted">
|
|
36
|
+
{main ? " · " : ""}
|
|
37
|
+
{rest
|
|
38
|
+
.map(([k, v]) => `${label(k)}: ${v === null ? "–" : asText(v)}`)
|
|
39
|
+
.join(" · ")}
|
|
40
|
+
</span>
|
|
41
|
+
)}
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function ReadableOutput({ value }: { value: unknown }) {
|
|
47
|
+
if (isPlain(value))
|
|
48
|
+
return typeof value === "string" && value.length > 80 ? (
|
|
49
|
+
<p className="readable break-words whitespace-pre-wrap">{value}</p>
|
|
50
|
+
) : (
|
|
51
|
+
<span className="break-words">
|
|
52
|
+
<Inline value={value} />
|
|
53
|
+
</span>
|
|
54
|
+
);
|
|
55
|
+
if (Array.isArray(value)) {
|
|
56
|
+
if (!value.length) return <span className="text-muted">None</span>;
|
|
57
|
+
return (
|
|
58
|
+
<ul className="readable list-disc space-y-1 pl-5 break-words">
|
|
59
|
+
{value.map((v: unknown, i) => (
|
|
60
|
+
<li key={i}>
|
|
61
|
+
{isPlain(v) ? (
|
|
62
|
+
<Inline value={v} />
|
|
63
|
+
) : v &&
|
|
64
|
+
typeof v === "object" &&
|
|
65
|
+
!Array.isArray(v) &&
|
|
66
|
+
Object.values(v).every(isPlain) ? (
|
|
67
|
+
<Row value={v as Record<string, unknown>} />
|
|
68
|
+
) : (
|
|
69
|
+
<ReadableOutput value={v} />
|
|
70
|
+
)}
|
|
71
|
+
</li>
|
|
72
|
+
))}
|
|
73
|
+
</ul>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
if (value && typeof value === "object") {
|
|
77
|
+
// Long text (a letter, a summary) reads best first and in full.
|
|
78
|
+
const entries = Object.entries(value as Record<string, unknown>).sort(
|
|
79
|
+
(a, b) =>
|
|
80
|
+
Number(typeof b[1] === "string" && b[1].length > 80) -
|
|
81
|
+
Number(typeof a[1] === "string" && a[1].length > 80),
|
|
82
|
+
);
|
|
83
|
+
return (
|
|
84
|
+
<dl className="space-y-2">
|
|
85
|
+
{entries.map(([k, v]) => (
|
|
86
|
+
<div key={k}>
|
|
87
|
+
<dt className="text-xs text-muted">{label(k)}</dt>
|
|
88
|
+
<dd>
|
|
89
|
+
<ReadableOutput value={v} />
|
|
90
|
+
</dd>
|
|
91
|
+
</div>
|
|
92
|
+
))}
|
|
93
|
+
</dl>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
return <span className="text-muted">–</span>;
|
|
97
|
+
}
|
|
@@ -31,9 +31,9 @@ const KIND: Record<
|
|
|
31
31
|
help: "An earlier version made live again.",
|
|
32
32
|
},
|
|
33
33
|
DEPLOY: {
|
|
34
|
-
text: "
|
|
34
|
+
text: "New instructions",
|
|
35
35
|
tone: "fallback",
|
|
36
|
-
help:
|
|
36
|
+
help: GLOSSARY.newInstructions,
|
|
37
37
|
},
|
|
38
38
|
OUTSIDE: {
|
|
39
39
|
text: "Changed outside",
|
|
@@ -134,6 +134,9 @@ export function HistoryEntries({
|
|
|
134
134
|
const ev = (e.evidence ?? {}) as Evidence;
|
|
135
135
|
const testId = ev.runId ?? ev.live ?? null;
|
|
136
136
|
const isLive = e.to.id === liveId;
|
|
137
|
+
// Said outright: "same models" read as the app switching models.
|
|
138
|
+
const unchanged = (v: typeof e.to) =>
|
|
139
|
+
`Models unchanged: ${label(v.model)} live${v.fallbackModel ? `, ${label(v.fallbackModel)} fallback` : ""}`;
|
|
137
140
|
return (
|
|
138
141
|
<article
|
|
139
142
|
key={e.id}
|
|
@@ -160,9 +163,12 @@ export function HistoryEntries({
|
|
|
160
163
|
{(e.kind === "ROLLBACK"
|
|
161
164
|
? [`Back to v${e.to.number}: ${label(e.to.model)} live`]
|
|
162
165
|
: e.kind === "DEPLOY"
|
|
163
|
-
? ["
|
|
166
|
+
? [unchanged(e.to), "The instructions in code changed"]
|
|
164
167
|
: e.kind === "INSTRUCTIONS"
|
|
165
|
-
? [
|
|
168
|
+
? [
|
|
169
|
+
unchanged(e.to),
|
|
170
|
+
"The instructions were edited at runtime",
|
|
171
|
+
]
|
|
166
172
|
: describeChange(e.from, e.to, label)
|
|
167
173
|
).map((line) => (
|
|
168
174
|
<li key={line}>{line}</li>
|
|
@@ -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(
|
|
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);
|