@leostera/evalkit 0.8.0 → 0.9.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 +46 -2
  2. package/README.md +2 -2
  3. package/dist/cli.mjs +386 -365
  4. package/dist/dashboard/assets/index-By1SJ1on.js +66 -0
  5. package/dist/dashboard/assets/index-geXMXCx9.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-BbVblaHz.mjs} +333 -51
  9. package/dist/index.d.mts +220 -178
  10. package/dist/index.d.mts.map +1 -1
  11. package/dist/index.mjs +2 -2
  12. package/dist/runner.d.mts +226 -168
  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 +3 -3
  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 +5 -3
  26. package/dist/skills/evalkit-matrices/SKILL.md +2 -2
  27. package/dist/skills/evalkit-results/SKILL.md +6 -6
  28. package/dist/{src-CZnDXP1K.mjs → src-Bn6fnZnF.mjs} +8 -3
  29. package/dist/{src-LeGSyDD2.mjs → src-BrfIXfO2.mjs} +72 -54
  30. package/dist/{src-mm8L_IxM.mjs → src-CcdLZqFk.mjs} +422 -230
  31. package/dist/upgrade-60SIRius.mjs +110 -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;
@@ -242,7 +242,7 @@ export type EvalCatalogScorer = {
242
242
  definedAt?: string;
243
243
  };
244
244
  export type EvalCatalogStep =
