/** * Pipeline types — shared interfaces for eval/grade pipeline output. */ import type { Trajectory } from "../trajectory/types.js"; import type { GraderResult } from "../graders/types.js"; import type { StimulusScore } from "../scoring/scorer.js"; import type { StimulusGradeResult } from "./grading.js"; export type EvalOutcomeStatus = "success" | "error" | "skipped"; /** * Oracle baseline (`--no-golden-input`) negative-control verdict, carried on the * outcome as a distinct fact from the grade itself. * * In baseline mode the exit code is a per-grader classification (a `required:` * grader that fails is healthy; a grader that trivially passes is a problem), * NOT the aggregate `score`/`passed`. Those grade fields cannot faithfully * encode the verdict on re-read: a healthy baseline emits `score: 0`, so a * threshold-aware reader (`resolveGradePass` → `score >= threshold`) would * report it failed even though the CLI exited 0. `threshold: 0` is legal and * `score >= 0` always holds, so no score value survives all thresholds either. * Consumers that re-read baseline outcomes MUST prefer `ok` here over any * score/threshold computation. */ export interface OracleBaselineOutcome { mode: "baseline"; /** * True when the negative control held for THIS stimulus. `vally oracle` exits 0 * only when every stimulus in the run is `ok`, so a single record is not the * run-level verdict. */ ok: boolean; } /** * Runtime shape guard for {@link OracleBaselineOutcome}. JSONL is arbitrary, * untrusted input (a hand-written or malformed record may carry * `ok: "false"`, which is a truthy string), so consumers MUST validate the * marker before honoring it and otherwise fall back to the score/threshold rule. */ export declare function isOracleBaselineOutcome(value: unknown): value is OracleBaselineOutcome; /** * Machine-readable output for a single stimulus run. * One of these is emitted per line when --output jsonl is active. */ export interface EvalOutcome { /** Outcome status. Consumers should check this instead of inferring from trajectory === null. */ status: EvalOutcomeStatus; /** The trajectory of the run (eval) or the input trajectory (grade). * null when trajectory is unavailable (error or skipped). */ trajectory: Trajectory | null; /** Top-level grading result with per-grader breakdown in `details`. * null when grading was skipped (e.g. --skip-grade). */ gradeResult: StimulusGradeResult | null; /** * Name of the stimulus this outcome belongs to. Emitted so consumers that * ingest JSONL (e.g. the analytics server) can identify the stimulus even * when `trajectory` is null. */ stimulus?: string; /** Error message when the stimulus run failed. */ error?: string; /** Human-readable reason this stimulus was skipped. Present only when * `status === "skipped"` (e.g. the active executor is not in the * stimulus's `supported_executors` allow-list). */ skipReason?: string; /** * Experiment context, present when this outcome was produced by * `vally experiment run`. Absent for plain `vally eval` runs. * Used for variant pairing, drift correlation, and reproducibility. */ experiment?: ExperimentOutcomeContext; /** * Oracle baseline negative-control verdict. Present only for * `vally oracle --no-golden-input` outcomes. When set, threshold-aware * consumers MUST prefer `oracleBaseline.ok` over any score/threshold rule — * the baseline verdict is a per-grader classification, not the aggregate * score (see {@link OracleBaselineOutcome}). */ oracleBaseline?: OracleBaselineOutcome; } /** * Experiment identity attached to outcomes produced by experiment runs. * Lean by design: just enough to pair outcomes across variants and link * back to the run summary record (which carries the full resolved config). */ export interface ExperimentOutcomeContext { /** Experiment config `name` field. */ name: string; /** Unique ID per `vally experiment run` invocation. */ runId: string; /** Variant key from the experiment config's `variants` map. */ variant: string; /** * Name of the baseline variant for this experiment run (a key in the * `variants` map). Identical across every record of a run; embedded per * record so consumers (e.g. `vally compare`, the analytics server) can * discover the baseline without a separate manifest or the experiment spec. * Optional: records produced before this field was introduced omit it, so * consumers must tolerate its absence. */ baseline?: string; /** Eval file path relative to the experiment file directory. */ evalFile: string; /** Content hash of the eval file. */ evalHash: string; /** Hash of the effective resolved config (defaults + environment). */ configHash: string; } /** Summary of a single completed trial. Carried inside a * {@link MultiTrialResult} and inside per-eval `StimulusSummary` * buckets in `RunSummary`. */ export interface TrialSummary { trialIndex: number; grade?: GraderResult; /** true = graders passed, false = graders failed or execution error, * null = unscored. */ passed: boolean | null; durationMs: number; metrics: Trajectory["metrics"]; /** The full trajectory for this trial. Reporters MUST treat this as * immutable; the CLI/composite owns trajectory memory lifecycle. */ trajectory?: Trajectory; /** Error message if execution failed. */ error?: string; } /** Aggregated multi-trial result for one stimulus. */ export interface MultiTrialResult { stimulusName: string; trials: TrialSummary[]; score: StimulusScore | null; } //# sourceMappingURL=types.d.ts.map