/**
 * TopicIntentArcCheck — Layer 3 of the Topic Intent Layer.
 *
 * Pre-send classifier that scans an agent's draft reply against the
 * topic's current tentative + settled items. Fires signals (not blocks)
 * when the draft would:
 *   - Act on a tentative item without conversational confirmation
 *   - Contradict an item already at authoritative tier
 *
 * Per spec v14 sections "How the agent asks for confirmation" and
 * "Authority on send" — ArcCheck is SIGNAL-only. The existing outbound
 * gate retains authority. The fired signal includes a suggested rewrite
 * hint, but never blocks. The agent itself decides whether to redraft.
 *
 * Per `feedback_gate_latency_vs_client_timeout`: ArcCheck is designed
 * to run concurrent with send-prep, not as a serial second gate. The
 * timeout is enforced at the HTTP route layer (route caller sets the
 * deadline; classifier itself is pure async).
 *
 * Per `feedback_signal_vs_authority`: ArcCheck is the brittle/low-context
 * filter that detects and emits a signal. The higher-level outbound gate
 * (tone-gate, response-review) has blocking authority. Two-layer split.
 *
 * Framework-agnostic: the LLM call is injected. Production wires it to
 * Instar's LlmQueue + IntelligenceProvider; tests stub it.
 */
import type { IntelligenceProvider } from './types.js';
import { TopicIntentStore, type EstablishedRef, type ProjectionResult } from './TopicIntent.js';
export interface ArcCheckInput {
    topicId: number;
    draftText: string;
    /** Optional: which user turn this draft is in reply to (for record-keeping). */
    forUserTurn?: number;
}
export type ArcCheckVerdict = {
    fire: false;
} | {
    fire: true;
    kind: 'acting-on-tentative' | 'contradicts-settled' | 'contradicts-frame';
    refId: string;
    refText: string;
    currentTier: 'tentative' | 'authoritative';
    currentConfidence: number;
    reason: string;
    /** Suggested rewrite hint the agent can include in its redraft. */
    suggestedRewriteHint: string;
};
/**
 * The injectable LLM step. Receives the draft + tracked refs and returns
 * a structured classification. Production wires this to a Haiku-class
 * call via LlmQueue; tests stub it.
 *
 * Return value shape: which refs (if any) the draft engages with, and
 * whether the engagement is "act on it" or "contradict it."
 */
export interface ArcCheckClassification {
    /** refIds the draft appears to ACT ON (decisions baked in, facts assumed). */
    actsOn: string[];
    /** refIds the draft appears to CONTRADICT. */
    contradicts: string[];
}
export type ArcCheckClassifyFn = (draftText: string, refs: Array<EstablishedRef & {
    projection: ProjectionResult;
}>) => Promise<ArcCheckClassification>;
export declare class ArcCheck {
    private store;
    private classifyFn;
    constructor(store: TopicIntentStore, classifyFn: ArcCheckClassifyFn);
    /**
     * Run ArcCheck on a draft. Returns a verdict object suitable for direct
     * return from an HTTP route or consumption by a hook.
     *
     * Verdict priority (when multiple conditions fire):
     *   1. contradicts-settled (highest — wrong direction on a decided fact/decision)
     *   2. contradicts-frame (drifting from the active task frame — method/audience/
     *      goal — fires at tentative OR authoritative, because a frame is exactly the
     *      thing worth catching early; this is the rung-1 founding-incident catch)
     *   3. acting-on-tentative (lowest — uncertain, but not wrong)
     *
     * If the draft engages multiple refs, the first matching one of the
     * highest-priority kind wins. Subsequent fires are deferred to a
     * future ArcCheck call after the agent's redraft.
     */
    check(input: ArcCheckInput): Promise<ArcCheckVerdict>;
}
/**
 * Build the ArcCheck prompt for production use. Separated so prompt
 * tuning can iterate without touching the classifier logic.
 *
 * The actual LLM provider call is wired in by the caller; this returns
 * the prompt string + structured response schema description.
 */
export declare function buildArcCheckPrompt(draftText: string, refs: Array<EstablishedRef & {
    projection: ProjectionResult;
}>): {
    systemPrompt: string;
    userPrompt: string;
};
/**
 * Parse the LLM's response into an ArcCheckClassification. Tolerates
 * code fences and prose preamble; degrades to empty arrays on parse
 * failure so a busted LLM response never falsely fires ArcCheck.
 */
export declare function parseArcCheckResponse(raw: string): ArcCheckClassification;
export type ArcCheckDegradeReason = 'no-intelligence' | 'error';
/**
 * Production classifier built atop an injected IntelligenceProvider. Mirrors
 * createLlmExtractFn from TopicIntentExtractor: degrade-safe, subscription
 * transport (the provider must be the subscription/REPL-pool path — see
 * feedback_anthropic_path_constraints), structured response parsing.
 *
 * `onDegrade` is an optional observability hook that fires on each degrade
 * path WITHOUT weakening degrade-safety — the function still returns
 * `{actsOn:[], contradicts:[]}` regardless. The `ArcCheck` class turns an
 * empty classification into `{fire:false}`, so a degraded call cannot fire
 * a false signal into the outbound gate.
 */
export declare function createArcCheckClassifyFn(intelligence?: IntelligenceProvider, onDegrade?: (reason: ArcCheckDegradeReason) => void): ArcCheckClassifyFn;
//# sourceMappingURL=TopicIntentArcCheck.d.ts.map