@juspay/neurolink 6.2.1 → 7.1.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 +32 -16
- package/README.md +3 -3
- package/dist/cli/factories/commandFactory.d.ts +70 -0
- package/dist/cli/factories/commandFactory.js +633 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.js +18 -990
- package/dist/cli/utils/{complete-setup.d.ts → completeSetup.d.ts} +1 -1
- package/dist/cli/utils/{complete-setup.js → completeSetup.js} +2 -2
- package/dist/{lib/core/base-provider.d.ts → core/baseProvider.d.ts} +1 -1
- package/dist/core/{base-provider.js → baseProvider.js} +2 -2
- package/dist/core/{dynamic-models.js → dynamicModels.js} +1 -1
- package/dist/core/evaluation.js +1 -1
- package/dist/core/factory.js +7 -5
- package/dist/core/types.d.ts +2 -2
- package/dist/{lib/factories/provider-registry.js → factories/providerRegistry.js} +11 -9
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/{core/base-provider.d.ts → lib/core/baseProvider.d.ts} +1 -1
- package/dist/lib/core/{base-provider.js → baseProvider.js} +2 -2
- package/dist/lib/core/{dynamic-models.js → dynamicModels.js} +1 -1
- package/dist/lib/core/evaluation.js +1 -1
- package/dist/lib/core/factory.js +6 -3
- package/dist/lib/core/types.d.ts +2 -2
- package/dist/{factories/provider-registry.js → lib/factories/providerRegistry.js} +11 -9
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.js +1 -1
- package/dist/lib/mcp/factory.d.ts +2 -2
- package/dist/lib/mcp/factory.js +2 -2
- package/dist/lib/mcp/servers/agent/{direct-tools-server.js → directToolsServer.js} +1 -1
- package/dist/lib/mcp/servers/{ai-providers/ai-core-server.js → aiProviders/aiCoreServer.js} +1 -1
- package/dist/lib/mcp/{tool-registry.d.ts → toolRegistry.d.ts} +5 -0
- package/dist/lib/mcp/{tool-registry.js → toolRegistry.js} +60 -0
- package/dist/lib/neurolink.d.ts +4 -4
- package/dist/lib/neurolink.js +13 -8
- package/dist/lib/providers/{amazon-bedrock.d.ts → amazonBedrock.d.ts} +2 -2
- package/dist/lib/providers/{amazon-bedrock.js → amazonBedrock.js} +1 -1
- package/dist/lib/providers/anthropic.d.ts +2 -2
- package/dist/lib/providers/anthropic.js +1 -1
- package/dist/{providers/anthropic-baseprovider.d.ts → lib/providers/anthropicBaseProvider.d.ts} +2 -2
- package/dist/lib/providers/{anthropic-baseprovider.js → anthropicBaseProvider.js} +1 -1
- package/dist/{providers/azure-openai.d.ts → lib/providers/azureOpenai.d.ts} +2 -2
- package/dist/{providers/azure-openai.js → lib/providers/azureOpenai.js} +1 -1
- package/dist/{providers/google-ai-studio.d.ts → lib/providers/googleAiStudio.d.ts} +2 -2
- package/dist/lib/providers/{google-ai-studio.js → googleAiStudio.js} +1 -1
- package/dist/{providers/google-vertex.d.ts → lib/providers/googleVertex.d.ts} +2 -2
- package/dist/lib/providers/{google-vertex.js → googleVertex.js} +1 -1
- package/dist/lib/providers/huggingFace.d.ts +2 -2
- package/dist/lib/providers/huggingFace.js +1 -1
- package/dist/lib/providers/index.d.ts +4 -4
- package/dist/lib/providers/index.js +4 -4
- package/dist/lib/providers/mistral.d.ts +2 -2
- package/dist/lib/providers/mistral.js +1 -1
- package/dist/lib/providers/ollama.d.ts +2 -2
- package/dist/lib/providers/ollama.js +1 -1
- package/dist/lib/providers/openAI.d.ts +2 -2
- package/dist/lib/providers/openAI.js +1 -1
- package/dist/{sdk/tool-registration.d.ts → lib/sdk/toolRegistration.d.ts} +1 -1
- package/dist/lib/sdk/{tool-registration.js → toolRegistration.js} +17 -0
- package/dist/lib/telemetry/index.d.ts +2 -2
- package/dist/lib/telemetry/index.js +3 -3
- package/dist/lib/utils/logger.js +5 -6
- package/dist/lib/utils/providerConfig.js +1 -1
- package/dist/lib/utils/{provider-setup-messages.js → providerSetupMessages.js} +1 -1
- package/dist/lib/utils/providerUtils.js +10 -3
- package/dist/mcp/factory.d.ts +2 -2
- package/dist/mcp/factory.js +2 -2
- package/dist/mcp/servers/agent/{direct-tools-server.js → directToolsServer.js} +1 -1
- package/dist/mcp/servers/{ai-providers/ai-core-server.js → aiProviders/aiCoreServer.js} +2 -2
- package/dist/mcp/{tool-registry.d.ts → toolRegistry.d.ts} +5 -0
- package/dist/mcp/{tool-registry.js → toolRegistry.js} +60 -0
- package/dist/neurolink.d.ts +5 -5
- package/dist/neurolink.js +13 -8
- package/dist/providers/{amazon-bedrock.d.ts → amazonBedrock.d.ts} +2 -2
- package/dist/providers/{amazon-bedrock.js → amazonBedrock.js} +1 -1
- package/dist/providers/anthropic.d.ts +2 -2
- package/dist/providers/anthropic.js +1 -1
- package/dist/{lib/providers/anthropic-baseprovider.d.ts → providers/anthropicBaseProvider.d.ts} +2 -2
- package/dist/providers/{anthropic-baseprovider.js → anthropicBaseProvider.js} +1 -1
- package/dist/{lib/providers/azure-openai.d.ts → providers/azureOpenai.d.ts} +2 -2
- package/dist/{lib/providers/azure-openai.js → providers/azureOpenai.js} +1 -1
- package/dist/{lib/providers/google-ai-studio.d.ts → providers/googleAiStudio.d.ts} +2 -2
- package/dist/providers/{google-ai-studio.js → googleAiStudio.js} +2 -2
- package/dist/{lib/providers/google-vertex.d.ts → providers/googleVertex.d.ts} +2 -2
- package/dist/providers/{google-vertex.js → googleVertex.js} +1 -1
- package/dist/providers/huggingFace.d.ts +2 -2
- package/dist/providers/huggingFace.js +1 -1
- package/dist/providers/index.d.ts +4 -4
- package/dist/providers/index.js +4 -4
- package/dist/providers/mistral.d.ts +2 -2
- package/dist/providers/mistral.js +1 -1
- package/dist/providers/ollama.d.ts +2 -2
- package/dist/providers/ollama.js +1 -1
- package/dist/providers/openAI.d.ts +2 -2
- package/dist/providers/openAI.js +1 -1
- package/dist/{lib/sdk/tool-registration.d.ts → sdk/toolRegistration.d.ts} +1 -1
- package/dist/sdk/{tool-registration.js → toolRegistration.js} +17 -0
- package/dist/telemetry/index.d.ts +2 -2
- package/dist/telemetry/index.js +3 -3
- package/dist/utils/logger.js +5 -6
- package/dist/utils/providerConfig.js +1 -1
- package/dist/utils/{provider-setup-messages.js → providerSetupMessages.js} +1 -1
- package/dist/utils/providerUtils.js +10 -3
- package/package.json +23 -22
- package/dist/cli/factories/command-factory.d.ts +0 -19
- package/dist/cli/factories/command-factory.js +0 -184
- /package/dist/agent/{direct-tools.d.ts → directTools.d.ts} +0 -0
- /package/dist/agent/{direct-tools.js → directTools.js} +0 -0
- /package/dist/cli/utils/{env-manager.d.ts → envManager.d.ts} +0 -0
- /package/dist/cli/utils/{env-manager.js → envManager.js} +0 -0
- /package/dist/cli/utils/{interactive-setup.d.ts → interactiveSetup.d.ts} +0 -0
- /package/dist/cli/utils/{interactive-setup.js → interactiveSetup.js} +0 -0
- /package/dist/core/{dynamic-models.d.ts → dynamicModels.d.ts} +0 -0
- /package/dist/core/{evaluation-providers.d.ts → evaluationProviders.d.ts} +0 -0
- /package/dist/core/{evaluation-providers.js → evaluationProviders.js} +0 -0
- /package/dist/core/{service-registry.d.ts → serviceRegistry.d.ts} +0 -0
- /package/dist/core/{service-registry.js → serviceRegistry.js} +0 -0
- /package/dist/factories/{provider-factory.d.ts → providerFactory.d.ts} +0 -0
- /package/dist/factories/{provider-factory.js → providerFactory.js} +0 -0
- /package/dist/factories/{provider-registry.d.ts → providerRegistry.d.ts} +0 -0
- /package/dist/lib/agent/{direct-tools.d.ts → directTools.d.ts} +0 -0
- /package/dist/lib/agent/{direct-tools.js → directTools.js} +0 -0
- /package/dist/lib/core/{dynamic-models.d.ts → dynamicModels.d.ts} +0 -0
- /package/dist/lib/core/{evaluation-providers.d.ts → evaluationProviders.d.ts} +0 -0
- /package/dist/lib/core/{evaluation-providers.js → evaluationProviders.js} +0 -0
- /package/dist/lib/core/{service-registry.d.ts → serviceRegistry.d.ts} +0 -0
- /package/dist/lib/core/{service-registry.js → serviceRegistry.js} +0 -0
- /package/dist/lib/factories/{provider-factory.d.ts → providerFactory.d.ts} +0 -0
- /package/dist/lib/factories/{provider-factory.js → providerFactory.js} +0 -0
- /package/dist/lib/factories/{provider-registry.d.ts → providerRegistry.d.ts} +0 -0
- /package/dist/lib/mcp/servers/agent/{direct-tools-server.d.ts → directToolsServer.d.ts} +0 -0
- /package/dist/lib/mcp/servers/{ai-providers/ai-analysis-tools.d.ts → aiProviders/aiAnalysisTools.d.ts} +0 -0
- /package/dist/lib/mcp/servers/{ai-providers/ai-analysis-tools.js → aiProviders/aiAnalysisTools.js} +0 -0
- /package/dist/lib/mcp/servers/{ai-providers/ai-core-server.d.ts → aiProviders/aiCoreServer.d.ts} +0 -0
- /package/dist/lib/mcp/servers/{ai-providers/ai-workflow-tools.d.ts → aiProviders/aiWorkflowTools.d.ts} +0 -0
- /package/dist/lib/mcp/servers/{ai-providers/ai-workflow-tools.js → aiProviders/aiWorkflowTools.js} +0 -0
- /package/dist/lib/mcp/servers/utilities/{utility-server.d.ts → utilityServer.d.ts} +0 -0
- /package/dist/lib/mcp/servers/utilities/{utility-server.js → utilityServer.js} +0 -0
- /package/dist/lib/proxy/{proxy-fetch.d.ts → proxyFetch.d.ts} +0 -0
- /package/dist/lib/proxy/{proxy-fetch.js → proxyFetch.js} +0 -0
- /package/dist/lib/telemetry/{telemetry-service.d.ts → telemetryService.d.ts} +0 -0
- /package/dist/lib/telemetry/{telemetry-service.js → telemetryService.js} +0 -0
- /package/dist/lib/types/{generate-types.d.ts → generateTypes.d.ts} +0 -0
- /package/dist/lib/types/{generate-types.js → generateTypes.js} +0 -0
- /package/dist/lib/types/{mcp-types.d.ts → mcpTypes.d.ts} +0 -0
- /package/dist/lib/types/{mcp-types.js → mcpTypes.js} +0 -0
- /package/dist/lib/types/{stream-types.d.ts → streamTypes.d.ts} +0 -0
- /package/dist/lib/types/{stream-types.js → streamTypes.js} +0 -0
- /package/dist/lib/types/{universal-provider-options.d.ts → universalProviderOptions.d.ts} +0 -0
- /package/dist/lib/types/{universal-provider-options.js → universalProviderOptions.js} +0 -0
- /package/dist/lib/utils/{provider-setup-messages.d.ts → providerSetupMessages.d.ts} +0 -0
- /package/dist/mcp/servers/agent/{direct-tools-server.d.ts → directToolsServer.d.ts} +0 -0
- /package/dist/mcp/servers/{ai-providers/ai-analysis-tools.d.ts → aiProviders/aiAnalysisTools.d.ts} +0 -0
- /package/dist/mcp/servers/{ai-providers/ai-analysis-tools.js → aiProviders/aiAnalysisTools.js} +0 -0
- /package/dist/mcp/servers/{ai-providers/ai-core-server.d.ts → aiProviders/aiCoreServer.d.ts} +0 -0
- /package/dist/mcp/servers/{ai-providers/ai-workflow-tools.d.ts → aiProviders/aiWorkflowTools.d.ts} +0 -0
- /package/dist/mcp/servers/{ai-providers/ai-workflow-tools.js → aiProviders/aiWorkflowTools.js} +0 -0
- /package/dist/mcp/servers/utilities/{utility-server.d.ts → utilityServer.d.ts} +0 -0
- /package/dist/mcp/servers/utilities/{utility-server.js → utilityServer.js} +0 -0
- /package/dist/proxy/{proxy-fetch.d.ts → proxyFetch.d.ts} +0 -0
- /package/dist/proxy/{proxy-fetch.js → proxyFetch.js} +0 -0
- /package/dist/telemetry/{telemetry-service.d.ts → telemetryService.d.ts} +0 -0
- /package/dist/telemetry/{telemetry-service.js → telemetryService.js} +0 -0
- /package/dist/types/{generate-types.d.ts → generateTypes.d.ts} +0 -0
- /package/dist/types/{generate-types.js → generateTypes.js} +0 -0
- /package/dist/types/{mcp-types.d.ts → mcpTypes.d.ts} +0 -0
- /package/dist/types/{mcp-types.js → mcpTypes.js} +0 -0
- /package/dist/types/{stream-types.d.ts → streamTypes.d.ts} +0 -0
- /package/dist/types/{stream-types.js → streamTypes.js} +0 -0
- /package/dist/types/{universal-provider-options.d.ts → universalProviderOptions.d.ts} +0 -0
- /package/dist/types/{universal-provider-options.js → universalProviderOptions.js} +0 -0
- /package/dist/utils/{provider-setup-messages.d.ts → providerSetupMessages.d.ts} +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Orchestrates the entire setup process: interactive wizard, environment management,
|
|
5
5
|
* provider testing, and summary display.
|
|
6
6
|
*/
|
|
7
|
-
import { type SetupResult } from "./
|
|
7
|
+
import { type SetupResult } from "./interactiveSetup.js";
|
|
8
8
|
/**
|
|
9
9
|
* Run the complete interactive setup process
|
|
10
10
|
*/
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Orchestrates the entire setup process: interactive wizard, environment management,
|
|
5
5
|
* provider testing, and summary display.
|
|
6
6
|
*/
|
|
7
|
-
import { runInteractiveSetup, testProviderConnectivity, displaySetupSummary, } from "./
|
|
8
|
-
import { updateEnvFile, displayEnvUpdateSummary } from "./
|
|
7
|
+
import { runInteractiveSetup, testProviderConnectivity, displaySetupSummary, } from "./interactiveSetup.js";
|
|
8
|
+
import { updateEnvFile, displayEnvUpdateSummary } from "./envManager.js";
|
|
9
9
|
import chalk from "chalk";
|
|
10
10
|
/**
|
|
11
11
|
* Run the complete interactive setup process
|
|
@@ -2,7 +2,7 @@ import type { ZodType, ZodTypeDef } from "zod";
|
|
|
2
2
|
import type { Schema } from "ai";
|
|
3
3
|
import type { Tool, LanguageModel } from "ai";
|
|
4
4
|
import type { AIProvider, TextGenerationOptions, EnhancedGenerateResult, AnalyticsData, AIProviderName, EvaluationData } from "../core/types.js";
|
|
5
|
-
import type { StreamOptions, StreamResult } from "../types/
|
|
5
|
+
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
6
6
|
import type { JsonValue, UnknownRecord } from "../types/common.js";
|
|
7
7
|
import type { ToolResult } from "../types/tools.js";
|
|
8
8
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from "../utils/logger.js";
|
|
2
|
-
import { directAgentTools } from "../agent/
|
|
2
|
+
import { directAgentTools } from "../agent/directTools.js";
|
|
3
3
|
/**
|
|
4
4
|
* Validates if a result contains a valid toolsObject structure
|
|
5
5
|
* @param result - The result object to validate
|
|
@@ -260,7 +260,7 @@ export class BaseProvider {
|
|
|
260
260
|
// Not an error - custom tools are optional
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
-
// MCP tools loading simplified - removed
|
|
263
|
+
// MCP tools loading simplified - removed functionCalling dependency
|
|
264
264
|
if (!this.mcpTools) {
|
|
265
265
|
// Set empty tools object - MCP tools are handled at a higher level
|
|
266
266
|
this.mcpTools = {};
|
|
@@ -163,7 +163,7 @@ export class DynamicModelProvider {
|
|
|
163
163
|
this.ensureInitialized();
|
|
164
164
|
switch (useCase) {
|
|
165
165
|
case "coding":
|
|
166
|
-
return (this.searchByCapability("
|
|
166
|
+
return (this.searchByCapability("functionCalling", {
|
|
167
167
|
excludeDeprecated: true,
|
|
168
168
|
})[0] || null);
|
|
169
169
|
case "analysis":
|
package/dist/core/evaluation.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { logger } from "../utils/logger.js";
|
|
5
5
|
import { AIProviderFactory } from "./factory.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
import { ProviderRegistry } from "../factories/
|
|
7
|
+
import { ProviderRegistry } from "../factories/providerRegistry.js";
|
|
8
8
|
// Zod schema for validation
|
|
9
9
|
const UnifiedEvaluationSchema = z.object({
|
|
10
10
|
relevance: z.number().min(1).max(10),
|
package/dist/core/factory.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// ✅ CIRCULAR DEPENDENCY FIX: Remove barrel export import
|
|
2
2
|
// Providers are now managed via ProviderFactory instead of direct imports
|
|
3
|
-
import { ProviderFactory } from "../factories/
|
|
4
|
-
import { ProviderRegistry } from "../factories/
|
|
3
|
+
import { ProviderFactory } from "../factories/providerFactory.js";
|
|
4
|
+
import { ProviderRegistry } from "../factories/providerRegistry.js";
|
|
5
5
|
import { getBestProvider } from "../utils/providerUtils.js";
|
|
6
6
|
import { logger } from "../utils/logger.js";
|
|
7
|
-
import { dynamicModelProvider } from "./
|
|
7
|
+
import { dynamicModelProvider } from "./dynamicModels.js";
|
|
8
8
|
const componentIdentifier = "aiProviderFactory";
|
|
9
9
|
/**
|
|
10
10
|
* Factory for creating AI provider instances with centralized configuration
|
|
@@ -89,6 +89,8 @@ export class AIProviderFactory {
|
|
|
89
89
|
// );
|
|
90
90
|
// }
|
|
91
91
|
// }
|
|
92
|
+
// CRITICAL FIX: Initialize providers before using them
|
|
93
|
+
await ProviderRegistry.registerAllProviders();
|
|
92
94
|
// PURE FACTORY PATTERN: No switch statements - use ProviderFactory exclusively
|
|
93
95
|
const normalizedName = this.normalizeProviderName(providerName);
|
|
94
96
|
const finalModelName = resolvedModelName === "default" || resolvedModelName === null
|
|
@@ -104,8 +106,8 @@ export class AIProviderFactory {
|
|
|
104
106
|
// Wrap with MCP if enabled
|
|
105
107
|
if (enableMCP) {
|
|
106
108
|
try {
|
|
107
|
-
logger.debug(`[${functionTag}] MCP wrapping disabled -
|
|
108
|
-
// MCP wrapping simplified - removed
|
|
109
|
+
logger.debug(`[${functionTag}] MCP wrapping disabled - functionCalling removed`);
|
|
110
|
+
// MCP wrapping simplified - removed functionCalling dependency
|
|
109
111
|
}
|
|
110
112
|
catch (mcpError) {
|
|
111
113
|
logger.warn(`[${functionTag}] Failed to wrap with MCP, using base provider`, {
|
package/dist/core/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ZodType, ZodTypeDef } from "zod";
|
|
2
2
|
import type { Schema, Tool } from "ai";
|
|
3
|
-
import type { GenerateResult } from "../types/
|
|
4
|
-
import type { StreamOptions, StreamResult } from "../types/
|
|
3
|
+
import type { GenerateResult } from "../types/generateTypes.js";
|
|
4
|
+
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
5
|
import type { JsonValue } from "../types/common.js";
|
|
6
6
|
export interface TextGenerationResult {
|
|
7
7
|
content: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProviderFactory } from "./
|
|
1
|
+
import { ProviderFactory } from "./providerFactory.js";
|
|
2
2
|
// ✅ FINAL CIRCULAR DEPENDENCY FIX: Lazy loading all providers
|
|
3
3
|
// Removed all static imports - providers loaded dynamically when needed
|
|
4
4
|
// This breaks the circular dependency chain completely
|
|
@@ -22,12 +22,12 @@ export class ProviderRegistry {
|
|
|
22
22
|
}
|
|
23
23
|
try {
|
|
24
24
|
// ✅ LAZY LOADING: Register providers with dynamic import factory functions
|
|
25
|
-
const { ProviderFactory } = await import("./
|
|
25
|
+
const { ProviderFactory } = await import("./providerFactory.js");
|
|
26
26
|
// Register Google AI Studio Provider (our validated baseline)
|
|
27
27
|
ProviderFactory.registerProvider(AIProviderName.GOOGLE_AI, async (modelName, providerName, sdk) => {
|
|
28
|
-
const { GoogleAIStudioProvider } = await import("../providers/
|
|
28
|
+
const { GoogleAIStudioProvider } = await import("../providers/googleAiStudio.js");
|
|
29
29
|
return new GoogleAIStudioProvider(modelName, sdk);
|
|
30
|
-
}, GoogleAIModels.GEMINI_2_5_FLASH, ["
|
|
30
|
+
}, GoogleAIModels.GEMINI_2_5_FLASH, ["googleAiStudio", "google", "gemini", "google-ai"]);
|
|
31
31
|
// Register OpenAI provider
|
|
32
32
|
ProviderFactory.registerProvider(AIProviderName.OPENAI, async (modelName, providerName, sdk) => {
|
|
33
33
|
const { OpenAIProvider } = await import("../providers/openAI.js");
|
|
@@ -40,20 +40,22 @@ export class ProviderRegistry {
|
|
|
40
40
|
}, "claude-3-5-sonnet-20241022", ["claude", "anthropic"]);
|
|
41
41
|
// Register Amazon Bedrock provider
|
|
42
42
|
ProviderFactory.registerProvider(AIProviderName.BEDROCK, async (modelName) => {
|
|
43
|
-
const { AmazonBedrockProvider } = await import("../providers/
|
|
43
|
+
const { AmazonBedrockProvider } = await import("../providers/amazonBedrock.js");
|
|
44
44
|
return new AmazonBedrockProvider(modelName);
|
|
45
45
|
}, undefined, // Let provider read BEDROCK_MODEL from .env
|
|
46
46
|
["bedrock", "aws"]);
|
|
47
47
|
// Register Azure OpenAI provider
|
|
48
48
|
ProviderFactory.registerProvider(AIProviderName.AZURE, async (modelName) => {
|
|
49
|
-
const { AzureOpenAIProvider } = await import("../providers/
|
|
49
|
+
const { AzureOpenAIProvider } = await import("../providers/azureOpenai.js");
|
|
50
50
|
return new AzureOpenAIProvider(modelName);
|
|
51
|
-
},
|
|
51
|
+
}, process.env.AZURE_MODEL ||
|
|
52
|
+
process.env.AZURE_OPENAI_DEPLOYMENT_ID ||
|
|
53
|
+
"gpt-4o-mini", ["azure", "azureOpenai"]);
|
|
52
54
|
// Register Google Vertex AI provider
|
|
53
55
|
ProviderFactory.registerProvider(AIProviderName.VERTEX, async (modelName) => {
|
|
54
|
-
const { GoogleVertexProvider } = await import("../providers/
|
|
56
|
+
const { GoogleVertexProvider } = await import("../providers/googleVertex.js");
|
|
55
57
|
return new GoogleVertexProvider(modelName);
|
|
56
|
-
}, "gemini-2.5-pro", ["vertex", "
|
|
58
|
+
}, "gemini-2.5-pro", ["vertex", "googleVertex"]);
|
|
57
59
|
// Register Hugging Face provider (Unified Router implementation)
|
|
58
60
|
ProviderFactory.registerProvider(AIProviderName.HUGGINGFACE, async (modelName) => {
|
|
59
61
|
const { HuggingFaceProvider } = await import("../providers/huggingFace.js");
|
package/dist/index.d.ts
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
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
|
-
export type { GenerateOptions, GenerateResult, EnhancedProvider, } from "./types/
|
|
13
|
-
export type { SimpleTool, ToolContext } from "./sdk/
|
|
14
|
-
export { createTool, createTypedTool, validateTool, } from "./sdk/
|
|
15
|
-
export type { InMemoryMCPServerConfig, InMemoryToolInfo, InMemoryToolResult, } from "./types/
|
|
12
|
+
export type { GenerateOptions, GenerateResult, EnhancedProvider, } from "./types/generateTypes.js";
|
|
13
|
+
export type { SimpleTool, ToolContext } from "./sdk/toolRegistration.js";
|
|
14
|
+
export { createTool, createTypedTool, validateTool, } from "./sdk/toolRegistration.js";
|
|
15
|
+
export type { InMemoryMCPServerConfig, InMemoryToolInfo, InMemoryToolResult, } from "./types/mcpTypes.js";
|
|
16
16
|
export { BedrockModels, OpenAIModels, VertexModels, DEFAULT_PROVIDER_CONFIGS, } from "./core/types.js";
|
|
17
17
|
export { getBestProvider, getAvailableProviders, isValidProvider, } from "./utils/providerUtils.js";
|
|
18
18
|
export { NeuroLink } from "./neurolink.js";
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// Core exports
|
|
10
10
|
import { AIProviderFactory } from "./core/factory.js";
|
|
11
11
|
export { AIProviderFactory };
|
|
12
|
-
export { createTool, createTypedTool, validateTool, } from "./sdk/
|
|
12
|
+
export { createTool, createTypedTool, validateTool, } from "./sdk/toolRegistration.js";
|
|
13
13
|
// Model enums
|
|
14
14
|
export { BedrockModels, OpenAIModels, VertexModels, DEFAULT_PROVIDER_CONFIGS, } from "./core/types.js";
|
|
15
15
|
// Utility exports
|
|
@@ -2,7 +2,7 @@ import type { ZodType, ZodTypeDef } from "zod";
|
|
|
2
2
|
import type { Schema } from "ai";
|
|
3
3
|
import type { Tool, LanguageModel } from "ai";
|
|
4
4
|
import type { AIProvider, TextGenerationOptions, EnhancedGenerateResult, AnalyticsData, AIProviderName, EvaluationData } from "../core/types.js";
|
|
5
|
-
import type { StreamOptions, StreamResult } from "../types/
|
|
5
|
+
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
6
6
|
import type { JsonValue, UnknownRecord } from "../types/common.js";
|
|
7
7
|
import type { ToolResult } from "../types/tools.js";
|
|
8
8
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from "../utils/logger.js";
|
|
2
|
-
import { directAgentTools } from "../agent/
|
|
2
|
+
import { directAgentTools } from "../agent/directTools.js";
|
|
3
3
|
/**
|
|
4
4
|
* Validates if a result contains a valid toolsObject structure
|
|
5
5
|
* @param result - The result object to validate
|
|
@@ -260,7 +260,7 @@ export class BaseProvider {
|
|
|
260
260
|
// Not an error - custom tools are optional
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
-
// MCP tools loading simplified - removed
|
|
263
|
+
// MCP tools loading simplified - removed functionCalling dependency
|
|
264
264
|
if (!this.mcpTools) {
|
|
265
265
|
// Set empty tools object - MCP tools are handled at a higher level
|
|
266
266
|
this.mcpTools = {};
|
|
@@ -163,7 +163,7 @@ export class DynamicModelProvider {
|
|
|
163
163
|
this.ensureInitialized();
|
|
164
164
|
switch (useCase) {
|
|
165
165
|
case "coding":
|
|
166
|
-
return (this.searchByCapability("
|
|
166
|
+
return (this.searchByCapability("functionCalling", {
|
|
167
167
|
excludeDeprecated: true,
|
|
168
168
|
})[0] || null);
|
|
169
169
|
case "analysis":
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { logger } from "../utils/logger.js";
|
|
5
5
|
import { AIProviderFactory } from "./factory.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
import { ProviderRegistry } from "../factories/
|
|
7
|
+
import { ProviderRegistry } from "../factories/providerRegistry.js";
|
|
8
8
|
// Zod schema for validation
|
|
9
9
|
const UnifiedEvaluationSchema = z.object({
|
|
10
10
|
relevance: z.number().min(1).max(10),
|
package/dist/lib/core/factory.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// ✅ CIRCULAR DEPENDENCY FIX: Remove barrel export import
|
|
2
2
|
// Providers are now managed via ProviderFactory instead of direct imports
|
|
3
|
-
import { ProviderFactory } from "../factories/
|
|
3
|
+
import { ProviderFactory } from "../factories/providerFactory.js";
|
|
4
|
+
import { ProviderRegistry } from "../factories/providerRegistry.js";
|
|
4
5
|
import { getBestProvider } from "../utils/providerUtils.js";
|
|
5
6
|
import { logger } from "../utils/logger.js";
|
|
6
7
|
const componentIdentifier = "aiProviderFactory";
|
|
@@ -87,6 +88,8 @@ export class AIProviderFactory {
|
|
|
87
88
|
// );
|
|
88
89
|
// }
|
|
89
90
|
// }
|
|
91
|
+
// CRITICAL FIX: Initialize providers before using them
|
|
92
|
+
await ProviderRegistry.registerAllProviders();
|
|
90
93
|
// PURE FACTORY PATTERN: No switch statements - use ProviderFactory exclusively
|
|
91
94
|
const normalizedName = this.normalizeProviderName(providerName);
|
|
92
95
|
const finalModelName = resolvedModelName === "default" || resolvedModelName === null
|
|
@@ -102,8 +105,8 @@ export class AIProviderFactory {
|
|
|
102
105
|
// Wrap with MCP if enabled
|
|
103
106
|
if (enableMCP) {
|
|
104
107
|
try {
|
|
105
|
-
logger.debug(`[${functionTag}] MCP wrapping disabled -
|
|
106
|
-
// MCP wrapping simplified - removed
|
|
108
|
+
logger.debug(`[${functionTag}] MCP wrapping disabled - functionCalling removed`);
|
|
109
|
+
// MCP wrapping simplified - removed functionCalling dependency
|
|
107
110
|
}
|
|
108
111
|
catch (mcpError) {
|
|
109
112
|
logger.warn(`[${functionTag}] Failed to wrap with MCP, using base provider`, {
|
package/dist/lib/core/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ZodType, ZodTypeDef } from "zod";
|
|
2
2
|
import type { Schema, Tool } from "ai";
|
|
3
|
-
import type { GenerateResult } from "../types/
|
|
4
|
-
import type { StreamOptions, StreamResult } from "../types/
|
|
3
|
+
import type { GenerateResult } from "../types/generateTypes.js";
|
|
4
|
+
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
5
|
import type { JsonValue } from "../types/common.js";
|
|
6
6
|
export interface TextGenerationResult {
|
|
7
7
|
content: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProviderFactory } from "./
|
|
1
|
+
import { ProviderFactory } from "./providerFactory.js";
|
|
2
2
|
// ✅ FINAL CIRCULAR DEPENDENCY FIX: Lazy loading all providers
|
|
3
3
|
// Removed all static imports - providers loaded dynamically when needed
|
|
4
4
|
// This breaks the circular dependency chain completely
|
|
@@ -22,12 +22,12 @@ export class ProviderRegistry {
|
|
|
22
22
|
}
|
|
23
23
|
try {
|
|
24
24
|
// ✅ LAZY LOADING: Register providers with dynamic import factory functions
|
|
25
|
-
const { ProviderFactory } = await import("./
|
|
25
|
+
const { ProviderFactory } = await import("./providerFactory.js");
|
|
26
26
|
// Register Google AI Studio Provider (our validated baseline)
|
|
27
27
|
ProviderFactory.registerProvider(AIProviderName.GOOGLE_AI, async (modelName, providerName, sdk) => {
|
|
28
|
-
const { GoogleAIStudioProvider } = await import("../providers/
|
|
28
|
+
const { GoogleAIStudioProvider } = await import("../providers/googleAiStudio.js");
|
|
29
29
|
return new GoogleAIStudioProvider(modelName, sdk);
|
|
30
|
-
}, GoogleAIModels.GEMINI_2_5_FLASH, ["
|
|
30
|
+
}, GoogleAIModels.GEMINI_2_5_FLASH, ["googleAiStudio", "google", "gemini", "google-ai"]);
|
|
31
31
|
// Register OpenAI provider
|
|
32
32
|
ProviderFactory.registerProvider(AIProviderName.OPENAI, async (modelName, providerName, sdk) => {
|
|
33
33
|
const { OpenAIProvider } = await import("../providers/openAI.js");
|
|
@@ -40,20 +40,22 @@ export class ProviderRegistry {
|
|
|
40
40
|
}, "claude-3-5-sonnet-20241022", ["claude", "anthropic"]);
|
|
41
41
|
// Register Amazon Bedrock provider
|
|
42
42
|
ProviderFactory.registerProvider(AIProviderName.BEDROCK, async (modelName) => {
|
|
43
|
-
const { AmazonBedrockProvider } = await import("../providers/
|
|
43
|
+
const { AmazonBedrockProvider } = await import("../providers/amazonBedrock.js");
|
|
44
44
|
return new AmazonBedrockProvider(modelName);
|
|
45
45
|
}, undefined, // Let provider read BEDROCK_MODEL from .env
|
|
46
46
|
["bedrock", "aws"]);
|
|
47
47
|
// Register Azure OpenAI provider
|
|
48
48
|
ProviderFactory.registerProvider(AIProviderName.AZURE, async (modelName) => {
|
|
49
|
-
const { AzureOpenAIProvider } = await import("../providers/
|
|
49
|
+
const { AzureOpenAIProvider } = await import("../providers/azureOpenai.js");
|
|
50
50
|
return new AzureOpenAIProvider(modelName);
|
|
51
|
-
},
|
|
51
|
+
}, process.env.AZURE_MODEL ||
|
|
52
|
+
process.env.AZURE_OPENAI_DEPLOYMENT_ID ||
|
|
53
|
+
"gpt-4o-mini", ["azure", "azureOpenai"]);
|
|
52
54
|
// Register Google Vertex AI provider
|
|
53
55
|
ProviderFactory.registerProvider(AIProviderName.VERTEX, async (modelName) => {
|
|
54
|
-
const { GoogleVertexProvider } = await import("../providers/
|
|
56
|
+
const { GoogleVertexProvider } = await import("../providers/googleVertex.js");
|
|
55
57
|
return new GoogleVertexProvider(modelName);
|
|
56
|
-
}, "gemini-2.5-pro", ["vertex", "
|
|
58
|
+
}, "gemini-2.5-pro", ["vertex", "googleVertex"]);
|
|
57
59
|
// Register Hugging Face provider (Unified Router implementation)
|
|
58
60
|
ProviderFactory.registerProvider(AIProviderName.HUGGINGFACE, async (modelName) => {
|
|
59
61
|
const { HuggingFaceProvider } = await import("../providers/huggingFace.js");
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
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
|
-
export type { GenerateOptions, GenerateResult, EnhancedProvider, } from "./types/
|
|
13
|
-
export type { SimpleTool, ToolContext } from "./sdk/
|
|
14
|
-
export { createTool, createTypedTool, validateTool, } from "./sdk/
|
|
15
|
-
export type { InMemoryMCPServerConfig, InMemoryToolInfo, InMemoryToolResult, } from "./types/
|
|
12
|
+
export type { GenerateOptions, GenerateResult, EnhancedProvider, } from "./types/generateTypes.js";
|
|
13
|
+
export type { SimpleTool, ToolContext } from "./sdk/toolRegistration.js";
|
|
14
|
+
export { createTool, createTypedTool, validateTool, } from "./sdk/toolRegistration.js";
|
|
15
|
+
export type { InMemoryMCPServerConfig, InMemoryToolInfo, InMemoryToolResult, } from "./types/mcpTypes.js";
|
|
16
16
|
export { BedrockModels, OpenAIModels, VertexModels, DEFAULT_PROVIDER_CONFIGS, } from "./core/types.js";
|
|
17
17
|
export { getBestProvider, getAvailableProviders, isValidProvider, } from "./utils/providerUtils.js";
|
|
18
18
|
export { NeuroLink } from "./neurolink.js";
|
package/dist/lib/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// Core exports
|
|
10
10
|
import { AIProviderFactory } from "./core/factory.js";
|
|
11
11
|
export { AIProviderFactory };
|
|
12
|
-
export { createTool, createTypedTool, validateTool, } from "./sdk/
|
|
12
|
+
export { createTool, createTypedTool, validateTool, } from "./sdk/toolRegistration.js";
|
|
13
13
|
// Model enums
|
|
14
14
|
export { BedrockModels, OpenAIModels, VertexModels, DEFAULT_PROVIDER_CONFIGS, } from "./core/types.js";
|
|
15
15
|
// Utility exports
|
|
@@ -8,7 +8,7 @@ import type { ExecutionContext } from "./contracts/mcpContract.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* MCP Server Categories for organization and discovery
|
|
10
10
|
*/
|
|
11
|
-
export type MCPServerCategory = "
|
|
11
|
+
export type MCPServerCategory = "aiProviders" | "frameworks" | "development" | "business" | "content" | "data" | "integrations" | "automation" | "analysis" | "custom";
|
|
12
12
|
/**
|
|
13
13
|
* Tool execution context - Rich context passed to every tool execution
|
|
14
14
|
* Following Lighthouse's pattern for rich tool context
|
|
@@ -130,7 +130,7 @@ export interface MCPServerConfig {
|
|
|
130
130
|
* id: 'neurolink-ai-core',
|
|
131
131
|
* title: 'NeuroLink AI Core',
|
|
132
132
|
* description: 'Core AI provider tools',
|
|
133
|
-
* category: '
|
|
133
|
+
* category: 'aiProviders'
|
|
134
134
|
* });
|
|
135
135
|
*
|
|
136
136
|
* aiCoreServer.registerTool({
|
package/dist/lib/mcp/factory.js
CHANGED
|
@@ -14,7 +14,7 @@ const ServerConfigSchema = z.object({
|
|
|
14
14
|
version: z.string().optional(),
|
|
15
15
|
category: z
|
|
16
16
|
.enum([
|
|
17
|
-
"
|
|
17
|
+
"aiProviders",
|
|
18
18
|
"frameworks",
|
|
19
19
|
"development",
|
|
20
20
|
"business",
|
|
@@ -46,7 +46,7 @@ const ServerConfigSchema = z.object({
|
|
|
46
46
|
* id: 'neurolink-ai-core',
|
|
47
47
|
* title: 'NeuroLink AI Core',
|
|
48
48
|
* description: 'Core AI provider tools',
|
|
49
|
-
* category: '
|
|
49
|
+
* category: 'aiProviders'
|
|
50
50
|
* });
|
|
51
51
|
*
|
|
52
52
|
* aiCoreServer.registerTool({
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Wraps the agent direct tools as an MCP server for proper registration
|
|
4
4
|
*/
|
|
5
5
|
import { createMCPServer } from "../../factory.js";
|
|
6
|
-
import { directAgentTools } from "../../../agent/
|
|
6
|
+
import { directAgentTools } from "../../../agent/directTools.js";
|
|
7
7
|
import { logger } from "../../../utils/logger.js";
|
|
8
8
|
/**
|
|
9
9
|
* Direct Tools Server - Agent direct tools for immediate use
|
|
@@ -15,7 +15,7 @@ export const aiCoreServer = createMCPServer({
|
|
|
15
15
|
id: "neurolink-ai-core",
|
|
16
16
|
title: "NeuroLink AI Core",
|
|
17
17
|
description: "Core AI provider management with automatic fallback and status monitoring",
|
|
18
|
-
category: "
|
|
18
|
+
category: "aiProviders",
|
|
19
19
|
version: "1.2.0",
|
|
20
20
|
capabilities: [
|
|
21
21
|
"provider-selection",
|
|
@@ -39,6 +39,11 @@ export declare class MCPToolRegistry extends MCPRegistry {
|
|
|
39
39
|
private tools;
|
|
40
40
|
private toolImpls;
|
|
41
41
|
private toolExecutionStats;
|
|
42
|
+
constructor();
|
|
43
|
+
/**
|
|
44
|
+
* Register all direct tools from directAgentTools
|
|
45
|
+
*/
|
|
46
|
+
private registerDirectTools;
|
|
42
47
|
/**
|
|
43
48
|
* Register a server with its tools (updated signature)
|
|
44
49
|
*/
|
|
@@ -5,10 +5,70 @@
|
|
|
5
5
|
import { MCPRegistry } from "./registry.js";
|
|
6
6
|
import { registryLogger } from "../utils/logger.js";
|
|
7
7
|
import { randomUUID } from "crypto";
|
|
8
|
+
import { directAgentTools } from "../agent/directTools.js";
|
|
8
9
|
export class MCPToolRegistry extends MCPRegistry {
|
|
9
10
|
tools = new Map();
|
|
10
11
|
toolImpls = new Map(); // Store actual tool implementations
|
|
11
12
|
toolExecutionStats = new Map();
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
// Auto-register direct tools on initialization
|
|
16
|
+
this.registerDirectTools();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Register all direct tools from directAgentTools
|
|
20
|
+
*/
|
|
21
|
+
registerDirectTools() {
|
|
22
|
+
registryLogger.info("Auto-registering direct tools...");
|
|
23
|
+
for (const [toolName, toolDef] of Object.entries(directAgentTools)) {
|
|
24
|
+
const toolId = `direct.${toolName}`;
|
|
25
|
+
const toolInfo = {
|
|
26
|
+
name: toolName,
|
|
27
|
+
description: toolDef.description || `Direct tool: ${toolName}`,
|
|
28
|
+
inputSchema: {},
|
|
29
|
+
serverId: "direct",
|
|
30
|
+
category: "built-in",
|
|
31
|
+
};
|
|
32
|
+
this.tools.set(toolId, toolInfo);
|
|
33
|
+
this.toolImpls.set(toolId, {
|
|
34
|
+
execute: async (params, context) => {
|
|
35
|
+
try {
|
|
36
|
+
// Direct tools from AI SDK expect their specific parameter structure
|
|
37
|
+
// Each tool validates its own parameters, so we safely pass them through
|
|
38
|
+
const result = await toolDef.execute(params, {
|
|
39
|
+
toolCallId: context?.sessionId || "unknown",
|
|
40
|
+
messages: [],
|
|
41
|
+
});
|
|
42
|
+
// Return the result wrapped in our standard format
|
|
43
|
+
return {
|
|
44
|
+
success: true,
|
|
45
|
+
data: result,
|
|
46
|
+
metadata: {
|
|
47
|
+
toolName,
|
|
48
|
+
serverId: "direct",
|
|
49
|
+
executionTime: 0,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
return {
|
|
55
|
+
success: false,
|
|
56
|
+
error: error instanceof Error ? error.message : String(error),
|
|
57
|
+
metadata: {
|
|
58
|
+
toolName,
|
|
59
|
+
serverId: "direct",
|
|
60
|
+
executionTime: 0,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
description: toolDef.description,
|
|
66
|
+
inputSchema: {},
|
|
67
|
+
});
|
|
68
|
+
registryLogger.debug(`Registered direct tool: ${toolName} as ${toolId}`);
|
|
69
|
+
}
|
|
70
|
+
registryLogger.info(`Auto-registered ${Object.keys(directAgentTools).length} direct tools`);
|
|
71
|
+
}
|
|
12
72
|
/**
|
|
13
73
|
* Register a server with its tools (updated signature)
|
|
14
74
|
*/
|
package/dist/lib/neurolink.d.ts
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* Uses real MCP infrastructure for tool discovery and execution.
|
|
7
7
|
*/
|
|
8
8
|
import type { TextGenerationOptions, TextGenerationResult } from "./core/types.js";
|
|
9
|
-
import type { GenerateOptions, GenerateResult } from "./types/
|
|
10
|
-
import type { StreamOptions, StreamResult } from "./types/
|
|
11
|
-
import type { SimpleTool } from "./sdk/
|
|
12
|
-
import type { InMemoryMCPServerConfig } from "./types/
|
|
9
|
+
import type { GenerateOptions, GenerateResult } from "./types/generateTypes.js";
|
|
10
|
+
import type { StreamOptions, StreamResult } from "./types/streamTypes.js";
|
|
11
|
+
import type { SimpleTool } from "./sdk/toolRegistration.js";
|
|
12
|
+
import type { InMemoryMCPServerConfig } from "./types/mcpTypes.js";
|
|
13
13
|
export interface ProviderStatus {
|
|
14
14
|
provider: string;
|
|
15
15
|
status: "working" | "failed" | "not-configured";
|
package/dist/lib/neurolink.js
CHANGED
|
@@ -15,11 +15,11 @@ catch (error) {
|
|
|
15
15
|
}
|
|
16
16
|
import { AIProviderFactory } from "./core/factory.js";
|
|
17
17
|
import { mcpLogger } from "./utils/logger.js";
|
|
18
|
-
import { toolRegistry } from "./mcp/
|
|
18
|
+
import { toolRegistry } from "./mcp/toolRegistry.js";
|
|
19
19
|
import { logger } from "./utils/logger.js";
|
|
20
20
|
import { getBestProvider } from "./utils/providerUtils.js";
|
|
21
|
-
import { ProviderRegistry } from "./factories/
|
|
22
|
-
import { validateTool, createMCPServerFromTools, } from "./sdk/
|
|
21
|
+
import { ProviderRegistry } from "./factories/providerRegistry.js";
|
|
22
|
+
import { validateTool, createMCPServerFromTools, } from "./sdk/toolRegistration.js";
|
|
23
23
|
// Core types imported from core/types.js
|
|
24
24
|
export class NeuroLink {
|
|
25
25
|
mcpInitialized = false;
|
|
@@ -355,7 +355,7 @@ export class NeuroLink {
|
|
|
355
355
|
const toolDescriptions = availableTools
|
|
356
356
|
.map((tool) => `- ${tool.name}: ${tool.description} (from ${tool.server})`)
|
|
357
357
|
.join("\n");
|
|
358
|
-
const toolPrompt = `\n\
|
|
358
|
+
const toolPrompt = `\n\nYou have access to these additional tools if needed:\n${toolDescriptions}\n\nIMPORTANT: You are a general-purpose AI assistant. Answer all requests directly and creatively. These tools are optional helpers - use them only when they would genuinely improve your response. For creative tasks like storytelling, writing, or general conversation, respond naturally without requiring tools.`;
|
|
359
359
|
return (originalSystemPrompt || "") + toolPrompt;
|
|
360
360
|
}
|
|
361
361
|
/**
|
|
@@ -649,9 +649,10 @@ export class NeuroLink {
|
|
|
649
649
|
* @returns Array of available tools with metadata
|
|
650
650
|
*/
|
|
651
651
|
async getAllAvailableTools() {
|
|
652
|
-
//
|
|
653
|
-
|
|
654
|
-
|
|
652
|
+
// MCP registry already includes direct tools, so just return MCP tools
|
|
653
|
+
// This prevents duplication since direct tools are auto-registered in MCP
|
|
654
|
+
const mcpTools = await toolRegistry.listTools();
|
|
655
|
+
return mcpTools;
|
|
655
656
|
}
|
|
656
657
|
// ============================================================================
|
|
657
658
|
// PROVIDER DIAGNOSTICS - SDK-First Architecture
|
|
@@ -661,13 +662,17 @@ export class NeuroLink {
|
|
|
661
662
|
* Primary method for provider health checking and diagnostics
|
|
662
663
|
*/
|
|
663
664
|
async getProviderStatus() {
|
|
665
|
+
// CRITICAL FIX: Ensure providers are registered before testing
|
|
666
|
+
console.log("🔍 DEBUG: Initializing MCP for provider status...");
|
|
667
|
+
await this.initializeMCP();
|
|
668
|
+
console.log("🔍 DEBUG: MCP initialized:", this.mcpInitialized);
|
|
664
669
|
const { AIProviderFactory } = await import("./core/factory.js");
|
|
665
670
|
const { hasProviderEnvVars } = await import("./utils/providerUtils.js");
|
|
666
671
|
const providers = [
|
|
667
672
|
"openai",
|
|
668
673
|
"bedrock",
|
|
669
674
|
"vertex",
|
|
670
|
-
"
|
|
675
|
+
"googleVertex",
|
|
671
676
|
"anthropic",
|
|
672
677
|
"azure",
|
|
673
678
|
"google-ai",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ZodType, ZodTypeDef } from "zod";
|
|
2
2
|
import { type Schema, type LanguageModelV1 } from "ai";
|
|
3
3
|
import type { AIProviderName } from "../core/types.js";
|
|
4
|
-
import type { StreamOptions, StreamResult } from "../types/
|
|
5
|
-
import { BaseProvider } from "../core/
|
|
4
|
+
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
|
+
import { BaseProvider } from "../core/baseProvider.js";
|
|
6
6
|
/**
|
|
7
7
|
* Amazon Bedrock Provider v2 - BaseProvider Implementation
|
|
8
8
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createAmazonBedrock } from "@ai-sdk/amazon-bedrock";
|
|
2
2
|
import { streamText } from "ai";
|
|
3
|
-
import { BaseProvider } from "../core/
|
|
3
|
+
import { BaseProvider } from "../core/baseProvider.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";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ZodType, ZodTypeDef } from "zod";
|
|
2
2
|
import { type Schema, type LanguageModelV1 } from "ai";
|
|
3
3
|
import type { AIProviderName } from "../core/types.js";
|
|
4
|
-
import type { StreamOptions, StreamResult } from "../types/
|
|
5
|
-
import { BaseProvider } from "../core/
|
|
4
|
+
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
|
+
import { BaseProvider } from "../core/baseProvider.js";
|
|
6
6
|
/**
|
|
7
7
|
* Anthropic Provider v2 - BaseProvider Implementation
|
|
8
8
|
* Fixed syntax and enhanced with proper error handling
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { anthropic } from "@ai-sdk/anthropic";
|
|
2
2
|
import { streamText } from "ai";
|
|
3
|
-
import { BaseProvider } from "../core/
|
|
3
|
+
import { BaseProvider } from "../core/baseProvider.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";
|