@nekzus/liop 2.4.0-alpha.3 → 2.4.0-alpha.31

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.
Files changed (104) hide show
  1. package/NOTICE +19 -0
  2. package/README.md +148 -69
  3. package/dist/bin/agent.js +27 -303
  4. package/dist/bridge.d.ts +4 -3
  5. package/dist/bridge.js +1 -4
  6. package/dist/chunk-2XHSALII.js +3 -0
  7. package/dist/chunk-2ZYX736J.js +2 -0
  8. package/dist/chunk-3WRKTVOF.js +2 -0
  9. package/dist/chunk-6KFKO6ZX.js +2 -0
  10. package/dist/chunk-6VK2XALI.js +2 -0
  11. package/dist/chunk-AN5NODTN.js +31 -0
  12. package/dist/chunk-AYDF3IFZ.js +2 -0
  13. package/dist/chunk-ECRS6N33.js +4 -0
  14. package/dist/chunk-FDJMH4CB.js +2 -0
  15. package/dist/chunk-FTF6AMF6.js +2 -0
  16. package/dist/chunk-GWVSCZUS.js +2 -0
  17. package/dist/chunk-HLAQ3HVD.js +57 -0
  18. package/dist/chunk-LZIEMSYZ.js +15 -0
  19. package/dist/chunk-MQ5SU26J.js +2 -0
  20. package/dist/chunk-N35BC62H.js +2 -0
  21. package/dist/chunk-PRNQM5KL.js +46 -0
  22. package/dist/chunk-TKLRW52V.js +2 -0
  23. package/dist/chunk-V35CXJQN.js +2 -0
  24. package/dist/chunk-WP5ER7RH.js +3 -0
  25. package/dist/chunk-XLVEDKM6.js +2 -0
  26. package/dist/chunk-Y675R34Z.js +2 -0
  27. package/dist/chunk-YLCNV764.js +3 -0
  28. package/dist/chunk-ZEU57HJP.js +3 -0
  29. package/dist/chunk-ZZMSFCJP.js +3 -0
  30. package/dist/client.d.ts +6 -4
  31. package/dist/client.js +1 -9
  32. package/dist/gateway.d.ts +6 -5
  33. package/dist/gateway.js +1 -10
  34. package/dist/{hybrid-CF__0YnC.d.ts → hybrid-BZpCiUaV.d.ts} +6 -5
  35. package/dist/{index-cMV0_yD9.d.ts → index-BYDtRGue.d.ts} +45 -36
  36. package/dist/{index-BW95kAL4.d.ts → index-ByzjpRCk.d.ts} +37 -72
  37. package/dist/index.d.ts +221 -50
  38. package/dist/index.js +4 -312
  39. package/dist/kyber-PULV7PQX.js +2 -0
  40. package/dist/mesh.d.ts +27 -143
  41. package/dist/mesh.js +1 -4
  42. package/dist/node-Djzm6UYd.d.ts +172 -0
  43. package/dist/protocol/liop_core.proto +25 -6
  44. package/dist/server.d.ts +4 -3
  45. package/dist/server.js +1 -7
  46. package/dist/types-29zv9X1V.d.ts +455 -0
  47. package/dist/types.d.ts +2 -1
  48. package/dist/types.js +1 -2
  49. package/dist/verifier-DqZ9MQ9l.d.ts +82 -0
  50. package/dist/verifier-J4NQYZX5.js +2 -0
  51. package/dist/workers/logic-execution.d.ts +7 -0
  52. package/dist/workers/logic-execution.js +1 -271
  53. package/dist/workers/zk-verifier.d.ts +9 -0
  54. package/dist/workers/zk-verifier.js +1 -173
  55. package/dist/zk-DzYNWBgo.d.ts +104 -0
  56. package/package.json +57 -84
  57. package/dist/bin/agent.js.map +0 -1
  58. package/dist/bridge.js.map +0 -1
  59. package/dist/chunk-32ADSAJS.js +0 -104
  60. package/dist/chunk-32ADSAJS.js.map +0 -1
  61. package/dist/chunk-547TYL27.js +0 -208109
  62. package/dist/chunk-547TYL27.js.map +0 -1
  63. package/dist/chunk-72MNYFR6.js +0 -64
  64. package/dist/chunk-72MNYFR6.js.map +0 -1
  65. package/dist/chunk-74CISO2I.js +0 -853
  66. package/dist/chunk-74CISO2I.js.map +0 -1
  67. package/dist/chunk-CRZBVFDV.js +0 -616
  68. package/dist/chunk-CRZBVFDV.js.map +0 -1
  69. package/dist/chunk-GA3Q2S7O.js +0 -558
  70. package/dist/chunk-GA3Q2S7O.js.map +0 -1
  71. package/dist/chunk-JIJPZFR2.js +0 -51
  72. package/dist/chunk-JIJPZFR2.js.map +0 -1
  73. package/dist/chunk-OUUTDSOW.js +0 -24
  74. package/dist/chunk-OUUTDSOW.js.map +0 -1
  75. package/dist/chunk-PYKRQAER.js +0 -77
  76. package/dist/chunk-PYKRQAER.js.map +0 -1
  77. package/dist/chunk-QLCOEP5J.js +0 -68
  78. package/dist/chunk-QLCOEP5J.js.map +0 -1
  79. package/dist/chunk-RWRRBYG4.js +0 -3
  80. package/dist/chunk-RWRRBYG4.js.map +0 -1
  81. package/dist/chunk-SONUORBT.js +0 -421
  82. package/dist/chunk-SONUORBT.js.map +0 -1
  83. package/dist/chunk-T5IUZF47.js +0 -716
  84. package/dist/chunk-T5IUZF47.js.map +0 -1
  85. package/dist/chunk-U5BZ66VX.js +0 -447
  86. package/dist/chunk-U5BZ66VX.js.map +0 -1
  87. package/dist/chunk-WCCGE4QR.js +0 -3520
  88. package/dist/chunk-WCCGE4QR.js.map +0 -1
  89. package/dist/chunk-WSW6YJNY.js +0 -168
  90. package/dist/chunk-WSW6YJNY.js.map +0 -1
  91. package/dist/client.js.map +0 -1
  92. package/dist/gateway.js.map +0 -1
  93. package/dist/index.js.map +0 -1
  94. package/dist/kyber-3ULIJSE3.js +0 -3
  95. package/dist/kyber-3ULIJSE3.js.map +0 -1
  96. package/dist/mesh.js.map +0 -1
  97. package/dist/server.js.map +0 -1
  98. package/dist/types-lJIxBlWF.d.ts +0 -256
  99. package/dist/types.js.map +0 -1
  100. package/dist/verifier-3FAKCFNN.js +0 -5
  101. package/dist/verifier-3FAKCFNN.js.map +0 -1
  102. package/dist/verifier-COnid_dg.d.ts +0 -31
  103. package/dist/workers/logic-execution.js.map +0 -1
  104. package/dist/workers/zk-verifier.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { MeshNode } from './mesh.js';
