@leostera/evalkit 0.0.1

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.
@@ -0,0 +1,939 @@
1
+ import * as Schema from "effect/Schema";
2
+ //#region ../core/src/identity.d.ts
3
+ declare const ResourceKindSchema: Schema.Literal<["run", "trial", "artifact"]>;
4
+ type ResourceKind = typeof ResourceKindSchema.Type;
5
+ /** Human-authored project-local identifier; never a generated resource URI. */
6
+ declare function authorId(value: string): string;
7
+ /** RFC 4122 textual UUID. EvalKit accepts v4/v7 and other valid UUID versions. */
8
+ declare const UuidSchema: Schema.filter<typeof Schema.String>;
9
+ type Uuid = typeof UuidSchema.Type;
10
+ type ResourceUri<TKind extends ResourceKind = ResourceKind> = `evalkit:${TKind}:${string}`;
11
+ declare const ResourceUriSchema: Schema.filter<typeof Schema.String>;
12
+ declare function resourceUriSchema<TKind extends ResourceKind>(kind: TKind): Schema.filter<typeof Schema.String>;
13
+ declare function resourceUri<TKind extends ResourceKind>(kind: TKind, uuid: Uuid): ResourceUri<TKind>;
14
+ declare function parseResourceUri<TKind extends ResourceKind>(value: string, expectedKind?: TKind): {
15
+ kind: TKind;
16
+ uuid: Uuid;
17
+ uri: ResourceUri<TKind>;
18
+ };
19
+ declare function resourceUuid(value: string, expectedKind?: ResourceKind): Uuid;
20
+ //#endregion
21
+ //#region ../core/src/matrix.d.ts
22
+ /** Canonical JSON: keys sorted recursively, array order preserved. Rejects non-JSON inputs. */
23
+ declare function canonicalParameters(value: JsonValue): string;
24
+ type MatrixSelection = {
25
+ /** Base eval IDs. Unknown values fail before dispatch. */
26
+ evals?: readonly string[];
27
+ /** Select existing dimension values, rather than overwriting every cell with the same value. */
28
+ parameters?: Readonly<Record<string, readonly JsonValue[]>>;
29
+ /** Overrides for non-dimension execution settings (e.g. maxTokens). */
30
+ overrides?: JsonObject;
31
+ };
32
+ type EvalMatrixCell = {
33
+ matrixId: string;
34
+ /** Stable canonical key including matrix, base eval and effective parameters. */
35
+ key: string;
36
+ eval: EvalDefinition;
37
+ parameters: JsonObject;
38
+ };
39
+ type EvalMatrixDefinition = {
40
+ id: string;
41
+ name?: string;
42
+ evals: readonly EvalDefinition[];
43
+ parameters: Readonly<Record<string, readonly JsonValue[]>>;
44
+ defaults?: JsonObject;
45
+ /** Complete correlated assignments, crossed with independent parameters. */
46
+ cases?: readonly JsonObject[];
47
+ /** Partial patterns over declared dimensions; matching cells are never run. */
48
+ exclude?: readonly JsonObject[];
49
+ };
50
+ type EvalMatrix = EvalMatrixDefinition & {
51
+ kind: 'matrix';
52
+ count(selection?: MatrixSelection): number;
53
+ cells(selection?: MatrixSelection): IterableIterator<EvalMatrixCell>;
54
+ };
55
+ declare function defineEvalMatrix<const T extends EvalMatrixDefinition>(definition: T): EvalMatrix & T;
56
+ //#endregion
57
+ //#region ../core/src/config.d.ts
58
+ type EvalkitConfig = {
59
+ /** Paths are relative to evalkit.config.js/ts, not the invoking shell directory. */
60
+ testDir?: string;
61
+ include?: readonly string[];
62
+ exclude?: readonly string[];
63
+ /** Explicit definitions are an alternative to discovery (e.g. hosted registries). */
64
+ evals?: readonly EvalDefinition[];
65
+ registry?: EvalRegistry;
66
+ /** Applied to every discovered eval. Values are forwarded, never provider-interpreted. */
67
+ matrix?: Omit<EvalMatrixDefinition, 'evals' | 'id'> & {
68
+ id?: string;
69
+ };
70
+ execution?: {
71
+ concurrency?: number;
72
+ trials?: number;
73
+ maxCells?: number;
74
+ };
75
+ reportDir?: string;
76
+ sandboxDir?: string;
77
+ };
78
+ /** Pure, typed project configuration. Loading/discovery belongs to the CLI. */
79
+ declare function defineConfig<const T extends EvalkitConfig>(configuration: T): T;
80
+ //#endregion
81
+ //#region ../core/src/schema.d.ts
82
+ /** Runtime schemas for serialized EvalKit report and API boundaries. */
83
+ declare const RunStatusSchema: Schema.Literal<["running", "completed", "failed", "cancelled"]>;
84
+ declare const RecordedErrorSchema: Schema.Struct<{
85
+ name: typeof Schema.String;
86
+ message: typeof Schema.String;
87
+ stack: Schema.optional<typeof Schema.String>;
88
+ }>;
89
+ declare const AutIdentitySchema: Schema.Struct<{
90
+ name: Schema.optional<typeof Schema.String>;
91
+ kind: typeof Schema.String;
92
+ id: typeof Schema.String;
93
+ version: Schema.optional<typeof Schema.String>;
94
+ }>;
95
+ declare const JsonValueSchema: Schema.Schema<JsonValue>;
96
+ declare const RunMetadataSchema: Schema.Struct<{
97
+ schemaVersion: Schema.Literal<[2, 3]>;
98
+ runUri: Schema.filter<typeof Schema.String>;
99
+ evalId: typeof Schema.String;
100
+ suiteId: Schema.optional<typeof Schema.String>;
101
+ parameters: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Schema<JsonValue, JsonValue, never>>>;
102
+ matrix: Schema.optional<Schema.Struct<{
103
+ id: typeof Schema.String;
104
+ cellKey: typeof Schema.String;
105
+ }>>;
106
+ aut: Schema.optional<Schema.Struct<{
107
+ name: Schema.optional<typeof Schema.String>;
108
+ kind: typeof Schema.String;
109
+ id: typeof Schema.String;
110
+ version: Schema.optional<typeof Schema.String>;
111
+ }>>;
112
+ startedAt: typeof Schema.String;
113
+ }>;
114
+ declare const TrialMetadataSchema: Schema.Struct<{
115
+ schemaVersion: Schema.Literal<[2, 3]>;
116
+ runUri: Schema.filter<typeof Schema.String>;
117
+ trialUri: Schema.filter<typeof Schema.String>;
118
+ trialIndex: typeof Schema.Number;
119
+ evalId: typeof Schema.String;
120
+ parameters: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Schema<JsonValue, JsonValue, never>>>;
121
+ matrix: Schema.optional<Schema.Struct<{
122
+ id: typeof Schema.String;
123
+ cellKey: typeof Schema.String;
124
+ }>>;
125
+ aut: Schema.optional<Schema.Struct<{
126
+ name: Schema.optional<typeof Schema.String>;
127
+ kind: typeof Schema.String;
128
+ id: typeof Schema.String;
129
+ version: Schema.optional<typeof Schema.String>;
130
+ }>>;
131
+ startedAt: typeof Schema.String;
132
+ }>;
133
+ /** On-disk manifests include a lifecycle status; older finalized manifests may still say running. */
134
+ declare const RunManifestSchema: Schema.Struct<{
135
+ schemaVersion: Schema.Literal<[2, 3]>;
136
+ runUri: Schema.filter<typeof Schema.String>;
137
+ evalId: typeof Schema.String;
138
+ suiteId: Schema.optional<typeof Schema.String>;
139
+ parameters: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Schema<JsonValue, JsonValue, never>>>;
140
+ matrix: Schema.optional<Schema.Struct<{
141
+ id: typeof Schema.String;
142
+ cellKey: typeof Schema.String;
143
+ }>>;
144
+ aut: Schema.optional<Schema.Struct<{
145
+ name: Schema.optional<typeof Schema.String>;
146
+ kind: typeof Schema.String;
147
+ id: typeof Schema.String;
148
+ version: Schema.optional<typeof Schema.String>;
149
+ }>>;
150
+ startedAt: typeof Schema.String;
151
+ status: Schema.optional<Schema.Literal<["running", "completed", "failed", "cancelled"]>>;
152
+ }>;
153
+ declare const TrialManifestSchema: Schema.Struct<{
154
+ schemaVersion: Schema.Literal<[2, 3]>;
155
+ runUri: Schema.filter<typeof Schema.String>;
156
+ trialUri: Schema.filter<typeof Schema.String>;
157
+ trialIndex: typeof Schema.Number;
158
+ evalId: typeof Schema.String;
159
+ parameters: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Schema<JsonValue, JsonValue, never>>>;
160
+ matrix: Schema.optional<Schema.Struct<{
161
+ id: typeof Schema.String;
162
+ cellKey: typeof Schema.String;
163
+ }>>;
164
+ aut: Schema.optional<Schema.Struct<{
165
+ name: Schema.optional<typeof Schema.String>;
166
+ kind: typeof Schema.String;
167
+ id: typeof Schema.String;
168
+ version: Schema.optional<typeof Schema.String>;
169
+ }>>;
170
+ startedAt: typeof Schema.String;
171
+ status: Schema.optional<Schema.Literal<["running", "completed", "failed", "cancelled"]>>;
172
+ }>;
173
+ declare const UsageSchema: Schema.Struct<{
174
+ inputTokens: Schema.optional<typeof Schema.Number>;
175
+ outputTokens: Schema.optional<typeof Schema.Number>;
176
+ totalTokens: Schema.optional<typeof Schema.Number>;
177
+ }>;
178
+ declare const JudgeRunInfoSchema: Schema.Struct<{
179
+ agent: Schema.optional<Schema.Struct<{
180
+ id: typeof Schema.String;
181
+ kind: typeof Schema.String;
182
+ name: Schema.optional<typeof Schema.String>;
183
+ version: Schema.optional<typeof Schema.String>;
184
+ }>>;
185
+ usage: Schema.optional<Schema.Struct<{
186
+ inputTokens: Schema.optional<typeof Schema.Number>;
187
+ outputTokens: Schema.optional<typeof Schema.Number>;
188
+ totalTokens: Schema.optional<typeof Schema.Number>;
189
+ }>>;
190
+ events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
191
+ }>;
192
+ declare const ScoreResultSchema: Schema.Struct<{
193
+ name: typeof Schema.String;
194
+ kind: Schema.Literal<["predicate", "judge"]>;
195
+ value: Schema.optional<typeof Schema.Number>;
196
+ passed: Schema.optional<typeof Schema.Boolean>;
197
+ explanation: Schema.optional<typeof Schema.String>;
198
+ evidence: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
199
+ judge: Schema.optional<Schema.Struct<{
200
+ agent: Schema.optional<Schema.Struct<{
201
+ id: typeof Schema.String;
202
+ kind: typeof Schema.String;
203
+ name: Schema.optional<typeof Schema.String>;
204
+ version: Schema.optional<typeof Schema.String>;
205
+ }>>;
206
+ usage: Schema.optional<Schema.Struct<{
207
+ inputTokens: Schema.optional<typeof Schema.Number>;
208
+ outputTokens: Schema.optional<typeof Schema.Number>;
209
+ totalTokens: Schema.optional<typeof Schema.Number>;
210
+ }>>;
211
+ events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
212
+ }>>;
213
+ durationMs: typeof Schema.Number;
214
+ error: Schema.optional<Schema.Struct<{
215
+ name: typeof Schema.String;
216
+ message: typeof Schema.String;
217
+ stack: Schema.optional<typeof Schema.String>;
218
+ }>>;
219
+ }>;
220
+ declare const CheckpointResultSchema: Schema.Struct<{
221
+ step: typeof Schema.Number;
222
+ kind: Schema.Literal<["predicate", "judge", "expect-tool-call"]>;
223
+ name: typeof Schema.String;
224
+ status: Schema.Literal<["passed", "failed", "error", "skipped"]>;
225
+ value: Schema.optional<typeof Schema.Number>;
226
+ passed: Schema.optional<typeof Schema.Boolean>;
227
+ explanation: Schema.optional<typeof Schema.String>;
228
+ evidence: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
229
+ judge: Schema.optional<Schema.Struct<{
230
+ agent: Schema.optional<Schema.Struct<{
231
+ id: typeof Schema.String;
232
+ kind: typeof Schema.String;
233
+ name: Schema.optional<typeof Schema.String>;
234
+ version: Schema.optional<typeof Schema.String>;
235
+ }>>;
236
+ usage: Schema.optional<Schema.Struct<{
237
+ inputTokens: Schema.optional<typeof Schema.Number>;
238
+ outputTokens: Schema.optional<typeof Schema.Number>;
239
+ totalTokens: Schema.optional<typeof Schema.Number>;
240
+ }>>;
241
+ events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
242
+ }>>;
243
+ durationMs: Schema.optional<typeof Schema.Number>;
244
+ error: Schema.optional<Schema.Struct<{
245
+ name: typeof Schema.String;
246
+ message: typeof Schema.String;
247
+ stack: Schema.optional<typeof Schema.String>;
248
+ }>>;
249
+ matchedToolCall: Schema.optional<Schema.Struct<{
250
+ eventIndex: typeof Schema.Number;
251
+ id: typeof Schema.String;
252
+ }>>;
253
+ }>;
254
+ declare const TrialScoringSchema: Schema.Struct<{
255
+ results: Schema.mutable<Schema.Array$<Schema.Struct<{
256
+ name: typeof Schema.String;
257
+ kind: Schema.Literal<["predicate", "judge"]>;
258
+ value: Schema.optional<typeof Schema.Number>;
259
+ passed: Schema.optional<typeof Schema.Boolean>;
260
+ explanation: Schema.optional<typeof Schema.String>;
261
+ evidence: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
262
+ judge: Schema.optional<Schema.Struct<{
263
+ agent: Schema.optional<Schema.Struct<{
264
+ id: typeof Schema.String;
265
+ kind: typeof Schema.String;
266
+ name: Schema.optional<typeof Schema.String>;
267
+ version: Schema.optional<typeof Schema.String>;
268
+ }>>;
269
+ usage: Schema.optional<Schema.Struct<{
270
+ inputTokens: Schema.optional<typeof Schema.Number>;
271
+ outputTokens: Schema.optional<typeof Schema.Number>;
272
+ totalTokens: Schema.optional<typeof Schema.Number>;
273
+ }>>;
274
+ events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
275
+ }>>;
276
+ durationMs: typeof Schema.Number;
277
+ error: Schema.optional<Schema.Struct<{
278
+ name: typeof Schema.String;
279
+ message: typeof Schema.String;
280
+ stack: Schema.optional<typeof Schema.String>;
281
+ }>>;
282
+ }>>>;
283
+ checkpoints: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
284
+ step: typeof Schema.Number;
285
+ kind: Schema.Literal<["predicate", "judge", "expect-tool-call"]>;
286
+ name: typeof Schema.String;
287
+ status: Schema.Literal<["passed", "failed", "error", "skipped"]>;
288
+ value: Schema.optional<typeof Schema.Number>;
289
+ passed: Schema.optional<typeof Schema.Boolean>;
290
+ explanation: Schema.optional<typeof Schema.String>;
291
+ evidence: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
292
+ judge: Schema.optional<Schema.Struct<{
293
+ agent: Schema.optional<Schema.Struct<{
294
+ id: typeof Schema.String;
295
+ kind: typeof Schema.String;
296
+ name: Schema.optional<typeof Schema.String>;
297
+ version: Schema.optional<typeof Schema.String>;
298
+ }>>;
299
+ usage: Schema.optional<Schema.Struct<{
300
+ inputTokens: Schema.optional<typeof Schema.Number>;
301
+ outputTokens: Schema.optional<typeof Schema.Number>;
302
+ totalTokens: Schema.optional<typeof Schema.Number>;
303
+ }>>;
304
+ events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
305
+ }>>;
306
+ durationMs: Schema.optional<typeof Schema.Number>;
307
+ error: Schema.optional<Schema.Struct<{
308
+ name: typeof Schema.String;
309
+ message: typeof Schema.String;
310
+ stack: Schema.optional<typeof Schema.String>;
311
+ }>>;
312
+ matchedToolCall: Schema.optional<Schema.Struct<{
313
+ eventIndex: typeof Schema.Number;
314
+ id: typeof Schema.String;
315
+ }>>;
316
+ }>>>>;
317
+ skippedScorers: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
318
+ overall: Schema.optional<typeof Schema.Number>;
319
+ passed: typeof Schema.Boolean;
320
+ }>;
321
+ declare const ArtifactEntrySchema: Schema.Struct<{
322
+ path: typeof Schema.String;
323
+ kind: Schema.Literal<["file", "directory"]>;
324
+ size: Schema.optional<typeof Schema.Number>;
325
+ }>;
326
+ declare const TrialSummarySchema: Schema.Struct<{
327
+ status: Schema.Literal<["running", "completed", "failed", "cancelled"]>;
328
+ endedAt: typeof Schema.String;
329
+ durationMs: Schema.optional<typeof Schema.Number>;
330
+ scoring: Schema.optional<Schema.Struct<{
331
+ results: Schema.mutable<Schema.Array$<Schema.Struct<{
332
+ name: typeof Schema.String;
333
+ kind: Schema.Literal<["predicate", "judge"]>;
334
+ value: Schema.optional<typeof Schema.Number>;
335
+ passed: Schema.optional<typeof Schema.Boolean>;
336
+ explanation: Schema.optional<typeof Schema.String>;
337
+ evidence: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
338
+ judge: Schema.optional<Schema.Struct<{
339
+ agent: Schema.optional<Schema.Struct<{
340
+ id: typeof Schema.String;
341
+ kind: typeof Schema.String;
342
+ name: Schema.optional<typeof Schema.String>;
343
+ version: Schema.optional<typeof Schema.String>;
344
+ }>>;
345
+ usage: Schema.optional<Schema.Struct<{
346
+ inputTokens: Schema.optional<typeof Schema.Number>;
347
+ outputTokens: Schema.optional<typeof Schema.Number>;
348
+ totalTokens: Schema.optional<typeof Schema.Number>;
349
+ }>>;
350
+ events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
351
+ }>>;
352
+ durationMs: typeof Schema.Number;
353
+ error: Schema.optional<Schema.Struct<{
354
+ name: typeof Schema.String;
355
+ message: typeof Schema.String;
356
+ stack: Schema.optional<typeof Schema.String>;
357
+ }>>;
358
+ }>>>;
359
+ checkpoints: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
360
+ step: typeof Schema.Number;
361
+ kind: Schema.Literal<["predicate", "judge", "expect-tool-call"]>;
362
+ name: typeof Schema.String;
363
+ status: Schema.Literal<["passed", "failed", "error", "skipped"]>;
364
+ value: Schema.optional<typeof Schema.Number>;
365
+ passed: Schema.optional<typeof Schema.Boolean>;
366
+ explanation: Schema.optional<typeof Schema.String>;
367
+ evidence: Schema.optional<Schema.Schema<JsonValue, JsonValue, never>>;
368
+ judge: Schema.optional<Schema.Struct<{
369
+ agent: Schema.optional<Schema.Struct<{
370
+ id: typeof Schema.String;
371
+ kind: typeof Schema.String;
372
+ name: Schema.optional<typeof Schema.String>;
373
+ version: Schema.optional<typeof Schema.String>;
374
+ }>>;
375
+ usage: Schema.optional<Schema.Struct<{
376
+ inputTokens: Schema.optional<typeof Schema.Number>;
377
+ outputTokens: Schema.optional<typeof Schema.Number>;
378
+ totalTokens: Schema.optional<typeof Schema.Number>;
379
+ }>>;
380
+ events: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<JsonValue, JsonValue, never>>>>;
381
+ }>>;
382
+ durationMs: Schema.optional<typeof Schema.Number>;
383
+ error: Schema.optional<Schema.Struct<{
384
+ name: typeof Schema.String;
385
+ message: typeof Schema.String;
386
+ stack: Schema.optional<typeof Schema.String>;
387
+ }>>;
388
+ matchedToolCall: Schema.optional<Schema.Struct<{
389
+ eventIndex: typeof Schema.Number;
390
+ id: typeof Schema.String;
391
+ }>>;
392
+ }>>>>;
393
+ skippedScorers: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
394
+ overall: Schema.optional<typeof Schema.Number>;
395
+ passed: typeof Schema.Boolean;
396
+ }>>;
397
+ artifacts: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
398
+ path: typeof Schema.String;
399
+ kind: Schema.Literal<["file", "directory"]>;
400
+ size: Schema.optional<typeof Schema.Number>;
401
+ }>>>>;
402
+ error: Schema.optional<Schema.Struct<{
403
+ name: typeof Schema.String;
404
+ message: typeof Schema.String;
405
+ stack: Schema.optional<typeof Schema.String>;
406
+ }>>;
407
+ }>;
408
+ declare const RunSummarySchema: Schema.Struct<{
409
+ status: Schema.Literal<["running", "completed", "failed", "cancelled"]>;
410
+ endedAt: typeof Schema.String;
411
+ durationMs: Schema.optional<typeof Schema.Number>;
412
+ trialCount: typeof Schema.Number;
413
+ passed: typeof Schema.Number;
414
+ failed: typeof Schema.Number;
415
+ error: Schema.optional<Schema.Struct<{
416
+ name: typeof Schema.String;
417
+ message: typeof Schema.String;
418
+ stack: Schema.optional<typeof Schema.String>;
419
+ }>>;
420
+ }>;
421
+ declare const TrajectoryEventSchema: Schema.Schema<TrajectoryEvent>;
422
+ declare const ApiErrorSchema: Schema.Struct<{
423
+ error: typeof Schema.String;
424
+ message: typeof Schema.String;
425
+ }>;
426
+ //#endregion
427
+ //#region ../core/src/trajectory.d.ts
428
+ /** Decode one private report's JSONL trajectory; reject malformed/non-event lines with their line number. */
429
+ declare function parseTrajectoryJsonl(contents: string): TrajectoryEvent[];
430
+ //#endregion
431
+ //#region ../core/src/index.d.ts
432
+ type JsonPrimitive = boolean | number | string | null;
433
+ type JsonValue = JsonPrimitive | JsonValue[] | {
434
+ [key: string]: JsonValue;
435
+ };
436
+ type JsonObject = {
437
+ [key: string]: JsonValue;
438
+ };
439
+ type AutIdentity = {
440
+ /** Human-readable logical agent name shown in catalogs and dashboards. */
441
+ name?: string;
442
+ kind: string;
443
+ id: string;
444
+ version?: string;
445
+ };
446
+ type AgentRuntimeName = 'local' | 'sandbox' | 'remote';
447
+ /**
448
+ * A serializable runtime requirement for an AUT. Concrete runtime packages own
449
+ * the interpretation of `kind` and `configuration`.
450
+ */
451
+ type AgentRuntime = {
452
+ kind: string;
453
+ configuration?: JsonObject;
454
+ };
455
+ type AgentRuntimes = Partial<Record<AgentRuntimeName, AgentRuntime>>;
456
+ type Usage = {
457
+ inputTokens?: number;
458
+ outputTokens?: number;
459
+ totalTokens?: number;
460
+ };
461
+ type RecordedError = {
462
+ name: string;
463
+ message: string;
464
+ stack?: string;
465
+ };
466
+ type AutEvent = {
467
+ kind: 'started';
468
+ timestamp: string;
469
+ } | {
470
+ kind: 'message';
471
+ role: 'system' | 'user' | 'assistant' | 'tool';
472
+ content: JsonValue;
473
+ timestamp: string;
474
+ } | {
475
+ kind: 'tool-call';
476
+ id: string;
477
+ name: string;
478
+ arguments: JsonValue;
479
+ timestamp: string;
480
+ } | {
481
+ kind: 'tool-result';
482
+ id: string;
483
+ name?: string;
484
+ result: JsonValue;
485
+ timestamp: string;
486
+ } | {
487
+ kind: 'turn-started';
488
+ turn: number;
489
+ timestamp: string;
490
+ } | {
491
+ kind: 'turn-completed';
492
+ turn: number;
493
+ timestamp: string;
494
+ latencyMs?: number;
495
+ usage?: Usage;
496
+ } | {
497
+ kind: 'completed';
498
+ output?: JsonValue;
499
+ timestamp: string;
500
+ } | {
501
+ kind: 'error';
502
+ error: RecordedError;
503
+ timestamp: string;
504
+ };
505
+ type RunnerEvent = {
506
+ kind: 'trial-started';
507
+ timestamp: string;
508
+ } | {
509
+ kind: 'transcript-step-started';
510
+ step: number;
511
+ timestamp: string;
512
+ } | {
513
+ kind: 'transcript-step-completed';
514
+ step: number;
515
+ timestamp: string;
516
+ } | {
517
+ kind: 'transcript-step-skipped';
518
+ step: number;
519
+ timestamp: string;
520
+ } | {
521
+ kind: 'checkpoint-started';
522
+ step: number;
523
+ name: string;
524
+ timestamp: string;
525
+ } | {
526
+ kind: 'checkpoint-completed';
527
+ step: number;
528
+ status: 'passed' | 'failed';
529
+ timestamp: string;
530
+ } | {
531
+ kind: 'checkpoint-error';
532
+ step: number;
533
+ error: RecordedError;
534
+ timestamp: string;
535
+ } | {
536
+ kind: 'scorer-started';
537
+ scorer: string;
538
+ timestamp: string;
539
+ } | {
540
+ kind: 'scorer-completed';
541
+ scorer: string;
542
+ value: number;
543
+ timestamp: string;
544
+ } | {
545
+ kind: 'scorer-failed';
546
+ scorer: string;
547
+ error: RecordedError;
548
+ timestamp: string;
549
+ } | {
550
+ kind: 'trial-completed';
551
+ timestamp: string;
552
+ } | {
553
+ kind: 'error';
554
+ error: RecordedError;
555
+ timestamp: string;
556
+ };
557
+ type TrajectoryEvent = (AutEvent & {
558
+ source: 'aut';
559
+ }) | (RunnerEvent & {
560
+ source: 'runner';
561
+ });
562
+ type WorkspaceView = {
563
+ /** Absolute path to this trial-scoped workspace. Do not persist it in reports. */
564
+ root: string;
565
+ };
566
+ type CandidateWorkspace = WorkspaceView;
567
+ type EvaluatorWorkspace = WorkspaceView;
568
+ type AutContext = {
569
+ runId: string;
570
+ evalId: string;
571
+ trialId: string;
572
+ trialIndex: number;
573
+ metadata: JsonObject;
574
+ /** Run-time parameters supplied by the eval definition or CLI invocation. */
575
+ parameters?: JsonObject;
576
+ runtime?: AgentRuntimeName;
577
+ /** Contains only resources visible to the AUT/model. */
578
+ workspace: CandidateWorkspace;
579
+ /** Private evaluator capability for trusted AUT adapters; never expose this to the model. */
580
+ evaluatorWorkspace: EvaluatorWorkspace;
581
+ };
582
+ type FixtureContext = Omit<AutContext, 'workspace' | 'evaluatorWorkspace'>;
583
+ type AutAdapter<TMessage = string> = {
584
+ readonly identity?: AutIdentity;
585
+ /** Available execution environments for this AUT. */
586
+ readonly runtimes?: AgentRuntimes;
587
+ start(options: {
588
+ context: AutContext;
589
+ runtime?: AgentRuntime;
590
+ onEvent: (event: AutEvent) => void | Promise<void>;
591
+ }): Promise<AutSession<TMessage>>;
592
+ };
593
+ type AutSession<TMessage = string> = {
594
+ /** Resolves once the AUT has completed the turn initiated by this message. */
595
+ send(message: TMessage): Promise<void>;
596
+ close(): Promise<void>;
597
+ };
598
+ /**
599
+ * Defines an Agent Under Test without coupling it to a runtime or transport.
600
+ * It preserves the adapter's concrete type for application-specific helpers.
601
+ */
602
+ declare function defineAgent<const T extends AutAdapter>(agent: T): T;
603
+ type FixtureVisibility = 'candidate' | 'evaluator';
604
+ type DirectoryFixture = {
605
+ kind: 'directory';
606
+ src: string;
607
+ dst: string;
608
+ visibility: FixtureVisibility;
609
+ };
610
+ type FileFixture = {
611
+ kind: 'file';
612
+ src: string;
613
+ dst: string;
614
+ visibility: FixtureVisibility;
615
+ };
616
+ type InlineFixture = {
617
+ kind: 'inline';
618
+ file: string;
619
+ data: string;
620
+ visibility: FixtureVisibility;
621
+ };
622
+ type DynamicFixture = {
623
+ kind: 'dynamic';
624
+ create(context: FixtureContext): Fixture | Fixture[] | Promise<Fixture | Fixture[]>;
625
+ };
626
+ type Fixture = DirectoryFixture | FileFixture | InlineFixture | DynamicFixture;
627
+ /**
628
+ * Declares a directory relative to the invoking project's working directory.
629
+ * The short form is candidate-visible and copies beneath the source basename.
630
+ */
631
+ declare function directory(src: string, options?: Partial<Omit<DirectoryFixture, 'kind' | 'src'>>): DirectoryFixture;
632
+ declare function file(src: string, options: Omit<FileFixture, 'kind' | 'src'>): FileFixture;
633
+ declare function inlineFile(file: string, data: string, visibility: FixtureVisibility): InlineFixture;
634
+ declare function dynamic(create: DynamicFixture['create']): DynamicFixture;
635
+ type UserStep = {
636
+ kind: 'user';
637
+ message: string;
638
+ };
639
+ type AgentStep = {
640
+ kind: 'agent';
641
+ expectation: JsonObject;
642
+ };
643
+ type TurnView = {
644
+ userStepIndex: number;
645
+ events: readonly (AutEvent & {
646
+ source: 'aut';
647
+ })[];
648
+ assistantMessages: readonly (Extract<AutEvent, {
649
+ kind: 'message';
650
+ }> & {
651
+ role: 'assistant';
652
+ source: 'aut';
653
+ })[];
654
+ toolCalls: readonly {
655
+ eventIndex: number;
656
+ id: string;
657
+ name: string;
658
+ arguments: JsonValue;
659
+ resultObservation: 'observed' | 'absent' | 'ambiguous';
660
+ result?: JsonValue;
661
+ }[];
662
+ lastAssistantText?: string;
663
+ };
664
+ type ExpectToolCallStep = {
665
+ kind: 'expect-tool-call';
666
+ name: string;
667
+ expected: {
668
+ name: string;
669
+ arguments?: JsonValue;
670
+ };
671
+ };
672
+ type TranscriptStep = UserStep | AgentStep | ScoringRule | ExpectToolCallStep;
673
+ /** Observes a tool call in the preceding turn; never invokes a tool. */
674
+ declare function expectToolCall(expected: ExpectToolCallStep['expected']): ExpectToolCallStep;
675
+ declare function user(message: string): UserStep;
676
+ declare function agent(expectation: JsonObject): AgentStep;
677
+ type JudgeRunInfo = {
678
+ agent?: AutIdentity;
679
+ usage?: Usage;
680
+ /** Judge-agent observations; never attributed to the AUT trajectory. */
681
+ events?: JsonValue[];
682
+ };
683
+ type ScoreValue = number | {
684
+ value: number;
685
+ passed?: boolean;
686
+ explanation?: string;
687
+ evidence?: JsonValue;
688
+ /** Judge-agent evidence, never inferred from AUT usage. */
689
+ judge?: JudgeRunInfo;
690
+ };
691
+ type ScoreResult = {
692
+ name: string;
693
+ kind: 'predicate' | 'judge';
694
+ value?: number;
695
+ passed?: boolean;
696
+ explanation?: string;
697
+ evidence?: JsonValue;
698
+ judge?: JudgeRunInfo;
699
+ durationMs: number;
700
+ error?: RecordedError;
701
+ };
702
+ type ArtifactView = {
703
+ candidate: CandidateWorkspace;
704
+ evaluator: EvaluatorWorkspace;
705
+ };
706
+ type ScoringContext = {
707
+ context: AutContext;
708
+ trajectory: {
709
+ events: readonly TrajectoryEvent[];
710
+ };
711
+ artifacts: ArtifactView;
712
+ /** Most recent completed turn; absent if no user message has been sent. */
713
+ turn?: TurnView;
714
+ };
715
+ type PredicateScorer = {
716
+ kind: 'predicate';
717
+ name: string;
718
+ supportsPartial?: boolean;
719
+ run(context: ScoringContext): boolean | ScoreValue | Promise<boolean | ScoreValue>;
720
+ };
721
+ type JudgeRule = {
722
+ kind: 'judge';
723
+ name: string;
724
+ rubric: string;
725
+ /** Run even when the scenario stopped early or execution failed. */
726
+ supportsPartial?: boolean;
727
+ };
728
+ type ScoringRule = PredicateScorer | JudgeRule;
729
+ declare function predicate(name: string, run: PredicateScorer['run'], options?: Pick<PredicateScorer, 'supportsPartial'>): PredicateScorer;
730
+ declare function judge(name: string, options: Pick<JudgeRule, 'rubric' | 'supportsPartial'>): JudgeRule;
731
+ type EvalPolicy = {
732
+ timeoutMs?: number;
733
+ /** Stop later transcript steps after a failed checkpoint assertion. Default false. */
734
+ failfast?: boolean;
735
+ /** Number of independent trials requested by local and hosted runners. */
736
+ trials?: number;
737
+ };
738
+ type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
739
+ id: string;
740
+ name?: string;
741
+ agent: TAgent;
742
+ /** Separate judge agent; its model and tools are never inherited from the AUT. */
743
+ judge?: AutAdapter;
744
+ fixtures?: Fixture[];
745
+ transcript: TranscriptStep[];
746
+ scoring: ScoringRule[];
747
+ policy?: EvalPolicy;
748
+ metadata?: JsonObject;
749
+ };
750
+ declare function defineEval<const T extends EvalDefinition>(definition: T): T;
751
+ type EvalSuite<TEvals extends readonly EvalDefinition[] = readonly EvalDefinition[]> = {
752
+ id: string;
753
+ name?: string;
754
+ evals: TEvals;
755
+ };
756
+ declare function defineSuite<const TSuite extends EvalSuite>(suite: TSuite): TSuite;
757
+ type EvalRegistration = EvalDefinition | EvalSuite | EvalMatrix;
758
+ declare function authoringId(value: {
759
+ id: string;
760
+ }): string;
761
+ type EvalRegistry = {
762
+ /** All registered evals, flattened from standalone entries and suites. */
763
+ evals: readonly EvalDefinition[];
764
+ suites: readonly EvalSuite[];
765
+ matrices: readonly EvalMatrix[];
766
+ get(uri: string): EvalDefinition | undefined;
767
+ getSuite(uri: string): EvalSuite | undefined;
768
+ metadata(): EvalRegistryMetadata[];
769
+ suiteMetadata(): EvalSuiteMetadata[];
770
+ catalog(): EvalCatalogEntry[];
771
+ };
772
+ type EvalRegistryMetadata = {
773
+ id: string;
774
+ name?: string;
775
+ suiteId?: string;
776
+ };
777
+ type EvalSuiteMetadata = {
778
+ id: string;
779
+ name?: string;
780
+ evalIds: string[];
781
+ };
782
+ type EvalCatalogFixture = {
783
+ kind: Fixture['kind'];
784
+ source: string;
785
+ destination?: string;
786
+ visibility?: FixtureVisibility;
787
+ };
788
+ type EvalCatalogEntry = {
789
+ id: string;
790
+ path: string;
791
+ name?: string;
792
+ suiteId?: string;
793
+ agent: {
794
+ name?: string;
795
+ kind: string;
796
+ id?: string;
797
+ version?: string;
798
+ runtimes: Array<{
799
+ name: AgentRuntimeName;
800
+ kind: string;
801
+ }>;
802
+ };
803
+ fixtures: EvalCatalogFixture[];
804
+ trialCount: number;
805
+ scorers: Array<{
806
+ name: string;
807
+ kind: ScoringRule['kind'];
808
+ }>;
809
+ };
810
+ /**
811
+ * Creates an explicit, statically imported eval registry. A suite is a
812
+ * path-like grouping of evals; nesting is presentation derived from its ID.
813
+ */
814
+ declare function registerEvals<const TRegistrations extends readonly EvalRegistration[]>(registrations: TRegistrations): EvalRegistry;
815
+ type RunStatus = 'running' | 'completed' | 'failed' | 'cancelled';
816
+ type RunMetadata = {
817
+ schemaVersion: 2 | 3;
818
+ runId: string;
819
+ runUri: ResourceUri<'run'>;
820
+ evalId: string;
821
+ suiteId?: string;
822
+ parameters?: JsonObject;
823
+ matrix?: {
824
+ id: string;
825
+ cellKey: string;
826
+ };
827
+ aut?: AutIdentity;
828
+ startedAt: string;
829
+ };
830
+ type TrialMetadata = {
831
+ schemaVersion: 2 | 3;
832
+ runId: string;
833
+ runUri: ResourceUri<'run'>;
834
+ trialId: string;
835
+ trialUri: ResourceUri<'trial'>;
836
+ trialIndex: number;
837
+ evalId: string;
838
+ parameters?: JsonObject;
839
+ matrix?: {
840
+ id: string;
841
+ cellKey: string;
842
+ };
843
+ aut?: AutIdentity;
844
+ startedAt: string;
845
+ };
846
+ type CheckpointResult = {
847
+ step: number;
848
+ kind: 'predicate' | 'judge' | 'expect-tool-call';
849
+ name: string;
850
+ status: 'passed' | 'failed' | 'error' | 'skipped';
851
+ value?: number;
852
+ passed?: boolean;
853
+ explanation?: string;
854
+ evidence?: JsonValue;
855
+ judge?: JudgeRunInfo;
856
+ durationMs?: number;
857
+ error?: RecordedError;
858
+ matchedToolCall?: {
859
+ eventIndex: number;
860
+ id: string;
861
+ };
862
+ };
863
+ type TrialScoring = {
864
+ results: ScoreResult[];
865
+ checkpoints?: CheckpointResult[];
866
+ skippedScorers?: string[];
867
+ overall?: number;
868
+ passed: boolean;
869
+ };
870
+ type ArtifactEntry = {
871
+ /** Path relative to this trial's artifact root. */
872
+ path: string;
873
+ kind: 'file' | 'directory';
874
+ size?: number;
875
+ };
876
+ type TrialSummary = {
877
+ status: RunStatus;
878
+ endedAt: string;
879
+ durationMs?: number;
880
+ scoring?: TrialScoring;
881
+ artifacts?: ArtifactEntry[];
882
+ error?: RecordedError;
883
+ };
884
+ type RunSummary = {
885
+ status: RunStatus;
886
+ endedAt: string;
887
+ durationMs?: number;
888
+ trialCount: number;
889
+ passed: number;
890
+ failed: number;
891
+ error?: RecordedError;
892
+ };
893
+ type TrialWriter = {
894
+ appendEvent(event: TrajectoryEvent): Promise<void>;
895
+ writeScores(scoring: TrialScoring): Promise<void>;
896
+ /** Writes a file below this trial's artifact root. */
897
+ writeArtifact(path: string, data: Uint8Array): Promise<void>;
898
+ finalize(summary: TrialSummary): Promise<void>;
899
+ };
900
+ type RunWriter = {
901
+ readonly location: string;
902
+ startTrial(metadata: TrialMetadata): Promise<TrialWriter>;
903
+ finalize(summary: RunSummary): Promise<void>;
904
+ };
905
+ type ReportStore = {
906
+ startRun(metadata: RunMetadata): Promise<RunWriter>;
907
+ };
908
+ type TrialResult = {
909
+ runId: string;
910
+ runUri: ResourceUri<'run'>;
911
+ trialId: string;
912
+ trialUri: ResourceUri<'trial'>;
913
+ trialIndex: number;
914
+ evalId: string;
915
+ status: RunStatus;
916
+ reportLocation: string;
917
+ durationMs?: number;
918
+ scoring?: TrialScoring;
919
+ error?: RecordedError;
920
+ };
921
+ type AggregateScoring = {
922
+ passed: number;
923
+ failed: number;
924
+ passRate: number;
925
+ overall?: number;
926
+ };
927
+ type RunResult = TrialResult & {
928
+ runId: string;
929
+ trialCount?: number;
930
+ passed?: number;
931
+ failed?: number;
932
+ aggregateScoring?: AggregateScoring;
933
+ /** Present for an aggregate multi-trial run. */
934
+ trials?: TrialResult[];
935
+ };
936
+ declare function recordError(error: unknown): RecordedError;
937
+ //#endregion
938
+ export { TrialMetadata as $, Uuid as $t, FixtureContext as A, RecordedErrorSchema as At, ReportStore as B, TrialSummarySchema as Bt, EvalRegistryMetadata as C, parseTrajectoryJsonl as Ct, ExpectToolCallStep as D, CheckpointResultSchema as Dt, EvaluatorWorkspace as E, AutIdentitySchema as Et, JsonValue as F, ScoreResultSchema as Ft, RunWriter as G, EvalMatrixCell as Gt, RunResult as H, EvalkitConfig as Ht, JudgeRule as I, TrajectoryEventSchema as It, ScoreValue as J, defineEvalMatrix as Jt, RunnerEvent as K, MatrixSelection as Kt, JudgeRunInfo as L, TrialManifestSchema as Lt, InlineFixture as M, RunMetadataSchema as Mt, JsonObject as N, RunStatusSchema as Nt, FileFixture as O, JsonValueSchema as Ot, JsonPrimitive as P, RunSummarySchema as Pt, TranscriptStep as Q, ResourceUriSchema as Qt, PredicateScorer as R, TrialMetadataSchema as Rt, EvalRegistry as S, user as St, EvalSuiteMetadata as T, ArtifactEntrySchema as Tt, RunStatus as U, defineConfig as Ut, RunMetadata as V, UsageSchema as Vt, RunSummary as W, EvalMatrix as Wt, ScoringRule as X, ResourceKindSchema as Xt, ScoringContext as Y, ResourceKind as Yt, TrajectoryEvent as Z, ResourceUri as Zt, EvalCatalogEntry as _, inlineFile as _t, AggregateScoring as a, resourceUuid as an, Usage as at, EvalPolicy as b, recordError as bt, AutAdapter as c, agent as ct, AutIdentity as d, defineEval as dt, UuidSchema as en, TrialResult as et, AutSession as f, defineSuite as ft, DynamicFixture as g, file as gt, DirectoryFixture as h, expectToolCall as ht, AgentStep as i, resourceUriSchema as in, TurnView as it, FixtureVisibility as j, RunManifestSchema as jt, Fixture as k, JudgeRunInfoSchema as kt, AutContext as l, authoringId as lt, CheckpointResult as m, dynamic as mt, AgentRuntimeName as n, parseResourceUri as nn, TrialSummary as nt, ArtifactEntry as o, UserStep as ot, CandidateWorkspace as p, directory as pt, ScoreResult as q, canonicalParameters as qt, AgentRuntimes as r, resourceUri as rn, TrialWriter as rt, ArtifactView as s, WorkspaceView as st, AgentRuntime as t, authorId as tn, TrialScoring as tt, AutEvent as u, defineAgent as ut, EvalCatalogFixture as v, judge as vt, EvalSuite as w, ApiErrorSchema as wt, EvalRegistration as x, registerEvals as xt, EvalDefinition as y, predicate as yt, RecordedError as z, TrialScoringSchema as zt };
939
+ //# sourceMappingURL=index-BwNYw4-_.d.mts.map