@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.
- package/CHANGELOG.md +56 -1
- 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 +239 -178
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/runner.d.mts +246 -169
- 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-b2Wnmzbb.mjs → src-BrfIXfO2.mjs} +75 -54
- package/dist/{src-DhromKNu.mjs → src-CcdLZqFk.mjs} +487 -250
- package/dist/upgrade-60SIRius.mjs +110 -0
- package/package.json +1 -1
- package/dist/dashboard/assets/index-BEBo_81Y.js +0 -34
- package/dist/dashboard/assets/index-C24IquYZ.css +0 -2
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,15 +686,33 @@ 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>;
|
|
703
|
+
workspace?: EvalWorkspace;
|
|
704
|
+
};
|
|
705
|
+
/** How EvalKit treats this scenario's candidate workspace. */
|
|
706
|
+
type EvalWorkspace = {
|
|
707
|
+
/**
|
|
708
|
+
* Paths to leave out of the run's snapshot, read like `.gitignore`: globs
|
|
709
|
+
* relative to the workspace, where a pattern without `/` matches that name
|
|
710
|
+
* at any depth and later patterns win. They come after the project's
|
|
711
|
+
* `artifacts.exclude` (default `DEFAULT_ARTIFACT_EXCLUDE`), so `!pattern`
|
|
712
|
+
* can keep a path the project leaves out, even inside an ignored directory:
|
|
713
|
+
* `['!_build/doc/**']` keeps generated docs while dropping the rest of `_build`.
|
|
714
|
+
*/
|
|
715
|
+
ignore?: readonly string[];
|
|
645
716
|
};
|
|
646
717
|
type EvalRegistryMetadata = {
|
|
647
718
|
id: string;
|
|
@@ -653,7 +724,18 @@ type EvalSuiteMetadata = {
|
|
|
653
724
|
name?: string;
|
|
654
725
|
evalIds: string[];
|
|
655
726
|
};
|
|
656
|
-
|
|
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
|
+
};
|
|
657
739
|
/**
|
|
658
740
|
* Where a run's eval code came from: the repository, eval project and commit.
|
|
659
741
|
* Results are tagged with it; they are never stored in the repository itself.
|
|
@@ -688,7 +770,7 @@ type RunProcess = {
|
|
|
688
770
|
hostname: string;
|
|
689
771
|
};
|
|
690
772
|
type RunMetadata = {
|
|
691
|
-
schemaVersion:
|
|
773
|
+
schemaVersion: 6;
|
|
692
774
|
runId: string;
|
|
693
775
|
runUri: ResourceUri<'run'>;
|
|
694
776
|
evalId: string;
|
|
@@ -700,34 +782,21 @@ type RunMetadata = {
|
|
|
700
782
|
};
|
|
701
783
|
aut?: AutIdentity;
|
|
702
784
|
startedAt: string;
|
|
703
|
-
/** Present
|
|
785
|
+
/** Present when the run's commit could be determined. */
|
|
704
786
|
source?: RunSource;
|
|
705
|
-
/** From schema version 5. */
|
|
706
787
|
process?: RunProcess;
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
evalId: string;
|
|
716
|
-
parameters?: JsonObject;
|
|
717
|
-
matrix?: {
|
|
718
|
-
id: string;
|
|
719
|
-
cellKey: string;
|
|
720
|
-
};
|
|
721
|
-
aut?: AutIdentity;
|
|
722
|
-
startedAt: string;
|
|
723
|
-
/** From schema version 5: the datasets this trial used, with content digests. */
|
|
724
|
-
datasets?: TrialDataset[];
|
|
725
|
-
};
|
|
726
|
-
type TrialDataset = {
|
|
788
|
+
/** Set when this run is one of several repeats launched together. */
|
|
789
|
+
batch?: Batch;
|
|
790
|
+
/** The effective snapshot ignore patterns: the project's `artifacts.exclude`, then the scenario's `workspace.ignore`. */
|
|
791
|
+
workspaceIgnore?: string[];
|
|
792
|
+
/** The datasets this run used, with content digests. */
|
|
793
|
+
datasets?: RunDataset[];
|
|
794
|
+
};
|
|
795
|
+
type RunDataset = {
|
|
727
796
|
id: string;
|
|
728
797
|
visibility: DatasetVisibility;
|
|
729
798
|
source: 'static' | 'computed';
|
|
730
|
-
/** SHA-256 of the
|
|
799
|
+
/** SHA-256 of the run's content: file paths and bytes, and the canonical value. */
|
|
731
800
|
digest: string;
|
|
732
801
|
};
|
|
733
802
|
type CheckpointResult = {
|
|
@@ -747,7 +816,21 @@ type CheckpointResult = {
|
|
|
747
816
|
id: string;
|
|
748
817
|
};
|
|
749
818
|
};
|
|
750
|
-
|
|
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 = {
|
|
751
834
|
results: ScoreResult[];
|
|
752
835
|
metrics?: MetricResult[];
|
|
753
836
|
checkpoints?: CheckpointResult[];
|
|
@@ -756,40 +839,34 @@ type TrialScoring = {
|
|
|
756
839
|
passed: boolean;
|
|
757
840
|
};
|
|
758
841
|
type ArtifactEntry = {
|
|
759
|
-
/** Path relative to this
|
|
842
|
+
/** Path relative to this run's artifact root. */
|
|
760
843
|
path: string;
|
|
761
844
|
kind: 'file' | 'directory';
|
|
762
845
|
size?: number;
|
|
763
846
|
};
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
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;
|
|
771
854
|
};
|
|
772
855
|
type RunSummary = {
|
|
773
856
|
status: RunStatus;
|
|
774
857
|
endedAt: string;
|
|
775
858
|
durationMs?: number;
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
/** Trials stopped by cancellation; counted neither as passed nor failed. */
|
|
780
|
-
cancelled?: number;
|
|
859
|
+
scoring?: RunScoring;
|
|
860
|
+
artifacts?: ArtifactEntry[];
|
|
861
|
+
attachments?: AttachmentEntry[];
|
|
781
862
|
error?: RecordedError;
|
|
782
863
|
};
|
|
783
|
-
type TrialWriter = {
|
|
784
|
-
appendEvent(event: TrajectoryEvent): Promise<void>;
|
|
785
|
-
writeScores(scoring: TrialScoring): Promise<void>;
|
|
786
|
-
/** Writes a file below this trial's artifact root. */
|
|
787
|
-
writeArtifact(path: string, data: Uint8Array): Promise<void>;
|
|
788
|
-
finalize(summary: TrialSummary): Promise<void>;
|
|
789
|
-
};
|
|
790
864
|
type RunWriter = {
|
|
791
865
|
readonly location: string;
|
|
792
|
-
|
|
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>;
|
|
793
870
|
finalize(summary: RunSummary): Promise<void>;
|
|
794
871
|
};
|
|
795
872
|
type ReportStore = {
|
|
@@ -797,35 +874,18 @@ type ReportStore = {
|
|
|
797
874
|
catalog?: RunCatalog;
|
|
798
875
|
}): Promise<RunWriter>;
|
|
799
876
|
};
|
|
800
|
-
|
|
877
|
+
/** One finished run, as `runEval` returns it. */
|
|
878
|
+
type RunResult = {
|
|
801
879
|
runId: string;
|
|
802
880
|
runUri: ResourceUri<'run'>;
|
|
803
|
-
trialId: string;
|
|
804
|
-
trialUri: ResourceUri<'trial'>;
|
|
805
|
-
trialIndex: number;
|
|
806
881
|
evalId: string;
|
|
807
882
|
status: RunStatus;
|
|
883
|
+
batch?: Batch;
|
|
808
884
|
reportLocation: string;
|
|
809
885
|
durationMs?: number;
|
|
810
|
-
scoring?:
|
|
886
|
+
scoring?: RunScoring;
|
|
811
887
|
error?: RecordedError;
|
|
812
888
|
};
|
|
813
|
-
type AggregateScoring = {
|
|
814
|
-
passed: number;
|
|
815
|
-
failed: number;
|
|
816
|
-
cancelled?: number;
|
|
817
|
-
passRate: number;
|
|
818
|
-
overall?: number;
|
|
819
|
-
};
|
|
820
|
-
type RunResult = TrialResult & {
|
|
821
|
-
runId: string;
|
|
822
|
-
trialCount?: number;
|
|
823
|
-
passed?: number;
|
|
824
|
-
failed?: number;
|
|
825
|
-
aggregateScoring?: AggregateScoring;
|
|
826
|
-
/** Present for an aggregate multi-trial run. */
|
|
827
|
-
trials?: TrialResult[];
|
|
828
|
-
};
|
|
829
889
|
//#endregion
|
|
830
890
|
//#region ../runner/src/local-report-store.d.ts
|
|
831
891
|
/** Persists each run as a local tree rooted below `rootDirectory`. */
|
|
@@ -848,7 +908,7 @@ export declare function staticDatasetFile(dataset: Dataset, root: string, file:
|
|
|
848
908
|
//#endregion
|
|
849
909
|
//#region ../runner/src/local-report-reader.d.ts
|
|
850
910
|
export declare const readRunManifest: (root: string, runId: string) => Promise<{
|
|
851
|
-
readonly schemaVersion:
|
|
911
|
+
readonly schemaVersion: 6;
|
|
852
912
|
readonly runUri: string;
|
|
853
913
|
readonly evalId: string;
|
|
854
914
|
readonly suiteId?: string | undefined;
|
|
@@ -884,52 +944,22 @@ export declare const readRunManifest: (root: string, runId: string) => Promise<{
|
|
|
884
944
|
readonly pid: number;
|
|
885
945
|
readonly hostname: string;
|
|
886
946
|
} | undefined;
|
|
887
|
-
readonly
|
|
888
|
-
}>;
|
|
889
|
-
export declare const readRunSummary: (root: string, runId: string) => Promise<{
|
|
890
|
-
readonly status: "cancelled" | "completed" | "failed" | "running";
|
|
891
|
-
readonly endedAt: string;
|
|
892
|
-
readonly durationMs?: number | undefined;
|
|
893
|
-
readonly trialCount: number;
|
|
894
|
-
readonly passed: number;
|
|
895
|
-
readonly failed: number;
|
|
896
|
-
readonly cancelled?: number | undefined;
|
|
897
|
-
readonly error?: {
|
|
898
|
-
readonly name: string;
|
|
899
|
-
readonly message: string;
|
|
900
|
-
readonly stack?: string | undefined;
|
|
901
|
-
} | undefined;
|
|
902
|
-
}>;
|
|
903
|
-
export declare const readTrialManifest: (root: string, runId: string, trialId: string) => Promise<{
|
|
904
|
-
readonly schemaVersion: 2 | 3 | 4 | 5;
|
|
905
|
-
readonly runUri: string;
|
|
906
|
-
readonly trialUri: string;
|
|
907
|
-
readonly trialIndex: number;
|
|
908
|
-
readonly evalId: string;
|
|
909
|
-
readonly parameters?: {
|
|
910
|
-
readonly [x: string]: JsonValue;
|
|
911
|
-
} | undefined;
|
|
912
|
-
readonly matrix?: {
|
|
913
|
-
readonly id: string;
|
|
914
|
-
readonly cellKey: string;
|
|
915
|
-
} | undefined;
|
|
916
|
-
readonly aut?: {
|
|
917
|
-
readonly name?: string | undefined;
|
|
918
|
-
readonly kind: string;
|
|
947
|
+
readonly batch?: {
|
|
919
948
|
readonly id: string;
|
|
920
|
-
readonly
|
|
949
|
+
readonly index: number;
|
|
950
|
+
readonly size: number;
|
|
921
951
|
} | undefined;
|
|
922
|
-
readonly
|
|
952
|
+
readonly workspaceIgnore?: string[] | undefined;
|
|
923
953
|
readonly datasets?: {
|
|
924
954
|
readonly id: string;
|
|
925
955
|
readonly visibility: "candidate" | "evaluator";
|
|
926
956
|
readonly source: "computed" | "static";
|
|
927
957
|
readonly digest: string;
|
|
928
958
|
}[] | undefined;
|
|
929
|
-
readonly status?: "cancelled" | "
|
|
959
|
+
readonly status?: "cancelled" | "errored" | "failed" | "passed" | "running" | undefined;
|
|
930
960
|
}>;
|
|
931
|
-
export declare const
|
|
932
|
-
readonly status: "cancelled" | "
|
|
961
|
+
export declare const readRunSummary: (root: string, runId: string) => Promise<{
|
|
962
|
+
readonly status: "cancelled" | "errored" | "failed" | "passed" | "running";
|
|
933
963
|
readonly endedAt: string;
|
|
934
964
|
readonly durationMs?: number | undefined;
|
|
935
965
|
readonly scoring?: {
|
|
@@ -950,6 +980,7 @@ export declare const readTrialSummary: (root: string, runId: string, trialId: st
|
|
|
950
980
|
readonly usage?: {
|
|
951
981
|
readonly inputTokens?: number | undefined;
|
|
952
982
|
readonly outputTokens?: number | undefined;
|
|
983
|
+
readonly cachedInputTokens?: number | undefined;
|
|
953
984
|
readonly totalTokens?: number | undefined;
|
|
954
985
|
} | undefined;
|
|
955
986
|
readonly events?: JsonValue[] | undefined;
|
|
@@ -993,6 +1024,7 @@ export declare const readTrialSummary: (root: string, runId: string, trialId: st
|
|
|
993
1024
|
readonly usage?: {
|
|
994
1025
|
readonly inputTokens?: number | undefined;
|
|
995
1026
|
readonly outputTokens?: number | undefined;
|
|
1027
|
+
readonly cachedInputTokens?: number | undefined;
|
|
996
1028
|
readonly totalTokens?: number | undefined;
|
|
997
1029
|
} | undefined;
|
|
998
1030
|
readonly events?: JsonValue[] | undefined;
|
|
@@ -1017,13 +1049,18 @@ export declare const readTrialSummary: (root: string, runId: string, trialId: st
|
|
|
1017
1049
|
readonly kind: "directory" | "file";
|
|
1018
1050
|
readonly size?: number | undefined;
|
|
1019
1051
|
}[] | undefined;
|
|
1052
|
+
readonly attachments?: {
|
|
1053
|
+
readonly name: string;
|
|
1054
|
+
readonly size: number;
|
|
1055
|
+
readonly truncatedFrom?: number | undefined;
|
|
1056
|
+
}[] | undefined;
|
|
1020
1057
|
readonly error?: {
|
|
1021
1058
|
readonly name: string;
|
|
1022
1059
|
readonly message: string;
|
|
1023
1060
|
readonly stack?: string | undefined;
|
|
1024
1061
|
} | undefined;
|
|
1025
1062
|
}>;
|
|
1026
|
-
export declare const
|
|
1063
|
+
export declare const readRunScoring: (root: string, runId: string) => Promise<{
|
|
1027
1064
|
readonly results: {
|
|
1028
1065
|
readonly name: string;
|
|
1029
1066
|
readonly kind: "judge" | "predicate";
|
|
@@ -1041,6 +1078,7 @@ export declare const readTrialScoring: (root: string, runId: string, trialId: st
|
|
|
1041
1078
|
readonly usage?: {
|
|
1042
1079
|
readonly inputTokens?: number | undefined;
|
|
1043
1080
|
readonly outputTokens?: number | undefined;
|
|
1081
|
+
readonly cachedInputTokens?: number | undefined;
|
|
1044
1082
|
readonly totalTokens?: number | undefined;
|
|
1045
1083
|
} | undefined;
|
|
1046
1084
|
readonly events?: JsonValue[] | undefined;
|
|
@@ -1084,6 +1122,7 @@ export declare const readTrialScoring: (root: string, runId: string, trialId: st
|
|
|
1084
1122
|
readonly usage?: {
|
|
1085
1123
|
readonly inputTokens?: number | undefined;
|
|
1086
1124
|
readonly outputTokens?: number | undefined;
|
|
1125
|
+
readonly cachedInputTokens?: number | undefined;
|
|
1087
1126
|
readonly totalTokens?: number | undefined;
|
|
1088
1127
|
} | undefined;
|
|
1089
1128
|
readonly events?: JsonValue[] | undefined;
|
|
@@ -1103,7 +1142,7 @@ export declare const readTrialScoring: (root: string, runId: string, trialId: st
|
|
|
1103
1142
|
readonly overall?: number | undefined;
|
|
1104
1143
|
readonly passed: boolean;
|
|
1105
1144
|
}>;
|
|
1106
|
-
export declare function
|
|
1145
|
+
export declare function readRunEvents(root: string, runId: string): Promise<TrajectoryEvent[]>;
|
|
1107
1146
|
/**
|
|
1108
1147
|
* True when a run's owning process is known to be gone: it ran on this host
|
|
1109
1148
|
* and its PID no longer exists. Runs from other hosts are never judged.
|
|
@@ -1111,49 +1150,84 @@ export declare function readTrialEvents(root: string, runId: string, trialId: st
|
|
|
1111
1150
|
export declare function ownerIsGone(owner: RunProcess | undefined): boolean;
|
|
1112
1151
|
//#endregion
|
|
1113
1152
|
//#region ../runner/src/matrix.d.ts
|
|
1114
|
-
/** Cells
|
|
1153
|
+
/** Cells and runs; a run that errored counts as failed, a cancelled one as neither. */
|
|
1115
1154
|
type MatrixSummary = {
|
|
1116
1155
|
cells: number;
|
|
1156
|
+
runs: number;
|
|
1117
1157
|
passed: number;
|
|
1118
1158
|
failed: number;
|
|
1119
1159
|
cancelled: number;
|
|
1120
1160
|
};
|
|
1121
1161
|
/** Bounded workers pull cells from the iterator; no Cartesian job array is allocated. */
|
|
1122
|
-
export declare function runMatrix(matrix: EvalMatrix, options: Omit<RunEvalOptions, 'runId' | '
|
|
1162
|
+
export declare function runMatrix(matrix: EvalMatrix, options: Omit<RunEvalOptions, 'runId' | 'parameters' | 'matrix'> & {
|
|
1123
1163
|
selection?: MatrixSelection;
|
|
1124
1164
|
/** The suite each cell's run is recorded under, when `suiteId` is not given. */
|
|
1125
1165
|
suiteFor?: (cell: EvalMatrixCell) => string | undefined;
|
|
1126
|
-
onResult?: (cell: EvalMatrixCell,
|
|
1166
|
+
onResult?: (cell: EvalMatrixCell, runs: readonly RunResult[]) => void | Promise<void>;
|
|
1127
1167
|
}): Effect.Effect<MatrixSummary, unknown>;
|
|
1128
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
|
|
1129
1198
|
//#region ../runner/src/workspace.d.ts
|
|
1130
|
-
/** Where a
|
|
1131
|
-
export declare function
|
|
1199
|
+
/** Where a run's persistent workspace lives below `root`. */
|
|
1200
|
+
export declare function runWorkspacePath(root: string, runId: string): string;
|
|
1132
1201
|
//#endregion
|
|
1133
1202
|
//#region ../runner/src/index.d.ts
|
|
1134
1203
|
export type RunEvalOptions = {
|
|
1135
1204
|
report: ReportStore;
|
|
1205
|
+
/** The run's ID; only with one run (no `repeat`). */
|
|
1136
1206
|
runId?: string;
|
|
1137
|
-
trialId?: string;
|
|
1138
1207
|
suiteId?: string;
|
|
1139
|
-
/** Overrides the
|
|
1140
|
-
|
|
1208
|
+
/** Overrides the scenario's `repeat`: how many runs to start, as one batch. */
|
|
1209
|
+
repeat?: number;
|
|
1141
1210
|
/** Parameters made available to the AUT for this invocation. */
|
|
1142
1211
|
parameters?: JsonObject;
|
|
1143
|
-
/** Matrix provenance
|
|
1212
|
+
/** Matrix provenance recorded in every run's manifest. */
|
|
1144
1213
|
matrix?: RunMetadata['matrix'];
|
|
1145
1214
|
/** Selects a declared AUT runtime such as local, sandbox, or remote. */
|
|
1146
1215
|
runtime?: AgentRuntimeName;
|
|
1147
|
-
/** Maximum number of
|
|
1216
|
+
/** Maximum number of this batch's runs executing concurrently. */
|
|
1148
1217
|
concurrency?: number;
|
|
1149
|
-
/** Optional shared limiter for coordinating
|
|
1218
|
+
/** Optional shared limiter for coordinating runs across batches. */
|
|
1150
1219
|
semaphore?: Effect.Semaphore;
|
|
1151
|
-
/** Base directory for persistent local
|
|
1220
|
+
/** Base directory for persistent local run workspaces. Omit for an ephemeral OS temp workspace. */
|
|
1152
1221
|
workspaceRoot?: string;
|
|
1153
|
-
/** With `workspaceRoot`: which
|
|
1222
|
+
/** With `workspaceRoot`: which run workspaces to keep afterwards. Default `'failed'`. */
|
|
1154
1223
|
keepWorkspaces?: KeepSandboxes;
|
|
1155
|
-
/**
|
|
1224
|
+
/**
|
|
1225
|
+
* Candidate paths left out of the artifact snapshot, before the scenario's
|
|
1226
|
+
* own `workspace.ignore`. Default `DEFAULT_ARTIFACT_EXCLUDE`.
|
|
1227
|
+
*/
|
|
1156
1228
|
artifactExclude?: readonly string[];
|
|
1229
|
+
/** Size limits for files adapters and scorers `attach()`. Default `DEFAULT_ATTACHMENT_LIMITS`. */
|
|
1230
|
+
attachmentLimits?: AttachmentLimits;
|
|
1157
1231
|
/** Repository and commit the eval code came from, recorded in the manifest. */
|
|
1158
1232
|
source?: RunSource;
|
|
1159
1233
|
/** The project's evals and suites at run time, saved beside the manifest. */
|
|
@@ -1161,7 +1235,7 @@ export type RunEvalOptions = {
|
|
|
1161
1235
|
/** Project root; dataset paths resolve against it. Default: the working directory. */
|
|
1162
1236
|
root?: string;
|
|
1163
1237
|
/**
|
|
1164
|
-
* Aborting stops new
|
|
1238
|
+
* Aborting stops new runs from starting; running ones stop at their next
|
|
1165
1239
|
* step and are finalized as cancelled. Also passed to dataset loaders.
|
|
1166
1240
|
*/
|
|
1167
1241
|
signal?: AbortSignal;
|
|
@@ -1169,20 +1243,23 @@ export type RunEvalOptions = {
|
|
|
1169
1243
|
* Observes every trajectory event after it is recorded, for live progress.
|
|
1170
1244
|
* It must not throw; an error it throws is ignored.
|
|
1171
1245
|
*/
|
|
1172
|
-
onEvent?: (
|
|
1246
|
+
onEvent?: (run: RunRef, event: TrajectoryEvent) => void;
|
|
1173
1247
|
now?: () => Date;
|
|
1174
1248
|
};
|
|
1175
|
-
/** Identifies the
|
|
1176
|
-
export type
|
|
1249
|
+
/** Identifies the run an observed event belongs to. */
|
|
1250
|
+
export type RunRef = {
|
|
1177
1251
|
runId: string;
|
|
1178
|
-
|
|
1179
|
-
trialIndex: number;
|
|
1252
|
+
batch?: Batch;
|
|
1180
1253
|
evalId: string;
|
|
1181
1254
|
suiteId?: string;
|
|
1182
1255
|
parameters?: JsonObject;
|
|
1183
1256
|
};
|
|
1184
|
-
/**
|
|
1185
|
-
|
|
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>;
|
|
1186
1263
|
//#endregion
|
|
1187
|
-
export type { DatasetFileEntry, MatrixSummary };
|
|
1264
|
+
export type { DatasetFileEntry, MatrixSummary, UpgradeReport };
|
|
1188
1265
|
//# sourceMappingURL=runner.d.mts.map
|