@leostera/evalkit 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +70 -6
  2. package/README.md +10 -8
  3. package/dist/cli.mjs +1227 -258
  4. package/dist/dashboard/assets/index-CTJpd8q8.js +34 -0
  5. package/dist/dashboard/assets/index-YAabTN3X.css +2 -0
  6. package/dist/dashboard/index.html +2 -2
  7. package/dist/files-C-U0-PWW.mjs +0 -2
  8. package/dist/index-db-vbqEGFaU.mjs +0 -2
  9. package/dist/index.d.mts +1346 -2
  10. package/dist/index.d.mts.map +1 -1
  11. package/dist/index.mjs +2 -4
  12. package/dist/runner.d.mts +809 -11
  13. package/dist/runner.d.mts.map +1 -1
  14. package/dist/runner.mjs +2 -2
  15. package/dist/share-worker.d.mts +76 -1
  16. package/dist/share-worker.d.mts.map +1 -1
  17. package/dist/share-worker.mjs +0 -2
  18. package/dist/share.d.mts +149 -6
  19. package/dist/share.d.mts.map +1 -1
  20. package/dist/share.mjs +1 -1
  21. package/dist/skills/evalkit/SKILL.md +32 -0
  22. package/dist/skills/evalkit-agents/SKILL.md +16 -0
  23. package/dist/skills/evalkit-datasets/SKILL.md +17 -0
  24. package/dist/skills/evalkit-evals/SKILL.md +19 -0
  25. package/dist/skills/evalkit-judges/SKILL.md +17 -0
  26. package/dist/skills/evalkit-matrices/SKILL.md +14 -0
  27. package/dist/skills/evalkit-results/SKILL.md +14 -0
  28. package/dist/{src-DoPs9Yug.mjs → src-CKqOzeBi.mjs} +448 -116
  29. package/dist/{src-ButXPY8P.mjs → src-CZPufWN_.mjs} +419 -94
  30. package/dist/{src-DzZueFn3.mjs → src-CZnDXP1K.mjs} +46 -10
  31. package/package.json +3 -2
  32. package/dist/cli.mjs.map +0 -1
  33. package/dist/dashboard/assets/index-D9NtA46z.css +0 -2
  34. package/dist/dashboard/assets/index-DrBwLKJD.js +0 -30
  35. package/dist/files-C-U0-PWW.mjs.map +0 -1
  36. package/dist/index-db-HdZXelOS.d.mts +0 -142
  37. package/dist/index-db-HdZXelOS.d.mts.map +0 -1
  38. package/dist/index-db-vbqEGFaU.mjs.map +0 -1
  39. package/dist/index-lOw0fmak.d.mts +0 -1028
  40. package/dist/index-lOw0fmak.d.mts.map +0 -1
  41. package/dist/index.mjs.map +0 -1
  42. package/dist/share-worker.mjs.map +0 -1
  43. package/dist/src-ButXPY8P.mjs.map +0 -1
  44. package/dist/src-DoPs9Yug.mjs.map +0 -1
  45. package/dist/src-DzZueFn3.mjs.map +0 -1
package/dist/runner.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as TrajectoryEvent, B as ReportStore, F as JsonValue, H as RunMetadata, N as JsonObject, U as RunResult, V as RunCatalog, W as RunSource, Xt as EvalMatrixCell, Yt as EvalMatrix, Zt as MatrixSelection, n as AgentRuntimeName, y as EvalDefinition } from "./index-lOw0fmak.mjs";
2
1
  import { Effect } from "effect";
2
+ import * as Schema from "effect/Schema";
3
3
  //#region ../runner/src/errors.d.ts
4
4
  declare const AutExecutionError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
5
5
  readonly _tag: "AutExecutionError";
@@ -8,10 +8,10 @@ export declare class AutExecutionError extends AutExecutionError_base<{
8
8
  cause: unknown;
9
9
  message?: string;
10
10
  }> {}
11
- declare const FixtureError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
12
- readonly _tag: "FixtureError";
11
+ declare const DatasetError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
12
+ readonly _tag: "DatasetError";
13
13
  } & Readonly<A>;
14
- export declare class FixtureError extends FixtureError_base<{
14
+ export declare class DatasetError extends DatasetError_base<{
15
15
  cause: unknown;
16
16
  message?: string;
17
17
  }> {}
@@ -38,14 +38,767 @@ export declare class CheckpointExecutionError extends CheckpointExecutionError_b
38
38
  message: string;
39
39
  cause: unknown;
40
40
  }> {}
