@crowandraven/evalkeeper 0.13.0 → 0.15.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/dist/drafts.d.ts +2 -0
- package/dist/drafts.js +3 -1
- package/dist/drafts.js.map +1 -1
- package/dist/failures.d.ts +16 -0
- package/dist/failures.js +40 -0
- package/dist/failures.js.map +1 -0
- package/dist/health.js +2 -1
- package/dist/health.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/legs.d.ts +4 -1
- package/dist/legs.js +6 -2
- package/dist/legs.js.map +1 -1
- package/dist/next/actions.js +53 -9
- package/dist/next/actions.js.map +1 -1
- package/dist/next/route.js +2 -1
- package/dist/next/route.js.map +1 -1
- package/dist/next/weekly.d.ts +7 -2
- package/dist/next/weekly.js +5 -3
- package/dist/next/weekly.js.map +1 -1
- package/dist/prune.d.ts +4 -1
- package/dist/prune.js +11 -2
- package/dist/prune.js.map +1 -1
- package/dist/react/AddCase.d.ts +12 -2
- package/dist/react/AddCase.js +70 -8
- package/dist/react/AddCase.js.map +1 -1
- package/dist/react/AnswerKey.js +11 -5
- package/dist/react/AnswerKey.js.map +1 -1
- package/dist/react/CaseMenu.d.ts +6 -1
- package/dist/react/CaseMenu.js +5 -2
- package/dist/react/CaseMenu.js.map +1 -1
- package/dist/react/CompareView.js +4 -4
- package/dist/react/CompareView.js.map +1 -1
- package/dist/react/FeedbackView.js +3 -3
- package/dist/react/FeedbackView.js.map +1 -1
- package/dist/react/HubSections.js +3 -4
- package/dist/react/HubSections.js.map +1 -1
- package/dist/react/InfoPopover.d.ts +19 -0
- package/dist/react/InfoPopover.js +46 -0
- package/dist/react/InfoPopover.js.map +1 -0
- package/dist/react/PriorityPicker.d.ts +21 -0
- package/dist/react/PriorityPicker.js +33 -0
- package/dist/react/PriorityPicker.js.map +1 -0
- package/dist/react/RunView.js +21 -5
- package/dist/react/RunView.js.map +1 -1
- package/dist/react/SettingsHistory.d.ts +2 -1
- package/dist/react/SettingsHistory.js +34 -26
- package/dist/react/SettingsHistory.js.map +1 -1
- package/dist/react/ShowEarlier.d.ts +11 -0
- package/dist/react/ShowEarlier.js +19 -0
- package/dist/react/ShowEarlier.js.map +1 -0
- package/dist/react/SuiteSections.d.ts +10 -8
- package/dist/react/SuiteSections.js +99 -55
- package/dist/react/SuiteSections.js.map +1 -1
- package/dist/react/WeeklyCheck.js +4 -8
- package/dist/react/WeeklyCheck.js.map +1 -1
- package/dist/react/app.d.ts +2 -0
- package/dist/react/app.js.map +1 -1
- package/dist/react/format.d.ts +2 -2
- package/dist/react/format.js +4 -2
- package/dist/react/format.js.map +1 -1
- package/dist/react/pieces.d.ts +11 -0
- package/dist/react/pieces.js +17 -2
- package/dist/react/pieces.js.map +1 -1
- package/dist/runner.d.ts +7 -2
- package/dist/runner.js +12 -3
- package/dist/runner.js.map +1 -1
- package/dist/suggest.js +25 -7
- package/dist/suggest.js.map +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.js.map +1 -1
- package/dist/weekly.js +4 -2
- package/dist/weekly.js.map +1 -1
- package/package.json +10 -10
- package/src/drafts.ts +6 -1
- package/src/failures.ts +50 -0
- package/src/health.ts +2 -1
- package/src/index.ts +1 -0
- package/src/legs.ts +8 -2
- package/src/next/actions.ts +54 -9
- package/src/next/route.ts +2 -1
- package/src/next/weekly.ts +15 -4
- package/src/prune.ts +15 -1
- package/src/react/AddCase.tsx +98 -11
- package/src/react/AnswerKey.tsx +74 -14
- package/src/react/CaseMenu.tsx +24 -0
- package/src/react/CompareView.tsx +19 -4
- package/src/react/FeedbackView.tsx +13 -3
- package/src/react/HubSections.tsx +10 -5
- package/src/react/InfoPopover.tsx +100 -0
- package/src/react/PriorityPicker.tsx +122 -0
- package/src/react/RunView.tsx +41 -6
- package/src/react/SettingsHistory.tsx +114 -76
- package/src/react/ShowEarlier.tsx +57 -0
- package/src/react/SuiteSections.tsx +318 -260
- package/src/react/WeeklyCheck.tsx +26 -9
- package/src/react/app.ts +2 -0
- package/src/react/format.ts +4 -2
- package/src/react/pieces.tsx +34 -1
- package/src/runner.ts +18 -5
- package/src/suggest.ts +26 -7
- package/src/types.ts +2 -1
- package/src/weekly.ts +7 -2
- package/templates/lib/evalkeeper/actions.ts +4 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LINK } from "./format.js";
|
|
2
2
|
import {
|
|
3
3
|
GLOSSARY,
|
|
4
4
|
describeChange,
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
type Settings,
|
|
8
8
|
} from "../index.js";
|
|
9
9
|
import { RollBack } from "./RollBack.js";
|
|
10
|
-
import {
|
|
10
|
+
import { ShowEarlier } from "./ShowEarlier.js";
|
|
11
|
+
import { Link, Chip, InfoTip, Tip, LocalDate } from "./pieces.js";
|
|
11
12
|
import { evalsPath, type EvalAppConfig } from "./app.js";
|
|
12
13
|
|
|
13
14
|
const KIND: Record<
|
|
@@ -46,12 +47,16 @@ const KIND: Record<
|
|
|
46
47
|
},
|
|
47
48
|
};
|
|
48
49
|
|
|
50
|
+
/** A version's card, on the page's background. */
|
|
51
|
+
const BOX = "space-y-2 rounded-md border border-line bg-card p-3 text-sm";
|
|
52
|
+
|
|
49
53
|
type Evidence = { runId?: string | null; live?: string | null };
|
|
50
54
|
|
|
51
55
|
/**
|
|
52
56
|
* A feature's settings history: every switch, newest first, with what
|
|
53
57
|
* changed, who, why, and the evidence; any earlier version can be made
|
|
54
|
-
* live again, with a reason.
|
|
58
|
+
* live again, with a reason. The newest and live versions show; earlier
|
|
59
|
+
* ones open with a toggle.
|
|
55
60
|
*/
|
|
56
61
|
export function SettingsHistory({
|
|
57
62
|
app,
|
|
@@ -70,12 +75,33 @@ export function SettingsHistory({
|
|
|
70
75
|
/** The settings in code, shown as v1 until the first change. */
|
|
71
76
|
defaults: Settings;
|
|
72
77
|
}) {
|
|
78
|
+
const heading = (
|
|
79
|
+
<h2 id="history" className="text-lg font-semibold">
|
|
80
|
+
Versions
|
|
81
|
+
<InfoTip term="versions" />
|
|
82
|
+
</h2>
|
|
83
|
+
);
|
|
84
|
+
// The newest version shows, and the live one when it's older (the first
|
|
85
|
+
// that points at it: a rollback points at the version it restored).
|
|
86
|
+
const live = entries.findIndex((e) => e.to.id === liveId);
|
|
87
|
+
const recent = (_e: HistoryEntry, i: number) => i === 0 || i === live;
|
|
88
|
+
const entry = (e: HistoryEntry) => (
|
|
89
|
+
<VersionEntry key={e.id} {...{ app, suite, e, liveId, label, box: BOX }} />
|
|
90
|
+
);
|
|
91
|
+
if (entries.some((e, i) => !recent(e, i)))
|
|
92
|
+
return (
|
|
93
|
+
<section className="space-y-3" aria-labelledby="history">
|
|
94
|
+
<ShowEarlier
|
|
95
|
+
heading={heading}
|
|
96
|
+
noun="versions"
|
|
97
|
+
recent={entries.filter(recent).map(entry)}
|
|
98
|
+
earlier={entries.filter((e, i) => !recent(e, i)).map(entry)}
|
|
99
|
+
/>
|
|
100
|
+
</section>
|
|
101
|
+
);
|
|
73
102
|
return (
|
|
74
103
|
<section className="space-y-3" aria-labelledby="history">
|
|
75
|
-
|
|
76
|
-
Versions
|
|
77
|
-
<InfoTip term="versions" />
|
|
78
|
-
</h2>
|
|
104
|
+
{heading}
|
|
79
105
|
<HistoryEntries
|
|
80
106
|
app={app}
|
|
81
107
|
suite={suite}
|
|
@@ -112,7 +138,7 @@ export function HistoryEntries({
|
|
|
112
138
|
/** No tint behind each version, for a list already on a tint. */
|
|
113
139
|
plain?: boolean;
|
|
114
140
|
}) {
|
|
115
|
-
const box =
|
|
141
|
+
const box = plain ? "space-y-2 py-2 text-sm" : BOX;
|
|
116
142
|
if (entries.length === 0)
|
|
117
143
|
return (
|
|
118
144
|
<article aria-label="Version 1: Defaults" className={box}>
|
|
@@ -135,74 +161,86 @@ export function HistoryEntries({
|
|
|
135
161
|
);
|
|
136
162
|
return (
|
|
137
163
|
<div className="space-y-2">
|
|
138
|
-
{entries.map((e) =>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const testId = ev.runId ?? ev.live ?? null;
|
|
142
|
-
const isLive = e.to.id === liveId;
|
|
143
|
-
// Said outright: "same models" read as the app switching models.
|
|
144
|
-
const unchanged = (v: typeof e.to) =>
|
|
145
|
-
`Models unchanged: ${label(v.model)} live${v.fallbackModel ? `, ${label(v.fallbackModel)} fallback` : ""}`;
|
|
146
|
-
return (
|
|
147
|
-
<article
|
|
148
|
-
key={e.id}
|
|
149
|
-
aria-label={`Version ${e.to.number}: ${kind.text}`}
|
|
150
|
-
className={box}
|
|
151
|
-
>
|
|
152
|
-
<div className="flex flex-wrap items-center justify-between gap-2">
|
|
153
|
-
<span className="flex flex-wrap items-center gap-2">
|
|
154
|
-
<span className="font-medium">v{e.to.number}</span>
|
|
155
|
-
<Tip text={kind.help} id={`kind-${e.id}`}>
|
|
156
|
-
<Chip tone={kind.tone}>{kind.text}</Chip>
|
|
157
|
-
</Tip>
|
|
158
|
-
{isLive && <Chip tone="live">Live now</Chip>}
|
|
159
|
-
</span>
|
|
160
|
-
<span className="text-xs text-muted">
|
|
161
|
-
{e.by ??
|
|
162
|
-
(e.kind === "OUTSIDE"
|
|
163
|
-
? "Found by the system"
|
|
164
|
-
: "System")}{" "}
|
|
165
|
-
· {momentOf(e.createdAt)}
|
|
166
|
-
</span>
|
|
167
|
-
</div>
|
|
168
|
-
<ul className="readable list-disc pl-5">
|
|
169
|
-
{(e.kind === "ROLLBACK"
|
|
170
|
-
? [`Back to v${e.to.number}: ${label(e.to.model)} live`]
|
|
171
|
-
: e.kind === "DEPLOY"
|
|
172
|
-
? [unchanged(e.to), "The instructions in code changed"]
|
|
173
|
-
: e.kind === "INSTRUCTIONS"
|
|
174
|
-
? [
|
|
175
|
-
unchanged(e.to),
|
|
176
|
-
"The instructions were edited at runtime",
|
|
177
|
-
]
|
|
178
|
-
: describeChange(e.from, e.to, label)
|
|
179
|
-
).map((line) => (
|
|
180
|
-
<li key={line}>{line}</li>
|
|
181
|
-
))}
|
|
182
|
-
</ul>
|
|
183
|
-
{e.reason && <p className="readable text-muted">{e.reason}</p>}
|
|
184
|
-
<div className="flex flex-wrap items-center gap-3">
|
|
185
|
-
{testId && (
|
|
186
|
-
<Link
|
|
187
|
-
href={evalsPath(app, suite, "runs", testId)}
|
|
188
|
-
className={`text-xs ${LINK}`}
|
|
189
|
-
>
|
|
190
|
-
The test behind it
|
|
191
|
-
</Link>
|
|
192
|
-
)}
|
|
193
|
-
{!isLive && (
|
|
194
|
-
<RollBack
|
|
195
|
-
action={app.actions.rollBackSettings}
|
|
196
|
-
suite={suite}
|
|
197
|
-
versionId={e.to.id}
|
|
198
|
-
number={e.to.number}
|
|
199
|
-
kind={e.kind}
|
|
200
|
-
/>
|
|
201
|
-
)}
|
|
202
|
-
</div>
|
|
203
|
-
</article>
|
|
204
|
-
);
|
|
205
|
-
})}
|
|
164
|
+
{entries.map((e) => (
|
|
165
|
+
<VersionEntry key={e.id} {...{ app, suite, e, liveId, label, box }} />
|
|
166
|
+
))}
|
|
206
167
|
</div>
|
|
207
168
|
);
|
|
208
169
|
}
|
|
170
|
+
|
|
171
|
+
/** One version: what changed, who and when, why, its evidence, and rollback. */
|
|
172
|
+
function VersionEntry({
|
|
173
|
+
app,
|
|
174
|
+
suite,
|
|
175
|
+
e,
|
|
176
|
+
liveId,
|
|
177
|
+
label,
|
|
178
|
+
box,
|
|
179
|
+
}: {
|
|
180
|
+
app: EvalAppConfig;
|
|
181
|
+
suite: string;
|
|
182
|
+
e: HistoryEntry;
|
|
183
|
+
liveId: string | null;
|
|
184
|
+
label: (model: string) => string;
|
|
185
|
+
box: string;
|
|
186
|
+
}) {
|
|
187
|
+
const kind = KIND[e.kind];
|
|
188
|
+
const ev = (e.evidence ?? {}) as Evidence;
|
|
189
|
+
const testId = ev.runId ?? ev.live ?? null;
|
|
190
|
+
const isLive = e.to.id === liveId;
|
|
191
|
+
// Said outright: "same models" read as the app switching models.
|
|
192
|
+
const unchanged = (v: typeof e.to) =>
|
|
193
|
+
`Models unchanged: ${label(v.model)} live${v.fallbackModel ? `, ${label(v.fallbackModel)} fallback` : ""}`;
|
|
194
|
+
return (
|
|
195
|
+
<article
|
|
196
|
+
aria-label={`Version ${e.to.number}: ${kind.text}`}
|
|
197
|
+
className={box}
|
|
198
|
+
>
|
|
199
|
+
<div className="flex flex-wrap items-center justify-between gap-2">
|
|
200
|
+
<span className="flex flex-wrap items-center gap-2">
|
|
201
|
+
<span className="font-medium">v{e.to.number}</span>
|
|
202
|
+
<Tip text={kind.help} id={`kind-${e.id}`}>
|
|
203
|
+
<Chip tone={kind.tone}>{kind.text}</Chip>
|
|
204
|
+
</Tip>
|
|
205
|
+
{isLive && <Chip tone="live">Live now</Chip>}
|
|
206
|
+
</span>
|
|
207
|
+
<span className="text-xs text-muted">
|
|
208
|
+
{e.by ?? (e.kind === "OUTSIDE" ? "Found by the system" : "System")} ·{" "}
|
|
209
|
+
<LocalDate date={e.createdAt} time />
|
|
210
|
+
</span>
|
|
211
|
+
</div>
|
|
212
|
+
<ul className="readable list-disc pl-5">
|
|
213
|
+
{(e.kind === "ROLLBACK"
|
|
214
|
+
? [`Back to v${e.to.number}: ${label(e.to.model)} live`]
|
|
215
|
+
: e.kind === "DEPLOY"
|
|
216
|
+
? [unchanged(e.to), "The instructions in code changed"]
|
|
217
|
+
: e.kind === "INSTRUCTIONS"
|
|
218
|
+
? [unchanged(e.to), "The instructions were edited at runtime"]
|
|
219
|
+
: describeChange(e.from, e.to, label)
|
|
220
|
+
).map((line) => (
|
|
221
|
+
<li key={line}>{line}</li>
|
|
222
|
+
))}
|
|
223
|
+
</ul>
|
|
224
|
+
{e.reason && <p className="readable text-muted">{e.reason}</p>}
|
|
225
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
226
|
+
{testId && (
|
|
227
|
+
<Link
|
|
228
|
+
href={evalsPath(app, suite, "runs", testId)}
|
|
229
|
+
className={`text-xs ${LINK}`}
|
|
230
|
+
>
|
|
231
|
+
The test behind it
|
|
232
|
+
</Link>
|
|
233
|
+
)}
|
|
234
|
+
{!isLive && (
|
|
235
|
+
<RollBack
|
|
236
|
+
action={app.actions.rollBackSettings}
|
|
237
|
+
suite={suite}
|
|
238
|
+
versionId={e.to.id}
|
|
239
|
+
number={e.to.number}
|
|
240
|
+
kind={e.kind}
|
|
241
|
+
/>
|
|
242
|
+
)}
|
|
243
|
+
</div>
|
|
244
|
+
</article>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useId, useState } from "react";
|
|
4
|
+
import { ChevronDown } from "lucide-react";
|
|
5
|
+
import { Button } from "./pieces.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A section whose earlier items stay folded until asked for: the heading
|
|
9
|
+
* with a toggle across from it, the recent items, then the rest when open.
|
|
10
|
+
*/
|
|
11
|
+
export function ShowEarlier({
|
|
12
|
+
heading,
|
|
13
|
+
recent,
|
|
14
|
+
earlier,
|
|
15
|
+
noun,
|
|
16
|
+
}: {
|
|
17
|
+
heading: React.ReactNode;
|
|
18
|
+
recent: React.ReactNode;
|
|
19
|
+
earlier: React.ReactNode[];
|
|
20
|
+
/** What the items are, plural: "versions". */
|
|
21
|
+
noun: string;
|
|
22
|
+
}) {
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
const id = useId();
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<div className="flex items-center justify-between gap-4">
|
|
28
|
+
{heading}
|
|
29
|
+
<Button
|
|
30
|
+
type="button"
|
|
31
|
+
aria-expanded={open}
|
|
32
|
+
aria-controls={open ? id : undefined}
|
|
33
|
+
onClick={() => {
|
|
34
|
+
setOpen(!open);
|
|
35
|
+
}}
|
|
36
|
+
className="inline-flex items-center gap-1 text-sm text-muted hover:text-ink"
|
|
37
|
+
>
|
|
38
|
+
{open
|
|
39
|
+
? `Hide earlier ${noun}`
|
|
40
|
+
: `Show ${earlier.length} earlier ${earlier.length === 1 ? noun.replace(/s$/, "") : noun}`}
|
|
41
|
+
<ChevronDown
|
|
42
|
+
aria-hidden
|
|
43
|
+
className={`h-4 w-4 transition-transform ${open ? "rotate-180" : ""}`}
|
|
44
|
+
/>
|
|
45
|
+
</Button>
|
|
46
|
+
</div>
|
|
47
|
+
<div className="space-y-2">
|
|
48
|
+
{recent}
|
|
49
|
+
{open && (
|
|
50
|
+
<div id={id} className="space-y-2">
|
|
51
|
+
{earlier}
|
|
52
|
+
</div>
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
</>
|
|
56
|
+
);
|
|
57
|
+
}
|