@leostera/evalkit 0.4.0 → 0.6.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/CHANGELOG.md +67 -1
- package/README.md +10 -8
- package/dist/cli.mjs +1287 -266
- package/dist/dashboard/assets/index-BK9x-zoi.css +2 -0
- package/dist/dashboard/assets/index-DzsDLGHx.js +32 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/files-C-U0-PWW.mjs +0 -2
- package/dist/index-db-vbqEGFaU.mjs +0 -2
- package/dist/index.d.mts +1344 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -4
- package/dist/runner.d.mts +807 -11
- package/dist/runner.d.mts.map +1 -1
- package/dist/runner.mjs +2 -2
- package/dist/share-worker.d.mts +76 -1
- package/dist/share-worker.d.mts.map +1 -1
- package/dist/share-worker.mjs +0 -2
- package/dist/share.d.mts +149 -6
- package/dist/share.d.mts.map +1 -1
- package/dist/share.mjs +1 -1
- package/dist/skills/evalkit/SKILL.md +32 -0
- package/dist/skills/evalkit-agents/SKILL.md +16 -0
- package/dist/skills/evalkit-datasets/SKILL.md +17 -0
- package/dist/skills/evalkit-evals/SKILL.md +19 -0
- package/dist/skills/evalkit-judges/SKILL.md +17 -0
- package/dist/skills/evalkit-matrices/SKILL.md +14 -0
- package/dist/skills/evalkit-results/SKILL.md +14 -0
- package/dist/{src-DoPs9Yug.mjs → src-CVSCn3bZ.mjs} +445 -115
- package/dist/{src-DzZueFn3.mjs → src-CZnDXP1K.mjs} +46 -10
- package/dist/{src-ButXPY8P.mjs → src-D4tCwxNb.mjs} +418 -94
- package/package.json +3 -2
- package/dist/cli.mjs.map +0 -1
- package/dist/dashboard/assets/index-D9NtA46z.css +0 -2
- package/dist/dashboard/assets/index-DrBwLKJD.js +0 -30
- package/dist/files-C-U0-PWW.mjs.map +0 -1
- package/dist/index-U6TUTBf7.d.mts +0 -1019
- package/dist/index-U6TUTBf7.d.mts.map +0 -1
- package/dist/index-db-HdZXelOS.d.mts +0 -142
- package/dist/index-db-HdZXelOS.d.mts.map +0 -1
- package/dist/index-db-vbqEGFaU.mjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/share-worker.mjs.map +0 -1
- package/dist/src-ButXPY8P.mjs.map +0 -1
- package/dist/src-DoPs9Yug.mjs.map +0 -1
- package/dist/src-DzZueFn3.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-U6TUTBf7.d.mts","names":[],"sources":["../../core/src/identity.ts","../../core/src/canonical-json.ts","../../core/src/matrix.ts","../../core/src/config.ts","../../core/src/schema.ts","../../core/src/trajectory.ts","../../core/src/index.ts"],"mappings":";;cAEa,oBAAkB,OAAA;KACnB,sBAAsB,mBAAmB;;iBAGrC,SAAS;;cAOZ,YAAU,OAAA,cAAA,OAAA;KAKX,cAAc,WAAW;KAEzB,YAAY,cAAc,eAAe,2BACxC;cAEA,mBAAiB,OAAA,cAAA,OAAA;iBAMd,kBAAkB,cAAc,cAAc,MAAM,QAAK,OAAA,cAAA,OAAA;iBAWzD,YAAY,cAAc,cACxC,MAAM,OACN,MAAM,OACL,YAAY;iBAIC,iBAAiB,cAAc,cAC7C,eACA,eAAe;EACZ,MAAM;EAAO,MAAM;EAAM,KAAK,YAAY;;iBAY/B,aAAa,eAAe,eAAe,eAAe;;;;iBCzD1D,oBAAoB,OAAO;;;KCK/B;;EAEV;;EAEA,aAAa,SAAS,wBAAwB;;EAE9C,YAAY;;KAEF;EACV;;EAEA;EACA,MAAM;EACN,YAAY;;KAEF;EACV;EACA;EACA,gBAAgB;EAChB,YAAY,SAAS,wBAAwB;EAC7C,WAAW;;EAEX,iBAAiB;;EAEjB,mBAAmB;;KAET,aAAa;EACvB;EACA,MAAM,YAAY;EAClB,MAAM,YAAY,kBAAkB,iBAAiB;;iBAWvC,uBAAuB,UAAU,sBAC/C,YAAY,IACX,aAAa;;;KCjDJ;;EAEV;EACA;EACA;;EAEA,iBA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A;EACA;;KAGU,YAAY;EACtB;EACA;EACA;EACA;EACA,mBAAmB;;EAEnB,SAAS;;iBAOK,YAAY,iBAAiB"}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
//#region ../share/src/files.d.ts
|
|
2
|
-
/** Where uploaded result files live: R2 in a Worker, a directory elsewhere. */
|
|
3
|
-
type ShareFiles = {
|
|
4
|
-
get(key: string): Promise<ReadableStream<Uint8Array> | Uint8Array | null>;
|
|
5
|
-
put(key: string, data: Uint8Array | string): Promise<void>;
|
|
6
|
-
/** Every key below `prefix`, in no particular order. */
|
|
7
|
-
list(prefix: string): AsyncIterable<string>;
|
|
8
|
-
};
|
|
9
|
-
/** The subset of the Workers R2 binding used here. */
|
|
10
|
-
type R2BucketLike = {
|
|
11
|
-
get(key: string): Promise<{
|
|
12
|
-
body: ReadableStream<Uint8Array>;
|
|
13
|
-
} | null>;
|
|
14
|
-
put(key: string, value: Uint8Array | string): Promise<unknown>;
|
|
15
|
-
list(options: {
|
|
16
|
-
prefix: string;
|
|
17
|
-
cursor?: string;
|
|
18
|
-
}): Promise<{
|
|
19
|
-
objects: {
|
|
20
|
-
key: string;
|
|
21
|
-
}[];
|
|
22
|
-
truncated: boolean;
|
|
23
|
-
cursor?: string;
|
|
24
|
-
}>;
|
|
25
|
-
};
|
|
26
|
-
declare function r2Files(bucket: R2BucketLike): ShareFiles;
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region ../share/src/bundle.d.ts
|
|
29
|
-
/**
|
|
30
|
-
* A run bundle: the snapshot files for one run, as one gzip-compressed body.
|
|
31
|
-
*
|
|
32
|
-
* "EKBUNDLE" (8 bytes) · header length (u32 BE) · header JSON · file bytes…
|
|
33
|
-
* header = { format: 1, files: [{ path, size }, …] }, bytes in that order.
|
|
34
|
-
*
|
|
35
|
-
* Both ends are EvalKit, so this is simpler than tar and has no path-length limit.
|
|
36
|
-
*/
|
|
37
|
-
declare const BUNDLE_FORMAT = 1;
|
|
38
|
-
type BundleFile = {
|
|
39
|
-
path: string;
|
|
40
|
-
data: Uint8Array;
|
|
41
|
-
};
|
|
42
|
-
declare function encodeBundle(files: BundleFile[]): Promise<Uint8Array>;
|
|
43
|
-
/** Decode and check the framing; path rules are enforced by the caller. */
|
|
44
|
-
declare function decodeBundle(body: Uint8Array, limits: {
|
|
45
|
-
maxBytes: number;
|
|
46
|
-
}): Promise<BundleFile[]>;
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region ../share/src/upload.d.ts
|
|
49
|
-
/** Finished runs only: a shared run's files are immutable once stored. */
|
|
50
|
-
type SharedRunStatus = 'passed' | 'failed' | 'errored';
|
|
51
|
-
type SharedSource = {
|
|
52
|
-
repo: string;
|
|
53
|
-
project: string;
|
|
54
|
-
commit: string;
|
|
55
|
-
ref?: string;
|
|
56
|
-
committedAt?: string;
|
|
57
|
-
dirty: boolean;
|
|
58
|
-
};
|
|
59
|
-
/** The fields of an uploaded run.json the server relies on. */
|
|
60
|
-
type SharedRun = {
|
|
61
|
-
id: string;
|
|
62
|
-
evalId: string;
|
|
63
|
-
suiteId?: string;
|
|
64
|
-
status: SharedRunStatus;
|
|
65
|
-
score?: number;
|
|
66
|
-
startedAt: string;
|
|
67
|
-
source: SharedSource;
|
|
68
|
-
/** Repository key (`repo` plus `/~project`), checked to be URL- and path-safe. */
|
|
69
|
-
repoKey: string;
|
|
70
|
-
/** The whole run.json object, served as-is in runs.json. */
|
|
71
|
-
summary: unknown;
|
|
72
|
-
};
|
|
73
|
-
/** A run bundle that passed every check; storing it cannot fail on its contents. */
|
|
74
|
-
type RunUpload = {
|
|
75
|
-
run: SharedRun;
|
|
76
|
-
runJson: Uint8Array;
|
|
77
|
-
catalog?: Uint8Array;
|
|
78
|
-
/** trials.json and trials/** files. */
|
|
79
|
-
files: BundleFile[];
|
|
80
|
-
};
|
|
81
|
-
declare function parseUpload(bundle: readonly BundleFile[]): RunUpload;
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region ../share/src/index-db.d.ts
|
|
84
|
-
/**
|
|
85
|
-
* The share server's metadata index: repositories, commits and runs.
|
|
86
|
-
* R2 (or a directory) holds the files; this index answers "what exists" and
|
|
87
|
-
* every listing query. It is derived from stored run.json files and can be
|
|
88
|
-
* rebuilt from them (`POST /api/v1/reindex`).
|
|
89
|
-
*/
|
|
90
|
-
/** Synchronous SQLite access, provided by Durable Object storage or bun:sqlite. */
|
|
91
|
-
type Sql = {
|
|
92
|
-
all<T>(query: string, ...params: SqlValue[]): T[];
|
|
93
|
-
run(query: string, ...params: SqlValue[]): void;
|
|
94
|
-
transaction<T>(work: () => T): T;
|
|
95
|
-
};
|
|
96
|
-
type SqlValue = string | number | null;
|
|
97
|
-
type RepoRow = {
|
|
98
|
-
key: string;
|
|
99
|
-
url: string;
|
|
100
|
-
project: string;
|
|
101
|
-
firstSeenAt: string;
|
|
102
|
-
lastUploadAt: string;
|
|
103
|
-
commits: number;
|
|
104
|
-
};
|
|
105
|
-
type CommitRow = {
|
|
106
|
-
commit: string;
|
|
107
|
-
ref?: string;
|
|
108
|
-
committedAt?: string;
|
|
109
|
-
firstSeenAt: string;
|
|
110
|
-
runs: number;
|
|
111
|
-
passed: number;
|
|
112
|
-
failed: number;
|
|
113
|
-
};
|
|
114
|
-
/** The operations the app needs; async so a Durable Object can sit behind it. */
|
|
115
|
-
type ShareIndex = {
|
|
116
|
-
hasRun(runId: string): Promise<boolean>;
|
|
117
|
-
recordRun(run: SharedRun): Promise<void>;
|
|
118
|
-
repos(): Promise<RepoRow[]>;
|
|
119
|
-
commits(repo: string): Promise<CommitRow[]>;
|
|
120
|
-
runs(repo: string, sha: string): Promise<unknown[]>;
|
|
121
|
-
/** Full SHA for a full SHA, a unique prefix (≥ 7), or a ref's latest commit. */
|
|
122
|
-
resolve(repo: string, ref: string): Promise<string | undefined>;
|
|
123
|
-
latest(repo: string): Promise<string | undefined>;
|
|
124
|
-
};
|
|
125
|
-
declare class ShareIndexDb {
|
|
126
|
-
private readonly sql;
|
|
127
|
-
private readonly now;
|
|
128
|
-
constructor(sql: Sql, now?: () => Date);
|
|
129
|
-
hasRun(runId: string): boolean;
|
|
130
|
-
/** Idempotent: recording an indexed run again changes nothing. */
|
|
131
|
-
recordRun(run: SharedRun): void;
|
|
132
|
-
repos(): RepoRow[];
|
|
133
|
-
commits(repo: string): CommitRow[];
|
|
134
|
-
runs(repo: string, sha: string): unknown[];
|
|
135
|
-
resolve(repo: string, ref: string): string | undefined;
|
|
136
|
-
latest(repo: string): string | undefined;
|
|
137
|
-
}
|
|
138
|
-
/** Adapt the synchronous index (bun:sqlite) to the app's async interface. */
|
|
139
|
-
declare function asyncIndex(db: ShareIndexDb): ShareIndex;
|
|
140
|
-
//#endregion
|
|
141
|
-
export { r2Files as _, Sql as a, SharedRun as c, BUNDLE_FORMAT as d, BundleFile as f, ShareFiles as g, R2BucketLike as h, ShareIndexDb as i, SharedRunStatus as l, encodeBundle as m, RepoRow as n, SqlValue as o, decodeBundle as p, ShareIndex as r, asyncIndex as s, CommitRow as t, parseUpload as u };
|
|
142
|
-
//# sourceMappingURL=index-db-HdZXelOS.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-db-HdZXelOS.d.mts","names":[],"sources":["../../share/src/files.ts","../../share/src/bundle.ts","../../share/src/upload.ts","../../share/src/index-db.ts"],"mappings":";;KACY;EACV,IAAI,cAAc,QAAQ,eAAe,cAAc;EACvD,IAAI,aAAa,MAAM,sBAAsB;;EAE7C,KAAK,iBAAiB;;;KAIZ;EACV,IAAI,cAAc;IAAU,MAAM,eAAe;;EACjD,IAAI,aAAa,OAAO,sBAAsB;EAC9C,KAAK;IAAW;IAAgB;MAAoB;IAClD;MAAW;;IACX;IACA;;;iBAIY,QAAQ,QAAQ,eAAe;;;;;;;;;;;cCXlC;KAGD;EAAe;EAAc,MAAM;;iBAUzB,aAAa,OAAO,eAAe,QAAQ;;iBA2B3C,aACpB,MAAM,YACN;EAAU;IACT,QAAQ;;;;KCtCC;KAEA;EACV;EACA;EACA;EACA;EACA;EACA;;;KAIU;EACV;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA,QAAQ;;EAER;;EAEA;;;KAUU;EACV,KAAK;EACL,SAAS;EACT,UAAU;;EAEV,OAAO;;iBAGO,YAAY,iBAAiB,eAAe;;;;;;;;;;KC5ChD;EACV,IAAI,GAAG,kBAAkB,QAAQ,aAAa;EAC9C,IAAI,kBAAkB,QAAQ;EAC9B,YAAY,GAAG,YAAY,IAAI;;KAErB;KAEA;EACV;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;;KAIU;EACV,OAAO,gBAAgB;EACvB,UAAU,KAAK,YAAY;EAC3B,SAAS,QAAQ;EACjB,QAAQ,eAAe,QAAQ;EAC/B,KAAK,cAAc,cAAc;;EAEjC,QAAQ,cAAc,cAAc;EACpC,OAAO,eAAe;;cA4CX;mBAEQ;mBACA;EAFnB,YACmB,KAAK,KACL,YAAW;EAK9B,OAAO;;EAKP,UAAU,KAAK;EAwDf,SAAS;EAST,QAAQ,eAAe;EAevB,KAAK,cAAc;EAUnB,QAAQ,cAAc;EAiBtB,OAAO;;;iBASO,WAAW,IAAI,eAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-db-vbqEGFaU.mjs","names":[],"sources":["../../share/src/bundle.ts","../../share/src/html.ts","../../share/src/paths.ts","../../share/src/upload.ts","../../share/src/app.ts","../../share/src/index-db.ts"],"sourcesContent":["/**\n * A run bundle: the snapshot files for one run, as one gzip-compressed body.\n *\n * \"EKBUNDLE\" (8 bytes) · header length (u32 BE) · header JSON · file bytes…\n * header = { format: 1, files: [{ path, size }, …] }, bytes in that order.\n *\n * Both ends are EvalKit, so this is simpler than tar and has no path-length limit.\n */\nexport const BUNDLE_FORMAT = 1;\nconst MAGIC = new TextEncoder().encode('EKBUNDLE');\n\nexport type BundleFile = { path: string; data: Uint8Array };\n\nasync function pipe(\n data: Uint8Array,\n transform: CompressionStream | DecompressionStream,\n): Promise<Uint8Array> {\n const stream = new Blob([data as BlobPart]).stream().pipeThrough(transform);\n return new Uint8Array(await new Response(stream).arrayBuffer());\n}\n\nexport async function encodeBundle(files: BundleFile[]): Promise<Uint8Array> {\n const header = new TextEncoder().encode(\n JSON.stringify({\n format: BUNDLE_FORMAT,\n files: files.map(({ path, data }) => ({ path, size: data.byteLength })),\n }),\n );\n const total =\n MAGIC.length +\n 4 +\n header.length +\n files.reduce((sum, file) => sum + file.data.byteLength, 0);\n const raw = new Uint8Array(total);\n raw.set(MAGIC, 0);\n new DataView(raw.buffer).setUint32(MAGIC.length, header.length);\n raw.set(header, MAGIC.length + 4);\n let offset = MAGIC.length + 4 + header.length;\n for (const file of files) {\n raw.set(file.data, offset);\n offset += file.data.byteLength;\n }\n return pipe(raw, new CompressionStream('gzip'));\n}\n\nexport class BundleError extends Error {}\n\n/** Decode and check the framing; path rules are enforced by the caller. */\nexport async function decodeBundle(\n body: Uint8Array,\n limits: { maxBytes: number },\n): Promise<BundleFile[]> {\n let raw: Uint8Array;\n try {\n raw = await pipe(body, new DecompressionStream('gzip'));\n } catch {\n throw new BundleError('Body is not a gzip-compressed EvalKit bundle');\n }\n if (raw.byteLength > limits.maxBytes)\n throw new BundleError(`Bundle exceeds ${limits.maxBytes} bytes`);\n if (\n raw.byteLength < MAGIC.length + 4 ||\n MAGIC.some((byte, index) => raw[index] !== byte)\n )\n throw new BundleError('Not an EvalKit bundle');\n const view = new DataView(raw.buffer, raw.byteOffset, raw.byteLength);\n const headerLength = view.getUint32(MAGIC.length);\n const start = MAGIC.length + 4;\n let header: { format?: unknown; files?: { path: unknown; size: unknown }[] };\n try {\n header = JSON.parse(\n new TextDecoder().decode(raw.subarray(start, start + headerLength)),\n );\n } catch {\n throw new BundleError('Bundle header is not valid JSON');\n }\n if (header.format !== BUNDLE_FORMAT)\n throw new BundleError(`Unsupported bundle format ${String(header.format)}`);\n if (!Array.isArray(header.files))\n throw new BundleError('Bundle header has no file list');\n let offset = start + headerLength;\n const files: BundleFile[] = [];\n for (const entry of header.files) {\n if (\n typeof entry.path !== 'string' ||\n typeof entry.size !== 'number' ||\n !Number.isSafeInteger(entry.size) ||\n entry.size < 0 ||\n offset + entry.size > raw.byteLength\n )\n throw new BundleError('Bundle file list does not match its contents');\n files.push({\n path: entry.path,\n data: raw.subarray(offset, offset + entry.size),\n });\n offset += entry.size;\n }\n if (offset !== raw.byteLength)\n throw new BundleError('Bundle has trailing bytes');\n return files;\n}\n","/**\n * Turn the dashboard's index.html into a read-only page. The app derives its\n * router basename from `<base href>`. A static snapshot reads `data/…` below\n * the base; on the share server, `share` says where the API is.\n */\nexport type ShareContext = {\n /** All repositories: `/api/v1/repos`. */\n repos: string;\n /** This repository's commits, for the version picker. */\n commits?: string;\n /** This commit's snapshot data (replaces `<base>/data/`). */\n data?: string;\n repo?: string;\n /** A ref or SHA with no shared results. */\n missing?: string;\n};\n\nexport function dashboardIndex(\n html: string,\n options: { base: string; assets?: string; share?: ShareContext },\n): string {\n const attrs = [\n 'data-evalkit-snapshot=\"static\"',\n ...(options.share\n ? [`data-evalkit-share=\"${escapeAttr(JSON.stringify(options.share))}\"`]\n : []),\n ].join(' ');\n const result = html\n .replace('<html lang=\"en\">', `<html lang=\"en\" ${attrs}>`)\n .replace(\n '<head>',\n `<head>\\n <base href=\"${escapeAttr(options.base)}\" />`,\n )\n .replaceAll('\"/assets/', `\"${options.assets ?? './assets/'}`);\n if (\n !result.includes('data-evalkit-snapshot=\"static\"') ||\n !result.includes('<base href=')\n )\n throw new Error('Bundled dashboard index.html has an unexpected shape');\n return result;\n}\n\nfunction escapeAttr(value: string): string {\n return value\n .replaceAll('&', '&')\n .replaceAll('\"', '"')\n .replaceAll('<', '<');\n}\n","const UUID =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\nconst TRIAL_JSON =\n /^trials\\/([^/]+)\\/(detail|events|artifacts|workspace)\\.json$/;\nconst TRIAL_FILE = /^trials\\/([^/]+)\\/workspace\\/(.+)$/;\n\nexport const isUuid = (value: string) => UUID.test(value);\nexport const isSha = (value: string) => /^[0-9a-f]{40}$/.test(value);\n\n/** One path segment that cannot escape or alias another location. */\nexport function safeSegment(segment: string): boolean {\n return (\n segment.length > 0 &&\n segment.length <= 255 &&\n segment !== '.' &&\n segment !== '..' &&\n !/[\\\\/\\0]/.test(segment)\n );\n}\n\n/**\n * The only files a run bundle may contain (the snapshot format from\n * `evalkit build`, for one run). Never evaluator workspaces.\n */\nexport function allowedRunPath(path: string): boolean {\n if (path === 'run.json' || path === 'catalog.json' || path === 'trials.json')\n return true;\n const json = TRIAL_JSON.exec(path);\n if (json) return isUuid(json[1]!);\n const file = TRIAL_FILE.exec(path);\n return Boolean(\n file && isUuid(file[1]!) && file[2]!.split('/').every(safeSegment),\n );\n}\n\n/**\n * Repository key: normalized host/path, plus `/~<project>` for an eval\n * project below the repository root. Used in storage keys and URLs.\n */\nexport function repoKey(source: { repo: string; project: string }): string {\n return source.project ? `${source.repo}/~${source.project}` : source.repo;\n}\n\nexport function validRepoKey(key: string): boolean {\n const segments = key.split('/');\n return (\n segments.length >= 2 &&\n !segments.includes('-') &&\n segments.every(safeSegment)\n );\n}\n","import type { BundleFile } from './bundle.js';\nimport {\n allowedRunPath,\n isSha,\n isUuid,\n repoKey,\n validRepoKey,\n} from './paths.js';\n\n/** Rejected input: the client sent something the server will not store. */\nexport class Rejected extends Error {}\n\n/** Finished runs only: a shared run's files are immutable once stored. */\nexport type SharedRunStatus = 'passed' | 'failed' | 'errored';\n\nexport type SharedSource = {\n repo: string;\n project: string;\n commit: string;\n ref?: string;\n committedAt?: string;\n dirty: boolean;\n};\n\n/** The fields of an uploaded run.json the server relies on. */\nexport type SharedRun = {\n id: string;\n evalId: string;\n suiteId?: string;\n status: SharedRunStatus;\n score?: number;\n startedAt: string;\n source: SharedSource;\n /** Repository key (`repo` plus `/~project`), checked to be URL- and path-safe. */\n repoKey: string;\n /** The whole run.json object, served as-is in runs.json. */\n summary: unknown;\n};\n\nexport type RunCatalog = {\n catalog: unknown[];\n evals: unknown[];\n suites: unknown[];\n};\n\n/** A run bundle that passed every check; storing it cannot fail on its contents. */\nexport type RunUpload = {\n run: SharedRun;\n runJson: Uint8Array;\n catalog?: Uint8Array;\n /** trials.json and trials/** files. */\n files: BundleFile[];\n};\n\nexport function parseUpload(bundle: readonly BundleFile[]): RunUpload {\n const byPath = new Map<string, Uint8Array>();\n for (const file of bundle) {\n if (!allowedRunPath(file.path))\n throw new Rejected(`File not allowed in a run bundle: ${file.path}`);\n if (byPath.has(file.path))\n throw new Rejected(`Duplicate file in bundle: ${file.path}`);\n byPath.set(file.path, file.data);\n }\n const runJson = byPath.get('run.json');\n if (!runJson) throw new Rejected('Bundle has no run.json');\n const catalog = byPath.get('catalog.json');\n if (catalog) parseCatalog(catalog);\n return {\n run: parseRun(runJson),\n runJson,\n ...(catalog ? { catalog } : {}),\n files: bundle.filter(\n (file) => file.path !== 'run.json' && file.path !== 'catalog.json',\n ),\n };\n}\n\nexport function parseRun(data: Uint8Array): SharedRun {\n const value = record(parseJson(data, 'run.json'), 'run.json');\n const source = record(value.source, 'run.json source');\n const id = text(value.id, 'id');\n if (!isUuid(id)) throw new Rejected('run.json id must be a UUID');\n const commit = text(source.commit, 'source.commit');\n if (!isSha(commit))\n throw new Rejected('source.commit must be a full 40-character SHA');\n if (typeof source.dirty !== 'boolean')\n throw new Rejected('source.dirty must be a boolean');\n const status = value.status;\n if (status !== 'passed' && status !== 'failed' && status !== 'errored')\n throw new Rejected(\n `Only finished runs can be shared (status ${JSON.stringify(status)})`,\n );\n if (value.score !== undefined && typeof value.score !== 'number')\n throw new Rejected('score must be a number');\n const shared: SharedSource = {\n repo: text(source.repo, 'source.repo'),\n project: projectPath(source.project),\n commit,\n dirty: source.dirty,\n ...optionalText(source.ref, 'ref', 'source.ref'),\n ...optionalText(source.committedAt, 'committedAt', 'source.committedAt'),\n };\n const key = repoKey(shared);\n if (!validRepoKey(key)) throw new Rejected(`Invalid repository: ${key}`);\n return {\n id,\n evalId: text(value.evalId, 'evalId'),\n status,\n startedAt: text(value.startedAt, 'startedAt'),\n source: shared,\n repoKey: key,\n summary: value,\n ...optionalText(value.suiteId, 'suiteId', 'suiteId'),\n ...(typeof value.score === 'number' ? { score: value.score } : {}),\n };\n}\n\nexport function parseCatalog(data: Uint8Array): RunCatalog {\n const value = record(parseJson(data, 'catalog.json'), 'catalog.json');\n const list = (field: keyof RunCatalog) => {\n const items = value[field];\n if (!Array.isArray(items))\n throw new Rejected(`catalog.json ${field} must be a list`);\n return items as unknown[];\n };\n return {\n catalog: list('catalog'),\n evals: list('evals'),\n suites: list('suites'),\n };\n}\n\n/** The eval project's path in the repository; `''` at the root. */\nfunction projectPath(value: unknown): string {\n if (typeof value !== 'string')\n throw new Rejected('source.project must be a string');\n return value;\n}\n\nfunction parseJson(data: Uint8Array, name: string): unknown {\n try {\n return JSON.parse(new TextDecoder().decode(data));\n } catch {\n throw new Rejected(`${name} is not valid JSON`);\n }\n}\n\nfunction record(value: unknown, name: string): Record<string, unknown> {\n if (!value || typeof value !== 'object' || Array.isArray(value))\n throw new Rejected(`${name} must be an object`);\n return value as Record<string, unknown>;\n}\n\nfunction text(value: unknown, name: string): string {\n if (typeof value !== 'string' || !value)\n throw new Rejected(`${name} must be a non-empty string`);\n return value;\n}\n\nfunction optionalText<K extends string>(\n value: unknown,\n key: K,\n name: string,\n): Partial<Record<K, string>> {\n if (value === undefined || value === null || value === '') return {};\n return { [key]: text(value, name) } as Record<K, string>;\n}\n","import { Hono, type Context } from 'hono';\nimport { BundleError, decodeBundle } from './bundle.js';\nimport type { ShareFiles } from './files.js';\nimport { dashboardIndex } from './html.js';\nimport type { ShareIndex } from './index-db.js';\nimport { isSha, isUuid, safeSegment, validRepoKey } from './paths.js';\nimport {\n parseCatalog,\n parseRun,\n parseUpload,\n Rejected,\n type RunCatalog,\n type RunUpload,\n type SharedRun,\n} from './upload.js';\n\n/** The bundled dashboard: its index.html template and its JS/CSS files. */\nexport type DashboardAssets = {\n index(): Promise<string>;\n get(path: string): Promise<Response | null>;\n};\n\n/** One structured log event. Bounded fields only; never file contents. */\nexport type ShareEvent =\n | {\n event: 'share.upload';\n outcome: 'created' | 'exists';\n repo: string;\n commit: string;\n runId: string;\n files: number;\n bytes: number;\n }\n | { event: 'share.upload'; outcome: 'rejected'; reason: string }\n | { event: 'share.reindex'; runs: number; indexed: number }\n | { event: 'share.error'; method: string; path: string; error: string };\n\nexport type ShareAppOptions = {\n files: ShareFiles;\n index: ShareIndex;\n assets: DashboardAssets;\n /** Uncompressed bundle limit; the compressed body must also fit a Worker request. */\n maxBundleBytes?: number;\n /** Defaults to one JSON line per event on stdout (Workers Logs indexes these). */\n log?: (event: ShareEvent) => void;\n};\n\n/** What a non-API path shows. */\ntype SharePage =\n | { kind: 'repositories' }\n | { kind: 'missing'; repo: string; ref?: string }\n | { kind: 'commit'; repo: string; sha: string };\n\nconst IMMUTABLE = 'public, max-age=31536000, immutable';\nconst NO_CACHE = { 'cache-control': 'no-cache' };\nconst RUN_FILE =\n /^repos\\/(.+)\\/commits\\/([0-9a-f]{40})\\/runs\\/([^/]+)\\/run\\.json$/;\nconst EMPTY_CATALOG: RunCatalog = { catalog: [], evals: [], suites: [] };\n\nconst jsonLine = (event: ShareEvent) => console.log(JSON.stringify(event));\n\n/**\n * The share server: a small JSON API plus the dashboard app. It stores\n * uploaded run bundles and shows one read-only snapshot per repository commit.\n *\n * POST /api/v1/uploads one run bundle\n * POST /api/v1/reindex rebuild the index from stored run.json files\n * GET /api/v1/repos indexed repositories\n * GET /api/v1/repos/<repo>/-/commits commits, newest first\n * GET /api/v1/repos/<repo>/-/<sha>/data/… snapshot data\n * GET /assets/* dashboard JS/CSS\n * GET /<repo> → latest commit\n * GET /<repo>/-/<ref|prefix>/… → full SHA\n * GET everything else the dashboard app\n *\n * There is no authentication: run it on a private network.\n */\nexport function createShareApp(options: ShareAppOptions) {\n const { files, index, assets } = options;\n const log = options.log ?? jsonLine;\n const maxBundleBytes = options.maxBundleBytes ?? 256 * 1024 * 1024;\n const app = new Hono();\n\n app.onError((error, context) => {\n log({\n event: 'share.error',\n method: context.req.method,\n path: context.req.path,\n error: error instanceof Error ? error.message : String(error),\n });\n return context.json({ error: 'Internal error' }, 500);\n });\n\n app.post('/api/v1/uploads', async (context) => {\n let upload: RunUpload;\n try {\n const body = new Uint8Array(await context.req.arrayBuffer());\n upload = parseUpload(\n await decodeBundle(body, { maxBytes: maxBundleBytes }),\n );\n } catch (error) {\n if (!(error instanceof BundleError || error instanceof Rejected))\n throw error;\n log({\n event: 'share.upload',\n outcome: 'rejected',\n reason: error.message,\n });\n return context.json({ error: error.message }, 400);\n }\n const { run } = upload;\n const url = new URL(\n `/${run.repoKey}/-/${run.source.commit}/runs/${run.id}`,\n context.req.url,\n ).href;\n const exists = await index.hasRun(run.id);\n if (!exists) await storeRun(upload);\n const outcome = exists ? 'exists' : 'created';\n log({\n event: 'share.upload',\n outcome,\n repo: run.repoKey,\n commit: run.source.commit,\n runId: run.id,\n files: upload.files.length,\n bytes: upload.files.reduce((sum, file) => sum + file.data.byteLength, 0),\n });\n return context.json(\n { status: outcome, url },\n outcome === 'created' ? 201 : 200,\n );\n });\n\n /** Files first, index last: a run becomes visible only once it is indexed. */\n async function storeRun({\n run,\n runJson,\n catalog,\n files: runFiles,\n }: RunUpload) {\n const commitBase = `repos/${run.repoKey}/commits/${run.source.commit}`;\n const runBase = `${commitBase}/runs/${run.id}`;\n for (const file of runFiles)\n await files.put(`${runBase}/${file.path}`, file.data);\n // A committed run's catalog describes the commit; a dirty run's only fills a gap.\n if (\n catalog &&\n (!run.source.dirty || !(await files.get(`${commitBase}/catalog.json`)))\n )\n await files.put(`${commitBase}/catalog.json`, catalog);\n await files.put(`${runBase}/run.json`, runJson);\n await index.recordRun(run);\n }\n\n app.post('/api/v1/reindex', async (context) => {\n let runs = 0;\n let indexed = 0;\n for await (const key of files.list('repos/')) {\n if (!RUN_FILE.test(key)) continue;\n runs += 1;\n const run = storedRun(await readBytes(await files.get(key)));\n if (!run || (await index.hasRun(run.id))) continue;\n await index.recordRun(run);\n indexed += 1;\n }\n log({ event: 'share.reindex', runs, indexed });\n return context.json({ runs, indexed });\n });\n\n app.get('/api/v1/repos', async (context) =>\n context.json({ repos: await index.repos() }, 200, NO_CACHE),\n );\n\n // /api/v1/repos/<repo>/-/commits and /api/v1/repos/<repo>/-/<sha>/data/…\n app.get('/api/v1/repos/*', async (context) => {\n const path = context.req.path.slice('/api/v1/repos/'.length);\n const marker = path.indexOf('/-/');\n const key = marker === -1 ? '' : path.slice(0, marker);\n if (!validRepoKey(key))\n return context.json({ error: 'Unknown repository' }, 404);\n const [sha = '', kind, ...segments] = path.slice(marker + 3).split('/');\n if (sha === 'commits' && kind === undefined)\n return context.json(\n { repo: key, commits: await index.commits(key) },\n 200,\n NO_CACHE,\n );\n if (!isSha(sha) || kind !== 'data')\n return context.json({ error: 'Not found' }, 404);\n return serveData(context, key, sha, segments.map(decodeURIComponent));\n });\n\n // The bundled dashboard's JS/CSS. A Worker serves these as static assets\n // before this app runs; the Bun server serves them here.\n app.get('/assets/*', async (context) => {\n const path = context.req.path.slice('/assets/'.length);\n if (!path.split('/').every(safeSegment)) return context.notFound();\n const response = await assets.get(path);\n if (!response) return context.notFound();\n const headers = new Headers(response.headers);\n headers.set('cache-control', IMMUTABLE);\n return new Response(response.body, { status: response.status, headers });\n });\n\n app.all('/api/*', (context) => context.json({ error: 'Not found' }, 404));\n\n // Every other path is the dashboard app. Short refs resolve to full SHAs\n // first, so every commit page URL names one immutable commit.\n app.get('*', async (context) => {\n const url = new URL(context.req.url);\n const path = url.pathname.replace(/\\/+$/, '');\n const marker = path.indexOf('/-/');\n if (marker === -1) return repositoryPage(context, path.slice(1));\n const repo = path.slice(1, marker);\n const [ref = '', ...rest] = url.pathname.slice(marker + 3).split('/');\n const sha = validRepoKey(repo)\n ? await index.resolve(repo, decodeURIComponent(ref))\n : undefined;\n if (!sha) return dashboardPage(context, { kind: 'missing', repo, ref });\n if (sha !== ref)\n return context.redirect(\n `/${repo}/-/${sha}/${rest.join('/')}${url.search}`,\n );\n return dashboardPage(context, { kind: 'commit', repo, sha });\n });\n\n /** `/` lists repositories; `/<repo>` opens its latest commit. */\n async function repositoryPage(context: Context, repo: string) {\n if (!repo) return dashboardPage(context, { kind: 'repositories' });\n const latest = validRepoKey(repo) ? await index.latest(repo) : undefined;\n if (latest) return context.redirect(`/${repo}/-/${latest}/`);\n return dashboardPage(context, { kind: 'missing', repo });\n }\n\n /** The dashboard's index.html, told where this page's data lives. */\n async function dashboardPage(context: Context, page: SharePage) {\n const api =\n page.kind === 'repositories'\n ? undefined\n : `/api/v1/repos/${page.repo}/-/`;\n return context.html(\n dashboardIndex(await assets.index(), {\n base: page.kind === 'commit' ? `/${page.repo}/-/${page.sha}/` : '/',\n assets: '/assets/',\n share: {\n repos: '/api/v1/repos',\n ...(page.kind === 'repositories'\n ? {}\n : { repo: page.repo, commits: `${api}commits` }),\n ...(page.kind === 'commit' ? { data: `${api}${page.sha}/` } : {}),\n ...(page.kind === 'missing' && page.ref ? { missing: page.ref } : {}),\n },\n }),\n page.kind === 'missing' ? 404 : 200,\n NO_CACHE,\n );\n }\n\n async function serveData(\n context: Context,\n key: string,\n sha: string,\n segments: string[],\n ) {\n if (!segments.every(safeSegment)) return context.notFound();\n const path = segments.join('/');\n const commitBase = `repos/${key}/commits/${sha}`;\n if (path === 'runs.json')\n return context.json({ runs: await index.runs(key, sha) }, 200, NO_CACHE); // grows as runs are uploaded\n if (['catalog.json', 'evals.json', 'suites.json'].includes(path)) {\n // Parsed at upload, so a stored catalog is always well formed.\n const data = await readBytes(\n await files.get(`${commitBase}/catalog.json`),\n );\n const catalog = data ? parseCatalog(data) : EMPTY_CATALOG;\n return context.json(\n path === 'catalog.json'\n ? { evals: catalog.catalog }\n : path === 'evals.json'\n ? { evals: catalog.evals }\n : { suites: catalog.suites },\n 200,\n NO_CACHE,\n );\n }\n const runFile = /^runs\\/([^/]+)\\/(trials\\.json|trials\\/.+)$/.exec(path);\n if (!runFile || !isUuid(runFile[1]!)) return context.notFound();\n const body = await files.get(`${commitBase}/${path}`);\n if (!body) return context.notFound();\n const json = path.endsWith('.json') && !path.includes('/workspace/');\n return new Response(body as BodyInit, {\n headers: json\n ? { 'content-type': 'application/json', 'cache-control': IMMUTABLE }\n : {\n // Candidate files are untrusted content on this origin: never render them.\n 'content-type': 'application/octet-stream',\n 'x-content-type-options': 'nosniff',\n 'content-security-policy': 'sandbox',\n 'cache-control': IMMUTABLE,\n },\n });\n }\n\n return app;\n}\n\n/** A stored run.json, or undefined if it is not a shareable run. */\nfunction storedRun(data: Uint8Array | null): SharedRun | undefined {\n if (!data) return undefined;\n try {\n return parseRun(data);\n } catch (error) {\n if (error instanceof Rejected) return undefined;\n throw error;\n }\n}\n\nasync function readBytes(\n body: ReadableStream<Uint8Array> | Uint8Array | null,\n): Promise<Uint8Array | null> {\n if (!body) return null;\n if (body instanceof Uint8Array) return body;\n return new Uint8Array(await new Response(body).arrayBuffer());\n}\n","import type { SharedRun } from './upload.js';\n\n/**\n * The share server's metadata index: repositories, commits and runs.\n * R2 (or a directory) holds the files; this index answers \"what exists\" and\n * every listing query. It is derived from stored run.json files and can be\n * rebuilt from them (`POST /api/v1/reindex`).\n */\n\n/** Synchronous SQLite access, provided by Durable Object storage or bun:sqlite. */\nexport type Sql = {\n all<T>(query: string, ...params: SqlValue[]): T[];\n run(query: string, ...params: SqlValue[]): void;\n transaction<T>(work: () => T): T;\n};\nexport type SqlValue = string | number | null;\n\nexport type RepoRow = {\n key: string;\n url: string;\n project: string;\n firstSeenAt: string;\n lastUploadAt: string;\n commits: number;\n};\n\nexport type CommitRow = {\n commit: string;\n ref?: string;\n committedAt?: string;\n firstSeenAt: string;\n runs: number;\n passed: number;\n failed: number;\n};\n\n/** The operations the app needs; async so a Durable Object can sit behind it. */\nexport type ShareIndex = {\n hasRun(runId: string): Promise<boolean>;\n recordRun(run: SharedRun): Promise<void>;\n repos(): Promise<RepoRow[]>;\n commits(repo: string): Promise<CommitRow[]>;\n runs(repo: string, sha: string): Promise<unknown[]>;\n /** Full SHA for a full SHA, a unique prefix (≥ 7), or a ref's latest commit. */\n resolve(repo: string, ref: string): Promise<string | undefined>;\n latest(repo: string): Promise<string | undefined>;\n};\n\nconst MIGRATIONS = [\n `CREATE TABLE IF NOT EXISTS repos (\n key TEXT PRIMARY KEY,\n url TEXT NOT NULL,\n project TEXT NOT NULL,\n first_seen_at TEXT NOT NULL,\n last_upload_at TEXT NOT NULL\n )`,\n `CREATE TABLE IF NOT EXISTS commits (\n repo TEXT NOT NULL,\n sha TEXT NOT NULL,\n ref TEXT,\n committed_at TEXT,\n first_seen_at TEXT NOT NULL,\n runs INTEGER NOT NULL DEFAULT 0,\n passed INTEGER NOT NULL DEFAULT 0,\n failed INTEGER NOT NULL DEFAULT 0,\n PRIMARY KEY (repo, sha)\n )`,\n `CREATE TABLE IF NOT EXISTS runs (\n id TEXT PRIMARY KEY,\n repo TEXT NOT NULL,\n sha TEXT NOT NULL,\n eval_id TEXT NOT NULL,\n suite_id TEXT,\n status TEXT NOT NULL,\n score REAL,\n started_at TEXT NOT NULL,\n dirty INTEGER NOT NULL,\n summary_json TEXT NOT NULL,\n uploaded_at TEXT NOT NULL\n )`,\n `CREATE INDEX IF NOT EXISTS commits_by_time ON commits (repo, committed_at DESC)`,\n `CREATE INDEX IF NOT EXISTS commits_by_ref ON commits (repo, ref, committed_at DESC)`,\n `CREATE INDEX IF NOT EXISTS runs_by_commit ON runs (repo, sha)`,\n `CREATE INDEX IF NOT EXISTS runs_by_eval ON runs (repo, eval_id, started_at)`,\n];\n\n/** Newest first; commits without a commit time order by first upload. */\nconst BY_TIME = `ORDER BY COALESCE(committed_at, first_seen_at) DESC, first_seen_at DESC`;\n\nexport class ShareIndexDb {\n constructor(\n private readonly sql: Sql,\n private readonly now: () => Date = () => new Date(),\n ) {\n for (const statement of MIGRATIONS) sql.run(statement);\n }\n\n hasRun(runId: string): boolean {\n return this.sql.all('SELECT 1 FROM runs WHERE id = ?', runId).length > 0;\n }\n\n /** Idempotent: recording an indexed run again changes nothing. */\n recordRun(run: SharedRun): void {\n const at = this.now().toISOString();\n this.sql.transaction(() => {\n if (this.hasRun(run.id)) return;\n this.sql.run(\n `INSERT INTO repos (key, url, project, first_seen_at, last_upload_at)\n VALUES (?, ?, ?, ?, ?)\n ON CONFLICT (key) DO UPDATE SET last_upload_at = excluded.last_upload_at`,\n run.repoKey,\n run.source.repo,\n run.source.project,\n at,\n at,\n );\n this.sql.run(\n `INSERT INTO commits (repo, sha, ref, committed_at, first_seen_at)\n VALUES (?, ?, ?, ?, ?)\n ON CONFLICT (repo, sha) DO UPDATE SET\n ref = COALESCE(commits.ref, excluded.ref),\n committed_at = COALESCE(commits.committed_at, excluded.committed_at)`,\n run.repoKey,\n run.source.commit,\n run.source.ref ?? null,\n run.source.committedAt ?? null,\n at,\n );\n this.sql.run(\n `INSERT INTO runs (id, repo, sha, eval_id, suite_id, status, score,\n started_at, dirty, summary_json, uploaded_at)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,\n run.id,\n run.repoKey,\n run.source.commit,\n run.evalId,\n run.suiteId ?? null,\n run.status,\n run.score ?? null,\n run.startedAt,\n run.source.dirty ? 1 : 0,\n JSON.stringify(run.summary),\n at,\n );\n // Dirty runs are shown but never count towards a commit's results.\n if (!run.source.dirty)\n this.sql.run(\n `UPDATE commits SET runs = runs + 1,\n passed = passed + ?, failed = failed + ?\n WHERE repo = ? AND sha = ?`,\n run.status === 'passed' ? 1 : 0,\n run.status === 'failed' || run.status === 'errored' ? 1 : 0,\n run.repoKey,\n run.source.commit,\n );\n });\n }\n\n repos(): RepoRow[] {\n return this.sql.all<RepoRow>(\n `SELECT key, url, project, first_seen_at AS firstSeenAt,\n last_upload_at AS lastUploadAt,\n (SELECT COUNT(*) FROM commits WHERE commits.repo = repos.key) AS commits\n FROM repos ORDER BY last_upload_at DESC`,\n );\n }\n\n commits(repo: string): CommitRow[] {\n return this.sql\n .all<CommitRow & { ref: string | null; committedAt: string | null }>(\n `SELECT sha AS \"commit\", ref, committed_at AS committedAt,\n first_seen_at AS firstSeenAt, runs, passed, failed\n FROM commits WHERE repo = ? ${BY_TIME}`,\n repo,\n )\n .map(({ ref, committedAt, ...row }) => ({\n ...row,\n ...(ref ? { ref } : {}),\n ...(committedAt ? { committedAt } : {}),\n }));\n }\n\n runs(repo: string, sha: string): unknown[] {\n return this.sql\n .all<{ summary_json: string }>(\n 'SELECT summary_json FROM runs WHERE repo = ? AND sha = ? ORDER BY started_at DESC',\n repo,\n sha,\n )\n .map((row) => JSON.parse(row.summary_json) as unknown);\n }\n\n resolve(repo: string, ref: string): string | undefined {\n if (/^[0-9a-f]{7,40}$/.test(ref)) {\n const matches = this.sql.all<{ sha: string }>(\n 'SELECT sha FROM commits WHERE repo = ? AND sha LIKE ? LIMIT 2',\n repo,\n `${ref}%`,\n );\n if (matches.length === 1) return matches[0]!.sha;\n if (matches.length > 1) return undefined; // ambiguous prefix\n }\n return this.sql.all<{ sha: string }>(\n `SELECT sha FROM commits WHERE repo = ? AND ref = ? ${BY_TIME} LIMIT 1`,\n repo,\n ref,\n )[0]?.sha;\n }\n\n latest(repo: string): string | undefined {\n return this.sql.all<{ sha: string }>(\n `SELECT sha FROM commits WHERE repo = ? ${BY_TIME} LIMIT 1`,\n repo,\n )[0]?.sha;\n }\n}\n\n/** Adapt the synchronous index (bun:sqlite) to the app's async interface. */\nexport function asyncIndex(db: ShareIndexDb): ShareIndex {\n return {\n hasRun: async (runId) => db.hasRun(runId),\n recordRun: async (run) => db.recordRun(run),\n repos: async () => db.repos(),\n commits: async (repo) => db.commits(repo),\n runs: async (repo, sha) => db.runs(repo, sha),\n resolve: async (repo, ref) => db.resolve(repo, ref),\n latest: async (repo) => db.latest(repo),\n };\n}\n"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AAE,IAAI,IAAI,CAAC;GACrB,GAAI,cAAc,EAAE,YAAY,IAAI,CAAC;EACvC,EAAE;CACN;CAEA,KAAK,MAAc,KAAwB;EACzC,OAAO,KAAK,IACT,IACC,qFACA,MACA,GACF,CAAC,CACA,KAAK,QAAQ,KAAK,MAAM,IAAI,YAAY,CAAY;CACzD;CAEA,QAAQ,MAAc,KAAiC;EACrD,IAAI,mBAAmB,KAAK,GAAG,GAAG;GAChC,MAAM,UAAU,KAAK,IAAI,IACvB,iEACA,MACA,GAAG,IAAI,EACT;GACA,IAAI,QAAQ,WAAW,GAAG,OAAO,QAAQ,EAAE,CAAE;GAC7C,IAAI,QAAQ,SAAS,GAAG,OAAO,KAAA;EACjC;EACA,OAAO,KAAK,IAAI,IACd,sDAAsD,QAAQ,WAC9D,MACA,GACF,CAAC,CAAC,EAAE,EAAE;CACR;CAEA,OAAO,MAAkC;EACvC,OAAO,KAAK,IAAI,IACd,0CAA0C,QAAQ,WAClD,IACF,CAAC,CAAC,EAAE,EAAE;CACR;AACF;;AAGA,SAAgB,WAAW,IAA8B;CACvD,OAAO;EACL,QAAQ,OAAO,UAAU,GAAG,OAAO,KAAK;EACxC,WAAW,OAAO,QAAQ,GAAG,UAAU,GAAG;EAC1C,OAAO,YAAY,GAAG,MAAM;EAC5B,SAAS,OAAO,SAAS,GAAG,QAAQ,IAAI;EACxC,MAAM,OAAO,MAAM,QAAQ,GAAG,KAAK,MAAM,GAAG;EAC5C,SAAS,OAAO,MAAM,QAAQ,GAAG,QAAQ,MAAM,GAAG;EAClD,QAAQ,OAAO,SAAS,GAAG,OAAO,IAAI;CACxC;AACF"}
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../core/src/config.ts","../../agents/src/index.ts"],"sourcesContent":["import type { EvalDefinition, EvalRegistry } from './index.js';\nimport type { EvalMatrixDefinition } from './matrix.js';\n\nexport type EvalkitConfig = {\n /** Paths are relative to evalkit.config.js/ts, not the invoking shell directory. */\n testDir?: string;\n include?: readonly string[];\n exclude?: readonly string[];\n /** Explicit definitions are an alternative to discovery (e.g. hosted registries). */\n evals?: readonly EvalDefinition[];\n registry?: EvalRegistry;\n /** Applied to every discovered eval. Values are forwarded, never provider-interpreted. */\n matrix?: Omit<EvalMatrixDefinition, 'evals' | 'id'> & { id?: string };\n execution?: { concurrency?: number; trials?: number; maxCells?: number };\n reportDir?: string;\n sandboxDir?: string;\n /** Where `evalkit share` uploads results. `EVALKIT_SHARE_URL` overrides it. */\n share?: { url: string };\n};\n\n/** Pure, typed project configuration. Loading/discovery belongs to the CLI. */\nexport function defineConfig<const T extends EvalkitConfig>(\n configuration: T,\n): T {\n return configuration;\n}\n","import { defineAgent, type AutAdapter } from '@evalkit/core';\n\nexport type AgentsSdkAutOptions = {\n endpoint: string;\n agent: string;\n getToken?: () => Promise<string | undefined> | string | undefined;\n instanceName?: (context: { runId: string; trialId: string }) => string;\n};\n\n/** Deferred remote Agents SDK transport. */\nexport function agentsSdk(_options: AgentsSdkAutOptions): AutAdapter {\n throw new Error('Agents SDK transport is not implemented yet');\n}\n\nexport type PiAutOptions = {\n command?: string;\n /** Additional non-secret Pi arguments, such as an explicit model selection. */\n args?: string[];\n};\n\n/** A local, one-prompt-per-turn AUT backed by Pi's non-interactive print mode. */\nexport function piAgent(options: PiAutOptions = {}): AutAdapter {\n const command = options.command ?? 'pi';\n return defineAgent({\n identity: {\n name: 'Pi Agent',\n kind: 'process',\n id: 'pi-agent',\n },\n runtimes: { local: { kind: 'process', configuration: { command } } },\n async start({ context, onEvent }) {\n await onEvent({ kind: 'started', timestamp: new Date().toISOString() });\n let turn = 0;\n return {\n async send(message: string) {\n turn += 1;\n await onEvent({\n kind: 'turn-started',\n turn,\n timestamp: new Date().toISOString(),\n });\n const process = Bun.spawn(\n [\n command,\n '--print',\n '--no-session',\n '--no-tools',\n ...(options.args ?? []),\n message,\n ],\n { cwd: context.workspace.root, stdout: 'pipe', stderr: 'pipe' },\n );\n const [stdout, stderr, exitCode] = await Promise.all([\n new Response(process.stdout).text(),\n new Response(process.stderr).text(),\n process.exited,\n ]);\n if (exitCode !== 0)\n throw new Error(`Pi exited with ${exitCode}: ${stderr.trim()}`);\n await onEvent({\n kind: 'message',\n role: 'assistant',\n content: stdout.trim(),\n timestamp: new Date().toISOString(),\n });\n await onEvent({\n kind: 'turn-completed',\n turn,\n timestamp: new Date().toISOString(),\n });\n },\n async close() {\n await onEvent({\n kind: 'completed',\n timestamp: new Date().toISOString(),\n });\n },\n };\n },\n });\n}\n"],"mappings":";;;AAqBA,SAAgB,aACd,eACG;CACH,OAAO;AACT;;;;ACJA,SAAgB,QAAQ,UAAwB,CAAC,GAAe;CAC9D,MAAM,UAAU,QAAQ,WAAW;CACnC,OAAO,YAAY;EACjB,UAAU;GACR,MAAM;GACN,MAAM;GACN,IAAI;EACN;EACA,UAAU,EAAE,OAAO;GAAE,MAAM;GAAW,eAAe,EAAE,QAAQ;EAAE,EAAE;EACnE,MAAM,MAAM,EAAE,SAAS,WAAW;GAChC,MAAM,QAAQ;IAAE,MAAM;IAAW,4BAAW,IAAI,KAAK,EAAA,CAAE,YAAY;GAAE,CAAC;GACtE,IAAI,OAAO;GACX,OAAO;IACL,MAAM,KAAK,SAAiB;KAC1B,QAAQ;KACR,MAAM,QAAQ;MACZ,MAAM;MACN;MACA,4BAAW,IAAI,KAAK,EAAA,CAAE,YAAY;KACpC,CAAC;KACD,MAAM,UAAU,IAAI,MAClB;MACE;MACA;MACA;MACA;MACA,GAAI,QAAQ,QAAQ,CAAC;MACrB;KACF,GACA;MAAE,KAAK,QAAQ,UAAU;MAAM,QAAQ;MAAQ,QAAQ;KAAO,CAChE;KACA,MAAM,CAAC,QAAQ,QAAQ,YAAY,MAAM,QAAQ,IAAI;MACnD,IAAI,SAAS,QAAQ,MAAM,CAAC,CAAC,KAAK;MAClC,IAAI,SAAS,QAAQ,MAAM,CAAC,CAAC,KAAK;MAClC,QAAQ;KACV,CAAC;KACD,IAAI,aAAa,GACf,MAAM,IAAI,MAAM,kBAAkB,SAAS,IAAI,OAAO,KAAK,GAAG;KAChE,MAAM,QAAQ;MACZ,MAAM;MACN,MAAM;MACN,SAAS,OAAO,KAAK;MACrB,4BAAW,IAAI,KAAK,EAAA,CAAE,YAAY;KACpC,CAAC;KACD,MAAM,QAAQ;MACZ,MAAM;MACN;MACA,4BAAW,IAAI,KAAK,EAAA,CAAE,YAAY;KACpC,CAAC;IACH;IACA,MAAM,QAAQ;KACZ,MAAM,QAAQ;MACZ,MAAM;MACN,4BAAW,IAAI,KAAK,EAAA,CAAE,YAAY;KACpC,CAAC;IACH;GACF;EACF;CACF,CAAC;AACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"share-worker.mjs","names":[],"sources":["../../share/src/index-do.ts","../../share/src/worker.ts"],"sourcesContent":["import { ShareIndexDb, type ShareIndex, type SqlValue } from './index-db.js';\n\n/** The subset of Durable Object state used by the index. */\ntype DurableObjectStateLike = {\n storage: {\n sql: {\n exec(query: string, ...params: SqlValue[]): { toArray(): unknown[] };\n };\n transactionSync<T>(work: () => T): T;\n };\n};\n\ntype DurableObjectNamespaceLike = {\n idFromName(name: string): unknown;\n get(id: unknown): { fetch(request: Request): Promise<Response> };\n};\n\nconst METHODS = [\n 'hasRun',\n 'recordRun',\n 'repos',\n 'commits',\n 'runs',\n 'resolve',\n 'latest',\n] as const satisfies readonly (keyof ShareIndex)[];\ntype Method = (typeof METHODS)[number];\n\n/**\n * One SQLite-backed Durable Object holds the whole index. It serializes every\n * write, so concurrent uploads for the same commit never race.\n * Bind it with `new_sqlite_classes: [\"ShareIndex\"]`.\n */\nexport class ShareIndexObject {\n private readonly db: ShareIndexDb;\n\n constructor(state: DurableObjectStateLike) {\n const { sql } = state.storage;\n this.db = new ShareIndexDb({\n all: <T>(query: string, ...params: SqlValue[]) =>\n sql.exec(query, ...params).toArray() as T[],\n run: (query, ...params) => {\n sql.exec(query, ...params);\n },\n transaction: (work) => state.storage.transactionSync(work),\n });\n }\n\n async fetch(request: Request): Promise<Response> {\n const { method, args } = (await request.json()) as {\n method: Method;\n args: unknown[];\n };\n if (!METHODS.includes(method))\n return new Response(`Unknown index method: ${String(method)}`, {\n status: 400,\n });\n const call = this.db[method] as (...values: unknown[]) => unknown;\n return Response.json({ result: call.apply(this.db, args) ?? null });\n }\n}\n\n/** The Worker's view of the index: each call is one request to the object. */\nexport function durableObjectIndex(\n namespace: DurableObjectNamespaceLike,\n): ShareIndex {\n const stub = namespace.get(namespace.idFromName('index'));\n const call = async (method: Method, ...args: unknown[]) => {\n const response = await stub.fetch(\n new Request('https://share-index/rpc', {\n method: 'POST',\n body: JSON.stringify({ method, args }),\n }),\n );\n if (!response.ok)\n throw new Error(`Index ${method} failed: ${await response.text()}`);\n const { result } = (await response.json()) as { result: unknown };\n return result ?? undefined;\n };\n return Object.fromEntries(\n METHODS.map((method) => [\n method,\n (...args: unknown[]) => call(method, ...args),\n ]),\n ) as unknown as ShareIndex;\n}\n","import { createShareApp } from './app.js';\nimport { r2Files, type R2BucketLike } from './files.js';\nimport { durableObjectIndex } from './index-do.js';\n\nexport { ShareIndexObject as ShareIndex } from './index-do.js';\n\n/**\n * Bindings for a share server Worker (see `wrangler.jsonc` in this package):\n * RESULTS (R2), INDEX (SQLite Durable Object, class ShareIndex), and ASSETS\n * (static assets: the bundled dashboard, with `run_worker_first: true`).\n */\nexport type ShareEnv = {\n RESULTS: R2BucketLike;\n INDEX: Parameters<typeof durableObjectIndex>[0];\n ASSETS: { fetch(request: Request): Promise<Response> };\n};\n\nexport default {\n fetch(request: Request, env: ShareEnv): Promise<Response> | Response {\n const asset = (path: string) =>\n env.ASSETS.fetch(new Request(new URL(path, 'https://assets.local')));\n const app = createShareApp({\n files: r2Files(env.RESULTS),\n index: durableObjectIndex(env.INDEX),\n assets: {\n // Static assets redirect /index.html to /, so ask for / directly.\n index: async () => (await asset('/')).text(),\n get: async (path) => {\n const response = await asset(`/assets/${path}`);\n return response.ok ? response : null;\n },\n },\n });\n return app.fetch(request);\n },\n};\n"],"mappings":";;;AAiBA,MAAM,UAAU;CACd;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;AAQA,IAAa,mBAAb,MAA8B;CAC5B;CAEA,YAAY,OAA+B;EACzC,MAAM,EAAE,QAAQ,MAAM;EACtB,KAAK,KAAK,IAAI,aAAa;GACzB,MAAS,OAAe,GAAG,WACzB,IAAI,KAAK,OAAO,GAAG,MAAM,CAAC,CAAC,QAAQ;GACrC,MAAM,OAAO,GAAG,WAAW;IACzB,IAAI,KAAK,OAAO,GAAG,MAAM;GAC3B;GACA,cAAc,SAAS,MAAM,QAAQ,gBAAgB,IAAI;EAC3D,CAAC;CACH;CAEA,MAAM,MAAM,SAAqC;EAC/C,MAAM,EAAE,QAAQ,SAAU,MAAM,QAAQ,KAAK;EAI7C,IAAI,CAAC,QAAQ,SAAS,MAAM,GAC1B,OAAO,IAAI,SAAS,yBAAyB,OAAO,MAAM,KAAK,EAC7D,QAAQ,IACV,CAAC;EACH,MAAM,OAAO,KAAK,GAAG;EACrB,OAAO,SAAS,KAAK,EAAE,QAAQ,KAAK,MAAM,KAAK,IAAI,IAAI,KAAK,KAAK,CAAC;CACpE;AACF;;AAGA,SAAgB,mBACd,WACY;CACZ,MAAM,OAAO,UAAU,IAAI,UAAU,WAAW,OAAO,CAAC;CACxD,MAAM,OAAO,OAAO,QAAgB,GAAG,SAAoB;EACzD,MAAM,WAAW,MAAM,KAAK,MAC1B,IAAI,QAAQ,2BAA2B;GACrC,QAAQ;GACR,MAAM,KAAK,UAAU;IAAE;IAAQ;GAAK,CAAC;EACvC,CAAC,CACH;EACA,IAAI,CAAC,SAAS,IACZ,MAAM,IAAI,MAAM,SAAS,OAAO,WAAW,MAAM,SAAS,KAAK,GAAG;EACpE,MAAM,EAAE,WAAY,MAAM,SAAS,KAAK;EACxC,OAAO,UAAU,KAAA;CACnB;CACA,OAAO,OAAO,YACZ,QAAQ,KAAK,WAAW,CACtB,SACC,GAAG,SAAoB,KAAK,QAAQ,GAAG,IAAI,CAC9C,CAAC,CACH;AACF;;;ACpEA,IAAA,iBAAe,EACb,MAAM,SAAkB,KAA6C;CACnE,MAAM,SAAS,SACb,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,IAAI,MAAM,sBAAsB,CAAC,CAAC;CAarE,OAZY,eAAe;EACzB,OAAO,QAAQ,IAAI,OAAO;EAC1B,OAAO,mBAAmB,IAAI,KAAK;EACnC,QAAQ;GAEN,OAAO,aAAa,MAAM,MAAM,GAAG,EAAA,CAAG,KAAK;GAC3C,KAAK,OAAO,SAAS;IACnB,MAAM,WAAW,MAAM,MAAM,WAAW,MAAM;IAC9C,OAAO,SAAS,KAAK,WAAW;GAClC;EACF;CACF,CACS,CAAC,CAAC,MAAM,OAAO;AAC1B,EACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"src-ButXPY8P.mjs","names":[],"sources":["../../core/src/identity.ts","../../core/src/canonical-json.ts","../../core/src/matrix.ts","../../core/src/schema.ts","../../core/src/trajectory.ts","../../core/src/index.ts"],"sourcesContent":["import * as Schema from 'effect/Schema';\n\nexport const ResourceKindSchema = Schema.Literal('run', 'trial', 'artifact');\nexport type ResourceKind = typeof ResourceKindSchema.Type;\n\n/** Human-authored project-local identifier; never a generated resource URI. */\nexport function authorId(value: string): string {\n if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value))\n throw new Error(`ID must be lowercase kebab-case: ${value}`);\n return value;\n}\n\n/** RFC 4122 textual UUID. EvalKit accepts v4/v7 and other valid UUID versions. */\nexport const UuidSchema = Schema.String.pipe(\n Schema.pattern(\n /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n ),\n);\nexport type Uuid = typeof UuidSchema.Type;\n\nexport type ResourceUri<TKind extends ResourceKind = ResourceKind> =\n `evalkit:${TKind}:${string}`;\n\nexport const ResourceUriSchema = Schema.String.pipe(\n Schema.pattern(\n /^evalkit:(run|trial|artifact):[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,\n ),\n);\n\nexport function resourceUriSchema<TKind extends ResourceKind>(kind: TKind) {\n return Schema.String.pipe(\n Schema.pattern(\n new RegExp(\n `^evalkit:${kind}:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`,\n 'i',\n ),\n ),\n );\n}\n\nexport function resourceUri<TKind extends ResourceKind>(\n kind: TKind,\n uuid: Uuid,\n): ResourceUri<TKind> {\n return `evalkit:${kind}:${uuid}`;\n}\n\nexport function parseResourceUri<TKind extends ResourceKind>(\n value: string,\n expectedKind?: TKind,\n): { kind: TKind; uuid: Uuid; uri: ResourceUri<TKind> } {\n const match = /^evalkit:(run|trial|artifact):(.+)$/.exec(value);\n if (!match) throw new Error(`Invalid EvalKit resource URI: ${value}`);\n const kind = match[1] as TKind;\n if (expectedKind && kind !== expectedKind)\n throw new Error(\n `Expected an EvalKit ${expectedKind} URI; received ${value}`,\n );\n const uuid = Schema.decodeUnknownSync(UuidSchema)(match[2]) as Uuid;\n return { kind, uuid, uri: resourceUri(kind, uuid) };\n}\n\nexport function resourceUuid(value: string, expectedKind?: ResourceKind): Uuid {\n return parseResourceUri(value, expectedKind).uuid;\n}\n","// Dependency-free so browser bundles (the dashboard) can import it without\n// pulling in the Effect schemas behind the package root.\nimport type { JsonValue } from './index.js';\n\n/** Canonical JSON: keys sorted recursively, array order preserved. Rejects non-JSON inputs. */\nexport function canonicalParameters(value: JsonValue): string {\n if (value === null || typeof value === 'string' || typeof value === 'boolean')\n return JSON.stringify(value);\n if (typeof value === 'number' && Number.isFinite(value))\n return JSON.stringify(value);\n if (Array.isArray(value))\n return `[${value.map(canonicalParameters).join(',')}]`;\n if (\n typeof value === 'object' &&\n Object.getPrototypeOf(value) === Object.prototype\n ) {\n return `{${Object.keys(value)\n .sort()\n .map(\n (key) => `${JSON.stringify(key)}:${canonicalParameters(value[key]!)}`,\n )\n .join(',')}}`;\n }\n throw new Error('Matrix parameters must be finite JSON values');\n}\n","import {\n authoringId,\n type EvalDefinition,\n type JsonObject,\n type JsonValue,\n} from './index.js';\nimport { canonicalParameters } from './canonical-json.js';\n\nexport { canonicalParameters };\n\nexport type MatrixSelection = {\n /** Base eval IDs. Unknown values fail before dispatch. */\n evals?: readonly string[];\n /** Select existing dimension values, rather than overwriting every cell with the same value. */\n parameters?: Readonly<Record<string, readonly JsonValue[]>>;\n /** Overrides for non-dimension execution settings (e.g. maxTokens). */\n overrides?: JsonObject;\n};\nexport type EvalMatrixCell = {\n matrixId: string;\n /** Stable canonical key including matrix, base eval and effective parameters. */\n key: string;\n eval: EvalDefinition;\n parameters: JsonObject;\n};\nexport type EvalMatrixDefinition = {\n id: string;\n name?: string;\n evals: readonly EvalDefinition[];\n parameters: Readonly<Record<string, readonly JsonValue[]>>;\n defaults?: JsonObject;\n /** Complete correlated assignments, crossed with independent parameters. */\n cases?: readonly JsonObject[];\n /** Partial patterns over declared dimensions; matching cells are never run. */\n exclude?: readonly JsonObject[];\n};\nexport type EvalMatrix = EvalMatrixDefinition & {\n kind: 'matrix';\n count(selection?: MatrixSelection): number;\n cells(selection?: MatrixSelection): IterableIterator<EvalMatrixCell>;\n};\n\nconst COUNT_BUDGET = 100_000;\nconst equal = (a: JsonValue, b: JsonValue) =>\n canonicalParameters(a) === canonicalParameters(b);\nconst matches = (pattern: JsonObject, values: JsonObject) =>\n Object.entries(pattern).every(\n ([key, value]) => Object.hasOwn(values, key) && equal(values[key]!, value),\n );\n\nexport function defineEvalMatrix<const T extends EvalMatrixDefinition>(\n definition: T,\n): EvalMatrix & T {\n authoringId(definition);\n const identities = new Set<string>();\n for (const evaluation of definition.evals) {\n const id = authoringId(evaluation);\n if (identities.has(id)) throw new Error(`Duplicate matrix eval: ${id}`);\n identities.add(id);\n }\n const axes = Object.entries(definition.parameters).sort(([a], [b]) =>\n a.localeCompare(b),\n );\n for (const [axis, choices] of axes) {\n if (!axis || !choices.length)\n throw new Error(`Matrix axis ${axis} must have at least one value`);\n const keys = choices.map(canonicalParameters);\n if (new Set(keys).size !== keys.length)\n throw new Error(`Duplicate values for matrix axis: ${axis}`);\n }\n canonicalParameters(definition.defaults ?? {});\n if (definition.cases && !definition.cases.length)\n throw new Error('Matrix cases must have at least one assignment');\n const cases = definition.cases ?? [{}];\n const caseKeys = Object.keys(cases[0]!).sort();\n const caseSignatures = new Set<string>();\n for (const assignment of cases) {\n canonicalParameters(assignment);\n if (Object.keys(assignment).sort().join('\\0') !== caseKeys.join('\\0'))\n throw new Error('Matrix cases must have the same dimensions');\n for (const key of caseKeys) {\n if (\n Object.hasOwn(definition.parameters, key) ||\n Object.hasOwn(definition.defaults ?? {}, key)\n )\n throw new Error(\n `Matrix case dimension conflicts with axis or default: ${key}`,\n );\n }\n const signature = canonicalParameters(assignment);\n if (caseSignatures.has(signature)) throw new Error('Duplicate matrix case');\n caseSignatures.add(signature);\n }\n const declared = new Set([...caseKeys, ...axes.map(([key]) => key)]);\n const exclusions = definition.exclude ?? [];\n for (const [index, pattern] of exclusions.entries()) {\n canonicalParameters(pattern);\n if (!Object.keys(pattern).length)\n throw new Error(`Matrix exclude[${index}] must specify a dimension`);\n for (const key of Object.keys(pattern))\n if (!declared.has(key))\n throw new Error(`Unknown matrix exclude dimension: ${key}`);\n if (\n !cases.some((assignment) =>\n Object.entries(pattern).every(\n ([key, value]) =>\n !Object.hasOwn(assignment, key) || equal(assignment[key]!, value),\n ),\n ) ||\n !axes.every(\n ([key, choices]) =>\n !Object.hasOwn(pattern, key) ||\n choices.some((choice) => equal(choice, pattern[key]!)),\n )\n )\n throw new Error(`Matrix exclude[${index}] matches no declared cell`);\n }\n const caseChoices = new Map(\n caseKeys.map((key) => [key, cases.map((assignment) => assignment[key]!)]),\n );\n\n function select(selection: MatrixSelection = {}) {\n for (const key of Object.keys(selection.parameters ?? {})) {\n if (!declared.has(key)) throw new Error(`Unknown matrix axis: ${key}`);\n }\n for (const key of Object.keys(selection.overrides ?? {})) {\n if (declared.has(key))\n throw new Error(`Select axis ${key}; do not override it`);\n }\n canonicalParameters(selection.overrides ?? {});\n for (const name of selection.evals ?? []) {\n if (!definition.evals.some((e) => e.id === name))\n throw new Error(`Unknown matrix eval: ${name}`);\n }\n const evals = definition.evals.filter(\n (e) => !selection.evals || selection.evals.includes(e.id),\n );\n const selected = new Map<string, Set<string>>();\n for (const [key, values] of Object.entries(selection.parameters ?? {})) {\n const available = definition.parameters[key] ?? caseChoices.get(key)!;\n const keys = new Set(values.map(canonicalParameters));\n for (const value of keys)\n if (!available.some((choice) => canonicalParameters(choice) === value))\n throw new Error(`Unknown ${key} value: ${value}`);\n selected.set(key, keys);\n }\n const filteredCases = cases.filter((assignment) =>\n caseKeys.every(\n (key) =>\n !selected.has(key) ||\n selected.get(key)!.has(canonicalParameters(assignment[key]!)),\n ),\n );\n const selectedAxes = axes.map(\n ([axis, choices]) =>\n [\n axis,\n choices.filter(\n (choice) =>\n !selected.has(axis) ||\n selected.get(axis)!.has(canonicalParameters(choice)),\n ),\n ] as const,\n );\n return {\n evals,\n cases: filteredCases,\n axes: selectedAxes,\n defaults: { ...definition.defaults, ...selection.overrides },\n };\n }\n\n /** Inclusion/exclusion counts sparse forbidden patterns without expanding the product. */\n function countCase(\n assignment: JsonObject,\n selectedAxes: readonly (readonly [string, readonly JsonValue[]])[],\n budget: { remaining: number },\n ): number {\n const patterns = exclusions\n .filter((pattern) =>\n Object.entries(pattern).every(\n ([key, value]) =>\n !Object.hasOwn(assignment, key) || equal(assignment[key]!, value),\n ),\n )\n .map(\n (pattern) =>\n Object.fromEntries(\n Object.entries(pattern).filter(\n ([key]) => !Object.hasOwn(assignment, key),\n ),\n ) as JsonObject,\n );\n const product = selectedAxes.reduce(\n (count, [, values]) => count * values.length,\n 1,\n );\n if (!patterns.length) return product;\n if (patterns.some((pattern) => !Object.keys(pattern).length)) return 0;\n function intersection(pattern: JsonObject): number {\n return selectedAxes.reduce(\n (count, [axis, choices]) =>\n count *\n (Object.hasOwn(pattern, axis)\n ? Number(choices.some((choice) => equal(choice, pattern[axis]!)))\n : choices.length),\n 1,\n );\n }\n let eligible = product;\n function visit(start: number, combined: JsonObject, sign: number): void {\n for (let index = start; index < patterns.length; index++) {\n if (--budget.remaining < 0)\n throw new Error(\n 'Exact matrix count exceeds planning budget; narrow the selection or exclusions',\n );\n const pattern = patterns[index]!;\n if (\n Object.entries(pattern).some(\n ([key, value]) =>\n Object.hasOwn(combined, key) && !equal(combined[key]!, value),\n )\n )\n continue;\n const merged = { ...combined, ...pattern };\n const matches = intersection(merged);\n if (!matches) continue;\n eligible += sign * matches;\n visit(index + 1, merged, -sign);\n }\n }\n visit(0, {}, -1);\n return eligible;\n }\n\n return {\n ...definition,\n kind: 'matrix',\n count(selection) {\n const selected = select(selection);\n const budget = { remaining: COUNT_BUDGET };\n const perEval = selected.cases.reduce(\n (count, assignment) =>\n count + countCase(assignment, selected.axes, budget),\n 0,\n );\n const count = perEval * selected.evals.length;\n if (!Number.isSafeInteger(count))\n throw new Error('Matrix exceeds safe cell count');\n return count;\n },\n *cells(selection) {\n const selected = select(selection);\n function* expand(\n index: number,\n values: JsonObject,\n ): Generator<JsonObject> {\n if (index === selected.axes.length) {\n yield values;\n return;\n }\n const [axis, choices] = selected.axes[index]!;\n for (const choice of choices)\n yield* expand(index + 1, { ...values, [axis]: choice });\n }\n for (const evaluation of selected.evals) {\n for (const assignment of selected.cases) {\n for (const dimensions of expand(0, assignment)) {\n if (exclusions.some((pattern) => matches(pattern, dimensions)))\n continue;\n const parameters = { ...selected.defaults, ...dimensions };\n yield {\n matrixId: definition.id,\n eval: evaluation,\n parameters,\n key: canonicalParameters({\n matrix: authoringId(definition),\n eval: authoringId(evaluation),\n parameters,\n }),\n };\n }\n }\n }\n },\n };\n}\n","import * as Schema from 'effect/Schema';\nimport { resourceUriSchema } from './identity.js';\nimport type { JsonValue, TrajectoryEvent } from './index.js';\n\n/** Runtime schemas for serialized EvalKit report and API boundaries. */\nexport const RunStatusSchema = Schema.Literal(\n 'running',\n 'completed',\n 'failed',\n 'cancelled',\n);\n\nexport const RecordedErrorSchema = Schema.Struct({\n name: Schema.String,\n message: Schema.String,\n stack: Schema.optional(Schema.String),\n});\n\nexport const AutIdentitySchema = Schema.Struct({\n name: Schema.optional(Schema.String),\n kind: Schema.String,\n id: Schema.String,\n version: Schema.optional(Schema.String),\n});\n\n// Payloads and scorer evidence are provider-neutral JSON, not benchmark-specific objects.\nexport const JsonValueSchema: Schema.Schema<JsonValue> = Schema.suspend(() =>\n Schema.Union(\n Schema.Null,\n Schema.Boolean,\n Schema.Number,\n Schema.String,\n Schema.mutable(Schema.Array(JsonValueSchema)),\n Schema.Record({ key: Schema.String, value: JsonValueSchema }),\n ),\n);\n\nconst ParametersSchema = Schema.Record({\n key: Schema.String,\n value: JsonValueSchema,\n});\nconst MatrixCellSchema = Schema.Struct({\n id: Schema.String,\n cellKey: Schema.String,\n});\n\nexport const RunSourceSchema = Schema.Struct({\n repo: Schema.String,\n project: Schema.String,\n commit: Schema.String,\n ref: Schema.optional(Schema.String),\n committedAt: Schema.optional(Schema.String),\n dirty: Schema.Boolean,\n ci: Schema.optional(\n Schema.Struct({\n provider: Schema.String,\n pipeline: Schema.optional(Schema.String),\n job: Schema.optional(Schema.String),\n url: Schema.optional(Schema.String),\n }),\n ),\n});\n\nexport const RunMetadataSchema = Schema.Struct({\n schemaVersion: Schema.Literal(2, 3, 4),\n runUri: resourceUriSchema('run'),\n evalId: Schema.String,\n suiteId: Schema.optional(Schema.String),\n parameters: Schema.optional(ParametersSchema),\n matrix: Schema.optional(MatrixCellSchema),\n aut: Schema.optional(AutIdentitySchema),\n startedAt: Schema.String,\n source: Schema.optional(RunSourceSchema),\n});\n\nexport const TrialMetadataSchema = Schema.Struct({\n schemaVersion: Schema.Literal(2, 3, 4),\n runUri: resourceUriSchema('run'),\n trialUri: resourceUriSchema('trial'),\n trialIndex: Schema.Number,\n evalId: Schema.String,\n parameters: Schema.optional(ParametersSchema),\n matrix: Schema.optional(MatrixCellSchema),\n aut: Schema.optional(AutIdentitySchema),\n startedAt: Schema.String,\n});\n\n/** On-disk manifests include a lifecycle status; older finalized manifests may still say running. */\nexport const RunManifestSchema = Schema.Struct({\n ...RunMetadataSchema.fields,\n status: Schema.optional(RunStatusSchema),\n});\nexport const TrialManifestSchema = Schema.Struct({\n ...TrialMetadataSchema.fields,\n status: Schema.optional(RunStatusSchema),\n});\n\nexport const UsageSchema = Schema.Struct({\n inputTokens: Schema.optional(Schema.Number),\n outputTokens: Schema.optional(Schema.Number),\n totalTokens: Schema.optional(Schema.Number),\n});\n\nexport const JudgeRunInfoSchema = Schema.Struct({\n agent: Schema.optional(\n Schema.Struct({\n id: Schema.String,\n kind: Schema.String,\n name: Schema.optional(Schema.String),\n version: Schema.optional(Schema.String),\n }),\n ),\n usage: Schema.optional(UsageSchema),\n events: Schema.optional(Schema.mutable(Schema.Array(JsonValueSchema))),\n});\n\nexport const ScoreResultSchema = Schema.Struct({\n name: Schema.String,\n kind: Schema.Literal('predicate', 'judge'),\n value: Schema.optional(Schema.Number),\n passed: Schema.optional(Schema.Boolean),\n explanation: Schema.optional(Schema.String),\n evidence: Schema.optional(JsonValueSchema),\n judge: Schema.optional(JudgeRunInfoSchema),\n durationMs: Schema.Number,\n error: Schema.optional(RecordedErrorSchema),\n});\nexport const CheckpointResultSchema = Schema.Struct({\n step: Schema.Number,\n kind: Schema.Literal('predicate', 'judge', 'expect-tool-call'),\n name: Schema.String,\n status: Schema.Literal('passed', 'failed', 'error', 'skipped'),\n value: Schema.optional(Schema.Number),\n passed: Schema.optional(Schema.Boolean),\n explanation: Schema.optional(Schema.String),\n evidence: Schema.optional(JsonValueSchema),\n judge: Schema.optional(JudgeRunInfoSchema),\n durationMs: Schema.optional(Schema.Number),\n error: Schema.optional(RecordedErrorSchema),\n matchedToolCall: Schema.optional(\n Schema.Struct({ eventIndex: Schema.Number, id: Schema.String }),\n ),\n});\nexport const TrialScoringSchema = Schema.Struct({\n results: Schema.mutable(Schema.Array(ScoreResultSchema)),\n checkpoints: Schema.optional(\n Schema.mutable(Schema.Array(CheckpointResultSchema)),\n ),\n skippedScorers: Schema.optional(Schema.mutable(Schema.Array(Schema.String))),\n overall: Schema.optional(Schema.Number),\n passed: Schema.Boolean,\n});\nexport const ArtifactEntrySchema = Schema.Struct({\n path: Schema.String,\n kind: Schema.Literal('file', 'directory'),\n size: Schema.optional(Schema.Number),\n});\nexport const TrialSummarySchema = Schema.Struct({\n status: RunStatusSchema,\n endedAt: Schema.String,\n durationMs: Schema.optional(Schema.Number),\n scoring: Schema.optional(TrialScoringSchema),\n artifacts: Schema.optional(Schema.mutable(Schema.Array(ArtifactEntrySchema))),\n error: Schema.optional(RecordedErrorSchema),\n});\n\nexport const RunSummarySchema = Schema.Struct({\n status: RunStatusSchema,\n endedAt: Schema.String,\n durationMs: Schema.optional(Schema.Number),\n trialCount: Schema.Number,\n passed: Schema.Number,\n failed: Schema.Number,\n error: Schema.optional(RecordedErrorSchema),\n});\n\nconst autEvent = {\n started: Schema.Struct({\n source: Schema.Literal('aut'),\n kind: Schema.Literal('started'),\n timestamp: Schema.String,\n }),\n message: Schema.Struct({\n source: Schema.Literal('aut'),\n kind: Schema.Literal('message'),\n role: Schema.Literal('system', 'user', 'assistant', 'tool'),\n content: JsonValueSchema,\n timestamp: Schema.String,\n }),\n toolCall: Schema.Struct({\n source: Schema.Literal('aut'),\n kind: Schema.Literal('tool-call'),\n id: Schema.String,\n name: Schema.String,\n arguments: JsonValueSchema,\n timestamp: Schema.String,\n }),\n toolResult: Schema.Struct({\n source: Schema.Literal('aut'),\n kind: Schema.Literal('tool-result'),\n id: Schema.String,\n name: Schema.optional(Schema.String),\n result: JsonValueSchema,\n timestamp: Schema.String,\n }),\n turnStarted: Schema.Struct({\n source: Schema.Literal('aut'),\n kind: Schema.Literal('turn-started'),\n turn: Schema.Number,\n timestamp: Schema.String,\n }),\n turnCompleted: Schema.Struct({\n source: Schema.Literal('aut'),\n kind: Schema.Literal('turn-completed'),\n turn: Schema.Number,\n timestamp: Schema.String,\n latencyMs: Schema.optional(Schema.Number),\n usage: Schema.optional(UsageSchema),\n }),\n completed: Schema.Struct({\n source: Schema.Literal('aut'),\n kind: Schema.Literal('completed'),\n output: Schema.optional(JsonValueSchema),\n timestamp: Schema.String,\n }),\n error: Schema.Struct({\n source: Schema.Literal('aut'),\n kind: Schema.Literal('error'),\n error: RecordedErrorSchema,\n timestamp: Schema.String,\n }),\n};\nconst runnerEvent = {\n trialStarted: Schema.Struct({\n source: Schema.Literal('runner'),\n kind: Schema.Literal('trial-started'),\n timestamp: Schema.String,\n }),\n stepStarted: Schema.Struct({\n source: Schema.Literal('runner'),\n kind: Schema.Literal('transcript-step-started'),\n step: Schema.Number,\n timestamp: Schema.String,\n }),\n stepCompleted: Schema.Struct({\n source: Schema.Literal('runner'),\n kind: Schema.Literal('transcript-step-completed'),\n step: Schema.Number,\n timestamp: Schema.String,\n }),\n stepSkipped: Schema.Struct({\n source: Schema.Literal('runner'),\n kind: Schema.Literal('transcript-step-skipped'),\n step: Schema.Number,\n timestamp: Schema.String,\n }),\n checkpointStarted: Schema.Struct({\n source: Schema.Literal('runner'),\n kind: Schema.Literal('checkpoint-started'),\n step: Schema.Number,\n name: Schema.String,\n timestamp: Schema.String,\n }),\n checkpointCompleted: Schema.Struct({\n source: Schema.Literal('runner'),\n kind: Schema.Literal('checkpoint-completed'),\n step: Schema.Number,\n status: Schema.Literal('passed', 'failed'),\n timestamp: Schema.String,\n }),\n checkpointError: Schema.Struct({\n source: Schema.Literal('runner'),\n kind: Schema.Literal('checkpoint-error'),\n step: Schema.Number,\n error: RecordedErrorSchema,\n timestamp: Schema.String,\n }),\n scorerStarted: Schema.Struct({\n source: Schema.Literal('runner'),\n kind: Schema.Literal('scorer-started'),\n scorer: Schema.String,\n timestamp: Schema.String,\n }),\n scorerCompleted: Schema.Struct({\n source: Schema.Literal('runner'),\n kind: Schema.Literal('scorer-completed'),\n scorer: Schema.String,\n value: Schema.Number,\n timestamp: Schema.String,\n }),\n scorerFailed: Schema.Struct({\n source: Schema.Literal('runner'),\n kind: Schema.Literal('scorer-failed'),\n scorer: Schema.String,\n error: RecordedErrorSchema,\n timestamp: Schema.String,\n }),\n trialCompleted: Schema.Struct({\n source: Schema.Literal('runner'),\n kind: Schema.Literal('trial-completed'),\n timestamp: Schema.String,\n }),\n error: Schema.Struct({\n source: Schema.Literal('runner'),\n kind: Schema.Literal('error'),\n error: RecordedErrorSchema,\n timestamp: Schema.String,\n }),\n};\n\nexport const TrajectoryEventSchema: Schema.Schema<TrajectoryEvent> =\n Schema.Union(...Object.values(autEvent), ...Object.values(runnerEvent));\n\nexport const ApiErrorSchema = Schema.Struct({\n error: Schema.String,\n message: Schema.String,\n});\n","import * as Schema from 'effect/Schema';\nimport type { TrajectoryEvent } from './index.js';\nimport { TrajectoryEventSchema } from './schema.js';\n\n/** Decode one private report's JSONL trajectory; reject malformed/non-event lines with their line number. */\nexport function parseTrajectoryJsonl(contents: string): TrajectoryEvent[] {\n const events: TrajectoryEvent[] = [];\n for (const [index, line] of contents.split(/\\r?\\n/).entries()) {\n if (!line.trim()) continue;\n try {\n events.push(\n Schema.decodeUnknownSync(TrajectoryEventSchema)(JSON.parse(line)),\n );\n } catch (cause) {\n throw new Error(`Invalid trajectory JSONL at line ${index + 1}`, {\n cause,\n });\n }\n }\n return events;\n}\n","import { authorId, type ResourceUri } from './identity.js';\nexport { defineConfig, type EvalkitConfig } from './config.js';\n\nexport type JsonPrimitive = boolean | number | string | null;\nexport type JsonValue =\n JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\nexport type JsonObject = { [key: string]: JsonValue };\n\nexport type AutIdentity = {\n /** Human-readable logical agent name shown in catalogs and dashboards. */\n name?: string;\n kind: string;\n id: string;\n version?: string;\n};\n\nexport type AgentRuntimeName = 'local' | 'sandbox' | 'remote';\n\n/**\n * A serializable runtime requirement for an AUT. Concrete runtime packages own\n * the interpretation of `kind` and `configuration`.\n */\nexport type AgentRuntime = {\n kind: string;\n configuration?: JsonObject;\n};\n\nexport type AgentRuntimes = Partial<Record<AgentRuntimeName, AgentRuntime>>;\n\nexport type Usage = {\n inputTokens?: number;\n outputTokens?: number;\n totalTokens?: number;\n};\n\nexport type RecordedError = {\n name: string;\n message: string;\n stack?: string;\n};\n\nexport type AutEvent =\n | { kind: 'started'; timestamp: string }\n | {\n kind: 'message';\n role: 'system' | 'user' | 'assistant' | 'tool';\n content: JsonValue;\n timestamp: string;\n }\n | {\n kind: 'tool-call';\n id: string;\n name: string;\n arguments: JsonValue;\n timestamp: string;\n }\n | {\n kind: 'tool-result';\n id: string;\n name?: string;\n result: JsonValue;\n timestamp: string;\n }\n | { kind: 'turn-started'; turn: number; timestamp: string }\n | {\n kind: 'turn-completed';\n turn: number;\n timestamp: string;\n latencyMs?: number;\n usage?: Usage;\n }\n | { kind: 'completed'; output?: JsonValue; timestamp: string }\n | { kind: 'error'; error: RecordedError; timestamp: string };\n\nexport type RunnerEvent =\n | { kind: 'trial-started'; timestamp: string }\n | { kind: 'transcript-step-started'; step: number; timestamp: string }\n | { kind: 'transcript-step-completed'; step: number; timestamp: string }\n | { kind: 'transcript-step-skipped'; step: number; timestamp: string }\n | {\n kind: 'checkpoint-started';\n step: number;\n name: string;\n timestamp: string;\n }\n | {\n kind: 'checkpoint-completed';\n step: number;\n status: 'passed' | 'failed';\n timestamp: string;\n }\n | {\n kind: 'checkpoint-error';\n step: number;\n error: RecordedError;\n timestamp: string;\n }\n | { kind: 'scorer-started'; scorer: string; timestamp: string }\n | {\n kind: 'scorer-completed';\n scorer: string;\n value: number;\n timestamp: string;\n }\n | {\n kind: 'scorer-failed';\n scorer: string;\n error: RecordedError;\n timestamp: string;\n }\n | { kind: 'trial-completed'; timestamp: string }\n | { kind: 'error'; error: RecordedError; timestamp: string };\n\nexport type TrajectoryEvent =\n (AutEvent & { source: 'aut' }) | (RunnerEvent & { source: 'runner' });\n\nexport type WorkspaceView = {\n /** Absolute path to this trial-scoped workspace. Do not persist it in reports. */\n root: string;\n};\n\nexport type CandidateWorkspace = WorkspaceView;\nexport type EvaluatorWorkspace = WorkspaceView;\n\nexport type AutContext = {\n runId: string;\n evalId: string;\n trialId: string;\n trialIndex: number;\n metadata: JsonObject;\n /** Run-time parameters supplied by the eval definition or CLI invocation. */\n parameters?: JsonObject;\n runtime?: AgentRuntimeName;\n /** Contains only resources visible to the AUT/model. */\n workspace: CandidateWorkspace;\n /** Private evaluator capability for trusted AUT adapters; never expose this to the model. */\n evaluatorWorkspace: EvaluatorWorkspace;\n};\n\nexport type FixtureContext = Omit<\n AutContext,\n 'workspace' | 'evaluatorWorkspace'\n>;\n\nexport type AutAdapter<TMessage = string> = {\n readonly identity?: AutIdentity;\n /** Available execution environments for this AUT. */\n readonly runtimes?: AgentRuntimes;\n start(options: {\n context: AutContext;\n runtime?: AgentRuntime;\n onEvent: (event: AutEvent) => void | Promise<void>;\n }): Promise<AutSession<TMessage>>;\n};\n\nexport type AutSession<TMessage = string> = {\n /** Resolves once the AUT has completed the turn initiated by this message. */\n send(message: TMessage): Promise<void>;\n close(): Promise<void>;\n};\n\n/**\n * Defines an Agent Under Test without coupling it to a runtime or transport.\n * It preserves the adapter's concrete type for application-specific helpers.\n */\nexport function defineAgent<const T extends AutAdapter>(agent: T): T {\n if (agent.identity) authoringId(agent.identity);\n return agent;\n}\n\nexport type FixtureVisibility = 'candidate' | 'evaluator';\n\nexport type DirectoryFixture = {\n kind: 'directory';\n src: string;\n dst: string;\n visibility: FixtureVisibility;\n};\n\nexport type FileFixture = {\n kind: 'file';\n src: string;\n dst: string;\n visibility: FixtureVisibility;\n};\n\nexport type InlineFixture = {\n kind: 'inline';\n file: string;\n data: string;\n visibility: FixtureVisibility;\n};\n\nexport type DynamicFixture = {\n kind: 'dynamic';\n create(\n context: FixtureContext,\n ): Fixture | Fixture[] | Promise<Fixture | Fixture[]>;\n};\n\nexport type Fixture =\n DirectoryFixture | FileFixture | InlineFixture | DynamicFixture;\n\nfunction defaultFixtureDestination(src: string): string {\n const normalized = src.replace(/\\\\/g, '/').replace(/\\/+$/, '');\n const destination = normalized.slice(normalized.lastIndexOf('/') + 1);\n if (!destination || destination === '.' || destination === '..') {\n throw new Error(`Fixture source needs a basename: ${src}`);\n }\n return destination;\n}\n\n/**\n * Declares a directory relative to the invoking project's working directory.\n * The short form is candidate-visible and copies beneath the source basename.\n */\nexport function directory(\n src: string,\n options: Partial<Omit<DirectoryFixture, 'kind' | 'src'>> = {},\n): DirectoryFixture {\n return {\n kind: 'directory',\n src,\n dst: options.dst ?? defaultFixtureDestination(src),\n visibility: options.visibility ?? 'candidate',\n };\n}\n\nexport function file(\n src: string,\n options: Omit<FileFixture, 'kind' | 'src'>,\n): FileFixture {\n return { kind: 'file', src, ...options };\n}\n\nexport function inlineFile(\n file: string,\n data: string,\n visibility: FixtureVisibility,\n): InlineFixture {\n return { kind: 'inline', file, data, visibility };\n}\n\nexport function dynamic(create: DynamicFixture['create']): DynamicFixture {\n return { kind: 'dynamic', create };\n}\n\nexport type UserStep = {\n kind: 'user';\n message: string;\n};\n\nexport type AgentStep = {\n kind: 'agent';\n expectation: JsonObject;\n};\n\nexport type TurnView = {\n userStepIndex: number;\n events: readonly (AutEvent & { source: 'aut' })[];\n assistantMessages: readonly (Extract<AutEvent, { kind: 'message' }> & {\n role: 'assistant';\n source: 'aut';\n })[];\n toolCalls: readonly {\n eventIndex: number;\n id: string;\n name: string;\n arguments: JsonValue;\n resultObservation: 'observed' | 'absent' | 'ambiguous';\n result?: JsonValue;\n }[];\n lastAssistantText?: string;\n};\n\nexport type ExpectToolCallStep = {\n kind: 'expect-tool-call';\n name: string;\n expected: { name: string; arguments?: JsonValue };\n};\nexport type TranscriptStep =\n UserStep | AgentStep | ScoringRule | ExpectToolCallStep;\n\n/** Observes a tool call in the preceding turn; never invokes a tool. */\nexport function expectToolCall(\n expected: ExpectToolCallStep['expected'],\n): ExpectToolCallStep {\n if (!expected.name.trim())\n throw new Error('Expected tool name must not be empty');\n return { kind: 'expect-tool-call', name: expected.name, expected };\n}\n\nexport function user(message: string): UserStep {\n return { kind: 'user', message };\n}\n\nexport function agent(expectation: JsonObject): AgentStep {\n return { kind: 'agent', expectation };\n}\n\nexport type JudgeRunInfo = {\n agent?: AutIdentity;\n usage?: Usage;\n /** Judge-agent observations; never attributed to the AUT trajectory. */\n events?: JsonValue[];\n};\n\nexport type ScoreValue =\n | number\n | {\n value: number;\n passed?: boolean;\n explanation?: string;\n evidence?: JsonValue;\n /** Judge-agent evidence, never inferred from AUT usage. */\n judge?: JudgeRunInfo;\n };\n\nexport type ScoreResult = {\n name: string;\n kind: 'predicate' | 'judge';\n value?: number;\n passed?: boolean;\n explanation?: string;\n evidence?: JsonValue;\n judge?: JudgeRunInfo;\n durationMs: number;\n error?: RecordedError;\n};\n\nexport type ArtifactView = {\n candidate: CandidateWorkspace;\n evaluator: EvaluatorWorkspace;\n};\n\nexport type ScoringContext = {\n context: AutContext;\n trajectory: { events: readonly TrajectoryEvent[] };\n artifacts: ArtifactView;\n /** Most recent completed turn; absent if no user message has been sent. */\n turn?: TurnView;\n};\n\nexport type PredicateScorer = {\n kind: 'predicate';\n name: string;\n supportsPartial?: boolean;\n run(\n context: ScoringContext,\n ): boolean | ScoreValue | Promise<boolean | ScoreValue>;\n};\n\nexport type JudgeRule = {\n kind: 'judge';\n name: string;\n rubric: string;\n /** Run even when the scenario stopped early or execution failed. */\n supportsPartial?: boolean;\n};\n\nexport type ScoringRule = PredicateScorer | JudgeRule;\n\nexport function predicate(\n name: string,\n run: PredicateScorer['run'],\n options: Pick<PredicateScorer, 'supportsPartial'> = {},\n): PredicateScorer {\n return { kind: 'predicate', name, run, ...options };\n}\n\nexport function judge(\n name: string,\n options: Pick<JudgeRule, 'rubric' | 'supportsPartial'>,\n): JudgeRule {\n if (!name.trim() || !options.rubric.trim())\n throw new Error('Judge name and rubric must not be empty');\n return { kind: 'judge', name, ...options };\n}\n\nexport type EvalPolicy = {\n timeoutMs?: number;\n /** Stop later transcript steps after a failed checkpoint assertion. Default false. */\n failfast?: boolean;\n /** Number of independent trials requested by local and hosted runners. */\n trials?: number;\n};\n\nexport type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {\n id: string;\n name?: string;\n agent: TAgent;\n /** Separate judge agent; its model and tools are never inherited from the AUT. */\n judge?: AutAdapter;\n fixtures?: Fixture[];\n transcript: TranscriptStep[];\n scoring: ScoringRule[];\n policy?: EvalPolicy;\n metadata?: JsonObject;\n};\n\nexport function defineEval<const T extends EvalDefinition>(definition: T): T {\n authoringId(definition);\n let hasUser = false;\n for (const step of definition.transcript) {\n if (step.kind === 'user') hasUser = true;\n else if (step.kind !== 'agent' && !hasUser)\n throw new Error('Checkpoint requires a preceding user step');\n }\n if (\n (definition.transcript.some((step) => step.kind === 'judge') ||\n definition.scoring.some((rule) => rule.kind === 'judge')) &&\n !definition.judge\n )\n throw new Error('Judge rules require an eval judge agent');\n if (definition.judge && definition.judge === definition.agent)\n throw new Error('Judge agent must be distinct from the agent under test');\n return definition;\n}\n\nexport { defineEvalMatrix, canonicalParameters } from './matrix.js';\nexport type { EvalMatrix, EvalMatrixCell, MatrixSelection } from './matrix.js';\nimport type { EvalMatrix } from './matrix.js';\n\nexport type EvalSuite<\n TEvals extends readonly EvalDefinition[] = readonly EvalDefinition[],\n> = {\n id: string;\n name?: string;\n evals: TEvals;\n};\n\nexport function defineSuite<const TSuite extends EvalSuite>(\n suite: TSuite,\n): TSuite {\n authoringId(suite);\n return suite;\n}\n\nexport type EvalRegistration = EvalDefinition | EvalSuite | EvalMatrix;\n\nexport function authoringId(value: { id: string }): string {\n if ('uri' in value || 'uuid' in value || 'slug' in value)\n throw new Error('Authored resources use id, not uri, uuid, or slug');\n return authorId(value.id);\n}\n\nfunction isEvalMatrix(\n registration: EvalRegistration,\n): registration is EvalMatrix {\n return 'kind' in registration && registration.kind === 'matrix';\n}\n\nfunction isEvalSuite(\n registration: EvalRegistration,\n): registration is EvalSuite {\n return !isEvalMatrix(registration) && 'evals' in registration;\n}\n\nexport type EvalRegistry = {\n /** All registered evals, flattened from standalone entries and suites. */\n evals: readonly EvalDefinition[];\n suites: readonly EvalSuite[];\n matrices: readonly EvalMatrix[];\n get(uri: string): EvalDefinition | undefined;\n getSuite(uri: string): EvalSuite | undefined;\n metadata(): EvalRegistryMetadata[];\n suiteMetadata(): EvalSuiteMetadata[];\n catalog(): EvalCatalogEntry[];\n};\n\nexport type EvalRegistryMetadata = {\n id: string;\n name?: string;\n suiteId?: string;\n};\n\nexport type EvalSuiteMetadata = {\n id: string;\n name?: string;\n evalIds: string[];\n};\n\nexport type EvalCatalogFixture = {\n kind: Fixture['kind'];\n source: string;\n destination?: string;\n visibility?: FixtureVisibility;\n};\n\nexport type EvalCatalogEntry = {\n id: string;\n path: string;\n name?: string;\n suiteId?: string;\n agent: {\n name?: string;\n kind: string;\n id?: string;\n version?: string;\n runtimes: Array<{ name: AgentRuntimeName; kind: string }>;\n };\n fixtures: EvalCatalogFixture[];\n trialCount: number;\n scorers: Array<{ name: string; kind: ScoringRule['kind'] }>;\n};\n\n/**\n * Creates an explicit, statically imported eval registry. A suite is a\n * path-like grouping of evals; nesting is presentation derived from its ID.\n */\nexport function registerEvals<\n const TRegistrations extends readonly EvalRegistration[],\n>(registrations: TRegistrations): EvalRegistry {\n const byId = new Map<string, EvalDefinition>();\n const suiteById = new Map<string, EvalSuite>();\n const suiteIdByEvalId = new Map<string, EvalSuite>();\n const standalone: EvalDefinition[] = [];\n const matrices: EvalMatrix[] = [];\n\n for (const registration of registrations) {\n if (isEvalMatrix(registration)) {\n const id = authoringId(registration);\n if (matrices.some((matrix) => authoringId(matrix) === id))\n throw new Error(`Eval registry contains duplicate matrix ID: ${id}`);\n matrices.push(registration);\n continue;\n }\n const suite = isEvalSuite(registration) ? registration : undefined;\n if (suite) {\n const id = authoringId(suite);\n if (suiteById.has(id))\n throw new Error(`Eval registry contains duplicate suite ID: ${id}`);\n suiteById.set(id, suite);\n }\n const evaluations: readonly EvalDefinition[] = suite\n ? suite.evals\n : [registration as EvalDefinition];\n for (const evaluation of evaluations) {\n const id = authoringId(evaluation);\n if (byId.has(id))\n throw new Error(`Eval registry contains duplicate eval ID: ${id}`);\n byId.set(id, evaluation);\n if (suite) suiteIdByEvalId.set(id, suite);\n else standalone.push(evaluation);\n }\n }\n\n const evals = [\n ...standalone,\n ...Array.from(suiteById.values()).flatMap((suite) => suite.evals),\n ];\n return {\n evals,\n suites: [...suiteById.values()],\n matrices,\n get: (id) => byId.get(id),\n getSuite: (id) => suiteById.get(id),\n metadata: () =>\n evals.map((evaluation) => {\n const suite = suiteIdByEvalId.get(authoringId(evaluation));\n return {\n id: evaluation.id,\n ...(evaluation.name ? { name: evaluation.name } : {}),\n ...(suite ? { suiteId: suite.id } : {}),\n };\n }),\n suiteMetadata: () =>\n [...suiteById.values()].map((suite) => ({\n id: suite.id,\n evalIds: suite.evals.map(authoringId),\n ...(suite.name ? { name: suite.name } : {}),\n })),\n catalog: () =>\n evals.map((evaluation) => {\n const suite = suiteIdByEvalId.get(authoringId(evaluation));\n const identity = evaluation.agent.identity;\n return {\n id: evaluation.id,\n path: suite ? `${suite.id}#${evaluation.id}` : evaluation.id,\n ...(evaluation.name ? { name: evaluation.name } : {}),\n ...(suite ? { suiteId: suite.id } : {}),\n agent: {\n ...(identity?.name ? { name: identity.name } : {}),\n kind: identity?.kind ?? 'adapter',\n ...(identity?.id ? { id: identity.id } : {}),\n ...(identity?.version ? { version: identity.version } : {}),\n runtimes: Object.entries(evaluation.agent.runtimes ?? {}).map(\n ([name, runtime]) => ({\n name: name as AgentRuntimeName,\n kind: runtime.kind,\n }),\n ),\n },\n fixtures: (evaluation.fixtures ?? []).map((fixture) =>\n fixture.kind === 'dynamic'\n ? { kind: 'dynamic', source: 'dynamic' }\n : fixture.kind === 'inline'\n ? {\n kind: 'inline',\n source: fixture.file,\n destination: fixture.file,\n visibility: fixture.visibility,\n }\n : {\n kind: fixture.kind,\n source: fixture.src,\n destination: fixture.dst,\n visibility: fixture.visibility,\n },\n ),\n trialCount: evaluation.policy?.trials ?? 1,\n scorers: evaluation.scoring.map(({ name, kind }) => ({ name, kind })),\n };\n }),\n };\n}\n\nexport type RunStatus = 'running' | 'completed' | 'failed' | 'cancelled';\n\n/**\n * Where a run's eval code came from: the repository, eval project and commit.\n * Results are tagged with it; they are never stored in the repository itself.\n */\nexport type RunSource = {\n /** Normalized repository key, e.g. `gitlab.example.com/group/repo`. */\n repo: string;\n /** Eval project directory relative to the repository root; `\"\"` at the root. */\n project: string;\n /** Full commit SHA. */\n commit: string;\n ref?: string;\n committedAt?: string;\n /** True when the working tree had uncommitted changes at run time. */\n dirty: boolean;\n ci?: { provider: string; pipeline?: string; job?: string; url?: string };\n};\n\n/** The project's evals and suites when a run started; written beside its manifest. */\nexport type RunCatalog = {\n catalog: EvalCatalogEntry[];\n evals: EvalRegistryMetadata[];\n suites: EvalSuiteMetadata[];\n};\n\nexport type RunMetadata = {\n schemaVersion: 2 | 3 | 4;\n runId: string;\n runUri: ResourceUri<'run'>;\n evalId: string;\n suiteId?: string;\n parameters?: JsonObject;\n matrix?: { id: string; cellKey: string };\n aut?: AutIdentity;\n startedAt: string;\n /** Present from schema version 4 when the run's commit could be determined. */\n source?: RunSource;\n};\n\nexport type TrialMetadata = {\n schemaVersion: 2 | 3 | 4;\n runId: string;\n runUri: ResourceUri<'run'>;\n trialId: string;\n trialUri: ResourceUri<'trial'>;\n trialIndex: number;\n evalId: string;\n parameters?: JsonObject;\n matrix?: { id: string; cellKey: string };\n aut?: AutIdentity;\n startedAt: string;\n};\n\nexport type CheckpointResult = {\n step: number;\n kind: 'predicate' | 'judge' | 'expect-tool-call';\n name: string;\n status: 'passed' | 'failed' | 'error' | 'skipped';\n value?: number;\n passed?: boolean;\n explanation?: string;\n evidence?: JsonValue;\n judge?: JudgeRunInfo;\n durationMs?: number;\n error?: RecordedError;\n matchedToolCall?: { eventIndex: number; id: string };\n};\n\nexport type TrialScoring = {\n results: ScoreResult[];\n checkpoints?: CheckpointResult[];\n skippedScorers?: string[];\n overall?: number;\n passed: boolean;\n};\n\nexport type ArtifactEntry = {\n /** Path relative to this trial's artifact root. */\n path: string;\n kind: 'file' | 'directory';\n size?: number;\n};\n\nexport type TrialSummary = {\n status: RunStatus;\n endedAt: string;\n durationMs?: number;\n scoring?: TrialScoring;\n artifacts?: ArtifactEntry[];\n error?: RecordedError;\n};\n\nexport type RunSummary = {\n status: RunStatus;\n endedAt: string;\n durationMs?: number;\n trialCount: number;\n passed: number;\n failed: number;\n error?: RecordedError;\n};\n\nexport type TrialWriter = {\n appendEvent(event: TrajectoryEvent): Promise<void>;\n writeScores(scoring: TrialScoring): Promise<void>;\n /** Writes a file below this trial's artifact root. */\n writeArtifact(path: string, data: Uint8Array): Promise<void>;\n finalize(summary: TrialSummary): Promise<void>;\n};\n\nexport type RunWriter = {\n readonly location: string;\n startTrial(metadata: TrialMetadata): Promise<TrialWriter>;\n finalize(summary: RunSummary): Promise<void>;\n};\n\nexport type ReportStore = {\n startRun(\n metadata: RunMetadata,\n context?: { catalog?: RunCatalog },\n ): Promise<RunWriter>;\n};\n\nexport type TrialResult = {\n runId: string;\n runUri: ResourceUri<'run'>;\n trialId: string;\n trialUri: ResourceUri<'trial'>;\n trialIndex: number;\n evalId: string;\n status: RunStatus;\n reportLocation: string;\n durationMs?: number;\n scoring?: TrialScoring;\n error?: RecordedError;\n};\n\nexport type AggregateScoring = {\n passed: number;\n failed: number;\n passRate: number;\n overall?: number;\n};\n\nexport type RunResult = TrialResult & {\n runId: string;\n trialCount?: number;\n passed?: number;\n failed?: number;\n aggregateScoring?: AggregateScoring;\n /** Present for an aggregate multi-trial run. */\n trials?: TrialResult[];\n};\n\nexport * from './identity.js';\nexport * from './schema.js';\nexport * from './trajectory.js';\n\nexport function recordError(error: unknown): RecordedError {\n if (error instanceof Error) {\n return {\n name: error.name,\n message: error.message,\n ...(error.stack ? { stack: error.stack } : {}),\n };\n }\n\n return { name: 'Error', message: String(error) };\n}\n"],"mappings":";;AAEA,MAAa,qBAAqB,OAAO,QAAQ,OAAO,SAAS,UAAU;;AAI3E,SAAgB,SAAS,OAAuB;CAC9C,IAAI,CAAC,6BAA6B,KAAK,KAAK,GAC1C,MAAM,IAAI,MAAM,oCAAoC,OAAO;CAC7D,OAAO;AACT;;AAGA,MAAa,aAAa,OAAO,OAAO,KACtC,OAAO,QACL,4EACF,CACF;AAMA,MAAa,oBAAoB,OAAO,OAAO,KAC7C,OAAO,QACL,yGACF,CACF;AAEA,SAAgB,kBAA8C,MAAa;CACzE,OAAO,OAAO,OAAO,KACnB,OAAO,QACL,IAAI,OACF,YAAY,KAAK,4EACjB,GACF,CACF,CACF;AACF;AAEA,SAAgB,YACd,MACA,MACoB;CACpB,OAAO,WAAW,KAAK,GAAG;AAC5B;AAEA,SAAgB,iBACd,OACA,cACsD;CACtD,MAAM,QAAQ,sCAAsC,KAAK,KAAK;CAC9D,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,iCAAiC,OAAO;CACpE,MAAM,OAAO,MAAM;CACnB,IAAI,gBAAgB,SAAS,cAC3B,MAAM,IAAI,MACR,uBAAuB,aAAa,iBAAiB,OACvD;CACF,MAAM,OAAO,OAAO,kBAAkB,UAAU,CAAC,CAAC,MAAM,EAAE;CAC1D,OAAO;EAAE;EAAM;EAAM,KAAK,YAAY,MAAM,IAAI;CAAE;AACpD;AAEA,SAAgB,aAAa,OAAe,cAAmC;CAC7E,OAAO,iBAAiB,OAAO,YAAY,CAAC,CAAC;AAC/C;;;;AC3DA,SAAgB,oBAAoB,OAA0B;CAC5D,IAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,OAAO,UAAU,WAClE,OAAO,KAAK,UAAU,KAAK;CAC7B,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