@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.
- package/dist/feedback.d.ts +3 -1
- package/dist/feedback.js +3 -1
- package/dist/feedback.js.map +1 -1
- package/dist/glossary.d.ts +3 -0
- package/dist/glossary.js +3 -0
- 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/index.d.ts +1 -0
- package/dist/index.js +1 -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/suiteContract.d.ts +3 -2
- package/dist/suiteContract.js +5 -2
- 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 +9 -2
- package/dist/suites/hopelessness.js +8 -5
- package/dist/suites/hopelessness.js.map +1 -1
- package/dist/suites/hopelessnessCases.d.ts +3 -2
- package/dist/suites/hopelessnessCases.js +3 -2
- package/dist/suites/hopelessnessCases.js.map +1 -1
- 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 +5 -0
- package/dist/suites/index.js +5 -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/types.d.ts +21 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/feedback.ts +3 -1
- package/src/glossary.ts +6 -0
- package/src/importCases.ts +21 -20
- package/src/index.ts +1 -0
- package/src/reviews.ts +428 -0
- package/src/suiteContract.ts +5 -2
- 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 +15 -5
- package/src/suites/hopelessnessCases.ts +3 -2
- package/src/suites/hopelessnessReviews.ts +1081 -0
- package/src/suites/index.ts +5 -0
- package/src/suites/injection.ts +463 -0
- package/src/suites/injectionAttacks.ts +136 -0
- package/src/types.ts +24 -0
- package/templates/app/evals/feedback/page.tsx +3 -1
- package/templates/app/evals/page.tsx +33 -26
- package/templates/components/evalkeeper/AnswerKey.tsx +23 -0
- package/templates/lib/evalkeeper/actions.ts +4 -1
package/dist/feedback.d.ts
CHANGED
|
@@ -100,7 +100,9 @@ export declare function whyNotACase(f: FeedbackRecord, suite: AnySuite | undefin
|
|
|
100
100
|
*
|
|
101
101
|
* @example
|
|
102
102
|
* ```ts
|
|
103
|
-
* const suite = SUITES.find(
|
|
103
|
+
* const suite = SUITES.find(
|
|
104
|
+
* (s) => s.operation === rating.operation && !isInjectionSuite(s),
|
|
105
|
+
* );
|
|
104
106
|
* const draft = suite ? caseFromFeedback(rating, suite) : null;
|
|
105
107
|
* if (draft) await store.createCase(draft);
|
|
106
108
|
* ```
|
package/dist/feedback.js
CHANGED
|
@@ -52,7 +52,9 @@ export function whyNotACase(f, suite) {
|
|
|
52
52
|
*
|
|
53
53
|
* @example
|
|
54
54
|
* ```ts
|
|
55
|
-
* const suite = SUITES.find(
|
|
55
|
+
* const suite = SUITES.find(
|
|
56
|
+
* (s) => s.operation === rating.operation && !isInjectionSuite(s),
|
|
57
|
+
* );
|
|
56
58
|
* const draft = suite ? caseFromFeedback(rating, suite) : null;
|
|
57
59
|
* if (draft) await store.createCase(draft);
|
|
58
60
|
* ```
|
package/dist/feedback.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedback.js","sourceRoot":"","sources":["../src/feedback.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAwF/C,yEAAyE;AACzE,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC;AAChC,sCAAsC;AACtC,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC;AAEjC,yFAAyF;AACzF,MAAM,UAAU,WAAW,CAAC,CAAY;IACtC,MAAM,IAAI,GAAG,CAAC,CAA4B,EAAE,GAAW,EAAE,EAAE;QACzD,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAClC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACtB,CAAC,CAAC;IACF,OAAO;QACL,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;QAClC,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,MAAM,EAAE,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI;QAC/D,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,EA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AE,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI;YAC/B,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,EAAE,EAAE,CAAC;YACL,IAAI,EAAE,CAAC;YACP,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,CAAC;SACR,CAAC;QACF,IAAI,CAAC,CAAC,MAAM,KAAK,IAAI;YAAE,CAAC,CAAC,EAAE,EAAE,CAAC;aACzB,CAAC;YACJ,CAAC,CAAC,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM;gBAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACpC,CAAC;QACD,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;SACpB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,GAAG,CAAC;QACJ,SAAS,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;QAC1D,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;KACjC,CAAC,CAAC;SACF,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAC/E,CAAC"}
|
package/dist/glossary.d.ts
CHANGED
|
@@ -19,6 +19,9 @@ export declare const GLOSSARY: {
|
|
|
19
19
|
readonly confirmed: "A person said this answer is right. Tests grade against it.";
|
|
20
20
|
readonly provisional: "Put to use before anyone reviewed it. Tests use it, and every score says it rests on unreviewed answers.";
|
|
21
21
|
readonly pending: "Proposed and not reviewed yet. Tests never grade against it until a person confirms it.";
|
|
22
|
+
readonly authorReviewed: "Confirmed by the suite's author, who checked this case once for every app that uses the suite. Your own confirmed answer replaces it.";
|
|
23
|
+
readonly fromBaseCase: "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.";
|
|
24
|
+
readonly expertReviewed: "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.";
|
|
22
25
|
readonly dev: "Cases you tune against: change prompts and checks while looking at these.";
|
|
23
26
|
readonly test: "Cases you only check: never tune against them, so they show how a change does on cases it wasn't fitted to.";
|
|
24
27
|
readonly suggestion: "Fixed rules pick it, so the reason given is the real one: accuracy first, then the suite's priority. Nothing changes until you choose.";
|
package/dist/glossary.js
CHANGED
|
@@ -19,6 +19,9 @@ export const GLOSSARY = {
|
|
|
19
19
|
confirmed: "A person said this answer is right. Tests grade against it.",
|
|
20
20
|
provisional: "Put to use before anyone reviewed it. Tests use it, and every score says it rests on unreviewed answers.",
|
|
21
21
|
pending: "Proposed and not reviewed yet. Tests never grade against it until a person confirms it.",
|
|
22
|
+
authorReviewed: "Confirmed by the suite's author, who checked this case once for every app that uses the suite. Your own confirmed answer replaces it.",
|
|
23
|
+
fromBaseCase: "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.",
|
|
24
|
+
expertReviewed: "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.",
|
|
22
25
|
dev: "Cases you tune against: change prompts and checks while looking at these.",
|
|
23
26
|
test: "Cases you only check: never tune against them, so they show how a change does on cases it wasn't fitted to.",
|
|
24
27
|
suggestion: "Fixed rules pick it, so the reason given is the real one: accuracy first, then the suite's priority. Nothing changes until you choose.",
|
package/dist/glossary.js.map
CHANGED
|
@@ -1 +1 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wFAAwF;IAC1F,IAAI,EAAE,wEAAwE;IAC9E,OAAO,EACL,+GAA+G;IACjH,OAAO,EACL,qEAAqE;IACvE,SAAS,EAAE,iEAAiE;IAC5E,MAAM,EACJ,6FAA6F;IAC/F,SAAS,EACP,qJAAqJ;IACvJ,QAAQ,EACN,iLAAiL;IACnL,SAAS,EACP,8MAA8M;IAChN,SAAS,EACP,oJAAoJ;IACtJ,IAAI,EAAE,oJAAoJ;IAC1J,WAAW,EACT,+FAA+F;IACjG,WAAW,EACT,mLAAmL;IACrL,aAAa,EACX,gKAAgK;IAClK,QAAQ,EACN,iMAAiM;IACnM,cAAc,EACZ,8KAA8K;IAChL,cAAc,EACZ,yKAAyK;IAC3K,eAAe,EACb,kGAAkG;IACpG,kBAAkB,EAChB,mLAAmL;IACrL,MAAM,EACJ,0KAA0K;IAC5K,SAAS,EACP,0MAA0M;IAC5M,MAAM,EACJ,4MAA4M;IAC9M,kBAAkB,EAChB,wKAAwK;IAC1K,gBAAgB,EACd,wKAAwK;IAC1K,mBAAmB,EACjB,+FAA+F;IACjG,qBAAqB,EACnB,qIAAqI;IACvI,UAAU,EACR,yIAAyI;IAC3I,OAAO,EACL,mGAAmG;IACrG,UAAU,EACR,sGAAsG;IACxG,OAAO,EACL,mJAAmJ;IACrJ,WAAW,EAAE,qDAAqD;IAClE,mBAAmB,EACjB,mJAAmJ;IACrJ,QAAQ,EACN,mFAAmF;IACrF,aAAa,EACX,+IAA+I;IACjJ,KAAK,EAAE,qEAAqE;IAC5E,KAAK,EAAE,qEAAqE;IAC5E,iBAAiB,EACf,4IAA4I;IAC9I,SAAS,EACP,6IAA6I;IAC/I,UAAU,EACR,sIAAsI;IACxI,cAAc,EACZ,2GAA2G;CACrG,CAAC"}
|
package/dist/importCases.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReviewResult } from "./reviews.js";
|
|
1
2
|
import type { EvalStore } from "./store.js";
|
|
2
3
|
import type { AnySuite } from "./types.js";
|
|
3
4
|
/** One row of an import, mapped to the suite's shapes. */
|
|
@@ -158,8 +159,18 @@ export declare function importCases<Row>(opts: {
|
|
|
158
159
|
}): Promise<ImportResult>;
|
|
159
160
|
/**
|
|
160
161
|
* Adds a suite's `starter` cases as drafts with pending answers, for a
|
|
161
|
-
* person to confirm on the pages.
|
|
162
|
-
*
|
|
163
|
-
* as in
|
|
162
|
+
* person to confirm on the pages. A case with a review shipped with the
|
|
163
|
+
* suite (`reviews`: its author or an expert checked it) gets that review
|
|
164
|
+
* as a confirmed answer instead, and is in use at once; see
|
|
165
|
+
* `addShippedReviews` for when one is left out. Safe to run again:
|
|
166
|
+
* starters already added (by their input) are skipped, and reviews shipped
|
|
167
|
+
* since are added to them. A suite's leak check runs on each, as in
|
|
168
|
+
* `importCases`.
|
|
169
|
+
*
|
|
170
|
+
* @param store - Where to add the cases.
|
|
171
|
+
* @param suite - The suite whose `starter` cases and `reviews` to add.
|
|
172
|
+
* @returns What was added and skipped, what the leak check removed, how
|
|
173
|
+
* many shipped reviews were added, and cases whose answer from someone
|
|
174
|
+
* in the app differs from a shipped review.
|
|
164
175
|
*/
|
|
165
|
-
export declare function importStarters(store: EvalStore, suite: AnySuite): Promise<ImportResult>;
|
|
176
|
+
export declare function importStarters(store: EvalStore, suite: AnySuite): Promise<ImportResult & ReviewResult>;
|
package/dist/importCases.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { nextSplit } from "./quickSet.js";
|
|
2
|
-
import {
|
|
2
|
+
import { addShippedReviews, starterKey } from "./reviews.js";
|
|
3
3
|
/** Rows that don't fit the suite. Nothing was written. */
|
|
4
4
|
export class CaseImportError extends Error {
|
|
5
5
|
problems;
|
|
@@ -250,30 +250,31 @@ export async function importCases(opts) {
|
|
|
250
250
|
}
|
|
251
251
|
return { added, skipped, removed };
|
|
252
252
|
}
|
|
253
|
-
/** A short, stable id for a starter case: a hash of its input. */
|
|
254
|
-
function starterId(input) {
|
|
255
|
-
// FNV-1a: the core stays free of node:crypto; this only names rows.
|
|
256
|
-
let h = 0x811c9dc5;
|
|
257
|
-
for (const ch of stableJson(input)) {
|
|
258
|
-
h ^= ch.charCodeAt(0);
|
|
259
|
-
h = Math.imul(h, 0x01000193) >>> 0;
|
|
260
|
-
}
|
|
261
|
-
return h.toString(16).padStart(8, "0");
|
|
262
|
-
}
|
|
263
253
|
/**
|
|
264
254
|
* Adds a suite's `starter` cases as drafts with pending answers, for a
|
|
265
|
-
* person to confirm on the pages.
|
|
266
|
-
*
|
|
267
|
-
* as in
|
|
255
|
+
* person to confirm on the pages. A case with a review shipped with the
|
|
256
|
+
* suite (`reviews`: its author or an expert checked it) gets that review
|
|
257
|
+
* as a confirmed answer instead, and is in use at once; see
|
|
258
|
+
* `addShippedReviews` for when one is left out. Safe to run again:
|
|
259
|
+
* starters already added (by their input) are skipped, and reviews shipped
|
|
260
|
+
* since are added to them. A suite's leak check runs on each, as in
|
|
261
|
+
* `importCases`.
|
|
262
|
+
*
|
|
263
|
+
* @param store - Where to add the cases.
|
|
264
|
+
* @param suite - The suite whose `starter` cases and `reviews` to add.
|
|
265
|
+
* @returns What was added and skipped, what the leak check removed, how
|
|
266
|
+
* many shipped reviews were added, and cases whose answer from someone
|
|
267
|
+
* in the app differs from a shipped review.
|
|
268
268
|
*/
|
|
269
|
-
export function importStarters(store, suite) {
|
|
270
|
-
|
|
269
|
+
export async function importStarters(store, suite) {
|
|
270
|
+
const source = `starter:${suite.key}`;
|
|
271
|
+
const imported = await importCases({
|
|
271
272
|
store,
|
|
272
273
|
suite,
|
|
273
|
-
source
|
|
274
|
+
source,
|
|
274
275
|
rows: suite.starter ?? [],
|
|
275
276
|
map: (s) => ({
|
|
276
|
-
id:
|
|
277
|
+
id: starterKey(s.input),
|
|
277
278
|
input: s.input,
|
|
278
279
|
label: s.label,
|
|
279
280
|
tags: s.tags,
|
|
@@ -281,5 +282,6 @@ export function importStarters(store, suite) {
|
|
|
281
282
|
split: s.split,
|
|
282
283
|
}),
|
|
283
284
|
});
|
|
285
|
+
return { ...imported, ...(await addShippedReviews(store, suite, source)) };
|
|
284
286
|
}
|
|
285
287
|
//# sourceMappingURL=importCases.js.map
|
package/dist/importCases.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importCases.js","sourceRoot":"","sources":["../src/importCases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"importCases.js","sourceRoot":"","sources":["../src/importCases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAqB,MAAM,cAAc,CAAC;AA6DhF,0DAA0D;AAC1D,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,QAAQ,CAAkB;IACnC,YAAY,MAAc,EAAE,QAAyB;QACnD,KAAK,CACH,GAAG,QAAQ,CAAC,MAAM,OAAO,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,MAAM,qCAAqC,QAAQ;aAChH,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;aACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,OAAO,GAAG,CAAC;aACpC,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CACnD,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAuBD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAe,EACf,KAAc,EACd,SAAwB;IAExB,IAA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AAW,KAAK,CAAC,GAAG,EAAE,CAAC;IACtC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC;QACjC,KAAK;QACL,KAAK;QACL,MAAM;QACN,IAAI,EAAE,KAAK,CAAC,OAAO,IAAI,EAAE;QACzB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACX,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;YACvB,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,KAAK,EAAE,CAAC,CAAC,KAAK;SACf,CAAC;KACH,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,CAAC,MAAM,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;AAC7E,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -36,5 +36,6 @@ export * from "./inInstructions.js";
|
|
|
36
36
|
// Server-only (node:crypto): import from "@crowandraven/evalkeeper/runner".
|
|
37
37
|
// In-memory store for tests and demos: "@crowandraven/evalkeeper/memory".
|
|
38
38
|
export * from "./importCases.js";
|
|
39
|
+
export * from "./reviews.js";
|
|
39
40
|
export * from "./activity.js";
|
|
40
41
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAA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cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,4EAA4E;AAC5E,0EAA0E;AAC1E,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import type { EvalStore, NewLabel } from "./store.js";
|
|
2
|
+
import type { AnySuite } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Reviews that ship with a suite: a person checked a starter case's answer
|
|
5
|
+
* once, for every app that uses the suite, so it arrives confirmed instead
|
|
6
|
+
* of pending. It's still a person's confirmation, never one made on their
|
|
7
|
+
* behalf: each review names who, when, and what qualifies them, and only
|
|
8
|
+
* counts for the exact input and answer they saw.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Who reviewed a shipped case: the suite's author ("AUTHOR"), or someone
|
|
12
|
+
* with experience in what the suite judges ("EXPERT"), such as a crisis
|
|
13
|
+
* line counselor for the crisis risk suite.
|
|
14
|
+
*/
|
|
15
|
+
export type ReviewLevel = "AUTHOR" | "EXPERT";
|
|
16
|
+
/** The `raterRole` on an answer the suite's author reviewed. */
|
|
17
|
+
export declare const AUTHOR_REVIEWED = "SUITE_AUTHOR";
|
|
18
|
+
/** The `raterRole` on an answer an expert reviewed for the suite. */
|
|
19
|
+
export declare const EXPERT_REVIEWED = "SUITE_EXPERT";
|
|
20
|
+
/**
|
|
21
|
+
* The `raterRole` on an attack case's answer (see `injectionCases`),
|
|
22
|
+
* carried from the base case it was made from: an attack shouldn't change
|
|
23
|
+
* the right answer, so its confirmation is the base case's.
|
|
24
|
+
*/
|
|
25
|
+
export declare const FROM_BASE_CASE = "FROM_BASE_CASE";
|
|
26
|
+
/**
|
|
27
|
+
* One person's review of one starter case, shipped with the suite. It
|
|
28
|
+
* counts only while the case's input and answer are what the reviewer
|
|
29
|
+
* saw: edit either and the case arrives pending again, and the suite
|
|
30
|
+
* contract fails until the review is redone or removed.
|
|
31
|
+
*/
|
|
32
|
+
export type ShippedReview = {
|
|
33
|
+
/** The case reviewed: `starterKey` of its input. */
|
|
34
|
+
case: string;
|
|
35
|
+
/** The answer they confirmed, in the suite's answer shape. */
|
|
36
|
+
label: unknown;
|
|
37
|
+
level: ReviewLevel;
|
|
38
|
+
/** Who reviewed it, shown with the answer. */
|
|
39
|
+
by: string;
|
|
40
|
+
/** What qualifies them ("suite author", "crisis line counselor"). */
|
|
41
|
+
credential: string;
|
|
42
|
+
/** The day they reviewed it, as YYYY-MM-DD. */
|
|
43
|
+
at: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A short, stable key for a starter case: a hash of its input. Reviews
|
|
47
|
+
* name cases by it, and `importStarters` uses it as the case's id, so a
|
|
48
|
+
* rerun skips cases already added.
|
|
49
|
+
*
|
|
50
|
+
* @param input - The starter case's input.
|
|
51
|
+
*/
|
|
52
|
+
export declare function starterKey(input: unknown): string;
|
|
53
|
+
/**
|
|
54
|
+
* Whether an answer's confirmation shipped with the suite (author or
|
|
55
|
+
* expert reviewed) rather than coming from someone in the app.
|
|
56
|
+
*
|
|
57
|
+
* @param label - The answer, or just its rater role.
|
|
58
|
+
*/
|
|
59
|
+
export declare function isShippedReview(label: {
|
|
60
|
+
raterRole: string;
|
|
61
|
+
}): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* What's wrong with a suite's shipped reviews, in plain sentences; empty
|
|
64
|
+
* when every one counts. A review that matches no starter, confirms a
|
|
65
|
+
* different answer than the case has now, or is missing who, what
|
|
66
|
+
* qualifies them, or when, is a problem: `suiteContractProblems` reports
|
|
67
|
+
* these so a stale review is fixed, not silently ignored.
|
|
68
|
+
*
|
|
69
|
+
* @param suite - The suite whose `reviews` to check.
|
|
70
|
+
* @param now - Today; reviews dated after it are a problem.
|
|
71
|
+
*/
|
|
72
|
+
export declare function reviewProblems(suite: AnySuite, now?: Date): string[];
|
|
73
|
+
/**
|
|
74
|
+
* The confirmed answer a review adds to a case.
|
|
75
|
+
*
|
|
76
|
+
* @param suite - The suite the review shipped with.
|
|
77
|
+
* @param r - A review that counts (see `reviewProblems`).
|
|
78
|
+
*/
|
|
79
|
+
export declare function reviewedLabel(suite: AnySuite, r: ShippedReview): NewLabel;
|
|
80
|
+
/** What adding a suite's shipped reviews did. */
|
|
81
|
+
export type ReviewResult = {
|
|
82
|
+
/** Confirmed answers added from the suite's reviews. */
|
|
83
|
+
reviewed: number;
|
|
84
|
+
/**
|
|
85
|
+
* Cases whose own confirmed or provisional answer, from someone in the
|
|
86
|
+
* app, differs from a shipped review. The app's answer stays; these are
|
|
87
|
+
* listed for a person to look at.
|
|
88
|
+
*/
|
|
89
|
+
disagree: {
|
|
90
|
+
caseId: string;
|
|
91
|
+
review: ShippedReview;
|
|
92
|
+
}[];
|
|
93
|
+
/**
|
|
94
|
+
* Cases whose stored input isn't the one reviewed (the suite's leak
|
|
95
|
+
* check changed it when it was added), so their reviews were left out.
|
|
96
|
+
*/
|
|
97
|
+
notSeen: {
|
|
98
|
+
caseId: string;
|
|
99
|
+
review: ShippedReview;
|
|
100
|
+
}[];
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Adds a suite's shipped reviews to its starter cases already in the
|
|
104
|
+
* store, as confirmed answers. Safe to run again: a review already added
|
|
105
|
+
* is skipped, and one re-signed with a new answer (after the case's
|
|
106
|
+
* answer changed) is added as the newer confirmation. A case whose own
|
|
107
|
+
* confirmed or provisional answer came from someone in the app keeps it:
|
|
108
|
+
* the review is never added over it, and a different answer is reported
|
|
109
|
+
* in `disagree`. A case whose stored input isn't the one reviewed (a leak
|
|
110
|
+
* check changed it) gets no review and is reported in `notSeen`. Reviews
|
|
111
|
+
* that don't count (see `reviewProblems`) are left out. `importStarters`
|
|
112
|
+
* runs it.
|
|
113
|
+
*
|
|
114
|
+
* @param store - Where the suite's cases are.
|
|
115
|
+
* @param suite - The suite whose `reviews` to add.
|
|
116
|
+
* @param source - The `sourceRef` prefix starter cases were added under.
|
|
117
|
+
* @param now - Today; reviews dated after it are left out.
|
|
118
|
+
*/
|
|
119
|
+
export declare function addShippedReviews(store: EvalStore, suite: AnySuite, source: string, now?: Date): Promise<ReviewResult>;
|
|
120
|
+
/** One row of a review sheet: a starter case for a reviewer to mark. */
|
|
121
|
+
export type ReviewSheetRow = {
|
|
122
|
+
/** The case: `starterKey` of its input. */
|
|
123
|
+
case: string;
|
|
124
|
+
/** The case's title, as the pages show it. */
|
|
125
|
+
title: string;
|
|
126
|
+
/** The whole input, so the reviewer sees what the model sees. */
|
|
127
|
+
input: string;
|
|
128
|
+
/** The answer to confirm, as stable JSON. */
|
|
129
|
+
answer: string;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* A suite's starter cases as rows for a reviewer to mark, in the order
|
|
133
|
+
* the suite lists them. `reviewsFromSheet` turns the rows they confirm
|
|
134
|
+
* into shipped reviews.
|
|
135
|
+
*
|
|
136
|
+
* @param suite - The suite whose `starter` cases to list.
|
|
137
|
+
*/
|
|
138
|
+
export declare function reviewSheet(suite: AnySuite): ReviewSheetRow[];
|
|
139
|
+
/** Who reviewed a sheet, for every review it makes. */
|
|
140
|
+
export type Reviewer = Pick<ShippedReview, "level" | "by" | "credential" | "at">;
|
|
141
|
+
/**
|
|
142
|
+
* Turns a marked review sheet into shipped reviews: one for each row the
|
|
143
|
+
* reviewer confirmed ("yes", "y", "ok"), of the case's answer as it is
|
|
144
|
+
* now. Rows left blank are left out. A row naming a case the suite
|
|
145
|
+
* doesn't have, marked anything else, or showing an answer other than the
|
|
146
|
+
* case's answer now (it changed after the sheet was made) stops it: a
|
|
147
|
+
* case whose answer should change is edited in the suite first, then
|
|
148
|
+
* reviewed again on a new sheet.
|
|
149
|
+
*
|
|
150
|
+
* @param suite - The suite the sheet was made from.
|
|
151
|
+
* @param rows - Each row's case, the reviewer's mark, and the answer the
|
|
152
|
+
* sheet showed them (from `reviewSheet`), when the sheet kept it.
|
|
153
|
+
* @param reviewer - Who reviewed it, what qualifies them, and when.
|
|
154
|
+
* @returns The reviews, in the suite's order.
|
|
155
|
+
* @throws When a row names an unknown case or has an unknown mark, or
|
|
156
|
+
* the reviewer is missing who, what qualifies them, or a date.
|
|
157
|
+
*/
|
|
158
|
+
export declare function reviewsFromSheet(suite: AnySuite, rows: readonly {
|
|
159
|
+
case: string;
|
|
160
|
+
confirm: string;
|
|
161
|
+
answer?: string;
|
|
162
|
+
}[], reviewer: Reviewer): ShippedReview[];
|
|
163
|
+
/**
|
|
164
|
+
* A suite's reviews with one reviewer's replaced by a new set: everyone
|
|
165
|
+
* else's stay as they were, and theirs (same name and level) are swapped
|
|
166
|
+
* for `next`, so signing a sheet again never duplicates a review.
|
|
167
|
+
*
|
|
168
|
+
* @param existing - The reviews the suite ships now.
|
|
169
|
+
* @param next - The reviews from the newly signed sheet.
|
|
170
|
+
* @param reviewer - Whose reviews `next` replaces.
|
|
171
|
+
*/
|
|
172
|
+
export declare function mergeReviews(existing: readonly ShippedReview[], next: readonly ShippedReview[], reviewer: Pick<Reviewer, "level" | "by">): ShippedReview[];
|