@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.
Files changed (45) hide show
  1. package/CHANGELOG.md +67 -1
  2. package/README.md +10 -8
  3. package/dist/cli.mjs +1287 -266
  4. package/dist/dashboard/assets/index-BK9x-zoi.css +2 -0
  5. package/dist/dashboard/assets/index-DzsDLGHx.js +32 -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 +1344 -2
  10. package/dist/index.d.mts.map +1 -1
  11. package/dist/index.mjs +2 -4
  12. package/dist/runner.d.mts +807 -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-CVSCn3bZ.mjs} +445 -115
  29. package/dist/{src-DzZueFn3.mjs → src-CZnDXP1K.mjs} +46 -10
  30. package/dist/{src-ButXPY8P.mjs → src-D4tCwxNb.mjs} +418 -94
  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-U6TUTBf7.d.mts +0 -1019
  37. package/dist/index-U6TUTBf7.d.mts.map +0 -1
  38. package/dist/index-db-HdZXelOS.d.mts +0 -142
  39. package/dist/index-db-HdZXelOS.d.mts.map +0 -1
  40. package/dist/index-db-vbqEGFaU.mjs.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, Jt as EvalMatrixCell, N as JsonObject, U as RunResult, V as RunCatalog, W as RunSource, Yt as MatrixSelection, n as AgentRuntimeName, qt as EvalMatrix, y as EvalDefinition } from "./index-U6TUTBf7.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,765 @@ 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
