@nekzus/liop 2.4.0-alpha.24 → 2.4.0-alpha.26

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 (109) hide show
  1. package/README.md +21 -10
  2. package/dist/bin/agent.js +27 -932
  3. package/dist/bridge.d.ts +3 -3
  4. package/dist/bridge.js +1 -5
  5. package/dist/chunk-2XHSALII.js +3 -0
  6. package/dist/chunk-2ZYX736J.js +2 -0
  7. package/dist/chunk-3WRKTVOF.js +2 -0
  8. package/dist/chunk-6KFKO6ZX.js +2 -0
  9. package/dist/chunk-6VK2XALI.js +2 -0
  10. package/dist/chunk-AYDF3IFZ.js +2 -0
  11. package/dist/chunk-CTTTLCGL.js +31 -0
  12. package/dist/chunk-ECRS6N33.js +4 -0
  13. package/dist/chunk-FDJMH4CB.js +2 -0
  14. package/dist/chunk-FTF6AMF6.js +0 -1
  15. package/dist/chunk-GWVSCZUS.js +2 -0
  16. package/dist/chunk-LEXMMIQI.js +15 -0
  17. package/dist/chunk-LM26HOJ6.js +31 -0
  18. package/dist/chunk-MQ5SU26J.js +2 -0
  19. package/dist/chunk-N35BC62H.js +2 -0
  20. package/dist/chunk-P6IJ3VBD.js +3 -0
  21. package/dist/chunk-TKLRW52V.js +2 -0
  22. package/dist/chunk-V35CXJQN.js +2 -0
  23. package/dist/chunk-WP5ER7RH.js +3 -0
  24. package/dist/chunk-XLVEDKM6.js +2 -0
  25. package/dist/chunk-Y675R34Z.js +2 -0
  26. package/dist/chunk-YD2AF2M6.js +46 -0
  27. package/dist/chunk-YLCNV764.js +3 -0
  28. package/dist/chunk-ZZMSFCJP.js +3 -0
  29. package/dist/client.d.ts +4 -4
  30. package/dist/client.js +1 -12
  31. package/dist/gateway.d.ts +5 -5
  32. package/dist/gateway.js +1 -12
  33. package/dist/{hybrid-Cb95yJFg.d.ts → hybrid-BZpCiUaV.d.ts} +3 -3
  34. package/dist/{index-DtovobWb.d.ts → index-BYDtRGue.d.ts} +3 -3
  35. package/dist/{index-D2P6Z_hP.d.ts → index-ByzjpRCk.d.ts} +6 -1
  36. package/dist/index.d.ts +15 -10
  37. package/dist/index.js +4 -319
  38. package/dist/kyber-PULV7PQX.js +2 -0
  39. package/dist/mesh.js +1 -5
  40. package/dist/server.d.ts +3 -3
  41. package/dist/server.js +1 -9
  42. package/dist/{types-rxL19f0l.d.ts → types-29zv9X1V.d.ts} +1 -1
  43. package/dist/types.d.ts +2 -2
  44. package/dist/types.js +1 -3
  45. package/dist/{verifier-EgKmGrh7.d.ts → verifier-DqZ9MQ9l.d.ts} +34 -5
  46. package/dist/verifier-J4NQYZX5.js +2 -0
  47. package/dist/workers/logic-execution.d.ts +2 -1
  48. package/dist/workers/logic-execution.js +1 -326
  49. package/dist/workers/zk-verifier.d.ts +1 -1
  50. package/dist/workers/zk-verifier.js +1 -245
  51. package/dist/{zk-CYImPsa6.d.ts → zk-DzYNWBgo.d.ts} +14 -1
  52. package/package.json +6 -2
  53. package/dist/bin/agent.js.map +0 -1
  54. package/dist/bridge.js.map +0 -1
  55. package/dist/chunk-2VQS2XRH.js +0 -564
  56. package/dist/chunk-2VQS2XRH.js.map +0 -1
  57. package/dist/chunk-3QH44NKZ.js +0 -115
  58. package/dist/chunk-3QH44NKZ.js.map +0 -1
  59. package/dist/chunk-53QKIQNF.js +0 -818
  60. package/dist/chunk-53QKIQNF.js.map +0 -1
  61. package/dist/chunk-7BSCUYUE.js +0 -421
  62. package/dist/chunk-7BSCUYUE.js.map +0 -1
  63. package/dist/chunk-7PITYWOV.js +0 -68
  64. package/dist/chunk-7PITYWOV.js.map +0 -1
  65. package/dist/chunk-FTF6AMF6.js.map +0 -1
  66. package/dist/chunk-GFGSHQN5.js +0 -206884
  67. package/dist/chunk-GFGSHQN5.js.map +0 -1
  68. package/dist/chunk-IDTXJQBH.js +0 -1506
  69. package/dist/chunk-IDTXJQBH.js.map +0 -1
  70. package/dist/chunk-IHKKWXHJ.js +0 -876
  71. package/dist/chunk-IHKKWXHJ.js.map +0 -1
  72. package/dist/chunk-IK7CGWAZ.js +0 -24
  73. package/dist/chunk-IK7CGWAZ.js.map +0 -1
  74. package/dist/chunk-JWFLXXZS.js +0 -3743
  75. package/dist/chunk-JWFLXXZS.js.map +0 -1
  76. package/dist/chunk-K3DGJLUY.js +0 -106
  77. package/dist/chunk-K3DGJLUY.js.map +0 -1
  78. package/dist/chunk-KR5UZUEY.js +0 -98
  79. package/dist/chunk-KR5UZUEY.js.map +0 -1
  80. package/dist/chunk-OHMZZMMC.js +0 -58
  81. package/dist/chunk-OHMZZMMC.js.map +0 -1
  82. package/dist/chunk-P34HDRN5.js +0 -213
  83. package/dist/chunk-P34HDRN5.js.map +0 -1
  84. package/dist/chunk-Q3FKHJ3B.js +0 -345
  85. package/dist/chunk-Q3FKHJ3B.js.map +0 -1
  86. package/dist/chunk-V47P2AQR.js +0 -281
  87. package/dist/chunk-V47P2AQR.js.map +0 -1
  88. package/dist/chunk-WPTOJYN5.js +0 -181
  89. package/dist/chunk-WPTOJYN5.js.map +0 -1
  90. package/dist/chunk-Y62GORQF.js +0 -51
  91. package/dist/chunk-Y62GORQF.js.map +0 -1
  92. package/dist/chunk-ZJGVKM7G.js +0 -803
  93. package/dist/chunk-ZJGVKM7G.js.map +0 -1
  94. package/dist/chunk-ZP3VVXOI.js +0 -66
  95. package/dist/chunk-ZP3VVXOI.js.map +0 -1
  96. package/dist/chunk-ZRWNMP5L.js +0 -165
  97. package/dist/chunk-ZRWNMP5L.js.map +0 -1
  98. package/dist/client.js.map +0 -1
  99. package/dist/gateway.js.map +0 -1
  100. package/dist/index.js.map +0 -1
  101. package/dist/kyber-CGOA7Q6A.js +0 -3
  102. package/dist/kyber-CGOA7Q6A.js.map +0 -1
  103. package/dist/mesh.js.map +0 -1
  104. package/dist/server.js.map +0 -1
  105. package/dist/types.js.map +0 -1
  106. package/dist/verifier-UBJTZQSA.js +0 -6
  107. package/dist/verifier-UBJTZQSA.js.map +0 -1
  108. package/dist/workers/logic-execution.js.map +0 -1
  109. package/dist/workers/zk-verifier.js.map +0 -1
