/** * @fileoverview Cross-System Mappings * * Provides mapping functions between different tier systems, domain namespaces, * and trust representations. These mappings enable interoperability between * the CAR specification and Vorion runtime systems. * * Key mappings: * - CertificationTier <-> RuntimeTier * - CAR Domains <-> Vorion Namespaces * - TrustBand <-> CertificationTier/RuntimeTier * * @module @vorionsys/contracts/car/mapping */ import { z } from 'zod'; import { type DomainCode } from './domains.js'; import { CapabilityLevel } from './levels.js'; import { CertificationTier, RuntimeTier } from './tiers.js'; /** * Maps a CertificationTier to the corresponding RuntimeTier. * * This is a direct 1:1 mapping since both use T0-T7 scale, but with * different semantic meanings: * - CertificationTier: External attestation status * - RuntimeTier: Deployment autonomy level * * @param certificationTier - CAR ID certification tier * @returns Corresponding Vorion runtime tier * * @example * ```typescript * certificationTierToRuntimeTier(CertificationTier.T3_MONITORED); * // RuntimeTier.T3_MONITORED * ``` */ export declare function certificationTierToRuntimeTier(certificationTier: CertificationTier): RuntimeTier; /** * Maps a RuntimeTier to the corresponding CertificationTier. * * @param runtimeTier - Vorion runtime tier * @returns Corresponding CAR ID certification tier * * @example * ```typescript * runtimeTierToCertificationTier(RuntimeTier.T3_MONITORED); * // CertificationTier.T3_MONITORED * ``` */ export declare function runtimeTierToCertificationTier(runtimeTier: RuntimeTier): CertificationTier; /** * Mapping configuration for certification to runtime tier. */ export declare const CERTIFICATION_TO_RUNTIME_TIER_MAP: Readonly>; /** * Mapping configuration for runtime to certification tier. */ export declare const RUNTIME_TO_CERTIFICATION_TIER_MAP: Readonly>; /** * TrustBand values from Vorion canonical types. * Replicated here to avoid circular dependencies. * * The 8-tier system (T0-T7) maps trust scores to discrete autonomy levels: * - T0: Sandbox - Isolated testing, no real operations (0-199) * - T1: Observed - Under active observation and supervision (200-349) * - T2: Provisional - Limited operations with strict constraints (350-499) * - T3: Monitored - Continuous monitoring with expanding freedom (500-649) * - T4: Standard - Trusted for routine operations (650-799) * - T5: Trusted - Expanded capabilities with minimal oversight (800-875) * - T6: Certified - Independent operation with audit trail (876-950) * - T7: Autonomous - Full autonomy for mission-critical operations (951-1000) */ export declare enum TrustBand { T0_SANDBOX = 0, T1_OBSERVED = 1, T2_PROVISIONAL = 2, T3_MONITORED = 3, T4_STANDARD = 4, T5_TRUSTED = 5, T6_CERTIFIED = 6, T7_AUTONOMOUS = 7 } /** * Zod schema for TrustBand validation. */ export declare const trustBandSchema: z.ZodNativeEnum; /** * Maps a TrustBand to a CertificationTier. * * @param trustBand - Vorion trust band * @returns Corresponding CAR ID certification tier * * @example * ```typescript * trustBandToCertificationTier(TrustBand.T3_STANDARD); * // CertificationTier.T3_MONITORED * ``` */ export declare function trustBandToCertificationTier(trustBand: TrustBand): CertificationTier; /** * Maps a TrustBand to a RuntimeTier. * * @param trustBand - Vorion trust band * @returns Corresponding Vorion runtime tier * * @example * ```typescript * trustBandToRuntimeTier(TrustBand.T3_STANDARD); * // RuntimeTier.T3_MONITORED * ``` */ export declare function trustBandToRuntimeTier(trustBand: TrustBand): RuntimeTier; /** * Maps a CertificationTier to a TrustBand. * * @param certificationTier - CAR ID certification tier * @returns Corresponding Vorion trust band */ export declare function certificationTierToTrustBand(certificationTier: CertificationTier): TrustBand; /** * Maps a RuntimeTier to a TrustBand. * * @param runtimeTier - Vorion runtime tier * @returns Corresponding Vorion trust band */ export declare function runtimeTierToTrustBand(runtimeTier: RuntimeTier): TrustBand; /** * Converts a trust score to both certification and runtime tiers. * * Note: CertificationTier and RuntimeTier use different score ranges, * so the same score may map to different tiers. * * @param score - Trust score (0-1000) * @returns Both certification and runtime tiers * * @example * ```typescript * scoreToBothTiers(550); * // { certificationTier: T3_MONITORED, runtimeTier: T3_TRUSTED } * ``` */ export declare function scoreToBothTiers(score: number): { certificationTier: CertificationTier; runtimeTier: RuntimeTier; }; /** * Normalizes a score between CAR ID and Vorion scales. * * CAR ID uses 0-1000 with boundaries at 100, 300, 500, 700, 900 * Vorion uses 0-1000 with boundaries at 166, 333, 500, 666, 833 * * @param score - Trust score * @param fromScale - Source scale ('carId' | 'vorion') * @param toScale - Target scale ('carId' | 'vorion') * @returns Normalized score in target scale */ export declare function normalizeScoreBetweenScales(score: number, fromScale: 'carId' | 'vorion', toScale: 'carId' | 'vorion'): number; /** * Vorion namespace strings corresponding to CAR ID domains. */ export type VorionNamespace = 'administration' | 'business' | 'communications' | 'data' | 'external' | 'finance' | 'governance' | 'healthcare' | 'infrastructure' | 'judicial' | 'knowledge' | 'logistics' | 'manufacturing' | 'nlp' | 'operations' | 'people' | 'quality' | 'research' | 'security' | 'training' | 'utilities' | 'verification' | 'web' | 'cross-domain' | 'yield' | 'reserved'; /** * Array of all Vorion namespaces. */ export declare const VORION_NAMESPACES: readonly VorionNamespace[]; /** * Zod schema for VorionNamespace validation. */ export declare const vorionNamespaceSchema: z.ZodEnum<["administration", "business", "communications", "cross-domain", "data", "external", "finance", "governance", "healthcare", "infrastructure", "judicial", "knowledge", "logistics", "manufacturing", "nlp", "operations", "people", "quality", "research", "reserved", "security", "training", "utilities", "verification", "web", "yield"]>; /** * Mapping from CAR ID domain codes to Vorion namespaces. */ export declare const DOMAIN_TO_NAMESPACE_MAP: Readonly>; /** * Mapping from Vorion namespaces to CAR ID domain codes. */ export declare const NAMESPACE_TO_DOMAIN_MAP: Readonly>; /** * Maps a CAR ID domain code to a Vorion namespace. * * @param domain - CAR ID domain code * @returns Vorion namespace * * @example * ```typescript * carIdDomainToVorionNamespace('F'); // 'finance' * carIdDomainToVorionNamespace('S'); // 'security' * ``` */ export declare function carIdDomainToVorionNamespace(domain: DomainCode): VorionNamespace; /** * Maps a Vorion namespace to a CAR ID domain code. * * @param namespace - Vorion namespace * @returns CAR ID domain code * * @example * ```typescript * vorionNamespaceToCarIdDomain('finance'); // 'F' * vorionNamespaceToCarIdDomain('security'); // 'S' * ``` */ export declare function vorionNamespaceToCarIdDomain(namespace: VorionNamespace): DomainCode; /** * Maps an array of CAR ID domains to Vorion namespaces. * * @param domains - Array of CAR ID domain codes * @returns Array of Vorion namespaces */ export declare function carIdDomainsToVorionNamespaces(domains: readonly DomainCode[]): VorionNamespace[]; /** * Maps an array of Vorion namespaces to CAR ID domains. * * @param namespaces - Array of Vorion namespaces * @returns Array of CAR ID domain codes */ export declare function vorionNamespacesToCarIdDomains(namespaces: readonly VorionNamespace[]): DomainCode[]; /** * Maps a capability level to a human-readable autonomy description. * * @param level - Capability level * @returns Autonomy description */ export declare function capabilityLevelToAutonomyDescription(level: CapabilityLevel): string; /** * Maps a capability level to a maximum allowed runtime tier. * * Higher capability levels require higher runtime tiers to operate. * * @param level - Capability level * @returns Minimum runtime tier required */ export declare function capabilityLevelToMinRuntimeTier(level: CapabilityLevel): RuntimeTier; /** * A bidirectional mapping between two types. */ export interface BidirectionalMap { forward: (a: A) => B; reverse: (b: B) => A; forwardMap: Readonly>; reverseMap: Readonly>; } /** * Creates a bidirectional mapping. * * @param mapping - Object mapping A values to B values * @returns Bidirectional map with forward and reverse functions */ export declare function createBidirectionalMap(mapping: Record): BidirectionalMap; /** * Pre-built bidirectional map for domain <-> namespace. */ export declare const domainNamespaceMap: BidirectionalMap; /** * Pre-built bidirectional map for certification <-> runtime tier. */ export declare const certificationRuntimeMap: BidirectionalMap; /** * Zod schema for tier mapping result. */ export declare const tierMappingResultSchema: z.ZodObject<{ certificationTier: z.ZodNativeEnum; runtimeTier: z.ZodNativeEnum; }, "strip", z.ZodTypeAny, { certificationTier: CertificationTier; runtimeTier: RuntimeTier; }, { certificationTier: CertificationTier; runtimeTier: RuntimeTier; }>; /** * Zod schema for domain mapping result. */ export declare const domainMappingResultSchema: z.ZodObject<{ domain: z.ZodEnum<["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]>; namespace: z.ZodEnum<["administration", "business", "communications", "cross-domain", "data", "external", "finance", "governance", "healthcare", "infrastructure", "judicial", "knowledge", "logistics", "manufacturing", "nlp", "operations", "people", "quality", "research", "reserved", "security", "training", "utilities", "verification", "web", "yield"]>; }, "strip", z.ZodTypeAny, { domain: "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z"; namespace: "governance" | "security" | "training" | "external" | "research" | "operations" | "data" | "business" | "administration" | "communications" | "finance" | "healthcare" | "infrastructure" | "judicial" | "knowledge" | "logistics" | "manufacturing" | "nlp" | "people" | "quality" | "utilities" | "verification" | "web" | "cross-domain" | "yield" | "reserved"; }, { domain: "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z"; namespace: "governance" | "security" | "training" | "external" | "research" | "operations" | "data" | "business" | "administration" | "communications" | "finance" | "healthcare" | "infrastructure" | "judicial" | "knowledge" | "logistics" | "manufacturing" | "nlp" | "people" | "quality" | "utilities" | "verification" | "web" | "cross-domain" | "yield" | "reserved"; }>; /** * Type guard for VorionNamespace. */ export declare function isVorionNamespace(value: unknown): value is VorionNamespace; /** * Type guard for TrustBand. */ export declare function isTrustBand(value: unknown): value is TrustBand;