+ timestamp: string;
376
+ } | {
377
+ kind: 'transcript-step-completed';
378
+ step: number;
379
+ timestamp: string;
380
+ } | {
381
+ kind: 'transcript-step-skipped';
382
+ step: number;
383
+ timestamp: string;
384
+ } | {
385
+ kind: 'checkpoint-started';
386
+ step: number;
387
+ name: string;
388
+ timestamp: string;
389
+ } | {
390
+ kind: 'checkpoint-completed';
391
+ step: number;
392
+ status: 'passed' | 'failed' | 'skipped';
393
+ timestamp: string;
394
+ } | {
395
+ kind: 'checkpoint-error';
396
+ step: number;
397
+ error: RecordedError;
398
+ timestamp: string;
399
+ } | {
400
+ kind: 'scorer-started';
401
+ scorer: string;
402
+ timestamp: string;
403
+ } | {
404
+ kind: 'scorer-completed';
405
+ scorer: string;
406
+ /** Absent when the scorer returned `skip()`. */
407
+ value?: number;
408
+ skipped?: true;
409
+ timestamp: string;
410
+ } | {
411
+ kind: 'scorer-failed';
412
+ scorer: string;
413
+ error: RecordedError;
414
+ timestamp: string;
415
+ } | {
416
+ kind: 'trial-completed';
417
+ timestamp: string;
418
+ } | {
419
+ kind: 'error';
420
+ error: RecordedError;
421
+ timestamp: string;
422
+ };
423
+ type TrajectoryEvent = (AutEvent & {
424
+ source: 'aut';
425
+ }) | (RunnerEvent & {
426
+ source: 'runner';
427
+ });
428
+ type WorkspaceView = {
429
+ /** Absolute path to this trial-scoped workspace. Do not persist it in reports. */
430
+ root: string;
431
+ };
432
+ type CandidateWorkspace = WorkspaceView;
433
+ type EvaluatorWorkspace = WorkspaceView;
434
+ type AutContext = {
435
+ runId: string;
436
+ evalId: string;
437
+ trialId: string;
438
+ trialIndex: number;
439
+ metadata: JsonObject;
440
+ /** Run-time parameters supplied by the eval definition or CLI invocation. */
441
+ parameters?: JsonObject;
442
+ runtime?: AgentRuntimeName;
443
+ /** Values of the scenario's candidate datasets, by dataset ID. */
444
+ data: JsonObject;
445
+ /** Contains only resources visible to the AUT/model. */
446
+ workspace: CandidateWorkspace;
447
+ /** Private evaluator capability for trusted AUT adapters; never expose this to the model. */
448
+ evaluatorWorkspace: EvaluatorWorkspace;
449
+ };
450
+ type AutAdapter<TMessage = string> = {
451
+ readonly identity?: AutIdentity;
452
+ /** Available execution environments for this AUT. Default: `{ local: { kind: 'in-process' } }`. */
453
+ readonly runtimes?: AgentRuntimes;
454
+ start(options: {
455
+ context: AutContext;
456
+ runtime?: AgentRuntime;
457
+ /** Optional: stream events as they happen. Returning a turn result from `send` is enough for most agents. */
458
+ onEvent: (event: AutEventInput) => void | Promise<void>;
459
+ }): Promise<AutSession<TMessage>>;
460
+ };
461
+ type AutSession<TMessage = string> = {
462
+ /**
463
+ * Resolves once the AUT has completed the turn initiated by this message.
464
+ * It may return the turn's reply and tool calls instead of emitting events.
465
+ */
466
+ send(message: TMessage): Promise<void | TurnResult>;
467
+ /** Optional; defaults to doing nothing. */
468
+ close?(): Promise<void>;
469
+ };
470
+ type UserStep = {
471
+ kind: 'user';
472
+ message: string;
473
+ };
474
+ type AgentStep = {
475
+ kind: 'agent';
476
+ expectation: JsonObject;
477
+ };
478
+ type TurnView = {
479
+ userStepIndex: number;
480
+ events: readonly (AutEvent & {
481
+ source: 'aut';
482
+ })[];
483
+ assistantMessages: readonly (Extract<AutEvent, {
484
+ kind: 'message';
485
+ }> & {
486
+ role: 'assistant';
487
+ source: 'aut';
488
+ })[];
489
+ toolCalls: readonly {
490
+ eventIndex: number;
491
+ id: string;
492
+ name: string;
493
+ arguments: JsonValue;
494
+ resultObservation: 'observed' | 'absent' | 'ambiguous';
495
+ result?: JsonValue;
496
+ }[];
497
+ lastAssistantText?: string;
498
+ };
499
+ type ExpectToolCallStep = {
500
+ kind: 'expect-tool-call';
501
+ name: string;
502
+ expected: {
503
+ name: string;
504
+ arguments?: JsonValue;
505
+ };
506
+ };
507
+ type TranscriptStep = UserStep | AgentStep | ScoringRule | ExpectToolCallStep;
508
+ type JudgeRunInfo = {
509
+ agent?: AutIdentity;
510
+ usage?: Usage;
511
+ /** Judge-agent observations; never attributed to the AUT trajectory. */
512
+ events?: JsonValue[];
513
+ };
514
+ /** A scorer's "does not apply" result; see `skip()`. */
515
+ type SkippedScore = {
516
+ skipped: true;
517
+ reason: string;
518
+ };
519
+ type ScoreValue = number | SkippedScore | {
520
+ value: number;
521
+ passed?: boolean;
522
+ explanation?: string;
523
+ /** Any JSON-convertible value. */
524
+ evidence?: unknown;
525
+ /** Judge-agent evidence, never inferred from AUT usage. */
526
+ judge?: JudgeRunInfo;
527
+ };
528
+ type ScoreResult = {
529
+ name: string;
530
+ kind: 'predicate' | 'judge';
531
+ value?: number;
532
+ passed?: boolean;
533
+ explanation?: string;
534
+ evidence?: JsonValue;
535
+ judge?: JudgeRunInfo;
536
+ durationMs: number;
537
+ error?: RecordedError;
538
+ /** The scorer returned `skip()`; `explanation` holds the reason and there is no value. */
539
+ skipped?: true;
540
+ };
541
+ type ArtifactView = {
542
+ candidate: CandidateWorkspace;
543
+ evaluator: EvaluatorWorkspace;
544
+ };
545
+ type ScoringContext = {
546
+ context: AutContext;
547
+ trajectory: {
548
+ events: readonly TrajectoryEvent[];
549
+ };
550
+ artifacts: ArtifactView;
551
+ /** Most recent completed turn; absent if no user message has been sent. */
552
+ turn?: TurnView;
553
+ /** Content of the last assistant message of `turn`. */
554
+ output?: JsonValue;
555
+ /** Values of all the scenario's datasets (candidate and evaluator), by dataset ID. */
556
+ data: JsonObject;
557
+ };
558
+ type PredicateScorer = {
559
+ kind: 'predicate';
560
+ name: string;
561
+ supportsPartial?: boolean;
562
+ /** A numeric result passes when it is at least this value. Default: only 1 passes. */
563
+ passAt?: number;
564
+ run(context: ScoringContext): boolean | ScoreValue | Promise<boolean | ScoreValue>;
565
+ };
566
+ type JudgeRule = {
567
+ kind: 'judge';
568
+ name: string;
569
+ rubric: string;
570
+ /** Run even when the scenario stopped early or execution failed. */
571
+ supportsPartial?: boolean;
572
+ };
573
+ type ScoringRule = PredicateScorer | JudgeRule;
574
+ type EvalPolicy = {
575
+ timeoutMs?: number;
576
+ /** Stop later transcript steps after a failed checkpoint assertion. Default false. */
577
+ failfast?: boolean;
578
+ /** Number of independent trials requested by local and hosted runners. */
579
+ trials?: number;
580
+ };
581
+ type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
582
+ id: string;
583
+ name?: string;
584
+ agent: TAgent;
585
+ /** Separate judge agent; its model and tools are never inherited from the AUT. */
586
+ judge?: AutAdapter;
587
+ /** Data and files the scenario uses; each trial gets its own copy. */
588
+ datasets?: readonly Dataset[];
589
+ transcript: TranscriptStep[];
590
+ scoring: ScoringRule[];
591
+ policy?: EvalPolicy;
592
+ /** Any JSON-convertible object; converted when the eval is defined. */
593
+ metadata?: Record<string, unknown>;
594
+ };
595
+ type EvalRegistryMetadata = {
596
+ id: string;
597
+ name?: string;
598
+ suiteId?: string;
599
+ };
600
+ type EvalSuiteMetadata = {
601
+ id: string;
602
+ name?: string;
603
+ evalIds: string[];
604
+ };
605
+ type RunStatus = 'running' | 'completed' | 'failed' | 'cancelled';
606
+ /**
607
+ * Where a run's eval code came from: the repository, eval project and commit.
608
+ * Results are tagged with it; they are never stored in the repository itself.
609
+ */
610
+ type RunSource = {
611
+ /** Normalized repository key, e.g. `gitlab.example.com/group/repo`. */
612
+ repo: string;
613
+ /** Eval project directory relative to the repository root; `""` at the root. */
614
+ project: string;
615
+ /** Full commit SHA. */
616
+ commit: string;
617
+ ref?: string;
618
+ committedAt?: string;
619
+ /** True when the working tree had uncommitted changes at run time. */
620
+ dirty: boolean;
621
+ ci?: {
622
+ provider: string;
623
+ pipeline?: string;
624
+ job?: string;
625
+ url?: string;
626
+ };
627
+ };
628
+ /** The project's evals and suites when a run started; written beside its manifest. */
629
+ type RunCatalog = {
630
+ catalog: EvalCatalogEntry[];
631
+ evals: EvalRegistryMetadata[];
632
+ suites: EvalSuiteMetadata[];
633
+ };
634
+ /** The process that owns a running run, so readers can tell an interrupted run from a live one. */
635
+ type RunProcess = {
636
+ pid: number;
637
+ hostname: string;
638
+ };
639
+ type RunMetadata = {
640
+ schemaVersion: 2 | 3 | 4 | 5;
641
+ runId: string;
642
+ runUri: ResourceUri<'run'>;
643
+ evalId: string;
644
+ suiteId?: string;
645
+ parameters?: JsonObject;
646
+ matrix?: {
647
+ id: string;
648
+ cellKey: string;
649
+ };
650
+ aut?: AutIdentity;
651
+ startedAt: string;
652
+ /** Present from schema version 4 when the run's commit could be determined. */
653
+ source?: RunSource;
654
+ /** From schema version 5. */
655
+ process?: RunProcess;
656
+ };
657
+ type TrialMetadata = {
658
+ schemaVersion: 2 | 3 | 4 | 5;
659
+ runId: string;
660
+ runUri: ResourceUri<'run'>;
661
+ trialId: string;
662
+ trialUri: ResourceUri<'trial'>;
663
+ trialIndex: number;
664
+ evalId: string;
665
+ parameters?: JsonObject;
666
+ matrix?: {
667
+ id: string;
668
+ cellKey: string;
669
+ };
670
+ aut?: AutIdentity;
671
+ startedAt: string;
672
+ /** From schema version 5: the datasets this trial used, with content digests. */
673
+ datasets?: TrialDataset[];
674
+ };
675
+ type TrialDataset = {
676
+ id: string;
677
+ visibility: DatasetVisibility;
678
+ source: 'static' | 'computed';
679
+ /** SHA-256 of the trial's content: file paths and bytes, and the canonical value. */
680
+ digest: string;
681
+ };
682
+ type CheckpointResult = {
683
+ step: number;
684
+ kind: 'predicate' | 'judge' | 'expect-tool-call';
685
+ name: string;
686
+ status: 'passed' | 'failed' | 'error' | 'skipped';
687
+ value?: number;
688
+ passed?: boolean;
689
+ explanation?: string;
690
+ evidence?: JsonValue;
691
+ judge?: JudgeRunInfo;
692
+ durationMs?: number;
693
+ error?: RecordedError;
694
+ matchedToolCall?: {
695
+ eventIndex: number;
696
+ id: string;
697
+ };
698
+ };
699
+ type TrialScoring = {
700
+ results: ScoreResult[];
701
+ checkpoints?: CheckpointResult[];
702
+ skippedScorers?: string[];
703
+ overall?: number;
704
+ passed: boolean;
705
+ };
706
+ type ArtifactEntry = {
707
+ /** Path relative to this trial's artifact root. */
708
+ path: string;
709
+ kind: 'file' | 'directory';
710
+ size?: number;
711
+ };
712
+ type TrialSummary = {
713
+ status: RunStatus;
714
+ endedAt: string;
715
+ durationMs?: number;
716
+ scoring?: TrialScoring;
717
+ artifacts?: ArtifactEntry[];
718
+ error?: RecordedError;
719
+ };
720
+ type RunSummary = {
721
+ status: RunStatus;
722
+ endedAt: string;
723
+ durationMs?: number;
724
+ trialCount: number;
725
+ passed: number;
726
+ failed: number;
727
+ /** Trials stopped by cancellation; counted neither as passed nor failed. */
728
+ cancelled?: number;
729
+ error?: RecordedError;
730
+ };
731
+ type TrialWriter = {
732
+ appendEvent(event: TrajectoryEvent): Promise<void>;
733
+ writeScores(scoring: TrialScoring): Promise<void>;
734
+ /** Writes a file below this trial's artifact root. */
735
+ writeArtifact(path: string, data: Uint8Array): Promise<void>;
736
+ finalize(summary: TrialSummary): Promise<void>;
737
+ };
738
+ type RunWriter = {
739
+ readonly location: string;
740
+ startTrial(metadata: TrialMetadata): Promise<TrialWriter>;
741
+ finalize(summary: RunSummary): Promise<void>;
742
+ };
743
+ type ReportStore = {
744
+ startRun(metadata: RunMetadata, context?: {
745
+ catalog?: RunCatalog;
746
+ }): Promise<RunWriter>;
747
+ };
748
+ type TrialResult = {
749
+ runId: string;
750
+ runUri: ResourceUri<'run'>;
751
+ trialId: string;
752
+ trialUri: ResourceUri<'trial'>;
753
+ trialIndex: number;
754
+ evalId: string;
755
+ status: RunStatus;
756
+ reportLocation: string;
757
+ durationMs?: number;
758
+ scoring?: TrialScoring;
759
+ error?: RecordedError;
760
+ };
761
+ type AggregateScoring = {
762
+ passed: number;
763
+ failed: number;
764
+ cancelled?: number;
765
+ passRate: number;
766
+ overall?: number;
767
+ };
768
+ type RunResult = TrialResult & {
769
+ runId: string;
770
+ trialCount?: number;
771
+ passed?: number;
772
+ failed?: number;
773
+ aggregateScoring?: AggregateScoring;
774
+ /** Present for an aggregate multi-trial run. */
775
+ trials?: TrialResult[];
776
+ };
41
777
  //#endregion
