import { A as AgentEvalError } from './errors-Dwqw-T_m.js';
import { R as RunRecord } from './run-record-DgUVo5pw.js';

/**
 * Backend-integrity guard: distinguish "agent failed" from "eval ran against
 * a stub / unconfigured backend." Without this guard a canonical eval can
 * silently report `0/N passed` and look like an agent-quality problem when
 * the LLM was never actually called — the failure mode we just hit running
 * the 4-vertical parallel eval (legal-sandbox-stub returned hard-coded 33-104
 * char strings; gtm/creative defaulted to a cli-bridge that wasn't running).
 *
 * The shape:
 *
 *   const report = summarizeBackendIntegrity(records)
 *   assertRealBackend(records)   // throws BackendIntegrityError if 100% stub
 *
 * A record is "stub-mode" if its `tokenUsage.input === 0 && tokenUsage.output === 0`.
 * (`costUsd` alone is unreliable — some backends successfully call LLMs but
 *  don't propagate pricing, producing real tokens with $0 cost.)
 *
 * Verdicts:
 *   - `real`   — at least one record has nonzero token usage
 *   - `stub`   — every record is stub-mode (eval ran blind)
 *   - `mixed`  — some records real, some stub (partial backend failure;
 *                often the 429-cascade or auth-half-failed case)
 */

interface BackendIntegrityReport {
    /** Total records inspected. */
    totalRecords: number;
    /** Records with input=0 AND output=0 (a stub fingerprint). */
    stubRecords: number;
    /** Records with nonzero token usage (real LLM activity). */
    realRecords: number;
    /** Records where output>0 but costUsd=0 (real LLM, broken cost ledger). */
    uncostedRecords: number;
    /** Sum of input tokens across all records. */
    totalInputTokens: number;
    /** Sum of output tokens across all records. */
    totalOutputTokens: number;
    /** Sum of costUsd across all records. */
    totalCostUsd: number;
    /** Worst-case integrity verdict. */
    verdict: 'real' | 'mixed' | 'stub';
    /** Human-readable diagnosis suitable for terminal output. */
    diagnosis: string;
}
/**
 * Error thrown when an integrity assertion fails. Caller can pattern-match
 * by `code === 'AGENT_EVAL_BACKEND_STUB'` to differentiate from other
 * errors.
 */
declare class BackendIntegrityError extends AgentEvalError {
    readonly report: BackendIntegrityReport;
    constructor(message: string, report: BackendIntegrityReport);
}
/**
 * Inspect a batch of RunRecords and return an integrity report. Pure
 * function — no I/O, no logging. The caller decides what to do with the
 * verdict (print warning, throw, gate CI, etc.).
 */
declare function summarizeBackendIntegrity(records: ReadonlyArray<RunRecord>): BackendIntegrityReport;
/**
 * Throw BackendIntegrityError if the verdict is 'stub' — i.e. every record
 * shows zero LLM activity. Non-strict callers can pass `{ allowMixed: false }`
 * to also reject mixed verdicts (recommended for CI gates).
 *
 * Real backends pass through silently.
 */
declare function assertRealBackend(records: ReadonlyArray<RunRecord>, opts?: {
    allowMixed?: boolean;
}): BackendIntegrityReport;

/**
 * @stable
 *
 * AgentProfile — the eval harness's unit of variation.
 *
 * A profile pins everything that changes agent behaviour for a benchmark
 * cell: the model, the active skills, the prompt version, the available
 * tools. Vary the profile — swap a model, add a skill — and re-run the suite
 * to benchmark the change. The scorecard keys a cell on
 * `(scenarioId, profileHash)`, so the model is not a separate axis: it lives
 * inside the profile, and two profiles with the same model but different
 * skills are different cells.
 *
 * `agentProfileHash` is the profile's behaviour identity. Two profiles that
 * produce the same agent behaviour share a hash (and a scorecard cell);
 * reordering `skills` or `tools` does not change it; the human-facing `id`
 * label does not affect it.
 */
interface AgentProfile {
    /** Human-facing label, e.g. `sonnet-legal-skills-v3`. Not part of the hash. */
    id: string;
    /** Model snapshot id this profile pins, e.g. `claude-sonnet-4-6@2025-04-15`. */
    model: string;
    /** Skill ids/versions active in this profile — the primary behaviour lever. */
    skills?: string[];
    /** Prompt version identifier. */
    promptVersion?: string;
    /** Tool ids available to the agent. */
    tools?: string[];
    /** Any other behaviour-bearing knobs that should fingerprint into the hash. */
    metadata?: Record<string, string | number | boolean>;
}
/**
 * Deterministic behaviour identity of a profile — a sha256 over the
 * behaviour-bearing fields. `skills` and `tools` are order-insensitive; the
 * `id` label is excluded. Throws on a profile with no `model` — an unkeyable
 * profile must fail loud rather than collapse into a blank-model cell.
 */
declare function agentProfileHash(profile: AgentProfile): string;

export { type AgentProfile as A, type BackendIntegrityReport as B, BackendIntegrityError as a, agentProfileHash as b, assertRealBackend as c, summarizeBackendIntegrity as s };
