import type { SuiteVerdict } from "../eval/judge/types.js"; import type { OptimizeAppliedChange, OptimizeMutationDiagnostic } from "./sourceMutator.js"; import type { OptimizeTarget, OptimizeTargetSet } from "./targets.js"; import type { OptimizeDecision, OptimizeResult } from "./types.js"; export type OptimizeVerbosity = "silent" | "default"; /** * Presentation boundary for the pointwise optimizers (greedy, GEPA). They speak * in a scalar objective + decision per iteration rather than the pairwise * judge's win counts, so they get their own reporter shape. Same silent/default * gating as the pairwise reporter: `silent` renders nothing. */ export type PointwiseReporter = { runStarted(args: { optimizer: string; runId: string; targets: OptimizeTarget[]; inputCount: number; iterations: number; }): void; gradingSetup(args: { graders: { name: string; describe: string; }[]; firstInput?: { id: string; goal?: string; }; }): void; baselineScored(args: { objective: number; }): void; iterationDecided(args: { iter: number; total: number; decision: OptimizeDecision; objective?: number; rationale?: string; changes?: OptimizeAppliedChange[]; diagnostics?: OptimizeMutationDiagnostic[]; durationMs?: number; }): void; /** Free-form, verbosity-gated line for optimizer-specific detail (e.g. which parent GEPA sampled). */ note(message: string): void; runFinished(args: { result: OptimizeResult; initialTargets: OptimizeTarget[]; finalTargets: OptimizeTarget[]; durationMs: number; }): void; }; /** One-line summary of why a mutation was rejected at validation. */ export declare function formatDiagnostics(diagnostics: OptimizeMutationDiagnostic[]): string; export declare function createPointwiseReporter(verbosity: OptimizeVerbosity, log?: (line: string) => void): PointwiseReporter; export declare const SILENT_POINTWISE_REPORTER: PointwiseReporter; /** Champion/candidate eval record paths for one input, read lazily when the * reporter renders response diffs. */ export type InputRecordPair = { inputId: string; championRecordPath?: string; candidateRecordPath?: string; }; /** * Presentation boundary for the optimize loop. The loop emits semantic * events; reporters decide what (if anything) to render. Silent renders * nothing; default renders the discovered-target gut check, per-iteration * progress with colored value and response diffs, and a final summary of * every optimized variable's start and end value. */ export type OptimizeReporter = { runStarted(args: { runId: string; targetSet: OptimizeTargetSet; inputCount: number; }): void; phase(args: { iter: number; total: number; message: string; }): void; validationFailed(args: { iter: number; total: number; diagnostics: OptimizeMutationDiagnostic[]; }): void; iterationRejected(args: { iter: number; total: number; phase: string; error: string; }): void; iterationDecided(args: { iter: number; total: number; decision: "accepted" | "rejected"; verdict: SuiteVerdict; changes: OptimizeAppliedChange[]; rationale: string; records: InputRecordPair[]; }): void; runFinished(args: { result: OptimizeResult; writebackApplied: boolean; initialTargets: OptimizeTarget[]; finalTargets: OptimizeTarget[]; }): void; }; export declare function createOptimizeReporter(verbosity: OptimizeVerbosity, log?: (line: string) => void): OptimizeReporter; export declare const SILENT_OPTIMIZE_REPORTER: OptimizeReporter;