@nekzus/liop 2.1.0 → 2.3.0
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/LICENSE +201 -21
- package/NOTICE +5 -0
- package/README.md +73 -5
- package/dist/bin/agent.js +303 -4
- package/dist/bin/agent.js.map +1 -1
- package/dist/bridge.d.ts +2 -2
- package/dist/bridge.js +4 -1
- package/dist/chunk-32ADSAJS.js +104 -0
- package/dist/chunk-32ADSAJS.js.map +1 -0
- package/dist/chunk-4LQPDN3W.js +556 -0
- package/dist/chunk-4LQPDN3W.js.map +1 -0
- package/dist/chunk-72MNYFR6.js +64 -0
- package/dist/chunk-72MNYFR6.js.map +1 -0
- package/dist/chunk-74CISO2I.js +853 -0
- package/dist/chunk-74CISO2I.js.map +1 -0
- package/dist/chunk-CRZBVFDV.js +616 -0
- package/dist/chunk-CRZBVFDV.js.map +1 -0
- package/dist/chunk-GKV6M2PQ.js +208106 -0
- package/dist/chunk-GKV6M2PQ.js.map +1 -0
- package/dist/chunk-JIJPZFR2.js +51 -0
- package/dist/chunk-JIJPZFR2.js.map +1 -0
- package/dist/chunk-OIMJZ64E.js +441 -0
- package/dist/chunk-OIMJZ64E.js.map +1 -0
- package/dist/chunk-OUUTDSOW.js +24 -0
- package/dist/chunk-OUUTDSOW.js.map +1 -0
- package/dist/chunk-PYKRQAER.js +77 -0
- package/dist/chunk-PYKRQAER.js.map +1 -0
- package/dist/chunk-QLCOEP5J.js +68 -0
- package/dist/chunk-QLCOEP5J.js.map +1 -0
- package/dist/chunk-RWRRBYG4.js +1 -0
- package/dist/chunk-SONUORBT.js +421 -0
- package/dist/chunk-SONUORBT.js.map +1 -0
- package/dist/chunk-UBOQZVV5.js +3508 -0
- package/dist/chunk-UBOQZVV5.js.map +1 -0
- package/dist/chunk-UCJEK75U.js +714 -0
- package/dist/chunk-UCJEK75U.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 +9 -1
- package/dist/gateway.d.ts +5 -110
- package/dist/gateway.js +10 -1
- package/dist/hybrid-CF__0YnC.d.ts +170 -0
- package/dist/{index-DO97j6hP.d.ts → index-BW95kAL4.d.ts} +72 -2
- package/dist/index-cMV0_yD9.d.ts +200 -0
- package/dist/index.d.ts +273 -18
- package/dist/index.js +311 -4
- package/dist/index.js.map +1 -1
- package/dist/kyber-3ULIJSE3.js +3 -0
- package/dist/{kyber-NONMBQNH.js.map → kyber-3ULIJSE3.js.map} +1 -1
- package/dist/mesh.d.ts +14 -0
- package/dist/mesh.js +4 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +7 -1
- package/dist/{types-DzEXgi4s.d.ts → types-lJIxBlWF.d.ts} +75 -47
- package/dist/types.d.ts +1 -1
- package/dist/types.js +2 -1
- package/dist/verifier-3FAKCFNN.js +5 -0
- package/dist/{verifier-XU2DB56Z.js.map → verifier-3FAKCFNN.js.map} +1 -1
- package/dist/workers/logic-execution.d.ts +1 -0
- package/dist/workers/logic-execution.js +271 -1
- package/dist/workers/logic-execution.js.map +1 -1
- package/dist/workers/zk-verifier.js +173 -1
- package/dist/workers/zk-verifier.js.map +1 -1
- package/package.json +98 -49
- package/dist/chunk-2MGFSIXN.js +0 -2
- package/dist/chunk-2MGFSIXN.js.map +0 -1
- package/dist/chunk-4C666HHU.js +0 -2
- package/dist/chunk-4C666HHU.js.map +0 -1
- package/dist/chunk-ANFXJGMP.js +0 -2
- package/dist/chunk-ANFXJGMP.js.map +0 -1
- package/dist/chunk-DBXGYHKY.js +0 -2
- package/dist/chunk-DBXGYHKY.js.map +0 -1
- package/dist/chunk-DQ6UW6L7.js +0 -2
- package/dist/chunk-DQ6UW6L7.js.map +0 -1
- package/dist/chunk-GI2LSJYZ.js +0 -13
- package/dist/chunk-GI2LSJYZ.js.map +0 -1
- package/dist/chunk-GJUZGKZW.js +0 -3
- package/dist/chunk-GJUZGKZW.js.map +0 -1
- package/dist/chunk-I46YEWND.js +0 -33
- package/dist/chunk-I46YEWND.js.map +0 -1
- package/dist/chunk-PWCXZWSE.js +0 -2
- package/dist/chunk-PWCXZWSE.js.map +0 -1
- package/dist/chunk-RYYRR4N5.js +0 -31
- package/dist/chunk-RYYRR4N5.js.map +0 -1
- package/dist/chunk-S6RJHZV2.js +0 -2
- package/dist/chunk-S6RJHZV2.js.map +0 -1
- package/dist/chunk-SB5XJXKV.js +0 -2
- package/dist/chunk-SB5XJXKV.js.map +0 -1
- package/dist/chunk-T3L6OCM3.js +0 -3
- package/dist/chunk-T3L6OCM3.js.map +0 -1
- package/dist/chunk-TYVG6TXQ.js +0 -2
- package/dist/chunk-TYVG6TXQ.js.map +0 -1
- package/dist/chunk-UCCGDGHE.js +0 -54
- package/dist/chunk-UCCGDGHE.js.map +0 -1
- package/dist/chunk-V5MKJT6S.js +0 -2
- package/dist/chunk-V5MKJT6S.js.map +0 -1
- package/dist/index-Brfvxmdt.d.ts +0 -101
- package/dist/kyber-NONMBQNH.js +0 -2
- package/dist/verifier-XU2DB56Z.js +0 -2
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.
|
|
@@ -26,7 +28,7 @@ interface TokenEstimator {
|
|
|
26
28
|
readonly name: string;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
|
-
* Exact BPE tokenizer using o200k_base encoding.
|
|
31
|
+
* Exact BPE tokenizer using inlined o200k_base encoding.
|
|
30
32
|
*
|
|
31
33
|
* o200k_base is the standard encoding for all modern OpenAI models
|
|
32
34
|
* (GPT-4o, GPT-4.1, o1, o3, o4) and provides a reasonable baseline
|
|
@@ -34,7 +36,7 @@ interface TokenEstimator {
|
|
|
34
36
|
*
|
|
35
37
|
* - Synchronous: safe for hot-path usage without async overhead
|
|
36
38
|
* - Merge cache reduced to 10K entries for long-running server processes
|
|
37
|
-
* -
|
|
39
|
+
* - Inlined at build-time: zero external runtime dependencies in node_modules
|
|
38
40
|
*/
|
|
39
41
|
declare class RealTokenEstimator implements TokenEstimator {
|
|
40
42
|
readonly name = "o200k_base";
|
|
@@ -46,24 +48,19 @@ declare class RealTokenEstimator implements TokenEstimator {
|
|
|
46
48
|
* Fallback heuristic estimator: ~4 characters per token.
|
|
47
49
|
*
|
|
48
50
|
* Industry-standard approximation (±10% for English/code content).
|
|
49
|
-
* Used only when
|
|
51
|
+
* Used only when tokenizer fails in constrained environments.
|
|
50
52
|
*/
|
|
51
53
|
declare class HeuristicTokenEstimator implements TokenEstimator {
|
|
52
54
|
readonly name = "heuristic (chars/4)";
|
|
53
55
|
countTokens(text: string): number;
|
|
54
56
|
}
|
|
55
57
|
/**
|
|
56
|
-
* Factory: creates a RealTokenEstimator with
|
|
57
|
-
* falling back to HeuristicTokenEstimator if
|
|
58
|
-
*
|
|
59
|
-
* Uses dynamic import to avoid blocking SDK initialization and to
|
|
60
|
-
* gracefully degrade in environments where gpt-tokenizer is unavailable.
|
|
58
|
+
* Factory: creates a RealTokenEstimator with inlined o200k_base,
|
|
59
|
+
* falling back to HeuristicTokenEstimator if an unexpected error occurs.
|
|
61
60
|
*/
|
|
62
61
|
declare function createTokenEstimator(): Promise<TokenEstimator>;
|
|
63
62
|
/**
|
|
64
|
-
* Synchronous factory: creates a
|
|
65
|
-
* Used when the async factory cannot be awaited (e.g., constructor contexts).
|
|
66
|
-
* The engine should upgrade to the real estimator via setEstimator() later.
|
|
63
|
+
* Synchronous factory: creates a RealTokenEstimator immediately.
|
|
67
64
|
*/
|
|
68
65
|
declare function createSyncTokenEstimator(): TokenEstimator;
|
|
69
66
|
|
|
@@ -199,6 +196,162 @@ declare class LiopError extends Error {
|
|
|
199
196
|
constructor(code: ErrorCode, message: string);
|
|
200
197
|
}
|
|
201
198
|
|
|
199
|
+
/**
|
|
200
|
+
* LIOP gRPC-Web Protocol Adapter (HTTP/1.1 Fallback)
|
|
201
|
+
*
|
|
202
|
+
* Implements standard gRPC-Web framing per the official gRPC-Web specification:
|
|
203
|
+
* https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md
|
|
204
|
+
*
|
|
205
|
+
* Allows web browsers, corporate Layer 7 HTTP/1.1 proxies, and enterprise WAFs
|
|
206
|
+
* to invoke LIOP nodes over HTTP/1.1 without requiring HTTP/2 streaming or h2c.
|
|
207
|
+
*
|
|
208
|
+
* Frame Format:
|
|
209
|
+
* - 1 byte: Frame Flag (0x00 = Data Frame, 0x80 = Trailers Frame)
|
|
210
|
+
* - 4 bytes: 32-bit Big-Endian Unsigned Integer (payload length in bytes)
|
|
211
|
+
* - N bytes: Message or Trailer payload
|
|
212
|
+
*/
|
|
213
|
+
|
|
214
|
+
declare const GRPC_WEB_CONSTANTS: {
|
|
215
|
+
readonly FLAG_DATA: 0;
|
|
216
|
+
readonly FLAG_TRAILERS: 128;
|
|
217
|
+
readonly HEADER_LENGTH: 5;
|
|
218
|
+
readonly CONTENT_TYPE_PREFIX: "application/grpc-web";
|
|
219
|
+
readonly STATUS_OK: 0;
|
|
220
|
+
readonly STATUS_CANCELLED: 1;
|
|
221
|
+
readonly STATUS_UNKNOWN: 2;
|
|
222
|
+
readonly STATUS_INVALID_ARGUMENT: 3;
|
|
223
|
+
readonly STATUS_DEADLINE_EXCEEDED: 4;
|
|
224
|
+
readonly STATUS_NOT_FOUND: 5;
|
|
225
|
+
readonly STATUS_PERMISSION_DENIED: 7;
|
|
226
|
+
readonly STATUS_UNAUTHENTICATED: 16;
|
|
227
|
+
readonly STATUS_INTERNAL: 13;
|
|
228
|
+
};
|
|
229
|
+
interface GrpcWebFrame {
|
|
230
|
+
isTrailer: boolean;
|
|
231
|
+
payload: Buffer;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Checks if an incoming HTTP request is a gRPC-Web request.
|
|
235
|
+
*/
|
|
236
|
+
declare function isGrpcWebRequest(contentType?: string): boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Encodes a binary payload into a standard 5-byte framed gRPC-Web Data Frame.
|
|
239
|
+
*/
|
|
240
|
+
declare function encodeDataFrame(payload: Buffer | Uint8Array): Buffer;
|
|
241
|
+
/**
|
|
242
|
+
* Encodes gRPC status and optional message into a 5-byte framed gRPC-Web Trailer Frame.
|
|
243
|
+
*/
|
|
244
|
+
declare function encodeTrailerFrame(status?: number, message?: string, customTrailers?: Record<string, string>): Buffer;
|
|
245
|
+
/**
|
|
246
|
+
* Parses raw gRPC-Web byte streams into an array of frames.
|
|
247
|
+
*/
|
|
248
|
+
declare function decodeFrames(buffer: Buffer): GrpcWebFrame[];
|
|
249
|
+
/**
|
|
250
|
+
* Dispatches an HTTP/1.1 gRPC-Web request to an underlying protocol handler
|
|
251
|
+
* and serializes data and trailer frames back to the client.
|
|
252
|
+
*/
|
|
253
|
+
declare function dispatchGrpcWebRequest(req: http.IncomingMessage, res: http.ServerResponse, handler: (path: string, payload: Buffer) => Promise<{
|
|
254
|
+
status: number;
|
|
255
|
+
message?: string;
|
|
256
|
+
data?: Buffer;
|
|
257
|
+
}>): Promise<void>;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* LIOP Prometheus Metrics Registry (Phase Beta-3)
|
|
261
|
+
* Lightweight, zero-dependency, high-performance metrics collector
|
|
262
|
+
* complying with Prometheus and OpenMetrics exposition format.
|
|
263
|
+
*/
|
|
264
|
+
type MetricLabels = Record<string, string | number>;
|
|
265
|
+
interface MetricDefinition {
|
|
266
|
+
name: string;
|
|
267
|
+
help: string;
|
|
268
|
+
type: "counter" | "gauge" | "histogram";
|
|
269
|
+
buckets?: number[];
|
|
270
|
+
}
|
|
271
|
+
declare class Counter {
|
|
272
|
+
readonly name: string;
|
|
273
|
+
readonly help: string;
|
|
274
|
+
private values;
|
|
275
|
+
constructor(name: string, help: string);
|
|
276
|
+
inc(labels?: MetricLabels, value?: number): void;
|
|
277
|
+
get(labels?: MetricLabels): number;
|
|
278
|
+
reset(): void;
|
|
279
|
+
toPrometheus(): string[];
|
|
280
|
+
}
|
|
281
|
+
declare class Gauge {
|
|
282
|
+
readonly name: string;
|
|
283
|
+
readonly help: string;
|
|
284
|
+
private values;
|
|
285
|
+
constructor(name: string, help: string);
|
|
286
|
+
set(labelsOrValue: MetricLabels | number, maybeValue?: number): void;
|
|
287
|
+
inc(labels?: MetricLabels, value?: number): void;
|
|
288
|
+
dec(labels?: MetricLabels, value?: number): void;
|
|
289
|
+
get(labels?: MetricLabels): number;
|
|
290
|
+
reset(): void;
|
|
291
|
+
toPrometheus(): string[];
|
|
292
|
+
}
|
|
293
|
+
declare class Histogram {
|
|
294
|
+
readonly name: string;
|
|
295
|
+
readonly help: string;
|
|
296
|
+
readonly buckets: number[];
|
|
297
|
+
private observations;
|
|
298
|
+
constructor(name: string, help: string, buckets?: number[]);
|
|
299
|
+
observe(labelsOrValue: MetricLabels | number, maybeValue?: number): void;
|
|
300
|
+
reset(): void;
|
|
301
|
+
toPrometheus(): string[];
|
|
302
|
+
}
|
|
303
|
+
declare class MetricsRegistry {
|
|
304
|
+
private counters;
|
|
305
|
+
private gauges;
|
|
306
|
+
private histograms;
|
|
307
|
+
counter(name: string, help: string): Counter;
|
|
308
|
+
gauge(name: string, help: string): Gauge;
|
|
309
|
+
histogram(name: string, help: string, buckets?: number[]): Histogram;
|
|
310
|
+
collectProcessMetrics(): void;
|
|
311
|
+
exportPrometheusText(): string;
|
|
312
|
+
resetAll(): void;
|
|
313
|
+
}
|
|
314
|
+
declare const protocolMetrics: MetricsRegistry;
|
|
315
|
+
declare const toolCallsTotal: Counter;
|
|
316
|
+
declare const fuelConsumed: Histogram;
|
|
317
|
+
declare const meshPeersConnected: Gauge;
|
|
318
|
+
declare const manifestCacheSize: Gauge;
|
|
319
|
+
declare const egressBlocksTotal: Counter;
|
|
320
|
+
declare const zkVerificationDurationMs: Histogram;
|
|
321
|
+
|
|
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
|
+
interface SpanContext {
|
|
328
|
+
traceId: string;
|
|
329
|
+
spanId: string;
|
|
330
|
+
sampled: boolean;
|
|
331
|
+
}
|
|
332
|
+
interface LiopSpan {
|
|
333
|
+
readonly name: string;
|
|
334
|
+
readonly context: SpanContext;
|
|
335
|
+
readonly startTime: number;
|
|
336
|
+
endTime?: number;
|
|
337
|
+
attributes: Record<string, string | number | boolean>;
|
|
338
|
+
status: "OK" | "ERROR";
|
|
339
|
+
error?: string;
|
|
340
|
+
setAttribute(key: string, value: string | number | boolean): LiopSpan;
|
|
341
|
+
recordException(error: Error | string): LiopSpan;
|
|
342
|
+
end(): void;
|
|
343
|
+
}
|
|
344
|
+
declare class LiopTracer {
|
|
345
|
+
static generateTraceId(): string;
|
|
346
|
+
static generateSpanId(): string;
|
|
347
|
+
static formatTraceparent(traceId: string, spanId: string, sampled?: boolean): string;
|
|
348
|
+
static parseTraceparent(header?: string | null): SpanContext | null;
|
|
349
|
+
static injectTraceparent(carrier: Record<string, string | string[] | undefined>, context: SpanContext): void;
|
|
350
|
+
static extractTraceparent(carrier: Record<string, string | string[] | undefined>): SpanContext | null;
|
|
351
|
+
startSpan(name: string, parent?: SpanContext | null, attributes?: Record<string, string | number | boolean>): LiopSpan;
|
|
352
|
+
}
|
|
353
|
+
declare const defaultTracer: LiopTracer;
|
|
354
|
+
|
|
202
355
|
/**
|
|
203
356
|
* LIOP Cross-AI Prompt Adapters (Fase 92)
|
|
204
357
|
*
|
|
@@ -216,6 +369,15 @@ interface PromptConfig {
|
|
|
216
369
|
*/
|
|
217
370
|
declare function generateSystemInstructions(provider: AIProvider): string;
|
|
218
371
|
|
|
372
|
+
/**
|
|
373
|
+
* LIOP Production-Grade gRPC Channel Options
|
|
374
|
+
*
|
|
375
|
+
* Enforces bidirectional symmetry between LiopRpcServer, LiopRpcClient,
|
|
376
|
+
* and gateway proxy channels per NIST SP 800-207 continuous verification.
|
|
377
|
+
* Prevents silent disconnections behind corporate stateful firewalls and NAT gateways.
|
|
378
|
+
*/
|
|
379
|
+
declare const GRPC_CHANNEL_OPTIONS: Readonly<Record<string, string | number>>;
|
|
380
|
+
|
|
219
381
|
/**
|
|
220
382
|
* TypeScript interfaces reflecting liop_core.proto (LIOP v1)
|
|
221
383
|
* Optimized for logic-on-origin and high-performance serialization.
|
|
@@ -252,6 +414,7 @@ interface LogicResponse {
|
|
|
252
414
|
declare class LiopRpcClient {
|
|
253
415
|
private client;
|
|
254
416
|
private token?;
|
|
417
|
+
readonly address: string;
|
|
255
418
|
constructor(address: string, tls?: LiopTlsOptions, token?: string);
|
|
256
419
|
/**
|
|
257
420
|
* Negotiates intent with the remote host.
|
|
@@ -266,6 +429,92 @@ declare class LiopRpcClient {
|
|
|
266
429
|
close(): void;
|
|
267
430
|
}
|
|
268
431
|
|
|
432
|
+
/**
|
|
433
|
+
* LIOP Post-Quantum Digital Signature Wrapper
|
|
434
|
+
* Implements ML-DSA-65 (CRYSTALS-Dilithium, NIST FIPS 204) for quantum-resistant
|
|
435
|
+
* manifest attestation, node revocation receipts, and cryptographic integrity.
|
|
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
|
|
443
|
+
*/
|
|
444
|
+
declare const DILITHIUM65_CONSTANTS: {
|
|
445
|
+
readonly PUBLIC_KEY_BYTES: 1952;
|
|
446
|
+
readonly SECRET_KEY_BYTES: 4032;
|
|
447
|
+
readonly SIGNATURE_BYTES: 3309;
|
|
448
|
+
readonly DEFAULT_CONTEXT: Uint8Array<ArrayBuffer>;
|
|
449
|
+
};
|
|
450
|
+
declare const Dilithium65Wrapper: {
|
|
451
|
+
/** Constants */
|
|
452
|
+
PUBLIC_KEY_BYTES: 1952;
|
|
453
|
+
SECRET_KEY_BYTES: 4032;
|
|
454
|
+
SIGNATURE_BYTES: 3309;
|
|
455
|
+
/**
|
|
456
|
+
* Generates a new ML-DSA-65 (FIPS 204) key pair.
|
|
457
|
+
* Optionally accepts a 32-byte seed for deterministic key generation.
|
|
458
|
+
*/
|
|
459
|
+
generateKeyPair(seed?: Uint8Array): {
|
|
460
|
+
publicKey: Uint8Array;
|
|
461
|
+
secretKey: Uint8Array;
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* Validates and imports a raw ML-DSA-65 public key.
|
|
465
|
+
*/
|
|
466
|
+
importPublicKey(buffer: Uint8Array): Uint8Array;
|
|
467
|
+
/**
|
|
468
|
+
* Signs a message using the post-quantum secret key.
|
|
469
|
+
* Supports optional domain separation context (up to 255 bytes).
|
|
470
|
+
*/
|
|
471
|
+
sign(message: Uint8Array | string, secretKey: Uint8Array, context?: Uint8Array): Uint8Array;
|
|
472
|
+
/**
|
|
473
|
+
* Verifies an ML-DSA-65 post-quantum digital signature.
|
|
474
|
+
*/
|
|
475
|
+
verify(signature: Uint8Array, message: Uint8Array | string, publicKey: Uint8Array, context?: Uint8Array): boolean;
|
|
476
|
+
/**
|
|
477
|
+
* Signs a structured manifest (LiopManifest) using canonical JSON serialization.
|
|
478
|
+
* Returns base64-encoded signature and public key for transport over gRPC/MCP.
|
|
479
|
+
*/
|
|
480
|
+
signManifest(manifest: Record<string, unknown>, secretKey: Uint8Array, publicKey: Uint8Array): {
|
|
481
|
+
signature: string;
|
|
482
|
+
publicKey: string;
|
|
483
|
+
};
|
|
484
|
+
/**
|
|
485
|
+
* Verifies the post-quantum signature of a structured manifest.
|
|
486
|
+
*/
|
|
487
|
+
verifyManifest(manifest: Record<string, unknown>, signatureBase64: string, publicKeyBase64: string): boolean;
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
declare const Kyber768Wrapper: {
|
|
491
|
+
/**
|
|
492
|
+
* Extracts and validates the 1184-byte Public Key from the Rust LIOP Data Node
|
|
493
|
+
* @param buffer Raw buffer sent via gRPC IntentResponse
|
|
494
|
+
*/
|
|
495
|
+
importPublicKey(buffer: Uint8Array): Uint8Array;
|
|
496
|
+
/**
|
|
497
|
+
* Encapsulates a shared secret using the server's public key.
|
|
498
|
+
* Returns the 1088-byte ciphertext to be sent back, and the 32-byte shared AES secret.
|
|
499
|
+
*/
|
|
500
|
+
encapsulateAsymmetric(publicKey: Uint8Array): Promise<{
|
|
501
|
+
ciphertext: Uint8Array;
|
|
502
|
+
sharedSecret: Uint8Array;
|
|
503
|
+
}>;
|
|
504
|
+
/**
|
|
505
|
+
* Generates a Kyber768 KeyPair for the server to accept intents.
|
|
506
|
+
*/
|
|
507
|
+
generateKeyPair(): Promise<{
|
|
508
|
+
publicKey: Uint8Array;
|
|
509
|
+
secretKey: Uint8Array;
|
|
510
|
+
}>;
|
|
511
|
+
/**
|
|
512
|
+
* Decapsulates the shared secret using the server's secret key.
|
|
513
|
+
* Zero-fills the shared secret buffer after extraction for side-channel protection.
|
|
514
|
+
*/
|
|
515
|
+
decapsulateSymmetric(ciphertext: Uint8Array, secretKey: Uint8Array): Promise<Uint8Array>;
|
|
516
|
+
};
|
|
517
|
+
|
|
269
518
|
declare class LiopRpcServer {
|
|
270
519
|
private server;
|
|
271
520
|
constructor();
|
|
@@ -274,6 +523,7 @@ declare class LiopRpcServer {
|
|
|
274
523
|
executeLogic: (call: grpc.ServerWritableStream<LogicRequest, LogicResponse>) => void;
|
|
275
524
|
}): void;
|
|
276
525
|
listen(port?: number, tls?: LiopTlsOptions): Promise<number>;
|
|
526
|
+
gracefulShutdown(timeoutMs?: number): Promise<void>;
|
|
277
527
|
stop(): Promise<void>;
|
|
278
528
|
}
|
|
279
529
|
|
|
@@ -282,6 +532,11 @@ declare class LiopRpcServer {
|
|
|
282
532
|
* preventing exposure of sensitive credentials and shell function injection.
|
|
283
533
|
*/
|
|
284
534
|
declare function getDefaultEnvironment(): Record<string, string>;
|
|
535
|
+
/**
|
|
536
|
+
* Calculates deterministic execution fuel units based on AST instruction complexity.
|
|
537
|
+
* Guarantees identical fuel consumption for the same logic across different hardware.
|
|
538
|
+
*/
|
|
539
|
+
declare function calculateAstInstructionFuel(code: string): number;
|
|
285
540
|
interface SandboxConfig {
|
|
286
541
|
allowEnv?: boolean;
|
|
287
542
|
allowedDirectories?: Record<string, string>;
|
|
@@ -428,4 +683,4 @@ declare function authorizeRequest(method: string, auth: AuthInfo | null, additio
|
|
|
428
683
|
declare const LIOP_SCOPES: readonly ["liop:tools:list", "liop:tools:call", "liop:resources:read", "liop:schema:read", "liop:mesh:query"];
|
|
429
684
|
type LiopScope = (typeof LIOP_SCOPES)[number];
|
|
430
685
|
|
|
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 };
|
|
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 };
|