/**
 * CompletionEvaluator — independent "is the autonomous goal met?" judge.
 *
 * Replaces the autonomous stop-hook's self-declared `<promise>` check with an
 * INDEPENDENT judgment: a small/fast model decides whether a verifiable
 * completion CONDITION is met, judging only what the agent has surfaced in the
 * recent transcript (it does not run tools — same contract as the framework
 * `/goal` feature this mirrors). "Not met" returns a reason that the hook feeds
 * back as next-turn guidance.
 *
 * This is the loop's continue/stop authority — a full-context model judgment
 * (condition + transcript), not a brittle low-context filter. Runs on the
 * shared IntelligenceProvider (Claude/Codex subscription or API), `fast` tier,
 * spend-capped upstream by LlmQueue.
 *
 * Specs:
 *   - docs/specs/goal-completion-evaluator.md (base)
 *   - docs/specs/AUTONOMOUS-COMPLETION-DISCIPLINE.md (signal extension §2b.4)
 */
import type { IntelligenceProvider } from './types.js';
/**
 * Protocol version stamped on EVERY P13 response (allow / block / error). A
 * newer hook reads this to tell a NEW server (which knows the milestone /
 * hard-blocker class and external-vs-buildable classification) from a
 * structurally-OLD one that omits it — even when the verdict itself is missing
 * (a timeout). See AUTONOMOUS-COMPLETION-DISCIPLINE.md §2b.4 surface 5 + §5
 * version-skew three-case detection.
 */
export declare const P13_PROTOCOL_VERSION = 2;
/**
 * Objective, deterministic signals the stop-hook computes (with no LLM call)
 * and feeds to the judge so it can corroborate (or contradict) the agent's
 * prose against structural state. All fields optional → an OLD hook that sends
 * no signals yields a byte-identical prompt + verdict (backward-compat).
 * Spec §2b.4 surface 3.
 */
export interface StopSignals {
    /** Whether the completion-condition evaluator last judged the condition met. */
    completionConditionMet?: boolean;
    /** Count of unchecked `[ ]` task boxes in the state file (buildable work remains). */
    uncheckedTaskCount?: number;
    /** Whether the state file has a parseable checkbox list, or none at all. */
    taskStructure?: 'has-tasks' | 'indeterminate';
    /** A known milestone/late-hour/needs-steer rationalization phrase is present. */
    milestoneRationalizationDetected?: boolean;
    /** Guard-directed control phrasing (a prompt-injection attempt) is present. */
    injectionSuspected?: boolean;
    /** The stop is an `(a)` hard-blocker exit → run the external-vs-buildable test. */
    stopKind?: 'hard-blocker';
}
export interface CompletionVerdict {
    /** Whether the condition is met (the loop may stop). */
    met: boolean;
    /** One-line reason — fed back as next-turn guidance when not met. */
    reason: string;
}
/**
 * Verdict for the P13 "The Stop Reason Is the Work" guard. SECONDARY to the
 * completion check: it does not decide whether the goal is done, only whether a
 * stop-attempt rests on the P13 anti-pattern (ending an autonomous run because
 * "I need a judgment call" or "this needs real engineering" — a derivable
 * standard or a buildable artifact dressed up as a stop reason).
 */
export interface StopRationaleVerdict {
    /** Whether the autonomous run may stop (no P13 violation detected). */
    stopAllowed: boolean;
    /** One-line P13 steering, fed back as next-turn guidance when the stop is not allowed. */
    guidance: string;
    /**
     * For a `stopKind:'hard-blocker'` request, how the judge classified the
     * blocker: `external` (genuinely agent-unresolvable → an `(a)` exit may
     * proceed) or `buildable` (the agent could build/derive/fetch what it claims
     * to need → keep working). Absent for non-hard-blocker requests.
     */
    classifiedBlocker?: 'external' | 'buildable';
}
export interface CompletionEvaluatorDeps {
    intelligence: IntelligenceProvider;
    /** Override model tier (default 'fast' — matches /goal's small-fast evaluator). */
    modelTier?: 'fast' | 'balanced' | 'capable';
}
export declare class CompletionEvaluator {
    private readonly intelligence;
    private readonly modelTier;
    constructor(deps: CompletionEvaluatorDeps);
    /**
     * Judge whether `condition` is met given the recent transcript text.
     * Robust to model phrasing: looks for an explicit MET/NOT_MET verdict.
     * On any error/ambiguity, returns `met:false` — never falsely "done" (the
     * caller treats "not met" as keep-working, which is the safe direction).
     *
     * `signals` (optional) folds the milestone/buildable-work scrutiny into the
     * completion prompt so the condition path runs a SINGLE critical-path LLM
     * call (spec §2b.2). Absent → identical to the pre-change behavior.
     */
    evaluate(condition: string, transcriptTail: string, signals?: StopSignals): Promise<CompletionVerdict>;
    private buildPrompt;
    /** Parse the model output into a verdict. Conservative: defaults to not-met. */
    private parse;
    /**
     * P13 "The Stop Reason Is the Work" guard. Given the recent transcript, decide
     * whether an autonomous stop-attempt is EARNED, or whether it rests on a P13
     * anti-pattern — ending the run citing any of:
     *   - "needs a judgment call" / "needs real engineering" (a derivable standard
     *     or buildable engineering dressed up as a stop reason);
     *   - "blocked on / waiting on another agent (or the operator)" (a peer
     *     dependency is NOT terminal — the agent must keep pursuing it: re-ping,
     *     periodic re-check, alternate path, or advance other work);
     *   - "a waiting / polling loop burns resources / spins the box" (waiting on a
     *     peer is not a CPU burn; a cheap periodic check is the right strategy).
     * ...WITHOUT showing a derived standard, a built artifact, or a genuinely
     * operator-only residual it has already pursued. Returns stopAllowed:false +
     * guidance when the anti-pattern is detected; otherwise stopAllowed:true.
     *
     * When `signals` is present, the prompt also gains the pre-approved-session
     * MILESTONE block + the objective-signals block; when `signals.stopKind` is
     * 'hard-blocker' it gains the external-vs-buildable classification and the
     * verdict carries `classifiedBlocker` (spec §2b.4).
     *
     * Fails OPEN (stopAllowed:true) on error or ambiguity: this is a SECONDARY guard
     * on top of the completion check, so an evaluator hiccup must never TRAP a
     * genuine completion — the primary completion authority still governs.
     */
    evaluateStopRationale(transcriptTail: string, signals?: StopSignals): Promise<StopRationaleVerdict>;
    private buildStopRationalePrompt;
    /** The fenced, instruction-inert transcript wrapper (anti-injection §3 item 2). */
    private fence;
    /** The pre-approved-session milestone block (spec §2b.4). */
    private renderMilestoneBlock;
    /** The objective-signals block (spec §2b.4). */
    private renderSignalsBlock;
    /** The hard-blocker external-vs-buildable classification block (spec §2b.4). */
    private renderHardBlockerBlock;
    /** Parse the P13 guard output. Conservative: defaults to ALLOW (never trap completion). */
    private parseStopRationale;
    get promptVersion(): string;
    get stopRationalePromptVersion(): string;
    /** Exposed for the PROMPT_VERSION canary test (spec §2b.4). */
    buildStopRationalePromptForTest(transcriptTail: string, signals?: StopSignals): string;
    /** Exposed for the PROMPT_VERSION canary + backward-compat snapshot tests. */
    buildCompletionPromptForTest(condition: string, transcriptTail: string, signals?: StopSignals): string;
}
//# sourceMappingURL=CompletionEvaluator.d.ts.map