export type DeepReadonly = T extends object ? { readonly [K in keyof T]: DeepReadonly; } : T; export type JsonProjection = string | number | boolean | null | undefined | readonly JsonProjection[] | { readonly [key: string]: JsonProjection; }; type Join = P extends string ? `${K}.${P}` : never; type Previous = [never, 0, 1, 2, 3, 4]; type ProjectionPath = [Depth] extends [0] ? never : T extends readonly (infer U)[] ? '[]' | Join<'[]', ProjectionPath> : T extends object ? { [K in keyof T & string]: K | (NonNullable extends readonly (infer U)[] ? `${K}[]` | Join<`${K}[]`, ProjectionPath> : Join, Previous[Depth]>>); }[keyof T & string] : never; type ArrayIdentityPath = [D] extends [0] ? never : P extends readonly (infer I)[] ? ProjectionPath : P extends object ? { [K in keyof P]: ArrayIdentityPath, Previous[D]>; }[keyof P] : never; export type SelectedDiffOptions

= Omit & { rules?: Partial, Omit & { matchBy?: ArrayIdentityPath

| ArrayIdentityPath

[]; }>>; paths?: ProjectionPath

[]; unorderedPaths?: ProjectionPath

[]; }; /** Stored expected answers may be partial; they are never exposed to the agent. */ export type DeepPartial = T extends readonly unknown[] ? { [K in keyof T]: DeepPartial; } : T extends object ? { [K in keyof T]?: DeepPartial; } : T; export interface EvaluationContext { readonly actual: DeepReadonly; readonly expected: DeepReadonly> | undefined; } export type EvaluationCallback = (context: EvaluationContext) => number; export interface ExactDiffRule { ignore?: true; order?: 'ordered' | 'unordered'; items?: 'at-least' | 'at-most' | 'exactly'; matchBy?: string | string[]; allowExtraFields?: boolean; numericTolerance?: number; } export interface ExactDiffOptions { rules?: Record; paths?: string[]; unorderedPaths?: string[]; numericTolerance?: number; allowExtraFields?: boolean; } export interface ExactDiffEvaluator { readonly kind: 'exact-diff'; readonly options?: ExactDiffOptions; /** Applied to actual and expected separately. */ readonly select: (output: DeepReadonly>) => JsonProjection; } export interface LlmJudgeEvaluator { readonly kind: 'llm-judge'; readonly prompt: string; readonly select: (context: EvaluationContext) => JsonProjection; readonly model?: string; } export interface CustomEvaluator { readonly kind: 'custom'; readonly evaluate: EvaluationCallback; } export type Evaluator = ExactDiffEvaluator | LlmJudgeEvaluator | CustomEvaluator; export type EvaluatorInput = EvaluationCallback | Evaluator; export interface WeightedPass> { readonly kind: 'weighted'; readonly weights: S; readonly threshold: number; } export interface CallbackPass> { readonly kind: 'callback'; readonly evaluate: (scores: Readonly) => boolean; } export type EvaluationPass> = WeightedPass | CallbackPass; export interface AgentEvaluation = Record> { readonly evaluators: Readonly>>; readonly pass: EvaluationPass; } export interface CompiledEvaluation { evaluators: Record; pass: { kind: 'callback'; } | { kind: 'weighted'; weights: Record; threshold: number; }; } /** Compare a typed projection, keeping full dataset expected answers unchanged. */ export declare function exactDiff(options: { select: (output: DeepReadonly>) => P; options?: SelectedDiffOptions

; }): ExactDiffEvaluator; /** Judge only the explicitly selected data through the worker model connection. */ export declare function llmJudge(options: { prompt: string; select: (context: EvaluationContext) => JsonProjection; model?: string; }): LlmJudgeEvaluator; /** A declarative weighted average, rendered as controls in the evaluation UI. */ export declare function weightedScore>(options: { weights: S; threshold: number; }): WeightedPass; export declare function validateWeightedPass(options: { weights: object; threshold: number; }, names?: readonly string[]): void; export declare function freezeEvaluationData(value: T): T; export declare function validateEvaluatorName(name: string): void; export declare function normalizeEvaluator(input: EvaluatorInput): Evaluator; export {};