/** * Grading — run graders against trajectories, optionally compare two runs. * * Core function: * gradeTrajectory(trajectory, graders) → grade a single trajectory * compareRuns(baseline, skilled) → grade both, compute deltas * * This is pure evaluation — no agent execution happens here. */ import type { Trajectory } from "../trajectory/types.js"; import { type GraderResult } from "../graders/types.js"; import { type Stimulus, type StimulusGraderConfig } from "../eval/types.js"; import type { GraderRegistry } from "../graders/registry.js"; import type { LlmClient } from "../graders/llm/types.js"; import type { ReasoningEffort } from "../graders/llm/types.js"; import type { JudgeProviderSpec } from "../provider/copilot-provider.js"; export interface StimulusGradeResult extends GraderResult { stimulusName: string; trajectoryId: string; timestamp: Date; } export interface ComparisonResult { baseline: GraderResult; skilled: GraderResult; deltas: MetricDeltas; } export interface MetricDeltas { tokensDelta: number; turnsDelta: number; toolCallsDelta: number; wallTimeMsDelta: number; errorsDelta: number; skillActivated: boolean; } export interface GradeTrajectoryOptions { registry?: GraderRegistry; /** * Authoritative stimulus from the eval spec. For turn-scoped diff grading, * this must preserve the original `turns` structure and must not be rebuilt * from a persisted trajectory's synthesized `prompt`. */ stimulus?: Stimulus; /** Default model for LLM graders (from eval config or CLI flag). Per-grader config.model takes priority. */ judgeModel?: string; /** * Reasoning effort for the judge model. Applied only when the eval-level * judge model is used (i.e. no per-grader `config.model` override). */ judgeReasoningEffort?: ReasoningEffort; /** * BYOK provider for the LLM judge (from `defaults.judge_provider`). Injected * into every LLM grader so the judge session targets a custom endpoint. */ judgeProvider?: JudgeProviderSpec; /** Grader weights from `scoring.weights` — keyed by grader type. Must be a normalized distribution (values sum to 1). When provided, the aggregate score is the weighted sum; types absent from the map receive weight 0 and are excluded from the score. */ weights?: Record; /** Base directory for resolving relative sidecar diff paths (trajectory.diffPath). Pass the --run-dir value when re-grading from a saved run output directory. */ diffBaseDir?: string; /** Reference-solution diff passed to every grader as `GraderInput.goldenPatch`. */ goldenPatch?: string; /** Optional callback fired before each grader runs. */ onGraderStart?: (info: { graderIndex: number; totalGraders: number; graderName: string; graderType: string; }) => void | Promise; /** Optional callback fired after each grader completes. */ onGraderComplete?: (info: { graderIndex: number; totalGraders: number; graderName: string; passed: boolean | null; evidence: string; durationMs: number; }) => void | Promise; } export declare function createDefaultGraderRegistry(llmClient?: LlmClient): GraderRegistry; /** * Register built-in LLM graders into an existing registry. * * Use this to upgrade a registry with LLM capabilities without * recreating it (which would drop any plugin registrations). */ export declare function registerLlmGraders(registry: GraderRegistry, llmClient: LlmClient): void; /** * Check whether any grader configs require an LLM client. * * Checks the registry first (catches plugin/external graders via the * behavior contract), then falls back to built-in LLM grader names for * cases where the LLM graders aren't yet registered (no LlmClient provided). */ export declare function needsLlmClient(graderConfigs: StimulusGraderConfig[], registry?: GraderRegistry): boolean; /** * Check whether any grader configs require filesystem access to the workspace. * * Checks the registry first (catches plugin/external graders via the * behavior contract), then falls back to built-in workspace grader names * for cases where graders aren't yet registered. */ export declare function needsWorkspace(graderConfigs: StimulusGraderConfig[], registry?: GraderRegistry): boolean; export declare function gradeTrajectory(trajectory: Trajectory, graderConfigs: StimulusGraderConfig[], options?: GradeTrajectoryOptions): Promise; export declare function compareRuns(baseline: Trajectory, skilled: Trajectory, graderConfigs: StimulusGraderConfig[], registry?: GraderRegistry, weights?: Record, stimulus?: Stimulus): Promise; export declare function mapGraderConfig(graderConfig: StimulusGraderConfig): Record; //# sourceMappingURL=grading.d.ts.map