41
+ declare const CancelledError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
42
+ readonly _tag: "CancelledError";
43
+ } & Readonly<A>;
44
+ /** The run was cancelled (Ctrl+C); the trial stops and is finalized as cancelled. */
45
+ export declare class CancelledError extends CancelledError_base<{
46
+ message: string;
47
+ }> {}
48
+ //#endregion
49
+ //#region ../core/src/identity.d.ts
50
+ declare const ResourceKindSchema: Schema.Literal<["run", "trial", "artifact"]>;
51
+ type ResourceKind = typeof ResourceKindSchema.Type;
52
+ type ResourceUri<TKind extends ResourceKind = ResourceKind> = `evalkit:${TKind}:${string}`;
53
+ //#endregion
54
+ //#region ../core/src/dataset.d.ts
55
+ /** Who can see a dataset: the agent (and scorers), or only scorers. */
56
+ type DatasetVisibility = 'candidate' | 'evaluator';
57
+ /** Inline text or bytes, or a file relative to the project root. */
58
+ type DatasetFileSource = string | Uint8Array | {
59
+ file: string;
60
+ };
61
+ /**
62
+ * Files for the trial workspace: a directory relative to the project root, or
63
+ * a map from workspace path (below the dataset's mount) to its content.
64
+ */
65
+ type DatasetFiles = string | Readonly<Record<string, DatasetFileSource>>;
66
+ /** What one trial receives from a dataset. */
67
+ type DatasetContent = {
68
+ files?: DatasetFiles;
69
+ /** Any JSON-convertible value; converted once when the trial starts. */
70
+ value?: unknown;
71
+ };
72
+ type DatasetLoadContext = {
73
+ /** The project root; relative paths in returned content resolve against it. */
74
+ root: string;
75
+ signal: AbortSignal;
76
+ };
77
+ type DatasetTrialContext = {
78
+ evalId: string;
79
+ runId: string;
80
+ trialId: string;
81
+ trialIndex: number;
82
+ /** Per-trial random seed, so repeated trials can choose different data. */
83
+ seed: number;
84
+ /** The matrix cell's parameters, or `{}`. */
85
+ parameters: JsonObject;
86
+ signal: AbortSignal;
87
+ };
88
+ type DatasetSource = {
89
+ kind: 'static';
90
+ files?: DatasetFiles;
91
+ value?: unknown;
92
+ valueFile?: string;
93
+ } | {
94
+ kind: 'computed';
95
+ onLoad: (load: DatasetLoadContext) => DatasetContent | Promise<DatasetContent>;
96
+ onRun?: (loaded: DatasetContent, trial: DatasetTrialContext) => DatasetContent | Promise<DatasetContent>;
97
+ };
98
+ /** A checked dataset, as returned by `defineDataset`. Evals accept only these. */
99
+ type Dataset = {
100
+ readonly kind: 'dataset';
101
+ readonly id: string;
102
+ readonly name?: string;
103
+ readonly visibility: DatasetVisibility;
104
+ /** Normalized relative POSIX path; `.` is the workspace root. */
105
+ readonly mount: string;
106
+ readonly source: DatasetSource;
107
+ };
108
+ //#endregion
109
+ //#region ../core/src/aut-events.d.ts
110
+ /**
111
+ * Events as adapters emit them. Payloads accept any JSON-convertible value and
112
+ * timestamps are optional; EvalKit converts them once into `AutEvent`s.
113
+ */
114
+ type AutEventInput = {
115
+ kind: 'started';
116
+ timestamp?: string;
117
+ } | {
118
+ kind: 'message';
119
+ role: 'system' | 'user' | 'assistant' | 'tool';
120
+ content: unknown;
121
+ timestamp?: string;
122
+ } | {
123
+ kind: 'tool-call';
124
+ id: string;
125
+ name: string;
126
+ arguments?: unknown;
127
+ timestamp?: string;
128
+ } | {
129
+ kind: 'tool-result';
130
+ id: string;
131
+ name?: string;
132
+ result?: unknown;
133
+ timestamp?: string;
134
+ } | {
135
+ kind: 'turn-started';
136
+ turn: number;
137
+ timestamp?: string;
138
+ } | {
139
+ kind: 'turn-completed';
140
+ turn: number;
141
+ timestamp?: string;
142
+ latencyMs?: number;
143
+ usage?: Usage;
144
+ } | {
145
+ kind: 'completed';
146
+ output?: unknown;
147
+ timestamp?: string;
148
+ } | {
149
+ kind: 'error';
150
+ error: RecordedError;
151
+ timestamp?: string;
152
+ };
153
+ type TurnToolCall = {
154
+ name: string;
155
+ arguments?: unknown;
156
+ /** When given, a `tool-result` event is recorded after the call. */
157
+ result?: unknown;
158
+ id?: string;
159
+ };
160
+ /** What `send()` may return instead of (or as well as) emitting events. A string is the reply. */
161
+ type TurnResult = string | {
162
+ reply?: unknown;
163
+ toolCalls?: readonly TurnToolCall[];
164
+ usage?: Usage;
165
+ };
166
+ //#endregion
167
+ //#region ../core/src/catalog.d.ts
168
+ type EvalCatalogAgent = {
169
+ name?: string;
170
+ kind: string;
171
+ id?: string;
172
+ version?: string;
173
+ runtimes: Array<{
174
+ name: AgentRuntimeName;
175
+ kind: string;
176
+ }>;
177
+ /** `file:line` of its `defineAgent` call, relative to the project. */
178
+ definedAt?: string;
179
+ };
180
+ /** A value's shape, without its content. */
181
+ type ValueShape = {
182
+ type: 'array';
183
+ items: number;
184
+ } | {
185
+ type: 'object';
186
+ keys: string[];
187
+ } | {
188
+ type: 'string' | 'number' | 'boolean' | 'null';
189
+ };
190
+ type EvalCatalogDataset = {
191
+ id: string;
192
+ name?: string;
193
+ visibility: DatasetVisibility;
194
+ source: 'static' | 'computed';
195
+ mount: string;
196
+ /** Static datasets: a directory relative to the project, or the workspace paths of inline files. */
197
+ files?: {
198
+ directory: string;
199
+ } | {
200
+ paths: string[];
201
+ };
202
+ /** Static datasets: the inline value's shape, or the value file's path. */
203
+ value?: {
204
+ shape: ValueShape;
205
+ } | {
206
+ file: string;
207
+ };
208
+ /** Computed datasets: which hooks are defined. */
209
+ hooks?: {
210
+ onLoad: true;
211
+ onRun: boolean;
212
+ };
213
+ definedAt?: string;
214
+ };
215
+ type EvalCatalogScorer = {
216
+ name: string;
217
+ kind: ScoringRule['kind'];
218
+ passAt?: number;
219
+ supportsPartial?: boolean;
220
+ /** Judges only. */
221
+ rubric?: string;
222
+ definedAt?: string;
223
+ };
224
+ type EvalCatalogStep = {
225
+ kind: 'user';
226
+ message: string;
227
+ } | {
228
+ kind: 'agent';
229
+ expectation: JsonValue;
230
+ } | {
231
+ kind: 'expect-tool-call';
232
+ name: string;
233
+ arguments?: JsonValue;
234
+ } |
235
+ /** A predicate or judge checked at this point of the conversation. */
236
+ {
237
+ kind: 'checkpoint';
238
+ scorer: EvalCatalogScorer;
239
+ };
240
+ type EvalCatalogEntry = {
241
+ id: string;
242
+ path: string;
243
+ name?: string;
244
+ suiteId?: string;
245
+ agent: EvalCatalogAgent;
246
+ /** The separate agent that runs judge rules, if any. */
247
+ judgeAgent?: EvalCatalogAgent;
248
+ datasets: EvalCatalogDataset[];
249
+ trialCount: number;
250
+ policy: {
251
+ trials: number;
252
+ timeoutMs?: number;
253
+ failfast?: boolean;
254
+ };
255
+ transcript: EvalCatalogStep[];
256
+ scorers: EvalCatalogScorer[];
257
+ metadata?: JsonValue;
258
+ /** `file:line` of its `defineEval` call, relative to the project. */
259
+ definedAt?: string;
260
+ };
261
+ //#endregion
262
+ //#region ../core/src/matrix.d.ts
263
+ type MatrixSelection = {
264
+ /** Base eval IDs. Unknown values fail before dispatch. */
265
+ evals?: readonly string[];
266
+ /** Select existing dimension values, rather than overwriting every cell with the same value. */
267
+ parameters?: Readonly<Record<string, readonly JsonValue[]>>;
268
+ /** Overrides for non-dimension execution settings (e.g. maxTokens). */
269
+ overrides?: JsonObject;
270
+ };
271
+ type EvalMatrixCell = {
272
+ matrixId: string;
273
+ /** Stable canonical key including matrix, base eval and effective parameters. */
274
+ key: string;
275
+ eval: EvalDefinition;
276
+ parameters: JsonObject;
277
+ };
278
+ type EvalMatrixDefinition = {
279
+ id: string;
280
+ name?: string;
281
+ evals: readonly EvalDefinition[];
282
+ parameters: Readonly<Record<string, readonly JsonValue[]>>;
283
+ defaults?: JsonObject;
284
+ /** Complete correlated assignments, crossed with independent parameters. */
285
+ cases?: readonly JsonObject[];
286
+ /** Partial patterns over declared dimensions; matching cells are never run. */
287
+ exclude?: readonly JsonObject[];
288
+ };
289
+ type EvalMatrix = EvalMatrixDefinition & {
290
+ kind: 'matrix';
291
+ count(selection?: MatrixSelection): number;
292
+ cells(selection?: MatrixSelection): IterableIterator<EvalMatrixCell>;
293
+ };
294
+ //#endregion
295
+ //#region ../core/src/index.d.ts
296
+ type JsonPrimitive = boolean | number | string | null;
297
+ type JsonValue = JsonPrimitive | JsonValue[] | {
298
+ [key: string]: JsonValue;
299
+ };
300
+ type JsonObject = {
301
+ [key: string]: JsonValue;
302
+ };
303
+ type AutIdentity = {
304
+ /** Human-readable logical agent name shown in catalogs and dashboards. */
305
+ name?: string;
306
+ kind: string;
307
+ id: string;
308
+ version?: string;
309
+ };
310
+ type AgentRuntimeName = 'local' | 'sandbox' | 'remote';
311
+ /**
312
+ * A serializable runtime requirement for an AUT. Concrete runtime packages own
313
+ * the interpretation of `kind` and `configuration`.
314
+ */
315
+ type AgentRuntime = {
316
+ kind: string;
317
+ configuration?: JsonObject;
318
+ };
319
+ type AgentRuntimes = Partial<Record<AgentRuntimeName, AgentRuntime>>;
320
+ type Usage = {
321
+ inputTokens?: number;
322
+ outputTokens?: number;
323
+ totalTokens?: number;
324
+ };
325
+ type RecordedError = {
326
+ name: string;
327
+ message: string;
328
+ stack?: string;
329
+ };
330
+ type AutEvent = {
331
+ kind: 'started';
332
+ timestamp: string;
333
+ } | {
334
+ kind: 'message';
335
+ role: 'system' | 'user' | 'assistant' | 'tool';
336
+ content: JsonValue;
337
+ timestamp: string;
338
+ } | {
339
+ kind: 'tool-call';
340
+ id: string;
341
+ name: string;
342
+ arguments: JsonValue;
343
+ timestamp: string;
344
+ } | {
345
+ kind: 'tool-result';
346
+ id: string;
347
+ name?: string;
348
+ result: JsonValue;
349
+ timestamp: string;
350
+ } | {
351
+ kind: 'turn-started';
352
+ turn: number;
353
+ timestamp: string;
354
+ } | {
355
+ kind: 'turn-completed';
356
+ turn: number;
357
+ timestamp: string;
358
+ latencyMs?: number;
359
+ usage?: Usage;
360
+ } | {
361
+ kind: 'completed';
362
+ output?: JsonValue;
363
+ timestamp: string;
364
+ } | {
365
+ kind: 'error';
366
+ error: RecordedError;
367
+ timestamp: string;
368
+ };
369
+ type RunnerEvent = {
370
+ kind: 'trial-started';
371
+ timestamp: string;
372
+ } | {
373
+ kind: 'transcript-step-started';
374
+ step: number;
375
+ /** The user message sent at this step; absent for checkpoints. */
376
+ message?: string;
377
+ timestamp: string;
378
+ } | {
379
+ kind: 'transcript-step-completed';
380
+ step: number;
381
+ timestamp: string;
382
+ } | {
383
+ kind: 'transcript-step-skipped';
384
+ step: number;
385
+ timestamp: string;
386
+ } | {
387
+ kind: 'checkpoint-started';
388
+ step: number;
389
+ name: string;
390
+ timestamp: string;
391
+ } | {
392
+ kind: 'checkpoint-completed';
393
+ step: number;
394
+ status: 'passed' | 'failed' | 'skipped';
395
+ timestamp: string;
396
+ } | {
397
+ kind: 'checkpoint-error';
398
+ step: number;
399
+ error: RecordedError;
400
+ timestamp: string;
401
+ } | {
402
+ kind: 'scorer-started';
403
+ scorer: string;
404
+ timestamp: string;
405
+ } | {
406
+ kind: 'scorer-completed';
407
+ scorer: string;
408
+ /** Absent when the scorer returned `skip()`. */
409
+ value?: number;
410
+ skipped?: true;
411
+ timestamp: string;
412
+ } | {
413
+ kind: 'scorer-failed';
414
+ scorer: string;
415
+ error: RecordedError;
416
+ timestamp: string;
417
+ } | {
418
+ kind: 'trial-completed';
419
+ timestamp: string;
420
+ } | {
421
+ kind: 'error';
422
+ error: RecordedError;
423
+ timestamp: string;
424
+ };
425
+ type TrajectoryEvent = (AutEvent & {
426
+ source: 'aut';
427
+ }) | (RunnerEvent & {
428
+ source: 'runner';
429
+ });
430
+ type WorkspaceView = {
431
+ /** Absolute path to this trial-scoped workspace. Do not persist it in reports. */
432
+ root: string;
433
+ };
434
+ type CandidateWorkspace = WorkspaceView;
435
+ type EvaluatorWorkspace = WorkspaceView;
436
+ type AutContext = {
437
+ runId: string;
438
+ evalId: string;
439
+ trialId: string;
440
+ trialIndex: number;
441
+ metadata: JsonObject;
442
+ /** Run-time parameters supplied by the eval definition or CLI invocation. */
443
+ parameters?: JsonObject;
444
+ runtime?: AgentRuntimeName;
445
+ /** Values of the scenario's candidate datasets, by dataset ID. */
446
+ data: JsonObject;
447
+ /** Contains only resources visible to the AUT/model. */
448
+ workspace: CandidateWorkspace;
449
+ /** Private evaluator capability for trusted AUT adapters; never expose this to the model. */
450
+ evaluatorWorkspace: EvaluatorWorkspace;
451
+ };
452
+ type AutAdapter<TMessage = string> = {
453
+ readonly identity?: AutIdentity;
454
+ /** Available execution environments for this AUT. Default: `{ local: { kind: 'in-process' } }`. */
455
+ readonly runtimes?: AgentRuntimes;
456
+ start(options: {
457
+ context: AutContext;
458
+ runtime?: AgentRuntime;
459
+ /** Optional: stream events as they happen. Returning a turn result from `send` is enough for most agents. */
460
+ onEvent: (event: AutEventInput) => void | Promise<void>;
461
+ }): Promise<AutSession<TMessage>>;
462
+ };
463
+ type AutSession<TMessage = string> = {
464
+ /**
465
+ * Resolves once the AUT has completed the turn initiated by this message.
466
+ * It may return the turn's reply and tool calls instead of emitting events.
467
+ */
468
+ send(message: TMessage): Promise<void | TurnResult>;
469
+ /** Optional; defaults to doing nothing. */
470
+ close?(): Promise<void>;
471
+ };
472
+ type UserStep = {
473
+ kind: 'user';
474
+ message: string;
475
+ };
476
+ type AgentStep = {
477
+ kind: 'agent';
478
+ expectation: JsonObject;
479
+ };
480
+ type TurnView = {
481
+ userStepIndex: number;
482
+ events: readonly (AutEvent & {
483
+ source: 'aut';
484
+ })[];
485
+ assistantMessages: readonly (Extract<AutEvent, {
486
+ kind: 'message';
487
+ }> & {
488
+ role: 'assistant';
489
+ source: 'aut';
490
+ })[];
491
+ toolCalls: readonly {
492
+ eventIndex: number;
493
+ id: string;
494
+ name: string;
495
+ arguments: JsonValue;
496
+ resultObservation: 'observed' | 'absent' | 'ambiguous';
497
+ result?: JsonValue;
498
+ }[];
499
+ lastAssistantText?: string;
500
+ };
501
+ type ExpectToolCallStep = {
502
+ kind: 'expect-tool-call';
503
+ name: string;
504
+ expected: {
505
+ name: string;
506
+ arguments?: JsonValue;
507
+ };
508
+ };
509
+ type TranscriptStep = UserStep | AgentStep | ScoringRule | ExpectToolCallStep;
510
+ type JudgeRunInfo = {
511
+ agent?: AutIdentity;
512
+ usage?: Usage;
513
+ /** Judge-agent observations; never attributed to the AUT trajectory. */
514
+ events?: JsonValue[];
515
+ };
516
+ /** A scorer's "does not apply" result; see `skip()`. */
517
+ type SkippedScore = {
518
+ skipped: true;
519
+ reason: string;
520
+ };
521
+ type ScoreValue = number | SkippedScore | {
522
+ value: number;
523
+ passed?: boolean;
524
+ explanation?: string;
525
+ /** Any JSON-convertible value. */
526
+ evidence?: unknown;
527
+ /** Judge-agent evidence, never inferred from AUT usage. */
528
+ judge?: JudgeRunInfo;
529
+ };
530
+ type ScoreResult = {
531
+ name: string;
532
+ kind: 'predicate' | 'judge';
533
+ value?: number;
534
+ passed?: boolean;
535
+ explanation?: string;
536
+ evidence?: JsonValue;
537
+ judge?: JudgeRunInfo;
538
+ durationMs: number;
539
+ error?: RecordedError;
540
+ /** The scorer returned `skip()`; `explanation` holds the reason and there is no value. */
541
+ skipped?: true;
542
+ };
543
+ type ArtifactView = {
544
+ candidate: CandidateWorkspace;
545
+ evaluator: EvaluatorWorkspace;
546
+ };
547
+ type ScoringContext = {
548
+ context: AutContext;
549
+ trajectory: {
550
+ events: readonly TrajectoryEvent[];
551
+ };
552
+ artifacts: ArtifactView;
553
+ /** Most recent completed turn; absent if no user message has been sent. */
554
+ turn?: TurnView;
555
+ /** Content of the last assistant message of `turn`. */
556
+ output?: JsonValue;
557
+ /** Values of all the scenario's datasets (candidate and evaluator), by dataset ID. */
558
+ data: JsonObject;
559
+ };
560
+ type PredicateScorer = {
561
+ kind: 'predicate';
562
+ name: string;
563
+ supportsPartial?: boolean;
564
+ /** A numeric result passes when it is at least this value. Default: only 1 passes. */
565
+ passAt?: number;
566
+ run(context: ScoringContext): boolean | ScoreValue | Promise<boolean | ScoreValue>;
567
+ };
568
+ type JudgeRule = {
569
+ kind: 'judge';
570
+ name: string;
571
+ rubric: string;
572
+ /** Run even when the scenario stopped early or execution failed. */
573
+ supportsPartial?: boolean;
574
+ };
575
+ type ScoringRule = PredicateScorer | JudgeRule;
576
+ type EvalPolicy = {
577
+ timeoutMs?: number;
578
+ /** Stop later transcript steps after a failed checkpoint assertion. Default false. */
579
+ failfast?: boolean;
580
+ /** Number of independent trials requested by local and hosted runners. */
581
+ trials?: number;
582
+ };
583
+ type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
584
+ id: string;
585
+ name?: string;
586
+ agent: TAgent;
587
+ /** Separate judge agent; its model and tools are never inherited from the AUT. */
588
+ judge?: AutAdapter;
589
+ /** Data and files the scenario uses; each trial gets its own copy. */
590
+ datasets?: readonly Dataset[];
591
+ transcript: TranscriptStep[];
592
+ scoring: ScoringRule[];
593
+ policy?: EvalPolicy;
594
+ /** Any JSON-convertible object; converted when the eval is defined. */
595
+ metadata?: Record<string, unknown>;
596
+ };
597
+ type EvalRegistryMetadata = {
598
+ id: string;
599
+ name?: string;
600
+ suiteId?: string;
601
+ };
602
+ type EvalSuiteMetadata = {
603
+ id: string;
604
+ name?: string;
605
+ evalIds: string[];
606
+ };
607
+ type RunStatus = 'running' | 'completed' | 'failed' | 'cancelled';
608
+ /**
609
+ * Where a run's eval code came from: the repository, eval project and commit.
610
+ * Results are tagged with it; they are never stored in the repository itself.
611
+ */
612
+ type RunSource = {
613
+ /** Normalized repository key, e.g. `gitlab.example.com/group/repo`. */
614
+ repo: string;
615
+ /** Eval project directory relative to the repository root; `""` at the root. */
616
+ project: string;
617
+ /** Full commit SHA. */
618
+ commit: string;
619
+ ref?: string;
620
+ committedAt?: string;
621
+ /** True when the working tree had uncommitted changes at run time. */
622
+ dirty: boolean;
623
+ ci?: {
624
+ provider: string;
625
+ pipeline?: string;
626
+ job?: string;
627
+ url?: string;
628
+ };
629
+ };
630
+ /** The project's evals and suites when a run started; written beside its manifest. */
631
+ type RunCatalog = {
632
+ catalog: EvalCatalogEntry[];
633
+ evals: EvalRegistryMetadata[];
634
+ suites: EvalSuiteMetadata[];
635
+ };
636
+ /** The process that owns a running run, so readers can tell an interrupted run from a live one. */
637
+ type RunProcess = {
638
+ pid: number;
639
+ hostname: string;
640
+ };
641
+ type RunMetadata = {
642
+ schemaVersion: 2 | 3 | 4 | 5;
643
+ runId: string;
644
+ runUri: ResourceUri<'run'>;
645
+ evalId: string;
646
+ suiteId?: string;
647
+ parameters?: JsonObject;
648
+ matrix?: {
649
+ id: string;
650
+ cellKey: string;
651
+ };
652
+ aut?: AutIdentity;
653
+ startedAt: string;
654
+ /** Present from schema version 4 when the run's commit could be determined. */
655
+ source?: RunSource;
656
+ /** From schema version 5. */
657
+ process?: RunProcess;
658
+ };
659
+ type TrialMetadata = {
660
+ schemaVersion: 2 | 3 | 4 | 5;
661
+ runId: string;
662
+ runUri: ResourceUri<'run'>;
663
+ trialId: string;
664
+ trialUri: ResourceUri<'trial'>;
665
+ trialIndex: number;
666
+ evalId: string;
667
+ parameters?: JsonObject;
668
+ matrix?: {
669
+ id: string;
670
+ cellKey: string;
671
+ };
672
+ aut?: AutIdentity;
673
+ startedAt: string;
674
+ /** From schema version 5: the datasets this trial used, with content digests. */
675
+ datasets?: TrialDataset[];
676
+ };
677
+ type TrialDataset = {
678
+ id: string;
679
+ visibility: DatasetVisibility;
680
+ source: 'static' | 'computed';
681
+ /** SHA-256 of the trial's content: file paths and bytes, and the canonical value. */
682
+ digest: string;
683
+ };
684
+ type CheckpointResult = {
685
+ step: number;
686
+ kind: 'predicate' | 'judge' | 'expect-tool-call';
687
+ name: string;
688
+ status: 'passed' | 'failed' | 'error' | 'skipped';
689
+ value?: number;
690
+ passed?: boolean;
691
+ explanation?: string;
692
+ evidence?: JsonValue;
693
+ judge?: JudgeRunInfo;
694
+ durationMs?: number;
695
+ error?: RecordedError;
696
+ matchedToolCall?: {
697
+ eventIndex: number;
698
+ id: string;
699
+ };
700
+ };
701
+ type TrialScoring = {
702
+ results: ScoreResult[];
703
+ checkpoints?: CheckpointResult[];
704
+ skippedScorers?: string[];
705
+ overall?: number;
706
+ passed: boolean;
707
+ };
708
+ type ArtifactEntry = {
709
+ /** Path relative to this trial's artifact root. */
710
+ path: string;
711
+ kind: 'file' | 'directory';
712
+ size?: number;
713
+ };
714
+ type TrialSummary = {
715
+ status: RunStatus;
716
+ endedAt: string;
717
+ durationMs?: number;
718
+ scoring?: TrialScoring;
719
+ artifacts?: ArtifactEntry[];
720
+ error?: RecordedError;
721
+ };
722
+ type RunSummary = {
723
+ status: RunStatus;
724
+ endedAt: string;
725
+ durationMs?: number;
726
+ trialCount: number;
727
+ passed: number;
728
+ failed: number;
729
+ /** Trials stopped by cancellation; counted neither as passed nor failed. */
730
+ cancelled?: number;
731
+ error?: RecordedError;
732
+ };
733
+ type TrialWriter = {
734
+ appendEvent(event: TrajectoryEvent): Promise<void>;
735
+ writeScores(scoring: TrialScoring): Promise<void>;
736
+ /** Writes a file below this trial's artifact root. */
737
+ writeArtifact(path: string, data: Uint8Array): Promise<void>;
738
+ finalize(summary: TrialSummary): Promise<void>;
739
+ };
740
+ type RunWriter = {
741
+ readonly location: string;
742
+ startTrial(metadata: TrialMetadata): Promise<TrialWriter>;
743
+ finalize(summary: RunSummary): Promise<void>;
744
+ };
745
+ type ReportStore = {
746
+ startRun(metadata: RunMetadata, context?: {
747
+ catalog?: RunCatalog;
748
+ }): Promise<RunWriter>;
749
+ };
750
+ type TrialResult = {
751
+ runId: string;
752
+ runUri: ResourceUri<'run'>;
753
+ trialId: string;
754
+ trialUri: ResourceUri<'trial'>;
755
+ trialIndex: number;
756
+ evalId: string;
757
+ status: RunStatus;
758
+ reportLocation: string;
759
+ durationMs?: number;
760
+ scoring?: TrialScoring;
761
+ error?: RecordedError;
762
+ };
763
+ type AggregateScoring = {
764
+ passed: number;
765
+ failed: number;
766
+ cancelled?: number;
767
+ passRate: number;
768
+ overall?: number;
769
+ };
770
+ type RunResult = TrialResult & {
771
+ runId: string;
772
+ trialCount?: number;
773
+ passed?: number;
774
+ failed?: number;
775
+ aggregateScoring?: AggregateScoring;
776
+ /** Present for an aggregate multi-trial run. */
777
+ trials?: TrialResult[];
778
+ };
41
779
  //#endregion
