/**
 * PendingConfirmationManager — lifecycle for conversational confirmation records.
 *
 * Layer 1 component. Manages the queue, TTL, dedup, retry-with-sharpening,
 * and revalidation rules for pending confirmations. Per spec v14 section
 * "Pending-Confirmation Records (v9 — addresses GPT round-on-v8 finding #2)":
 *
 *   - At most one outstanding PendingConfirmation per topic
 *   - Queue depth: 3; 4th queued is dropped silently with telemetry
 *   - Queue dedup by refId
 *   - TTL: 5 substantive user turns OR 24h, whichever first
 *   - TTL clock starts at DEQUEUE time, not queue-entry time
 *   - Revalidation at dequeue: refId still tentative + proposition still
 *     semantically relevant; stale → drop silently with telemetry
 *   - Answer interpretation by Tier 1 LLM (positive / negative / ambiguous /
 *     non-responsive); ambiguous triggers sharpen + retry up to maxRetries=2,
 *     then status=abandoned
 *
 * Framework-agnostic: pure logic over the JSON store. No transport coupling.
 */
import { TopicIntentStore, type PendingConfirmation, type TopicIntentFile } from './TopicIntent.js';
export type AnswerVerdict = 'positive' | 'negative' | 'ambiguous' | 'non-responsive';
export interface CreateOpts {
    topicId: number;
    arcId: string;
    refId: string;
    propositionText: string;
    questionText: string;
    currentUserTurn: number;
    now?: string;
    ttl?: {
        turns: number;
        hours: number;
    };
    maxRetries?: number;
}
export interface RevalidationResult {
    valid: boolean;
    reason?: 'no-longer-tentative' | 'proposition-stale' | 'ref-missing' | 'ok';
}
/**
 * Operator-supplied callbacks. Both are deterministic from the manager's
 * point of view — the caller routes them to whatever LLM/lexical check
 * makes sense in context.
 */
export interface PendingConfirmCallbacks {
    /**
     * Asked at DEQUEUE time. Returns whether the queued proposition is still
     * semantically relevant given more recent events on the topic.
     * Default: always valid (no-op stub for tests / pre-Layer-3).
     */
    revalidateProposition?: (queued: PendingConfirmation, file: TopicIntentFile) => RevalidationResult;
}
export interface CreateResult {
    status: 'outstanding' | 'queued' | 'dropped-duplicate' | 'dropped-queue-full';
    pendingId?: string;
    reason?: string;
}
export declare class PendingConfirmationManager {
    private store;
    private callbacks;
    constructor(store: TopicIntentStore, callbacks?: PendingConfirmCallbacks);
    /**
     * Create a new pending confirmation. May go outstanding immediately,
     * queue, or be dropped (duplicate / queue full).
     */
    create(opts: CreateOpts): CreateResult;
    /**
     * Interpret an incoming user-authored message as an answer to the current
     * outstanding pending confirmation, if any.
     *
     * The caller is responsible for running the Tier-1 LLM verdict; this
     * method takes the verdict and applies the state machine.
     */
    interpretAnswer(topicId: number, verdict: AnswerVerdict, sourceMessageId: string, now?: string): {
        applied: boolean;
        outcome: 'positive' | 'negative' | 'sharpen-retry' | 'abandoned' | 'no-outstanding';
    };
    /**
     * Sweep for TTL expiry on the outstanding pending. Called by the caller
     * after every substantive user turn (turn-based TTL) and periodically
     * (clock-based TTL).
     *
     * Returns the dropped pending if one was swept.
     */
    sweepTtl(topicId: number, currentUserTurn: number, now?: string): PendingConfirmation | null;
    /** Force-cancel the outstanding pending (e.g. on emergency stop / corrective input). */
    cancelOutstanding(topicId: number, now?: string): PendingConfirmation | null;
    /**
     * Promote the next queued item to outstanding (if any).
     * Runs revalidation at dequeue time. Stale items are dropped silently.
     */
    private dequeueNext;
    private revalidate;
}
//# sourceMappingURL=TopicIntentPendingConfirm.d.ts.map