@cef-ai/eval 0.0.0-stage → 0.2.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.
Files changed (54) hide show
  1. package/README.md +195 -2
  2. package/dist/capture.d.ts +37 -0
  3. package/dist/capture.d.ts.map +1 -0
  4. package/dist/capture.js +70 -0
  5. package/dist/capture.js.map +1 -0
  6. package/dist/conformance.d.ts +6 -0
  7. package/dist/conformance.d.ts.map +1 -0
  8. package/dist/conformance.js +256 -0
  9. package/dist/conformance.js.map +1 -0
  10. package/dist/contract.d.ts +18 -0
  11. package/dist/contract.d.ts.map +1 -0
  12. package/dist/contract.js +176 -0
  13. package/dist/contract.js.map +1 -0
  14. package/dist/index.d.ts +18 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +11 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/layout.d.ts +105 -0
  19. package/dist/layout.d.ts.map +1 -0
  20. package/dist/layout.js +215 -0
  21. package/dist/layout.js.map +1 -0
  22. package/dist/pool.d.ts +13 -0
  23. package/dist/pool.d.ts.map +1 -0
  24. package/dist/pool.js +34 -0
  25. package/dist/pool.js.map +1 -0
  26. package/dist/result.d.ts +11 -0
  27. package/dist/result.d.ts.map +1 -0
  28. package/dist/result.js +72 -0
  29. package/dist/result.js.map +1 -0
  30. package/dist/run.d.ts +86 -0
  31. package/dist/run.d.ts.map +1 -0
  32. package/dist/run.js +240 -0
  33. package/dist/run.js.map +1 -0
  34. package/dist/score.d.ts +102 -0
  35. package/dist/score.d.ts.map +1 -0
  36. package/dist/score.js +433 -0
  37. package/dist/score.js.map +1 -0
  38. package/dist/storage.d.ts +218 -0
  39. package/dist/storage.d.ts.map +1 -0
  40. package/dist/storage.js +577 -0
  41. package/dist/storage.js.map +1 -0
  42. package/dist/summary.d.ts +105 -0
  43. package/dist/summary.d.ts.map +1 -0
  44. package/dist/summary.js +219 -0
  45. package/dist/summary.js.map +1 -0
  46. package/dist/types.d.ts +265 -0
  47. package/dist/types.d.ts.map +1 -0
  48. package/dist/types.js +14 -0
  49. package/dist/types.js.map +1 -0
  50. package/dist/vault-store.d.ts +46 -0
  51. package/dist/vault-store.d.ts.map +1 -0
  52. package/dist/vault-store.js +127 -0
  53. package/dist/vault-store.js.map +1 -0
  54. package/package.json +27 -3
