@leostera/evalkit 0.7.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 +56 -1
  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 +239 -178
  10. package/dist/index.d.mts.map +1 -1
  11. package/dist/index.mjs +2 -2
  12. package/dist/runner.d.mts +246 -169
  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-b2Wnmzbb.mjs → src-BrfIXfO2.mjs} +75 -54
  30. package/dist/{src-DhromKNu.mjs → src-CcdLZqFk.mjs} +487 -250
  31. package/dist/upgrade-60SIRius.mjs +110 -0
  32. package/package.json +1 -1
  33. package/dist/dashboard/assets/index-BEBo_81Y.js +0 -34
  34. package/dist/dashboard/assets/index-C24IquYZ.css +0 -2
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,26 +339,36 @@ 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
350
350
  * pattern without `/` matches that name at any depth. Replaces the default,
351
351
  * `DEFAULT_ARTIFACT_EXCLUDE` (dependencies, build output, VCS metadata).
352
+ * A scenario's `workspace.ignore` patterns come after these.
352
353
  */
353
354
  exclude?: readonly string[];
355
+ /** Limits for files adapters `attach()`. */
356
+ attachments?: AttachmentLimits;
354
357
  };
355
- /** 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`. */
356
359
  sandboxDir?: string;
357
- /** 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. */
358
361
  keepSandboxes?: KeepSandboxes;
359
362
  share?: ShareConfig;
360
363
  };
361
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>;
362
372
  /** Left out of candidate snapshots unless `artifacts.exclude` says otherwise. */
363
373
  export declare const DEFAULT_ARTIFACT_EXCLUDE: readonly string[];
364
374
  /** HTTP header names and values. */
