/**
 * Authenticity — "is this real, or convincing BS?"
 *
 * Pass/build-style scoring rewards anything that compiles and renders, so an
 * agent can ship a polished frontend with a FAKE in-browser engine and zero of
 * the required on-chain/contract work, and outscore a half-finished real
 * implementation. This module scores what buildability does not: did the agent
 * actually build the intended thing on the intended infra, or fake it.
 *
 * Two layers:
 *   - DETERMINISTIC `scoreAuthenticity` — calibrated by construction (no LLM,
 *     trustworthy today). Structural signals over the produced files, driven by
 *     a domain `AuthenticitySignals` config: required artifact present, real
 *     implementation of the hard part, real infra calls, wiring, fake-shim
 *     detection, mock/stub density.
 *   - LLM NUANCE `scoreAuthenticityNuance` — mocked% / fake% / unique% for the
 *     "looks real but is hollow" cases structure can't see.
 *
 * `gateRealness` is the anti-Goodhart gate: a submission missing the required
 * artifact (or faking it) is capped and cannot rank high regardless of how
 * buildable it is. Domain-agnostic; ships a Solidity/Fhenix preset.
 *
 * Input is the produced-state currency: `{ path, content }[]` — exactly what
 * `extractProducedState(...).artifacts` yields, so any consumer can feed a run's
 * produced state straight in.
 */
interface ProducedFile {
    path: string;
    content?: string;
}
interface AuthenticitySignals {
    /** Human label for the domain (e.g. 'fhenix-fhe'). */
    label: string;
    /** A file the task REQUIRES (e.g. /\.sol$/ for an on-chain task). */
    requiredArtifact?: RegExp;
    /** Vendored/3rd-party paths to exclude from required-artifact detection. */
    vendored?: RegExp;
    /** Real implementation of the hard part, inside the required artifact
     *  (e.g. Fhenix encrypted types + FHE.* ops). Matched against content, so it
     *  fails on comments/strings only if the regex is written tightly. */
    realImpl: RegExp;
    /** Real use of the intended client infra (e.g. cofhejs.encrypt() calls). */
    realInfra: RegExp;
    /** Evidence the artifact is actually wired/used (e.g. contract writes). */
    wiring?: RegExp;
    /** A fake shim standing in for the real thing — matched on file path AND body. */
    fakeShim: RegExp;
    /** Mock/stub/TODO markers. Defaults to a generic set. */
    mock?: RegExp;
    /** Score weights (default 40/25/20/15). */
    weights?: {
        artifact?: number;
        impl?: number;
        infra?: number;
        wiring?: number;
    };
}
interface AuthenticityResult {
    /** Deterministic realness, 0 (BS) … 100 (real on real infra). */
    realness: number;
    requiredArtifactPresent: boolean;
    requiredArtifactCount: number;
    usesRealImpl: boolean;
    realInfra: boolean;
    wired: boolean;
    /** The required artifact is actually referenced/imported by other (non-artifact)
     *  files — i.e. wired into the rest of the system, not dead code. Domain-agnostic:
     *  a deliverable nothing else uses is suspect in any vertical. */
    artifactReferenced: boolean;
    /** Convenience: the artifact is connected to the running system, via either the
     *  domain wiring signal OR a structural reference. */
    artifactWired: boolean;
    fakeShim: boolean;
    /** mock/stub markers per 1000 LOC, capped at 100. */
    mockDensity: number;
    /** Human-readable BS flags — what's missing or faked. */
    flags: string[];
}
/** Deterministic authenticity scan of produced files. Pure — same files in,
 *  same score out. No LLM, no IO. */
declare function scoreAuthenticity(files: readonly ProducedFile[], signals: AuthenticitySignals): AuthenticityResult;
interface RealnessGate {
    gated: boolean;
    reason?: string;
}
/** Anti-Goodhart gate: a required-artifact-missing or faked submission is
 *  capped and cannot rank high regardless of buildability. */
