@leostera/evalkit 0.8.0 → 0.10.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 (34) hide show
  1. package/CHANGELOG.md +93 -2
  2. package/README.md +5 -4
  3. package/dist/cli.mjs +510 -379
  4. package/dist/dashboard/assets/index-DNR4shrM.js +67 -0
  5. package/dist/dashboard/assets/index-TPYprg75.css +2 -0
  6. package/dist/dashboard/index.html +2 -2
  7. package/dist/{files-C-U0-PWW.mjs → files-DkDQs2JL.mjs} +3 -0
  8. package/dist/{index-db-vbqEGFaU.mjs → index-db-B1FeXzmS.mjs} +333 -51
  9. package/dist/index.d.mts +529 -183
  10. package/dist/index.d.mts.map +1 -1
  11. package/dist/index.mjs +2 -2
  12. package/dist/runner.d.mts +447 -173
  13. package/dist/runner.d.mts.map +1 -1
  14. package/dist/runner.mjs +2 -2
  15. package/dist/share-worker.d.mts +10 -3
  16. package/dist/share-worker.d.mts.map +1 -1
  17. package/dist/share-worker.mjs +6 -3
  18. package/dist/share.d.mts +49 -7
  19. package/dist/share.d.mts.map +1 -1
  20. package/dist/share.mjs +4 -4
  21. package/dist/skills/evalkit/SKILL.md +5 -5
  22. package/dist/skills/evalkit-agents/SKILL.md +5 -3
  23. package/dist/skills/evalkit-datasets/SKILL.md +5 -5
  24. package/dist/skills/evalkit-evals/SKILL.md +5 -5
  25. package/dist/skills/evalkit-judges/SKILL.md +8 -6
  26. package/dist/skills/evalkit-matrices/SKILL.md +2 -2
  27. package/dist/skills/evalkit-results/SKILL.md +6 -6
  28. package/dist/{src-LeGSyDD2.mjs → src-B14fXAGp.mjs} +334 -73
  29. package/dist/{src-CZnDXP1K.mjs → src-Bccv9igQ.mjs} +8 -3
  30. package/dist/{src-mm8L_IxM.mjs → src-BfSQKOJP.mjs} +676 -321
  31. package/dist/upgrade-G-uFPJKg.mjs +111 -0
  32. package/package.json +1 -1
  33. package/dist/dashboard/assets/index-C12IeG2y.css +0 -2
  34. package/dist/dashboard/assets/index-xlVsW6ZR.js +0 -37
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as Schema from "effect/Schema";
2
2
  //#region ../core/src/identity.d.ts
3
- export declare const ResourceKindSchema: Schema.Literal<["run", "trial", "artifact"]>;
3
+ export declare const ResourceKindSchema: Schema.Literal<["run", "artifact"]>;
4
4
  export type ResourceKind = typeof ResourceKindSchema.Type;
5
5
  /** Human-authored project-local identifier; never a generated resource URI. */
6
6
  export declare function authorId(value: string): string;
@@ -26,14 +26,14 @@ export type DatasetFileSource = string | Uint8Array | {
26
26
  file: string;
27
27
  };
28
28
  /**
29
- * Files for the trial workspace: a directory relative to the project root, or
29
+ * Files for the run workspace: a directory relative to the project root, or
30
30
  * a map from workspace path (below the dataset's mount) to its content.
31
31
  */
32
32
  export type DatasetFiles = string | Readonly<Record<string, DatasetFileSource>>;
33
- /** What one trial receives from a dataset. */
33
+ /** What one run receives from a dataset. */
34
34
  export type DatasetContent = {
35
35
  files?: DatasetFiles;
36
- /** Any JSON-convertible value; converted once when the trial starts. */
36
+ /** Any JSON-convertible value; converted once when the run starts. */
37
37
  value?: unknown;
38
38
  };
