@juspay/neurolink 5.2.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -2
- package/dist/chat/client-utils.d.ts +3 -0
- package/dist/chat/client-utils.js +22 -5
- package/dist/chat/index.d.ts +4 -7
- package/dist/chat/index.js +0 -8
- package/dist/chat/session-storage.d.ts +2 -2
- package/dist/chat/session.d.ts +4 -3
- package/dist/chat/session.js +1 -1
- package/dist/chat/sse-handler.js +13 -21
- package/dist/chat/types.d.ts +3 -2
- package/dist/chat/websocket-chat-handler.d.ts +4 -3
- package/dist/chat/websocket-chat-handler.js +12 -12
- package/dist/cli/commands/config.d.ts +2 -2
- package/dist/cli/commands/mcp.d.ts +3 -2
- package/dist/cli/commands/mcp.js +39 -29
- package/dist/cli/commands/ollama.js +8 -4
- package/dist/cli/factories/command-factory.d.ts +2 -1
- package/dist/cli/factories/command-factory.js +6 -5
- package/dist/cli/index.js +22 -19
- package/dist/core/analytics.d.ts +3 -2
- package/dist/core/analytics.js +16 -7
- package/dist/core/base-provider.d.ts +35 -7
- package/dist/core/base-provider.js +57 -23
- package/dist/core/constants.d.ts +1 -0
- package/dist/core/constants.js +1 -0
- package/dist/core/defaults.d.ts +2 -1
- package/dist/core/evaluation.d.ts +4 -4
- package/dist/core/evaluation.js +17 -7
- package/dist/core/factory.d.ts +3 -2
- package/dist/core/service-registry.d.ts +4 -4
- package/dist/core/types.d.ts +11 -4
- package/dist/factories/compatibility-factory.d.ts +16 -1
- package/dist/factories/compatibility-factory.js +3 -1
- package/dist/factories/provider-factory.d.ts +5 -4
- package/dist/factories/provider-factory.js +15 -24
- package/dist/factories/provider-generate-factory.js +26 -20
- package/dist/lib/chat/client-utils.d.ts +3 -0
- package/dist/lib/chat/client-utils.js +22 -5
- package/dist/lib/chat/index.d.ts +4 -7
- package/dist/lib/chat/index.js +0 -8
- package/dist/lib/chat/session-storage.d.ts +2 -2
- package/dist/lib/chat/session.d.ts +4 -3
- package/dist/lib/chat/session.js +1 -1
- package/dist/lib/chat/sse-handler.js +13 -21
- package/dist/lib/chat/types.d.ts +3 -2
- package/dist/lib/chat/websocket-chat-handler.d.ts +4 -3
- package/dist/lib/chat/websocket-chat-handler.js +12 -12
- package/dist/lib/core/analytics.d.ts +3 -2
- package/dist/lib/core/analytics.js +16 -7
- package/dist/lib/core/base-provider.d.ts +35 -7
- package/dist/lib/core/base-provider.js +57 -23
- package/dist/lib/core/constants.d.ts +1 -0
- package/dist/lib/core/constants.js +1 -0
- package/dist/lib/core/defaults.d.ts +2 -1
- package/dist/lib/core/evaluation.d.ts +4 -4
- package/dist/lib/core/evaluation.js +17 -7
- package/dist/lib/core/factory.d.ts +3 -2
- package/dist/lib/core/service-registry.d.ts +4 -4
- package/dist/lib/core/types.d.ts +11 -4
- package/dist/lib/factories/compatibility-factory.d.ts +16 -1
- package/dist/lib/factories/compatibility-factory.js +3 -1
- package/dist/lib/factories/provider-factory.d.ts +5 -4
- package/dist/lib/factories/provider-factory.js +15 -24
- package/dist/lib/factories/provider-generate-factory.js +26 -20
- package/dist/lib/mcp/adapters/plugin-bridge.d.ts +5 -4
- package/dist/lib/mcp/adapters/plugin-bridge.js +13 -6
- package/dist/lib/mcp/client.d.ts +3 -1
- package/dist/lib/mcp/client.js +13 -10
- package/dist/lib/mcp/context-manager.d.ts +2 -1
- package/dist/lib/mcp/context-manager.js +8 -4
- package/dist/lib/mcp/contracts/mcp-contract.d.ts +15 -8
- package/dist/lib/mcp/core/plugin-manager.d.ts +3 -2
- package/dist/lib/mcp/core/plugin-manager.js +1 -1
- package/dist/lib/mcp/demo/plugin-demo.js +3 -1
- package/dist/lib/mcp/dynamic-chain-executor.d.ts +64 -40
- package/dist/lib/mcp/dynamic-chain-executor.js +3 -3
- package/dist/lib/mcp/dynamic-orchestrator.d.ts +14 -8
- package/dist/lib/mcp/ecosystem.d.ts +4 -4
- package/dist/lib/mcp/error-manager.d.ts +2 -2
- package/dist/lib/mcp/error-recovery.d.ts +4 -3
- package/dist/lib/mcp/external-client.d.ts +1 -1
- package/dist/lib/mcp/external-client.js +14 -10
- package/dist/lib/mcp/external-manager.d.ts +3 -3
- package/dist/lib/mcp/external-manager.js +9 -3
- package/dist/lib/mcp/factory.d.ts +7 -7
- package/dist/lib/mcp/function-calling.d.ts +14 -0
- package/dist/lib/mcp/function-calling.js +133 -34
- package/dist/lib/mcp/health-monitor.d.ts +2 -1
- package/dist/lib/mcp/health-monitor.js +16 -7
- package/dist/lib/mcp/index.d.ts +5 -5
- package/dist/lib/mcp/initialize-tools.d.ts +2 -1
- package/dist/lib/mcp/initialize-tools.js +10 -2
- package/dist/lib/mcp/manager.d.ts +2 -1
- package/dist/lib/mcp/neurolink-mcp-client.d.ts +1 -0
- package/dist/lib/mcp/neurolink-mcp-client.js +22 -6
- package/dist/lib/mcp/orchestrator.d.ts +13 -12
- package/dist/lib/mcp/orchestrator.js +10 -8
- package/dist/lib/mcp/plugin-manager.js +4 -2
- package/dist/lib/mcp/plugins/core/filesystem-mcp.d.ts +3 -2
- package/dist/lib/mcp/plugins/core/filesystem-mcp.js +5 -2
- package/dist/lib/mcp/plugins/filesystem-mcp.d.ts +2 -1
- package/dist/lib/mcp/registry.d.ts +2 -1
- package/dist/lib/mcp/registry.js +2 -1
- package/dist/lib/mcp/security-manager.d.ts +4 -2
- package/dist/lib/mcp/servers/agent/direct-tools-server.js +18 -6
- package/dist/lib/mcp/servers/ai-providers/ai-analysis-tools.d.ts +1 -16
- package/dist/lib/mcp/servers/ai-providers/ai-analysis-tools.js +21 -17
- package/dist/lib/mcp/servers/ai-providers/ai-core-server.d.ts +2 -2
- package/dist/lib/mcp/servers/ai-providers/ai-core-server.js +15 -133
- package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.d.ts +1 -97
- package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.js +18 -18
- package/dist/lib/mcp/session-manager.d.ts +4 -3
- package/dist/lib/mcp/session-persistence.js +5 -2
- package/dist/lib/mcp/tool-integration.d.ts +3 -2
- package/dist/lib/mcp/tool-integration.js +3 -1
- package/dist/lib/mcp/tool-registry.d.ts +18 -1
- package/dist/lib/mcp/tool-registry.js +11 -8
- package/dist/lib/mcp/transport-manager.d.ts +2 -1
- package/dist/lib/mcp/transport-manager.js +5 -1
- package/dist/lib/mcp/unified-mcp.d.ts +5 -5
- package/dist/lib/mcp/unified-registry.d.ts +18 -2
- package/dist/lib/mcp/unified-registry.js +52 -3
- package/dist/lib/neurolink.d.ts +2 -2
- package/dist/lib/neurolink.js +40 -15
- package/dist/lib/providers/amazon-bedrock.d.ts +1 -1
- package/dist/lib/providers/amazon-bedrock.js +8 -7
- package/dist/lib/providers/analytics-helper.d.ts +8 -23
- package/dist/lib/providers/analytics-helper.js +95 -33
- package/dist/lib/providers/anthropic-baseprovider.d.ts +3 -3
- package/dist/lib/providers/anthropic-baseprovider.js +6 -5
- package/dist/lib/providers/anthropic.d.ts +2 -2
- package/dist/lib/providers/anthropic.js +11 -4
- package/dist/lib/providers/azure-openai.d.ts +5 -4
- package/dist/lib/providers/azure-openai.js +10 -4
- package/dist/lib/providers/function-calling-provider.d.ts +66 -4
- package/dist/lib/providers/function-calling-provider.js +209 -10
- package/dist/lib/providers/google-ai-studio.d.ts +2 -2
- package/dist/lib/providers/google-ai-studio.js +9 -3
- package/dist/lib/providers/google-vertex.d.ts +2 -2
- package/dist/lib/providers/google-vertex.js +18 -12
- package/dist/lib/providers/huggingFace.d.ts +1 -1
- package/dist/lib/providers/huggingFace.js +8 -4
- package/dist/lib/providers/mcp-provider.d.ts +3 -3
- package/dist/lib/providers/mcp-provider.js +20 -5
- package/dist/lib/providers/mistral.d.ts +34 -27
- package/dist/lib/providers/mistral.js +115 -107
- package/dist/lib/providers/ollama.d.ts +2 -1
- package/dist/lib/providers/ollama.js +43 -3
- package/dist/lib/providers/openAI.d.ts +1 -1
- package/dist/lib/providers/openAI.js +8 -4
- package/dist/lib/proxy/proxy-fetch.js +3 -2
- package/dist/lib/sdk/tool-extension.d.ts +12 -12
- package/dist/lib/sdk/tool-extension.js +2 -1
- package/dist/lib/sdk/tool-registration.d.ts +16 -12
- package/dist/lib/sdk/tool-registration.js +3 -2
- package/dist/lib/services/streaming/streaming-manager.js +11 -10
- package/dist/lib/services/types.d.ts +5 -4
- package/dist/lib/services/websocket/websocket-server.d.ts +1 -1
- package/dist/lib/services/websocket/websocket-server.js +13 -12
- package/dist/lib/telemetry/telemetry-service.js +9 -8
- package/dist/lib/types/cli.d.ts +247 -0
- package/dist/lib/types/cli.js +22 -0
- package/dist/lib/types/common.d.ts +76 -0
- package/dist/lib/types/common.js +52 -0
- package/dist/lib/types/generate-types.d.ts +6 -6
- package/dist/lib/types/index.d.ts +12 -0
- package/dist/lib/types/index.js +12 -0
- package/dist/lib/types/mcp-types.d.ts +7 -7
- package/dist/lib/types/providers.d.ts +158 -0
- package/dist/lib/types/providers.js +23 -0
- package/dist/lib/types/stream-types.d.ts +4 -3
- package/dist/lib/types/tools.d.ts +154 -0
- package/dist/lib/types/tools.js +24 -0
- package/dist/lib/utils/logger.d.ts +5 -5
- package/dist/lib/utils/provider-validation.d.ts +2 -1
- package/dist/mcp/adapters/plugin-bridge.d.ts +5 -4
- package/dist/mcp/adapters/plugin-bridge.js +13 -6
- package/dist/mcp/client.d.ts +3 -1
- package/dist/mcp/client.js +13 -10
- package/dist/mcp/context-manager.d.ts +2 -1
- package/dist/mcp/context-manager.js +8 -4
- package/dist/mcp/contracts/mcp-contract.d.ts +15 -8
- package/dist/mcp/core/plugin-manager.d.ts +3 -2
- package/dist/mcp/core/plugin-manager.js +1 -1
- package/dist/mcp/demo/plugin-demo.js +3 -1
- package/dist/mcp/dynamic-chain-executor.d.ts +64 -40
- package/dist/mcp/dynamic-chain-executor.js +3 -3
- package/dist/mcp/dynamic-orchestrator.d.ts +14 -8
- package/dist/mcp/dynamic-orchestrator.js +1 -1
- package/dist/mcp/ecosystem.d.ts +4 -4
- package/dist/mcp/error-manager.d.ts +2 -2
- package/dist/mcp/error-recovery.d.ts +4 -3
- package/dist/mcp/external-client.d.ts +1 -1
- package/dist/mcp/external-client.js +14 -10
- package/dist/mcp/external-manager.d.ts +3 -3
- package/dist/mcp/external-manager.js +9 -3
- package/dist/mcp/factory.d.ts +7 -7
- package/dist/mcp/function-calling.d.ts +14 -0
- package/dist/mcp/function-calling.js +133 -34
- package/dist/mcp/health-monitor.d.ts +2 -1
- package/dist/mcp/health-monitor.js +16 -7
- package/dist/mcp/index.d.ts +5 -5
- package/dist/mcp/initialize-tools.d.ts +2 -1
- package/dist/mcp/initialize-tools.js +10 -2
- package/dist/mcp/manager.d.ts +2 -1
- package/dist/mcp/neurolink-mcp-client.d.ts +1 -0
- package/dist/mcp/neurolink-mcp-client.js +22 -6
- package/dist/mcp/orchestrator.d.ts +13 -12
- package/dist/mcp/orchestrator.js +10 -8
- package/dist/mcp/plugin-manager.js +4 -2
- package/dist/mcp/plugins/core/filesystem-mcp.d.ts +3 -2
- package/dist/mcp/plugins/core/filesystem-mcp.js +5 -2
- package/dist/mcp/plugins/filesystem-mcp.d.ts +2 -1
- package/dist/mcp/registry.d.ts +2 -1
- package/dist/mcp/registry.js +2 -1
- package/dist/mcp/security-manager.d.ts +4 -2
- package/dist/mcp/servers/agent/direct-tools-server.js +19 -6
- package/dist/mcp/servers/ai-providers/ai-analysis-tools.d.ts +1 -16
- package/dist/mcp/servers/ai-providers/ai-analysis-tools.js +21 -17
- package/dist/mcp/servers/ai-providers/ai-core-server.d.ts +2 -2
- package/dist/mcp/servers/ai-providers/ai-core-server.js +15 -132
- package/dist/mcp/servers/ai-providers/ai-workflow-tools.d.ts +1 -97
- package/dist/mcp/servers/ai-providers/ai-workflow-tools.js +18 -18
- package/dist/mcp/session-manager.d.ts +4 -3
- package/dist/mcp/session-persistence.js +5 -2
- package/dist/mcp/tool-integration.d.ts +3 -2
- package/dist/mcp/tool-integration.js +3 -1
- package/dist/mcp/tool-registry.d.ts +18 -1
- package/dist/mcp/tool-registry.js +11 -8
- package/dist/mcp/transport-manager.d.ts +2 -1
- package/dist/mcp/transport-manager.js +5 -1
- package/dist/mcp/unified-mcp.d.ts +5 -5
- package/dist/mcp/unified-registry.d.ts +18 -2
- package/dist/mcp/unified-registry.js +52 -3
- package/dist/neurolink.d.ts +2 -2
- package/dist/neurolink.js +40 -15
- package/dist/providers/amazon-bedrock.d.ts +1 -1
- package/dist/providers/amazon-bedrock.js +8 -7
- package/dist/providers/analytics-helper.d.ts +8 -23
- package/dist/providers/analytics-helper.js +95 -33
- package/dist/providers/anthropic-baseprovider.d.ts +3 -3
- package/dist/providers/anthropic-baseprovider.js +6 -5
- package/dist/providers/anthropic.d.ts +2 -2
- package/dist/providers/anthropic.js +11 -4
- package/dist/providers/azure-openai.d.ts +5 -4
- package/dist/providers/azure-openai.js +10 -4
- package/dist/providers/function-calling-provider.d.ts +66 -4
- package/dist/providers/function-calling-provider.js +209 -10
- package/dist/providers/google-ai-studio.d.ts +2 -2
- package/dist/providers/google-ai-studio.js +9 -3
- package/dist/providers/google-vertex.d.ts +2 -2
- package/dist/providers/google-vertex.js +18 -12
- package/dist/providers/huggingFace.d.ts +1 -1
- package/dist/providers/huggingFace.js +8 -4
- package/dist/providers/mcp-provider.d.ts +3 -3
- package/dist/providers/mcp-provider.js +20 -5
- package/dist/providers/mistral.d.ts +34 -27
- package/dist/providers/mistral.js +116 -108
- package/dist/providers/ollama.d.ts +2 -1
- package/dist/providers/ollama.js +43 -3
- package/dist/providers/openAI.d.ts +1 -1
- package/dist/providers/openAI.js +8 -4
- package/dist/proxy/proxy-fetch.js +3 -2
- package/dist/sdk/tool-extension.d.ts +12 -12
- package/dist/sdk/tool-extension.js +2 -1
- package/dist/sdk/tool-registration.d.ts +16 -12
- package/dist/sdk/tool-registration.js +3 -2
- package/dist/services/streaming/streaming-manager.js +11 -10
- package/dist/services/types.d.ts +5 -4
- package/dist/services/websocket/websocket-server.d.ts +1 -1
- package/dist/services/websocket/websocket-server.js +14 -12
- package/dist/telemetry/telemetry-service.js +9 -8
- package/dist/types/cli.d.ts +247 -0
- package/dist/types/cli.js +22 -0
- package/dist/types/common.d.ts +76 -0
- package/dist/types/common.js +52 -0
- package/dist/types/generate-types.d.ts +6 -6
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.js +12 -0
- package/dist/types/mcp-types.d.ts +7 -7
- package/dist/types/providers.d.ts +158 -0
- package/dist/types/providers.js +23 -0
- package/dist/types/stream-types.d.ts +4 -3
- package/dist/types/tools.d.ts +154 -0
- package/dist/types/tools.js +25 -0
- package/dist/utils/logger.d.ts +5 -5
- package/dist/utils/provider-validation.d.ts +2 -1
- package/package.json +12 -10
|
@@ -72,7 +72,7 @@ export class ExternalMCPManager {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
catch (error) {
|
|
75
|
-
if (error
|
|
75
|
+
if (error?.code === "ENOENT") {
|
|
76
76
|
logger.warn(`[External MCP Manager] Config file not found: ${this.configPath}`);
|
|
77
77
|
this.config = { mcpServers: {} };
|
|
78
78
|
}
|
|
@@ -163,6 +163,12 @@ export class ExternalMCPManager {
|
|
|
163
163
|
*/
|
|
164
164
|
async registerServerTools(serverInfo) {
|
|
165
165
|
try {
|
|
166
|
+
if (!serverInfo.client) {
|
|
167
|
+
throw new Error("Client is not available");
|
|
168
|
+
}
|
|
169
|
+
if (!serverInfo.server) {
|
|
170
|
+
throw new Error("Server is not available");
|
|
171
|
+
}
|
|
166
172
|
const tools = serverInfo.client.getNeuroLinkTools();
|
|
167
173
|
// Register each tool with the server
|
|
168
174
|
for (const [toolName, tool] of Object.entries(tools)) {
|
|
@@ -198,8 +204,8 @@ export class ExternalMCPManager {
|
|
|
198
204
|
statuses[name] = {
|
|
199
205
|
...info,
|
|
200
206
|
// Don't include the actual client/server objects in status
|
|
201
|
-
client:
|
|
202
|
-
server:
|
|
207
|
+
client: null,
|
|
208
|
+
server: null,
|
|
203
209
|
};
|
|
204
210
|
}
|
|
205
211
|
return statuses;
|
|
@@ -42,15 +42,15 @@ export interface NeuroLinkExecutionContext extends ExecutionContext {
|
|
|
42
42
|
features?: string[];
|
|
43
43
|
enableDemoMode?: boolean;
|
|
44
44
|
securityLevel?: "public" | "private" | "organization";
|
|
45
|
-
metadata?: Record<string,
|
|
46
|
-
[key: string]:
|
|
45
|
+
metadata?: Record<string, unknown>;
|
|
46
|
+
[key: string]: unknown;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Tool execution result - Standardized result format
|
|
50
50
|
*/
|
|
51
51
|
export interface ToolResult {
|
|
52
52
|
success: boolean;
|
|
53
|
-
data?:
|
|
53
|
+
data?: unknown;
|
|
54
54
|
error?: string | Error;
|
|
55
55
|
usage?: {
|
|
56
56
|
tokens?: number;
|
|
@@ -67,7 +67,7 @@ export interface ToolResult {
|
|
|
67
67
|
timestamp?: number;
|
|
68
68
|
executionTime?: number;
|
|
69
69
|
executionId?: string;
|
|
70
|
-
[key: string]:
|
|
70
|
+
[key: string]: unknown;
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
@@ -83,7 +83,7 @@ export interface NeuroLinkMCPTool {
|
|
|
83
83
|
category?: string;
|
|
84
84
|
permissions?: string[];
|
|
85
85
|
version?: string;
|
|
86
|
-
metadata?: Record<string,
|
|
86
|
+
metadata?: Record<string, unknown>;
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* MCP Server Interface - Lighthouse compatible
|
|
@@ -97,7 +97,7 @@ export interface NeuroLinkMCPServer {
|
|
|
97
97
|
visibility?: "public" | "private" | "organization";
|
|
98
98
|
tools: Record<string, NeuroLinkMCPTool>;
|
|
99
99
|
registerTool(tool: NeuroLinkMCPTool): NeuroLinkMCPServer;
|
|
100
|
-
metadata?: Record<string,
|
|
100
|
+
metadata?: Record<string, unknown>;
|
|
101
101
|
dependencies?: string[];
|
|
102
102
|
capabilities?: string[];
|
|
103
103
|
}
|
|
@@ -111,7 +111,7 @@ export interface MCPServerConfig {
|
|
|
111
111
|
version?: string;
|
|
112
112
|
category?: MCPServerCategory;
|
|
113
113
|
visibility?: "public" | "private" | "organization";
|
|
114
|
-
metadata?: Record<string,
|
|
114
|
+
metadata?: Record<string, unknown>;
|
|
115
115
|
dependencies?: string[];
|
|
116
116
|
capabilities?: string[];
|
|
117
117
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Tool } from "ai";
|
|
7
7
|
import type { NeuroLinkMCPTool, ToolResult, NeuroLinkExecutionContext } from "./factory.js";
|
|
8
|
+
import type { UnknownRecord } from "../types/common.js";
|
|
8
9
|
/**
|
|
9
10
|
* Convert MCP tool to AI SDK function definition
|
|
10
11
|
*/
|
|
@@ -14,6 +15,7 @@ export declare function mcpToolToAISDKTool(tool: NeuroLinkMCPTool, serverId: str
|
|
|
14
15
|
*/
|
|
15
16
|
export declare function getAvailableFunctionTools(): Promise<{
|
|
16
17
|
tools: Tool[];
|
|
18
|
+
toolsObject: Record<string, Tool>;
|
|
17
19
|
toolMap: Map<string, {
|
|
18
20
|
serverId: string;
|
|
19
21
|
toolName: string;
|
|
@@ -49,3 +51,15 @@ export declare function getFunctionToolsForCategory(category?: string, maxTools?
|
|
|
49
51
|
* Check if function calling is available
|
|
50
52
|
*/
|
|
51
53
|
export declare function isFunctionCallingAvailable(): Promise<boolean>;
|
|
54
|
+
/**
|
|
55
|
+
* Utility function to create a named tool object for debugging
|
|
56
|
+
*/
|
|
57
|
+
export declare function createNamedTool(name: string, toolDef: Tool): Tool & {
|
|
58
|
+
name: string;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Get tools with proper name properties for debugging
|
|
62
|
+
*/
|
|
63
|
+
export declare function getToolsWithNames(): Promise<Record<string, UnknownRecord & {
|
|
64
|
+
name: string;
|
|
65
|
+
}>>;
|
|
@@ -8,6 +8,100 @@ import { z } from "zod";
|
|
|
8
8
|
import { unifiedRegistry } from "./unified-registry.js";
|
|
9
9
|
import { createExecutionContext } from "./context-manager.js";
|
|
10
10
|
import { mcpLogger } from "./logging.js";
|
|
11
|
+
/**
|
|
12
|
+
* Parses neurolink-specific function name patterns to extract the server ID and tool name.
|
|
13
|
+
*
|
|
14
|
+
* @param {string[]} parts - An array of strings representing parts of a function name,
|
|
15
|
+
* typically obtained by splitting the function name on underscores.
|
|
16
|
+
* @returns {{ serverId: string; toolName: string } | null} An object containing the `serverId`
|
|
17
|
+
* and `toolName` if the input matches a neurolink-specific pattern, or `null` if no match is found.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Returns { serverId: "neurolink_ai_core", toolName: "generate" }
|
|
21
|
+
* parseNeuroLinkPattern(["neurolink", "ai", "core", "generate"]);
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Returns { serverId: "neurolink_utility", toolName: "format_number" }
|
|
25
|
+
* parseNeuroLinkPattern(["neurolink", "utility", "format_number"]);
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Returns null
|
|
29
|
+
* parseNeuroLinkPattern(["other", "pattern"]);
|
|
30
|
+
*/
|
|
31
|
+
function parseNeuroLinkPattern(parts) {
|
|
32
|
+
if (parts.length >= 3 &&
|
|
33
|
+
parts[0] === "neurolink" &&
|
|
34
|
+
(parts[1] === "ai" || parts[1] === "utility")) {
|
|
35
|
+
// neurolink_ai_core_generate -> serverId: "neurolink_ai_core", toolName: "generate"
|
|
36
|
+
// neurolink_utility_format_number -> serverId: "neurolink_utility", toolName: "format_number"
|
|
37
|
+
if (parts[1] === "ai" && parts[2] === "core") {
|
|
38
|
+
return {
|
|
39
|
+
serverId: "neurolink_ai_core",
|
|
40
|
+
toolName: parts.slice(3).join("_"),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
else if (parts[1] === "utility") {
|
|
44
|
+
return {
|
|
45
|
+
serverId: "neurolink_utility",
|
|
46
|
+
toolName: parts.slice(2).join("_"),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Parse underscore-separated function name format
|
|
54
|
+
*/
|
|
55
|
+
function parseUnderscoreFormat(functionName) {
|
|
56
|
+
const parts = functionName.split("_");
|
|
57
|
+
if (parts.length >= 2) {
|
|
58
|
+
// Try neurolink-specific patterns first
|
|
59
|
+
const neurolinkResult = parseNeuroLinkPattern(parts);
|
|
60
|
+
if (neurolinkResult) {
|
|
61
|
+
return neurolinkResult;
|
|
62
|
+
}
|
|
63
|
+
// Default underscore parsing
|
|
64
|
+
return {
|
|
65
|
+
serverId: parts[0],
|
|
66
|
+
toolName: parts.slice(1).join("_"),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Parse dot-separated function name format (legacy support)
|
|
73
|
+
*/
|
|
74
|
+
function parseDotFormat(functionName) {
|
|
75
|
+
const parts = functionName.split(".");
|
|
76
|
+
if (parts.length >= 2) {
|
|
77
|
+
return {
|
|
78
|
+
serverId: parts[0],
|
|
79
|
+
toolName: parts.slice(1).join("."),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Parse function name to extract server ID and tool name
|
|
86
|
+
* Handles various naming patterns including neurolink server patterns
|
|
87
|
+
*/
|
|
88
|
+
function parseFunctionName(functionName) {
|
|
89
|
+
// Try underscore format first (most common)
|
|
90
|
+
const underscoreResult = parseUnderscoreFormat(functionName);
|
|
91
|
+
if (underscoreResult) {
|
|
92
|
+
return underscoreResult;
|
|
93
|
+
}
|
|
94
|
+
// Fallback to dot format for backward compatibility
|
|
95
|
+
const dotResult = parseDotFormat(functionName);
|
|
96
|
+
if (dotResult) {
|
|
97
|
+
return dotResult;
|
|
98
|
+
}
|
|
99
|
+
// Final fallback - return as-is with unknown server
|
|
100
|
+
return {
|
|
101
|
+
serverId: "unknown",
|
|
102
|
+
toolName: functionName,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
11
105
|
/**
|
|
12
106
|
* Convert MCP tool to AI SDK function definition
|
|
13
107
|
*/
|
|
@@ -55,6 +149,7 @@ export function mcpToolToAISDKTool(tool, serverId) {
|
|
|
55
149
|
export async function getAvailableFunctionTools() {
|
|
56
150
|
const functionTag = "getAvailableFunctionTools";
|
|
57
151
|
const tools = [];
|
|
152
|
+
const toolsObject = {};
|
|
58
153
|
const toolMap = new Map();
|
|
59
154
|
try {
|
|
60
155
|
// Add overall timeout for the entire function
|
|
@@ -281,6 +376,8 @@ export async function getAvailableFunctionTools() {
|
|
|
281
376
|
},
|
|
282
377
|
});
|
|
283
378
|
tools.push(aiTool);
|
|
379
|
+
// Store tool with proper name association
|
|
380
|
+
toolsObject[functionName] = aiTool;
|
|
284
381
|
// Store mapping for execution - CRITICAL: Use sanitized functionName as key
|
|
285
382
|
toolMap.set(functionName, {
|
|
286
383
|
serverId: typeof toolInfo.serverId === "string"
|
|
@@ -302,7 +399,7 @@ export async function getAvailableFunctionTools() {
|
|
|
302
399
|
if (overallTimeoutId) {
|
|
303
400
|
clearTimeout(overallTimeoutId);
|
|
304
401
|
}
|
|
305
|
-
return { tools, toolMap };
|
|
402
|
+
return { tools, toolsObject, toolMap };
|
|
306
403
|
}
|
|
307
404
|
catch (error) {
|
|
308
405
|
if (overallTimeoutId) {
|
|
@@ -315,7 +412,7 @@ export async function getAvailableFunctionTools() {
|
|
|
315
412
|
}
|
|
316
413
|
catch (error) {
|
|
317
414
|
mcpLogger.error(`[${functionTag}] Error getting function tools:`, error);
|
|
318
|
-
return { tools: [], toolMap: new Map() };
|
|
415
|
+
return { tools: [], toolsObject: {}, toolMap: new Map() };
|
|
319
416
|
}
|
|
320
417
|
}
|
|
321
418
|
/**
|
|
@@ -345,38 +442,12 @@ export async function executeFunctionCall(functionName, parameters, context) {
|
|
|
345
442
|
});
|
|
346
443
|
}
|
|
347
444
|
// Parse server and tool name from function name
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
const firstPart = parts[0];
|
|
355
|
-
if (firstPart && typeof firstPart === "string" && firstPart.length > 0) {
|
|
356
|
-
serverId = firstPart;
|
|
357
|
-
}
|
|
358
|
-
else {
|
|
359
|
-
serverId = "unknown";
|
|
360
|
-
}
|
|
361
|
-
toolName = parts.slice(1).join("_"); // Rejoin in case tool name had underscores
|
|
362
|
-
}
|
|
363
|
-
else {
|
|
364
|
-
// Fallback to dot format for backward compatibility
|
|
365
|
-
parts = functionName.split(".");
|
|
366
|
-
if (parts.length === 2) {
|
|
367
|
-
const parsedServerId = parts[0];
|
|
368
|
-
const parsedToolName = parts[1];
|
|
369
|
-
if (parsedServerId && parsedToolName) {
|
|
370
|
-
serverId = parsedServerId;
|
|
371
|
-
toolName = parsedToolName;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
else {
|
|
375
|
-
// Can't parse - try executing as-is through unified registry
|
|
376
|
-
mcpLogger.debug(`[${functionTag}] Cannot parse function name format: ${functionName}, trying unified registry`);
|
|
377
|
-
const result = await unifiedRegistry.executeTool(functionName, actualParameters, finalContext);
|
|
378
|
-
return result;
|
|
379
|
-
}
|
|
445
|
+
const { serverId, toolName } = parseFunctionName(functionName);
|
|
446
|
+
if (serverId === "unknown") {
|
|
447
|
+
// Can't parse - try executing as-is through unified registry
|
|
448
|
+
mcpLogger.debug(`[${functionTag}] Cannot parse function name format: ${functionName}, trying unified registry`);
|
|
449
|
+
const result = await unifiedRegistry.executeTool(functionName, actualParameters, finalContext);
|
|
450
|
+
return result;
|
|
380
451
|
}
|
|
381
452
|
// Handle built-in NeuroLink servers directly
|
|
382
453
|
if (serverId === "neurolink-utility" ||
|
|
@@ -541,3 +612,31 @@ export async function isFunctionCallingAvailable() {
|
|
|
541
612
|
return false;
|
|
542
613
|
}
|
|
543
614
|
}
|
|
615
|
+
/**
|
|
616
|
+
* Utility function to create a named tool object for debugging
|
|
617
|
+
*/
|
|
618
|
+
export function createNamedTool(name, toolDef) {
|
|
619
|
+
return {
|
|
620
|
+
name,
|
|
621
|
+
description: toolDef.description,
|
|
622
|
+
parameters: toolDef.parameters,
|
|
623
|
+
execute: toolDef.execute,
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Get tools with proper name properties for debugging
|
|
628
|
+
*/
|
|
629
|
+
export async function getToolsWithNames() {
|
|
630
|
+
try {
|
|
631
|
+
const { toolsObject } = await getAvailableFunctionTools();
|
|
632
|
+
const namedTools = {};
|
|
633
|
+
for (const [name, tool] of Object.entries(toolsObject)) {
|
|
634
|
+
namedTools[name] = createNamedTool(name, tool);
|
|
635
|
+
}
|
|
636
|
+
return namedTools;
|
|
637
|
+
}
|
|
638
|
+
catch (error) {
|
|
639
|
+
mcpLogger.warn("[getToolsWithNames] Failed to get tools with names:", error);
|
|
640
|
+
return {};
|
|
641
|
+
}
|
|
642
|
+
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Based on health monitoring patterns from Cline
|
|
5
5
|
*/
|
|
6
6
|
import type { MCPRegistry } from "./registry.js";
|
|
7
|
+
import type { Unknown } from "../types/common.js";
|
|
7
8
|
import { ErrorManager } from "./error-manager.js";
|
|
8
9
|
/**
|
|
9
10
|
* Connection status states
|
|
@@ -215,7 +216,7 @@ export declare class HealthMonitor {
|
|
|
215
216
|
* @param event Event type to subscribe to
|
|
216
217
|
* @param callback Callback function
|
|
217
218
|
*/
|
|
218
|
-
on(event: "health-change" | "recovery-started" | "recovery-failed" | "critical-error", callback: (data:
|
|
219
|
+
on(event: "health-change" | "recovery-started" | "recovery-failed" | "critical-error", callback: (data: Unknown) => void): void;
|
|
219
220
|
/**
|
|
220
221
|
* Get health history for trend analysis
|
|
221
222
|
*
|
|
@@ -578,26 +578,35 @@ export class HealthMonitor {
|
|
|
578
578
|
*/
|
|
579
579
|
generateRecommendations(summary, servers) {
|
|
580
580
|
const recommendations = [];
|
|
581
|
+
// Type-safe access to summary properties
|
|
582
|
+
const overallHealth = typeof summary.overallHealth === "number" ? summary.overallHealth : 0;
|
|
583
|
+
const unhealthyServers = typeof summary.unhealthyServers === "number"
|
|
584
|
+
? summary.unhealthyServers
|
|
585
|
+
: 0;
|
|
586
|
+
const totalServers = typeof summary.totalServers === "number" ? summary.totalServers : 1;
|
|
581
587
|
// Check overall health
|
|
582
|
-
if (
|
|
588
|
+
if (overallHealth < 50) {
|
|
583
589
|
recommendations.push("Critical: System health is below 50%. Immediate attention required.");
|
|
584
590
|
}
|
|
585
591
|
// Check unhealthy servers
|
|
586
|
-
if (
|
|
592
|
+
if (unhealthyServers > totalServers * 0.3) {
|
|
587
593
|
recommendations.push("Multiple servers are failing. Check network connectivity and server availability.");
|
|
588
594
|
}
|
|
589
595
|
// Check recovery attempts
|
|
590
|
-
const highRecoveryServers = servers.filter((s) => s.metrics
|
|
596
|
+
const highRecoveryServers = servers.filter((s) => typeof s.metrics === "object" &&
|
|
597
|
+
s.metrics &&
|
|
598
|
+
typeof s.metrics.recoveryAttempts === "number" &&
|
|
599
|
+
s.metrics.recoveryAttempts > 2);
|
|
591
600
|
if (highRecoveryServers.length > 0) {
|
|
592
|
-
recommendations.push(`Servers with repeated recovery attempts: ${highRecoveryServers.map((s) => s.serverId).join(", ")}. Consider manual intervention.`);
|
|
601
|
+
recommendations.push(`Servers with repeated recovery attempts: ${highRecoveryServers.map((s) => (typeof s.serverId === "string" ? s.serverId : "unknown")).join(", ")}. Consider manual intervention.`);
|
|
593
602
|
}
|
|
594
603
|
// Check latency
|
|
595
|
-
const highLatencyServers = servers.filter((s) => s.avgLatency > 1000);
|
|
604
|
+
const highLatencyServers = servers.filter((s) => typeof s.avgLatency === "number" && s.avgLatency > 1000);
|
|
596
605
|
if (highLatencyServers.length > 0) {
|
|
597
|
-
recommendations.push(`High latency detected on servers: ${highLatencyServers.map((s) => s.serverId).join(", ")}. Check server load and network conditions.`);
|
|
606
|
+
recommendations.push(`High latency detected on servers: ${highLatencyServers.map((s) => (typeof s.serverId === "string" ? s.serverId : "unknown")).join(", ")}. Check server load and network conditions.`);
|
|
598
607
|
}
|
|
599
608
|
// Positive feedback
|
|
600
|
-
if (
|
|
609
|
+
if (overallHealth >= 90) {
|
|
601
610
|
recommendations.push("System health is excellent. All servers are operating normally.");
|
|
602
611
|
}
|
|
603
612
|
return recommendations;
|
package/dist/lib/mcp/index.d.ts
CHANGED
|
@@ -23,17 +23,17 @@ export declare function listMCPs(): Promise<MCPMetadata[]>;
|
|
|
23
23
|
/**
|
|
24
24
|
* Execute an MCP operation
|
|
25
25
|
*/
|
|
26
|
-
export declare function executeMCP<T =
|
|
26
|
+
export declare function executeMCP<T = unknown>(name: string, config: unknown, args: unknown, context?: {
|
|
27
27
|
sessionId?: string;
|
|
28
28
|
userId?: string;
|
|
29
29
|
}): Promise<T>;
|
|
30
30
|
/**
|
|
31
31
|
* Quick filesystem operations
|
|
32
32
|
*/
|
|
33
|
-
export declare function readFile(path: string, basePath?: string): Promise<
|
|
34
|
-
export declare function writeFile(path: string, content: string, basePath?: string): Promise<
|
|
35
|
-
export declare function listFiles(path: string, basePath?: string): Promise<
|
|
36
|
-
export declare function createDirectory(path: string, basePath?: string): Promise<
|
|
33
|
+
export declare function readFile(path: string, basePath?: string): Promise<string | Buffer>;
|
|
34
|
+
export declare function writeFile(path: string, content: string, basePath?: string): Promise<void>;
|
|
35
|
+
export declare function listFiles(path: string, basePath?: string): Promise<string[]>;
|
|
36
|
+
export declare function createDirectory(path: string, basePath?: string): Promise<void>;
|
|
37
37
|
/**
|
|
38
38
|
* Get MCP ecosystem statistics
|
|
39
39
|
*/
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { NeuroLinkMCPClient } from "./client.js";
|
|
6
6
|
import type { NeuroLinkExecutionContext } from "./factory.js";
|
|
7
|
+
import type { UnknownRecord } from "../types/common.js";
|
|
7
8
|
/**
|
|
8
9
|
* Initialize and register tools from MCP Servers with the MCP client
|
|
9
10
|
* Following Lighthouse's pattern for tool registration
|
|
@@ -13,7 +14,7 @@ export declare const initializeMCPTools: (sessionId: string, client: NeuroLinkMC
|
|
|
13
14
|
* Get all available tools across all servers
|
|
14
15
|
* Useful for documentation and discovery
|
|
15
16
|
*/
|
|
16
|
-
export declare function getAllAvailableTools(inMemoryServers?: Map<string,
|
|
17
|
+
export declare function getAllAvailableTools(inMemoryServers?: Map<string, UnknownRecord>): Promise<Array<{
|
|
17
18
|
serverId: string;
|
|
18
19
|
serverTitle: string;
|
|
19
20
|
toolName: string;
|
|
@@ -145,7 +145,10 @@ export async function getAllAvailableTools(inMemoryServers) {
|
|
|
145
145
|
if (inMemoryServers) {
|
|
146
146
|
for (const [serverId, serverConfig] of inMemoryServers) {
|
|
147
147
|
const server = serverConfig.server;
|
|
148
|
-
if (server &&
|
|
148
|
+
if (server &&
|
|
149
|
+
typeof server === "object" &&
|
|
150
|
+
"tools" in server &&
|
|
151
|
+
server.tools) {
|
|
149
152
|
// Handle both Map and object formats
|
|
150
153
|
const toolEntries = server.tools instanceof Map
|
|
151
154
|
? Array.from(server.tools.entries())
|
|
@@ -175,7 +178,12 @@ export async function getAllAvailableTools(inMemoryServers) {
|
|
|
175
178
|
}
|
|
176
179
|
tools.push({
|
|
177
180
|
serverId,
|
|
178
|
-
serverTitle: server
|
|
181
|
+
serverTitle: typeof server === "object" &&
|
|
182
|
+
server &&
|
|
183
|
+
"title" in server &&
|
|
184
|
+
typeof server.title === "string"
|
|
185
|
+
? server.title
|
|
186
|
+
: serverId,
|
|
179
187
|
toolName,
|
|
180
188
|
namespacedName,
|
|
181
189
|
description,
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { NeuroLinkMCPClient } from "./client.js";
|
|
6
6
|
import type { MCPClientConfig } from "./client.js";
|
|
7
|
+
import type { UnknownRecord } from "../types/common.js";
|
|
7
8
|
/**
|
|
8
9
|
* MCP Manager - Factory pattern for managing multiple client instances
|
|
9
10
|
* Following Lighthouse's session-based architecture
|
|
@@ -46,7 +47,7 @@ export declare class NeuroLinkMCPManager {
|
|
|
46
47
|
static getAllStats(): {
|
|
47
48
|
instanceCount: number;
|
|
48
49
|
maxInstances: number;
|
|
49
|
-
instances: Record<string,
|
|
50
|
+
instances: Record<string, UnknownRecord>;
|
|
50
51
|
};
|
|
51
52
|
/**
|
|
52
53
|
* Clear all instances (for testing or shutdown)
|
|
@@ -244,11 +244,26 @@ Response (JSON array only):`;
|
|
|
244
244
|
exists: async () => false,
|
|
245
245
|
},
|
|
246
246
|
path: {
|
|
247
|
-
join: (...paths) =>
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
247
|
+
join: (...paths) => {
|
|
248
|
+
const pathModule = require("path");
|
|
249
|
+
return pathModule.join(...paths);
|
|
250
|
+
},
|
|
251
|
+
resolve: (...paths) => {
|
|
252
|
+
const pathModule = require("path");
|
|
253
|
+
return pathModule.resolve(...paths);
|
|
254
|
+
},
|
|
255
|
+
relative: (from, to) => {
|
|
256
|
+
const pathModule = require("path");
|
|
257
|
+
return pathModule.relative(from, to);
|
|
258
|
+
},
|
|
259
|
+
dirname: (pathArg) => {
|
|
260
|
+
const pathModule = require("path");
|
|
261
|
+
return pathModule.dirname(pathArg);
|
|
262
|
+
},
|
|
263
|
+
basename: (pathArg, ext) => {
|
|
264
|
+
const pathModule = require("path");
|
|
265
|
+
return pathModule.basename(pathArg, ext);
|
|
266
|
+
},
|
|
252
267
|
},
|
|
253
268
|
grantedPermissions: [],
|
|
254
269
|
log: console.log,
|
|
@@ -367,7 +382,7 @@ Response (JSON array only):`;
|
|
|
367
382
|
const toolResult = toolResults[0];
|
|
368
383
|
if (toolResult.result.success && toolResult.result.data) {
|
|
369
384
|
const data = toolResult.result.data;
|
|
370
|
-
if (data.displayString) {
|
|
385
|
+
if (typeof data.displayString === "string") {
|
|
371
386
|
return data.displayString;
|
|
372
387
|
}
|
|
373
388
|
}
|
|
@@ -409,6 +424,7 @@ Please provide a natural response based on the tool results.`;
|
|
|
409
424
|
const tools = {};
|
|
410
425
|
for (const [name, tool] of this.tools) {
|
|
411
426
|
tools[name] = {
|
|
427
|
+
name: name, // Include the tool name as a property
|
|
412
428
|
description: tool.description,
|
|
413
429
|
inputSchema: tool.inputSchema,
|
|
414
430
|
};
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Now with semaphore-based race condition prevention
|
|
6
6
|
*/
|
|
7
7
|
import type { ToolResult } from "./factory.js";
|
|
8
|
+
import type { JsonValue, UnknownRecord } from "../types/common.js";
|
|
8
9
|
import { MCPToolRegistry, type ToolExecutionOptions } from "./tool-registry.js";
|
|
9
10
|
import { ContextManager, type ContextRequest } from "./context-manager.js";
|
|
10
11
|
import { SemaphoreManager } from "./semaphore-manager.js";
|
|
@@ -27,7 +28,7 @@ export interface PipelineOptions {
|
|
|
27
28
|
*/
|
|
28
29
|
export interface PipelineStep {
|
|
29
30
|
toolName: string;
|
|
30
|
-
params:
|
|
31
|
+
params: JsonValue;
|
|
31
32
|
options?: ToolExecutionOptions;
|
|
32
33
|
dependsOn?: string[];
|
|
33
34
|
stepId?: string;
|
|
@@ -95,7 +96,7 @@ export declare class MCPOrchestrator {
|
|
|
95
96
|
* @param options Execution options
|
|
96
97
|
* @returns Tool execution result
|
|
97
98
|
*/
|
|
98
|
-
executeTool(toolName: string, params:
|
|
99
|
+
executeTool(toolName: string, params: JsonValue, contextRequest?: ContextRequest, options?: ToolExecutionOptions & {
|
|
99
100
|
sessionOptions?: SessionOptions;
|
|
100
101
|
}): Promise<ToolResult>;
|
|
101
102
|
/**
|
|
@@ -129,11 +130,11 @@ export declare class MCPOrchestrator {
|
|
|
129
130
|
* @returns Comprehensive orchestrator statistics
|
|
130
131
|
*/
|
|
131
132
|
getStats(): {
|
|
132
|
-
registry:
|
|
133
|
-
context:
|
|
134
|
-
session:
|
|
135
|
-
error:
|
|
136
|
-
health?:
|
|
133
|
+
registry: UnknownRecord;
|
|
134
|
+
context: UnknownRecord;
|
|
135
|
+
session: UnknownRecord;
|
|
136
|
+
error: UnknownRecord;
|
|
137
|
+
health?: UnknownRecord;
|
|
137
138
|
orchestrator: {
|
|
138
139
|
pipelinesExecuted: number;
|
|
139
140
|
};
|
|
@@ -162,7 +163,7 @@ export declare class MCPOrchestrator {
|
|
|
162
163
|
* @param value State value
|
|
163
164
|
* @returns Success status
|
|
164
165
|
*/
|
|
165
|
-
setSessionState(sessionId: string, key: string, value:
|
|
166
|
+
setSessionState(sessionId: string, key: string, value: JsonValue): Promise<boolean>;
|
|
166
167
|
/**
|
|
167
168
|
* Get session state value
|
|
168
169
|
*
|
|
@@ -170,7 +171,7 @@ export declare class MCPOrchestrator {
|
|
|
170
171
|
* @param key State key
|
|
171
172
|
* @returns State value or undefined
|
|
172
173
|
*/
|
|
173
|
-
getSessionState(sessionId: string, key: string): Promise<
|
|
174
|
+
getSessionState(sessionId: string, key: string): Promise<JsonValue | undefined>;
|
|
174
175
|
/**
|
|
175
176
|
* Get all active sessions
|
|
176
177
|
*
|
|
@@ -240,7 +241,7 @@ export declare class MCPOrchestrator {
|
|
|
240
241
|
* @param config Transport configuration
|
|
241
242
|
* @returns Connected MCP client
|
|
242
243
|
*/
|
|
243
|
-
connectTransport(config: TransportConfig): Promise<
|
|
244
|
+
connectTransport(config: TransportConfig): Promise<unknown>;
|
|
244
245
|
/**
|
|
245
246
|
* Disconnect from MCP server
|
|
246
247
|
*/
|
|
@@ -280,7 +281,7 @@ export declare const defaultOrchestrator: MCPOrchestrator;
|
|
|
280
281
|
* @param options Execution options
|
|
281
282
|
* @returns Tool execution result
|
|
282
283
|
*/
|
|
283
|
-
export declare function executeTool(toolName: string, params:
|
|
284
|
+
export declare function executeTool(toolName: string, params: JsonValue, contextRequest?: ContextRequest, options?: ToolExecutionOptions): Promise<ToolResult>;
|
|
284
285
|
/**
|
|
285
286
|
* Utility function to execute text generation pipeline
|
|
286
287
|
*
|
|
@@ -289,7 +290,7 @@ export declare function executeTool(toolName: string, params: any, contextReques
|
|
|
289
290
|
* @param options Generation options
|
|
290
291
|
* @returns Text generation result
|
|
291
292
|
*/
|
|
292
|
-
export declare function executeTextPipeline(prompt: string, contextRequest?: ContextRequest, options?:
|
|
293
|
+
export declare function executeTextPipeline(prompt: string, contextRequest?: ContextRequest, options?: UnknownRecord): Promise<TextPipelineResult>;
|
|
293
294
|
/**
|
|
294
295
|
* Utility function to execute pipeline with default orchestrator
|
|
295
296
|
*
|
|
@@ -295,7 +295,7 @@ export class MCPOrchestrator {
|
|
|
295
295
|
toolName: "select-provider",
|
|
296
296
|
params: {
|
|
297
297
|
requirements: {
|
|
298
|
-
maxTokens: options.maxTokens,
|
|
298
|
+
maxTokens: options.maxTokens || 1000,
|
|
299
299
|
costEfficient: true,
|
|
300
300
|
},
|
|
301
301
|
},
|
|
@@ -307,11 +307,11 @@ export class MCPOrchestrator {
|
|
|
307
307
|
toolName: "generate",
|
|
308
308
|
params: {
|
|
309
309
|
prompt,
|
|
310
|
-
provider: options.provider,
|
|
311
|
-
model: options.model,
|
|
312
|
-
temperature: options.temperature,
|
|
313
|
-
maxTokens: options.maxTokens,
|
|
314
|
-
systemPrompt: options.systemPrompt,
|
|
310
|
+
provider: options.provider || "auto",
|
|
311
|
+
model: options.model || "default",
|
|
312
|
+
temperature: options.temperature || 0.7,
|
|
313
|
+
maxTokens: options.maxTokens || 1000,
|
|
314
|
+
systemPrompt: options.systemPrompt || "",
|
|
315
315
|
},
|
|
316
316
|
dependsOn: options.provider ? [] : ["select-provider"],
|
|
317
317
|
});
|
|
@@ -346,7 +346,8 @@ export class MCPOrchestrator {
|
|
|
346
346
|
return {
|
|
347
347
|
success: true,
|
|
348
348
|
text: textResult.data?.text,
|
|
349
|
-
provider: textResult.data?.provider ||
|
|
349
|
+
provider: textResult.data?.provider ||
|
|
350
|
+
providerResult?.data?.provider,
|
|
350
351
|
model: textResult.data?.model,
|
|
351
352
|
executionTime,
|
|
352
353
|
usage: textResult.usage,
|
|
@@ -441,7 +442,8 @@ export class MCPOrchestrator {
|
|
|
441
442
|
* @returns State value or undefined
|
|
442
443
|
*/
|
|
443
444
|
async getSessionState(sessionId, key) {
|
|
444
|
-
|
|
445
|
+
const result = this.sessionManager.getSessionState(sessionId, key);
|
|
446
|
+
return result;
|
|
445
447
|
}
|
|
446
448
|
/**
|
|
447
449
|
* Get all active sessions
|