@@ -376,6 +386,32 @@ type ShareConfig = {
376
386
  /** Pure, typed project configuration. Loading/discovery belongs to the CLI. */
377
387
  export declare function defineConfig<const T extends EvalkitConfig>(configuration: T): T;
378
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
379
415
  //#region ../core/src/json.d.ts
380
416
  /** A value that cannot be stored in a report, with the path of the offending part. */
381
417
  export declare class NotJsonError extends Error {
@@ -412,7 +448,9 @@ export declare function definitionSite(value: unknown): DefinitionSite | undefin
412
448
  //#endregion
413
449
  //#region ../core/src/schema.d.ts
414
450
  /** Runtime schemas for serialized EvalKit report and API boundaries. */
415
- 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;
416
454
  export declare const RecordedErrorSchema: Schema.Struct<{
417
455
  name: typeof Schema.String;
418
456
  message: typeof Schema.String;
@@ -439,8 +477,19 @@ export declare const RunSourceSchema: Schema.Struct<{
439
477
  url: Schema.optional<typeof Schema.String>;
440
478
  }>>;
441
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
+ }>;
442
491
  export declare const RunMetadataSchema: Schema.Struct<{
443
- schemaVersion: Schema.Literal<[2, 3, 4, 5]>;
492
+ schemaVersion: Schema.Literal<[6]>;
444
493
  runUri: Schema.filter<typeof Schema.String>;
445
494
  evalId: typeof Schema.String;
446
495
  suiteId: Schema.optional<typeof Schema.String>;
@@ -474,25 +523,13 @@ export declare const RunMetadataSchema: Schema.Struct<{
474
523
  pid: typeof Schema.Number;
475
524
  hostname: typeof Schema.String;
476
525
  }>>;
477
- }>;
478
- export declare const TrialMetadataSchema: Schema.Struct<{
479
- schemaVersion: Schema.Literal<[2, 3, 4, 5]>;
480
- runUri: Schema.filter<typeof Schema.String>;
481
- trialUri: Schema.filter<typeof Schema.String>;
482
- trialIndex: typeof Schema.Number;
483
- evalId: typeof Schema.String;
484
- parameters: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Schema<JsonValue, JsonValue, never>>>;
485
- matrix: Schema.optional<Schema.Struct<{
486
- id: typeof Schema.String;
487
- cellKey: typeof Schema.String;
488
- }>>;
489
- aut: Schema.optional<Schema.Struct<{
490
- name: Schema.optional<typeof Schema.String>;
491
- kind: typeof Schema.String;
526
+ batch: Schema.optional<Schema.Struct<{
492
527
  id: typeof Schema.String;
493
- version: Schema.optional<typeof Schema.String>;
528
+ index: typeof Schema.Number;
529
+ size: typeof Schema.Number;
494
530
  }>>;
495
- startedAt: typeof Schema.String;
531
+ /** The effective snapshot ignore patterns: the project's, then the scenario's. */
532
+ workspaceIgnore: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
496
533
  datasets: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
497
534
  id: typeof Schema.String;
498
535
  visibility: Schema.Literal<["candidate", "evaluator"]>;
@@ -500,9 +537,9 @@ export declare const TrialMetadataSchema: Schema.Struct<{
500
537
  digest: typeof Schema.String;
501
538
  }>>>>;
502
539
  }>;
503
- /** On-disk manifests include a lifecycle status; older finalized manifests may still say running. */
540
+ /** On-disk manifests include a lifecycle status. */
504
541
  export declare const RunManifestSchema: Schema.Struct<{
505
- schemaVersion: Schema.Literal<[2, 3, 4, 5]>;
542
+ schemaVersion: Schema.Literal<[6]>;
506
543
  runUri: Schema.filter<typeof Schema.String>;
507
544
  evalId: typeof Schema.String;
508
545
  suiteId: Schema.optional<typeof Schema.String>;
@@ -536,37 +573,24 @@ export declare const RunManifestSchema: Schema.Struct<{
536
573
  pid: typeof Schema.Number;
537
574
  hostname: typeof Schema.String;
538
575
  }>>;
539
- status: Schema.optional<Schema.Literal<["running", "completed", "failed", "cancelled"]>>;
540
- }>;
541
- export declare const TrialManifestSchema: Schema.Struct<{
542
- schemaVersion: Schema.Literal<[2, 3, 4, 5]>;
543
- runUri: Schema.filter<typeof Schema.String>;
544
- trialUri: Schema.filter<typeof Schema.String>;
545
- trialIndex: typeof Schema.Number;
546
- evalId: typeof Schema.String;
547
- parameters: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Schema<JsonValue, JsonValue, never>>>;
548
- matrix: Schema.optional<Schema.Struct<{
549
- id: typeof Schema.String;
550
- cellKey: typeof Schema.String;
551
- }>>;
552
- aut: Schema.optional<Schema.Struct<{
553
- name: Schema.optional<typeof Schema.String>;
554
- kind: typeof Schema.String;
576
+ batch: Schema.optional<Schema.Struct<{
555
577
  id: typeof Schema.String;
556
- version: Schema.optional<typeof Schema.String>;
578
+ index: typeof Schema.Number;
579
+ size: typeof Schema.Number;
557
580
  }>>;
558
- startedAt: typeof Schema.String;
581
+ workspaceIgnore: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
559
582
  datasets: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
560
583
  id: typeof Schema.String;
561
584
  visibility: Schema.Literal<["candidate", "evaluator"]>;
562
585
  source: Schema.Literal<["static", "computed"]>;
563
586
  digest: typeof Schema.String;
564
587
  }>>>>;
565
- status: Schema.optional<Schema.Literal<["running", "completed", "failed", "cancelled"]>>;
588
+ status: Schema.optional<Schema.Literal<["running", "passed", "failed", "errored", "cancelled"]>>;
566
589
  }>;
567
590
  export declare const UsageSchema: Schema.Struct<{
568
591
  inputTokens: Schema.optional<typeof Schema.Number>;
569
592
  outputTokens: Schema.optional<typeof Schema.Number>;
593
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
570
594
  totalTokens: Schema.optional<typeof Schema.Number>;
571
595
  }>;
572
596
  export declare const JudgeRunInfoSchema: Schema.Struct<{
@@ -579,6 +603,7 @@ export declare const JudgeRunInfoSchema: Schema.Struct<{
579
603
  usage: Schema.optional<Schema.Struct<{
580
604
  inputTokens: Schema.optional<typeof Schema.Number>;
581
605
  outputTokens: Schema.optional<typeof Schema.Number>;
606
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
582
607
  totalTokens: Schema.optional<typeof Schema.Number>;
583
608
  }>>;
584
609
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
@@ -600,6 +625,7 @@ export declare const ScoreResultSchema: Schema.Struct<{
600
625
  usage: Schema.optional<Schema.Struct<{
601
626
  inputTokens: Schema.optional<typeof Schema.Number>;
602
627
  outputTokens: Schema.optional<typeof Schema.Number>;
628
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
603
629
  totalTokens: Schema.optional<typeof Schema.Number>;
604
630
  }>>;
605
631
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
@@ -631,6 +657,7 @@ export declare const CheckpointResultSchema: Schema.Struct<{
631
657
  usage: Schema.optional<Schema.Struct<{
632
658
  inputTokens: Schema.optional<typeof Schema.Number>;
633
659
  outputTokens: Schema.optional<typeof Schema.Number>;
660
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
634
661
  totalTokens: Schema.optional<typeof Schema.Number>;
635
662
  }>>;
636
663
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
@@ -658,7 +685,7 @@ export declare const MetricResultSchema: Schema.Struct<{
658
685
  stack: Schema.optional<typeof Schema.String>;
659
686
  }>>;
660
687
  }>;
661
- export declare const TrialScoringSchema: Schema.Struct<{
688
+ export declare const RunScoringSchema: Schema.Struct<{
662
689
  results: Schema.mutable<Schema.Array$<Schema.Struct<{
663
690
  name: typeof Schema.String;
664
691
  kind: Schema.Literal<["predicate", "judge"]>;
@@ -676,6 +703,7 @@ export declare const TrialScoringSchema: Schema.Struct<{
676
703
  usage: Schema.optional<Schema.Struct<{
677
704
  inputTokens: Schema.optional<typeof Schema.Number>;
678
705
  outputTokens: Schema.optional<typeof Schema.Number>;
706
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
679
707
  totalTokens: Schema.optional<typeof Schema.Number>;
680
708
  }>>;
681
709
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
@@ -719,6 +747,7 @@ export declare const TrialScoringSchema: Schema.Struct<{
719
747
  usage: Schema.optional<Schema.Struct<{
720
748
  inputTokens: Schema.optional<typeof Schema.Number>;
721
749
  outputTokens: Schema.optional<typeof Schema.Number>;
750
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
722
751
  totalTokens: Schema.optional<typeof Schema.Number>;
723
752
  }>>;
724
753
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
@@ -743,8 +772,13 @@ export declare const ArtifactEntrySchema: Schema.Struct<{
743
772
  kind: Schema.Literal<["file", "directory"]>;
744
773
  size: Schema.optional<typeof Schema.Number>;
745
774
  }>;
746
- export declare const TrialSummarySchema: Schema.Struct<{
747
- 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"]>;
748
782
  endedAt: typeof Schema.String;
749
783
  durationMs: Schema.optional<typeof Schema.Number>;
750
784
  scoring: Schema.optional<Schema.Struct<{
@@ -765,6 +799,7 @@ export declare const TrialSummarySchema: Schema.Struct<{
765
799
  usage: Schema.optional<Schema.Struct<{
766
800
  inputTokens: Schema.optional<typeof Schema.Number>;
767
801
  outputTokens: Schema.optional<typeof Schema.Number>;
802
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
768
803
  totalTokens: Schema.optional<typeof Schema.Number>;
769
804
  }>>;
770
805
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
@@ -808,6 +843,7 @@ export declare const TrialSummarySchema: Schema.Struct<{
808
843
  usage: Schema.optional<Schema.Struct<{
809
844
  inputTokens: Schema.optional<typeof Schema.Number>;
810
845
  outputTokens: Schema.optional<typeof Schema.Number>;
846
+ cachedInputTokens: Schema.optional<typeof Schema.Number>;
811
847
  totalTokens: Schema.optional<typeof Schema.Number>;
812
848
  }>>;
813
849
  events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
@@ -832,20 +868,11 @@ export declare const TrialSummarySchema: Schema.Struct<{
832
868
  kind: Schema.Literal<["file", "directory"]>;
833
869
  size: Schema.optional<typeof Schema.Number>;
834
870
  }>>>>;
835
- error: Schema.optional<Schema.Struct<{
871
+ attachments: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
836
872
  name: typeof Schema.String;
837
- message: typeof Schema.String;
838
- stack: Schema.optional<typeof Schema.String>;
839
- }>>;
840
- }>;
841
- export declare const RunSummarySchema: Schema.Struct<{
842
- status: Schema.Literal<["running", "completed", "failed", "cancelled"]>;
843
- endedAt: typeof Schema.String;
844
- durationMs: Schema.optional<typeof Schema.Number>;
845
- trialCount: typeof Schema.Number;
846
- passed: typeof Schema.Number;
847
- failed: typeof Schema.Number;
848
- cancelled: Schema.optional<typeof Schema.Number>;
873
+ size: typeof Schema.Number;
874
+ truncatedFrom: Schema.optional<typeof Schema.Number>;
875
+ }>>>>;
849
876
  error: Schema.optional<Schema.Struct<{
850
877
  name: typeof Schema.String;
851
878
  message: typeof Schema.String;
@@ -887,11 +914,6 @@ export type AgentRuntime = {
887
914
  configuration?: JsonObject;
888
915
  };
889
916
  export type AgentRuntimes = Partial<Record<AgentRuntimeName, AgentRuntime>>;
890
- export type Usage = {
891
- inputTokens?: number;
892
- outputTokens?: number;
893
- totalTokens?: number;
894
- };
895
917
  export type RecordedError = {
896
918
  name: string;
897
919
  message: string;
@@ -937,7 +959,7 @@ export type AutEvent = {
937
959
  timestamp: string;
938
960
  };
939
961
  export type RunnerEvent = {
940
- kind: 'trial-started';
962
+ kind: 'run-started';
941
963
  timestamp: string;
942
964
  } | {
943
965
  kind: 'transcript-step-started';
@@ -985,7 +1007,7 @@ export type RunnerEvent = {
985
1007
  error: RecordedError;
986
1008
  timestamp: string;
987
1009
  } | {
988
- kind: 'trial-completed';
1010
+ kind: 'run-completed';
989
1011
  timestamp: string;
990
1012
  } | {
991
1013
  kind: 'error';
@@ -998,7 +1020,7 @@ export type TrajectoryEvent = (AutEvent & {
998
1020
  source: 'runner';
999
1021
  });
1000
1022
  export type WorkspaceView = {
1001
- /** 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. */
1002
1024
  root: string;
1003
1025
  };
1004
1026
  export type CandidateWorkspace = WorkspaceView;
@@ -1006,8 +1028,8 @@ export type EvaluatorWorkspace = WorkspaceView;
1006
1028
  export type AutContext = {
1007
1029
  runId: string;
1008
1030
  evalId: string;
1009
- trialId: string;
1010
- trialIndex: number;
1031
+ /** Set when this run is one of several repeats launched together. */
1032
+ batch?: Batch;
1011
1033
  metadata: JsonObject;
1012
1034
  /** Run-time parameters supplied by the eval definition or CLI invocation. */
1013
1035
  parameters?: JsonObject;
@@ -1028,6 +1050,14 @@ export type AutAdapter<TMessage = string> = {
1028
1050
  runtime?: AgentRuntime;
1029
1051
  /** Optional: stream events as they happen. Returning a turn result from `send` is enough for most agents. */
1030
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>;
1031
1061
  }): Promise<AutSession<TMessage>>;
1032
1062
  };
1033
1063
  export type AutSession<TMessage = string> = {
@@ -1054,13 +1084,14 @@ export type UserMessageInput = {
1054
1084
  parameters: JsonObject;
1055
1085
  /** Values of the scenario's candidate datasets, by dataset ID (never evaluator ones). */
1056
1086
  data: JsonObject;
1057
- /** The trial's random seed (also in `context.metadata.randomSeed`). */
1087
+ /** The run's random seed (also in `context.metadata.randomSeed`). */
1058
1088
  seed: number;
1059
- trialIndex: number;
1089
+ /** Set when this run is one of several repeats launched together. */
1090
+ batch?: Batch;
1060
1091
  };
1061
1092
  export type UserStep = {
1062
1093
  kind: 'user';
1063
- /** A fixed message, or one computed for each trial. */
1094
+ /** A fixed message, or one computed for each run. */
1064
1095
  message: string | ((input: UserMessageInput) => string);
1065
1096
  };
1066
1097
  export type AgentStep = {
@@ -1100,7 +1131,7 @@ export type TranscriptStep = UserStep | AgentStep | ScoringRule | ExpectToolCall
1100
1131
  /** Observes a tool call in the preceding turn; never invokes a tool. */
1101
1132
  export declare function expectToolCall(expected: ExpectToolCallStep['expected']): ExpectToolCallStep;
1102
1133
  /**
1103
- * 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
1104
1135
  * matrix axis: `user(({ parameters }) => `Set up OCaml with ${parameters.toolchain}.`)`.
1105
1136
  */
1106
1137
  export declare function user(message: UserStep['message']): UserStep;
@@ -1116,18 +1147,21 @@ export type SkippedScore = {
1116
1147
  skipped: true;
1117
1148
  reason: string;
1118
1149
  };
1119
- export type ScoreValue = number | SkippedScore | {
1150
+ export type ScoreValue<Evidence = unknown> = number | SkippedScore | {
1120
1151
  value: number;
1121
1152
  passed?: boolean;
1122
1153
  explanation?: string;
1123
- /** Any JSON-convertible value. */
1124
- 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;
1125
1159
  /** Judge-agent evidence, never inferred from AUT usage. */
1126
1160
  judge?: JudgeRunInfo;
1127
1161
  };
1128
1162
  /**
1129
- * Marks a scorer as not applicable to this trial. A skipped result neither
1130
- * 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.
1131
1165
  */
1132
1166
  export declare function skip(reason: string): SkippedScore;
1133
1167
  export type ScoreResult = {
@@ -1165,14 +1199,36 @@ export type ScoringContext = {
1165
1199
  * example, in a container that is gone by final scoring).
1166
1200
  */
1167
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>;
1216
+ };
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;
1168
1224
  };
1169
- export type PredicateScorer = {
1225
+ export type PredicateScorer<Evidence = unknown> = {
1170
1226
  kind: 'predicate';
1171
1227
  name: string;
1172
1228
  supportsPartial?: boolean;
1173
1229
  /** A numeric result passes when it is at least this value. Default: only 1 passes. */
1174
1230
  passAt?: number;
1175
- run(context: ScoringContext): boolean | ScoreValue | Promise<boolean | ScoreValue>;
1231
+ run(context: ScoringContext): boolean | ScoreValue<Evidence> | Promise<boolean | ScoreValue<Evidence>>;
1176
1232
  };
1177
1233
  export type JudgeRule = {
1178
1234
  kind: 'judge';
@@ -1182,9 +1238,10 @@ export type JudgeRule = {
1182
1238
  supportsPartial?: boolean;
1183
1239
  };
1184
1240
  export type ScoringRule = PredicateScorer | JudgeRule;
1185
- 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>;
1186
1243
  /**
1187
- * 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.
1188
1245
  * Metrics never decide pass or fail; they are averaged per run and shown on
1189
1246
  * the scoreboard. Return undefined when there is nothing to measure.
1190
1247
  */
@@ -1197,10 +1254,11 @@ export type Metric = {
1197
1254
  better?: 'lower' | 'higher';
1198
1255
  run(context: ScoringContext): number | undefined | Promise<number | undefined>;
1199
1256
  };
1200
- export declare function metric(name: string, run: Metric['run'], options?: Pick<Metric, 'unit' | 'better'>): Metric;
1201
- /** 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. */
1202
1260
  export type MetricResult = {
1203
- name: string;
1261
+ name: MetricName;
1204
1262
  /** Absent when the metric measured nothing or failed. */
1205
1263
  value?: number;
1206
1264
  unit?: string;
@@ -1214,8 +1272,6 @@ export type EvalPolicy = {
1214
1272
  timeoutMs?: number;
1215
1273
  /** Stop later transcript steps after a failed checkpoint assertion. Default false. */
1216
1274
  failfast?: boolean;
1217
- /** Number of independent trials requested by local and hosted runners. */
1218
- trials?: number;
1219
1275
  };
1220
1276
  export type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
1221
1277
  id: string;
@@ -1223,15 +1279,33 @@ export type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
1223
1279
  agent: TAgent;
1224
1280
  /** Separate judge agent; its model and tools are never inherited from the AUT. */
1225
1281
  judge?: AutAdapter;
1226
- /** 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. */
1227
1283
  datasets?: readonly Dataset[];
1228
1284
  transcript: TranscriptStep[];
1229
1285
  scoring: ScoringRule[];
1230
- /** 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. */
1231
1287
  metrics?: readonly Metric[];
1232
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;
1233
1294
  /** Any JSON-convertible object; converted when the eval is defined. */
1234
1295
  metadata?: Record<string, unknown>;
1296
+ workspace?: EvalWorkspace;
1297
+ };
1298
+ /** How EvalKit treats this scenario's candidate workspace. */
1299
+ export type EvalWorkspace = {
1300
+ /**
1301
+ * Paths to leave out of the run's snapshot, read like `.gitignore`: globs
1302
+ * relative to the workspace, where a pattern without `/` matches that name
1303
+ * at any depth and later patterns win. They come after the project's
1304
+ * `artifacts.exclude` (default `DEFAULT_ARTIFACT_EXCLUDE`), so `!pattern`
1305
+ * can keep a path the project leaves out, even inside an ignored directory:
1306
+ * `['!_build/doc/**']` keeps generated docs while dropping the rest of `_build`.
1307
+ */
1308
+ ignore?: readonly string[];
1235
1309
  };
1236
1310
  export declare function defineEval<const T extends EvalDefinition>(definition: T): T;
1237
1311
  export type EvalSuite<TEvals extends readonly EvalDefinition[] = readonly EvalDefinition[]> = {
@@ -1271,7 +1345,18 @@ export type EvalSuiteMetadata = {
1271
1345
  * path-like grouping of evals; nesting is presentation derived from its ID.
1272
1346
  */
1273
1347
  export declare function registerEvals<const TRegistrations extends readonly EvalRegistration[]>(registrations: TRegistrations): EvalRegistry;
1274
- 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
+ };
1275
1360
  /**
1276
1361
  * Where a run's eval code came from: the repository, eval project and commit.
1277
1362
  * Results are tagged with it; they are never stored in the repository itself.
@@ -1306,7 +1391,7 @@ export type RunProcess = {
1306
1391
  hostname: string;
1307
1392
  };
1308
1393
  export type RunMetadata = {
1309
- schemaVersion: 2 | 3 | 4 | 5;
1394
+ schemaVersion: 6;
1310
1395
  runId: string;
1311
1396
  runUri: ResourceUri<'run'>;
1312
1397
  evalId: string;
@@ -1318,34 +1403,21 @@ export type RunMetadata = {
1318
1403
  };
1319
1404
  aut?: AutIdentity;
1320
1405
  startedAt: string;
1321
- /** Present from schema version 4 when the run's commit could be determined. */
1406
+ /** Present when the run's commit could be determined. */
1322
1407
  source?: RunSource;
1323
- /** From schema version 5. */
1324
1408
  process?: RunProcess;
1325
- };
1326
- export type TrialMetadata = {
1327
- schemaVersion: 2 | 3 | 4 | 5;
1328
- runId: string;
1329
- runUri: ResourceUri<'run'>;
1330
- trialId: string;
1331
- trialUri: ResourceUri<'trial'>;
1332
- trialIndex: number;
1333
- evalId: string;
1334
- parameters?: JsonObject;
1335
- matrix?: {
1336
- id: string;
1337
- cellKey: string;
1338
- };
1339
- aut?: AutIdentity;
1340
- startedAt: string;
1341
- /** From schema version 5: the datasets this trial used, with content digests. */
1342
- datasets?: TrialDataset[];
1343
- };
1344
- export type TrialDataset = {
1409
+ /** Set when this run is one of several repeats launched together. */
1410
+ batch?: Batch;
1411
+ /** The effective snapshot ignore patterns: the project's `artifacts.exclude`, then the scenario's `workspace.ignore`. */
1412
+ workspaceIgnore?: string[];
1413
+ /** The datasets this run used, with content digests. */
1414
+ datasets?: RunDataset[];
1415
+ };
1416
+ export type RunDataset = {
1345
1417
  id: string;
1346
1418
  visibility: DatasetVisibility;
1347
1419
  source: 'static' | 'computed';
1348
- /** 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. */
1349
1421
  digest: string;
1350
1422
  };
1351
1423
  export type CheckpointResult = {
@@ -1365,9 +1437,21 @@ export type CheckpointResult = {
1365
1437
  id: string;
1366
1438
  };
1367
1439
  };
1368
- /** Metrics EvalKit records for every trial; scenario metrics may not reuse these names. */
1369
- export declare const BUILT_IN_METRICS: readonly string[];
1370
- 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 = {
1371
1455
  results: ScoreResult[];
1372
1456
  metrics?: MetricResult[];
1373
1457
  checkpoints?: CheckpointResult[];
@@ -1376,40 +1460,34 @@ export type TrialScoring = {
1376
1460
  passed: boolean;
1377
1461
  };
1378
1462
  export type ArtifactEntry = {
1379
- /** Path relative to this trial's artifact root. */
1463
+ /** Path relative to this run's artifact root. */
1380
1464
  path: string;
1381
1465
  kind: 'file' | 'directory';
1382
1466
  size?: number;
1383
1467
  };
1384
- export type TrialSummary = {
1385
- status: RunStatus;
1386
- endedAt: string;
1387
- durationMs?: number;
1388
- scoring?: TrialScoring;
1389
- artifacts?: ArtifactEntry[];
1390
- 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;
1391
1475
  };
1392
1476
  export type RunSummary = {
1393
1477
  status: RunStatus;
1394
1478
  endedAt: string;
1395
1479
  durationMs?: number;
1396
- trialCount: number;
1397
- passed: number;
1398
- failed: number;
1399
- /** Trials stopped by cancellation; counted neither as passed nor failed. */
1400
- cancelled?: number;
1480
+ scoring?: RunScoring;
1481
+ artifacts?: ArtifactEntry[];
1482
+ attachments?: AttachmentEntry[];
1401
1483
  error?: RecordedError;
1402
1484
  };
1403
- export type TrialWriter = {
1404
- appendEvent(event: TrajectoryEvent): Promise<void>;
1405
- writeScores(scoring: TrialScoring): Promise<void>;
1406
- /** Writes a file below this trial's artifact root. */
1407
- writeArtifact(path: string, data: Uint8Array): Promise<void>;
1408
- finalize(summary: TrialSummary): Promise<void>;
1409
- };
1410
1485
  export type RunWriter = {
1411
1486
  readonly location: string;
1412
- 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>;
1413
1491
  finalize(summary: RunSummary): Promise<void>;
1414
1492
  };
1415
1493
  export type ReportStore = {
@@ -1417,35 +1495,18 @@ export type ReportStore = {
1417
1495
  catalog?: RunCatalog;
1418
1496
  }): Promise<RunWriter>;
1419
1497
  };
1420
- export type TrialResult = {
1498
+ /** One finished run, as `runEval` returns it. */
1499
+ export type RunResult = {
1421
1500
  runId: string;
1422
1501
  runUri: ResourceUri<'run'>;
1423
- trialId: string;
1424
- trialUri: ResourceUri<'trial'>;
1425
- trialIndex: number;
1426
1502
  evalId: string;
1427
1503
  status: RunStatus;
1504
+ batch?: Batch;
1428
1505
  reportLocation: string;
1429
1506
  durationMs?: number;
1430
- scoring?: TrialScoring;
1507
+ scoring?: RunScoring;
1431
1508
  error?: RecordedError;
1432
1509
  };
1433
- export type AggregateScoring = {
1434
- passed: number;
1435
- failed: number;
1436
- cancelled?: number;
1437
- passRate: number;
1438
- overall?: number;
1439
- };
1440
- export type RunResult = TrialResult & {
1441
- runId: string;
1442
- trialCount?: number;
1443
- passed?: number;
1444
- failed?: number;
1445
- aggregateScoring?: AggregateScoring;
1446
- /** Present for an aggregate multi-trial run. */
1447
- trials?: TrialResult[];
1448
- };
1449
1510
  export declare function recordError(error: unknown): RecordedError;
1450
1511
  //#endregion
1451
1512
  //#region ../agents/src/index.d.ts
@@ -1457,5 +1518,5 @@ type PiAutOptions = {
1457
1518
  /** A local, one-prompt-per-turn AUT backed by Pi's non-interactive print mode. */
1458
1519
  export declare function piAgent(options?: PiAutOptions): AutAdapter;
1459
1520
  //#endregion
1460
- export type { DefinitionSite, EvalMatrix, EvalMatrixCell, EvalkitConfig, KeepSandboxes, MatrixSelection, ShareConfig, ShareHeaders };
1521
+ export type { AttachmentLimits, DefinitionSite, EvalMatrix, EvalMatrixCell, EvalkitConfig, KeepSandboxes, MatrixSelection, ShareConfig, ShareHeaders, Usage };
1461
1522
  //# sourceMappingURL=index.d.mts.map