/**
 * Shared confidence contract for actionability-ladder emitters (D0049).
 *
 * Every confidence-emitting site in the actionability-ladder design set
 * (per-document attribution ensemble, structured grader judgments,
 * diagnosis cards, regression detection) emits the same abstract triple
 * so consumers can reason about confidence uniformly across emitters.
 *
 * Bucket thresholds and the formula behind `level` are emitter-specific;
 * the externally comparable behavior is the `level` enum. Consumers that
 * need the underlying mechanic read `derivation` and can branch.
 */
/**
 * Conventional `derivation` identifiers for the seed set of emitters
 * named in D0049. Re-exported as a typed tuple so consumers and tests can
 * reference one source of truth instead of redeclaring the literals.
 *
 * Adding a new emitter does not require editing this list — `derivation`
 * is an open tag (see `ConfidenceDerivation`). The list is the
 * recommended starting set, not the universe.
 */
export const CONVENTIONAL_DERIVATIONS = [
    "ensemble-stdev",
    "ceiling-cross-check",
    "regression-gate",
    "card-type-specific",
    // Sentinel placeholder used by the eval pipeline's
    // `synthesizeUnparsedJudgment` fall-back. The validator
    // (`validateGraderJudgmentsCalibration`) overwrites it with
    // "ceiling-cross-check" before judgments leave the live pipeline,
    // so it should not appear on stored reports — the literal is in
    // this list so a leaked sentinel is greppable.
    "synthesized-pre-cross-check",
];
/**
 * Structural type guard for `Confidence`. Verifies the runtime shape
 * matches the contract — useful at trust boundaries that can't depend on
 * a Zod schema (the schema lives at the consuming site since each emitter
 * picks its own `level` thresholds, but the shape is shared).
 */
export function isConfidence(value) {
    if (typeof value !== "object" || value === null)
        return false;
    const v = value;
    if (v.level !== "high" && v.level !== "medium" && v.level !== "low") {
        return false;
    }
    if (typeof v.signalsPresent !== "number" ||
        !Number.isFinite(v.signalsPresent)) {
        return false;
    }
    if (typeof v.derivation !== "string" || v.derivation.length === 0) {
        return false;
    }
    return true;
}