package/README.md CHANGED
@@ -60,8 +60,8 @@ This addresses the data privacy, bandwidth, and latency bottlenecks of distribut
60
60
  | **Resilient Hybrid Routing** | Deterministic per-tool multiplexing across `http-gateway`, `p2p-grpc`, and `local` with 5-failure circuit breaker (`RoutingTable`).|
61
61
  | **OAuth 2.1 M2M Lifecycle** | Concurrency in-flight de-duplication, 30-second preemptive refresh buffer, and reactive invalidation (`TokenManager`). |
62
62
  | **Sliding-Window Rate Limiter**| In-memory OWASP API4:2023 rate limiting with background cleanup unreferenced intervals (`InMemoryRateLimiter`). |
63
- | **PII Shield** | Multi-layer egress filter with Regional Presets, custom keys, and recursive floats sanitization (`sanitizeOutput`). |
64
- | **ZK-Receipts** | Sovereign Zero-Knowledge Proofs: Groth16 BN254 with 144-byte binary journal (v2) and legacy HMAC-SHA256 (v1). Enforces `ZK_BLOCKING` on Tier 1 Enclaves. |
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`). |
65
65
  | **Worker Pool** | Heavy computation (crypto, sandboxing) dispatched to OS threads via `piscina` with background async warmup. |
66
66
  | **Post-Quantum Ready** | ML-KEM-768 (Kyber) + ML-DSA-65 (Dilithium) with 1-hour session lifetime and AES-256-GCM encryption. |
67
67
  | **Enterprise Observability** | Immutable SOC 2 Hash-Chain audit log (`AuditLogger`), physical wire egress tracking, Prometheus metrics (`/metrics`), and K8s probes. |
@@ -451,25 +451,28 @@ To block arbitrary command execution (e.g., Shellshock) and prevent exposure of
451
451
  - **Unix/Linux Allowlist**: `HOME`, `LOGNAME`, `PATH`, `SHELL`, `TERM`, `USER`.
452
452
  Variables starting with shell functions `()` are dropped.
453
453
 
454
- ### Sovereign ZK-Receipts & Groth16 Attestation
454
+ ### Sovereign Tri-Modal ZK-Receipts & Hardware Attestation
455
455
 
456
- LIOP ZK-Receipts provide cryptographic evidence that a computation was executed honestly under zero-trust bounds. Version 2 receipts introduce true Zero-Knowledge Groth16 proofs over the BN254 pairing-friendly elliptic curve, packing a 144-byte binary journal:
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).
457
460
 
458
461
  - **144-Byte Binary Journal Layout**:
459
462
  - `guest_image_id` (32 bytes): Sovereign enclave guest runtime image identifier
460
463
  - `logic_digest` (32 bytes): SHA-256 fingerprint of the executed JavaScript/WASM logic
461
464
  - `dataset_digest` (32 bytes): SHA-256 fingerprint of the origin dataset at execution time
462
465
  - `output_digest` (32 bytes): SHA-256 fingerprint of the sanitized computation result
463
- - `fuel_consumed` (8 bytes uint64 BE): AST fuel metering units consumed
466
+ - `fuel_consumed` (8 bytes uint64 BE): Quantized instruction-level AST fuel units consumed
464
467
  - `execution_timestamp` (8 bytes uint64 BE): Epoch timestamp in milliseconds
465
- - **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 or curve proof causes immediate rejection.
466
- - **Enclave Policy Invariant (`ZK_BLOCKING`)**: Tier 1 Sovereign Enclaves configure `zkMode: "required"`, rejecting queries if a valid Groth16 proof cannot be synthesized.
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.
467
470
 
468
471
  ```typescript
