@cef-ai/eval 0.0.0-stage → 0.1.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 +202 -2
- package/dist/capture.d.ts +37 -0
- package/dist/capture.d.ts.map +1 -0
- package/dist/capture.js +70 -0
- package/dist/capture.js.map +1 -0
- package/dist/conformance.d.ts +6 -0
- package/dist/conformance.d.ts.map +1 -0
- package/dist/conformance.js +257 -0
- package/dist/conformance.js.map +1 -0
- package/dist/contract.d.ts +18 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +176 -0
- package/dist/contract.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.d.ts +112 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +222 -0
- package/dist/layout.js.map +1 -0
- package/dist/migrate.d.ts +30 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +113 -0
- package/dist/migrate.js.map +1 -0
- package/dist/pool.d.ts +13 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/pool.js +34 -0
- package/dist/pool.js.map +1 -0
- package/dist/result.d.ts +11 -0
- package/dist/result.d.ts.map +1 -0
- package/dist/result.js +72 -0
- package/dist/result.js.map +1 -0
- package/dist/run.d.ts +86 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +240 -0
- package/dist/run.js.map +1 -0
- package/dist/score.d.ts +102 -0
- package/dist/score.d.ts.map +1 -0
- package/dist/score.js +433 -0
- package/dist/score.js.map +1 -0
- package/dist/storage.d.ts +218 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +577 -0
- package/dist/storage.js.map +1 -0
- package/dist/summary.d.ts +105 -0
- package/dist/summary.d.ts.map +1 -0
- package/dist/summary.js +219 -0
- package/dist/summary.js.map +1 -0
- package/dist/types.d.ts +265 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +14 -0
- package/dist/types.js.map +1 -0
- package/package.json +27 -3
package/dist/contract.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parsers for what crosses the store boundary. A case or header comes from a
|
|
3
|
+
* person — a repo file, a ROC form — so it is checked field by field and a bad
|
|
4
|
+
* one is refused with the field named. Records the library writes itself are
|
|
5
|
+
* read back leniently.
|
|
6
|
+
*/
|
|
7
|
+
import { assertCaseId, assertDatasetName, isCaseId } from "./layout.js";
|
|
8
|
+
export class EvalContractError extends Error {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "EvalContractError";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** A plain JSON object: not null, not an array. */
|
|
15
|
+
export const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
16
|
+
function fail(where, what) {
|
|
17
|
+
throw new EvalContractError(`${where}: ${what}`);
|
|
18
|
+
}
|
|
19
|
+
function isJson(v, depth = 0) {
|
|
20
|
+
if (depth > 64)
|
|
21
|
+
return false;
|
|
22
|
+
if (v === null || typeof v === "string" || typeof v === "boolean")
|
|
23
|
+
return true;
|
|
24
|
+
if (typeof v === "number")
|
|
25
|
+
return Number.isFinite(v);
|
|
26
|
+
if (Array.isArray(v))
|
|
27
|
+
return v.every((x) => isJson(x, depth + 1));
|
|
28
|
+
if (isObject(v))
|
|
29
|
+
return Object.values(v).every((x) => isJson(x, depth + 1));
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const LIMIT_KEYS = ["maxDurationMs", "maxTokens", "maxSteps", "maxCost"];
|
|
33
|
+
export function parseLimits(raw, where) {
|
|
34
|
+
if (raw === undefined || raw === null)
|
|
35
|
+
return undefined;
|
|
36
|
+
if (!isObject(raw))
|
|
37
|
+
fail(where, "limits must be an object");
|
|
38
|
+
const out = {};
|
|
39
|
+
for (const [k, v] of Object.entries(raw)) {
|
|
40
|
+
if (!LIMIT_KEYS.includes(k))
|
|
41
|
+
fail(where, `unknown limit "${k}" (known: ${LIMIT_KEYS.join(", ")})`);
|
|
42
|
+
if (typeof v !== "number" || !Number.isFinite(v) || v < 0)
|
|
43
|
+
fail(where, `limits.${k} must be a number ≥ 0`);
|
|
44
|
+
out[k] = v;
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
export function parseHeader(raw) {
|
|
49
|
+
const where = "header";
|
|
50
|
+
if (!isObject(raw))
|
|
51
|
+
fail(where, "must be an object");
|
|
52
|
+
if (typeof raw.dataset !== "string")
|
|
53
|
+
fail(where, "dataset must be a string");
|
|
54
|
+
try {
|
|
55
|
+
assertDatasetName(raw.dataset);
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
fail(where, e.message);
|
|
59
|
+
}
|
|
60
|
+
if (typeof raw.workflowId !== "string" || !raw.workflowId)
|
|
61
|
+
fail(where, "workflowId must be a non-empty string");
|
|
62
|
+
if (raw.description !== undefined && typeof raw.description !== "string")
|
|
63
|
+
fail(where, "description must be a string");
|
|
64
|
+
if (typeof raw.createdAt !== "string")
|
|
65
|
+
fail(where, "createdAt must be an ISO timestamp string");
|
|
66
|
+
if (raw.baselineId !== undefined && raw.baselineId !== null && typeof raw.baselineId !== "string") {
|
|
67
|
+
fail(where, "baselineId must be a string");
|
|
68
|
+
}
|
|
69
|
+
const limits = parseLimits(raw.limits, where);
|
|
70
|
+
return {
|
|
71
|
+
dataset: raw.dataset,
|
|
72
|
+
workflowId: raw.workflowId,
|
|
73
|
+
...(raw.description !== undefined ? { description: raw.description } : {}),
|
|
74
|
+
...(limits ? { limits } : {}),
|
|
75
|
+
createdAt: raw.createdAt,
|
|
76
|
+
...(typeof raw.baselineId === "string" && raw.baselineId ? { baselineId: raw.baselineId } : {}),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export function parseCase(raw) {
|
|
80
|
+
if (!isObject(raw))
|
|
81
|
+
fail("case", "must be an object");
|
|
82
|
+
if (typeof raw.id !== "string")
|
|
83
|
+
fail("case", "id must be a string");
|
|
84
|
+
const where = `case "${raw.id}"`;
|
|
85
|
+
try {
|
|
86
|
+
assertCaseId(raw.id);
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
fail(where, e.message);
|
|
90
|
+
}
|
|
91
|
+
if (!isObject(raw.input) || !isJson(raw.input))
|
|
92
|
+
fail(where, "input must be a JSON object (the workflow.start payload)");
|
|
93
|
+
if (raw.expected !== undefined) {
|
|
94
|
+
if (!isObject(raw.expected) || !isJson(raw.expected))
|
|
95
|
+
fail(where, "expected must be a JSON object keyed by Result field");
|
|
96
|
+
}
|
|
97
|
+
if (raw.tags !== undefined && (!Array.isArray(raw.tags) || raw.tags.some((t) => typeof t !== "string"))) {
|
|
98
|
+
fail(where, "tags must be an array of strings");
|
|
99
|
+
}
|
|
100
|
+
if (raw.notes !== undefined && typeof raw.notes !== "string")
|
|
101
|
+
fail(where, "notes must be a string");
|
|
102
|
+
let source;
|
|
103
|
+
if (raw.source !== undefined) {
|
|
104
|
+
const s = raw.source;
|
|
105
|
+
if (!isObject(s) || typeof s.context !== "string" || typeof s.capturedAt !== "string") {
|
|
106
|
+
fail(where, "source must be { context, capturedAt, workflowVersion? }");
|
|
107
|
+
}
|
|
108
|
+
if (s.workflowVersion !== undefined && typeof s.workflowVersion !== "string") {
|
|
109
|
+
fail(where, "source.workflowVersion must be a string");
|
|
110
|
+
}
|
|
111
|
+
source = {
|
|
112
|
+
context: s.context,
|
|
113
|
+
...(s.workflowVersion !== undefined ? { workflowVersion: s.workflowVersion } : {}),
|
|
114
|
+
capturedAt: s.capturedAt,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const limits = parseLimits(raw.limits, where);
|
|
118
|
+
return {
|
|
119
|
+
id: raw.id,
|
|
120
|
+
input: raw.input,
|
|
121
|
+
...(raw.expected !== undefined ? { expected: raw.expected } : {}),
|
|
122
|
+
...(limits ? { limits } : {}),
|
|
123
|
+
...(raw.tags !== undefined ? { tags: raw.tags } : {}),
|
|
124
|
+
...(raw.notes !== undefined ? { notes: raw.notes } : {}),
|
|
125
|
+
...(source ? { source } : {}),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export function parseVersionManifest(raw, dataset, version) {
|
|
129
|
+
const where = `dataset "${dataset}" v${version}`;
|
|
130
|
+
if (!isObject(raw))
|
|
131
|
+
fail(where, "manifest must be an object");
|
|
132
|
+
if (raw.version !== version)
|
|
133
|
+
fail(where, `manifest says version ${String(raw.version)}`);
|
|
134
|
+
if (!Array.isArray(raw.cases))
|
|
135
|
+
fail(where, "manifest has no cases array");
|
|
136
|
+
const cases = raw.cases.map((c, i) => {
|
|
137
|
+
if (!isObject(c) || typeof c.id !== "string" || !isCaseId(c.id)
|
|
138
|
+
|| typeof c.rev !== "number" || !Number.isInteger(c.rev) || c.rev < 1
|
|
139
|
+
|| typeof c.sha256 !== "string" || !/^[0-9a-f]{64}$/.test(c.sha256)) {
|
|
140
|
+
fail(where, `cases[${i}] must be { id, rev, sha256 }`);
|
|
141
|
+
}
|
|
142
|
+
return { id: c.id, rev: c.rev, sha256: c.sha256 };
|
|
143
|
+
});
|
|
144
|
+
return {
|
|
145
|
+
version,
|
|
146
|
+
header: parseHeader(raw.header),
|
|
147
|
+
cases,
|
|
148
|
+
createdAt: typeof raw.createdAt === "string" ? raw.createdAt : "",
|
|
149
|
+
...(typeof raw.note === "string" ? { note: raw.note } : {}),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* A run record read back. Lenient: the library wrote it. A record written
|
|
154
|
+
* before v2 numbers its repeat `trial`; it reads as `repeat`.
|
|
155
|
+
*/
|
|
156
|
+
export function parseRunRecord(raw, where) {
|
|
157
|
+
const repeat = isObject(raw) ? (typeof raw.repeat === "number" ? raw.repeat : raw.trial) : undefined;
|
|
158
|
+
if (!isObject(raw) || typeof raw.caseId !== "string" || typeof repeat !== "number"
|
|
159
|
+
|| typeof raw.status !== "string" || !isObject(raw.metrics) || !Array.isArray(raw.scores)) {
|
|
160
|
+
fail(where, "not a run record");
|
|
161
|
+
}
|
|
162
|
+
const { trial: _trial, ...rest } = raw;
|
|
163
|
+
return { ...rest, repeat };
|
|
164
|
+
}
|
|
165
|
+
/** An experiment's meta read back. Lenient: the library wrote it. */
|
|
166
|
+
export function parseExperiment(raw, where) {
|
|
167
|
+
if (!isObject(raw) || typeof raw.id !== "string" || typeof raw.dataset !== "string"
|
|
168
|
+
|| typeof raw.datasetVersion !== "number" || typeof raw.status !== "string") {
|
|
169
|
+
fail(where, "not an experiment");
|
|
170
|
+
}
|
|
171
|
+
// Summaries written before v2 have no per-field accuracy.
|
|
172
|
+
if (isObject(raw.summary) && !isObject(raw.summary.fields))
|
|
173
|
+
return { ...raw, summary: { ...raw.summary, fields: {} } };
|
|
174
|
+
return raw;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGxE,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,mDAAmD;AACnD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAgC,EAAE,CACnE,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE3D,SAAS,IAAI,CAAC,KAAa,EAAE,IAAY;IACvC,MAAM,IAAI,iBAAiB,CAAC,GAAG,KAAK,KAAK,IAAI,EAAE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AK,QAAQ,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC9E,IAAI,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;IACnC,CAAC;IACD,0DAA0D;IAC1D,IAAI,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,GAAG,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,EAA2B,CAAC;IAChJ,OAAO,GAA4B,CAAC;AACtC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type { Json, Limits, Header, Matcher, Case, VersionEntry, VersionManifest, Metrics, Score, RunStatus, RunRecord, ExperimentStatus, Experiment, Summary, FieldAccuracy, DatasetDiff, ResultField, ResultFieldType, RunEnd, WorkflowTarget, } from "./types.js";
|
|
2
|
+
export { WORKFLOWS_PREFIX, LEGACY_EVALS_PREFIX, MIGRATION_MARKER_KEY, isWorkflowId, isDatasetName, isCaseId, isExperimentId, assertWorkflowId, assertDatasetName, assertCaseId, assertExperimentId, workflowPrefix, datasetsPrefix, datasetPrefix, headerKey, casesPrefix, caseDirPrefix, caseRevKey, tombstoneKey, archivedPrefix, archiveKey, versionsPrefix, versionKey, experimentsPrefix, experimentPrefix, experimentMetaKey, runsPrefix, runKey, attemptsPrefix, attemptKey, attemptFromKey, revFromKey, caseIdFromKey, archivedIdFromKey, versionFromKey, experimentIdFromMetaKey, runFromKey, canonicalJson, sha256Hex, newExperimentId, runContext, experimentContextPrefix, runIdOf, } from "./layout.js";
|
|
3
|
+
export { EvalContractError, isObject, parseHeader, parseCase, parseLimits, parseVersionManifest, parseRunRecord, parseExperiment, } from "./contract.js";
|
|
4
|
+
export { memoryStore, createDataset, getHeader, requireHeader, updateHeader, setBaseline, listWorkflows, listDatasets, listCaseIds, listArchivedCaseIds, listDeletedCaseIds, listCaseRevisions, getCaseRevision, getCase, saveCase, addCase, archiveCase, unarchiveCase, deleteCase, undeleteCase, loadWorkingSet, listVersions, latestVersionNumber, getVersion, cutVersion, diffVersionEntries, autoVersionNote, ensureDatasetVersion, versionHistory, loadVersion, putExperiment, claimAttempt, getExperiment, listExperiments, putRunRecord, getRunRecord, listRunRecords, loadExperiment, findExperiment, childPrefixes, } from "./storage.js";
|
|
5
|
+
export type { EvalStore, StoreAtomicity, CreateDatasetInput, DatasetSummary, VersionHistoryEntry } from "./storage.js";
|
|
6
|
+
export { migrateLegacyLayout, needsLegacyMigration } from "./migrate.js";
|
|
7
|
+
export type { MigrationReport } from "./migrate.js";
|
|
8
|
+
export { resultFieldsFromGraph } from "./result.js";
|
|
9
|
+
export { storeConformance } from "./conformance.js";
|
|
10
|
+
export { FIELD_SCORER, LIMIT_SCORER, readField, deepEqual, parseBand, isMatcher, matchValue, scoreFields, effectiveLimits, scoreLimits, casePass, expectedTypesOf, checkResultCompatibility, unsafeRegex, MAX_REGEX_LENGTH, } from "./score.js";
|
|
11
|
+
export type { BandOp, ResultCompatibility } from "./score.js";
|
|
12
|
+
export { emptyMetrics, percentile, summarize, compareExperiments } from "./summary.js";
|
|
13
|
+
export type { Change, MetricDelta, RunComparison, CaseComparison, ExperimentComparison, ComparisonSide, } from "./summary.js";
|
|
14
|
+
export { runExperiment, runOne, DEFAULT_TIMEOUT_MS, DEFAULT_CONCURRENCY } from "./run.js";
|
|
15
|
+
export type { RunExperimentOptions, ExperimentProgress } from "./run.js";
|
|
16
|
+
export { caseFromRun, expectationFrom, isFreeText, slugCaseId, uniqueCaseId } from "./capture.js";
|
|
17
|
+
export type { CapturedRun } from "./capture.js";
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,E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,CAAC;AAClG,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { WORKFLOWS_PREFIX, LEGACY_EVALS_PREFIX, MIGRATION_MARKER_KEY, isWorkflowId, isDatasetName, isCaseId, isExperimentId, assertWorkflowId, assertDatasetName, assertCaseId, assertExperimentId, workflowPrefix, datasetsPrefix, datasetPrefix, headerKey, casesPrefix, caseDirPrefix, caseRevKey, tombstoneKey, archivedPrefix, archiveKey, versionsPrefix, versionKey, experimentsPrefix, experimentPrefix, experimentMetaKey, runsPrefix, runKey, attemptsPrefix, attemptKey, attemptFromKey, revFromKey, caseIdFromKey, archivedIdFromKey, versionFromKey, experimentIdFromMetaKey, runFromKey, canonicalJson, sha256Hex, newExperimentId, runContext, experimentContextPrefix, runIdOf, } from "./layout.js";
|
|
2
|
+
export { EvalContractError, isObject, parseHeader, parseCase, parseLimits, parseVersionManifest, parseRunRecord, parseExperiment, } from "./contract.js";
|
|
3
|
+
export { memoryStore, createDataset, getHeader, requireHeader, updateHeader, setBaseline, listWorkflows, listDatasets, listCaseIds, listArchivedCaseIds, listDeletedCaseIds, listCaseRevisions, getCaseRevision, getCase, saveCase, addCase, archiveCase, unarchiveCase, deleteCase, undeleteCase, loadWorkingSet, listVersions, latestVersionNumber, getVersion, cutVersion, diffVersionEntries, autoVersionNote, ensureDatasetVersion, versionHistory, loadVersion, putExperiment, claimAttempt, getExperiment, listExperiments, putRunRecord, getRunRecord, listRunRecords, loadExperiment, findExperiment, childPrefixes, } from "./storage.js";
|
|
4
|
+
export { migrateLegacyLayout, needsLegacyMigration } from "./migrate.js";
|
|
5
|
+
export { resultFieldsFromGraph } from "./result.js";
|
|
6
|
+
export { storeConformance } from "./conformance.js";
|
|
7
|
+
export { FIELD_SCORER, LIMIT_SCORER, readField, deepEqual, parseBand, isMatcher, matchValue, scoreFields, effectiveLimits, scoreLimits, casePass, expectedTypesOf, checkResultCompatibility, unsafeRegex, MAX_REGEX_LENGTH, } from "./score.js";
|
|
8
|
+
export { emptyMetrics, percentile, summarize, compareExperiments } from "./summary.js";
|
|
9
|
+
export { runExperiment, runOne, DEFAULT_TIMEOUT_MS, DEFAULT_CONCURRENCY } from "./run.js";
|
|
10
|
+
export { caseFromRun, expectationFrom, isFreeText, slugCaseId, uniqueCaseId } from "./capture.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuBA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,aAAa,EACb,SAAS,EACT,WAAW,EACX,aAAa,EACb,UAAU,EACV,YAAY,EACZ,cAAc,EACd,UAAU,EACV,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,MAAM,EACN,cAAc,EACd,UAAU,EACV,cAAc,EACd,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,UAAU,EACV,aAAa,EACb,SAAS,EACT,eAAe,EACf,UAAU,EACV,uBAAuB,EACvB,OAAO,GACR,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,SAAS,EACT,WAAW,EACX,oBAAoB,EACpB,cAAc,EACd,eAAe,GAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,WAAW,EACX,aAAa,EACb,SAAS,EACT,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,EACb,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,OAAO,EACP,QAAQ,EACR,OAAO,EACP,WAAW,EACX,aAAa,EACb,UAAU,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,EACd,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,UAAU,EACV,WAAW,EACX,eAAe,EACf,WAAW,EACX,QAAQ,EACR,eAAe,EACf,wBAAwB,EACxB,WAAW,EACX,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKvF,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG1F,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage layout — one layout for ROC and the CLI, so either reads what the
|
|
3
|
+
* other wrote. Grouped by workflow: a dataset belongs to one workflow, and an
|
|
4
|
+
* experiment is a sibling of the datasets (it names `dataset@version`), not a
|
|
5
|
+
* child of one.
|
|
6
|
+
*
|
|
7
|
+
* workflows/<wf>/datasets/<dataset>/header.json Header (mutable)
|
|
8
|
+
* workflows/<wf>/datasets/<dataset>/cases/<caseId>/r<n>.json Case revision (write-once)
|
|
9
|
+
* workflows/<wf>/datasets/<dataset>/cases/<caseId>/deleted.json tombstone
|
|
10
|
+
* workflows/<wf>/datasets/<dataset>/archived/<caseId>.json archive flag
|
|
11
|
+
* workflows/<wf>/datasets/<dataset>/versions/v<n>.json VersionManifest (write-once)
|
|
12
|
+
* workflows/<wf>/experiments/<expId>/meta.json Experiment (mutable: status)
|
|
13
|
+
* workflows/<wf>/experiments/<expId>/runs/<caseId>.<repeat>.json RunRecord (write-once)
|
|
14
|
+
* workflows/<wf>/experiments/<expId>/attempts/a<n>.json attempt claim (write-once)
|
|
15
|
+
*
|
|
16
|
+
* The v1 layout (`evals/datasets/<dataset>/…`, experiments nested in their
|
|
17
|
+
* dataset) is read only by `migrateLegacyLayout`.
|
|
18
|
+
*
|
|
19
|
+
* WRITE-ONCE REVISIONS, NOT ONE FILE. Editing a case writes `r<n+1>`; nothing
|
|
20
|
+
* is rewritten, so a version that pinned `r3` by sha256 keeps loading exactly
|
|
21
|
+
* what it pinned however often the case is edited. Revision and version numbers
|
|
22
|
+
* are derived by listing — there is no mutable "latest" pointer to lose a write
|
|
23
|
+
* to — and the store's `putIfAbsent` decides who holds a number two writers
|
|
24
|
+
* computed at once.
|
|
25
|
+
*
|
|
26
|
+
* FLAGS ARE THEIR OWN OBJECTS. An archived/deleted marker inside the case would
|
|
27
|
+
* change its bytes and so its hash, and every version pinning it would refuse
|
|
28
|
+
* to load. A marker beside it leaves history intact.
|
|
29
|
+
*/
|
|
30
|
+
export declare const WORKFLOWS_PREFIX = "workflows/";
|
|
31
|
+
/** The v1 layout's root; only `migrateLegacyLayout` reads it. */
|
|
32
|
+
export declare const LEGACY_EVALS_PREFIX = "evals/datasets/";
|
|
33
|
+
/** Written once `migrateLegacyLayout` has copied every legacy dataset. */
|
|
34
|
+
export declare const MIGRATION_MARKER_KEY = "evals/MIGRATED.json";
|
|
35
|
+
/** A workflow id is the workflow agent's alias; it is a key segment here. */
|
|
36
|
+
export declare function isWorkflowId(id: string): boolean;
|
|
37
|
+
export declare function isDatasetName(name: string): boolean;
|
|
38
|
+
export declare function isCaseId(id: string): boolean;
|
|
39
|
+
export declare function isExperimentId(id: string): boolean;
|
|
40
|
+
export declare function assertWorkflowId(id: string): void;
|
|
41
|
+
export declare function assertDatasetName(name: string): void;
|
|
42
|
+
export declare function assertCaseId(id: string): void;
|
|
43
|
+
export declare function assertExperimentId(id: string): void;
|
|
44
|
+
export declare const workflowPrefix: (workflowId: string) => string;
|
|
45
|
+
export declare const datasetsPrefix: (workflowId: string) => string;
|
|
46
|
+
export declare const datasetPrefix: (workflowId: string, dataset: string) => string;
|
|
47
|
+
export declare const headerKey: (workflowId: string, dataset: string) => string;
|
|
48
|
+
export declare const casesPrefix: (workflowId: string, dataset: string) => string;
|
|
49
|
+
export declare const caseDirPrefix: (workflowId: string, dataset: string, caseId: string) => string;
|
|
50
|
+
export declare const caseRevKey: (workflowId: string, dataset: string, caseId: string, rev: number) => string;
|
|
51
|
+
export declare const tombstoneKey: (workflowId: string, dataset: string, caseId: string) => string;
|
|
52
|
+
export declare const archivedPrefix: (workflowId: string, dataset: string) => string;
|
|
53
|
+
export declare const archiveKey: (workflowId: string, dataset: string, caseId: string) => string;
|
|
54
|
+
export declare const versionsPrefix: (workflowId: string, dataset: string) => string;
|
|
55
|
+
export declare const versionKey: (workflowId: string, dataset: string, version: number) => string;
|
|
56
|
+
export declare const experimentsPrefix: (workflowId: string) => string;
|
|
57
|
+
export declare const experimentPrefix: (workflowId: string, expId: string) => string;
|
|
58
|
+
export declare const experimentMetaKey: (workflowId: string, expId: string) => string;
|
|
59
|
+
export declare const runsPrefix: (workflowId: string, expId: string) => string;
|
|
60
|
+
export declare const runKey: (workflowId: string, expId: string, caseId: string, repeat: number) => string;
|
|
61
|
+
export declare const attemptsPrefix: (workflowId: string, expId: string) => string;
|
|
62
|
+
export declare const attemptKey: (workflowId: string, expId: string, attempt: number) => string;
|
|
63
|
+
/** An attempt number from an attempt claim key, or null. `a01` is not `a1`. */
|
|
64
|
+
export declare function attemptFromKey(workflowId: string, expId: string, key: string): number | null;
|
|
65
|
+
/** A revision number from a key inside a case's directory, or null. `r01` is not `r1`. */
|
|
66
|
+
export declare function revFromKey(workflowId: string, dataset: string, caseId: string, key: string): number | null;
|
|
67
|
+
/** The case id from any key inside a case's directory, or null. */
|
|
68
|
+
export declare function caseIdFromKey(workflowId: string, dataset: string, key: string): string | null;
|
|
69
|
+
export declare function archivedIdFromKey(workflowId: string, dataset: string, key: string): string | null;
|
|
70
|
+
export declare function versionFromKey(workflowId: string, dataset: string, key: string): number | null;
|
|
71
|
+
export declare function experimentIdFromMetaKey(workflowId: string, key: string): string | null;
|
|
72
|
+
/** `{caseId, repeat}` from a run record key, or null. */
|
|
73
|
+
export declare function runFromKey(workflowId: string, expId: string, key: string): {
|
|
74
|
+
caseId: string;
|
|
75
|
+
repeat: number;
|
|
76
|
+
} | null;
|
|
77
|
+
/** Highest number `parse` finds in `keys`, 0 when none. */
|
|
78
|
+
export declare function highest(keys: string[], parse: (key: string) => number | null): number;
|
|
79
|
+
/**
|
|
80
|
+
* Canonical JSON: sorted keys, two-space indent, trailing newline. A case's
|
|
81
|
+
* sha256 is over these bytes, so it depends on content and not on the key order
|
|
82
|
+
* some serialiser happened to emit.
|
|
83
|
+
*/
|
|
84
|
+
export declare function canonicalJson(value: unknown): string;
|
|
85
|
+
/** SHA-256 hex of a UTF-8 string, via Web Crypto (browser-safe; no node:crypto). */
|
|
86
|
+
export declare function sha256Hex(text: string): Promise<string>;
|
|
87
|
+
/**
|
|
88
|
+
* `exp-<base36 ms>-<4 rand>`: sorts by creation time. The time is padded to 8
|
|
89
|
+
* base36 digits — its natural width from 1973 to 2059 — so a lexical sort is a
|
|
90
|
+
* time sort.
|
|
91
|
+
*/
|
|
92
|
+
export declare function newExperimentId(now?: number): string;
|
|
93
|
+
/**
|
|
94
|
+
* The context one run is published into: `eval-<expId>-<caseId>-<repeat>-a<attempt>`.
|
|
95
|
+
*
|
|
96
|
+
* WHY AN ATTEMPT. A resumed experiment re-runs every case × repeat that has no
|
|
97
|
+
* record yet — and one of those may have been STARTED by the attempt that
|
|
98
|
+
* died. Publishing a second `workflow.start` into that context would land a
|
|
99
|
+
* second run beside the first (same runId, same context), and whichever end
|
|
100
|
+
* event arrives first would be scored. Each attempt of an experiment gets
|
|
101
|
+
* fresh contexts instead; they all still share the experiment's prefix, so a
|
|
102
|
+
* version pin covers them.
|
|
103
|
+
*/
|
|
104
|
+
export declare const runContext: (expId: string, caseId: string, repeat: number, attempt: number) => string;
|
|
105
|
+
/**
|
|
106
|
+
* The prefix every run of an experiment shares — what a version pin targets.
|
|
107
|
+
* Ends in `-` so no other experiment's contexts can share it.
|
|
108
|
+
*/
|
|
109
|
+
export declare const experimentContextPrefix: (expId: string) => string;
|
|
110
|
+
/** The id the runner knows a run by (`runIdFor` in the runner). */
|
|
111
|
+
export declare const runIdOf: (context: string) => string;
|
|
112
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAC7C,iEAAiE;AACjE,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AACrD,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,wBAAwB,CAAC;AAO1D,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAE5C;AAED,wBAAgB,cAAc,CAAC,EAA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C and the CLI, so either reads what the
|
|
3
|
+
* other wrote. Grouped by workflow: a dataset belongs to one workflow, and an
|
|
4
|
+
* experiment is a sibling of the datasets (it names `dataset@version`), not a
|
|
5
|
+
* child of one.
|
|
6
|
+
*
|
|
7
|
+
* workflows/<wf>/datasets/<dataset>/header.json Header (mutable)
|
|
8
|
+
* workflows/<wf>/datasets/<dataset>/cases/<caseId>/r<n>.json Case revision (write-once)
|
|
9
|
+
* workflows/<wf>/datasets/<dataset>/cases/<caseId>/deleted.json tombstone
|
|
10
|
+
* workflows/<wf>/datasets/<dataset>/archived/<caseId>.json archive flag
|
|
11
|
+
* workflows/<wf>/datasets/<dataset>/versions/v<n>.json VersionManifest (write-once)
|
|
12
|
+
* workflows/<wf>/experiments/<expId>/meta.json Experiment (mutable: status)
|
|
13
|
+
* workflows/<wf>/experiments/<expId>/runs/<caseId>.<repeat>.json RunRecord (write-once)
|
|
14
|
+
* workflows/<wf>/experiments/<expId>/attempts/a<n>.json attempt claim (write-once)
|
|
15
|
+
*
|
|
16
|
+
* The v1 layout (`evals/datasets/<dataset>/…`, experiments nested in their
|
|
17
|
+
* dataset) is read only by `migrateLegacyLayout`.
|
|
18
|
+
*
|
|
19
|
+
* WRITE-ONCE REVISIONS, NOT ONE FILE. Editing a case writes `r<n+1>`; nothing
|
|
20
|
+
* is rewritten, so a version that pinned `r3` by sha256 keeps loading exactly
|
|
21
|
+
* what it pinned however often the case is edited. Revision and version numbers
|
|
22
|
+
* are derived by listing — there is no mutable "latest" pointer to lose a write
|
|
23
|
+
* to — and the store's `putIfAbsent` decides who holds a number two writers
|
|
24
|
+
* computed at once.
|
|
25
|
+
*
|
|
26
|
+
* FLAGS ARE THEIR OWN OBJECTS. An archived/deleted marker inside the case would
|
|
27
|
+
* change its bytes and so its hash, and every version pinning it would refuse
|
|
28
|
+
* to load. A marker beside it leaves history intact.
|
|
29
|
+
*/
|
|
30
|
+
export const WORKFLOWS_PREFIX = "workflows/";
|
|
31
|
+
/** The v1 layout's root; only `migrateLegacyLayout` reads it. */
|
|
32
|
+
export const LEGACY_EVALS_PREFIX = "evals/datasets/";
|
|
33
|
+
/** Written once `migrateLegacyLayout` has copied every legacy dataset. */
|
|
34
|
+
export const MIGRATION_MARKER_KEY = "evals/MIGRATED.json";
|
|
35
|
+
const WORKFLOW_ID_RE = /^[A-Za-z0-9._-]{1,128}$/;
|
|
36
|
+
const DATASET_RE = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
37
|
+
const CASE_ID_RE = /^[A-Za-z0-9._-]{1,80}$/;
|
|
38
|
+
const EXP_ID_RE = /^exp-[a-z0-9]+-[a-z0-9]{4}$/;
|
|
39
|
+
/** A workflow id is the workflow agent's alias; it is a key segment here. */
|
|
40
|
+
export function isWorkflowId(id) {
|
|
41
|
+
return WORKFLOW_ID_RE.test(id) && id !== "." && id !== "..";
|
|
42
|
+
}
|
|
43
|
+
export function isDatasetName(name) {
|
|
44
|
+
return DATASET_RE.test(name);
|
|
45
|
+
}
|
|
46
|
+
export function isCaseId(id) {
|
|
47
|
+
return CASE_ID_RE.test(id) && id !== "." && id !== "..";
|
|
48
|
+
}
|
|
49
|
+
export function isExperimentId(id) {
|
|
50
|
+
return EXP_ID_RE.test(id);
|
|
51
|
+
}
|
|
52
|
+
export function assertWorkflowId(id) {
|
|
53
|
+
if (!isWorkflowId(id))
|
|
54
|
+
throw new Error(`workflow id "${id}" must match ${WORKFLOW_ID_RE} — it is a storage key prefix`);
|
|
55
|
+
}
|
|
56
|
+
export function assertDatasetName(name) {
|
|
57
|
+
if (!isDatasetName(name)) {
|
|
58
|
+
throw new Error(`dataset name "${name}" must match ${DATASET_RE} — it is a storage key prefix`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function assertCaseId(id) {
|
|
62
|
+
if (!isCaseId(id))
|
|
63
|
+
throw new Error(`case id "${id}" must match ${CASE_ID_RE}`);
|
|
64
|
+
}
|
|
65
|
+
export function assertExperimentId(id) {
|
|
66
|
+
if (!isExperimentId(id))
|
|
67
|
+
throw new Error(`experiment id "${id}" must look like exp-<base36 ms>-<4 chars>`);
|
|
68
|
+
}
|
|
69
|
+
export const workflowPrefix = (workflowId) => `${WORKFLOWS_PREFIX}${workflowId}/`;
|
|
70
|
+
export const datasetsPrefix = (workflowId) => `${workflowPrefix(workflowId)}datasets/`;
|
|
71
|
+
export const datasetPrefix = (workflowId, dataset) => `${datasetsPrefix(workflowId)}${dataset}/`;
|
|
72
|
+
export const headerKey = (workflowId, dataset) => `${datasetPrefix(workflowId, dataset)}header.json`;
|
|
73
|
+
export const casesPrefix = (workflowId, dataset) => `${datasetPrefix(workflowId, dataset)}cases/`;
|
|
74
|
+
export const caseDirPrefix = (workflowId, dataset, caseId) => `${casesPrefix(workflowId, dataset)}${caseId}/`;
|
|
75
|
+
export const caseRevKey = (workflowId, dataset, caseId, rev) => `${caseDirPrefix(workflowId, dataset, caseId)}r${rev}.json`;
|
|
76
|
+
export const tombstoneKey = (workflowId, dataset, caseId) => `${caseDirPrefix(workflowId, dataset, caseId)}deleted.json`;
|
|
77
|
+
export const archivedPrefix = (workflowId, dataset) => `${datasetPrefix(workflowId, dataset)}archived/`;
|
|
78
|
+
export const archiveKey = (workflowId, dataset, caseId) => `${archivedPrefix(workflowId, dataset)}${caseId}.json`;
|
|
79
|
+
export const versionsPrefix = (workflowId, dataset) => `${datasetPrefix(workflowId, dataset)}versions/`;
|
|
80
|
+
export const versionKey = (workflowId, dataset, version) => `${versionsPrefix(workflowId, dataset)}v${version}.json`;
|
|
81
|
+
export const experimentsPrefix = (workflowId) => `${workflowPrefix(workflowId)}experiments/`;
|
|
82
|
+
export const experimentPrefix = (workflowId, expId) => `${experimentsPrefix(workflowId)}${expId}/`;
|
|
83
|
+
export const experimentMetaKey = (workflowId, expId) => `${experimentPrefix(workflowId, expId)}meta.json`;
|
|
84
|
+
export const runsPrefix = (workflowId, expId) => `${experimentPrefix(workflowId, expId)}runs/`;
|
|
85
|
+
export const runKey = (workflowId, expId, caseId, repeat) => `${runsPrefix(workflowId, expId)}${caseId}.${repeat}.json`;
|
|
86
|
+
export const attemptsPrefix = (workflowId, expId) => `${experimentPrefix(workflowId, expId)}attempts/`;
|
|
87
|
+
export const attemptKey = (workflowId, expId, attempt) => `${attemptsPrefix(workflowId, expId)}a${attempt}.json`;
|
|
88
|
+
/** An attempt number from an attempt claim key, or null. `a01` is not `a1`. */
|
|
89
|
+
export function attemptFromKey(workflowId, expId, key) {
|
|
90
|
+
const prefix = attemptsPrefix(workflowId, expId);
|
|
91
|
+
if (!key.startsWith(prefix) || !key.endsWith(".json"))
|
|
92
|
+
return null;
|
|
93
|
+
const m = /^a([1-9]\d*)$/.exec(key.slice(prefix.length, -".json".length));
|
|
94
|
+
return m ? Number.parseInt(m[1], 10) : null;
|
|
95
|
+
}
|
|
96
|
+
/** A revision number from a key inside a case's directory, or null. `r01` is not `r1`. */
|
|
97
|
+
export function revFromKey(workflowId, dataset, caseId, key) {
|
|
98
|
+
const prefix = caseDirPrefix(workflowId, dataset, caseId);
|
|
99
|
+
if (!key.startsWith(prefix) || !key.endsWith(".json"))
|
|
100
|
+
return null;
|
|
101
|
+
const m = /^r([1-9]\d*)$/.exec(key.slice(prefix.length, -".json".length));
|
|
102
|
+
return m ? Number.parseInt(m[1], 10) : null;
|
|
103
|
+
}
|
|
104
|
+
/** The case id from any key inside a case's directory, or null. */
|
|
105
|
+
export function caseIdFromKey(workflowId, dataset, key) {
|
|
106
|
+
const prefix = casesPrefix(workflowId, dataset);
|
|
107
|
+
if (!key.startsWith(prefix))
|
|
108
|
+
return null;
|
|
109
|
+
const rest = key.slice(prefix.length);
|
|
110
|
+
const slash = rest.indexOf("/");
|
|
111
|
+
if (slash < 0)
|
|
112
|
+
return null;
|
|
113
|
+
const id = rest.slice(0, slash);
|
|
114
|
+
return isCaseId(id) ? id : null;
|
|
115
|
+
}
|
|
116
|
+
export function archivedIdFromKey(workflowId, dataset, key) {
|
|
117
|
+
const prefix = archivedPrefix(workflowId, dataset);
|
|
118
|
+
if (!key.startsWith(prefix) || !key.endsWith(".json"))
|
|
119
|
+
return null;
|
|
120
|
+
const id = key.slice(prefix.length, -".json".length);
|
|
121
|
+
return isCaseId(id) ? id : null;
|
|
122
|
+
}
|
|
123
|
+
export function versionFromKey(workflowId, dataset, key) {
|
|
124
|
+
const prefix = versionsPrefix(workflowId, dataset);
|
|
125
|
+
if (!key.startsWith(prefix) || !key.endsWith(".json"))
|
|
126
|
+
return null;
|
|
127
|
+
const m = /^v([1-9]\d*)$/.exec(key.slice(prefix.length, -".json".length));
|
|
128
|
+
return m ? Number.parseInt(m[1], 10) : null;
|
|
129
|
+
}
|
|
130
|
+
export function experimentIdFromMetaKey(workflowId, key) {
|
|
131
|
+
const prefix = experimentsPrefix(workflowId);
|
|
132
|
+
if (!key.startsWith(prefix) || !key.endsWith("/meta.json"))
|
|
133
|
+
return null;
|
|
134
|
+
const id = key.slice(prefix.length, -"/meta.json".length);
|
|
135
|
+
return isExperimentId(id) ? id : null;
|
|
136
|
+
}
|
|
137
|
+
/** `{caseId, repeat}` from a run record key, or null. */
|
|
138
|
+
export function runFromKey(workflowId, expId, key) {
|
|
139
|
+
const prefix = runsPrefix(workflowId, expId);
|
|
140
|
+
if (!key.startsWith(prefix) || !key.endsWith(".json"))
|
|
141
|
+
return null;
|
|
142
|
+
const stem = key.slice(prefix.length, -".json".length);
|
|
143
|
+
const dot = stem.lastIndexOf(".");
|
|
144
|
+
if (dot <= 0)
|
|
145
|
+
return null;
|
|
146
|
+
const caseId = stem.slice(0, dot);
|
|
147
|
+
const repeat = Number(stem.slice(dot + 1));
|
|
148
|
+
if (!isCaseId(caseId) || !Number.isInteger(repeat) || repeat < 1)
|
|
149
|
+
return null;
|
|
150
|
+
return { caseId, repeat };
|
|
151
|
+
}
|
|
152
|
+
/** Highest number `parse` finds in `keys`, 0 when none. */
|
|
153
|
+
export function highest(keys, parse) {
|
|
154
|
+
let max = 0;
|
|
155
|
+
for (const key of keys) {
|
|
156
|
+
const n = parse(key);
|
|
157
|
+
if (n !== null && n > max)
|
|
158
|
+
max = n;
|
|
159
|
+
}
|
|
160
|
+
return max;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Canonical JSON: sorted keys, two-space indent, trailing newline. A case's
|
|
164
|
+
* sha256 is over these bytes, so it depends on content and not on the key order
|
|
165
|
+
* some serialiser happened to emit.
|
|
166
|
+
*/
|
|
167
|
+
export function canonicalJson(value) {
|
|
168
|
+
return JSON.stringify(sortKeys(value), null, 2) + "\n";
|
|
169
|
+
}
|
|
170
|
+
function sortKeys(value) {
|
|
171
|
+
if (Array.isArray(value))
|
|
172
|
+
return value.map(sortKeys);
|
|
173
|
+
if (typeof value === "object" && value !== null) {
|
|
174
|
+
// Null prototype: a plain `{}` drops a `__proto__` key on assignment, which
|
|
175
|
+
// is silent data loss in a write-once store.
|
|
176
|
+
const out = Object.create(null);
|
|
177
|
+
for (const k of Object.keys(value).sort()) {
|
|
178
|
+
const v = value[k];
|
|
179
|
+
if (v !== undefined)
|
|
180
|
+
out[k] = sortKeys(v);
|
|
181
|
+
}
|
|
182
|
+
return out;
|
|
183
|
+
}
|
|
184
|
+
return value;
|
|
185
|
+
}
|
|
186
|
+
/** SHA-256 hex of a UTF-8 string, via Web Crypto (browser-safe; no node:crypto). */
|
|
187
|
+
export async function sha256Hex(text) {
|
|
188
|
+
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text));
|
|
189
|
+
return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* `exp-<base36 ms>-<4 rand>`: sorts by creation time. The time is padded to 8
|
|
193
|
+
* base36 digits — its natural width from 1973 to 2059 — so a lexical sort is a
|
|
194
|
+
* time sort.
|
|
195
|
+
*/
|
|
196
|
+
export function newExperimentId(now = Date.now()) {
|
|
197
|
+
const alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
198
|
+
let rand = "";
|
|
199
|
+
for (let i = 0; i < 4; i++)
|
|
200
|
+
rand += alphabet[Math.floor(Math.random() * alphabet.length)];
|
|
201
|
+
return `exp-${now.toString(36).padStart(8, "0")}-${rand}`;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* The context one run is published into: `eval-<expId>-<caseId>-<repeat>-a<attempt>`.
|
|
205
|
+
*
|
|
206
|
+
* WHY AN ATTEMPT. A resumed experiment re-runs every case × repeat that has no
|
|
207
|
+
* record yet — and one of those may have been STARTED by the attempt that
|
|
208
|
+
* died. Publishing a second `workflow.start` into that context would land a
|
|
209
|
+
* second run beside the first (same runId, same context), and whichever end
|
|
210
|
+
* event arrives first would be scored. Each attempt of an experiment gets
|
|
211
|
+
* fresh contexts instead; they all still share the experiment's prefix, so a
|
|
212
|
+
* version pin covers them.
|
|
213
|
+
*/
|
|
214
|
+
export const runContext = (expId, caseId, repeat, attempt) => `eval-${expId}-${caseId}-${repeat}-a${attempt}`;
|
|
215
|
+
/**
|
|
216
|
+
* The prefix every run of an experiment shares — what a version pin targets.
|
|
217
|
+
* Ends in `-` so no other experiment's contexts can share it.
|
|
218
|
+
*/
|
|
219
|
+
export const experimentContextPrefix = (expId) => `eval-${expId}-`;
|
|
220
|
+
/** The id the runner knows a run by (`runIdFor` in the runner). */
|
|
221
|
+
export const runIdOf = (context) => (context ? `run-${context}` : "");
|
|
222
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAC7C,iEAAiE;AACjE,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AACrD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAG,qBAAqB,CAAC;AAE1D,MAAM,cAAc,G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AI,GAAG,EAAE,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QAAE,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1F,OAAO,OAAO,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;AAC5D,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,MAAc,EAAE,MAAc,EAAE,OAAe,EAAU,EAAE,CACnG,QAAQ,KAAK,IAAI,MAAM,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,QAAQ,KAAK,GAAG,CAAC;AAEnF,mEAAmE;AACnE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type EvalStore } from "./storage.js";
|
|
2
|
+
export interface MigrationReport {
|
|
3
|
+
/** The marker was already there; nothing was read or written. */
|
|
4
|
+
alreadyMigrated: boolean;
|
|
5
|
+
datasets: Array<{
|
|
6
|
+
dataset: string;
|
|
7
|
+
workflowId: string;
|
|
8
|
+
keys: number;
|
|
9
|
+
experiments: number;
|
|
10
|
+
}>;
|
|
11
|
+
/** Keys this call wrote. */
|
|
12
|
+
copied: number;
|
|
13
|
+
/** Keys already at their target (an earlier run, or a v2 writer); left as they were. */
|
|
14
|
+
existing: number;
|
|
15
|
+
/** Legacy datasets not copied, and why. Any entry keeps the marker unwritten. */
|
|
16
|
+
skipped: Array<{
|
|
17
|
+
dataset: string;
|
|
18
|
+
reason: string;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
/** Whether this store has v1 keys and no marker saying they were migrated. */
|
|
22
|
+
export declare function needsLegacyMigration(store: EvalStore): Promise<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* Copy every v1 dataset — header, cases, flags, versions and its experiments —
|
|
25
|
+
* into `workflows/<header.workflowId>/…`. Idempotent; see the file comment.
|
|
26
|
+
*/
|
|
27
|
+
export declare function migrateLegacyLayout(store: EvalStore, opts?: {
|
|
28
|
+
now?: Date;
|
|
29
|
+
}): Promise<MigrationReport>;
|
|
30
|
+
//# sourceMappingURL=migrate.d.ts.map
|