/**
 * Composition Engine (ADR-031 Phase 3)
 *
 * Evaluates composition rules that encode expert knowledge about
 * capability interactions. When certain capability combinations are
 * detected, the engine automatically adds required companion capabilities.
 *
 * Example: erp_integration + security_validation → add data_security
 *
 * Rules are defined in the ecosystem graph's `compositions` array.
 * The engine iterates until no new capabilities are added, with a
 * maximum of 3 iterations to prevent runaway rule chains.
 */
export type CompositionOperator = 'all' | 'any';
export type CompositionPriority = 'required' | 'recommended' | 'optional';
export interface CompositionRule {
    readonly id: string;
    readonly when: readonly string[];
    readonly operator: CompositionOperator;
    readonly add: readonly string[];
    readonly reason: string;
    readonly priority: CompositionPriority;
}
export interface CompositionResult {
    /** Final set of capabilities after composition rules are applied. */
    readonly capabilities: readonly string[];
    /** Capabilities that were added by composition rules. */
    readonly added: readonly string[];
    /** Rules that fired and their details. */
    readonly firedRules: readonly FiredRule[];
    /** Number of iterations performed. */
    readonly iterations: number;
}
export interface FiredRule {
    readonly ruleId: string;
    readonly reason: string;
    readonly addedCapabilities: readonly string[];
    readonly priority: CompositionPriority;
}
/**
 * Apply composition rules to expand the capability set.
 *
 * Iterates until no new capabilities are added or MAX_ITERATIONS is reached.
 * Only 'required' rules always fire. 'recommended' rules fire if under
 * the agent budget threshold. 'optional' rules are never auto-applied.
 *
 * @param capabilities - Initial set of classified capabilities
 * @param rules - Composition rules from the graph
 * @param validCapabilities - Set of all valid capability names in the graph
 * @param options - Budget and control options
 */
export declare function applyCompositions(capabilities: readonly string[], rules: readonly CompositionRule[], validCapabilities: ReadonlySet<string>, options?: CompositionOptions): CompositionResult;
export interface CompositionOptions {
    /** Current agent count before composition. */
    readonly currentAgentCount?: number;
    /** Total agent budget ceiling. */
    readonly agentBudget?: number;
}
/**
 * Validate composition rules for structural correctness.
 * Returns error messages or empty array.
 */
export declare function validateCompositionRules(rules: readonly CompositionRule[], validCapabilities: ReadonlySet<string>): string[];
/**
 * Detect cycles in composition rules.
 * A cycle occurs when rule A adds capability X, and rule B (triggered by X) adds
 * a capability that triggers rule A.
 */
export declare function detectCompositionCycles(rules: readonly CompositionRule[]): {
    hasCycle: boolean;
    cycleNodes: string[];
};
/**
 * Format composition result as a human-readable explanation.
 */
export declare function formatCompositionExplanation(result: CompositionResult): string;
//# sourceMappingURL=composition-engine.d.ts.map