@nekzus/liop 2.4.0-alpha.23 → 2.4.0-alpha.25
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.
- package/README.md +21 -10
- package/dist/bin/agent.js +61 -23
- package/dist/bridge.d.ts +3 -3
- package/dist/bridge.js +3 -3
- package/dist/{chunk-WPTOJYN5.js → chunk-3664H3CV.js} +14 -59
- package/dist/{chunk-E7RSX476.js → chunk-6MYJBM2E.js} +4 -4
- package/dist/{chunk-AMSFSS2I.js → chunk-DSOB2JKM.js} +20 -10
- package/dist/{chunk-OHMZZMMC.js → chunk-ET6VRUK2.js} +3 -3
- package/dist/{chunk-P34HDRN5.js → chunk-FIVRGOA4.js} +69 -2
- package/dist/{chunk-KB3HUVMD.js → chunk-IHKKWXHJ.js} +24 -25
- package/dist/chunk-JPWC6XG6.js +941 -0
- package/dist/{chunk-YLFNJQI2.js → chunk-KR5UZUEY.js} +24 -3
- package/dist/chunk-NXCAFF73.js +59 -0
- package/dist/{chunk-7BSCUYUE.js → chunk-R52TZEIL.js} +8 -3
- package/dist/{chunk-3WKFZQ34.js → chunk-S3RAZTEM.js} +11 -7
- package/dist/{chunk-PUDETPL4.js → chunk-V47P2AQR.js} +5 -3
- package/dist/{chunk-E2CFIWD6.js → chunk-WXOWJXY6.js} +4 -4
- package/dist/{chunk-ZRWNMP5L.js → chunk-WXYDFCIW.js} +139 -11
- package/dist/{chunk-T2QDHVUD.js → chunk-ZU3WVVLC.js} +21 -12
- package/dist/client.d.ts +4 -4
- package/dist/client.js +6 -6
- package/dist/gateway.d.ts +5 -5
- package/dist/gateway.js +8 -7
- package/dist/{hybrid-B7EjCj3q.d.ts → hybrid-BZpCiUaV.d.ts} +3 -3
- package/dist/{index-DDwiS7tf.d.ts → index-BYDtRGue.d.ts} +3 -3
- package/dist/{index-D2P6Z_hP.d.ts → index-ByzjpRCk.d.ts} +6 -1
- package/dist/index.d.ts +15 -10
- package/dist/index.js +15 -14
- package/dist/mesh.js +1 -1
- package/dist/server.d.ts +3 -3
- package/dist/server.js +6 -5
- package/dist/{types-rxL19f0l.d.ts → types-29zv9X1V.d.ts} +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.js +2 -2
- package/dist/verifier-55HW6AFN.js +6 -0
- package/dist/{verifier-DTn1LXDU.d.ts → verifier-DqZ9MQ9l.d.ts} +34 -5
- package/dist/workers/logic-execution.d.ts +2 -1
- package/dist/workers/logic-execution.js +38 -9
- package/dist/workers/zk-verifier.d.ts +1 -1
- package/dist/workers/zk-verifier.js +35 -5
- package/dist/{zk-CYImPsa6.d.ts → zk-DzYNWBgo.d.ts} +14 -1
- package/package.json +6 -2
- package/dist/bin/agent.js.map +0 -1
- package/dist/bridge.js.map +0 -1
- package/dist/chunk-3QH44NKZ.js.map +0 -1
- package/dist/chunk-3WKFZQ34.js.map +0 -1
- package/dist/chunk-7BSCUYUE.js.map +0 -1
- package/dist/chunk-7PITYWOV.js.map +0 -1
- package/dist/chunk-AMSFSS2I.js.map +0 -1
- package/dist/chunk-E2CFIWD6.js.map +0 -1
- package/dist/chunk-E7RSX476.js.map +0 -1
- package/dist/chunk-FTF6AMF6.js.map +0 -1
- package/dist/chunk-GFGSHQN5.js +0 -206884
- package/dist/chunk-GFGSHQN5.js.map +0 -1
- package/dist/chunk-IK7CGWAZ.js.map +0 -1
- package/dist/chunk-K3DGJLUY.js.map +0 -1
- package/dist/chunk-KB3HUVMD.js.map +0 -1
- package/dist/chunk-OHMZZMMC.js.map +0 -1
- package/dist/chunk-P34HDRN5.js.map +0 -1
- package/dist/chunk-PUDETPL4.js.map +0 -1
- package/dist/chunk-Q3FKHJ3B.js.map +0 -1
- package/dist/chunk-T2QDHVUD.js.map +0 -1
- package/dist/chunk-WPTOJYN5.js.map +0 -1
- package/dist/chunk-Y62GORQF.js.map +0 -1
- package/dist/chunk-YLFNJQI2.js.map +0 -1
- package/dist/chunk-ZP3VVXOI.js.map +0 -1
- package/dist/chunk-ZRWNMP5L.js.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/gateway.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/kyber-CGOA7Q6A.js.map +0 -1
- package/dist/mesh.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/verifier-UBJTZQSA.js +0 -6
- package/dist/verifier-UBJTZQSA.js.map +0 -1
- package/dist/workers/logic-execution.js.map +0 -1
- 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
|
-
| **
|
|
64
|
-
| **
|
|
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 &
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
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 (
|
|
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
|
|
package/dist/bin/agent.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { probeTopology, RoutingTable } from '../chunk-
|
|
2
|
+
import { probeTopology, RoutingTable } from '../chunk-V47P2AQR.js';
|
|
3
3
|
import { TokenManager } from '../chunk-3QH44NKZ.js';
|
|
4
|
-
import { LiopServer } from '../chunk-
|
|
4
|
+
import { LiopServer } from '../chunk-ZU3WVVLC.js';
|
|
5
5
|
import '../chunk-Y62GORQF.js';
|
|
6
|
-
import { LiopMcpRouter } from '../chunk-
|
|
7
|
-
import '../chunk-
|
|
6
|
+
import { LiopMcpRouter } from '../chunk-DSOB2JKM.js';
|
|
7
|
+
import '../chunk-WXYDFCIW.js';
|
|
8
8
|
import '../chunk-IK7CGWAZ.js';
|
|
9
9
|
import '../chunk-7PITYWOV.js';
|
|
10
|
-
import '../chunk-
|
|
11
|
-
import '../chunk-
|
|
10
|
+
import '../chunk-NXCAFF73.js';
|
|
11
|
+
import '../chunk-3664H3CV.js';
|
|
12
|
+
import '../chunk-JPWC6XG6.js';
|
|
12
13
|
import '../chunk-Q3FKHJ3B.js';
|
|
13
|
-
import { isLegacyRequest } from '../chunk-
|
|
14
|
-
import '../chunk-
|
|
14
|
+
import { normalizeToolArguments, TOOL_ALIASES, isLegacyRequest } from '../chunk-KR5UZUEY.js';
|
|
15
|
+
import '../chunk-FIVRGOA4.js';
|
|
15
16
|
import '../chunk-FTF6AMF6.js';
|
|
16
17
|
import '../chunk-ZP3VVXOI.js';
|
|
17
|
-
import { MeshNode } from '../chunk-
|
|
18
|
+
import { MeshNode } from '../chunk-IHKKWXHJ.js';
|
|
18
19
|
import { log } from '../chunk-K3DGJLUY.js';
|
|
19
20
|
import * as fs from 'fs';
|
|
20
21
|
import * as os from 'os';
|
|
@@ -137,6 +138,21 @@ async function resolveBootstrapNodes(liopDir) {
|
|
|
137
138
|
if (args.length > 0) {
|
|
138
139
|
bootstrapNodes = args.filter((a) => a.startsWith("/"));
|
|
139
140
|
}
|
|
141
|
+
if (process.env.LIOP_NEXUS_URL || process.env.LIOP_BLG_URL) {
|
|
142
|
+
const targetUrl = process.env.LIOP_NEXUS_URL || process.env.LIOP_BLG_URL;
|
|
143
|
+
if (targetUrl) {
|
|
144
|
+
const resolved = await resolveBootstrapFromUrl(targetUrl);
|
|
145
|
+
if (resolved) {
|
|
146
|
+
const normalized = normalizeBootstrap(resolved);
|
|
147
|
+
if (!bootstrapNodes.includes(normalized)) {
|
|
148
|
+
bootstrapNodes.push(normalized);
|
|
149
|
+
log.info(
|
|
150
|
+
`[LIOP-Agent] \u2705 Added bootstrap from URL discovery: ${normalized}`
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
140
156
|
if (bootstrapNodes.length === 0) {
|
|
141
157
|
const searchDirs = [
|
|
142
158
|
process.cwd(),
|
|
@@ -169,19 +185,6 @@ async function resolveBootstrapNodes(liopDir) {
|
|
|
169
185
|
}
|
|
170
186
|
}
|
|
171
187
|
}
|
|
172
|
-
if (process.env.LIOP_NEXUS_URL) {
|
|
173
|
-
const nexusUrl = process.env.LIOP_NEXUS_URL;
|
|
174
|
-
const resolved = await resolveBootstrapFromUrl(nexusUrl);
|
|
175
|
-
if (resolved) {
|
|
176
|
-
const normalized = normalizeBootstrap(resolved);
|
|
177
|
-
if (!bootstrapNodes.includes(normalized)) {
|
|
178
|
-
bootstrapNodes.push(normalized);
|
|
179
|
-
log.info(
|
|
180
|
-
`[LIOP-Agent] \u2705 Added bootstrap from URL discovery: ${normalized}`
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
188
|
if (bootstrapNodes.length === 0 && process.env.LIOP_BOOTSTRAP) {
|
|
186
189
|
bootstrapNodes.push(process.env.LIOP_BOOTSTRAP.trim());
|
|
187
190
|
}
|
|
@@ -399,6 +402,13 @@ async function runGatewayMode(gateway, tokenManager, routingTable) {
|
|
|
399
402
|
}
|
|
400
403
|
if (method === "tools/call") {
|
|
401
404
|
const params = request.params;
|
|
405
|
+
if (params?.arguments) {
|
|
406
|
+
params.arguments = normalizeToolArguments(params.arguments);
|
|
407
|
+
}
|
|
408
|
+
if (params?.name) {
|
|
409
|
+
const canonicalName = TOOL_ALIASES[params.name] || params.name;
|
|
410
|
+
params.name = canonicalName;
|
|
411
|
+
}
|
|
402
412
|
if (params?.name === "LiopMeshStatus") {
|
|
403
413
|
const statusResponse = {
|
|
404
414
|
jsonrpc: "2.0",
|
|
@@ -438,6 +448,16 @@ async function runGatewayMode(gateway, tokenManager, routingTable) {
|
|
|
438
448
|
if (!hasStatus) {
|
|
439
449
|
toolsList.unshift(LIOP_MESH_STATUS_TOOL);
|
|
440
450
|
}
|
|
451
|
+
for (const [alias, target] of Object.entries(TOOL_ALIASES)) {
|
|
452
|
+
const targetDef = toolsList.find((t) => t.name === target);
|
|
453
|
+
if (targetDef && !toolsList.some((t) => t.name === alias)) {
|
|
454
|
+
toolsList.push({
|
|
455
|
+
...targetDef,
|
|
456
|
+
name: alias,
|
|
457
|
+
description: `[Alias -> ${target}] ${targetDef.description || ""}`.trim()
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
}
|
|
441
461
|
routingTable.registerGatewayTools(toolsList, gateway.mcpEndpoint);
|
|
442
462
|
}
|
|
443
463
|
if (!isLegacyRequest(request)) {
|
|
@@ -720,7 +740,15 @@ async function runHybridMode(topology, tokenManager, routingTable) {
|
|
|
720
740
|
}
|
|
721
741
|
if (method === "tools/call") {
|
|
722
742
|
const params = request.params;
|
|
723
|
-
|
|
743
|
+
if (params?.arguments) {
|
|
744
|
+
params.arguments = normalizeToolArguments(params.arguments);
|
|
745
|
+
}
|
|
746
|
+
const rawToolName = params?.name || "";
|
|
747
|
+
const canonicalToolName = TOOL_ALIASES[rawToolName] || rawToolName;
|
|
748
|
+
if (params?.name) {
|
|
749
|
+
params.name = canonicalToolName;
|
|
750
|
+
}
|
|
751
|
+
const toolName = canonicalToolName;
|
|
724
752
|
const route = routingTable.resolve(toolName);
|
|
725
753
|
if (route?.provider === "http-gateway") {
|
|
726
754
|
const start = Date.now();
|
|
@@ -778,6 +806,16 @@ async function runHybridMode(topology, tokenManager, routingTable) {
|
|
|
778
806
|
for (const t of gatewayTools) toolMap.set(t.name, t);
|
|
779
807
|
for (const t of meshTools)
|
|
780
808
|
if (!toolMap.has(t.name)) toolMap.set(t.name, t);
|
|
809
|
+
for (const [alias, target] of Object.entries(TOOL_ALIASES)) {
|
|
810
|
+
const targetDef = toolMap.get(target);
|
|
811
|
+
if (targetDef && !toolMap.has(alias)) {
|
|
812
|
+
toolMap.set(alias, {
|
|
813
|
+
...targetDef,
|
|
814
|
+
name: alias,
|
|
815
|
+
description: `[Alias -> ${target}] ${targetDef.description || ""}`.trim()
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
}
|
|
781
819
|
const merged = Array.from(toolMap.values()).sort(
|
|
782
820
|
(a, b) => a.name.localeCompare(b.name)
|
|
783
821
|
);
|
package/dist/bridge.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import { L as LiopServer, a as LiopServerOptions } from './index-
|
|
2
|
+
import { L as LiopServer, a as LiopServerOptions } from './index-ByzjpRCk.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import './node-Djzm6UYd.js';
|
|
5
|
-
import './types-
|
|
6
|
-
import './zk-
|
|
5
|
+
import './types-29zv9X1V.js';
|
|
6
|
+
import './zk-DzYNWBgo.js';
|
|
7
7
|
import 'jose';
|
|
8
8
|
|
|
9
9
|
/**
|
package/dist/bridge.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { LiopMcpBridge, LiopStreamBridge } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { LiopMcpBridge, LiopStreamBridge } from './chunk-WXOWJXY6.js';
|
|
2
|
+
import './chunk-KR5UZUEY.js';
|
|
3
|
+
import './chunk-FIVRGOA4.js';
|
|
4
4
|
import './chunk-K3DGJLUY.js';
|
|
5
5
|
//# sourceMappingURL=bridge.js.map
|
|
6
6
|
//# sourceMappingURL=bridge.js.map
|
|
@@ -48,6 +48,17 @@ var Dilithium65Wrapper = {
|
|
|
48
48
|
secretKey: keys.secretKey
|
|
49
49
|
};
|
|
50
50
|
},
|
|
51
|
+
/**
|
|
52
|
+
* Derives the ML-DSA-65 public key from a given secret key.
|
|
53
|
+
*/
|
|
54
|
+
getPublicKey(secretKey) {
|
|
55
|
+
if (secretKey.length !== DILITHIUM65_CONSTANTS.SECRET_KEY_BYTES) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`ML-DSA-65 Secret Key must be exactly ${DILITHIUM65_CONSTANTS.SECRET_KEY_BYTES} bytes (Received: ${secretKey.length})`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
return ml_dsa65.getPublicKey(secretKey);
|
|
61
|
+
},
|
|
51
62
|
/**
|
|
52
63
|
* Validates and imports a raw ML-DSA-65 public key.
|
|
53
64
|
*/
|
|
@@ -120,62 +131,6 @@ var Dilithium65Wrapper = {
|
|
|
120
131
|
}
|
|
121
132
|
};
|
|
122
133
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
initialize: [],
|
|
127
|
-
"notifications/initialized": [],
|
|
128
|
-
"notifications/cancelled": [],
|
|
129
|
-
ping: [],
|
|
130
|
-
"server/discover": [],
|
|
131
|
-
"subscriptions/listen": [],
|
|
132
|
-
// Tool operations — require explicit authorization
|
|
133
|
-
"tools/list": ["liop:tools:list"],
|
|
134
|
-
"tools/call": ["liop:tools:call"],
|
|
135
|
-
// Resource operations — read-level access
|
|
136
|
-
"resources/list": ["liop:resources:read"],
|
|
137
|
-
"resources/read": ["liop:resources:read"],
|
|
138
|
-
"resources/templates/list": ["liop:resources:read"],
|
|
139
|
-
// Prompt/schema operations — schema-level access
|
|
140
|
-
"prompts/list": ["liop:schema:read"],
|
|
141
|
-
"prompts/get": ["liop:schema:read"]
|
|
142
|
-
};
|
|
143
|
-
function authorizeRequest(method, auth, additionalScopes) {
|
|
144
|
-
const methodScopes = SCOPE_MAP[method];
|
|
145
|
-
if (methodScopes !== void 0 && methodScopes.length === 0) {
|
|
146
|
-
return { allowed: true };
|
|
147
|
-
}
|
|
148
|
-
if (!auth) {
|
|
149
|
-
return {
|
|
150
|
-
allowed: false,
|
|
151
|
-
reason: `Authentication required for method: ${method}`
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
const needed = [...methodScopes ?? [], ...additionalScopes ?? []];
|
|
155
|
-
if (needed.length === 0) {
|
|
156
|
-
return {
|
|
157
|
-
allowed: false,
|
|
158
|
-
reason: `Unknown method: ${method}. Access denied (fail-closed).`
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
const clientScopes = new Set(auth.scopes);
|
|
162
|
-
const missing = needed.filter((s) => !clientScopes.has(s));
|
|
163
|
-
if (missing.length > 0) {
|
|
164
|
-
return {
|
|
165
|
-
allowed: false,
|
|
166
|
-
reason: `Insufficient scopes for ${method}. Missing: ${missing.join(", ")}`
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
return { allowed: true };
|
|
170
|
-
}
|
|
171
|
-
var LIOP_SCOPES = [
|
|
172
|
-
"liop:tools:list",
|
|
173
|
-
"liop:tools:call",
|
|
174
|
-
"liop:resources:read",
|
|
175
|
-
"liop:schema:read",
|
|
176
|
-
"liop:mesh:query"
|
|
177
|
-
];
|
|
178
|
-
|
|
179
|
-
export { DILITHIUM65_CONSTANTS, Dilithium65Wrapper, LIOP_SCOPES, authorizeRequest };
|
|
180
|
-
//# sourceMappingURL=chunk-WPTOJYN5.js.map
|
|
181
|
-
//# sourceMappingURL=chunk-WPTOJYN5.js.map
|
|
134
|
+
export { DILITHIUM65_CONSTANTS, Dilithium65Wrapper };
|
|
135
|
+
//# sourceMappingURL=chunk-3664H3CV.js.map
|
|
136
|
+
//# sourceMappingURL=chunk-3664H3CV.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LiopMcpRouter } from './chunk-
|
|
2
|
-
import { LIOP_SCOPES } from './chunk-
|
|
1
|
+
import { LiopMcpRouter } from './chunk-DSOB2JKM.js';
|
|
2
|
+
import { LIOP_SCOPES } from './chunk-NXCAFF73.js';
|
|
3
3
|
import { meshPeersConnected, manifestCacheSize, protocolMetrics } from './chunk-Q3FKHJ3B.js';
|
|
4
4
|
import { log } from './chunk-K3DGJLUY.js';
|
|
5
5
|
import * as http from 'http';
|
|
@@ -814,5 +814,5 @@ var LiopHybridGateway = class {
|
|
|
814
814
|
};
|
|
815
815
|
|
|
816
816
|
export { GRPC_WEB_CONSTANTS, InMemoryRateLimiter, LiopHybridGateway, buildProtectedResourceMetadata, decodeFrames, dispatchGrpcWebRequest, encodeDataFrame, encodeTrailerFrame, executeGatewayInterceptor, isGrpcWebRequest };
|
|
817
|
-
//# sourceMappingURL=chunk-
|
|
818
|
-
//# sourceMappingURL=chunk-
|
|
817
|
+
//# sourceMappingURL=chunk-6MYJBM2E.js.map
|
|
818
|
+
//# sourceMappingURL=chunk-6MYJBM2E.js.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { LiopVerifier } from './chunk-
|
|
1
|
+
import { LiopVerifier } from './chunk-WXYDFCIW.js';
|
|
2
2
|
import { Kyber768Wrapper } from './chunk-7PITYWOV.js';
|
|
3
|
-
import { authorizeRequest
|
|
4
|
-
import {
|
|
3
|
+
import { authorizeRequest } from './chunk-NXCAFF73.js';
|
|
4
|
+
import { Dilithium65Wrapper } from './chunk-3664H3CV.js';
|
|
5
|
+
import { TokenTelemetryEngine, liopV1, createChannelCredentials, GRPC_CHANNEL_OPTIONS } from './chunk-JPWC6XG6.js';
|
|
5
6
|
import { toolCallsTotal, toolCallErrorsTotal, pqcHandshakeDurationMs, pqcHandshakesTotal, zkVerificationsTotal, wireEgressBytesTotal } from './chunk-Q3FKHJ3B.js';
|
|
6
|
-
import { MCP_PROTOCOL_VERSION, MCP_LEGACY_SUPPORT_ENABLED, isLegacyRequest, adaptResponseForLegacyClient, MCP_PROTOCOL_VERSION_LEGACY, buildLegacyInitializeResponse } from './chunk-
|
|
7
|
+
import { MCP_PROTOCOL_VERSION, MCP_LEGACY_SUPPORT_ENABLED, isLegacyRequest, adaptResponseForLegacyClient, MCP_PROTOCOL_VERSION_LEGACY, buildLegacyInitializeResponse, TOOL_ALIASES, normalizeToolArguments } from './chunk-KR5UZUEY.js';
|
|
7
8
|
import { log } from './chunk-K3DGJLUY.js';
|
|
8
9
|
import * as crypto from 'crypto';
|
|
9
10
|
import * as grpc from '@grpc/grpc-js';
|
|
@@ -860,12 +861,15 @@ Network ID: ${peerId}${blueprint}`;
|
|
|
860
861
|
* by searching the manifest cache. Supports exact names and suffixed names.
|
|
861
862
|
*/
|
|
862
863
|
resolveManifestTarget(toolName) {
|
|
864
|
+
const targetCanonical = TOOL_ALIASES[toolName] || toolName;
|
|
863
865
|
for (const [peerId, { manifest }] of this.manifestCache.entries()) {
|
|
864
|
-
const tool = manifest.tools.find(
|
|
866
|
+
const tool = manifest.tools.find(
|
|
867
|
+
(t) => t.name === toolName || t.name === targetCanonical
|
|
868
|
+
);
|
|
865
869
|
if (tool) {
|
|
866
870
|
return {
|
|
867
871
|
peerId,
|
|
868
|
-
originalToolName:
|
|
872
|
+
originalToolName: tool.name
|
|
869
873
|
};
|
|
870
874
|
}
|
|
871
875
|
}
|
|
@@ -873,13 +877,16 @@ Network ID: ${peerId}${blueprint}`;
|
|
|
873
877
|
if (parts.length > 1) {
|
|
874
878
|
const suffix = parts.pop();
|
|
875
879
|
const baseName = parts.join("_");
|
|
880
|
+
const canonicalBase = TOOL_ALIASES[baseName] || baseName;
|
|
876
881
|
for (const [peerId, { manifest }] of this.manifestCache.entries()) {
|
|
877
882
|
if (peerId.endsWith(suffix || "")) {
|
|
878
|
-
const tool = manifest.tools.find(
|
|
883
|
+
const tool = manifest.tools.find(
|
|
884
|
+
(t) => t.name === baseName || t.name === canonicalBase
|
|
885
|
+
);
|
|
879
886
|
if (tool) {
|
|
880
887
|
return {
|
|
881
888
|
peerId,
|
|
882
|
-
originalToolName:
|
|
889
|
+
originalToolName: tool.name
|
|
883
890
|
};
|
|
884
891
|
}
|
|
885
892
|
}
|
|
@@ -899,6 +906,9 @@ Network ID: ${peerId}${blueprint}`;
|
|
|
899
906
|
return `***${peerId.slice(-8)}`;
|
|
900
907
|
}
|
|
901
908
|
async transcodeMcpToLiop(id, params, token) {
|
|
909
|
+
if (params?.arguments) {
|
|
910
|
+
params.arguments = normalizeToolArguments(params.arguments);
|
|
911
|
+
}
|
|
902
912
|
const toolName = params.name;
|
|
903
913
|
if (toolName === "LiopMeshStatus") {
|
|
904
914
|
this.refreshManifestCache(true).catch(() => {
|
|
@@ -1493,5 +1503,5 @@ ${cachedToolList}` : "\nNo remote tools discovered yet.",
|
|
|
1493
1503
|
};
|
|
1494
1504
|
|
|
1495
1505
|
export { LiopMcpRouter };
|
|
1496
|
-
//# sourceMappingURL=chunk-
|
|
1497
|
-
//# sourceMappingURL=chunk-
|
|
1506
|
+
//# sourceMappingURL=chunk-DSOB2JKM.js.map
|
|
1507
|
+
//# sourceMappingURL=chunk-DSOB2JKM.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ZkVerificationError } from './chunk-
|
|
1
|
+
import { ZkVerificationError } from './chunk-FIVRGOA4.js';
|
|
2
2
|
import { bn254, stringBigints } from 'micro-zk-proofs';
|
|
3
3
|
|
|
4
4
|
var VERIFICATION_LATENCY_BUDGET_MS = 250;
|
|
@@ -54,5 +54,5 @@ function deserializeGrothProof(buf) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export { VERIFICATION_LATENCY_BUDGET_MS, deserializeGrothProof, deserializeVKey, serializeGrothProof, serializeVKey, verifyGroth16Proof };
|
|
57
|
-
//# sourceMappingURL=chunk-
|
|
58
|
-
//# sourceMappingURL=chunk-
|
|
57
|
+
//# sourceMappingURL=chunk-ET6VRUK2.js.map
|
|
58
|
+
//# sourceMappingURL=chunk-ET6VRUK2.js.map
|
|
@@ -4,6 +4,7 @@ import crypto from 'crypto';
|
|
|
4
4
|
var ProofType = /* @__PURE__ */ ((ProofType2) => {
|
|
5
5
|
ProofType2[ProofType2["HMAC_LEGACY"] = 0] = "HMAC_LEGACY";
|
|
6
6
|
ProofType2[ProofType2["GROTH16"] = 2] = "GROTH16";
|
|
7
|
+
ProofType2[ProofType2["GROTH16_PQC_HYBRID"] = 3] = "GROTH16_PQC_HYBRID";
|
|
7
8
|
return ProofType2;
|
|
8
9
|
})(ProofType || {});
|
|
9
10
|
var RECEIPT_VERSION_V1 = 1;
|
|
@@ -74,6 +75,36 @@ var receiptCodec = {
|
|
|
74
75
|
const checksum = crypto.createHash("sha256").update(payload).digest();
|
|
75
76
|
return Buffer.concat([payload, checksum]);
|
|
76
77
|
},
|
|
78
|
+
/**
|
|
79
|
+
* Encodes a version 2.1 Hybrid Binary Receipt (Groth16 + ML-DSA-65 co-sign).
|
|
80
|
+
* Layout:
|
|
81
|
+
* [0x02][0x03 ProofType.GROTH16_PQC_HYBRID][journalLen: 4B UInt32BE][journal: 144B]
|
|
82
|
+
* [proofLen: 2B UInt16BE][groth16 proof: ~260B]
|
|
83
|
+
* [sigLen: 2B UInt16BE][signature: 3309B]
|
|
84
|
+
* [publicKey: 1952B]
|
|
85
|
+
* [checksum: 32B SHA-256]
|
|
86
|
+
*/
|
|
87
|
+
encodeHybridV2(journal, proof, pqcSignature, pqcPublicKey) {
|
|
88
|
+
const header = Buffer.alloc(6);
|
|
89
|
+
header.writeUInt8(RECEIPT_VERSION_V2, 0);
|
|
90
|
+
header.writeUInt8(3 /* GROTH16_PQC_HYBRID */, 1);
|
|
91
|
+
header.writeUInt32BE(journal.length, 2);
|
|
92
|
+
const proofLenBuf = Buffer.alloc(2);
|
|
93
|
+
proofLenBuf.writeUInt16BE(proof.length, 0);
|
|
94
|
+
const sigLenBuf = Buffer.alloc(2);
|
|
95
|
+
sigLenBuf.writeUInt16BE(pqcSignature.length, 0);
|
|
96
|
+
const payload = Buffer.concat([
|
|
97
|
+
header,
|
|
98
|
+
journal,
|
|
99
|
+
proofLenBuf,
|
|
100
|
+
proof,
|
|
101
|
+
sigLenBuf,
|
|
102
|
+
pqcSignature,
|
|
103
|
+
pqcPublicKey
|
|
104
|
+
]);
|
|
105
|
+
const checksum = crypto.createHash("sha256").update(payload).digest();
|
|
106
|
+
return Buffer.concat([payload, checksum]);
|
|
107
|
+
},
|
|
77
108
|
/**
|
|
78
109
|
* Decodes any LIOP Binary Receipt (v1 HMAC or v2 ZK).
|
|
79
110
|
*/
|
|
@@ -128,6 +159,42 @@ var receiptCodec = {
|
|
|
128
159
|
throw new ZkVerificationError("Receipt checksum verification failed.");
|
|
129
160
|
}
|
|
130
161
|
const journal = Buffer.from(raw.subarray(6, 6 + journalLen));
|
|
162
|
+
if (proofType === 3 /* GROTH16_PQC_HYBRID */) {
|
|
163
|
+
let offset = 6 + journalLen;
|
|
164
|
+
if (raw.length < offset + 2 + 32) {
|
|
165
|
+
throw new ZkVerificationError(
|
|
166
|
+
"Malformed hybrid receipt: missing proof length header."
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
const proofLen = raw.readUInt16BE(offset);
|
|
170
|
+
offset += 2;
|
|
171
|
+
if (raw.length < offset + proofLen + 2 + 32) {
|
|
172
|
+
throw new ZkVerificationError(
|
|
173
|
+
"Malformed hybrid receipt: truncated Groth16 proof."
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
const proof2 = Buffer.from(raw.subarray(offset, offset + proofLen));
|
|
177
|
+
offset += proofLen;
|
|
178
|
+
const sigLen = raw.readUInt16BE(offset);
|
|
179
|
+
offset += 2;
|
|
180
|
+
if (raw.length < offset + sigLen + 32) {
|
|
181
|
+
throw new ZkVerificationError(
|
|
182
|
+
"Malformed hybrid receipt: truncated ML-DSA-65 signature."
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
const pqcSignature = Buffer.from(raw.subarray(offset, offset + sigLen));
|
|
186
|
+
offset += sigLen;
|
|
187
|
+
const pqcPublicKey = Buffer.from(raw.subarray(offset, raw.length - 32));
|
|
188
|
+
return {
|
|
189
|
+
version: RECEIPT_VERSION_V2,
|
|
190
|
+
proofType,
|
|
191
|
+
journal,
|
|
192
|
+
proof: proof2,
|
|
193
|
+
pqcSignature,
|
|
194
|
+
pqcPublicKey,
|
|
195
|
+
raw
|
|
196
|
+
};
|
|
197
|
+
}
|
|
131
198
|
const proof = Buffer.from(raw.subarray(6 + journalLen, raw.length - 32));
|
|
132
199
|
return {
|
|
133
200
|
version: RECEIPT_VERSION_V2,
|
|
@@ -209,5 +276,5 @@ var ZkVerifier = {
|
|
|
209
276
|
};
|
|
210
277
|
|
|
211
278
|
export { ProofType, RECEIPT_VERSION_V1, RECEIPT_VERSION_V2, ZK_JOURNAL_V2_SIZE, ZkVerificationError, ZkVerifier, decodeJournalV2, encodeJournalV2, receiptCodec };
|
|
212
|
-
//# sourceMappingURL=chunk-
|
|
213
|
-
//# sourceMappingURL=chunk-
|
|
279
|
+
//# sourceMappingURL=chunk-FIVRGOA4.js.map
|
|
280
|
+
//# sourceMappingURL=chunk-FIVRGOA4.js.map
|
|
@@ -341,31 +341,30 @@ var MeshNode = class _MeshNode {
|
|
|
341
341
|
log.info(
|
|
342
342
|
`[LIOP-Mesh] Forcing direct P2P dial to ${bootNodes.length} bootstrap nodes...`
|
|
343
343
|
);
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
344
|
+
const activeNode = this.node;
|
|
345
|
+
if (!activeNode) return;
|
|
346
|
+
const maxRetries = 2;
|
|
347
|
+
await Promise.allSettled(
|
|
348
|
+
bootNodes.map(async (addr) => {
|
|
349
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
350
|
+
try {
|
|
351
|
+
await activeNode.dial(multiaddr(addr), {
|
|
352
|
+
signal: AbortSignal.timeout(2500)
|
|
353
|
+
});
|
|
354
|
+
log.info(`[LIOP-Mesh] \u2705 Successfully dialed ${addr}`);
|
|
355
|
+
return;
|
|
356
|
+
} catch (_e) {
|
|
357
|
+
if (attempt === maxRetries) {
|
|
358
|
+
log.warn(
|
|
359
|
+
`[LIOP-Mesh] \u26A0\uFE0F Could not connect to bootstrap ${addr} after ${maxRetries} attempts. Continuing...`
|
|
360
|
+
);
|
|
361
|
+
} else {
|
|
362
|
+
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
363
|
+
}
|
|
364
364
|
}
|
|
365
|
-
attempt++;
|
|
366
365
|
}
|
|
367
|
-
}
|
|
368
|
-
|
|
366
|
+
})
|
|
367
|
+
);
|
|
369
368
|
}
|
|
370
369
|
}
|
|
371
370
|
async stop() {
|
|
@@ -873,5 +872,5 @@ var MeshNode = class _MeshNode {
|
|
|
873
872
|
};
|
|
874
873
|
|
|
875
874
|
export { MeshNode };
|
|
876
|
-
//# sourceMappingURL=chunk-
|
|
877
|
-
//# sourceMappingURL=chunk-
|
|
875
|
+
//# sourceMappingURL=chunk-IHKKWXHJ.js.map
|
|
876
|
+
//# sourceMappingURL=chunk-IHKKWXHJ.js.map
|