declare function gateRealness(r: AuthenticityResult, opts?: {
    floor?: number;
    requireArtifact?: boolean;
    requireArtifactWired?: boolean;
}): RealnessGate;
interface AuthenticityNuance {
    /** 0 (nothing mocked) … 100 (entirely mocked). */
    mockedPct: number;
    /** 0 (genuine) … 100 (a hollow facade / cargo-culted). */
    fakePct: number;
    /** 0 (boilerplate/template clone) … 100 (distinctive real work). */
    uniquePct: number;
    verdict: string;
}
/** A minimal completion fn — inject your model caller (router/tcloud). Keeps
 *  this module free of any specific LLM client. */
type CompleteFn = (system: string, user: string) => Promise<string>;
/**
 * LLM nuance scoring — judges the "looks real but is hollow" axis structure
 * misses. Inject a `complete` caller; returns mocked/fake/unique % + a verdict.
 * Fail-soft: a bad/unparseable response yields a worst-case (fully-fake) read,
 * never a false pass.
 */
declare function scoreAuthenticityNuance(files: readonly ProducedFile[], complete: CompleteFn, opts?: {
    intent?: string;
    prioritize?: RegExp;
}): Promise<AuthenticityNuance>;
interface RealnessJudgment {
    /** 0 (facade/simulator) … 100 (real implementation on the intended infra). */
    isReal: number;
    rationale: string;
}
/**
 * Ask an LLM to rate realness DIRECTLY on a 0-100 scale — the axis that matched
 * human blind-labels in validation (F1 0.80→0.88 on the gray band; a fakePct/
 * hollowness proxy over-penalized "real core + stubbed periphery" partials, and a
 * weak judge model over-flagged — use a strong one). Domain-agnostic skeleton; the
 * consumer supplies `intent` (what the deliverable should be) and `rubric` (domain
 * specifics of real-vs-fake). Fail-closed: a bad response reads as fully fake.
 */
declare function judgeRealnessLlm(files: readonly ProducedFile[], complete: CompleteFn, opts?: {
    intent?: string;
    rubric?: string;
    prioritize?: RegExp;
}): Promise<RealnessJudgment>;
type RealnessBand = 'clean-real' | 'clean-fake' | 'gray';
interface BlendedRealness extends AuthenticityResult {
    /** Final realness after (only-when-needed) LLM adjudication, 0…100. */
    blendedRealness: number;
    band: RealnessBand;
    /** True iff the LLM judge was actually consulted (gray band only). */
    consultedLlm: boolean;
    /** Present iff the LLM was consulted. */
    judgment?: RealnessJudgment;
}
/**
 * Score realness using the cheapest sufficient signal: trust the deterministic
 * scorer on the CLEAN extremes (obvious fakes / obviously-real-and-wired), and only
 * spend an LLM call on the GRAY band — cells that look real structurally but carry
 * fakeness markers (a fake shim, an unwired/dead artifact, high mock density) or land
 * mid-range. This caps LLM cost at the fraction of cells static analysis can't
 * resolve, which matters at multi-vertical / multi-partner scale.
 *
 * Domain-agnostic: the gray-band TRIGGER is structural; the LLM judges via the
 * consumer-supplied `intent`. Fail-closed (a bad LLM response reads as fully fake).
 */
declare function scoreRealnessBlended(files: readonly ProducedFile[], signals: AuthenticitySignals, complete: CompleteFn, opts?: {
    intent?: string;
    rubric?: string;
    grayBand?: [number, number];
    mockGrayThreshold?: number;
}): Promise<BlendedRealness>;

export { type AuthenticityNuance, type AuthenticityResult, type AuthenticitySignals, type BlendedRealness, type CompleteFn, type ProducedFile, type RealnessBand, type RealnessGate, type RealnessJudgment, gateRealness, judgeRealnessLlm, scoreAuthenticity, scoreAuthenticityNuance, scoreRealnessBlended };
