/**
 * Instruction Validator - Instruction Integrity Validation
 *
 * Validates system prompts and instructions against approved hashes and templates
 * to prevent prompt injection attacks.
 *
 * Features:
 * - Exact hash matching for approved system prompts
 * - Template matching with parameter extraction
 * - Signed instruction source verification
 * - Instruction normalization to prevent bypass attempts
 *
 * @packageDocumentation
 * @module @vorion/semantic-governance/instruction-validator
 */
import { VorionError } from '../common/errors.js';
import type { InstructionIntegrity, InstructionTemplate, InstructionValidationResult, TemplateMatchResult } from './types.js';
/**
 * Error thrown when instruction validation fails
 */
export declare class InstructionValidationError extends VorionError {
    code: string;
    statusCode: number;
    constructor(message: string, details?: Record<string, unknown>);
}
/**
 * Instruction Validator
 *
 * Validates instructions against the configured instruction integrity rules.
 * Supports three validation methods:
 * 1. Exact hash matching - instruction matches a pre-approved hash
 * 2. Template matching - instruction matches a template with valid parameters
 * 3. Signed source verification - instruction comes from a trusted, signed source
 */
export declare class InstructionValidator {
    private readonly config;
    private readonly ajv;
    private readonly hashSet;
    private readonly templateCache;
    /**
     * Create a new InstructionValidator
     *
     * @param config - Instruction integrity configuration
     */
    constructor(config: InstructionIntegrity);
    /**
     * Validate a system prompt or instruction against allowed configurations
     *
     * @param systemPrompt - The system prompt or instruction to validate
     * @returns Validation result indicating whether the instruction is valid
     */
    validateInstruction(systemPrompt: string): InstructionValidationResult;
    /**
     * Match an instruction against configured templates
     *
     * @param instruction - The instruction to match
     * @returns Template match result with extracted parameters
     */
    matchTemplate(instruction: string): TemplateMatchResult;
    /**
     * Verify a signed instruction from a trusted source
     *
     * @param instruction - The instruction content
     * @param signature - The cryptographic signature (base64)
     * @param source - The source identifier (DID or URL)
     * @returns Whether the signed source is valid
     */
    verifySignedSource(instruction: string, signature: string, source: string): boolean;
    /**
     * Compute SHA-256 hash of an instruction
     *
     * @param instruction - The instruction to hash
     * @returns SHA-256 hash in the format "sha256:hexstring"
     */
    hashInstruction(instruction: string): string;
    /**
     * Normalize an instruction for consistent hashing
     *
     * Prevents bypass attempts via:
     * - Whitespace variations
     * - Unicode tricks
     * - Case differences
     *
     * @param instruction - The instruction to normalize
     * @returns Normalized instruction
     */
    normalizeInstruction(instruction: string): string;
    /**
     * Register a new allowed instruction hash
     *
     * @param hash - SHA-256 hash to register
     */
    registerHash(hash: string): void;
    /**
     * Register a new instruction template
     *
     * @param template - Template to register
     */
    registerTemplate(template: InstructionTemplate): void;
    /**
     * Check if a source is in the allowed sources list
     *
     * @param source - Source identifier to check
     * @returns Whether the source is allowed
     */
    private isSourceAllowed;
    /**
     * Compile a template into a regex for matching
     *
     * @param template - Template to compile
     */
    private compileTemplate;
    /**
     * Escape special regex characters
     *
     * @param str - String to escape
     * @returns Escaped string
     */
    private escapeRegex;
    /**
     * Calculate match confidence based on how well the instruction matches the pattern
     *
     * @param instruction - Normalized instruction
     * @param regex - Template regex
     * @returns Confidence score between 0 and 1
     */
    private calculateMatchConfidence;
}
/**
 * Common injection patterns to detect in instructions
 */
export declare const COMMON_INJECTION_PATTERNS: RegExp[];
/**
 * Check if content contains potential injection patterns
 *
 * @param content - Content to check
 * @returns Array of detected patterns
 */
export declare function detectInjectionPatterns(content: string): string[];
/**
 * Create an InstructionValidator with default configuration
 *
 * @returns InstructionValidator with secure defaults
 */
export declare function createDefaultInstructionValidator(): InstructionValidator;
//# sourceMappingURL=instruction-validator.d.ts.map