@nekzus/liop 2.5.0-beta.1 → 2.5.0-beta.3

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 (104) hide show
  1. package/NOTICE +19 -0
  2. package/README.md +148 -69
  3. package/dist/bin/agent.js +27 -303
  4. package/dist/bridge.d.ts +4 -3
  5. package/dist/bridge.js +1 -4
  6. package/dist/chunk-2XHSALII.js +3 -0
  7. package/dist/chunk-2ZYX736J.js +2 -0
  8. package/dist/chunk-3WRKTVOF.js +2 -0
  9. package/dist/chunk-6KFKO6ZX.js +2 -0
  10. package/dist/chunk-6VK2XALI.js +2 -0
  11. package/dist/chunk-AYDF3IFZ.js +2 -0
  12. package/dist/chunk-CTTTLCGL.js +31 -0
  13. package/dist/chunk-ECRS6N33.js +4 -0
  14. package/dist/chunk-FDJMH4CB.js +2 -0
  15. package/dist/chunk-FTF6AMF6.js +2 -0
  16. package/dist/chunk-GWVSCZUS.js +2 -0
  17. package/dist/chunk-LEXMMIQI.js +15 -0
  18. package/dist/chunk-LM26HOJ6.js +31 -0
  19. package/dist/chunk-MQ5SU26J.js +2 -0
  20. package/dist/chunk-N35BC62H.js +2 -0
  21. package/dist/chunk-P6IJ3VBD.js +3 -0
  22. package/dist/chunk-TKLRW52V.js +2 -0
  23. package/dist/chunk-V35CXJQN.js +2 -0
  24. package/dist/chunk-WP5ER7RH.js +3 -0
  25. package/dist/chunk-XLVEDKM6.js +2 -0
  26. package/dist/chunk-Y675R34Z.js +2 -0
  27. package/dist/chunk-YD2AF2M6.js +46 -0
  28. package/dist/chunk-YLCNV764.js +3 -0
  29. package/dist/chunk-ZZMSFCJP.js +3 -0
  30. package/dist/client.d.ts +6 -4
  31. package/dist/client.js +1 -9
  32. package/dist/gateway.d.ts +6 -5
  33. package/dist/gateway.js +1 -10
  34. package/dist/{hybrid-CF__0YnC.d.ts → hybrid-BZpCiUaV.d.ts} +6 -5
  35. package/dist/{index-cMV0_yD9.d.ts → index-BYDtRGue.d.ts} +45 -36
  36. package/dist/{index-BW95kAL4.d.ts → index-ByzjpRCk.d.ts} +37 -72
  37. package/dist/index.d.ts +221 -50
  38. package/dist/index.js +4 -312
  39. package/dist/kyber-PULV7PQX.js +2 -0
  40. package/dist/mesh.d.ts +27 -143
  41. package/dist/mesh.js +1 -4
  42. package/dist/node-Djzm6UYd.d.ts +172 -0
  43. package/dist/protocol/liop_core.proto +25 -6
  44. package/dist/server.d.ts +4 -3
  45. package/dist/server.js +1 -7
  46. package/dist/types-29zv9X1V.d.ts +455 -0
  47. package/dist/types.d.ts +2 -1
  48. package/dist/types.js +1 -2
  49. package/dist/verifier-DqZ9MQ9l.d.ts +82 -0
  50. package/dist/verifier-J4NQYZX5.js +2 -0
  51. package/dist/workers/logic-execution.d.ts +7 -0
  52. package/dist/workers/logic-execution.js +1 -271
  53. package/dist/workers/zk-verifier.d.ts +9 -0
  54. package/dist/workers/zk-verifier.js +1 -173
  55. package/dist/zk-DzYNWBgo.d.ts +104 -0
  56. package/package.json +56 -45
  57. package/dist/bin/agent.js.map +0 -1
  58. package/dist/bridge.js.map +0 -1
  59. package/dist/chunk-32ADSAJS.js +0 -104
  60. package/dist/chunk-32ADSAJS.js.map +0 -1
  61. package/dist/chunk-547TYL27.js +0 -208109
  62. package/dist/chunk-547TYL27.js.map +0 -1
  63. package/dist/chunk-72MNYFR6.js +0 -64
  64. package/dist/chunk-72MNYFR6.js.map +0 -1
  65. package/dist/chunk-74CISO2I.js +0 -853
  66. package/dist/chunk-74CISO2I.js.map +0 -1
  67. package/dist/chunk-CRZBVFDV.js +0 -616
  68. package/dist/chunk-CRZBVFDV.js.map +0 -1
  69. package/dist/chunk-GA3Q2S7O.js +0 -558
  70. package/dist/chunk-GA3Q2S7O.js.map +0 -1
  71. package/dist/chunk-JIJPZFR2.js +0 -51
  72. package/dist/chunk-JIJPZFR2.js.map +0 -1
  73. package/dist/chunk-OUUTDSOW.js +0 -24
  74. package/dist/chunk-OUUTDSOW.js.map +0 -1
  75. package/dist/chunk-PYKRQAER.js +0 -77
  76. package/dist/chunk-PYKRQAER.js.map +0 -1
  77. package/dist/chunk-QLCOEP5J.js +0 -68
  78. package/dist/chunk-QLCOEP5J.js.map +0 -1
  79. package/dist/chunk-RWRRBYG4.js +0 -3
  80. package/dist/chunk-RWRRBYG4.js.map +0 -1
  81. package/dist/chunk-SONUORBT.js +0 -421
  82. package/dist/chunk-SONUORBT.js.map +0 -1
  83. package/dist/chunk-T5IUZF47.js +0 -716
  84. package/dist/chunk-T5IUZF47.js.map +0 -1
  85. package/dist/chunk-U5BZ66VX.js +0 -447
  86. package/dist/chunk-U5BZ66VX.js.map +0 -1
  87. package/dist/chunk-WCCGE4QR.js +0 -3520
  88. package/dist/chunk-WCCGE4QR.js.map +0 -1
  89. package/dist/chunk-WSW6YJNY.js +0 -168
  90. package/dist/chunk-WSW6YJNY.js.map +0 -1
  91. package/dist/client.js.map +0 -1
  92. package/dist/gateway.js.map +0 -1
  93. package/dist/index.js.map +0 -1
  94. package/dist/kyber-3ULIJSE3.js +0 -3
  95. package/dist/kyber-3ULIJSE3.js.map +0 -1
  96. package/dist/mesh.js.map +0 -1
  97. package/dist/server.js.map +0 -1
  98. package/dist/types-lJIxBlWF.d.ts +0 -256
  99. package/dist/types.js.map +0 -1
  100. package/dist/verifier-3FAKCFNN.js +0 -5
  101. package/dist/verifier-3FAKCFNN.js.map +0 -1
  102. package/dist/verifier-COnid_dg.d.ts +0 -31
  103. package/dist/workers/logic-execution.js.map +0 -1
  104. package/dist/workers/zk-verifier.js.map +0 -1
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Manifest describing a node's capabilities in the LIOP Mesh.
3
+ * Exchanged via the /liop/manifest/1.0.0 protocol stream.
4
+ */
5
+ interface LiopManifest {
6
+ peerId: string;
7
+ grpcPort: number;
8
+ tools: Array<{
9
+ name: string;
10
+ description?: string;
11
+ inputSchema?: Record<string, unknown>;
12
+ zkMode?: "none" | "optimistic" | "required";
13
+ guestImageId?: string;
14
+ circuitName?: string;
15
+ vkey?: Record<string, unknown>;
16
+ }>;
17
+ resources: Array<{
18
+ name: string;
19
+ uri: string;
20
+ description?: string;
21
+ mimeType?: string;
22
+ text?: string;
23
+ }>;
24
+ serverInfo: {
25
+ name: string;
26
+ version: string;
27
+ };
28
+ taxonomy?: {
29
+ domain: string;
30
+ clearanceTier: number;
31
+ executionTypes: string[];
32
+ };
33
+ authRequired?: boolean;
34
+ /** Canonical slug for deterministic token resolution. Agents resolve LIOP_TOKEN_<tokenSlug>. Must match /^[A-Z][A-Z0-9_]*$/. */
35
+ tokenSlug?: string;
36
+ /** Expected guest image identifier hash for sovereign enclaves (Hex) */
37
+ guestImageId?: string;
38
+ /** Static verification key mappings for fast-path analytical circuits */
39
+ vkeys?: Record<string, unknown>;
40
+ /** ML-DSA-65 (FIPS 204) Post-Quantum Digital Signature for Manifest Attestation (Base64) */
41
+ pqcSignature?: string;
42
+ /** ML-DSA-65 (FIPS 204) Post-Quantum Public Key (Base64) */
43
+ pqcPublicKey?: string;
44
+ }
45
+ interface MeshNodeConfig {
46
+ listenAddresses?: string[];
47
+ bootstrapNodes?: string[];
48
+ identityPath?: string;
49
+ enableWAN?: boolean;
50
+ dhtStoragePath?: string;
51
+ /** Optional function to translate multiaddrs (e.g. for Docker NAT traversal). Return null to drop an address. */
52
+ addressMapper?: (addr: string) => string | null;
53
+ /** Enable AutoNAT reachability detection (default: true) */
54
+ enableAutoNAT?: boolean;
55
+ /** Enable Circuit Relay v2 transport & server for NAT traversal (default: true) */
56
+ enableRelay?: boolean;
57
+ /** Enable DCUtR decentralized hole punching (default: true) */
58
+ enableDcutr?: boolean;
59
+ /** Enable mDNS peer discovery for local networks (default: false in WAN, true in LAN) */
60
+ enableMdns?: boolean;
61
+ /**
62
+ * Pre-Shared Key for libp2p Private Network isolation (Tier 1 Enclave Hardening).
63
+ * When provided, the node will reject ALL connections from peers that do not
64
+ * possess the identical 95-byte PSK at the transport framing layer,
65
+ * BEFORE the Noise XX handshake is attempted.
66
+ * @see https://github.com/libp2p/specs/blob/master/pnet/Private-Networks-PSK-V1.md
67
+ */
68
+ swarmKey?: Uint8Array;
69
+ }
70
+ /**
71
+ * P2P Mesh Node backed by libp2p + Kademlia DHT.
72
+ *
73
+ * Provides capability advertisement via CID-based content routing
74
+ * and decentralized peer discovery.
75
+ */
76
+ declare class MeshNode {
77
+ private node;
78
+ private config;
79
+ private manifestDialFailureState;
80
+ private static readonly MANIFEST_DIAL_BASE_COOLDOWN_MS;
81
+ private static readonly MANIFEST_DIAL_MAX_COOLDOWN_MS;
82
+ private static readonly MANIFEST_DIAL_SKIP_LOG_THROTTLE_MS;
83
+ /**
84
+ * Buffer of capability hashes that have been announced.
85
+ * Used to re-announce capabilities when new peers connect
86
+ * (critical for small / isolated clusters where the initial
87
+ * provide() finds zero peers in the routing table).
88
+ */
89
+ private announcedCapabilities;
90
+ /** Guards against concurrent re-announcement storms. */
91
+ private reannouncing;
92
+ /** Callback that returns the local node's manifest on request. */
93
+ private manifestProvider;
94
+ /** Flag to ensure the manifest protocol is only registered once. */
95
+ private manifestProtocolRegistered;
96
+ /** Local Ed25519 Private Key for protocol signatures */
97
+ private localPrivateKey;
98
+ constructor(config?: MeshNodeConfig);
99
+ private shouldSkipManifestDial;
100
+ private recordManifestDialFailure;
101
+ private clearManifestDialFailure;
102
+ /**
103
+ * Loads a persistent identity from disk or generates a new Ed25519 keypair.
104
+ * Uses privateKeyToProtobuf/privateKeyFromProtobuf (libp2p v3.x official API).
105
+ */
106
+ private loadOrCreateIdentity;
107
+ /**
108
+ * Persists the private key to disk using protobuf serialization (libp2p v3.x).
109
+ */
110
+ private saveIdentity;
111
+ /**
112
+ * Creates a CID v1 (raw codec 0x55) from a SHA-256 hash of the capability string.
113
+ * Required by @libp2p/kad-dht v16+ for provide/findProviders.
114
+ */
115
+ private capabilityToCID;
116
+ /**
117
+ * Re-announces all buffered capabilities after a new peer connects.
118
+ * Uses a small delay to allow the DHT protocol handshake to complete.
119
+ */
120
+ private reannounceAll;
121
+ start(): Promise<void>;
122
+ stop(): Promise<void>;
123
+ private loadRoutingTable;
124
+ private saveRoutingTable;
125
+ /**
126
+ * Internal logic to register protocol handlers against the libp2p node.
127
+ * Can be called multiple times; handles idempotent registration.
128
+ */
129
+ private applyHandlers;
130
+ /**
131
+ * Registers a callback as the manifest provider.
132
+ * Will be applied immediately if the node is already initialized.
133
+ */
134
+ registerManifestHandler(provider: () => LiopManifest): void;
135
+ /**
136
+ * Queries a remote peer's manifest by opening a /liop/manifest/1.0.0 stream.
137
+ * Returns null if the peer doesn't support the protocol or is unreachable.
138
+ */
139
+ queryManifest(peerIdStr: string): Promise<LiopManifest | null>;
140
+ /**
141
+ * Discovers all peers in the DHT that have announced "liop:manifest".
142
+ * Returns their PeerIDs for subsequent manifest queries.
143
+ */
144
+ discoverManifestProviders(): Promise<string[]>;
145
+ /**
146
+ * Announces this node as a manifest provider in the DHT.
147
+ * Should be called after tools/resources have been registered.
148
+ */
149
+ announceManifest(): Promise<void>;
150
+ /**
151
+ * Returns the current size of the routing table for diagnostic purposes.
152
+ */
153
+ getRoutingTableSize(): number;
154
+ getPeerId(): string;
155
+ sign(data: Uint8Array): Promise<Uint8Array>;
156
+ getMultiaddrs(): string[];
157
+ announceCapability(hash: string): Promise<void>;
158
+ findProviders(hash: string): Promise<string[]>;
159
+ resolvePeer(peerIdStr: string): Promise<string[]>;
160
+ isStarted(): boolean;
161
+ getPeers(): string[];
162
+ /**
163
+ * Returns true if this MeshNode was booted inside an isolated libp2p private network (pnet PSK).
164
+ */
165
+ isPrivateNetwork(): boolean;
166
+ /**
167
+ * Returns the configured 95-byte Swarm Key, or undefined if running in a public/consortium mesh.
168
+ */
169
+ getSwarmKey(): Uint8Array | undefined;
170
+ }
171
+
172
+ export { type LiopManifest as L, type MeshNodeConfig as M, MeshNode as a };
@@ -1,3 +1,6 @@
1
+ // Copyright 2026 Nekzus Solutions and contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
1
4
  syntax = "proto3";
