/**
 * Core Rule Engine for V3.1 Inference System
 * Provides pattern matching and rule application for both logical and deployment inference
 */
import { InferenceRule, InferenceContext, ValidationResult } from './types.js';
export interface RuleEngineStatistics {
    rulesLoaded: number;
    conditionsCompiled: number;
    conditionCacheSize: number;
    conditionCacheHits: number;
    conditionCacheMisses: number;
    /** Share of evaluations served from cache (0..1). */
    conditionCacheHitRate: number;
    templateContextHits: number;
    templateContextMisses: number;
}
export declare class RuleEngine<TInput, TOutput> {
    private debug;
    private rules;
    private conditionCache;
    private compiledConditions;
    private lastTemplateContext;
    private stats;
    constructor(debug?: boolean);
    /**
     * Load rules for a specific category (e.g., 'controllers', 'services')
     */
    loadRules(category: string, rules: InferenceRule<TInput, TOutput>[]): ValidationResult;
    /**
     * Compile a condition expression to a reusable function. Called once per
     * rule at load time (or from the validator, which exercises the parse).
     */
    private compileCondition;
    /**
     * Return cache + compilation statistics. Useful for measuring the impact
     * of the condition cache and spotting cache-defeating call patterns.
     */
    getStatistics(): RuleEngineStatistics;
    /**
     * Find all matching rules for input in a category
     */
    findMatches(category: string, input: TInput, context: InferenceContext): InferenceRule<TInput, TOutput>[];
    /**
     * Apply a rule to generate output
     */
    apply(rule: InferenceRule<TInput, TOutput>, input: TInput, context: InferenceContext): TOutput;
    /**
     * Get all loaded rules for debugging
     */
    getAllRules(): Map<string, InferenceRule<TInput, TOutput>[]>;
    /**
     * Clear all loaded rules
     */
    clearRules(): void;
    private validateRule;
    private evaluateCondition;
    /**
     * Compact cache key describing only what the condition can observe. Two
     * invocations with the same rule + model + relationship topology + lifecycle
     * presence produce identical keys — unlike the old JSON.stringify-based
     * key, which was instance-specific.
     */
    private buildConditionCacheKey;
    private buildTemplateContext;
    private applyHandlebarsTemplate;
    private applyJsonTemplate;
    private applyYamlTemplate;
    private applySpeclyTemplate;
    private convertJsonToSpecly;
}
//# sourceMappingURL=rule-engine.d.ts.map