@nekzus/liop 2.4.0-alpha.23 → 2.4.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 +56 -19
- package/dist/bin/agent.js.map +1 -1
- package/dist/bridge.js +2 -2
- package/dist/{chunk-E2CFIWD6.js → chunk-2VQS2XRH.js} +3 -3
- package/dist/{chunk-E2CFIWD6.js.map → chunk-2VQS2XRH.js.map} +1 -1
- package/dist/{chunk-E7RSX476.js → chunk-53QKIQNF.js} +3 -3
- package/dist/{chunk-E7RSX476.js.map → chunk-53QKIQNF.js.map} +1 -1
- package/dist/{chunk-AMSFSS2I.js → chunk-IDTXJQBH.js} +16 -7
- package/dist/chunk-IDTXJQBH.js.map +1 -0
- package/dist/{chunk-KB3HUVMD.js → chunk-IHKKWXHJ.js} +24 -25
- package/dist/chunk-IHKKWXHJ.js.map +1 -0
- package/dist/{chunk-T2QDHVUD.js → chunk-JWFLXXZS.js} +3 -3
- package/dist/{chunk-T2QDHVUD.js.map → chunk-JWFLXXZS.js.map} +1 -1
- package/dist/{chunk-YLFNJQI2.js → chunk-KR5UZUEY.js} +24 -3
- package/dist/chunk-KR5UZUEY.js.map +1 -0
- package/dist/{chunk-PUDETPL4.js → chunk-V47P2AQR.js} +5 -3
- package/dist/chunk-V47P2AQR.js.map +1 -0
- package/dist/{chunk-3WKFZQ34.js → chunk-ZJGVKM7G.js} +4 -4
- package/dist/{chunk-3WKFZQ34.js.map → chunk-ZJGVKM7G.js.map} +1 -1
- package/dist/client.d.ts +2 -2
- package/dist/client.js +3 -3
- package/dist/gateway.d.ts +2 -2
- package/dist/gateway.js +3 -3
- package/dist/{hybrid-B7EjCj3q.d.ts → hybrid-Cb95yJFg.d.ts} +1 -1
- package/dist/{index-DDwiS7tf.d.ts → index-DtovobWb.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +9 -9
- package/dist/mesh.js +1 -1
- package/dist/server.js +2 -2
- package/dist/types.js +1 -1
- package/dist/{verifier-DTn1LXDU.d.ts → verifier-EgKmGrh7.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-AMSFSS2I.js.map +0 -1
- package/dist/chunk-KB3HUVMD.js.map +0 -1
- package/dist/chunk-PUDETPL4.js.map +0 -1
- package/dist/chunk-YLFNJQI2.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/runtime/routing-table.ts","../src/runtime/topology-probe.ts"],"names":[],"mappings":";;;AAoCO,IAAM,YAAA,GAAN,MAAM,aAAA,CAAa;AAAA,EACjB,MAAA,uBAAa,GAAA,EAAuB;AAAA,EAC5C,OAAwB,YAAA,GAAe,CAAA;AAAA;AAAA;AAAA;AAAA,EAKhC,oBAAA,CACN,KAAA,EACA,WAAA,EACA,YAAA,GAAe,IAAA,EACR;AACP,IAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACzB,MAAA,MAAM,QAAA,GAAW,IAAA,CAAK,MAAA,CAAO,GAAA,CAAI,KAAK,IAAI,CAAA;AAC1C,MAAA,IAAA,CAAK,MAAA,CAAO,GAAA,CAAI,IAAA,CAAK,IAAA,EAAM;AAAA,QAC1B,MAAM,IAAA,CAAK,IAAA;AAAA,QACX,QAAA,EAAU,cAAA;AAAA,QACV,QAAA,EAAU,WAAA;AAAA,QACV,WAAA,EAAa,IAAA,CAAK,WAAA,IAAe,QAAA,EAAU,WAAA;AAAA,QAC3C,WAAA,EAAa,IAAA,CAAK,WAAA,IAAe,QAAA,EAAU,WAAA;AAAA,QAC3C,SAAA,EAAW,UAAU,SAAA,IAAa,CAAA;AAAA,QAClC,SAAA,EAAW,CAAA;AAAA,QACX,WAAA,EAAa,QAAA,EAAU,WAAA,IAAe,IAAA,CAAK,GAAA,EAAI;AAAA,QAC/C;AAAA,OACA,CAAA;AAAA,IACF;AACA,IAAA,GAAA,CAAI,IAAA;AAAA,MACH,CAAA,0BAAA,EAA6B,KAAA,CAAM,M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"chunk-PUDETPL4.js","sourcesContent":["// Copyright 2026 Nekzus Solutions and contributors\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * LIOP Routing Table — Per-Tool Hybrid Routing & Resilience\n *\n * Maintains deterministic per-tool routes across heterogeneous transports:\n * - \"http-gateway\": Route through Border LIO Gateway or reverse proxy via HTTP/JSON-RPC.\n * - \"p2p-grpc\": Route directly to sovereign node via libp2p + gRPC (Kyber768/ZK-Receipt).\n * - \"local\": Handled in-process (e.g. LiopMeshStatus, diagnostic probes).\n *\n * Implements per-route latency tracking, failure backoff, and circuit breaking.\n */\n\nimport { log } from \"../utils/logger.js\";\n\nexport type TransportProvider = \"http-gateway\" | \"p2p-grpc\" | \"local\";\n\nexport interface ToolDefinition {\n\tname: string;\n\tdescription?: string;\n\tinputSchema?: Record<string, unknown>;\n}\n\nexport interface ToolRoute {\n\tname: string;\n\tprovider: TransportProvider;\n\tendpoint: string;\n\tdescription?: string;\n\tinputSchema?: Record<string, unknown>;\n\tlatencyMs: number;\n\tfailCount: number;\n\tlastSuccess: number;\n\tauthRequired?: boolean;\n}\n\nexport class RoutingTable {\n\tprivate routes = new Map<string, ToolRoute>();\n\tprivate static readonly MAX_FAILURES = 5;\n\n\t/**\n\t * Registers or updates a collection of tools exposed via an HTTP Gateway.\n\t */\n\tpublic registerGatewayTools(\n\t\ttools: ToolDefinition[],\n\t\tmcpEndpoint: string,\n\t\tauthRequired = true,\n\t): void {\n\t\tfor (const tool of tools) {\n\t\t\tconst existing = this.routes.get(tool.name);\n\t\t\tthis.routes.set(tool.name, {\n\t\t\t\tname: tool.name,\n\t\t\t\tprovider: \"http-gateway\",\n\t\t\t\tendpoint: mcpEndpoint,\n\t\t\t\tdescription: tool.description ?? existing?.description,\n\t\t\t\tinputSchema: tool.inputSchema ?? existing?.inputSchema,\n\t\t\t\tlatencyMs: existing?.latencyMs ?? 0,\n\t\t\t\tfailCount: 0,\n\t\t\t\tlastSuccess: existing?.lastSuccess ?? Date.now(),\n\t\t\t\tauthRequired,\n\t\t\t});\n\t\t}\n\t\tlog.info(\n\t\t\t`[RoutingTable] Registered ${tools.length} tool(s) via HTTP Gateway (${mcpEndpoint})`,\n\t\t);\n\t}\n\n\t/**\n\t * Registers tools discovered directly over the P2P Mesh (gRPC).\n\t */\n\tpublic registerMeshTools(\n\t\ttools: ToolDefinition[],\n\t\tgrpcTarget: string,\n\t\tauthRequired = false,\n\t): void {\n\t\tfor (const tool of tools) {\n\t\t\tconst existing = this.routes.get(tool.name);\n\t\t\t// Do not overwrite healthy gateway routes unless explicitly preferred\n\t\t\tif (\n\t\t\t\texisting &&\n\t\t\t\texisting.provider === \"http-gateway\" &&\n\t\t\t\texisting.failCount === 0\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthis.routes.set(tool.name, {\n\t\t\t\tname: tool.name,\n\t\t\t\tprovider: \"p2p-grpc\",\n\t\t\t\tendpoint: grpcTarget,\n\t\t\t\tdescription: tool.description ?? existing?.description,\n\t\t\t\tinputSchema: tool.inputSchema ?? existing?.inputSchema,\n\t\t\t\tlatencyMs: existing?.latencyMs ?? 0,\n\t\t\t\tfailCount: 0,\n\t\t\t\tlastSuccess: existing?.lastSuccess ?? Date.now(),\n\t\t\t\tauthRequired,\n\t\t\t});\n\t\t}\n\t\tlog.info(\n\t\t\t`[RoutingTable] Registered ${tools.length} tool(s) via P2P Mesh gRPC (${grpcTarget})`,\n\t\t);\n\t}\n\n\t/**\n\t * Registers an in-process local tool (e.g. LiopMeshStatus).\n\t */\n\tpublic registerLocalTool(tool: ToolDefinition): void {\n\t\tthis.routes.set(tool.name, {\n\t\t\tname: tool.name,\n\t\t\tprovider: \"local\",\n\t\t\tendpoint: \"in-process\",\n\t\t\tdescription: tool.description,\n\t\t\tinputSchema: tool.inputSchema,\n\t\t\tlatencyMs: 0,\n\t\t\tfailCount: 0,\n\t\t\tlastSuccess: Date.now(),\n\t\t\tauthRequired: false,\n\t\t});\n\t}\n\n\t/**\n\t * Resolves the optimal route for a specific tool.\n\t */\n\tpublic resolve(toolName: string): ToolRoute | undefined {\n\t\tconst route = this.routes.get(toolName);\n\t\tif (!route) return undefined;\n\n\t\t// If circuit is tripped (excessive failures), still return route but log warning\n\t\tif (route.failCount >= RoutingTable.MAX_FAILURES) {\n\t\t\tlog.warn(\n\t\t\t\t`[RoutingTable] Tool '${toolName}' route has tripped circuit breaker (${route.failCount} consecutive failures).`,\n\t\t\t);\n\t\t}\n\n\t\treturn route;\n\t}\n\n\t/**\n\t * Records a successful invocation on a route, resetting failures and updating latency.\n\t */\n\tpublic recordSuccess(toolName: string, latencyMs: number): void {\n\t\tconst route = this.routes.get(toolName);\n\t\tif (route) {\n\t\t\troute.failCount = 0;\n\t\t\troute.latencyMs = latencyMs;\n\t\t\troute.lastSuccess = Date.now();\n\t\t}\n\t}\n\n\t/**\n\t * Records a failed invocation on a route.\n\t */\n\tpublic recordFailure(toolName: string): void {\n\t\tconst route = this.routes.get(toolName);\n\t\tif (route) {\n\t\t\troute.failCount += 1;\n\t\t\tlog.warn(\n\t\t\t\t`[RoutingTable] Failure recorded for tool '${toolName}' (failCount: ${route.failCount})`,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Lists all registered tools in sorted format for tools/list.\n\t */\n\tpublic getAllToolDefinitions(): ToolDefinition[] {\n\t\tconst list: ToolDefinition[] = [];\n\t\tfor (const route of this.routes.values()) {\n\t\t\tlist.push({\n\t\t\t\tname: route.name,\n\t\t\t\tdescription: route.description,\n\t\t\t\tinputSchema: route.inputSchema,\n\t\t\t});\n\t\t}\n\t\treturn list.sort((a, b) => a.name.localeCompare(b.name));\n\t}\n\n\tpublic getRoute(toolName: string): ToolRoute | undefined {\n\t\treturn this.routes.get(toolName);\n\t}\n\n\tpublic size(): number {\n\t\treturn this.routes.size;\n\t}\n\n\tpublic clear(): void {\n\t\tthis.routes.clear();\n\t}\n}\n","// Copyright 2026 Nekzus Solutions and contributors\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * LIOP Topology Probe — RFC 9728 PRM Chain & Adaptive Network Detection\n *\n * Implements single-URL auto-discovery of multi-tier mesh environments:\n * 1. Probes RFC 9728 Protected Resource Metadata (PRM) or /health endpoint.\n * 2. Chains discovery to obtain OAuth 2.1 authorization server endpoints.\n * 3. Identifies whether the node should operate in \"gateway\", \"mesh\", or \"hybrid\" mode.\n *\n * Standards: RFC 9728, RFC 8414, RFC 8707, NIST SP 800-207\n */\n\nimport { log } from \"../utils/logger.js\";\n\nexport interface GatewayTopologyInfo {\n\tbaseUrl: string;\n\tmcpEndpoint: string;\n\thealthEndpoint: string;\n\ttokenEndpoint: string;\n\tissuer: string;\n\taudience: string;\n\tscopes: string[];\n\ttools: string[];\n\ttier: number;\n}\n\nexport interface MeshTopologyInfo {\n\tbootstrapNodes: string[];\n\tidentityPath?: string;\n}\n\nexport interface TopologyProbeResult {\n\tmode: \"gateway\" | \"mesh\" | \"hybrid\";\n\tgateway?: GatewayTopologyInfo;\n\tmesh?: MeshTopologyInfo;\n}\n\nexport interface TopologyProbeOptions {\n\tblgUrl?: string;\n\tnexusUrl?: string;\n\tclientId?: string;\n\tclientSecret?: string;\n\taudience?: string;\n\tstaticToken?: string;\n\tbootstrapNodes?: string[];\n\tidentityPath?: string;\n\tautoProbeLocal?: boolean;\n}\n\n/**\n * Executes the RFC 9728 PRM chain and health probe on a candidate Gateway URL.\n */\nasync function probeGatewayUrl(\n\tcandidateUrl: string,\n\toptions: TopologyProbeOptions,\n): Promise<GatewayTopologyInfo | null> {\n\tconst trimmedUrl = candidateUrl.replace(/\\/+$/, \"\");\n\tconst healthUrl = `${trimmedUrl}/health`;\n\n\ttry {\n\t\tlog.info(`[TopologyProbe] Probing candidate Gateway at: ${healthUrl}`);\n\t\tconst healthRes = await fetch(healthUrl, {\n\t\t\theaders: { Accept: \"application/json\" },\n\t\t\tsignal: AbortSignal.timeout(3000),\n\t\t});\n\n\t\tif (!healthRes.ok) {\n\t\t\tlog.info(\n\t\t\t\t`[TopologyProbe] Probe failed at ${healthUrl} [HTTP ${healthRes.status}]`,\n\t\t\t);\n\t\t\treturn null;\n\t\t}\n\n\t\tconst healthData = (await healthRes.json()) as {\n\t\t\tstatus?: string;\n\t\t\ttools?: string[];\n\t\t\tauth?: {\n\t\t\t\tissuer?: string;\n\t\t\t\ttoken_endpoint?: string;\n\t\t\t\tjwks_uri?: string;\n\t\t\t};\n\t\t\ttopology?: {\n\t\t\t\ttier?: number;\n\t\t\t};\n\t\t};\n\n\t\tif (healthData.status !== \"healthy\") {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Discover OAuth metadata via PRM (RFC 9728)\n\t\tlet issuer = healthData.auth?.issuer || \"\";\n\t\tlet tokenEndpoint = healthData.auth?.token_endpoint || \"\";\n\t\tlet audience = options.audience || \"urn:liop:mesh:api\";\n\t\tlet scopes: string[] = [\n\t\t\t\"liop:tools:list\",\n\t\t\t\"liop:tools:call\",\n\t\t\t\"liop:resources:read\",\n\t\t\t\"liop:schema:read\",\n\t\t\t\"liop:mesh:query\",\n\t\t];\n\n\t\ttry {\n\t\t\tconst prmUrl = `${trimmedUrl}/.well-known/oauth-protected-resource`;\n\t\t\tconst prmRes = await fetch(prmUrl, {\n\t\t\t\theaders: { Accept: \"application/json\" },\n\t\t\t\tsignal: AbortSignal.timeout(2000),\n\t\t\t});\n\t\t\tif (prmRes.ok) {\n\t\t\t\tconst prmData = (await prmRes.json()) as {\n\t\t\t\t\tresource?: string;\n\t\t\t\t\tauthorization_servers?: string[];\n\t\t\t\t\tscopes_supported?: string[];\n\t\t\t\t};\n\t\t\t\tif (prmData.resource) audience = prmData.resource;\n\t\t\t\tif (prmData.authorization_servers?.length) {\n\t\t\t\t\tissuer = prmData.authorization_servers[0];\n\t\t\t\t}\n\t\t\t\tif (prmData.scopes_supported?.length) {\n\t\t\t\t\tscopes = prmData.scopes_supported;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Non-fatal if PRM endpoint is not present\n\t\t}\n\n\t\t// If token endpoint is not explicitly given, resolve from issuer\n\t\tif (!tokenEndpoint && issuer) {\n\t\t\tconst baseIssuer = issuer.endsWith(\"/oidc\") ? issuer : `${issuer}/oidc`;\n\t\t\ttokenEndpoint = `${baseIssuer}/token`;\n\t\t}\n\n\t\t// Normalize tokenEndpoint for Docker-to-Host bridge environments\n\t\tif (tokenEndpoint) {\n\t\t\ttry {\n\t\t\t\tconst parsedEndpoint = new URL(tokenEndpoint);\n\t\t\t\tif (options.nexusUrl) {\n\t\t\t\t\tconst nexusBase = options.nexusUrl.replace(/\\/+$/, \"\");\n\t\t\t\t\tconst nexusHost = new URL(nexusBase).host;\n\t\t\t\t\tparsedEndpoint.host = nexusHost;\n\t\t\t\t\ttokenEndpoint = parsedEndpoint.toString();\n\t\t\t\t} else if (\n\t\t\t\t\t(parsedEndpoint.hostname === \"nexus\" ||\n\t\t\t\t\t\tparsedEndpoint.hostname === \"nexus-prod\" ||\n\t\t\t\t\t\tparsedEndpoint.hostname.startsWith(\"172.\")) &&\n\t\t\t\t\ttrimmedUrl.includes(\"127.0.0.1\")\n\t\t\t\t) {\n\t\t\t\t\tparsedEndpoint.host = \"127.0.0.1:15000\";\n\t\t\t\t\ttokenEndpoint = parsedEndpoint.toString();\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t/* keep original tokenEndpoint */\n\t\t\t}\n\t\t}\n\n\t\tlog.info(\n\t\t\t`[TopologyProbe] ✅ Verified Gateway at ${trimmedUrl} (Tools: ${healthData.tools?.length ?? 0}, Tier: ${healthData.topology?.tier ?? 2})`,\n\t\t);\n\n\t\treturn {\n\t\t\tbaseUrl: trimmedUrl,\n\t\t\tmcpEndpoint: `${trimmedUrl}/mcp`,\n\t\t\thealthEndpoint: `${trimmedUrl}/health`,\n\t\t\ttokenEndpoint,\n\t\t\tissuer,\n\t\t\taudience,\n\t\t\tscopes,\n\t\t\ttools: healthData.tools || [],\n\t\t\ttier: healthData.topology?.tier ?? 2,\n\t\t};\n\t} catch (err) {\n\t\tlog.info(\n\t\t\t`[TopologyProbe] Gateway probe unreachable at ${trimmedUrl}: ${err instanceof Error ? err.message : String(err)}`,\n\t\t);\n\t\treturn null;\n\t}\n}\n\n/**\n * Probes the runtime environment and determines the optimal architecture mode.\n */\nexport async function probeTopology(\n\toptions: TopologyProbeOptions = {},\n): Promise<TopologyProbeResult> {\n\tlog.info(\"[TopologyProbe] Starting adaptive network topology discovery...\");\n\n\tlet gatewayInfo: GatewayTopologyInfo | null = null;\n\n\t// 1. Check explicit Border LIO Gateway URL (Highest priority)\n\tif (options.blgUrl) {\n\t\tgatewayInfo = await probeGatewayUrl(options.blgUrl, options);\n\t}\n\n\t// 2. Auto-probing known local infrastructure ports if enabled/unspecified\n\tif (!gatewayInfo && (options.autoProbeLocal ?? true)) {\n\t\tconst candidateUrls = [\n\t\t\t\"http://127.0.0.1:15018\", // Production BLG port\n\t\t\t\"http://127.0.0.1:15000\", // Production Nexus port\n\t\t\t\"http://127.0.0.1:13000\", // Demo Nexus port\n\t\t];\n\n\t\tfor (const url of candidateUrls) {\n\t\t\t// Skip if already probed\n\t\t\tif (options.blgUrl && url.includes(new URL(options.blgUrl).port))\n\t\t\t\tcontinue;\n\n\t\t\tgatewayInfo = await probeGatewayUrl(url, options);\n\t\t\tif (gatewayInfo) break;\n\t\t}\n\t}\n\n\t// 3. Evaluate P2P Mesh connectivity\n\tconst bootstrapNodes = options.bootstrapNodes || [];\n\tconst hasMeshBootstraps = bootstrapNodes.length > 0;\n\n\t// 4. Decide runtime mode\n\tif (gatewayInfo && hasMeshBootstraps) {\n\t\tlog.info(\n\t\t\t`[TopologyProbe] ⚡ Mode Determined: HYBRID (Gateway: ${gatewayInfo.baseUrl} + ${bootstrapNodes.length} P2P bootstraps)`,\n\t\t);\n\t\treturn {\n\t\t\tmode: \"hybrid\",\n\t\t\tgateway: gatewayInfo,\n\t\t\tmesh: {\n\t\t\t\tbootstrapNodes,\n\t\t\t\tidentityPath: options.identityPath,\n\t\t\t},\n\t\t};\n\t}\n\n\tif (gatewayInfo) {\n\t\tlog.info(\n\t\t\t`[TopologyProbe] 🚀 Mode Determined: GATEWAY (Zero-P2P overhead, direct to ${gatewayInfo.baseUrl})`,\n\t\t);\n\t\treturn {\n\t\t\tmode: \"gateway\",\n\t\t\tgateway: gatewayInfo,\n\t\t};\n\t}\n\n\tlog.info(\n\t\t`[TopologyProbe] 🌐 Mode Determined: MESH (Standard P2P DHT, Bootstraps: ${bootstrapNodes.length})`,\n\t);\n\treturn {\n\t\tmode: \"mesh\",\n\t\tmesh: {\n\t\t\tbootstrapNodes,\n\t\t\tidentityPath: options.identityPath,\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/gateway/mcp-compat.ts","../src/types.ts"],"names":[],"mappings":";;;;;AAiBO,IAAM,0BAAA,GAA6B;AAKnC,IAAM,2BAAA,GAA8B;AAKpC,SAAS,6BAAA,CACf,YACA,EAAA,EACc;AACd,EAAA,OAAO;AAAA,IACN,OAAA,EAAS,KAAA;AAAA,IACT,IAAI,EAAA,IAAM,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,MACP,eAAA,EAAiB,2BAAA;AAAA,MACjB,YAAA,EAAc;AAAA,QACb,KAAA,EAAO,EAAE,WAAA,EAAa,IAAA,EAAK;AAAA,QAC3B,SAAA,EAAW,EAAE,WAAA,EAAa,IAAA,EAAK;AAAA,QAC/B,OAAA,EAAS,EAAE,WAAA,EAAa,IAAA;AAAK,OAC9B;AAAA,MACA;AAAA;AACD,GACD;AACD;AAOO,SAAS,gBAAgB,OAAA,EAA8B;AAC7D,EAAA,IACC,OAAA,CAAQ,MAAA,KAAW,YAAA,IACnB,OAAA,CAAQ,WAAW,2BAAA,EAClB;AACD,IAAA,OAAO,IAAA;AAAA,EACR;AAEA,EAAA,MAAM,SAAS,OAAA,CAAQ,MAAA;AACvB,EAAA,MAAM,OAAO,MAAA,EAAQ,KAAA;AACrB,EAAA,MAAM,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E,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EACjC,WAAW,CAAA,CACT,KAAA;AAAA,IACA,EAAE,MAAA,CAAO;AAAA,MACR,IAAA,EAAM,EAAE,MAAA,EAAO;AAAA,MACf,WAAA,EAAa,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,MACjC,QAAA,EAAU,CAAA,CAAE,OAAA,EAAQ,CAAE,QAAA;AAAS,KAC/B;AAAA,IAED,QAAA;AACH,CAAC","file":"chunk-YLFNJQI2.js","sourcesContent":["// Copyright 2026 Nekzus Solutions and contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { McpRequest, McpResponse, ServerInfo } from \"../types.js\";\n\n/**\n * @mcp-legacy ENTIRE FILE — MCP 2025-era backward compatibility layer.\n * Remove this file when MCP v1 (2025-11-25) reaches EOL.\n *\n * SUNSET INSTRUCTION: Delete this file, then grep for \"@mcp-legacy\" in the\n * codebase to find and remove all remaining legacy seams.\n */\n\n/**\n * @mcp-legacy Master kill switch for MCP 2025-era backward compatibility.\n * Set to `false` when MCP v1 reaches End-of-Life (EOL) to disable all legacy seams.\n */\nexport const MCP_LEGACY_SUPPORT_ENABLED = true;\n\n/**\n * @mcp-legacy Legacy protocol version constant.\n */\nexport const MCP_PROTOCOL_VERSION_LEGACY = \"2025-11-25\" as const;\n\n/**\n * @mcp-legacy Build the legacy initialize handshake response.\n */\nexport function buildLegacyInitializeResponse(\n\tserverInfo: ServerInfo,\n\tid?: string | number | null,\n): McpResponse {\n\treturn {\n\t\tjsonrpc: \"2.0\",\n\t\tid: id ?? null,\n\t\tresult: {\n\t\t\tprotocolVersion: MCP_PROTOCOL_VERSION_LEGACY,\n\t\t\tcapabilities: {\n\t\t\t\ttools: { listChanged: true },\n\t\t\t\tresources: { listChanged: true },\n\t\t\t\tprompts: { listChanged: true },\n\t\t\t},\n\t\t\tserverInfo,\n\t\t},\n\t};\n}\n\n/**\n * @mcp-legacy Detect if a request is strictly from a 2025-era legacy client.\n * Legacy requests either invoke 'initialize', 'notifications/initialized',\n * or lack modern '_meta' protocol envelopes.\n */\nexport function isLegacyRequest(request: McpRequest): boolean {\n\tif (\n\t\trequest.method === \"initialize\" ||\n\t\trequest.method === \"notifications/initialized\"\n\t) {\n\t\treturn true;\n\t}\n\n\tconst params = request.params as Record<string, unknown> | undefined;\n\tconst meta = params?._meta as Record<string, unknown> | undefined;\n\tconst version = meta?.[\"io.modelcontextprotocol/protocolVersion\"];\n\n\tif (!version || version === MCP_PROTOCOL_VERSION_LEGACY) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\n/**\n * @mcp-legacy Wrap and strip modern-era fields (resultType, ttlMs, cacheScope, etc.)\n * from a response to ensure 100% wire-compatibility with strict 2025 MCP clients.\n */\nexport function adaptResponseForLegacyClient(\n\tresponse: McpResponse,\n): McpResponse {\n\tif (!response.result || typeof response.result !== \"object\") {\n\t\treturn response;\n\t}\n\n\tconst rawResult = { ...(response.result as Record<string, unknown>) };\n\n\t// Strip modern-only envelope tags\n\tdelete rawResult.resultType;\n\tdelete rawResult.ttlMs;\n\tdelete rawResult.cacheScope;\n\n\treturn {\n\t\t...response,\n\t\tresult: rawResult,\n\t};\n}\n","// Copyright 2026 Nekzus Solutions and contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { z } from \"zod\";\n\n/**\n * Protocol Version Identifiers\n */\nexport const MCP_PROTOCOL_VERSION = \"2026-07-28\" as const;\n\nexport {\n\tMCP_LEGACY_SUPPORT_ENABLED,\n\tMCP_PROTOCOL_VERSION_LEGACY,\n} from \"./gateway/mcp-compat.js\";\n\n/**\n * Protocol Era Classification\n */\nexport type McpEra = \"legacy\" | \"modern\";\n\n/**\n * Caching Hints for MCP 2026-07-28 Spec\n */\nexport interface CacheableResult {\n\tttlMs?: number;\n\tcacheScope?: \"public\" | \"private\";\n}\n\n/**\n * Multi-Round-Trip Requests (MRTR) Specification Types\n */\nexport interface InputRequest {\n\tid: string;\n\tmessage: string;\n\tschema?: Record<string, unknown>;\n}\n\nexport interface InputResponse {\n\tid: string;\n\tvalue: unknown;\n}\n\nexport interface InputRequiredResult {\n\tresultType: \"input_required\";\n\tinputRequests: InputRequest[];\n\trequestState?: string;\n}\n\n/**\n * Modern Envelope Metadata (_meta)\n */\nexport interface McpRequestMeta {\n\t\"io.modelcontextprotocol/protocolVersion\"?: string;\n\t\"io.modelcontextprotocol/clientInfo\"?: {\n\t\tname: string;\n\t\tversion: string;\n\t};\n\t\"io.modelcontextprotocol/clientCapabilities\"?: Record<string, unknown>;\n\t[key: string]: unknown;\n}\n\n/**\n * Base Protocol Types representing parity with Model Context Protocol\n */\n\nexport const ToolSchema = z.object({\n\tname: z.string(),\n\tdescription: z.string().optional(),\n\tinputSchema: z.record(z.string(), z.unknown()), // Represents a JSON Schema\n});\n\nexport type Tool = z.infer<typeof ToolSchema>;\n\nexport const ResourceSchema = z.object({\n\turi: z.string(),\n\tname: z.string(),\n\tdescription: z.string().optional(),\n\tmimeType: z.string().optional(),\n});\n\nexport type Resource = z.infer<typeof ResourceSchema>;\n\nexport const PromptSchema = z.object({\n\tname: z.string(),\n\tdescription: z.string().optional(),\n\targuments: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tname: z.string(),\n\t\t\t\tdescription: z.string().optional(),\n\t\t\t\trequired: z.boolean().optional(),\n\t\t\t}),\n\t\t)\n\t\t.optional(),\n});\n\nexport type Prompt = z.infer<typeof PromptSchema>;\n\nexport interface CallToolRequest {\n\tname: string;\n\targuments?: Record<string, unknown>;\n}\n\nexport interface CallToolResult {\n\tcontent: Array<{\n\t\ttype: \"text\" | \"image\" | \"resource\";\n\t\ttext?: string;\n\t\tdata?: string;\n\t\tmimeType?: string;\n\t\tresource?: {\n\t\t\turi: string;\n\t\t\ttext?: string;\n\t\t\tblob?: string;\n\t\t};\n\t}>;\n\tisError?: boolean;\n\tzkVerified?: boolean;\n\tzkProofType?: import(\"./security/zk.js\").ProofType;\n}\n\nexport interface GetPromptRequest {\n\tname: string;\n\targuments?: Record<string, string>;\n}\n\nexport interface GetPromptResult {\n\tdescription?: string;\n\tmessages: Array<{\n\t\trole: \"user\" | \"assistant\";\n\t\tcontent:\n\t\t\t| { type: \"text\"; text: string }\n\t\t\t| { type: \"image\"; data: string; mimeType: string }\n\t\t\t| {\n\t\t\t\t\ttype: \"resource\";\n\t\t\t\t\tresource: { uri: string; text?: string; blob?: string };\n\t\t\t };\n\t}>;\n}\n\nexport interface ServerInfo {\n\tname: string;\n\tversion: string;\n\tcapabilities?: {\n\t\tprompts?: { listChanged?: boolean };\n\t\tresources?: { subscribe?: boolean; listChanged?: boolean };\n\t\ttools?: { listChanged?: boolean };\n\t\t/** @mcp-legacy @deprecated Deprecated in MCP 2026-07-28 spec */\n\t\tlogging?: Record<string, unknown>;\n\t};\n}\n\nexport interface DiscoverResult {\n\tresultType: \"complete\";\n\tsupportedVersions: string[];\n\tcapabilities: ServerInfo[\"capabilities\"];\n\tserverInfo: ServerInfo;\n\tinstructions?: string;\n}\n\nexport interface McpRequest {\n\tmethod: string;\n\tparams?: unknown;\n\tid?: string | number | null;\n\tjsonrpc?: \"2.0\";\n}\n\nexport interface McpResponse {\n\tjsonrpc: \"2.0\";\n\tid?: string | number | null;\n\tresult?: unknown;\n\terror?: {\n\t\tcode: number;\n\t\tmessage: string;\n\t\tdata?: unknown;\n\t};\n}\n\n/**\n * Re-export Gateway Interceptor types for consumer convenience.\n */\nexport type {\n\tGatewayAdmissionResult,\n\tGatewayInterceptor,\n\tGatewayInterceptorContext,\n\tGatewayInterceptorOptions,\n} from \"./gateway/interceptor.js\";\nexport type { AuditInterceptor } from \"./interceptors/audit-interceptor.js\";\n/**\n * Re-export Log & Audit Interceptor types for consumer convenience.\n */\nexport type {\n\tLogEvent,\n\tLogInterceptor,\n} from \"./interceptors/log-interceptor.js\";\n/**\n * Re-export AuthInfo from the security module for convenience.\n * Compatible with MCP TypeScript SDK AuthInfo interface shape.\n */\nexport type { AuthInfo } from \"./security/jwt-validator.js\";\nexport type {\n\tZkJournalV2,\n\tZkPolicy,\n\tZkReceipt,\n} from \"./security/zk.js\";\n/**\n * Re-export Zero-Knowledge Proof & Verification types for consumer convenience.\n */\nexport {\n\tProofType,\n\tRECEIPT_VERSION_V1,\n\tRECEIPT_VERSION_V2,\n\tZK_JOURNAL_V2_SIZE,\n} from \"./security/zk.js\";\n"]}
|