@nekzus/liop 2.4.0-alpha.3 → 2.4.0-alpha.30
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/NOTICE +19 -0
- package/README.md +148 -69
- package/dist/bin/agent.js +27 -303
- package/dist/bridge.d.ts +4 -3
- package/dist/bridge.js +1 -4
- package/dist/chunk-2XHSALII.js +3 -0
- package/dist/chunk-2ZYX736J.js +2 -0
- package/dist/chunk-3WRKTVOF.js +2 -0
- package/dist/chunk-6KFKO6ZX.js +2 -0
- package/dist/chunk-6VK2XALI.js +2 -0
- package/dist/chunk-AN5NODTN.js +31 -0
- package/dist/chunk-AYDF3IFZ.js +2 -0
- package/dist/chunk-ECRS6N33.js +4 -0
- package/dist/chunk-FDJMH4CB.js +2 -0
- package/dist/chunk-FTF6AMF6.js +2 -0
- package/dist/chunk-GWVSCZUS.js +2 -0
- package/dist/chunk-HLAQ3HVD.js +57 -0
- package/dist/chunk-LZIEMSYZ.js +15 -0
- package/dist/chunk-MQ5SU26J.js +2 -0
- package/dist/chunk-N35BC62H.js +2 -0
- package/dist/chunk-PRNQM5KL.js +46 -0
- package/dist/chunk-TKLRW52V.js +2 -0
- package/dist/chunk-V35CXJQN.js +2 -0
- package/dist/chunk-WP5ER7RH.js +3 -0
- package/dist/chunk-XLVEDKM6.js +2 -0
- package/dist/chunk-Y675R34Z.js +2 -0
- package/dist/chunk-YLCNV764.js +3 -0
- package/dist/chunk-ZEU57HJP.js +3 -0
- package/dist/chunk-ZZMSFCJP.js +3 -0
- package/dist/client.d.ts +6 -4
- package/dist/client.js +1 -9
- package/dist/gateway.d.ts +6 -5
- package/dist/gateway.js +1 -10
- package/dist/{hybrid-CF__0YnC.d.ts → hybrid-BZpCiUaV.d.ts} +6 -5
- package/dist/{index-cMV0_yD9.d.ts → index-BYDtRGue.d.ts} +45 -36
- package/dist/{index-BW95kAL4.d.ts → index-ByzjpRCk.d.ts} +37 -72
- package/dist/index.d.ts +221 -50
- package/dist/index.js +4 -312
- package/dist/kyber-PULV7PQX.js +2 -0
- package/dist/mesh.d.ts +27 -143
- package/dist/mesh.js +1 -4
- package/dist/node-Djzm6UYd.d.ts +172 -0
- package/dist/protocol/liop_core.proto +25 -6
- package/dist/server.d.ts +4 -3
- package/dist/server.js +1 -7
- package/dist/types-29zv9X1V.d.ts +455 -0
- package/dist/types.d.ts +2 -1
- package/dist/types.js +1 -2
- package/dist/verifier-DqZ9MQ9l.d.ts +82 -0
- package/dist/verifier-J4NQYZX5.js +2 -0
- package/dist/workers/logic-execution.d.ts +7 -0
- package/dist/workers/logic-execution.js +1 -271
- package/dist/workers/zk-verifier.d.ts +9 -0
- package/dist/workers/zk-verifier.js +1 -173
- package/dist/zk-DzYNWBgo.d.ts +104 -0
- package/package.json +57 -84
- package/dist/bin/agent.js.map +0 -1
- package/dist/bridge.js.map +0 -1
- package/dist/chunk-32ADSAJS.js +0 -104
- package/dist/chunk-32ADSAJS.js.map +0 -1
- package/dist/chunk-547TYL27.js +0 -208109
- package/dist/chunk-547TYL27.js.map +0 -1
- package/dist/chunk-72MNYFR6.js +0 -64
- package/dist/chunk-72MNYFR6.js.map +0 -1
- package/dist/chunk-74CISO2I.js +0 -853
- package/dist/chunk-74CISO2I.js.map +0 -1
- package/dist/chunk-CRZBVFDV.js +0 -616
- package/dist/chunk-CRZBVFDV.js.map +0 -1
- package/dist/chunk-GA3Q2S7O.js +0 -558
- package/dist/chunk-GA3Q2S7O.js.map +0 -1
- package/dist/chunk-JIJPZFR2.js +0 -51
- package/dist/chunk-JIJPZFR2.js.map +0 -1
- package/dist/chunk-OUUTDSOW.js +0 -24
- package/dist/chunk-OUUTDSOW.js.map +0 -1
- package/dist/chunk-PYKRQAER.js +0 -77
- package/dist/chunk-PYKRQAER.js.map +0 -1
- package/dist/chunk-QLCOEP5J.js +0 -68
- package/dist/chunk-QLCOEP5J.js.map +0 -1
- package/dist/chunk-RWRRBYG4.js +0 -3
- package/dist/chunk-RWRRBYG4.js.map +0 -1
- package/dist/chunk-SONUORBT.js +0 -421
- package/dist/chunk-SONUORBT.js.map +0 -1
- package/dist/chunk-T5IUZF47.js +0 -716
- package/dist/chunk-T5IUZF47.js.map +0 -1
- package/dist/chunk-U5BZ66VX.js +0 -447
- package/dist/chunk-U5BZ66VX.js.map +0 -1
- package/dist/chunk-WCCGE4QR.js +0 -3520
- package/dist/chunk-WCCGE4QR.js.map +0 -1
- package/dist/chunk-WSW6YJNY.js +0 -168
- package/dist/chunk-WSW6YJNY.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-3ULIJSE3.js +0 -3
- package/dist/kyber-3ULIJSE3.js.map +0 -1
- package/dist/mesh.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/types-lJIxBlWF.d.ts +0 -256
- package/dist/types.js.map +0 -1
- package/dist/verifier-3FAKCFNN.js +0 -5
- package/dist/verifier-3FAKCFNN.js.map +0 -1
- package/dist/verifier-COnid_dg.d.ts +0 -31
- package/dist/workers/logic-execution.js.map +0 -1
- package/dist/workers/zk-verifier.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,48 @@
|
|
|
1
1
|
export { LiopBridgeOptions, LiopMcpBridge, LiopStreamBridge, LiopStreamBridgeOptions } from './bridge.js';
|
|
2
|
-
import { L as LiopTlsOptions } from './index-
|
|
3
|
-
export { C as CertInfo, a as CertManager, b as CertManagerOptions, c as LiopClient } from './index-
|
|
2
|
+
import { L as LiopTlsOptions } from './index-BYDtRGue.js';
|
|
3
|
+
export { C as CertInfo, a as CertManager, b as CertManagerOptions, c as LiopClient, d as createChannelCredentials, e as createServerCredentials } from './index-BYDtRGue.js';
|
|
4
|
+
import { ProofWithSignals, VerificationKey } from 'micro-zk-proofs';
|
|
5
|
+
export { ProofWithSignals, VerificationKey } from 'micro-zk-proofs';
|
|
6
|
+
export { L as LiopVerifier, T as TeePolicy, a as TeeVerificationOptions, b as TeeVerificationResult, V as VerifyZkOptions } from './verifier-DqZ9MQ9l.js';
|
|
4
7
|
import * as http from 'node:http';
|
|
5
|
-
export { I as InMemoryRateLimiter, L as LiopHybridGateway, a as LiopMcpRouter, R as RateLimitStatus, b as RateLimiterOptions } from './hybrid-
|
|
6
|
-
|
|
8
|
+
export { I as InMemoryRateLimiter, L as LiopHybridGateway, a as LiopMcpRouter, R as RateLimitStatus, b as RateLimiterOptions } from './hybrid-BZpCiUaV.js';
|
|
9
|
+
import { A as AuthInfo } from './types-29zv9X1V.js';
|
|
10
|
+
export { g as AuditEntry, h as AuditInterceptor, d as AuditLogger, i as AuditRecordParams, j as AuditStatus, k as CacheableResult, C as CallToolRequest, a as CallToolResult, D as DiscoverResult, l as GENESIS_HASH, m as GatewayAdmissionResult, n as GatewayInterceptor, o as GatewayInterceptorContext, G as GatewayInterceptorOptions, e as GetPromptRequest, f as GetPromptResult, I as InputRequest, p as InputRequiredResult, q as InputResponse, J as JwtValidator, L as LiopLogger, r as LogEvent, s as LogInterceptor, t as LogLevel, u as MCP_LEGACY_SUPPORT_ENABLED, v as MCP_PROTOCOL_VERSION, w as MCP_PROTOCOL_VERSION_LEGACY, M as McpEra, b as McpRequest, x as McpRequestMeta, c as McpResponse, P as Prompt, y as PromptSchema, R as Resource, z as ResourceSchema, S as ServerInfo, T as Tool, B as ToolSchema, E as computeEntryHash, F as executeGatewayInterceptor, H as globalAuditLogger, K as log } from './types-29zv9X1V.js';
|
|
11
|
+
export { L as LiopManifest, a as MeshNode, M as MeshNodeConfig } from './node-Djzm6UYd.js';
|
|
12
|
+
export { SWARM_KEY_BYTE_LENGTH, createSwarmKey, deserializeSwarmKey, loadSwarmKey, parseSwarmKey, saveSwarmKey, serializeSwarmKey } from './mesh.js';
|
|
7
13
|
import * as grpc from '@grpc/grpc-js';
|
|
8
|
-
export { A as AUTH_DEFAULTS, b as AggregationPolicy, c as
|
|
9
|
-
import { A as AuthInfo } from './types-lJIxBlWF.js';
|
|
10
|
-
export { e as CacheableResult, C as CallToolRequest, a as CallToolResult, D as DiscoverResult, G as GetPromptRequest, d as GetPromptResult, I as InputRequest, f as InputRequiredResult, g as InputResponse, J as JwtValidator, h as MCP_LEGACY_SUPPORT_ENABLED, i as MCP_PROTOCOL_VERSION, j as MCP_PROTOCOL_VERSION_LEGACY, M as McpEra, b as McpRequest, k as McpRequestMeta, c as McpResponse, P as Prompt, l as PromptSchema, R as Resource, m as ResourceSchema, S as ServerInfo, T as Tool, n as ToolSchema } from './types-lJIxBlWF.js';
|
|
14
|
+
export { A as AUTH_DEFAULTS, b as AggregationPolicy, c as AuthRole, d as LiopAuthConfig, L as LiopServer, a as LiopServerOptions, e as LogicExecutionPolicy, N as NerScanner, O as OAuthClientConfig, f as OutputSanitizerConfig, P as PII_PATTERNS, g as PII_PRESETS, h as PiiRule, i as PiiScanner, T as ToolHandler, s as sanitizeOutput } from './index-ByzjpRCk.js';
|
|
11
15
|
import * as jose from 'jose';
|
|
12
16
|
import Provider from 'oidc-provider';
|
|
17
|
+
export { D as DecodedReceipt, P as ProofType, R as RECEIPT_VERSION_V1, a as RECEIPT_VERSION_V2, b as ZK_JOURNAL_V2_SIZE, c as ZkJournalV2, Z as ZkPolicy, d as ZkReceipt, e as ZkVerificationError, f as ZkVerifier, g as decodeJournalV2, h as encodeJournalV2, r as receiptCodec } from './zk-DzYNWBgo.js';
|
|
13
18
|
import '@modelcontextprotocol/sdk/server/mcp.js';
|
|
14
19
|
import 'zod';
|
|
15
|
-
import './verifier-COnid_dg.js';
|
|
16
20
|
import 'node:events';
|
|
17
21
|
|
|
22
|
+
declare const VERIFICATION_LATENCY_BUDGET_MS = 250;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Verifies a Groth16 Zero-Knowledge proof against a verification key.
|
|
26
|
+
* Traps curve validation errors gracefully to ensure safe verification.
|
|
27
|
+
*/
|
|
28
|
+
declare function verifyGroth16Proof(vkey: VerificationKey, proofWithSignals: ProofWithSignals): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Serializes a VerificationKey into a Buffer.
|
|
31
|
+
*/
|
|
32
|
+
declare function serializeVKey(vkey: VerificationKey): Buffer;
|
|
33
|
+
/**
|
|
34
|
+
* Deserializes a Buffer into a typed VerificationKey.
|
|
35
|
+
*/
|
|
36
|
+
declare function deserializeVKey(buf: Buffer): VerificationKey;
|
|
37
|
+
/**
|
|
38
|
+
* Serializes a ProofWithSignals into a Buffer.
|
|
39
|
+
*/
|
|
40
|
+
declare function serializeGrothProof(proofWithSignals: ProofWithSignals): Buffer;
|
|
41
|
+
/**
|
|
42
|
+
* Deserializes a Buffer into a typed ProofWithSignals.
|
|
43
|
+
*/
|
|
44
|
+
declare function deserializeGrothProof(buf: Buffer): ProofWithSignals;
|
|
45
|
+
|
|
18
46
|
/**
|
|
19
47
|
* TokenEstimator — Pluggable strategy for counting tokens in text content.
|
|
20
48
|
*
|
|
@@ -36,7 +64,7 @@ interface TokenEstimator {
|
|
|
36
64
|
*
|
|
37
65
|
* - Synchronous: safe for hot-path usage without async overhead
|
|
38
66
|
* - Merge cache reduced to 10K entries for long-running server processes
|
|
39
|
-
* -
|
|
67
|
+
* - External dependency: resolved from gpt-tokenizer in node_modules at runtime
|
|
40
68
|
*/
|
|
41
69
|
declare class RealTokenEstimator implements TokenEstimator {
|
|
42
70
|
readonly name = "o200k_base";
|
|
@@ -113,6 +141,7 @@ interface TokenOperationMetric {
|
|
|
113
141
|
readonly toolName?: string;
|
|
114
142
|
readonly peerId?: string;
|
|
115
143
|
readonly durationMs?: number;
|
|
144
|
+
readonly originDatasetTokens?: number;
|
|
116
145
|
}
|
|
117
146
|
/** Session-level aggregate report */
|
|
118
147
|
interface TokenSessionReport {
|
|
@@ -313,17 +342,25 @@ declare class MetricsRegistry {
|
|
|
313
342
|
}
|
|
314
343
|
declare const protocolMetrics: MetricsRegistry;
|
|
315
344
|
declare const toolCallsTotal: Counter;
|
|
345
|
+
declare const toolCallErrorsTotal: Counter;
|
|
316
346
|
declare const fuelConsumed: Histogram;
|
|
317
347
|
declare const meshPeersConnected: Gauge;
|
|
318
348
|
declare const manifestCacheSize: Gauge;
|
|
319
349
|
declare const egressBlocksTotal: Counter;
|
|
320
350
|
declare const zkVerificationDurationMs: Histogram;
|
|
351
|
+
declare const zkVerificationsTotal: Counter;
|
|
352
|
+
declare const zkProofsByTypeTotal: Counter;
|
|
353
|
+
declare const zkProvingDurationMs: Histogram;
|
|
354
|
+
declare const zkVkeyCacheSize: Gauge;
|
|
355
|
+
declare const tokensInputTotal: Counter;
|
|
356
|
+
declare const tokensOutputTotal: Counter;
|
|
357
|
+
declare const tokensSavedTotal: Counter;
|
|
358
|
+
declare const operationDurationMs: Histogram;
|
|
359
|
+
declare const pqcHandshakeDurationMs: Histogram;
|
|
360
|
+
declare const pqcHandshakesTotal: Counter;
|
|
361
|
+
declare const wireEgressBytesTotal: Counter;
|
|
362
|
+
declare const wireSavedBytesTotal: Counter;
|
|
321
363
|
|
|
322
|
-
/**
|
|
323
|
-
* LIOP OpenTelemetry Distributed Tracing (Phase Beta-3)
|
|
324
|
-
* W3C TraceContext compliant distributed tracer for gRPC & MCP transports.
|
|
325
|
-
* Spec: https://www.w3.org/TR/trace-context/
|
|
326
|
-
*/
|
|
327
364
|
interface SpanContext {
|
|
328
365
|
traceId: string;
|
|
329
366
|
spanId: string;
|
|
@@ -382,6 +419,16 @@ declare const GRPC_CHANNEL_OPTIONS: Readonly<Record<string, string | number>>;
|
|
|
382
419
|
* TypeScript interfaces reflecting liop_core.proto (LIOP v1)
|
|
383
420
|
* Optimized for logic-on-origin and high-performance serialization.
|
|
384
421
|
*/
|
|
422
|
+
declare enum ProofMode {
|
|
423
|
+
PROOF_MODE_LEGACY_HMAC = 0,
|
|
424
|
+
PROOF_MODE_ZK_OPTIMISTIC = 1,
|
|
425
|
+
PROOF_MODE_ZK_BLOCKING = 2
|
|
426
|
+
}
|
|
427
|
+
declare enum ProofType {
|
|
428
|
+
PROOF_TYPE_HMAC_LEGACY = 0,
|
|
429
|
+
PROOF_TYPE_GROTH16 = 2,
|
|
430
|
+
PROOF_TYPE_GROTH16_PQC_HYBRID = 3
|
|
431
|
+
}
|
|
385
432
|
interface IntentRequest {
|
|
386
433
|
agent_did: string;
|
|
387
434
|
capability_hash: string;
|
|
@@ -399,14 +446,18 @@ interface LogicRequest {
|
|
|
399
446
|
inputs: Record<string, Uint8Array>;
|
|
400
447
|
pqc_ciphertext: Uint8Array;
|
|
401
448
|
aes_nonce: Uint8Array;
|
|
449
|
+
requested_proof_mode?: ProofMode;
|
|
402
450
|
}
|
|
403
451
|
interface LogicResponse {
|
|
404
452
|
semantic_evidence: string;
|
|
405
453
|
cryptographic_proof: Uint8Array;
|
|
406
454
|
zk_receipt: Uint8Array;
|
|
407
455
|
is_error: boolean;
|
|
456
|
+
proof_type?: ProofType;
|
|
457
|
+
guest_image_id?: Uint8Array;
|
|
408
458
|
}
|
|
409
459
|
|
|
460
|
+
type TokenProvider = string | (() => Promise<string | undefined> | string | undefined);
|
|
410
461
|
/**
|
|
411
462
|
* LIOP gRPC Client Implementation
|
|
412
463
|
* Provides a high-level interface for secure intent negotiation and logic execution.
|
|
@@ -414,8 +465,11 @@ interface LogicResponse {
|
|
|
414
465
|
declare class LiopRpcClient {
|
|
415
466
|
private client;
|
|
416
467
|
private token?;
|
|
468
|
+
private lastResolvedToken?;
|
|
417
469
|
readonly address: string;
|
|
418
|
-
constructor(address: string, tls?: LiopTlsOptions, token?:
|
|
470
|
+
constructor(address: string, tls?: LiopTlsOptions, token?: TokenProvider);
|
|
471
|
+
setToken(token?: TokenProvider): void;
|
|
472
|
+
private resolveToken;
|
|
419
473
|
/**
|
|
420
474
|
* Negotiates intent with the remote host.
|
|
421
475
|
* Returns the ephemeral Kyber public key for payload encryption.
|
|
@@ -430,17 +484,28 @@ declare class LiopRpcClient {
|
|
|
430
484
|
}
|
|
431
485
|
|
|
432
486
|
/**
|
|
433
|
-
* LIOP
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
*
|
|
437
|
-
* Characteristics:
|
|
438
|
-
* - Security Category: NIST Level 3 (~AES-192 equivalent quantum resistance)
|
|
439
|
-
* - Public Key Length: 1952 bytes
|
|
440
|
-
* - Secret Key Length: 4032 bytes
|
|
441
|
-
* - Signature Length: 3309 bytes
|
|
442
|
-
* - Implementation: Pure TypeScript/JS via @noble/post-quantum
|
|
487
|
+
* LIOP Symmetric Payload Encryption Wrapper
|
|
488
|
+
* Uses AES-256-GCM to secure WASM Code transport over Zero-Trust networks.
|
|
489
|
+
* Fully compatible with the `aes-gcm` Rust crate used by Wasmtime.
|
|
443
490
|
*/
|
|
491
|
+
declare const AesGcmWrapper: {
|
|
492
|
+
/**
|
|
493
|
+
* Encrypts a raw WASM payload using the shared secret negotiated via Kyber768.
|
|
494
|
+
*
|
|
495
|
+
* @param payload Raw incoming WASM byte array or string.
|
|
496
|
+
* @param sharedSecret A perfectly derived 32-byte (256-bit) shared secret array
|
|
497
|
+
* @returns The encrypted buffer to push to the GRPc stream, along with the 12-byte initialization vector natively generated.
|
|
498
|
+
*/
|
|
499
|
+
encryptPayload(payload: Uint8Array | Buffer, sharedSecret: Uint8Array): {
|
|
500
|
+
ciphertext: Buffer;
|
|
501
|
+
nonce: Buffer;
|
|
502
|
+
};
|
|
503
|
+
/**
|
|
504
|
+
* Decrypts a remote Zero-Knowledge receipt using AES-256-GCM.
|
|
505
|
+
*/
|
|
506
|
+
decryptPayload(ciphertextBuffer: Buffer, nonce: Buffer, sharedSecret: Uint8Array): Buffer;
|
|
507
|
+
};
|
|
508
|
+
|
|
444
509
|
declare const DILITHIUM65_CONSTANTS: {
|
|
445
510
|
readonly PUBLIC_KEY_BYTES: 1952;
|
|
446
511
|
readonly SECRET_KEY_BYTES: 4032;
|
|
@@ -460,6 +525,10 @@ declare const Dilithium65Wrapper: {
|
|
|
460
525
|
publicKey: Uint8Array;
|
|
461
526
|
secretKey: Uint8Array;
|
|
462
527
|
};
|
|
528
|
+
/**
|
|
529
|
+
* Derives the ML-DSA-65 public key from a given secret key.
|
|
530
|
+
*/
|
|
531
|
+
getPublicKey(secretKey: Uint8Array): Uint8Array;
|
|
463
532
|
/**
|
|
464
533
|
* Validates and imports a raw ML-DSA-65 public key.
|
|
465
534
|
*/
|
|
@@ -527,6 +596,132 @@ declare class LiopRpcServer {
|
|
|
527
596
|
stop(): Promise<void>;
|
|
528
597
|
}
|
|
529
598
|
|
|
599
|
+
type TransportProvider = "http-gateway" | "p2p-grpc" | "local";
|
|
600
|
+
interface ToolDefinition {
|
|
601
|
+
name: string;
|
|
602
|
+
description?: string;
|
|
603
|
+
inputSchema?: Record<string, unknown>;
|
|
604
|
+
}
|
|
605
|
+
interface ToolRoute {
|
|
606
|
+
name: string;
|
|
607
|
+
provider: TransportProvider;
|
|
608
|
+
endpoint: string;
|
|
609
|
+
description?: string;
|
|
610
|
+
inputSchema?: Record<string, unknown>;
|
|
611
|
+
latencyMs: number;
|
|
612
|
+
failCount: number;
|
|
613
|
+
lastSuccess: number;
|
|
614
|
+
authRequired?: boolean;
|
|
615
|
+
}
|
|
616
|
+
declare class RoutingTable {
|
|
617
|
+
private routes;
|
|
618
|
+
private static readonly MAX_FAILURES;
|
|
619
|
+
/**
|
|
620
|
+
* Registers or updates a collection of tools exposed via an HTTP Gateway.
|
|
621
|
+
*/
|
|
622
|
+
registerGatewayTools(tools: ToolDefinition[], mcpEndpoint: string, authRequired?: boolean): void;
|
|
623
|
+
/**
|
|
624
|
+
* Registers tools discovered directly over the P2P Mesh (gRPC).
|
|
625
|
+
*/
|
|
626
|
+
registerMeshTools(tools: ToolDefinition[], grpcTarget: string, authRequired?: boolean): void;
|
|
627
|
+
/**
|
|
628
|
+
* Registers an in-process local tool (e.g. LiopMeshStatus).
|
|
629
|
+
*/
|
|
630
|
+
registerLocalTool(tool: ToolDefinition): void;
|
|
631
|
+
/**
|
|
632
|
+
* Resolves the optimal route for a specific tool.
|
|
633
|
+
*/
|
|
634
|
+
resolve(toolName: string): ToolRoute | undefined;
|
|
635
|
+
/**
|
|
636
|
+
* Records a successful invocation on a route, resetting failures and updating latency.
|
|
637
|
+
*/
|
|
638
|
+
recordSuccess(toolName: string, latencyMs: number): void;
|
|
639
|
+
/**
|
|
640
|
+
* Records a failed invocation on a route.
|
|
641
|
+
*/
|
|
642
|
+
recordFailure(toolName: string): void;
|
|
643
|
+
/**
|
|
644
|
+
* Lists all registered tools in sorted format for tools/list.
|
|
645
|
+
*/
|
|
646
|
+
getAllToolDefinitions(): ToolDefinition[];
|
|
647
|
+
getRoute(toolName: string): ToolRoute | undefined;
|
|
648
|
+
size(): number;
|
|
649
|
+
clear(): void;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
interface TokenManagerOptions {
|
|
653
|
+
tokenEndpoint: string;
|
|
654
|
+
clientId: string;
|
|
655
|
+
clientSecret: string;
|
|
656
|
+
audience?: string;
|
|
657
|
+
scopes?: string | string[];
|
|
658
|
+
staticToken?: string;
|
|
659
|
+
}
|
|
660
|
+
declare class TokenManager {
|
|
661
|
+
private cachedToken;
|
|
662
|
+
private expiresAt;
|
|
663
|
+
private pendingPromise;
|
|
664
|
+
private readonly tokenEndpoint;
|
|
665
|
+
private readonly clientId;
|
|
666
|
+
private readonly clientSecret;
|
|
667
|
+
private readonly audience;
|
|
668
|
+
private readonly scope;
|
|
669
|
+
private staticToken?;
|
|
670
|
+
private static readonly REFRESH_BUFFER_MS;
|
|
671
|
+
constructor(options: TokenManagerOptions);
|
|
672
|
+
/**
|
|
673
|
+
* Returns a valid OAuth 2.1 access token.
|
|
674
|
+
* Automatically performs preemptive refresh if the token is close to expiry.
|
|
675
|
+
*/
|
|
676
|
+
getToken(): Promise<string>;
|
|
677
|
+
/**
|
|
678
|
+
* Force-invalidates cached token, e.g. after receiving a 401 Unauthorized response.
|
|
679
|
+
*/
|
|
680
|
+
invalidate(): void;
|
|
681
|
+
/**
|
|
682
|
+
* Returns true if the token is absent or has passed the refresh threshold.
|
|
683
|
+
*/
|
|
684
|
+
isExpired(): boolean;
|
|
685
|
+
getExpiresAt(): number;
|
|
686
|
+
private fetchNewToken;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
interface GatewayTopologyInfo {
|
|
690
|
+
baseUrl: string;
|
|
691
|
+
mcpEndpoint: string;
|
|
692
|
+
healthEndpoint: string;
|
|
693
|
+
tokenEndpoint: string;
|
|
694
|
+
issuer: string;
|
|
695
|
+
audience: string;
|
|
696
|
+
scopes: string[];
|
|
697
|
+
tools: string[];
|
|
698
|
+
tier: number;
|
|
699
|
+
}
|
|
700
|
+
interface MeshTopologyInfo {
|
|
701
|
+
bootstrapNodes: string[];
|
|
702
|
+
identityPath?: string;
|
|
703
|
+
}
|
|
704
|
+
interface TopologyProbeResult {
|
|
705
|
+
mode: "gateway" | "mesh" | "hybrid";
|
|
706
|
+
gateway?: GatewayTopologyInfo;
|
|
707
|
+
mesh?: MeshTopologyInfo;
|
|
708
|
+
}
|
|
709
|
+
interface TopologyProbeOptions {
|
|
710
|
+
blgUrl?: string;
|
|
711
|
+
nexusUrl?: string;
|
|
712
|
+
clientId?: string;
|
|
713
|
+
clientSecret?: string;
|
|
714
|
+
audience?: string;
|
|
715
|
+
staticToken?: string;
|
|
716
|
+
bootstrapNodes?: string[];
|
|
717
|
+
identityPath?: string;
|
|
718
|
+
autoProbeLocal?: boolean;
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Probes the runtime environment and determines the optimal architecture mode.
|
|
722
|
+
*/
|
|
723
|
+
declare function probeTopology(options?: TopologyProbeOptions): Promise<TopologyProbeResult>;
|
|
724
|
+
|
|
530
725
|
/**
|
|
531
726
|
* Returns a filtered environment object containing only safe system variables,
|
|
532
727
|
* preventing exposure of sensitive credentials and shell function injection.
|
|
@@ -574,21 +769,6 @@ declare class WasiSandbox {
|
|
|
574
769
|
teardown(): Promise<void>;
|
|
575
770
|
}
|
|
576
771
|
|
|
577
|
-
/**
|
|
578
|
-
* LIOP Embedded OAuth 2.1 Authorization Server
|
|
579
|
-
*
|
|
580
|
-
* Implements a lightweight, high-performance OAuth 2.1 / OIDC Authorization Server
|
|
581
|
-
* for the Nexus node using `panva/node-oidc-provider`.
|
|
582
|
-
*
|
|
583
|
-
* Security Hardening:
|
|
584
|
-
* - M2M (Machine-to-Machine) Client Credentials Grant ONLY (Zero human interaction interface).
|
|
585
|
-
* - Algorithmic whitelist: EdDSA (Ed25519) for token signing.
|
|
586
|
-
* - JWT Access Tokens: Allows stateless, cryptographically-secure validation on data nodes (NIST SP 800-207).
|
|
587
|
-
* - Interaction Lockout: Throws exception on any interactive flow attempt to prevent hijack attacks (OWASP).
|
|
588
|
-
*
|
|
589
|
-
* Standards: OAuth 2.1, RFC 6749, RFC 7519, NIST SP 800-63B
|
|
590
|
-
*/
|
|
591
|
-
|
|
592
772
|
interface OAuthServerClientConfig {
|
|
593
773
|
client_id: string;
|
|
594
774
|
client_secret: string;
|
|
@@ -610,15 +790,6 @@ interface OAuthServerResult {
|
|
|
610
790
|
*/
|
|
611
791
|
declare function createOAuthServer(config: OAuthServerConfig): OAuthServerResult;
|
|
612
792
|
|
|
613
|
-
/**
|
|
614
|
-
* LIOP Protected Resource Metadata — RFC 9728
|
|
615
|
-
*
|
|
616
|
-
* Builds the JSON document served at /.well-known/oauth-protected-resource.
|
|
617
|
-
* This enables MCP clients to discover the authorization server and
|
|
618
|
-
* required scopes for accessing LIOP tools and resources.
|
|
619
|
-
*
|
|
620
|
-
* Standards: RFC 9728, MCP Spec 2025-11-25
|
|
621
|
-
*/
|
|
622
793
|
/**
|
|
623
794
|
* RFC 9728 Protected Resource Metadata response.
|
|
624
795
|
*
|
|
@@ -683,4 +854,4 @@ declare function authorizeRequest(method: string, auth: AuthInfo | null, additio
|
|
|
683
854
|
declare const LIOP_SCOPES: readonly ["liop:tools:list", "liop:tools:call", "liop:resources:read", "liop:schema:read", "liop:mesh:query"];
|
|
684
855
|
type LiopScope = (typeof LIOP_SCOPES)[number];
|
|
685
856
|
|
|
686
|
-
export { type AIProvider, AuthInfo, Counter, DILITHIUM65_CONSTANTS, Dilithium65Wrapper, ErrorCode, GRPC_CHANNEL_OPTIONS, GRPC_WEB_CONSTANTS, Gauge, type GrpcWebFrame, HeuristicTokenEstimator, Histogram, Kyber768Wrapper, LIOP_SCOPES, LiopError, LiopOTelBridge, LiopRpcClient, LiopRpcServer, type LiopScope, type LiopSpan, LiopTracer, type MetricDefinition, type MetricLabels, MetricsRegistry, type PromptConfig, RealTokenEstimator, type SandboxConfig, type SpanContext, type TokenEstimator, type TokenOperationMetric, type TokenSessionReport, TokenTelemetryEngine, type ToolTokenBreakdown, WasiSandbox, authorizeRequest, buildProtectedResourceMetadata, calculateAstInstructionFuel, createOAuthServer, createSyncTokenEstimator, createTokenEstimator, decodeFrames, defaultTracer, dispatchGrpcWebRequest, egressBlocksTotal, encodeDataFrame, encodeTrailerFrame, fuelConsumed, generateSystemInstructions, getDefaultEnvironment, isGrpcWebRequest, manifestCacheSize, meshPeersConnected, protocolMetrics, toolCallsTotal, zkVerificationDurationMs };
|
|
857
|
+
export { type AIProvider, AesGcmWrapper, AuthInfo, Counter, DILITHIUM65_CONSTANTS, Dilithium65Wrapper, ErrorCode, GRPC_CHANNEL_OPTIONS, GRPC_WEB_CONSTANTS, type GatewayTopologyInfo, Gauge, type GrpcWebFrame, HeuristicTokenEstimator, Histogram, Kyber768Wrapper, LIOP_SCOPES, LiopError, LiopOTelBridge, LiopRpcClient, LiopRpcServer, type LiopScope, type LiopSpan, LiopTlsOptions, LiopTracer, type MeshTopologyInfo, type MetricDefinition, type MetricLabels, MetricsRegistry, type PromptConfig, RealTokenEstimator, RoutingTable, type SandboxConfig, type SpanContext, type TokenEstimator, TokenManager, type TokenManagerOptions, type TokenOperationMetric, type TokenProvider, type TokenSessionReport, TokenTelemetryEngine, type ToolDefinition, type ToolRoute, type ToolTokenBreakdown, type TopologyProbeOptions, type TopologyProbeResult, type TransportProvider, VERIFICATION_LATENCY_BUDGET_MS, WasiSandbox, authorizeRequest, buildProtectedResourceMetadata, calculateAstInstructionFuel, createOAuthServer, createSyncTokenEstimator, createTokenEstimator, decodeFrames, defaultTracer, deserializeGrothProof, deserializeVKey, dispatchGrpcWebRequest, egressBlocksTotal, encodeDataFrame, encodeTrailerFrame, fuelConsumed, generateSystemInstructions, getDefaultEnvironment, isGrpcWebRequest, manifestCacheSize, meshPeersConnected, operationDurationMs, pqcHandshakeDurationMs, pqcHandshakesTotal, probeTopology, protocolMetrics, serializeGrothProof, serializeVKey, tokensInputTotal, tokensOutputTotal, tokensSavedTotal, toolCallErrorsTotal, toolCallsTotal, verifyGroth16Proof, wireEgressBytesTotal, wireSavedBytesTotal, zkProofsByTypeTotal, zkProvingDurationMs, zkVerificationDurationMs, zkVerificationsTotal, zkVkeyCacheSize };
|