import { JudgeVerdict } from '@tangle-network/agent-eval';
export { EnsembleAggregate, JudgeVerdict, RunRecord, aggregateJudgeVerdicts } from '@tangle-network/agent-eval';
import { Scenario, JudgeConfig } from '@tangle-network/agent-eval/campaign';
export { CampaignResult, DispatchContext, Gate, JudgeConfig, JudgeDimension, JudgeScore, LabeledScenarioStore, MutableSurface, Mutator, Scenario, SurfaceProposer, defaultProductionGate, evolutionaryProposer, gepaProposer, paretoSignificanceGate, runCampaign } from '@tangle-network/agent-eval/campaign';
export { T as TrustItem, a as TrustThresholds, b as TrustVerdict, t as trustVerdicts } from '../trust-gate-Dcm5xSva.js';
export { SelfImproveBudget, SelfImproveOptions, SelfImproveResult, selfImprove } from '@tangle-network/agent-eval/contract';

/**
 * Eval-campaign — the app-shell's curated surface for a product's
 * self-improvement loop, NOT a reimplementation.
 *
 * The loop ENGINE lives in `@tangle-network/agent-eval` (a peer dependency):
 * `selfImprove` already owns the whole cycle — train/holdout split, the GEPA
 * proposer, the held-out production gate, durable provenance + hosted ingest, and
 * every default. A product should NOT hand-roll `runImprovementLoop` +
 * `emitLoopProvenance` around it (that is the boilerplate this surface exists to
 * delete). It should call `selfImprove` with three things it actually owns:
 * scenarios, an `agent` dispatch, and a `judge`.
 *
 * This module adds the one piece `selfImprove` does not own and which every
 * multi-model product re-hand-rolls — the ensemble judge:
 *
 *   {@link buildEnsembleJudge} — turn a per-rubric `scoreOne` into a
 *   `JudgeConfig` that fans out N uncorrelated judge calls and reduces them via
 *   the substrate's `aggregateJudgeVerdicts` (survivor-mean, inter-rater spread,
 *   fail-loud on all-failed). A product writes its rubric + one judge call; the
 *   fan-out, partial-failure handling, and composite are the scaffold's.
 *
 * Everything else is a curated re-export so a product has ONE eval import:
 * `selfImprove` + the gates + the proposers + the types. See
 * `.claude/skills/eval-campaign/SKILL.md` for the wiring contract.
 */

/** Config for {@link buildEnsembleJudge}. `D` = the rubric's dimension union. */
interface EnsembleJudgeConfig<TArtifact, TScenario extends Scenario, D extends string> {
    /** Judge name — appears in traces and scorecards. */
    name: string;
    /** Stable-ordered rubric dimensions. Drives the `JudgeDimension` list AND the
     *  reducer keys, so a judge that omits a dimension scores it 0 (never silently
     *  dropped). */
    rubric: readonly D[];
    /**
     * Score ONE artifact on the rubric → a raw per-dimension verdict. Called
     * `judgeReps` times per artifact; vary the model by `rep` for an uncorrelated
     * ensemble (judges that share a base model share its bias). Return
     * `{ model, perDimension: null }` to record a judge failure WITHOUT killing
     * the ensemble; throw only on an unrecoverable error (the whole rep is then
     * treated as a failed judge).
     */
    scoreOne: (input: {
        artifact: TArtifact;
        scenario: TScenario;
        signal: AbortSignal;
        rep: number;
    }) => Promise<JudgeVerdict<D>>;
    /** Independent judge calls per artifact, reduced by `aggregateJudgeVerdicts`.
     *  Default 1. Raise (with model variety in `scoreOne`) for inter-rater bands. */
    judgeReps?: number;
    /** Per-dimension composite weights. Default: uniform over `rubric`. A partial
     *  map selects-and-weights exactly the named dimensions. */
    weights?: Partial<Record<D, number>>;
    /** Optional human-readable dimension descriptions. Default: the key itself. */
    describe?: (dim: D) => string;
}
/**
 * Build a `JudgeConfig` whose `score()` fans out `judgeReps` independent
 * `scoreOne` calls and reduces them with the substrate's
 * `aggregateJudgeVerdicts`. A single judge call failing does NOT fail the cell
 * (it is recorded and dropped); only ALL judges failing throws — which the
 * campaign records as a failed cell, never a silent zero.
 *
 * Pass the result straight to `selfImprove({ judge })` (or `runCampaign`).
 */
declare function buildEnsembleJudge<TArtifact, TScenario extends Scenario, D extends string>(cfg: EnsembleJudgeConfig<TArtifact, TScenario, D>): JudgeConfig<TArtifact, TScenario>;

export { type EnsembleJudgeConfig, buildEnsembleJudge };