469
472
  import { LiopServer } from "@nekzus/liop/server";
470
- import { LiopVerifier } from "@nekzus/liop";
473
+ import { LiopVerifier, verifyTeeAttestationDetailed } from "@nekzus/liop";
471
474
 
472
- // 1. Enclave configuration with ZK_BLOCKING policy
475
+ // 1. Enclave configuration with ZK_BLOCKING and PQC signing
473
476
  const server = new LiopServer({ name: "bank-enclave", version: "1.0.0" });
474
477
  server.tool(
475
478
  "calculate_payroll_aggregate",
@@ -478,6 +481,7 @@ server.tool(
478
481
  async () => ({ content: [{ type: "text", text: "ok" }] }),
479
482
  {
480
483
  zkMode: "required", // Enforces Groth16 proof generation (ZK_BLOCKING)
484
+ pqcSign: true, // Enables ML-DSA-65 digital signature (Receipt v2.1)
481
485
  circuitName: "sum",
482
486
  }
483
487
  );
@@ -490,6 +494,13 @@ const isValid = await verifier.verifyZkReceipt(
490
494
  rawReceiptBuffer,
491
495
  { zkPolicy: "required" }
492
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
+ );
493
504
  ```
494
505
 
495
506
  ---
@@ -505,7 +516,7 @@ The following shows a complete Logic-Injection-on-Origin execution cycle (handle
505
516
  4. Code executes inside a V8 isolate with CPU fuel limits (no Node.js globals)
506
517
  5. Taint Analyzer blocks PII side-channel derivation (charCodeAt, boolean inference)
507
518
  6. PII Shield scans output for forbidden data and keys
508
- 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)
509
520
  8. Result + receipt returned to the LLM (raw data never exposed)
510
521
  ```
511
522