245
- /** `message` is absent when it is computed for each trial. */
245
+ /** `message` is absent when it is computed for each run. */
246
246
  {
247
247
  kind: 'user';
248
248
  message?: string;
@@ -268,9 +268,9 @@ export type EvalCatalogEntry = {
268
268
  /** The separate agent that runs judge rules, if any. */
269
269
  judgeAgent?: EvalCatalogAgent;
270
270
  datasets: EvalCatalogDataset[];
271
- trialCount: number;
271
+ /** Runs started each time the scenario runs (`repeat`). */
272
+ repeat: number;
272
273
  policy: {
273
- trials: number;
274
274
  timeoutMs?: number;
275
275
  failfast?: boolean;
276
276
  };
@@ -339,11 +339,11 @@ type EvalkitConfig = {
339
339
  };
340
340
  execution?: {
341
341
  concurrency?: number;
342
- trials?: number;
342
+ repeat?: number;
343
343
  maxCells?: number;
344
344
  };
345
345
  reportDir?: string;
346
- /** The candidate files saved with each trial's results. */
346
+ /** The candidate files saved with each run's results. */
347
347
  artifacts?: {
348
348
  /**
349
349
  * Paths to leave out, as globs relative to the candidate workspace; a
@@ -352,14 +352,23 @@ type EvalkitConfig = {
352
352
  * A scenario's `workspace.ignore` patterns come after these.
353
353
  */
354
354
  exclude?: readonly string[];
355
+ /** Limits for files adapters `attach()`. */
356
+ attachments?: AttachmentLimits;
355
357
  };
356
- /** Where each trial's real workspace lives during a run. Default `_evalkit-sandbox`. */
358
+ /** Where each run's real workspace lives during a run. Default `_evalkit-sandbox`. */
357
359
  sandboxDir?: string;
358
- /** Which trial workspaces to keep in `sandboxDir` afterwards. Default `'failed'`: only trials that did not pass. */
360
+ /** Which run workspaces to keep in `sandboxDir` afterwards. Default `'failed'`: only runs that did not pass. */
359
361
  keepSandboxes?: KeepSandboxes;
360
362
  share?: ShareConfig;
361
363
  };
362
364
  type KeepSandboxes = 'failed' | 'all' | 'none';
365
+ type AttachmentLimits = {
366
+ /** A larger attachment keeps its last this-many bytes. Default 5 MB. */
367
+ maxFileBytes?: number;
368
+ /** All of one run's attachments; past it, `attach()` rejects. Default 20 MB. */
369
+ maxRunBytes?: number;
370
+ };
371
+ export declare const DEFAULT_ATTACHMENT_LIMITS: Required<AttachmentLimits>;
363
372
  /** Left out of candidate snapshots unless `artifacts.exclude` says otherwise. */
364
373
  export declare const DEFAULT_ARTIFACT_EXCLUDE: readonly string[];
365
374
  /** HTTP header names and values. */
@@ -377,6 +386,32 @@ type ShareConfig = {
377
386
  /** Pure, typed project configuration. Loading/discovery belongs to the CLI. */
378
387
  export declare function defineConfig<const T extends EvalkitConfig>(configuration: T): T;
379
388
  //#endregion
389
+ //#region ../core/src/usage.d.ts
390
+ /**
391
+ * Token usage an agent reports for one turn. EvalKit never measures or infers
392
+ * it; adapters copy it from their provider.
393
+ */
394
+ type Usage = {
395
+ /**
396
+ * Every input token the model read this turn: the prompt, history and tool
397
+ * results, **including** tokens read from or written to a prompt cache.
398
+ * (Some providers report cached tokens separately; add them in.)
399
+ */
400
+ inputTokens?: number;
401
+ /** Every token the model produced, including reasoning tokens. */
402
+ outputTokens?: number;
403
+ /** Of `inputTokens`, how many were read from a prompt cache. Informational. */
404
+ cachedInputTokens?: number;
405
+ /** The provider's own total; used only when input and output are not reported. */
406
+ totalTokens?: number;
407
+ };
408
+ /**
409
+ * The tokens a turn counts toward the `tokens` metric: `inputTokens +
410
+ * outputTokens` (cached input included), or `totalTokens` when neither is
411
+ * reported. Undefined when the turn reported no usage.
412
+ */
413
+ export declare function turnTokens(usage: Usage | undefined): number | undefined;
414
+ //#endregion
380
415
  //#region ../core/src/json.d.ts
381
416
  /** A value that cannot be stored in a report, with the path of the offending part. */
382
417
  export declare class NotJsonError extends Error {
@@ -413,7 +448,9 @@ export declare function definitionSite(value: unknown): DefinitionSite | undefin
413
448
  //#endregion
414
449
  //#region ../core/src/schema.d.ts
415
450
  /** Runtime schemas for serialized EvalKit report and API boundaries. */
416
- export declare const RunStatusSchema: Schema.Literal<["running", "completed", "failed", "cancelled"]>;
451
+ export declare const RunStatusSchema: Schema.Literal<["running", "passed", "failed", "errored", "cancelled"]>;
452
+ /** The report schema version this EvalKit writes and reads. */
453
+ export declare const REPORT_SCHEMA_VERSION = 6;
417
454
  export declare const RecordedErrorSchema: Schema.Struct<{
418
455
  name: typeof Schema.String;
419
456
  message: typeof Schema.String;
@@ -440,8 +477,19 @@ export declare const RunSourceSchema: Schema.Struct<{
440
477
  url: Schema.optional<typeof Schema.String>;
441
478
  }>>;
442
479
  }>;
480
+ export declare const BatchSchema: Schema.Struct<{
481
+ id: typeof Schema.String;
482
+ index: typeof Schema.Number;
483
+ size: typeof Schema.Number;
484
+ }>;
485
+ export declare const RunDatasetSchema: Schema.Struct<{
486
+ id: typeof Schema.String;
487
+ visibility: Schema.Literal<["candidate", "evaluator"]>;
488
+ source: Schema.Literal<["static", "computed"]>;
489
+ digest: typeof Schema.String;
490
+ }>;
443
491
  export declare const RunMetadataSchema: Schema.Struct<{
444
- schemaVersion: Schema.Literal<[2, 3, 4, 5]>;
492
+ schemaVersion: Schema.Literal<[6]>;
445
493
  runUri: Schema.filter<typeof Schema.String>;
446
494
  evalId: typeof Schema.String;
447
495
  suiteId: Schema.optional<typeof Schema.String>;
@@ -475,25 +523,11 @@ export declare const RunMetadataSchema: Schema.Struct<{
475
523
  pid: typeof Schema.Number;
476
524
  hostname: typeof Schema.String;
477
525
  }>>;
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<{
526
+ batch: Schema.optional<Schema.Struct<{
487
527
  id: typeof Schema.String;
488
- cellKey: typeof Schema.String;
528
+ index: typeof Schema.Number;
529
+ size: typeof Schema.Number;
489
530
  }>>;
490
- aut: Schema.optional<Schema.Struct<{
491
- name: Schema.optional<typeof Schema.String>;
492
- kind: typeof Schema.String;
493
- id: typeof Schema.String;
494
- version: Schema.optional<typeof Schema.String>;
495
- }>>;
496
- startedAt: typeof Schema.String;
497
531
  /** The effective snapshot ignore patterns: the project's, then the scenario's. */
498
532
  workspaceIgnore: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
499
533
  datasets: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
@@ -503,9 +537,9 @@ export declare const TrialMetadataSchema: Schema.Struct<{
503
537
  digest: typeof Schema.String;
504
538
  }>>>>;
505
539
  }>;
506
- /** On-disk manifests include a lifecycle status; older finalized manifests may still say running. */
540
+ /** On-disk manifests include a lifecycle status. */
507
541
  export declare const RunManifestSchema: Schema.Struct<{
508
- schemaVersion: Schema.Literal<[2, 3, 4, 5]>;
542
+ schemaVersion: Schema.Literal<[6]>;
509
543
  runUri: Schema.filter<typeof Schema.String>;
510
544
  evalId: typeof Schema.String;
511
545
  suiteId: Schema.optional<typeof Schema.String>;
@@ -539,26 +573,11 @@ export declare const RunManifestSchema: Schema.Struct<{
539
573
  pid: typeof Schema.Number;
540
574
  hostname: typeof Schema.String;
541
575
  }>>;
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<{
552
- 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;
576
+ batch: Schema.optional<Schema.Struct<{
558
577
  id: typeof Schema.String;
559
- version: Schema.optional<typeof Schema.String>;
578
+ index: typeof Schema.Number;
579
+ size: typeof Schema.Number;
560
580
  }>>;
561
- startedAt: typeof Schema.String;
562
581
  workspaceIgnore: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
563
582
  datasets: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
564
583
  id: typeof Schema.String;
@@ -566,11 +585,12 @@ export declare const TrialManifestSchema: Schema.Struct<{
566
585
  source: Schema.Literal<["static", "computed"]>;
567
586
  digest: typeof Schema.String;
568
587
  }>>>>;
569
- status: Schema.optional<Schema.Literal<["running", "completed", "failed", "cancelled"]>>;
588
+ status: Schema.optional<Schema.Literal<["running", "passed", "failed", "errored", "cancelled"]>>;
570
589
  }>;
571
590
  export declare const UsageSchema: Schema.Struct<{
572
591
  inputTokens: Schema.optional<typeof Schema.Number>;
573
592
  outputTokens: Schema.optional<typeof Schema.Number>;
593
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
574
594
  totalTokens: Schema.optional<typeof Schema.Number>;
575
595
  }>;
576
596
  export declare const JudgeRunInfoSchema: Schema.Struct<{
@@ -583,6 +603,7 @@ export declare const JudgeRunInfoSchema: Schema.Struct<{
583
603
  usage: Schema.optional<Schema.Struct<{
584
604
  inputTokens: Schema.optional<typeof Schema.Number>;
585
605
  outputTokens: Schema.optional<typeof Schema.Number>;
606
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
586
607
  totalTokens: Schema.optional<typeof Schema.Number>;
587
608
  }>>;
588
609
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
@@ -604,6 +625,7 @@ export declare const ScoreResultSchema: Schema.Struct<{
604
625
  usage: Schema.optional<Schema.Struct<{
605
626
  inputTokens: Schema.optional<typeof Schema.Number>;
606
627
  outputTokens: Schema.optional<typeof Schema.Number>;
628
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
607
629
  totalTokens: Schema.optional<typeof Schema.Number>;
608
630
  }>>;
609
631
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
@@ -635,6 +657,7 @@ export declare const CheckpointResultSchema: Schema.Struct<{
635
657
  usage: Schema.optional<Schema.Struct<{
636
658
  inputTokens: Schema.optional<typeof Schema.Number>;
637
659
  outputTokens: Schema.optional<typeof Schema.Number>;
660
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
638
661
  totalTokens: Schema.optional<typeof Schema.Number>;
639
662
  }>>;
640
663
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
@@ -662,7 +685,7 @@ export declare const MetricResultSchema: Schema.Struct<{
662
685
  stack: Schema.optional<typeof Schema.String>;
663
686
  }>>;
664
687
  }>;
665
- export declare const TrialScoringSchema: Schema.Struct<{
688
+ export declare const RunScoringSchema: Schema.Struct<{
666
689
  results: Schema.mutable<Schema.Array$<Schema.Struct<{
667
690
  name: typeof Schema.String;
668
691
  kind: Schema.Literal<["predicate", "judge"]>;
@@ -680,6 +703,7 @@ export declare const TrialScoringSchema: Schema.Struct<{
680
703
  usage: Schema.optional<Schema.Struct<{
681
704
  inputTokens: Schema.optional<typeof Schema.Number>;
682
705
  outputTokens: Schema.optional<typeof Schema.Number>;
706
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
683
707
  totalTokens: Schema.optional<typeof Schema.Number>;
684
708
  }>>;
685
709
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
@@ -723,6 +747,7 @@ export declare const TrialScoringSchema: Schema.Struct<{
723
747
  usage: Schema.optional<Schema.Struct<{
724
748
  inputTokens: Schema.optional<typeof Schema.Number>;
725
749
  outputTokens: Schema.optional<typeof Schema.Number>;
750
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
726
751
  totalTokens: Schema.optional<typeof Schema.Number>;
727
752
  }>>;
728
753
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
@@ -747,8 +772,13 @@ export declare const ArtifactEntrySchema: Schema.Struct<{
747
772
  kind: Schema.Literal<["file", "directory"]>;
748
773
  size: Schema.optional<typeof Schema.Number>;
749
774
  }>;
750
- export declare const TrialSummarySchema: Schema.Struct<{
751
- status: Schema.Literal<["running", "completed", "failed", "cancelled"]>;
775
+ export declare const AttachmentEntrySchema: Schema.Struct<{
776
+ name: typeof Schema.String;
777
+ size: typeof Schema.Number;
778
+ truncatedFrom: Schema.optional<typeof Schema.Number>;
779
+ }>;
780
+ export declare const RunSummarySchema: Schema.Struct<{
781
+ status: Schema.Literal<["running", "passed", "failed", "errored", "cancelled"]>;
752
782
  endedAt: typeof Schema.String;
753
783
  durationMs: Schema.optional<typeof Schema.Number>;
754
784
  scoring: Schema.optional<Schema.Struct<{
@@ -769,6 +799,7 @@ export declare const TrialSummarySchema: Schema.Struct<{
769
799
  usage: Schema.optional<Schema.Struct<{
770
800
  inputTokens: Schema.optional<typeof Schema.Number>;
771
801
  outputTokens: Schema.optional<typeof Schema.Number>;
802
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
772
803
  totalTokens: Schema.optional<typeof Schema.Number>;
773
804
  }>>;
774
805
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
@@ -812,6 +843,7 @@ export declare const TrialSummarySchema: Schema.Struct<{
812
843
  usage: Schema.optional<Schema.Struct<{
813
844
  inputTokens: Schema.optional<typeof Schema.Number>;
814
845
  outputTokens: Schema.optional<typeof Schema.Number>;
846
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
815
847
  totalTokens: Schema.optional<typeof Schema.Number>;
816
848
  }>>;
817
849
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
@@ -836,20 +868,11 @@ export declare const TrialSummarySchema: Schema.Struct<{
836
868
  kind: Schema.Literal<["file", "directory"]>;
837
869
  size: Schema.optional<typeof Schema.Number>;
838
870
  }>>>>;
839
- error: Schema.optional<Schema.Struct<{
871
+ attachments: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
840
872
  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>;
873
+ size: typeof Schema.Number;
874
+ truncatedFrom: Schema.optional<typeof Schema.Number>;
875
+ }>>>>;
853
876
  error: Schema.optional<Schema.Struct<{
854
877
  name: typeof Schema.String;
855
878
  message: typeof Schema.String;
@@ -891,11 +914,6 @@ export type AgentRuntime = {
891
914
  configuration?: JsonObject;
892
915
  };
893
916
  export type AgentRuntimes = Partial<Record<AgentRuntimeName, AgentRuntime>>;
894
- export type Usage = {
895
- inputTokens?: number;
896
- outputTokens?: number;
897
- totalTokens?: number;
898
- };
899
917
  export type RecordedError = {
900
918
  name: string;
901
919
  message: string;
@@ -941,7 +959,7 @@ export type AutEvent = {
941
959
  timestamp: string;
942
960
  };
943
961
  export type RunnerEvent = {
944
- kind: 'trial-started';
962
+ kind: 'run-started';
945
963
  timestamp: string;
946
964
  } | {
947
965
  kind: 'transcript-step-started';
@@ -989,7 +1007,7 @@ export type RunnerEvent = {
989
1007
  error: RecordedError;
990
1008
  timestamp: string;
991
1009
  } | {
992
- kind: 'trial-completed';
1010
+ kind: 'run-completed';
993
1011
  timestamp: string;
994
1012
  } | {
995
1013
  kind: 'error';
@@ -1002,7 +1020,7 @@ export type TrajectoryEvent = (AutEvent & {
1002
1020
  source: 'runner';
1003
1021
  });
1004
1022
  export type WorkspaceView = {
1005
- /** Absolute path to this trial-scoped workspace. Do not persist it in reports. */
1023
+ /** Absolute path to this run-scoped workspace. Do not persist it in reports. */
1006
1024
  root: string;
1007
1025
  };
1008
1026
  export type CandidateWorkspace = WorkspaceView;
@@ -1010,8 +1028,8 @@ export type EvaluatorWorkspace = WorkspaceView;
1010
1028
  export type AutContext = {
1011
1029
  runId: string;
1012
1030
  evalId: string;
1013
- trialId: string;
1014
- trialIndex: number;
1031
+ /** Set when this run is one of several repeats launched together. */
1032
+ batch?: Batch;
1015
1033
  metadata: JsonObject;
1016
1034
  /** Run-time parameters supplied by the eval definition or CLI invocation. */
1017
1035
  parameters?: JsonObject;
@@ -1032,6 +1050,14 @@ export type AutAdapter<TMessage = string> = {
1032
1050
  runtime?: AgentRuntime;
1033
1051
  /** Optional: stream events as they happen. Returning a turn result from `send` is enough for most agents. */
1034
1052
  onEvent: (event: AutEventInput) => void | Promise<void>;
1053
+ /**
1054
+ * Saves a file with the run's results, such as the agent's raw log,
1055
+ * whether or not its sandbox is kept. `name` is a relative path of
1056
+ * letters, digits, `.`, `_` and `-` (`logs/agent.log`); each name once.
1057
+ * A file over the size limit keeps its last bytes; past the run's
1058
+ * total limit it is rejected. See `artifacts.attachments` in the config.
1059
+ */
1060
+ attach: (name: string, content: string | Uint8Array) => Promise<void>;
1035
1061
  }): Promise<AutSession<TMessage>>;
1036
1062
  };
1037
1063
  export type AutSession<TMessage = string> = {
@@ -1058,13 +1084,14 @@ export type UserMessageInput = {
1058
1084
  parameters: JsonObject;
1059
1085
  /** Values of the scenario's candidate datasets, by dataset ID (never evaluator ones). */
1060
1086
  data: JsonObject;
1061
- /** The trial's random seed (also in `context.metadata.randomSeed`). */
1087
+ /** The run's random seed (also in `context.metadata.randomSeed`). */
1062
1088
  seed: number;
1063
- trialIndex: number;
1089
+ /** Set when this run is one of several repeats launched together. */
1090
+ batch?: Batch;
1064
1091
  };
1065
1092
  export type UserStep = {
1066
1093
  kind: 'user';
1067
- /** A fixed message, or one computed for each trial. */
1094
+ /** A fixed message, or one computed for each run. */
1068
1095
  message: string | ((input: UserMessageInput) => string);
1069
1096
  };
1070
1097
  export type AgentStep = {
@@ -1104,7 +1131,7 @@ export type TranscriptStep = UserStep | AgentStep | ScoringRule | ExpectToolCall
1104
1131
  /** Observes a tool call in the preceding turn; never invokes a tool. */
1105
1132
  export declare function expectToolCall(expected: ExpectToolCallStep['expected']): ExpectToolCallStep;
1106
1133
  /**
1107
- * A user message. Pass a function to compute it for each trial, e.g. from a
1134
+ * A user message. Pass a function to compute it for each run, e.g. from a
1108
1135
  * matrix axis: `user(({ parameters }) => `Set up OCaml with ${parameters.toolchain}.`)`.
1109
1136
  */
1110
1137
  export declare function user(message: UserStep['message']): UserStep;
@@ -1120,18 +1147,21 @@ export type SkippedScore = {
1120
1147
  skipped: true;
1121
1148
  reason: string;
1122
1149
  };
1123
- export type ScoreValue = number | SkippedScore | {
1150
+ export type ScoreValue<Evidence = unknown> = number | SkippedScore | {
1124
1151
  value: number;
1125
1152
  passed?: boolean;
1126
1153
  explanation?: string;
1127
- /** Any JSON-convertible value. */
1128
- evidence?: unknown;
1154
+ /**
1155
+ * Any JSON-convertible value: what the scorer observed. A checkpoint's
1156
+ * evidence reaches later scorers through `checkpoint(rule)`.
1157
+ */
1158
+ evidence?: Evidence;
1129
1159
  /** Judge-agent evidence, never inferred from AUT usage. */
1130
1160
  judge?: JudgeRunInfo;
1131
1161
  };
1132
1162
  /**
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.
1163
+ * Marks a scorer as not applicable to this run. A skipped result neither
1164
+ * passes nor fails the run and is left out of score averages.
1135
1165
  */
1136
1166
  export declare function skip(reason: string): SkippedScore;
1137
1167
  export type ScoreResult = {
@@ -1169,14 +1199,36 @@ export type ScoringContext = {
1169
1199
  * example, in a container that is gone by final scoring).
1170
1200
  */
1171
1201
  checkpoints: readonly CheckpointResult[];
1202
+ /**
1203
+ * The latest result of a checkpoint in this scenario's transcript, looked
1204
+ * up by the rule itself, so renaming it cannot break the lookup. A
1205
+ * predicate's `evidence` keeps its type. Undefined until that step has
1206
+ * run; throws for a rule that is not in the transcript.
1207
+ */
1208
+ checkpoint<Evidence>(rule: PredicateScorer<Evidence>): CheckpointOutcome<Evidence> | undefined;
1209
+ checkpoint(rule: JudgeRule | ExpectToolCallStep): CheckpointOutcome<JsonValue> | undefined;
1210
+ /**
1211
+ * Saves a file with the run's results, like the agent's `attach()`: for
1212
+ * example a container's log, or a file the agent reported, read before the
1213
+ * workspace is gone. Same names, limits and rules.
1214
+ */
1215
+ attach(name: string, content: string | Uint8Array): Promise<void>;
1172
1216
  };
1173
- export type PredicateScorer = {
1217
+ /**
1218
+ * A checkpoint's result with typed evidence. Evidence is saved as JSON, so
1219
+ * it arrives as its JSON form: a `Date` becomes a string, `undefined` fields
1220
+ * are dropped.
1221
+ */
1222
+ export type CheckpointOutcome<Evidence> = Omit<CheckpointResult, 'evidence'> & {
1223
+ evidence?: Evidence;
1224
+ };
1225
+ export type PredicateScorer<Evidence = unknown> = {
1174
1226
  kind: 'predicate';
1175
1227
  name: string;
1176
1228
  supportsPartial?: boolean;
1177
1229
  /** A numeric result passes when it is at least this value. Default: only 1 passes. */
1178
1230
  passAt?: number;
1179
- run(context: ScoringContext): boolean | ScoreValue | Promise<boolean | ScoreValue>;
1231
+ run(context: ScoringContext): boolean | ScoreValue<Evidence> | Promise<boolean | ScoreValue<Evidence>>;
1180
1232
  };
1181
1233
  export type JudgeRule = {
1182
1234
  kind: 'judge';
@@ -1186,9 +1238,10 @@ export type JudgeRule = {
1186
1238
  supportsPartial?: boolean;
1187
1239
  };
1188
1240
  export type ScoringRule = PredicateScorer | JudgeRule;
1189
- export declare function predicate(name: string, run: PredicateScorer['run'], options?: Pick<PredicateScorer, 'supportsPartial' | 'passAt'>): PredicateScorer;
1241
+ /** A scorer in code. Its `evidence` type carries through to `checkpoint(rule)`. */
1242
+ export declare function predicate<Evidence = unknown>(name: string, run: PredicateScorer<Evidence>['run'], options?: Pick<PredicateScorer, 'supportsPartial' | 'passAt'>): PredicateScorer<Evidence>;
1190
1243
  /**
1191
- * A number measured for every trial, such as tokens, retries or web searches.
1244
+ * A number measured for every run, such as tokens, retries or web searches.
1192
1245
  * Metrics never decide pass or fail; they are averaged per run and shown on
1193
1246
  * the scoreboard. Return undefined when there is nothing to measure.
1194
1247
  */
@@ -1201,10 +1254,11 @@ export type Metric = {
1201
1254
  better?: 'lower' | 'higher';
1202
1255
  run(context: ScoringContext): number | undefined | Promise<number | undefined>;
1203
1256
  };
1204
- export declare function metric(name: string, run: Metric['run'], options?: Pick<Metric, 'unit' | 'better'>): Metric;
1205
- /** A metric's value for one trial. */
1257
+ /** A built-in metric's name is a type error here, as well as at definition time. */
1258
+ export declare function metric<const Name extends string>(name: Name extends BuiltInMetricName ? never : Name, run: Metric['run'], options?: Pick<Metric, 'unit' | 'better'>): Metric;
1259
+ /** A metric's value for one run. */
1206
1260
  export type MetricResult = {
1207
- name: string;
1261
+ name: MetricName;
1208
1262
  /** Absent when the metric measured nothing or failed. */
1209
1263
  value?: number;
1210
1264
  unit?: string;
@@ -1218,8 +1272,6 @@ export type EvalPolicy = {
1218
1272
  timeoutMs?: number;
1219
1273
  /** Stop later transcript steps after a failed checkpoint assertion. Default false. */
1220
1274
  failfast?: boolean;
1221
- /** Number of independent trials requested by local and hosted runners. */
1222
- trials?: number;
1223
1275
  };
1224
1276
  export type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
1225
1277
  id: string;
@@ -1227,13 +1279,18 @@ export type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
1227
1279
  agent: TAgent;
1228
1280
  /** Separate judge agent; its model and tools are never inherited from the AUT. */
1229
1281
  judge?: AutAdapter;
1230
- /** Data and files the scenario uses; each trial gets its own copy. */
1282
+ /** Data and files the scenario uses; each run gets its own copy. */
1231
1283
  datasets?: readonly Dataset[];
1232
1284
  transcript: TranscriptStep[];
1233
1285
  scoring: ScoringRule[];
1234
- /** Numbers to measure for every trial; they never affect pass or fail. */
1286
+ /** Numbers to measure for every run; they never affect pass or fail. */
1235
1287
  metrics?: readonly Metric[];
1236
1288
  policy?: EvalPolicy;
1289
+ /**
1290
+ * How many runs to start each time the scenario runs, as one batch: repeats
1291
+ * under identical conditions, to see how often it passes. Default 1.
1292
+ */
1293
+ repeat?: number;
1237
1294
  /** Any JSON-convertible object; converted when the eval is defined. */
1238
1295
  metadata?: Record<string, unknown>;
1239
1296
  workspace?: EvalWorkspace;
@@ -1241,7 +1298,7 @@ export type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
1241
1298
  /** How EvalKit treats this scenario's candidate workspace. */
1242
1299
  export type EvalWorkspace = {
1243
1300
  /**
1244
- * Paths to leave out of the trial's snapshot, read like `.gitignore`: globs
1301
+ * Paths to leave out of the run's snapshot, read like `.gitignore`: globs
1245
1302
  * relative to the workspace, where a pattern without `/` matches that name
1246
1303
  * at any depth and later patterns win. They come after the project's
1247
1304
  * `artifacts.exclude` (default `DEFAULT_ARTIFACT_EXCLUDE`), so `!pattern`
@@ -1288,7 +1345,18 @@ export type EvalSuiteMetadata = {
1288
1345
  * path-like grouping of evals; nesting is presentation derived from its ID.
1289
1346
  */
1290
1347
  export declare function registerEvals<const TRegistrations extends readonly EvalRegistration[]>(registrations: TRegistrations): EvalRegistry;
1291
- export type RunStatus = 'running' | 'completed' | 'failed' | 'cancelled';
1348
+ /**
1349
+ * How a run ended: `passed` or `failed` by its scores, `errored` when it could
1350
+ * not finish (the agent, a dataset or EvalKit failed), `cancelled` by Ctrl+C.
1351
+ */
1352
+ export type RunStatus = 'running' | 'passed' | 'failed' | 'errored' | 'cancelled';
1353
+ /** Runs launched together as repeats of one configuration (`repeat`). */
1354
+ export type Batch = {
1355
+ id: string;
1356
+ /** Zero-based position in the batch. */
1357
+ index: number;
1358
+ size: number;
1359
+ };
1292
1360
  /**
1293
1361
  * Where a run's eval code came from: the repository, eval project and commit.
1294
1362
  * Results are tagged with it; they are never stored in the repository itself.
@@ -1323,7 +1391,7 @@ export type RunProcess = {
1323
1391
  hostname: string;
1324
1392
  };
1325
1393
  export type RunMetadata = {
1326
- schemaVersion: 2 | 3 | 4 | 5;
1394
+ schemaVersion: 6;
1327
1395
  runId: string;
1328
1396
  runUri: ResourceUri<'run'>;
1329
1397
  evalId: string;
@@ -1335,36 +1403,21 @@ export type RunMetadata = {
1335
1403
  };
1336
1404
  aut?: AutIdentity;
1337
1405
  startedAt: string;
1338
- /** Present from schema version 4 when the run's commit could be determined. */
1406
+ /** Present when the run's commit could be determined. */
1339
1407
  source?: RunSource;
1340
- /** From schema version 5. */
1341
1408
  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;
1409
+ /** Set when this run is one of several repeats launched together. */
1410
+ batch?: Batch;
1358
1411
  /** The effective snapshot ignore patterns: the project's `artifacts.exclude`, then the scenario's `workspace.ignore`. */
1359
1412
  workspaceIgnore?: string[];
1360
- /** From schema version 5: the datasets this trial used, with content digests. */
1361
- datasets?: TrialDataset[];
1413
+ /** The datasets this run used, with content digests. */
1414
+ datasets?: RunDataset[];
1362
1415
  };
1363
- export type TrialDataset = {
1416
+ export type RunDataset = {
1364
1417
  id: string;
1365
1418
  visibility: DatasetVisibility;
1366
1419
  source: 'static' | 'computed';
1367
- /** SHA-256 of the trial's content: file paths and bytes, and the canonical value. */
1420
+ /** SHA-256 of the run's content: file paths and bytes, and the canonical value. */
1368
1421
  digest: string;
1369
1422
  };
1370
1423
  export type CheckpointResult = {
@@ -1384,9 +1437,21 @@ export type CheckpointResult = {
1384
1437
  id: string;
1385
1438
  };
1386
1439
  };
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 = {
1440
+ /**
1441
+ * Metrics EvalKit records for every run; scenario metrics may not reuse
1442
+ * these names.
1443
+ *
1444
+ * - `agent time` (ms): from the run's first event to its last one before
1445
+ * final scoring.
1446
+ * - `tokens`: the sum of `turnTokens(usage)` over the turns that reported
1447
+ * usage, cached input included. Absent when no turn reported any.
1448
+ * - `tool calls`: the agent's `tool-call` events.
1449
+ */
1450
+ export declare const BUILT_IN_METRICS: readonly ['agent time', 'tokens', 'tool calls'];
1451
+ export type BuiltInMetricName = (typeof BUILT_IN_METRICS)[number];
1452
+ /** A built-in metric's name (suggested by editors), or a scenario's own. */
1453
+ export type MetricName = BuiltInMetricName | (string & {});
1454
+ export type RunScoring = {
1390
1455
  results: ScoreResult[];
1391
1456
  metrics?: MetricResult[];
1392
1457
  checkpoints?: CheckpointResult[];
@@ -1395,40 +1460,34 @@ export type TrialScoring = {
1395
1460
  passed: boolean;
1396
1461
  };
1397
1462
  export type ArtifactEntry = {
1398
- /** Path relative to this trial's artifact root. */
1463
+ /** Path relative to this run's artifact root. */
1399
1464
  path: string;
1400
1465
  kind: 'file' | 'directory';
1401
1466
  size?: number;
1402
1467
  };
1403
- export type TrialSummary = {
1404
- status: RunStatus;
1405
- endedAt: string;
1406
- durationMs?: number;
1407
- scoring?: TrialScoring;
1408
- artifacts?: ArtifactEntry[];
1409
- error?: RecordedError;
1468
+ /** A file an adapter attached with `attach()`, saved as `artifacts/attachments/<name>`. */
1469
+ export type AttachmentEntry = {
1470
+ name: string;
1471
+ /** Bytes saved. */
1472
+ size: number;
1473
+ /** The original size, when the file was cut to its last `maxFileBytes`. */
1474
+ truncatedFrom?: number;
1410
1475
  };
1411
1476
  export type RunSummary = {
1412
1477
  status: RunStatus;
1413
1478
  endedAt: string;
1414
1479
  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;
1480
+ scoring?: RunScoring;
1481
+ artifacts?: ArtifactEntry[];
1482
+ attachments?: AttachmentEntry[];
1420
1483
  error?: RecordedError;
1421
1484
  };
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
1485
  export type RunWriter = {
1430
1486
  readonly location: string;
1431
- startTrial(metadata: TrialMetadata): Promise<TrialWriter>;
1487
+ appendEvent(event: TrajectoryEvent): Promise<void>;
1488
+ writeScores(scoring: RunScoring): Promise<void>;
1489
+ /** Writes a file below this run's artifact root. */
1490
+ writeArtifact(path: string, data: Uint8Array): Promise<void>;
1432
1491
  finalize(summary: RunSummary): Promise<void>;
1433
1492
  };
1434
1493
  export type ReportStore = {
@@ -1436,35 +1495,18 @@ export type ReportStore = {
1436
1495
  catalog?: RunCatalog;
1437
1496
  }): Promise<RunWriter>;
1438
1497
  };
1439
- export type TrialResult = {
1498
+ /** One finished run, as `runEval` returns it. */
1499
+ export type RunResult = {
1440
1500
  runId: string;
1441
1501
  runUri: ResourceUri<'run'>;
1442
- trialId: string;
1443
- trialUri: ResourceUri<'trial'>;
1444
- trialIndex: number;
1445
1502
  evalId: string;
1446
1503
  status: RunStatus;
1504
+ batch?: Batch;
1447
1505
  reportLocation: string;
1448
1506
  durationMs?: number;
1449
- scoring?: TrialScoring;
1507
+ scoring?: RunScoring;
1450
1508
  error?: RecordedError;
1451
1509
  };
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
1510
  export declare function recordError(error: unknown): RecordedError;
1469
1511
  //#endregion
1470
1512
  //#region ../agents/src/index.d.ts
@@ -1476,5 +1518,5 @@ type PiAutOptions = {
1476
1518
  /** A local, one-prompt-per-turn AUT backed by Pi's non-interactive print mode. */
1477
1519
  export declare function piAgent(options?: PiAutOptions): AutAdapter;
1478
1520
  //#endregion
1479
- export type { DefinitionSite, EvalMatrix, EvalMatrixCell, EvalkitConfig, KeepSandboxes, MatrixSelection, ShareConfig, ShareHeaders };
1521
+ export type { AttachmentLimits, DefinitionSite, EvalMatrix, EvalMatrixCell, EvalkitConfig, KeepSandboxes, MatrixSelection, ShareConfig, ShareHeaders, Usage };
1480
1522
  //# sourceMappingURL=index.d.mts.map