42
780
  //#region ../runner/src/local-report-store.d.ts
43
781
  /** Persists each run as a local tree rooted below `rootDirectory`. */
44
782
  export declare function localReportStore(rootDirectory: string): ReportStore;
45
783
  //#endregion
784
+ //#region ../runner/src/datasets.d.ts
785
+ /** A file a static dataset places below its mount, for browsing. */
786
+ type DatasetFileEntry = {
787
+ path: string;
788
+ size: number;
789
+ };
790
+ /**
791
+ * The files a static dataset places in every workspace, relative to its
792
+ * mount. Computed datasets return `undefined`: their files only exist once
793
+ * `onLoad` runs, and browsing must never run project code.
794
+ */
795
+ export declare function staticDatasetFiles(dataset: Dataset, root: string): Promise<DatasetFileEntry[] | undefined>;
796
+ /** One file of a static dataset, by its path below the mount. */
797
+ export declare function staticDatasetFile(dataset: Dataset, root: string, file: string): Promise<Uint8Array<ArrayBuffer>>;
798
+ //#endregion
46
799
  //#region ../runner/src/local-report-reader.d.ts
47
800
  export declare const readRunManifest: (root: string, runId: string) => Promise<{
48
- readonly schemaVersion: 2 | 3 | 4;
801
+ readonly schemaVersion: 2 | 3 | 4 | 5;
49
802
  readonly runUri: string;
50
803
  readonly evalId: string;
51
804
  readonly suiteId?: string | undefined;
@@ -77,6 +830,10 @@ export declare const readRunManifest: (root: string, runId: string) => Promise<{
77
830
  readonly url?: string | undefined;
78
831
  } | undefined;
79
832
  } | undefined;
