@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
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { promises as fs } from "fs";
|
|
6
6
|
import path from "path";
|
|
7
7
|
import crypto from "crypto";
|
|
8
|
+
import { logger } from "../utils/logger.js";
|
|
8
9
|
const { readFile, writeFile, readdir, mkdir, unlink, access } = fs;
|
|
9
10
|
/**
|
|
10
11
|
* Enhanced Config Manager with automatic backup/restore capabilities
|
|
@@ -32,7 +33,7 @@ export class NeuroLinkConfigManager {
|
|
|
32
33
|
if (createBackup) {
|
|
33
34
|
await this.createBackup(reason);
|
|
34
35
|
if (!silent) {
|
|
35
|
-
|
|
36
|
+
logger.info("💾 Backup created before config update");
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
const existing = await this.loadConfig();
|
|
@@ -50,7 +51,7 @@ export class NeuroLinkConfigManager {
|
|
|
50
51
|
try {
|
|
51
52
|
await this.persistConfig(this.config);
|
|
52
53
|
if (!silent) {
|
|
53
|
-
|
|
54
|
+
logger.info("✅ Configuration updated successfully");
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
catch (error) {
|
|
@@ -58,7 +59,7 @@ export class NeuroLinkConfigManager {
|
|
|
58
59
|
if (createBackup) {
|
|
59
60
|
await this.restoreLatestBackup();
|
|
60
61
|
if (!silent) {
|
|
61
|
-
|
|
62
|
+
logger.info("🔄 Auto-restored from backup due to error");
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
throw new Error(`Config update failed, restored from backup: ${error.message}`);
|
|
@@ -115,13 +116,13 @@ export default ${JSON.stringify(currentConfig, null, 2)};`;
|
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
118
|
catch (error) {
|
|
118
|
-
|
|
119
|
+
logger.warn(`Failed to read backup ${file}:`, error.message);
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
return backups.sort((a, b) => b.metadata.timestamp - a.metadata.timestamp);
|
|
122
123
|
}
|
|
123
124
|
catch (error) {
|
|
124
|
-
|
|
125
|
+
logger.warn("Failed to list backups:", error.message);
|
|
125
126
|
return [];
|
|
126
127
|
}
|
|
127
128
|
}
|
|
@@ -142,7 +143,7 @@ export default ${JSON.stringify(currentConfig, null, 2)};`;
|
|
|
142
143
|
}
|
|
143
144
|
this.config = restoredConfig;
|
|
144
145
|
await this.persistConfig(this.config);
|
|
145
|
-
|
|
146
|
+
logger.info(`✅ Config restored from backup: ${backupFilename}`);
|
|
146
147
|
}
|
|
147
148
|
catch (error) {
|
|
148
149
|
throw new Error(`Failed to restore from backup ${backupFilename}: ${error.message}`);
|
|
@@ -167,10 +168,10 @@ export default ${JSON.stringify(currentConfig, null, 2)};`;
|
|
|
167
168
|
for (const backup of toDelete) {
|
|
168
169
|
try {
|
|
169
170
|
await unlink(backup.path);
|
|
170
|
-
|
|
171
|
+
logger.info(`🗑️ Deleted old backup: ${backup.filename}`);
|
|
171
172
|
}
|
|
172
173
|
catch (error) {
|
|
173
|
-
|
|
174
|
+
logger.warn(`Failed to delete backup ${backup.filename}:`, error.message);
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
177
|
}
|
|
@@ -248,7 +249,7 @@ export default ${JSON.stringify(currentConfig, null, 2)};`;
|
|
|
248
249
|
await mkdir(this.backupDir, { recursive: true });
|
|
249
250
|
}
|
|
250
251
|
catch (error) {
|
|
251
|
-
|
|
252
|
+
logger.warn("Failed to create backup directory:", error.message);
|
|
252
253
|
}
|
|
253
254
|
}
|
|
254
255
|
async readConfigFile() {
|
|
@@ -265,7 +266,7 @@ export default ${JSON.stringify(currentConfig, null, 2)};`;
|
|
|
265
266
|
throw new Error("Invalid config file format");
|
|
266
267
|
}
|
|
267
268
|
catch (error) {
|
|
268
|
-
|
|
269
|
+
logger.info("Config file not found, generating default...");
|
|
269
270
|
return await this.generateDefaultConfig();
|
|
270
271
|
}
|
|
271
272
|
}
|
|
@@ -17,8 +17,18 @@ export interface AnalyticsData {
|
|
|
17
17
|
responseTime: number;
|
|
18
18
|
context?: Record<string, JsonValue>;
|
|
19
19
|
timestamp: string;
|
|
20
|
+
evaluation?: {
|
|
21
|
+
relevanceScore: number;
|
|
22
|
+
accuracyScore: number;
|
|
23
|
+
completenessScore: number;
|
|
24
|
+
overall: number;
|
|
25
|
+
evaluationProvider?: string;
|
|
26
|
+
evaluationTime?: number;
|
|
27
|
+
evaluationAttempt?: number;
|
|
28
|
+
};
|
|
29
|
+
costDetails?: UnknownRecord;
|
|
20
30
|
}
|
|
21
31
|
/**
|
|
22
32
|
* Create analytics data structure from AI response
|
|
23
33
|
*/
|
|
24
|
-
export declare function createAnalytics(provider: string, model: string, result:
|
|
34
|
+
export declare function createAnalytics(provider: string, model: string, result: unknown, responseTime: number, context?: Record<string, unknown>): AnalyticsData;
|
|
@@ -21,7 +21,7 @@ export function createAnalytics(provider, model, result, responseTime, context)
|
|
|
21
21
|
tokens,
|
|
22
22
|
cost,
|
|
23
23
|
responseTime,
|
|
24
|
-
context,
|
|
24
|
+
context: context,
|
|
25
25
|
timestamp: new Date().toISOString(),
|
|
26
26
|
};
|
|
27
27
|
logger.debug(`[${functionTag}] Analytics created`, {
|
|
@@ -41,7 +41,7 @@ export function createAnalytics(provider, model, result, responseTime, context)
|
|
|
41
41
|
model,
|
|
42
42
|
tokens: { input: 0, output: 0, total: 0 },
|
|
43
43
|
responseTime,
|
|
44
|
-
context,
|
|
44
|
+
context: context,
|
|
45
45
|
timestamp: new Date().toISOString(),
|
|
46
46
|
};
|
|
47
47
|
}
|
|
@@ -260,24 +260,10 @@ export class BaseProvider {
|
|
|
260
260
|
// Not an error - custom tools are optional
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
-
//
|
|
263
|
+
// MCP tools loading simplified - removed function-calling dependency
|
|
264
264
|
if (!this.mcpTools) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
const result = await getAvailableFunctionTools();
|
|
268
|
-
if (isValidToolsObject(result)) {
|
|
269
|
-
this.mcpTools = result.toolsObject;
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
logger.debug(`Invalid or empty toolsObject for ${this.providerName}: Expected an object with at least one key, but got ${typeof result?.toolsObject} with ${result?.toolsObject
|
|
273
|
-
? Object.keys(result.toolsObject).length
|
|
274
|
-
: 0} keys. Full result:`, result);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
catch (error) {
|
|
278
|
-
logger.debug(`MCP tools not available for ${this.providerName}:`, error);
|
|
279
|
-
// Not an error - MCP tools are optional
|
|
280
|
-
}
|
|
265
|
+
// Set empty tools object - MCP tools are handled at a higher level
|
|
266
|
+
this.mcpTools = {};
|
|
281
267
|
}
|
|
282
268
|
// Add MCP tools if available
|
|
283
269
|
if (this.mcpTools) {
|
|
@@ -353,7 +339,7 @@ export class BaseProvider {
|
|
|
353
339
|
return enhancedResult;
|
|
354
340
|
}
|
|
355
341
|
async createAnalytics(result, responseTime, options) {
|
|
356
|
-
const { createAnalytics } = await import("
|
|
342
|
+
const { createAnalytics } = await import("./analytics.js");
|
|
357
343
|
return createAnalytics(this.providerName, this.modelName, result, responseTime, options.context);
|
|
358
344
|
}
|
|
359
345
|
async createEvaluation(result, options) {
|
|
@@ -21,8 +21,8 @@ declare const ModelConfigSchema: z.ZodObject<{
|
|
|
21
21
|
releaseDate: z.ZodString;
|
|
22
22
|
}, "strip", z.ZodTypeAny, {
|
|
23
23
|
id: string;
|
|
24
|
-
capabilities: string[];
|
|
25
24
|
displayName: string;
|
|
25
|
+
capabilities: string[];
|
|
26
26
|
deprecated: boolean;
|
|
27
27
|
pricing: {
|
|
28
28
|
input: number;
|
|
@@ -32,8 +32,8 @@ declare const ModelConfigSchema: z.ZodObject<{
|
|
|
32
32
|
releaseDate: string;
|
|
33
33
|
}, {
|
|
34
34
|
id: string;
|
|
35
|
-
capabilities: string[];
|
|
36
35
|
displayName: string;
|
|
36
|
+
capabilities: string[];
|
|
37
37
|
deprecated: boolean;
|
|
38
38
|
pricing: {
|
|
39
39
|
input: number;
|
|
@@ -64,8 +64,8 @@ declare const ModelRegistrySchema: z.ZodObject<{
|
|
|
64
64
|
releaseDate: z.ZodString;
|
|
65
65
|
}, "strip", z.ZodTypeAny, {
|
|
66
66
|
id: string;
|
|
67
|
-
capabilities: string[];
|
|
68
67
|
displayName: string;
|
|
68
|
+
capabilities: string[];
|
|
69
69
|
deprecated: boolean;
|
|
70
70
|
pricing: {
|
|
71
71
|
input: number;
|
|
@@ -75,8 +75,8 @@ declare const ModelRegistrySchema: z.ZodObject<{
|
|
|
75
75
|
releaseDate: string;
|
|
76
76
|
}, {
|
|
77
77
|
id: string;
|
|
78
|
-
capabilities: string[];
|
|
79
78
|
displayName: string;
|
|
79
|
+
capabilities: string[];
|
|
80
80
|
deprecated: boolean;
|
|
81
81
|
pricing: {
|
|
82
82
|
input: number;
|
|
@@ -89,11 +89,10 @@ declare const ModelRegistrySchema: z.ZodObject<{
|
|
|
89
89
|
defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
90
90
|
}, "strip", z.ZodTypeAny, {
|
|
91
91
|
version: string;
|
|
92
|
-
lastUpdated: string;
|
|
93
92
|
models: Record<string, Record<string, {
|
|
94
93
|
id: string;
|
|
95
|
-
capabilities: string[];
|
|
96
94
|
displayName: string;
|
|
95
|
+
capabilities: string[];
|
|
97
96
|
deprecated: boolean;
|
|
98
97
|
pricing: {
|
|
99
98
|
input: number;
|
|
@@ -102,15 +101,15 @@ declare const ModelRegistrySchema: z.ZodObject<{
|
|
|
102
101
|
contextWindow: number;
|
|
103
102
|
releaseDate: string;
|
|
104
103
|
}>>;
|
|
104
|
+
lastUpdated: string;
|
|
105
105
|
aliases?: Record<string, string> | undefined;
|
|
106
106
|
defaults?: Record<string, string> | undefined;
|
|
107
107
|
}, {
|
|
108
108
|
version: string;
|
|
109
|
-
lastUpdated: string;
|
|
110
109
|
models: Record<string, Record<string, {
|
|
111
110
|
id: string;
|
|
112
|
-
capabilities: string[];
|
|
113
111
|
displayName: string;
|
|
112
|
+
capabilities: string[];
|
|
114
113
|
deprecated: boolean;
|
|
115
114
|
pricing: {
|
|
116
115
|
input: number;
|
|
@@ -119,6 +118,7 @@ declare const ModelRegistrySchema: z.ZodObject<{
|
|
|
119
118
|
contextWindow: number;
|
|
120
119
|
releaseDate: string;
|
|
121
120
|
}>>;
|
|
121
|
+
lastUpdated: string;
|
|
122
122
|
aliases?: Record<string, string> | undefined;
|
|
123
123
|
defaults?: Record<string, string> | undefined;
|
|
124
124
|
}>;
|
package/dist/lib/core/factory.js
CHANGED
|
@@ -87,13 +87,12 @@ export class AIProviderFactory {
|
|
|
87
87
|
// );
|
|
88
88
|
// }
|
|
89
89
|
// }
|
|
90
|
-
let provider;
|
|
91
90
|
// PURE FACTORY PATTERN: No switch statements - use ProviderFactory exclusively
|
|
92
91
|
const normalizedName = this.normalizeProviderName(providerName);
|
|
93
92
|
const finalModelName = resolvedModelName === "default" || resolvedModelName === null
|
|
94
93
|
? undefined
|
|
95
94
|
: resolvedModelName;
|
|
96
|
-
provider = await ProviderFactory.createProvider(normalizedName, finalModelName, sdk);
|
|
95
|
+
const provider = await ProviderFactory.createProvider(normalizedName, finalModelName, sdk);
|
|
97
96
|
logger.debug(componentIdentifier, "Pure factory pattern provider created", {
|
|
98
97
|
providerName: normalizedName,
|
|
99
98
|
modelName: finalModelName,
|
|
@@ -103,15 +102,8 @@ export class AIProviderFactory {
|
|
|
103
102
|
// Wrap with MCP if enabled
|
|
104
103
|
if (enableMCP) {
|
|
105
104
|
try {
|
|
106
|
-
logger.debug(`[${functionTag}]
|
|
107
|
-
|
|
108
|
-
provider = createMCPAwareProviderV3(provider, {
|
|
109
|
-
providerName,
|
|
110
|
-
modelName: resolvedModelName || undefined,
|
|
111
|
-
enableMCP: true,
|
|
112
|
-
enableFunctionCalling: true,
|
|
113
|
-
});
|
|
114
|
-
logger.debug(`[${functionTag}] Provider wrapped with MCP support`);
|
|
105
|
+
logger.debug(`[${functionTag}] MCP wrapping disabled - function-calling removed`);
|
|
106
|
+
// MCP wrapping simplified - removed function-calling dependency
|
|
115
107
|
}
|
|
116
108
|
catch (mcpError) {
|
|
117
109
|
logger.warn(`[${functionTag}] Failed to wrap with MCP, using base provider`, {
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -10,8 +10,6 @@ import { AIProviderFactory } from "./core/factory.js";
|
|
|
10
10
|
export { AIProviderFactory };
|
|
11
11
|
export type { AIProvider, AIProviderName, ProviderConfig, StreamingOptions, ProviderAttempt, SupportedModelName, } from "./core/types.js";
|
|
12
12
|
export type { GenerateOptions, GenerateResult, EnhancedProvider, } from "./types/generate-types.js";
|
|
13
|
-
export { CompatibilityConversionFactory } from "./factories/compatibility-factory.js";
|
|
14
|
-
export { ProviderGenerateFactory } from "./factories/provider-generate-factory.js";
|
|
15
13
|
export type { SimpleTool, ToolContext } from "./sdk/tool-registration.js";
|
|
16
14
|
export { createTool, createTypedTool, validateTool, } from "./sdk/tool-registration.js";
|
|
17
15
|
export type { InMemoryMCPServerConfig, InMemoryToolInfo, InMemoryToolResult, } from "./types/mcp-types.js";
|
|
@@ -78,8 +76,8 @@ export declare function createBestAIProvider(requestedProvider?: string, modelNa
|
|
|
78
76
|
* await writeFile('output.txt', 'Hello from MCP!');
|
|
79
77
|
* ```
|
|
80
78
|
*/
|
|
81
|
-
export {
|
|
82
|
-
export type {
|
|
79
|
+
export { initializeMCPEcosystem, listMCPs, executeMCP, getMCPStats, mcpLogger, } from "./mcp/index.js";
|
|
80
|
+
export type { McpMetadata, ExecutionContext, DiscoveredMcp, ToolInfo, ToolExecutionResult, LogLevel, } from "./mcp/index.js";
|
|
83
81
|
export declare function initializeTelemetry(): Promise<boolean>;
|
|
84
82
|
export declare function getTelemetryStatus(): {
|
|
85
83
|
enabled: boolean;
|
package/dist/lib/index.js
CHANGED
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
// Core exports
|
|
10
10
|
import { AIProviderFactory } from "./core/factory.js";
|
|
11
11
|
export { AIProviderFactory };
|
|
12
|
-
export { CompatibilityConversionFactory } from "./factories/compatibility-factory.js";
|
|
13
|
-
export { ProviderGenerateFactory } from "./factories/provider-generate-factory.js";
|
|
14
12
|
export { createTool, createTypedTool, validateTool, } from "./sdk/tool-registration.js";
|
|
15
13
|
// Model enums
|
|
16
14
|
export { BedrockModels, OpenAIModels, VertexModels, DEFAULT_PROVIDER_CONFIGS, } from "./core/types.js";
|
|
@@ -86,15 +84,8 @@ export async function createBestAIProvider(requestedProvider, modelName) {
|
|
|
86
84
|
*/
|
|
87
85
|
export {
|
|
88
86
|
// Core MCP ecosystem
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
PluginManager, pluginManager, listMCPs, executeMCP, getMCPStats,
|
|
92
|
-
// Quick filesystem operations
|
|
93
|
-
readFile, writeFile, listFiles, createDirectory,
|
|
94
|
-
// Core contracts and types
|
|
95
|
-
MCP, SecurityManager, mcpLogger,
|
|
96
|
-
// Core plugins
|
|
97
|
-
FileSystemMCP, } from "./mcp/index.js";
|
|
87
|
+
// Simplified MCP exports
|
|
88
|
+
initializeMCPEcosystem, listMCPs, executeMCP, getMCPStats, mcpLogger, } from "./mcp/index.js";
|
|
98
89
|
// ============================================================================
|
|
99
90
|
// REAL-TIME SERVICES & TELEMETRY - Enterprise Platform Features
|
|
100
91
|
// ============================================================================
|
|
@@ -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/lib/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/lib/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/lib/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/lib/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("./index.js").ToolInfo[]>;
|
|
150
142
|
/**
|
|
151
143
|
* Get comprehensive status of all AI providers
|
|
152
144
|
* Primary method for provider health checking and diagnostics
|