/**
 * CascadeEngine — evaluates declarative cascade rules against live domain health
 * and determines which effects need to be applied when a domain state changes.
 *
 * The engine is read-only with respect to health state — it evaluates and returns
 * CascadeResult objects; callers are responsible for applying effects.
 */
import type { HealthDomain, HealthStatus, CascadeRule, EvaluateResult } from './types.js';
import type { RuntimeHealthAggregator } from './aggregator.js';
/**
 * Evaluates CascadeRules against live domain health changes.
 * Use checkUpstreamHealth to gate dispatch before executing domain operations.
 */
export declare class CascadeEngine {
    private readonly rules;
    private readonly aggregator;
    private readonly clock;
    /** Pre-indexed rules by domain for O(1) lookup */
    private readonly ruleIndex;
    constructor(rules: CascadeRule[], aggregator: RuntimeHealthAggregator, clock?: () => number);
    /**
     * Evaluate all cascade rules for a domain health transition.
     *
     * Returns an EvaluateResult with two separate arrays:
     * - `cascades`: effects that are actionable now and should be applied immediately.
     * - `pendingRecovery`: rules with recoveryFirst where recovery is still possible;
     *    callers should not apply these yet.
     *
     * @param domain - The domain whose health changed.
     * @param newStatus - The new health status of the domain.
     * @param sourceContext - Optional context identifying the entity that triggered
     *   the change (e.g. `{ pluginId: 'my-plugin' }`). Carried into each CascadeResult.
     */
    evaluate(domain: HealthDomain, newStatus: HealthStatus, sourceContext?: Record<string, string>): EvaluateResult;
    /**
     * Get all rules that would fire for the given domain + status combination.
     * Uses the pre-indexed rule map for O(1) domain lookup.
     * Pure — no side effects.
     */
    getRulesForDomain(domain: HealthDomain, status: HealthStatus): CascadeRule[];
    /**
     * Check whether a domain's upstream dependencies are healthy enough to allow dispatch.
     * Traverses the cascade rules in reverse: finds rules whose TARGET is this domain
     * and whose SOURCE is currently in the triggering state.
     *
     * Returns whether dispatch is healthy, which upstream domains are blocking it,
     * and a human-readable reason if blocked.
     */
    checkUpstreamHealth(domain: HealthDomain): {
        healthy: boolean;
        blockedBy?: HealthDomain[];
        reason?: string;
    };
}
//# sourceMappingURL=cascade-engine.d.ts.map