@juspay/neurolink 6.0.0 ā 6.2.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 +14 -3
- package/dist/cli/commands/config.d.ts +13 -13
- package/dist/cli/index.js +3 -9
- 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/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 +7 -19
- package/dist/lib/mcp/index.js +15 -56
- package/dist/lib/neurolink.d.ts +1 -9
- package/dist/lib/neurolink.js +21 -70
- 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 +4 -2
- 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/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 +7 -19
- package/dist/mcp/index.js +15 -56
- package/dist/neurolink.d.ts +1 -9
- package/dist/neurolink.js +21 -70
- 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 +4 -2
- 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/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 +2 -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/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/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
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 type { MCPMetadata, ExecutionContext, MCPConstructor, MCPInstance, DiscoveredMCP, } from "./contracts/mcp-contract.js";
|
|
8
|
-
export { MCPEcosystem, mcpEcosystem } from "./ecosystem.js";
|
|
9
|
-
export { PluginManager, pluginManager } from "./plugin-manager.js";
|
|
10
|
-
export { SecurityManager } from "./security-manager.js";
|
|
6
|
+
export type { McpMetadata, ExecutionContext, DiscoveredMcp, ToolInfo, ToolExecutionResult, } from "./contracts/mcpContract.js";
|
|
11
7
|
export { mcpLogger } from "./logging.js";
|
|
12
8
|
export type { LogLevel } from "./logging.js";
|
|
13
|
-
|
|
14
|
-
import type { MCPMetadata } from "./contracts/mcp-contract.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 { MCP } from "./contracts/mcp-contract.js";
|
|
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
|
|
6
|
+
// Core functionality exports
|
|
15
7
|
export { mcpLogger } from "./logging.js";
|
|
16
|
-
// Core plugins
|
|
17
|
-
export { FileSystemMCP } from "./plugins/core/filesystem-mcp.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/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
|
package/dist/lib/neurolink.js
CHANGED
|
@@ -14,18 +14,15 @@ catch (error) {
|
|
|
14
14
|
// Environment variables should be set externally in production
|
|
15
15
|
}
|
|
16
16
|
import { AIProviderFactory } from "./core/factory.js";
|
|
17
|
-
import { ContextManager } from "./mcp/context-manager.js";
|
|
18
17
|
import { mcpLogger } from "./mcp/logging.js";
|
|
19
18
|
import { toolRegistry } from "./mcp/tool-registry.js";
|
|
20
|
-
import { unifiedRegistry } from "./mcp/unified-registry.js";
|
|
21
19
|
import { logger } from "./utils/logger.js";
|
|
22
|
-
import { getBestProvider } from "./utils/providerUtils
|
|
20
|
+
import { getBestProvider } from "./utils/providerUtils.js";
|
|
23
21
|
import { ProviderRegistry } from "./factories/provider-registry.js";
|
|
24
22
|
import { validateTool, createMCPServerFromTools, } from "./sdk/tool-registration.js";
|
|
25
23
|
// Core types imported from core/types.js
|
|
26
24
|
export class NeuroLink {
|
|
27
25
|
mcpInitialized = false;
|
|
28
|
-
contextManager;
|
|
29
26
|
// Tool registration support
|
|
30
27
|
customTools = new Map();
|
|
31
28
|
inMemoryServers = new Map();
|
|
@@ -34,7 +31,6 @@ export class NeuroLink {
|
|
|
34
31
|
ProviderRegistry.setOptions({
|
|
35
32
|
enableManualMCP: false,
|
|
36
33
|
});
|
|
37
|
-
this.contextManager = new ContextManager();
|
|
38
34
|
}
|
|
39
35
|
/**
|
|
40
36
|
* Initialize MCP registry with enhanced error handling and resource cleanup
|
|
@@ -223,12 +219,7 @@ export class NeuroLink {
|
|
|
223
219
|
if (!this.mcpInitialized) {
|
|
224
220
|
return null; // Skip MCP if not available
|
|
225
221
|
}
|
|
226
|
-
//
|
|
227
|
-
const context = this.contextManager.createContext({
|
|
228
|
-
sessionId: `neurolink-${Date.now()}`,
|
|
229
|
-
userId: "neurolink-user",
|
|
230
|
-
aiProvider: options.provider || "auto",
|
|
231
|
-
});
|
|
222
|
+
// Context creation removed - was never used
|
|
232
223
|
// Determine provider
|
|
233
224
|
const providerName = options.provider === "auto" || !options.provider
|
|
234
225
|
? await getBestProvider()
|
|
@@ -402,12 +393,7 @@ export class NeuroLink {
|
|
|
402
393
|
}
|
|
403
394
|
// Initialize MCP if needed
|
|
404
395
|
await this.initializeMCP();
|
|
405
|
-
//
|
|
406
|
-
const context = this.contextManager.createContext({
|
|
407
|
-
sessionId: `neurolink-stream-${Date.now()}`,
|
|
408
|
-
userId: "neurolink-user",
|
|
409
|
-
aiProvider: options.provider || "auto",
|
|
410
|
-
});
|
|
396
|
+
// Context creation removed - was never used
|
|
411
397
|
// Determine provider to use
|
|
412
398
|
const providerName = options.provider === "auto" || !options.provider
|
|
413
399
|
? await getBestProvider()
|
|
@@ -416,7 +402,6 @@ export class NeuroLink {
|
|
|
416
402
|
mcpLogger.debug(`[${functionTag}] Starting MCP-enabled streaming`, {
|
|
417
403
|
provider: providerName,
|
|
418
404
|
prompt: (options.input.text?.substring(0, 100) || "No text") + "...",
|
|
419
|
-
contextId: context.sessionId,
|
|
420
405
|
});
|
|
421
406
|
// Create provider using the same factory pattern as generate
|
|
422
407
|
const provider = await AIProviderFactory.createBestProvider(providerName, options.model, true, this);
|
|
@@ -632,19 +617,14 @@ export class NeuroLink {
|
|
|
632
617
|
}
|
|
633
618
|
// If not found in custom tools or in-memory servers, try unified registry
|
|
634
619
|
try {
|
|
635
|
-
//
|
|
636
|
-
|
|
637
|
-
if (!isNeuroLinkMCPInitialized()) {
|
|
638
|
-
mcpLogger.debug(`[${functionTag}] Initializing built-in MCP servers`);
|
|
639
|
-
await initializeNeuroLinkMCP();
|
|
640
|
-
}
|
|
620
|
+
// Built-in tools initialization simplified
|
|
621
|
+
mcpLogger.debug(`[${functionTag}] MCP initialization simplified`);
|
|
641
622
|
// Create minimal execution context for external tools
|
|
642
|
-
const context =
|
|
623
|
+
const context = {
|
|
643
624
|
sessionId: `neurolink-tool-${Date.now()}`,
|
|
644
625
|
userId: "neurolink-user",
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
const result = (await unifiedRegistry.executeTool(toolName, params, context));
|
|
626
|
+
};
|
|
627
|
+
const result = (await toolRegistry.executeTool(toolName, params, context));
|
|
648
628
|
return result;
|
|
649
629
|
}
|
|
650
630
|
catch (error) {
|
|
@@ -669,8 +649,9 @@ export class NeuroLink {
|
|
|
669
649
|
* @returns Array of available tools with metadata
|
|
670
650
|
*/
|
|
671
651
|
async getAllAvailableTools() {
|
|
672
|
-
|
|
673
|
-
|
|
652
|
+
// Simplified tool listing - removed initialize-tools dependency
|
|
653
|
+
const tools = await toolRegistry.listTools();
|
|
654
|
+
return tools;
|
|
674
655
|
}
|
|
675
656
|
// ============================================================================
|
|
676
657
|
// PROVIDER DIAGNOSTICS - SDK-First Architecture
|
|
@@ -857,25 +838,16 @@ export class NeuroLink {
|
|
|
857
838
|
* @returns Promise resolving to MCP status details
|
|
858
839
|
*/
|
|
859
840
|
async getMCPStatus() {
|
|
860
|
-
const { unifiedRegistry } = await import("./mcp/unified-registry.js");
|
|
861
841
|
try {
|
|
862
|
-
|
|
863
|
-
const
|
|
864
|
-
const autoDiscoveredServers = unifiedRegistry.getAutoDiscoveredServers();
|
|
865
|
-
const allTools = await unifiedRegistry.listAllTools();
|
|
842
|
+
// Simplified MCP status - unified registry removed
|
|
843
|
+
const allTools = await toolRegistry.listTools();
|
|
866
844
|
return {
|
|
867
845
|
mcpInitialized: this.mcpInitialized,
|
|
868
|
-
totalServers,
|
|
869
|
-
availableServers,
|
|
870
|
-
autoDiscoveredCount:
|
|
846
|
+
totalServers: 1, // Only tool registry now
|
|
847
|
+
availableServers: 1,
|
|
848
|
+
autoDiscoveredCount: 0, // No auto-discovery
|
|
871
849
|
totalTools: allTools.length,
|
|
872
|
-
autoDiscoveredServers:
|
|
873
|
-
id: server.metadata.name,
|
|
874
|
-
name: server.metadata.name,
|
|
875
|
-
source: server.source,
|
|
876
|
-
status: "discovered",
|
|
877
|
-
hasServer: true,
|
|
878
|
-
})),
|
|
850
|
+
autoDiscoveredServers: [], // No auto-discovery
|
|
879
851
|
customToolsCount: this.customTools.size,
|
|
880
852
|
inMemoryServersCount: this.inMemoryServers.size,
|
|
881
853
|
};
|
|
@@ -899,24 +871,8 @@ export class NeuroLink {
|
|
|
899
871
|
* @returns Promise resolving to array of MCP server information
|
|
900
872
|
*/
|
|
901
873
|
async listMCPServers() {
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
const servers = unifiedRegistry.getAutoDiscoveredServers();
|
|
905
|
-
return servers.map((server) => ({
|
|
906
|
-
id: server.metadata.name,
|
|
907
|
-
name: server.metadata.name,
|
|
908
|
-
source: server.source,
|
|
909
|
-
status: unifiedRegistry.isConnected(server.metadata.name)
|
|
910
|
-
? "connected"
|
|
911
|
-
: "discovered",
|
|
912
|
-
hasServer: true,
|
|
913
|
-
metadata: server.metadata,
|
|
914
|
-
}));
|
|
915
|
-
}
|
|
916
|
-
catch (error) {
|
|
917
|
-
logger.warn("Failed to list MCP servers", { error });
|
|
918
|
-
return [];
|
|
919
|
-
}
|
|
874
|
+
// Simplified MCP servers listing - unified registry removed
|
|
875
|
+
return [];
|
|
920
876
|
}
|
|
921
877
|
/**
|
|
922
878
|
* Test connectivity to a specific MCP server
|
|
@@ -924,13 +880,8 @@ export class NeuroLink {
|
|
|
924
880
|
* @returns Promise resolving to true if server is reachable
|
|
925
881
|
*/
|
|
926
882
|
async testMCPServer(serverId) {
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
return unifiedRegistry.isConnected(serverId);
|
|
930
|
-
}
|
|
931
|
-
catch {
|
|
932
|
-
return false;
|
|
933
|
-
}
|
|
883
|
+
// Simplified MCP server testing - unified registry removed
|
|
884
|
+
return false; // No auto-discovery servers available
|
|
934
885
|
}
|
|
935
886
|
}
|
|
936
887
|
// Create default instance
|
|
@@ -4,32 +4,21 @@ import { BaseProvider } from "../core/base-provider.js";
|
|
|
4
4
|
import { logger } from "../utils/logger.js";
|
|
5
5
|
import { TimeoutError, } from "../utils/timeout.js";
|
|
6
6
|
import { DEFAULT_MAX_TOKENS } from "../core/constants.js";
|
|
7
|
+
import { validateApiKey, createAWSAccessKeyConfig, createAWSSecretConfig, getAWSRegion, getAWSSessionToken, } from "../utils/providerConfig.js";
|
|
7
8
|
// Configuration helpers
|
|
8
9
|
const getBedrockModelId = () => {
|
|
9
10
|
return (process.env.BEDROCK_MODEL ||
|
|
10
11
|
process.env.BEDROCK_MODEL_ID ||
|
|
11
12
|
"arn:aws:bedrock:us-east-2:225681119357:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0");
|
|
12
13
|
};
|
|
14
|
+
// Configuration helpers - now using consolidated utility
|
|
13
15
|
const getAWSAccessKeyId = () => {
|
|
14
|
-
|
|
15
|
-
if (!accessKeyId) {
|
|
16
|
-
throw new Error(`ā AWS Bedrock Provider Configuration Error\n\nMissing required environment variables: AWS_ACCESS_KEY_ID\n\nš§ Step 1: Get AWS Credentials\n1. Visit: https://console.aws.amazon.com/iam/\n2. Create IAM user with Bedrock permissions\n3. Generate access key\n\nš§ Step 2: Set Environment Variables\nAdd to your .env file:\nAWS_ACCESS_KEY_ID=your_access_key_here\nAWS_SECRET_ACCESS_KEY=your_secret_key_here\nAWS_REGION=us-east-1\n\nš§ Step 3: Restart Application\nRestart your application to load the new environment variables.`);
|
|
17
|
-
}
|
|
18
|
-
return accessKeyId;
|
|
16
|
+
return validateApiKey(createAWSAccessKeyConfig());
|
|
19
17
|
};
|
|
20
18
|
const getAWSSecretAccessKey = () => {
|
|
21
|
-
|
|
22
|
-
if (!secretAccessKey) {
|
|
23
|
-
throw new Error(`ā AWS Bedrock Provider Configuration Error\n\nMissing required environment variables: AWS_SECRET_ACCESS_KEY\n\nš§ Step 1: Get AWS Credentials\n1. Visit: https://console.aws.amazon.com/iam/\n2. Create IAM user with Bedrock permissions\n3. Generate access key\n\nš§ Step 2: Set Environment Variables\nAdd to your .env file:\nAWS_ACCESS_KEY_ID=your_access_key_here\nAWS_SECRET_ACCESS_KEY=your_secret_key_here\nAWS_REGION=us-east-1\n\nš§ Step 3: Restart Application\nRestart your application to load the new environment variables.`);
|
|
24
|
-
}
|
|
25
|
-
return secretAccessKey;
|
|
26
|
-
};
|
|
27
|
-
const getAWSRegion = () => {
|
|
28
|
-
return process.env.AWS_REGION || "us-east-1";
|
|
29
|
-
};
|
|
30
|
-
const getAWSSessionToken = () => {
|
|
31
|
-
return process.env.AWS_SESSION_TOKEN;
|
|
19
|
+
return validateApiKey(createAWSSecretConfig());
|
|
32
20
|
};
|
|
21
|
+
// Note: getAWSRegion and getAWSSessionToken are now directly imported from consolidated utility
|
|
33
22
|
const getAppEnvironment = () => {
|
|
34
23
|
return process.env.PUBLIC_APP_ENVIRONMENT || "production";
|
|
35
24
|
};
|
|
@@ -4,6 +4,7 @@ import { BaseProvider } from "../core/base-provider.js";
|
|
|
4
4
|
import { logger } from "../utils/logger.js";
|
|
5
5
|
import { createTimeoutController, TimeoutError, } from "../utils/timeout.js";
|
|
6
6
|
import { DEFAULT_MAX_TOKENS } from "../core/constants.js";
|
|
7
|
+
import { validateApiKey, createAnthropicBaseConfig, } from "../utils/providerConfig.js";
|
|
7
8
|
/**
|
|
8
9
|
* Anthropic provider implementation using BaseProvider pattern
|
|
9
10
|
* Migrated from direct API calls to Vercel AI SDK (@ai-sdk/anthropic)
|
|
@@ -50,28 +51,9 @@ export class AnthropicProviderV2 extends BaseProvider {
|
|
|
50
51
|
}
|
|
51
52
|
return new Error(`Anthropic error: ${errorWithStatus?.message || String(error) || "Unknown error"}`);
|
|
52
53
|
}
|
|
54
|
+
// Configuration helper - now using consolidated utility
|
|
53
55
|
getApiKey() {
|
|
54
|
-
|
|
55
|
-
if (!apiKey) {
|
|
56
|
-
throw new Error(`ā ANTHROPIC Provider Configuration Error
|
|
57
|
-
|
|
58
|
-
Missing required environment variables: ANTHROPIC_API_KEY
|
|
59
|
-
|
|
60
|
-
š§ Step 1: Get Credentials
|
|
61
|
-
Get your API key from https://console.anthropic.com/
|
|
62
|
-
|
|
63
|
-
š” Step 2: Add to your .env file (or export in CLI):
|
|
64
|
-
ANTHROPIC_API_KEY="sk-ant-your-anthropic-api-key"
|
|
65
|
-
# Optional:
|
|
66
|
-
ANTHROPIC_MODEL="claude-3-5-sonnet-20241022"
|
|
67
|
-
ANTHROPIC_BASE_URL="https://api.anthropic.com"
|
|
68
|
-
|
|
69
|
-
š Step 3: Test the setup:
|
|
70
|
-
npx neurolink generate "Hello" --provider anthropic
|
|
71
|
-
|
|
72
|
-
š More info: https://docs.neurolink.dev/providers/anthropic`);
|
|
73
|
-
}
|
|
74
|
-
return apiKey;
|
|
56
|
+
return validateApiKey(createAnthropicBaseConfig());
|
|
75
57
|
}
|
|
76
58
|
// executeGenerate removed - BaseProvider handles all generation with tools
|
|
77
59
|
async executeStream(options, analysisSchema) {
|
|
@@ -4,16 +4,13 @@ import { BaseProvider } from "../core/base-provider.js";
|
|
|
4
4
|
import { logger } from "../utils/logger.js";
|
|
5
5
|
import { createTimeoutController, TimeoutError, } from "../utils/timeout.js";
|
|
6
6
|
import { DEFAULT_MAX_TOKENS } from "../core/constants.js";
|
|
7
|
-
|
|
7
|
+
import { validateApiKey, createAnthropicConfig, getProviderModel, } from "../utils/providerConfig.js";
|
|
8
|
+
// Configuration helpers - now using consolidated utility
|
|
8
9
|
const getAnthropicApiKey = () => {
|
|
9
|
-
|
|
10
|
-
if (!apiKey) {
|
|
11
|
-
throw new Error(`ā Anthropic Provider Configuration Error\n\nMissing required environment variable: ANTHROPIC_API_KEY\n\nš§ Step 1: Get Anthropic API Key\n1. Visit: https://console.anthropic.com/\n2. Sign in or create an account\n3. Go to API Keys section\n4. Create a new API key\n\nš§ Step 2: Set Environment Variable\nAdd to your .env file:\nANTHROPIC_API_KEY=your_api_key_here\n\nš§ Step 3: Restart Application\nRestart your application to load the new environment variables.`);
|
|
12
|
-
}
|
|
13
|
-
return apiKey;
|
|
10
|
+
return validateApiKey(createAnthropicConfig());
|
|
14
11
|
};
|
|
15
12
|
const getDefaultAnthropicModel = () => {
|
|
16
|
-
return
|
|
13
|
+
return getProviderModel("ANTHROPIC_MODEL", "claude-3-5-sonnet-20241022");
|
|
17
14
|
};
|
|
18
15
|
/**
|
|
19
16
|
* Anthropic Provider v2 - BaseProvider Implementation
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createAzure } from "@ai-sdk/azure";
|
|
2
2
|
import { streamText } from "ai";
|
|
3
3
|
import { BaseProvider } from "../core/base-provider.js";
|
|
4
|
+
import { validateApiKey, createAzureAPIKeyConfig, createAzureEndpointConfig, } from "../utils/providerConfig.js";
|
|
4
5
|
export class AzureOpenAIProvider extends BaseProvider {
|
|
5
6
|
apiKey;
|
|
6
7
|
resourceName;
|
|
@@ -21,11 +22,12 @@ export class AzureOpenAIProvider extends BaseProvider {
|
|
|
21
22
|
process.env.AZURE_OPENAI_DEPLOYMENT_ID ||
|
|
22
23
|
"gpt-4o";
|
|
23
24
|
this.apiVersion = process.env.AZURE_API_VERSION || "2024-10-01-preview";
|
|
25
|
+
// Configuration validation - now using consolidated utility
|
|
24
26
|
if (!this.apiKey) {
|
|
25
|
-
|
|
27
|
+
validateApiKey(createAzureAPIKeyConfig());
|
|
26
28
|
}
|
|
27
29
|
if (!this.resourceName) {
|
|
28
|
-
|
|
30
|
+
validateApiKey(createAzureEndpointConfig());
|
|
29
31
|
}
|
|
30
32
|
// Create the Azure provider instance
|
|
31
33
|
this.azureProvider = createAzure({
|
|
@@ -4,6 +4,7 @@ import { BaseProvider } from "../core/base-provider.js";
|
|
|
4
4
|
import { logger } from "../utils/logger.js";
|
|
5
5
|
import { TimeoutError, } from "../utils/timeout.js";
|
|
6
6
|
import { DEFAULT_MAX_TOKENS } from "../core/constants.js";
|
|
7
|
+
import { validateApiKey, createVertexProjectConfig, createGoogleAuthConfig, } from "../utils/providerConfig.js";
|
|
7
8
|
// Cache for anthropic module to avoid repeated imports
|
|
8
9
|
let _createVertexAnthropic = null;
|
|
9
10
|
let _anthropicImportAttempted = false;
|
|
@@ -28,14 +29,9 @@ async function getCreateVertexAnthropic() {
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
// Configuration helpers
|
|
32
|
+
// Configuration helpers - now using consolidated utility
|
|
31
33
|
const getVertexProjectId = () => {
|
|
32
|
-
|
|
33
|
-
process.env.VERTEX_PROJECT_ID ||
|
|
34
|
-
process.env.GOOGLE_VERTEX_PROJECT;
|
|
35
|
-
if (!projectId) {
|
|
36
|
-
throw new Error(`ā Google Vertex AI Provider Configuration Error\n\nMissing required environment variables: GOOGLE_CLOUD_PROJECT_ID or VERTEX_PROJECT_ID\n\nš§ Step 1: Get Google Cloud Credentials\n1. Visit: https://console.cloud.google.com/\n2. Create or select a project\n3. Enable Vertex AI API\n4. Set up authentication\n\nš§ Step 2: Set Environment Variables\nAdd to your .env file:\nGOOGLE_CLOUD_PROJECT_ID=your_project_id_here\nGOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json\n\nš§ Step 3: Restart Application\nRestart your application to load the new environment variables.`);
|
|
37
|
-
}
|
|
38
|
-
return projectId;
|
|
34
|
+
return validateApiKey(createVertexProjectConfig());
|
|
39
35
|
};
|
|
40
36
|
const getVertexLocation = () => {
|
|
41
37
|
return (process.env.GOOGLE_CLOUD_LOCATION ||
|
|
@@ -72,9 +68,9 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
72
68
|
cachedAnthropicModel = null;
|
|
73
69
|
constructor(modelName, sdk) {
|
|
74
70
|
super(modelName, "vertex", sdk);
|
|
75
|
-
// Validate Google Cloud credentials
|
|
71
|
+
// Validate Google Cloud credentials - now using consolidated utility
|
|
76
72
|
if (!hasGoogleCredentials()) {
|
|
77
|
-
|
|
73
|
+
validateApiKey(createGoogleAuthConfig());
|
|
78
74
|
}
|
|
79
75
|
// Initialize Google Cloud configuration
|
|
80
76
|
this.projectId = getVertexProjectId();
|
|
@@ -4,20 +4,15 @@ import { BaseProvider } from "../core/base-provider.js";
|
|
|
4
4
|
import { logger } from "../utils/logger.js";
|
|
5
5
|
import { createTimeoutController, TimeoutError, } from "../utils/timeout.js";
|
|
6
6
|
import { DEFAULT_MAX_TOKENS } from "../core/constants.js";
|
|
7
|
-
|
|
7
|
+
import { validateApiKey, createHuggingFaceConfig, getProviderModel, } from "../utils/providerConfig.js";
|
|
8
|
+
// Configuration helpers - now using consolidated utility
|
|
8
9
|
const getHuggingFaceApiKey = () => {
|
|
9
|
-
|
|
10
|
-
if (!apiKey) {
|
|
11
|
-
throw new Error(`ā HuggingFace Provider Configuration Error\n\nMissing required environment variables: HUGGINGFACE_API_KEY\n\nš§ Step 1: Get Credentials\n1. Visit: https://huggingface.co/settings/tokens\n2. Create new API token\n3. Copy the token\n\nš§ Step 2: Set Environment Variable\nAdd to your .env file:\nHUGGINGFACE_API_KEY=your_token_here\n\nš§ Step 3: Restart Application\nRestart your application to load the new environment variables.`);
|
|
12
|
-
}
|
|
13
|
-
return apiKey;
|
|
10
|
+
return validateApiKey(createHuggingFaceConfig());
|
|
14
11
|
};
|
|
15
12
|
const getDefaultHuggingFaceModel = () => {
|
|
16
|
-
return
|
|
17
|
-
};
|
|
18
|
-
const hasHuggingFaceCredentials = () => {
|
|
19
|
-
return !!(process.env.HUGGINGFACE_API_KEY || process.env.HF_TOKEN);
|
|
13
|
+
return getProviderModel("HUGGINGFACE_MODEL", "microsoft/DialoGPT-medium");
|
|
20
14
|
};
|
|
15
|
+
// Note: hasHuggingFaceCredentials now directly imported from consolidated utility
|
|
21
16
|
/**
|
|
22
17
|
* HuggingFace Provider - BaseProvider Implementation
|
|
23
18
|
* Using AI SDK with HuggingFace's OpenAI-compatible endpoint
|
|
@@ -2,17 +2,14 @@ import { createMistral } from "@ai-sdk/mistral";
|
|
|
2
2
|
import { streamText } from "ai";
|
|
3
3
|
import { BaseProvider } from "../core/base-provider.js";
|
|
4
4
|
import { logger } from "../utils/logger.js";
|
|
5
|
-
import { createAnalytics } from "
|
|
6
|
-
|
|
5
|
+
import { createAnalytics } from "../core/analytics.js";
|
|
6
|
+
import { validateApiKey, createMistralConfig, getProviderModel, } from "../utils/providerConfig.js";
|
|
7
|
+
// Configuration helpers - now using consolidated utility
|
|
7
8
|
const getMistralApiKey = () => {
|
|
8
|
-
|
|
9
|
-
if (!apiKey) {
|
|
10
|
-
throw new Error("Mistral API key not found. Please set MISTRAL_API_KEY environment variable.");
|
|
11
|
-
}
|
|
12
|
-
return apiKey;
|
|
9
|
+
return validateApiKey(createMistralConfig());
|
|
13
10
|
};
|
|
14
11
|
const getDefaultMistralModel = () => {
|
|
15
|
-
return
|
|
12
|
+
return getProviderModel("MISTRAL_MODEL", "mistral-large-latest");
|
|
16
13
|
};
|
|
17
14
|
/**
|
|
18
15
|
* Mistral AI Provider v2 - BaseProvider Implementation
|
|
@@ -5,16 +5,13 @@ import { BaseProvider } from "../core/base-provider.js";
|
|
|
5
5
|
import { logger } from "../utils/logger.js";
|
|
6
6
|
import { createTimeoutController, TimeoutError, } from "../utils/timeout.js";
|
|
7
7
|
import { DEFAULT_MAX_TOKENS } from "../core/constants.js";
|
|
8
|
-
|
|
8
|
+
import { validateApiKey, createOpenAIConfig, getProviderModel, } from "../utils/providerConfig.js";
|
|
9
|
+
// Configuration helpers - now using consolidated utility
|
|
9
10
|
const getOpenAIApiKey = () => {
|
|
10
|
-
|
|
11
|
-
if (!apiKey) {
|
|
12
|
-
throw new Error(`ā OPENAI Provider Configuration Error\n\nMissing required environment variables: OPENAI_API_KEY\n\nš§ Step 1: Get Credentials\n1. Visit: https://platform.openai.com/api-keys\n2. Create new API key\n3. Copy the key\n\nš§ Step 2: Set Environment Variable\nAdd to your .env file:\nOPENAI_API_KEY=your_api_key_here\n\nš§ Step 3: Restart Application\nRestart your application to load the new environment variables.`);
|
|
13
|
-
}
|
|
14
|
-
return apiKey;
|
|
11
|
+
return validateApiKey(createOpenAIConfig());
|
|
15
12
|
};
|
|
16
13
|
const getOpenAIModel = () => {
|
|
17
|
-
return
|
|
14
|
+
return getProviderModel("OPENAI_MODEL", "gpt-4o");
|
|
18
15
|
};
|
|
19
16
|
/**
|
|
20
17
|
* OpenAI Provider v2 - BaseProvider Implementation
|