/**
 * StandardsConformanceReviewer — check a draft spec against the living
 * constitution and SIGNAL possible violations.
 *
 * Reuses the CoherenceReviewer *pattern* (injected IntelligenceProvider →
 * subscription/REPL-pool, anti-injection framing, degrade-safe) but returns a
 * structured per-standard report rather than a single block/warn verdict.
 *
 * Signal-only (spec §4): it produces a report; it has NO blocking authority. The
 * human ratification + the instar-dev `approved:true` gate decide. Degrade-safe:
 * no provider, or an LLM throw/timeout → an empty report (fail-open) — the gate
 * must never block spec work by being down.
 *
 * Spec: docs/specs/standards-conformance-gate.md §2.
 */
import type { IntelligenceProvider, IntelligenceOptions } from '../types.js';
import type { StandardArticle } from '../StandardsRegistryParser.js';
export type ConformanceStatus = 'possible-violation';
/**
 * Constitutional-fit verdict for the Constitutional Traceability gate (P13's
 * sibling): does the spec's design INDISPUTABLY fit the parent constitutional
 * standard it names? 'fit' passes; 'weak'/'none' block (the work must improve the
 * constitution to cover it, or be recognized as unconstitutional).
 */
export type ConformanceFitVerdict = 'fit' | 'weak' | 'none';
export interface ConformanceFinding {
    /** The standard the draft may violate (article name). */
    standard: string;
    family: string;
    status: ConformanceStatus;
    /** One-line plain-English reason. */
    reason: string;
}
export interface ConformanceReport {
    findings: ConformanceFinding[];
    /** How many standards were checked against. */
    standardsChecked: number;
    /** True when the LLM step didn't run (no provider / error) — report is empty, not authoritative. */
    degraded: boolean;
    degradeReason?: 'no-intelligence' | 'error' | 'unparseable';
    checkedAt: string;
    /** Constitutional-fit verdict (Constitutional Traceability gate) — populated when a caller requests it via judgeFit(). */
    fit?: FitReport;
}
/**
 * The Constitutional Traceability fit judgment: does the spec indisputably fit the
 * parent constitutional standard it names? The structural half (does the named
 * parent resolve to a real registry article?) always runs and can BLOCK with
 * 'none'. The qualitative half (is the fit indisputable?) is an LLM judgment that
 * BLOCKS on 'weak'/'none' but FAILS OPEN to 'fit' when the reviewer is degraded —
 * the gate must never block work by being down.
 */
export interface FitReport {
    verdict: ConformanceFitVerdict;
    /** The parent-principle name the spec claims (echoed). */
    parentPrinciple: string;
    /** Whether parentPrinciple resolved to a real registry article. */
    parentResolved: boolean;
    /** One-line plain-English rationale. */
    reason: string;
    /** True when the LLM step didn't run (fail-open to 'fit'). */
    degraded: boolean;
    degradeReason?: 'no-intelligence' | 'error' | 'unparseable';
    checkedAt: string;
}
/** Hard cap so a wall-of-text spec can't dominate the prompt (injection hardening). */
export declare const MAX_SPEC_CHARS = 24000;
/**
 * Per-call budget passed to the provider for the conformance review. Reviewing
 * a full spec against the whole constitution is a single heavy top-tier call
 * that routinely exceeds the providers' 30s default; without this the call is
 * killed mid-review and the gate returns a misleadingly-empty degraded report.
 * Kept strictly BELOW the route's outer middleware budget (SPEC_REVIEW_TIMEOUT_MS
 * in AgentServer) so the provider's clean kill fires before the HTTP 408 — a
 * genuinely-too-slow spec degrades fail-open rather than erroring at the client.
 */
export declare const CONFORMANCE_REVIEW_TIMEOUT_MS = 150000;
export declare function buildConformancePrompt(specMarkdown: string, articles: StandardArticle[]): string;
/** Tolerant JSON-array parse (handles code fences / prose preamble). */
export declare function parseConformanceResponse(raw: string, articles: StandardArticle[]): ConformanceFinding[] | null;
/** Build the Constitutional Traceability fit-judgment prompt for one named parent standard. */
export declare function buildFitPrompt(specMarkdown: string, parentArticle: StandardArticle): string;
/** Tolerant parse of the fit-judgment JSON object. Returns null on unparseable. */
export declare function parseFitResponse(raw: string): {
    verdict: ConformanceFitVerdict;
    reason: string;
} | null;
export declare class StandardsConformanceReviewer {
    private intelligence;
    private opts;
    constructor(intelligence: IntelligenceProvider | null, opts?: {
        model?: IntelligenceOptions['model'];
    });
    review(specMarkdown: string, articles: StandardArticle[]): Promise<ConformanceReport>;
    /**
     * Constitutional Traceability fit judgment (Part C). The STRUCTURAL half always
     * runs: the named parent must resolve to a real registry article, else 'none' (a
     * real block — "name a parent that resolves", not a degrade). The QUALITATIVE half
     * is the LLM; it returns 'fit'/'weak'/'none' and FAILS OPEN to 'fit' when degraded
     * (no provider / error / unparseable) — the gate must never block work by being down.
     */
    judgeFit(specMarkdown: string, parentPrincipleName: string, articles: StandardArticle[]): Promise<FitReport>;
}
//# sourceMappingURL=standards-conformance.d.ts.map