@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.
- package/CHANGELOG.md +46 -2
- package/README.md +2 -2
- package/dist/cli.mjs +386 -365
- package/dist/dashboard/assets/index-By1SJ1on.js +66 -0
- package/dist/dashboard/assets/index-geXMXCx9.css +2 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/{files-C-U0-PWW.mjs → files-DkDQs2JL.mjs} +3 -0
- package/dist/{index-db-vbqEGFaU.mjs → index-db-BbVblaHz.mjs} +333 -51
- package/dist/index.d.mts +220 -178
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/runner.d.mts +226 -168
- package/dist/runner.d.mts.map +1 -1
- package/dist/runner.mjs +2 -2
- package/dist/share-worker.d.mts +10 -3
- package/dist/share-worker.d.mts.map +1 -1
- package/dist/share-worker.mjs +6 -3
- package/dist/share.d.mts +49 -7
- package/dist/share.d.mts.map +1 -1
- package/dist/share.mjs +4 -4
- package/dist/skills/evalkit/SKILL.md +3 -3
- package/dist/skills/evalkit-agents/SKILL.md +5 -3
- package/dist/skills/evalkit-datasets/SKILL.md +5 -5
- package/dist/skills/evalkit-evals/SKILL.md +5 -5
- package/dist/skills/evalkit-judges/SKILL.md +5 -3
- package/dist/skills/evalkit-matrices/SKILL.md +2 -2
- package/dist/skills/evalkit-results/SKILL.md +6 -6
- package/dist/{src-CZnDXP1K.mjs → src-Bn6fnZnF.mjs} +8 -3
- package/dist/{src-LeGSyDD2.mjs → src-BrfIXfO2.mjs} +72 -54
- package/dist/{src-mm8L_IxM.mjs → src-CcdLZqFk.mjs} +422 -230
- package/dist/upgrade-60SIRius.mjs +110 -0
- package/package.json +1 -1
- package/dist/dashboard/assets/index-C12IeG2y.css +0 -2
- package/dist/dashboard/assets/index-xlVsW6ZR.js +0 -37
package/dist/runner.d.mts
CHANGED
|
@@ -41,13 +41,13 @@ export declare class CheckpointExecutionError extends CheckpointExecutionError_b
|
|
|
41
41
|
declare const CancelledError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
42
42
|
readonly _tag: "CancelledError";
|
|
43
43
|
} & Readonly<A>;
|
|
44
|
-
/** The run was cancelled (Ctrl+C); the
|
|
44
|
+
/** The run was cancelled (Ctrl+C); the run stops and is finalized as cancelled. */
|
|
45
45
|
export declare class CancelledError extends CancelledError_base<{
|
|
46
46
|
message: string;
|
|
47
47
|
}> {}
|
|
48
48
|
//#endregion
|
|
49
49
|
//#region ../core/src/identity.d.ts
|
|
50
|
-
declare const ResourceKindSchema: Schema.Literal<["run", "
|
|
50
|
+
declare const ResourceKindSchema: Schema.Literal<["run", "artifact"]>;
|
|
51
51
|
type ResourceKind = typeof ResourceKindSchema.Type;
|
|
52
52
|
type ResourceUri<TKind extends ResourceKind = ResourceKind> = `evalkit:${TKind}:${string}`;
|
|
53
53
|
//#endregion
|
|
@@ -59,14 +59,14 @@ type DatasetFileSource = string | Uint8Array | {
|
|
|
59
59
|
file: string;
|
|
60
60
|
};
|
|
61
61
|
/**
|
|
62
|
-
* Files for the
|
|
62
|
+
* Files for the run workspace: a directory relative to the project root, or
|
|
63
63
|
* a map from workspace path (below the dataset's mount) to its content.
|
|
64
64
|
*/
|
|
65
65
|
type DatasetFiles = string | Readonly<Record<string, DatasetFileSource>>;
|
|
66
|
-
/** What one
|
|
66
|
+
/** What one run receives from a dataset. */
|
|
67
67
|
type DatasetContent = {
|
|
68
68
|
files?: DatasetFiles;
|
|
69
|
-
/** Any JSON-convertible value; converted once when the
|
|
69
|
+
/** Any JSON-convertible value; converted once when the run starts. */
|
|
70
70
|
value?: unknown;
|
|
71
71
|
};
|
|
72
72
|
type DatasetLoadContext = {
|
|
@@ -74,12 +74,12 @@ type DatasetLoadContext = {
|
|
|
74
74
|
root: string;
|
|
75
75
|
signal: AbortSignal;
|
|
76
76
|
};
|
|
77
|
-
type
|
|
77
|
+
type DatasetRunContext = {
|
|
78
78
|
evalId: string;
|
|
79
79
|
runId: string;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
/** Per-
|
|
80
|
+
/** Set when the run is one of several repeats launched together. */
|
|
81
|
+
batch?: Batch;
|
|
82
|
+
/** Per-run random seed, so repeated runs can choose different data. */
|
|
83
83
|
seed: number;
|
|
84
84
|
/** The matrix cell's parameters, or `{}`. */
|
|
85
85
|
parameters: JsonObject;
|
|
@@ -93,7 +93,7 @@ type DatasetSource = {
|
|
|
93
93
|
} | {
|
|
94
94
|
kind: 'computed';
|
|
95
95
|
onLoad: (load: DatasetLoadContext) => DatasetContent | Promise<DatasetContent>;
|
|
96
|
-
onRun?: (loaded: DatasetContent,
|
|
96
|
+
onRun?: (loaded: DatasetContent, run: DatasetRunContext) => DatasetContent | Promise<DatasetContent>;
|
|
97
97
|
};
|
|
98
98
|
/** A checked dataset, as returned by `defineDataset`. Evals accept only these. */
|
|
99
99
|
type Dataset = {
|
|
@@ -222,7 +222,7 @@ type EvalCatalogScorer = {
|
|
|
222
222
|
definedAt?: string;
|
|
223
223
|
};
|
|
224
224
|
type EvalCatalogStep =
|
|
225
|
-
/** `message` is absent when it is computed for each
|
|
225
|
+
/** `message` is absent when it is computed for each run. */
|
|
226
226
|
{
|
|
227
227
|
kind: 'user';
|
|
228
228
|
message?: string;
|
|
@@ -248,9 +248,9 @@ type EvalCatalogEntry = {
|
|
|
248
248
|
/** The separate agent that runs judge rules, if any. */
|
|
249
249
|
judgeAgent?: EvalCatalogAgent;
|
|
250
250
|
datasets: EvalCatalogDataset[];
|
|
251
|
-
|
|
251
|
+
/** Runs started each time the scenario runs (`repeat`). */
|
|
252
|
+
repeat: number;
|
|
252
253
|
policy: {
|
|
253
|
-
trials: number;
|
|
254
254
|
timeoutMs?: number;
|
|
255
255
|
failfast?: boolean;
|
|
256
256
|
};
|
|
@@ -296,6 +296,32 @@ type EvalMatrix = EvalMatrixDefinition & {
|
|
|
296
296
|
//#endregion
|
|
297
297
|
//#region ../core/src/config.d.ts
|
|
298
298
|
type KeepSandboxes = 'failed' | 'all' | 'none';
|
|
299
|
+
type AttachmentLimits = {
|
|
300
|
+
/** A larger attachment keeps its last this-many bytes. Default 5 MB. */
|
|
301
|
+
maxFileBytes?: number;
|
|
302
|
+
/** All of one run's attachments; past it, `attach()` rejects. Default 20 MB. */
|
|
303
|
+
maxRunBytes?: number;
|
|
304
|
+
};
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region ../core/src/usage.d.ts
|
|
307
|
+
/**
|
|
308
|
+
* Token usage an agent reports for one turn. EvalKit never measures or infers
|
|
309
|
+
* it; adapters copy it from their provider.
|
|
310
|
+
*/
|
|
311
|
+
type Usage = {
|
|
312
|
+
/**
|
|
313
|
+
* Every input token the model read this turn: the prompt, history and tool
|
|
314
|
+
* results, **including** tokens read from or written to a prompt cache.
|
|
315
|
+
* (Some providers report cached tokens separately; add them in.)
|
|
316
|
+
*/
|
|
317
|
+
inputTokens?: number;
|
|
318
|
+
/** Every token the model produced, including reasoning tokens. */
|
|
319
|
+
outputTokens?: number;
|
|
320
|
+
/** Of `inputTokens`, how many were read from a prompt cache. Informational. */
|
|
321
|
+
cachedInputTokens?: number;
|
|
322
|
+
/** The provider's own total; used only when input and output are not reported. */
|
|
323
|
+
totalTokens?: number;
|
|
324
|
+
};
|
|
299
325
|
//#endregion
|
|
300
326
|
//#region ../core/src/index.d.ts
|
|
301
327
|
type JsonPrimitive = boolean | number | string | null;
|
|
@@ -322,11 +348,6 @@ type AgentRuntime = {
|
|
|
322
348
|
configuration?: JsonObject;
|
|
323
349
|
};
|
|
324
350
|
type AgentRuntimes = Partial<Record<AgentRuntimeName, AgentRuntime>>;
|
|
325
|
-
type Usage = {
|
|
326
|
-
inputTokens?: number;
|
|
327
|
-
outputTokens?: number;
|
|
328
|
-
totalTokens?: number;
|
|
329
|
-
};
|
|
330
351
|
type RecordedError = {
|
|
331
352
|
name: string;
|
|
332
353
|
message: string;
|
|
@@ -372,7 +393,7 @@ type AutEvent = {
|
|
|
372
393
|
timestamp: string;
|
|
373
394
|
};
|
|
374
395
|
type RunnerEvent = {
|
|
375
|
-
kind: '
|
|
396
|
+
kind: 'run-started';
|
|
376
397
|
timestamp: string;
|
|
377
398
|
} | {
|
|
378
399
|
kind: 'transcript-step-started';
|
|
@@ -420,7 +441,7 @@ type RunnerEvent = {
|
|
|
420
441
|
error: RecordedError;
|
|
421
442
|
timestamp: string;
|
|
422
443
|
} | {
|
|
423
|
-
kind: '
|
|
444
|
+
kind: 'run-completed';
|
|
424
445
|
timestamp: string;
|
|
425
446
|
} | {
|
|
426
447
|
kind: 'error';
|
|
@@ -433,7 +454,7 @@ type TrajectoryEvent = (AutEvent & {
|
|
|
433
454
|
source: 'runner';
|
|
434
455
|
});
|
|
435
456
|
type WorkspaceView = {
|
|
436
|
-
/** Absolute path to this
|
|
457
|
+
/** Absolute path to this run-scoped workspace. Do not persist it in reports. */
|
|
437
458
|
root: string;
|
|
438
459
|
};
|
|
439
460
|
type CandidateWorkspace = WorkspaceView;
|
|
@@ -441,8 +462,8 @@ type EvaluatorWorkspace = WorkspaceView;
|
|
|
441
462
|
type AutContext = {
|
|
442
463
|
runId: string;
|
|
443
464
|
evalId: string;
|
|
444
|
-
|
|
445
|
-
|
|
465
|
+
/** Set when this run is one of several repeats launched together. */
|
|
466
|
+
batch?: Batch;
|
|
446
467
|
metadata: JsonObject;
|
|
447
468
|
/** Run-time parameters supplied by the eval definition or CLI invocation. */
|
|
448
469
|
parameters?: JsonObject;
|
|
@@ -463,6 +484,14 @@ type AutAdapter<TMessage = string> = {
|
|
|
463
484
|
runtime?: AgentRuntime;
|
|
464
485
|
/** Optional: stream events as they happen. Returning a turn result from `send` is enough for most agents. */
|
|
465
486
|
onEvent: (event: AutEventInput) => void | Promise<void>;
|
|
487
|
+
/**
|
|
488
|
+
* Saves a file with the run's results, such as the agent's raw log,
|
|
489
|
+
* whether or not its sandbox is kept. `name` is a relative path of
|
|
490
|
+
* letters, digits, `.`, `_` and `-` (`logs/agent.log`); each name once.
|
|
491
|
+
* A file over the size limit keeps its last bytes; past the run's
|
|
492
|
+
* total limit it is rejected. See `artifacts.attachments` in the config.
|
|
493
|
+
*/
|
|
494
|
+
attach: (name: string, content: string | Uint8Array) => Promise<void>;
|
|
466
495
|
}): Promise<AutSession<TMessage>>;
|
|
467
496
|
};
|
|
468
497
|
type AutSession<TMessage = string> = {
|
|
@@ -480,13 +509,14 @@ type UserMessageInput = {
|
|
|
480
509
|
parameters: JsonObject;
|
|
481
510
|
/** Values of the scenario's candidate datasets, by dataset ID (never evaluator ones). */
|
|
482
511
|
data: JsonObject;
|
|
483
|
-
/** The
|
|
512
|
+
/** The run's random seed (also in `context.metadata.randomSeed`). */
|
|
484
513
|
seed: number;
|
|
485
|
-
|
|
514
|
+
/** Set when this run is one of several repeats launched together. */
|
|
515
|
+
batch?: Batch;
|
|
486
516
|
};
|
|
487
517
|
type UserStep = {
|
|
488
518
|
kind: 'user';
|
|
489
|
-
/** A fixed message, or one computed for each
|
|
519
|
+
/** A fixed message, or one computed for each run. */
|
|
490
520
|
message: string | ((input: UserMessageInput) => string);
|
|
491
521
|
};
|
|
492
522
|
type AgentStep = {
|
|
@@ -534,12 +564,15 @@ type SkippedScore = {
|
|
|
534
564
|
skipped: true;
|
|
535
565
|
reason: string;
|
|
536
566
|
};
|
|
537
|
-
type ScoreValue = number | SkippedScore | {
|
|
567
|
+
type ScoreValue<Evidence = unknown> = number | SkippedScore | {
|
|
538
568
|
value: number;
|
|
539
569
|
passed?: boolean;
|
|
540
570
|
explanation?: string;
|
|
541
|
-
/**
|
|
542
|
-
|
|
571
|
+
/**
|
|
572
|
+
* Any JSON-convertible value: what the scorer observed. A checkpoint's
|
|
573
|
+
* evidence reaches later scorers through `checkpoint(rule)`.
|
|
574
|
+
*/
|
|
575
|
+
evidence?: Evidence;
|
|
543
576
|
/** Judge-agent evidence, never inferred from AUT usage. */
|
|
544
577
|
judge?: JudgeRunInfo;
|
|
545
578
|
};
|
|
@@ -578,14 +611,36 @@ type ScoringContext = {
|
|
|
578
611
|
* example, in a container that is gone by final scoring).
|
|
579
612
|
*/
|
|
580
613
|
checkpoints: readonly CheckpointResult[];
|
|
614
|
+
/**
|
|
615
|
+
* The latest result of a checkpoint in this scenario's transcript, looked
|
|
616
|
+
* up by the rule itself, so renaming it cannot break the lookup. A
|
|
617
|
+
* predicate's `evidence` keeps its type. Undefined until that step has
|
|
618
|
+
* run; throws for a rule that is not in the transcript.
|
|
619
|
+
*/
|
|
620
|
+
checkpoint<Evidence>(rule: PredicateScorer<Evidence>): CheckpointOutcome<Evidence> | undefined;
|
|
621
|
+
checkpoint(rule: JudgeRule | ExpectToolCallStep): CheckpointOutcome<JsonValue> | undefined;
|
|
622
|
+
/**
|
|
623
|
+
* Saves a file with the run's results, like the agent's `attach()`: for
|
|
624
|
+
* example a container's log, or a file the agent reported, read before the
|
|
625
|
+
* workspace is gone. Same names, limits and rules.
|
|
626
|
+
*/
|
|
627
|
+
attach(name: string, content: string | Uint8Array): Promise<void>;
|
|
628
|
+
};
|
|
629
|
+
/**
|
|
630
|
+
* A checkpoint's result with typed evidence. Evidence is saved as JSON, so
|
|
631
|
+
* it arrives as its JSON form: a `Date` becomes a string, `undefined` fields
|
|
632
|
+
* are dropped.
|
|
633
|
+
*/
|
|
634
|
+
type CheckpointOutcome<Evidence> = Omit<CheckpointResult, 'evidence'> & {
|
|
635
|
+
evidence?: Evidence;
|
|
581
636
|
};
|
|
582
|
-
type PredicateScorer = {
|
|
637
|
+
type PredicateScorer<Evidence = unknown> = {
|
|
583
638
|
kind: 'predicate';
|
|
584
639
|
name: string;
|
|
585
640
|
supportsPartial?: boolean;
|
|
586
641
|
/** A numeric result passes when it is at least this value. Default: only 1 passes. */
|
|
587
642
|
passAt?: number;
|
|
588
|
-
run(context: ScoringContext): boolean | ScoreValue | Promise<boolean | ScoreValue
|
|
643
|
+
run(context: ScoringContext): boolean | ScoreValue<Evidence> | Promise<boolean | ScoreValue<Evidence>>;
|
|
589
644
|
};
|
|
590
645
|
type JudgeRule = {
|
|
591
646
|
kind: 'judge';
|
|
@@ -596,7 +651,7 @@ type JudgeRule = {
|
|
|
596
651
|
};
|
|
597
652
|
type ScoringRule = PredicateScorer | JudgeRule;
|
|
598
653
|
/**
|
|
599
|
-
* A number measured for every
|
|
654
|
+
* A number measured for every run, such as tokens, retries or web searches.
|
|
600
655
|
* Metrics never decide pass or fail; they are averaged per run and shown on
|
|
601
656
|
* the scoreboard. Return undefined when there is nothing to measure.
|
|
602
657
|
*/
|
|
@@ -609,9 +664,9 @@ type Metric = {
|
|
|
609
664
|
better?: 'lower' | 'higher';
|
|
610
665
|
run(context: ScoringContext): number | undefined | Promise<number | undefined>;
|
|
611
666
|
};
|
|
612
|
-
/** A metric's value for one
|
|
667
|
+
/** A metric's value for one run. */
|
|
613
668
|
type MetricResult = {
|
|
614
|
-
name:
|
|
669
|
+
name: MetricName;
|
|
615
670
|
/** Absent when the metric measured nothing or failed. */
|
|
616
671
|
value?: number;
|
|
617
672
|
unit?: string;
|
|
@@ -624,8 +679,6 @@ type EvalPolicy = {
|
|
|
624
679
|
timeoutMs?: number;
|
|
625
680
|
/** Stop later transcript steps after a failed checkpoint assertion. Default false. */
|
|
626
681
|
failfast?: boolean;
|
|
627
|
-
/** Number of independent trials requested by local and hosted runners. */
|
|
628
|
-
trials?: number;
|
|
629
682
|
};
|
|
630
683
|
type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
|
|
631
684
|
id: string;
|
|
@@ -633,13 +686,18 @@ type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
|
|
|
633
686
|
agent: TAgent;
|
|
634
687
|
/** Separate judge agent; its model and tools are never inherited from the AUT. */
|
|
635
688
|
judge?: AutAdapter;
|
|
636
|
-
/** Data and files the scenario uses; each
|
|
689
|
+
/** Data and files the scenario uses; each run gets its own copy. */
|
|
637
690
|
datasets?: readonly Dataset[];
|
|
638
691
|
transcript: TranscriptStep[];
|
|
639
692
|
scoring: ScoringRule[];
|
|
640
|
-
/** Numbers to measure for every
|
|
693
|
+
/** Numbers to measure for every run; they never affect pass or fail. */
|
|
641
694
|
metrics?: readonly Metric[];
|
|
642
695
|
policy?: EvalPolicy;
|
|
696
|
+
/**
|
|
697
|
+
* How many runs to start each time the scenario runs, as one batch: repeats
|
|
698
|
+
* under identical conditions, to see how often it passes. Default 1.
|
|
699
|
+
*/
|
|
700
|
+
repeat?: number;
|
|
643
701
|
/** Any JSON-convertible object; converted when the eval is defined. */
|
|
644
702
|
metadata?: Record<string, unknown>;
|
|
645
703
|
workspace?: EvalWorkspace;
|
|
@@ -647,7 +705,7 @@ type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
|
|
|
647
705
|
/** How EvalKit treats this scenario's candidate workspace. */
|
|
648
706
|
type EvalWorkspace = {
|
|
649
707
|
/**
|
|
650
|
-
* Paths to leave out of the
|
|
708
|
+
* Paths to leave out of the run's snapshot, read like `.gitignore`: globs
|
|
651
709
|
* relative to the workspace, where a pattern without `/` matches that name
|
|
652
710
|
* at any depth and later patterns win. They come after the project's
|
|
653
711
|
* `artifacts.exclude` (default `DEFAULT_ARTIFACT_EXCLUDE`), so `!pattern`
|
|
@@ -666,7 +724,18 @@ type EvalSuiteMetadata = {
|
|
|
666
724
|
name?: string;
|
|
667
725
|
evalIds: string[];
|
|
668
726
|
};
|
|
669
|
-
|
|
727
|
+
/**
|
|
728
|
+
* How a run ended: `passed` or `failed` by its scores, `errored` when it could
|
|
729
|
+
* not finish (the agent, a dataset or EvalKit failed), `cancelled` by Ctrl+C.
|
|
730
|
+
*/
|
|
731
|
+
type RunStatus = 'running' | 'passed' | 'failed' | 'errored' | 'cancelled';
|
|
732
|
+
/** Runs launched together as repeats of one configuration (`repeat`). */
|
|
733
|
+
type Batch = {
|
|
734
|
+
id: string;
|
|
735
|
+
/** Zero-based position in the batch. */
|
|
736
|
+
index: number;
|
|
737
|
+
size: number;
|
|
738
|
+
};
|
|
670
739
|
/**
|
|
671
740
|
* Where a run's eval code came from: the repository, eval project and commit.
|
|
672
741
|
* Results are tagged with it; they are never stored in the repository itself.
|
|
@@ -701,7 +770,7 @@ type RunProcess = {
|
|
|
701
770
|
hostname: string;
|
|
702
771
|
};
|
|
703
772
|
type RunMetadata = {
|
|
704
|
-
schemaVersion:
|
|
773
|
+
schemaVersion: 6;
|
|
705
774
|
runId: string;
|
|
706
775
|
runUri: ResourceUri<'run'>;
|
|
707
776
|
evalId: string;
|
|
@@ -713,36 +782,21 @@ type RunMetadata = {
|
|
|
713
782
|
};
|
|
714
783
|
aut?: AutIdentity;
|
|
715
784
|
startedAt: string;
|
|
716
|
-
/** Present
|
|
785
|
+
/** Present when the run's commit could be determined. */
|
|
717
786
|
source?: RunSource;
|
|
718
|
-
/** From schema version 5. */
|
|
719
787
|
process?: RunProcess;
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
schemaVersion: 2 | 3 | 4 | 5;
|
|
723
|
-
runId: string;
|
|
724
|
-
runUri: ResourceUri<'run'>;
|
|
725
|
-
trialId: string;
|
|
726
|
-
trialUri: ResourceUri<'trial'>;
|
|
727
|
-
trialIndex: number;
|
|
728
|
-
evalId: string;
|
|
729
|
-
parameters?: JsonObject;
|
|
730
|
-
matrix?: {
|
|
731
|
-
id: string;
|
|
732
|
-
cellKey: string;
|
|
733
|
-
};
|
|
734
|
-
aut?: AutIdentity;
|
|
735
|
-
startedAt: string;
|
|
788
|
+
/** Set when this run is one of several repeats launched together. */
|
|
789
|
+
batch?: Batch;
|
|
736
790
|
/** The effective snapshot ignore patterns: the project's `artifacts.exclude`, then the scenario's `workspace.ignore`. */
|
|
737
791
|
workspaceIgnore?: string[];
|
|
738
|
-
/**
|
|
739
|
-
datasets?:
|
|
792
|
+
/** The datasets this run used, with content digests. */
|
|
793
|
+
datasets?: RunDataset[];
|
|
740
794
|
};
|
|
741
|
-
type
|
|
795
|
+
type RunDataset = {
|
|
742
796
|
id: string;
|
|
743
797
|
visibility: DatasetVisibility;
|
|
744
798
|
source: 'static' | 'computed';
|
|
745
|
-
/** SHA-256 of the
|
|
799
|
+
/** SHA-256 of the run's content: file paths and bytes, and the canonical value. */
|
|
746
800
|
digest: string;
|
|
747
801
|
};
|
|
748
802
|
type CheckpointResult = {
|
|
@@ -762,7 +816,21 @@ type CheckpointResult = {
|
|
|
762
816
|
id: string;
|
|
763
817
|
};
|
|
764
818
|
};
|
|
765
|
-
|
|
819
|
+
/**
|
|
820
|
+
* Metrics EvalKit records for every run; scenario metrics may not reuse
|
|
821
|
+
* these names.
|
|
822
|
+
*
|
|
823
|
+
* - `agent time` (ms): from the run's first event to its last one before
|
|
824
|
+
* final scoring.
|
|
825
|
+
* - `tokens`: the sum of `turnTokens(usage)` over the turns that reported
|
|
826
|
+
* usage, cached input included. Absent when no turn reported any.
|
|
827
|
+
* - `tool calls`: the agent's `tool-call` events.
|
|
828
|
+
*/
|
|
829
|
+
declare const BUILT_IN_METRICS: readonly ['agent time', 'tokens', 'tool calls'];
|
|
830
|
+
type BuiltInMetricName = (typeof BUILT_IN_METRICS)[number];
|
|
831
|
+
/** A built-in metric's name (suggested by editors), or a scenario's own. */
|
|
832
|
+
type MetricName = BuiltInMetricName | (string & {});
|
|
833
|
+
type RunScoring = {
|
|
766
834
|
results: ScoreResult[];
|
|
767
835
|
metrics?: MetricResult[];
|
|
768
836
|
checkpoints?: CheckpointResult[];
|
|
@@ -771,40 +839,34 @@ type TrialScoring = {
|
|
|
771
839
|
passed: boolean;
|
|
772
840
|
};
|
|
773
841
|
type ArtifactEntry = {
|
|
774
|
-
/** Path relative to this
|
|
842
|
+
/** Path relative to this run's artifact root. */
|
|
775
843
|
path: string;
|
|
776
844
|
kind: 'file' | 'directory';
|
|
777
845
|
size?: number;
|
|
778
846
|
};
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
847
|
+
/** A file an adapter attached with `attach()`, saved as `artifacts/attachments/<name>`. */
|
|
848
|
+
type AttachmentEntry = {
|
|
849
|
+
name: string;
|
|
850
|
+
/** Bytes saved. */
|
|
851
|
+
size: number;
|
|
852
|
+
/** The original size, when the file was cut to its last `maxFileBytes`. */
|
|
853
|
+
truncatedFrom?: number;
|
|
786
854
|
};
|
|
787
855
|
type RunSummary = {
|
|
788
856
|
status: RunStatus;
|
|
789
857
|
endedAt: string;
|
|
790
858
|
durationMs?: number;
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
/** Trials stopped by cancellation; counted neither as passed nor failed. */
|
|
795
|
-
cancelled?: number;
|
|
859
|
+
scoring?: RunScoring;
|
|
860
|
+
artifacts?: ArtifactEntry[];
|
|
861
|
+
attachments?: AttachmentEntry[];
|
|
796
862
|
error?: RecordedError;
|
|
797
863
|
};
|
|
798
|
-
type TrialWriter = {
|
|
799
|
-
appendEvent(event: TrajectoryEvent): Promise<void>;
|
|
800
|
-
writeScores(scoring: TrialScoring): Promise<void>;
|
|
801
|
-
/** Writes a file below this trial's artifact root. */
|
|
802
|
-
writeArtifact(path: string, data: Uint8Array): Promise<void>;
|
|
803
|
-
finalize(summary: TrialSummary): Promise<void>;
|
|
804
|
-
};
|
|
805
864
|
type RunWriter = {
|
|
806
865
|
readonly location: string;
|
|
807
|
-
|
|
866
|
+
appendEvent(event: TrajectoryEvent): Promise<void>;
|
|
867
|
+
writeScores(scoring: RunScoring): Promise<void>;
|
|
868
|
+
/** Writes a file below this run's artifact root. */
|
|
869
|
+
writeArtifact(path: string, data: Uint8Array): Promise<void>;
|
|
808
870
|
finalize(summary: RunSummary): Promise<void>;
|
|
809
871
|
};
|
|
810
872
|
type ReportStore = {
|
|
@@ -812,35 +874,18 @@ type ReportStore = {
|
|
|
812
874
|
catalog?: RunCatalog;
|
|
813
875
|
}): Promise<RunWriter>;
|
|
814
876
|
};
|
|
815
|
-
|
|
877
|
+
/** One finished run, as `runEval` returns it. */
|
|
878
|
+
type RunResult = {
|
|
816
879
|
runId: string;
|
|
817
880
|
runUri: ResourceUri<'run'>;
|
|
818
|
-
trialId: string;
|
|
819
|
-
trialUri: ResourceUri<'trial'>;
|
|
820
|
-
trialIndex: number;
|
|
821
881
|
evalId: string;
|
|
822
882
|
status: RunStatus;
|
|
883
|
+
batch?: Batch;
|
|
823
884
|
reportLocation: string;
|
|
824
885
|
durationMs?: number;
|
|
825
|
-
scoring?:
|
|
886
|
+
scoring?: RunScoring;
|
|
826
887
|
error?: RecordedError;
|
|
827
888
|
};
|
|
828
|
-
type AggregateScoring = {
|
|
829
|
-
passed: number;
|
|
830
|
-
failed: number;
|
|
831
|
-
cancelled?: number;
|
|
832
|
-
passRate: number;
|
|
833
|
-
overall?: number;
|
|
834
|
-
};
|
|
835
|
-
type RunResult = TrialResult & {
|
|
836
|
-
runId: string;
|
|
837
|
-
trialCount?: number;
|
|
838
|
-
passed?: number;
|
|
839
|
-
failed?: number;
|
|
840
|
-
aggregateScoring?: AggregateScoring;
|
|
841
|
-
/** Present for an aggregate multi-trial run. */
|
|
842
|
-
trials?: TrialResult[];
|
|
843
|
-
};
|
|
844
889
|
//#endregion
|
|
845
890
|
//#region ../runner/src/local-report-store.d.ts
|
|
846
891
|
/** Persists each run as a local tree rooted below `rootDirectory`. */
|
|
@@ -863,7 +908,7 @@ export declare function staticDatasetFile(dataset: Dataset, root: string, file:
|
|
|
863
908
|
//#endregion
|
|
864
909
|
//#region ../runner/src/local-report-reader.d.ts
|
|
865
910
|
export declare const readRunManifest: (root: string, runId: string) => Promise<{
|
|
866
|
-
readonly schemaVersion:
|
|
911
|
+
readonly schemaVersion: 6;
|
|
867
912
|
readonly runUri: string;
|
|
868
913
|
readonly evalId: string;
|
|
869
914
|
readonly suiteId?: string | undefined;
|
|
@@ -899,42 +944,11 @@ export declare const readRunManifest: (root: string, runId: string) => Promise<{
|
|
|
899
944
|
readonly pid: number;
|
|
900
945
|
readonly hostname: string;
|
|
901
946
|
} | undefined;
|
|
902
|
-
readonly
|
|
903
|
-
}>;
|
|
904
|
-
export declare const readRunSummary: (root: string, runId: string) => Promise<{
|
|
905
|
-
readonly status: "cancelled" | "completed" | "failed" | "running";
|
|
906
|
-
readonly endedAt: string;
|
|
907
|
-
readonly durationMs?: number | undefined;
|
|
908
|
-
readonly trialCount: number;
|
|
909
|
-
readonly passed: number;
|
|
910
|
-
readonly failed: number;
|
|
911
|
-
readonly cancelled?: number | undefined;
|
|
912
|
-
readonly error?: {
|
|
913
|
-
readonly name: string;
|
|
914
|
-
readonly message: string;
|
|
915
|
-
readonly stack?: string | undefined;
|
|
916
|
-
} | undefined;
|
|
917
|
-
}>;
|
|
918
|
-
export declare const readTrialManifest: (root: string, runId: string, trialId: string) => Promise<{
|
|
919
|
-
readonly schemaVersion: 2 | 3 | 4 | 5;
|
|
920
|
-
readonly runUri: string;
|
|
921
|
-
readonly trialUri: string;
|
|
922
|
-
readonly trialIndex: number;
|
|
923
|
-
readonly evalId: string;
|
|
924
|
-
readonly parameters?: {
|
|
925
|
-
readonly [x: string]: JsonValue;
|
|
926
|
-
} | undefined;
|
|
927
|
-
readonly matrix?: {
|
|
947
|
+
readonly batch?: {
|
|
928
948
|
readonly id: string;
|
|
929
|
-
readonly
|
|
949
|
+
readonly index: number;
|
|
950
|
+
readonly size: number;
|
|
930
951
|
} | undefined;
|
|
931
|
-
readonly aut?: {
|
|
932
|
-
readonly name?: string | undefined;
|
|
933
|
-
readonly kind: string;
|
|
934
|
-
readonly id: string;
|
|
935
|
-
readonly version?: string | undefined;
|
|
936
|
-
} | undefined;
|
|
937
|
-
readonly startedAt: string;
|
|
938
952
|
readonly workspaceIgnore?: string[] | undefined;
|
|
939
953
|
readonly datasets?: {
|
|
940
954
|
readonly id: string;
|
|
@@ -942,10 +956,10 @@ export declare const readTrialManifest: (root: string, runId: string, trialId: s
|
|
|
942
956
|
readonly source: "computed" | "static";
|
|
943
957
|
readonly digest: string;
|
|
944
958
|
}[] | undefined;
|
|
945
|
-
readonly status?: "cancelled" | "
|
|
959
|
+
readonly status?: "cancelled" | "errored" | "failed" | "passed" | "running" | undefined;
|
|
946
960
|
}>;
|
|
947
|
-
export declare const
|
|
948
|
-
readonly status: "cancelled" | "
|
|
961
|
+
export declare const readRunSummary: (root: string, runId: string) => Promise<{
|
|
962
|
+
readonly status: "cancelled" | "errored" | "failed" | "passed" | "running";
|
|
949
963
|
readonly endedAt: string;
|
|
950
964
|
readonly durationMs?: number | undefined;
|
|
951
965
|
readonly scoring?: {
|
|
@@ -966,6 +980,7 @@ export declare const readTrialSummary: (root: string, runId: string, trialId: st
|
|
|
966
980
|
readonly usage?: {
|
|
967
981
|
readonly inputTokens?: number | undefined;
|
|
968
982
|
readonly outputTokens?: number | undefined;
|
|
983
|
+
readonly cachedInputTokens?: number | undefined;
|
|
969
984
|
readonly totalTokens?: number | undefined;
|
|
970
985
|
} | undefined;
|
|
971
986
|
readonly events?: JsonValue[] | undefined;
|
|
@@ -1009,6 +1024,7 @@ export declare const readTrialSummary: (root: string, runId: string, trialId: st
|
|
|
1009
1024
|
readonly usage?: {
|
|
1010
1025
|
readonly inputTokens?: number | undefined;
|
|
1011
1026
|
readonly outputTokens?: number | undefined;
|
|
1027
|
+
readonly cachedInputTokens?: number | undefined;
|
|
1012
1028
|
readonly totalTokens?: number | undefined;
|
|
1013
1029
|
} | undefined;
|
|
1014
1030
|
readonly events?: JsonValue[] | undefined;
|
|
@@ -1033,13 +1049,18 @@ export declare const readTrialSummary: (root: string, runId: string, trialId: st
|
|
|
1033
1049
|
readonly kind: "directory" | "file";
|
|
1034
1050
|
readonly size?: number | undefined;
|
|
1035
1051
|
}[] | undefined;
|
|
1052
|
+
readonly attachments?: {
|
|
1053
|
+
readonly name: string;
|
|
1054
|
+
readonly size: number;
|
|
1055
|
+
readonly truncatedFrom?: number | undefined;
|
|
1056
|
+
}[] | undefined;
|
|
1036
1057
|
readonly error?: {
|
|
1037
1058
|
readonly name: string;
|
|
1038
1059
|
readonly message: string;
|
|
1039
1060
|
readonly stack?: string | undefined;
|
|
1040
1061
|
} | undefined;
|
|
1041
1062
|
}>;
|
|
1042
|
-
export declare const
|
|
1063
|
+
export declare const readRunScoring: (root: string, runId: string) => Promise<{
|
|
1043
1064
|
readonly results: {
|
|
1044
1065
|
readonly name: string;
|
|
1045
1066
|
readonly kind: "judge" | "predicate";
|
|
@@ -1057,6 +1078,7 @@ export declare const readTrialScoring: (root: string, runId: string, trialId: st
|
|
|
1057
1078
|
readonly usage?: {
|
|
1058
1079
|
readonly inputTokens?: number | undefined;
|
|
1059
1080
|
readonly outputTokens?: number | undefined;
|
|
1081
|
+
readonly cachedInputTokens?: number | undefined;
|
|
1060
1082
|
readonly totalTokens?: number | undefined;
|
|
1061
1083
|
} | undefined;
|
|
1062
1084
|
readonly events?: JsonValue[] | undefined;
|
|
@@ -1100,6 +1122,7 @@ export declare const readTrialScoring: (root: string, runId: string, trialId: st
|
|
|
1100
1122
|
readonly usage?: {
|
|
1101
1123
|
readonly inputTokens?: number | undefined;
|
|
1102
1124
|
readonly outputTokens?: number | undefined;
|
|
1125
|
+
readonly cachedInputTokens?: number | undefined;
|
|
1103
1126
|
readonly totalTokens?: number | undefined;
|
|
1104
1127
|
} | undefined;
|
|
1105
1128
|
readonly events?: JsonValue[] | undefined;
|
|
@@ -1119,7 +1142,7 @@ export declare const readTrialScoring: (root: string, runId: string, trialId: st
|
|
|
1119
1142
|
readonly overall?: number | undefined;
|
|
1120
1143
|
readonly passed: boolean;
|
|
1121
1144
|
}>;
|
|
1122
|
-
export declare function
|
|
1145
|
+
export declare function readRunEvents(root: string, runId: string): Promise<TrajectoryEvent[]>;
|
|
1123
1146
|
/**
|
|
1124
1147
|
* True when a run's owning process is known to be gone: it ran on this host
|
|
1125
1148
|
* and its PID no longer exists. Runs from other hosts are never judged.
|
|
@@ -1127,52 +1150,84 @@ export declare function readTrialEvents(root: string, runId: string, trialId: st
|
|
|
1127
1150
|
export declare function ownerIsGone(owner: RunProcess | undefined): boolean;
|
|
1128
1151
|
//#endregion
|
|
1129
1152
|
//#region ../runner/src/matrix.d.ts
|
|
1130
|
-
/** Cells
|
|
1153
|
+
/** Cells and runs; a run that errored counts as failed, a cancelled one as neither. */
|
|
1131
1154
|
type MatrixSummary = {
|
|
1132
1155
|
cells: number;
|
|
1156
|
+
runs: number;
|
|
1133
1157
|
passed: number;
|
|
1134
1158
|
failed: number;
|
|
1135
1159
|
cancelled: number;
|
|
1136
1160
|
};
|
|
1137
1161
|
/** Bounded workers pull cells from the iterator; no Cartesian job array is allocated. */
|
|
1138
|
-
export declare function runMatrix(matrix: EvalMatrix, options: Omit<RunEvalOptions, 'runId' | '
|
|
1162
|
+
export declare function runMatrix(matrix: EvalMatrix, options: Omit<RunEvalOptions, 'runId' | 'parameters' | 'matrix'> & {
|
|
1139
1163
|
selection?: MatrixSelection;
|
|
1140
1164
|
/** The suite each cell's run is recorded under, when `suiteId` is not given. */
|
|
1141
1165
|
suiteFor?: (cell: EvalMatrixCell) => string | undefined;
|
|
1142
|
-
onResult?: (cell: EvalMatrixCell,
|
|
1166
|
+
onResult?: (cell: EvalMatrixCell, runs: readonly RunResult[]) => void | Promise<void>;
|
|
1143
1167
|
}): Effect.Effect<MatrixSummary, unknown>;
|
|
1144
1168
|
//#endregion
|
|
1169
|
+
//#region ../runner/src/upgrade.d.ts
|
|
1170
|
+
/** What upgrading a results folder did, or would do with `dryRun`. */
|
|
1171
|
+
type UpgradeReport = {
|
|
1172
|
+
/** Old runs converted (or that would be). */
|
|
1173
|
+
upgraded: number;
|
|
1174
|
+
/** Version 6 runs they became. */
|
|
1175
|
+
runs: number;
|
|
1176
|
+
/** Old runs with more than one trial: each trial became a run in a batch. */
|
|
1177
|
+
batches: number;
|
|
1178
|
+
/** Old runs left alone because they are still running. */
|
|
1179
|
+
running: string[];
|
|
1180
|
+
};
|
|
1181
|
+
/**
|
|
1182
|
+
* Rewrites results from report schema versions 2 to 5 into version 6, in
|
|
1183
|
+
* place (RFD0008). An old run of one trial (most of them) becomes a run with
|
|
1184
|
+
* the same ID, so links to it keep working. An old run of several trials
|
|
1185
|
+
* becomes runs with the trials' IDs, in a batch with the old run's ID.
|
|
1186
|
+
*
|
|
1187
|
+
* Each new run is written under a temporary name and renamed into place;
|
|
1188
|
+
* artifacts are moved, not copied, as the last step before that rename. An
|
|
1189
|
+
* old run is removed only after its new runs exist, and one replaced under
|
|
1190
|
+
* the same ID is set aside first, so a crash at any point leaves the old run
|
|
1191
|
+
* or complete new ones, and re-running finishes the job. Version 6 runs are
|
|
1192
|
+
* left alone.
|
|
1193
|
+
*/
|
|
1194
|
+
export declare function upgradeReports(root: string, options?: {
|
|
1195
|
+
dryRun?: boolean;
|
|
1196
|
+
}): Promise<UpgradeReport>;
|
|
1197
|
+
//#endregion
|
|
1145
1198
|
//#region ../runner/src/workspace.d.ts
|
|
1146
|
-
/** Where a
|
|
1147
|
-
export declare function
|
|
1199
|
+
/** Where a run's persistent workspace lives below `root`. */
|
|
1200
|
+
export declare function runWorkspacePath(root: string, runId: string): string;
|
|
1148
1201
|
//#endregion
|
|
1149
1202
|
//#region ../runner/src/index.d.ts
|
|
1150
1203
|
export type RunEvalOptions = {
|
|
1151
1204
|
report: ReportStore;
|
|
1205
|
+
/** The run's ID; only with one run (no `repeat`). */
|
|
1152
1206
|
runId?: string;
|
|
1153
|
-
trialId?: string;
|
|
1154
1207
|
suiteId?: string;
|
|
1155
|
-
/** Overrides the
|
|
1156
|
-
|
|
1208
|
+
/** Overrides the scenario's `repeat`: how many runs to start, as one batch. */
|
|
1209
|
+
repeat?: number;
|
|
1157
1210
|
/** Parameters made available to the AUT for this invocation. */
|
|
1158
1211
|
parameters?: JsonObject;
|
|
1159
|
-
/** Matrix provenance
|
|
1212
|
+
/** Matrix provenance recorded in every run's manifest. */
|
|
1160
1213
|
matrix?: RunMetadata['matrix'];
|
|
1161
1214
|
/** Selects a declared AUT runtime such as local, sandbox, or remote. */
|
|
1162
1215
|
runtime?: AgentRuntimeName;
|
|
1163
|
-
/** Maximum number of
|
|
1216
|
+
/** Maximum number of this batch's runs executing concurrently. */
|
|
1164
1217
|
concurrency?: number;
|
|
1165
|
-
/** Optional shared limiter for coordinating
|
|
1218
|
+
/** Optional shared limiter for coordinating runs across batches. */
|
|
1166
1219
|
semaphore?: Effect.Semaphore;
|
|
1167
|
-
/** Base directory for persistent local
|
|
1220
|
+
/** Base directory for persistent local run workspaces. Omit for an ephemeral OS temp workspace. */
|
|
1168
1221
|
workspaceRoot?: string;
|
|
1169
|
-
/** With `workspaceRoot`: which
|
|
1222
|
+
/** With `workspaceRoot`: which run workspaces to keep afterwards. Default `'failed'`. */
|
|
1170
1223
|
keepWorkspaces?: KeepSandboxes;
|
|
1171
1224
|
/**
|
|
1172
1225
|
* Candidate paths left out of the artifact snapshot, before the scenario's
|
|
1173
1226
|
* own `workspace.ignore`. Default `DEFAULT_ARTIFACT_EXCLUDE`.
|
|
1174
1227
|
*/
|
|
1175
1228
|
artifactExclude?: readonly string[];
|
|
1229
|
+
/** Size limits for files adapters and scorers `attach()`. Default `DEFAULT_ATTACHMENT_LIMITS`. */
|
|
1230
|
+
attachmentLimits?: AttachmentLimits;
|
|
1176
1231
|
/** Repository and commit the eval code came from, recorded in the manifest. */
|
|
1177
1232
|
source?: RunSource;
|
|
1178
1233
|
/** The project's evals and suites at run time, saved beside the manifest. */
|
|
@@ -1180,7 +1235,7 @@ export type RunEvalOptions = {
|
|
|
1180
1235
|
/** Project root; dataset paths resolve against it. Default: the working directory. */
|
|
1181
1236
|
root?: string;
|
|
1182
1237
|
/**
|
|
1183
|
-
* Aborting stops new
|
|
1238
|
+
* Aborting stops new runs from starting; running ones stop at their next
|
|
1184
1239
|
* step and are finalized as cancelled. Also passed to dataset loaders.
|
|
1185
1240
|
*/
|
|
1186
1241
|
signal?: AbortSignal;
|
|
@@ -1188,20 +1243,23 @@ export type RunEvalOptions = {
|
|
|
1188
1243
|
* Observes every trajectory event after it is recorded, for live progress.
|
|
1189
1244
|
* It must not throw; an error it throws is ignored.
|
|
1190
1245
|
*/
|
|
1191
|
-
onEvent?: (
|
|
1246
|
+
onEvent?: (run: RunRef, event: TrajectoryEvent) => void;
|
|
1192
1247
|
now?: () => Date;
|
|
1193
1248
|
};
|
|
1194
|
-
/** Identifies the
|
|
1195
|
-
export type
|
|
1249
|
+
/** Identifies the run an observed event belongs to. */
|
|
1250
|
+
export type RunRef = {
|
|
1196
1251
|
runId: string;
|
|
1197
|
-
|
|
1198
|
-
trialIndex: number;
|
|
1252
|
+
batch?: Batch;
|
|
1199
1253
|
evalId: string;
|
|
1200
1254
|
suiteId?: string;
|
|
1201
1255
|
parameters?: JsonObject;
|
|
1202
1256
|
};
|
|
1203
|
-
/**
|
|
1204
|
-
|
|
1257
|
+
/**
|
|
1258
|
+
* Runs a scenario: once, or `repeat` times as one batch. Resolves to one
|
|
1259
|
+
* result per run started; runs never started because of cancellation are
|
|
1260
|
+
* left out.
|
|
1261
|
+
*/
|
|
1262
|
+
export declare function runEval(definition: EvalDefinition, options: RunEvalOptions): Effect.Effect<RunResult[], unknown>;
|
|
1205
1263
|
//#endregion
|
|
1206
|
-
export type { DatasetFileEntry, MatrixSummary };
|
|
1264
|
+
export type { DatasetFileEntry, MatrixSummary, UpgradeReport };
|
|
1207
1265
|
//# sourceMappingURL=runner.d.mts.map
|