@terminals-tech/sdk 1.0.0-rc.1 → 1.0.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.
Files changed (82) hide show
  1. package/README.md +15 -19
  2. package/dist/WebContainerManager-4LIOGRVM.js +22 -0
  3. package/dist/browser-http-client-ZQLDWZMU.js +317 -0
  4. package/dist/cache-VKYSQRXX.js +45 -0
  5. package/dist/capabilities-MIPUMBLL.js +96 -0
  6. package/dist/chunk-2ESYSVXG.js +48 -0
  7. package/dist/chunk-2WTYE4SW.js +190 -0
  8. package/dist/chunk-3LFMIVJM.js +40 -0
  9. package/dist/chunk-ABCK4FWN.js +136 -0
  10. package/dist/chunk-AFDUOYHD.js +2060 -0
  11. package/dist/chunk-BCOQMFKT.js +265 -0
  12. package/dist/chunk-BYXBJQAS.js +0 -0
  13. package/dist/chunk-DKFJIILR.js +9798 -0
  14. package/dist/chunk-EXI3LJVJ.js +51 -0
  15. package/dist/chunk-FOXUEYWK.js +42 -0
  16. package/dist/chunk-GJWAJAX3.js +173 -0
  17. package/dist/chunk-H3POJCFA.js +333 -0
  18. package/dist/chunk-KASHT6C5.js +784 -0
  19. package/dist/chunk-KHR7ZYCX.js +4034 -0
  20. package/dist/chunk-L45BSQDJ.js +296 -0
  21. package/dist/chunk-LLGZTP3G.js +5521 -0
  22. package/dist/chunk-NTMBOESX.js +152 -0
  23. package/dist/chunk-OCLSAUCD.js +474 -0
  24. package/dist/chunk-OSSRZOGC.js +190 -0
  25. package/dist/chunk-PPFTKJDB.js +497 -0
  26. package/dist/chunk-PWAHFID5.js +381 -0
  27. package/dist/chunk-Q2VI6ICE.js +188 -0
  28. package/dist/chunk-QJFKEQHF.js +6460 -0
  29. package/dist/chunk-QWXPVB2L.js +320 -0
  30. package/dist/chunk-QWZRZKLZ.js +896 -0
  31. package/dist/chunk-STMI72WH.js +1005 -0
  32. package/dist/chunk-TSQ3BGLA.js +11945 -0
  33. package/dist/chunk-UJDUQNE2.js +79 -0
  34. package/dist/chunk-VZA2NUH3.js +118 -0
  35. package/dist/chunk-WGBCRNMB.js +1817 -0
  36. package/dist/chunk-WU4OTGJE.js +752 -0
  37. package/dist/chunk-XPJ63Y6T.js +70 -0
  38. package/dist/chunk-Y2EULKA2.js +172 -0
  39. package/dist/chunk-YJEZWCYV.js +94 -0
  40. package/dist/chunk-ZVO47SQV.js +150 -0
  41. package/dist/container-lite-QD3CRLS4.js +327 -0
  42. package/dist/core-H2UUDATO.js +146 -0
  43. package/dist/crypto-D4LMI2RN.js +45 -0
  44. package/dist/db-BWC2GGBN.js +50 -0
  45. package/dist/demo-T655Z5S4.js +87 -0
  46. package/dist/diagnostics-6RQTBR6I.js +113 -0
  47. package/dist/dist-OPDCWARF.js +727 -0
  48. package/dist/dist-VXJEKX3T.js +2441 -0
  49. package/dist/dist-VYGJXGUS.js +1008 -0
  50. package/dist/embeddings-7QXTXUMC.js +15 -0
  51. package/dist/embeddings-MAEWWUHW.js +9 -0
  52. package/dist/graph-RKMNE2X5.js +36 -0
  53. package/dist/hvm-CBEP3M4F.js +126 -0
  54. package/dist/index.cjs +49874 -8001
  55. package/dist/index.d.cts +1629 -1363
  56. package/dist/index.d.ts +1629 -1363
  57. package/dist/index.js +2462 -8130
  58. package/dist/mcp-NK34ZNM5.js +101 -0
  59. package/dist/mcp-client-service-browser-SGB2K3VZ.js +14 -0
  60. package/dist/neuro-state-XHRGIRVO.js +498 -0
  61. package/dist/nodes-K6GKI2FM.js +364 -0
  62. package/dist/package-EXUIU2RL.js +93 -0
  63. package/dist/package-VGL7HYTO.js +106 -0
  64. package/dist/package-XHMLOAQ4.js +98 -0
  65. package/dist/pg-events-QJAM2HIP.js +15 -0
  66. package/dist/pglite-adapter-43IOUBMV.js +50 -0
  67. package/dist/pgliteService-IUGNNOVU.js +258 -0
  68. package/dist/policy-IRJCM6FS.js +13 -0
  69. package/dist/registry-5WTDYQVQ.js +26 -0
  70. package/dist/registry-FW63E7FE.js +16 -0
  71. package/dist/registry-ZQ2IBLF6.js +9 -0
  72. package/dist/resolver-ALOJSOK5.js +24 -0
  73. package/dist/scheduler-B5CEYKWT.js +127 -0
  74. package/dist/secret-store-H7273UIT.js +18 -0
  75. package/dist/server-VW6DYDLH.js +18 -0
  76. package/dist/skills-VN7IN7SJ.js +6375 -0
  77. package/dist/stack-4KWCQQP7.js +103 -0
  78. package/dist/storage-L7MWNSPG.js +13 -0
  79. package/dist/supabaseService-6AYP2VY3.js +476 -0
  80. package/dist/topology-CIWWNVAN.js +13 -0
  81. package/dist/webcontainer-XWCE56F3.js +281 -0
  82. package/package.json +9 -3
package/dist/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { JSONSchema7 } from 'json-schema';
2
+ import { Observable } from 'rxjs';
2
3
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
3
4
  import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
4
5
 
@@ -549,6 +550,19 @@ interface CoherenceMetrics$1 {
549
550
  timestamp: number;
550
551
  }
551
552
 
553
+ /**
554
+ * Brain Coherence Module
555
+ * Metrics for measuring cognitive coherence in agent outputs
556
+ *
557
+ * Based on NEURO coherence patterns:
558
+ * - Grounding: Connection to factual/contextual reality
559
+ * - Internal: Self-consistency of reasoning
560
+ * - Crystallization: Clarity and actionability of output
561
+ *
562
+ * Heuristic primitives are composed from L1 (core/primitives/coherence-heuristics).
563
+ * This module adds weights, configuration, explanations, and audio mapping.
564
+ */
565
+
552
566
  type CoherenceMetrics = CoherenceMetrics$1;
553
567
  /**
554
568
  * Enhanced coherence result with human-readable explanations
@@ -913,7 +927,7 @@ declare function createDAG<N, E = void>(nodes: DAGNode<N>[], edges: DAGEdge<E>[]
913
927
  * @module sdk-types
914
928
  */
915
929
 
