UNPKG

mcard-js

Version:

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

201 lines 6.27 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 var DOTSRole; (function (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 */ DOTSRole["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 */ DOTSRole["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 */ DOTSRole["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)} */ DOTSRole["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) */ DOTSRole["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). */ DOTSRole["TARGET"] = "Target"; /** * TIGHT - Vertical composition direction (strict) * * Prerequisites chains. Cannot skip foundational concepts. * Ensures type safety across compositions. * * Vertical = mandatory sequential dependency */ DOTSRole["TIGHT"] = "Tight"; /** * LOOSE - Horizontal composition direction (flexible) * * Same concept via different interaction patterns. * Enables behavioral flexibility while preserving semantics. * * Horizontal = parallel/interchangeable alternatives */ DOTSRole["LOOSE"] = "Loose"; /** * UNIT - Identity object for parallel composition * * Empty MCard / Root Namespace. The neutral element. * For any system S: Unit ⊗ S ≅ S */ DOTSRole["UNIT"] = "Unit"; })(DOTSRole || (DOTSRole = {})); /** * EOS (Experimental-Operational Symmetry) Role * * Each MVP Card type enforces a specific dimension of symmetry * to ensure environment-invariant correctness. */ export var EOSRole; (function (EOSRole) { /** * INVARIANT_CONTENT - The Galois Root * * MCard: Hash(Content) is a pure function. * Same content in Dev = Same hash in Prod. * Environment-invariant identity. */ EOSRole["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. */ EOSRole["GENERATIVE_LENS"] = "GenerativeLens"; /** * SOVEREIGN_DECISION - Controlled Symmetry Breaking 2 * * VCard: The Gap Junction. * Breaks symmetry by introducing Authority. * Decisional reality creation. */ EOSRole["SOVEREIGN_DECISION"] = "SovereignDecision"; })(EOSRole || (EOSRole = {})); /** * Card Plane in the MVP Cards architecture * * Maps to SDN (Software-Defined Networking) plane separation: * Data Plane → Control Plane → Application Plane */ export var CardPlane; (function (CardPlane) { /** * DATA_PLANE - MCard * * Immutable, content-addressable storage. * The monadic foundation that wraps effects. * CRD-only operations (Create, Retrieve, Delete). */ CardPlane["DATA"] = "Data"; /** * CONTROL_PLANE - PCard * * Polynomial functor composition. * Monadic execution via PTR. * Policy and logic gating. */ CardPlane["CONTROL"] = "Control"; /** * APPLICATION_PLANE - VCard * * Value exchange and authentication. * Side effect management (IO Monad). * Sovereign memory and authorization. */ CardPlane["APPLICATION"] = "Application"; })(CardPlane || (CardPlane = {})); /** * Create DOTS metadata for an MCard */ export function createMCardDOTSMetadata(tightRefs = [], looseRefs = []) { return { role: DOTSRole.CARRIER, eosRole: EOSRole.INVARIANT_CONTENT, plane: CardPlane.DATA, tightRefs, looseRefs }; } /** * Create DOTS metadata for a PCard (CLM) */ export function createPCardDOTSMetadata(isLens, tightRefs = [], looseRefs = []) { return { role: isLens ? DOTSRole.LENS : DOTSRole.CHART, eosRole: EOSRole.GENERATIVE_LENS, plane: CardPlane.CONTROL, tightRefs, looseRefs }; } /** * Create DOTS metadata for a VCard */ export function createVCardDOTSMetadata() { return { role: DOTSRole.ARENA, eosRole: EOSRole.SOVEREIGN_DECISION, plane: CardPlane.APPLICATION }; } //# sourceMappingURL=dots.js.map