import type { DatasetExample } from '../types/evaluate.js'; /** A target's output kept for reuse, with what producing it took. */ export interface CachedOutput { /** What the target returned. */ output: unknown; /** How long producing it took, in milliseconds. */ latencyMs: number; /** What it cost, when known. */ cost?: number; /** ISO-8601 time it was produced. */ cachedAt: string; } /** * Where `evaluate()` keeps target outputs between experiments. Keys are opaque hex strings; a cache * only stores and returns values by them. */ export interface EvaluationCache { /** The output stored under a key. */ get(key: string): Promise | CachedOutput | undefined; /** Stores an output under a key, replacing any there. */ set(key: string, value: CachedOutput): Promise | void; } /** Options for a `MemoryEvaluationCache`. */ export interface MemoryEvaluationCacheOptions { /** Outputs kept; the least recently used is dropped first. Defaults to 10,000. */ maxEntries?: number; } /** * Target outputs in process memory, least recently used dropped first. Outputs are copied in and * out, so an evaluator that mutates an output cannot change what a later experiment reuses. */ export declare class MemoryEvaluationCache implements EvaluationCache { private readonly entries; private readonly maxEntries; constructor(options?: MemoryEvaluationCacheOptions); /** The output under a key, marking it recently used. */ get(key: string): CachedOutput | undefined; /** Stores an output, dropping the least recently used when full. */ set(key: string, value: CachedOutput): void; /** Outputs held. */ size(): number; /** Drops every output. */ clear(): void; } /** * A fingerprint for whatever decides a target's output — a model name, a prompt version, a * temperature, a context bundle version — as `f` and 16 hex digits of a SHA-256 over its canonical * JSON, so the same settings always give the same fingerprint, whatever the key order. */ export declare function fingerprintOf(value: unknown): Promise; /** * The cache key of one example run: a SHA-256 over the target's fingerprint, the example's id and * inputs, and the repetition. The expected output is left out, so correcting a label re-scores the * cached output instead of producing it again. */ export declare function evaluationCacheKey(fingerprint: string, example: DatasetExample, run: number): Promise;