42
778
  //#region ../runner/src/local-report-store.d.ts
43
779
  /** Persists each run as a local tree rooted below `rootDirectory`. */
44
780
  export declare function localReportStore(rootDirectory: string): ReportStore;
45
781
  //#endregion
782
+ //#region ../runner/src/datasets.d.ts
783
+ /** A file a static dataset places below its mount, for browsing. */
784
+ type DatasetFileEntry = {
785
+ path: string;
786
+ size: number;
787
+ };
788
+ /**
789
+ * The files a static dataset places in every workspace, relative to its
790
+ * mount. Computed datasets return `undefined`: their files only exist once
791
+ * `onLoad` runs, and browsing must never run project code.
792
+ */
793
+ export declare function staticDatasetFiles(dataset: Dataset, root: string): Promise<DatasetFileEntry[] | undefined>;
794
+ /** One file of a static dataset, by its path below the mount. */
795
+ export declare function staticDatasetFile(dataset: Dataset, root: string, file: string): Promise<Uint8Array<ArrayBuffer>>;
796
+ //#endregion
46
797
  //#region ../runner/src/local-report-reader.d.ts
47
798
  export declare const readRunManifest: (root: string, runId: string) => Promise<{
48
- readonly schemaVersion: 2 | 3 | 4;
799
+ readonly schemaVersion: 2 | 3 | 4 | 5;
49
800
  readonly runUri: string;
50
801
  readonly evalId: string;
51
802
  readonly suiteId?: string | undefined;
@@ -77,6 +828,10 @@ export declare const readRunManifest: (root: string, runId: string) => Promise<{
77
828
  readonly url?: string | undefined;
78
829
  } | undefined;
79
830
  } | undefined;