@@ -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,KA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IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ;WAC9E,OAAO,GAAG,CAAC,cAAc,KAAK,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"}
@@ -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, 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 { CONDITIONAL_WRITE_PROBE_KEY, ConditionalWriteUnsupportedError, vaultObjectStore } from "./vault-store.js";
7
+ export type { VaultObjects, VaultObjectStoreOptions } from "./vault-store.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,EACV,IAAI,EACJ,MAAM,EACN,MAAM,EACN,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,eAAe,EACf,O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,0 +1,11 @@
1
+ export { WORKFLOWS_PREFIX, 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 { CONDITIONAL_WRITE_PROBE_KEY, ConditionalWriteUnsupportedError, vaultObjectStore } from "./vault-store.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,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,2BAA2B,EAAE,gCAAgC,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGnH,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"}
@@ -0,0 +1,105 @@
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
+ * WRITE-ONCE REVISIONS, NOT ONE FILE. Editing a case writes `r<n+1>`; nothing
17
+ * is rewritten, so a version that pinned `r3` by sha256 keeps loading exactly
18
+ * what it pinned however often the case is edited. Revision and version numbers
19
+ * are derived by listing — there is no mutable "latest" pointer to lose a write
20
+ * to — and the store's `putIfAbsent` decides who holds a number two writers
21
+ * computed at once.
22
+ *
23
+ * FLAGS ARE THEIR OWN OBJECTS. An archived/deleted marker inside the case would
24
+ * change its bytes and so its hash, and every version pinning it would refuse
25
+ * to load. A marker beside it leaves history intact.
26
+ */
27
+ export declare const WORKFLOWS_PREFIX = "workflows/";
28
+ /** A workflow id is the workflow agent's alias; it is a key segment here. */
29
+ export declare function isWorkflowId(id: string): boolean;
30
+ export declare function isDatasetName(name: string): boolean;
31
+ export declare function isCaseId(id: string): boolean;
32
+ export declare function isExperimentId(id: string): boolean;
33
+ export declare function assertWorkflowId(id: string): void;
34
+ export declare function assertDatasetName(name: string): void;
35
+ export declare function assertCaseId(id: string): void;
36
+ export declare function assertExperimentId(id: string): void;
37
+ export declare const workflowPrefix: (workflowId: string) => string;
38
+ export declare const datasetsPrefix: (workflowId: string) => string;
39
+ export declare const datasetPrefix: (workflowId: string, dataset: string) => string;
40
+ export declare const headerKey: (workflowId: string, dataset: string) => string;
41
+ export declare const casesPrefix: (workflowId: string, dataset: string) => string;
42
+ export declare const caseDirPrefix: (workflowId: string, dataset: string, caseId: string) => string;
43
+ export declare const caseRevKey: (workflowId: string, dataset: string, caseId: string, rev: number) => string;
44
+ export declare const tombstoneKey: (workflowId: string, dataset: string, caseId: string) => string;
45
+ export declare const archivedPrefix: (workflowId: string, dataset: string) => string;
46
+ export declare const archiveKey: (workflowId: string, dataset: string, caseId: string) => string;
47
+ export declare const versionsPrefix: (workflowId: string, dataset: string) => string;
48
+ export declare const versionKey: (workflowId: string, dataset: string, version: number) => string;
49
+ export declare const experimentsPrefix: (workflowId: string) => string;
50
+ export declare const experimentPrefix: (workflowId: string, expId: string) => string;
51
+ export declare const experimentMetaKey: (workflowId: string, expId: string) => string;
52
+ export declare const runsPrefix: (workflowId: string, expId: string) => string;
53
+ export declare const runKey: (workflowId: string, expId: string, caseId: string, repeat: number) => string;
54
+ export declare const attemptsPrefix: (workflowId: string, expId: string) => string;
55
+ export declare const attemptKey: (workflowId: string, expId: string, attempt: number) => string;
56
+ /** An attempt number from an attempt claim key, or null. `a01` is not `a1`. */
57
+ export declare function attemptFromKey(workflowId: string, expId: string, key: string): number | null;
58
+ /** A revision number from a key inside a case's directory, or null. `r01` is not `r1`. */
59
+ export declare function revFromKey(workflowId: string, dataset: string, caseId: string, key: string): number | null;
60
+ /** The case id from any key inside a case's directory, or null. */
61
+ export declare function caseIdFromKey(workflowId: string, dataset: string, key: string): string | null;
62
+ export declare function archivedIdFromKey(workflowId: string, dataset: string, key: string): string | null;
63
+ export declare function versionFromKey(workflowId: string, dataset: string, key: string): number | null;
64
+ export declare function experimentIdFromMetaKey(workflowId: string, key: string): string | null;
65
+ /** `{caseId, repeat}` from a run record key, or null. */
66
+ export declare function runFromKey(workflowId: string, expId: string, key: string): {
67
+ caseId: string;
68
+ repeat: number;
69
+ } | null;
70
+ /** Highest number `parse` finds in `keys`, 0 when none. */
71
+ export declare function highest(keys: string[], parse: (key: string) => number | null): number;
72
+ /**
73
+ * Canonical JSON: sorted keys, two-space indent, trailing newline. A case's
74
+ * sha256 is over these bytes, so it depends on content and not on the key order
75
+ * some serialiser happened to emit.
76
+ */
77
+ export declare function canonicalJson(value: unknown): string;
78
+ /** SHA-256 hex of a UTF-8 string, via Web Crypto (browser-safe; no node:crypto). */
79
+ export declare function sha256Hex(text: string): Promise<string>;
80
+ /**
81
+ * `exp-<base36 ms>-<4 rand>`: sorts by creation time. The time is padded to 8
82
+ * base36 digits — its natural width from 1973 to 2059 — so a lexical sort is a
83
+ * time sort.
84
+ */
85
+ export declare function newExperimentId(now?: number): string;
86
+ /**
87
+ * The context one run is published into: `eval-<expId>-<caseId>-<repeat>-a<attempt>`.
88
+ *
89
+ * WHY AN ATTEMPT. A resumed experiment re-runs every case × repeat that has no
90
+ * record yet — and one of those may have been STARTED by the attempt that
91
+ * died. Publishing a second `workflow.start` into that context would land a
92
+ * second run beside the first (same runId, same context), and whichever end
93
+ * event arrives first would be scored. Each attempt of an experiment gets
94
+ * fresh contexts instead; they all still share the experiment's prefix, so a
95
+ * version pin covers them.
96
+ */
97
+ export declare const runContext: (expId: string, caseId: string, repeat: number, attempt: number) => string;
98
+ /**
99
+ * The prefix every run of an experiment shares — what a version pin targets.
100
+ * Ends in `-` so no other experiment's contexts can share it.
101
+ */
102
+ export declare const experimentContextPrefix: (expId: string) => string;
103
+ /** The id the runner knows a run by (`runIdFor` in the runner). */
104
+ export declare const runIdOf: (context: string) => string;
105
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAO7C,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,EAAE,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAEjD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAIpD;AAED,wBAAgB,YAAY,CAAC,EAAE,EA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AE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKtF;AAED,yDAAyD;AACzD,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAUpH;AAED,2DAA2D;AAC3D,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,MAAM,CAOrF;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD;AAiBD,oFAAoF;AACpF,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG7D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,GAAE,MAAmB,GAAG,MAAM,CAKhE;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,EAAE,QAAQ,MAAM,EAAE,SAAS,MAAM,KAAG,MAC3C,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,KAAG,MAA0B,CAAC;AAEnF,mEAAmE;AACnE,eAAO,MAAM,OAAO,GAAI,SAAS,MAAM,KAAG,MAA2C,CAAC"}
package/dist/layout.js ADDED
@@ -0,0 +1,215 @@
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
+ * WRITE-ONCE REVISIONS, NOT ONE FILE. Editing a case writes `r<n+1>`; nothing
17
+ * is rewritten, so a version that pinned `r3` by sha256 keeps loading exactly
18
+ * what it pinned however often the case is edited. Revision and version numbers
19
+ * are derived by listing — there is no mutable "latest" pointer to lose a write
20
+ * to — and the store's `putIfAbsent` decides who holds a number two writers
21
+ * computed at once.
22
+ *
23
+ * FLAGS ARE THEIR OWN OBJECTS. An archived/deleted marker inside the case would
24
+ * change its bytes and so its hash, and every version pinning it would refuse
25
+ * to load. A marker beside it leaves history intact.
26
+ */
27
+ export const WORKFLOWS_PREFIX = "workflows/";
28
+ const WORKFLOW_ID_RE = /^[A-Za-z0-9._-]{1,128}$/;
29
+ const DATASET_RE = /^[a-z0-9][a-z0-9-]{0,62}$/;
30
+ const CASE_ID_RE = /^[A-Za-z0-9._-]{1,80}$/;
31
+ const EXP_ID_RE = /^exp-[a-z0-9]+-[a-z0-9]{4}$/;
32
+ /** A workflow id is the workflow agent's alias; it is a key segment here. */
33
+ export function isWorkflowId(id) {
34
+ return WORKFLOW_ID_RE.test(id) && id !== "." && id !== "..";
35
+ }
36
+ export function isDatasetName(name) {
37
+ return DATASET_RE.test(name);
38
+ }
39
+ export function isCaseId(id) {
40
+ return CASE_ID_RE.test(id) && id !== "." && id !== "..";
41
+ }
42
+ export function isExperimentId(id) {
43
+ return EXP_ID_RE.test(id);
44
+ }
45
+ export function assertWorkflowId(id) {
46
+ if (!isWorkflowId(id))
47
+ throw new Error(`workflow id "${id}" must match ${WORKFLOW_ID_RE} — it is a storage key prefix`);
48
+ }
49
+ export function assertDatasetName(name) {
50
+ if (!isDatasetName(name)) {
51
+ throw new Error(`dataset name "${name}" must match ${DATASET_RE} — it is a storage key prefix`);
52
+ }
53
+ }
54
+ export function assertCaseId(id) {
55
+ if (!isCaseId(id))
56
+ throw new Error(`case id "${id}" must match ${CASE_ID_RE}`);
57
+ }
58
+ export function assertExperimentId(id) {
59
+ if (!isExperimentId(id))
60
+ throw new Error(`experiment id "${id}" must look like exp-<base36 ms>-<4 chars>`);
61
+ }
62
+ export const workflowPrefix = (workflowId) => `${WORKFLOWS_PREFIX}${workflowId}/`;
63
+ export const datasetsPrefix = (workflowId) => `${workflowPrefix(workflowId)}datasets/`;
64
+ export const datasetPrefix = (workflowId, dataset) => `${datasetsPrefix(workflowId)}${dataset}/`;
65
+ export const headerKey = (workflowId, dataset) => `${datasetPrefix(workflowId, dataset)}header.json`;
66
+ export const casesPrefix = (workflowId, dataset) => `${datasetPrefix(workflowId, dataset)}cases/`;
67
+ export const caseDirPrefix = (workflowId, dataset, caseId) => `${casesPrefix(workflowId, dataset)}${caseId}/`;
68
+ export const caseRevKey = (workflowId, dataset, caseId, rev) => `${caseDirPrefix(workflowId, dataset, caseId)}r${rev}.json`;
69
+ export const tombstoneKey = (workflowId, dataset, caseId) => `${caseDirPrefix(workflowId, dataset, caseId)}deleted.json`;
70
+ export const archivedPrefix = (workflowId, dataset) => `${datasetPrefix(workflowId, dataset)}archived/`;
71
+ export const archiveKey = (workflowId, dataset, caseId) => `${archivedPrefix(workflowId, dataset)}${caseId}.json`;
72
+ export const versionsPrefix = (workflowId, dataset) => `${datasetPrefix(workflowId, dataset)}versions/`;
73
+ export const versionKey = (workflowId, dataset, version) => `${versionsPrefix(workflowId, dataset)}v${version}.json`;
74
+ export const experimentsPrefix = (workflowId) => `${workflowPrefix(workflowId)}experiments/`;
75
+ export const experimentPrefix = (workflowId, expId) => `${experimentsPrefix(workflowId)}${expId}/`;
76
+ export const experimentMetaKey = (workflowId, expId) => `${experimentPrefix(workflowId, expId)}meta.json`;
77
+ export const runsPrefix = (workflowId, expId) => `${experimentPrefix(workflowId, expId)}runs/`;
78
+ export const runKey = (workflowId, expId, caseId, repeat) => `${runsPrefix(workflowId, expId)}${caseId}.${repeat}.json`;
79
+ export const attemptsPrefix = (workflowId, expId) => `${experimentPrefix(workflowId, expId)}attempts/`;
80
+ export const attemptKey = (workflowId, expId, attempt) => `${attemptsPrefix(workflowId, expId)}a${attempt}.json`;
81
+ /** An attempt number from an attempt claim key, or null. `a01` is not `a1`. */
82
+ export function attemptFromKey(workflowId, expId, key) {
83
+ const prefix = attemptsPrefix(workflowId, expId);
84
+ if (!key.startsWith(prefix) || !key.endsWith(".json"))
85
+ return null;
86
+ const m = /^a([1-9]\d*)$/.exec(key.slice(prefix.length, -".json".length));
87
+ return m ? Number.parseInt(m[1], 10) : null;
88
+ }
89
+ /** A revision number from a key inside a case's directory, or null. `r01` is not `r1`. */
90
+ export function revFromKey(workflowId, dataset, caseId, key) {
91
+ const prefix = caseDirPrefix(workflowId, dataset, caseId);
92
+ if (!key.startsWith(prefix) || !key.endsWith(".json"))
93
+ return null;
94
+ const m = /^r([1-9]\d*)$/.exec(key.slice(prefix.length, -".json".length));
95
+ return m ? Number.parseInt(m[1], 10) : null;
96
+ }
97
+ /** The case id from any key inside a case's directory, or null. */
98
+ export function caseIdFromKey(workflowId, dataset, key) {
99
+ const prefix = casesPrefix(workflowId, dataset);
100
+ if (!key.startsWith(prefix))
101
+ return null;
102
+ const rest = key.slice(prefix.length);
103
+ const slash = rest.indexOf("/");
104
+ if (slash < 0)
105
+ return null;
106
+ const id = rest.slice(0, slash);
107
+ return isCaseId(id) ? id : null;
108
+ }
109
+ export function archivedIdFromKey(workflowId, dataset, key) {
110
+ const prefix = archivedPrefix(workflowId, dataset);
111
+ if (!key.startsWith(prefix) || !key.endsWith(".json"))
112
+ return null;
113
+ const id = key.slice(prefix.length, -".json".length);
114
+ return isCaseId(id) ? id : null;
115
+ }
116
+ export function versionFromKey(workflowId, dataset, key) {
117
+ const prefix = versionsPrefix(workflowId, dataset);
118
+ if (!key.startsWith(prefix) || !key.endsWith(".json"))
119
+ return null;
120
+ const m = /^v([1-9]\d*)$/.exec(key.slice(prefix.length, -".json".length));
121
+ return m ? Number.parseInt(m[1], 10) : null;
122
+ }
123
+ export function experimentIdFromMetaKey(workflowId, key) {
124
+ const prefix = experimentsPrefix(workflowId);
125
+ if (!key.startsWith(prefix) || !key.endsWith("/meta.json"))
126
+ return null;
127
+ const id = key.slice(prefix.length, -"/meta.json".length);
128
+ return isExperimentId(id) ? id : null;
129
+ }
130
+ /** `{caseId, repeat}` from a run record key, or null. */
131
+ export function runFromKey(workflowId, expId, key) {
132
+ const prefix = runsPrefix(workflowId, expId);
133
+ if (!key.startsWith(prefix) || !key.endsWith(".json"))
134
+ return null;
135
+ const stem = key.slice(prefix.length, -".json".length);
136
+ const dot = stem.lastIndexOf(".");
137
+ if (dot <= 0)
138
+ return null;
139
+ const caseId = stem.slice(0, dot);
140
+ const repeat = Number(stem.slice(dot + 1));
141
+ if (!isCaseId(caseId) || !Number.isInteger(repeat) || repeat < 1)
142
+ return null;
143
+ return { caseId, repeat };
144
+ }
145
+ /** Highest number `parse` finds in `keys`, 0 when none. */
146
+ export function highest(keys, parse) {
147
+ let max = 0;
148
+ for (const key of keys) {
149
+ const n = parse(key);
150
+ if (n !== null && n > max)
151
+ max = n;
152
+ }
153
+ return max;
154
+ }
155
+ /**
156
+ * Canonical JSON: sorted keys, two-space indent, trailing newline. A case's
157
+ * sha256 is over these bytes, so it depends on content and not on the key order
158
+ * some serialiser happened to emit.
159
+ */
160
+ export function canonicalJson(value) {
161
+ return JSON.stringify(sortKeys(value), null, 2) + "\n";
162
+ }
163
+ function sortKeys(value) {
164
+ if (Array.isArray(value))
165
+ return value.map(sortKeys);
166
+ if (typeof value === "object" && value !== null) {
167
+ // Null prototype: a plain `{}` drops a `__proto__` key on assignment, which
168
+ // is silent data loss in a write-once store.
169
+ const out = Object.create(null);
170
+ for (const k of Object.keys(value).sort()) {
171
+ const v = value[k];
172
+ if (v !== undefined)
173
+ out[k] = sortKeys(v);
174
+ }
175
+ return out;
176
+ }
177
+ return value;
178
+ }
179
+ /** SHA-256 hex of a UTF-8 string, via Web Crypto (browser-safe; no node:crypto). */
180
+ export async function sha256Hex(text) {
181
+ const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text));
182
+ return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("");
183
+ }
184
+ /**
185
+ * `exp-<base36 ms>-<4 rand>`: sorts by creation time. The time is padded to 8
186
+ * base36 digits — its natural width from 1973 to 2059 — so a lexical sort is a
187
+ * time sort.
188
+ */
189
+ export function newExperimentId(now = Date.now()) {
190
+ const alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
191
+ let rand = "";
192
+ for (let i = 0; i < 4; i++)
193
+ rand += alphabet[Math.floor(Math.random() * alphabet.length)];
194
+ return `exp-${now.toString(36).padStart(8, "0")}-${rand}`;
195
+ }
196
+ /**
197
+ * The context one run is published into: `eval-<expId>-<caseId>-<repeat>-a<attempt>`.
198
+ *
199
+ * WHY AN ATTEMPT. A resumed experiment re-runs every case × repeat that has no
200
+ * record yet — and one of those may have been STARTED by the attempt that
201
+ * died. Publishing a second `workflow.start` into that context would land a
202
+ * second run beside the first (same runId, same context), and whichever end
203
+ * event arrives first would be scored. Each attempt of an experiment gets
204
+ * fresh contexts instead; they all still share the experiment's prefix, so a
205
+ * version pin covers them.
206
+ */
207
+ export const runContext = (expId, caseId, repeat, attempt) => `eval-${expId}-${caseId}-${repeat}-a${attempt}`;
208
+ /**
209
+ * The prefix every run of an experiment shares — what a version pin targets.
210
+ * Ends in `-` so no other experiment's contexts can share it.
211
+ */
212
+ export const experimentContextPrefix = (expId) => `eval-${expId}-`;
213
+ /** The id the runner knows a run by (`runIdFor` in the runner). */
214
+ export const runIdOf = (context) => (context ? `run-${context}` : "");
215
+ //# sourceMappingURL=layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAE7C,MAAM,cAAc,GAAG,yBAAyB,CAAC;AACjD,MAAM,UAAU,GAAG,2BAA2B,CAAC;AAC/C,MAAM,UAAU,GAAG,wBAAwB,CAAC;AAC5C,MAAM,SAAS,GAAG,6BAA6B,CAAC;AAEhD,6EAA6E;AAC7E,MAAM,UAAU,YAAY,CAAC,EAAU;IACrC,OAAO,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,EAAU;IACjC,OAAO,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,EAAU;IACzC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,gBAAgB,EAAE,gBAAgB,cAAc,+BAA+B,CAAC,CAAC;AAC1H,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,gBAAgB,UAAU,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,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1F,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc,IAAI,CAAC,GAAG,EAAE;IACtD,MAAM,QAAQ,GAAG,sCAAsC,CAAC;IACxD,IAAI,IAAI,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"}
package/dist/pool.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Bounded-concurrency for-each, shared by `runExperiment` and the store
3
+ * conformance suite. Dependency-free and browser-safe.
4
+ *
5
+ * IT FAILS SAFELY. When one item throws, no further item is started, every
6
+ * item already in flight is awaited, and only then does the pool reject, with
7
+ * the first error. `Promise.all` over the workers would reject at the first
8
+ * throw while its siblings kept running — so a caller's cleanup (releasing a
9
+ * version pin, writing the final summary) would run under work that was still
10
+ * writing, and land before it.
11
+ */
12
+ export declare function pool<T>(items: readonly T[], limit: number, fn: (item: T) => Promise<void>): Promise<void>;
13
+ //# sourceMappingURL=pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../src/pool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAsB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAmB/G"}