@nekzus/liop 2.4.0-alpha.13 → 2.4.0-alpha.14
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 +10 -10
- package/dist/bridge.d.ts +2 -2
- package/dist/bridge.js +3 -3
- package/dist/{chunk-NFFBJALJ.js → chunk-2KSO3W4A.js} +2 -2
- package/dist/{chunk-NFFBJALJ.js.map → chunk-2KSO3W4A.js.map} +1 -1
- package/dist/{chunk-UWC7OY7K.js → chunk-6CPRIMCD.js} +27 -5
- package/dist/chunk-6CPRIMCD.js.map +1 -0
- package/dist/{chunk-3BJ5QQHK.js → chunk-COISHJK5.js} +3 -3
- package/dist/{chunk-3BJ5QQHK.js.map → chunk-COISHJK5.js.map} +1 -1
- package/dist/{chunk-UCVP3XAL.js → chunk-HWUCX2II.js} +3 -3
- package/dist/{chunk-UCVP3XAL.js.map → chunk-HWUCX2II.js.map} +1 -1
- package/dist/{chunk-NFPQJCWL.js → chunk-JPN5456V.js} +7 -7
- package/dist/{chunk-NFPQJCWL.js.map → chunk-JPN5456V.js.map} +1 -1
- package/dist/{chunk-PXSXQEXO.js → chunk-KB7LNCVI.js} +9 -9
- package/dist/{chunk-PXSXQEXO.js.map → chunk-KB7LNCVI.js.map} +1 -1
- package/dist/chunk-LIBI3HMN.js +106 -0
- package/dist/chunk-LIBI3HMN.js.map +1 -0
- package/dist/{chunk-OPYSUDSW.js → chunk-OSJDFUBY.js} +5 -5
- package/dist/{chunk-OPYSUDSW.js.map → chunk-OSJDFUBY.js.map} +1 -1
- package/dist/{chunk-7RXOIDXP.js → chunk-QJIXNZTL.js} +3 -3
- package/dist/{chunk-7RXOIDXP.js.map → chunk-QJIXNZTL.js.map} +1 -1
- package/dist/{chunk-PEN3KFLF.js → chunk-RWBFGRF7.js} +3 -3
- package/dist/{chunk-PEN3KFLF.js.map → chunk-RWBFGRF7.js.map} +1 -1
- package/dist/{chunk-5SQLODJS.js → chunk-TDTGUVLB.js} +4 -4
- package/dist/{chunk-5SQLODJS.js.map → chunk-TDTGUVLB.js.map} +1 -1
- package/dist/{chunk-DZ2FQGJD.js → chunk-UAUBVKMK.js} +3 -3
- package/dist/{chunk-DZ2FQGJD.js.map → chunk-UAUBVKMK.js.map} +1 -1
- package/dist/{chunk-ESRXG36Y.js → chunk-VRZ3UIYA.js} +3 -3
- package/dist/{chunk-ESRXG36Y.js.map → chunk-VRZ3UIYA.js.map} +1 -1
- package/dist/client.d.ts +2 -2
- package/dist/client.js +8 -8
- package/dist/gateway.d.ts +3 -3
- package/dist/gateway.js +7 -7
- package/dist/{hybrid-FFII2lHf.d.ts → hybrid-CTC9oYVp.d.ts} +2 -2
- package/dist/{index-BLu6LG_C.d.ts → index-DHdTB7B8.d.ts} +1 -1
- package/dist/{index-DckIVTsW.d.ts → index-Dqn4dtZP.d.ts} +2 -51
- package/dist/index.d.ts +6 -6
- package/dist/index.js +13 -13
- package/dist/mesh.js +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +4 -4
- package/dist/{types-DDiBZWEq.d.ts → types-CMYlWlX2.d.ts} +105 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/verifier-A7HX6KAJ.js +6 -0
- package/dist/{verifier-HRFXBKT5.js.map → verifier-A7HX6KAJ.js.map} +1 -1
- package/package.json +1 -1
- package/dist/chunk-HA6YZ42O.js +0 -64
- package/dist/chunk-HA6YZ42O.js.map +0 -1
- package/dist/chunk-UWC7OY7K.js.map +0 -1
- package/dist/verifier-HRFXBKT5.js +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { log } from './chunk-
|
|
1
|
+
import { log } from './chunk-LIBI3HMN.js';
|
|
2
2
|
|
|
3
3
|
// src/runtime/token-manager.ts
|
|
4
4
|
var TokenManager = class _TokenManager {
|
|
@@ -111,5 +111,5 @@ var TokenManager = class _TokenManager {
|
|
|
111
111
|
};
|
|
112
112
|
|
|
113
113
|
export { TokenManager };
|
|
114
|
-
//# sourceMappingURL=chunk-
|
|
115
|
-
//# sourceMappingURL=chunk-
|
|
114
|
+
//# sourceMappingURL=chunk-VRZ3UIYA.js.map
|
|
115
|
+
//# sourceMappingURL=chunk-VRZ3UIYA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/runtime/token-manager.ts"],"names":[],"mappings":";;;AAwBO,IAAM,YAAA,GAAN,MAAM,aAAA,CAAa;AAAA,EACjB,WAAA,GAA6B,IAAA;AAAA,EAC7B,SAAA,GAAY,CAAA;AAAA;AAAA,EACZ,cAAA,GAAyC,IAAA;AAAA,EAEhC,aAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACT,WAAA;AAAA;AAAA,EAGR,OAAwB,iBAAA,GAAoB,GAAA;AAAA,EAE5C,YAAY,OAAA,EAA8B;AACzC,IAAA,IAAA,CAAK,gBAAgB,OAAA,CAAQ,aAAA;AAC7B,IAAA,IAAA,CAAK,WAAW,OAAA,CAAQ,QAAA;AACxB,IAAA,IAAA,CAAK,eAAe,OAAA,CAAQ,YAAA;AAC5B,IAAA,IAAA,CAAK,QAAA,GAAW,QAAQ,QAAA,IAAY,mBAAA;AACpC,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA,CAAM,OAAA,CAAQ,OAAA,CAAQ,MAAM,CAAA,GACtC,OAAA,CAAQ,MAAA,CAAO,IAAA,CAAK,GAAG,CAAA,GACtB,OAAA,CAAQ,MAAA,IACV,sFAAA;AACF,IAAA,IAAA,CAAK,cAAc,OAAA,CAAQ,WAAA;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAa,QAAA,GAA4B;AACxC,IAAA,IAAI,KAAK,WAAA,EAAa;AACrB,MAAA,OAAO,IAAA,CAAK,WAAA;AAAA,IACb;AAEA,IAAA,MAAM,GAAA,GAAM,KAAK,GAAA,EAAI;AACrB,IAAA,IACC,KAAK,WA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 2026 Nekzus Solutions and contributors\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * LIOP Token Manager — Adaptive OAuth 2.1 M2M Token Lifecycle\n *\n * Implements resilient token caching with preemptive refresh (30s safety buffer),\n * concurrency de-duplication (single in-flight HTTP request), and on-demand\n * invalidation for 401 Unauthorized handling.\n *\n * Standards: RFC 6749, RFC 8707 (Resource Indicators), RFC 9068 (JWT Profile)\n */\n\nimport { log } from \"../utils/logger.js\";\n\nexport interface TokenManagerOptions {\n\ttokenEndpoint: string;\n\tclientId: string;\n\tclientSecret: string;\n\taudience?: string;\n\tscopes?: string | string[];\n\tstaticToken?: string;\n}\n\nexport class TokenManager {\n\tprivate cachedToken: string | null = null;\n\tprivate expiresAt = 0; // Epoch ms\n\tprivate pendingPromise: Promise<string> | null = null;\n\n\tprivate readonly tokenEndpoint: string;\n\tprivate readonly clientId: string;\n\tprivate readonly clientSecret: string;\n\tprivate readonly audience: string;\n\tprivate readonly scope: string;\n\tprivate staticToken?: string;\n\n\t// Preemptive refresh threshold: 30 seconds before expiration\n\tprivate static readonly REFRESH_BUFFER_MS = 30_000;\n\n\tconstructor(options: TokenManagerOptions) {\n\t\tthis.tokenEndpoint = options.tokenEndpoint;\n\t\tthis.clientId = options.clientId;\n\t\tthis.clientSecret = options.clientSecret;\n\t\tthis.audience = options.audience ?? \"urn:liop:mesh:api\";\n\t\tthis.scope = Array.isArray(options.scopes)\n\t\t\t? options.scopes.join(\" \")\n\t\t\t: (options.scopes ??\n\t\t\t\t\"liop:tools:call liop:tools:list liop:resources:read liop:schema:read liop:mesh:query\");\n\t\tthis.staticToken = options.staticToken;\n\t}\n\n\t/**\n\t * Returns a valid OAuth 2.1 access token.\n\t * Automatically performs preemptive refresh if the token is close to expiry.\n\t */\n\tpublic async getToken(): Promise<string> {\n\t\tif (this.staticToken) {\n\t\t\treturn this.staticToken;\n\t\t}\n\n\t\tconst now = Date.now();\n\t\tif (\n\t\t\tthis.cachedToken &&\n\t\t\tnow < this.expiresAt - TokenManager.REFRESH_BUFFER_MS\n\t\t) {\n\t\t\treturn this.cachedToken;\n\t\t}\n\n\t\tif (this.pendingPromise) {\n\t\t\treturn this.pendingPromise;\n\t\t}\n\n\t\tthis.pendingPromise = (async () => {\n\t\t\ttry {\n\t\t\t\tconst token = await this.fetchNewToken();\n\t\t\t\tthis.cachedToken = token;\n\t\t\t\treturn token;\n\t\t\t} finally {\n\t\t\t\tthis.pendingPromise = null;\n\t\t\t}\n\t\t})();\n\n\t\treturn this.pendingPromise;\n\t}\n\n\t/**\n\t * Force-invalidates cached token, e.g. after receiving a 401 Unauthorized response.\n\t */\n\tpublic invalidate(): void {\n\t\tthis.cachedToken = null;\n\t\tthis.expiresAt = 0;\n\t\tif (this.clientId && this.clientSecret) {\n\t\t\tthis.staticToken = undefined;\n\t\t}\n\t\tlog.info(\"[TokenManager] Cached OAuth access token invalidated.\");\n\t}\n\n\t/**\n\t * Returns true if the token is absent or has passed the refresh threshold.\n\t */\n\tpublic isExpired(): boolean {\n\t\tif (this.staticToken) return false;\n\t\treturn (\n\t\t\t!this.cachedToken ||\n\t\t\tDate.now() >= this.expiresAt - TokenManager.REFRESH_BUFFER_MS\n\t\t);\n\t}\n\n\tpublic getExpiresAt(): number {\n\t\treturn this.expiresAt;\n\t}\n\n\tprivate async fetchNewToken(): Promise<string> {\n\t\tlog.info(\n\t\t\t`[TokenManager] Requesting M2M token from ${this.tokenEndpoint} for client '${this.clientId}'...`,\n\t\t);\n\n\t\tconst params = new URLSearchParams({\n\t\t\tgrant_type: \"client_credentials\",\n\t\t\tclient_id: this.clientId,\n\t\t\tclient_secret: this.clientSecret,\n\t\t\tresource: this.audience,\n\t\t\tscope: this.scope,\n\t\t});\n\n\t\tconst response = await fetch(this.tokenEndpoint, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/x-www-form-urlencoded\",\n\t\t\t\tAccept: \"application/json\",\n\t\t\t},\n\t\t\tbody: params.toString(),\n\t\t\tsignal: AbortSignal.timeout(10_000),\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tconst errorText = await response.text();\n\t\t\tthrow new Error(\n\t\t\t\t`OAuth token request failed [HTTP ${response.status}]: ${errorText}`,\n\t\t\t);\n\t\t}\n\n\t\tconst data = (await response.json()) as {\n\t\t\taccess_token?: string;\n\t\t\texpires_in?: number;\n\t\t\ttoken_type?: string;\n\t\t};\n\n\t\tif (!data.access_token) {\n\t\t\tthrow new Error(\n\t\t\t\t\"OAuth token response did not contain an 'access_token' field.\",\n\t\t\t);\n\t\t}\n\n\t\tconst expiresInSec =\n\t\t\ttypeof data.expires_in === \"number\" ? data.expires_in : 3600;\n\t\tthis.expiresAt = Date.now() + expiresInSec * 1000;\n\n\t\tlog.info(\n\t\t\t`[TokenManager] Acquired access token successfully. Expires in ${expiresInSec}s.`,\n\t\t);\n\n\t\treturn data.access_token;\n\t}\n}\n"]}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './verifier-COnid_dg.js';
|
|
2
2
|
import './node-B0b2vUFS.js';
|
|
3
|
-
export { c as LiopClient } from './index-
|
|
4
|
-
import './types-
|
|
3
|
+
export { c as LiopClient } from './index-DHdTB7B8.js';
|
|
4
|
+
import './types-CMYlWlX2.js';
|
|
5
5
|
import '@grpc/grpc-js';
|
|
6
6
|
import 'node:events';
|
|
7
7
|
import 'zod';
|
package/dist/client.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { LiopClient } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
export { LiopClient } from './chunk-KB7LNCVI.js';
|
|
2
|
+
import './chunk-VRZ3UIYA.js';
|
|
3
|
+
import './chunk-UAUBVKMK.js';
|
|
4
|
+
import './chunk-RWBFGRF7.js';
|
|
5
5
|
import './chunk-IK7CGWAZ.js';
|
|
6
6
|
import './chunk-7PITYWOV.js';
|
|
7
|
-
import './chunk-
|
|
7
|
+
import './chunk-COISHJK5.js';
|
|
8
8
|
import './chunk-PAICJCKJ.js';
|
|
9
|
-
import './chunk-
|
|
10
|
-
import './chunk-
|
|
11
|
-
import './chunk-
|
|
9
|
+
import './chunk-2KSO3W4A.js';
|
|
10
|
+
import './chunk-QJIXNZTL.js';
|
|
11
|
+
import './chunk-LIBI3HMN.js';
|
|
12
12
|
//# sourceMappingURL=client.js.map
|
|
13
13
|
//# sourceMappingURL=client.js.map
|
package/dist/gateway.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './node-B0b2vUFS.js';
|
|
2
|
-
import './index-
|
|
3
|
-
import './types-
|
|
4
|
-
export { L as LiopHybridGateway } from './hybrid-
|
|
2
|
+
import './index-Dqn4dtZP.js';
|
|
3
|
+
import './types-CMYlWlX2.js';
|
|
4
|
+
export { L as LiopHybridGateway } from './hybrid-CTC9oYVp.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import './verifier-COnid_dg.js';
|
package/dist/gateway.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { LiopHybridGateway } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
export { LiopHybridGateway } from './chunk-TDTGUVLB.js';
|
|
2
|
+
import './chunk-JPN5456V.js';
|
|
3
|
+
import './chunk-UAUBVKMK.js';
|
|
4
|
+
import './chunk-RWBFGRF7.js';
|
|
5
5
|
import './chunk-IK7CGWAZ.js';
|
|
6
6
|
import './chunk-7PITYWOV.js';
|
|
7
7
|
import './chunk-VH4K4U45.js';
|
|
8
|
-
import './chunk-
|
|
8
|
+
import './chunk-COISHJK5.js';
|
|
9
9
|
import './chunk-PAICJCKJ.js';
|
|
10
|
-
import './chunk-
|
|
11
|
-
import './chunk-
|
|
10
|
+
import './chunk-2KSO3W4A.js';
|
|
11
|
+
import './chunk-LIBI3HMN.js';
|
|
12
12
|
//# sourceMappingURL=gateway.js.map
|
|
13
13
|
//# sourceMappingURL=gateway.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as MeshNode } from './node-B0b2vUFS.js';
|
|
2
|
-
import { L as LiopServer } from './index-
|
|
3
|
-
import { b as McpRequest, M as McpEra, A as AuthInfo, c as McpResponse, G as GatewayInterceptorOptions } from './types-
|
|
2
|
+
import { L as LiopServer } from './index-Dqn4dtZP.js';
|
|
3
|
+
import { b as McpRequest, M as McpEra, A as AuthInfo, c as McpResponse, G as GatewayInterceptorOptions } from './types-CMYlWlX2.js';
|
|
4
4
|
import { L as LiopVerifier } from './verifier-COnid_dg.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -2,7 +2,7 @@ import { L as LiopVerifier } from './verifier-COnid_dg.js';
|
|
|
2
2
|
import { M as MeshNodeConfig } from './node-B0b2vUFS.js';
|
|
3
3
|
import * as grpc from '@grpc/grpc-js';
|
|
4
4
|
import { EventEmitter } from 'node:events';
|
|
5
|
-
import { M as McpEra, C as CallToolRequest, a as CallToolResult } from './types-
|
|
5
|
+
import { M as McpEra, C as CallToolRequest, a as CallToolResult } from './types-CMYlWlX2.js';
|
|
6
6
|
|
|
7
7
|
interface CertManagerOptions {
|
|
8
8
|
/** Path to the root CA certificate (PEM format) */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { M as MeshNodeConfig, a as MeshNode } from './node-B0b2vUFS.js';
|
|
3
|
-
import { J as JwtValidator, S as ServerInfo, a as CallToolResult, P as Prompt,
|
|
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-CMYlWlX2.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* LIOP OAuth 2.1 Hybrid Auth — Configuration Types
|
|
@@ -100,55 +100,6 @@ declare const AUTH_DEFAULTS: {
|
|
|
100
100
|
readonly signingAlgorithm: "EdDSA";
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
type AuditStatus = "SUCCESS" | "BLOCKED_EGRESS" | "ERROR" | "POLICY_VIOLATION";
|
|
104
|
-
interface AuditEntry {
|
|
105
|
-
id: string;
|
|
106
|
-
timestamp: string;
|
|
107
|
-
traceId: string;
|
|
108
|
-
agentDid: string;
|
|
109
|
-
peerId: string;
|
|
110
|
-
toolName: string;
|
|
111
|
-
datasetHash: string;
|
|
112
|
-
fuelConsumed: number;
|
|
113
|
-
outputHash: string;
|
|
114
|
-
zkReceiptSig: string;
|
|
115
|
-
status: AuditStatus;
|
|
116
|
-
prevEntryHash: string;
|
|
117
|
-
entryHash: string;
|
|
118
|
-
}
|
|
119
|
-
interface AuditRecordParams {
|
|
120
|
-
timestamp?: string;
|
|
121
|
-
traceId?: string;
|
|
122
|
-
agentDid: string;
|
|
123
|
-
peerId: string;
|
|
124
|
-
toolName: string;
|
|
125
|
-
datasetHash?: string;
|
|
126
|
-
fuelConsumed: number;
|
|
127
|
-
outputHash?: string;
|
|
128
|
-
zkReceiptSig?: string;
|
|
129
|
-
status: AuditStatus;
|
|
130
|
-
}
|
|
131
|
-
declare const GENESIS_HASH: string;
|
|
132
|
-
declare function computeEntryHash(entryWithoutHash: Omit<AuditEntry, "entryHash">): string;
|
|
133
|
-
declare class AuditLogger {
|
|
134
|
-
private entries;
|
|
135
|
-
private lastEntryHash;
|
|
136
|
-
private filePath?;
|
|
137
|
-
constructor(filePath?: string);
|
|
138
|
-
recordExecution(params: AuditRecordParams): AuditEntry;
|
|
139
|
-
getEntries(): readonly AuditEntry[];
|
|
140
|
-
getEntryCount(): number;
|
|
141
|
-
verifyIntegrity(): {
|
|
142
|
-
valid: boolean;
|
|
143
|
-
totalEntries: number;
|
|
144
|
-
brokenIndex?: number;
|
|
145
|
-
reason?: string;
|
|
146
|
-
};
|
|
147
|
-
exportJsonl(): string;
|
|
148
|
-
private loadFromFile;
|
|
149
|
-
}
|
|
150
|
-
declare const globalAuditLogger: AuditLogger;
|
|
151
|
-
|
|
152
103
|
/** Single named entity detected by the NER scanner. */
|
|
153
104
|
interface NerEntity {
|
|
154
105
|
type: "person" | "place" | "organization";
|
|
@@ -563,4 +514,4 @@ declare class LiopServer {
|
|
|
563
514
|
private applyInMemoryBudget;
|
|
564
515
|
}
|
|
565
516
|
|
|
566
|
-
export { AUTH_DEFAULTS as A,
|
|
517
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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, d as createChannelCredentials, e as createServerCredentials } from './index-
|
|
2
|
+
import { L as LiopTlsOptions } from './index-DHdTB7B8.js';
|
|
3
|
+
export { C as CertInfo, a as CertManager, b as CertManagerOptions, c as LiopClient, d as createChannelCredentials, e as createServerCredentials } from './index-DHdTB7B8.js';
|
|
4
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-
|
|
6
|
-
import { A as AuthInfo } from './types-
|
|
7
|
-
export {
|
|
5
|
+
export { I as InMemoryRateLimiter, L as LiopHybridGateway, a as LiopMcpRouter, R as RateLimitStatus, b as RateLimiterOptions } from './hybrid-CTC9oYVp.js';
|
|
6
|
+
import { A as AuthInfo } from './types-CMYlWlX2.js';
|
|
7
|
+
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 LogEvent, r as LogInterceptor, s as MCP_LEGACY_SUPPORT_ENABLED, t as MCP_PROTOCOL_VERSION, u as MCP_PROTOCOL_VERSION_LEGACY, M as McpEra, b as McpRequest, v as McpRequestMeta, c as McpResponse, P as Prompt, w as PromptSchema, R as Resource, x as ResourceSchema, S as ServerInfo, T as Tool, y as ToolSchema, z as computeEntryHash, B as executeGatewayInterceptor, E as globalAuditLogger } from './types-CMYlWlX2.js';
|
|
8
8
|
export { L as LiopManifest, a as MeshNode, M as MeshNodeConfig } from './node-B0b2vUFS.js';
|
|
9
9
|
export { SWARM_KEY_BYTE_LENGTH, createSwarmKey, deserializeSwarmKey, loadSwarmKey, parseSwarmKey, saveSwarmKey, serializeSwarmKey } from './mesh.js';
|
|
10
10
|
import * as grpc from '@grpc/grpc-js';
|
|
11
|
-
export { A as AUTH_DEFAULTS, b as AggregationPolicy, c as
|
|
11
|
+
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-Dqn4dtZP.js';
|
|
12
12
|
import * as jose from 'jose';
|
|
13
13
|
import Provider from 'oidc-provider';
|
|
14
14
|
import '@modelcontextprotocol/sdk/server/mcp.js';
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
export { WasiSandbox, calculateAstInstructionFuel, getDefaultEnvironment } from './chunk-7BSCUYUE.js';
|
|
2
|
-
export { AesGcmWrapper, LiopClient, LiopRpcClient } from './chunk-
|
|
3
|
-
export { LiopMcpBridge, LiopStreamBridge } from './chunk-
|
|
4
|
-
export { GRPC_WEB_CONSTANTS, InMemoryRateLimiter, LiopHybridGateway, buildProtectedResourceMetadata, decodeFrames, dispatchGrpcWebRequest, encodeDataFrame, encodeTrailerFrame, executeGatewayInterceptor, isGrpcWebRequest } from './chunk-
|
|
5
|
-
export { RoutingTable, probeTopology } from './chunk-
|
|
6
|
-
export { TokenManager } from './chunk-
|
|
7
|
-
export { AUTH_DEFAULTS, AuditLogger, GENESIS_HASH, JwtValidator, LiopRpcServer, LiopServer, NerScanner, PII_PATTERNS, PII_PRESETS, PiiScanner, computeEntryHash, createOAuthServer, globalAuditLogger } from './chunk-
|
|
2
|
+
export { AesGcmWrapper, LiopClient, LiopRpcClient } from './chunk-KB7LNCVI.js';
|
|
3
|
+
export { LiopMcpBridge, LiopStreamBridge } from './chunk-OSJDFUBY.js';
|
|
4
|
+
export { GRPC_WEB_CONSTANTS, InMemoryRateLimiter, LiopHybridGateway, buildProtectedResourceMetadata, decodeFrames, dispatchGrpcWebRequest, encodeDataFrame, encodeTrailerFrame, executeGatewayInterceptor, isGrpcWebRequest } from './chunk-TDTGUVLB.js';
|
|
5
|
+
export { RoutingTable, probeTopology } from './chunk-HWUCX2II.js';
|
|
6
|
+
export { TokenManager } from './chunk-VRZ3UIYA.js';
|
|
7
|
+
export { AUTH_DEFAULTS, AuditLogger, GENESIS_HASH, JwtValidator, LiopRpcServer, LiopServer, NerScanner, PII_PATTERNS, PII_PRESETS, PiiScanner, computeEntryHash, createOAuthServer, globalAuditLogger } from './chunk-6CPRIMCD.js';
|
|
8
8
|
export { sanitizeOutput } from './chunk-Y62GORQF.js';
|
|
9
|
-
export { LiopMcpRouter } from './chunk-
|
|
10
|
-
export { HeuristicTokenEstimator, LiopOTelBridge, RealTokenEstimator, TokenTelemetryEngine, createSyncTokenEstimator, createTokenEstimator } from './chunk-
|
|
11
|
-
import './chunk-
|
|
9
|
+
export { LiopMcpRouter } from './chunk-JPN5456V.js';
|
|
10
|
+
export { HeuristicTokenEstimator, LiopOTelBridge, RealTokenEstimator, TokenTelemetryEngine, createSyncTokenEstimator, createTokenEstimator } from './chunk-UAUBVKMK.js';
|
|
11
|
+
import './chunk-RWBFGRF7.js';
|
|
12
12
|
import './chunk-IK7CGWAZ.js';
|
|
13
13
|
export { Kyber768Wrapper } from './chunk-7PITYWOV.js';
|
|
14
14
|
export { DILITHIUM65_CONSTANTS, Dilithium65Wrapper, LIOP_SCOPES, authorizeRequest } from './chunk-VH4K4U45.js';
|
|
15
|
-
export { GRPC_CHANNEL_OPTIONS, createChannelCredentials, createServerCredentials } from './chunk-
|
|
15
|
+
export { GRPC_CHANNEL_OPTIONS, createChannelCredentials, createServerCredentials } from './chunk-COISHJK5.js';
|
|
16
16
|
export { Counter, Gauge, Histogram, MetricsRegistry, egressBlocksTotal, fuelConsumed, manifestCacheSize, meshPeersConnected, operationDurationMs, pqcHandshakeDurationMs, pqcHandshakesTotal, protocolMetrics, tokensInputTotal, tokensOutputTotal, tokensSavedTotal, toolCallErrorsTotal, toolCallsTotal, wireEgressBytesTotal, wireSavedBytesTotal, zkVerificationDurationMs, zkVerificationsTotal } from './chunk-PAICJCKJ.js';
|
|
17
|
-
export { MCP_LEGACY_SUPPORT_ENABLED, MCP_PROTOCOL_VERSION, MCP_PROTOCOL_VERSION_LEGACY, PromptSchema, ResourceSchema, ToolSchema } from './chunk-
|
|
17
|
+
export { MCP_LEGACY_SUPPORT_ENABLED, MCP_PROTOCOL_VERSION, MCP_PROTOCOL_VERSION_LEGACY, PromptSchema, ResourceSchema, ToolSchema } from './chunk-2KSO3W4A.js';
|
|
18
18
|
export { SWARM_KEY_BYTE_LENGTH, createSwarmKey, deserializeSwarmKey, loadSwarmKey, parseSwarmKey, saveSwarmKey, serializeSwarmKey } from './chunk-ZP3VVXOI.js';
|
|
19
|
-
export { MeshNode } from './chunk-
|
|
20
|
-
import { log } from './chunk-
|
|
19
|
+
export { MeshNode } from './chunk-QJIXNZTL.js';
|
|
20
|
+
import { log } from './chunk-LIBI3HMN.js';
|
|
21
21
|
import * as crypto from 'crypto';
|
|
22
22
|
import { EventEmitter } from 'events';
|
|
23
23
|
import * as fs from 'fs';
|
package/dist/mesh.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './chunk-FTF6AMF6.js';
|
|
2
2
|
export { SWARM_KEY_BYTE_LENGTH, createSwarmKey, deserializeSwarmKey, loadSwarmKey, parseSwarmKey, saveSwarmKey, serializeSwarmKey } from './chunk-ZP3VVXOI.js';
|
|
3
|
-
export { MeshNode } from './chunk-
|
|
4
|
-
import './chunk-
|
|
3
|
+
export { MeshNode } from './chunk-QJIXNZTL.js';
|
|
4
|
+
import './chunk-LIBI3HMN.js';
|
|
5
5
|
//# sourceMappingURL=mesh.js.map
|
|
6
6
|
//# sourceMappingURL=mesh.js.map
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { b as AggregationPolicy, L as LiopServer, a as LiopServerOptions,
|
|
1
|
+
export { b as AggregationPolicy, L as LiopServer, a as LiopServerOptions, e as LogicExecutionPolicy, N as NerScanner, 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-Dqn4dtZP.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import './node-B0b2vUFS.js';
|
|
4
|
-
import './types-
|
|
4
|
+
import './types-CMYlWlX2.js';
|
|
5
5
|
import 'jose';
|
package/dist/server.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { LiopServer, NerScanner, PII_PATTERNS, PII_PRESETS, PiiScanner } from './chunk-
|
|
1
|
+
export { LiopServer, NerScanner, PII_PATTERNS, PII_PRESETS, PiiScanner } from './chunk-6CPRIMCD.js';
|
|
2
2
|
export { sanitizeOutput } from './chunk-Y62GORQF.js';
|
|
3
3
|
import './chunk-VH4K4U45.js';
|
|
4
|
-
import './chunk-
|
|
4
|
+
import './chunk-COISHJK5.js';
|
|
5
5
|
import './chunk-PAICJCKJ.js';
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
6
|
+
import './chunk-QJIXNZTL.js';
|
|
7
|
+
import './chunk-LIBI3HMN.js';
|
|
8
8
|
//# sourceMappingURL=server.js.map
|
|
9
9
|
//# sourceMappingURL=server.js.map
|
|
@@ -1,6 +1,80 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as jose from 'jose';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Technology-agnostic cryptographic audit interceptor.
|
|
6
|
+
*
|
|
7
|
+
* Fires asynchronously (fire-and-forget) AFTER each AuditEntry
|
|
8
|
+
* has been sealed (hash computed, chain linked, and optionally
|
|
9
|
+
* persisted to JSONL). The interceptor receives a frozen deep-clone
|
|
10
|
+
* of the completed AuditEntry — mutations cannot tamper with the
|
|
11
|
+
* hash chain.
|
|
12
|
+
*
|
|
13
|
+
* Use cases: forward audit entries to TypeSafe Jev for threat
|
|
14
|
+
* pattern detection, stream to SOC 2 SIEM aggregators, trigger
|
|
15
|
+
* PagerDuty alerts on BLOCKED_EGRESS/POLICY_VIOLATION statuses,
|
|
16
|
+
* or feed into compliance dashboards.
|
|
17
|
+
*/
|
|
18
|
+
type AuditInterceptor = (entry: Readonly<AuditEntry>) => void | Promise<void>;
|
|
19
|
+
|
|
20
|
+
type AuditStatus = "SUCCESS" | "BLOCKED_EGRESS" | "ERROR" | "POLICY_VIOLATION";
|
|
21
|
+
interface AuditEntry {
|
|
22
|
+
id: string;
|
|
23
|
+
timestamp: string;
|
|
24
|
+
traceId: string;
|
|
25
|
+
agentDid: string;
|
|
26
|
+
peerId: string;
|
|
27
|
+
toolName: string;
|
|
28
|
+
datasetHash: string;
|
|
29
|
+
fuelConsumed: number;
|
|
30
|
+
outputHash: string;
|
|
31
|
+
zkReceiptSig: string;
|
|
32
|
+
status: AuditStatus;
|
|
33
|
+
prevEntryHash: string;
|
|
34
|
+
entryHash: string;
|
|
35
|
+
}
|
|
36
|
+
interface AuditRecordParams {
|
|
37
|
+
timestamp?: string;
|
|
38
|
+
traceId?: string;
|
|
39
|
+
agentDid: string;
|
|
40
|
+
peerId: string;
|
|
41
|
+
toolName: string;
|
|
42
|
+
datasetHash?: string;
|
|
43
|
+
fuelConsumed: number;
|
|
44
|
+
outputHash?: string;
|
|
45
|
+
zkReceiptSig?: string;
|
|
46
|
+
status: AuditStatus;
|
|
47
|
+
}
|
|
48
|
+
declare const GENESIS_HASH: string;
|
|
49
|
+
declare function computeEntryHash(entryWithoutHash: Omit<AuditEntry, "entryHash">): string;
|
|
50
|
+
declare class AuditLogger {
|
|
51
|
+
private entries;
|
|
52
|
+
private lastEntryHash;
|
|
53
|
+
private filePath?;
|
|
54
|
+
private interceptor?;
|
|
55
|
+
constructor(filePath?: string);
|
|
56
|
+
/**
|
|
57
|
+
* Registers a technology-agnostic audit interceptor.
|
|
58
|
+
* The interceptor fires AFTER the entry is sealed (hash computed)
|
|
59
|
+
* and appended to the chain. It receives a frozen deep-clone
|
|
60
|
+
* that cannot tamper with the hash chain.
|
|
61
|
+
* Pass `undefined` to disable interception (zero overhead).
|
|
62
|
+
*/
|
|
63
|
+
setInterceptor(interceptor: AuditInterceptor | undefined): void;
|
|
64
|
+
recordExecution(params: AuditRecordParams): AuditEntry;
|
|
65
|
+
getEntries(): readonly AuditEntry[];
|
|
66
|
+
getEntryCount(): number;
|
|
67
|
+
verifyIntegrity(): {
|
|
68
|
+
valid: boolean;
|
|
69
|
+
totalEntries: number;
|
|
70
|
+
brokenIndex?: number;
|
|
71
|
+
reason?: string;
|
|
72
|
+
};
|
|
73
|
+
exportJsonl(): string;
|
|
74
|
+
private loadFromFile;
|
|
75
|
+
}
|
|
76
|
+
declare const globalAuditLogger: AuditLogger;
|
|
77
|
+
|
|
4
78
|
/**
|
|
5
79
|
* LIOP JWT Validator — Token Verification Engine
|
|
6
80
|
*
|
|
@@ -156,6 +230,36 @@ interface GatewayInterceptorOptions {
|
|
|
156
230
|
*/
|
|
157
231
|
declare function executeGatewayInterceptor(request: McpRequest, context: Omit<GatewayInterceptorContext, "signal">, options: Required<Pick<GatewayInterceptorOptions, "interceptor">> & GatewayInterceptorOptions): Promise<GatewayAdmissionResult>;
|
|
158
232
|
|
|
233
|
+
type LogLevel = "silent" | "error" | "warn" | "info" | "debug";
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Structured snapshot of an operational log event.
|
|
237
|
+
* Frozen copy — mutations have no effect on the logger.
|
|
238
|
+
*/
|
|
239
|
+
interface LogEvent {
|
|
240
|
+
/** ISO 8601 timestamp of the log emission. */
|
|
241
|
+
timestamp: string;
|
|
242
|
+
/** Severity level that triggered this event. */
|
|
243
|
+
level: LogLevel;
|
|
244
|
+
/** Formatted log message (already interpolated by LiopLogger). */
|
|
245
|
+
message: string;
|
|
246
|
+
/** Additional variadic arguments passed to the log method. */
|
|
247
|
+
args: readonly unknown[];
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Technology-agnostic operational log interceptor.
|
|
251
|
+
*
|
|
252
|
+
* Fires asynchronously (fire-and-forget) after each log emission
|
|
253
|
+
* that passes the current level filter. The interceptor receives
|
|
254
|
+
* a frozen snapshot of the log event. Errors thrown by the
|
|
255
|
+
* interceptor are caught silently and never propagate to the caller.
|
|
256
|
+
*
|
|
257
|
+
* Use cases: forward logs to TypeSafe Jev for anomaly detection,
|
|
258
|
+
* stream to a SIEM (Splunk, Datadog), aggregate in NotebookLM,
|
|
259
|
+
* or persist to a custom observability backend.
|
|
260
|
+
*/
|
|
261
|
+
type LogInterceptor = (event: Readonly<LogEvent>) => void | Promise<void>;
|
|
262
|
+
|
|
159
263
|
/**
|
|
160
264
|
* Protocol Version Identifiers
|
|
161
265
|
*/
|
|
@@ -312,4 +416,4 @@ interface McpResponse {
|
|
|
312
416
|
};
|
|
313
417
|
}
|
|
314
418
|
|
|
315
|
-
export { type AuthInfo as A, type CallToolRequest as C, type DiscoverResult as D, type GatewayInterceptorOptions as G, type InputRequest as I, JwtValidator as J, type McpEra as M, type Prompt as P, type Resource as R, type ServerInfo as S, type Tool as T, type CallToolResult as a, type McpRequest as b, type McpResponse as c, type GetPromptRequest as
|
|
419
|
+
export { type AuthInfo as A, executeGatewayInterceptor as B, type CallToolRequest as C, type DiscoverResult as D, globalAuditLogger as E, type GatewayInterceptorOptions as G, type InputRequest as I, JwtValidator as J, type LogEvent as L, type McpEra as M, type Prompt as P, type Resource as R, type ServerInfo as S, type Tool as T, type CallToolResult as a, type McpRequest as b, type McpResponse as c, AuditLogger as d, type GetPromptRequest as e, type GetPromptResult as f, type AuditEntry as g, type AuditInterceptor as h, type AuditRecordParams as i, type AuditStatus as j, type CacheableResult as k, GENESIS_HASH as l, type GatewayAdmissionResult as m, type GatewayInterceptor as n, type GatewayInterceptorContext as o, type InputRequiredResult as p, type InputResponse as q, type LogInterceptor as r, MCP_LEGACY_SUPPORT_ENABLED as s, MCP_PROTOCOL_VERSION as t, MCP_PROTOCOL_VERSION_LEGACY as u, type McpRequestMeta as v, PromptSchema as w, ResourceSchema as x, ToolSchema as y, computeEntryHash as z };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'zod';
|
|
2
|
-
export { A as AuthInfo,
|
|
2
|
+
export { h as AuditInterceptor, A as AuthInfo, k as CacheableResult, C as CallToolRequest, a as CallToolResult, D as DiscoverResult, 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, L as LogEvent, r as LogInterceptor, s as MCP_LEGACY_SUPPORT_ENABLED, t as MCP_PROTOCOL_VERSION, u as MCP_PROTOCOL_VERSION_LEGACY, M as McpEra, b as McpRequest, v as McpRequestMeta, c as McpResponse, P as Prompt, w as PromptSchema, R as Resource, x as ResourceSchema, S as ServerInfo, T as Tool, y as ToolSchema } from './types-CMYlWlX2.js';
|
|
3
3
|
import 'jose';
|
package/dist/types.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { MCP_LEGACY_SUPPORT_ENABLED, MCP_PROTOCOL_VERSION, MCP_PROTOCOL_VERSION_LEGACY, PromptSchema, ResourceSchema, ToolSchema } from './chunk-
|
|
1
|
+
export { MCP_LEGACY_SUPPORT_ENABLED, MCP_PROTOCOL_VERSION, MCP_PROTOCOL_VERSION_LEGACY, PromptSchema, ResourceSchema, ToolSchema } from './chunk-2KSO3W4A.js';
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
|
3
3
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"verifier-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"verifier-A7HX6KAJ.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nekzus/liop",
|
|
3
|
-
"version": "2.4.0-alpha.
|
|
3
|
+
"version": "2.4.0-alpha.14",
|
|
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",
|
package/dist/chunk-HA6YZ42O.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// src/utils/logger.ts
|
|
2
|
-
var LiopLogger = class _LiopLogger {
|
|
3
|
-
static instance;
|
|
4
|
-
level = "info";
|
|
5
|
-
constructor() {
|
|
6
|
-
this.setLevelFromEnv();
|
|
7
|
-
}
|
|
8
|
-
static getInstance() {
|
|
9
|
-
if (!_LiopLogger.instance) {
|
|
10
|
-
_LiopLogger.instance = new _LiopLogger();
|
|
11
|
-
}
|
|
12
|
-
return _LiopLogger.instance;
|
|
13
|
-
}
|
|
14
|
-
setLevelFromEnv() {
|
|
15
|
-
const envLevel = process.env.LIOP_LOG_LEVEL?.toLowerCase();
|
|
16
|
-
if (envLevel === "silent" || envLevel === "error" || envLevel === "warn" || envLevel === "info" || envLevel === "debug") {
|
|
17
|
-
this.level = envLevel;
|
|
18
|
-
} else {
|
|
19
|
-
this.level = "info";
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
setLevel(level) {
|
|
23
|
-
this.level = level;
|
|
24
|
-
}
|
|
25
|
-
shouldLog(targetLevel) {
|
|
26
|
-
const levels = {
|
|
27
|
-
silent: 0,
|
|
28
|
-
error: 1,
|
|
29
|
-
warn: 2,
|
|
30
|
-
info: 3,
|
|
31
|
-
debug: 4
|
|
32
|
-
};
|
|
33
|
-
return levels[this.level] >= levels[targetLevel];
|
|
34
|
-
}
|
|
35
|
-
formatMessage(level, message) {
|
|
36
|
-
const ts = (/* @__PURE__ */ new Date()).toISOString();
|
|
37
|
-
return `[${ts}] [${level}] ${message}`;
|
|
38
|
-
}
|
|
39
|
-
error(message, ...args) {
|
|
40
|
-
if (this.shouldLog("error")) {
|
|
41
|
-
console.error(this.formatMessage("ERROR", message), ...args);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
warn(message, ...args) {
|
|
45
|
-
if (this.shouldLog("warn")) {
|
|
46
|
-
console.error(this.formatMessage("WARN", message), ...args);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
info(message, ...args) {
|
|
50
|
-
if (this.shouldLog("info")) {
|
|
51
|
-
console.error(this.formatMessage("INFO", message), ...args);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
debug(message, ...args) {
|
|
55
|
-
if (this.shouldLog("debug")) {
|
|
56
|
-
console.error(this.formatMessage("DEBUG", message), ...args);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
var log = LiopLogger.getInstance();
|
|
61
|
-
|
|
62
|
-
export { log };
|
|
63
|
-
//# sourceMappingURL=chunk-HA6YZ42O.js.map
|
|
64
|
-
//# sourceMappingURL=chunk-HA6YZ42O.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/logger.ts"],"names":[],"mappings":";AAUO,IAAM,UAAA,GAAN,MAAM,WAAA,CAAW;AAAA,EACvB,OAAe,QAAA;AAAA,EACP,KAAA,GAAkB,MAAA;AAAA,EAElB,WAAA,GAAc;AACrB,IAAA,IAAA,CAAK,eAAA,EAAgB;AAAA,EACtB;AAAA,EAEA,OAAc,WAAA,GAA0B;AACvC,IAAA,IAAI,CAAC,YAAW,QAAA,EAAU;AACzB,MAAA,WAAA,CAAW,QAAA,GAAW,IAAI,WAAA,EAAW;AAAA,IACtC;AACA,IAAA,OAAO,WAAA,CAAW,QAAA;AAAA,EACnB;AAAA,EAEQ,eAAA,GAAkB;AACzB,IAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,GAAA,CAAI,cAAA,EAAgB,WAAA,EAAY;AACzD,IAAA,IACC,QAAA,KAAa,YACb,QAAA,KAAa,OAAA,IACb,aAAa,MAAA,IACb,QAAA,KAAa,MAAA,IACb,QAAA,KAAa,OAAA,EACZ;AACD,MAAA,IAAA,CAAK,KAAA,GAAQ,QAAA;AAAA,IACd,CAAA,MAAO;AAEN,MAAA,IAAA,CAAK,KAAA,GAAQ,MAAA;AAAA,IACd;AAAA,EACD;AAAA,EAEO,SAAS,KAAA,EAAiB;AAChC,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AAAA,EACd;AAAA,EAEQ,UAAU,WAAA,EAAgC;AACjD,IAAA,MAAM,MAAA,GAAmC;AAAA,MACxC,MAAA,EAAQ,CAAA;AAAA,MACR,KAAA,EAAO,CAAA;AAAA,MACP,IAAA,EAAM,CAAA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CAAA,EAAG,GAAG,IAAI,CAAA;AAAA,IAC5D;AAAA,EACD;AACD,CAAA;AAEO,IAAM,GAAA,GAAM,WAAW,WAAA","file":"chunk-HA6YZ42O.js","sourcesContent":["// Copyright 2026 Nekzus Solutions and contributors\n// SPDX-License-Identifier: Apache-2.0\n\nexport type LogLevel = \"silent\" | \"error\" | \"warn\" | \"info\" | \"debug\";\n\n/**\n * LiopLogger - Structured Logging Abstraction\n * Configurable via `process.env.LIOP_LOG_LEVEL`.\n * Emits strictly to stderr to comply with MCP stdio protocols.\n */\nexport class LiopLogger {\n\tprivate static instance: LiopLogger;\n\tprivate level: LogLevel = \"info\";\n\n\tprivate constructor() {\n\t\tthis.setLevelFromEnv();\n\t}\n\n\tpublic static getInstance(): LiopLogger {\n\t\tif (!LiopLogger.instance) {\n\t\t\tLiopLogger.instance = new LiopLogger();\n\t\t}\n\t\treturn LiopLogger.instance;\n\t}\n\n\tprivate setLevelFromEnv() {\n\t\tconst envLevel = process.env.LIOP_LOG_LEVEL?.toLowerCase();\n\t\tif (\n\t\t\tenvLevel === \"silent\" ||\n\t\t\tenvLevel === \"error\" ||\n\t\t\tenvLevel === \"warn\" ||\n\t\t\tenvLevel === \"info\" ||\n\t\t\tenvLevel === \"debug\"\n\t\t) {\n\t\t\tthis.level = envLevel as LogLevel;\n\t\t} else {\n\t\t\t// Default level: info\n\t\t\tthis.level = \"info\";\n\t\t}\n\t}\n\n\tpublic setLevel(level: LogLevel) {\n\t\tthis.level = level;\n\t}\n\n\tprivate shouldLog(targetLevel: LogLevel): boolean {\n\t\tconst levels: Record<LogLevel, number> = {\n\t\t\tsilent: 0,\n\t\t\terror: 1,\n\t\t\twarn: 2,\n\t\t\tinfo: 3,\n\t\t\tdebug: 4,\n\t\t};\n\t\treturn levels[this.level] >= levels[targetLevel];\n\t}\n\n\tprivate formatMessage(level: string, message: string): string {\n\t\tconst ts = new Date().toISOString();\n\t\treturn `[${ts}] [${level}] ${message}`;\n\t}\n\n\tpublic error(message: string, ...args: unknown[]) {\n\t\tif (this.shouldLog(\"error\")) {\n\t\t\tconsole.error(this.formatMessage(\"ERROR\", message), ...args);\n\t\t}\n\t}\n\n\tpublic warn(message: string, ...args: unknown[]) {\n\t\tif (this.shouldLog(\"warn\")) {\n\t\t\tconsole.error(this.formatMessage(\"WARN\", message), ...args);\n\t\t}\n\t}\n\n\tpublic info(message: string, ...args: unknown[]) {\n\t\tif (this.shouldLog(\"info\")) {\n\t\t\tconsole.error(this.formatMessage(\"INFO\", message), ...args);\n\t\t}\n\t}\n\n\tpublic debug(message: string, ...args: unknown[]) {\n\t\tif (this.shouldLog(\"debug\")) {\n\t\t\tconsole.error(this.formatMessage(\"DEBUG\", message), ...args);\n\t\t}\n\t}\n}\n\nexport const log = LiopLogger.getInstance();\n"]}
|