/**
 * Verifier — caller-provided domain-specific evaluation interface.
 *
 * Design intent:
 * - No built-in verifier pool or registry. Each caller constructs their own
 *   verifier that encodes domain knowledge (math, code correctness, policy, …).
 * - `evaluate` may be sync or async to accommodate both lightweight heuristics
 *   and LLM-backed judges without forcing unnecessary Promise overhead.
 * - `name` is mandatory for telemetry correlation (spans, metrics, logs).
 */
// ─── Runtime guard ───────────────────────────────────────────────────────────
/**
 * Assert that `r` is a valid {@link VerifierResult} at runtime.
 *
 * Throws a `TypeError` with a descriptive message when:
 * - `r` is null or not an object
 * - `score` is not a finite number in [0, 1]
 * - `rationale` is not a string
 *
 * Use this after `await verifier.evaluate(output)` when the verifier is
 * provided by untrusted third-party code.
 */
export function assertVerifierResult(r) {
    if (r === null || r === undefined || typeof r !== "object") {
        throw new TypeError(`assertVerifierResult: expected an object, got ${r === null ? "null" : typeof r}`);
    }
    const { score, rationale } = r;
    if (typeof score !== "number" || !Number.isFinite(score) || score < 0 || score > 1) {
        throw new TypeError(`assertVerifierResult: score must be a finite number in [0,1], got ${String(score)}`);
    }
    if (typeof rationale !== "string") {
        throw new TypeError(`assertVerifierResult: rationale must be a string, got ${typeof rationale}`);
    }
}
//# sourceMappingURL=verifier.js.map