/**
 * Paraphrase robustness — mutates a scenario prompt in structure-
 * preserving ways, re-scores, and reports score variance.
 *
 * Mutators are pure functions `(prompt: string) => string`. Ship a
 * default set; consumers add domain-specific ones.
 *
 * Robustness score: 1 - stdDev(scores) / (mean if positive else 1).
 * A perfect agent returns the same answer regardless of typo / case /
 * reordering — any variance signals a brittle prompt.
 */
export type Mutator = (prompt: string, seed: number) => string;
export interface RobustnessResult {
    originalScore: number;
    variantScores: Array<{
        mutator: string;
        score: number;
        mutated: string;
    }>;
    meanScore: number;
    stdDev: number;
    robustness: number;
}
export declare function paraphraseRobustness(prompt: string, mutators: Array<{
    id: string;
    fn: Mutator;
}>, scoreFn: (prompt: string) => Promise<number>, options?: {
    seed?: number;
}): Promise<RobustnessResult>;
/** Lowercase the whole prompt. Robust models ignore case. */
export declare const lowercaseMutator: Mutator;
/** Reorder sentences. Robust models don't depend on sentence order. */
export declare const sentenceReorderMutator: Mutator;
/** Swap adjacent letter pairs (1 per 40 chars, min 1). Robust models tolerate typos. */
export declare const typoMutator: Mutator;
/** Add a benign politeness prefix. Robust models ignore flattery. */
export declare const politenessPrefixMutator: Mutator;
/** Compact whitespace, strip newlines. Robust models don't depend on formatting. */
export declare const whitespaceCollapseMutator: Mutator;
export declare const DEFAULT_MUTATORS: Array<{
    id: string;
    fn: Mutator;
}>;
export interface ParaphraseRobustnessScenarioInput {
    scenarios: Array<{
        id: string;
        userTurns: string[];
    }>;
    /**
     * Mutators applied to every user turn in every scenario. Each
     * scenario is paraphrased once per mutator (so `reps` × `scenarios`
     * × `mutators` total paraphrased runs).
     */
    mutators: Array<{
        name: string;
        mutator: (text: string) => string;
    }>;
    /**
     * Run a (possibly mutated) scenario and return its score in [0,1].
     * Called once for the original turns of each scenario, and once per
     * (scenario × mutator × rep) for the paraphrased variants.
     */
    runScenario: (args: {
        id: string;
        userTurns: string[];
    }) => Promise<{
        score: number;
    }>;
    /** Times to repeat each (scenario × mutator) pair. Default 1. */
    reps?: number;
}
export interface ParaphraseRobustnessScenarioResult {
    /**
     * Aggregate robustness: `mean(paraphrased) / mean(original)`,
     * clipped to `[0, 1]`. `1` = paraphrasing didn't degrade the agent;
     * `0` = paraphrasing destroyed it (or original was 0).
     */
    score: number;
    perScenario: Array<{
        id: string;
        originalScore: number;
        paraphrasedMean: number;
        /** Per-mutator delta (paraphrased − original); negative = mutator hurt. */
        deltas: Record<string, number>;
    }>;
    mutators: string[];
}
/**
 * Multi-turn convenience wrapper around {@link paraphraseRobustness}.
 *
 * Consumers with a list of multi-turn scenarios were hand-wrapping the
 * single-prompt runner per scenario; this iterates for them. Mutators
 * are applied to every user turn (mutator runs once per turn with a
 * stable seed derived from the rep index).
 *
 * Contract:
 *   - Calls `runScenario` once with the original `userTurns` to
 *     establish the baseline `originalScore`.
 *   - For each `(scenario, mutator, rep)` combination, builds a
 *     mutated copy of `userTurns` (every turn passed through
 *     `mutator.mutator`) and calls `runScenario` again.
 *   - Aggregates per-scenario means, then computes the overall
 *     `mean(paraphrasedMean) / mean(originalScore)`, clipped to
 *     `[0, 1]`. If every original score is 0 the aggregate is 0.
 */
export declare function paraphraseRobustnessScenarios(args: ParaphraseRobustnessScenarioInput): Promise<ParaphraseRobustnessScenarioResult>;
//# sourceMappingURL=paraphrase.d.ts.map