831
+ readonly process?: {
832
+ readonly pid: number;
833
+ readonly hostname: string;
834
+ } | undefined;
80
835
  readonly status?: "cancelled" | "completed" | "failed" | "running" | undefined;
81
836
  }>;
82
837
  export declare const readRunSummary: (root: string, runId: string) => Promise<{
@@ -86,6 +841,7 @@ export declare const readRunSummary: (root: string, runId: string) => Promise<{
86
841
  readonly trialCount: number;
87
842
  readonly passed: number;
88
843
  readonly failed: number;
844
+ readonly cancelled?: number | undefined;
89
845
  readonly error?: {
90
846
  readonly name: string;
91
847
  readonly message: string;
@@ -93,7 +849,7 @@ export declare const readRunSummary: (root: string, runId: string) => Promise<{
93
849
  } | undefined;
94
850
  }>;
95
851
  export declare const readTrialManifest: (root: string, runId: string, trialId: string) => Promise<{
96
- readonly schemaVersion: 2 | 3 | 4;
852
+ readonly schemaVersion: 2 | 3 | 4 | 5;
97
853
  readonly runUri: string;
98
854
  readonly trialUri: string;
99
855
  readonly trialIndex: number;
@@ -112,6 +868,12 @@ export declare const readTrialManifest: (root: string, runId: string, trialId: s
112
868
  readonly version?: string | undefined;
113
869
  } | undefined;
114
870
  readonly startedAt: string;
871
+ readonly datasets?: {
872
+ readonly id: string;
873
+ readonly visibility: "candidate" | "evaluator";
874
+ readonly source: "computed" | "static";
875
+ readonly digest: string;
876
+ }[] | undefined;
115
877
  readonly status?: "cancelled" | "completed" | "failed" | "running" | undefined;
116
878
  }>;
117
879
  export declare const readTrialSummary: (root: string, runId: string, trialId: string) => Promise<{
@@ -146,6 +908,7 @@ export declare const readTrialSummary: (root: string, runId: string, trialId: st
146
908
  readonly message: string;
147
909
  readonly stack?: string | undefined;
148
910
  } | undefined;
911
+ readonly skipped?: true | undefined;
149
912
  }[];
150
913
  readonly checkpoints?: {
151
914
  readonly step: number;
@@ -224,6 +987,7 @@ export declare const readTrialScoring: (root: string, runId: string, trialId: st
224
987
  readonly message: string;
225
988
  readonly stack?: string | undefined;
226
989
  } | undefined;
990
+ readonly skipped?: true | undefined;
227
991
  }[];
228
992
  readonly checkpoints?: {
229
993
  readonly step: number;
@@ -264,17 +1028,27 @@ export declare const readTrialScoring: (root: string, runId: string, trialId: st
264
1028
  readonly passed: boolean;
265
1029
  }>;
266
1030
  export declare function readTrialEvents(root: string, runId: string, trialId: string): Promise<TrajectoryEvent[]>;
1031
+ /**
1032
+ * True when a run's owning process is known to be gone: it ran on this host
1033
+ * and its PID no longer exists. Runs from other hosts are never judged.
1034
+ */
1035
+ export declare function ownerIsGone(owner: RunProcess | undefined): boolean;
267
1036
  //#endregion
268
1037
  //#region ../runner/src/matrix.d.ts
1038
+ /** Cells run; cancelled cells are neither passed nor failed. */
1039
+ type MatrixSummary = {
1040
+ cells: number;
1041
+ passed: number;
1042
+ failed: number;
1043
+ cancelled: number;
1044
+ };
269
1045
  /** Bounded workers pull cells from the iterator; no Cartesian job array is allocated. */
270
1046
  export declare function runMatrix(matrix: EvalMatrix, options: Omit<RunEvalOptions, 'runId' | 'trialId' | 'parameters' | 'matrix'> & {
271
1047
  selection?: MatrixSelection;
1048
+ /** The suite each cell's run is recorded under, when `suiteId` is not given. */
1049
+ suiteFor?: (cell: EvalMatrixCell) => string | undefined;
272
1050
  onResult?: (cell: EvalMatrixCell, result: RunResult) => void | Promise<void>;
273
- }): Effect.Effect<{
274
- cells: number;
275
- passed: number;
276
- failed: number;
277
- }, unknown>;
1051
+ }): Effect.Effect<MatrixSummary, unknown>;
278
1052
  //#endregion
279
1053
  //#region ../runner/src/index.d.ts
280
1054
  export type RunEvalOptions = {
@@ -300,9 +1074,31 @@ export type RunEvalOptions = {
300
1074
  source?: RunSource;
301
1075
  /** The project's evals and suites at run time, saved beside the manifest. */
302
1076
  catalog?: RunCatalog;
1077
+ /** Project root; dataset paths resolve against it. Default: the working directory. */
1078
+ root?: string;
1079
+ /**
1080
+ * Aborting stops new trials from starting; running trials stop at their next
1081
+ * step and are finalized as cancelled. Also passed to dataset loaders.
1082
+ */
1083
+ signal?: AbortSignal;
1084
+ /**
1085
+ * Observes every trajectory event after it is recorded, for live progress.
1086
+ * It must not throw; an error it throws is ignored.
1087
+ */
1088
+ onEvent?: (trial: TrialRef, event: TrajectoryEvent) => void;
303
1089
  now?: () => Date;
304
1090
  };
1091
+ /** Identifies the trial an observed event belongs to. */
1092
+ export type TrialRef = {
1093
+ runId: string;
1094
+ trialId: string;
1095
+ trialIndex: number;
1096
+ evalId: string;
1097
+ suiteId?: string;
1098
+ parameters?: JsonObject;
1099
+ };
305
1100
  /** Effect-native aggregate eval execution entry point. */
306
1101
  export declare function runEval(definition: EvalDefinition, options: RunEvalOptions): Effect.Effect<RunResult, unknown>;
307
1102
  //#endregion
1103
+ export type { DatasetFileEntry, MatrixSummary };
308
1104
  //# sourceMappingURL=runner.d.mts.map