@nekzus/liop 2.1.0-alpha.13 → 2.1.0-alpha.15
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/dist/bin/agent.js +7 -5
- package/dist/bin/agent.js.map +1 -1
- package/dist/bridge.d.ts +2 -2
- package/dist/bridge.js +2 -1
- package/dist/{chunk-UVO7DII3.js → chunk-4LQPDN3W.js} +108 -15
- package/dist/chunk-4LQPDN3W.js.map +1 -0
- package/dist/chunk-636UOVSO.js +714 -0
- package/dist/chunk-636UOVSO.js.map +1 -0
- package/dist/{chunk-NJRSFFD7.js → chunk-74CISO2I.js} +60 -22
- package/dist/chunk-74CISO2I.js.map +1 -0
- package/dist/{chunk-E5QBDD5E.js → chunk-CRZBVFDV.js} +169 -22
- package/dist/chunk-CRZBVFDV.js.map +1 -0
- package/dist/chunk-JIJPZFR2.js +51 -0
- package/dist/chunk-JIJPZFR2.js.map +1 -0
- package/dist/{chunk-HB5DXX3Q.js → chunk-KF4DCCU3.js} +232 -48
- package/dist/chunk-KF4DCCU3.js.map +1 -0
- package/dist/chunk-OIMJZ64E.js +441 -0
- package/dist/chunk-OIMJZ64E.js.map +1 -0
- package/dist/chunk-PYKRQAER.js +77 -0
- package/dist/chunk-PYKRQAER.js.map +1 -0
- package/dist/{chunk-J3WPBMJ5.js → chunk-SONUORBT.js} +95 -6
- package/dist/chunk-SONUORBT.js.map +1 -0
- package/dist/{chunk-2JLG4DET.js → chunk-UBOQZVV5.js} +261 -107
- package/dist/chunk-UBOQZVV5.js.map +1 -0
- package/dist/chunk-WSW6YJNY.js +168 -0
- package/dist/chunk-WSW6YJNY.js.map +1 -0
- package/dist/client.d.ts +3 -2
- package/dist/client.js +4 -3
- package/dist/gateway.d.ts +5 -110
- package/dist/gateway.js +5 -4
- package/dist/hybrid-CF__0YnC.d.ts +170 -0
- package/dist/{index-BlGc0iym.d.ts → index-BW95kAL4.d.ts} +63 -2
- package/dist/index-cMV0_yD9.d.ts +200 -0
- package/dist/index.d.ts +267 -7
- package/dist/index.js +266 -13
- package/dist/index.js.map +1 -1
- package/dist/mesh.d.ts +14 -0
- package/dist/mesh.js +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +5 -4
- package/dist/{types-sKeUxuky.d.ts → types-lJIxBlWF.d.ts} +71 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/workers/logic-execution.d.ts +1 -0
- package/dist/workers/logic-execution.js +17 -1
- package/dist/workers/logic-execution.js.map +1 -1
- package/package.json +79 -31
- package/dist/chunk-2JLG4DET.js.map +0 -1
- package/dist/chunk-CT6NHSYP.js +0 -30
- package/dist/chunk-CT6NHSYP.js.map +0 -1
- package/dist/chunk-E5QBDD5E.js.map +0 -1
- package/dist/chunk-HB5DXX3Q.js.map +0 -1
- package/dist/chunk-IJHTRIZC.js +0 -56
- package/dist/chunk-IJHTRIZC.js.map +0 -1
- package/dist/chunk-J3WPBMJ5.js.map +0 -1
- package/dist/chunk-NJRSFFD7.js.map +0 -1
- package/dist/chunk-PHTWUTY7.js +0 -300
- package/dist/chunk-PHTWUTY7.js.map +0 -1
- package/dist/chunk-RDWCGZ2A.js +0 -87
- package/dist/chunk-RDWCGZ2A.js.map +0 -1
- package/dist/chunk-UVO7DII3.js.map +0 -1
- package/dist/index-qM8ZH8sC.d.ts +0 -101
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { L as LiopVerifier } from './verifier-COnid_dg.js';
|
|
2
|
+
import { MeshNodeConfig } from './mesh.js';
|
|
3
|
+
import { EventEmitter } from 'node:events';
|
|
4
|
+
import { M as McpEra, C as CallToolRequest, a as CallToolResult } from './types-lJIxBlWF.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* LIOP Certificate Manager (CertManager)
|
|
8
|
+
* Provides automated certificate monitoring, X.509 validity inspection,
|
|
9
|
+
* and hot-reloading for mutual TLS (mTLS) without node restarts.
|
|
10
|
+
*
|
|
11
|
+
* Compliance:
|
|
12
|
+
* - NIST SP 800-52 Rev. 2: Guidelines for the Selection and Use of TLS
|
|
13
|
+
* - Zero-Trust Architecture (NIST SP 800-207): Continuous cryptographic verification
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
interface CertManagerOptions {
|
|
17
|
+
/** Path to the root CA certificate (PEM format) */
|
|
18
|
+
rootCertPath?: string;
|
|
19
|
+
/** Path to the server/client certificate chain (PEM format) */
|
|
20
|
+
certChainPath: string;
|
|
21
|
+
/** Path to the private key (PEM format) */
|
|
22
|
+
privateKeyPath: string;
|
|
23
|
+
/** Expiration warning threshold in days (default: 30) */
|
|
24
|
+
warningDays?: number;
|
|
25
|
+
/** Enable file watching for automatic hot-reloading (default: true) */
|
|
26
|
+
watchFiles?: boolean;
|
|
27
|
+
/** Debounce delay in ms for hot reloading (default: 150) */
|
|
28
|
+
debounceMs?: number;
|
|
29
|
+
}
|
|
30
|
+
interface CertInfo {
|
|
31
|
+
subject: string;
|
|
32
|
+
issuer: string;
|
|
33
|
+
validFrom: string;
|
|
34
|
+
validTo: string;
|
|
35
|
+
fingerprint256: string;
|
|
36
|
+
daysRemaining: number;
|
|
37
|
+
isExpired: boolean;
|
|
38
|
+
isExpiringSoon: boolean;
|
|
39
|
+
}
|
|
40
|
+
declare class CertManager extends EventEmitter {
|
|
41
|
+
private readonly options;
|
|
42
|
+
private rootCertBuffer;
|
|
43
|
+
private certChainBuffer;
|
|
44
|
+
private privateKeyBuffer;
|
|
45
|
+
private watchers;
|
|
46
|
+
private reloadDebounceTimer;
|
|
47
|
+
private readonly warningDays;
|
|
48
|
+
private readonly debounceMs;
|
|
49
|
+
constructor(options: CertManagerOptions);
|
|
50
|
+
/**
|
|
51
|
+
* Synchronously loads or reloads certificates from filesystem into memory.
|
|
52
|
+
*/
|
|
53
|
+
loadCertificates(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Inspects the loaded server/client certificate chain using Node.js native X509Certificate.
|
|
56
|
+
*/
|
|
57
|
+
inspectCertificate(): CertInfo;
|
|
58
|
+
/**
|
|
59
|
+
* Sets up non-blocking filesystem watchers to detect certificate renewals
|
|
60
|
+
* and trigger hot-reloading without process restarts.
|
|
61
|
+
*/
|
|
62
|
+
private setupWatchers;
|
|
63
|
+
/**
|
|
64
|
+
* Debounces reload events to ensure files have finished writing.
|
|
65
|
+
*/
|
|
66
|
+
private scheduleReload;
|
|
67
|
+
/**
|
|
68
|
+
* Manually triggers a reload of certificates and emits the 'reload' event.
|
|
69
|
+
*/
|
|
70
|
+
reload(): CertInfo;
|
|
71
|
+
getRootCert(): Buffer | null;
|
|
72
|
+
getCertChain(): Buffer;
|
|
73
|
+
getPrivateKey(): Buffer;
|
|
74
|
+
/**
|
|
75
|
+
* Stops all active file watchers and releases resources.
|
|
76
|
+
*/
|
|
77
|
+
dispose(): void;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* LIOP TLS Configuration
|
|
82
|
+
*
|
|
83
|
+
* Provides conditional TLS credential factories for gRPC connections.
|
|
84
|
+
* When TLS options are provided, connections are secured with mutual TLS.
|
|
85
|
+
* Otherwise, falls back to insecure credentials (alpha/development mode).
|
|
86
|
+
*
|
|
87
|
+
* Production Hardening (Phase 128):
|
|
88
|
+
* - When NODE_ENV=production and TLS is configured but certificate loading
|
|
89
|
+
* fails, the system throws a fatal error instead of silently degrading
|
|
90
|
+
* to insecure credentials. This prevents MITM/eavesdropping attacks
|
|
91
|
+
* caused by misconfigured certificate paths going unnoticed.
|
|
92
|
+
* - Reference: gRPC-node official docs — "Using insecure credentials in
|
|
93
|
+
* production poses significant security risks including eavesdropping,
|
|
94
|
+
* MITM attacks, and lack of authentication."
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
interface LiopTlsOptions {
|
|
98
|
+
/** Path to the root CA certificate (PEM format) */
|
|
99
|
+
rootCert?: string;
|
|
100
|
+
/** Path to the server/client certificate (PEM format) */
|
|
101
|
+
certChain?: string;
|
|
102
|
+
/** Path to the private key (PEM format) */
|
|
103
|
+
privateKey?: string;
|
|
104
|
+
/** Require mutual TLS (mTLS): verify client certificate against root CA */
|
|
105
|
+
mutualTls?: boolean;
|
|
106
|
+
/** Optional CertManager instance for automated certificate management and hot reloading */
|
|
107
|
+
certManager?: CertManager;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* LIOP Client
|
|
112
|
+
* High-level orchestration for discovery and execution in the Logic-Injection-on-Origin mesh.
|
|
113
|
+
*/
|
|
114
|
+
declare class LiopClient {
|
|
115
|
+
private meshNode;
|
|
116
|
+
private rpcClients;
|
|
117
|
+
private manifests;
|
|
118
|
+
private tlsOptions?;
|
|
119
|
+
private serverInfo?;
|
|
120
|
+
verifier: LiopVerifier;
|
|
121
|
+
private oauthToken?;
|
|
122
|
+
/** Protocol negotiation era */
|
|
123
|
+
era: McpEra;
|
|
124
|
+
/** Negotiated protocol version */
|
|
125
|
+
protocolVersion: string;
|
|
126
|
+
constructor(tls?: LiopTlsOptions);
|
|
127
|
+
/**
|
|
128
|
+
* Requests an M2M access token from the Nexus Authorization Server using Client Credentials.
|
|
129
|
+
*/
|
|
130
|
+
private acquireM2MToken;
|
|
131
|
+
/**
|
|
132
|
+
* Discovers and connects to the target server or mesh capability.
|
|
133
|
+
* If address is omitted, it sets up the MeshNode to act purely dynamically.
|
|
134
|
+
*/
|
|
135
|
+
connect(address?: string, options?: {
|
|
136
|
+
meshConfig?: MeshNodeConfig;
|
|
137
|
+
auth?: {
|
|
138
|
+
clientId?: string;
|
|
139
|
+
clientSecret?: string;
|
|
140
|
+
nexusUrl?: string;
|
|
141
|
+
audience?: string;
|
|
142
|
+
scope?: string;
|
|
143
|
+
token?: string;
|
|
144
|
+
};
|
|
145
|
+
}): Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Selects the optimal IP from an array of multiaddrs.
|
|
148
|
+
* Prioritizes routable non-loopback IPv4 addresses (e.g. Docker bridge, LAN, WAN)
|
|
149
|
+
* over loopback (127.0.0.1) to prevent inter-container connection failures.
|
|
150
|
+
*/
|
|
151
|
+
private selectOptimalIp;
|
|
152
|
+
/**
|
|
153
|
+
* Dynamically queries Kademlia DHT to find the optimal PeerID providing the Capability
|
|
154
|
+
* and returns the physical gRPC target (host:port) resolved from the provider's manifest.
|
|
155
|
+
*/
|
|
156
|
+
resolveCapability(toolName: string): Promise<string>;
|
|
157
|
+
/**
|
|
158
|
+
* Probes a remote MCP endpoint using 'server/discover' to negotiate protocol era.
|
|
159
|
+
* Falls back to legacy initialize handshake if server/discover fails.
|
|
160
|
+
*/
|
|
161
|
+
probeServerDiscover(mcpUrl: string): Promise<{
|
|
162
|
+
era: McpEra;
|
|
163
|
+
protocolVersion: string;
|
|
164
|
+
supportedVersions: string[];
|
|
165
|
+
}>;
|
|
166
|
+
/**
|
|
167
|
+
* Discovers remote capabilities via the LIOP Manifest Protocol.
|
|
168
|
+
* Utilizes a memory cache to avoid redundant network dials against live peers.
|
|
169
|
+
*/
|
|
170
|
+
discoverTools(forceRefresh?: boolean): Promise<{
|
|
171
|
+
name: string;
|
|
172
|
+
description?: string;
|
|
173
|
+
}[]>;
|
|
174
|
+
/**
|
|
175
|
+
* Invokes a tool.
|
|
176
|
+
*/
|
|
177
|
+
callTool(request: CallToolRequest, _wasmPayload?: Buffer): Promise<CallToolResult>;
|
|
178
|
+
private getOrCreateRpcClient;
|
|
179
|
+
/**
|
|
180
|
+
* Reads a specific resource by URI.
|
|
181
|
+
* In LIOP, resources can be static definitions or dynamic streams.
|
|
182
|
+
*/
|
|
183
|
+
readResource(uri: string): Promise<{
|
|
184
|
+
contents: Array<{
|
|
185
|
+
uri: string;
|
|
186
|
+
mimeType?: string;
|
|
187
|
+
text: string;
|
|
188
|
+
}>;
|
|
189
|
+
}>;
|
|
190
|
+
getServerInfo(): {
|
|
191
|
+
name: string;
|
|
192
|
+
version: string;
|
|
193
|
+
} | undefined;
|
|
194
|
+
/**
|
|
195
|
+
* Destroys the active Mesh Node resources.
|
|
196
|
+
*/
|
|
197
|
+
close(): Promise<void>;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export { type CertInfo as C, type LiopTlsOptions as L, CertManager as a, type CertManagerOptions as b, LiopClient as c };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
export { LiopBridgeOptions, LiopMcpBridge, LiopStreamBridge, LiopStreamBridgeOptions } from './bridge.js';
|
|
2
|
-
import { L as LiopTlsOptions } from './index-
|
|
3
|
-
export { a as LiopClient } from './index-
|
|
4
|
-
|
|
2
|
+
import { L as LiopTlsOptions } from './index-cMV0_yD9.js';
|
|
3
|
+
export { C as CertInfo, a as CertManager, b as CertManagerOptions, c as LiopClient } from './index-cMV0_yD9.js';
|
|
4
|
+
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-CF__0YnC.js';
|
|
5
6
|
export { LiopManifest, MeshNode, MeshNodeConfig } from './mesh.js';
|
|
6
7
|
import * as grpc from '@grpc/grpc-js';
|
|
7
|
-
export { A as AUTH_DEFAULTS, b as AggregationPolicy, c as
|
|
8
|
-
import { A as AuthInfo } from './types-
|
|
9
|
-
export { C as CallToolRequest, a as CallToolResult, G as GetPromptRequest,
|
|
8
|
+
export { A as AUTH_DEFAULTS, b as AggregationPolicy, c as AuditEntry, d as AuditLogger, e as AuditRecordParams, f as AuditStatus, g as AuthRole, G as GENESIS_HASH, h as LiopAuthConfig, L as LiopServer, a as LiopServerOptions, i as LogicExecutionPolicy, N as NerScanner, O as OAuthClientConfig, j as OutputSanitizerConfig, P as PII_PATTERNS, k as PII_PRESETS, l as PiiRule, m as PiiScanner, T as ToolHandler, n as computeEntryHash, o as globalAuditLogger, s as sanitizeOutput } from './index-BW95kAL4.js';
|
|
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';
|
|
10
11
|
import * as jose from 'jose';
|
|
11
12
|
import Provider from 'oidc-provider';
|
|
12
13
|
import '@modelcontextprotocol/sdk/server/mcp.js';
|
|
13
14
|
import 'zod';
|
|
14
15
|
import './verifier-COnid_dg.js';
|
|
16
|
+
import 'node:events';
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* TokenEstimator — Pluggable strategy for counting tokens in text content.
|
|
@@ -199,6 +201,162 @@ declare class LiopError extends Error {
|
|
|
199
201
|
constructor(code: ErrorCode, message: string);
|
|
200
202
|
}
|
|
201
203
|
|
|
204
|
+
/**
|
|
205
|
+
* LIOP gRPC-Web Protocol Adapter (HTTP/1.1 Fallback)
|
|
206
|
+
*
|
|
207
|
+
* Implements standard gRPC-Web framing per the official gRPC-Web specification:
|
|
208
|
+
* https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md
|
|
209
|
+
*
|
|
210
|
+
* Allows web browsers, corporate Layer 7 HTTP/1.1 proxies, and enterprise WAFs
|
|
211
|
+
* to invoke LIOP nodes over HTTP/1.1 without requiring HTTP/2 streaming or h2c.
|
|
212
|
+
*
|
|
213
|
+
* Frame Format:
|
|
214
|
+
* - 1 byte: Frame Flag (0x00 = Data Frame, 0x80 = Trailers Frame)
|
|
215
|
+
* - 4 bytes: 32-bit Big-Endian Unsigned Integer (payload length in bytes)
|
|
216
|
+
* - N bytes: Message or Trailer payload
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
declare const GRPC_WEB_CONSTANTS: {
|
|
220
|
+
readonly FLAG_DATA: 0;
|
|
221
|
+
readonly FLAG_TRAILERS: 128;
|
|
222
|
+
readonly HEADER_LENGTH: 5;
|
|
223
|
+
readonly CONTENT_TYPE_PREFIX: "application/grpc-web";
|
|
224
|
+
readonly STATUS_OK: 0;
|
|
225
|
+
readonly STATUS_CANCELLED: 1;
|
|
226
|
+
readonly STATUS_UNKNOWN: 2;
|
|
227
|
+
readonly STATUS_INVALID_ARGUMENT: 3;
|
|
228
|
+
readonly STATUS_DEADLINE_EXCEEDED: 4;
|
|
229
|
+
readonly STATUS_NOT_FOUND: 5;
|
|
230
|
+
readonly STATUS_PERMISSION_DENIED: 7;
|
|
231
|
+
readonly STATUS_UNAUTHENTICATED: 16;
|
|
232
|
+
readonly STATUS_INTERNAL: 13;
|
|
233
|
+
};
|
|
234
|
+
interface GrpcWebFrame {
|
|
235
|
+
isTrailer: boolean;
|
|
236
|
+
payload: Buffer;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Checks if an incoming HTTP request is a gRPC-Web request.
|
|
240
|
+
*/
|
|
241
|
+
declare function isGrpcWebRequest(contentType?: string): boolean;
|
|
242
|
+
/**
|
|
243
|
+
* Encodes a binary payload into a standard 5-byte framed gRPC-Web Data Frame.
|
|
244
|
+
*/
|
|
245
|
+
declare function encodeDataFrame(payload: Buffer | Uint8Array): Buffer;
|
|
246
|
+
/**
|
|
247
|
+
* Encodes gRPC status and optional message into a 5-byte framed gRPC-Web Trailer Frame.
|
|
248
|
+
*/
|
|
249
|
+
declare function encodeTrailerFrame(status?: number, message?: string, customTrailers?: Record<string, string>): Buffer;
|
|
250
|
+
/**
|
|
251
|
+
* Parses raw gRPC-Web byte streams into an array of frames.
|
|
252
|
+
*/
|
|
253
|
+
declare function decodeFrames(buffer: Buffer): GrpcWebFrame[];
|
|
254
|
+
/**
|
|
255
|
+
* Dispatches an HTTP/1.1 gRPC-Web request to an underlying protocol handler
|
|
256
|
+
* and serializes data and trailer frames back to the client.
|
|
257
|
+
*/
|
|
258
|
+
declare function dispatchGrpcWebRequest(req: http.IncomingMessage, res: http.ServerResponse, handler: (path: string, payload: Buffer) => Promise<{
|
|
259
|
+
status: number;
|
|
260
|
+
message?: string;
|
|
261
|
+
data?: Buffer;
|
|
262
|
+
}>): Promise<void>;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* LIOP Prometheus Metrics Registry (Phase Beta-3)
|
|
266
|
+
* Lightweight, zero-dependency, high-performance metrics collector
|
|
267
|
+
* complying with Prometheus and OpenMetrics exposition format.
|
|
268
|
+
*/
|
|
269
|
+
type MetricLabels = Record<string, string | number>;
|
|
270
|
+
interface MetricDefinition {
|
|
271
|
+
name: string;
|
|
272
|
+
help: string;
|
|
273
|
+
type: "counter" | "gauge" | "histogram";
|
|
274
|
+
buckets?: number[];
|
|
275
|
+
}
|
|
276
|
+
declare class Counter {
|
|
277
|
+
readonly name: string;
|
|
278
|
+
readonly help: string;
|
|
279
|
+
private values;
|
|
280
|
+
constructor(name: string, help: string);
|
|
281
|
+
inc(labels?: MetricLabels, value?: number): void;
|
|
282
|
+
get(labels?: MetricLabels): number;
|
|
283
|
+
reset(): void;
|
|
284
|
+
toPrometheus(): string[];
|
|
285
|
+
}
|
|
286
|
+
declare class Gauge {
|
|
287
|
+
readonly name: string;
|
|
288
|
+
readonly help: string;
|
|
289
|
+
private values;
|
|
290
|
+
constructor(name: string, help: string);
|
|
291
|
+
set(labelsOrValue: MetricLabels | number, maybeValue?: number): void;
|
|
292
|
+
inc(labels?: MetricLabels, value?: number): void;
|
|
293
|
+
dec(labels?: MetricLabels, value?: number): void;
|
|
294
|
+
get(labels?: MetricLabels): number;
|
|
295
|
+
reset(): void;
|
|
296
|
+
toPrometheus(): string[];
|
|
297
|
+
}
|
|
298
|
+
declare class Histogram {
|
|
299
|
+
readonly name: string;
|
|
300
|
+
readonly help: string;
|
|
301
|
+
readonly buckets: number[];
|
|
302
|
+
private observations;
|
|
303
|
+
constructor(name: string, help: string, buckets?: number[]);
|
|
304
|
+
observe(labelsOrValue: MetricLabels | number, maybeValue?: number): void;
|
|
305
|
+
reset(): void;
|
|
306
|
+
toPrometheus(): string[];
|
|
307
|
+
}
|
|
308
|
+
declare class MetricsRegistry {
|
|
309
|
+
private counters;
|
|
310
|
+
private gauges;
|
|
311
|
+
private histograms;
|
|
312
|
+
counter(name: string, help: string): Counter;
|
|
313
|
+
gauge(name: string, help: string): Gauge;
|
|
314
|
+
histogram(name: string, help: string, buckets?: number[]): Histogram;
|
|
315
|
+
collectProcessMetrics(): void;
|
|
316
|
+
exportPrometheusText(): string;
|
|
317
|
+
resetAll(): void;
|
|
318
|
+
}
|
|
319
|
+
declare const protocolMetrics: MetricsRegistry;
|
|
320
|
+
declare const toolCallsTotal: Counter;
|
|
321
|
+
declare const fuelConsumed: Histogram;
|
|
322
|
+
declare const meshPeersConnected: Gauge;
|
|
323
|
+
declare const manifestCacheSize: Gauge;
|
|
324
|
+
declare const egressBlocksTotal: Counter;
|
|
325
|
+
declare const zkVerificationDurationMs: Histogram;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* LIOP OpenTelemetry Distributed Tracing (Phase Beta-3)
|
|
329
|
+
* W3C TraceContext compliant distributed tracer for gRPC & MCP transports.
|
|
330
|
+
* Spec: https://www.w3.org/TR/trace-context/
|
|
331
|
+
*/
|
|
332
|
+
interface SpanContext {
|
|
333
|
+
traceId: string;
|
|
334
|
+
spanId: string;
|
|
335
|
+
sampled: boolean;
|
|
336
|
+
}
|
|
337
|
+
interface LiopSpan {
|
|
338
|
+
readonly name: string;
|
|
339
|
+
readonly context: SpanContext;
|
|
340
|
+
readonly startTime: number;
|
|
341
|
+
endTime?: number;
|
|
342
|
+
attributes: Record<string, string | number | boolean>;
|
|
343
|
+
status: "OK" | "ERROR";
|
|
344
|
+
error?: string;
|
|
345
|
+
setAttribute(key: string, value: string | number | boolean): LiopSpan;
|
|
346
|
+
recordException(error: Error | string): LiopSpan;
|
|
347
|
+
end(): void;
|
|
348
|
+
}
|
|
349
|
+
declare class LiopTracer {
|
|
350
|
+
static generateTraceId(): string;
|
|
351
|
+
static generateSpanId(): string;
|
|
352
|
+
static formatTraceparent(traceId: string, spanId: string, sampled?: boolean): string;
|
|
353
|
+
static parseTraceparent(header?: string | null): SpanContext | null;
|
|
354
|
+
static injectTraceparent(carrier: Record<string, string | string[] | undefined>, context: SpanContext): void;
|
|
355
|
+
static extractTraceparent(carrier: Record<string, string | string[] | undefined>): SpanContext | null;
|
|
356
|
+
startSpan(name: string, parent?: SpanContext | null, attributes?: Record<string, string | number | boolean>): LiopSpan;
|
|
357
|
+
}
|
|
358
|
+
declare const defaultTracer: LiopTracer;
|
|
359
|
+
|
|
202
360
|
/**
|
|
203
361
|
* LIOP Cross-AI Prompt Adapters (Fase 92)
|
|
204
362
|
*
|
|
@@ -216,6 +374,15 @@ interface PromptConfig {
|
|
|
216
374
|
*/
|
|
217
375
|
declare function generateSystemInstructions(provider: AIProvider): string;
|
|
218
376
|
|
|
377
|
+
/**
|
|
378
|
+
* LIOP Production-Grade gRPC Channel Options
|
|
379
|
+
*
|
|
380
|
+
* Enforces bidirectional symmetry between LiopRpcServer, LiopRpcClient,
|
|
381
|
+
* and gateway proxy channels per NIST SP 800-207 continuous verification.
|
|
382
|
+
* Prevents silent disconnections behind corporate stateful firewalls and NAT gateways.
|
|
383
|
+
*/
|
|
384
|
+
declare const GRPC_CHANNEL_OPTIONS: Readonly<Record<string, string | number>>;
|
|
385
|
+
|
|
219
386
|
/**
|
|
220
387
|
* TypeScript interfaces reflecting liop_core.proto (LIOP v1)
|
|
221
388
|
* Optimized for logic-on-origin and high-performance serialization.
|
|
@@ -252,6 +419,7 @@ interface LogicResponse {
|
|
|
252
419
|
declare class LiopRpcClient {
|
|
253
420
|
private client;
|
|
254
421
|
private token?;
|
|
422
|
+
readonly address: string;
|
|
255
423
|
constructor(address: string, tls?: LiopTlsOptions, token?: string);
|
|
256
424
|
/**
|
|
257
425
|
* Negotiates intent with the remote host.
|
|
@@ -266,6 +434,92 @@ declare class LiopRpcClient {
|
|
|
266
434
|
close(): void;
|
|
267
435
|
}
|
|
268
436
|
|
|
437
|
+
/**
|
|
438
|
+
* LIOP Post-Quantum Digital Signature Wrapper
|
|
439
|
+
* Implements ML-DSA-65 (CRYSTALS-Dilithium, NIST FIPS 204) for quantum-resistant
|
|
440
|
+
* manifest attestation, node revocation receipts, and cryptographic integrity.
|
|
441
|
+
*
|
|
442
|
+
* Characteristics:
|
|
443
|
+
* - Security Category: NIST Level 3 (~AES-192 equivalent quantum resistance)
|
|
444
|
+
* - Public Key Length: 1952 bytes
|
|
445
|
+
* - Secret Key Length: 4032 bytes
|
|
446
|
+
* - Signature Length: 3309 bytes
|
|
447
|
+
* - Implementation: Pure TypeScript/JS via @noble/post-quantum
|
|
448
|
+
*/
|
|
449
|
+
declare const DILITHIUM65_CONSTANTS: {
|
|
450
|
+
readonly PUBLIC_KEY_BYTES: 1952;
|
|
451
|
+
readonly SECRET_KEY_BYTES: 4032;
|
|
452
|
+
readonly SIGNATURE_BYTES: 3309;
|
|
453
|
+
readonly DEFAULT_CONTEXT: Uint8Array<ArrayBuffer>;
|
|
454
|
+
};
|
|
455
|
+
declare const Dilithium65Wrapper: {
|
|
456
|
+
/** Constants */
|
|
457
|
+
PUBLIC_KEY_BYTES: 1952;
|
|
458
|
+
SECRET_KEY_BYTES: 4032;
|
|
459
|
+
SIGNATURE_BYTES: 3309;
|
|
460
|
+
/**
|
|
461
|
+
* Generates a new ML-DSA-65 (FIPS 204) key pair.
|
|
462
|
+
* Optionally accepts a 32-byte seed for deterministic key generation.
|
|
463
|
+
*/
|
|
464
|
+
generateKeyPair(seed?: Uint8Array): {
|
|
465
|
+
publicKey: Uint8Array;
|
|
466
|
+
secretKey: Uint8Array;
|
|
467
|
+
};
|
|
468
|
+
/**
|
|
469
|
+
* Validates and imports a raw ML-DSA-65 public key.
|
|
470
|
+
*/
|
|
471
|
+
importPublicKey(buffer: Uint8Array): Uint8Array;
|
|
472
|
+
/**
|
|
473
|
+
* Signs a message using the post-quantum secret key.
|
|
474
|
+
* Supports optional domain separation context (up to 255 bytes).
|
|
475
|
+
*/
|
|
476
|
+
sign(message: Uint8Array | string, secretKey: Uint8Array, context?: Uint8Array): Uint8Array;
|
|
477
|
+
/**
|
|
478
|
+
* Verifies an ML-DSA-65 post-quantum digital signature.
|
|
479
|
+
*/
|
|
480
|
+
verify(signature: Uint8Array, message: Uint8Array | string, publicKey: Uint8Array, context?: Uint8Array): boolean;
|
|
481
|
+
/**
|
|
482
|
+
* Signs a structured manifest (LiopManifest) using canonical JSON serialization.
|
|
483
|
+
* Returns base64-encoded signature and public key for transport over gRPC/MCP.
|
|
484
|
+
*/
|
|
485
|
+
signManifest(manifest: Record<string, unknown>, secretKey: Uint8Array, publicKey: Uint8Array): {
|
|
486
|
+
signature: string;
|
|
487
|
+
publicKey: string;
|
|
488
|
+
};
|
|
489
|
+
/**
|
|
490
|
+
* Verifies the post-quantum signature of a structured manifest.
|
|
491
|
+
*/
|
|
492
|
+
verifyManifest(manifest: Record<string, unknown>, signatureBase64: string, publicKeyBase64: string): boolean;
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
declare const Kyber768Wrapper: {
|
|
496
|
+
/**
|
|
497
|
+
* Extracts and validates the 1184-byte Public Key from the Rust LIOP Data Node
|
|
498
|
+
* @param buffer Raw buffer sent via gRPC IntentResponse
|
|
499
|
+
*/
|
|
500
|
+
importPublicKey(buffer: Uint8Array): Uint8Array;
|
|
501
|
+
/**
|
|
502
|
+
* Encapsulates a shared secret using the server's public key.
|
|
503
|
+
* Returns the 1088-byte ciphertext to be sent back, and the 32-byte shared AES secret.
|
|
504
|
+
*/
|
|
505
|
+
encapsulateAsymmetric(publicKey: Uint8Array): Promise<{
|
|
506
|
+
ciphertext: Uint8Array;
|
|
507
|
+
sharedSecret: Uint8Array;
|
|
508
|
+
}>;
|
|
509
|
+
/**
|
|
510
|
+
* Generates a Kyber768 KeyPair for the server to accept intents.
|
|
511
|
+
*/
|
|
512
|
+
generateKeyPair(): Promise<{
|
|
513
|
+
publicKey: Uint8Array;
|
|
514
|
+
secretKey: Uint8Array;
|
|
515
|
+
}>;
|
|
516
|
+
/**
|
|
517
|
+
* Decapsulates the shared secret using the server's secret key.
|
|
518
|
+
* Zero-fills the shared secret buffer after extraction for side-channel protection.
|
|
519
|
+
*/
|
|
520
|
+
decapsulateSymmetric(ciphertext: Uint8Array, secretKey: Uint8Array): Promise<Uint8Array>;
|
|
521
|
+
};
|
|
522
|
+
|
|
269
523
|
declare class LiopRpcServer {
|
|
270
524
|
private server;
|
|
271
525
|
constructor();
|
|
@@ -274,6 +528,7 @@ declare class LiopRpcServer {
|
|
|
274
528
|
executeLogic: (call: grpc.ServerWritableStream<LogicRequest, LogicResponse>) => void;
|
|
275
529
|
}): void;
|
|
276
530
|
listen(port?: number, tls?: LiopTlsOptions): Promise<number>;
|
|
531
|
+
gracefulShutdown(timeoutMs?: number): Promise<void>;
|
|
277
532
|
stop(): Promise<void>;
|
|
278
533
|
}
|
|
279
534
|
|
|
@@ -282,6 +537,11 @@ declare class LiopRpcServer {
|
|
|
282
537
|
* preventing exposure of sensitive credentials and shell function injection.
|
|
283
538
|
*/
|
|
284
539
|
declare function getDefaultEnvironment(): Record<string, string>;
|
|
540
|
+
/**
|
|
541
|
+
* Calculates deterministic execution fuel units based on AST instruction complexity.
|
|
542
|
+
* Guarantees identical fuel consumption for the same logic across different hardware.
|
|
543
|
+
*/
|
|
544
|
+
declare function calculateAstInstructionFuel(code: string): number;
|
|
285
545
|
interface SandboxConfig {
|
|
286
546
|
allowEnv?: boolean;
|
|
287
547
|
allowedDirectories?: Record<string, string>;
|
|
@@ -428,4 +688,4 @@ declare function authorizeRequest(method: string, auth: AuthInfo | null, additio
|
|
|
428
688
|
declare const LIOP_SCOPES: readonly ["liop:tools:list", "liop:tools:call", "liop:resources:read", "liop:schema:read", "liop:mesh:query"];
|
|
429
689
|
type LiopScope = (typeof LIOP_SCOPES)[number];
|
|
430
690
|
|
|
431
|
-
export { type AIProvider, AuthInfo, ErrorCode, HeuristicTokenEstimator, LIOP_SCOPES, LiopError, LiopOTelBridge, LiopRpcClient, LiopRpcServer, type LiopScope, type PromptConfig, RealTokenEstimator, type SandboxConfig, type TokenEstimator, type TokenOperationMetric, type TokenSessionReport, TokenTelemetryEngine, type ToolTokenBreakdown, WasiSandbox, authorizeRequest, buildProtectedResourceMetadata, createOAuthServer, createSyncTokenEstimator, createTokenEstimator, generateSystemInstructions, getDefaultEnvironment };
|
|
691
|
+
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 };
|