import { PermissionRule, PermissionResource } from '@vess-id/ai-identity'; import { LocalPolicy, PolicyEvaluationResult, PolicySource } from './types'; /** * Two-layer policy evaluator (spec §7.1, §7.3). * * Evaluation flow: * 1. Local Policy evaluation → deny? block immediately * 2. Org Policy evaluation (from synced cache) → deny? block immediately * 3. Pass-through → continue to VC acquisition * * Semantics (spec §7.5): * - deny > allow (deny always wins over allow) * - more specific resource wins * - explicit action > wildcard * - local allow does NOT grant permission — only means "not blocked" */ export declare class PolicyEvaluator { private readonly localPolicy; private readonly orgRules; constructor(localPolicy: LocalPolicy, orgRules?: PermissionRule[]); /** * Evaluate both local and org policies. * Returns allowed=false if any deny rule matches. * Returns allowed=true if no deny matches (pass-through, not a grant). */ evaluate(provider: string, action: string, resource: PermissionResource): PolicyEvaluationResult; evaluateLocal(provider: string, action: string, resource: PermissionResource): PolicyEvaluationResult; evaluateOrg(provider: string, action: string, resource: PermissionResource): PolicyEvaluationResult; private evaluateRules; /** * Compute specificity score for a rule (spec §7.5). * Higher = more specific. * * Scoring: * - Specific provider (+10) vs wildcard provider (+0) * - Specific resource type (+10) vs wildcard (+0) * - Resource id (+20) > resource pattern (+10) > no constraint (+0) * - Specific action (+10) vs wildcard action (+0) */ private computeSpecificity; private matchesProvider; private matchesAction; private expandTilde; private matchesResource; /** * Add a deny rule at runtime (e.g., from user's deny_persistent choice). * For beta, this only adds to in-memory policy. Persistence to policy.yaml is β2+. */ addDenyRule(rule: { actions: string[]; effect: 'deny'; source: PolicySource; }): void; /** * Simple glob matching for resource patterns. * Supports: * - '*' matches any sequence of characters (except /) * - '**' matches any sequence including / * - '?' matches a single character */ private globMatch; } //# sourceMappingURL=policy-evaluator.d.ts.map