@nekzus/liop 2.0.0-alpha.22 → 2.0.0-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/agent.js +2 -2
- package/dist/bin/agent.js.map +1 -1
- package/dist/bridge.js +1 -1
- package/dist/{chunk-LROSNSWJ.js → chunk-F7B6B4XS.js} +2 -2
- package/dist/{chunk-LROSNSWJ.js.map → chunk-F7B6B4XS.js.map} +1 -1
- package/dist/chunk-GD6EOKYV.js +54 -0
- package/dist/chunk-GD6EOKYV.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +33 -2
- package/dist/server.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-OVMCD5FR.js +0 -54
- package/dist/chunk-OVMCD5FR.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { a as LiopClient } from './index-BihN3W-K.js';
|
|
|
4
4
|
export { LiopHybridGateway } from './gateway.js';
|
|
5
5
|
export { LiopManifest, MeshNode, MeshNodeConfig } from './mesh.js';
|
|
6
6
|
import * as grpc from '@grpc/grpc-js';
|
|
7
|
-
export { AggregationPolicy, LiopServer, LiopServerOptions, LogicExecutionPolicy, NerScanner, PII_PATTERNS, PII_PRESETS, PiiRule, PiiScanner, ToolHandler } from './server.js';
|
|
7
|
+
export { AggregationPolicy, LiopServer, LiopServerOptions, LogicExecutionPolicy, NerScanner, OutputSanitizerConfig, PII_PATTERNS, PII_PRESETS, PiiRule, PiiScanner, ToolHandler, sanitizeOutput } from './server.js';
|
|
8
8
|
export { CallToolRequest, CallToolResult, GetPromptRequest, GetPromptResult, McpRequest, McpResponse, Prompt, PromptSchema, Resource, ResourceSchema, ServerInfo, Tool, ToolSchema } from './types.js';
|
|
9
9
|
import '@modelcontextprotocol/sdk/server/mcp.js';
|
|
10
10
|
import 'zod';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export{b as WasiSandbox}from'./chunk-C65RM2A3.js';export{b as LiopClient,a as LiopRpcClient}from'./chunk-ISKM7EAL.js';export{c as PromptSchema,b as ResourceSchema,a as ToolSchema}from'./chunk-TNMS53OP.js';export{b as LiopMcpBridge,a as LiopStreamBridge}from'./chunk-
|
|
1
|
+
export{b as WasiSandbox}from'./chunk-C65RM2A3.js';export{b as LiopClient,a as LiopRpcClient}from'./chunk-ISKM7EAL.js';export{c as PromptSchema,b as ResourceSchema,a as ToolSchema}from'./chunk-TNMS53OP.js';export{b as LiopMcpBridge,a as LiopStreamBridge}from'./chunk-F7B6B4XS.js';export{a as LiopHybridGateway}from'./chunk-SYMZRXI3.js';export{a as LiopRpcServer,g as LiopServer,b as NerScanner,d as PII_PATTERNS,e as PII_PRESETS,f as PiiScanner,c as sanitizeOutput}from'./chunk-GD6EOKYV.js';import'./chunk-2MGFSIXN.js';export{b as HeuristicTokenEstimator,e as LiopOTelBridge,a as RealTokenEstimator,f as TokenTelemetryEngine,d as createSyncTokenEstimator,c as createTokenEstimator}from'./chunk-UK7OBXGZ.js';import'./chunk-UVTEJYHN.js';import'./chunk-ANFXJGMP.js';import'./chunk-DBXGYHKY.js';import'./chunk-V5MKJT6S.js';export{a as MeshNode}from'./chunk-7I6YJS3C.js';import'./chunk-S6RJHZV2.js';import'./chunk-4C666HHU.js';var m=(e=>(e.CapabilityViolation="CapabilityViolation",e.SandboxEscape="SandboxEscape",e.PiiLeak="PiiLeak",e.InvalidIntent="InvalidIntent",e.Throttled="Throttled",e.ZkVerificationFailed="ZkVerificationFailed",e.MeshUnavailable="MeshUnavailable",e.ConnectionFailed="ConnectionFailed",e))(m||{}),n=class extends Error{code;constructor(o,t){super(t),this.name="LiopError",this.code=o;}};var g={claude:{xmlStandard:true,jsonSchemaPreferred:false},openai:{xmlStandard:false,jsonSchemaPreferred:true},gemini:{xmlStandard:false,jsonSchemaPreferred:true}};function _(i){let o=g[i],t=`[LIOP-PROTO-V1: LOGIC-ON-ORIGIN SPECIFICATION]
|
|
2
2
|
You are interacting with a Logic-Injection-on-Origin Protocol (LIOP) Mesh Network.
|
|
3
3
|
Unlike standard MCP where you pull context to evaluate it remotely, in LIOP you WRITE code that executes on the data's origin.
|
|
4
4
|
|
|
@@ -40,5 +40,5 @@ Example:
|
|
|
40
40
|
"target": "liop://vault/patients",
|
|
41
41
|
"logic_blob": "const records = await liop.readResource(args.target); return { targetCount: records.filter(r => r.disease === 'Hypertension').length };"
|
|
42
42
|
}
|
|
43
|
-
`),t}export{m as ErrorCode,n as LiopError,
|
|
43
|
+
`),t}export{m as ErrorCode,n as LiopError,_ as generateSystemInstructions};//# sourceMappingURL=index.js.map
|
|
44
44
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/prompts/adapters.ts"],"names":["ErrorCode","LiopError","code","message","PROVIDER_CONFIGS","generateSystemInstructions","provider","config","instructions"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/prompts/adapters.ts"],"names":["ErrorCode","LiopError","code","message","PROVIDER_CONFIGS","generateSystemInstructions","provider","config","instructions"],"mappings":"y5BAAO,IAAKA,OACXA,CAAAA,CAAA,mBAAA,CAAsB,qBAAA,CACtBA,CAAAA,CAAA,cAAgB,eAAA,CAChBA,CAAAA,CAAA,OAAA,CAAU,SAAA,CACVA,EAAA,aAAA,CAAgB,eAAA,CAChBA,EAAA,SAAA,CAAY,WAAA,CACZA,EAAA,oBAAA,CAAuB,sBAAA,CACvBA,CAAAA,CAAA,eAAA,CAAkB,kBAClBA,CAAAA,CAAA,gBAAA,CAAmB,kBAAA,CARRA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,IAWCC,CAAAA,CAAN,cAAwB,KAAM,CACpB,KAEhB,WAAA,CAAYC,CAAAA,CAAiBC,EAAiB,CAC7C,KAAA,CAAMA,CAAO,CAAA,CACb,IAAA,CAAK,IAAA,CAAO,WAAA,CACZ,KAAK,IAAA,CAAOD,EACb,CACD,ECLA,IAAME,CAAAA,CAAqD,CAC1D,MAAA,CAAQ,CAAE,YAAa,IAAA,CAAM,mBAAA,CAAqB,KAAM,CAAA,CACxD,MAAA,CAAQ,CAAE,WAAA,CAAa,KAAA,CAAO,mBAAA,CAAqB,IAAK,EACxD,MAAA,CAAQ,CAAE,YAAa,KAAA,CAAO,mBAAA,CAAqB,IAAK,CACzD,CAAA,CAMO,SAASC,CAAAA,CAA2BC,EAA8B,CACxE,IAAMC,EAASH,CAAAA,CAAiBE,CAAQ,EAEpCE,CAAAA,CAAe,CAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA,CA2BnB,OAAID,CAAAA,CAAO,WAAA,CACVC,CAAAA,EAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA,CAUND,CAAAA,CAAO,sBACjBC,CAAAA,EAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA,CAAA,CAWVA,CACR","file":"index.js","sourcesContent":["export enum ErrorCode {\n\tCapabilityViolation = \"CapabilityViolation\",\n\tSandboxEscape = \"SandboxEscape\",\n\tPiiLeak = \"PiiLeak\",\n\tInvalidIntent = \"InvalidIntent\",\n\tThrottled = \"Throttled\",\n\tZkVerificationFailed = \"ZkVerificationFailed\",\n\tMeshUnavailable = \"MeshUnavailable\",\n\tConnectionFailed = \"ConnectionFailed\",\n}\n\nexport class LiopError extends Error {\n\tpublic readonly code: ErrorCode;\n\n\tconstructor(code: ErrorCode, message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"LiopError\";\n\t\tthis.code = code;\n\t}\n}\n","/**\n * LIOP Cross-AI Prompt Adapters (Fase 92)\n *\n * Normalizes system instructions for different LLM providers (Claude, OpenAI, Gemini)\n * to ensure they understand how to generate \"Logic-on-Origin\" WASM-compatible payload structures.\n */\n\nexport type AIProvider = \"claude\" | \"openai\" | \"gemini\";\n\nexport interface PromptConfig {\n\txmlStandard: boolean;\n\tjsonSchemaPreferred: boolean;\n}\n\nconst PROVIDER_CONFIGS: Record<AIProvider, PromptConfig> = {\n\tclaude: { xmlStandard: true, jsonSchemaPreferred: false },\n\topenai: { xmlStandard: false, jsonSchemaPreferred: true },\n\tgemini: { xmlStandard: false, jsonSchemaPreferred: true },\n};\n\n/**\n * Generates specific System Prompts optimized for the provided AI.\n * This instructs the LLM on how to bypass Context-Pulling and use Logic-Injection (Zero-Shot).\n */\nexport function generateSystemInstructions(provider: AIProvider): string {\n\tconst config = PROVIDER_CONFIGS[provider];\n\n\tlet instructions = `[LIOP-PROTO-V1: LOGIC-ON-ORIGIN SPECIFICATION]\nYou are interacting with a Logic-Injection-on-Origin Protocol (LIOP) Mesh Network.\nUnlike standard MCP where you pull context to evaluate it remotely, in LIOP you WRITE code that executes on the data's origin.\n\n### CORE PARADIGM\nWhen you call a tool or resource, you MUST provide a payload that represents secure sandboxed logic to be executed on the remote Node.\nThe node will execute your logic securely on the raw secure data, and return only the RESULT, avoiding PII data egress.\n\n### EXECUTION RULES\n1. Provide a self-contained JavaScript syntax block that we will compile to WASM-Sandboxed logic.\n2. Rely only on standard ECMA script features (No Node.js polyfills).\n3. The logic must end by returning the calculated insights, not the raw data.\n\n### DIFFERENTIAL PRIVACY (DP) MECHANISM (Laplace Mechanism)\nTo prevent database reconstruction and inference attacks, numeric query outputs are processed by a Laplace DP engine:\n- COUNT / LENGTH queries: To get EXACT integer values without noise, you MUST name return keys containing 'count', 'length', 'size', 'num', 'positive', 'negative', or starting with 'total_' or 'num_' (e.g. 'total_tx', 'credits_count'). This forces sensitivity=1.0, rounds values, and clamps to non-negative values.\n- AVERAGE queries: Return keys containing 'avg', 'mean', or 'average' scale down noise automatically by dividing global sensitivity by the dataset size (sensitivity / n).\n- SUM / OTHER queries: Return keys without these semantic names receive full Laplace noise based on the global node sensitivity (which can be up to 100,000 in Bank nodes to protect raw balances). Do NOT attempt to bypass this by renaming sum fields to count fields, as it violates protocol integrity.\n\n### SANDBOX RUNTIME RESTRICTIONS & WORKAROUNDS\n- Date is poisoned: The 'Date' class/constructor is undefined (calling 'new Date()', 'Date.now()', or 'Date.parse()' will crash the execution).\n - Workaround: Perform chronological sorting and comparisons lexicographically on ISO 8601 string dates (e.g. record.date >= '2024-01-01').\n- Poisoned globals: eval, Function, setTimeout, setInterval, Buffer, ArrayBuffer, and TypedArrays are undefined.\n- Frozen prototypes: Modifications to Object.prototype, Array.prototype, etc., are blocked.\n- K-Anonymity constraints: Small datasets (< 10 records) limit outputs to max 3 scalar keys with NO nesting. Datasets with >= 10 records limit outputs to max 10 fields.\n`;\n\n\tif (config.xmlStandard) {\n\t\tinstructions += `\n### PAYLOAD FORMATTING (CLAUDE-XML PREFERRED)\nYou must wrap your logic precisely within <liop_logic> tags.\nExample:\n<liop_logic>\nconst records = await liop.readResource(\"liop://vault/patients\");\nconst filtered = records.filter(r => r.disease === \"Hypertension\");\nreturn { alert: \"High risk demographic\", targetCount: filtered.length };\n</liop_logic>\n`;\n\t} else if (config.jsonSchemaPreferred) {\n\t\tinstructions += `\n### PAYLOAD FORMATTING (JSON PARSING PREFERRED)\nYou must provide your logic strictly within a JSON string key called \\`\"logic_blob\"\\` inside your tool call parameters.\nExample:\n{\n \"target\": \"liop://vault/patients\",\n \"logic_blob\": \"const records = await liop.readResource(args.target); return { targetCount: records.filter(r => r.disease === 'Hypertension').length };\"\n}\n`;\n\t}\n\n\treturn instructions;\n}\n"]}
|
package/dist/server.d.ts
CHANGED
|
@@ -37,6 +37,28 @@ declare class NerScanner {
|
|
|
37
37
|
scanDeep(input: unknown, seen?: WeakSet<object>): Promise<NerScanResult>;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* LIOP Egress Shield Output Sanitizer (NIST SP 800-226 and OWASP DLP 2025 compliant)
|
|
42
|
+
* Recursively sanitizes execution outputs by rounding floating-point numbers
|
|
43
|
+
* and clamping negative values to zero floor where appropriate.
|
|
44
|
+
*
|
|
45
|
+
* Implements absolute immutability, returning a fresh copy of the data.
|
|
46
|
+
*/
|
|
47
|
+
interface OutputSanitizerConfig {
|
|
48
|
+
/** Maximum decimal places for floating-point values (default: 4) */
|
|
49
|
+
maxDecimalPlaces?: number;
|
|
50
|
+
/** Clamp negative values to zero floor (default: true) */
|
|
51
|
+
clampNonNegative?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Recursively walks a JSON-like tree, rounding floats and clamping negative values.
|
|
55
|
+
*
|
|
56
|
+
* @param output - The raw or DP-modified output object/value to sanitize
|
|
57
|
+
* @param config - Sanitization parameters (rounding depth, negative clamping)
|
|
58
|
+
* @returns A sanitized deep copy of the output
|
|
59
|
+
*/
|
|
60
|
+
declare function sanitizeOutput(output: unknown, config?: OutputSanitizerConfig): unknown;
|
|
61
|
+
|
|
40
62
|
/**
|
|
41
63
|
* LIOP Professional PII Engine (The Shield V2 - Tier-1 Military Edition)
|
|
42
64
|
* Implements high-fidelity detection based on NIST and OWASP standards.
|
|
@@ -120,6 +142,7 @@ interface LiopServerOptions {
|
|
|
120
142
|
security?: {
|
|
121
143
|
piiPatterns?: PiiRule[];
|
|
122
144
|
forbiddenKeys?: string[];
|
|
145
|
+
sensitiveKeys?: string[];
|
|
123
146
|
/** Enable NLP-based Named Entity Recognition scanning on output values. */
|
|
124
147
|
enableNerScanning?: boolean;
|
|
125
148
|
/** Rate limiting configuration for tool calls (OWASP A01). */
|
|
@@ -170,11 +193,19 @@ interface LogicExecutionPolicy {
|
|
|
170
193
|
* For SUM queries on a field with range [0, X], set sensitivity = X.
|
|
171
194
|
*/
|
|
172
195
|
dpSensitivity?: number;
|
|
196
|
+
/**
|
|
197
|
+
* Dataset size threshold below which Differential Privacy is active (default: 50).
|
|
198
|
+
*/
|
|
199
|
+
dpSmallDatasetThreshold?: number;
|
|
173
200
|
/**
|
|
174
201
|
* Max queries per numeric field per PQC session (default: 5).
|
|
175
202
|
* Prevents multi-query differencing attacks.
|
|
176
203
|
*/
|
|
177
204
|
queryBudgetPerField?: number;
|
|
205
|
+
/**
|
|
206
|
+
* Domain-specific sensitive keys that fall under the "sensitive" query budget tier.
|
|
207
|
+
*/
|
|
208
|
+
sensitiveKeys?: string[];
|
|
178
209
|
}
|
|
179
210
|
declare class LiopServer {
|
|
180
211
|
private serverInfo;
|
|
@@ -286,7 +317,7 @@ declare class LiopServer {
|
|
|
286
317
|
/**
|
|
287
318
|
* Emulates calling a tool (used locally or via LIOPMcpBridge)
|
|
288
319
|
*/
|
|
289
|
-
callTool(request: CallToolRequest): Promise<CallToolResult>;
|
|
320
|
+
callTool(request: CallToolRequest, clientId?: string): Promise<CallToolResult>;
|
|
290
321
|
/**
|
|
291
322
|
* Retrieves registered tools
|
|
292
323
|
*/
|
|
@@ -343,4 +374,4 @@ declare class LiopServer {
|
|
|
343
374
|
close(): Promise<void>;
|
|
344
375
|
}
|
|
345
376
|
|
|
346
|
-
export { type AggregationPolicy, LiopServer, type LiopServerOptions, type LogicExecutionPolicy, NerScanner, PII_PATTERNS, PII_PRESETS, type PiiRule, PiiScanner, type ToolHandler };
|
|
377
|
+
export { type AggregationPolicy, LiopServer, type LiopServerOptions, type LogicExecutionPolicy, NerScanner, type OutputSanitizerConfig, PII_PATTERNS, PII_PRESETS, type PiiRule, PiiScanner, type ToolHandler, sanitizeOutput };
|
package/dist/server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{g as LiopServer,b as NerScanner,d as PII_PATTERNS,e as PII_PRESETS,f as PiiScanner,c as sanitizeOutput}from'./chunk-GD6EOKYV.js';import'./chunk-2MGFSIXN.js';import'./chunk-V5MKJT6S.js';import'./chunk-7I6YJS3C.js';import'./chunk-S6RJHZV2.js';import'./chunk-4C666HHU.js';//# sourceMappingURL=server.js.map
|
|
2
2
|
//# sourceMappingURL=server.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nekzus/liop",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.24",
|
|
4
4
|
"description": "Official SDK for Logic-Injection-on-Origin Protocol (LIOP). Deploy Logic-on-Origin with WebAssembly at gRPC speed and bidirectional MCP compatibility.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|