/**
 * Governance Engine
 *
 * Core engine for evaluating intents against policies and making governance decisions.
 *
 * @packageDocumentation
 */
import type { Intent, ControlAction, ID, Timestamp } from '../common/types.js';
import { type Policy, type PolicySet, type PolicyEffect, type ConflictResolutionStrategy } from './policy.js';
/**
 * Detailed audit trail entry for rule matching
 */
export interface RuleAuditEntry {
    /** Policy ID */
    policyId: ID;
    /** Policy name */
    policyName: string;
    /** Rule field */
    field: string;
    /** Rule operator */
    operator: string;
    /** Expected value */
    expectedValue: unknown;
    /** Actual value */
    actualValue: unknown;
    /** Whether the rule matched */
    matched: boolean;
}
/**
 * Policy evaluation audit entry
 */
export interface PolicyAuditEntry {
    /** Policy ID */
    policyId: ID;
    /** Policy name */
    policyName: string;
    /** Policy priority */
    priority: number;
    /** Whether the policy matched */
    matched: boolean;
    /** Effect if matched */
    effect: PolicyEffect;
    /** Individual rule audit entries */
    ruleAudit: RuleAuditEntry[];
    /** Evaluation duration */
    durationMs: number;
}
/**
 * Result of evaluating an intent against policies
 */
export interface EvaluationResult {
    /** The intent that was evaluated */
    intentId: ID;
    /** Final decision */
    decision: ControlAction;
    /** Reason for the decision */
    reason?: string;
    /** Whether the intent is permitted */
    permitted: boolean;
    /** Policies that were evaluated */
    policiesEvaluated: PolicyAuditEntry[];
    /** Policies that matched */
    matchedPolicies: PolicyAuditEntry[];
    /** Total evaluation duration */
    durationMs: number;
    /** Evaluation timestamp */
    evaluatedAt: Timestamp;
}
/**
 * Structural type for proof-plane integration (avoids hard dependency on @vorionsys/proof-plane)
 */
export interface ProofPlaneEmitter {
    logDecisionMade(decision: {
        decisionId: string;
        intentId: string;
        agentId: string;
        correlationId: string;
        permitted: boolean;
        trustBand: number;
        trustScore: number;
        reasoning: string[];
        decidedAt: Date;
        expiresAt: Date;
        latencyMs: number;
        version: number;
    }, correlationId?: string): Promise<unknown>;
}
/**
 * Options for governance engine
 */
export interface GovernanceEngineOptions {
    /** Conflict resolution strategy */
    conflictResolution?: ConflictResolutionStrategy;
    /** Default decision when no policies match */
    defaultDecision?: ControlAction;
    /** Whether to enable tracing */
    enableTracing?: boolean;
    /** Optional proof plane for audit event emission */
    proofPlane?: ProofPlaneEmitter;
}
/**
 * GovernanceEngine class for evaluating intents against policies
 */
export declare class GovernanceEngine {
    private ruleEvaluator;
    private policySetManager;
    private options;
    constructor(options?: GovernanceEngineOptions);
    /**
     * Evaluate an intent against a set of policies
     */
    evaluateIntent(intent: Intent, policies: Policy[]): EvaluationResult;
    /**
     * Evaluate an intent with OpenTelemetry tracing
     */
    evaluateIntentWithTracing(intent: Intent, policies: Policy[]): Promise<EvaluationResult>;
    /**
     * Load policies from policy sets
     */
    loadPoliciesFromSets(): Policy[];
    /**
     * Add a policy set to the engine
     */
    addPolicySet(policySet: PolicySet): void;
    /**
     * Remove a policy set from the engine
     */
    removePolicySet(id: ID): boolean;
    /**
     * Get all policy sets
     */
    getPolicySets(): PolicySet[];
    /**
     * Find policies matching specific criteria
     */
    findMatchingPolicies(action?: string, resource?: string, intentType?: string): Policy[];
    /**
     * Clear all loaded policies
     */
    clearPolicies(): void;
    /**
     * Get engine options
     */
    getOptions(): Readonly<Required<GovernanceEngineOptions>>;
    /**
     * Create an audit entry from a policy match result
     */
    private createPolicyAuditEntry;
    /**
     * Emit a decision proof event to the proof plane (fire-and-forget)
     */
    private emitDecisionProof;
}
/**
 * Create a new governance engine instance
 */
export declare function createGovernanceEngine(options?: GovernanceEngineOptions): GovernanceEngine;
//# sourceMappingURL=engine.d.ts.map