@nekzus/liop 2.4.0-alpha.22 → 2.4.0-alpha.24
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 +72 -36
- package/dist/bin/agent.js +60 -22
- package/dist/bin/agent.js.map +1 -1
- package/dist/bridge.d.ts +4 -3
- package/dist/bridge.js +3 -2
- package/dist/{chunk-VRDZ5IKE.js → chunk-2VQS2XRH.js} +15 -9
- package/dist/chunk-2VQS2XRH.js.map +1 -0
- package/dist/{chunk-EJ426URA.js → chunk-53QKIQNF.js} +4 -4
- package/dist/{chunk-EJ426URA.js.map → chunk-53QKIQNF.js.map} +1 -1
- package/dist/{chunk-UJFWPRDM.js → chunk-GFGSHQN5.js} +3 -3
- package/dist/{chunk-UJFWPRDM.js.map → chunk-GFGSHQN5.js.map} +1 -1
- package/dist/{chunk-VRB5HUYU.js → chunk-IDTXJQBH.js} +27 -13
- package/dist/chunk-IDTXJQBH.js.map +1 -0
- package/dist/{chunk-XRDN232O.js → chunk-IHKKWXHJ.js} +24 -25
- package/dist/chunk-IHKKWXHJ.js.map +1 -0
- package/dist/{chunk-5SWHE62F.js → chunk-JWFLXXZS.js} +71 -11
- package/dist/chunk-JWFLXXZS.js.map +1 -0
- package/dist/{chunk-2KSO3W4A.js → chunk-KR5UZUEY.js} +24 -3
- package/dist/chunk-KR5UZUEY.js.map +1 -0
- package/dist/chunk-OHMZZMMC.js +58 -0
- package/dist/chunk-OHMZZMMC.js.map +1 -0
- package/dist/chunk-P34HDRN5.js +213 -0
- package/dist/chunk-P34HDRN5.js.map +1 -0
- package/dist/{chunk-PAICJCKJ.js → chunk-Q3FKHJ3B.js} +17 -4
- package/dist/chunk-Q3FKHJ3B.js.map +1 -0
- package/dist/{chunk-PUDETPL4.js → chunk-V47P2AQR.js} +5 -3
- package/dist/chunk-V47P2AQR.js.map +1 -0
- package/dist/{chunk-FCFTYOAS.js → chunk-ZJGVKM7G.js} +22 -12
- package/dist/chunk-ZJGVKM7G.js.map +1 -0
- package/dist/{chunk-2STZHJ24.js → chunk-ZRWNMP5L.js} +58 -7
- package/dist/chunk-ZRWNMP5L.js.map +1 -0
- package/dist/client.d.ts +5 -4
- package/dist/client.js +7 -6
- package/dist/gateway.d.ts +6 -5
- package/dist/gateway.js +7 -6
- package/dist/{hybrid-DWe1bMoV.d.ts → hybrid-Cb95yJFg.d.ts} +4 -4
- package/dist/{index-CdW8j8Bn.d.ts → index-D2P6Z_hP.d.ts} +25 -2
- package/dist/{index-BuEQtBHD.d.ts → index-DtovobWb.d.ts} +8 -4
- package/dist/index.d.ts +51 -9
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/dist/mesh.d.ts +1 -1
- package/dist/mesh.js +1 -1
- package/dist/{node-B0b2vUFS.d.ts → node-Djzm6UYd.d.ts} +8 -0
- package/dist/protocol/liop_core.proto +22 -6
- package/dist/server.d.ts +4 -3
- package/dist/server.js +5 -4
- package/dist/{types-CzRSOlOo.d.ts → types-rxL19f0l.d.ts} +3 -0
- package/dist/types.d.ts +2 -1
- package/dist/types.js +2 -1
- package/dist/{verifier-COnid_dg.d.ts → verifier-EgKmGrh7.d.ts} +26 -4
- package/dist/verifier-UBJTZQSA.js +6 -0
- package/dist/{verifier-XFU7ZB2W.js.map → verifier-UBJTZQSA.js.map} +1 -1
- package/dist/workers/logic-execution.d.ts +6 -0
- package/dist/workers/logic-execution.js +56 -1
- package/dist/workers/logic-execution.js.map +1 -1
- package/dist/workers/zk-verifier.d.ts +9 -0
- package/dist/workers/zk-verifier.js +119 -47
- package/dist/workers/zk-verifier.js.map +1 -1
- package/dist/zk-CYImPsa6.d.ts +91 -0
- package/package.json +2 -1
- package/dist/chunk-2KSO3W4A.js.map +0 -1
- package/dist/chunk-2STZHJ24.js.map +0 -1
- package/dist/chunk-5SWHE62F.js.map +0 -1
- package/dist/chunk-FCFTYOAS.js.map +0 -1
- package/dist/chunk-PAICJCKJ.js.map +0 -1
- package/dist/chunk-PUDETPL4.js.map +0 -1
- package/dist/chunk-VRB5HUYU.js.map +0 -1
- package/dist/chunk-VRDZ5IKE.js.map +0 -1
- package/dist/chunk-XRDN232O.js.map +0 -1
- package/dist/verifier-XFU7ZB2W.js +0 -6
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
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)
|
|
7
|
+
<h1>Logic-Injection-on-Origin Protocol (LIOP), TypeScript SDK</h1>
|
|
8
8
|
<p><strong>The official TypeScript SDK and MCP Bridge for the Logic-Injection-on-Origin Protocol.</strong></p>
|
|
9
9
|
|
|
10
10
|
<p align="center">
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Official Documentation
|
|
23
23
|
|
|
24
24
|
Comprehensive interactive guides, architectural deep dives, and API specifications are hosted on our official portal:
|
|
25
25
|
|
|
@@ -37,7 +37,7 @@ Comprehensive interactive guides, architectural deep dives, and API specificatio
|
|
|
37
37
|
|
|
38
38
|
## Overview
|
|
39
39
|
|
|
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
|
|
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.
|
|
41
41
|
|
|
42
42
|
This addresses the data privacy, bandwidth, and latency bottlenecks of distributed agent data analysis.
|
|
43
43
|
|
|
@@ -52,7 +52,7 @@ This addresses the data privacy, bandwidth, and latency bottlenecks of distribut
|
|
|
52
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
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
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
|
|
55
|
+
| **MCP Drop-in Replacement** | `LiopServer` mirrors the Anthropic MCP `Server` API (tools, resources, and prompts with `Zod` schemas). |
|
|
56
56
|
| **Guardian AST** | Pre-execution heuristic inspection blocks sandbox escapes (`require`, `fs`, `eval`, `fetch`, prototype pollution). |
|
|
57
57
|
| **IFC Taint Analyzer** | 5-pass Acorn AST information flow control tracking collection aliases, correlation guards, and extrema gates at preflight. |
|
|
58
58
|
| **WASI Sandbox** | JavaScript payloads execute inside V8 isolates with CPU fuel limits, no Node.js globals, and safe environment isolation (`allowEnv`). |
|
|
@@ -61,7 +61,7 @@ This addresses the data privacy, bandwidth, and latency bottlenecks of distribut
|
|
|
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
63
|
| **PII Shield** | Multi-layer egress filter with Regional Presets, custom keys, and recursive floats sanitization (`sanitizeOutput`). |
|
|
64
|
-
| **ZK-Receipts** |
|
|
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. |
|
|
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. |
|
|
@@ -121,7 +121,7 @@ npm install -g @nekzus/liop@latest
|
|
|
121
121
|
liop
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
###
|
|
124
|
+
### Claude Desktop Configuration
|
|
125
125
|
|
|
126
126
|
To integrate LIOP into Claude Desktop, update your `claude_desktop_config.json` (typically found in `%APPDATA%\Claude\claude_desktop_config.json` on Windows):
|
|
127
127
|
|
|
@@ -185,7 +185,7 @@ server.tool(
|
|
|
185
185
|
"Analyzes local log files without sending raw data to the LLM.",
|
|
186
186
|
{ target_error: z.string().describe("The error pattern to search for") },
|
|
187
187
|
async ({ target_error }) => {
|
|
188
|
-
// This logic runs at origin
|
|
188
|
+
// This logic runs at origin, data never leaves the server
|
|
189
189
|
return {
|
|
190
190
|
content: [{ type: "text", text: `Found 51 occurrences of ${target_error}` }],
|
|
191
191
|
};
|
|
@@ -324,13 +324,13 @@ await bridge.connect();
|
|
|
324
324
|
|
|
325
325
|
**Supported JSON-RPC methods:**
|
|
326
326
|
|
|
327
|
-
- `initialize
|
|
328
|
-
- `tools/list
|
|
329
|
-
- `tools/call
|
|
330
|
-
- `resources/list
|
|
331
|
-
- `resources/read
|
|
332
|
-
- `prompts/list
|
|
333
|
-
- `prompts/get
|
|
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
|
|
334
334
|
|
|
335
335
|
---
|
|
336
336
|
|
|
@@ -343,13 +343,13 @@ await bridge.connect();
|
|
|
343
343
|
│ Layer 1: Guardian AST (Pre-Execution Static Analysis) │
|
|
344
344
|
│ 14-function WASI allowlist • 128 import cap • Blocks │
|
|
345
345
|
│ require, import(), fs, eval, fetch, __proto__ │
|
|
346
|
-
|
|
346
|
+
├───────────────────────────────────────────────────────────┤
|
|
347
347
|
│ Layer 2: WASI Sandbox (V8 Isolate) │
|
|
348
348
|
│ 25 poisoned globals (incl. Date, TypedArrays) • │
|
|
349
349
|
│ CPU Fuel limits • 5s timeout • maxHeapMb (64MB default) │
|
|
350
350
|
│ Object.freeze() on 11 core prototypes • allowEnv allowlist │
|
|
351
351
|
├───────────────────────────────────────────────────────────┤
|
|
352
|
-
│ Layer 3: Taint Analyzer (IFC
|
|
352
|
+
│ Layer 3: Taint Analyzer (IFC, Static) │
|
|
353
353
|
│ Acorn AST 3-pass analysis blocks PII side-channels: │
|
|
354
354
|
│ charCodeAt, boolean inference, arithmetic derivation │
|
|
355
355
|
├───────────────────────────────────────────────────────────┤
|
|
@@ -362,8 +362,9 @@ await bridge.connect();
|
|
|
362
362
|
│ Blocks raw row export • maxOutputRows (default: 10) • │
|
|
363
363
|
│ Conditional error: detailed (dev) vs opaque (production) │
|
|
364
364
|
├───────────────────────────────────────────────────────────┤
|
|
365
|
-
│ Layer 6: ZK-Receipt (
|
|
366
|
-
│
|
|
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) │
|
|
367
368
|
│ output_hash cross-verification • Balanced-brace extractor │
|
|
368
369
|
└───────────────────────────────────────────────────────────┘
|
|
369
370
|
```
|
|
@@ -407,7 +408,7 @@ const server = new LiopServer(info, {
|
|
|
407
408
|
|
|
408
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.
|
|
409
410
|
|
|
410
|
-
###
|
|
411
|
+
### 3-Tier Query Budget (NIST SP 800-226)
|
|
411
412
|
|
|
412
413
|
To prevent advanced statistical differentiation or database reconstruction attacks, the SDK implements a tiered, session-based budget engine:
|
|
413
414
|
|
|
@@ -417,27 +418,27 @@ To prevent advanced statistical differentiation or database reconstruction attac
|
|
|
417
418
|
|
|
418
419
|
If an injected payload queries a field beyond its budget limit, the preflight static analysis immediately blocks execution.
|
|
419
420
|
|
|
420
|
-
###
|
|
421
|
+
### K-Anonymity on Small Datasets
|
|
421
422
|
|
|
422
423
|
When operating on high-privacy datasets, if the source records count is **less than 10**, the SDK forces a strict K-Anonymity restriction:
|
|
423
424
|
- Rejects any output that contains nested objects or arrays.
|
|
424
425
|
- Restricts the returned structure to a maximum of **3 scalar keys** (e.g., simple aggregate counts or statistics).
|
|
425
426
|
- Prevents structural data leakage in low-entropy datasets.
|
|
426
427
|
|
|
427
|
-
###
|
|
428
|
+
### Sandbox Poisoned Globals & Date Workaround
|
|
428
429
|
|
|
429
430
|
For maximum host security, the WASI sandbox enforces a poisoned environment that strips dangerous globals and prevents timing side-channels:
|
|
430
431
|
- **Poisoned/Disabled**: `Date` (Date.now, parse, etc. throw an exception to prevent timing analysis), `eval`, `Function`, `setTimeout`, `setInterval`, `Buffer`, `ArrayBuffer`, and all `TypedArrays`.
|
|
431
432
|
- **Date Workaround**: To perform date checks, use lexicographical string comparison on ISO 8601 strings (e.g., `record.date >= "2026-01-01"`).
|
|
432
433
|
|
|
433
|
-
###
|
|
434
|
+
### Recursive In-Memory Numerical Sanitization
|
|
434
435
|
|
|
435
436
|
To mitigate timing channels, statistical differentiation, and floats side-channels, the SDK executes a recursive sanitization pipeline before the PII scanner runs:
|
|
436
437
|
- Positive floating-point numbers are recursively rounded to exactly **4 decimal places**.
|
|
437
438
|
- Negative values are safely clamped to **0** (via `sanitizeOutput()`).
|
|
438
439
|
- This operation runs entirely in-memory and recursively on all fields, preserving data structure immutability without expensive and fragile serialization-deserialization cycles.
|
|
439
440
|
|
|
440
|
-
###
|
|
441
|
+
### Environment Isolation & allowEnv Allowlist
|
|
441
442
|
|
|
442
443
|
For robust sandboxing, the WASI execution path isolates host environment variables. Propagation can be enabled explicitly:
|
|
443
444
|
```typescript
|
|
@@ -450,11 +451,46 @@ To block arbitrary command execution (e.g., Shellshock) and prevent exposure of
|
|
|
450
451
|
- **Unix/Linux Allowlist**: `HOME`, `LOGNAME`, `PATH`, `SHELL`, `TERM`, `USER`.
|
|
451
452
|
Variables starting with shell functions `()` are dropped.
|
|
452
453
|
|
|
453
|
-
###
|
|
454
|
+
### Sovereign ZK-Receipts & Groth16 Attestation
|
|
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:
|
|
457
|
+
|
|
458
|
+
- **144-Byte Binary Journal Layout**:
|
|
459
|
+
- `guest_image_id` (32 bytes): Sovereign enclave guest runtime image identifier
|
|
460
|
+
- `logic_digest` (32 bytes): SHA-256 fingerprint of the executed JavaScript/WASM logic
|
|
461
|
+
- `dataset_digest` (32 bytes): SHA-256 fingerprint of the origin dataset at execution time
|
|
462
|
+
- `output_digest` (32 bytes): SHA-256 fingerprint of the sanitized computation result
|
|
463
|
+
- `fuel_consumed` (8 bytes uint64 BE): AST fuel metering units consumed
|
|
464
|
+
- `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.
|
|
467
|
+
|
|
468
|
+
```typescript
|
|
469
|
+
import { LiopServer } from "@nekzus/liop/server";
|
|
470
|
+
import { LiopVerifier } from "@nekzus/liop";
|
|
471
|
+
|
|
472
|
+
// 1. Enclave configuration with ZK_BLOCKING policy
|
|
473
|
+
const server = new LiopServer({ name: "bank-enclave", version: "1.0.0" });
|
|
474
|
+
server.tool(
|
|
475
|
+
"calculate_payroll_aggregate",
|
|
476
|
+
"Aggregates payroll without egressing employee identities",
|
|
477
|
+
{ payload: z.string() },
|
|
478
|
+
async () => ({ content: [{ type: "text", text: "ok" }] }),
|
|
479
|
+
{
|
|
480
|
+
zkMode: "required", // Enforces Groth16 proof generation (ZK_BLOCKING)
|
|
481
|
+
circuitName: "sum",
|
|
482
|
+
}
|
|
483
|
+
);
|
|
454
484
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
485
|
+
// 2. Client verification via LiopVerifier
|
|
486
|
+
const verifier = new LiopVerifier();
|
|
487
|
+
const isValid = await verifier.verifyZkReceipt(
|
|
488
|
+
Buffer.from(logicPayload),
|
|
489
|
+
remoteImageIdHex,
|
|
490
|
+
rawReceiptBuffer,
|
|
491
|
+
{ zkPolicy: "required" }
|
|
492
|
+
);
|
|
493
|
+
```
|
|
458
494
|
|
|
459
495
|
---
|
|
460
496
|
|
|
@@ -498,7 +534,7 @@ Node.js is single-threaded. Heavy operations like Kyber768 decryption, AES-GCM a
|
|
|
498
534
|
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:
|
|
499
535
|
|
|
500
536
|
```typescript
|
|
501
|
-
// Automatic
|
|
537
|
+
// Automatic, no configuration needed
|
|
502
538
|
// When a Logic-Injection-on-Origin payload is received:
|
|
503
539
|
// 1. Main thread receives JSON-RPC request
|
|
504
540
|
// 2. Worker thread: AST inspection + PQC decryption + Sandbox execution
|
|
@@ -571,7 +607,7 @@ Navigate to **`http://localhost:16000`** in your browser:
|
|
|
571
607
|
|
|
572
608
|
* **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).
|
|
573
609
|
* **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).
|
|
574
|
-
* **Token Economy Dashboard:** Live comparison showing **98.9%
|
|
610
|
+
* **Token Economy Dashboard:** Live comparison showing **98.9% to 99.6% token reduction** and **99.6% network bandwidth savings** over traditional MCP context-pulling.
|
|
575
611
|
* **REST Telemetry Endpoint:** Query session analytics programmatically at `GET http://localhost:16000/api/telemetry`.
|
|
576
612
|
* **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.
|
|
577
613
|
* **Dual Dark Modes:** Toggle between Obsidian OLED (`#000000`) and Slate Navy (`#0f172a`) interfaces.
|
|
@@ -618,7 +654,7 @@ This package is continuously tested across multiple platforms and Node.js versio
|
|
|
618
654
|
- **Multi-OS matrix:** Ubuntu, Windows, macOS
|
|
619
655
|
- **Node.js versions:** 20.x, 22.x
|
|
620
656
|
- **Code quality:** Enforced by [Biome.js](https://biomejs.dev/) (linting + formatting)
|
|
621
|
-
- **Security:** Verified 6-layer defense-in-depth architecture
|
|
657
|
+
- **Security:** Verified 6-layer defense-in-depth architecture (see [Security Architecture](https://nekzus-32.mintlify.app/typescript-sdk/security))
|
|
622
658
|
|
|
623
659
|
> 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).
|
|
624
660
|
|
|
@@ -638,12 +674,12 @@ The codebase undergoes regular dependencies audits. As of June 2026, the SDK is
|
|
|
638
674
|
|
|
639
675
|
## Related
|
|
640
676
|
|
|
641
|
-
- [LIOP Documentation](https://nekzus-32.mintlify.app/)
|
|
642
|
-
- [LIOP Specification](https://github.com/Nekzus/LIOP/blob/main/protocol/SPECIFICATION.md)
|
|
643
|
-
- [LIOP Manifesto](https://github.com/Nekzus/LIOP/blob/main/MANIFESTO.md)
|
|
644
|
-
- [Contributing Guide](https://github.com/Nekzus/LIOP/blob/main/CONTRIBUTING.md)
|
|
645
|
-
- [Rust Mesh Node](https://github.com/Nekzus/LIOP/tree/main/servers/liop-node)
|
|
646
|
-
- [LIOP CLI](https://github.com/Nekzus/LIOP/tree/main/tools/liop-cli)
|
|
677
|
+
- [LIOP Documentation](https://nekzus-32.mintlify.app/): Full conceptual and API documentation
|
|
678
|
+
- [LIOP Specification](https://github.com/Nekzus/LIOP/blob/main/protocol/SPECIFICATION.md): Technical specification
|
|
679
|
+
- [LIOP Manifesto](https://github.com/Nekzus/LIOP/blob/main/MANIFESTO.md): Project philosophy
|
|
680
|
+
- [Contributing Guide](https://github.com/Nekzus/LIOP/blob/main/CONTRIBUTING.md): How to contribute
|
|
681
|
+
- [Rust Mesh Node](https://github.com/Nekzus/LIOP/tree/main/servers/liop-node): Native high-performance backend
|
|
682
|
+
- [LIOP CLI](https://github.com/Nekzus/LIOP/tree/main/tools/liop-cli): Developer diagnostics
|
|
647
683
|
|
|
648
684
|
---
|
|
649
685
|
|
package/dist/bin/agent.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
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-JWFLXXZS.js';
|
|
5
5
|
import '../chunk-Y62GORQF.js';
|
|
6
|
-
import { LiopMcpRouter } from '../chunk-
|
|
7
|
-
import '../chunk-
|
|
6
|
+
import { LiopMcpRouter } from '../chunk-IDTXJQBH.js';
|
|
7
|
+
import '../chunk-ZRWNMP5L.js';
|
|
8
8
|
import '../chunk-IK7CGWAZ.js';
|
|
9
9
|
import '../chunk-7PITYWOV.js';
|
|
10
10
|
import '../chunk-WPTOJYN5.js';
|
|
11
|
-
import '../chunk-
|
|
12
|
-
import '../chunk-
|
|
13
|
-
import { isLegacyRequest } from '../chunk-
|
|
11
|
+
import '../chunk-GFGSHQN5.js';
|
|
12
|
+
import '../chunk-Q3FKHJ3B.js';
|
|
13
|
+
import { normalizeToolArguments, TOOL_ALIASES, isLegacyRequest } from '../chunk-KR5UZUEY.js';
|
|
14
|
+
import '../chunk-P34HDRN5.js';
|
|
14
15
|
import '../chunk-FTF6AMF6.js';
|
|
15
16
|
import '../chunk-ZP3VVXOI.js';
|
|
16
|
-
import { MeshNode } from '../chunk-
|
|
17
|
+
import { MeshNode } from '../chunk-IHKKWXHJ.js';
|
|
17
18
|
import { log } from '../chunk-K3DGJLUY.js';
|
|
18
19
|
import * as fs from 'fs';
|
|
19
20
|
import * as os from 'os';
|
|
@@ -136,6 +137,21 @@ async function resolveBootstrapNodes(liopDir) {
|
|
|
136
137
|
if (args.length > 0) {
|
|
137
138
|
bootstrapNodes = args.filter((a) => a.startsWith("/"));
|
|
138
139
|
}
|
|
140
|
+
if (process.env.LIOP_NEXUS_URL || process.env.LIOP_BLG_URL) {
|
|
141
|
+
const targetUrl = process.env.LIOP_NEXUS_URL || process.env.LIOP_BLG_URL;
|
|
142
|
+
if (targetUrl) {
|
|
143
|
+
const resolved = await resolveBootstrapFromUrl(targetUrl);
|
|
144
|
+
if (resolved) {
|
|
145
|
+
const normalized = normalizeBootstrap(resolved);
|
|
146
|
+
if (!bootstrapNodes.includes(normalized)) {
|
|
147
|
+
bootstrapNodes.push(normalized);
|
|
148
|
+
log.info(
|
|
149
|
+
`[LIOP-Agent] \u2705 Added bootstrap from URL discovery: ${normalized}`
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
139
155
|
if (bootstrapNodes.length === 0) {
|
|
140
156
|
const searchDirs = [
|
|
141
157
|
process.cwd(),
|
|
@@ -168,19 +184,6 @@ async function resolveBootstrapNodes(liopDir) {
|
|
|
168
184
|
}
|
|
169
185
|
}
|
|
170
186
|
}
|
|
171
|
-
if (process.env.LIOP_NEXUS_URL) {
|
|
172
|
-
const nexusUrl = process.env.LIOP_NEXUS_URL;
|
|
173
|
-
const resolved = await resolveBootstrapFromUrl(nexusUrl);
|
|
174
|
-
if (resolved) {
|
|
175
|
-
const normalized = normalizeBootstrap(resolved);
|
|
176
|
-
if (!bootstrapNodes.includes(normalized)) {
|
|
177
|
-
bootstrapNodes.push(normalized);
|
|
178
|
-
log.info(
|
|
179
|
-
`[LIOP-Agent] \u2705 Added bootstrap from URL discovery: ${normalized}`
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
187
|
if (bootstrapNodes.length === 0 && process.env.LIOP_BOOTSTRAP) {
|
|
185
188
|
bootstrapNodes.push(process.env.LIOP_BOOTSTRAP.trim());
|
|
186
189
|
}
|
|
@@ -398,6 +401,13 @@ async function runGatewayMode(gateway, tokenManager, routingTable) {
|
|
|
398
401
|
}
|
|
399
402
|
if (method === "tools/call") {
|
|
400
403
|
const params = request.params;
|
|
404
|
+
if (params?.arguments) {
|
|
405
|
+
params.arguments = normalizeToolArguments(params.arguments);
|
|
406
|
+
}
|
|
407
|
+
if (params?.name) {
|
|
408
|
+
const canonicalName = TOOL_ALIASES[params.name] || params.name;
|
|
409
|
+
params.name = canonicalName;
|
|
410
|
+
}
|
|
401
411
|
if (params?.name === "LiopMeshStatus") {
|
|
402
412
|
const statusResponse = {
|
|
403
413
|
jsonrpc: "2.0",
|
|
@@ -437,6 +447,16 @@ async function runGatewayMode(gateway, tokenManager, routingTable) {
|
|
|
437
447
|
if (!hasStatus) {
|
|
438
448
|
toolsList.unshift(LIOP_MESH_STATUS_TOOL);
|
|
439
449
|
}
|
|
450
|
+
for (const [alias, target] of Object.entries(TOOL_ALIASES)) {
|
|
451
|
+
const targetDef = toolsList.find((t) => t.name === target);
|
|
452
|
+
if (targetDef && !toolsList.some((t) => t.name === alias)) {
|
|
453
|
+
toolsList.push({
|
|
454
|
+
...targetDef,
|
|
455
|
+
name: alias,
|
|
456
|
+
description: `[Alias -> ${target}] ${targetDef.description || ""}`.trim()
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
}
|
|
440
460
|
routingTable.registerGatewayTools(toolsList, gateway.mcpEndpoint);
|
|
441
461
|
}
|
|
442
462
|
if (!isLegacyRequest(request)) {
|
|
@@ -719,7 +739,15 @@ async function runHybridMode(topology, tokenManager, routingTable) {
|
|
|
719
739
|
}
|
|
720
740
|
if (method === "tools/call") {
|
|
721
741
|
const params = request.params;
|
|
722
|
-
|
|
742
|
+
if (params?.arguments) {
|
|
743
|
+
params.arguments = normalizeToolArguments(params.arguments);
|
|
744
|
+
}
|
|
745
|
+
const rawToolName = params?.name || "";
|
|
746
|
+
const canonicalToolName = TOOL_ALIASES[rawToolName] || rawToolName;
|
|
747
|
+
if (params?.name) {
|
|
748
|
+
params.name = canonicalToolName;
|
|
749
|
+
}
|
|
750
|
+
const toolName = canonicalToolName;
|
|
723
751
|
const route = routingTable.resolve(toolName);
|
|
724
752
|
if (route?.provider === "http-gateway") {
|
|
725
753
|
const start = Date.now();
|
|
@@ -777,6 +805,16 @@ async function runHybridMode(topology, tokenManager, routingTable) {
|
|
|
777
805
|
for (const t of gatewayTools) toolMap.set(t.name, t);
|
|
778
806
|
for (const t of meshTools)
|
|
779
807
|
if (!toolMap.has(t.name)) toolMap.set(t.name, t);
|
|
808
|
+
for (const [alias, target] of Object.entries(TOOL_ALIASES)) {
|
|
809
|
+
const targetDef = toolMap.get(target);
|
|
810
|
+
if (targetDef && !toolMap.has(alias)) {
|
|
811
|
+
toolMap.set(alias, {
|
|
812
|
+
...targetDef,
|
|
813
|
+
name: alias,
|
|
814
|
+
description: `[Alias -> ${target}] ${targetDef.description || ""}`.trim()
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
}
|
|
780
818
|
const merged = Array.from(toolMap.values()).sort(
|
|
781
819
|
(a, b) => a.name.localeCompare(b.name)
|
|
782
820
|
);
|