UNPKG

mcard-js

Version:

MCard - Content-addressable storage with cryptographic hashing, handle resolution, and vector search for Node.js and browsers

206 lines 6.54 kB
/** * DOTS Vocabulary Types * * From the Double Operadic Theory of Systems (DOTS), this module provides * a minimal, domain-independent vocabulary for describing compositional systems. * * The MVP Cards architecture maps directly to DOTS: * - MCard → Carrier (the actual data/systems) * - PCard → Lens (tight) + Chart (loose) * - VCard → Arena + Action * * Reference: docs/WorkingNotes/Hub/Theory/Integration/DOTS Vocabulary as Efficient Representation for ABC Curriculum.md */ /** * DOTS Role enumeration * * These nine terms (seven structural + Action + Unit) form a complete, * compositional language for describing any system, interface, or interaction. */ export declare enum DOTSRole { /** * CARRIER - Category Car(S) of all actual data/systems * * MCard is the Carrier. Each MCard is an Object in the Carrier category; * each hash-link is a Morphism in Car(S). * * Polynomial Form: Objects = MCards, Morphisms = hash references */ CARRIER = "Carrier", /** * LENS - Tight morphism (structure-preserving interface map) * * PCard's abstract_spec ↔ concrete_impl relationship is a Lens. * Ensures type safety: Abstract types match Concrete types. * * Lens = (get, put) pair with coherence laws */ LENS = "Lens", /** * CHART - Loose morphism (behavioral interaction pattern) * * PCard's balanced_expectations (tests) describe the wiring. * Enables flexibility: same Abstract spec via different Concrete implementations. * * Chart = horizontal morphism in Target double category */ CHART = "Chart", /** * ARENA - Interface type (what can interact) * * VCard is the Arena. It defines the subject_did, capabilities[], * and ExternalRef[]. An Arena is a pair of sets (Inputs, Outputs). * * Arena = (I, O) → Polynomial functor P(X) = Σ_{i∈I} X^{O(i)} */ ARENA = "Arena", /** * ACTION - Module structure where interactions act on systems * * VCard enables Action: interactions (Charts/PCards) act on * systems (MCards/Carrier) to produce new systems. * The VCard authorization gate is the mechanism of this action. * * Action = Loose(I) ⊛ Car(S) → Car(S) */ ACTION = "Action", /** * TARGET - Double category I of all interfaces and interactions * * The CLM design space. Contains all possible Arenas (objects), * Lenses (tight morphisms), and Charts (loose morphisms). */ TARGET = "Target", /** * TIGHT - Vertical composition direction (strict) * * Prerequisites chains. Cannot skip foundational concepts. * Ensures type safety across compositions. * * Vertical = mandatory sequential dependency */ TIGHT = "Tight", /** * LOOSE - Horizontal composition direction (flexible) * * Same concept via different interaction patterns. * Enables behavioral flexibility while preserving semantics. * * Horizontal = parallel/interchangeable alternatives */ LOOSE = "Loose", /** * UNIT - Identity object for parallel composition * * Empty MCard / Root Namespace. The neutral element. * For any system S: Unit ⊗ S ≅ S */ UNIT = "Unit" } /** * EOS (Experimental-Operational Symmetry) Role * * Each MVP Card type enforces a specific dimension of symmetry * to ensure environment-invariant correctness. */ export declare enum EOSRole { /** * INVARIANT_CONTENT - The Galois Root * * MCard: Hash(Content) is a pure function. * Same content in Dev = Same hash in Prod. * Environment-invariant identity. */ INVARIANT_CONTENT = "InvariantContent", /** * GENERATIVE_LENS - Controlled Symmetry Breaking 1 * * PCard: Pure function f(x)=y. * Invariant in definition, variant only in input. * The logic is environment-invariant. */ GENERATIVE_LENS = "GenerativeLens", /** * SOVEREIGN_DECISION - Controlled Symmetry Breaking 2 * * VCard: The Gap Junction. * Breaks symmetry by introducing Authority. * Decisional reality creation. */ SOVEREIGN_DECISION = "SovereignDecision" } /** * Card Plane in the MVP Cards architecture * * Maps to SDN (Software-Defined Networking) plane separation: * Data Plane → Control Plane → Application Plane */ export declare enum CardPlane { /** * DATA_PLANE - MCard * * Immutable, content-addressable storage. * The monadic foundation that wraps effects. * CRD-only operations (Create, Retrieve, Delete). */ DATA = "Data", /** * CONTROL_PLANE - PCard * * Polynomial functor composition. * Monadic execution via PTR. * Policy and logic gating. */ CONTROL = "Control", /** * APPLICATION_PLANE - VCard * * Value exchange and authentication. * Side effect management (IO Monad). * Sovereign memory and authorization. */ APPLICATION = "Application" } /** * Polynomial Functor Type * * The mathematical foundation for DOTS. * Every DOTS component is a polynomial functor of the form: * P(X) = Σ_{i∈I} X^{O(i)} */ export interface PolynomialFunctor { /** Positions (I) - input types, system states */ positions: string[]; /** Directions O(i) - output types per position */ directions: Record<string, string[]>; } /** * DOTS metadata that can be attached to any card type */ export interface DOTSMetadata { /** Primary DOTS role (Carrier, Lens, Chart, Arena, Action) */ role: DOTSRole; /** EOS symmetry role */ eosRole?: EOSRole; /** Card plane (Data, Control, Application) */ plane: CardPlane; /** Polynomial functor representation (optional) */ polynomial?: PolynomialFunctor; /** Tight morphism references (prerequisite hashes) */ tightRefs?: string[]; /** Loose morphism references (alternative implementation hashes) */ looseRefs?: string[]; } /** * Create DOTS metadata for an MCard */ export declare function createMCardDOTSMetadata(tightRefs?: string[], looseRefs?: string[]): DOTSMetadata; /** * Create DOTS metadata for a PCard (CLM) */ export declare function createPCardDOTSMetadata(isLens: boolean, tightRefs?: string[], looseRefs?: string[]): DOTSMetadata; /** * Create DOTS metadata for a VCard */ export declare function createVCardDOTSMetadata(): DOTSMetadata; //# sourceMappingURL=dots.d.ts.map