@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
package/NOTICE CHANGED
@@ -3,3 +3,22 @@ Copyright 2026 Nekzus Solutions and contributors
3
3
 
4
4
  This product includes software developed by
5
5
  Nekzus Solutions (https://github.com/Nekzus/LIOP).
6
+
7
+ ========================================================================
8
+ Third-Party Bundled Dependencies and Acknowledgments
9
+ ========================================================================
10
+
11
+ This SDK statically bundles or adapts software from third parties:
12
+
13
+ 1. gpt-tokenizer (https://github.com/niieani/gpt-tokenizer)
14
+ Copyright (c) 2023-2024 Bazyli Brzoska
15
+ Licensed under the MIT License.
16
+
17
+ 2. OpenTelemetry JS API (@opentelemetry/api) (https://github.com/open-telemetry/opentelemetry-js)
18
+ Copyright The OpenTelemetry Authors
19
+ Licensed under the Apache License, Version 2.0.
20
+
21
+ 3. Model Context Protocol (MCP) (https://modelcontextprotocol.io)
22
+ Protocol schemas and interoperability semantics adapted for backward compatibility.
23
+ Copyright Anthropic, PBC and contributors.
24
+ Licensed under the MIT License.
package/README.md CHANGED
@@ -1,49 +1,70 @@
1
1
  <div align="center">
2
2
  <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="https://res.cloudinary.com/dsvsl0b0b/image/upload/v1774702621/Neural-Mesh-Protocol/qaqsa28yrtpnxnbclv3p.svg?v=20260328">
4
- <img alt="Logic-Injection-on-Origin Protocol Logo" src="https://res.cloudinary.com/dsvsl0b0b/image/upload/v1774702621/Neural-Mesh-Protocol/hoanw0m6tybpz5fbl12n.svg?v=20260328" width="700">
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Nekzus/LIOP/main/docs/logo/dark.svg">
4
+ <img alt="Logic-Injection-on-Origin Protocol Logo" src="https://raw.githubusercontent.com/Nekzus/LIOP/main/docs/logo/light.svg" width="700">
5
5
  </picture>
6
6
 
7
- <h1>Logic-Injection-on-Origin Protocol (LIOP) — TypeScript SDK</h1>
8
- <p align="center">
9
- <a href="https://github.com/Nekzus/LIOP/actions/workflows/ci.yml"><img src="https://github.com/Nekzus/LIOP/actions/workflows/ci.yml/badge.svg?event=push" alt="Github Workflow"></a>
10
- <a href="https://www.npmjs.com/package/@nekzus/liop"><img src="https://img.shields.io/npm/v/@nekzus/liop.svg" alt="npm version"></a>
11
- <a href="https://www.npmjs.com/package/@nekzus/liop"><img src="https://img.shields.io/npm/dm/@nekzus/liop.svg" alt="npm-month"></a>
12
- <a href="https://www.npmjs.com/package/@nekzus/liop"><img src="https://img.shields.io/npm/dt/@nekzus/liop.svg?style=flat" alt="npm-total"></a>
13
- <a href="https://github.com/Nekzus/LIOP/blob/main/LICENSE"><img src="https://img.shields.io/github/license/Nekzus/LIOP.svg" alt="License"></a>
14
- <a href="https://nekzus-32.mintlify.app/"><img src="https://img.shields.io/badge/docs-mintlify-0D9373?style=flat" alt="Docs"></a>
15
- <a href="https://deepwiki.com/Nekzus/LIOP"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
16
- <a href="https://paypal.me/maseortega"><img src="https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square" alt="Donate"></a>
17
- </p>
18
-
19
- <p><strong>The official TypeScript SDK for the Logic-Injection-on-Origin Protocol.</strong></p>
20
- <p>Deploy Logic-on-Origin with WebAssembly sandboxing, gRPC-speed execution, and full MCP backward compatibility.</p>
7
+ <h1>Logic-Injection-on-Origin Protocol (LIOP), TypeScript SDK</h1>
8
+ <p><strong>The official TypeScript SDK and MCP Bridge for the Logic-Injection-on-Origin Protocol.</strong></p>
9
+
10
+ <p align="center">
11
+ <a href="https://github.com/Nekzus/LIOP/actions/workflows/ci.yml"><img src="https://github.com/Nekzus/LIOP/actions/workflows/ci.yml/badge.svg?event=push" alt="Github Workflow"></a>
12
+ <a href="https://www.npmjs.com/package/@nekzus/liop"><img src="https://img.shields.io/npm/v/@nekzus/liop.svg" alt="npm version"></a>
13
+ <a href="https://www.npmjs.com/package/@nekzus/liop"><img src="https://img.shields.io/npm/dm/@nekzus/liop.svg" alt="npm downloads"></a>
14
+ <a href="https://github.com/Nekzus/LIOP/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg" alt="License"></a>
15
+ <a href="https://nekzus-32.mintlify.app/typescript-sdk/overview"><img src="https://img.shields.io/badge/docs-mintlify-0D9373?style=flat" alt="Docs"></a>
16
+ <a href="https://deepwiki.com/Nekzus/LIOP"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
17
+ </p>
21
18
  </div>
22
19
 
23
20
  ---
24
21
 
22
+ ## Official Documentation
23
+
24
+ Comprehensive interactive guides, architectural deep dives, and API specifications are hosted on our official portal:
25
+
26
+ | Documentation Section | Focus Area | Canonical Guide |
27
+ |---|---|---|
28
+ | **Overview & Setup** | Package architecture, core exports, and installation modes | [SDK Overview](https://nekzus-32.mintlify.app/typescript-sdk/overview) |
29
+ | **LiopClient API** | Discovery, intent negotiation, gRPC channels, and error catalog | [LiopClient Reference](https://nekzus-32.mintlify.app/typescript-sdk/client) |
30
+ | **LiopServer API** | Capability hosting, Zod schemas, and V8 sandboxing boundaries | [LiopServer Reference](https://nekzus-32.mintlify.app/typescript-sdk/server) |
31
+ | **LiopMcpBridge** | Zero-trust wrapping of `@modelcontextprotocol/sdk` servers | [Bridge Documentation](https://nekzus-32.mintlify.app/typescript-sdk/bridge) |
32
+ | **Runtime & Discovery** | `TopologyProbe`, `RoutingTable` circuit breaker, and `TokenManager` | [Runtime Architecture](https://nekzus-32.mintlify.app/typescript-sdk/runtime) |
33
+ | **Security Architecture** | 6-Layer defense-in-depth, AST Guardian, and Egress PII Shield | [Security Guide](https://nekzus-32.mintlify.app/typescript-sdk/security) |
34
+ | **Observability & SRE** | Prometheus metrics catalog and 26-panel Grafana master dashboard | [Observability Runbook](https://nekzus-32.mintlify.app/operations/observability-runbook) |
35
+
36
+ ---
37
+
25
38
  ## Overview
26
39
 
27
- `@nekzus/liop` is an SDK that implements the **Logic-Injection-on-Origin (LIO)** paradigm: instead of extracting raw data from a server and sending it to an LLM, the LLM injects a micro-module of logic to be executed *at the data source*, inside a secure sandbox. The result — never the raw data — is returned.
40
+ `@nekzus/liop` is an SDK that implements the **Logic-Injection-on-Origin (LIO)** paradigm: instead of extracting raw data from a server and sending it to an LLM, the LLM injects a micro-module of logic to be executed *at the data source*, inside a secure sandbox. The result, and never the raw data, is returned.
28
41
 
29
- This fundamentally solves the data privacy, bandwidth, and latency challenges of AI-powered data analysis at scale.
42
+ This addresses the data privacy, bandwidth, and latency bottlenecks of distributed agent data analysis.
30
43
 
31
44
  ### Key Capabilities
32
45
 
33
46
  | Feature | Description |
34
47
  | :---------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------- |
35
48
  | **Logic-Injection-on-Origin** | LLMs send code, not queries. Data never leaves the origin server. |
36
- | **Dual-Era MCP Compliance** | Seamless support for modern stateless MCP v2 (2026-07-28) and legacy MCP (2025-11-25) clients (Claude Desktop, Cursor). |
49
+ | **Dual-Era MCP Compliance** | Dual-era compatibility supporting modern stateless MCP v2 (2026-07-28) and legacy MCP (2025-11-25) clients (Claude Desktop, Cursor). |
37
50
  | **Token Economy Engine** | Inlined BPE `o200k_base` tokenizer with zero runtime dependencies (16.5MB footprint reduction) and OpenTelemetry `gen_ai.*` bridge. |
38
- | **Interactive Playground UI** | Real-time Web UI (`:14000`) with live 7-phase SSE execution stream and cryptographic proof inspector. |
39
- | **MCP Drop-in Replacement** | `LiopServer` mirrors the Anthropic MCP `Server` API — tools, resources, and prompts with `Zod` schemas. |
40
- | **Guardian AST** | Zero-time heuristic inspection blocks sandbox escapes (`require`, `fs`, `eval`, `fetch`, prototype pollution). |
51
+ | **Interactive Playground UI** | Real-time Web UI (`:16000` prod / `:14000` dev) with 4-tab modular architecture (`Output`, `Debug`, `Telemetry`, `Export`), code generation (TS/cURL/Python), and dual OLED/Slate themes. |
52
+ | **Multi-Tier Sovereign Enclaves** | Physical socket isolation via `@libp2p/pnet` (256-bit Swarm Key PSK) and Border LIO Gateway (`blg`) with OAuth 2.1 authentication. |
53
+ | **AST Fuel Metering** | Deterministic AST instruction fuel scoring with 100-bucket quantization for NIST SP 800-53 timing side-channel elimination (`stddev = 0`).|
54
+ | **Differential Privacy Engine** | NIST SP 800-226 Laplace mechanism with CSPRNG entropy, query-aware sensitivity, and deterministic ZK-Receipt auditing (`DpEngine`). |
55
+ | **MCP Drop-in Replacement** | `LiopServer` mirrors the Anthropic MCP `Server` API (tools, resources, and prompts with `Zod` schemas). |
56
+ | **Guardian AST** | Pre-execution heuristic inspection blocks sandbox escapes (`require`, `fs`, `eval`, `fetch`, prototype pollution). |
57
+ | **IFC Taint Analyzer** | 5-pass Acorn AST information flow control tracking collection aliases, correlation guards, and extrema gates at preflight. |
41
58
  | **WASI Sandbox** | JavaScript payloads execute inside V8 isolates with CPU fuel limits, no Node.js globals, and safe environment isolation (`allowEnv`). |
42
- | **PII Shield** | Multi-layer egress filter with Regional Presets, custom keys, and recursive floats sanitization (`sanitizeOutput`). |
43
- | **ZK-Receipts** | Cryptographic proof with `output_hash` cross-verification (Replay Mitigation) and balanced-brace proxy extraction. |
59
+ | **Adaptive Network Discovery**| Single-URL RFC 9728 Protected Resource Metadata probe and adaptive execution mode resolution (`TopologyProbe`). |
60
+ | **Resilient Hybrid Routing** | Deterministic per-tool multiplexing across `http-gateway`, `p2p-grpc`, and `local` with 5-failure circuit breaker (`RoutingTable`).|
61
+ | **OAuth 2.1 M2M Lifecycle** | Concurrency in-flight de-duplication, 30-second preemptive refresh buffer, and reactive invalidation (`TokenManager`). |
62
+ | **Sliding-Window Rate Limiter**| In-memory OWASP API4:2023 rate limiting with background cleanup unreferenced intervals (`InMemoryRateLimiter`). |
63
+ | **ZK-Receipts** | Tri-modal Zero-Knowledge proofs: HMAC-SHA256 (v1), Groth16 BN254 with 144-byte binary journal (v2), and dual-layer ML-DSA-65 post-quantum hybrid receipts (v2.1). Enforces `ZK_BLOCKING` on Tier 1 Enclaves. |
64
+ | **Hardware TEE Attestation** | Pre-flight validation of confidential hardware root-of-trust evidence for AMD SEV-SNP (1,184-byte report) and AWS Nitro Enclaves (`verifyTeeAttestationDetailed`). |
44
65
  | **Worker Pool** | Heavy computation (crypto, sandboxing) dispatched to OS threads via `piscina` with background async warmup. |
45
66
  | **Post-Quantum Ready** | ML-KEM-768 (Kyber) + ML-DSA-65 (Dilithium) with 1-hour session lifetime and AES-256-GCM encryption. |
46
- | **Enterprise Observability** | Immutable SOC 2 Hash-Chain audit log (`AuditLogger`), Prometheus metrics (`/metrics`), and Kubernetes probes (`/healthz`, `/readyz`). |
67
+ | **Enterprise Observability** | Immutable SOC 2 Hash-Chain audit log (`AuditLogger`), physical wire egress tracking, Prometheus metrics (`/metrics`), and K8s probes. |
47
68
  | **P2P Mesh** | Kademlia DHT discovery via `libp2p` with TCP + WebSocket + Yamux multiplexing and Noise encryption. |
48
69
 
49
70
  ---
@@ -64,7 +85,7 @@ npm install @nekzus/liop@beta
64
85
 
65
86
  ### Zero-Bloat & Micro-Deployments (Opt-Out)
66
87
 
67
- By default, the SDK provides out-of-the-box MCP backward compatibility (`LiopMcpBridge`) by declaring `@modelcontextprotocol/sdk` as an optional dependency (which is automatically resolved by standard installations of NPM, PNPM, or Yarn).
88
+ By default, the SDK provides backward compatibility with MCP (`LiopMcpBridge`) by declaring `@modelcontextprotocol/sdk` as an optional dependency (which is automatically resolved by standard installations of NPM, PNPM, or Yarn).
68
89
 
69
90
  For constrained production environments (e.g., Docker, AWS Lambda, Edge/IoT) where every megabyte counts, you can perform a **pure, zero-bloat LIOP installation** by opting out of the optional dependencies:
70
91
 
@@ -100,7 +121,7 @@ npm install -g @nekzus/liop@latest
100
121
  liop
101
122
  ```
102
123
 
103
- ### 🤖 Claude Desktop Configuration
124
+ ### Claude Desktop Configuration
104
125
 
105
126
  To integrate LIOP into Claude Desktop, update your `claude_desktop_config.json` (typically found in `%APPDATA%\Claude\claude_desktop_config.json` on Windows):
106
127
 
@@ -111,7 +132,7 @@ To integrate LIOP into Claude Desktop, update your `claude_desktop_config.json`
111
132
  "command": "npx",
112
133
  "args": ["-y", "@nekzus/liop@latest"],
113
134
  "env": {
114
- "LIOP_NEXUS_URL": "http://your-nexus-host:3000",
135
+ "LIOP_NEXUS_URL": "http://your-nexus-host:15000",
115
136
  "LIOP_LOG_LEVEL": "info",
116
137
  "LIOP_TOKEN_BANK": "your-secure-bank-token",
117
138
  "LIOP_TOKEN_VAULT": "your-secure-vault-token",
@@ -164,7 +185,7 @@ server.tool(
164
185
  "Analyzes local log files without sending raw data to the LLM.",
165
186
  { target_error: z.string().describe("The error pattern to search for") },
166
187
  async ({ target_error }) => {
167
- // This logic runs at origin — data never leaves the server
188
+ // This logic runs at origin, data never leaves the server
168
189
  return {
169
190
  content: [{ type: "text", text: `Found 51 occurrences of ${target_error}` }],
170
191
  };
@@ -303,32 +324,32 @@ await bridge.connect();
303
324
 
304
325
  **Supported JSON-RPC methods:**
305
326
 
306
- - `initialize` — Returns server capabilities and info
307
- - `tools/list` — Lists available tools
308
- - `tools/call` — Calls a tool (with ZK-Receipt verification)
309
- - `resources/list` — Lists available resources
310
- - `resources/read` — Reads a resource
311
- - `prompts/list` — Lists available prompts
312
- - `prompts/get` — Gets a specific prompt
327
+ - `initialize`: Returns server capabilities and info
328
+ - `tools/list`: Lists available tools
329
+ - `tools/call`: Calls a tool (with ZK-Receipt verification)
330
+ - `resources/list`: Lists available resources
331
+ - `resources/read`: Reads a resource
332
+ - `prompts/list`: Lists available prompts
333
+ - `prompts/get`: Gets a specific prompt
313
334
 
314
335
  ---
315
336
 
316
337
  ## Security Architecture
317
338
 
318
- ### The Shield — Multi-Layer Defense
339
+ ### Defense-in-Depth Architecture
319
340
 
320
341
  ```
321
342
  ┌───────────────────────────────────────────────────────────┐
322
- │ Layer 1: Guardian AST (Zero-Time Static Analysis) │
343
+ │ Layer 1: Guardian AST (Pre-Execution Static Analysis) │
323
344
  │ 14-function WASI allowlist • 128 import cap • Blocks │
324
345
  │ require, import(), fs, eval, fetch, __proto__ │
325
- ├───────────────────────────────────────────────────────────┐
346
+ ├───────────────────────────────────────────────────────────┤
326
347
  │ Layer 2: WASI Sandbox (V8 Isolate) │
327
348
  │ 25 poisoned globals (incl. Date, TypedArrays) • │
328
349
  │ CPU Fuel limits • 5s timeout • maxHeapMb (64MB default) │
329
350
  │ Object.freeze() on 11 core prototypes • allowEnv allowlist │
330
351
  ├───────────────────────────────────────────────────────────┤
331
- │ Layer 3: Taint Analyzer (IFC — Static) │
352
+ │ Layer 3: Taint Analyzer (IFC, Static) │
332
353
  │ Acorn AST 3-pass analysis blocks PII side-channels: │
333
354
  │ charCodeAt, boolean inference, arithmetic derivation │
334
355
  ├───────────────────────────────────────────────────────────┤
@@ -341,8 +362,9 @@ await bridge.connect();
341
362
  │ Blocks raw row export • maxOutputRows (default: 10) • │
342
363
  │ Conditional error: detailed (dev) vs opaque (production) │
343
364
  ├───────────────────────────────────────────────────────────┤
344
- │ Layer 6: ZK-Receipt (Integrity & Replay Mitigation) │
345
- │ SHA-256 ImageID + HMAC-SHA256 Seal (Kyber768-derived) • │
365
+ │ Layer 6: ZK-Receipt (Groth16 BN254 & Replay Mitigation) │
366
+ │ Version 2: 144-byte binary journal + Groth16 curve points │
367
+ │ Version 1: HMAC-SHA256 session commitment (Kyber768) │
346
368
  │ output_hash cross-verification • Balanced-brace extractor │
347
369
  └───────────────────────────────────────────────────────────┘
348
370
  ```
@@ -386,7 +408,7 @@ const server = new LiopServer(info, {
386
408
 
387
409
  To avoid false positive triggers caused by HMAC-SHA256 ZK-Receipt signatures or transport wrapper frames (such as `{ content: [{ type: "text", text: "..." }] }`), the PII Shield and Aggregation-First engines scan only the unwrapped business data (via `unwrapForAggregationPolicyScan`). Cryptographic seals and protocol routing structures are isolated and excluded from compliance scans.
388
410
 
389
- ### 📊 3-Tier Query Budget (NIST SP 800-226)
411
+ ### 3-Tier Query Budget (NIST SP 800-226)
390
412
 
391
413
  To prevent advanced statistical differentiation or database reconstruction attacks, the SDK implements a tiered, session-based budget engine:
392
414
 
@@ -396,27 +418,27 @@ To prevent advanced statistical differentiation or database reconstruction attac
396
418
 
397
419
  If an injected payload queries a field beyond its budget limit, the preflight static analysis immediately blocks execution.
398
420
 
399
- ### 🛡️ K-Anonymity on Small Datasets
421
+ ### K-Anonymity on Small Datasets
400
422
 
401
423
  When operating on high-privacy datasets, if the source records count is **less than 10**, the SDK forces a strict K-Anonymity restriction:
402
424
  - Rejects any output that contains nested objects or arrays.
403
425
  - Restricts the returned structure to a maximum of **3 scalar keys** (e.g., simple aggregate counts or statistics).
404
426
  - Prevents structural data leakage in low-entropy datasets.
405
427
 
406
- ### ❄️ Sandbox Poisoned Globals & Date Workaround
428
+ ### Sandbox Poisoned Globals & Date Workaround
407
429
 
408
430
  For maximum host security, the WASI sandbox enforces a poisoned environment that strips dangerous globals and prevents timing side-channels:
409
431
  - **Poisoned/Disabled**: `Date` (Date.now, parse, etc. throw an exception to prevent timing analysis), `eval`, `Function`, `setTimeout`, `setInterval`, `Buffer`, `ArrayBuffer`, and all `TypedArrays`.
410
432
  - **Date Workaround**: To perform date checks, use lexicographical string comparison on ISO 8601 strings (e.g., `record.date >= "2026-01-01"`).
411
433
 
412
- ### 🧹 Recursive In-Memory Numerical Sanitization
434
+ ### Recursive In-Memory Numerical Sanitization
413
435
 
414
436
  To mitigate timing channels, statistical differentiation, and floats side-channels, the SDK executes a recursive sanitization pipeline before the PII scanner runs:
415
437
  - Positive floating-point numbers are recursively rounded to exactly **4 decimal places**.
416
438
  - Negative values are safely clamped to **0** (via `sanitizeOutput()`).
417
439
  - This operation runs entirely in-memory and recursively on all fields, preserving data structure immutability without expensive and fragile serialization-deserialization cycles.
418
440
 
419
- ### 🌐 Environment Isolation & allowEnv Allowlist
441
+ ### Environment Isolation & allowEnv Allowlist
420
442
 
421
443
  For robust sandboxing, the WASI execution path isolates host environment variables. Propagation can be enabled explicitly:
422
444
  ```typescript
@@ -429,11 +451,57 @@ To block arbitrary command execution (e.g., Shellshock) and prevent exposure of
429
451
  - **Unix/Linux Allowlist**: `HOME`, `LOGNAME`, `PATH`, `SHELL`, `TERM`, `USER`.
430
452
  Variables starting with shell functions `()` are dropped.
431
453
 
432
- ### 🔒 ZK-Receipt Replay & Tampering Mitigation
454
+ ### Sovereign Tri-Modal ZK-Receipts & Hardware Attestation
455
+
456
+ LIOP ZK-Receipts provide cryptographic evidence that a computation was executed honestly under zero-trust bounds. The protocol implements three complementary cryptographic modes:
457
+ - **Mode 0 (`HMAC_LEGACY`, v1)**: Session commitments sealed with the ML-KEM-768 quantum-resistant shared key.
458
+ - **Mode 2 (`GROTH16`, v2)**: Compact Zero-Knowledge SNARK proofs over the BN254 pairing-friendly elliptic curve packing a 144-byte binary journal (~252 bytes total).
459
+ - **Mode 3 (`GROTH16_PQC_HYBRID`, v2.1)**: Dual-layer receipts combining Groth16 BN254 mathematical proofs with an ML-DSA-65 post-quantum digital signature conforming to NIST FIPS 204 (~5.6 KB total).
460
+
461
+ - **144-Byte Binary Journal Layout**:
462
+ - `guest_image_id` (32 bytes): Sovereign enclave guest runtime image identifier
463
+ - `logic_digest` (32 bytes): SHA-256 fingerprint of the executed JavaScript/WASM logic
464
+ - `dataset_digest` (32 bytes): SHA-256 fingerprint of the origin dataset at execution time
465
+ - `output_digest` (32 bytes): SHA-256 fingerprint of the sanitized computation result
466
+ - `fuel_consumed` (8 bytes uint64 BE): Quantized instruction-level AST fuel units consumed
467
+ - `execution_timestamp` (8 bytes uint64 BE): Epoch timestamp in milliseconds
468
+ - **Tampering & Replay Mitigation**: The client computes the local SHA-256 hash of the received output and asserts strict equality with `journal.outputDigest`. Any modified bit in either the journal, curve proof, or post-quantum signature causes immediate rejection.
469
+ - **Enclave Policy Invariant (`ZK_BLOCKING`)**: Tier 1 Sovereign Enclaves configure `zkMode: "required"`, rejecting queries if a valid Groth16 proof cannot be synthesized or if mock proofs are supplied. When `pqcSign: true` is configured, the enclave emits a Version 2.1 hybrid receipt co-signed with ML-DSA-65.
470
+
471
+ ```typescript
472
+ import { LiopServer } from "@nekzus/liop/server";
473
+ import { LiopVerifier, verifyTeeAttestationDetailed } from "@nekzus/liop";
474
+
475
+ // 1. Enclave configuration with ZK_BLOCKING and PQC signing
476
+ const server = new LiopServer({ name: "bank-enclave", version: "1.0.0" });
477
+ server.tool(
478
+ "calculate_payroll_aggregate",
479
+ "Aggregates payroll without egressing employee identities",
480
+ { payload: z.string() },
481
+ async () => ({ content: [{ type: "text", text: "ok" }] }),
482
+ {
483
+ zkMode: "required", // Enforces Groth16 proof generation (ZK_BLOCKING)
484
+ pqcSign: true, // Enables ML-DSA-65 digital signature (Receipt v2.1)
485
+ circuitName: "sum",
486
+ }
487
+ );
433
488
 
434
- LIOP ZK-Receipts provide cryptographic evidence that a computation was executed honestly under zero-trust bounds. To defeat **Man-in-the-Middle (MITM) reply tampering and replay attacks** (re-using old signatures on new query data):
435
- - The verification pipeline computes the SHA-256 hash of the received business output (`expectedOutput`) and strictly asserts its equivalence with `Journal.output_hash` signed inside the ZK-Receipt (via `verifyZkReceipt`).
436
- - **Balanced-Brace Proxy Extractor**: If the tool call was delegated to a proxied tool (`__liop_proxy_tool`), the verifier invokes an in-process balanced-brace state machine to safely isolate proxy arguments from the response metadata, preventing false validation failures.
489
+ // 2. Client verification via LiopVerifier
490
+ const verifier = new LiopVerifier();
491
+ const isValid = await verifier.verifyZkReceipt(
492
+ Buffer.from(logicPayload),
493
+ remoteImageIdHex,
494
+ rawReceiptBuffer,
495
+ { zkPolicy: "required" }
496
+ );
497
+
498
+ // 3. Pre-flight Hardware TEE Attestation (AMD SEV-SNP / AWS Nitro Enclaves)
499
+ const teeStatus = await verifyTeeAttestationDetailed(
500
+ attestationBytes,
501
+ expectedNonce,
502
+ { requireHardwareSigned: true }
503
+ );
504
+ ```
437
505
 
438
506
  ---
439
507
 
@@ -444,11 +512,11 @@ The following shows a complete Logic-Injection-on-Origin execution cycle (handle
444
512
  ```
445
513
  1. LLM generates JavaScript analysis code wrapped in @LIOP / @END boundaries
446
514
  2. LiopServer receives the payload via tools/call (JSON-RPC or direct)
447
- 3. Guardian AST inspects for sandbox escapes (zero-time heuristic analysis)
515
+ 3. Guardian AST inspects for sandbox escapes (pre-execution heuristic analysis)
448
516
  4. Code executes inside a V8 isolate with CPU fuel limits (no Node.js globals)
449
517
  5. Taint Analyzer blocks PII side-channel derivation (charCodeAt, boolean inference)
450
518
  6. PII Shield scans output for forbidden data and keys
451
- 7. ZK-Receipt generated (SHA-256 ImageID + HMAC-SHA256 seal)
519
+ 7. ZK-Receipt generated (Tri-modal: HMAC v1, Groth16 v2, or Groth16 + ML-DSA-65 v2.1)
452
520
  8. Result + receipt returned to the LLM (raw data never exposed)
453
521
  ```
454
522
 
@@ -477,7 +545,7 @@ Node.js is single-threaded. Heavy operations like Kyber768 decryption, AES-GCM a
477
545
  This SDK dispatches all heavy computation to OS-level threads via [`piscina`](https://github.com/piscinajs/piscina), achieving Rust-like concurrency. On server or verifier initialization, background warmup tasks are automatically dispatched to pre-warm the pool workers, eliminating V8/WASI cold-start overhead (~820k fuel units) for subsequent calls:
478
546
 
479
547
  ```typescript
480
- // Automatic — no configuration needed
548
+ // Automatic, no configuration needed
481
549
  // When a Logic-Injection-on-Origin payload is received:
482
550
  // 1. Main thread receives JSON-RPC request
483
551
  // 2. Worker thread: AST inspection + PQC decryption + Sandbox execution
@@ -528,21 +596,32 @@ await server.connectToMesh();
528
596
 
529
597
  ---
530
598
 
531
- ## Interactive Web Playground (`:14000`)
599
+ ## Interactive Web Playground (`:16000` prod / `:14000` dev)
532
600
 
533
- The SDK includes an industrial, real-time developer interface to visually test Logic-Injection-on-Origin, trace post-quantum handshakes, and inspect cryptographic proofs:
601
+ The SDK includes a real-time developer interface to test Logic-Injection-on-Origin, trace post-quantum handshakes, evaluate AST fuel consumption, and inspect cryptographic proofs:
534
602
 
535
603
  ```bash
536
- # Launch the full Docker mesh and interactive Web UI
604
+ # 1. Launch the full 10-node production audit mesh with traffic shaping (http://localhost:16000)
605
+ pnpm run audit:prod:start
606
+
607
+ # Run the 12-suite automated production audit against the mesh (64 tests)
608
+ pnpm run audit:prod:run
609
+
610
+ # Teardown and cleanup production containers
611
+ pnpm run audit:prod:clean
612
+
613
+ # 2. Alternatively, launch the lightweight 5-node demo (http://localhost:14000)
537
614
  pnpm run demo:start
538
615
  ```
539
616
 
540
- Navigate to **`http://localhost:14000`** in your browser:
617
+ Navigate to **`http://localhost:16000`** in your browser:
541
618
 
542
619
  * **Live 7-Phase Streaming:** Visualizes Bootstrap, DHT Discovery, ML-KEM-768 Handshake, AES-256-GCM Sealing, WASI Sandbox Execution, ZK-Receipt Verification, and Output Aggregation via real-time Server-Sent Events (SSE).
543
- * **Built-in Industrial Presets:** Ready-to-run micro-modules for High-Frequency Trading (HFT Level 2 order books), Banking transaction analysis, Medical Vault HIPAA records, and PII exfiltration defense.
544
- * **Cryptographic Proof Inspector:** Validates SHA-256 `ImageID`, HMAC-SHA256 ZK-receipt seals, and dataset integrity digests on the fly.
545
- * **Dual Dark Modes:** Seamlessly toggle between OLED Obsidian and Slate Midnight interfaces.
620
+ * **Tri-Tab Results Panel:** Switch between `Aggregated Output` (sanitized JSON), `Fuel & Telemetry` (WASI fuel metering, token economy comparison banner), and `Crypto Proofs` (ImageID, Dataset Hash, and HMAC-SHA256 signature with instant copy).
621
+ * **Token Economy Dashboard:** Live comparison showing **98.9% to 99.6% token reduction** and **99.6% network bandwidth savings** over traditional MCP context-pulling.
622
+ * **REST Telemetry Endpoint:** Query session analytics programmatically at `GET http://localhost:16000/api/telemetry`.
623
+ * **Built-in Scenario Presets:** Ready-to-run micro-modules for High-Frequency Trading (HFT Level 2 order books), Banking transaction analysis, Medical Vault HIPAA records, and Edge IoT industrial sensor telemetry.
624
+ * **Dual Dark Modes:** Toggle between Obsidian OLED (`#000000`) and Slate Navy (`#0f172a`) interfaces.
546
625
 
547
626
  ---
548
627
 
@@ -586,7 +665,7 @@ This package is continuously tested across multiple platforms and Node.js versio
586
665
  - **Multi-OS matrix:** Ubuntu, Windows, macOS
587
666
  - **Node.js versions:** 20.x, 22.x
588
667
  - **Code quality:** Enforced by [Biome.js](https://biomejs.dev/) (linting + formatting)
589
- - **Security:** Verified 6-layer defense-in-depth architecture — see [Security Architecture](https://nekzus-32.mintlify.app/typescript-sdk/security)
668
+ - **Security:** Verified 6-layer defense-in-depth architecture (see [Security Architecture](https://nekzus-32.mintlify.app/typescript-sdk/security))
590
669
 
591
670
  > To run tests locally or contribute, clone the [repository](https://github.com/Nekzus/LIOP) and follow the [Contributing Guide](https://github.com/Nekzus/LIOP/blob/main/CONTRIBUTING.md).
592
671
 
@@ -600,18 +679,18 @@ You can run security audits and check package health scores directly from the mo
600
679
  - **Check SDK Security Score:** `pnpm socket:score` (shows the detailed package score for the SDK in Markdown format)
601
680
  - **Fix Vulnerabilities:** `pnpm socket:fix` (automatically remediates known CVEs in package.json)
602
681
 
603
- The codebase undergoes regular dependencies audits. As of June 2026, the SDK is verified to be 100% free of orphan packages and dead dependencies, ensuring an ultra-lightweight deployment footprint.
682
+ The codebase undergoes regular dependencies audits. As of June 2026, the SDK is verified to be 100% free of orphan packages and dead dependencies, ensuring a minimal deployment footprint.
604
683
 
605
684
  ---
606
685
 
607
686
  ## Related
608
687
 
609
- - [LIOP Documentation](https://nekzus-32.mintlify.app/) — Full conceptual and API documentation
610
- - [LIOP Specification](https://github.com/Nekzus/LIOP/blob/main/protocol/SPECIFICATION.md) — Technical specification
611
- - [LIOP Manifesto](https://github.com/Nekzus/LIOP/blob/main/MANIFESTO.md) — Project philosophy
612
- - [Contributing Guide](https://github.com/Nekzus/LIOP/blob/main/CONTRIBUTING.md) — How to contribute
613
- - [Rust Mesh Node](https://github.com/Nekzus/LIOP/tree/main/servers/liop-node) — Native high-performance backend
614
- - [LIOP CLI](https://github.com/Nekzus/LIOP/tree/main/tools/liop-cli) — Developer diagnostics
688
+ - [LIOP Documentation](https://nekzus-32.mintlify.app/): Full conceptual and API documentation
689
+ - [LIOP Specification](https://github.com/Nekzus/LIOP/blob/main/protocol/SPECIFICATION.md): Technical specification
690
+ - [LIOP Manifesto](https://github.com/Nekzus/LIOP/blob/main/MANIFESTO.md): Project philosophy
691
+ - [Contributing Guide](https://github.com/Nekzus/LIOP/blob/main/CONTRIBUTING.md): How to contribute
692
+ - [Rust Mesh Node](https://github.com/Nekzus/LIOP/tree/main/servers/liop-node): Native high-performance backend
693
+ - [LIOP CLI](https://github.com/Nekzus/LIOP/tree/main/tools/liop-cli): Developer diagnostics
615
694
 
616
695
  ---
617
696