@aigrc/core 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,8 +1,9 @@
1
- import { RiskFactors, Trustworthiness, AssetCard, JurisdictionClassification, Intent, Technical } from './schemas/index.mjs';
2
- export { ApprovalSchema, AssetCardSchema, Classification, ClassificationSchema, Constraints, ConstraintsSchema, ControlStatus, ControlStatusSchema, Governance, GovernanceSchema, IntentSchema, JurisdictionClassificationSchema, Owner, OwnerSchema, RiskFactorsSchema, TechnicalSchema, TrustworthinessCharacteristic, TrustworthinessCharacteristicSchema, TrustworthinessSchema } from './schemas/index.mjs';
1
+ import { RiskLevel, RiskFactors, Trustworthiness, AssetCard, JurisdictionClassification, GoldenThread, Intent, Technical, AigrcConfig, PolicyFile, OperatingMode, PolicyRule, PolicyCapabilities } from './schemas/index.mjs';
2
+ export { AigrcConfigSchema, AigrcIntegrationsConfig, AigrcIntegrationsConfigSchema, AigrcRuntimeConfig, AigrcRuntimeConfigSchema, ApprovalSchema, AssetCardRuntime, AssetCardRuntimeSchema, AssetCardSchema, CapabilitiesManifest, CapabilitiesManifestSchema, Classification, ClassificationSchema, Constraints, ConstraintsSchema, ControlStatus, ControlStatusSchema, GoldenThreadSchema, Governance, GovernanceSchema, GovernanceTokenCapabilityClaims, GovernanceTokenCapabilityClaimsSchema, GovernanceTokenControlClaims, GovernanceTokenControlClaimsSchema, GovernanceTokenGovernanceClaims, GovernanceTokenGovernanceClaimsSchema, GovernanceTokenIdentityClaims, GovernanceTokenIdentityClaimsSchema, GovernanceTokenLineageClaims, GovernanceTokenLineageClaimsSchema, GovernanceTokenPayload, GovernanceTokenPayloadSchema, IntentSchema, JurisdictionClassificationSchema, KillSwitchCommand, KillSwitchCommandSchema, KillSwitchCommandType, KillSwitchCommandTypeSchema, Lineage, LineageSchema, OperatingModeSchema, Owner, OwnerSchema, PolicyCapabilitiesSchema, PolicyFileSchema, PolicyRuleEffect, PolicyRuleEffectSchema, PolicyRuleSchema, RiskFactorsSchema, RiskLevelSchema, RuntimeIdentity, RuntimeIdentitySchema, TechnicalSchema, TrustworthinessCharacteristic, TrustworthinessCharacteristicSchema, TrustworthinessSchema } from './schemas/index.mjs';
3
3
  import { z } from 'zod';
4
+ export { AIR, AIRBuildConstraints, AIRBuildConstraintsSchema, AIRMetadata, AIRMetadataSchema, AIRModel, AIRModelSchema, AIRPIIFilterConfig, AIRPIIFilterConfigSchema, AIRPolicySource, AIRPolicySourceSchema, AIRRegion, AIRRegionSchema, AIRRegistryConstraints, AIRRegistryConstraintsSchema, AIRRuntimeConstraints, AIRRuntimeConstraintsSchema, AIRSchema, AIRToxicityFilterConfig, AIRToxicityFilterConfigSchema, AIRVendor, AIRVendorSchema, createEmptyAIR, isModelAllowed, isRegionAllowed, isVendorAllowed, validateAIR } from './air/index.mjs';
5
+ export { GovernanceLock, GovernanceLockBuildConstraints, GovernanceLockBuildConstraintsSchema, GovernanceLockConstraints, GovernanceLockConstraintsSchema, GovernanceLockPolicySource, GovernanceLockPolicySourceSchema, GovernanceLockRegistryConstraints, GovernanceLockRegistryConstraintsSchema, GovernanceLockRuntimeConstraints, GovernanceLockRuntimeConstraintsSchema, GovernanceLockSchema, GovernanceLockSignature, GovernanceLockSignatureSchema, GovernanceLockValidationResult, addSignature, computeHash, createGovernanceLock, createSigningPayload, getDaysUntilExpiration, isGovernanceLockExpired, isModelAllowedByLock, isRegionAllowedByLock, isVendorAllowedByLock, parseGovernanceLockJSON, parseGovernanceLockYAML, serializeGovernanceLockJSON, serializeGovernanceLockYAML, validateGovernanceLock } from './governance-lock/index.mjs';
4
6
 
