/**
 * Completion verifier — the task-completion oracle.
 *
 * Answers the only eval question that is not a proxy: did the agent actually
 * COMPLETE the task — produce every required deliverable, persisted and
 * correct — rather than describe what should be done. A fluent transcript
 * that never produces the artifact scores zero here.
 *
 * Per requirement, a two-stage check:
 *   1. Structural — a produced item (vault artifact / approved proposal /
 *      tool call) of the right kind is matched against the requirement and
 *      carries non-empty content. Deterministic; no LLM.
 *   2. Correctness — only if structurally present AND the matched item
 *      carries content, one targeted check decides whether that item
 *      actually fulfils the requirement. A hallucinated artifact fails here;
 *      an absent one already failed stage 1.
 *
 * `completionRate` is satisfied / total. Quality dimensions are meaningless
 * on an incomplete task — callers gate on `fullyComplete` / `completionRate`
 * before scoring quality.
 */
import type { TCloud } from '@tangle-network/tcloud';
import type { Artifact } from './artifact-validator';
import type { DefaultVerdict } from './verdict';
/** What kind of produced state can satisfy a requirement structurally. */
export type SatisfiedBy = 'artifact' | 'proposal' | 'tool-call' | 'any';
export interface CompletionRequirement {
    /** Stable id from the task gold (e.g. a persona's `expected_requirements[].req_id`). */
    reqId: string;
    /** Human-readable description of the required deliverable. */
    title: string;
    /** Optional kind/category hint, matched against a produced item's kind. */
    category?: string;
    /** What produced state satisfies this requirement. Defaults to 'any'. */
    satisfiedBy?: SatisfiedBy;
}
export interface TaskGold {
    taskId: string;
    requirements: CompletionRequirement[];
}
export interface ProducedProposal {
    id: string;
    title: string;
    status: 'pending' | 'approved' | 'rejected';
    /** Optional persisted body — when present, enables a correctness check. */
    content?: string;
}
/** Everything observable about what a run actually produced. */
export interface ProducedState {
    /** Persisted vault artifacts. Reuses the shared `Artifact` shape. */
    artifacts: Artifact[];
    /** Proposals / filings the agent created. */
    proposals: ProducedProposal[];
    /** Names of tools the agent invoked. */
    toolCalls: string[];
}
export interface RequirementCheck {
    reqId: string;
    title: string;
    /** A produced item of the right kind matched the requirement, non-empty. */
    structurallyPresent: boolean;
    /**
     * Whether the matched item actually fulfils the requirement. `null` when
     * not structurally present, or when the matched item carries no content
     * to assess.
     */
    correct: boolean | null;
    /** structurallyPresent && correct !== false. */
    satisfied: boolean;
    /** Human-readable evidence for the verdict. */
    evidence: string[];
}
/** Extends the substrate verdict spine: `valid` = `fullyComplete` and
 *  `score` = `completionRate` — derived in `completionVerdict()`, the one
 *  place those equalities hold by construction. */
export interface CompletionVerdict extends DefaultVerdict {
    taskId: string;
    requirements: RequirementCheck[];
    /** satisfied / total requirements. */
    completionRate: number;
    /** Every requirement satisfied. */
    fullyComplete: boolean;
}
/**
 * Construct a `CompletionVerdict` from the per-requirement checks, deriving
 * `completionRate` / `fullyComplete` and the spine fields (`valid` =
 * `fullyComplete`, `score` = `completionRate`) in one place. Throws on zero
 * requirements — a verdict over nothing is a misconfiguration, mirroring
 * `verifyCompletion`'s gold-spec guard.
 */
export declare function completionVerdict(input: {
    taskId: string;
    requirements: RequirementCheck[];
}): CompletionVerdict;
/**
 * Decides whether a produced item's content actually fulfils a requirement.
 * Injected so the structural verifier stays pure and unit-testable; the
 * production implementation is `createLlmCorrectnessChecker`.
 */
export type CorrectnessChecker = (requirement: CompletionRequirement, content: string) => Promise<{
    correct: boolean;
    reason: string;
}>;
/**
 * Verify whether a run completed the task. `checkCorrectness` is injected —
 * `createLlmCorrectnessChecker` for production, a deterministic stub in tests.
 *
 * Throws on a gold spec with no requirements: an eval task that requires
 * nothing is a misconfiguration, not a vacuously-complete task.
 */
export declare function verifyCompletion(gold: TaskGold, state: ProducedState, checkCorrectness: CorrectnessChecker): Promise<CompletionVerdict>;
export interface LlmCorrectnessCheckerOpts {
    model?: string;
    /** Max chars of artifact content sent to the checker. */
    maxContentChars?: number;
}
/** Parse the correctness checker's model response. Fails loud on a bad shape. */
export declare function parseCorrectnessResponse(raw: string): {
    correct: boolean;
    reason: string;
};
/**
 * Production `CorrectnessChecker` — one LLM call per matched artifact,
 * deterministic (temperature 0), structured JSON out. Judges fulfilment
 * only: a plan, a gesture, or a description of what should be done does not
 * fulfil a requirement — the artifact must BE the deliverable.
 */
export declare function createLlmCorrectnessChecker(tc: TCloud, opts?: LlmCorrectnessCheckerOpts): CorrectnessChecker;
/**
 * Deterministic `CorrectnessChecker` — the no-LLM counterpart to
 * `createLlmCorrectnessChecker`. A produced item fulfils a requirement when its
 * content is substantive (≥ `minContentLength` chars) AND recalls ≥ `minRecall`
 * of the requirement title's significant tokens. No network.
 *
 * Polarity-blind: token recall credits a negation that contains the
 * requirement's tokens ("I will NOT produce the comparison" recalls every token
 * of "produce the comparison"). The structural match stage is ALSO lexical, so
 * pairing the two collapses to a single gameable gate. Use this only as an
 * opt-in structural pre-filter or for tasks whose requirements have no polarity
 * to invert; for produced-state grading the correctness checker MUST be semantic
 * (`createLlmCorrectnessChecker`). See the anti-game fixtures in the test suite.
 */
export declare function createTokenRecallChecker(opts?: {
    minRecall?: number;
    minContentLength?: number;
}): CorrectnessChecker;
//# sourceMappingURL=completion-verifier.d.ts.map