916
- interface NodePolicy$1 {
930
+ interface NodePolicy {
917
931
  fs?: {
918
932
  mode?: "sandboxed" | "full";
919
933
  allowedPaths?: string[];
@@ -923,7 +937,7 @@ interface NodePolicy$1 {
923
937
  allowList?: string[];
924
938
  };
925
939
  }
926
- interface StackPolicies$1 {
940
+ interface StackPolicies {
927
941
  fs?: {
928
942
  mode?: "sandboxed" | "full";
929
943
  allowedPaths?: string[];
@@ -1015,7 +1029,7 @@ declare function kuramotoStep(phases: ArrayLike<number>, omega: ArrayLike<number
1015
1029
  /**
1016
1030
  * Signal types for cross-layer communication
1017
1031
  */
1018
- type SignalType = "health_update" | "circuit_change" | "convergence_update" | "coherence_update" | "resonance_update" | "tensor_state_update" | "task_complete" | "task_failed" | "adaptation_required" | "backpressure_warning" | "audio_metrics_update" | "mesh_update" | "mesh_query" | "session_state_change" | "skill_capture_started" | "skill_action_recorded" | "skill_capture_completed" | "skill_crystallized" | "skill_training_started" | "skill_training_completed" | "skill_artifact_activated" | "skill_suggested" | "skill_executed" | "skill_peer_review" | "skill_delegation" | "skill_agent_refine" | "skill_selection" | "skill_backpressure" | "skill_budget_exceeded" | "skill_error" | "interaction_created" | "interaction_status_changed" | "deploy_scaffold" | "deploy_push" | "deploy_build" | "deploy_status" | "deploy_preview" | "deploy_live" | "deploy_error" | "potentiation_rising" | "potentiation_peak" | "potentiation_discharge" | "potentiation_reset" | "action_dispatched" | "action_executed" | "action_failed" | "combo_completed" | "input_surface_changed" | "forge_scene_saved" | "forge_iteration_recorded" | "forge_profile_crystallized" | "forge_profile_requested" | "integration_connected" | "integration_disconnected" | "integration_heartbeat" | "integration_error" | "ui_navigation" | "ui_surface_opened" | "ui_surface_closed" | "ui_interaction" | "ui_error_shown" | "ui_search" | "artifact_preview" | "manifold_node_added" | "manifold_edge_added" | "manifold_query" | "manifold_snapshot" | "connector_status_changed" | "connector_sync_started" | "connector_sync_complete" | "connector_sync_error" | "connector_document_indexed" | "graph_entity_upserted" | "graph_relationship_added" | "graph_traversal_complete" | "intent_signal_emitted" | "oscillator_phase_updated" | "oscillator_suggestion_generated" | "journey_note_created" | "journey_note_deleted" | "journey_edge_created" | "journey_cluster_created" | "journey_replay_entered" | "journey_replay_exited" | "journey_spatial_navigate" | "journey_completed" | "boundary_crossed" | "boundary_sealed" | "convergence_declared" | "convergence_lost" | "crystallization_declared" | "crystallization_melted" | "chat_message_sent" | "chat_message_received" | "chat_error" | "coherence_gate_accepted" | "coherence_gate_rejected" | "manifold_geodesic_computed" | "manifold_distance_measured" | "sematon_created" | "sematon_witnessed" | "sematon_folded" | "sematon_realized" | "sematon_expired";
1032
+ type SignalType = "health_update" | "circuit_change" | "convergence_update" | "coherence_update" | "resonance_update" | "tensor_state_update" | "task_complete" | "task_failed" | "adaptation_required" | "backpressure_warning" | "audio_metrics_update" | "mesh_update" | "mesh_query" | "session_state_change" | "skill_capture_started" | "skill_action_recorded" | "skill_capture_completed" | "skill_crystallized" | "skill_training_started" | "skill_training_completed" | "skill_artifact_activated" | "skill_suggested" | "skill_executed" | "skill_peer_review" | "skill_delegation" | "skill_agent_refine" | "skill_selection" | "skill_backpressure" | "skill_budget_exceeded" | "skill_error" | "interaction_created" | "interaction_status_changed" | "deploy_scaffold" | "deploy_push" | "deploy_build" | "deploy_status" | "deploy_preview" | "deploy_live" | "deploy_error" | "potentiation_rising" | "potentiation_peak" | "potentiation_discharge" | "potentiation_reset" | "action_dispatched" | "action_executed" | "action_failed" | "combo_completed" | "input_surface_changed" | "forge_scene_saved" | "forge_iteration_recorded" | "forge_profile_crystallized" | "forge_profile_requested" | "integration_connected" | "integration_disconnected" | "integration_heartbeat" | "integration_error" | "ui_navigation" | "ui_surface_opened" | "ui_surface_closed" | "ui_interaction" | "ui_error_shown" | "ui_search" | "artifact_preview" | "manifold_node_added" | "manifold_edge_added" | "manifold_query" | "manifold_snapshot" | "connector_status_changed" | "connector_sync_started" | "connector_sync_complete" | "connector_sync_error" | "connector_document_indexed" | "graph_entity_upserted" | "graph_relationship_added" | "graph_traversal_complete" | "intent_signal_emitted" | "oscillator_phase_updated" | "oscillator_suggestion_generated" | "journey_note_created" | "journey_note_deleted" | "journey_edge_created" | "journey_cluster_created" | "journey_replay_entered" | "journey_replay_exited" | "journey_spatial_navigate" | "journey_completed" | "boundary_crossed" | "boundary_sealed" | "convergence_declared" | "convergence_lost" | "crystallization_declared" | "crystallization_melted" | "chat_message_sent" | "chat_message_received" | "chat_error" | "coherence_gate_accepted" | "coherence_gate_rejected" | "manifold_geodesic_computed" | "manifold_distance_measured" | "sematon_created" | "sematon_witnessed" | "sematon_folded" | "sematon_realized" | "sematon_expired" | "voice_identity_encoded" | "voice_speaking_started" | "voice_speaking_completed" | "voice_chunk_scheduled" | "voice_coherence_mapped";
1019
1033
  /**
1020
1034
  * Layer-aware signal for AXON cross-layer communication
1021
1035
  */
@@ -1473,1595 +1487,1847 @@ declare function createCircuitBreaker(options: CircuitBreakerOptions): {
1473
1487
  reset(): void;
1474
1488
  };
1475
1489
 
1476
- type NodePolicy = NodePolicy$1;
1477
- type StackPolicies = StackPolicies$1;
1478
1490
  /**
1479
- * Runtime tier for node execution.
1491
+ * Core SDK Fundamental utilities and data structures
1480
1492
  *
1481
- * Defines the execution environment for computational nodes:
1482
- * - `worker`: Web Worker/service worker
1483
- * - `container-lite`: Lightweight containerized runtime
1484
- * - `webcontainer`: Browser-based container (WebAssembly)
1485
- * - `edge`: Edge function/serverless
1486
- * - `wasm-hvm`: WebAssembly with HVM (Higher-order Virtual Machine)
1487
- * - `stack`: Nested stack execution
1493
+ * Result types, retry/circuit-breaker, event bus, validation, DAG, registry.
1494
+ * Hides internal combinators, vector ops, stream internals.
1488
1495
  *
1489
- * @example
1490
- * const tier: RuntimeTier = "worker";
1496
+ * @copyright © 2026 Intuition Labs LLC. All rights reserved. Patent Pending.
1497
+ * @module sdk/core
1491
1498
  */
1492
- type RuntimeTier = "worker" | "container-lite" | "webcontainer" | "edge" | "wasm-hvm" | "stack";
1499
+
1500
+ type core_CircuitBreakerOptions = CircuitBreakerOptions;
1501
+ type core_DAG<N, E = void> = DAG<N, E>;
1502
+ type core_DAGEdge<E = void> = DAGEdge<E>;
1503
+ type core_DAGNode<T> = DAGNode<T>;
1504
+ type core_EventHandler<T> = EventHandler<T>;
1505
+ type core_Registry<K, V> = Registry<K, V>;
1506
+ type core_RetryOptions = RetryOptions;
1507
+ type core_SDKResult<T, E = Error> = SDKResult<T, E>;
1508
+ type core_StoreError = StoreError;
1509
+ type core_TypedEventBus<Events extends Record<string, unknown>> = TypedEventBus<Events>;
1510
+ type core_Untrusted<T> = Untrusted<T>;
1511
+ type core_Validated<T> = Validated<T>;
1512
+ declare const core_createCircuitBreaker: typeof createCircuitBreaker;
1513
+ declare const core_createDAG: typeof createDAG;
1514
+ declare const core_createEventBus: typeof createEventBus;
1515
+ declare const core_createRegistry: typeof createRegistry;
1516
+ declare const core_err: typeof err;
1517
+ declare const core_isErr: typeof isErr;
1518
+ declare const core_isOk: typeof isOk;
1519
+ declare const core_ok: typeof ok;
1520
+ declare const core_secureValidate: typeof secureValidate;
1521
+ declare const core_unbrand: typeof unbrand;
1522
+ declare const core_untrusted: typeof untrusted;
1523
+ declare const core_validateWithSchema: typeof validateWithSchema;
1524
+ declare const core_validated: typeof validated;
1525
+ declare const core_withRetry: typeof withRetry;
1526
+ declare namespace core {
1527
+ export { type core_CircuitBreakerOptions as CircuitBreakerOptions, type core_DAG as DAG, type core_DAGEdge as DAGEdge, type core_DAGNode as DAGNode, type core_EventHandler as EventHandler, type core_Registry as Registry, type core_RetryOptions as RetryOptions, type core_SDKResult as SDKResult, type core_StoreError as StoreError, type core_TypedEventBus as TypedEventBus, type core_Untrusted as Untrusted, type core_Validated as Validated, core_createCircuitBreaker as createCircuitBreaker, core_createDAG as createDAG, core_createEventBus as createEventBus, core_createRegistry as createRegistry, core_err as err, flatMap as flatMapResult, core_isErr as isErr, core_isOk as isOk, map as mapResult, core_ok as ok, core_secureValidate as secureValidate, core_unbrand as unbrand, core_untrusted as untrusted, core_validateWithSchema as validateWithSchema, core_validated as validated, core_withRetry as withRetry };
1528
+ }
1529
+
1493
1530
  /**
1494
- * Secret reference for node execution.
1531
+ * L0 Category Theory Primitives
1495
1532
  *
1496
- * Links a secret from the vault into node environment.
1533
+ * Foundational categorical abstractions for cross-layer type mappings.
1534
+ * Provides the mathematical foundation for isomorphisms between AXON layers.
1497
1535
  *
1498
- * @example
1499
- * const secret: NodeSecretRef = {
1500
- * name: "api_key",
1501
- * scope: "stack",
1502
- * env: "OPENAI_API_KEY",
1503
- * required: true
1504
- * };
1536
+ * @license BUSL-1.1
1537
+ * @copyright © 2026 Intuition Labs LLC. All rights reserved. Patent Pending.
1538
+ * @module core/L0/category
1505
1539
  */
1506
- interface NodeSecretRef {
1507
- /** Secret identifier in vault */
1508
- name: string;
1509
- /** Resolution scope: node-local or stack-wide */
1510
- scope: "node" | "stack";
1511
- /** Environment variable name (defaults to name if omitted) */
1512
- env?: string;
1513
- /** Whether secret must exist (default: false) */
1514
- required?: boolean;
1540
+ /**
1541
+ * A morphism is a structure-preserving transformation between types.
1542
+ * This is the fundamental building block of category theory.
1543
+ */
1544
+ type Morphism<A, B> = (a: A) => B;
1545
+ /**
1546
+ * Async morphism for transformations that may be asynchronous
1547
+ */
1548
+ type AsyncMorphism<A, B> = (a: A) => Promise<B>;
1549
+ /**
1550
+ * A Category consists of objects and morphisms between them,
1551
+ * with composition and identity laws.
1552
+ */
1553
+ interface Category<Obj, Hom> {
1554
+ /** Identity morphism for each object */
1555
+ identity<A extends Obj>(a: A): Hom;
1556
+ /** Composition of morphisms: g . f = g(f(x)) */
1557
+ compose<A extends Obj, B extends Obj, C extends Obj>(f: Hom, g: Hom): Hom;
1515
1558
  }
1516
1559
  /**
1517
- * Runtime-specific entrypoints for node execution.
1518
- *
1519
- * Each runtime tier has its own entrypoint format.
1520
- * At least one entrypoint must be specified.
1521
- *
1522
- * @example
1523
- * const entrypoints: NodeEntrypoints = {
1524
- * worker: { module: "./transform.js", export: "transform" },
1525
- * edge: { endpoint: "https://api.example.com/process" }
1526
- * };
1560
+ * An isomorphism is a bijective morphism with an inverse.
1561
+ * For A and B to be isomorphic, there must exist:
1562
+ * - forward: A B
1563
+ * - backward: B A
1564
+ * - such that: backward(forward(a)) = a AND forward(backward(b)) = b
1527
1565
  */
1528
- interface NodeEntrypoints {
1529
- /** Web Worker entrypoint */
1530
- worker?: {
1531
- module: string;
1532
- export?: string;
1533
- };
1534
- /** Container-lite entrypoint */
1535
- "container-lite"?: {
1536
- command: string;
1537
- args?: string[];
1538
- cwd?: string;
1539
- };
1540
- /** WebContainer entrypoint */
1541
- webcontainer?: {
1542
- command: string;
1543
- args?: string[];
1544
- cwd?: string;
1545
- };
1546
- /** WASM HVM entrypoint */
1547
- "wasm-hvm"?: {
1548
- module: string;
1549
- function?: string;
1550
- };
1551
- /** Edge function entrypoint */
1552
- edge?: {
1553
- endpoint: string;
1554
- };
1566
+ interface Iso<A, B> {
1567
+ /** Forward transformation: A → B */
1568
+ forward: Morphism<A, B>;
1569
+ /** Backward transformation: B → A */
1570
+ backward: Morphism<B, A>;
1571
+ /** Optional metadata about the isomorphism */
1572
+ meta?: IsoMeta;
1555
1573
  }
1556
1574
  /**
1557
- * Base manifest fields shared by nodes and stacks.
1558
- *
1559
- * @internal
1575
+ * Metadata about an isomorphism
1560
1576
  */
1561
- interface BaseManifestV0 {
1562
- /** Unique identifier (must be stable across versions) */
1563
- id: string;
1564
- /** Semantic version (e.g., "1.0.0") */
1565
- version: string;
1577
+ interface IsoMeta {
1566
1578
  /** Human-readable name */
1567
1579
  name?: string;
1568
- /** Description of functionality */
1580
+ /** Description of what this iso does */
1569
1581
  description?: string;
1570
- /** Security and resource policies */
1571
- policies?: NodePolicy | StackPolicies;
1572
- /** Arbitrary metadata for extensions */
1573
- metadata?: Record<string, unknown>;
1582
+ /** Whether this is an exact isomorphism (no information loss) */
1583
+ exact?: boolean;
1584
+ /** Confidence score for derived isomorphisms (0-1) */
1585
+ confidence?: number;
1586
+ /** Source layer (L1-L5) */
1587
+ sourceLayer?: LayerId;
1588
+ /** Target layer (L1-L5) */
1589
+ targetLayer?: LayerId;
1574
1590
  }
1575
1591
  /**
1576
- * Node manifest for DAG orchestrator.
1577
- *
1578
- * Defines a single computational node in a workflow.
1579
- * Nodes are atomic execution units with typed inputs/outputs.
1580
- *
1581
- * @example
1582
- * const node: NodeManifestV0 = {
1583
- * id: "llm-transform",
1584
- * version: "1.0.0",
1585
- * kind: "transform",
1586
- * runtimes: ["worker", "edge"],
1587
- * entrypoints: {
1588
- * worker: { module: "./llm.js", export: "transform" }
1589
- * },
1590
- * inputsSchema: {
1591
- * type: "object",
1592
- * properties: {
1593
- * prompt: { type: "string" }
1594
- * },
1595
- * required: ["prompt"]
1596
- * },
1597
- * outputsSchema: {
1598
- * type: "object",
1599
- * properties: {
1600
- * text: { type: "string" }
1601
- * }
1602
- * }
1603
- * };
1592
+ * Async isomorphism for transformations that may be asynchronous
1604
1593
  */
1605
- interface NodeManifestV0 extends BaseManifestV0 {
1606
- /** Node type classification */
1607
- kind: "prompt" | "mcp" | "task" | "transform" | "webhook" | "custom";
1608
- /** UI label override */
1609
- label?: string;
1610
- /** Supported runtime tiers (in priority order) */
1611
- runtimes: RuntimeTier[];
1612
- /** Runtime-specific execution entrypoints */
1613
- entrypoints: NodeEntrypoints;
1614
- /** JSON Schema for input validation */
1615
- inputsSchema?: JSONSchema7;
1616
- /** JSON Schema for output validation */
1617
- outputsSchema?: JSONSchema7;
1618
- /** Declared capabilities (e.g., "network", "filesystem") */
1619
- capabilities?: string[];
1620
- /** Secret references required by this node */
1621
- secrets?: NodeSecretRef[];
1622
- /** Lifecycle hooks for instrumentation */
1623
- hooks?: {
1624
- explain?: string;
1625
- debug?: string;
1626
- askInput?: string;
1627
- };
1628
- /** UI configuration */
1629
- ui?: {
1630
- /** Node-specific UI config */
1631
- config?: unknown;
1632
- /** Output viewer configuration */
1633
- viewer?: {
1634
- kind?: "text" | "table" | "json" | "custom";
1635
- componentId?: string;
1636
- };
1637
- };
1638
- /** MCP server integration */
1639
- mcp?: {
1640
- /** MCP server identifier */
1641
- server?: string;
1642
- /** Exposed MCP tools */
1643
- tools?: Array<{
1644
- name: string;
1645
- schema?: JSONSchema7;
1646
- }>;
1647
- };
1648
- /** Observability configuration */
1649
- observability?: {
1650
- /** Emit execution logs */
1651
- emitLogs?: boolean;
1652
- /** Emit output artifacts */
1653
- emitArtifacts?: boolean;
1654
- /** Trace attribute keys to capture */
1655
- traceAttributes?: string[];
1656
- };
1594
+ interface AsyncIso<A, B> {
1595
+ forward: AsyncMorphism<A, B>;
1596
+ backward: AsyncMorphism<B, A>;
1597
+ meta?: IsoMeta;
1657
1598
  }
1658
1599
  /**
1659
- * Stack-level secret scope definition.
1660
- *
1661
- * Defines which nodes can access a secret.
1662
- *
1663
- * @example
1664
- * const secretScope: StackSecretScope = {
1665
- * scope: ["fetch-node", "transform-node"],
1666
- * required: true
1667
- * };
1600
+ * An embedding is a one-way structure-preserving transformation.
1601
+ * Unlike isomorphisms, embeddings may not have a full inverse.
1602
+ * The partial inverse extracts as much as possible from the target type.
1668
1603
  */
1669
- interface StackSecretScope {
1670
- /** Node IDs that can access this secret */
1671
- scope: string[];
1672
- /** Whether secret must exist */
1673
- required?: boolean;
1604
+ interface Embed<A, B> {
1605
+ /** Embed A into B */
1606
+ embed: Morphism<A, B>;
1607
+ /** Partial extraction from B (may lose information) */
1608
+ extract: Morphism<B, Partial<A>>;
1609
+ /** Whether the embedding is lossless */
1610
+ lossless?: boolean;
1674
1611
  }
1675
1612
  /**
1676
- * Stack-level runtime tier configuration.
1677
- *
1678
- * Allows stack-wide defaults with per-node overrides.
1679
- *
1680
- * @example
1681
- * const runtimes: StackRuntimes = {
1682
- * default: ["worker", "edge"],
1683
- * overrides: {
1684
- * "heavy-compute": ["container-lite"]
1685
- * }
1686
- * };
1613
+ * A functor maps objects and morphisms between categories
1614
+ * while preserving identity and composition.
1687
1615
  */
1688
- interface StackRuntimes {
1689
- /** Default runtime tiers for all nodes */
1690
- default?: RuntimeTier[];
1691
- /** Per-node runtime tier overrides (nodeId -> tiers) */
1692
- overrides?: Record<string, RuntimeTier[]>;
1616
+ interface Functor<F> {
1617
+ /** Map a morphism over the functor */
1618
+ map<A, B>(f: Morphism<A, B>): (fa: F) => F;
1693
1619
  }
1694
1620
  /**
1695
- * Node configuration within a stack.
1696
- *
1697
- * References a node manifest and provides instance-specific config.
1698
- *
1699
- * @example
1700
- * const nodeConfig: StackNodeConfig = {
1701
- * id: "fetch-1",
1702
- * nodeRef: "http-fetch",
1703
- * config: { timeout: 5000 },
1704
- * runtimes: ["edge"],
1705
- * secrets: ["api_key"]
1706
- * };
1621
+ * Natural transformation between functors F and G.
1622
+ * For each object A, provides a morphism F(A) → G(A)
1623
+ * such that the naturality square commutes.
1707
1624
  */
1708
- interface StackNodeConfig {
1709
- /** Unique ID within stack */
1710
- id: string;
1711
- /** Reference to NodeManifestV0.id */
1712
- nodeRef: string;
1713
- /** Node-specific configuration */
1714
- config?: Record<string, unknown>;
1715
- /** Runtime tier override */
1716
- runtimes?: RuntimeTier[];
1717
- /** Security policy override */
1718
- policies?: NodePolicy;
1719
- /** Secret names from stack.secrets */
1720
- secrets?: string[];
1721
- }
1625
+ type NaturalTransformation<F, G> = <A>(fa: F) => G;
1722
1626
  /**
1723
- * Directed edge connecting two nodes in the stack DAG.
1724
- *
1725
- * Defines data flow from one node's outputs to another's inputs.
1726
- *
1727
- * @example
1728
- * const edge: StackEdge = {
1729
- * from: "fetch-1",
1730
- * to: "transform-1",
1731
- * map: { "data": "input" }
1732
- * };
1627
+ * AXON Layer identifiers
1733
1628
  */
1734
- interface StackEdge {
1735
- /** Source node ID */
1736
- from: string;
1737
- /** Target node ID */
1738
- to: string;
1739
- /** Output-to-input key mapping (defaults to identity) */
1740
- map?: Record<string, string>;
1741
- }
1629
+ type LayerId = "L0" | "L1" | "L2" | "L3" | "L4" | "L5";
1742
1630
  /**
1743
- * Manifest layer provenance.
1744
- *
1745
- * - `L0`: Landing/Zero layer (low-level primitives)
1746
- * - `L1`: Compose/Platform layer (higher-level abstractions)
1631
+ * Layer metadata
1747
1632
  */
1748
- type ManifestLayer = "L0" | "L1" | "L2" | "L3" | "L4" | "L5";
1749
- /**
1750
- * Stack manifest for DAG orchestrator.
1751
- *
1752
- * Defines a complete workflow as a directed acyclic graph (DAG) of nodes.
1753
- *
1754
- * @example
1755
- * const stack: StackManifestV0 = {
1756
- * id: "data-pipeline",
1757
- * version: "1.0.0",
1758
- * nodes: [
1759
- * { id: "fetch", nodeRef: "http-fetch", config: { url: "..." } },
1760
- * { id: "transform", nodeRef: "llm-transform" }
1761
- * ],
1762
- * edges: [
1763
- * { from: "fetch", to: "transform", map: { data: "input" } }
1764
- * ],
1765
- * secrets: {
1766
- * api_key: { scope: ["fetch"], required: true }
1767
- * }
1768
- * };
1633
+ interface LayerMeta {
1634
+ id: LayerId;
1635
+ name: string;
1636
+ description: string;
1637
+ color: string;
1638
+ }
1639
+ /**
1640
+ * AXON Layer definitions
1769
1641
  */
1770
- interface StackManifestV0 extends BaseManifestV0 {
1771
- /** Node instances in this stack */
1772
- nodes: StackNodeConfig[];
1773
- /** Edges connecting nodes (data flow) */
1774
- edges?: StackEdge[];
1775
- /** Stack-level secret definitions */
1776
- secrets?: Record<string, StackSecretScope>;
1777
- /** Runtime tier configuration */
1778
- runtimes?: StackRuntimes;
1779
- /** Provenance layer (L0 or L1) */
1780
- layer?: ManifestLayer;
1642
+ declare const LAYERS: Record<LayerId, LayerMeta>;
1643
+ /**
1644
+ * Valid layer transitions in the AXON architecture
1645
+ */
1646
+ declare const VALID_TRANSITIONS: ReadonlyArray<[LayerId, LayerId]>;
1647
+ /**
1648
+ * Product type - categorical product of A and B
1649
+ */
1650
+ type Product<A, B> = readonly [A, B];
1651
+ /**
1652
+ * Coproduct (sum) type - categorical coproduct of A and B
1653
+ */
1654
+ type Coproduct<A, B> = {
1655
+ readonly tag: "left";
1656
+ readonly value: A;
1657
+ } | {
1658
+ readonly tag: "right";
1659
+ readonly value: B;
1660
+ };
1661
+ /**
1662
+ * Create a left-tagged coproduct
1663
+ */
1664
+ declare function left<A, B>(value: A): Coproduct<A, B>;
1665
+ /**
1666
+ * Create a right-tagged coproduct
1667
+ */
1668
+ declare function right<A, B>(value: B): Coproduct<A, B>;
1669
+ /**
1670
+ * Fold over a coproduct
1671
+ */
1672
+ declare function fold<A, B, C>(onLeft: Morphism<A, C>, onRight: Morphism<B, C>): Morphism<Coproduct<A, B>, C>;
1673
+ /**
1674
+ * A proof witness type - represents evidence that P holds
1675
+ */
1676
+ type Proof<P> = P extends true ? {
1677
+ readonly _witness: unique symbol;
1678
+ } : never;
1679
+ /**
1680
+ * A verified value with attached proof
1681
+ */
1682
+ interface Verified<T, P> {
1683
+ readonly value: T;
1684
+ readonly proof: Proof<P>;
1685
+ }
1686
+ /**
1687
+ * Compose two morphisms: g . f
1688
+ */
1689
+ declare function compose<A, B, C>(f: Morphism<A, B>, g: Morphism<B, C>): Morphism<A, C>;
1690
+ /**
1691
+ * Compose two async morphisms
1692
+ */
1693
+ declare function composeAsync<A, B, C>(f: AsyncMorphism<A, B>, g: AsyncMorphism<B, C>): Promise<AsyncMorphism<A, C>>;
1694
+ /**
1695
+ * Identity morphism
1696
+ */
1697
+ declare function identity<A>(): Morphism<A, A>;
1698
+ /**
1699
+ * Compose two isomorphisms
1700
+ */
1701
+ declare function composeIso<A, B, C>(iso1: Iso<A, B>, iso2: Iso<B, C>): Iso<A, C>;
1702
+ /**
1703
+ * Invert an isomorphism
1704
+ */
1705
+ declare function invertIso<A, B>(iso: Iso<A, B>): Iso<B, A>;
1706
+ /**
1707
+ * Create an identity isomorphism
1708
+ */
1709
+ declare function identityIso<A>(): Iso<A, A>;
1710
+ /**
1711
+ * A typed bridge between two layers with verified transition
1712
+ */
1713
+ interface LayerBridge<From extends LayerId, To extends LayerId, A, B> {
1714
+ readonly sourceLayer: From;
1715
+ readonly targetLayer: To;
1716
+ readonly iso: Iso<A, B>;
1781
1717
  }
1718
+ /**
1719
+ * Check if a layer transition is valid
1720
+ */
1721
+ declare function isValidTransition(from: LayerId, to: LayerId): boolean;
1722
+ /**
1723
+ * Create a layer bridge (validates transition at runtime)
1724
+ */
1725
+ declare function createBridge<From extends LayerId, To extends LayerId, A, B>(from: From, to: To, iso: Iso<A, B>): LayerBridge<From, To, A, B> | null;
1782
1726
 
1783
1727
  /**
1784
- * Skill Manifest Types (L1)
1728
+ * L0 Information Theory Primitives
1785
1729
  *
1786
- * Core types for the Skills Platform. A SkillManifest extends StackManifestV0
1787
- * with skill-specific metadata a skill IS a stack with agent orchestration.
1730
+ * Provides measures for information preservation, entropy,
1731
+ * and semantic density in cross-layer transformations.
1788
1732
  *
1789
- * @module skills/types
1733
+ * @module core/L0/information
1790
1734
  */
1791
-
1792
- type SkillCategory = "startup" | "legal" | "finance" | "engineering" | "content" | "research" | "operations" | "marketing" | "verification";
1793
- type SkillOutputType = "document" | "website" | "spreadsheet" | "presentation" | "codebase" | "analysis" | "dataset" | "visual" | "video" | "audio" | "composite";
1794
- declare const SKILL_TIERS: readonly ["flagship", "professional", "utility"];
1795
- type SkillTier = (typeof SKILL_TIERS)[number];
1796
- declare const SKILL_RANKS: readonly ["skill", "flow", "fleet", "org", "society"];
1797
- type SkillRank = (typeof SKILL_RANKS)[number];
1798
- /** Effective-dated rank assignment — immutable audit trail */
1799
- interface RankAssignment {
1800
- /** Current rank */
1801
- rank: SkillRank;
1802
- /** ISO 8601 timestamp when this rank became effective */
1803
- effectiveFrom: string;
1804
- /** ISO 8601 timestamp when this rank was superseded (null = current) */
1805
- effectiveTo: string | null;
1806
- /** Evidence that promotion invariants were satisfied */
1807
- proof?: PromotionProof;
1808
- }
1809
1735
  /**
1810
- * Promotion proof the Curry-Howard witness type.
1811
- * Each promotion requires structural evidence that the entity
1812
- * satisfies the invariants of the target rank.
1736
+ * Calculate Shannon entropy for a probability distribution.
1737
+ * H(X) = p(x) log₂ p(x)
1738
+ *
1739
+ * @param probabilities - Array of probabilities (should sum to 1)
1740
+ * @returns Entropy in bits
1813
1741
  */
1814
- interface PromotionProof {
1815
- /** Source rank */
1816
- from: SkillRank;
1817
- /** Target rank */
1818
- to: SkillRank;
1819
- /** Structural invariant checks that passed */
1820
- invariants: PromotionInvariant[];
1821
- /** Timestamp of promotion evaluation */
1822
- evaluatedAt: string;
1823
- /** Quality score at time of promotion (0-1) */
1824
- qualityScore: number;
1825
- }
1826
- interface PromotionInvariant {
1827
- /** Invariant name (e.g., "has_convergence", "has_3_plus_skills", "has_mesh_events") */
1828
- name: string;
1829
- /** Whether this invariant was satisfied */
1830
- satisfied: boolean;
1831
- /** Human-readable evidence */
1832
- evidence?: string;
1833
- }
1834
- interface SkillCapabilities {
1835
- /** Allow image generation via connected media providers */
1836
- allowImageGen?: boolean;
1837
- /** Allow video generation via connected media providers */
1838
- allowVideoGen?: boolean;
1839
- /** Allow MCP tool access during execution */
1840
- allowTools?: boolean;
1841
- /** Allow web search during execution */
1842
- allowWebSearch?: boolean;
1843
- /** Allow code execution in sandbox */
1844
- allowCodeExec?: boolean;
1742
+ declare function entropy(probabilities: number[]): number;
1743
+ /**
1744
+ * Calculate joint entropy H(X, Y)
1745
+ *
1746
+ * @param jointProbabilities - 2D array of joint probabilities P(X=x, Y=y)
1747
+ * @returns Joint entropy in bits
1748
+ */
1749
+ declare function jointEntropy(jointProbabilities: number[][]): number;
1750
+ /**
1751
+ * Calculate conditional entropy H(Y|X) = H(X,Y) - H(X)
1752
+ *
1753
+ * @param jointProbabilities - 2D array P(X=x, Y=y)
1754
+ * @returns Conditional entropy in bits
1755
+ */
1756
+ declare function conditionalEntropy(jointProbabilities: number[][]): number;
1757
+ /**
1758
+ * Calculate mutual information I(X; Y) = H(X) + H(Y) - H(X, Y)
1759
+ * Measures how much knowing one variable reduces uncertainty about the other.
1760
+ *
1761
+ * @param pX - Marginal probability of X
1762
+ * @param pY - Marginal probability of Y
1763
+ * @param pXY - Joint probability P(X, Y) as 2D array
1764
+ * @returns Mutual information in bits
1765
+ */
1766
+ declare function mutualInformation(pX: number[], pY: number[], pXY: number[][]): number;
1767
+ /**
1768
+ * Metrics for measuring information preservation in transformations
1769
+ */
1770
+ interface InformationPreservation {
1771
+ /** Fraction of source information retained (0-1) */
1772
+ retention: number;
1773
+ /** Entropy of the source */
1774
+ sourceEntropy: number;
1775
+ /** Entropy of the target */
1776
+ targetEntropy: number;
1777
+ /** Mutual information between source and target */
1778
+ mutualInfo: number;
1779
+ /** Whether the transformation is lossless */
1780
+ lossless: boolean;
1845
1781
  }
1846
- interface SkillAgent {
1847
- /** Agent role name (e.g., "Market Researcher", "Legal Analyst") */
1848
- role: string;
1849
- /** What this agent does in the workflow */
1850
- description: string;
1851
- /** Maps to a NodeManifestV0.id in the stack */
1852
- nodeRef?: string;
1853
- /** When true, a synthetic peer reviewer evaluates this agent's output after completion */
1854
- peerReview?: boolean;
1855
- }
1856
- interface SkillSampleOutput {
1857
- type: SkillOutputType;
1858
- title: string;
1859
- /** Screenshot or live preview URL */
1860
- previewUrl?: string;
1861
- description: string;
1862
- }
1863
- /** External service dependency for a skill */
1864
- interface SkillServiceRequirement {
1865
- /** Unique key for this requirement (e.g., "search", "database", "email") */
1866
- key: string;
1867
- /** Human-readable label */
1868
- label: string;
1869
- /** Type of service needed */
1870
- type: "mcp" | "api" | "credential";
1871
- /** Description of what this service is used for */
1872
- description: string;
1873
- /** Whether this service is required or optional */
1874
- required: boolean;
1875
- /** Suggested MCP server names (for type: "mcp") */
1876
- suggestedServers?: string[];
1877
- }
1878
- interface SkillMeta<TInput extends Record<string, unknown> = Record<string, unknown>> {
1879
- /** Unique skill slug (url-safe) */
1880
- slug: string;
1881
- /** Display name */
1882
- title: string;
1883
- /** One-line value proposition */
1884
- tagline: string;
1885
- /** Detailed description (markdown) */
1886
- description: string;
1887
- /** Skill category */
1888
- category: SkillCategory;
1889
- /** Skill tier (complexity/impact level) */
1890
- tier: SkillTier;
1891
- /** Expected output artifact types */
1892
- outputs: SkillOutputType[];
1893
- /** Estimated execution time range in seconds [min, max] */
1894
- estimatedTime: [number, number];
1895
- /** Required input schema (JSON Schema) */
1896
- inputSchema: JSONSchema7;
1897
- /** Agent roles involved in this skill */
1898
- agents: SkillAgent[];
1899
- /** Sample input for demo/preview (typed to match inputSchema) */
1900
- sampleInput?: TInput;
1901
- /** Sample output artifacts for showcase */
1902
- sampleOutputs?: SkillSampleOutput[];
1903
- /** Tags for filtering */
1904
- tags: string[];
1905
- /** Author */
1906
- author: string;
1907
- /** Icon identifier (from icon set) */
1908
- icon?: string;
1909
- /** Cosmic gradient pair index (0-7 from cosmicGradients) */
1910
- gradientIndex?: number;
1911
- /** Output schema for composition chaining (JSON Schema) */
1912
- outputSchema?: JSONSchema7;
1913
- /** Allow agents to dynamically delegate tasks to ephemeral agents. Max 2 per run. */
1914
- allowDelegation?: boolean;
1915
- /** External service dependencies (MCP servers, APIs, credentials) */
1916
- services?: SkillServiceRequirement[];
1917
- /** Runtime capability toggles (image gen, video gen, tools, etc.) */
1918
- capabilities?: SkillCapabilities;
1919
- /** Current rank in the hierarchy (default: "skill") */
1920
- rank?: SkillRank;
1921
- /** Effective-dated rank history — immutable audit trail */
1922
- rankHistory?: RankAssignment[];
1923
- /**
1924
- * Convergence configuration for iterative agent output refinement.
1925
- *
1926
- * Future optimization: the manual convergence loop in runner.ts could be
1927
- * replaced by `withRetry()` + `withCircuitBreaker()` from
1928
- * `lib/terminals-tech/core/primitives/middleware` — they provide the same
1929
- * retry/backoff/threshold semantics with composable middleware chaining.
1930
- * See also `createRefinementLoop()` from `primitives/refinement` which
1931
- * encapsulates the score/delta/plateau logic as a standalone primitive.
1932
- */
1933
- convergence?: {
1934
- /** Max refinement iterations per agent. Default 1 (no refinement), max 5. */
1935
- maxIterations: number;
1936
- /** Quality threshold (0-1). Agent output must meet this to pass. Default 0.7. */
1937
- qualityThreshold: number;
1938
- /** Minimum quality improvement per iteration. Stops early if delta < this. Default 0.05. */
1939
- minDelta: number;
1940
- /** Refinement strategy: retry (re-execute), critique (LLM critic), refine (critique + inject feedback). */
1941
- strategy: "retry" | "critique" | "refine";
1942
- };
1782
+ /**
1783
+ * Measure information preservation between source and transformed representations.
1784
+ * Uses hash-based sampling for large datasets.
1785
+ *
1786
+ * @param source - Original values
1787
+ * @param transformed - Transformed values
1788
+ * @param roundTrip - Optional round-trip values (transformed → source)
1789
+ * @returns Information preservation metrics
1790
+ */
1791
+ declare function measurePreservation<S, T>(source: S[], transformed: T[], roundTrip?: S[]): InformationPreservation;
1792
+ /**
1793
+ * Semantic density measures bits of meaningful information per token.
1794
+ * Higher density = more information packed into fewer tokens.
1795
+ */
1796
+ interface SemanticDensity {
1797
+ /** Total tokens in the representation */
1798
+ tokenCount: number;
1799
+ /** Estimated information content in bits */
1800
+ informationBits: number;
1801
+ /** Bits per token */
1802
+ density: number;
1803
+ /** Compression ratio compared to baseline */
1804
+ compressionRatio: number;
1943
1805
  }
1944
1806
  /**
1945
- * A SkillManifest extends StackManifestV0 with skill-specific metadata.
1807
+ * Calculate semantic density of a representation.
1946
1808
  *
1947
- * This is the core type a skill IS a stack manifest with agent orchestration
1948
- * metadata. The `skill` field contains all presentation and execution metadata.
1809
+ * @param tokens - Array of tokens (strings, symbols, etc.)
1810
+ * @param baselineTokensPerBit - Baseline tokens per bit of information (default: 2)
1811
+ * @returns Semantic density metrics
1812
+ */
1813
+ declare function calculateSemanticDensity(tokens: string[], baselineTokensPerBit?: number): SemanticDensity;
1814
+ /**
1815
+ * Estimate Kolmogorov complexity via compression.
1816
+ * Lower complexity = more compressible = more structured.
1949
1817
  *
1950
- * The `TInput` parameter establishes compile-time correspondence between
1951
- * the JSON Schema `inputSchema`, the typed `sampleInput`, and the runtime
1952
- * input validated by `SkillRunner.start()`.
1818
+ * @param data - String representation of data
1819
+ * @returns Estimated complexity as compression ratio
1953
1820
  */
1954
- interface SkillManifest<TInput extends Record<string, unknown> = Record<string, unknown>> extends StackManifestV0 {
1955
- /** Skill-specific metadata */
1956
- skill: SkillMeta<TInput>;
1957
- }
1958
-
1959
- type ManifestType = "skill" | "stack" | "node" | "project";
1960
- type ManifestSource = "system" | "user" | "compose" | "marketplace" | "import";
1961
- interface RegistryEntry {
1962
- type: ManifestType;
1963
- manifest: SkillManifest | StackManifestV0 | NodeManifestV0 | Record<string, unknown>;
1964
- source: ManifestSource;
1965
- registeredAt: number;
1966
- tags?: string[];
1967
- }
1968
- interface RegistryFilter {
1969
- type?: ManifestType;
1970
- source?: ManifestSource;
1971
- category?: SkillCategory;
1972
- tags?: string[];
1973
- limit?: number;
1974
- }
1975
- declare class ManifestRegistry {
1976
- private entries;
1977
- register(manifest: SkillManifest | StackManifestV0 | NodeManifestV0 | Record<string, unknown>, type: ManifestType, source: ManifestSource, tags?: string[]): void;
1978
- get(key: string): RegistryEntry | undefined;
1979
- getSkill(slug: string): SkillManifest | undefined;
1980
- getAll(filter?: RegistryFilter): RegistryEntry[];
1981
- resolve(ref: string): RegistryEntry | null;
1982
- search(query: string, filter?: RegistryFilter): RegistryEntry[];
1983
- unregister(key: string): boolean;
1984
- get size(): number;
1985
- clear(): void;
1986
- private deriveKey;
1987
- }
1988
- /** Singleton registry instance */
1989
- declare const registry: ManifestRegistry;
1990
-
1821
+ declare function estimateComplexity(data: string): number;
1991
1822
  /**
1992
- * Core SDK Fundamental utilities and data structures
1823
+ * Calculate KL divergence D_KL(P || Q) = Σ p(x) log(p(x)/q(x))
1824
+ * Measures how much P differs from Q.
1993
1825
  *
1994
- * Result types, retry/circuit-breaker, event bus, validation, DAG, registry.
1995
- * Hides internal combinators, vector ops, stream internals.
1826
+ * @param p - True distribution
1827
+ * @param q - Approximate distribution
1828
+ * @returns KL divergence (non-negative, 0 = identical)
1829
+ */
1830
+ declare function klDivergence(p: number[], q: number[]): number;
1831
+ /**
1832
+ * Calculate Jensen-Shannon divergence (symmetric KL variant)
1833
+ * JSD(P, Q) = 0.5 * D_KL(P || M) + 0.5 * D_KL(Q || M) where M = 0.5(P + Q)
1996
1834
  *
1997
- * @copyright © 2026 Intuition Labs LLC. All rights reserved. Patent Pending.
1998
- * @module sdk/core
1835
+ * @param p - First distribution
1836
+ * @param q - Second distribution
1837
+ * @returns JS divergence in [0, 1]
1999
1838
  */
2000
-
2001
- type core_CircuitBreakerOptions = CircuitBreakerOptions;
2002
- type core_DAG<N, E = void> = DAG<N, E>;
2003
- type core_DAGEdge<E = void> = DAGEdge<E>;
2004
- type core_DAGNode<T> = DAGNode<T>;
2005
- type core_EventHandler<T> = EventHandler<T>;
2006
- type core_ManifestRegistry = ManifestRegistry;
2007
- declare const core_ManifestRegistry: typeof ManifestRegistry;
2008
- type core_Registry<K, V> = Registry<K, V>;
2009
- type core_RetryOptions = RetryOptions;
2010
- type core_SDKResult<T, E = Error> = SDKResult<T, E>;
2011
- type core_StoreError = StoreError;
2012
- type core_TypedEventBus<Events extends Record<string, unknown>> = TypedEventBus<Events>;
2013
- type core_Untrusted<T> = Untrusted<T>;
2014
- type core_Validated<T> = Validated<T>;
2015
- declare const core_createCircuitBreaker: typeof createCircuitBreaker;
2016
- declare const core_createDAG: typeof createDAG;
2017
- declare const core_createEventBus: typeof createEventBus;
2018
- declare const core_createRegistry: typeof createRegistry;
2019
- declare const core_err: typeof err;
2020
- declare const core_isErr: typeof isErr;
2021
- declare const core_isOk: typeof isOk;
2022
- declare const core_ok: typeof ok;
2023
- declare const core_registry: typeof registry;
2024
- declare const core_secureValidate: typeof secureValidate;
2025
- declare const core_unbrand: typeof unbrand;
2026
- declare const core_untrusted: typeof untrusted;
2027
- declare const core_validateWithSchema: typeof validateWithSchema;
2028
- declare const core_validated: typeof validated;
2029
- declare const core_withRetry: typeof withRetry;
2030
- declare namespace core {
2031
- export { type core_CircuitBreakerOptions as CircuitBreakerOptions, type core_DAG as DAG, type core_DAGEdge as DAGEdge, type core_DAGNode as DAGNode, type core_EventHandler as EventHandler, core_ManifestRegistry as ManifestRegistry, type core_Registry as Registry, type core_RetryOptions as RetryOptions, type core_SDKResult as SDKResult, type core_StoreError as StoreError, type core_TypedEventBus as TypedEventBus, type core_Untrusted as Untrusted, type core_Validated as Validated, core_createCircuitBreaker as createCircuitBreaker, core_createDAG as createDAG, core_createEventBus as createEventBus, core_createRegistry as createRegistry, core_err as err, flatMap as flatMapResult, core_isErr as isErr, core_isOk as isOk, map as mapResult, core_ok as ok, core_registry as registry, core_secureValidate as secureValidate, core_unbrand as unbrand, core_untrusted as untrusted, core_validateWithSchema as validateWithSchema, core_validated as validated, core_withRetry as withRetry };
2032
- }
1839
+ declare function jsDivergence(p: number[], q: number[]): number;
1840
+ /**
1841
+ * Normalize an array to sum to 1 (probability distribution)
1842
+ */
1843
+ declare function normalize(values: number[]): number[];
1844
+ /**
1845
+ * Calculate cosine similarity between two vectors
1846
+ */
1847
+ declare function cosineSimilarity(a: number[], b: number[]): number;
2033
1848
 
2034
1849
  /**
2035
- * L0 Category Theory Primitives
1850
+ * L0 Automatic Isomorphism Derivation
2036
1851
  *
2037
- * Foundational categorical abstractions for cross-layer type mappings.
2038
- * Provides the mathematical foundation for isomorphisms between AXON layers.
1852
+ * Automatically derives isomorphisms between compatible types
1853
+ * using structural analysis and field mapping.
2039
1854
  *
2040
1855
  * @license BUSL-1.1
2041
1856
  * @copyright © 2026 Intuition Labs LLC. All rights reserved. Patent Pending.
2042
- * @module core/L0/category
1857
+ * @module core/L0/derivation
2043
1858
  */
1859
+
2044
1860
  /**
2045
- * A morphism is a structure-preserving transformation between types.
2046
- * This is the fundamental building block of category theory.
1861
+ * Type shape descriptor for structural analysis
2047
1862
  */
2048
- type Morphism<A, B> = (a: A) => B;
1863
+ interface TypeShape {
1864
+ /** Type kind (object, array, primitive, etc.) */
1865
+ kind: "object" | "array" | "primitive" | "null" | "undefined";
1866
+ /** For objects: map of field name to TypeShape */
1867
+ fields?: Record<string, TypeShape>;
1868
+ /** For arrays: element type shape */
1869
+ elementType?: TypeShape;
1870
+ /** For primitives: the primitive type */
1871
+ primitiveType?: "string" | "number" | "boolean" | "bigint" | "symbol";
1872
+ /** Whether the field is optional */
1873
+ optional?: boolean;
1874
+ }
2049
1875
  /**
2050
- * Async morphism for transformations that may be asynchronous
1876
+ * Extract the structural shape of a value at runtime
1877
+ *
1878
+ * @param value - Value to analyze
1879
+ * @returns TypeShape descriptor
2051
1880
  */
2052
- type AsyncMorphism<A, B> = (a: A) => Promise<B>;
1881
+ declare function extractShape(value: unknown): TypeShape;
2053
1882
  /**
2054
- * A Category consists of objects and morphisms between them,
2055
- * with composition and identity laws.
1883
+ * Calculate similarity between two type shapes (Jaccard-like)
1884
+ *
1885
+ * @param a - First type shape
1886
+ * @param b - Second type shape
1887
+ * @returns Similarity score (0-1)
2056
1888
  */
2057
- interface Category<Obj, Hom> {
2058
- /** Identity morphism for each object */
2059
- identity<A extends Obj>(a: A): Hom;
2060
- /** Composition of morphisms: g . f = g(f(x)) */
2061
- compose<A extends Obj, B extends Obj, C extends Obj>(f: Hom, g: Hom): Hom;
1889
+ declare function shapeSimilarity(a: TypeShape, b: TypeShape): number;
1890
+ /**
1891
+ * A mapping between fields in source and target types
1892
+ */
1893
+ interface FieldMapping {
1894
+ /** Source field name */
1895
+ source: string;
1896
+ /** Target field name */
1897
+ target: string;
1898
+ /** Confidence of the mapping (0-1) */
1899
+ confidence: number;
1900
+ /** Transform function if types differ */
1901
+ transform?: Morphism<unknown, unknown>;
2062
1902
  }
2063
1903
  /**
2064
- * An isomorphism is a bijective morphism with an inverse.
2065
- * For A and B to be isomorphic, there must exist:
2066
- * - forward: A → B
2067
- * - backward: B → A
2068
- * - such that: backward(forward(a)) = a AND forward(backward(b)) = b
1904
+ * Derive field mappings between two object shapes
1905
+ *
1906
+ * @param source - Source type shape
1907
+ * @param target - Target type shape
1908
+ * @returns Array of field mappings
2069
1909
  */
2070
- interface Iso<A, B> {
2071
- /** Forward transformation: A → B */
2072
- forward: Morphism<A, B>;
2073
- /** Backward transformation: B → A */
2074
- backward: Morphism<B, A>;
2075
- /** Optional metadata about the isomorphism */
2076
- meta?: IsoMeta;
1910
+ declare function deriveFieldMappings(source: TypeShape, target: TypeShape): FieldMapping[];
1911
+ /**
1912
+ * Result of automatic isomorphism derivation
1913
+ */
1914
+ interface DerivedIso<A, B> extends Iso<A, B> {
1915
+ /** Field mappings used */
1916
+ fieldMappings: FieldMapping[];
1917
+ /** Overall confidence score */
1918
+ confidence: number;
2077
1919
  }
2078
1920
  /**
2079
- * Metadata about an isomorphism
1921
+ * Options for isomorphism derivation
2080
1922
  */
2081
- interface IsoMeta {
2082
- /** Human-readable name */
2083
- name?: string;
2084
- /** Description of what this iso does */
2085
- description?: string;
2086
- /** Whether this is an exact isomorphism (no information loss) */
2087
- exact?: boolean;
2088
- /** Confidence score for derived isomorphisms (0-1) */
2089
- confidence?: number;
2090
- /** Source layer (L1-L5) */
2091
- sourceLayer?: LayerId;
2092
- /** Target layer (L1-L5) */
2093
- targetLayer?: LayerId;
2094
- }
2095
- /**
2096
- * Async isomorphism for transformations that may be asynchronous
2097
- */
2098
- interface AsyncIso<A, B> {
2099
- forward: AsyncMorphism<A, B>;
2100
- backward: AsyncMorphism<B, A>;
2101
- meta?: IsoMeta;
2102
- }
2103
- /**
2104
- * An embedding is a one-way structure-preserving transformation.
2105
- * Unlike isomorphisms, embeddings may not have a full inverse.
2106
- * The partial inverse extracts as much as possible from the target type.
2107
- */
2108
- interface Embed<A, B> {
2109
- /** Embed A into B */
2110
- embed: Morphism<A, B>;
2111
- /** Partial extraction from B (may lose information) */
2112
- extract: Morphism<B, Partial<A>>;
2113
- /** Whether the embedding is lossless */
2114
- lossless?: boolean;
2115
- }
2116
- /**
2117
- * A functor maps objects and morphisms between categories
2118
- * while preserving identity and composition.
2119
- */
2120
- interface Functor<F> {
2121
- /** Map a morphism over the functor */
2122
- map<A, B>(f: Morphism<A, B>): (fa: F) => F;
2123
- }
2124
- /**
2125
- * Natural transformation between functors F and G.
2126
- * For each object A, provides a morphism F(A) → G(A)
2127
- * such that the naturality square commutes.
2128
- */
2129
- type NaturalTransformation<F, G> = <A>(fa: F) => G;
2130
- /**
2131
- * AXON Layer identifiers
2132
- */
2133
- type LayerId = "L0" | "L1" | "L2" | "L3" | "L4" | "L5";
2134
- /**
2135
- * Layer metadata
2136
- */
2137
- interface LayerMeta {
2138
- id: LayerId;
2139
- name: string;
2140
- description: string;
2141
- color: string;
1923
+ interface DerivationOptions {
1924
+ /** Minimum confidence threshold (default: 0.5) */
1925
+ minConfidence?: number;
1926
+ /** Whether to include partial mappings (default: true) */
1927
+ includePartial?: boolean;
1928
+ /** Custom field transforms */
1929
+ customTransforms?: Record<string, Morphism<unknown, unknown>>;
2142
1930
  }
2143
1931
  /**
2144
- * AXON Layer definitions
2145
- */
2146
- declare const LAYERS: Record<LayerId, LayerMeta>;
2147
- /**
2148
- * Valid layer transitions in the AXON architecture
1932
+ * Automatically derive an isomorphism between two types based on structure
1933
+ *
1934
+ * @param sampleA - Sample value of type A
1935
+ * @param sampleB - Sample value of type B
1936
+ * @param options - Derivation options
1937
+ * @returns Derived isomorphism or null if not derivable
2149
1938
  */
2150
- declare const VALID_TRANSITIONS: ReadonlyArray<[LayerId, LayerId]>;
1939
+ declare function deriveIsomorphism<A extends object, B extends object>(sampleA: A, sampleB: B, options?: DerivationOptions): DerivedIso<A, B> | null;
2151
1940
  /**
2152
- * Product type - categorical product of A and B
1941
+ * Verify an isomorphism by testing round-trip on sample values
1942
+ *
1943
+ * @param iso - Isomorphism to verify
1944
+ * @param samples - Sample values to test
1945
+ * @returns True if all round-trips match
2153
1946
  */
2154
- type Product<A, B> = readonly [A, B];
1947
+ declare function verifyIsomorphism<A, B>(iso: Iso<A, B>, samples: A[]): boolean;
2155
1948
  /**
2156
- * Coproduct (sum) type - categorical coproduct of A and B
1949
+ * Check if two types are structurally compatible for isomorphism
1950
+ *
1951
+ * @param shapeA - Source type shape
1952
+ * @param shapeB - Target type shape
1953
+ * @returns Compatibility score (0-1)
2157
1954
  */
2158
- type Coproduct<A, B> = {
2159
- readonly tag: "left";
2160
- readonly value: A;
2161
- } | {
2162
- readonly tag: "right";
2163
- readonly value: B;
2164
- };
1955
+ declare function checkCompatibility(shapeA: TypeShape, shapeB: TypeShape): number;
2165
1956
  /**
2166
- * Create a left-tagged coproduct
1957
+ * Check if a type can be embedded into another (one-way mapping)
1958
+ *
1959
+ * @param source - Source type shape
1960
+ * @param target - Target type shape
1961
+ * @returns True if source can be fully embedded in target
2167
1962
  */
2168
- declare function left<A, B>(value: A): Coproduct<A, B>;
1963
+ declare function canEmbed(source: TypeShape, target: TypeShape): boolean;
1964
+
2169
1965
  /**
2170
- * Create a right-tagged coproduct
1966
+ * L0 Sematon — The Smallest Meaning-Bearing Unit
1967
+ *
1968
+ * The sematon is the atomic unit of operational meaning in Terminals OS.
1969
+ * It carries a typed payload, convergence witness, p-adic address,
1970
+ * information-theoretic metrics, and a constructor flag that guarantees
1971
+ * the Deutsch-Marletto invariant: after transforming an input, the
1972
+ * sematon retains the ability to transform again.
1973
+ *
1974
+ * The sematon unifies Signal<T>, ContextNode, FractalSnapshot,
1975
+ * ConvergenceWitness, and CombinatorEvent into a single formal type
1976
+ * at the L0 foundation layer.
1977
+ *
1978
+ * Core Engine Primitive.
1979
+ *
1980
+ * @license BUSL-1.1
1981
+ * @copyright © 2026 Intuition Labs LLC. All rights reserved. Patent Pending.
1982
+ * @module core/L0/sematon
2171
1983
  */
2172
- declare function right<A, B>(value: B): Coproduct<A, B>;
2173
1984
  /**
2174
- * Fold over a coproduct
1985
+ * Payload kind classification for sematons.
1986
+ * Determines how the payload is interpreted across layers.
2175
1987
  */
2176
- declare function fold<A, B, C>(onLeft: Morphism<A, C>, onRight: Morphism<B, C>): Morphism<Coproduct<A, B>, C>;
1988
+ type SematonKind = "signal" | "context" | "fractal" | "witness" | "combinator" | "interaction" | "custom";
2177
1989
  /**
2178
- * A proof witness type - represents evidence that P holds
1990
+ * Convergence witness snapshot embedded in a sematon.
1991
+ * Minimal subset of ConvergenceWitness for portability.
2179
1992
  */
2180
- type Proof<P> = P extends true ? {
2181
- readonly _witness: unique symbol;
2182
- } : never;
1993
+ interface SematonWitness {
1994
+ /** Kuramoto order parameter R in [0, 1] */
1995
+ R: number;
1996
+ /** Shannon entropy of activation distribution */
1997
+ activationEntropy: number;
1998
+ /** Whether convergence criteria are met */
1999
+ converged: boolean;
2000
+ /** Step at which this witness was taken */
2001
+ step: number;
2002
+ }
2183
2003
  /**
2184
- * A verified value with attached proof
2004
+ * The Sematon smallest meaning-bearing unit with operational consequence.
2005
+ *
2006
+ * Generic over T (the payload type):
2007
+ * T = Signal payload at signal kind
2008
+ * T = ContextNode metadata at context kind
2009
+ * T = FractalSnapshot at fractal kind
2010
+ * T = arbitrary at custom kind
2185
2011
  */
2186
- interface Verified<T, P> {
2187
- readonly value: T;
2188
- readonly proof: Proof<P>;
2012
+ interface Sematon<T = unknown> {
2013
+ /** Unique identifier */
2014
+ readonly id: string;
2015
+ /** Payload kind classification */
2016
+ readonly kind: SematonKind;
2017
+ /** The meaning-bearing payload */
2018
+ readonly payload: T;
2019
+ /** Convergence witness at creation time */
2020
+ readonly witness: SematonWitness;
2021
+ /** p-adic address for hierarchical locality */
2022
+ readonly padicAddress: string;
2023
+ /** Shannon entropy of payload (bits) */
2024
+ readonly entropy: number;
2025
+ /** Semantic density (bits per token) */
2026
+ readonly density: number;
2027
+ /** The resistance to constructive transformation: H / (ρ * R) */
2028
+ readonly impedance: number;
2029
+ /** Deterministic content hash (FNV-1a) */
2030
+ readonly shapeHash: string;
2031
+ /**
2032
+ * Constructor flag: can this sematon participate in further transformations?
2033
+ * True iff: witness has converged AND entropy is finite AND payload is non-empty.
2034
+ * This is the Deutsch-Marletto invariant.
2035
+ */
2036
+ readonly constructive: boolean;
2037
+ /** Creation timestamp */
2038
+ readonly createdAt: number;
2039
+ /** Source layer or surface that produced this sematon */
2040
+ readonly source: string;
2189
2041
  }
2190
2042
  /**
2191
- * Compose two morphisms: g . f
2043
+ * Folded (serializable) representation of a Sematon.
2044
+ * Suitable for JSON serialization, mesh relay, or persistence.
2192
2045
  */
2193
- declare function compose<A, B, C>(f: Morphism<A, B>, g: Morphism<B, C>): Morphism<A, C>;
2046
+ interface FoldedSematon {
2047
+ id: string;
2048
+ kind: SematonKind;
2049
+ payload: string;
2050
+ witness: SematonWitness;
2051
+ padicAddress: string;
2052
+ entropy: number;
2053
+ density: number;
2054
+ impedance: number;
2055
+ shapeHash: string;
2056
+ constructive: boolean;
2057
+ createdAt: number;
2058
+ source: string;
2059
+ }
2060
+ interface SematonConfig<T> {
2061
+ kind: SematonKind;
2062
+ payload: T;
2063
+ witness: SematonWitness;
2064
+ padicAddress?: string;
2065
+ source?: string;
2066
+ }
2194
2067
  /**
2195
- * Compose two async morphisms
2068
+ * Create a new Sematon from configuration.
2196
2069
  */
2197
- declare function composeAsync<A, B, C>(f: AsyncMorphism<A, B>, g: AsyncMorphism<B, C>): Promise<AsyncMorphism<A, C>>;
2070
+ declare function createSematon<T>(config: SematonConfig<T>): Sematon<T>;
2198
2071
  /**
2199
- * Identity morphism
2072
+ * Get the Shannon entropy of a sematon's payload.
2200
2073
  */
2201
- declare function identity<A>(): Morphism<A, A>;
2074
+ declare function sematonEntropy<T>(sematon: Sematon<T>): number;
2202
2075
  /**
2203
- * Compose two isomorphisms
2076
+ * Get the semantic density of a sematon.
2204
2077
  */
2205
- declare function composeIso<A, B, C>(iso1: Iso<A, B>, iso2: Iso<B, C>): Iso<A, C>;
2078
+ declare function sematonDensity<T>(sematon: Sematon<T>): number;
2206
2079
  /**
2207
- * Invert an isomorphism
2080
+ * Check if a sematon can participate in further transformations.
2081
+ * This is the Deutsch-Marletto constructor invariant.
2208
2082
  */
2209
- declare function invertIso<A, B>(iso: Iso<A, B>): Iso<B, A>;
2083
+ declare function isRealizable<T>(sematon: Sematon<T>): boolean;
2210
2084
  /**
2211
- * Create an identity isomorphism
2085
+ * Compute distance between two sematons using payload cosine similarity
2086
+ * weighted by witness R proximity.
2087
+ *
2088
+ * Distance in [0, 1] where 0 = identical, 1 = maximally different.
2212
2089
  */
2213
- declare function identityIso<A>(): Iso<A, A>;
2090
+ declare function sematonDistance<T>(a: Sematon<T>, b: Sematon<T>): number;
2214
2091
  /**
2215
- * A typed bridge between two layers with verified transition
2092
+ * Fold a Sematon into a JSON-serializable representation.
2093
+ * HVM γ (construct) — compress for handoff, persistence, or relay.
2216
2094
  */
2217
- interface LayerBridge<From extends LayerId, To extends LayerId, A, B> {
2218
- readonly sourceLayer: From;
2219
- readonly targetLayer: To;
2220
- readonly iso: Iso<A, B>;
2221
- }
2095
+ declare function foldSematon<T>(sematon: Sematon<T>): FoldedSematon;
2222
2096
  /**
2223
- * Check if a layer transition is valid
2097
+ * Unfold a serialized representation back into a Sematon.
2098
+ * HVM δ (duplicate) — expand from handoff, persistence, or relay.
2224
2099
  */
2225
- declare function isValidTransition(from: LayerId, to: LayerId): boolean;
2100
+ declare function unfoldSematon<T>(folded: FoldedSematon): Sematon<T>;
2101
+
2226
2102
  /**
2227
- * Create a layer bridge (validates transition at runtime)
2228
- */
2229
- declare function createBridge<From extends LayerId, To extends LayerId, A, B>(from: From, to: To, iso: Iso<A, B>): LayerBridge<From, To, A, B> | null;
2230
-
2231
- /**
2232
- * L0 Information Theory Primitives
2233
- *
2234
- * Provides measures for information preservation, entropy,
2235
- * and semantic density in cross-layer transformations.
2236
- *
2237
- * @module core/L0/information
2238
- */
2239
- /**
2240
- * Calculate Shannon entropy for a probability distribution.
2241
- * H(X) = -Σ p(x) log₂ p(x)
2103
+ * L0 Realizability Trace Constructor Proof Runtime
2242
2104
  *
2243
- * @param probabilities - Array of probabilities (should sum to 1)
2244
- * @returns Entropy in bits
2245
- */
2246
- declare function entropy(probabilities: number[]): number;
2247
- /**
2248
- * Calculate joint entropy H(X, Y)
2105
+ * A RealizabilityTrace is an ordered sequence of RealizabilitySteps.
2106
+ * Each step records: input Sematon(s), output Sematon(s), a ConvergenceWitness
2107
+ * snapshot, and information gain.
2249
2108
  *
2250
- * @param jointProbabilities - 2D array of joint probabilities P(X=x, Y=y)
2251
- * @returns Joint entropy in bits
2252
- */
2253
- declare function jointEntropy(jointProbabilities: number[][]): number;
2254
- /**
2255
- * Calculate conditional entropy H(Y|X) = H(X,Y) - H(X)
2109
+ * verifyTrace() checks three constructor invariants:
2110
+ * 1. Each input was realizable (constructive flag true)
2111
+ * 2. Each witness converged (R above threshold)
2112
+ * 3. Information is non-decreasing across steps
2256
2113
  *
2257
- * @param jointProbabilities - 2D array P(X=x, Y=y)
2258
- * @returns Conditional entropy in bits
2259
- */
2260
- declare function conditionalEntropy(jointProbabilities: number[][]): number;
2261
- /**
2262
- * Calculate mutual information I(X; Y) = H(X) + H(Y) - H(X, Y)
2263
- * Measures how much knowing one variable reduces uncertainty about the other.
2114
+ * This is the Deutsch-Marletto constructor invariant made executable:
2115
+ * after transforming inputs, the system retains the ability to transform again.
2264
2116
  *
2265
- * @param pX - Marginal probability of X
2266
- * @param pY - Marginal probability of Y
2267
- * @param pXY - Joint probability P(X, Y) as 2D array
2268
- * @returns Mutual information in bits
2269
- */
2270
- declare function mutualInformation(pX: number[], pY: number[], pXY: number[][]): number;
2271
- /**
2272
- * Metrics for measuring information preservation in transformations
2117
+ * @license BUSL-1.1
2118
+ * @copyright © 2026 Intuition Labs LLC. All rights reserved. Patent Pending.
2119
+ * @module core/L0/realizability
2273
2120
  */
2274
- interface InformationPreservation {
2275
- /** Fraction of source information retained (0-1) */
2276
- retention: number;
2277
- /** Entropy of the source */
2278
- sourceEntropy: number;
2279
- /** Entropy of the target */
2280
- targetEntropy: number;
2281
- /** Mutual information between source and target */
2282
- mutualInfo: number;
2283
- /** Whether the transformation is lossless */
2284
- lossless: boolean;
2121
+
2122
+ interface RealizabilityStep {
2123
+ /** Step index in the trace */
2124
+ index: number;
2125
+ /** Input sematons consumed by this step */
2126
+ inputs: Sematon[];
2127
+ /** Output sematons produced by this step */
2128
+ outputs: Sematon[];
2129
+ /** Convergence witness at this step */
2130
+ witness: SematonWitness;
2131
+ /** Total information content of outputs (bits) */
2132
+ informationGain: number;
2133
+ /** Timestamp */
2134
+ timestamp: number;
2285
2135
  }
2286
- /**
2287
- * Measure information preservation between source and transformed representations.
2288
- * Uses hash-based sampling for large datasets.
2289
- *
2290
- * @param source - Original values
2291
- * @param transformed - Transformed values
2292
- * @param roundTrip - Optional round-trip values (transformed → source)
2293
- * @returns Information preservation metrics
2294
- */
2295
- declare function measurePreservation<S, T>(source: S[], transformed: T[], roundTrip?: S[]): InformationPreservation;
2296
- /**
2297
- * Semantic density measures bits of meaningful information per token.
2298
- * Higher density = more information packed into fewer tokens.
2299
- */
2300
- interface SemanticDensity {
2301
- /** Total tokens in the representation */
2302
- tokenCount: number;
2303
- /** Estimated information content in bits */
2304
- informationBits: number;
2305
- /** Bits per token */
2306
- density: number;
2307
- /** Compression ratio compared to baseline */
2308
- compressionRatio: number;
2136
+ interface RealizabilityTrace {
2137
+ /** Unique trace identifier */
2138
+ id: string;
2139
+ /** Ordered sequence of steps */
2140
+ steps: RealizabilityStep[];
2141
+ /** Whether the trace has been verified */
2142
+ verified: boolean;
2143
+ /** Total information gain across all steps */
2144
+ totalInfoGain: number;
2145
+ /** Count of constructive (realizable) steps */
2146
+ constructiveSteps: number;
2147
+ /** Creation timestamp */
2148
+ createdAt: number;
2309
2149
  }
2150
+ interface VerificationSuccess {
2151
+ valid: true;
2152
+ totalInfoGain: number;
2153
+ constructiveSteps: number;
2154
+ }
2155
+ interface VerificationFailure {
2156
+ valid: false;
2157
+ failureStep: number;
2158
+ reason: string;
2159
+ }
2160
+ type VerificationResult = VerificationSuccess | VerificationFailure;
2310
2161
  /**
2311
- * Calculate semantic density of a representation.
2312
- *
2313
- * @param tokens - Array of tokens (strings, symbols, etc.)
2314
- * @param baselineTokensPerBit - Baseline tokens per bit of information (default: 2)
2315
- * @returns Semantic density metrics
2316
- */
2317
- declare function calculateSemanticDensity(tokens: string[], baselineTokensPerBit?: number): SemanticDensity;
2318
- /**
2319
- * Estimate Kolmogorov complexity via compression.
2320
- * Lower complexity = more compressible = more structured.
2321
- *
2322
- * @param data - String representation of data
2323
- * @returns Estimated complexity as compression ratio
2162
+ * Create a single realizability step.
2163
+ * Computes informationGain as the sum of output sematon entropies.
2324
2164
  */
2325
- declare function estimateComplexity(data: string): number;
2165
+ declare function createRealizabilityStep(index: number, inputs: Sematon[], outputs: Sematon[], witness: SematonWitness): RealizabilityStep;
2326
2166
  /**
2327
- * Calculate KL divergence D_KL(P || Q) = Σ p(x) log(p(x)/q(x))
2328
- * Measures how much P differs from Q.
2329
- *
2330
- * @param p - True distribution
2331
- * @param q - Approximate distribution
2332
- * @returns KL divergence (non-negative, 0 = identical)
2167
+ * Construct a RealizabilityTrace from an ordered sequence of steps.
2168
+ * Computes totalInfoGain and constructiveSteps.
2333
2169
  */
2334
- declare function klDivergence(p: number[], q: number[]): number;
2170
+ declare function traceRealizability(steps: RealizabilityStep[]): RealizabilityTrace;
2335
2171
  /**
2336
- * Calculate Jensen-Shannon divergence (symmetric KL variant)
2337
- * JSD(P, Q) = 0.5 * D_KL(P || M) + 0.5 * D_KL(Q || M) where M = 0.5(P + Q)
2172
+ * Verify a realizability trace against three constructor invariants:
2173
+ * 1. Each step's inputs must all be realizable
2174
+ * 2. Each step's witness must have converged
2175
+ * 3. Information is non-decreasing across steps
2338
2176
  *
2339
- * @param p - First distribution
2340
- * @param q - Second distribution
2341
- * @returns JS divergence in [0, 1]
2177
+ * Returns VerificationSuccess or VerificationFailure with step index and reason.
2342
2178
  */
2343
- declare function jsDivergence(p: number[], q: number[]): number;
2179
+ declare function verifyTrace(trace: RealizabilityTrace): VerificationResult;
2344
2180
  /**
2345
- * Normalize an array to sum to 1 (probability distribution)
2181
+ * Fold a RealizabilityTrace into a JSON string.
2182
+ * Sematons are folded via foldSematon first for portable serialization.
2346
2183
  */
2347
- declare function normalize(values: number[]): number[];
2184
+ declare function foldTrace(trace: RealizabilityTrace): string;
2348
2185
  /**
2349
- * Calculate cosine similarity between two vectors
2186
+ * Unfold a JSON string back into a RealizabilityTrace.
2187
+ * Sematons are unfolded via unfoldSematon.
2350
2188
  */
2351
- declare function cosineSimilarity(a: number[], b: number[]): number;
2189
+ declare function unfoldTrace(json: string): RealizabilityTrace;
2352
2190
 
2353
2191
  /**
2354
- * L0 Automatic Isomorphism Derivation
2192
+ * L0 Foundation Layer
2355
2193
  *
2356
- * Automatically derives isomorphisms between compatible types
2357
- * using structural analysis and field mapping.
2194
+ * Provides categorical foundations and information-theoretic primitives
2195
+ * for cross-layer mappings in the AXON architecture.
2358
2196
  *
2359
- * @license BUSL-1.1
2360
- * @copyright © 2026 Intuition Labs LLC. All rights reserved. Patent Pending.
2361
- * @module core/L0/derivation
2197
+ * @module core/L0
2362
2198
  */
2363
2199
 
2364
- /**
2365
- * Type shape descriptor for structural analysis
2366
- */
2367
- interface TypeShape {
2368
- /** Type kind (object, array, primitive, etc.) */
2369
- kind: "object" | "array" | "primitive" | "null" | "undefined";
2370
- /** For objects: map of field name to TypeShape */
2371
- fields?: Record<string, TypeShape>;
2372
- /** For arrays: element type shape */
2373
- elementType?: TypeShape;
2374
- /** For primitives: the primitive type */
2375
- primitiveType?: "string" | "number" | "boolean" | "bigint" | "symbol";
2376
- /** Whether the field is optional */
2377
- optional?: boolean;
2200
+ type index_AsyncIso<A, B> = AsyncIso<A, B>;
2201
+ type index_AsyncMorphism<A, B> = AsyncMorphism<A, B>;
2202
+ type index_Category<Obj, Hom> = Category<Obj, Hom>;
2203
+ type index_Coproduct<A, B> = Coproduct<A, B>;
2204
+ type index_DerivationOptions = DerivationOptions;
2205
+ type index_DerivedIso<A, B> = DerivedIso<A, B>;
2206
+ type index_Embed<A, B> = Embed<A, B>;
2207
+ type index_FieldMapping = FieldMapping;
2208
+ type index_FoldedSematon = FoldedSematon;
2209
+ type index_Functor<F> = Functor<F>;
2210
+ type index_InformationPreservation = InformationPreservation;
2211
+ type index_Iso<A, B> = Iso<A, B>;
2212
+ type index_IsoMeta = IsoMeta;
2213
+ declare const index_LAYERS: typeof LAYERS;
2214
+ type index_LayerBridge<From extends LayerId, To extends LayerId, A, B> = LayerBridge<From, To, A, B>;
2215
+ type index_LayerId = LayerId;
2216
+ type index_LayerMeta = LayerMeta;
2217
+ type index_Morphism<A, B> = Morphism<A, B>;
2218
+ type index_NaturalTransformation<F, G> = NaturalTransformation<F, G>;
2219
+ type index_Product<A, B> = Product<A, B>;
2220
+ type index_Proof<P> = Proof<P>;
2221
+ type index_RealizabilityStep = RealizabilityStep;
2222
+ type index_RealizabilityTrace = RealizabilityTrace;
2223
+ type index_SemanticDensity = SemanticDensity;
2224
+ type index_Sematon<T = unknown> = Sematon<T>;
2225
+ type index_SematonConfig<T> = SematonConfig<T>;
2226
+ type index_SematonKind = SematonKind;
2227
+ type index_SematonWitness = SematonWitness;
2228
+ type index_TypeShape = TypeShape;
2229
+ declare const index_VALID_TRANSITIONS: typeof VALID_TRANSITIONS;
2230
+ type index_VerificationFailure = VerificationFailure;
2231
+ type index_VerificationResult = VerificationResult;
2232
+ type index_VerificationSuccess = VerificationSuccess;
2233
+ type index_Verified<T, P> = Verified<T, P>;
2234
+ declare const index_calculateSemanticDensity: typeof calculateSemanticDensity;
2235
+ declare const index_canEmbed: typeof canEmbed;
2236
+ declare const index_checkCompatibility: typeof checkCompatibility;
2237
+ declare const index_compose: typeof compose;
2238
+ declare const index_composeAsync: typeof composeAsync;
2239
+ declare const index_composeIso: typeof composeIso;
2240
+ declare const index_conditionalEntropy: typeof conditionalEntropy;
2241
+ declare const index_cosineSimilarity: typeof cosineSimilarity;
2242
+ declare const index_createBridge: typeof createBridge;
2243
+ declare const index_createRealizabilityStep: typeof createRealizabilityStep;
2244
+ declare const index_createSematon: typeof createSematon;
2245
+ declare const index_deriveFieldMappings: typeof deriveFieldMappings;
2246
+ declare const index_deriveIsomorphism: typeof deriveIsomorphism;
2247
+ declare const index_entropy: typeof entropy;
2248
+ declare const index_estimateComplexity: typeof estimateComplexity;
2249
+ declare const index_extractShape: typeof extractShape;
2250
+ declare const index_fold: typeof fold;
2251
+ declare const index_foldSematon: typeof foldSematon;
2252
+ declare const index_foldTrace: typeof foldTrace;
2253
+ declare const index_identity: typeof identity;
2254
+ declare const index_identityIso: typeof identityIso;
2255
+ declare const index_invertIso: typeof invertIso;
2256
+ declare const index_isRealizable: typeof isRealizable;
2257
+ declare const index_isValidTransition: typeof isValidTransition;
2258
+ declare const index_jointEntropy: typeof jointEntropy;
2259
+ declare const index_jsDivergence: typeof jsDivergence;
2260
+ declare const index_klDivergence: typeof klDivergence;
2261
+ declare const index_left: typeof left;
2262
+ declare const index_measurePreservation: typeof measurePreservation;
2263
+ declare const index_mutualInformation: typeof mutualInformation;
2264
+ declare const index_normalize: typeof normalize;
2265
+ declare const index_right: typeof right;
2266
+ declare const index_sematonDensity: typeof sematonDensity;
2267
+ declare const index_sematonDistance: typeof sematonDistance;
2268
+ declare const index_sematonEntropy: typeof sematonEntropy;
2269
+ declare const index_shapeSimilarity: typeof shapeSimilarity;
2270
+ declare const index_traceRealizability: typeof traceRealizability;
2271
+ declare const index_unfoldSematon: typeof unfoldSematon;
2272
+ declare const index_unfoldTrace: typeof unfoldTrace;
2273
+ declare const index_verifyIsomorphism: typeof verifyIsomorphism;
2274
+ declare const index_verifyTrace: typeof verifyTrace;
2275
+ declare namespace index {
2276
+ export { type index_AsyncIso as AsyncIso, type index_AsyncMorphism as AsyncMorphism, type index_Category as Category, type index_Coproduct as Coproduct, type index_DerivationOptions as DerivationOptions, type index_DerivedIso as DerivedIso, type index_Embed as Embed, type index_FieldMapping as FieldMapping, type index_FoldedSematon as FoldedSematon, type index_Functor as Functor, type index_InformationPreservation as InformationPreservation, type index_Iso as Iso, type index_IsoMeta as IsoMeta, index_LAYERS as LAYERS, type index_LayerBridge as LayerBridge, type index_LayerId as LayerId, type index_LayerMeta as LayerMeta, type index_Morphism as Morphism, type index_NaturalTransformation as NaturalTransformation, type index_Product as Product, type index_Proof as Proof, type index_RealizabilityStep as RealizabilityStep, type index_RealizabilityTrace as RealizabilityTrace, type index_SemanticDensity as SemanticDensity, type index_Sematon as Sematon, type index_SematonConfig as SematonConfig, type index_SematonKind as SematonKind, type index_SematonWitness as SematonWitness, type index_TypeShape as TypeShape, index_VALID_TRANSITIONS as VALID_TRANSITIONS, type index_VerificationFailure as VerificationFailure, type index_VerificationResult as VerificationResult, type index_VerificationSuccess as VerificationSuccess, type index_Verified as Verified, index_calculateSemanticDensity as calculateSemanticDensity, index_canEmbed as canEmbed, index_checkCompatibility as checkCompatibility, index_compose as compose, index_composeAsync as composeAsync, index_composeIso as composeIso, index_conditionalEntropy as conditionalEntropy, index_cosineSimilarity as cosineSimilarity, index_createBridge as createBridge, index_createRealizabilityStep as createRealizabilityStep, index_createSematon as createSematon, index_deriveFieldMappings as deriveFieldMappings, index_deriveIsomorphism as deriveIsomorphism, index_entropy as entropy, index_estimateComplexity as estimateComplexity, index_extractShape as extractShape, index_fold as fold, index_foldSematon as foldSematon, index_foldTrace as foldTrace, index_identity as identity, index_identityIso as identityIso, index_invertIso as invertIso, index_isRealizable as isRealizable, index_isValidTransition as isValidTransition, index_jointEntropy as jointEntropy, index_jsDivergence as jsDivergence, index_klDivergence as klDivergence, index_left as left, index_measurePreservation as measurePreservation, index_mutualInformation as mutualInformation, index_normalize as normalize, index_right as right, index_sematonDensity as sematonDensity, index_sematonDistance as sematonDistance, index_sematonEntropy as sematonEntropy, index_shapeSimilarity as shapeSimilarity, index_traceRealizability as traceRealizability, index_unfoldSematon as unfoldSematon, index_unfoldTrace as unfoldTrace, index_verifyIsomorphism as verifyIsomorphism, index_verifyTrace as verifyTrace };
2378
2277
  }
2278
+
2379
2279
  /**
2380
- * Extract the structural shape of a value at runtime
2280
+ * Action Algebra Input-Agnostic Action Types
2381
2281
  *
2382
- * @param value - Value to analyze
2383
- * @returns TypeShape descriptor
2384
- */
2385
- declare function extractShape(value: unknown): TypeShape;
2386
- /**
2387
- * Calculate similarity between two type shapes (Jaccard-like)
2282
+ * All input surfaces (keyboard, gamepad, voice, touch) compile down to this algebra.
2283
+ * All executors interpret this algebra into effects.
2388
2284
  *
2389
- * @param a - First type shape
2390
- * @param b - Second type shape
2391
- * @returns Similarity score (0-1)
2392
- */
2393
- declare function shapeSimilarity(a: TypeShape, b: TypeShape): number;
2394
- /**
2395
- * A mapping between fields in source and target types
2285
+ * @module core/primitives/action
2396
2286
  */
2397
- interface FieldMapping {
2398
- /** Source field name */
2399
- source: string;
2400
- /** Target field name */
2401
- target: string;
2402
- /** Confidence of the mapping (0-1) */
2403
- confidence: number;
2404
- /** Transform function if types differ */
2405
- transform?: Morphism<unknown, unknown>;
2287
+
2288
+ type NavigationTarget = {
2289
+ kind: "surface";
2290
+ surface: SurfaceId;
2291
+ } | {
2292
+ kind: "tab";
2293
+ tab: string;
2294
+ } | {
2295
+ kind: "route";
2296
+ path: string;
2297
+ params?: Record<string, string>;
2298
+ } | {
2299
+ kind: "focus";
2300
+ elementId: string;
2301
+ } | {
2302
+ kind: "relative";
2303
+ direction: "up" | "down" | "left" | "right";
2304
+ };
2305
+ type SkillRef = {
2306
+ kind: "slug";
2307
+ slug: string;
2308
+ } | {
2309
+ kind: "id";
2310
+ id: string;
2311
+ } | {
2312
+ kind: "command";
2313
+ commandId: string;
2314
+ };
2315
+ interface ComposeEdge {
2316
+ sourceId: string;
2317
+ targetId: string;
2318
+ port?: string;
2406
2319
  }
2407
- /**
2408
- * Derive field mappings between two object shapes
2409
- *
2410
- * @param source - Source type shape
2411
- * @param target - Target type shape
2412
- * @returns Array of field mappings
2413
- */
2414
- declare function deriveFieldMappings(source: TypeShape, target: TypeShape): FieldMapping[];
2415
- /**
2416
- * Result of automatic isomorphism derivation
2417
- */
2418
- interface DerivedIso<A, B> extends Iso<A, B> {
2419
- /** Field mappings used */
2420
- fieldMappings: FieldMapping[];
2421
- /** Overall confidence score */
2422
- confidence: number;
2320
+ type ObserveTarget = {
2321
+ kind: "metric";
2322
+ metricId: string;
2323
+ } | {
2324
+ kind: "panel";
2325
+ panelId: string;
2326
+ } | {
2327
+ kind: "surface";
2328
+ surface: SurfaceId;
2329
+ };
2330
+ interface DelegateAssignment {
2331
+ agentId: string;
2332
+ taskDescription: string;
2333
+ context?: Record<string, unknown>;
2423
2334
  }
2424
- /**
2425
- * Options for isomorphism derivation
2426
- */
2427
- interface DerivationOptions {
2428
- /** Minimum confidence threshold (default: 0.5) */
2429
- minConfidence?: number;
2430
- /** Whether to include partial mappings (default: true) */
2431
- includePartial?: boolean;
2432
- /** Custom field transforms */
2433
- customTransforms?: Record<string, Morphism<unknown, unknown>>;
2335
+ type Action = {
2336
+ verb: "navigate";
2337
+ target: NavigationTarget;
2338
+ } | {
2339
+ verb: "execute";
2340
+ skill: SkillRef;
2341
+ args?: Record<string, unknown>;
2342
+ } | {
2343
+ verb: "compose";
2344
+ edge: ComposeEdge;
2345
+ } | {
2346
+ verb: "observe";
2347
+ target: ObserveTarget;
2348
+ zoom?: number;
2349
+ } | {
2350
+ verb: "delegate";
2351
+ assignment: DelegateAssignment;
2352
+ } | {
2353
+ verb: "palette";
2354
+ query?: string;
2355
+ } | {
2356
+ verb: "cancel";
2357
+ } | {
2358
+ verb: "undo";
2359
+ } | {
2360
+ verb: "redo";
2361
+ } | {
2362
+ verb: "sequence";
2363
+ actions: Action[];
2364
+ };
2365
+ type InputSurface = "keyboard" | "gamepad" | "voice" | "touch" | "command_palette";
2366
+ interface ActionEvent {
2367
+ action: Action;
2368
+ source: InputSurface;
2369
+ timestamp: number;
2370
+ inputTrace?: string[];
2371
+ }
2372
+ interface ActionContext {
2373
+ activeSurface: SurfaceId;
2374
+ activeTab: string;
2375
+ selection: string[];
2376
+ isTextFocused: boolean;
2377
+ isModalOpen: boolean;
2378
+ }
2379
+ type ActionPredicate = (ctx: ActionContext) => boolean;
2380
+ interface KeyboardTrigger {
2381
+ type: "chord" | "key" | "sequence";
2382
+ keys: string[];
2383
+ timeout?: number;
2384
+ }
2385
+ type GamepadButton = "a" | "b" | "x" | "y" | "lb" | "rb" | "lt" | "rt" | "back" | "start" | "ls" | "rs" | "dpad_up" | "dpad_down" | "dpad_left" | "dpad_right";
2386
+ interface GamepadTrigger {
2387
+ type: "button" | "combo" | "axis";
2388
+ buttons?: GamepadButton[];
2389
+ sequence?: {
2390
+ button: GamepadButton;
2391
+ holdMs?: number;
2392
+ }[];
2393
+ axis?: {
2394
+ stick: "left" | "right";
2395
+ direction: "up" | "down" | "left" | "right";
2396
+ threshold?: number;
2397
+ };
2398
+ }
2399
+ interface VoiceTrigger {
2400
+ type: "intent";
2401
+ patterns: string[];
2402
+ confidenceThreshold?: number;
2403
+ }
2404
+ interface TouchTrigger {
2405
+ type: "gesture";
2406
+ gesture: "swipe_left" | "swipe_right" | "swipe_up" | "swipe_down" | "pinch_in" | "pinch_out" | "long_press" | "double_tap" | "three_finger_swipe";
2407
+ }
2408
+ type InputTrigger = KeyboardTrigger | GamepadTrigger | VoiceTrigger | TouchTrigger;
2409
+ interface ActionBinding {
2410
+ id: string;
2411
+ action: Action;
2412
+ label: string;
2413
+ category: string;
2414
+ when: ActionPredicate;
2415
+ trigger: InputTrigger;
2416
+ surface: InputSurface;
2434
2417
  }
2418
+ /** Sequence two actions (flattens nested sequences) */
2419
+ declare function seq(a: Action, b: Action): Action;
2420
+ /** Navigate then execute */
2421
+ declare function goAndRun(target: NavigationTarget, skill: SkillRef): Action;
2422
+ /** Delegate then observe */
2423
+ declare function delegateAndWatch(assignment: DelegateAssignment, metric: ObserveTarget): Action;
2424
+
2435
2425
  /**
2436
- * Automatically derive an isomorphism between two types based on structure
2437
- *
2438
- * @param sampleA - Sample value of type A
2439
- * @param sampleB - Sample value of type B
2440
- * @param options - Derivation options
2441
- * @returns Derived isomorphism or null if not derivable
2442
- */
2443
- declare function deriveIsomorphism<A extends object, B extends object>(sampleA: A, sampleB: B, options?: DerivationOptions): DerivedIso<A, B> | null;
2444
- /**
2445
- * Verify an isomorphism by testing round-trip on sample values
2446
- *
2447
- * @param iso - Isomorphism to verify
2448
- * @param samples - Sample values to test
2449
- * @returns True if all round-trips match
2450
- */
2451
- declare function verifyIsomorphism<A, B>(iso: Iso<A, B>, samples: A[]): boolean;
2452
- /**
2453
- * Check if two types are structurally compatible for isomorphism
2426
+ * ActionBus Singleton event bus for the Action Algebra
2454
2427
  *
2455
- * @param shapeA - Source type shape
2456
- * @param shapeB - Target type shape
2457
- * @returns Compatibility score (0-1)
2458
- */
2459
- declare function checkCompatibility(shapeA: TypeShape, shapeB: TypeShape): number;
2460
- /**
2461
- * Check if a type can be embedded into another (one-way mapping)
2428
+ * All input surfaces publish ActionEvents here.
2429
+ * The executor and any observers subscribe here.
2462
2430
  *
2463
- * @param source - Source type shape
2464
- * @param target - Target type shape
2465
- * @returns True if source can be fully embedded in target
2431
+ * @module core/primitives/action-bus
2466
2432
  */
2467
- declare function canEmbed(source: TypeShape, target: TypeShape): boolean;
2433
+
2434
+ type ActionBusEvents = {
2435
+ "action:dispatched": ActionEvent;
2436
+ "action:executed": ActionEvent & {
2437
+ result: "success" | "error";
2438
+ error?: string;
2439
+ };
2440
+ "action:cancelled": {
2441
+ reason: string;
2442
+ timestamp: number;
2443
+ };
2444
+ "context:changed": ActionContext;
2445
+ };
2446
+ declare function getActionBus(): TypedEventBus<ActionBusEvents>;
2447
+ declare function dispatchAction(event: ActionEvent): void;
2448
+ declare function onAction(handler: (event: ActionEvent) => void): () => void;
2468
2449
 
2469
2450
  /**
2470
- * L0 SematonThe Smallest Meaning-Bearing Unit
2471
- *
2472
- * The sematon is the atomic unit of operational meaning in Terminals OS.
2473
- * It carries a typed payload, convergence witness, p-adic address,
2474
- * information-theoretic metrics, and a constructor flag that guarantees
2475
- * the Deutsch-Marletto invariant: after transforming an input, the
2476
- * sematon retains the ability to transform again.
2477
- *
2478
- * The sematon unifies Signal<T>, ContextNode, FractalSnapshot,
2479
- * ConvergenceWitness, and CombinatorEvent into a single formal type
2480
- * at the L0 foundation layer.
2451
+ * Mesh SDKEvent emission, subscription, and query
2481
2452
  *
2482
- * Core Engine Primitive.
2453
+ * Cross-layer communication via signals and the action bus.
2454
+ * Hides Interaction primitive internals, SDKMessage, AXON internals.
2483
2455
  *
2484
- * @license BUSL-1.1
2485
2456
  * @copyright © 2026 Intuition Labs LLC. All rights reserved. Patent Pending.
2486
- * @module core/L0/sematon
2487
- */
2488
- /**
2489
- * Payload kind classification for sematons.
2490
- * Determines how the payload is interpreted across layers.
2491
- */
2492
- type SematonKind = "signal" | "context" | "fractal" | "witness" | "combinator" | "interaction" | "custom";
2493
- /**
2494
- * Convergence witness snapshot embedded in a sematon.
2495
- * Minimal subset of ConvergenceWitness for portability.
2457
+ * @module sdk/mesh
2496
2458
  */
2497
- interface SematonWitness {
2498
- /** Kuramoto order parameter R in [0, 1] */
2499
- R: number;
2500
- /** Shannon entropy of activation distribution */
2501
- activationEntropy: number;
2502
- /** Whether convergence criteria are met */
2503
- converged: boolean;
2504
- /** Step at which this witness was taken */
2505
- step: number;
2459
+
2460
+ type mesh_Action = Action;
2461
+ type mesh_ActionBinding = ActionBinding;
2462
+ type mesh_ActionBusEvents = ActionBusEvents;
2463
+ type mesh_ActionContext = ActionContext;
2464
+ type mesh_ActionEvent = ActionEvent;
2465
+ type mesh_InputSurface = InputSurface;
2466
+ type mesh_Signal<T = unknown> = Signal<T>;
2467
+ type mesh_SignalBus = SignalBus;
2468
+ type mesh_SignalHandler<T = unknown> = SignalHandler<T>;
2469
+ type mesh_SignalType = SignalType;
2470
+ declare const mesh_createSignalBus: typeof createSignalBus;
2471
+ declare const mesh_delegateAndWatch: typeof delegateAndWatch;
2472
+ declare const mesh_dispatchAction: typeof dispatchAction;
2473
+ declare const mesh_emitSignal: typeof emitSignal;
2474
+ declare const mesh_getActionBus: typeof getActionBus;
2475
+ declare const mesh_getSignalBus: typeof getSignalBus;
2476
+ declare const mesh_goAndRun: typeof goAndRun;
2477
+ declare const mesh_onAction: typeof onAction;
2478
+ declare const mesh_seq: typeof seq;
2479
+ declare const mesh_subscribeToSignals: typeof subscribeToSignals;
2480
+ declare namespace mesh {
2481
+ export { type mesh_Action as Action, type mesh_ActionBinding as ActionBinding, type mesh_ActionBusEvents as ActionBusEvents, type mesh_ActionContext as ActionContext, type mesh_ActionEvent as ActionEvent, type mesh_InputSurface as InputSurface, type mesh_Signal as Signal, type mesh_SignalBus as SignalBus, type mesh_SignalHandler as SignalHandler, type mesh_SignalType as SignalType, mesh_createSignalBus as createSignalBus, mesh_delegateAndWatch as delegateAndWatch, mesh_dispatchAction as dispatchAction, mesh_emitSignal as emitSignal, mesh_getActionBus as getActionBus, mesh_getSignalBus as getSignalBus, mesh_goAndRun as goAndRun, mesh_onAction as onAction, mesh_seq as seq, mesh_subscribeToSignals as subscribeToSignals };
2506
2482
  }
2507
- /**
2508
- * The Sematon — smallest meaning-bearing unit with operational consequence.
2509
- *
2510
- * Generic over T (the payload type):
2511
- * T = Signal payload at signal kind
2512
- * T = ContextNode metadata at context kind
2513
- * T = FractalSnapshot at fractal kind
2514
- * T = arbitrary at custom kind
2515
- */
2516
- interface Sematon<T = unknown> {
2517
- /** Unique identifier */
2518
- readonly id: string;
2519
- /** Payload kind classification */
2520
- readonly kind: SematonKind;
2521
- /** The meaning-bearing payload */
2522
- readonly payload: T;
2523
- /** Convergence witness at creation time */
2524
- readonly witness: SematonWitness;
2525
- /** p-adic address for hierarchical locality */
2526
- readonly padicAddress: string;
2527
- /** Shannon entropy of payload (bits) */
2528
- readonly entropy: number;
2529
- /** Semantic density (bits per token) */
2530
- readonly density: number;
2531
- /** The resistance to constructive transformation: H / (ρ * R) */
2532
- readonly impedance: number;
2533
- /** Deterministic content hash (FNV-1a) */
2534
- readonly shapeHash: string;
2535
- /**
2536
- * Constructor flag: can this sematon participate in further transformations?
2537
- * True iff: witness has converged AND entropy is finite AND payload is non-empty.
2538
- * This is the Deutsch-Marletto invariant.
2539
- */
2540
- readonly constructive: boolean;
2541
- /** Creation timestamp */
2542
- readonly createdAt: number;
2543
- /** Source layer or surface that produced this sematon */
2544
- readonly source: string;
2483
+
2484
+ type brain_CoherenceConfig = CoherenceConfig;
2485
+ type brain_CoherenceInput = CoherenceInput;
2486
+ type brain_CoherenceMetrics = CoherenceMetrics;
2487
+ type brain_CoherenceResult = CoherenceResult;
2488
+ type brain_KuramotoStepOptions = KuramotoStepOptions;
2489
+ type brain_OrderParameter = OrderParameter;
2490
+ declare const brain_calculateCoherence: typeof calculateCoherence;
2491
+ declare const brain_calculateCoherenceWithExplanations: typeof calculateCoherenceWithExplanations;
2492
+ declare const brain_getCoherenceSuggestions: typeof getCoherenceSuggestions;
2493
+ declare const brain_isCoherent: typeof isCoherent;
2494
+ declare const brain_kuramotoStep: typeof kuramotoStep;
2495
+ declare const brain_orderParameter: typeof orderParameter;
2496
+ declare const brain_phaseLockingValue: typeof phaseLockingValue;
2497
+ declare const brain_wrapTo2Pi: typeof wrapTo2Pi;
2498
+ declare const brain_wrapToPi: typeof wrapToPi;
2499
+ declare namespace brain {
2500
+ export { type brain_CoherenceConfig as CoherenceConfig, type brain_CoherenceInput as CoherenceInput, type brain_CoherenceMetrics as CoherenceMetrics, type brain_CoherenceResult as CoherenceResult, type brain_KuramotoStepOptions as KuramotoStepOptions, type brain_OrderParameter as OrderParameter, brain_calculateCoherence as calculateCoherence, brain_calculateCoherenceWithExplanations as calculateCoherenceWithExplanations, brain_getCoherenceSuggestions as getCoherenceSuggestions, brain_isCoherent as isCoherent, brain_kuramotoStep as kuramotoStep, brain_orderParameter as orderParameter, brain_phaseLockingValue as phaseLockingValue, brain_wrapTo2Pi as wrapTo2Pi, brain_wrapToPi as wrapToPi };
2545
2501
  }
2502
+
2546
2503
  /**
2547
- * Folded (serializable) representation of a Sematon.
2548
- * Suitable for JSON serialization, mesh relay, or persistence.
2504
+ * Agent Communication Bus in-memory message passing for skill agents.
2505
+ *
2506
+ * Scoped per skill run. Agents publish findings, review requests, and
2507
+ * delegation requests. Downstream agents receive accumulated context
2508
+ * via their system prompt.
2509
+ *
2510
+ * @module skills/agent-bus
2549
2511
  */
2550
- interface FoldedSematon {
2551
- id: string;
2552
- kind: SematonKind;
2512
+ type AgentMessageType = "finding" | "question" | "review_request" | "review_response" | "delegation_request" | "delegation_response";
2513
+ interface AgentMessage {
2514
+ fromAgent: string;
2515
+ toAgent?: string;
2516
+ type: AgentMessageType;
2553
2517
  payload: string;
2554
- witness: SematonWitness;
2555
- padicAddress: string;
2556
- entropy: number;
2557
- density: number;
2558
- impedance: number;
2559
- shapeHash: string;
2560
- constructive: boolean;
2561
- createdAt: number;
2562
- source: string;
2518
+ timestamp: number;
2519
+ runId: string;
2563
2520
  }
2564
- interface SematonConfig<T> {
2565
- kind: SematonKind;
2566
- payload: T;
2567
- witness: SematonWitness;
2568
- padicAddress?: string;
2569
- source?: string;
2521
+ type MessageHandler = (msg: AgentMessage) => void;
2522
+ interface AgentBus {
2523
+ publish(msg: AgentMessage): void;
2524
+ query(filter: {
2525
+ fromAgent?: string;
2526
+ type?: string;
2527
+ }): AgentMessage[];
2528
+ subscribe(agentId: string, handler: MessageHandler): () => void;
2529
+ getAll(): AgentMessage[];
2570
2530
  }
2571
2531
  /**
2572
- * Create a new Sematon from configuration.
2573
- */
2574
- declare function createSematon<T>(config: SematonConfig<T>): Sematon<T>;
2575
- /**
2576
- * Get the Shannon entropy of a sematon's payload.
2532
+ * Create an AgentBus scoped to a single skill run.
2533
+ * Messages are stored in-memory (array). No persistence needed —
2534
+ * the bus lifetime matches the SkillRunner instance.
2577
2535
  */
2578
- declare function sematonEntropy<T>(sematon: Sematon<T>): number;
2536
+ declare function createAgentBus(runId: string): AgentBus;
2537
+
2579
2538
  /**
2580
- * Get the semantic density of a sematon.
2539
+ * Protocol SDK MCP and A2A protocol connections
2540
+ *
2541
+ * Delegation primitives and agent communication types.
2542
+ * Hides MCP client lifecycle, A2A internals.
2543
+ *
2544
+ * @copyright © 2026 Intuition Labs LLC. All rights reserved. Patent Pending.
2545
+ * @module sdk/protocol
2581
2546
  */
2582
- declare function sematonDensity<T>(sematon: Sematon<T>): number;
2547
+
2548
+ type protocol_AgentBus = AgentBus;
2549
+ type protocol_AgentMessage = AgentMessage;
2550
+ type protocol_AgentMessageType = AgentMessageType;
2551
+ type protocol_DelegationChain = DelegationChain;
2552
+ type protocol_DelegationEdge<S = SurfaceId, T = SurfaceId> = DelegationEdge<S, T>;
2553
+ type protocol_DelegationEdgeInput<S = SurfaceId, T = SurfaceId> = DelegationEdgeInput<S, T>;
2554
+ type protocol_DelegationEndpoint<S = SurfaceId> = DelegationEndpoint<S>;
2555
+ declare const protocol_createAgentBus: typeof createAgentBus;
2556
+ declare const protocol_createDelegationChain: typeof createDelegationChain;
2557
+ declare const protocol_createDelegationEdge: typeof createDelegationEdge;
2558
+ declare const protocol_isValidSurfaceId: typeof isValidSurfaceId;
2559
+ declare namespace protocol {
2560
+ export { type protocol_AgentBus as AgentBus, type protocol_AgentMessage as AgentMessage, type protocol_AgentMessageType as AgentMessageType, type protocol_DelegationChain as DelegationChain, type protocol_DelegationEdge as DelegationEdge, type protocol_DelegationEdgeInput as DelegationEdgeInput, type protocol_DelegationEndpoint as DelegationEndpoint, protocol_createAgentBus as createAgentBus, protocol_createDelegationChain as createDelegationChain, protocol_createDelegationEdge as createDelegationEdge, protocol_isValidSurfaceId as isValidSurfaceId };
2561
+ }
2562
+
2583
2563
  /**
2584
- * Check if a sematon can participate in further transformations.
2585
- * This is the Deutsch-Marletto constructor invariant.
2564
+ * Trigger Type System
2565
+ *
2566
+ * Canonical discriminated-union types for all stack trigger mechanisms.
2567
+ * A trigger defines *when* and *how* a stack run is initiated.
2568
+ *
2569
+ * Usage:
2570
+ * - StackManifestV0.triggerConfig holds the declared trigger for a stack.
2571
+ * - TriggerContext is injected into every run so downstream nodes can inspect
2572
+ * how the execution was started.
2573
+ * - NodeSecretRef lets webhook triggers reference vault-backed HMAC keys
2574
+ * through the provider control plane instead of inline secrets.
2575
+ *
2576
+ * @module machines/core/types/trigger
2586
2577
  */
2587
- declare function isRealizable<T>(sematon: Sematon<T>): boolean;
2578
+
2579
+ /** Run the stack on a fixed time interval. */
2580
+ interface IntervalTriggerConfig {
2581
+ kind: "interval";
2582
+ /** Seconds between runs. Minimum enforced at 1. */
2583
+ everySeconds: number;
2584
+ }
2588
2585
  /**
2589
- * Compute distance between two sematons using payload cosine similarity
2590
- * weighted by witness R proximity.
2586
+ * Run the stack on a standard 5-field cron schedule.
2591
2587
  *
2592
- * Distance in [0, 1] where 0 = identical, 1 = maximally different.
2588
+ * The expression follows the POSIX/Vixie-cron syntax:
2589
+ * `minute hour day-of-month month day-of-week`
2590
+ *
2591
+ * @example "0 9 * * 1-5" // weekdays at 09:00 UTC
2592
+ * @example "* /15 * * * *" // every 15 minutes (non-standard extended form)
2593
2593
  */
2594
- declare function sematonDistance<T>(a: Sematon<T>, b: Sematon<T>): number;
2594
+ interface CronTriggerConfig {
2595
+ kind: "cron";
2596
+ /** Standard 5-field cron expression. */
2597
+ expression: string;
2598
+ /** IANA timezone name (default: "UTC"). */
2599
+ timezone?: string;
2600
+ }
2595
2601
  /**
2596
- * Fold a Sematon into a JSON-serializable representation.
2597
- * HVM γ (construct) — compress for handoff, persistence, or relay.
2602
+ * Run the stack when an inbound HTTP webhook is received.
2603
+ *
2604
+ * Secret verification:
2605
+ * - Use `secretRef` for production — the key stays server-side.
2606
+ * - Use the inline `secret` field only for dev/test environments.
2598
2607
  */
2599
- declare function foldSematon<T>(sematon: Sematon<T>): FoldedSematon;
2608
+ interface WebhookTriggerConfig {
2609
+ kind: "webhook";
2610
+ /** Relative path segment appended to the stack webhook base URL. */
2611
+ path?: string;
2612
+ /** Accepted HTTP method (default: "POST"). */
2613
+ method?: "GET" | "POST" | "PUT" | "PATCH";
2614
+ /**
2615
+ * Inline HMAC signing secret.
2616
+ * Production deployments should prefer `secretRef` to keep the value
2617
+ * server-side in the Supabase vault.
2618
+ */
2619
+ secret?: string;
2620
+ /** Vault-backed secret reference for the HMAC signing key. */
2621
+ secretRef?: NodeSecretRef;
2622
+ }
2600
2623
  /**
2601
- * Unfold a serialized representation back into a Sematon.
2602
- * HVM δ (duplicate) — expand from handoff, persistence, or relay.
2624
+ * Run the stack when a matching AXON event is published on the given topic.
2625
+ *
2626
+ * AXON cross-layer events are published via `system.signal.emit.v1` nodes or
2627
+ * directly through the AXON kernel. The filter is applied against the event
2628
+ * payload before dispatching.
2603
2629
  */
2604
- declare function unfoldSematon<T>(folded: FoldedSematon): Sematon<T>;
2630
+ interface EventTriggerConfig {
2631
+ kind: "event";
2632
+ /** AXON event topic string (e.g. "brain.index.complete", "user.action.*"). */
2633
+ topic: string;
2634
+ /**
2635
+ * Optional shallow equality filter applied to the event payload.
2636
+ * Only events whose payload contains all key-value pairs in this map
2637
+ * will dispatch the stack run.
2638
+ */
2639
+ filter?: Record<string, unknown>;
2640
+ }
2641
+ /** Run the stack only when explicitly requested via the API or UI. */
2642
+ interface ManualTriggerConfig {
2643
+ kind: "manual";
2644
+ }
2645
+ /** Discriminated union over all trigger kinds. */
2646
+ type TriggerConfig = IntervalTriggerConfig | CronTriggerConfig | WebhookTriggerConfig | EventTriggerConfig | ManualTriggerConfig;
2605
2647
 
2606
2648
  /**
2607
- * L0 Realizability Trace Constructor Proof Runtime
2649
+ * Runtime tier for node execution.
2608
2650
  *
2609
- * A RealizabilityTrace is an ordered sequence of RealizabilitySteps.
2610
- * Each step records: input Sematon(s), output Sematon(s), a ConvergenceWitness
2611
- * snapshot, and information gain.
2651
+ * Defines the execution environment for computational nodes:
2652
+ * - `worker`: Web Worker/service worker
2653
+ * - `container-lite`: Lightweight containerized runtime
2654
+ * - `webcontainer`: Browser-based container (WebAssembly)
2655
+ * - `edge`: Edge function/serverless
2656
+ * - `wasm-hvm`: WebAssembly with HVM (Higher-order Virtual Machine)
2657
+ * - `stack`: Nested stack execution
2612
2658
  *
2613
- * verifyTrace() checks three constructor invariants:
2614
- * 1. Each input was realizable (constructive flag true)
2615
- * 2. Each witness converged (R above threshold)
2616
- * 3. Information is non-decreasing across steps
2659
+ * @example
2660
+ * const tier: RuntimeTier = "worker";
2661
+ */
2662
+ type RuntimeTier = "worker" | "container-lite" | "webcontainer" | "edge" | "wasm-hvm" | "stack";
2663
+ /**
2664
+ * Secret reference for node execution.
2617
2665
  *
2618
- * This is the Deutsch-Marletto constructor invariant made executable:
2619
- * after transforming inputs, the system retains the ability to transform again.
2666
+ * Links a secret from the vault into node environment.
2620
2667
  *
2621
- * @license BUSL-1.1
2622
- * @copyright © 2026 Intuition Labs LLC. All rights reserved. Patent Pending.
2623
- * @module core/L0/realizability
2668
+ * @example
2669
+ * const secret: NodeSecretRef = {
2670
+ * name: "api_key",
2671
+ * scope: "stack",
2672
+ * env: "OPENAI_API_KEY",
2673
+ * required: true
2674
+ * };
2624
2675
  */
2625
-
2626
- interface RealizabilityStep {
2627
- /** Step index in the trace */
2628
- index: number;
2629
- /** Input sematons consumed by this step */
2630
- inputs: Sematon[];
2631
- /** Output sematons produced by this step */
2632
- outputs: Sematon[];
2633
- /** Convergence witness at this step */
2634
- witness: SematonWitness;
2635
- /** Total information content of outputs (bits) */
2636
- informationGain: number;
2637
- /** Timestamp */
2638
- timestamp: number;
2676
+ interface NodeSecretRef {
2677
+ /** Secret identifier in vault */
2678
+ name: string;
2679
+ /** Resolution scope: node-local or stack-wide */
2680
+ scope: "node" | "stack";
2681
+ /** Environment variable name (defaults to name if omitted) */
2682
+ env?: string;
2683
+ /** Whether secret must exist (default: false) */
2684
+ required?: boolean;
2639
2685
  }
2640
- interface RealizabilityTrace {
2641
- /** Unique trace identifier */
2686
+ /**
2687
+ * Base manifest fields shared by nodes and stacks.
2688
+ *
2689
+ * @internal
2690
+ */
2691
+ interface BaseManifestV0 {
2692
+ /** Unique identifier (must be stable across versions) */
2642
2693
  id: string;
2643
- /** Ordered sequence of steps */
2644
- steps: RealizabilityStep[];
2645
- /** Whether the trace has been verified */
2646
- verified: boolean;
2647
- /** Total information gain across all steps */
2648
- totalInfoGain: number;
2649
- /** Count of constructive (realizable) steps */
2650
- constructiveSteps: number;
2651
- /** Creation timestamp */
2652
- createdAt: number;
2694
+ /** Semantic version (e.g., "1.0.0") */
2695
+ version: string;
2696
+ /** Human-readable name */
2697
+ name?: string;
2698
+ /** Description of functionality */
2699
+ description?: string;
2700
+ /** Security and resource policies */
2701
+ policies?: NodePolicy | StackPolicies;
2702
+ /** Arbitrary metadata for extensions */
2703
+ metadata?: Record<string, unknown>;
2653
2704
  }
2654
- interface VerificationSuccess {
2655
- valid: true;
2656
- totalInfoGain: number;
2657
- constructiveSteps: number;
2705
+ /**
2706
+ * Stack-level secret scope definition.
2707
+ *
2708
+ * Defines which nodes can access a secret.
2709
+ *
2710
+ * @example
2711
+ * const secretScope: StackSecretScope = {
2712
+ * scope: ["fetch-node", "transform-node"],
2713
+ * required: true
2714
+ * };
2715
+ */
2716
+ interface StackSecretScope {
2717
+ /** Node IDs that can access this secret */
2718
+ scope: string[];
2719
+ /** Whether secret must exist */
2720
+ required?: boolean;
2658
2721
  }
2659
- interface VerificationFailure {
2660
- valid: false;
2661
- failureStep: number;
2662
- reason: string;
2722
+ /**
2723
+ * Stack-level runtime tier configuration.
2724
+ *
2725
+ * Allows stack-wide defaults with per-node overrides.
2726
+ *
2727
+ * @example
2728
+ * const runtimes: StackRuntimes = {
2729
+ * default: ["worker", "edge"],
2730
+ * overrides: {
2731
+ * "heavy-compute": ["container-lite"]
2732
+ * }
2733
+ * };
2734
+ */
2735
+ interface StackRuntimes {
2736
+ /** Default runtime tiers for all nodes */
2737
+ default?: RuntimeTier[];
2738
+ /** Per-node runtime tier overrides (nodeId -> tiers) */
2739
+ overrides?: Record<string, RuntimeTier[]>;
2663
2740
  }
2664
- type VerificationResult = VerificationSuccess | VerificationFailure;
2665
2741
  /**
2666
- * Create a single realizability step.
2667
- * Computes informationGain as the sum of output sematon entropies.
2742
+ * Reference from a stack node to a brain connector instance.
2743
+ *
2744
+ * Binds the connector's extracted data chunks into this node's input,
2745
+ * allowing RAG / knowledge-graph results to flow into the execution graph.
2668
2746
  */
2669
- declare function createRealizabilityStep(index: number, inputs: Sematon[], outputs: Sematon[], witness: SematonWitness): RealizabilityStep;
2747
+ interface ConnectorRef {
2748
+ /** ID of the ConnectorInstance in the brain pipeline. */
2749
+ connectorId: string;
2750
+ /** ID of the ConnectorDefinition (catalog entry). */
2751
+ definitionId: string;
2752
+ /**
2753
+ * Optional shallow filter applied to DataChunks from this connector.
2754
+ * Only chunks whose metadata contains all key-value pairs in this map
2755
+ * will be included.
2756
+ */
2757
+ dataChunkFilter?: Record<string, unknown>;
2758
+ }
2670
2759
  /**
2671
- * Construct a RealizabilityTrace from an ordered sequence of steps.
2672
- * Computes totalInfoGain and constructiveSteps.
2760
+ * Node configuration within a stack.
2761
+ *
2762
+ * References a node manifest and provides instance-specific config.
2763
+ *
2764
+ * @example
2765
+ * const nodeConfig: StackNodeConfig = {
2766
+ * id: "fetch-1",
2767
+ * nodeRef: "http-fetch",
2768
+ * config: { timeout: 5000 },
2769
+ * runtimes: ["edge"],
2770
+ * secrets: ["api_key"]
2771
+ * };
2673
2772
  */
2674
- declare function traceRealizability(steps: RealizabilityStep[]): RealizabilityTrace;
2773
+ interface StackNodeConfig {
2774
+ /** Unique ID within stack */
2775
+ id: string;
2776
+ /** Reference to NodeManifestV0.id */
2777
+ nodeRef: string;
2778
+ /** Node-specific configuration */
2779
+ config?: Record<string, unknown>;
2780
+ /** Runtime tier override */
2781
+ runtimes?: RuntimeTier[];
2782
+ /** Security policy override */
2783
+ policies?: NodePolicy;
2784
+ /** Secret names from stack.secrets */
2785
+ secrets?: string[];
2786
+ /**
2787
+ * Reference to a brain connector whose data chunks feed this node.
2788
+ * The orchestrator resolves this at run-time before invoking the node.
2789
+ */
2790
+ connectorRef?: ConnectorRef;
2791
+ }
2675
2792
  /**
2676
- * Verify a realizability trace against three constructor invariants:
2677
- * 1. Each step's inputs must all be realizable
2678
- * 2. Each step's witness must have converged
2679
- * 3. Information is non-decreasing across steps
2793
+ * Directed edge connecting two nodes in the stack DAG.
2680
2794
  *
2681
- * Returns VerificationSuccess or VerificationFailure with step index and reason.
2795
+ * Defines data flow from one node's outputs to another's inputs.
2796
+ *
2797
+ * @example
2798
+ * const edge: StackEdge = {
2799
+ * from: "fetch-1",
2800
+ * to: "transform-1",
2801
+ * map: { "data": "input" }
2802
+ * };
2682
2803
  */
2683
- declare function verifyTrace(trace: RealizabilityTrace): VerificationResult;
2804
+ interface StackEdge {
2805
+ /** Source node ID */
2806
+ from: string;
2807
+ /** Target node ID */
2808
+ to: string;
2809
+ /** Output-to-input key mapping (defaults to identity) */
2810
+ map?: Record<string, string>;
2811
+ }
2684
2812
  /**
2685
- * Fold a RealizabilityTrace into a JSON string.
2686
- * Sematons are folded via foldSematon first for portable serialization.
2813
+ * Manifest layer provenance.
2814
+ *
2815
+ * - `L0`: Landing/Zero layer (low-level primitives)
2816
+ * - `L1`: Compose/Platform layer (higher-level abstractions)
2687
2817
  */
2688
- declare function foldTrace(trace: RealizabilityTrace): string;
2818
+ type ManifestLayer = "L0" | "L1" | "L2" | "L3" | "L4" | "L5";
2689
2819
  /**
2690
- * Unfold a JSON string back into a RealizabilityTrace.
2691
- * Sematons are unfolded via unfoldSematon.
2820
+ * Stack manifest for DAG orchestrator.
2821
+ *
2822
+ * Defines a complete workflow as a directed acyclic graph (DAG) of nodes.
2823
+ *
2824
+ * @example
2825
+ * const stack: StackManifestV0 = {
2826
+ * id: "data-pipeline",
2827
+ * version: "1.0.0",
2828
+ * nodes: [
2829
+ * { id: "fetch", nodeRef: "http-fetch", config: { url: "..." } },
2830
+ * { id: "transform", nodeRef: "llm-transform" }
2831
+ * ],
2832
+ * edges: [
2833
+ * { from: "fetch", to: "transform", map: { data: "input" } }
2834
+ * ],
2835
+ * secrets: {
2836
+ * api_key: { scope: ["fetch"], required: true }
2837
+ * }
2838
+ * };
2692
2839
  */
2693
- declare function unfoldTrace(json: string): RealizabilityTrace;
2840
+ interface StackManifestV0 extends BaseManifestV0 {
2841
+ /** Node instances in this stack */
2842
+ nodes: StackNodeConfig[];
2843
+ /** Edges connecting nodes (data flow) */
2844
+ edges?: StackEdge[];
2845
+ /** Stack-level secret definitions */
2846
+ secrets?: Record<string, StackSecretScope>;
2847
+ /** Runtime tier configuration */
2848
+ runtimes?: StackRuntimes;
2849
+ /** Provenance layer (L0 or L1) */
2850
+ layer?: ManifestLayer;
2851
+ /**
2852
+ * Declared trigger for this stack.
2853
+ *
2854
+ * Defines when and how the stack is automatically started.
2855
+ * The orchestrator and scheduler use this at registration time.
2856
+ * When absent, the stack is manual-only.
2857
+ */
2858
+ triggerConfig?: TriggerConfig;
2859
+ }
2694
2860
 
2695
2861
  /**
2696
- * L0 Foundation Layer
2862
+ * Skill Manifest Types (L1)
2697
2863
  *
2698
- * Provides categorical foundations and information-theoretic primitives
2699
- * for cross-layer mappings in the AXON architecture.
2864
+ * Core types for the Skills Platform. A SkillManifest extends StackManifestV0
2865
+ * with skill-specific metadata a skill IS a stack with agent orchestration.
2700
2866
  *
2701
- * @module core/L0
2867
+ * @module skills/types
2702
2868
  */
2703
2869
 
2704
- type index_AsyncIso<A, B> = AsyncIso<A, B>;
2705
- type index_AsyncMorphism<A, B> = AsyncMorphism<A, B>;
2706
- type index_Category<Obj, Hom> = Category<Obj, Hom>;
2707
- type index_Coproduct<A, B> = Coproduct<A, B>;
2708
- type index_DerivationOptions = DerivationOptions;
2709
- type index_DerivedIso<A, B> = DerivedIso<A, B>;
2710
- type index_Embed<A, B> = Embed<A, B>;
2711
- type index_FieldMapping = FieldMapping;
2712
- type index_FoldedSematon = FoldedSematon;
2713
- type index_Functor<F> = Functor<F>;
2714
- type index_InformationPreservation = InformationPreservation;
2715
- type index_Iso<A, B> = Iso<A, B>;
2716
- type index_IsoMeta = IsoMeta;
2717
- declare const index_LAYERS: typeof LAYERS;
2718
- type index_LayerBridge<From extends LayerId, To extends LayerId, A, B> = LayerBridge<From, To, A, B>;
2719
- type index_LayerId = LayerId;
2720
- type index_LayerMeta = LayerMeta;
2721
- type index_Morphism<A, B> = Morphism<A, B>;
2722
- type index_NaturalTransformation<F, G> = NaturalTransformation<F, G>;
2723
- type index_Product<A, B> = Product<A, B>;
2724
- type index_Proof<P> = Proof<P>;
2725
- type index_RealizabilityStep = RealizabilityStep;
2726
- type index_RealizabilityTrace = RealizabilityTrace;
2727
- type index_SemanticDensity = SemanticDensity;
2728
- type index_Sematon<T = unknown> = Sematon<T>;
2729
- type index_SematonConfig<T> = SematonConfig<T>;
2730
- type index_SematonKind = SematonKind;
2731
- type index_SematonWitness = SematonWitness;
2732
- type index_TypeShape = TypeShape;
2733
- declare const index_VALID_TRANSITIONS: typeof VALID_TRANSITIONS;
2734
- type index_VerificationFailure = VerificationFailure;
2735
- type index_VerificationResult = VerificationResult;
2736
- type index_VerificationSuccess = VerificationSuccess;
2737
- type index_Verified<T, P> = Verified<T, P>;
2738
- declare const index_calculateSemanticDensity: typeof calculateSemanticDensity;
2739
- declare const index_canEmbed: typeof canEmbed;
2740
- declare const index_checkCompatibility: typeof checkCompatibility;
2741
- declare const index_compose: typeof compose;
2742
- declare const index_composeAsync: typeof composeAsync;
2743
- declare const index_composeIso: typeof composeIso;
2744
- declare const index_conditionalEntropy: typeof conditionalEntropy;
2745
- declare const index_cosineSimilarity: typeof cosineSimilarity;
2746
- declare const index_createBridge: typeof createBridge;
2747
- declare const index_createRealizabilityStep: typeof createRealizabilityStep;
2748
- declare const index_createSematon: typeof createSematon;
2749
- declare const index_deriveFieldMappings: typeof deriveFieldMappings;
2750
- declare const index_deriveIsomorphism: typeof deriveIsomorphism;
2751
- declare const index_entropy: typeof entropy;
2752
- declare const index_estimateComplexity: typeof estimateComplexity;
2753
- declare const index_extractShape: typeof extractShape;
2754
- declare const index_fold: typeof fold;
2755
- declare const index_foldSematon: typeof foldSematon;
2756
- declare const index_foldTrace: typeof foldTrace;
2757
- declare const index_identity: typeof identity;
2758
- declare const index_identityIso: typeof identityIso;
2759
- declare const index_invertIso: typeof invertIso;
2760
- declare const index_isRealizable: typeof isRealizable;
2761
- declare const index_isValidTransition: typeof isValidTransition;
2762
- declare const index_jointEntropy: typeof jointEntropy;
2763
- declare const index_jsDivergence: typeof jsDivergence;
2764
- declare const index_klDivergence: typeof klDivergence;
2765
- declare const index_left: typeof left;
2766
- declare const index_measurePreservation: typeof measurePreservation;
2767
- declare const index_mutualInformation: typeof mutualInformation;
2768
- declare const index_normalize: typeof normalize;
2769
- declare const index_right: typeof right;
2770
- declare const index_sematonDensity: typeof sematonDensity;
2771
- declare const index_sematonDistance: typeof sematonDistance;
2772
- declare const index_sematonEntropy: typeof sematonEntropy;
2773
- declare const index_shapeSimilarity: typeof shapeSimilarity;
2774
- declare const index_traceRealizability: typeof traceRealizability;
2775
- declare const index_unfoldSematon: typeof unfoldSematon;
2776
- declare const index_unfoldTrace: typeof unfoldTrace;
2777
- declare const index_verifyIsomorphism: typeof verifyIsomorphism;
2778
- declare const index_verifyTrace: typeof verifyTrace;
2779
- declare namespace index {
2780
- export { type index_AsyncIso as AsyncIso, type index_AsyncMorphism as AsyncMorphism, type index_Category as Category, type index_Coproduct as Coproduct, type index_DerivationOptions as DerivationOptions, type index_DerivedIso as DerivedIso, type index_Embed as Embed, type index_FieldMapping as FieldMapping, type index_FoldedSematon as FoldedSematon, type index_Functor as Functor, type index_InformationPreservation as InformationPreservation, type index_Iso as Iso, type index_IsoMeta as IsoMeta, index_LAYERS as LAYERS, type index_LayerBridge as LayerBridge, type index_LayerId as LayerId, type index_LayerMeta as LayerMeta, type index_Morphism as Morphism, type index_NaturalTransformation as NaturalTransformation, type index_Product as Product, type index_Proof as Proof, type index_RealizabilityStep as RealizabilityStep, type index_RealizabilityTrace as RealizabilityTrace, type index_SemanticDensity as SemanticDensity, type index_Sematon as Sematon, type index_SematonConfig as SematonConfig, type index_SematonKind as SematonKind, type index_SematonWitness as SematonWitness, type index_TypeShape as TypeShape, index_VALID_TRANSITIONS as VALID_TRANSITIONS, type index_VerificationFailure as VerificationFailure, type index_VerificationResult as VerificationResult, type index_VerificationSuccess as VerificationSuccess, type index_Verified as Verified, index_calculateSemanticDensity as calculateSemanticDensity, index_canEmbed as canEmbed, index_checkCompatibility as checkCompatibility, index_compose as compose, index_composeAsync as composeAsync, index_composeIso as composeIso, index_conditionalEntropy as conditionalEntropy, index_cosineSimilarity as cosineSimilarity, index_createBridge as createBridge, index_createRealizabilityStep as createRealizabilityStep, index_createSematon as createSematon, index_deriveFieldMappings as deriveFieldMappings, index_deriveIsomorphism as deriveIsomorphism, index_entropy as entropy, index_estimateComplexity as estimateComplexity, index_extractShape as extractShape, index_fold as fold, index_foldSematon as foldSematon, index_foldTrace as foldTrace, index_identity as identity, index_identityIso as identityIso, index_invertIso as invertIso, index_isRealizable as isRealizable, index_isValidTransition as isValidTransition, index_jointEntropy as jointEntropy, index_jsDivergence as jsDivergence, index_klDivergence as klDivergence, index_left as left, index_measurePreservation as measurePreservation, index_mutualInformation as mutualInformation, index_normalize as normalize, index_right as right, index_sematonDensity as sematonDensity, index_sematonDistance as sematonDistance, index_sematonEntropy as sematonEntropy, index_shapeSimilarity as shapeSimilarity, index_traceRealizability as traceRealizability, index_unfoldSematon as unfoldSematon, index_unfoldTrace as unfoldTrace, index_verifyIsomorphism as verifyIsomorphism, index_verifyTrace as verifyTrace };
2870
+ type SkillCategory = "startup" | "legal" | "finance" | "engineering" | "content" | "research" | "operations" | "marketing" | "verification";
2871
+ type SkillOutputType = "document" | "website" | "spreadsheet" | "presentation" | "codebase" | "analysis" | "dataset" | "visual" | "video" | "audio" | "composite";
2872
+ declare const SKILL_CATEGORIES: readonly SkillCategory[];
2873
+ declare const SKILL_TIERS: readonly ["flagship", "professional", "utility"];
2874
+ type SkillTier = (typeof SKILL_TIERS)[number];
2875
+ declare const SKILL_RANKS: readonly ["skill", "flow", "fleet", "org", "society"];
2876
+ type SkillRank = (typeof SKILL_RANKS)[number];
2877
+ /** Effective-dated rank assignment — immutable audit trail */
2878
+ interface RankAssignment {
2879
+ /** Current rank */
2880
+ rank: SkillRank;
2881
+ /** ISO 8601 timestamp when this rank became effective */
2882
+ effectiveFrom: string;
2883
+ /** ISO 8601 timestamp when this rank was superseded (null = current) */
2884
+ effectiveTo: string | null;
2885
+ /** Evidence that promotion invariants were satisfied */
2886
+ proof?: PromotionProof;
2781
2887
  }
2782
-
2783
2888
  /**
2784
- * Action AlgebraInput-Agnostic Action Types
2785
- *
2786
- * All input surfaces (keyboard, gamepad, voice, touch) compile down to this algebra.
2787
- * All executors interpret this algebra into effects.
2788
- *
2789
- * @module core/primitives/action
2889
+ * Promotion proofthe Curry-Howard witness type.
2890
+ * Each promotion requires structural evidence that the entity
2891
+ * satisfies the invariants of the target rank.
2790
2892
  */
2791
-
2792
- type NavigationTarget = {
2793
- kind: "surface";
2794
- surface: SurfaceId;
2795
- } | {
2796
- kind: "tab";
2797
- tab: string;
2798
- } | {
2799
- kind: "route";
2800
- path: string;
2801
- params?: Record<string, string>;
2802
- } | {
2803
- kind: "focus";
2804
- elementId: string;
2805
- } | {
2806
- kind: "relative";
2807
- direction: "up" | "down" | "left" | "right";
2808
- };
2809
- type SkillRef = {
2810
- kind: "slug";
2811
- slug: string;
2812
- } | {
2813
- kind: "id";
2814
- id: string;
2815
- } | {
2816
- kind: "command";
2817
- commandId: string;
2818
- };
2819
- interface ComposeEdge {
2820
- sourceId: string;
2821
- targetId: string;
2822
- port?: string;
2823
- }
2824
- type ObserveTarget = {
2825
- kind: "metric";
2826
- metricId: string;
2827
- } | {
2828
- kind: "panel";
2829
- panelId: string;
2830
- } | {
2831
- kind: "surface";
2832
- surface: SurfaceId;
2833
- };
2834
- interface DelegateAssignment {
2835
- agentId: string;
2836
- taskDescription: string;
2837
- context?: Record<string, unknown>;
2838
- }
2839
- type Action = {
2840
- verb: "navigate";
2841
- target: NavigationTarget;
2842
- } | {
2843
- verb: "execute";
2844
- skill: SkillRef;
2845
- args?: Record<string, unknown>;
2846
- } | {
2847
- verb: "compose";
2848
- edge: ComposeEdge;
2849
- } | {
2850
- verb: "observe";
2851
- target: ObserveTarget;
2852
- zoom?: number;
2853
- } | {
2854
- verb: "delegate";
2855
- assignment: DelegateAssignment;
2856
- } | {
2857
- verb: "palette";
2858
- query?: string;
2859
- } | {
2860
- verb: "cancel";
2861
- } | {
2862
- verb: "undo";
2863
- } | {
2864
- verb: "redo";
2865
- } | {
2866
- verb: "sequence";
2867
- actions: Action[];
2868
- };
2869
- type InputSurface = "keyboard" | "gamepad" | "voice" | "touch" | "command_palette";
2870
- interface ActionEvent {
2871
- action: Action;
2872
- source: InputSurface;
2873
- timestamp: number;
2874
- inputTrace?: string[];
2893
+ interface PromotionProof {
2894
+ /** Source rank */
2895
+ from: SkillRank;
2896
+ /** Target rank */
2897
+ to: SkillRank;
2898
+ /** Structural invariant checks that passed */
2899
+ invariants: PromotionInvariant[];
2900
+ /** Timestamp of promotion evaluation */
2901
+ evaluatedAt: string;
2902
+ /** Quality score at time of promotion (0-1) */
2903
+ qualityScore: number;
2875
2904
  }
2876
- interface ActionContext {
2877
- activeSurface: SurfaceId;
2878
- activeTab: string;
2879
- selection: string[];
2880
- isTextFocused: boolean;
2881
- isModalOpen: boolean;
2905
+ interface PromotionInvariant {
2906
+ /** Invariant name (e.g., "has_convergence", "has_3_plus_skills", "has_mesh_events") */
2907
+ name: string;
2908
+ /** Whether this invariant was satisfied */
2909
+ satisfied: boolean;
2910
+ /** Human-readable evidence */
2911
+ evidence?: string;
2882
2912
  }
2883
- type ActionPredicate = (ctx: ActionContext) => boolean;
2884
- interface KeyboardTrigger {
2885
- type: "chord" | "key" | "sequence";
2886
- keys: string[];
2887
- timeout?: number;
2913
+ interface SkillCapabilities {
2914
+ /** Allow image generation via connected media providers */
2915
+ allowImageGen?: boolean;
2916
+ /** Allow video generation via connected media providers */
2917
+ allowVideoGen?: boolean;
2918
+ /** Allow MCP tool access during execution */
2919
+ allowTools?: boolean;
2920
+ /** Allow web search during execution */
2921
+ allowWebSearch?: boolean;
2922
+ /** Allow code execution in sandbox */
2923
+ allowCodeExec?: boolean;
2888
2924
  }
2889
- type GamepadButton = "a" | "b" | "x" | "y" | "lb" | "rb" | "lt" | "rt" | "back" | "start" | "ls" | "rs" | "dpad_up" | "dpad_down" | "dpad_left" | "dpad_right";
2890
- interface GamepadTrigger {
2891
- type: "button" | "combo" | "axis";
2892
- buttons?: GamepadButton[];
2893
- sequence?: {
2894
- button: GamepadButton;
2895
- holdMs?: number;
2896
- }[];
2897
- axis?: {
2898
- stick: "left" | "right";
2899
- direction: "up" | "down" | "left" | "right";
2900
- threshold?: number;
2901
- };
2925
+ interface SkillHealth {
2926
+ /** Overall health score 0-100 */
2927
+ score: number;
2928
+ /** Health grade derived from score */
2929
+ grade: "A" | "B" | "C" | "D" | "F";
2930
+ /** Last N run outcomes for sparkline display */
2931
+ recentRuns: SkillRunSummary[];
2932
+ /** Average convergence iterations across recent runs */
2933
+ avgConvergenceIterations: number;
2934
+ /** Average quality score across recent runs (0-1) */
2935
+ avgQualityScore: number;
2936
+ /** Success rate as percentage (0-100) */
2937
+ successRate: number;
2938
+ /** Last run timestamp */
2939
+ lastRunAt: string | null;
2940
+ /** Total run count */
2941
+ totalRuns: number;
2942
+ }
2943
+ interface SkillRunSummary {
2944
+ /** Run ID */
2945
+ runId: string;
2946
+ /** Run status */
2947
+ status: "completed" | "failed" | "cancelled";
2948
+ /** Quality score (0-1) */
2949
+ qualityScore: number;
2950
+ /** Duration in seconds */
2951
+ duration: number;
2952
+ /** Timestamp */
2953
+ timestamp: string;
2902
2954
  }
2903
- interface VoiceTrigger {
2904
- type: "intent";
2905
- patterns: string[];
2906
- confidenceThreshold?: number;
2955
+ interface SkillAgent {
2956
+ /** Agent role name (e.g., "Market Researcher", "Legal Analyst") */
2957
+ role: string;
2958
+ /** What this agent does in the workflow */
2959
+ description: string;
2960
+ /** Maps to a NodeManifestV0.id in the stack */
2961
+ nodeRef?: string;
2962
+ /** When true, a synthetic peer reviewer evaluates this agent's output after completion */
2963
+ peerReview?: boolean;
2907
2964
  }
2908
- interface TouchTrigger {
2909
- type: "gesture";
2910
- gesture: "swipe_left" | "swipe_right" | "swipe_up" | "swipe_down" | "pinch_in" | "pinch_out" | "long_press" | "double_tap" | "three_finger_swipe";
2965
+ interface SkillSampleOutput {
2966
+ type: SkillOutputType;
2967
+ title: string;
2968
+ /** Screenshot or live preview URL */
2969
+ previewUrl?: string;
2970
+ description: string;
2911
2971
  }
2912
- type InputTrigger = KeyboardTrigger | GamepadTrigger | VoiceTrigger | TouchTrigger;
2913
- interface ActionBinding {
2914
- id: string;
2915
- action: Action;
2972
+ /** External service dependency for a skill */
2973
+ interface SkillServiceRequirement {
2974
+ /** Unique key for this requirement (e.g., "search", "database", "email") */
2975
+ key: string;
2976
+ /** Human-readable label */
2916
2977
  label: string;
2917
- category: string;
2918
- when: ActionPredicate;
2919
- trigger: InputTrigger;
2920
- surface: InputSurface;
2978
+ /** Type of service needed */
2979
+ type: "mcp" | "api" | "credential";
2980
+ /** Description of what this service is used for */
2981
+ description: string;
2982
+ /** Whether this service is required or optional */
2983
+ required: boolean;
2984
+ /** Suggested MCP server names (for type: "mcp") */
2985
+ suggestedServers?: string[];
2986
+ }
2987
+ interface SkillMeta<TInput extends Record<string, unknown> = Record<string, unknown>> {
2988
+ /** Unique skill slug (url-safe) */
2989
+ slug: string;
2990
+ /** Display name */
2991
+ title: string;
2992
+ /** One-line value proposition */
2993
+ tagline: string;
2994
+ /** Detailed description (markdown) */
2995
+ description: string;
2996
+ /** Skill category */
2997
+ category: SkillCategory;
2998
+ /** Skill tier (complexity/impact level) */
2999
+ tier: SkillTier;
3000
+ /** Expected output artifact types */
3001
+ outputs: SkillOutputType[];
3002
+ /** Estimated execution time range in seconds [min, max] */
3003
+ estimatedTime: [number, number];
3004
+ /** Required input schema (JSON Schema) */
3005
+ inputSchema: JSONSchema7;
3006
+ /** Agent roles involved in this skill */
3007
+ agents: SkillAgent[];
3008
+ /** Sample input for demo/preview (typed to match inputSchema) */
3009
+ sampleInput?: TInput;
3010
+ /** Sample output artifacts for showcase */
3011
+ sampleOutputs?: SkillSampleOutput[];
3012
+ /** Tags for filtering */
3013
+ tags: string[];
3014
+ /** Author */
3015
+ author: string;
3016
+ /** Icon identifier (from icon set) */
3017
+ icon?: string;
3018
+ /** Cosmic gradient pair index (0-7 from cosmicGradients) */
3019
+ gradientIndex?: number;
3020
+ /** Output schema for composition chaining (JSON Schema) */
3021
+ outputSchema?: JSONSchema7;
3022
+ /** Allow agents to dynamically delegate tasks to ephemeral agents. Max 2 per run. */
3023
+ allowDelegation?: boolean;
3024
+ /** External service dependencies (MCP servers, APIs, credentials) */
3025
+ services?: SkillServiceRequirement[];
3026
+ /** Runtime capability toggles (image gen, video gen, tools, etc.) */
3027
+ capabilities?: SkillCapabilities;
3028
+ /** Current rank in the hierarchy (default: "skill") */
3029
+ rank?: SkillRank;
3030
+ /** Effective-dated rank history — immutable audit trail */
3031
+ rankHistory?: RankAssignment[];
3032
+ /**
3033
+ * Convergence configuration for iterative agent output refinement.
3034
+ *
3035
+ * Future optimization: the manual convergence loop in runner.ts could be
3036
+ * replaced by `withRetry()` + `withCircuitBreaker()` from
3037
+ * `lib/terminals-tech/core/primitives/middleware` — they provide the same
3038
+ * retry/backoff/threshold semantics with composable middleware chaining.
3039
+ * See also `createRefinementLoop()` from `primitives/refinement` which
3040
+ * encapsulates the score/delta/plateau logic as a standalone primitive.
3041
+ */
3042
+ convergence?: {
3043
+ /** Max refinement iterations per agent. Default 1 (no refinement), max 5. */
3044
+ maxIterations: number;
3045
+ /** Quality threshold (0-1). Agent output must meet this to pass. Default 0.7. */
3046
+ qualityThreshold: number;
3047
+ /** Minimum quality improvement per iteration. Stops early if delta < this. Default 0.05. */
3048
+ minDelta: number;
3049
+ /** Refinement strategy: retry (re-execute), critique (LLM critic), refine (critique + inject feedback). */
3050
+ strategy: "retry" | "critique" | "refine";
3051
+ };
2921
3052
  }
2922
- /** Sequence two actions (flattens nested sequences) */
2923
- declare function seq(a: Action, b: Action): Action;
2924
- /** Navigate then execute */
2925
- declare function goAndRun(target: NavigationTarget, skill: SkillRef): Action;
2926
- /** Delegate then observe */
2927
- declare function delegateAndWatch(assignment: DelegateAssignment, metric: ObserveTarget): Action;
2928
-
2929
3053
  /**
2930
- * ActionBus Singleton event bus for the Action Algebra
3054
+ * A SkillManifest extends StackManifestV0 with skill-specific metadata.
2931
3055
  *
2932
- * All input surfaces publish ActionEvents here.
2933
- * The executor and any observers subscribe here.
3056
+ * This is the core type — a skill IS a stack manifest with agent orchestration
3057
+ * metadata. The `skill` field contains all presentation and execution metadata.
2934
3058
  *
2935
- * @module core/primitives/action-bus
3059
+ * The `TInput` parameter establishes compile-time correspondence between
3060
+ * the JSON Schema `inputSchema`, the typed `sampleInput`, and the runtime
3061
+ * input validated by `SkillRunner.start()`.
2936
3062
  */
2937
-
2938
- type ActionBusEvents = {
2939
- "action:dispatched": ActionEvent;
2940
- "action:executed": ActionEvent & {
2941
- result: "success" | "error";
2942
- error?: string;
2943
- };
2944
- "action:cancelled": {
2945
- reason: string;
2946
- timestamp: number;
2947
- };
2948
- "context:changed": ActionContext;
3063
+ interface SkillManifest<TInput extends Record<string, unknown> = Record<string, unknown>> extends StackManifestV0 {
3064
+ /** Skill-specific metadata */
3065
+ skill: SkillMeta<TInput>;
3066
+ }
3067
+ declare const SKILL_RUN_STATUSES: readonly ["pending", "running", "gate_pending", "paused", "resuming", "retrying", "completed", "failed", "cancelled"];
3068
+ type SkillRunStatus = (typeof SKILL_RUN_STATUSES)[number];
3069
+
3070
+ /**
3071
+ * Skill Registry + Catalog Bridge
3072
+ *
3073
+ * Follows the applet-node-adapter.ts pattern — registers skills into the
3074
+ * node catalog via registerManifestProvider for "skill:*" resolution.
3075
+ *
3076
+ * @module skills/registry
3077
+ */
3078
+
3079
+ declare function registerSkill(skill: SkillManifest): void;
3080
+ declare function getSkill(slug: string): SkillManifest | undefined;
3081
+ declare function getAllSkills(): SkillManifest[];
3082
+ declare function getSkillsByCategory(category: SkillCategory): SkillManifest[];
3083
+ declare function getSkillCount(): number;
3084
+ /**
3085
+ * Ensures flagship skills are registered. Safe to call from API routes
3086
+ * (SSR context) where the client-side side-effect import hasn't run.
3087
+ * Idempotent — skips if registry is already populated.
3088
+ */
3089
+ declare function ensureSkillsRegistered(): Promise<void>;
3090
+
3091
+ /**
3092
+ * AXON Signal Codes for Skills (0x0050-0x005F range)
3093
+ *
3094
+ * Follows the DEPLOY_SIGNAL_CODES pattern from lib/deploy/provider.ts.
3095
+ * Next available range after deploy's 0x0040-0x004F.
3096
+ *
3097
+ * @module skills/signals
3098
+ */
3099
+ declare const SKILL_SIGNAL_CODES: {
3100
+ /** Skill execution started */
3101
+ readonly SKILL_START: 80;
3102
+ /** Individual agent within skill started */
3103
+ readonly SKILL_AGENT_START: 81;
3104
+ /** Individual agent within skill completed */
3105
+ readonly SKILL_AGENT_COMPLETE: 82;
3106
+ /** An artifact has been produced */
3107
+ readonly SKILL_ARTIFACT_READY: 83;
3108
+ /** Progress update (percentage, current step) */
3109
+ readonly SKILL_PROGRESS: 84;
3110
+ /** Skill execution completed successfully */
3111
+ readonly SKILL_COMPLETE: 85;
3112
+ /** Skill execution paused — awaiting user gate decision */
3113
+ readonly SKILL_GATE_PENDING: 86;
3114
+ /** Peer review cycle triggered for an agent */
3115
+ readonly SKILL_PEER_REVIEW: 87;
3116
+ /** Dynamic delegation triggered by an agent */
3117
+ readonly SKILL_DELEGATION: 88;
3118
+ /** Agent output refinement iteration (convergence engine) */
3119
+ readonly SKILL_AGENT_REFINE: 89;
3120
+ /** Population selection round completed */
3121
+ readonly SKILL_SELECTION: 90;
3122
+ /** Backpressure event in skill chain */
3123
+ readonly SKILL_BACKPRESSURE: 91;
3124
+ /** Resource budget exceeded */
3125
+ readonly SKILL_BUDGET_EXCEEDED: 92;
3126
+ /** Skill execution error */
3127
+ readonly SKILL_ERROR: 95;
2949
3128
  };
2950
- declare function getActionBus(): TypedEventBus<ActionBusEvents>;
2951
- declare function dispatchAction(event: ActionEvent): void;
2952
- declare function onAction(handler: (event: ActionEvent) => void): () => void;
3129
+ type SkillSignalCode = (typeof SKILL_SIGNAL_CODES)[keyof typeof SKILL_SIGNAL_CODES];
3130
+ type SkillEventType = "skill:start" | "skill:agent_start" | "skill:agent_complete" | "skill:artifact_ready" | "skill:progress" | "skill:complete" | "skill:gate_pending" | "skill:peer_review" | "skill:delegation" | "skill:agent_refine" | "skill:selection" | "skill:backpressure" | "skill:budget_exceeded" | "skill:error";
2953
3131
 
2954
3132
  /**
2955
- * Mesh SDK — Event emission, subscription, and query
3133
+ * Skill SDK — Skill execution and management
2956
3134
  *
2957
- * Cross-layer communication via signals and the action bus.
2958
- * Hides Interaction primitive internals, SDKMessage, AXON internals.
3135
+ * Skill types, registry access, and signal constants.
3136
+ * Hides SkillManifest internals, runner pipeline, agent-executor, topo-sort.
2959
3137
  *
2960
3138
  * @copyright © 2026 Intuition Labs LLC. All rights reserved. Patent Pending.
2961
- * @module sdk/mesh
2962
- */
2963
-
2964
- type mesh_Action = Action;
2965
- type mesh_ActionBinding = ActionBinding;
2966
- type mesh_ActionBusEvents = ActionBusEvents;
2967
- type mesh_ActionContext = ActionContext;
2968
- type mesh_ActionEvent = ActionEvent;
2969
- type mesh_InputSurface = InputSurface;
2970
- type mesh_Signal<T = unknown> = Signal<T>;
2971
- type mesh_SignalBus = SignalBus;
2972
- type mesh_SignalHandler<T = unknown> = SignalHandler<T>;
2973
- type mesh_SignalType = SignalType;
2974
- declare const mesh_createSignalBus: typeof createSignalBus;
2975
- declare const mesh_delegateAndWatch: typeof delegateAndWatch;
2976
- declare const mesh_dispatchAction: typeof dispatchAction;
2977
- declare const mesh_emitSignal: typeof emitSignal;
2978
- declare const mesh_getActionBus: typeof getActionBus;
2979
- declare const mesh_getSignalBus: typeof getSignalBus;
2980
- declare const mesh_goAndRun: typeof goAndRun;
2981
- declare const mesh_onAction: typeof onAction;
2982
- declare const mesh_seq: typeof seq;
2983
- declare const mesh_subscribeToSignals: typeof subscribeToSignals;
2984
- declare namespace mesh {
2985
- export { type mesh_Action as Action, type mesh_ActionBinding as ActionBinding, type mesh_ActionBusEvents as ActionBusEvents, type mesh_ActionContext as ActionContext, type mesh_ActionEvent as ActionEvent, type mesh_InputSurface as InputSurface, type mesh_Signal as Signal, type mesh_SignalBus as SignalBus, type mesh_SignalHandler as SignalHandler, type mesh_SignalType as SignalType, mesh_createSignalBus as createSignalBus, mesh_delegateAndWatch as delegateAndWatch, mesh_dispatchAction as dispatchAction, mesh_emitSignal as emitSignal, mesh_getActionBus as getActionBus, mesh_getSignalBus as getSignalBus, mesh_goAndRun as goAndRun, mesh_onAction as onAction, mesh_seq as seq, mesh_subscribeToSignals as subscribeToSignals };
2986
- }
3139
+ * @module sdk/skill
3140
+ */
3141
+
3142
+ declare const skill_SKILL_CATEGORIES: typeof SKILL_CATEGORIES;
3143
+ declare const skill_SKILL_RANKS: typeof SKILL_RANKS;
3144
+ declare const skill_SKILL_RUN_STATUSES: typeof SKILL_RUN_STATUSES;
3145
+ declare const skill_SKILL_SIGNAL_CODES: typeof SKILL_SIGNAL_CODES;
3146
+ declare const skill_SKILL_TIERS: typeof SKILL_TIERS;
3147
+ type skill_SkillAgent = SkillAgent;
3148
+ type skill_SkillCapabilities = SkillCapabilities;
3149
+ type skill_SkillCategory = SkillCategory;
3150
+ type skill_SkillEventType = SkillEventType;
3151
+ type skill_SkillHealth = SkillHealth;
3152
+ type skill_SkillManifest<TInput extends Record<string, unknown> = Record<string, unknown>> = SkillManifest<TInput>;
3153
+ type skill_SkillMeta<TInput extends Record<string, unknown> = Record<string, unknown>> = SkillMeta<TInput>;
3154
+ type skill_SkillRank = SkillRank;
3155
+ type skill_SkillRunStatus = SkillRunStatus;
3156
+ type skill_SkillSignalCode = SkillSignalCode;
3157
+ type skill_SkillTier = SkillTier;
3158
+ declare const skill_ensureSkillsRegistered: typeof ensureSkillsRegistered;
3159
+ declare const skill_getAllSkills: typeof getAllSkills;
3160
+ declare const skill_getSkill: typeof getSkill;
3161
+ declare const skill_getSkillCount: typeof getSkillCount;
3162
+ declare const skill_getSkillsByCategory: typeof getSkillsByCategory;
3163
+ declare const skill_registerSkill: typeof registerSkill;
3164
+ declare namespace skill {
3165
+ export { skill_SKILL_CATEGORIES as SKILL_CATEGORIES, skill_SKILL_RANKS as SKILL_RANKS, skill_SKILL_RUN_STATUSES as SKILL_RUN_STATUSES, skill_SKILL_SIGNAL_CODES as SKILL_SIGNAL_CODES, skill_SKILL_TIERS as SKILL_TIERS, type skill_SkillAgent as SkillAgent, type skill_SkillCapabilities as SkillCapabilities, type skill_SkillCategory as SkillCategory, type skill_SkillEventType as SkillEventType, type skill_SkillHealth as SkillHealth, type skill_SkillManifest as SkillManifest, type skill_SkillMeta as SkillMeta, type skill_SkillRank as SkillRank, type skill_SkillRunStatus as SkillRunStatus, type skill_SkillSignalCode as SkillSignalCode, type skill_SkillTier as SkillTier, skill_ensureSkillsRegistered as ensureSkillsRegistered, skill_getAllSkills as getAllSkills, skill_getSkill as getSkill, skill_getSkillCount as getSkillCount, skill_getSkillsByCategory as getSkillsByCategory, skill_registerSkill as registerSkill };
3166
+ }
3167
+
3168
+ /**
3169
+ * Manifold Annihilation API
3170
+ *
3171
+ * Converges an Intent Manifold and a Context Manifold via py2bend compilation
3172
+ * and HVM reduction where available.
3173
+ */
3174
+
3175
+ interface AnnihilationOptions {
3176
+ maxSteps?: number;
3177
+ convergenceThreshold?: number;
3178
+ gravity?: number;
3179
+ }
3180
+ interface ManifoldReductionMetrics {
3181
+ compiled: boolean;
3182
+ reduced: boolean;
3183
+ strategy: string;
3184
+ runtime: "wasm-hvm" | "compile-only";
3185
+ durationMs: number;
3186
+ warnings: string[];
3187
+ errors: string[];
3188
+ logitBias: Record<string, number>;
3189
+ }
3190
+ interface ManifoldSematonPayload {
3191
+ result: string;
3192
+ steps: number;
3193
+ intent: string;
3194
+ contextSnapshot: string;
3195
+ bendCode?: string;
3196
+ reduction: ManifoldReductionMetrics;
3197
+ }
3198
+ declare function annihilate(intent: string, context?: string, options?: AnnihilationOptions): Promise<Sematon<ManifoldSematonPayload>>;
3199
+ declare const manifold: {
3200
+ annihilate: typeof annihilate;
3201
+ };
2987
3202
 
2988
- type brain_CoherenceConfig = CoherenceConfig;
2989
- type brain_CoherenceInput = CoherenceInput;
2990
- type brain_CoherenceMetrics = CoherenceMetrics;
2991
- type brain_CoherenceResult = CoherenceResult;
2992
- type brain_KuramotoStepOptions = KuramotoStepOptions;
2993
- type brain_OrderParameter = OrderParameter;
2994
- declare const brain_calculateCoherence: typeof calculateCoherence;
2995
- declare const brain_calculateCoherenceWithExplanations: typeof calculateCoherenceWithExplanations;
2996
- declare const brain_getCoherenceSuggestions: typeof getCoherenceSuggestions;
2997
- declare const brain_isCoherent: typeof isCoherent;
2998
- declare const brain_kuramotoStep: typeof kuramotoStep;
2999
- declare const brain_orderParameter: typeof orderParameter;
3000
- declare const brain_phaseLockingValue: typeof phaseLockingValue;
3001
- declare const brain_wrapTo2Pi: typeof wrapTo2Pi;
3002
- declare const brain_wrapToPi: typeof wrapToPi;
3003
- declare namespace brain {
3004
- export { type brain_CoherenceConfig as CoherenceConfig, type brain_CoherenceInput as CoherenceInput, type brain_CoherenceMetrics as CoherenceMetrics, type brain_CoherenceResult as CoherenceResult, type brain_KuramotoStepOptions as KuramotoStepOptions, type brain_OrderParameter as OrderParameter, brain_calculateCoherence as calculateCoherence, brain_calculateCoherenceWithExplanations as calculateCoherenceWithExplanations, brain_getCoherenceSuggestions as getCoherenceSuggestions, brain_isCoherent as isCoherent, brain_kuramotoStep as kuramotoStep, brain_orderParameter as orderParameter, brain_phaseLockingValue as phaseLockingValue, brain_wrapTo2Pi as wrapTo2Pi, brain_wrapToPi as wrapToPi };
3203
+ type manifold$1_AnnihilationOptions = AnnihilationOptions;
3204
+ type manifold$1_ManifoldReductionMetrics = ManifoldReductionMetrics;
3205
+ type manifold$1_ManifoldSematonPayload = ManifoldSematonPayload;
3206
+ declare const manifold$1_annihilate: typeof annihilate;
3207
+ declare const manifold$1_manifold: typeof manifold;
3208
+ declare namespace manifold$1 {
3209
+ export { type manifold$1_AnnihilationOptions as AnnihilationOptions, type manifold$1_ManifoldReductionMetrics as ManifoldReductionMetrics, type manifold$1_ManifoldSematonPayload as ManifoldSematonPayload, manifold$1_annihilate as annihilate, manifold$1_manifold as manifold };
3210
+ }
3211
+
3212
+ /**
3213
+ * StateMirror - Total Context Encoding
3214
+ *
3215
+ * Continuously encodes the entire application, UI, and cognitive state into a
3216
+ * shared representational manifold. This provides the ObserverKernel with literal
3217
+ * environmental awareness, preventing "blind" execution.
3218
+ */
3219
+
3220
+ interface SystemStateSnapshot {
3221
+ /** The current URL or deep-link active in the browser */
3222
+ activeUrl: string;
3223
+ /** The specific UI component currently focused or under cursor */
3224
+ focusedComponent: string | null;
3225
+ /** The last N intents expressed by the user */
3226
+ recentIntents: string[];
3227
+ /** Latest L1 AudioKernel spectral entropy [0,1] */
3228
+ audioEntropy: number;
3229
+ /** Whether the NanoFold 3D surface is actively rendering */
3230
+ nanoFoldActive: boolean;
3231
+ /** Current System Coherence R [0,1] */
3232
+ coherenceR: number;
3233
+ /** Current active project or workspace ID */
3234
+ activeProject: string | null;
3235
+ }
3236
+ declare class StateMirror {
3237
+ private state$;
3238
+ private bridgeOwnerId;
3239
+ private bridgeOrder;
3240
+ constructor();
3241
+ private initSubscriptions;
3242
+ /** Gets the observable stream of state changes */
3243
+ get stream$(): Observable<SystemStateSnapshot>;
3244
+ /** Gets a synchronous snapshot of the current state */
3245
+ get snapshot(): SystemStateSnapshot;
3246
+ claimBridge(bridgeId: string): void;
3247
+ releaseBridge(bridgeId: string): void;
3248
+ /** Partially updates the mirror state */
3249
+ update(partial: Partial<SystemStateSnapshot>): void;
3250
+ /**
3251
+ * Bridge-scoped update to prevent multiple mounted app shells from racing
3252
+ * against the same singleton mirror.
3253
+ */
3254
+ updateFromBridge(bridgeId: string, partial: Partial<SystemStateSnapshot>): void;
3255
+ /**
3256
+ * Flattens the continuous state into a dense text manifold.
3257
+ * This is passed to the ObserverKernel to ground it in the immediate UI/UX reality.
3258
+ */
3259
+ encodeToManifold(): string;
3005
3260
  }
3006
3261
 
3007
3262
  /**
3008
- * Agent Communication Bus — in-memory message passing for skill agents.
3263
+ * ObserverField & Neurons
3009
3264
  *
3010
- * Scoped per skill run. Agents publish findings, review requests, and
3011
- * delegation requests. Downstream agents receive accumulated context
3012
- * via their system prompt.
3265
+ * Formalization of the Terminals abstraction:
3266
+ * The MicroLM is not a calculator. It is a continuous ObserverKernel.
3267
+ * Skills are not apps. They are geometric Neurons equipped by the Observer.
3013
3268
  *
3014
- * @module skills/agent-bus
3269
+ * @module sdk/observer
3015
3270
  */
3016
- type AgentMessageType = "finding" | "question" | "review_request" | "review_response" | "delegation_request" | "delegation_response";
3017
- interface AgentMessage {
3018
- fromAgent: string;
3019
- toAgent?: string;
3020
- type: AgentMessageType;
3021
- payload: string;
3022
- timestamp: number;
3023
- runId: string;
3024
- }
3025
- type MessageHandler = (msg: AgentMessage) => void;
3026
- interface AgentBus {
3027
- publish(msg: AgentMessage): void;
3028
- query(filter: {
3029
- fromAgent?: string;
3030
- type?: string;
3031
- }): AgentMessage[];
3032
- subscribe(agentId: string, handler: MessageHandler): () => void;
3033
- getAll(): AgentMessage[];
3034
- }
3271
+
3035
3272
  /**
3036
- * Create an AgentBus scoped to a single skill run.
3037
- * Messages are stored in-memory (array). No persistence needed —
3038
- * the bus lifetime matches the SkillRunner instance.
3273
+ * A hot-swappable structural template that the Observer equips to resolve intent.
3039
3274
  */
3040
- declare function createAgentBus(runId: string): AgentBus;
3041
-
3275
+ interface Neuron {
3276
+ id: string;
3277
+ kind: "skill" | "isomorphism" | "prompt-sensor" | "py2bend-template";
3278
+ payload: unknown;
3279
+ gravity: number;
3280
+ }
3281
+ interface ObserverConfig {
3282
+ id: string;
3283
+ heartbeatHz?: number;
3284
+ stateMirror?: StateMirror;
3285
+ }
3042
3286
  /**
3043
- * Protocol SDK MCP and A2A protocol connections
3044
- *
3045
- * Delegation primitives and agent communication types.
3046
- * Hides MCP client lifecycle, A2A internals.
3287
+ * ObserverKernel - Continuous Local Witness
3047
3288
  *
3048
- * @copyright © 2026 Intuition Labs LLC. All rights reserved. Patent Pending.
3049
- * @module sdk/protocol
3289
+ * An active, unbroken presence that maintains a heartbeat,
3290
+ * observes the StateMirror, and equips Neurons (skills) dynamically.
3050
3291
  */
3292
+ declare class ObserverKernel {
3293
+ readonly id: string;
3294
+ readonly heartbeatHz: number;
3295
+ private mirror;
3296
+ private activeNeurons;
3297
+ private coherenceR$;
3298
+ private pulseTimer;
3299
+ constructor(config: ObserverConfig);
3300
+ get coherence(): number;
3301
+ get isRunning(): boolean;
3302
+ /** Starts the continuous heartbeat */
3303
+ start(): void;
3304
+ /** Stops the heartbeat */
3305
+ stop(): void;
3306
+ /** The continuous observation loop */
3307
+ private pulse;
3308
+ /** Equips a new geometric constraint (Neuron) onto the observer */
3309
+ equipNeuron(neuron: Neuron): void;
3310
+ /** Unequips a Neuron */
3311
+ unequipNeuron(neuronId: string): void;
3312
+ /** Replace the active neuron field in one operation. */
3313
+ syncNeurons(neurons: Neuron[]): void;
3314
+ /**
3315
+ * The core execution path:
3316
+ * Flattens the active Neurons + StateMirror context, then drops them into the Annihilator.
3317
+ */
3318
+ resolve(intent: string): Promise<Sematon<any>>;
3319
+ }
3320
+ declare function disposeObserverKernel(id: string): void;
3321
+ declare function getObserverKernel(id: string, config?: Omit<ObserverConfig, "id">): ObserverKernel;
3051
3322
 
3052
- type protocol_AgentBus = AgentBus;
3053
- type protocol_AgentMessage = AgentMessage;
3054
- type protocol_AgentMessageType = AgentMessageType;
3055
- type protocol_DelegationChain = DelegationChain;
3056
- type protocol_DelegationEdge<S = SurfaceId, T = SurfaceId> = DelegationEdge<S, T>;
3057
- type protocol_DelegationEdgeInput<S = SurfaceId, T = SurfaceId> = DelegationEdgeInput<S, T>;
3058
- type protocol_DelegationEndpoint<S = SurfaceId> = DelegationEndpoint<S>;
3059
- declare const protocol_createAgentBus: typeof createAgentBus;
3060
- declare const protocol_createDelegationChain: typeof createDelegationChain;
3061
- declare const protocol_createDelegationEdge: typeof createDelegationEdge;
3062
- declare const protocol_isValidSurfaceId: typeof isValidSurfaceId;
3063
- declare namespace protocol {
3064
- export { type protocol_AgentBus as AgentBus, type protocol_AgentMessage as AgentMessage, type protocol_AgentMessageType as AgentMessageType, type protocol_DelegationChain as DelegationChain, type protocol_DelegationEdge as DelegationEdge, type protocol_DelegationEdgeInput as DelegationEdgeInput, type protocol_DelegationEndpoint as DelegationEndpoint, protocol_createAgentBus as createAgentBus, protocol_createDelegationChain as createDelegationChain, protocol_createDelegationEdge as createDelegationEdge, protocol_isValidSurfaceId as isValidSurfaceId };
3323
+ type observer_Neuron = Neuron;
3324
+ type observer_ObserverConfig = ObserverConfig;
3325
+ type observer_ObserverKernel = ObserverKernel;
3326
+ declare const observer_ObserverKernel: typeof ObserverKernel;
3327
+ declare const observer_disposeObserverKernel: typeof disposeObserverKernel;
3328
+ declare const observer_getObserverKernel: typeof getObserverKernel;
3329
+ declare namespace observer {
3330
+ export { type observer_Neuron as Neuron, type observer_ObserverConfig as ObserverConfig, observer_ObserverKernel as ObserverKernel, observer_disposeObserverKernel as disposeObserverKernel, observer_getObserverKernel as getObserverKernel };
3065
3331
  }
3066
3332
 
3067
3333
  /**
@@ -3543,6 +3809,6 @@ declare function createAxonBus(): InMemoryAxonBus;
3543
3809
  *
3544
3810
  * Curated package facade for the npm package.
3545
3811
  */
3546
- declare const SDK_VERSION = "1.0.0-rc.1";
3812
+ declare const SDK_VERSION = "1.0.0";
3547
3813
 
3548
- export { type AxonMessage, type AxonMessageBus, brain as Brain, type CoherenceConfig, type CoherenceInput, type CoherenceMetrics, type CoherenceResult, core as Core, InMemoryAxonBus, type KuramotoStepOptions, index as L0, mesh as Mesh, type OrderParameter, protocol as Protocol, ProtocolBridge, SDK_VERSION, terminal as Terminal, calculateCoherence, calculateCoherenceWithExplanations, createAxonBus, createProtocolBridge, getCoherenceSuggestions, isCoherent, kuramotoStep, orderParameter, phaseLockingValue, wrapTo2Pi, wrapToPi };
3814
+ export { type AxonMessage, type AxonMessageBus, brain as Brain, core as Core, InMemoryAxonBus, index as L0, manifold$1 as Manifold, mesh as Mesh, observer as Observer, protocol as Protocol, ProtocolBridge, SDK_VERSION, skill as Skill, terminal as Terminal, createAxonBus, createProtocolBridge };