/**
 * Rule evaluation logic for workflow steps
 *
 * Evaluates workflow step rules to determine the matched rule index.
 * Supports tag-based detection, ai() conditions, aggregate conditions,
 * and AI judge fallback.
 */
import type { WorkflowStep, WorkflowState, RuleMatchMethod } from '../../models/types.js';
import type { StructuredCaller } from '../../../agents/structured-caller.js';
import type { ProviderType, RuleIndexDetector } from '../types.js';
export interface RuleMatch {
    index: number;
    method: RuleMatchMethod;
}
export interface RuleEvaluatorContext {
    /** Workflow state (for accessing stepOutputs in aggregate evaluation) */
    state: WorkflowState;
    /** Working directory (for AI judge calls) */
    cwd: string;
    /** Effective provider for the step */
    provider?: ProviderType;
    resolvedProvider?: ProviderType;
    resolvedModel?: string;
    /** Whether interactive-only rules are enabled */
    interactive?: boolean;
    /** Rule tag index detector */
    detectRuleIndex: RuleIndexDetector;
    /** Structured caller */
    structuredCaller: StructuredCaller;
}
/**
 * Evaluates rules for a workflow step to determine the next transition.
 *
 * Evaluation order (first match wins):
 * 1. Aggregate conditions: all()/any() — evaluate sub-step results
 * 2. Immediate deterministic when conditions that appear before the matched Phase 3 tag
 * 3. Tag detection from Phase 3 output
 * 4. Immediate deterministic when conditions that appear before the matched Phase 1 tag
 * 5. Tag detection from Phase 1 output (fallback)
 * 6. Immediate deterministic when conditions that appear before the matched ai() rule
 * 7. ai() condition evaluation via AI judge
 * 8. Remaining immediate deterministic when conditions
 * 9. All-conditions AI judge (final fallback)
 * 10. Deferred deterministic fallbacks (for example when: true)
 *
 * Returns undefined for steps without rules.
 * Throws if rules exist but no rule matched (Fail Fast).
 */
export declare class RuleEvaluator {
    private readonly step;
    private readonly ctx;
    constructor(step: WorkflowStep, ctx: RuleEvaluatorContext);
    private structuredCallerJudgeOptions;
    evaluate(agentContent: string, tagContent: string): Promise<RuleMatch | undefined>;
    private resolveTaggedRuleIndex;
    private findFirstNonDeterministicRuleIndex;
    private evaluateImmediateDeterministicConditions;
    private evaluateDeferredDeterministicConditions;
    /**
     * Evaluate ai() conditions via AI judge.
     * Returns the 0-based rule index, or -1 if no match.
     */
    private evaluateAiConditions;
    /**
     * Final fallback: evaluate ALL rule conditions via AI judge.
     * Returns the 0-based rule index, or -1 if no match.
     */
    private evaluateAllConditionsViaAiJudge;
}
//# sourceMappingURL=RuleEvaluator.d.ts.map