5
- type RiskLevel = "minimal" | "limited" | "high" | "unacceptable";
6
7
  interface ClassificationResult {
7
8
  riskLevel: RiskLevel;
8
9
  reasons: string[];
@@ -12,6 +13,57 @@ interface ClassificationResult {
12
13
  declare function classifyRisk(factors: RiskFactors): ClassificationResult;
13
14
  declare function validateRiskFactors(factors: RiskFactors): boolean;
14
15
 
16
+ /**
17
+ * Risk Level Utility Functions (AIGOS-105)
18
+ * Provides consistent operations for comparing and mapping risk levels
19
+ */
20
+
21
+ /**
22
+ * Compare two risk levels
23
+ * @returns -1 if a < b, 0 if a == b, 1 if a > b
24
+ */
25
+ declare function compareRiskLevels(a: RiskLevel, b: RiskLevel): -1 | 0 | 1;
26
+ /**
27
+ * Check if a risk level is at least as severe as a threshold
28
+ */
29
+ declare function isRiskLevelAtLeast(level: RiskLevel, threshold: RiskLevel): boolean;
30
+ /**
31
+ * Check if a risk level is at most as severe as a threshold
32
+ */
33
+ declare function isRiskLevelAtMost(level: RiskLevel, threshold: RiskLevel): boolean;
34
+ /**
35
+ * Get the ordinal value (0-3) of a risk level
36
+ */
37
+ declare function getRiskLevelOrdinal(level: RiskLevel): number;
38
+ /**
39
+ * Get the maximum (most severe) risk level from an array
40
+ */
41
+ declare function getMaxRiskLevel(levels: RiskLevel[]): RiskLevel;
42
+ /**
43
+ * Get the minimum (least severe) risk level from an array
44
+ */
45
+ declare function getMinRiskLevel(levels: RiskLevel[]): RiskLevel;
46
+ /**
47
+ * Map an AIGOS risk level to EU AI Act category
48
+ */
49
+ declare function mapToEuAiActCategory(level: RiskLevel): string;
50
+ /**
51
+ * Get all risk levels at or above a threshold
52
+ */
53
+ declare function getRiskLevelsAtLeast(threshold: RiskLevel): RiskLevel[];
54
+ /**
55
+ * Get all risk levels at or below a threshold
56
+ */
57
+ declare function getRiskLevelsAtMost(threshold: RiskLevel): RiskLevel[];
58
+ /**
59
+ * Parse a string to a RiskLevel, returning undefined if invalid
60
+ */
61
+ declare function parseRiskLevel(value: string): RiskLevel | undefined;
62
+ /**
63
+ * Check if a value is a valid RiskLevel
64
+ */
65
+ declare function isValidRiskLevel(value: unknown): value is RiskLevel;
66
+
15
67
  interface CreateAssetCardOptions {
16
68
  name: string;
17
69
  description?: string;
@@ -66,6 +118,65 @@ interface TicketInfo {
66
118
  businessJustification?: string;
67
119
  riskTolerance?: "low" | "medium" | "high";
68
120
  }
121
+ interface GoldenThreadComponents {
122
+ ticket_id: string;
123
+ approved_by: string;
124
+ approved_at: string;
125
+ }
126
+ interface GoldenThreadHashResult {
127
+ canonical_string: string;
128
+ hash: string;
129
+ }
130
+ interface GoldenThreadVerificationResult {
131
+ verified: boolean;
132
+ computed: string;
133
+ expected: string;
134
+ mismatch_reason?: string;
135
+ }
136
+ /**
137
+ * Compute the canonical string for Golden Thread hashing.
138
+ * Format: approved_at={ISO8601}|approved_by={email}|ticket_id={id}
139
+ * Fields are sorted alphabetically with pipe delimiters.
140
+ *
141
+ * Test Vector:
142
+ * Input: ticket_id=FIN-1234, approved_by=ciso@corp.com, approved_at=2025-01-15T10:30:00Z
143
+ * Output: "approved_at=2025-01-15T10:30:00Z|approved_by=ciso@corp.com|ticket_id=FIN-1234"
144
+ */
145
+ declare function computeCanonicalString(components: GoldenThreadComponents): string;
146
+ /**
147
+ * Compute SHA-256 hash of the Golden Thread canonical string.
148
+ * Output format: sha256:{64 lowercase hex chars}
149
+ *
150
+ * Test Vector:
151
+ * Input: FIN-1234 | ciso@corp.com | 2025-01-15T10:30:00Z
152
+ * Output: sha256:7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730
153
+ */
154
+ declare function computeGoldenThreadHash(components: GoldenThreadComponents): Promise<GoldenThreadHashResult>;
155
+ /**
156
+ * Synchronous hash computation using Node.js crypto (for Node environments)
157
+ */
158
+ declare function computeGoldenThreadHashSync(components: GoldenThreadComponents): GoldenThreadHashResult;
159
+ /**
160
+ * Verify a Golden Thread hash against computed value.
161
+ * Uses constant-time comparison for security.
162
+ */
163
+ declare function verifyGoldenThreadHash(components: GoldenThreadComponents, expectedHash: string): Promise<GoldenThreadVerificationResult>;
164
+ /**
165
+ * Synchronous hash verification
166
+ */
167
+ declare function verifyGoldenThreadHashSync(components: GoldenThreadComponents, expectedHash: string): GoldenThreadVerificationResult;
168
+ /**
169
+ * Extract Golden Thread components from an Asset Card
170
+ */
171
+ declare function extractGoldenThreadComponents(asset: AssetCard): GoldenThreadComponents | null;
172
+ /**
173
+ * Create a complete Golden Thread object with computed hash
174
+ */
175
+ declare function createGoldenThread(components: GoldenThreadComponents): Promise<GoldenThread>;
176
+ /**
177
+ * Synchronous version of createGoldenThread
178
+ */
179
+ declare function createGoldenThreadSync(components: GoldenThreadComponents): GoldenThread;
69
180
  interface LinkResult {
70
181
  success: boolean;
71
182
  intent: Intent;
@@ -77,6 +188,53 @@ declare function validateGoldenThread(asset: AssetCard): {
77
188
  healthScore: number;
78
189
  issues: string[];
79
190
  };
191
+ /** Supported signature algorithms */
192
+ type SignatureAlgorithm = "RSA-SHA256" | "ECDSA-P256";
193
+ /** Result of signature verification */
194
+ interface SignatureVerificationResult {
195
+ /** Whether signature is valid */
196
+ verified: boolean;
197
+ /** Algorithm used */
198
+ algorithm: SignatureAlgorithm | null;
199
+ /** Error message if verification failed */
200
+ error?: string;
201
+ /** The data that was signed (canonical string) */
202
+ signedData?: string;
203
+ }
204
+ /** Public key for signature verification */
205
+ interface SignaturePublicKey {
206
+ /** Algorithm this key is for */
207
+ algorithm: SignatureAlgorithm;
208
+ /** PEM-encoded public key or JWK */
209
+ key: string;
210
+ /** Key ID for key rotation */
211
+ keyId?: string;
212
+ }
213
+ /**
214
+ * Parse a signature string in format: {ALGORITHM}:{BASE64_SIGNATURE}
215
+ */
216
+ declare function parseSignature(signature: string): {
217
+ algorithm: SignatureAlgorithm;
218
+ data: Uint8Array;
219
+ } | null;
220
+ /**
221
+ * Verify a Golden Thread signature using Web Crypto API.
222
+ *
223
+ * @param components - The Golden Thread components that were signed
224
+ * @param signature - The signature in format {ALGORITHM}:{BASE64_SIGNATURE}
225
+ * @param publicKey - The public key for verification
226
+ * @returns Verification result
227
+ */
228
+ declare function verifyGoldenThreadSignature(components: GoldenThreadComponents, signature: string, publicKey: SignaturePublicKey): Promise<SignatureVerificationResult>;
229
+ /**
230
+ * Synchronous signature verification using Node.js crypto
231
+ */
232
+ declare function verifyGoldenThreadSignatureSync(components: GoldenThreadComponents, signature: string, publicKeyPem: string): SignatureVerificationResult;
233
+ /**
234
+ * Sign Golden Thread components (for testing/tooling)
235
+ * Note: privateKey should be a CryptoKey from Web Crypto API
236
+ */
237
+ declare function signGoldenThread(components: GoldenThreadComponents, privateKey: unknown, algorithm: SignatureAlgorithm): Promise<string>;
80
238
 
81
239
  declare const ConfidenceLevelSchema: z.ZodEnum<["high", "medium", "low"]>;
82
240
  type ConfidenceLevel = z.infer<typeof ConfidenceLevelSchema>;
@@ -219,8 +377,313 @@ declare function isModelFile(filePath: string): boolean;
219
377
 
220
378
  declare function detectAnnotations(filePath: string, lines: string[], patterns: PatternDefinition[]): DetectionResult[];
221
379
 
380
+ /** Configuration file names to search for (in order of precedence) */
381
+ declare const CONFIG_FILE_NAMES: readonly [".aigrc.yaml", ".aigrc.yml", "aigrc.yaml", "aigrc.yml"];
382
+ /** Environment variable for config path override */
383
+ declare const CONFIG_ENV_VAR = "AIGRC_CONFIG_PATH";
384
+ /** Result of configuration discovery */
385
+ interface ConfigDiscoveryResult {
386
+ /** The discovered configuration */
387
+ config: AigrcConfig;
388
+ /** Absolute path to the configuration file */
389
+ configPath: string;
390
+ /** Directory containing the configuration */
391
+ configDir: string;
392
+ /** Whether this was loaded from environment variable */
393
+ fromEnv: boolean;
394
+ }
395
+ /** Options for configuration discovery */
396
+ interface DiscoverConfigOptions {
397
+ /** Starting directory for search (defaults to cwd) */
398
+ startDir?: string;
399
+ /** Maximum directories to traverse upward (default: 10) */
400
+ maxDepth?: number;
401
+ /** Override config path (equivalent to AIGRC_CONFIG_PATH) */
402
+ configPath?: string;
403
+ }
404
+ /**
405
+ * Discovers and loads the AIGRC configuration file.
406
+ *
407
+ * Search order:
408
+ * 1. Explicit configPath option
409
+ * 2. AIGRC_CONFIG_PATH environment variable
410
+ * 3. Walking up from startDir looking for config files
411
+ *
412
+ * @param options Discovery options
413
+ * @returns Configuration result or null if not found
414
+ */
415
+ declare function discoverConfig(options?: DiscoverConfigOptions): ConfigDiscoveryResult | null;
416
+ /**
417
+ * Synchronously discovers configuration
418
+ */
419
+ declare function discoverConfigSync(options?: DiscoverConfigOptions): ConfigDiscoveryResult | null;
420
+ /** Result of policy discovery */
421
+ interface PolicyDiscoveryResult {
422
+ /** Loaded policies indexed by ID */
423
+ policies: Map<string, PolicyFile>;
424
+ /** Paths of loaded policy files */
425
+ loadedPaths: string[];
426
+ /** Errors encountered during loading */
427
+ errors: PolicyLoadError[];
428
+ }
429
+ /** Error during policy loading */
430
+ interface PolicyLoadError {
431
+ path: string;
432
+ error: string;
433
+ }
434
+ /** Options for policy discovery */
435
+ interface DiscoverPoliciesOptions {
436
+ /** Configuration to use for policy paths */
437
+ config?: AigrcConfig;
438
+ /** Base directory for relative paths */
439
+ baseDir?: string;
440
+ /** Additional paths to search */
441
+ additionalPaths?: string[];
442
+ }
443
+ /**
444
+ * Discovers and loads all policy files.
445
+ *
446
+ * @param options Discovery options
447
+ * @returns Map of policy ID to PolicyFile
448
+ */
449
+ declare function discoverPolicies(options?: DiscoverPoliciesOptions): PolicyDiscoveryResult;
450
+ /**
451
+ * Loads a specific policy by ID
452
+ */
453
+ declare function loadPolicy(policyId: string, options?: DiscoverPoliciesOptions): PolicyFile | null;
454
+
455
+ /** Result of asset card discovery */
456
+ interface AssetDiscoveryResult {
457
+ /** Loaded asset cards indexed by ID */
458
+ assets: Map<string, AssetCard>;
459
+ /** Paths of loaded asset files */
460
+ loadedPaths: string[];
461
+ /** Errors encountered during loading */
462
+ errors: AssetLoadError[];
463
+ }
464
+ /** Error during asset loading */
465
+ interface AssetLoadError {
466
+ path: string;
467
+ error: string;
468
+ }
469
+ /** Options for asset discovery */
470
+ interface DiscoverAssetsOptions {
471
+ /** Configuration to use for asset paths */
472
+ config?: AigrcConfig;
473
+ /** Base directory for relative paths */
474
+ baseDir?: string;
475
+ /** Additional paths to search */
476
+ additionalPaths?: string[];
477
+ }
478
+ /**
479
+ * Discovers and loads all asset cards.
480
+ *
481
+ * @param options Discovery options
482
+ * @returns Map of asset ID to AssetCard
483
+ */
484
+ declare function discoverAssets(options?: DiscoverAssetsOptions): AssetDiscoveryResult;
485
+ /**
486
+ * Loads a specific asset by ID
487
+ */
488
+ declare function loadAsset(assetId: string, options?: DiscoverAssetsOptions): AssetCard | null;
489
+ /**
490
+ * Loads an asset card from a specific file path
491
+ */
492
+ declare function loadAssetFromPath(filePath: string): AssetCard | null;
493
+ /**
494
+ * Gets the effective configuration for an environment.
495
+ * Merges base config with environment-specific overrides.
496
+ *
497
+ * @param config Base configuration
498
+ * @param environment Environment name (e.g., "production", "development")
499
+ * @returns Merged configuration
500
+ */
501
+ declare function getEnvironmentConfig(config: AigrcConfig, environment: string): AigrcConfig;
502
+ /**
503
+ * Gets the current environment name from environment variables.
504
+ * Checks NODE_ENV, AIGRC_ENV in order.
505
+ */
506
+ declare function getCurrentEnvironment(): string;
507
+ /**
508
+ * Creates a default configuration
509
+ */
510
+ declare function createDefaultConfig(): AigrcConfig;
511
+
512
+ /** Maximum inheritance depth to prevent infinite loops */
513
+ declare const MAX_INHERITANCE_DEPTH = 10;
514
+ /** Error thrown when policy resolution fails */
515
+ declare class PolicyResolutionError extends Error {
516
+ readonly policyId: string;
517
+ readonly cause?: unknown | undefined;
518
+ constructor(message: string, policyId: string, cause?: unknown | undefined);
519
+ }
520
+ /** Result of policy resolution */
521
+ interface ResolvedPolicy {
522
+ /** The fully resolved policy (all inheritance applied) */
523
+ policy: PolicyFile;
524
+ /** Chain of policy IDs from root to this policy */
525
+ inheritanceChain: string[];
526
+ /** Number of policies in the chain */
527
+ depth: number;
528
+ }
529
+ /** Policy repository for loading policies by ID */
530
+ interface PolicyRepository {
531
+ /** Gets a policy by ID */
532
+ get(id: string): PolicyFile | undefined;
533
+ /** Checks if a policy exists */
534
+ has(id: string): boolean;
535
+ }
536
+ /**
537
+ * Creates a PolicyRepository from a Map
538
+ */
539
+ declare function createPolicyRepository(policies: Map<string, PolicyFile>): PolicyRepository;
540
+ /**
541
+ * Resolves a policy by ID, applying all inherited policies.
542
+ *
543
+ * @param policyId The ID of the policy to resolve
544
+ * @param repository Repository for loading policies
545
+ * @returns Resolved policy with all inheritance applied
546
+ */
547
+ declare function resolvePolicy(policyId: string, repository: PolicyRepository): ResolvedPolicy;
548
+ /**
549
+ * Merges two policies, with the child taking precedence.
550
+ *
551
+ * Merge rules:
552
+ * - Scalar values: child overrides parent
553
+ * - Arrays (rules): child's rules are appended after parent's
554
+ * - Capabilities: deep merge with child overriding
555
+ * - applies_to: replaced entirely by child if specified
556
+ */
557
+ declare function mergePolicies(parent: PolicyFile, child: PolicyFile): PolicyFile;
558
+ /** Context for policy evaluation */
559
+ interface PolicyEvaluationContext {
560
+ /** Current risk level of the agent */
561
+ riskLevel: RiskLevel;
562
+ /** Current operating mode */
563
+ mode: OperatingMode;
564
+ /** Current timestamp (ISO 8601) */
565
+ timestamp?: string;
566
+ /** Custom context values */
567
+ custom?: Record<string, unknown>;
568
+ }
569
+ /** Result of evaluating a policy rule */
570
+ interface PolicyEvaluationResult {
571
+ /** Whether the action is allowed */
572
+ allowed: boolean;
573
+ /** Effect that was applied */
574
+ effect: "allow" | "deny" | "audit";
575
+ /** Rule that matched, if any */
576
+ matchedRule?: PolicyRule;
577
+ /** Whether any rule matched */
578
+ matched: boolean;
579
+ /** Reason for the decision */
580
+ reason: string;
581
+ }
582
+ /**
583
+ * Evaluates a policy for a given action and resource.
584
+ *
585
+ * @param policy The resolved policy to evaluate
586
+ * @param action The action being performed (e.g., "read_file")
587
+ * @param resource The resource being accessed (e.g., "/path/to/file")
588
+ * @param context Evaluation context
589
+ * @returns Evaluation result
590
+ */
591
+ declare function evaluatePolicy(policy: PolicyFile, action: string, resource: string, context: PolicyEvaluationContext): PolicyEvaluationResult;
592
+ /**
593
+ * Checks if an action is allowed by capability lists.
594
+ * Uses tool allow/deny lists for quick checks without full rule evaluation.
595
+ */
596
+ declare function isToolAllowed(tool: string, capabilities?: PolicyCapabilities): boolean;
597
+ /**
598
+ * Checks if a domain is allowed by capability lists.
599
+ */
600
+ declare function isDomainAllowed(domain: string, capabilities?: PolicyCapabilities): boolean;
601
+ /** Policy selection criteria */
602
+ interface PolicySelectionCriteria {
603
+ /** Asset ID to match */
604
+ assetId: string;
605
+ /** Risk level of the agent */
606
+ riskLevel: RiskLevel;
607
+ /** Operating mode */
608
+ mode: OperatingMode;
609
+ /** Tags associated with the agent */
610
+ tags?: string[];
611
+ /** Environment (e.g., "production", "staging") */
612
+ environment?: string;
613
+ }
614
+ /** Policy selection result */
615
+ interface PolicySelectionResult {
616
+ /** The selected policy (null if none found) */
617
+ policy: PolicyFile | null;
618
+ /** Policy ID */
619
+ policyId: string | null;
620
+ /** How the policy was selected */
621
+ selectionReason: PolicySelectionReason;
622
+ /** Policies that were considered */
623
+ candidatePolicies: string[];
624
+ /** Score breakdown for the selected policy */
625
+ score?: PolicyScore;
626
+ }
627
+ /** Reason for policy selection */
628
+ type PolicySelectionReason = "explicit_match" | "risk_level_match" | "tag_match" | "wildcard_match" | "default_policy" | "no_policy_found";
629
+ /** Score breakdown for policy selection */
630
+ interface PolicyScore {
631
+ /** Total score */
632
+ total: number;
633
+ /** Explicit asset match bonus */
634
+ explicitMatch: number;
635
+ /** Risk level match bonus */
636
+ riskLevelMatch: number;
637
+ /** Tag match count */
638
+ tagMatches: number;
639
+ /** Priority from policy */
640
+ priority: number;
641
+ }
642
+ /**
643
+ * Selects the best policy for an agent based on criteria.
644
+ *
645
+ * Selection algorithm:
646
+ * 1. Filter policies by applies_to (asset ID or wildcard)
647
+ * 2. Score remaining policies:
648
+ * - Explicit asset match: +100
649
+ * - Risk level match: +50
650
+ * - Each tag match: +10
651
+ * - Policy priority: +priority value
652
+ * 3. Return highest scoring policy
653
+ *
654
+ * @param criteria Selection criteria
655
+ * @param repository Policy repository
656
+ * @param defaultPolicyId Optional default policy ID
657
+ * @returns Selected policy result
658
+ */
659
+ declare function selectPolicy(criteria: PolicySelectionCriteria, repository: PolicyRepository, defaultPolicyId?: string): PolicySelectionResult;
660
+ /**
661
+ * Creates a policy selector with caching for repeated lookups.
662
+ */
663
+ interface PolicySelector {
664
+ /** Select a policy for given criteria */
665
+ select(criteria: PolicySelectionCriteria): PolicySelectionResult;
666
+ /** Clear the cache */
667
+ clearCache(): void;
668
+ /** Get cache statistics */
669
+ getCacheStats(): {
670
+ hits: number;
671
+ misses: number;
672
+ size: number;
673
+ };
674
+ }
675
+ /**
676
+ * Creates a policy selector with LRU caching.
677
+ *
678
+ * @param repository Policy repository
679
+ * @param defaultPolicyId Default policy ID
680
+ * @param cacheSize Maximum cache size (default: 100)
681
+ * @returns Policy selector
682
+ */
683
+ declare function createPolicySelector(repository: PolicyRepository, defaultPolicyId?: string, cacheSize?: number): PolicySelector;
684
+
222
685
  declare function formatDate(date: Date): string;
223
686
  declare function parseDate(dateString: string): Date;
224
687
  declare function slugify(text: string): string;
225
688
 
226
- export { AssetCard, type AssetCardSuggestion, type ClassificationResult, type ConfidenceLevel, ConfidenceLevelSchema, type CreateAssetCardOptions, type DetectionResult, type DetectionStrategy, DetectionStrategySchema, type FrameworkCategory, FrameworkCategorySchema, Intent, JurisdictionClassification, type LinkResult, MODEL_EXTENSIONS, type PatternDefinition, type PatternLanguage, type PatternRule, type PatternRuleType, RiskFactors, type RiskImplication, type RiskLevel, type ScanError, type ScanOptions, type ScanProgress, type ScanProgressCallback, type ScanResult, type ScanSummary, Technical, type TicketInfo, Trustworthiness, addJurisdiction, analyzeImports, applyImplicationChains, classifyRisk, clearRegistry, createAssetCard, createImplication, detectAnnotations, formatDate, generateAssetId, getAllPatterns, getPattern, getPatternsByCategory, getPatternsByLanguage, inferRiskFactors, initializePatterns, isModelFile, isRegistryInitialized, javascriptPatterns, linkAssetToTicket, loadAssetCard, matchPatterns, modelFilePatterns, parseDate, pythonPatterns, registerPattern, resetPatterns, riskIndicatorPatterns, saveAssetCard, scan, scanFileExtension, scanSync, slugify, suggestAssetCard, updateJurisdictionCompliance, validateAssetCard, validateGoldenThread, validateRiskFactors };
689
+ export { AigrcConfig, AssetCard, type AssetCardSuggestion, type AssetDiscoveryResult, type AssetLoadError, CONFIG_ENV_VAR, CONFIG_FILE_NAMES, type ClassificationResult, type ConfidenceLevel, ConfidenceLevelSchema, type ConfigDiscoveryResult, type CreateAssetCardOptions, type DetectionResult, type DetectionStrategy, DetectionStrategySchema, type DiscoverAssetsOptions, type DiscoverConfigOptions, type DiscoverPoliciesOptions, type FrameworkCategory, FrameworkCategorySchema, GoldenThread, type GoldenThreadComponents, type GoldenThreadHashResult, type GoldenThreadVerificationResult, Intent, JurisdictionClassification, type LinkResult, MAX_INHERITANCE_DEPTH, MODEL_EXTENSIONS, OperatingMode, type PatternDefinition, type PatternLanguage, type PatternRule, type PatternRuleType, PolicyCapabilities, type PolicyDiscoveryResult, type PolicyEvaluationContext, type PolicyEvaluationResult, PolicyFile, type PolicyLoadError, type PolicyRepository, PolicyResolutionError, PolicyRule, type PolicyScore, type PolicySelectionCriteria, type PolicySelectionReason, type PolicySelectionResult, type PolicySelector, type ResolvedPolicy, RiskFactors, type RiskImplication, RiskLevel, type ScanError, type ScanOptions, type ScanProgress, type ScanProgressCallback, type ScanResult, type ScanSummary, type SignatureAlgorithm, type SignaturePublicKey, type SignatureVerificationResult, Technical, type TicketInfo, Trustworthiness, addJurisdiction, analyzeImports, applyImplicationChains, classifyRisk, clearRegistry, compareRiskLevels, computeCanonicalString, computeGoldenThreadHash, computeGoldenThreadHashSync, createAssetCard, createDefaultConfig, createGoldenThread, createGoldenThreadSync, createImplication, createPolicyRepository, createPolicySelector, detectAnnotations, discoverAssets, discoverConfig, discoverConfigSync, discoverPolicies, evaluatePolicy, extractGoldenThreadComponents, formatDate, generateAssetId, getAllPatterns, getCurrentEnvironment, getEnvironmentConfig, getMaxRiskLevel, getMinRiskLevel, getPattern, getPatternsByCategory, getPatternsByLanguage, getRiskLevelOrdinal, getRiskLevelsAtLeast, getRiskLevelsAtMost, inferRiskFactors, initializePatterns, isDomainAllowed, isModelFile, isRegistryInitialized, isRiskLevelAtLeast, isRiskLevelAtMost, isToolAllowed, isValidRiskLevel, javascriptPatterns, linkAssetToTicket, loadAsset, loadAssetCard, loadAssetFromPath, loadPolicy, mapToEuAiActCategory, matchPatterns, mergePolicies, modelFilePatterns, parseDate, parseRiskLevel, parseSignature, pythonPatterns, registerPattern, resetPatterns, resolvePolicy, riskIndicatorPatterns, saveAssetCard, scan, scanFileExtension, scanSync, selectPolicy, signGoldenThread, slugify, suggestAssetCard, updateJurisdictionCompliance, validateAssetCard, validateGoldenThread, validateRiskFactors, verifyGoldenThreadHash, verifyGoldenThreadHashSync, verifyGoldenThreadSignature, verifyGoldenThreadSignatureSync };