@crowandraven/evalkeeper 0.10.0 → 0.11.1
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 +1 -2
- package/dist/ai-sdk/decide.d.ts +35 -0
- package/dist/ai-sdk/decide.js +36 -0
- package/dist/ai-sdk/decide.js.map +1 -0
- package/dist/ai-sdk/hash.d.ts +50 -0
- package/dist/ai-sdk/hash.js +59 -0
- package/dist/ai-sdk/hash.js.map +1 -0
- package/dist/ai-sdk/index.d.ts +15 -0
- package/dist/ai-sdk/index.js +16 -0
- package/dist/ai-sdk/index.js.map +1 -0
- package/dist/ai-sdk/judge.d.ts +69 -0
- package/dist/ai-sdk/judge.js +105 -0
- package/dist/ai-sdk/judge.js.map +1 -0
- package/dist/ai-sdk/usage.d.ts +18 -0
- package/dist/ai-sdk/usage.js +19 -0
- package/dist/ai-sdk/usage.js.map +1 -0
- package/dist/board.d.ts +5 -0
- package/dist/cli/addPages.d.ts +6 -1
- package/dist/cli/addPages.js +14 -8
- package/dist/cli/addPages.js.map +1 -1
- package/dist/cli/main.d.ts +19 -5
- package/dist/cli/main.js +100 -4
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/migration.d.ts +95 -0
- package/dist/cli/migration.js +247 -0
- package/dist/cli/migration.js.map +1 -0
- package/dist/feedback.d.ts +1 -1
- package/dist/glossary.d.ts +8 -1
- package/dist/glossary.js +8 -1
- package/dist/glossary.js.map +1 -1
- package/dist/inInstructions.d.ts +1 -1
- package/dist/inInstructions.js +1 -1
- package/dist/next/RefreshWhile.d.ts +11 -0
- package/dist/next/RefreshWhile.js +28 -0
- package/dist/next/RefreshWhile.js.map +1 -0
- package/dist/next/actions.d.ts +14 -0
- package/dist/next/actions.js +332 -0
- package/dist/next/actions.js.map +1 -0
- package/dist/next/components.d.ts +9 -0
- package/dist/next/components.js +27 -0
- package/dist/next/components.js.map +1 -0
- package/dist/next/cron.d.ts +9 -0
- package/dist/next/cron.js +17 -0
- package/dist/next/cron.js.map +1 -0
- package/dist/next/index.d.ts +15 -0
- package/dist/next/index.js +16 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/pages.d.ts +70 -0
- package/dist/next/pages.js +77 -0
- package/dist/next/pages.js.map +1 -0
- package/dist/next/route.d.ts +19 -0
- package/dist/next/route.js +31 -0
- package/dist/next/route.js.map +1 -0
- package/dist/next/weekly.d.ts +20 -0
- package/dist/next/weekly.js +55 -0
- package/dist/next/weekly.js.map +1 -0
- package/dist/next/wiring.d.ts +19 -0
- package/dist/next/wiring.js +2 -0
- package/dist/next/wiring.js.map +1 -0
- package/dist/prisma/contracts.d.ts +74 -0
- package/dist/prisma/contracts.js +178 -0
- package/dist/prisma/contracts.js.map +1 -0
- package/dist/prisma/index.d.ts +423 -0
- package/dist/prisma/index.js +622 -0
- package/dist/prisma/index.js.map +1 -0
- package/dist/prisma/mapping.d.ts +63 -0
- package/dist/prisma/mapping.js +111 -0
- package/dist/prisma/mapping.js.map +1 -0
- package/dist/prisma/moveIn.d.ts +106 -0
- package/dist/prisma/moveIn.js +299 -0
- package/dist/prisma/moveIn.js.map +1 -0
- package/dist/prune.d.ts +45 -0
- package/dist/prune.js +32 -0
- package/dist/prune.js.map +1 -1
- package/dist/react/AddCase.d.ts +10 -0
- package/dist/react/AddCase.js +19 -0
- package/dist/react/AddCase.js.map +1 -0
- package/dist/react/AnswerKey.d.ts +22 -0
- package/dist/react/AnswerKey.js +83 -0
- package/dist/react/AnswerKey.js.map +1 -0
- package/dist/react/CaseMenu.d.ts +17 -0
- package/dist/react/CaseMenu.js +41 -0
- package/dist/react/CaseMenu.js.map +1 -0
- package/dist/react/CompareView.d.ts +14 -0
- package/dist/react/CompareView.js +51 -0
- package/dist/react/CompareView.js.map +1 -0
- package/dist/react/ConfirmAnswer.d.ts +13 -0
- package/dist/react/ConfirmAnswer.js +27 -0
- package/dist/react/ConfirmAnswer.js.map +1 -0
- package/dist/react/DisagreementChip.d.ts +10 -0
- package/dist/react/DisagreementChip.js +21 -0
- package/dist/react/DisagreementChip.js.map +1 -0
- package/dist/react/FeedbackView.d.ts +10 -0
- package/dist/react/FeedbackView.js +26 -0
- package/dist/react/FeedbackView.js.map +1 -0
- package/dist/react/Fields.d.ts +32 -0
- package/dist/react/Fields.js +33 -0
- package/dist/react/Fields.js.map +1 -0
- package/dist/react/HubSections.d.ts +78 -0
- package/dist/react/HubSections.js +124 -0
- package/dist/react/HubSections.js.map +1 -0
- package/dist/react/ModelMenu.d.ts +16 -0
- package/dist/react/ModelMenu.js +38 -0
- package/dist/react/ModelMenu.js.map +1 -0
- package/dist/react/RateView.d.ts +18 -0
- package/dist/react/RateView.js +30 -0
- package/dist/react/RateView.js.map +1 -0
- package/dist/react/ReadableOutput.d.ts +3 -0
- package/dist/react/ReadableOutput.js +50 -0
- package/dist/react/ReadableOutput.js.map +1 -0
- package/dist/react/RollBack.d.ts +17 -0
- package/dist/react/RollBack.js +26 -0
- package/dist/react/RollBack.js.map +1 -0
- package/dist/react/RunView.d.ts +9 -0
- package/dist/react/RunView.js +41 -0
- package/dist/react/RunView.js.map +1 -0
- package/dist/react/SettingsHistory.d.ts +33 -0
- package/dist/react/SettingsHistory.js +79 -0
- package/dist/react/SettingsHistory.js.map +1 -0
- package/dist/react/SideBySideView.d.ts +14 -0
- package/dist/react/SideBySideView.js +67 -0
- package/dist/react/SideBySideView.js.map +1 -0
- package/dist/react/SuiteSections.d.ts +111 -0
- package/dist/react/SuiteSections.js +224 -0
- package/dist/react/SuiteSections.js.map +1 -0
- package/dist/react/Tabs.d.ts +15 -0
- package/dist/react/Tabs.js +18 -0
- package/dist/react/Tabs.js.map +1 -0
- package/dist/react/Thumbs.d.ts +13 -0
- package/dist/react/Thumbs.js +54 -0
- package/dist/react/Thumbs.js.map +1 -0
- package/dist/react/WeeklyCheck.d.ts +11 -0
- package/dist/react/WeeklyCheck.js +19 -0
- package/dist/react/WeeklyCheck.js.map +1 -0
- package/dist/react/app.d.ts +118 -0
- package/dist/react/app.js +87 -0
- package/dist/react/app.js.map +1 -0
- package/dist/react/format.d.ts +27 -0
- package/dist/react/format.js +38 -0
- package/dist/react/format.js.map +1 -0
- package/dist/react/index.d.ts +31 -0
- package/dist/react/index.js +32 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/pieces.d.ts +191 -0
- package/dist/react/pieces.js +191 -0
- package/dist/react/pieces.js.map +1 -0
- package/dist/readCheck.d.ts +1 -1
- package/dist/runner.d.ts +62 -2
- package/dist/runner.js +123 -3
- package/dist/runner.js.map +1 -1
- package/dist/settings.d.ts +1 -1
- package/dist/store.d.ts +1 -1
- package/dist/suggest.d.ts +1 -1
- package/dist/suggest.js +7 -7
- package/dist/suggest.js.map +1 -1
- package/dist/suiteContract.d.ts +3 -3
- package/dist/suiteContract.js +20 -16
- package/dist/suiteContract.js.map +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +56 -6
- package/schema/evalkeeper.prisma +196 -0
- package/src/ai-sdk/decide.ts +57 -0
- package/src/ai-sdk/hash.ts +74 -0
- package/src/ai-sdk/index.ts +15 -0
- package/src/ai-sdk/judge.ts +163 -0
- package/src/ai-sdk/usage.ts +31 -0
- package/src/board.ts +5 -0
- package/src/cli/addPages.ts +15 -7
- package/src/cli/main.ts +135 -9
- package/src/cli/migration.ts +349 -0
- package/src/feedback.ts +1 -1
- package/src/glossary.ts +16 -2
- package/src/inInstructions.ts +1 -1
- package/{templates/components/evalkeeper → src/next}/RefreshWhile.tsx +2 -2
- package/src/next/actions.ts +389 -0
- package/src/next/components.ts +31 -0
- package/{templates/lib/evalkeeper/cronAuth.ts → src/next/cron.ts} +3 -0
- package/src/next/index.ts +15 -0
- package/src/next/pages.tsx +106 -0
- package/src/next/route.ts +35 -0
- package/src/next/weekly.ts +70 -0
- package/src/next/wiring.ts +18 -0
- package/src/prisma/contracts.ts +249 -0
- package/src/prisma/index.ts +1169 -0
- package/src/prisma/mapping.ts +147 -0
- package/src/prisma/moveIn.ts +502 -0
- package/src/prune.ts +77 -0
- package/{templates/components/evalkeeper → src/react}/AddCase.tsx +6 -6
- package/{templates/components/evalkeeper → src/react}/AnswerKey.tsx +92 -61
- package/{templates/components/evalkeeper → src/react}/CaseMenu.tsx +9 -8
- package/src/react/CompareView.tsx +270 -0
- package/{templates/components/evalkeeper → src/react}/ConfirmAnswer.tsx +6 -3
- package/{templates/components/evalkeeper → src/react}/DisagreementChip.tsx +2 -3
- package/src/react/FeedbackView.tsx +230 -0
- package/{templates/components/evalkeeper → src/react}/Fields.tsx +6 -6
- package/src/react/HubSections.tsx +446 -0
- package/src/react/ModelMenu.tsx +89 -0
- package/src/react/RateView.tsx +143 -0
- package/{templates/components/evalkeeper → src/react}/ReadableOutput.tsx +1 -1
- package/{templates/components/evalkeeper → src/react}/RollBack.tsx +9 -10
- package/src/react/RunView.tsx +151 -0
- package/{templates/components/evalkeeper → src/react}/SettingsHistory.tsx +16 -9
- package/src/react/SideBySideView.tsx +307 -0
- package/src/react/SuiteSections.tsx +925 -0
- package/src/react/Tabs.tsx +61 -0
- package/{templates/components/evalkeeper → src/react}/Thumbs.tsx +7 -6
- package/{templates/components/evalkeeper → src/react}/WeeklyCheck.tsx +31 -20
- package/src/react/app.ts +173 -0
- package/src/react/format.ts +45 -0
- package/src/react/index.ts +31 -0
- package/src/react/pieces.tsx +412 -0
- package/src/readCheck.ts +1 -1
- package/src/runner.ts +167 -3
- package/src/settings.ts +1 -1
- package/src/store.ts +1 -1
- package/src/suggest.ts +7 -7
- package/src/suiteContract.ts +35 -28
- package/src/testing.ts +2 -2
- package/src/types.ts +2 -2
- package/starter/index.ts +22 -8
- package/templates/app/api/cron/evals-weekly/route.ts +5 -15
- package/templates/app/evals/[suite]/compare/page.tsx +6 -383
- package/templates/app/evals/[suite]/page.tsx +7 -685
- package/templates/app/evals/[suite]/rate/page.tsx +6 -151
- package/templates/app/evals/[suite]/runs/[runId]/page.tsx +6 -174
- package/templates/app/evals/[suite]/side-by-side/page.tsx +6 -318
- package/templates/app/evals/feedback/page.tsx +6 -227
- package/templates/app/evals/layout.tsx +10 -0
- package/templates/app/evals/page.tsx +7 -397
- package/templates/lib/evalkeeper/actions.ts +34 -317
- package/templates/lib/evalkeeper/appComponents.tsx +21 -0
- package/templates/lib/evalkeeper/evals.ts +14 -0
- package/templates/lib/evalkeeper/paths.ts +2 -7
- package/templates/components/evalkeeper/Submit.tsx +0 -67
- package/templates/components/evalkeeper/Tip.tsx +0 -98
- package/templates/components/evalkeeper/ui.tsx +0 -105
- package/templates/lib/evalkeeper/time.ts +0 -4
- package/templates/lib/evalkeeper/weekly.ts +0 -74
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { type ComponentType, type ReactNode } from "react";
|
|
2
|
+
import { type GlossaryTerm } from "../glossary.js";
|
|
3
|
+
import type { HealthStatus } from "../health.js";
|
|
4
|
+
/**
|
|
5
|
+
* The pieces Evalkeeper's screens are built from. Each draws Evalkeeper's
|
|
6
|
+
* own by default, and your app's when you name one in
|
|
7
|
+
* `EvalComponentsProvider`. Every piece is a client component, so yours
|
|
8
|
+
* must be too (a file starting `"use client"`, or a component library's
|
|
9
|
+
* client components).
|
|
10
|
+
*/
|
|
11
|
+
declare const CHIP: {
|
|
12
|
+
readonly live: "bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300";
|
|
13
|
+
readonly fallback: "bg-sky-100 text-sky-800 dark:bg-sky-500/15 dark:text-sky-200";
|
|
14
|
+
readonly warn: "bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-200";
|
|
15
|
+
readonly serious: "bg-red-50 text-red-800 dark:bg-red-500/10 dark:text-red-200";
|
|
16
|
+
readonly neutral: "bg-tint text-muted";
|
|
17
|
+
};
|
|
18
|
+
/** A chip's color. */
|
|
19
|
+
export type ChipTone = keyof typeof CHIP;
|
|
20
|
+
/** A box around a section of a page. */
|
|
21
|
+
export type CardProps = {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
className?: string;
|
|
24
|
+
};
|
|
25
|
+
/** A small label and its color. */
|
|
26
|
+
export type ChipProps = {
|
|
27
|
+
tone: ChipTone;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
};
|
|
30
|
+
/** A link: where it goes, its words, and Evalkeeper's classes. */
|
|
31
|
+
export type LinkProps = {
|
|
32
|
+
href: string;
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
className?: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
};
|
|
37
|
+
/** Where a back link goes, and its words. */
|
|
38
|
+
export type BackLinkProps = {
|
|
39
|
+
href: string;
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
};
|
|
42
|
+
/** A score: parts right of parts expected. */
|
|
43
|
+
export type ScoreProps = {
|
|
44
|
+
right: number;
|
|
45
|
+
total: number;
|
|
46
|
+
};
|
|
47
|
+
/** A form's submit button: its words, its weight, and whether it's off. */
|
|
48
|
+
export type SubmitProps = {
|
|
49
|
+
children: ReactNode;
|
|
50
|
+
variant?: "primary" | "quiet";
|
|
51
|
+
/** Off until the form is ready; wrap it in a `<Tip>` saying why. */
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
};
|
|
54
|
+
/** An icon-only submit button's accessible name and icon. */
|
|
55
|
+
export type IconSubmitProps = {
|
|
56
|
+
label: string;
|
|
57
|
+
icon: ReactNode;
|
|
58
|
+
};
|
|
59
|
+
/** What a tooltip explains: a glossary term, or your own text. */
|
|
60
|
+
export type InfoTipProps = {
|
|
61
|
+
/** A glossary entry, or your own text with `text`. */
|
|
62
|
+
term?: GlossaryTerm;
|
|
63
|
+
text?: string;
|
|
64
|
+
/** Unique per page when the same term shows more than once. */
|
|
65
|
+
id?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Where it opens. "bottom" inside a scrolling container (a table), whose
|
|
68
|
+
* top edge would cut it off.
|
|
69
|
+
*/
|
|
70
|
+
side?: "top" | "bottom";
|
|
71
|
+
/** "end" near a container's right edge, so it opens leftward. */
|
|
72
|
+
align?: "center" | "end";
|
|
73
|
+
};
|
|
74
|
+
/** What a tooltip explains, and the thing it wraps. */
|
|
75
|
+
export type TipProps = InfoTipProps & {
|
|
76
|
+
children: ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* The child is a control that takes focus itself (a button), so the
|
|
79
|
+
* wrapper isn't a second tab stop.
|
|
80
|
+
*/
|
|
81
|
+
control?: boolean;
|
|
82
|
+
};
|
|
83
|
+
/** Whether a test is running, so the page should keep refreshing. */
|
|
84
|
+
export type RefreshWhileProps = {
|
|
85
|
+
active: boolean;
|
|
86
|
+
};
|
|
87
|
+
/** A plain button: a toggle, a menu item, a step in a form. */
|
|
88
|
+
export type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
89
|
+
/** A one-line text field. */
|
|
90
|
+
export type TextInputProps = React.InputHTMLAttributes<HTMLInputElement>;
|
|
91
|
+
/** A multi-line text field. */
|
|
92
|
+
export type TextAreaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
93
|
+
/** A dropdown of options, given as `<option>` children. */
|
|
94
|
+
export type SelectProps = React.SelectHTMLAttributes<HTMLSelectElement>;
|
|
95
|
+
/**
|
|
96
|
+
* Every piece you can replace. Each gets the props Evalkeeper's own would,
|
|
97
|
+
* its `className` included, which yours can use or ignore. Controls must
|
|
98
|
+
* render the native element (or pass `name` and the value to one), so
|
|
99
|
+
* forms still submit.
|
|
100
|
+
*/
|
|
101
|
+
export type EvalComponents = {
|
|
102
|
+
Card: ComponentType<CardProps>;
|
|
103
|
+
Chip: ComponentType<ChipProps>;
|
|
104
|
+
Link: ComponentType<LinkProps>;
|
|
105
|
+
BackLink: ComponentType<BackLinkProps>;
|
|
106
|
+
Score: ComponentType<ScoreProps>;
|
|
107
|
+
Submit: ComponentType<SubmitProps>;
|
|
108
|
+
IconSubmit: ComponentType<IconSubmitProps>;
|
|
109
|
+
Spinner: ComponentType;
|
|
110
|
+
Tip: ComponentType<TipProps>;
|
|
111
|
+
InfoTip: ComponentType<InfoTipProps>;
|
|
112
|
+
Button: ComponentType<ButtonProps>;
|
|
113
|
+
TextInput: ComponentType<TextInputProps>;
|
|
114
|
+
TextArea: ComponentType<TextAreaProps>;
|
|
115
|
+
Select: ComponentType<SelectProps>;
|
|
116
|
+
RefreshWhile: ComponentType<RefreshWhileProps>;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Draws Evalkeeper's screens inside it with your app's components. Render
|
|
120
|
+
* it once around the eval pages (a layout), from a client component of
|
|
121
|
+
* your own that imports your components:
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```tsx
|
|
125
|
+
* "use client";
|
|
126
|
+
* import Link from "next/link";
|
|
127
|
+
* import { EvalComponentsProvider } from "@crowandraven/evalkeeper/react";
|
|
128
|
+
* import { Button } from "@/components/ui/button";
|
|
129
|
+
*
|
|
130
|
+
* export function AppComponents({ children }: { children: React.ReactNode }) {
|
|
131
|
+
* return (
|
|
132
|
+
* <EvalComponentsProvider components={{ Link, Button }}>
|
|
133
|
+
* {children}
|
|
134
|
+
* </EvalComponentsProvider>
|
|
135
|
+
* );
|
|
136
|
+
* }
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* @param props - Your components (any of `EvalComponents`; the rest stay
|
|
140
|
+
* Evalkeeper's) and the screens to draw with them.
|
|
141
|
+
*/
|
|
142
|
+
export declare function EvalComponentsProvider({ components, children, }: {
|
|
143
|
+
components: Partial<EvalComponents>;
|
|
144
|
+
children: ReactNode;
|
|
145
|
+
}): import("react").JSX.Element;
|
|
146
|
+
/** A box around a section of a page. */
|
|
147
|
+
export declare function Card(props: CardProps): import("react").JSX.Element;
|
|
148
|
+
/** A small rounded label: Live, Fallback, Retires …, serious, minor. */
|
|
149
|
+
export declare function Chip(props: ChipProps): import("react").JSX.Element;
|
|
150
|
+
/** A suite's health as a chip; the card's details say why. */
|
|
151
|
+
export declare function StatusBadge({ status }: {
|
|
152
|
+
status: HealthStatus;
|
|
153
|
+
}): import("react").JSX.Element;
|
|
154
|
+
/**
|
|
155
|
+
* A link to another page. A plain `<a>` by default; pass your router's
|
|
156
|
+
* link (Next.js's `Link`, say) to move between pages without a reload.
|
|
157
|
+
*/
|
|
158
|
+
export declare function Link(props: LinkProps): import("react").JSX.Element;
|
|
159
|
+
/** A link back to the page above, with an arrow. */
|
|
160
|
+
export declare function BackLink(props: BackLinkProps): import("react").JSX.Element;
|
|
161
|
+
/** A score with a thin bar, for tables. */
|
|
162
|
+
export declare function Score(props: ScoreProps): import("react").JSX.Element;
|
|
163
|
+
/** The rotating loader, while something runs. */
|
|
164
|
+
export declare function Spinner(): import("react").JSX.Element;
|
|
165
|
+
/** A submit button that spins while its form's action runs. */
|
|
166
|
+
export declare function Submit(props: SubmitProps): import("react").JSX.Element;
|
|
167
|
+
/**
|
|
168
|
+
* An icon-only submit button. `label` is its accessible name; wrap it in a
|
|
169
|
+
* `<Tip control>` for the tooltip. The icon turns into the loader while the
|
|
170
|
+
* action runs.
|
|
171
|
+
*/
|
|
172
|
+
export declare function IconSubmit(props: IconSubmitProps): import("react").JSX.Element;
|
|
173
|
+
/** A small (i) button that explains the label before it. */
|
|
174
|
+
export declare function InfoTip(props: InfoTipProps): import("react").JSX.Element;
|
|
175
|
+
/** Explains whatever it wraps (a chip, a number) on hover and focus. */
|
|
176
|
+
export declare function Tip(props: TipProps): import("react").JSX.Element;
|
|
177
|
+
/** A plain button: the native `<button>` unless your app names its own. */
|
|
178
|
+
export declare function Button(props: ButtonProps): import("react").JSX.Element;
|
|
179
|
+
/** A one-line text field: the native `<input>` unless your app names its own. */
|
|
180
|
+
export declare function TextInput(props: TextInputProps): import("react").JSX.Element;
|
|
181
|
+
/** A multi-line text field: the native `<textarea>` unless your app names its own. */
|
|
182
|
+
export declare function TextArea(props: TextAreaProps): import("react").JSX.Element;
|
|
183
|
+
/** A dropdown: the native `<select>` unless your app names its own. */
|
|
184
|
+
export declare function Select(props: SelectProps): import("react").JSX.Element;
|
|
185
|
+
/**
|
|
186
|
+
* Keeps a page up to date while a test runs. Refreshing is your router's
|
|
187
|
+
* job (Next.js's `router.refresh()`), so this draws nothing unless your
|
|
188
|
+
* app names its own `RefreshWhile`; without one, reload to see results.
|
|
189
|
+
*/
|
|
190
|
+
export declare function RefreshWhile(props: RefreshWhileProps): import("react").ReactElement<RefreshWhileProps, string | import("react").JSXElementConstructor<any>> | null;
|
|
191
|
+
export {};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, createElement, useContext, } from "react";
|
|
4
|
+
import { useFormStatus } from "react-dom";
|
|
5
|
+
import { ArrowLeft, Info, LoaderCircle } from "lucide-react";
|
|
6
|
+
import { GLOSSARY } from "../glossary.js";
|
|
7
|
+
import { pct, QUIET_BUTTON } from "./format.js";
|
|
8
|
+
/**
|
|
9
|
+
* The pieces Evalkeeper's screens are built from. Each draws Evalkeeper's
|
|
10
|
+
* own by default, and your app's when you name one in
|
|
11
|
+
* `EvalComponentsProvider`. Every piece is a client component, so yours
|
|
12
|
+
* must be too (a file starting `"use client"`, or a component library's
|
|
13
|
+
* client components).
|
|
14
|
+
*/
|
|
15
|
+
const CHIP = {
|
|
16
|
+
live: "bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300",
|
|
17
|
+
fallback: "bg-sky-100 text-sky-800 dark:bg-sky-500/15 dark:text-sky-200",
|
|
18
|
+
warn: "bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-200",
|
|
19
|
+
serious: "bg-red-50 text-red-800 dark:bg-red-500/10 dark:text-red-200",
|
|
20
|
+
neutral: "bg-tint text-muted",
|
|
21
|
+
};
|
|
22
|
+
const Swapped = createContext({});
|
|
23
|
+
/**
|
|
24
|
+
* Draws Evalkeeper's screens inside it with your app's components. Render
|
|
25
|
+
* it once around the eval pages (a layout), from a client component of
|
|
26
|
+
* your own that imports your components:
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* "use client";
|
|
31
|
+
* import Link from "next/link";
|
|
32
|
+
* import { EvalComponentsProvider } from "@crowandraven/evalkeeper/react";
|
|
33
|
+
* import { Button } from "@/components/ui/button";
|
|
34
|
+
*
|
|
35
|
+
* export function AppComponents({ children }: { children: React.ReactNode }) {
|
|
36
|
+
* return (
|
|
37
|
+
* <EvalComponentsProvider components={{ Link, Button }}>
|
|
38
|
+
* {children}
|
|
39
|
+
* </EvalComponentsProvider>
|
|
40
|
+
* );
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param props - Your components (any of `EvalComponents`; the rest stay
|
|
45
|
+
* Evalkeeper's) and the screens to draw with them.
|
|
46
|
+
*/
|
|
47
|
+
export function EvalComponentsProvider({ components, children, }) {
|
|
48
|
+
return _jsx(Swapped.Provider, { value: components, children: children });
|
|
49
|
+
}
|
|
50
|
+
/** The app's piece by name, or undefined to draw Evalkeeper's. */
|
|
51
|
+
const useSwapped = (name) => useContext(Swapped)[name];
|
|
52
|
+
/** A box around a section of a page. */
|
|
53
|
+
export function Card(props) {
|
|
54
|
+
const C = useSwapped("Card");
|
|
55
|
+
if (C)
|
|
56
|
+
return createElement(C, props);
|
|
57
|
+
const { children, className = "" } = props;
|
|
58
|
+
return (_jsx("section", { className: `rounded-lg border border-line bg-card p-5 ${className}`, children: children }));
|
|
59
|
+
}
|
|
60
|
+
/** A small rounded label: Live, Fallback, Retires …, serious, minor. */
|
|
61
|
+
export function Chip(props) {
|
|
62
|
+
const C = useSwapped("Chip");
|
|
63
|
+
if (C)
|
|
64
|
+
return createElement(C, props);
|
|
65
|
+
return (_jsx("span", { className: `inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-xs font-medium leading-none ${CHIP[props.tone]}`, children: props.children }));
|
|
66
|
+
}
|
|
67
|
+
const STATUS = {
|
|
68
|
+
good: { label: "Good", tone: "live" },
|
|
69
|
+
fair: { label: "Fair", tone: "warn" },
|
|
70
|
+
improve: { label: "Needs work", tone: "serious" },
|
|
71
|
+
few: { label: "Few cases", tone: "warn" },
|
|
72
|
+
stale: { label: "Retest", tone: "warn" },
|
|
73
|
+
untested: { label: "Untested", tone: "neutral" },
|
|
74
|
+
};
|
|
75
|
+
/** A suite's health as a chip; the card's details say why. */
|
|
76
|
+
export function StatusBadge({ status }) {
|
|
77
|
+
const s = STATUS[status];
|
|
78
|
+
return _jsx(Chip, { tone: s.tone, children: s.label });
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A link to another page. A plain `<a>` by default; pass your router's
|
|
82
|
+
* link (Next.js's `Link`, say) to move between pages without a reload.
|
|
83
|
+
*/
|
|
84
|
+
export function Link(props) {
|
|
85
|
+
const C = useSwapped("Link");
|
|
86
|
+
if (C)
|
|
87
|
+
return createElement(C, props);
|
|
88
|
+
const { href, children, className, title } = props;
|
|
89
|
+
return (_jsx("a", { href: href, className: className, title: title, children: children }));
|
|
90
|
+
}
|
|
91
|
+
/** A link back to the page above, with an arrow. */
|
|
92
|
+
export function BackLink(props) {
|
|
93
|
+
const C = useSwapped("BackLink");
|
|
94
|
+
if (C)
|
|
95
|
+
return createElement(C, props);
|
|
96
|
+
return (_jsxs(Link, { href: props.href, className: "inline-flex items-center gap-1 text-sm text-muted hover:text-ink", children: [_jsx(ArrowLeft, { "aria-hidden": true, className: "h-4 w-4" }), props.children] }));
|
|
97
|
+
}
|
|
98
|
+
/** A score with a thin bar, for tables. */
|
|
99
|
+
export function Score(props) {
|
|
100
|
+
const C = useSwapped("Score");
|
|
101
|
+
if (C)
|
|
102
|
+
return createElement(C, props);
|
|
103
|
+
const { right, total } = props;
|
|
104
|
+
const rate = total ? right / total : 0;
|
|
105
|
+
return (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "w-10 tabular-nums", children: pct(rate) }), _jsx("span", { className: "h-1.5 w-20 rounded-full bg-tint", children: _jsx("span", { className: "block h-1.5 rounded-full bg-accent", style: { width: `${rate * 100}%` } }) }), _jsxs("span", { className: "text-xs text-muted tabular-nums", children: [Math.round(right), "/", Math.round(total)] })] }));
|
|
106
|
+
}
|
|
107
|
+
/** The rotating loader, while something runs. */
|
|
108
|
+
export function Spinner() {
|
|
109
|
+
const C = useSwapped("Spinner");
|
|
110
|
+
if (C)
|
|
111
|
+
return createElement(C);
|
|
112
|
+
return _jsx(LoaderCircle, { "aria-hidden": true, className: "h-3.5 w-3.5 animate-spin" });
|
|
113
|
+
}
|
|
114
|
+
/** A submit button that spins while its form's action runs. */
|
|
115
|
+
export function Submit(props) {
|
|
116
|
+
const C = useSwapped("Submit");
|
|
117
|
+
const { pending } = useFormStatus();
|
|
118
|
+
if (C)
|
|
119
|
+
return createElement(C, props);
|
|
120
|
+
const { children, variant = "primary", disabled = false } = props;
|
|
121
|
+
return (_jsxs("button", { type: "submit", disabled: pending || disabled, className: `inline-flex items-center gap-2 whitespace-nowrap rounded-md px-3 py-1.5 text-sm disabled:opacity-60 ${variant === "primary" ? "bg-accent text-white" : QUIET_BUTTON}`, children: [pending && _jsx(Spinner, {}), children] }));
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* An icon-only submit button. `label` is its accessible name; wrap it in a
|
|
125
|
+
* `<Tip control>` for the tooltip. The icon turns into the loader while the
|
|
126
|
+
* action runs.
|
|
127
|
+
*/
|
|
128
|
+
export function IconSubmit(props) {
|
|
129
|
+
const C = useSwapped("IconSubmit");
|
|
130
|
+
const { pending } = useFormStatus();
|
|
131
|
+
if (C)
|
|
132
|
+
return createElement(C, props);
|
|
133
|
+
return (_jsx("button", { type: "submit", "aria-label": props.label, disabled: pending, className: "inline-flex h-8 w-8 items-center justify-center rounded-md border border-line bg-card text-ink hover:bg-tint disabled:opacity-60", children: pending ? _jsx(Spinner, {}) : props.icon }));
|
|
134
|
+
}
|
|
135
|
+
const tipText = (p) => p.text ?? (p.term ? GLOSSARY[p.term] : "");
|
|
136
|
+
const tipId = (p) => `tip-${p.id ?? p.term ?? "info"}`;
|
|
137
|
+
/**
|
|
138
|
+
* Tooltips explain how things work. They open on hover and on keyboard
|
|
139
|
+
* focus, and screen readers read the text as the element's description.
|
|
140
|
+
* CSS shows them; the named group (group/tip) keeps one from opening when
|
|
141
|
+
* an outer "group" (an open case) is hovered.
|
|
142
|
+
*/
|
|
143
|
+
function Bubble({ id, text, side = "top", align = "center", }) {
|
|
144
|
+
return (_jsx("span", { role: "tooltip", id: id, className: `pointer-events-none invisible absolute ${side === "top" ? "bottom-full mb-2" : "top-full mt-2"} ${align === "end" ? "right-0" : "left-1/2 -translate-x-1/2"} z-20 w-64 rounded-md border border-line bg-card px-3 py-2 text-left text-xs font-normal normal-case leading-snug tracking-normal text-ink opacity-0 shadow-lg transition-opacity group-focus-within/tip:visible group-focus-within/tip:opacity-100 group-hover/tip:visible group-hover/tip:opacity-100`, children: text }));
|
|
145
|
+
}
|
|
146
|
+
/** A small (i) button that explains the label before it. */
|
|
147
|
+
export function InfoTip(props) {
|
|
148
|
+
const C = useSwapped("InfoTip");
|
|
149
|
+
if (C)
|
|
150
|
+
return createElement(C, props);
|
|
151
|
+
const id = tipId(props);
|
|
152
|
+
return (_jsxs("span", { className: "group/tip relative ml-1 inline-flex align-middle", children: [_jsx("button", { type: "button", "aria-describedby": id, "aria-label": "What's this?", className: "inline-flex h-4 w-4 items-center justify-center rounded-full text-muted hover:text-ink", children: _jsx(Info, { "aria-hidden": true, className: "h-3.5 w-3.5" }) }), _jsx(Bubble, { id: id, text: tipText(props), side: props.side, align: props.align })] }));
|
|
153
|
+
}
|
|
154
|
+
/** Explains whatever it wraps (a chip, a number) on hover and focus. */
|
|
155
|
+
export function Tip(props) {
|
|
156
|
+
const C = useSwapped("Tip");
|
|
157
|
+
if (C)
|
|
158
|
+
return createElement(C, props);
|
|
159
|
+
const id = tipId(props);
|
|
160
|
+
return (_jsxs("span", { className: "group/tip relative inline-flex", ...(props.control ? {} : { tabIndex: 0, "aria-describedby": id }), children: [props.children, _jsx(Bubble, { id: id, text: tipText(props), side: props.side, align: props.align })] }));
|
|
161
|
+
}
|
|
162
|
+
/** A plain button: the native `<button>` unless your app names its own. */
|
|
163
|
+
export function Button(props) {
|
|
164
|
+
const C = useSwapped("Button");
|
|
165
|
+
return C ? createElement(C, props) : _jsx("button", { ...props });
|
|
166
|
+
}
|
|
167
|
+
/** A one-line text field: the native `<input>` unless your app names its own. */
|
|
168
|
+
export function TextInput(props) {
|
|
169
|
+
const C = useSwapped("TextInput");
|
|
170
|
+
return C ? createElement(C, props) : _jsx("input", { ...props });
|
|
171
|
+
}
|
|
172
|
+
/** A multi-line text field: the native `<textarea>` unless your app names its own. */
|
|
173
|
+
export function TextArea(props) {
|
|
174
|
+
const C = useSwapped("TextArea");
|
|
175
|
+
return C ? createElement(C, props) : _jsx("textarea", { ...props });
|
|
176
|
+
}
|
|
177
|
+
/** A dropdown: the native `<select>` unless your app names its own. */
|
|
178
|
+
export function Select(props) {
|
|
179
|
+
const C = useSwapped("Select");
|
|
180
|
+
return C ? createElement(C, props) : _jsx("select", { ...props });
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Keeps a page up to date while a test runs. Refreshing is your router's
|
|
184
|
+
* job (Next.js's `router.refresh()`), so this draws nothing unless your
|
|
185
|
+
* app names its own `RefreshWhile`; without one, reload to see results.
|
|
186
|
+
*/
|
|
187
|
+
export function RefreshWhile(props) {
|
|
188
|
+
const C = useSwapped("RefreshWhile");
|
|
189
|
+
return C ? createElement(C, props) : null;
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=pieces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pieces.js","sourceRoot":"","sources":["../../src/react/pieces.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,GAGX,MAAM,OAAO,CA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FAAsF;AACtF,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,MAAM,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACjC,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,sBAAc,KAAK,GAAI,CAAC;AAC/D,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,MAAM,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,oBAAY,KAAK,GAAI,CAAC;AAC7D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,CAAC,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IACrC,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,CAAC"}
|
package/dist/readCheck.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export type ReadRow = Readonly<Record<string, unknown>>;
|
|
|
43
43
|
/**
|
|
44
44
|
* Where a read check reads rows from: a store's records
|
|
45
45
|
* (`checkStoreReads`), or an adapter's raw rows before it fills in
|
|
46
|
-
* defaults (`prismaReadCheck` in `@crowandraven/evalkeeper
|
|
46
|
+
* defaults (`prismaReadCheck` in `@crowandraven/evalkeeper/prisma`), so a
|
|
47
47
|
* value the store would quietly replace still shows. Cases come with
|
|
48
48
|
* their answers in `labels`.
|
|
49
49
|
*/
|
package/dist/runner.d.ts
CHANGED
|
@@ -32,14 +32,14 @@ export type RunnerOptions = {
|
|
|
32
32
|
models: ModelCatalog;
|
|
33
33
|
/**
|
|
34
34
|
* The current instructions' hash for an operation (see instructionsHash
|
|
35
|
-
* in `@crowandraven/evalkeeper
|
|
35
|
+
* in `@crowandraven/evalkeeper/ai-sdk`). A test records it, so editing the instructions
|
|
36
36
|
* marks older tests out of date.
|
|
37
37
|
*/
|
|
38
38
|
promptVersion: (operation: string) => string | Promise<string>;
|
|
39
39
|
/**
|
|
40
40
|
* Everything the operation's model is told, as text: system text, prompt
|
|
41
41
|
* templates, schema and tool descriptions (`instructionParts` in
|
|
42
|
-
* `@crowandraven/evalkeeper
|
|
42
|
+
* `@crowandraven/evalkeeper/ai-sdk`, from the parts you hash). Lets
|
|
43
43
|
* `casesInInstructions` warn when a case was copied into them.
|
|
44
44
|
*/
|
|
45
45
|
instructionTexts?: (operation: string) => string[] | Promise<string[]>;
|
|
@@ -182,6 +182,63 @@ export declare function createRunner(opts: RunnerOptions): {
|
|
|
182
182
|
rows: BoardRow[];
|
|
183
183
|
liveRunId: string | null;
|
|
184
184
|
}[]>;
|
|
185
|
+
modelsFor: (operation: string) => string[];
|
|
186
|
+
createTest: (args: Parameters<(args: {
|
|
187
|
+
suite: string;
|
|
188
|
+
model: string;
|
|
189
|
+
set?: EvalSet;
|
|
190
|
+
repeats?: number;
|
|
191
|
+
/** Who started it; null for a scheduled check. */
|
|
192
|
+
startedBy?: string | null;
|
|
193
|
+
/** A reasoning setting to test; undefined: the operation's own. */
|
|
194
|
+
reasoningEffort?: ReasoningEffort | null;
|
|
195
|
+
/** A temperature to test; undefined: the operation's live one. */
|
|
196
|
+
temperature?: number | null;
|
|
197
|
+
/** An output cap to test; undefined: the operation's live one. */
|
|
198
|
+
maxOutputTokens?: number | null;
|
|
199
|
+
/** For the estimate: pass the same `fresh` to runEval. */
|
|
200
|
+
fresh?: boolean;
|
|
201
|
+
}) => Promise<{
|
|
202
|
+
run: RunRecord;
|
|
203
|
+
estimate: {
|
|
204
|
+
cases: number;
|
|
205
|
+
/** Answers the test will need: cases times repeats. */
|
|
206
|
+
answers: number;
|
|
207
|
+
/** Of those, answers an identical earlier request will give for free. */
|
|
208
|
+
reused: number;
|
|
209
|
+
costUsd: number | null;
|
|
210
|
+
};
|
|
211
|
+
}>>[0]) => Promise<{
|
|
212
|
+
runs: RunRecord[];
|
|
213
|
+
estimate: {
|
|
214
|
+
cases: number;
|
|
215
|
+
answers: number;
|
|
216
|
+
reused: number;
|
|
217
|
+
costUsd: number | null;
|
|
218
|
+
};
|
|
219
|
+
}>;
|
|
220
|
+
estimateTest: (suiteKey: string, model: string, set: EvalSet, repeats: number, o?: Parameters<(suiteKey: string, model: string, set: EvalSet, repeats: number, o?: {
|
|
221
|
+
/** Never reuse: every answer is a new call. */
|
|
222
|
+
fresh?: boolean;
|
|
223
|
+
/** The setting to test; undefined: the operation's live one. */
|
|
224
|
+
reasoningEffort?: ReasoningEffort | null;
|
|
225
|
+
/** The temperature to test; undefined: the operation's live one. */
|
|
226
|
+
temperature?: number | null;
|
|
227
|
+
/** The output cap to test; undefined: the operation's live one. */
|
|
228
|
+
maxOutputTokens?: number | null;
|
|
229
|
+
}) => Promise<{
|
|
230
|
+
cases: number;
|
|
231
|
+
/** Answers the test will need: cases times repeats. */
|
|
232
|
+
answers: number;
|
|
233
|
+
/** Of those, answers an identical earlier request will give for free. */
|
|
234
|
+
reused: number;
|
|
235
|
+
costUsd: number | null;
|
|
236
|
+
}>>[4]) => Promise<{
|
|
237
|
+
cases: number;
|
|
238
|
+
answers: number;
|
|
239
|
+
reused: number;
|
|
240
|
+
costUsd: number | null;
|
|
241
|
+
}>;
|
|
185
242
|
suiteOrThrow: (key: string) => AnySuite;
|
|
186
243
|
casesFor: (suite: string, set: EvalSet) => Promise<CaseRecord[]>;
|
|
187
244
|
estimateRun: (suiteKey: string, model: string, set: EvalSet, repeats: number, o?: {
|
|
@@ -231,6 +288,9 @@ export declare function createRunner(opts: RunnerOptions): {
|
|
|
231
288
|
gradeOutput: (suite: AnySuite, c: CaseRecord, output: unknown, onCost?: (usd: number) => void) => Promise<CheckResult[]>;
|
|
232
289
|
rescoreRun: (runId: string) => Promise<void>;
|
|
233
290
|
rescoreRecent: (suiteKey: string, limit?: number) => Promise<void>;
|
|
291
|
+
answerKeyHealth: (suiteKey: string, today?: Date) => Promise<import("./prune.js").AnswerKeyHealth<CaseRecord>>;
|
|
292
|
+
retireEasy: (suiteKey: string) => Promise<number>;
|
|
293
|
+
retireStaleDrafts: (suiteKey: string, today?: Date) => Promise<number>;
|
|
234
294
|
stopStuckRuns: (suiteKey: string, now?: number) => Promise<void>;
|
|
235
295
|
compare: (suiteKey: string, a: string, b: string) => Promise<{
|
|
236
296
|
suite: AnySuite;
|