import type { BoberConfig } from "../../config/schema.js"; import { runReplayHarness } from "./replay-harness.js"; export interface VariantScore { variantId: string; prompt: string; promptLength: number; /** replayPassCount = total - regressions; axis 1: maximize (desc). */ replayPassCount: number; regressions: number; improvements: number; } export interface GepaResult { promoted: boolean; winnerPath: string | null; baselineRegressions: number; variantsTried: number; } /** * Produces a deterministic set of small textual mutations of `basePrompt`. * A fixed seed yields byte-identical variants on every call (no Math.random). * * Three operator classes applied in order: * 1. Append a clarifying constraint sentence. * 2. Paraphrase the first markdown heading (## or #). * 3. Reorder two adjacent guidance bullets (lines starting with "- "). * * Each operator uses the PRNG to pick among a small fixed vocabulary so the * result space is deterministic and bounded. */ export declare function proposeVariants(basePrompt: string, seed: number): string[]; /** * Returns the non-dominated (Pareto) frontier of `scored`. * * Dominance axes (both must be worse for a variant to be excluded): * axis 1: replayPassCount — higher is better (desc). * axis 2: promptLength — lower is better (asc). * * A variant B is dominated by A iff: * A.replayPassCount >= B.replayPassCount AND A.promptLength <= B.promptLength * with at least one strict inequality. * * PURE: no clock, no fs, input array is not mutated. */ export declare function paretoSet(scored: VariantScore[]): VariantScore[]; /** Options accepted by evolve(). */ export interface EvolveOptions { role: "generator" | "evaluator"; seed: number; dryRun?: boolean; /** Injected runId for deterministic test paths. Defaults to `evolve-`. */ runId?: string; } /** DI seam — tests inject a stub harness; production uses the real one. */ export type HarnessFn = typeof runReplayHarness; export interface EvolveDeps { harness?: HarnessFn; } /** * Orchestration entry point for offline prompt evolution. * * Reads the base prompt, proposes variants, scores each via the harness, * keeps the Pareto frontier, and writes results under .bober/evolve//. * * Promotion predicate (strict — a tie does NOT promote): * eligible ⟺ result.regressions.length === 0 AND result.improvements.length > baseline.improvements.length * * Writes: * report.json — always * promoted/.md — only when a winner exists AND !dryRun * * SAFETY: all write paths are constructed under .bober/evolve// — see SAFETY INVARIANTS above. */ export declare function evolve(projectRoot: string, config: BoberConfig, opts: EvolveOptions, deps?: EvolveDeps): Promise; //# sourceMappingURL=gepa.d.ts.map