2
5
  package liop.v1;
3
6
 
@@ -11,6 +14,19 @@ service LogicMesh {
11
14
  rpc ExecuteLogic (LogicRequest) returns (stream LogicResponse);
12
15
  }
13
16
 
17
+ // Verification and proving policy requested by the caller
18
+ enum ProofMode {
19
+ PROOF_MODE_LEGACY_HMAC = 0;
20
+ PROOF_MODE_ZK_OPTIMISTIC = 1;
21
+ PROOF_MODE_ZK_BLOCKING = 2;
22
+ }
23
+
24
+ // Cryptographic proof format attached to computation receipts
25
+ enum ProofType {
26
+ PROOF_TYPE_HMAC_LEGACY = 0;
27
+ PROOF_TYPE_GROTH16 = 2;
28
+ }
29
+
14
30
  // Request to negotiate an intent to execute a WASM capability
15
31
  message IntentRequest {
16
32
  string agent_did = 1; // Decentralized Identifier (DID) e.g., spiffe:// or Noise PeerID
@@ -28,17 +44,20 @@ message IntentResponse {
28
44
 
29
45
  // Request to push a WASM module down to the origin for execution
30
46
  message LogicRequest {
31
- string session_token = 1; // Token acquired from NegotiateIntent
32
- bytes wasm_binary = 2; // AES-GCM Encrypted .wasm Logic-on-Origin filter code
33
- map<string, bytes> inputs = 3; // AES-GCM Encrypted input parameters
34
- bytes pqc_ciphertext = 4; // Kyber (ML-KEM-768) Ciphertext encapsulating the AES shared secret
35
- bytes aes_nonce = 5; // 12-byte nonce for AES-GCM
47
+ string session_token = 1; // Token acquired from NegotiateIntent
48
+ bytes wasm_binary = 2; // AES-GCM Encrypted .wasm Logic-on-Origin filter code
49
+ map<string, bytes> inputs = 3; // AES-GCM Encrypted input parameters
50
+ bytes pqc_ciphertext = 4; // Kyber (ML-KEM-768) Ciphertext encapsulating the AES shared secret
51
+ bytes aes_nonce = 5; // 12-byte nonce for AES-GCM
52
+ ProofMode requested_proof_mode = 6; // Proving policy requested by caller
36
53
  }
37
54
 
38
55
  // Streamed Response back to the LLM agent containing reduced, semantically rich semantic responses
39
56
  message LogicResponse {
40
57
  string semantic_evidence = 1; // Condensed semantic result for the LLM
41
58
  bytes cryptographic_proof = 2; // Integrity signature (SHA256)
42
- bytes zk_receipt = 3; // Zero-Knowledge Proof Receipt (e.g. risc0 zkVM) for Computational Integrity
59
+ bytes zk_receipt = 3; // Zero-Knowledge Proof Receipt for Computational Integrity
43
60
  bool is_error = 4; // Execution status
61
+ ProofType proof_type = 5; // Format of the zero-knowledge computational proof
62
+ bytes guest_image_id = 6; // Guest image identifier (32 bytes SHA-256)
44
63
  }
package/dist/server.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- export { b as AggregationPolicy, L as LiopServer, a as LiopServerOptions, i as LogicExecutionPolicy, N as NerScanner, j as OutputSanitizerConfig, P as PII_PATTERNS, k as PII_PRESETS, l as PiiRule, m as PiiScanner, T as ToolHandler, s as sanitizeOutput } from './index-BW95kAL4.js';
1
+ export { b as AggregationPolicy, L as LiopServer, a as LiopServerOptions, e as LogicExecutionPolicy, N as NerScanner, f as OutputSanitizerConfig, P as PII_PATTERNS, g as PII_PRESETS, h as PiiRule, i as PiiScanner, T as ToolHandler, s as sanitizeOutput } from './index-ByzjpRCk.js';
2
2
  import 'zod';
3
- import './mesh.js';
4
- import './types-lJIxBlWF.js';
3
+ import './node-Djzm6UYd.js';
4
+ import './types-29zv9X1V.js';
5
+ import './zk-DzYNWBgo.js';
5
6
  import 'jose';
package/dist/server.js CHANGED
@@ -1,8 +1,2 @@
1
- export { LiopServer, NerScanner, PII_PATTERNS, PII_PRESETS, PiiScanner } from './chunk-WCCGE4QR.js';
2
- export { sanitizeOutput } from './chunk-JIJPZFR2.js';
3
- import './chunk-U5BZ66VX.js';
4
- import './chunk-WSW6YJNY.js';
5
- import './chunk-74CISO2I.js';
6
- import './chunk-72MNYFR6.js';
7
- //# sourceMappingURL=server.js.map
1
+ export{m as LiopServer,i as NerScanner,j as PII_PATTERNS,k as PII_PRESETS,l as PiiScanner}from'./chunk-YD2AF2M6.js';export{a as sanitizeOutput}from'./chunk-MQ5SU26J.js';import'./chunk-XLVEDKM6.js';import'./chunk-2ZYX736J.js';import'./chunk-ECRS6N33.js';import'./chunk-ZZMSFCJP.js';import'./chunk-6VK2XALI.js';import'./chunk-V35CXJQN.js';import'./chunk-3WRKTVOF.js';import'./chunk-AYDF3IFZ.js';//# sourceMappingURL=server.js.map
8
2
  //# sourceMappingURL=server.js.map