2
- import { L as LiopServer } from './index-BW95kAL4.js';
3
- import { L as LiopVerifier } from './verifier-COnid_dg.js';
4
- import { b as McpRequest, M as McpEra, A as AuthInfo, c as McpResponse } from './types-lJIxBlWF.js';
1
+ import { a as MeshNode } from './node-Djzm6UYd.js';
2
+ import { L as LiopServer } from './index-ByzjpRCk.js';
3
+ import { b as McpRequest, M as McpEra, A as AuthInfo, c as McpResponse, G as GatewayInterceptorOptions } from './types-29zv9X1V.js';
4
+ import { L as LiopVerifier } from './verifier-DqZ9MQ9l.js';
5
5
 
6
6
  /**
7
7
  * LIOP Sliding-Window Rate Limiter
@@ -153,9 +153,10 @@ declare class LiopHybridGateway {
153
153
  private jwtValidator?;
154
154
  private oauthProvider?;
155
155
  private rateLimiter;
156
+ private readonly interceptorOptions?;
156
157
  private isDraining;
157
158
  private activeRequests;
158
- constructor(liopServer: LiopServer, meshNode?: MeshNode | null, rpcPort?: number, rateLimiterOptions?: RateLimiterOptions);
159
+ constructor(liopServer: LiopServer, meshNode?: MeshNode | null, rpcPort?: number, rateLimiterOptions?: RateLimiterOptions, interceptorOptions?: GatewayInterceptorOptions);
159
160
  private setupH2Routes;
160
161
  private setupH1Routes;
161
162
  private handleGrpcStream;
@@ -1,17 +1,9 @@
1
- import { L as LiopVerifier } from './verifier-COnid_dg.js';
2
- import { MeshNodeConfig } from './mesh.js';
1
+ import { L as LiopVerifier } from './verifier-DqZ9MQ9l.js';
2
+ import { M as MeshNodeConfig } from './node-Djzm6UYd.js';
3
+ import * as grpc from '@grpc/grpc-js';
3
4
  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
- */
5
+ import { Z as ZkPolicy } from './zk-DzYNWBgo.js';
6
+ import { M as McpEra, C as CallToolRequest, a as CallToolResult } from './types-29zv9X1V.js';
15
7
 