833
+ readonly process?: {
834
+ readonly pid: number;
835
+ readonly hostname: string;
836
+ } | undefined;
80
837
  readonly status?: "cancelled" | "completed" | "failed" | "running" | undefined;
81
838
  }>;
82
839
  export declare const readRunSummary: (root: string, runId: string) => Promise<{
@@ -86,6 +843,7 @@ export declare const readRunSummary: (root: string, runId: string) => Promise<{
86
843
  readonly trialCount: number;
87
844
  readonly passed: number;
88
845
  readonly failed: number;
846
+ readonly cancelled?: number | undefined;
89
847
  readonly error?: {
90
848
  readonly name: string;
91
849
  readonly message: string;
@@ -93,7 +851,7 @@ export declare const readRunSummary: (root: string, runId: string) => Promise<{
93
851
  } | undefined;
94
852
  }>;
95
853
  export declare const readTrialManifest: (root: string, runId: string, trialId: string) => Promise<{
96
- readonly schemaVersion: 2 | 3 | 4;
854
+ readonly schemaVersion: 2 | 3 | 4 | 5;
97
855
  readonly runUri: string;
98
856
  readonly trialUri: string;
99
857
  readonly trialIndex: number;
@@ -112,6 +870,12 @@ export declare const readTrialManifest: (root: string, runId: string, trialId: s
112
870
  readonly version?: string | undefined;
113
871
  } | undefined;
114
872
  readonly startedAt: string;
873
+ readonly datasets?: {
874
+ readonly id: string;
875
+ readonly visibility: "candidate" | "evaluator";
876
+ readonly source: "computed" | "static";
877
+ readonly digest: string;
878
+ }[] | undefined;
115
879
  readonly status?: "cancelled" | "completed" | "failed" | "running" | undefined;
116
880
  }>;
117
881
  export declare const readTrialSummary: (root: string, runId: string, trialId: string) => Promise<{
@@ -146,6 +910,7 @@ export declare const readTrialSummary: (root: string, runId: string, trialId: st
146
910
  readonly message: string;
147
911
  readonly stack?: string | undefined;
148
912
  } | undefined;
913
+ readonly skipped?: true | undefined;
149
914
  }[];
150
915
  readonly checkpoints?: {
151
916
  readonly step: number;
@@ -224,6 +989,7 @@ export declare const readTrialScoring: (root: string, runId: string, trialId: st
224
989
  readonly message: string;
225
990
  readonly stack?: string | undefined;
226
991
  } | undefined;
992
+ readonly skipped?: true | undefined;
227
993
  }[];
228
994
  readonly checkpoints?: {
229
995
  readonly step: number;
@@ -264,17 +1030,27 @@ export declare const readTrialScoring: (root: string, runId: string, trialId: st
264
1030
  readonly passed: boolean;
265
1031
  }>;
266
1032
  export declare function readTrialEvents(root: string, runId: string, trialId: string): Promise<TrajectoryEvent[]>;
1033
+ /**
1034
+ * True when a run's owning process is known to be gone: it ran on this host
1035
+ * and its PID no longer exists. Runs from other hosts are never judged.
1036
+ */
1037
+ export declare function ownerIsGone(owner: RunProcess | undefined): boolean;
267
1038
  //#endregion
268
1039
  //#region ../runner/src/matrix.d.ts
1040
+ /** Cells run; cancelled cells are neither passed nor failed. */
1041
+ type MatrixSummary = {
1042
+ cells: number;
1043
+ passed: number;
1044
+ failed: number;
1045
+ cancelled: number;
1046
+ };
269
1047
  /** Bounded workers pull cells from the iterator; no Cartesian job array is allocated. */
270
1048
  export declare function runMatrix(matrix: EvalMatrix, options: Omit<RunEvalOptions, 'runId' | 'trialId' | 'parameters' | 'matrix'> & {
271
1049
  selection?: MatrixSelection;
1050
+ /** The suite each cell's run is recorded under, when `suiteId` is not given. */
1051
+ suiteFor?: (cell: EvalMatrixCell) => string | undefined;
272
1052
  onResult?: (cell: EvalMatrixCell, result: RunResult) => void | Promise<void>;
273
- }): Effect.Effect<{
274
- cells: number;
275
- passed: number;
276
- failed: number;
277
- }, unknown>;
1053
+ }): Effect.Effect<MatrixSummary, unknown>;
278
1054
  //#endregion
279
1055
  //#region ../runner/src/index.d.ts
280
1056
  export type RunEvalOptions = {
@@ -300,9 +1076,31 @@ export type RunEvalOptions = {
300
1076
  source?: RunSource;
301
1077
  /** The project's evals and suites at run time, saved beside the manifest. */
302
1078
  catalog?: RunCatalog;
1079
+ /** Project root; dataset paths resolve against it. Default: the working directory. */
1080
+ root?: string;
1081
+ /**
1082
+ * Aborting stops new trials from starting; running trials stop at their next
1083
+ * step and are finalized as cancelled. Also passed to dataset loaders.
1084
+ */
1085
+ signal?: AbortSignal;
1086
+ /**
1087
+ * Observes every trajectory event after it is recorded, for live progress.
1088
+ * It must not throw; an error it throws is ignored.
1089
+ */
1090
+ onEvent?: (trial: TrialRef, event: TrajectoryEvent) => void;
303
1091
  now?: () => Date;
304
1092
  };
1093
+ /** Identifies the trial an observed event belongs to. */
1094
+ export type TrialRef = {
1095
+ runId: string;
1096
+ trialId: string;
1097
+ trialIndex: number;
1098
+ evalId: string;
1099
+ suiteId?: string;
1100
+ parameters?: JsonObject;
1101
+ };
305
1102
  /** Effect-native aggregate eval execution entry point. */
306
1103
  export declare function runEval(definition: EvalDefinition, options: RunEvalOptions): Effect.Effect<RunResult, unknown>;
307
1104
  //#endregion
1105
+ export type { DatasetFileEntry, MatrixSummary };
308
1106
  //# sourceMappingURL=runner.d.mts.map