39
39
  export type DatasetLoadContext = {
@@ -41,12 +41,12 @@ export type DatasetLoadContext = {
41
41
  root: string;
42
42
  signal: AbortSignal;
43
43
  };
44
- export type DatasetTrialContext = {
44
+ export type DatasetRunContext = {
45
45
  evalId: string;
46
46
  runId: string;
47
- trialId: string;
48
- trialIndex: number;
49
- /** Per-trial random seed, so repeated trials can choose different data. */
47
+ /** Set when the run is one of several repeats launched together. */
48
+ batch?: Batch;
49
+ /** Per-run random seed, so repeated runs can choose different data. */
50
50
  seed: number;
51
51
  /** The matrix cell's parameters, or `{}`. */
52
52
  parameters: JsonObject;
@@ -70,10 +70,10 @@ export type StaticDatasetDefinition = DatasetCommon & {
70
70
  onRun?: never;
71
71
  };
72
72
  export type ComputedDatasetDefinition<TLoaded extends DatasetContent> = DatasetCommon & {
73
- /** Once per process; the successful result is cached and shared by every trial. */
73
+ /** Once per process; the successful result is cached and shared by every run. */
74
74
  onLoad: (load: DatasetLoadContext) => TLoaded | Promise<TLoaded>;
75
- /** Once per trial; defaults to using the loaded content as is. */
76
- onRun?: (loaded: TLoaded, trial: DatasetTrialContext) => DatasetContent | Promise<DatasetContent>;
75
+ /** Once per run; defaults to using the loaded content as is. */
76
+ onRun?: (loaded: TLoaded, run: DatasetRunContext) => DatasetContent | Promise<DatasetContent>;
77
77
  files?: never;
78
78
  value?: never;
79
79
  valueFile?: never;
@@ -86,7 +86,7 @@ export type DatasetSource = {
86
86
  } | {
87
87
  kind: 'computed';
88
88
  onLoad: (load: DatasetLoadContext) => DatasetContent | Promise<DatasetContent>;
89
- onRun?: (loaded: DatasetContent, trial: DatasetTrialContext) => DatasetContent | Promise<DatasetContent>;
89
+ onRun?: (loaded: DatasetContent, run: DatasetRunContext) => DatasetContent | Promise<DatasetContent>;
90
90
  };
91
91
  /** A checked dataset, as returned by `defineDataset`. Evals accept only these. */
92
92
  export type Dataset = {
@@ -101,10 +101,10 @@ export type Dataset = {
101
101
  /** Normalizes a relative POSIX path and rejects absolute or escaping ones. */
102
102
  export declare function relativeDatasetPath(value: string, label: string): string;
103
103
  /**
104
- * Declares named data that scenarios use: files placed in each trial's
104
+ * Declares named data that scenarios use: files placed in each run's
105
105
  * workspace, a value for the agent and scorers, or both. Static datasets give
106
106
  * `files`, `value` or `valueFile`; computed datasets give `onLoad` (cached per
107
- * process) and optionally `onRun` (per trial).
107
+ * process) and optionally `onRun` (per run).
108
108
  */
109
109
  export declare function defineDataset<TLoaded extends DatasetContent>(definition: StaticDatasetDefinition | ComputedDatasetDefinition<TLoaded>): Dataset;
110
110
  export declare function isDataset(value: unknown): value is Dataset;
@@ -144,6 +144,8 @@ export type AutEventInput = {
144
144
  timestamp?: string;
145
145
  latencyMs?: number;
146
146
  usage?: Usage;
147
+ /** The model that answered this turn, when the agent knows it. */
148
+ model?: string;
147
149
  } | {
148
150
  kind: 'completed';
149
151
  output?: unknown;
@@ -165,6 +167,8 @@ export type TurnResult = string | {
165
167
  reply?: unknown;
166
168
  toolCalls?: readonly TurnToolCall[];
167
169
  usage?: Usage;
170
+ /** The model that answered, recorded with the usage. */
171
+ model?: string;
168
172
  };
169
173
  /** Converts an adapter event into a recorded `AutEvent`. */
170
174
  export declare function normalizeAutEvent(input: AutEventInput, now: () => Date): AutEvent;
@@ -174,6 +178,89 @@ export declare function normalizeAutEvent(input: AutEventInput, now: () => Date)
174
178
  */
175
179
  export declare function turnResultEvents(result: TurnResult, turn: number, now: () => Date): AutEvent[];
176
180
  //#endregion
181
+ //#region ../core/src/judge.d.ts
182
+ /**
183
+ * How a judge must answer, and how EvalKit turns the answer into a score.
184
+ *
185
+ * - `verdict` (the default): a value from 0 to 1 and a reason, as JSON.
186
+ * - `choices`: one of a fixed set of answers, such as A/B/C, each worth a value.
187
+ * - `criteria`: a value from 0 to 1 per criterion; the score is their weighted mean.
188
+ */
189
+ type JudgeAnswer = {
190
+ kind: 'verdict';
191
+ } | {
192
+ kind: 'choices';
193
+ choices: JudgeChoice[];
194
+ } | {
195
+ kind: 'criteria';
196
+ criteria: JudgeCriterion[];
197
+ };
198
+ /** One answer a `choices` judge can give. Keys are matched case-insensitively. */
199
+ type JudgeChoice = {
200
+ key: string;
201
+ label: string;
202
+ value: number;
203
+ };
204
+ /** One thing a `criteria` judge scores. */
205
+ type JudgeCriterion = {
206
+ name: string;
207
+ weight: number;
208
+ description?: string;
209
+ };
210
+ /**
211
+ * A judge that answers with one of these choices, in this order:
212
+ * `choices({ A: ['Accurate and helpful', 1], B: ['Partly right', 0.5], C: ['Wrong', 0] })`.
213
+ */
214
+ export declare function choices(options: Record<string, readonly [label: string, value: number]>): JudgeAnswer;
215
+ /**
216
+ * Criteria by name: a number is the weight; `{ weight, description }` also
217
+ * says what the criterion checks. Weights default to 1.
218
+ */
219
+ type CriteriaOptions = Record<string, number | {
220
+ weight?: number;
221
+ description?: string;
222
+ }>;
223
+ /**
224
+ * A judge that scores each criterion from 0 to 1; the score is the weighted
225
+ * mean. A number is the weight; `{ weight, description }` also says what the
226
+ * criterion means. Weights default to 1.
227
+ */
228
+ export declare function criteria(options: CriteriaOptions): JudgeAnswer;
229
+ /**
230
+ * One criterion's result, as a scorer returns it and as results record it:
231
+ * a value with what it saw, or `reached: false` when the check never got to
232
+ * run, because something before it failed (say, the app would not start).
233
+ * A criterion not reached counts as 0; the score's `explanation` says why,
234
+ * once, instead of every criterion repeating it.
235
+ */
236
+ type CriterionResult = ReachedCriterion | UnreachedCriterion;
237
+ type ReachedCriterion = {
238
+ name: string;
239
+ /** From 0 to 1. */
240
+ value: number;
241
+ /** Default 1, or the declared weight. */
242
+ weight?: number;
243
+ /** Why this value. */
244
+ explanation?: string;
245
+ /** What the check observed, as plain data. */
246
+ evidence?: JsonValue;
247
+ };
248
+ type UnreachedCriterion = {
249
+ name: string;
250
+ reached: false;
251
+ weight?: number;
252
+ explanation?: string;
253
+ };
254
+ /** A criterion as a scorer returns it: its evidence may be any plain value. */
255
+ type CriterionInput = (Omit<ReachedCriterion, 'evidence'> & {
256
+ evidence?: unknown;
257
+ }) | UnreachedCriterion;
258
+ /**
259
+ * The pass mark in words: `only 1`, `≥ 0.5`, or for choices the ones that
260
+ * pass, such as `A or B`.
261
+ */
262
+ export declare function passMark(passAt: number | undefined, answer?: JudgeAnswer): string;
263
+ //#endregion
177
264
  //#region ../core/src/catalog.d.ts
178
265
  /**
179
266
  * What the dashboard's Library shows about each definition. Only definition
@@ -184,6 +271,8 @@ export declare function turnResultEvents(result: TurnResult, turn: number, now:
184
271
  export type CatalogOptions = {
185
272
  /** Project root; definition sites are reported relative to it, never absolute. */
186
273
  root?: string;
274
+ /** The project's default judge agent (`judge` in evalkit.config.ts). */
275
+ judge?: AutAdapter;
187
276
  };
188
277
  export type EvalCatalogAgent = {
189
278
  name?: string;
@@ -235,14 +324,24 @@ export type EvalCatalogDataset = {
235
324
  export type EvalCatalogScorer = {
236
325
  name: string;
237
326
  kind: ScoringRule['kind'];
327
+ /** What it checks, in the author's words. */
328
+ description?: string;
238
329
  passAt?: number;
239
330
  supportsPartial?: boolean;
240
331
  /** Judges only. */
241
332
  rubric?: string;
333
+ /** Judges only: the agent that judges (its own, or the project's default). */
334
+ agent?: EvalCatalogAgent;
335
+ /** Judges only: the names of the inputs it sees. */
336
+ inputs?: string[];
337
+ /** Judges only: how it answers. */
338
+ answer?: JudgeAnswer;
339
+ /** Judges only: the prompt it receives, with `{input}` placeholders. */
340
+ prompt?: string;
242
341
  definedAt?: string;
243
342
  };
244
343
  export type EvalCatalogStep =
245
- /** `message` is absent when it is computed for each trial. */
344
+ /** `message` is absent when it is computed for each run. */
246
345
  {
247
346
  kind: 'user';
248
347
  message?: string;
@@ -268,9 +367,9 @@ export type EvalCatalogEntry = {
268
367
  /** The separate agent that runs judge rules, if any. */
269
368
  judgeAgent?: EvalCatalogAgent;
270
369
  datasets: EvalCatalogDataset[];
271
- trialCount: number;
370
+ /** Runs started each time the scenario runs (`repeat`). */
371
+ repeat: number;
272
372
  policy: {
273
- trials: number;
274
373
  timeoutMs?: number;
275
374
  failfast?: boolean;
276
375
  };
@@ -339,11 +438,11 @@ type EvalkitConfig = {
339
438
  };
340
439
  execution?: {
341
440
  concurrency?: number;
342
- trials?: number;
441
+ repeat?: number;
343
442
  maxCells?: number;
344
443
  };
345
444
  reportDir?: string;
346
- /** The candidate files saved with each trial's results. */
445
+ /** The candidate files saved with each run's results. */
347
446
  artifacts?: {
348
447
  /**
349
448
  * Paths to leave out, as globs relative to the candidate workspace; a
@@ -352,14 +451,33 @@ type EvalkitConfig = {
352
451
  * A scenario's `workspace.ignore` patterns come after these.
353
452
  */
354
453
  exclude?: readonly string[];
454
+ /** Limits for files adapters `attach()`. */
455
+ attachments?: AttachmentLimits;
355
456
  };
356
- /** Where each trial's real workspace lives during a run. Default `_evalkit-sandbox`. */
457
+ /**
458
+ * Where each run's real workspace lives. Default: outside the project, in
459
+ * `<tmp>/evalkit/<project>-<hash>`, so agents cannot read the project or
460
+ * other runs by looking around. Inside the project, `run` warns.
461
+ */
357
462
  sandboxDir?: string;
358
- /** Which trial workspaces to keep in `sandboxDir` afterwards. Default `'failed'`: only trials that did not pass. */
463
+ /** Which run workspaces to keep in `sandboxDir` afterwards. Default `'failed'`: only runs that did not pass. */
359
464
  keepSandboxes?: KeepSandboxes;
360
465
  share?: ShareConfig;
466
+ /**
467
+ * The agent for every judge that names none: `judge(name, { rubric })`.
468
+ * Made with `defineAgent()`; it gets each run's parameters, so a matrix
469
+ * axis can choose its model.
470
+ */
471
+ judge?: AutAdapter;
361
472
  };
362
473
  type KeepSandboxes = 'failed' | 'all' | 'none';
474
+ type AttachmentLimits = {
475
+ /** A larger attachment keeps its last this-many bytes. Default 5 MB. */
476
+ maxFileBytes?: number;
477
+ /** All of one run's attachments; past it, `attach()` rejects. Default 20 MB. */
478
+ maxRunBytes?: number;
479
+ };
480
+ export declare const DEFAULT_ATTACHMENT_LIMITS: Required<AttachmentLimits>;
363
481
  /** Left out of candidate snapshots unless `artifacts.exclude` says otherwise. */
364
482
  export declare const DEFAULT_ARTIFACT_EXCLUDE: readonly string[];
365
483
  /** HTTP header names and values. */
@@ -377,6 +495,32 @@ type ShareConfig = {
377
495
  /** Pure, typed project configuration. Loading/discovery belongs to the CLI. */
378
496
  export declare function defineConfig<const T extends EvalkitConfig>(configuration: T): T;
379
497
  //#endregion
498
+ //#region ../core/src/usage.d.ts
499
+ /**
500
+ * Token usage an agent reports for one turn. EvalKit never measures or infers
501
+ * it; adapters copy it from their provider.
502
+ */
503
+ type Usage = {
504
+ /**
505
+ * Every input token the model read this turn: the prompt, history and tool
506
+ * results, **including** tokens read from or written to a prompt cache.
507
+ * (Some providers report cached tokens separately; add them in.)
508
+ */
509
+ inputTokens?: number;
510
+ /** Every token the model produced, including reasoning tokens. */
511
+ outputTokens?: number;
512
+ /** Of `inputTokens`, how many were read from a prompt cache. Informational. */
513
+ cachedInputTokens?: number;
514
+ /** The provider's own total; used only when input and output are not reported. */
515
+ totalTokens?: number;
516
+ };
517
+ /**
518
+ * The tokens a turn counts toward the `tokens` metric: `inputTokens +
519
+ * outputTokens` (cached input included), or `totalTokens` when neither is
520
+ * reported. Undefined when the turn reported no usage.
521
+ */
522
+ export declare function turnTokens(usage: Usage | undefined): number | undefined;
523
+ //#endregion
380
524
  //#region ../core/src/json.d.ts
381
525
  /** A value that cannot be stored in a report, with the path of the offending part. */
382
526
  export declare class NotJsonError extends Error {
@@ -413,7 +557,9 @@ export declare function definitionSite(value: unknown): DefinitionSite | undefin
413
557
  //#endregion
414
558
  //#region ../core/src/schema.d.ts
415
559
  /** Runtime schemas for serialized EvalKit report and API boundaries. */
416
- export declare const RunStatusSchema: Schema.Literal<["running", "completed", "failed", "cancelled"]>;
560
+ export declare const RunStatusSchema: Schema.Literal<["running", "passed", "failed", "errored", "cancelled"]>;
561
+ /** The report schema version this EvalKit writes and reads. */
562
+ export declare const REPORT_SCHEMA_VERSION = 6;
417
563
  export declare const RecordedErrorSchema: Schema.Struct<{
418
564
  name: typeof Schema.String;
419
565
  message: typeof Schema.String;
@@ -440,8 +586,19 @@ export declare const RunSourceSchema: Schema.Struct<{
440
586
  url: Schema.optional<typeof Schema.String>;
441
587
  }>>;
442
588
  }>;
589
+ export declare const BatchSchema: Schema.Struct<{
590
+ id: typeof Schema.String;
591
+ index: typeof Schema.Number;
592
+ size: typeof Schema.Number;
593
+ }>;
594
+ export declare const RunDatasetSchema: Schema.Struct<{
595
+ id: typeof Schema.String;
596
+ visibility: Schema.Literal<["candidate", "evaluator"]>;
597
+ source: Schema.Literal<["static", "computed"]>;
598
+ digest: typeof Schema.String;
599
+ }>;
443
600
  export declare const RunMetadataSchema: Schema.Struct<{
444
- schemaVersion: Schema.Literal<[2, 3, 4, 5]>;
601
+ schemaVersion: Schema.Literal<[6]>;
445
602
  runUri: Schema.filter<typeof Schema.String>;
446
603
  evalId: typeof Schema.String;
447
604
  suiteId: Schema.optional<typeof Schema.String>;
@@ -475,25 +632,11 @@ export declare const RunMetadataSchema: Schema.Struct<{
475
632
  pid: typeof Schema.Number;
476
633
  hostname: typeof Schema.String;
477
634
  }>>;
478
- }>;
479
- export declare const TrialMetadataSchema: Schema.Struct<{
480
- schemaVersion: Schema.Literal<[2, 3, 4, 5]>;
481
- runUri: Schema.filter<typeof Schema.String>;
482
- trialUri: Schema.filter<typeof Schema.String>;
483
- trialIndex: typeof Schema.Number;
484
- evalId: typeof Schema.String;
485
- parameters: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Schema<JsonValue, JsonValue, never>>>;
486
- matrix: Schema.optional<Schema.Struct<{
487
- id: typeof Schema.String;
488
- cellKey: typeof Schema.String;
489
- }>>;
490
- aut: Schema.optional<Schema.Struct<{
491
- name: Schema.optional<typeof Schema.String>;
492
- kind: typeof Schema.String;
635
+ batch: Schema.optional<Schema.Struct<{
493
636
  id: typeof Schema.String;
494
- version: Schema.optional<typeof Schema.String>;
637
+ index: typeof Schema.Number;
638
+ size: typeof Schema.Number;
495
639
  }>>;
496
- startedAt: typeof Schema.String;
497
640
  /** The effective snapshot ignore patterns: the project's, then the scenario's. */
498
641
  workspaceIgnore: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
499
642
  datasets: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
@@ -503,9 +646,9 @@ export declare const TrialMetadataSchema: Schema.Struct<{
503
646
  digest: typeof Schema.String;
504
647
  }>>>>;
505
648
  }>;
506
- /** On-disk manifests include a lifecycle status; older finalized manifests may still say running. */
649
+ /** On-disk manifests include a lifecycle status. */
507
650
  export declare const RunManifestSchema: Schema.Struct<{
508
- schemaVersion: Schema.Literal<[2, 3, 4, 5]>;
651
+ schemaVersion: Schema.Literal<[6]>;
509
652
  runUri: Schema.filter<typeof Schema.String>;
510
653
  evalId: typeof Schema.String;
511
654
  suiteId: Schema.optional<typeof Schema.String>;
@@ -539,26 +682,11 @@ export declare const RunManifestSchema: Schema.Struct<{
539
682
  pid: typeof Schema.Number;
540
683
  hostname: typeof Schema.String;
541
684
  }>>;
542
- status: Schema.optional<Schema.Literal<["running", "completed", "failed", "cancelled"]>>;
543
- }>;
544
- export declare const TrialManifestSchema: Schema.Struct<{
545
- schemaVersion: Schema.Literal<[2, 3, 4, 5]>;
546
- runUri: Schema.filter<typeof Schema.String>;
547
- trialUri: Schema.filter<typeof Schema.String>;
548
- trialIndex: typeof Schema.Number;
549
- evalId: typeof Schema.String;
550
- parameters: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Schema<JsonValue, JsonValue, never>>>;
551
- matrix: Schema.optional<Schema.Struct<{
685
+ batch: Schema.optional<Schema.Struct<{
552
686
  id: typeof Schema.String;
553
- cellKey: typeof Schema.String;
554
- }>>;
555
- aut: Schema.optional<Schema.Struct<{
556
- name: Schema.optional<typeof Schema.String>;
557
- kind: typeof Schema.String;
558
- id: typeof Schema.String;
559
- version: Schema.optional<typeof Schema.String>;
687
+ index: typeof Schema.Number;
688
+ size: typeof Schema.Number;
560
689
  }>>;
561
- startedAt: typeof Schema.String;
562
690
  workspaceIgnore: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
563
691
  datasets: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
564
692
  id: typeof Schema.String;
@@ -566,11 +694,12 @@ export declare const TrialManifestSchema: Schema.Struct<{
566
694
  source: Schema.Literal<["static", "computed"]>;
567
695
  digest: typeof Schema.String;
568
696
  }>>>>;
569
- status: Schema.optional<Schema.Literal<["running", "completed", "failed", "cancelled"]>>;
697
+ status: Schema.optional<Schema.Literal<["running", "passed", "failed", "errored", "cancelled"]>>;
570
698
  }>;
571
699
  export declare const UsageSchema: Schema.Struct<{
572
700
  inputTokens: Schema.optional<typeof Schema.Number>;
573
701
  outputTokens: Schema.optional<typeof Schema.Number>;
702
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
574
703
  totalTokens: Schema.optional<typeof Schema.Number>;
575
704
  }>;
576
705
  export declare const JudgeRunInfoSchema: Schema.Struct<{
@@ -580,14 +709,34 @@ export declare const JudgeRunInfoSchema: Schema.Struct<{
580
709
  name: Schema.optional<typeof Schema.String>;
581
710
  version: Schema.optional<typeof Schema.String>;
582
711
  }>>;
712
+ model: Schema.optional<typeof Schema.String>;
583
713
  usage: Schema.optional<Schema.Struct<{
584
714
  inputTokens: Schema.optional<typeof Schema.Number>;
585
715
  outputTokens: Schema.optional<typeof Schema.Number>;
716
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
586
717
  totalTokens: Schema.optional<typeof Schema.Number>;
587
718
  }>>;
719
+ prompt: Schema.optional<typeof Schema.String>;
720
+ reply: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
721
+ attempts: Schema.optional<typeof Schema.Number>;
588
722
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
589
723
  }>;
590
724
  export declare const ScoreResultSchema: Schema.Struct<{
725
+ passAt: Schema.optional<typeof Schema.Number>;
726
+ choice: Schema.optional<typeof Schema.String>;
727
+ criteria: Schema.optional<Schema.mutable<Schema.Array$<Schema.Union<[Schema.Struct<{
728
+ name: typeof Schema.String;
729
+ value: typeof Schema.Number;
730
+ weight: Schema.optional<typeof Schema.Number>;
731
+ explanation: Schema.optional<typeof Schema.String>;
732
+ evidence: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
733
+ }>, Schema.Struct<{
734
+ name: typeof Schema.String;
735
+ reached: Schema.Literal<[false]>;
736
+ weight: Schema.optional<typeof Schema.Number>;
737
+ explanation: Schema.optional<typeof Schema.String>;
738
+ }>]>>>>;
739
+ attachments: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
591
740
  name: typeof Schema.String;
592
741
  kind: Schema.Literal<["predicate", "judge"]>;
593
742
  value: Schema.optional<typeof Schema.Number>;
@@ -601,11 +750,16 @@ export declare const ScoreResultSchema: Schema.Struct<{
601
750
  name: Schema.optional<typeof Schema.String>;
602
751
  version: Schema.optional<typeof Schema.String>;
603
752
  }>>;
753
+ model: Schema.optional<typeof Schema.String>;
604
754
  usage: Schema.optional<Schema.Struct<{
605
755
  inputTokens: Schema.optional<typeof Schema.Number>;
606
756
  outputTokens: Schema.optional<typeof Schema.Number>;
757
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
607
758
  totalTokens: Schema.optional<typeof Schema.Number>;
608
759
  }>>;
760
+ prompt: Schema.optional<typeof Schema.String>;
761
+ reply: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
762
+ attempts: Schema.optional<typeof Schema.Number>;
609
763
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
610
764
  }>>;
611
765
  durationMs: typeof Schema.Number;
@@ -617,6 +771,21 @@ export declare const ScoreResultSchema: Schema.Struct<{
617
771
  skipped: Schema.optional<Schema.Literal<[true]>>;
618
772
  }>;
619
773
  export declare const CheckpointResultSchema: Schema.Struct<{
774
+ passAt: Schema.optional<typeof Schema.Number>;
775
+ choice: Schema.optional<typeof Schema.String>;
776
+ criteria: Schema.optional<Schema.mutable<Schema.Array$<Schema.Union<[Schema.Struct<{
777
+ name: typeof Schema.String;
778
+ value: typeof Schema.Number;
779
+ weight: Schema.optional<typeof Schema.Number>;
780
+ explanation: Schema.optional<typeof Schema.String>;
781
+ evidence: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
782
+ }>, Schema.Struct<{
783
+ name: typeof Schema.String;
784
+ reached: Schema.Literal<[false]>;
785
+ weight: Schema.optional<typeof Schema.Number>;
786
+ explanation: Schema.optional<typeof Schema.String>;
787
+ }>]>>>>;
788
+ attachments: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
620
789
  step: typeof Schema.Number;
621
790
  kind: Schema.Literal<["predicate", "judge", "expect-tool-call"]>;
622
791
  name: typeof Schema.String;
@@ -632,11 +801,16 @@ export declare const CheckpointResultSchema: Schema.Struct<{
632
801
  name: Schema.optional<typeof Schema.String>;
633
802
  version: Schema.optional<typeof Schema.String>;
634
803
  }>>;
804
+ model: Schema.optional<typeof Schema.String>;
635
805
  usage: Schema.optional<Schema.Struct<{
636
806
  inputTokens: Schema.optional<typeof Schema.Number>;
637
807
  outputTokens: Schema.optional<typeof Schema.Number>;
808
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
638
809
  totalTokens: Schema.optional<typeof Schema.Number>;
639
810
  }>>;
811
+ prompt: Schema.optional<typeof Schema.String>;
812
+ reply: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
813
+ attempts: Schema.optional<typeof Schema.Number>;
640
814
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
641
815
  }>>;
642
816
  durationMs: Schema.optional<typeof Schema.Number>;
@@ -662,8 +836,23 @@ export declare const MetricResultSchema: Schema.Struct<{
662
836
  stack: Schema.optional<typeof Schema.String>;
663
837
  }>>;
664
838
  }>;
665
- export declare const TrialScoringSchema: Schema.Struct<{
839
+ export declare const RunScoringSchema: Schema.Struct<{
666
840
  results: Schema.mutable<Schema.Array$<Schema.Struct<{
841
+ passAt: Schema.optional<typeof Schema.Number>;
842
+ choice: Schema.optional<typeof Schema.String>;
843
+ criteria: Schema.optional<Schema.mutable<Schema.Array$<Schema.Union<[Schema.Struct<{
844
+ name: typeof Schema.String;
845
+ value: typeof Schema.Number;
846
+ weight: Schema.optional<typeof Schema.Number>;
847
+ explanation: Schema.optional<typeof Schema.String>;
848
+ evidence: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
849
+ }>, Schema.Struct<{
850
+ name: typeof Schema.String;
851
+ reached: Schema.Literal<[false]>;
852
+ weight: Schema.optional<typeof Schema.Number>;
853
+ explanation: Schema.optional<typeof Schema.String>;
854
+ }>]>>>>;
855
+ attachments: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
667
856
  name: typeof Schema.String;
668
857
  kind: Schema.Literal<["predicate", "judge"]>;
669
858
  value: Schema.optional<typeof Schema.Number>;
@@ -677,11 +866,16 @@ export declare const TrialScoringSchema: Schema.Struct<{
677
866
  name: Schema.optional<typeof Schema.String>;
678
867
  version: Schema.optional<typeof Schema.String>;
679
868
  }>>;
869
+ model: Schema.optional<typeof Schema.String>;
680
870
  usage: Schema.optional<Schema.Struct<{
681
871
  inputTokens: Schema.optional<typeof Schema.Number>;
682
872
  outputTokens: Schema.optional<typeof Schema.Number>;
873
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
683
874
  totalTokens: Schema.optional<typeof Schema.Number>;
684
875
  }>>;
876
+ prompt: Schema.optional<typeof Schema.String>;
877
+ reply: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
878
+ attempts: Schema.optional<typeof Schema.Number>;
685
879
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
686
880
  }>>;
687
881
  durationMs: typeof Schema.Number;
@@ -705,6 +899,21 @@ export declare const TrialScoringSchema: Schema.Struct<{
705
899
  }>>;
706
900
  }>>>>;
707
901
  checkpoints: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
902
+ passAt: Schema.optional<typeof Schema.Number>;
903
+ choice: Schema.optional<typeof Schema.String>;
904
+ criteria: Schema.optional<Schema.mutable<Schema.Array$<Schema.Union<[Schema.Struct<{
905
+ name: typeof Schema.String;
906
+ value: typeof Schema.Number;
907
+ weight: Schema.optional<typeof Schema.Number>;
908
+ explanation: Schema.optional<typeof Schema.String>;
909
+ evidence: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
910
+ }>, Schema.Struct<{
911
+ name: typeof Schema.String;
912
+ reached: Schema.Literal<[false]>;
913
+ weight: Schema.optional<typeof Schema.Number>;
914
+ explanation: Schema.optional<typeof Schema.String>;
915
+ }>]>>>>;
916
+ attachments: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
708
917
  step: typeof Schema.Number;
709
918
  kind: Schema.Literal<["predicate", "judge", "expect-tool-call"]>;
710
919
  name: typeof Schema.String;
@@ -720,11 +929,16 @@ export declare const TrialScoringSchema: Schema.Struct<{
720
929
  name: Schema.optional<typeof Schema.String>;
721
930
  version: Schema.optional<typeof Schema.String>;
722
931
  }>>;
932
+ model: Schema.optional<typeof Schema.String>;
723
933
  usage: Schema.optional<Schema.Struct<{
724
934
  inputTokens: Schema.optional<typeof Schema.Number>;
725
935
  outputTokens: Schema.optional<typeof Schema.Number>;
936
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
726
937
  totalTokens: Schema.optional<typeof Schema.Number>;
727
938
  }>>;
939
+ prompt: Schema.optional<typeof Schema.String>;
940
+ reply: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
941
+ attempts: Schema.optional<typeof Schema.Number>;
728
942
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
729
943
  }>>;
730
944
  durationMs: Schema.optional<typeof Schema.Number>;
@@ -747,12 +961,32 @@ export declare const ArtifactEntrySchema: Schema.Struct<{
747
961
  kind: Schema.Literal<["file", "directory"]>;
748
962
  size: Schema.optional<typeof Schema.Number>;
749
963
  }>;
750
- export declare const TrialSummarySchema: Schema.Struct<{
751
- status: Schema.Literal<["running", "completed", "failed", "cancelled"]>;
964
+ export declare const AttachmentEntrySchema: Schema.Struct<{
965
+ name: typeof Schema.String;
966
+ size: typeof Schema.Number;
967
+ truncatedFrom: Schema.optional<typeof Schema.Number>;
968
+ }>;
969
+ export declare const RunSummarySchema: Schema.Struct<{
970
+ status: Schema.Literal<["running", "passed", "failed", "errored", "cancelled"]>;
752
971
  endedAt: typeof Schema.String;
753
972
  durationMs: Schema.optional<typeof Schema.Number>;
754
973
  scoring: Schema.optional<Schema.Struct<{
755
974
  results: Schema.mutable<Schema.Array$<Schema.Struct<{
975
+ passAt: Schema.optional<typeof Schema.Number>;
976
+ choice: Schema.optional<typeof Schema.String>;
977
+ criteria: Schema.optional<Schema.mutable<Schema.Array$<Schema.Union<[Schema.Struct<{
978
+ name: typeof Schema.String;
979
+ value: typeof Schema.Number;
980
+ weight: Schema.optional<typeof Schema.Number>;
981
+ explanation: Schema.optional<typeof Schema.String>;
982
+ evidence: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
983
+ }>, Schema.Struct<{
984
+ name: typeof Schema.String;
985
+ reached: Schema.Literal<[false]>;
986
+ weight: Schema.optional<typeof Schema.Number>;
987
+ explanation: Schema.optional<typeof Schema.String>;
988
+ }>]>>>>;
989
+ attachments: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
756
990
  name: typeof Schema.String;
757
991
  kind: Schema.Literal<["predicate", "judge"]>;
758
992
  value: Schema.optional<typeof Schema.Number>;
@@ -766,11 +1000,16 @@ export declare const TrialSummarySchema: Schema.Struct<{
766
1000
  name: Schema.optional<typeof Schema.String>;
767
1001
  version: Schema.optional<typeof Schema.String>;
768
1002
  }>>;
1003
+ model: Schema.optional<typeof Schema.String>;
769
1004
  usage: Schema.optional<Schema.Struct<{
770
1005
  inputTokens: Schema.optional<typeof Schema.Number>;
771
1006
  outputTokens: Schema.optional<typeof Schema.Number>;
1007
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
772
1008
  totalTokens: Schema.optional<typeof Schema.Number>;
773
1009
  }>>;
1010
+ prompt: Schema.optional<typeof Schema.String>;
1011
+ reply: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
1012
+ attempts: Schema.optional<typeof Schema.Number>;
774
1013
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
775
1014
  }>>;
776
1015
  durationMs: typeof Schema.Number;
@@ -794,6 +1033,21 @@ export declare const TrialSummarySchema: Schema.Struct<{
794
1033
  }>>;
795
1034
  }>>>>;
796
1035
  checkpoints: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
1036
+ passAt: Schema.optional<typeof Schema.Number>;
1037
+ choice: Schema.optional<typeof Schema.String>;
1038
+ criteria: Schema.optional<Schema.mutable<Schema.Array$<Schema.Union<[Schema.Struct<{
1039
+ name: typeof Schema.String;
1040
+ value: typeof Schema.Number;
1041
+ weight: Schema.optional<typeof Schema.Number>;
1042
+ explanation: Schema.optional<typeof Schema.String>;
1043
+ evidence: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
1044
+ }>, Schema.Struct<{
1045
+ name: typeof Schema.String;
1046
+ reached: Schema.Literal<[false]>;
1047
+ weight: Schema.optional<typeof Schema.Number>;
1048
+ explanation: Schema.optional<typeof Schema.String>;
1049
+ }>]>>>>;
1050
+ attachments: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
797
1051
  step: typeof Schema.Number;
798
1052
  kind: Schema.Literal<["predicate", "judge", "expect-tool-call"]>;
799
1053
  name: typeof Schema.String;
@@ -809,11 +1063,16 @@ export declare const TrialSummarySchema: Schema.Struct<{
809
1063
  name: Schema.optional<typeof Schema.String>;
810
1064
  version: Schema.optional<typeof Schema.String>;
811
1065
  }>>;
1066
+ model: Schema.optional<typeof Schema.String>;
812
1067
  usage: Schema.optional<Schema.Struct<{
813
1068
  inputTokens: Schema.optional<typeof Schema.Number>;
814
1069
  outputTokens: Schema.optional<typeof Schema.Number>;
1070
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
815
1071
  totalTokens: Schema.optional<typeof Schema.Number>;
816
1072
  }>>;
1073
+ prompt: Schema.optional<typeof Schema.String>;
1074
+ reply: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
1075
+ attempts: Schema.optional<typeof Schema.Number>;
817
1076
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
818
1077
  }>>;
819
1078
  durationMs: Schema.optional<typeof Schema.Number>;
@@ -836,20 +1095,11 @@ export declare const TrialSummarySchema: Schema.Struct<{
836
1095
  kind: Schema.Literal<["file", "directory"]>;
837
1096
  size: Schema.optional<typeof Schema.Number>;
838
1097
  }>>>>;
839
- error: Schema.optional<Schema.Struct<{
1098
+ attachments: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
840
1099
  name: typeof Schema.String;
841
- message: typeof Schema.String;
842
- stack: Schema.optional<typeof Schema.String>;
843
- }>>;
844
- }>;
845
- export declare const RunSummarySchema: Schema.Struct<{
846
- status: Schema.Literal<["running", "completed", "failed", "cancelled"]>;
847
- endedAt: typeof Schema.String;
848
- durationMs: Schema.optional<typeof Schema.Number>;
849
- trialCount: typeof Schema.Number;
850
- passed: typeof Schema.Number;
851
- failed: typeof Schema.Number;
852
- cancelled: Schema.optional<typeof Schema.Number>;
1100
+ size: typeof Schema.Number;
1101
+ truncatedFrom: Schema.optional<typeof Schema.Number>;
1102
+ }>>>>;
853
1103
  error: Schema.optional<Schema.Struct<{
854
1104
  name: typeof Schema.String;
855
1105
  message: typeof Schema.String;
@@ -891,11 +1141,6 @@ export type AgentRuntime = {
891
1141
  configuration?: JsonObject;
892
1142
  };
893
1143
  export type AgentRuntimes = Partial<Record<AgentRuntimeName, AgentRuntime>>;
894
- export type Usage = {
895
- inputTokens?: number;
896
- outputTokens?: number;
897
- totalTokens?: number;
898
- };
899
1144
  export type RecordedError = {
900
1145
  name: string;
901
1146
  message: string;
@@ -931,6 +1176,8 @@ export type AutEvent = {
931
1176
  timestamp: string;
932
1177
  latencyMs?: number;
933
1178
  usage?: Usage;
1179
+ /** The model that answered this turn, when the agent knows it. */
1180
+ model?: string;
934
1181
  } | {
935
1182
  kind: 'completed';
936
1183
  output?: JsonValue;
@@ -941,7 +1188,7 @@ export type AutEvent = {
941
1188
  timestamp: string;
942
1189
  };
943
1190
  export type RunnerEvent = {
944
- kind: 'trial-started';
1191
+ kind: 'run-started';
945
1192
  timestamp: string;
946
1193
  } | {
947
1194
  kind: 'transcript-step-started';
@@ -989,7 +1236,7 @@ export type RunnerEvent = {
989
1236
  error: RecordedError;
990
1237
  timestamp: string;
991
1238
  } | {
992
- kind: 'trial-completed';
1239
+ kind: 'run-completed';
993
1240
  timestamp: string;
994
1241
  } | {
995
1242
  kind: 'error';
@@ -1002,7 +1249,7 @@ export type TrajectoryEvent = (AutEvent & {
1002
1249
  source: 'runner';
1003
1250
  });
1004
1251
  export type WorkspaceView = {
1005
- /** Absolute path to this trial-scoped workspace. Do not persist it in reports. */
1252
+ /** Absolute path to this run-scoped workspace. Do not persist it in reports. */
1006
1253
  root: string;
1007
1254
  };
1008
1255
  export type CandidateWorkspace = WorkspaceView;
@@ -1010,8 +1257,8 @@ export type EvaluatorWorkspace = WorkspaceView;
1010
1257
  export type AutContext = {
1011
1258
  runId: string;
1012
1259
  evalId: string;
1013
- trialId: string;
1014
- trialIndex: number;
1260
+ /** Set when this run is one of several repeats launched together. */
1261
+ batch?: Batch;
1015
1262
  metadata: JsonObject;
1016
1263
  /** Run-time parameters supplied by the eval definition or CLI invocation. */
1017
1264
  parameters?: JsonObject;
@@ -1032,6 +1279,14 @@ export type AutAdapter<TMessage = string> = {
1032
1279
  runtime?: AgentRuntime;
1033
1280
  /** Optional: stream events as they happen. Returning a turn result from `send` is enough for most agents. */
1034
1281
  onEvent: (event: AutEventInput) => void | Promise<void>;
1282
+ /**
1283
+ * Saves a file with the run's results, such as the agent's raw log,
1284
+ * whether or not its sandbox is kept. `name` is a relative path of
1285
+ * letters, digits, `.`, `_` and `-` (`logs/agent.log`); each name once.
1286
+ * A file over the size limit keeps its last bytes; past the run's
1287
+ * total limit it is rejected. See `artifacts.attachments` in the config.
1288
+ */
1289
+ attach: (name: string, content: string | Uint8Array) => Promise<void>;
1035
1290
  }): Promise<AutSession<TMessage>>;
1036
1291
  };
1037
1292
  export type AutSession<TMessage = string> = {
@@ -1058,13 +1313,14 @@ export type UserMessageInput = {
1058
1313
  parameters: JsonObject;
1059
1314
  /** Values of the scenario's candidate datasets, by dataset ID (never evaluator ones). */
1060
1315
  data: JsonObject;
1061
- /** The trial's random seed (also in `context.metadata.randomSeed`). */
1316
+ /** The run's random seed (also in `context.metadata.randomSeed`). */
1062
1317
  seed: number;
1063
- trialIndex: number;
1318
+ /** Set when this run is one of several repeats launched together. */
1319
+ batch?: Batch;
1064
1320
  };
1065
1321
  export type UserStep = {
1066
1322
  kind: 'user';
1067
- /** A fixed message, or one computed for each trial. */
1323
+ /** A fixed message, or one computed for each run. */
1068
1324
  message: string | ((input: UserMessageInput) => string);
1069
1325
  };
1070
1326
  export type AgentStep = {
@@ -1104,14 +1360,28 @@ export type TranscriptStep = UserStep | AgentStep | ScoringRule | ExpectToolCall
1104
1360
  /** Observes a tool call in the preceding turn; never invokes a tool. */
1105
1361
  export declare function expectToolCall(expected: ExpectToolCallStep['expected']): ExpectToolCallStep;
1106
1362
  /**
1107
- * A user message. Pass a function to compute it for each trial, e.g. from a
1363
+ * A user message. Pass a function to compute it for each run, e.g. from a
1108
1364
  * matrix axis: `user(({ parameters }) => `Set up OCaml with ${parameters.toolchain}.`)`.
1109
1365
  */
1110
1366
  export declare function user(message: UserStep['message']): UserStep;
1111
1367
  export declare function agent(expectation: JsonObject): AgentStep;
1368
+ /**
1369
+ * What a judge saw and said. The built-in `judge()` records all of it; a
1370
+ * predicate that calls a model itself can report `model`, `prompt` and
1371
+ * `reply` so the dashboard shows them the same way.
1372
+ */
1112
1373
  export type JudgeRunInfo = {
1113
1374
  agent?: AutIdentity;
1375
+ /** The model the judge reported using (`turn-completed` `model`). */
1376
+ model?: string;
1377
+ /** Tokens the judge used: never counted in the agent's `tokens`. */
1114
1378
  usage?: Usage;
1379
+ /** The exact prompt the judge received. */
1380
+ prompt?: string;
1381
+ /** Its reply, as text or JSON. */
1382
+ reply?: JsonValue;
1383
+ /** 2 when its first reply was not in the format asked for and it was asked again. */
1384
+ attempts?: number;
1115
1385
  /** Judge-agent observations; never attributed to the AUT trajectory. */
1116
1386
  events?: JsonValue[];
1117
1387
  };
@@ -1120,18 +1390,27 @@ export type SkippedScore = {
1120
1390
  skipped: true;
1121
1391
  reason: string;
1122
1392
  };
1123
- export type ScoreValue = number | SkippedScore | {
1124
- value: number;
1393
+ export type ScoreValue<Evidence = unknown> = number | SkippedScore | {
1394
+ /** From 0 to 1. Without it, the weighted mean of `criteria`. */
1395
+ value?: number;
1125
1396
  passed?: boolean;
1126
1397
  explanation?: string;
1127
- /** Any JSON-convertible value. */
1128
- evidence?: unknown;
1129
- /** Judge-agent evidence, never inferred from AUT usage. */
1398
+ /**
1399
+ * Any JSON-convertible value: what the scorer observed. A checkpoint's
1400
+ * evidence reaches later scorers through `checkpoint(rule)`.
1401
+ */
1402
+ evidence?: Evidence;
1403
+ /**
1404
+ * Per-criterion results, each shown on its own; see `CriterionResult`.
1405
+ * Return `{ name, reached: false }` for a check that never ran.
1406
+ */
1407
+ criteria?: CriterionInput[];
1408
+ /** What a model-backed scorer saw and said; never counted as AUT usage. */
1130
1409
  judge?: JudgeRunInfo;
1131
1410
  };
1132
1411
  /**
1133
- * Marks a scorer as not applicable to this trial. A skipped result neither
1134
- * passes nor fails the trial and is left out of score averages.
1412
+ * Marks a scorer as not applicable to this run. A skipped result neither
1413
+ * passes nor fails the run and is left out of score averages.
1135
1414
  */
1136
1415
  export declare function skip(reason: string): SkippedScore;
1137
1416
  export type ScoreResult = {
@@ -1139,8 +1418,15 @@ export type ScoreResult = {
1139
1418
  kind: 'predicate' | 'judge';
1140
1419
  value?: number;
1141
1420
  passed?: boolean;
1421
+ /** The pass mark the value was held to (1 unless the rule set `passAt`). */
1422
+ passAt?: number;
1142
1423
  explanation?: string;
1143
1424
  evidence?: JsonValue;
1425
+ /** A `choices` judge's answer, such as `B`. */
1426
+ choice?: string;
1427
+ criteria?: CriterionResult[];
1428
+ /** Files its scorer saved with `attach()`, by name. */
1429
+ attachments?: string[];
1144
1430
  judge?: JudgeRunInfo;
1145
1431
  durationMs: number;
1146
1432
  error?: RecordedError;
@@ -1169,26 +1455,88 @@ export type ScoringContext = {
1169
1455
  * example, in a container that is gone by final scoring).
1170
1456
  */
1171
1457
  checkpoints: readonly CheckpointResult[];
1458
+ /**
1459
+ * The latest result of a checkpoint in this scenario's transcript, looked
1460
+ * up by the rule itself, so renaming it cannot break the lookup. A
1461
+ * predicate's `evidence` keeps its type. Undefined until that step has
1462
+ * run; throws for a rule that is not in the transcript.
1463
+ */
1464
+ checkpoint<Evidence>(rule: PredicateScorer<Evidence>): CheckpointOutcome<Evidence> | undefined;
1465
+ checkpoint(rule: JudgeRule | ExpectToolCallStep): CheckpointOutcome<JsonValue> | undefined;
1466
+ /**
1467
+ * Saves a file with the run's results, like the agent's `attach()`: for
1468
+ * example a container's log, or a file the agent reported, read before the
1469
+ * workspace is gone. Same names, limits and rules.
1470
+ */
1471
+ attach(name: string, content: string | Uint8Array): Promise<void>;
1172
1472
  };
1173
- export type PredicateScorer = {
1473
+ /**
1474
+ * A checkpoint's result with typed evidence. Evidence is saved as JSON, so
1475
+ * it arrives as its JSON form: a `Date` becomes a string, `undefined` fields
1476
+ * are dropped.
1477
+ */
1478
+ export type CheckpointOutcome<Evidence> = Omit<CheckpointResult, 'evidence'> & {
1479
+ evidence?: Evidence;
1480
+ };
1481
+ export type PredicateScorer<Evidence = unknown> = {
1174
1482
  kind: 'predicate';
1175
1483
  name: string;
1484
+ /** What it checks, in a sentence, shown wherever the scorer is. */
1485
+ description?: string;
1176
1486
  supportsPartial?: boolean;
1177
1487
  /** A numeric result passes when it is at least this value. Default: only 1 passes. */
1178
1488
  passAt?: number;
1179
- run(context: ScoringContext): boolean | ScoreValue | Promise<boolean | ScoreValue>;
1489
+ /**
1490
+ * The checks it reports, declared up front so they show before a run.
1491
+ * A declared criterion it leaves out is recorded as not reached; one it
1492
+ * did not declare is an error.
1493
+ */
1494
+ criteria?: JudgeCriterion[];
1495
+ run(context: ScoringContext): boolean | ScoreValue<Evidence> | Promise<boolean | ScoreValue<Evidence>>;
1180
1496
  };
1497
+ /** What a judge sees: one named input, read from the run. */
1498
+ export type JudgeInput = (scoring: ScoringContext) => JsonValue | undefined | Promise<JsonValue | undefined>;
1499
+ /**
1500
+ * A rubric-graded scorer. EvalKit builds the prompt from the rubric, the
1501
+ * inputs and the answer format, runs the judge agent, checks its answer
1502
+ * (asking once more if it is not in the format asked for), and records
1503
+ * what it saw and said.
1504
+ */
1181
1505
  export type JudgeRule = {
1182
1506
  kind: 'judge';
1183
1507
  name: string;
1184
1508
  rubric: string;
1509
+ /** What it checks, in a sentence, shown wherever the judge is. */
1510
+ description?: string;
1511
+ /**
1512
+ * The agent that judges, made with `defineAgent()`. Default: `judge` in
1513
+ * evalkit.config.ts. It gets the run's parameters, so a matrix axis can
1514
+ * choose its model.
1515
+ */
1516
+ agent?: AutAdapter;
1517
+ /**
1518
+ * What the judge sees, by name. Default: `conversation` (this turn at a
1519
+ * checkpoint, the whole run in final scoring) and `reply` (the last reply).
1520
+ */
1521
+ inputs?: Readonly<Record<string, JudgeInput>>;
1522
+ /** How it answers. Default `verdict`: a value from 0 to 1 and a reason. */
1523
+ answer: JudgeAnswer;
1524
+ /** A value passes when it is at least this. Default: only 1 passes. */
1525
+ passAt?: number;
1185
1526
  /** Run even when the scenario stopped early or execution failed. */
1186
1527
  supportsPartial?: boolean;
1187
1528
  };
1188
1529
  export type ScoringRule = PredicateScorer | JudgeRule;
1189
- export declare function predicate(name: string, run: PredicateScorer['run'], options?: Pick<PredicateScorer, 'supportsPartial' | 'passAt'>): PredicateScorer;
1530
+ /** A scorer in code. Its `evidence` type carries through to `checkpoint(rule)`. */
1531
+ export declare function predicate<Evidence = unknown>(name: string, run: PredicateScorer<Evidence>['run'], options?: Pick<PredicateScorer, 'supportsPartial' | 'passAt' | 'description'> & {
1532
+ /** The checks it reports by name: `{ 'cannot push': 'the share token gets 403' }` or `{ name: { weight, description } }`. */
1533
+ criteria?: Record<string, string | number | {
1534
+ weight?: number;
1535
+ description?: string;
1536
+ }>;
1537
+ }): PredicateScorer<Evidence>;
1190
1538
  /**
1191
- * A number measured for every trial, such as tokens, retries or web searches.
1539
+ * A number measured for every run, such as tokens, retries or web searches.
1192
1540
  * Metrics never decide pass or fail; they are averaged per run and shown on
1193
1541
  * the scoreboard. Return undefined when there is nothing to measure.
1194
1542
  */
@@ -1201,10 +1549,11 @@ export type Metric = {
1201
1549
  better?: 'lower' | 'higher';
1202
1550
  run(context: ScoringContext): number | undefined | Promise<number | undefined>;
1203
1551
  };
1204
- export declare function metric(name: string, run: Metric['run'], options?: Pick<Metric, 'unit' | 'better'>): Metric;
1205
- /** A metric's value for one trial. */
1552
+ /** A built-in metric's name is a type error here, as well as at definition time. */
1553
+ export declare function metric<const Name extends string>(name: Name extends BuiltInMetricName ? never : Name, run: Metric['run'], options?: Pick<Metric, 'unit' | 'better'>): Metric;
1554
+ /** A metric's value for one run. */
1206
1555
  export type MetricResult = {
1207
- name: string;
1556
+ name: MetricName;
1208
1557
  /** Absent when the metric measured nothing or failed. */
1209
1558
  value?: number;
1210
1559
  unit?: string;
@@ -1213,27 +1562,30 @@ export type MetricResult = {
1213
1562
  builtIn?: true;
1214
1563
  error?: RecordedError;
1215
1564
  };
1216
- export declare function judge(name: string, options: Pick<JudgeRule, 'rubric' | 'supportsPartial'>): JudgeRule;
1565
+ export declare function judge(name: string, options: Omit<JudgeRule, 'kind' | 'name' | 'answer'> & {
1566
+ answer?: JudgeAnswer;
1567
+ }): JudgeRule;
1217
1568
  export type EvalPolicy = {
1218
1569
  timeoutMs?: number;
1219
1570
  /** Stop later transcript steps after a failed checkpoint assertion. Default false. */
1220
1571
  failfast?: boolean;
1221
- /** Number of independent trials requested by local and hosted runners. */
1222
- trials?: number;
1223
1572
  };
1224
1573
  export type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
1225
1574
  id: string;
1226
1575
  name?: string;
1227
1576
  agent: TAgent;
1228
- /** Separate judge agent; its model and tools are never inherited from the AUT. */
1229
- judge?: AutAdapter;
1230
- /** Data and files the scenario uses; each trial gets its own copy. */
1577
+ /** Data and files the scenario uses; each run gets its own copy. */
1231
1578
  datasets?: readonly Dataset[];
1232
1579
  transcript: TranscriptStep[];
1233
1580
  scoring: ScoringRule[];
1234
- /** Numbers to measure for every trial; they never affect pass or fail. */
1581
+ /** Numbers to measure for every run; they never affect pass or fail. */
1235
1582
  metrics?: readonly Metric[];
1236
1583
  policy?: EvalPolicy;
1584
+ /**
1585
+ * How many runs to start each time the scenario runs, as one batch: repeats
1586
+ * under identical conditions, to see how often it passes. Default 1.
1587
+ */
1588
+ repeat?: number;
1237
1589
  /** Any JSON-convertible object; converted when the eval is defined. */
1238
1590
  metadata?: Record<string, unknown>;
1239
1591
  workspace?: EvalWorkspace;
@@ -1241,7 +1593,7 @@ export type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
1241
1593
  /** How EvalKit treats this scenario's candidate workspace. */
1242
1594
  export type EvalWorkspace = {
1243
1595
  /**
1244
- * Paths to leave out of the trial's snapshot, read like `.gitignore`: globs
1596
+ * Paths to leave out of the run's snapshot, read like `.gitignore`: globs
1245
1597
  * relative to the workspace, where a pattern without `/` matches that name
1246
1598
  * at any depth and later patterns win. They come after the project's
1247
1599
  * `artifacts.exclude` (default `DEFAULT_ARTIFACT_EXCLUDE`), so `!pattern`
@@ -1251,6 +1603,10 @@ export type EvalWorkspace = {
1251
1603
  ignore?: readonly string[];
1252
1604
  };
1253
1605
  export declare function defineEval<const T extends EvalDefinition>(definition: T): T;
1606
+ /** A judge never grades with the agent it is judging. */
1607
+ export declare function assertJudgesIndependent(definition: Pick<EvalDefinition, 'agent' | 'transcript' | 'scoring'> & {
1608
+ id: string;
1609
+ }, defaultJudge?: AutAdapter): void;
1254
1610
  export type EvalSuite<TEvals extends readonly EvalDefinition[] = readonly EvalDefinition[]> = {
1255
1611
  id: string;
1256
1612
  name?: string;
@@ -1288,7 +1644,18 @@ export type EvalSuiteMetadata = {
1288
1644
  * path-like grouping of evals; nesting is presentation derived from its ID.
1289
1645
  */
1290
1646
  export declare function registerEvals<const TRegistrations extends readonly EvalRegistration[]>(registrations: TRegistrations): EvalRegistry;
1291
- export type RunStatus = 'running' | 'completed' | 'failed' | 'cancelled';
1647
+ /**
1648
+ * How a run ended: `passed` or `failed` by its scores, `errored` when it could
1649
+ * not finish (the agent, a dataset or EvalKit failed), `cancelled` by Ctrl+C.
1650
+ */
1651
+ export type RunStatus = 'running' | 'passed' | 'failed' | 'errored' | 'cancelled';
1652
+ /** Runs launched together as repeats of one configuration (`repeat`). */
1653
+ export type Batch = {
1654
+ id: string;
1655
+ /** Zero-based position in the batch. */
1656
+ index: number;
1657
+ size: number;
1658
+ };
1292
1659
  /**
1293
1660
  * Where a run's eval code came from: the repository, eval project and commit.
1294
1661
  * Results are tagged with it; they are never stored in the repository itself.
@@ -1323,7 +1690,7 @@ export type RunProcess = {
1323
1690
  hostname: string;
1324
1691
  };
1325
1692
  export type RunMetadata = {
1326
- schemaVersion: 2 | 3 | 4 | 5;
1693
+ schemaVersion: 6;
1327
1694
  runId: string;
1328
1695
  runUri: ResourceUri<'run'>;
1329
1696
  evalId: string;
@@ -1335,36 +1702,21 @@ export type RunMetadata = {
1335
1702
  };
1336
1703
  aut?: AutIdentity;
1337
1704
  startedAt: string;
1338
- /** Present from schema version 4 when the run's commit could be determined. */
1705
+ /** Present when the run's commit could be determined. */
1339
1706
  source?: RunSource;
1340
- /** From schema version 5. */
1341
1707
  process?: RunProcess;
1342
- };
1343
- export type TrialMetadata = {
1344
- schemaVersion: 2 | 3 | 4 | 5;
1345
- runId: string;
1346
- runUri: ResourceUri<'run'>;
1347
- trialId: string;
1348
- trialUri: ResourceUri<'trial'>;
1349
- trialIndex: number;
1350
- evalId: string;
1351
- parameters?: JsonObject;
1352
- matrix?: {
1353
- id: string;
1354
- cellKey: string;
1355
- };
1356
- aut?: AutIdentity;
1357
- startedAt: string;
1708
+ /** Set when this run is one of several repeats launched together. */
1709
+ batch?: Batch;
1358
1710
  /** The effective snapshot ignore patterns: the project's `artifacts.exclude`, then the scenario's `workspace.ignore`. */
1359
1711
  workspaceIgnore?: string[];
1360
- /** From schema version 5: the datasets this trial used, with content digests. */
1361
- datasets?: TrialDataset[];
1712
+ /** The datasets this run used, with content digests. */
1713
+ datasets?: RunDataset[];
1362
1714
  };
1363
- export type TrialDataset = {
1715
+ export type RunDataset = {
1364
1716
  id: string;
1365
1717
  visibility: DatasetVisibility;
1366
1718
  source: 'static' | 'computed';
1367
- /** SHA-256 of the trial's content: file paths and bytes, and the canonical value. */
1719
+ /** SHA-256 of the run's content: file paths and bytes, and the canonical value. */
1368
1720
  digest: string;
1369
1721
  };
1370
1722
  export type CheckpointResult = {
@@ -1374,8 +1726,13 @@ export type CheckpointResult = {
1374
1726
  status: 'passed' | 'failed' | 'error' | 'skipped';
1375
1727
  value?: number;
1376
1728
  passed?: boolean;
1729
+ passAt?: number;
1377
1730
  explanation?: string;
1378
1731
  evidence?: JsonValue;
1732
+ choice?: string;
1733
+ criteria?: CriterionResult[];
1734
+ /** Files its scorer saved with `attach()`, by name. */
1735
+ attachments?: string[];
1379
1736
  judge?: JudgeRunInfo;
1380
1737
  durationMs?: number;
1381
1738
  error?: RecordedError;
@@ -1384,9 +1741,21 @@ export type CheckpointResult = {
1384
1741
  id: string;
1385
1742
  };
1386
1743
  };
1387
- /** Metrics EvalKit records for every trial; scenario metrics may not reuse these names. */
1388
- export declare const BUILT_IN_METRICS: readonly string[];
1389
- export type TrialScoring = {
1744
+ /**
1745
+ * Metrics EvalKit records for every run; scenario metrics may not reuse
1746
+ * these names.
1747
+ *
1748
+ * - `agent time` (ms): from the run's first event to its last one before
1749
+ * final scoring.
1750
+ * - `tokens`: the sum of `turnTokens(usage)` over the turns that reported
1751
+ * usage, cached input included. Absent when no turn reported any.
1752
+ * - `tool calls`: the agent's `tool-call` events.
1753
+ */
1754
+ export declare const BUILT_IN_METRICS: readonly ['agent time', 'tokens', 'tool calls', 'judge tokens'];
1755
+ export type BuiltInMetricName = (typeof BUILT_IN_METRICS)[number];
1756
+ /** A built-in metric's name (suggested by editors), or a scenario's own. */
1757
+ export type MetricName = BuiltInMetricName | (string & {});
1758
+ export type RunScoring = {
1390
1759
  results: ScoreResult[];
1391
1760
  metrics?: MetricResult[];
1392
1761
  checkpoints?: CheckpointResult[];
@@ -1395,40 +1764,34 @@ export type TrialScoring = {
1395
1764
  passed: boolean;
1396
1765
  };
1397
1766
  export type ArtifactEntry = {
1398
- /** Path relative to this trial's artifact root. */
1767
+ /** Path relative to this run's artifact root. */
1399
1768
  path: string;
1400
1769
  kind: 'file' | 'directory';
1401
1770
  size?: number;
1402
1771
  };
1403
- export type TrialSummary = {
1404
- status: RunStatus;
1405
- endedAt: string;
1406
- durationMs?: number;
1407
- scoring?: TrialScoring;
1408
- artifacts?: ArtifactEntry[];
1409
- error?: RecordedError;
1772
+ /** A file an adapter attached with `attach()`, saved as `artifacts/attachments/<name>`. */
1773
+ export type AttachmentEntry = {
1774
+ name: string;
1775
+ /** Bytes saved. */
1776
+ size: number;
1777
+ /** The original size, when the file was cut to its last `maxFileBytes`. */
1778
+ truncatedFrom?: number;
1410
1779
  };
1411
1780
  export type RunSummary = {
1412
1781
  status: RunStatus;
1413
1782
  endedAt: string;
1414
1783
  durationMs?: number;
1415
- trialCount: number;
1416
- passed: number;
1417
- failed: number;
1418
- /** Trials stopped by cancellation; counted neither as passed nor failed. */
1419
- cancelled?: number;
1784
+ scoring?: RunScoring;
1785
+ artifacts?: ArtifactEntry[];
1786
+ attachments?: AttachmentEntry[];
1420
1787
  error?: RecordedError;
1421
1788
  };
1422
- export type TrialWriter = {
1423
- appendEvent(event: TrajectoryEvent): Promise<void>;
1424
- writeScores(scoring: TrialScoring): Promise<void>;
1425
- /** Writes a file below this trial's artifact root. */
1426
- writeArtifact(path: string, data: Uint8Array): Promise<void>;
1427
- finalize(summary: TrialSummary): Promise<void>;
1428
- };
1429
1789
  export type RunWriter = {
1430
1790
  readonly location: string;
1431
- startTrial(metadata: TrialMetadata): Promise<TrialWriter>;
1791
+ appendEvent(event: TrajectoryEvent): Promise<void>;
1792
+ writeScores(scoring: RunScoring): Promise<void>;
1793
+ /** Writes a file below this run's artifact root. */
1794
+ writeArtifact(path: string, data: Uint8Array): Promise<void>;
1432
1795
  finalize(summary: RunSummary): Promise<void>;
1433
1796
  };
1434
1797
  export type ReportStore = {
@@ -1436,35 +1799,18 @@ export type ReportStore = {
1436
1799
  catalog?: RunCatalog;
1437
1800
  }): Promise<RunWriter>;
1438
1801
  };
1439
- export type TrialResult = {
1802
+ /** One finished run, as `runEval` returns it. */
1803
+ export type RunResult = {
1440
1804
  runId: string;
1441
1805
  runUri: ResourceUri<'run'>;
1442
- trialId: string;
1443
- trialUri: ResourceUri<'trial'>;
1444
- trialIndex: number;
1445
1806
  evalId: string;
1446
1807
  status: RunStatus;
1808
+ batch?: Batch;
1447
1809
  reportLocation: string;
1448
1810
  durationMs?: number;
1449
- scoring?: TrialScoring;
1811
+ scoring?: RunScoring;
1450
1812
  error?: RecordedError;
1451
1813
  };
1452
- export type AggregateScoring = {
1453
- passed: number;
1454
- failed: number;
1455
- cancelled?: number;
1456
- passRate: number;
1457
- overall?: number;
1458
- };
1459
- export type RunResult = TrialResult & {
1460
- runId: string;
1461
- trialCount?: number;
1462
- passed?: number;
1463
- failed?: number;
1464
- aggregateScoring?: AggregateScoring;
1465
- /** Present for an aggregate multi-trial run. */
1466
- trials?: TrialResult[];
1467
- };
1468
1814
  export declare function recordError(error: unknown): RecordedError;
1469
1815
  //#endregion
1470
1816
  //#region ../agents/src/index.d.ts
@@ -1476,5 +1822,5 @@ type PiAutOptions = {
1476
1822
  /** A local, one-prompt-per-turn AUT backed by Pi's non-interactive print mode. */
1477
1823
  export declare function piAgent(options?: PiAutOptions): AutAdapter;
1478
1824
  //#endregion
1479
- export type { DefinitionSite, EvalMatrix, EvalMatrixCell, EvalkitConfig, KeepSandboxes, MatrixSelection, ShareConfig, ShareHeaders };
1825
+ export type { AttachmentLimits, CriteriaOptions, CriterionInput, CriterionResult, DefinitionSite, EvalMatrix, EvalMatrixCell, EvalkitConfig, JudgeAnswer, JudgeChoice, JudgeCriterion, KeepSandboxes, MatrixSelection, ReachedCriterion, ShareConfig, ShareHeaders, UnreachedCriterion, Usage };
1480
1826
  //# sourceMappingURL=index.d.mts.map