import type { SearchResult, TotemConfig } from '@mmnto/totem';
import { type ShieldFinding, type ShieldStructuredVerdict } from './shield-templates.js';
export { MAX_DIFF_CHARS, SHIELD_LEARN_SYSTEM_PROMPT, STRUCTURAL_SYSTEM_PROMPT, } from './shield-templates.js';
interface RetrievedContext {
    specs: SearchResult[];
    sessions: SearchResult[];
    code: SearchResult[];
    lessons: SearchResult[];
}
export declare function buildFileContext(changedFiles: string[], cwd: string, maxLines: number, maxChars: number): Promise<string>;
export declare function assemblePrompt(diff: string, changedFiles: string[], context: RetrievedContext, systemPrompt: string, smartHints?: string[], fileContext?: string): string;
export declare function assembleStructuralPrompt(diff: string, changedFiles: string[], systemPrompt: string, smartHints?: string[], fileContext?: string): string;
export declare function parseVerdict(content: string): {
    pass: boolean;
    reason: string;
} | null;
/**
 * Three-layer JSON extraction from LLM plain-text response.
 * Layer 1: XML tags, Layer 2: markdown code fences, Layer 3: bare JSON.
 * Returns null if all layers fail (caller falls back to V1 regex parseVerdict).
 */
export declare function extractStructuredVerdict(content: string): ShieldStructuredVerdict | null;
/**
 * Deterministic pass/fail based on findings.
 * CRITICAL = fail, WARN/INFO = pass with advisory.
 */
export declare function computeVerdict(verdict: ShieldStructuredVerdict): {
    pass: boolean;
    reason: string;
};
/**
 * Human-readable output for stderr.
 * Groups findings by severity (CRITICAL → WARN → INFO) with colored header.
 */
export declare function formatVerdictForDisplay(verdict: ShieldStructuredVerdict, pass: boolean): string;
/**
 * Write the .reviewed-content-hash flag on PASS.
 * Uses a content hash of tracked source files (not Git SHA) so the flag
 * survives commits, amends, and rebases. Only breaks when source files change.
 *
 * The `extensions` parameter drives which file types are hashed. Defaults to
 * the historical hardcoded set for backward compatibility with callers that
 * predate #1527. The set must be pre-validated (see
 * `ReviewSourceExtensionSchema` in core); values are passed as `git ls-files`
 * glob arguments via safeExec and the regex refinement is the shell-injection
 * boundary.
 */
export declare function writeReviewedContentHash(cwd: string, totemDir: string, configRoot?: string, extensions?: readonly string[]): Promise<void>;
/**
 * Record a shield override: append the override event to the Trap Ledger
 * AND stamp the reviewed-content-hash so the push-gate hook unblocks.
 *
 * mmnto-ai/totem#1716: prior to this helper the override branch only wrote the ledger
 * entry; the missing stamp left the contributor stuck behind the push-gate
 * with a tribal-knowledge `git reset --soft HEAD~1 && totem review --staged`
 * workaround. Override is a legitimate completion path (with logged
 * justification) and must produce the same cache state as a passing review.
 */
export declare function recordShieldOverride(params: {
    override: string;
    cwd: string;
    totemDir: string;
    configRoot?: string;
    sourceExtensions?: readonly string[];
}): Promise<void>;
export type ShieldFormat = 'text' | 'sarif' | 'json';
export interface ShieldOptions {
    raw?: boolean;
    out?: string;
    model?: string;
    fresh?: boolean;
    staged?: boolean;
    /** Explicit ref range for `git diff` (mmnto-ai/totem#1717). Bypasses implicit fallback chain. */
    diff?: string;
    /**
     * Force the branch-vs-base (push-gate) diff scope (mmnto-ai/totem#2091).
     * Mutually exclusive with `staged` and `diff`.
     */
    branch?: boolean;
    /**
     * Explicit base branch name for the forced branch-vs-base scope
     * (mmnto-ai/totem#2091). Implies `branch`; resolved via `getGitBranchDiff`'s
     * origin-preference logic (mmnto-ai/totem#2054).
     */
    base?: string;
    mode?: 'standard' | 'structural';
    learn?: boolean;
    yes?: boolean;
    override?: string;
    suppress?: string[];
    autoCapture?: boolean;
    /**
     * Pre-flight deterministic-rule estimator (mmnto-ai/totem#1714). When
     * true, `shieldCommand` short-circuits to `runEstimate` in
     * `shield-estimate.ts`: same diff-resolution chain as the LLM review
     * path, then `runCompiledRules` against `compiled-rules.json`, then
     * return — no orchestrator, no embedder, no LanceDB. Output is labeled
     * `[Estimate]` (`ESTIMATE_DISPLAY_TAG`) instead of `[Review]` so log
     * lines unmistakably read as a forecast. Mutually incompatible with
     * `--learn`, `--auto-capture`, `--override`, `--suppress`, `--fresh`,
     * `--mode`, and `--raw` — these only apply to the LLM path; combining
     * them throws `TotemConfigError CONFIG_INVALID`.
     */
    estimate?: boolean;
    /**
     * Pattern-history overlay opt-out (mmnto-ai/totem#1731). Default `true`
     * (enabled) when undefined; opt out via `--no-history`. Only effective
     * with `--estimate`; silently ignored on the LLM path. Commander
     * auto-inverts the negative flag, so the user-facing surface is
     * `--no-history` and this field receives `false` when the flag is set.
     */
    history?: boolean;
}
export declare function learnFromVerdict(verdictContent: string, diff: string, options: ShieldOptions, config: TotemConfig, cwd: string, configRoot?: string): Promise<void>;
/** @internal — exported for testing */
export declare function captureObservationRules(findings: ShieldFinding[], cwd: string, config: TotemConfig, configRoot: string | undefined): Promise<void>;
interface IncrementalResult {
    eligible: boolean;
    reason?: string;
    deltaDiff?: string;
    changedFiles?: string[];
    linesChanged?: number;
}
export declare function evaluateIncrementalEligibility(cwd: string, totemDir: string, configRoot?: string): Promise<IncrementalResult>;
export declare function shieldCommand(options: ShieldOptions): Promise<void>;
//# sourceMappingURL=shield.d.ts.map