16
8
  interface CertManagerOptions {
17
9
  /** Path to the root CA certificate (PEM format) */
@@ -77,23 +69,6 @@ declare class CertManager extends EventEmitter {
77
69
  dispose(): void;
78
70
  }
79
71
 
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
72
  interface LiopTlsOptions {
98
73
  /** Path to the root CA certificate (PEM format) */
99
74
  rootCert?: string;
@@ -105,7 +80,28 @@ interface LiopTlsOptions {
105
80
  mutualTls?: boolean;
106
81
  /** Optional CertManager instance for automated certificate management and hot reloading */
107
82
  certManager?: CertManager;
83
+ /**
84
+ * Explicitly permit unencrypted (insecure) credentials for local development,
85
+ * Docker testbeds, or tooling harnesses without emitting console warnings.
86
+ * Ignored if isTlsEnforced() is true (production/enforced mode always throws).
87
+ */
88
+ insecure?: boolean;
89
+ /**
90
+ * Explicitly suppress the fallback warning when insecure credentials are created.
91
+ */
92
+ suppressWarning?: boolean;
108
93
  }
94
+ /**
95
+ * Creates gRPC server credentials from TLS options.
96
+ * In production or when LIOP_ENFORCE_TLS=true, refuses to fall back to insecure.
97
+ * When mutualTls=true, enforces client certificate authentication against root CA.
98
+ */
99
+ declare function createServerCredentials(tls?: LiopTlsOptions): grpc.ServerCredentials;
100
+ /**
101
+ * Creates gRPC channel credentials from TLS options.
102
+ * In production or when LIOP_ENFORCE_TLS=true, refuses to fall back to insecure.
103
+ */
104
+ declare function createChannelCredentials(tls?: LiopTlsOptions): grpc.ChannelCredentials;
109
105
 
110
106
  /**
111
107
  * LIOP Client
@@ -119,15 +115,12 @@ declare class LiopClient {
119
115
  private serverInfo?;
120
116
  verifier: LiopVerifier;
121
117
  private oauthToken?;
118
+ private tokenManager?;
122
119
  /** Protocol negotiation era */
123
120
  era: McpEra;
124
121
  /** Negotiated protocol version */
125
122
  protocolVersion: string;
126
123
  constructor(tls?: LiopTlsOptions);
127
- /**
128
- * Requests an M2M access token from the Nexus Authorization Server using Client Credentials.
129
- */
130
- private acquireM2MToken;
131
124
  /**
132
125
  * Discovers and connects to the target server or mesh capability.
133
126
  * If address is omitted, it sets up the MeshNode to act purely dynamically.
@@ -174,7 +167,10 @@ declare class LiopClient {
174
167
  /**
175
168
  * Invokes a tool.
176
169
  */
177
- callTool(request: CallToolRequest, _wasmPayload?: Buffer): Promise<CallToolResult>;
170
+ callTool(request: CallToolRequest, _wasmPayload?: Buffer, options?: {
171
+ zkPolicy?: ZkPolicy;
172
+ circuitName?: string;
173
+ }): Promise<CallToolResult>;
178
174
  private getOrCreateRpcClient;
179
175
  /**
180
176
  * Reads a specific resource by URI.
@@ -187,6 +183,19 @@ declare class LiopClient {
187
183
  text: string;
188
184
  }>;
189
185
  }>;
186
+ /**
187
+ * Returns the local PeerId string if the mesh node is active, null otherwise.
188
+ * PeerIds are public identifiers by libp2p protocol design (Ed25519 public key hash).
189
+ */
190
+ get peerId(): string | null;
191
+ /**
192
+ * Returns true if the mesh node is initialized and running.
193
+ */
194
+ get isMeshActive(): boolean;
195
+ /**
196
+ * Returns the number of active P2P connections, or 0 if the mesh is inactive.
197
+ */
198
+ get connectionCount(): number;
190
199
  getServerInfo(): {
191
200
  name: string;
192
201
  version: string;
@@ -197,4 +206,4 @@ declare class LiopClient {
197
206
  close(): Promise<void>;
198
207
  }
199
208
 
200
- export { type CertInfo as C, type LiopTlsOptions as L, CertManager as a, type CertManagerOptions as b, LiopClient as c };
209
+ export { type CertInfo as C, type LiopTlsOptions as L, CertManager as a, type CertManagerOptions as b, LiopClient as c, createChannelCredentials as d, createServerCredentials as e };
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { MeshNode } from './mesh.js';
3
- import { J as JwtValidator, S as ServerInfo, a as CallToolResult, P as Prompt, G as GetPromptRequest, d as GetPromptResult, C as CallToolRequest, T as Tool, R as Resource } from './types-lJIxBlWF.js';
2
+ import { M as MeshNodeConfig, a as MeshNode } from './node-Djzm6UYd.js';
3
+ import { d as AuditLogger, J as JwtValidator, S as ServerInfo, a as CallToolResult, P as Prompt, e as GetPromptRequest, f as GetPromptResult, C as CallToolRequest, T as Tool, R as Resource } from './types-29zv9X1V.js';
4
4
 
5
5
  /**
6
6
  * LIOP OAuth 2.1 Hybrid Auth — Configuration Types
@@ -100,60 +100,6 @@ declare const AUTH_DEFAULTS: {
100
100
  readonly signingAlgorithm: "EdDSA";
101
101
  };
102
102
 
103
- /**
104
- * LIOP Immutable Audit Logger (Phase Beta-3)
105
- * SOC 2 Type II & HIPAA compliant audit trail with cryptographic Hash-Chain.
106
- * Guarantees tamper-evidence and non-repudiation for all Logic-on-Origin executions.
107
- */
108
- type AuditStatus = "SUCCESS" | "BLOCKED_EGRESS" | "ERROR" | "POLICY_VIOLATION";
109
- interface AuditEntry {
110
- id: string;
111
- timestamp: string;
112
- traceId: string;
113
- agentDid: string;
114
- peerId: string;
115
- toolName: string;
116
- datasetHash: string;
117
- fuelConsumed: number;
118
- outputHash: string;
119
- zkReceiptSig: string;
120
- status: AuditStatus;
121
- prevEntryHash: string;
122
- entryHash: string;
123
- }
124
- interface AuditRecordParams {
125
- timestamp?: string;
126
- traceId?: string;
127
- agentDid: string;
128
- peerId: string;
129
- toolName: string;
130
- datasetHash?: string;
131
- fuelConsumed: number;
132
- outputHash?: string;
133
- zkReceiptSig?: string;
134
- status: AuditStatus;
135
- }
136
- declare const GENESIS_HASH: string;
137
- declare function computeEntryHash(entryWithoutHash: Omit<AuditEntry, "entryHash">): string;
138
- declare class AuditLogger {
139
- private entries;
140
- private lastEntryHash;
141
- private filePath?;
142
- constructor(filePath?: string);
143
- recordExecution(params: AuditRecordParams): AuditEntry;
144
- getEntries(): readonly AuditEntry[];
145
- getEntryCount(): number;
146
- verifyIntegrity(): {
147
- valid: boolean;
148
- totalEntries: number;
149
- brokenIndex?: number;
150
- reason?: string;
151
- };
152
- exportJsonl(): string;
153
- private loadFromFile;
154
- }
155
- declare const globalAuditLogger: AuditLogger;
156
-
157
103
  /** Single named entity detected by the NER scanner. */
158
104
  interface NerEntity {
159
105
  type: "person" | "place" | "organization";
@@ -211,11 +157,6 @@ interface OutputSanitizerConfig {
211
157
  */
212
158
  declare function sanitizeOutput(output: unknown, config?: OutputSanitizerConfig): unknown;
213
159
 
214
- /**
215
- * LIOP Professional PII Engine (The Shield V2 - Tier-1 Military Edition)
216
- * Implements high-fidelity detection based on NIST and OWASP standards.
217
- * Features Multi-Layer Verification (Regex + Algorithmic Validators).
218
- */
219
160
  type PiiRuleDefinition = {
220
161
  name: string;
221
162
  pattern: string | RegExp;
@@ -340,6 +281,10 @@ interface LiopServerOptions {
340
281
  * Path to a shared JSON file for persistent Query Budget tracking across multiple server instances.
341
282
  */
342
283
  budgetStorePath?: string;
284
+ /** Expected guest image identifier hash for sovereign enclaves (Hex) */
285
+ guestImageId?: string;
286
+ /** Static verification key mappings for fast-path analytical circuits */
287
+ zkVkeys?: Record<string, unknown>;
343
288
  }
344
289
  interface AggregationPolicy {
345
290
  /** Maximum number of object-type array elements allowed (default: 10) */
@@ -390,6 +335,29 @@ interface LogicExecutionPolicy {
390
335
  * Path to a shared JSON file for persistent Query Budget tracking across multiple server instances.
391
336
  */
392
337
  budgetStorePath?: string;
338
+ /**
339
+ * Zero-Knowledge proof mode required for this tool capability.
340
+ * - "none": standard HMAC-SHA256 session commitment
341
+ * - "optimistic": Groth16 v2 receipt generated if prover available, otherwise fallback
342
+ * - "required": strictly enforces Groth16 v2 proof generation; rejects if unavailable
343
+ */
344
+ zkMode?: "none" | "optimistic" | "required";
345
+ /**
346
+ * Optional custom guest image identifier hash for this capability.
347
+ */
348
+ guestImageId?: string;
349
+ /**
350
+ * Name of the designated R1CS circuit (e.g. "sum", "count", "average", "filter").
351
+ */
352
+ circuitName?: string;
353
+ /**
354
+ * Static verification key JSON structure for this capability.
355
+ */
356
+ vkey?: Record<string, unknown>;
357
+ /**
358
+ * Whether to co-sign the Groth16 receipt with an ML-DSA-65 post-quantum digital signature (FIPS 204).
359
+ */
360
+ pqcSign?: boolean;
393
361
  }
394
362
  declare class LiopServer {
395
363
  private serverInfo;
@@ -416,6 +384,7 @@ declare class LiopServer {
416
384
  private meshNode;
417
385
  private rpcServer;
418
386
  private boundPort;
387
+ private enclavePqcKeypair?;
419
388
  jwtValidator?: JwtValidator;
420
389
  oauthProvider?: any;
421
390
  private sessions;
@@ -458,11 +427,7 @@ declare class LiopServer {
458
427
  */
459
428
  connect(options?: {
460
429
  port?: number;
461
- meshConfig?: {
462
- listenAddresses?: string[];
463
- bootstrapNodes?: string[];
464
- identityPath?: string;
465
- };
430
+ meshConfig?: MeshNodeConfig;
466
431
  }): Promise<void>;
467
432
  /**
468
433
  * Register a new Tool
@@ -541,6 +506,10 @@ declare class LiopServer {
541
506
  * Injects data into the secure sandbox context for Logic-on-Origin tools.
542
507
  */
543
508
  setSandboxData(records: Record<string, unknown>[]): void;
509
+ /**
510
+ * Returns the read-only sandbox records registered in the enclave.
511
+ */
512
+ getSandboxData(): readonly Record<string, unknown>[];
544
513
  getBoundPort(): number | null;
545
514
  /**
546
515
  * Connects to the libp2p Kademlia DHT and announces capabilities.
@@ -548,11 +517,7 @@ declare class LiopServer {
548
517
  */
549
518
  connectToMesh(options?: {
550
519
  port?: number;
551
- meshConfig?: {
552
- listenAddresses?: string[];
553
- bootstrapNodes?: string[];
554
- identityPath?: string;
555
- };
520
+ meshConfig?: MeshNodeConfig;
556
521
  }): Promise<void>;
557
522
  /**
558
523
  * Internal worker execution with Egress Filtering logic.
@@ -581,4 +546,4 @@ declare class LiopServer {
581
546
  private applyInMemoryBudget;
582
547
  }
583
548
 
584
- export { AUTH_DEFAULTS as A, GENESIS_HASH as G, LiopServer as L, NerScanner as N, type OAuthClientConfig as O, PII_PATTERNS as P, type ToolHandler as T, type LiopServerOptions as a, type AggregationPolicy as b, type AuditEntry as c, AuditLogger as d, type AuditRecordParams as e, type AuditStatus as f, type AuthRole as g, type LiopAuthConfig as h, type LogicExecutionPolicy as i, type OutputSanitizerConfig as j, PII_PRESETS as k, type PiiRule as l, PiiScanner as m, computeEntryHash as n, globalAuditLogger as o, sanitizeOutput as s };
549
+ export { AUTH_DEFAULTS as A, LiopServer as L, NerScanner as N, type OAuthClientConfig as O, PII_PATTERNS as P, type ToolHandler as T, type LiopServerOptions as a, type AggregationPolicy as b, type AuthRole as c, type LiopAuthConfig as d, type LogicExecutionPolicy as e, type OutputSanitizerConfig as f, PII_PRESETS as g, type PiiRule as h, PiiScanner as i, sanitizeOutput as s };