@juspay/neurolink 6.1.0 → 6.2.1
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 +16 -6
- package/dist/agent/direct-tools.js +6 -5
- package/dist/cli/commands/config.d.ts +13 -13
- package/dist/cli/index.js +3 -9
- package/dist/config/configManager.js +11 -10
- package/dist/core/analytics.d.ts +11 -1
- package/dist/core/analytics.js +2 -2
- package/dist/core/base-provider.js +4 -18
- package/dist/core/dynamic-models.d.ts +8 -8
- package/dist/core/factory.js +3 -11
- package/dist/index.d.ts +2 -4
- package/dist/index.js +2 -11
- package/dist/lib/agent/direct-tools.js +6 -5
- package/dist/lib/config/configManager.js +11 -10
- package/dist/lib/core/analytics.d.ts +11 -1
- package/dist/lib/core/analytics.js +2 -2
- package/dist/lib/core/base-provider.js +4 -18
- package/dist/lib/core/dynamic-models.d.ts +8 -8
- package/dist/lib/core/factory.js +3 -11
- package/dist/lib/index.d.ts +2 -4
- package/dist/lib/index.js +2 -11
- package/dist/lib/mcp/factory.d.ts +1 -1
- package/dist/lib/mcp/index.d.ts +9 -21
- package/dist/lib/mcp/index.js +16 -57
- package/dist/lib/mcp/registry.js +1 -1
- package/dist/lib/mcp/servers/ai-providers/ai-analysis-tools.js +2 -1
- package/dist/lib/mcp/tool-registry.js +1 -1
- package/dist/lib/neurolink.d.ts +1 -9
- package/dist/lib/neurolink.js +22 -71
- package/dist/lib/providers/amazon-bedrock.js +5 -16
- package/dist/lib/providers/anthropic-baseprovider.js +3 -21
- package/dist/lib/providers/anthropic.js +4 -7
- package/dist/lib/providers/azure-openai.js +6 -3
- package/dist/lib/providers/google-vertex.js +5 -9
- package/dist/lib/providers/huggingFace.js +5 -10
- package/dist/lib/providers/mistral.js +5 -8
- package/dist/lib/providers/openAI.js +4 -7
- package/dist/lib/telemetry/index.js +2 -1
- package/dist/lib/utils/logger.d.ts +62 -2
- package/dist/lib/utils/logger.js +174 -9
- package/dist/lib/utils/providerConfig.d.ts +117 -0
- package/dist/lib/utils/providerConfig.js +353 -0
- package/dist/lib/utils/providerUtils.d.ts +2 -1
- package/dist/lib/utils/providerUtils.js +53 -36
- package/dist/lib/utils/timeout.d.ts +72 -1
- package/dist/lib/utils/timeout.js +203 -2
- package/dist/mcp/factory.d.ts +1 -1
- package/dist/mcp/index.d.ts +9 -21
- package/dist/mcp/index.js +16 -57
- package/dist/mcp/registry.js +1 -1
- package/dist/mcp/servers/ai-providers/ai-analysis-tools.js +2 -1
- package/dist/mcp/tool-registry.js +1 -1
- package/dist/neurolink.d.ts +1 -9
- package/dist/neurolink.js +22 -71
- package/dist/providers/amazon-bedrock.js +5 -16
- package/dist/providers/anthropic-baseprovider.js +3 -21
- package/dist/providers/anthropic.js +4 -7
- package/dist/providers/azure-openai.js +6 -3
- package/dist/providers/google-vertex.js +5 -9
- package/dist/providers/huggingFace.js +5 -10
- package/dist/providers/mistral.js +5 -8
- package/dist/providers/openAI.js +4 -7
- package/dist/telemetry/index.js +2 -1
- package/dist/utils/logger.d.ts +62 -2
- package/dist/utils/logger.js +174 -9
- package/dist/utils/providerConfig.d.ts +117 -0
- package/dist/utils/providerConfig.js +353 -0
- package/dist/utils/providerUtils.d.ts +2 -1
- package/dist/utils/providerUtils.js +53 -36
- package/dist/utils/timeout.d.ts +72 -1
- package/dist/utils/timeout.js +203 -2
- package/package.json +1 -1
- package/dist/chat/client-utils.d.ts +0 -95
- package/dist/chat/client-utils.js +0 -315
- package/dist/chat/index.d.ts +0 -24
- package/dist/chat/index.js +0 -33
- package/dist/chat/session-storage.d.ts +0 -77
- package/dist/chat/session-storage.js +0 -233
- package/dist/chat/session.d.ts +0 -96
- package/dist/chat/session.js +0 -257
- package/dist/chat/sse-handler.d.ts +0 -49
- package/dist/chat/sse-handler.js +0 -259
- package/dist/chat/types.d.ts +0 -74
- package/dist/chat/types.js +0 -5
- package/dist/chat/websocket-chat-handler.d.ts +0 -37
- package/dist/chat/websocket-chat-handler.js +0 -262
- package/dist/cli/commands/mcp.d.ts +0 -20
- package/dist/cli/commands/mcp.js +0 -1272
- package/dist/core/defaults.d.ts +0 -19
- package/dist/core/defaults.js +0 -29
- package/dist/core/evaluation-config.d.ts +0 -29
- package/dist/core/evaluation-config.js +0 -144
- package/dist/factories/compatibility-factory.d.ts +0 -35
- package/dist/factories/compatibility-factory.js +0 -71
- package/dist/factories/provider-generate-factory.d.ts +0 -20
- package/dist/factories/provider-generate-factory.js +0 -93
- package/dist/lib/chat/client-utils.d.ts +0 -95
- package/dist/lib/chat/client-utils.js +0 -315
- package/dist/lib/chat/index.d.ts +0 -24
- package/dist/lib/chat/index.js +0 -33
- package/dist/lib/chat/session-storage.d.ts +0 -77
- package/dist/lib/chat/session-storage.js +0 -233
- package/dist/lib/chat/session.d.ts +0 -96
- package/dist/lib/chat/session.js +0 -257
- package/dist/lib/chat/sse-handler.d.ts +0 -49
- package/dist/lib/chat/sse-handler.js +0 -259
- package/dist/lib/chat/types.d.ts +0 -74
- package/dist/lib/chat/types.js +0 -5
- package/dist/lib/chat/websocket-chat-handler.d.ts +0 -37
- package/dist/lib/chat/websocket-chat-handler.js +0 -262
- package/dist/lib/core/defaults.d.ts +0 -19
- package/dist/lib/core/defaults.js +0 -29
- package/dist/lib/core/evaluation-config.d.ts +0 -29
- package/dist/lib/core/evaluation-config.js +0 -144
- package/dist/lib/factories/compatibility-factory.d.ts +0 -35
- package/dist/lib/factories/compatibility-factory.js +0 -71
- package/dist/lib/factories/provider-generate-factory.d.ts +0 -20
- package/dist/lib/factories/provider-generate-factory.js +0 -93
- package/dist/lib/mcp/adapters/plugin-bridge.d.ts +0 -40
- package/dist/lib/mcp/adapters/plugin-bridge.js +0 -89
- package/dist/lib/mcp/auto-discovery.d.ts +0 -62
- package/dist/lib/mcp/auto-discovery.js +0 -149
- package/dist/lib/mcp/client.d.ts +0 -68
- package/dist/lib/mcp/client.js +0 -248
- package/dist/lib/mcp/config.d.ts +0 -31
- package/dist/lib/mcp/config.js +0 -99
- package/dist/lib/mcp/context-manager.d.ts +0 -171
- package/dist/lib/mcp/context-manager.js +0 -362
- package/dist/lib/mcp/contracts/mcp-contract.d.ts +0 -169
- package/dist/lib/mcp/contracts/mcp-contract.js +0 -58
- package/dist/lib/mcp/core/plugin-manager.d.ts +0 -46
- package/dist/lib/mcp/core/plugin-manager.js +0 -110
- package/dist/lib/mcp/demo/plugin-demo.d.ts +0 -20
- package/dist/lib/mcp/demo/plugin-demo.js +0 -118
- package/dist/lib/mcp/dynamic-chain-executor.d.ts +0 -225
- package/dist/lib/mcp/dynamic-chain-executor.js +0 -489
- package/dist/lib/mcp/dynamic-orchestrator.d.ts +0 -115
- package/dist/lib/mcp/dynamic-orchestrator.js +0 -351
- package/dist/lib/mcp/ecosystem.d.ts +0 -75
- package/dist/lib/mcp/ecosystem.js +0 -161
- package/dist/lib/mcp/error-manager.d.ts +0 -254
- package/dist/lib/mcp/error-manager.js +0 -501
- package/dist/lib/mcp/error-recovery.d.ts +0 -159
- package/dist/lib/mcp/error-recovery.js +0 -405
- package/dist/lib/mcp/external-client.d.ts +0 -88
- package/dist/lib/mcp/external-client.js +0 -331
- package/dist/lib/mcp/external-manager.d.ts +0 -112
- package/dist/lib/mcp/external-manager.js +0 -308
- package/dist/lib/mcp/function-calling.d.ts +0 -65
- package/dist/lib/mcp/function-calling.js +0 -642
- package/dist/lib/mcp/health-monitor.d.ts +0 -257
- package/dist/lib/mcp/health-monitor.js +0 -630
- package/dist/lib/mcp/initialize-tools.d.ts +0 -29
- package/dist/lib/mcp/initialize-tools.js +0 -261
- package/dist/lib/mcp/initialize.d.ts +0 -18
- package/dist/lib/mcp/initialize.js +0 -62
- package/dist/lib/mcp/logging.d.ts +0 -38
- package/dist/lib/mcp/logging.js +0 -100
- package/dist/lib/mcp/manager.d.ts +0 -68
- package/dist/lib/mcp/manager.js +0 -176
- package/dist/lib/mcp/neurolink-mcp-client.d.ts +0 -97
- package/dist/lib/mcp/neurolink-mcp-client.js +0 -462
- package/dist/lib/mcp/orchestrator.d.ts +0 -302
- package/dist/lib/mcp/orchestrator.js +0 -703
- package/dist/lib/mcp/plugin-manager.d.ts +0 -98
- package/dist/lib/mcp/plugin-manager.js +0 -296
- package/dist/lib/mcp/plugins/core/filesystem-mcp.d.ts +0 -36
- package/dist/lib/mcp/plugins/core/filesystem-mcp.js +0 -142
- package/dist/lib/mcp/plugins/filesystem-mcp.d.ts +0 -37
- package/dist/lib/mcp/plugins/filesystem-mcp.js +0 -54
- package/dist/lib/mcp/security-manager.d.ts +0 -87
- package/dist/lib/mcp/security-manager.js +0 -344
- package/dist/lib/mcp/semaphore-manager.d.ts +0 -137
- package/dist/lib/mcp/semaphore-manager.js +0 -329
- package/dist/lib/mcp/session-manager.d.ts +0 -187
- package/dist/lib/mcp/session-manager.js +0 -400
- package/dist/lib/mcp/session-persistence.d.ts +0 -93
- package/dist/lib/mcp/session-persistence.js +0 -301
- package/dist/lib/mcp/tool-integration.d.ts +0 -58
- package/dist/lib/mcp/tool-integration.js +0 -203
- package/dist/lib/mcp/transport-manager.d.ts +0 -154
- package/dist/lib/mcp/transport-manager.js +0 -334
- package/dist/lib/mcp/unified-mcp.d.ts +0 -133
- package/dist/lib/mcp/unified-mcp.js +0 -251
- package/dist/lib/mcp/unified-registry.d.ts +0 -165
- package/dist/lib/mcp/unified-registry.js +0 -538
- package/dist/lib/providers/analytics-helper.d.ts +0 -38
- package/dist/lib/providers/analytics-helper.js +0 -216
- package/dist/lib/providers/function-calling-provider.d.ts +0 -142
- package/dist/lib/providers/function-calling-provider.js +0 -630
- package/dist/lib/providers/mcp-provider.d.ts +0 -75
- package/dist/lib/providers/mcp-provider.js +0 -283
- package/dist/lib/providers/timeout-wrapper.d.ts +0 -40
- package/dist/lib/providers/timeout-wrapper.js +0 -100
- package/dist/lib/sdk/tool-extension.d.ts +0 -181
- package/dist/lib/sdk/tool-extension.js +0 -284
- package/dist/lib/services/streaming/streaming-manager.d.ts +0 -29
- package/dist/lib/services/streaming/streaming-manager.js +0 -245
- package/dist/lib/services/types.d.ts +0 -156
- package/dist/lib/services/types.js +0 -2
- package/dist/lib/services/websocket/websocket-server.d.ts +0 -34
- package/dist/lib/services/websocket/websocket-server.js +0 -305
- package/dist/lib/utils/provider-validation.d.ts +0 -36
- package/dist/lib/utils/provider-validation.js +0 -625
- package/dist/lib/utils/providerUtils-fixed.d.ts +0 -8
- package/dist/lib/utils/providerUtils-fixed.js +0 -94
- package/dist/lib/utils/streaming-utils.d.ts +0 -79
- package/dist/lib/utils/streaming-utils.js +0 -198
- package/dist/lib/utils/timeout-manager.d.ts +0 -75
- package/dist/lib/utils/timeout-manager.js +0 -244
- package/dist/mcp/adapters/plugin-bridge.d.ts +0 -40
- package/dist/mcp/adapters/plugin-bridge.js +0 -89
- package/dist/mcp/auto-discovery.d.ts +0 -62
- package/dist/mcp/auto-discovery.js +0 -149
- package/dist/mcp/client.d.ts +0 -68
- package/dist/mcp/client.js +0 -248
- package/dist/mcp/config.d.ts +0 -31
- package/dist/mcp/config.js +0 -99
- package/dist/mcp/context-manager.d.ts +0 -171
- package/dist/mcp/context-manager.js +0 -362
- package/dist/mcp/contracts/mcp-contract.d.ts +0 -169
- package/dist/mcp/contracts/mcp-contract.js +0 -58
- package/dist/mcp/core/plugin-manager.d.ts +0 -46
- package/dist/mcp/core/plugin-manager.js +0 -110
- package/dist/mcp/demo/plugin-demo.d.ts +0 -20
- package/dist/mcp/demo/plugin-demo.js +0 -118
- package/dist/mcp/dynamic-chain-executor.d.ts +0 -225
- package/dist/mcp/dynamic-chain-executor.js +0 -489
- package/dist/mcp/dynamic-orchestrator.d.ts +0 -115
- package/dist/mcp/dynamic-orchestrator.js +0 -351
- package/dist/mcp/ecosystem.d.ts +0 -75
- package/dist/mcp/ecosystem.js +0 -162
- package/dist/mcp/error-manager.d.ts +0 -254
- package/dist/mcp/error-manager.js +0 -501
- package/dist/mcp/error-recovery.d.ts +0 -159
- package/dist/mcp/error-recovery.js +0 -405
- package/dist/mcp/external-client.d.ts +0 -88
- package/dist/mcp/external-client.js +0 -331
- package/dist/mcp/external-manager.d.ts +0 -112
- package/dist/mcp/external-manager.js +0 -308
- package/dist/mcp/function-calling.d.ts +0 -65
- package/dist/mcp/function-calling.js +0 -642
- package/dist/mcp/health-monitor.d.ts +0 -257
- package/dist/mcp/health-monitor.js +0 -630
- package/dist/mcp/initialize-tools.d.ts +0 -29
- package/dist/mcp/initialize-tools.js +0 -262
- package/dist/mcp/initialize.d.ts +0 -18
- package/dist/mcp/initialize.js +0 -62
- package/dist/mcp/logging.d.ts +0 -38
- package/dist/mcp/logging.js +0 -100
- package/dist/mcp/manager.d.ts +0 -68
- package/dist/mcp/manager.js +0 -176
- package/dist/mcp/neurolink-mcp-client.d.ts +0 -97
- package/dist/mcp/neurolink-mcp-client.js +0 -462
- package/dist/mcp/orchestrator.d.ts +0 -302
- package/dist/mcp/orchestrator.js +0 -703
- package/dist/mcp/plugin-manager.d.ts +0 -98
- package/dist/mcp/plugin-manager.js +0 -297
- package/dist/mcp/plugins/core/filesystem-mcp.d.ts +0 -36
- package/dist/mcp/plugins/core/filesystem-mcp.js +0 -142
- package/dist/mcp/plugins/core/neurolink-mcp.json +0 -17
- package/dist/mcp/plugins/filesystem-mcp.d.ts +0 -37
- package/dist/mcp/plugins/filesystem-mcp.js +0 -54
- package/dist/mcp/security-manager.d.ts +0 -87
- package/dist/mcp/security-manager.js +0 -344
- package/dist/mcp/semaphore-manager.d.ts +0 -137
- package/dist/mcp/semaphore-manager.js +0 -329
- package/dist/mcp/session-manager.d.ts +0 -187
- package/dist/mcp/session-manager.js +0 -400
- package/dist/mcp/session-persistence.d.ts +0 -93
- package/dist/mcp/session-persistence.js +0 -302
- package/dist/mcp/tool-integration.d.ts +0 -58
- package/dist/mcp/tool-integration.js +0 -203
- package/dist/mcp/transport-manager.d.ts +0 -154
- package/dist/mcp/transport-manager.js +0 -335
- package/dist/mcp/unified-mcp.d.ts +0 -133
- package/dist/mcp/unified-mcp.js +0 -251
- package/dist/mcp/unified-registry.d.ts +0 -165
- package/dist/mcp/unified-registry.js +0 -539
- package/dist/providers/analytics-helper.d.ts +0 -38
- package/dist/providers/analytics-helper.js +0 -216
- package/dist/providers/function-calling-provider.d.ts +0 -142
- package/dist/providers/function-calling-provider.js +0 -630
- package/dist/providers/mcp-provider.d.ts +0 -75
- package/dist/providers/mcp-provider.js +0 -283
- package/dist/providers/timeout-wrapper.d.ts +0 -40
- package/dist/providers/timeout-wrapper.js +0 -100
- package/dist/sdk/tool-extension.d.ts +0 -181
- package/dist/sdk/tool-extension.js +0 -284
- package/dist/services/streaming/streaming-manager.d.ts +0 -29
- package/dist/services/streaming/streaming-manager.js +0 -245
- package/dist/services/types.d.ts +0 -156
- package/dist/services/types.js +0 -2
- package/dist/services/websocket/websocket-server.d.ts +0 -34
- package/dist/services/websocket/websocket-server.js +0 -306
- package/dist/utils/provider-validation.d.ts +0 -36
- package/dist/utils/provider-validation.js +0 -625
- package/dist/utils/providerUtils-fixed.d.ts +0 -8
- package/dist/utils/providerUtils-fixed.js +0 -94
- package/dist/utils/streaming-utils.d.ts +0 -79
- package/dist/utils/streaming-utils.js +0 -198
- package/dist/utils/timeout-manager.d.ts +0 -75
- package/dist/utils/timeout-manager.js +0 -244
|
@@ -1,50 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Utility functions for AI provider management
|
|
3
|
+
* Consolidated from providerUtils-fixed.ts
|
|
3
4
|
*/
|
|
5
|
+
import { AIProviderFactory } from "../core/factory.js";
|
|
4
6
|
import { logger } from "./logger.js";
|
|
5
7
|
/**
|
|
6
|
-
* Get the best available provider based on
|
|
8
|
+
* Get the best available provider based on real-time availability checks
|
|
9
|
+
* Enhanced version consolidated from providerUtils-fixed.ts
|
|
7
10
|
* @param requestedProvider - Optional preferred provider name
|
|
8
11
|
* @returns The best provider name to use
|
|
9
12
|
*/
|
|
10
13
|
export async function getBestProvider(requestedProvider) {
|
|
11
|
-
// If a specific provider is requested, return it (existing logic)
|
|
12
|
-
if (requestedProvider && requestedProvider !== "auto") {
|
|
13
|
-
return requestedProvider;
|
|
14
|
-
}
|
|
15
14
|
// 🔧 FIX: Check for explicit default provider in env
|
|
16
15
|
if (process.env.DEFAULT_PROVIDER &&
|
|
17
|
-
|
|
16
|
+
(await isProviderAvailable(process.env.DEFAULT_PROVIDER))) {
|
|
18
17
|
return process.env.DEFAULT_PROVIDER;
|
|
19
18
|
}
|
|
20
|
-
// 🔧 FIX: Special case for Ollama when
|
|
19
|
+
// 🔧 FIX: Special case for Ollama - prioritize local when available
|
|
21
20
|
if (process.env.OLLAMA_BASE_URL && process.env.OLLAMA_MODEL) {
|
|
22
|
-
// Quick connectivity check for Ollama (non-blocking)
|
|
23
21
|
try {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
res = await fetch("http://localhost:11434/api/tags", {
|
|
29
|
-
method: "GET",
|
|
30
|
-
signal: controller.signal,
|
|
31
|
-
});
|
|
32
|
-
clearTimeout(timeout);
|
|
33
|
-
if (res.ok) {
|
|
34
|
-
return "ollama"; // Prioritize working local AI
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
clearTimeout(timeout);
|
|
39
|
-
// Fall through to cloud providers
|
|
22
|
+
if (await isProviderAvailable("ollama")) {
|
|
23
|
+
logger.debug(`[getBestProvider] Prioritizing working local Ollama`);
|
|
24
|
+
return "ollama"; // Prioritize working local AI
|
|
40
25
|
}
|
|
41
|
-
// Removed redundant if (res.ok) block here
|
|
42
26
|
}
|
|
43
27
|
catch {
|
|
44
28
|
// Fall through to cloud providers
|
|
45
29
|
}
|
|
46
30
|
}
|
|
47
|
-
// Existing provider priority logic...
|
|
48
31
|
const providers = [
|
|
49
32
|
"google-ai",
|
|
50
33
|
"anthropic",
|
|
@@ -56,24 +39,58 @@ export async function getBestProvider(requestedProvider) {
|
|
|
56
39
|
"bedrock",
|
|
57
40
|
"ollama", // Keep as fallback
|
|
58
41
|
];
|
|
59
|
-
|
|
42
|
+
if (requestedProvider && requestedProvider !== "auto") {
|
|
43
|
+
if (await isProviderAvailable(requestedProvider)) {
|
|
44
|
+
logger.debug(`[getBestProvider] Using requested provider: ${requestedProvider}`);
|
|
45
|
+
return requestedProvider;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
logger.warn(`[getBestProvider] Requested provider '${requestedProvider}' is not available. Falling back to auto-selection.`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
60
51
|
for (const provider of providers) {
|
|
61
|
-
if (
|
|
52
|
+
if (await isProviderAvailable(provider)) {
|
|
62
53
|
logger.debug(`[getBestProvider] Selected provider: ${provider}`);
|
|
63
54
|
return provider;
|
|
64
55
|
}
|
|
65
56
|
}
|
|
66
|
-
|
|
67
|
-
logger.warn("[getBestProvider] No providers configured, defaulting to bedrock");
|
|
68
|
-
return "bedrock";
|
|
57
|
+
throw new Error("No available AI providers. Please check your configurations.");
|
|
69
58
|
}
|
|
70
59
|
/**
|
|
71
|
-
* Check if a provider
|
|
72
|
-
*
|
|
73
|
-
* @
|
|
60
|
+
* Check if a provider is truly available by performing a quick authentication test.
|
|
61
|
+
* Enhanced function consolidated from providerUtils-fixed.ts
|
|
62
|
+
* @param providerName - The name of the provider to check.
|
|
63
|
+
* @returns True if the provider is available and authenticated.
|
|
74
64
|
*/
|
|
75
|
-
function
|
|
76
|
-
|
|
65
|
+
async function isProviderAvailable(providerName) {
|
|
66
|
+
if (!hasProviderEnvVars(providerName) && providerName !== "ollama") {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
if (providerName === "ollama") {
|
|
70
|
+
try {
|
|
71
|
+
const response = await fetch("http://localhost:11434/api/tags", {
|
|
72
|
+
method: "GET",
|
|
73
|
+
signal: AbortSignal.timeout(2000),
|
|
74
|
+
});
|
|
75
|
+
if (response.ok) {
|
|
76
|
+
const { models } = await response.json();
|
|
77
|
+
const defaultOllamaModel = "llama3.2:latest";
|
|
78
|
+
return models.some((m) => m.name === defaultOllamaModel);
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const provider = await AIProviderFactory.createProvider(providerName);
|
|
88
|
+
await provider.generate({ prompt: "test", maxTokens: 1 });
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
77
94
|
}
|
|
78
95
|
/**
|
|
79
96
|
* Check if a provider has the minimum required environment variables
|
|
@@ -66,4 +66,75 @@ export declare function getDefaultTimeout(provider: string, operation?: "generat
|
|
|
66
66
|
* @returns Promise that rejects with TimeoutError
|
|
67
67
|
*/
|
|
68
68
|
export declare function createTimeoutPromise(timeout: number | string | undefined, provider: string, operation: "generate" | "stream"): Promise<never> | null;
|
|
69
|
-
export
|
|
69
|
+
export interface TimeoutConfig {
|
|
70
|
+
operation: string;
|
|
71
|
+
timeout?: number | string;
|
|
72
|
+
gracefulShutdown?: boolean;
|
|
73
|
+
retryOnTimeout?: boolean;
|
|
74
|
+
maxRetries?: number;
|
|
75
|
+
abortSignal?: AbortSignal;
|
|
76
|
+
}
|
|
77
|
+
export interface TimeoutResult<T> {
|
|
78
|
+
success: boolean;
|
|
79
|
+
data?: T;
|
|
80
|
+
error?: Error;
|
|
81
|
+
timedOut: boolean;
|
|
82
|
+
executionTime: number;
|
|
83
|
+
retriesUsed: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Enhanced timeout manager with proper cleanup and abort controller integration
|
|
87
|
+
* Consolidated from timeout-manager.ts
|
|
88
|
+
*/
|
|
89
|
+
export declare class TimeoutManager {
|
|
90
|
+
private activeTimeouts;
|
|
91
|
+
/**
|
|
92
|
+
* Execute operation with timeout and proper cleanup
|
|
93
|
+
*/
|
|
94
|
+
executeWithTimeout<T>(operation: () => Promise<T>, config: TimeoutConfig): Promise<TimeoutResult<T>>;
|
|
95
|
+
private performSingleOperation;
|
|
96
|
+
private getTimeoutMs;
|
|
97
|
+
private generateOperationId;
|
|
98
|
+
private createTimeoutPromise;
|
|
99
|
+
private registerTimeout;
|
|
100
|
+
cleanup(operationId: string): void;
|
|
101
|
+
gracefulShutdown(): void;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Wrapper functions consolidated from timeout-wrapper.ts
|
|
105
|
+
*/
|
|
106
|
+
/**
|
|
107
|
+
* Wrap a promise with timeout
|
|
108
|
+
* @param promise - The promise to wrap
|
|
109
|
+
* @param timeout - Timeout duration (number in ms or string with unit)
|
|
110
|
+
* @param provider - Provider name for error messages
|
|
111
|
+
* @param operation - Operation type (generate or stream)
|
|
112
|
+
* @returns The result of the promise or throws TimeoutError
|
|
113
|
+
*/
|
|
114
|
+
export declare function withTimeout<T>(promise: Promise<T>, timeout: number | string | undefined, provider: string, operation: "generate" | "stream"): Promise<T>;
|
|
115
|
+
/**
|
|
116
|
+
* Wrap a streaming async generator with timeout
|
|
117
|
+
* @param generator - The async generator to wrap
|
|
118
|
+
* @param timeout - Timeout duration for the entire stream
|
|
119
|
+
* @param provider - Provider name for error messages
|
|
120
|
+
* @returns Wrapped async generator that respects timeout
|
|
121
|
+
*/
|
|
122
|
+
export declare function withStreamingTimeout<T>(generator: AsyncGenerator<T>, timeout: number | string | undefined, provider: string): AsyncGenerator<T>;
|
|
123
|
+
/**
|
|
124
|
+
* Create an abort controller with timeout
|
|
125
|
+
* @param timeout - Timeout duration
|
|
126
|
+
* @param provider - Provider name for error messages
|
|
127
|
+
* @param operation - Operation type
|
|
128
|
+
* @returns AbortController and cleanup function
|
|
129
|
+
*/
|
|
130
|
+
export declare function createTimeoutController(timeout: number | string | undefined, provider: string, operation: "generate" | "stream"): {
|
|
131
|
+
controller: AbortController;
|
|
132
|
+
cleanup: () => void;
|
|
133
|
+
timeoutMs: number;
|
|
134
|
+
} | null;
|
|
135
|
+
/**
|
|
136
|
+
* Merge abort signals (for combining user abort with timeout)
|
|
137
|
+
* @param signals - Array of abort signals to merge
|
|
138
|
+
* @returns Combined abort controller
|
|
139
|
+
*/
|
|
140
|
+
export declare function mergeAbortSignals(signals: (AbortSignal | undefined)[]): AbortController;
|
|
@@ -134,5 +134,206 @@ export function createTimeoutPromise(timeout, provider, operation) {
|
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
/**
|
|
138
|
+
* Enhanced timeout manager with proper cleanup and abort controller integration
|
|
139
|
+
* Consolidated from timeout-manager.ts
|
|
140
|
+
*/
|
|
141
|
+
export class TimeoutManager {
|
|
142
|
+
activeTimeouts = new Map();
|
|
143
|
+
/**
|
|
144
|
+
* Execute operation with timeout and proper cleanup
|
|
145
|
+
*/
|
|
146
|
+
async executeWithTimeout(operation, config) {
|
|
147
|
+
const startTime = Date.now();
|
|
148
|
+
const operationId = this.generateOperationId(config.operation);
|
|
149
|
+
let retriesUsed = 0;
|
|
150
|
+
const maxRetries = config.retryOnTimeout ? (config.maxRetries ?? 1) : 0;
|
|
151
|
+
while (retriesUsed <= maxRetries) {
|
|
152
|
+
try {
|
|
153
|
+
const result = await this.performSingleOperation(operation, config, operationId);
|
|
154
|
+
return {
|
|
155
|
+
success: true,
|
|
156
|
+
data: result,
|
|
157
|
+
timedOut: false,
|
|
158
|
+
executionTime: Date.now() - startTime,
|
|
159
|
+
retriesUsed,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
this.cleanup(operationId);
|
|
164
|
+
if (error instanceof TimeoutError && retriesUsed < maxRetries) {
|
|
165
|
+
retriesUsed++;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
success: false,
|
|
170
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
171
|
+
timedOut: error instanceof TimeoutError,
|
|
172
|
+
executionTime: Date.now() - startTime,
|
|
173
|
+
retriesUsed,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
success: false,
|
|
179
|
+
error: new Error("Maximum retries exceeded"),
|
|
180
|
+
timedOut: true,
|
|
181
|
+
executionTime: Date.now() - startTime,
|
|
182
|
+
retriesUsed,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
async performSingleOperation(operation, config, operationId) {
|
|
186
|
+
const timeoutMs = this.getTimeoutMs(config);
|
|
187
|
+
if (!timeoutMs) {
|
|
188
|
+
return await operation();
|
|
189
|
+
}
|
|
190
|
+
const controller = new AbortController();
|
|
191
|
+
const existingSignal = config.abortSignal;
|
|
192
|
+
if (existingSignal) {
|
|
193
|
+
existingSignal.addEventListener("abort", () => {
|
|
194
|
+
controller.abort(existingSignal.reason);
|
|
195
|
+
});
|
|
196
|
+
if (existingSignal.aborted) {
|
|
197
|
+
throw new Error("Operation aborted before execution");
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const timeoutPromise = this.createTimeoutPromise(timeoutMs, operationId);
|
|
201
|
+
this.registerTimeout(operationId, timeoutPromise.timer, controller, () => {
|
|
202
|
+
clearTimeout(timeoutPromise.timer);
|
|
203
|
+
});
|
|
204
|
+
try {
|
|
205
|
+
return await Promise.race([operation(), timeoutPromise.promise]);
|
|
206
|
+
}
|
|
207
|
+
finally {
|
|
208
|
+
this.cleanup(operationId);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
getTimeoutMs(config) {
|
|
212
|
+
return parseTimeout(config.timeout);
|
|
213
|
+
}
|
|
214
|
+
generateOperationId(operation) {
|
|
215
|
+
return `${operation}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
216
|
+
}
|
|
217
|
+
createTimeoutPromise(timeoutMs, operationId) {
|
|
218
|
+
let timer;
|
|
219
|
+
const promise = new Promise((_, reject) => {
|
|
220
|
+
timer = setTimeout(() => {
|
|
221
|
+
reject(new TimeoutError(`Operation timeout after ${timeoutMs}ms`, timeoutMs));
|
|
222
|
+
}, timeoutMs);
|
|
223
|
+
});
|
|
224
|
+
return { promise, timer: timer };
|
|
225
|
+
}
|
|
226
|
+
registerTimeout(operationId, timer, controller, cleanup) {
|
|
227
|
+
this.activeTimeouts.set(operationId, { timer, controller, cleanup });
|
|
228
|
+
}
|
|
229
|
+
cleanup(operationId) {
|
|
230
|
+
const timeoutInfo = this.activeTimeouts.get(operationId);
|
|
231
|
+
if (timeoutInfo) {
|
|
232
|
+
timeoutInfo.cleanup();
|
|
233
|
+
this.activeTimeouts.delete(operationId);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
gracefulShutdown() {
|
|
237
|
+
for (const [operationId] of this.activeTimeouts) {
|
|
238
|
+
this.cleanup(operationId);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Wrapper functions consolidated from timeout-wrapper.ts
|
|
244
|
+
*/
|
|
245
|
+
/**
|
|
246
|
+
* Wrap a promise with timeout
|
|
247
|
+
* @param promise - The promise to wrap
|
|
248
|
+
* @param timeout - Timeout duration (number in ms or string with unit)
|
|
249
|
+
* @param provider - Provider name for error messages
|
|
250
|
+
* @param operation - Operation type (generate or stream)
|
|
251
|
+
* @returns The result of the promise or throws TimeoutError
|
|
252
|
+
*/
|
|
253
|
+
export async function withTimeout(promise, timeout, provider, operation) {
|
|
254
|
+
const timeoutMs = parseTimeout(timeout);
|
|
255
|
+
if (!timeoutMs) {
|
|
256
|
+
return promise;
|
|
257
|
+
}
|
|
258
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
259
|
+
setTimeout(() => {
|
|
260
|
+
reject(new TimeoutError(`${provider} ${operation} operation timed out after ${timeoutMs}ms`, timeoutMs, provider, operation));
|
|
261
|
+
}, timeoutMs);
|
|
262
|
+
});
|
|
263
|
+
return Promise.race([promise, timeoutPromise]);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Wrap a streaming async generator with timeout
|
|
267
|
+
* @param generator - The async generator to wrap
|
|
268
|
+
* @param timeout - Timeout duration for the entire stream
|
|
269
|
+
* @param provider - Provider name for error messages
|
|
270
|
+
* @returns Wrapped async generator that respects timeout
|
|
271
|
+
*/
|
|
272
|
+
export async function* withStreamingTimeout(generator, timeout, provider) {
|
|
273
|
+
const timeoutMs = parseTimeout(timeout);
|
|
274
|
+
if (!timeoutMs) {
|
|
275
|
+
yield* generator;
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
let timeoutId;
|
|
279
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
280
|
+
timeoutId = setTimeout(() => {
|
|
281
|
+
reject(new TimeoutError(`${provider} streaming operation timed out after ${timeoutMs}ms`, timeoutMs, provider, "stream"));
|
|
282
|
+
}, timeoutMs);
|
|
283
|
+
});
|
|
284
|
+
try {
|
|
285
|
+
for await (const item of generator) {
|
|
286
|
+
const raceResult = await Promise.race([
|
|
287
|
+
Promise.resolve(item),
|
|
288
|
+
timeoutPromise,
|
|
289
|
+
]);
|
|
290
|
+
yield raceResult;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
finally {
|
|
294
|
+
clearTimeout(timeoutId);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Create an abort controller with timeout
|
|
299
|
+
* @param timeout - Timeout duration
|
|
300
|
+
* @param provider - Provider name for error messages
|
|
301
|
+
* @param operation - Operation type
|
|
302
|
+
* @returns AbortController and cleanup function
|
|
303
|
+
*/
|
|
304
|
+
export function createTimeoutController(timeout, provider, operation) {
|
|
305
|
+
const timeoutMs = parseTimeout(timeout);
|
|
306
|
+
if (!timeoutMs) {
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
const controller = new AbortController();
|
|
310
|
+
const timer = setTimeout(() => {
|
|
311
|
+
controller.abort(new TimeoutError(`${provider} ${operation} operation timed out after ${timeout}`, timeoutMs, provider, operation));
|
|
312
|
+
}, timeoutMs);
|
|
313
|
+
const cleanup = () => {
|
|
314
|
+
clearTimeout(timer);
|
|
315
|
+
};
|
|
316
|
+
return { controller, cleanup, timeoutMs };
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Merge abort signals (for combining user abort with timeout)
|
|
320
|
+
* @param signals - Array of abort signals to merge
|
|
321
|
+
* @returns Combined abort controller
|
|
322
|
+
*/
|
|
323
|
+
export function mergeAbortSignals(signals) {
|
|
324
|
+
const controller = new AbortController();
|
|
325
|
+
for (const signal of signals) {
|
|
326
|
+
if (signal && !signal.aborted) {
|
|
327
|
+
signal.addEventListener("abort", () => {
|
|
328
|
+
if (!controller.signal.aborted) {
|
|
329
|
+
controller.abort(signal.reason);
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
if (signal?.aborted) {
|
|
334
|
+
controller.abort(signal.reason);
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return controller;
|
|
339
|
+
}
|
package/dist/mcp/factory.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Compatible with Lighthouse MCP patterns for seamless migration
|
|
5
5
|
*/
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
import type { ExecutionContext } from "./contracts/
|
|
7
|
+
import type { ExecutionContext } from "./contracts/mcpContract.js";
|
|
8
8
|
/**
|
|
9
9
|
* MCP Server Categories for organization and discovery
|
|
10
10
|
*/
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -3,39 +3,27 @@
|
|
|
3
3
|
* Universal AI Development Platform with Extensible Plugin Architecture
|
|
4
4
|
* Implementation based on research blueprint
|
|
5
5
|
*/
|
|
6
|
-
export {
|
|
7
|
-
export
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
export { SecurityManager } from "./security-manager.js";
|
|
11
|
-
export { mcpLogger } from "./logging.js";
|
|
12
|
-
export type { LogLevel } from "./logging.js";
|
|
13
|
-
export { FileSystemMCP } from "./plugins/core/filesystem-mcp.js";
|
|
14
|
-
import type { MCPMetadata } from "./contracts/mcp-contract.js";
|
|
6
|
+
export type { McpMetadata, ExecutionContext, DiscoveredMcp, ToolInfo, ToolExecutionResult, } from "./contracts/mcpContract.js";
|
|
7
|
+
export { mcpLogger } from "../utils/logger.js";
|
|
8
|
+
export type { LogLevel } from "../utils/logger.js";
|
|
9
|
+
import type { McpMetadata } from "./contracts/mcpContract.js";
|
|
15
10
|
/**
|
|
16
|
-
* Initialize the MCP ecosystem
|
|
11
|
+
* Initialize the MCP ecosystem - simplified
|
|
17
12
|
*/
|
|
18
13
|
export declare function initializeMCPEcosystem(): Promise<void>;
|
|
19
14
|
/**
|
|
20
|
-
* List available MCPs
|
|
15
|
+
* List available MCPs - simplified
|
|
21
16
|
*/
|
|
22
|
-
export declare function listMCPs(): Promise<
|
|
17
|
+
export declare function listMCPs(): Promise<McpMetadata[]>;
|
|
23
18
|
/**
|
|
24
|
-
* Execute an MCP operation
|
|
19
|
+
* Execute an MCP operation - simplified
|
|
25
20
|
*/
|
|
26
21
|
export declare function executeMCP<T = unknown>(name: string, config: unknown, args: unknown, context?: {
|
|
27
22
|
sessionId?: string;
|
|
28
23
|
userId?: string;
|
|
29
24
|
}): Promise<T>;
|
|
30
25
|
/**
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
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
|
-
/**
|
|
38
|
-
* Get MCP ecosystem statistics
|
|
26
|
+
* Get MCP ecosystem statistics - simplified
|
|
39
27
|
*/
|
|
40
28
|
export declare function getMCPStats(): Promise<{
|
|
41
29
|
initialized: boolean;
|
package/dist/mcp/index.js
CHANGED
|
@@ -3,76 +3,35 @@
|
|
|
3
3
|
* Universal AI Development Platform with Extensible Plugin Architecture
|
|
4
4
|
* Implementation based on research blueprint
|
|
5
5
|
*/
|
|
6
|
-
// Core
|
|
7
|
-
export {
|
|
8
|
-
// Main ecosystem interface
|
|
9
|
-
export { MCPEcosystem, mcpEcosystem } from "./ecosystem.js";
|
|
10
|
-
// Plugin management
|
|
11
|
-
export { PluginManager, pluginManager } from "./plugin-manager.js";
|
|
12
|
-
// Security
|
|
13
|
-
export { SecurityManager } from "./security-manager.js";
|
|
14
|
-
// Logging
|
|
15
|
-
export { mcpLogger } from "./logging.js";
|
|
16
|
-
// Core plugins
|
|
17
|
-
export { FileSystemMCP } from "./plugins/core/filesystem-mcp.js";
|
|
6
|
+
// Core functionality exports
|
|
7
|
+
export { mcpLogger } from "../utils/logger.js";
|
|
18
8
|
/**
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
// Import the ecosystem singleton
|
|
22
|
-
import { mcpEcosystem } from "./ecosystem.js";
|
|
23
|
-
/**
|
|
24
|
-
* Initialize the MCP ecosystem
|
|
9
|
+
* Initialize the MCP ecosystem - simplified
|
|
25
10
|
*/
|
|
26
11
|
export async function initializeMCPEcosystem() {
|
|
27
|
-
|
|
12
|
+
// Simplified initialization - no complex ecosystem needed
|
|
13
|
+
return Promise.resolve();
|
|
28
14
|
}
|
|
29
15
|
/**
|
|
30
|
-
* List available MCPs
|
|
16
|
+
* List available MCPs - simplified
|
|
31
17
|
*/
|
|
32
18
|
export async function listMCPs() {
|
|
33
|
-
return
|
|
19
|
+
return [];
|
|
34
20
|
}
|
|
35
21
|
/**
|
|
36
|
-
* Execute an MCP operation
|
|
22
|
+
* Execute an MCP operation - simplified
|
|
37
23
|
*/
|
|
38
24
|
export async function executeMCP(name, config, args, context) {
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Quick filesystem operations
|
|
43
|
-
*/
|
|
44
|
-
export async function readFile(path, basePath) {
|
|
45
|
-
return mcpEcosystem.filesystem({
|
|
46
|
-
action: "readFile",
|
|
47
|
-
path,
|
|
48
|
-
basePath,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
export async function writeFile(path, content, basePath) {
|
|
52
|
-
return mcpEcosystem.filesystem({
|
|
53
|
-
action: "writeFile",
|
|
54
|
-
path,
|
|
55
|
-
content,
|
|
56
|
-
basePath,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
export async function listFiles(path, basePath) {
|
|
60
|
-
return mcpEcosystem.filesystem({
|
|
61
|
-
action: "listFiles",
|
|
62
|
-
path,
|
|
63
|
-
basePath,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
export async function createDirectory(path, basePath) {
|
|
67
|
-
return mcpEcosystem.filesystem({
|
|
68
|
-
action: "createDir",
|
|
69
|
-
path,
|
|
70
|
-
basePath,
|
|
71
|
-
});
|
|
25
|
+
throw new Error("MCP execution not available - ecosystem removed");
|
|
72
26
|
}
|
|
73
27
|
/**
|
|
74
|
-
* Get MCP ecosystem statistics
|
|
28
|
+
* Get MCP ecosystem statistics - simplified
|
|
75
29
|
*/
|
|
76
30
|
export async function getMCPStats() {
|
|
77
|
-
return
|
|
31
|
+
return {
|
|
32
|
+
initialized: false,
|
|
33
|
+
pluginsDiscovered: 0,
|
|
34
|
+
pluginsBySource: {},
|
|
35
|
+
availablePlugins: [],
|
|
36
|
+
};
|
|
78
37
|
}
|
package/dist/mcp/registry.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MCP Registry - Industry Standard Interface with camelCase
|
|
3
3
|
*/
|
|
4
|
-
import { registryLogger } from "
|
|
4
|
+
import { registryLogger } from "../utils/logger.js";
|
|
5
5
|
/**
|
|
6
6
|
* Simple MCP registry for plugin management
|
|
7
7
|
* Maintains backward compatibility with existing code
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { AIProviderFactory } from "../../../core/factory.js";
|
|
8
8
|
import { getBestProvider, getAvailableProviders, } from "../../../utils/providerUtils.js";
|
|
9
|
+
import { logger } from "../../../utils/logger.js";
|
|
9
10
|
/**
|
|
10
11
|
* Input Schemas for AI Analysis Tools
|
|
11
12
|
*/
|
|
@@ -89,7 +90,7 @@ const analyzeAIUsageTool = {
|
|
|
89
90
|
const typedParams = params;
|
|
90
91
|
const startTime = Date.now();
|
|
91
92
|
try {
|
|
92
|
-
|
|
93
|
+
logger.debug(`[AI-Analysis] Starting real AI-powered usage analysis for timeRange: ${typedParams.timeRange}`);
|
|
93
94
|
const providerName = await getBestProvider();
|
|
94
95
|
const provider = await AIProviderFactory.createProvider(providerName);
|
|
95
96
|
if (!provider) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Updated to match industry standard camelCase interfaces
|
|
4
4
|
*/
|
|
5
5
|
import { MCPRegistry } from "./registry.js";
|
|
6
|
-
import { registryLogger } from "
|
|
6
|
+
import { registryLogger } from "../utils/logger.js";
|
|
7
7
|
import { randomUUID } from "crypto";
|
|
8
8
|
export class MCPToolRegistry extends MCPRegistry {
|
|
9
9
|
tools = new Map();
|
package/dist/neurolink.d.ts
CHANGED
|
@@ -40,7 +40,6 @@ export interface MCPServerInfo {
|
|
|
40
40
|
}
|
|
41
41
|
export declare class NeuroLink {
|
|
42
42
|
private mcpInitialized;
|
|
43
|
-
private contextManager;
|
|
44
43
|
private customTools;
|
|
45
44
|
private inMemoryServers;
|
|
46
45
|
constructor();
|
|
@@ -139,14 +138,7 @@ export declare class NeuroLink {
|
|
|
139
138
|
* Get all available tools including custom and in-memory ones
|
|
140
139
|
* @returns Array of available tools with metadata
|
|
141
140
|
*/
|
|
142
|
-
getAllAvailableTools(): Promise<
|
|
143
|
-
serverId: string;
|
|
144
|
-
serverTitle: string;
|
|
145
|
-
toolName: string;
|
|
146
|
-
namespacedName: string;
|
|
147
|
-
description: string;
|
|
148
|
-
isImplemented: boolean;
|
|
149
|
-
}[]>;
|
|
141
|
+
getAllAvailableTools(): Promise<import("./mcp/tool-registry.js").ToolInfo[]>;
|
|
150
142
|
/**
|
|
151
143
|
* Get comprehensive status of all AI providers
|
|
152
144
|
* Primary method for provider health checking and diagnostics
|