@juspay/neurolink 7.29.1 → 7.29.3
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 +12 -0
- package/dist/cli/commands/config.d.ts +86 -86
- package/dist/cli/commands/mcp.js +64 -9
- package/dist/cli/commands/models.js +25 -21
- package/dist/cli/commands/ollama.js +2 -2
- package/dist/cli/factories/commandFactory.d.ts +9 -0
- package/dist/cli/factories/commandFactory.js +177 -83
- package/dist/cli/factories/ollamaCommandFactory.js +3 -1
- package/dist/cli/factories/sagemakerCommandFactory.js +3 -2
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +19 -11
- package/dist/cli/utils/envManager.js +5 -5
- package/dist/cli/utils/ollamaUtils.d.ts +12 -0
- package/dist/cli/utils/ollamaUtils.js +58 -42
- package/dist/config/configManager.js +5 -2
- package/dist/core/analytics.d.ts +2 -24
- package/dist/core/analytics.js +12 -17
- package/dist/core/baseProvider.d.ts +30 -1
- package/dist/core/baseProvider.js +180 -198
- package/dist/core/dynamicModels.d.ts +4 -4
- package/dist/core/dynamicModels.js +7 -7
- package/dist/core/evaluation.d.ts +9 -9
- package/dist/core/evaluation.js +117 -65
- package/dist/core/evaluationProviders.d.ts +18 -2
- package/dist/core/evaluationProviders.js +15 -13
- package/dist/core/factory.js +77 -4
- package/dist/core/modelConfiguration.d.ts +63 -0
- package/dist/core/modelConfiguration.js +354 -290
- package/dist/core/streamAnalytics.d.ts +10 -5
- package/dist/core/streamAnalytics.js +10 -10
- package/dist/core/types.d.ts +19 -109
- package/dist/core/types.js +13 -0
- package/dist/factories/providerFactory.js +4 -1
- package/dist/factories/providerRegistry.js +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/lib/config/configManager.js +5 -2
- package/dist/lib/core/analytics.d.ts +2 -24
- package/dist/lib/core/analytics.js +12 -17
- package/dist/lib/core/baseProvider.d.ts +30 -1
- package/dist/lib/core/baseProvider.js +180 -198
- package/dist/lib/core/dynamicModels.js +7 -7
- package/dist/lib/core/evaluation.d.ts +9 -9
- package/dist/lib/core/evaluation.js +117 -65
- package/dist/lib/core/evaluationProviders.d.ts +18 -2
- package/dist/lib/core/evaluationProviders.js +15 -13
- package/dist/lib/core/factory.js +77 -4
- package/dist/lib/core/modelConfiguration.d.ts +63 -0
- package/dist/lib/core/modelConfiguration.js +354 -290
- package/dist/lib/core/streamAnalytics.d.ts +10 -5
- package/dist/lib/core/streamAnalytics.js +10 -10
- package/dist/lib/core/types.d.ts +19 -109
- package/dist/lib/core/types.js +13 -0
- package/dist/lib/factories/providerFactory.js +4 -1
- package/dist/lib/factories/providerRegistry.js +2 -2
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/mcp/externalServerManager.js +14 -6
- package/dist/lib/mcp/factory.js +1 -1
- package/dist/lib/mcp/flexibleToolValidator.d.ts +50 -0
- package/dist/lib/mcp/flexibleToolValidator.js +161 -0
- package/dist/lib/mcp/index.d.ts +1 -1
- package/dist/lib/mcp/index.js +1 -1
- package/dist/lib/mcp/mcpCircuitBreaker.js +5 -1
- package/dist/lib/mcp/mcpClientFactory.js +3 -0
- package/dist/lib/mcp/registry.d.ts +3 -3
- package/dist/lib/mcp/registry.js +3 -3
- package/dist/lib/mcp/servers/aiProviders/aiAnalysisTools.js +5 -5
- package/dist/lib/mcp/servers/aiProviders/aiWorkflowTools.js +6 -6
- package/dist/lib/mcp/servers/utilities/utilityServer.js +1 -1
- package/dist/lib/mcp/toolDiscoveryService.js +8 -2
- package/dist/lib/mcp/toolRegistry.d.ts +2 -2
- package/dist/lib/mcp/toolRegistry.js +29 -54
- package/dist/lib/middleware/builtin/analytics.js +4 -4
- package/dist/lib/middleware/builtin/guardrails.js +2 -2
- package/dist/lib/middleware/registry.js +11 -2
- package/dist/lib/models/modelRegistry.d.ts +1 -1
- package/dist/lib/models/modelRegistry.js +3 -3
- package/dist/lib/models/modelResolver.d.ts +1 -1
- package/dist/lib/models/modelResolver.js +2 -2
- package/dist/lib/neurolink.d.ts +118 -0
- package/dist/lib/neurolink.js +814 -952
- package/dist/lib/providers/amazonBedrock.d.ts +47 -6
- package/dist/lib/providers/amazonBedrock.js +282 -23
- package/dist/lib/providers/amazonSagemaker.d.ts +1 -1
- package/dist/lib/providers/amazonSagemaker.js +12 -3
- package/dist/lib/providers/anthropic.d.ts +1 -1
- package/dist/lib/providers/anthropic.js +7 -6
- package/dist/lib/providers/anthropicBaseProvider.d.ts +1 -1
- package/dist/lib/providers/anthropicBaseProvider.js +4 -3
- package/dist/lib/providers/aws/credentialProvider.d.ts +58 -0
- package/dist/lib/providers/aws/credentialProvider.js +267 -0
- package/dist/lib/providers/aws/credentialTester.d.ts +49 -0
- package/dist/lib/providers/aws/credentialTester.js +394 -0
- package/dist/lib/providers/azureOpenai.d.ts +1 -1
- package/dist/lib/providers/azureOpenai.js +1 -1
- package/dist/lib/providers/googleAiStudio.d.ts +1 -1
- package/dist/lib/providers/googleAiStudio.js +2 -2
- package/dist/lib/providers/googleVertex.d.ts +40 -0
- package/dist/lib/providers/googleVertex.js +330 -274
- package/dist/lib/providers/huggingFace.js +1 -1
- package/dist/lib/providers/mistral.d.ts +1 -1
- package/dist/lib/providers/mistral.js +2 -2
- package/dist/lib/providers/ollama.d.ts +4 -0
- package/dist/lib/providers/ollama.js +38 -18
- package/dist/lib/providers/openAI.d.ts +1 -1
- package/dist/lib/providers/openAI.js +2 -2
- package/dist/lib/providers/sagemaker/adaptive-semaphore.js +7 -4
- package/dist/lib/providers/sagemaker/client.js +13 -3
- package/dist/lib/providers/sagemaker/config.js +5 -1
- package/dist/lib/providers/sagemaker/detection.js +19 -9
- package/dist/lib/providers/sagemaker/errors.d.ts +8 -1
- package/dist/lib/providers/sagemaker/errors.js +103 -20
- package/dist/lib/providers/sagemaker/language-model.d.ts +3 -3
- package/dist/lib/providers/sagemaker/language-model.js +4 -4
- package/dist/lib/providers/sagemaker/parsers.js +14 -6
- package/dist/lib/providers/sagemaker/streaming.js +14 -3
- package/dist/lib/providers/sagemaker/types.d.ts +1 -1
- package/dist/lib/proxy/awsProxyIntegration.d.ts +23 -0
- package/dist/lib/proxy/awsProxyIntegration.js +285 -0
- package/dist/lib/proxy/proxyFetch.d.ts +9 -5
- package/dist/lib/proxy/proxyFetch.js +232 -98
- package/dist/lib/proxy/utils/noProxyUtils.d.ts +39 -0
- package/dist/lib/proxy/utils/noProxyUtils.js +149 -0
- package/dist/lib/sdk/toolRegistration.d.ts +1 -1
- package/dist/lib/types/cli.d.ts +80 -8
- package/dist/lib/types/contextTypes.js +2 -2
- package/dist/lib/types/generateTypes.d.ts +4 -6
- package/dist/lib/types/providers.d.ts +124 -19
- package/dist/lib/types/providers.js +6 -6
- package/dist/lib/types/streamTypes.d.ts +4 -6
- package/dist/lib/types/typeAliases.d.ts +1 -1
- package/dist/lib/utils/analyticsUtils.d.ts +33 -0
- package/dist/lib/utils/analyticsUtils.js +76 -0
- package/dist/lib/utils/errorHandling.js +4 -1
- package/dist/lib/utils/evaluationUtils.d.ts +27 -0
- package/dist/lib/utils/evaluationUtils.js +131 -0
- package/dist/lib/utils/optionsUtils.js +10 -1
- package/dist/lib/utils/performance.d.ts +1 -1
- package/dist/lib/utils/performance.js +15 -3
- package/dist/lib/utils/providerConfig.d.ts +1 -0
- package/dist/lib/utils/providerConfig.js +2 -1
- package/dist/lib/utils/providerHealth.d.ts +48 -0
- package/dist/lib/utils/providerHealth.js +221 -158
- package/dist/lib/utils/providerUtils.js +2 -2
- package/dist/lib/utils/timeout.js +8 -3
- package/dist/mcp/externalServerManager.js +14 -6
- package/dist/mcp/factory.js +1 -1
- package/dist/mcp/flexibleToolValidator.d.ts +50 -0
- package/dist/mcp/flexibleToolValidator.js +161 -0
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/mcpCircuitBreaker.js +5 -1
- package/dist/mcp/mcpClientFactory.js +3 -0
- package/dist/mcp/registry.d.ts +3 -3
- package/dist/mcp/registry.js +3 -3
- package/dist/mcp/servers/aiProviders/aiAnalysisTools.js +5 -5
- package/dist/mcp/servers/aiProviders/aiWorkflowTools.js +6 -6
- package/dist/mcp/servers/utilities/utilityServer.js +1 -1
- package/dist/mcp/toolDiscoveryService.js +8 -2
- package/dist/mcp/toolRegistry.d.ts +2 -2
- package/dist/mcp/toolRegistry.js +29 -54
- package/dist/middleware/builtin/analytics.js +4 -4
- package/dist/middleware/builtin/guardrails.js +2 -2
- package/dist/middleware/registry.js +11 -2
- package/dist/models/modelRegistry.d.ts +1 -1
- package/dist/models/modelRegistry.js +3 -3
- package/dist/models/modelResolver.d.ts +1 -1
- package/dist/models/modelResolver.js +2 -2
- package/dist/neurolink.d.ts +118 -0
- package/dist/neurolink.js +814 -952
- package/dist/providers/amazonBedrock.d.ts +47 -6
- package/dist/providers/amazonBedrock.js +282 -23
- package/dist/providers/amazonSagemaker.d.ts +1 -1
- package/dist/providers/amazonSagemaker.js +12 -3
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +7 -6
- package/dist/providers/anthropicBaseProvider.d.ts +1 -1
- package/dist/providers/anthropicBaseProvider.js +4 -3
- package/dist/providers/aws/credentialProvider.d.ts +58 -0
- package/dist/providers/aws/credentialProvider.js +267 -0
- package/dist/providers/aws/credentialTester.d.ts +49 -0
- package/dist/providers/aws/credentialTester.js +394 -0
- package/dist/providers/azureOpenai.d.ts +1 -1
- package/dist/providers/azureOpenai.js +1 -1
- package/dist/providers/googleAiStudio.d.ts +1 -1
- package/dist/providers/googleAiStudio.js +2 -2
- package/dist/providers/googleVertex.d.ts +40 -0
- package/dist/providers/googleVertex.js +330 -274
- package/dist/providers/huggingFace.js +1 -1
- package/dist/providers/mistral.d.ts +1 -1
- package/dist/providers/mistral.js +2 -2
- package/dist/providers/ollama.d.ts +4 -0
- package/dist/providers/ollama.js +38 -18
- package/dist/providers/openAI.d.ts +1 -1
- package/dist/providers/openAI.js +2 -2
- package/dist/providers/sagemaker/adaptive-semaphore.js +7 -4
- package/dist/providers/sagemaker/client.js +13 -3
- package/dist/providers/sagemaker/config.js +5 -1
- package/dist/providers/sagemaker/detection.js +19 -9
- package/dist/providers/sagemaker/errors.d.ts +8 -1
- package/dist/providers/sagemaker/errors.js +103 -20
- package/dist/providers/sagemaker/language-model.d.ts +3 -3
- package/dist/providers/sagemaker/language-model.js +4 -4
- package/dist/providers/sagemaker/parsers.js +14 -6
- package/dist/providers/sagemaker/streaming.js +14 -3
- package/dist/providers/sagemaker/types.d.ts +1 -1
- package/dist/proxy/awsProxyIntegration.d.ts +23 -0
- package/dist/proxy/awsProxyIntegration.js +285 -0
- package/dist/proxy/proxyFetch.d.ts +9 -5
- package/dist/proxy/proxyFetch.js +232 -98
- package/dist/proxy/utils/noProxyUtils.d.ts +39 -0
- package/dist/proxy/utils/noProxyUtils.js +149 -0
- package/dist/sdk/toolRegistration.d.ts +1 -1
- package/dist/types/cli.d.ts +80 -8
- package/dist/types/contextTypes.js +2 -2
- package/dist/types/generateTypes.d.ts +4 -6
- package/dist/types/providers.d.ts +124 -19
- package/dist/types/providers.js +6 -6
- package/dist/types/streamTypes.d.ts +4 -6
- package/dist/types/typeAliases.d.ts +1 -1
- package/dist/utils/analyticsUtils.d.ts +33 -0
- package/dist/utils/analyticsUtils.js +76 -0
- package/dist/utils/errorHandling.js +4 -1
- package/dist/utils/evaluationUtils.d.ts +27 -0
- package/dist/utils/evaluationUtils.js +131 -0
- package/dist/utils/optionsUtils.js +10 -1
- package/dist/utils/performance.d.ts +1 -1
- package/dist/utils/performance.js +15 -3
- package/dist/utils/providerConfig.d.ts +1 -0
- package/dist/utils/providerConfig.js +2 -1
- package/dist/utils/providerHealth.d.ts +48 -0
- package/dist/utils/providerHealth.js +221 -158
- package/dist/utils/providerUtils.js +2 -2
- package/dist/utils/timeout.js +8 -3
- package/package.json +5 -1
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import type { AnalyticsData } from "./types.js";
|
|
2
2
|
import type { TokenUsage } from "../types/providers.js";
|
|
3
3
|
import type { ToolCall, ToolResult } from "../types/streamTypes.js";
|
|
4
|
+
/**
|
|
5
|
+
* Raw usage data from Vercel AI SDK (uses different field names)
|
|
6
|
+
*/
|
|
7
|
+
interface AISDKUsage {
|
|
8
|
+
promptTokens: number;
|
|
9
|
+
completionTokens: number;
|
|
10
|
+
totalTokens: number;
|
|
11
|
+
}
|
|
4
12
|
/**
|
|
5
13
|
* Stream analytics result from Vercel AI SDK streamText
|
|
6
14
|
*/
|
|
7
15
|
export interface StreamTextResult {
|
|
8
16
|
textStream: AsyncIterable<string>;
|
|
9
17
|
text: Promise<string>;
|
|
10
|
-
usage: Promise<
|
|
11
|
-
promptTokens: number;
|
|
12
|
-
completionTokens: number;
|
|
13
|
-
totalTokens: number;
|
|
14
|
-
} | undefined>;
|
|
18
|
+
usage: Promise<AISDKUsage | undefined>;
|
|
15
19
|
response: Promise<{
|
|
16
20
|
id?: string;
|
|
17
21
|
model?: string;
|
|
@@ -63,3 +67,4 @@ export declare class BaseStreamAnalyticsCollector implements StreamAnalyticsColl
|
|
|
63
67
|
* Global instance of stream analytics collector
|
|
64
68
|
*/
|
|
65
69
|
export declare const streamAnalyticsCollector: BaseStreamAnalyticsCollector;
|
|
70
|
+
export {};
|
|
@@ -13,24 +13,24 @@ export class BaseStreamAnalyticsCollector {
|
|
|
13
13
|
if (!usage) {
|
|
14
14
|
logger.debug("No usage data available from stream result");
|
|
15
15
|
return {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
input: 0,
|
|
17
|
+
output: 0,
|
|
18
|
+
total: 0,
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
return {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
input: usage.promptTokens || 0,
|
|
23
|
+
output: usage.completionTokens || 0,
|
|
24
|
+
total: usage.totalTokens ||
|
|
25
25
|
(usage.promptTokens || 0) + (usage.completionTokens || 0),
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
catch (error) {
|
|
29
29
|
logger.warn("Failed to collect usage from stream result", { error });
|
|
30
30
|
return {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
input: 0,
|
|
32
|
+
output: 0,
|
|
33
|
+
total: 0,
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -100,7 +100,7 @@ export class BaseStreamAnalyticsCollector {
|
|
|
100
100
|
error: error instanceof Error ? error.message : String(error),
|
|
101
101
|
});
|
|
102
102
|
// Return minimal analytics on error
|
|
103
|
-
return createAnalytics(provider, model, { usage: {
|
|
103
|
+
return createAnalytics(provider, model, { usage: { input: 0, output: 0, total: 0 } }, responseTime, {
|
|
104
104
|
...metadata,
|
|
105
105
|
streamingMode: true,
|
|
106
106
|
analyticsError: true,
|
package/dist/lib/core/types.d.ts
CHANGED
|
@@ -4,16 +4,14 @@ import type { GenerateResult } from "../types/generateTypes.js";
|
|
|
4
4
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
5
|
import type { JsonValue } from "../types/common.js";
|
|
6
6
|
import type { ChatMessage } from "../types/conversationTypes.js";
|
|
7
|
-
import type { AnalyticsData } from "
|
|
7
|
+
import type { TokenUsage, AnalyticsData } from "../types/providers.js";
|
|
8
|
+
import type { EvaluationData } from "../index.js";
|
|
9
|
+
export type { EvaluationData };
|
|
8
10
|
export interface TextGenerationResult {
|
|
9
11
|
content: string;
|
|
10
12
|
provider?: string;
|
|
11
13
|
model?: string;
|
|
12
|
-
usage?:
|
|
13
|
-
promptTokens?: number;
|
|
14
|
-
completionTokens?: number;
|
|
15
|
-
totalTokens?: number;
|
|
16
|
-
};
|
|
14
|
+
usage?: TokenUsage;
|
|
17
15
|
responseTime?: number;
|
|
18
16
|
toolsUsed?: string[];
|
|
19
17
|
toolExecutions?: Array<{
|
|
@@ -30,13 +28,7 @@ export interface TextGenerationResult {
|
|
|
30
28
|
category?: string;
|
|
31
29
|
}>;
|
|
32
30
|
analytics?: AnalyticsData;
|
|
33
|
-
evaluation?:
|
|
34
|
-
relevance: number;
|
|
35
|
-
accuracy: number;
|
|
36
|
-
completeness: number;
|
|
37
|
-
overall: number;
|
|
38
|
-
reasoning?: string;
|
|
39
|
-
};
|
|
31
|
+
evaluation?: EvaluationData;
|
|
40
32
|
}
|
|
41
33
|
/**
|
|
42
34
|
* Supported AI Provider Names
|
|
@@ -105,10 +97,20 @@ export declare enum GoogleAIModels {
|
|
|
105
97
|
GEMINI_1_5_FLASH = "gemini-1.5-flash",
|
|
106
98
|
GEMINI_1_5_FLASH_LITE = "gemini-1.5-flash-lite"
|
|
107
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Supported Models for Anthropic (Direct API)
|
|
102
|
+
*/
|
|
103
|
+
export declare enum AnthropicModels {
|
|
104
|
+
CLAUDE_3_5_SONNET = "claude-3-5-sonnet-20241022",
|
|
105
|
+
CLAUDE_3_5_HAIKU = "claude-3-5-haiku-20241022",
|
|
106
|
+
CLAUDE_3_SONNET = "claude-3-sonnet-20240229",
|
|
107
|
+
CLAUDE_3_OPUS = "claude-3-opus-20240229",
|
|
108
|
+
CLAUDE_3_HAIKU = "claude-3-haiku-20240307"
|
|
109
|
+
}
|
|
108
110
|
/**
|
|
109
111
|
* Union type of all supported model names
|
|
110
112
|
*/
|
|
111
|
-
export type SupportedModelName = BedrockModels | OpenAIModels | VertexModels | GoogleAIModels;
|
|
113
|
+
export type SupportedModelName = BedrockModels | OpenAIModels | VertexModels | GoogleAIModels | AnthropicModels;
|
|
112
114
|
/**
|
|
113
115
|
* Provider configuration specifying provider and its available models
|
|
114
116
|
*/
|
|
@@ -153,102 +155,10 @@ export interface TextGenerationOptions {
|
|
|
153
155
|
content: string;
|
|
154
156
|
}>;
|
|
155
157
|
conversationMessages?: ChatMessage[];
|
|
158
|
+
expectedOutcome?: string;
|
|
159
|
+
evaluationCriteria?: string[];
|
|
156
160
|
}
|
|
157
|
-
export type { AnalyticsData };
|
|
158
|
-
/**
|
|
159
|
-
* Response quality evaluation scores
|
|
160
|
-
* Comprehensive evaluation interface for response quality assessment
|
|
161
|
-
*/
|
|
162
|
-
export interface EvaluationData {
|
|
163
|
-
relevance: number;
|
|
164
|
-
accuracy: number;
|
|
165
|
-
completeness: number;
|
|
166
|
-
overall: number;
|
|
167
|
-
domainAlignment?: number;
|
|
168
|
-
terminologyAccuracy?: number;
|
|
169
|
-
toolEffectiveness?: number;
|
|
170
|
-
isOffTopic: boolean;
|
|
171
|
-
alertSeverity: "low" | "medium" | "high" | "none";
|
|
172
|
-
reasoning: string;
|
|
173
|
-
suggestedImprovements?: string;
|
|
174
|
-
evaluationModel: string;
|
|
175
|
-
evaluationTime: number;
|
|
176
|
-
evaluationDomain?: string;
|
|
177
|
-
evaluationProvider?: string;
|
|
178
|
-
evaluationAttempt?: number;
|
|
179
|
-
evaluationConfig?: {
|
|
180
|
-
mode: string;
|
|
181
|
-
fallbackUsed: boolean;
|
|
182
|
-
costEstimate: number;
|
|
183
|
-
};
|
|
184
|
-
domainConfig?: {
|
|
185
|
-
domainName: string;
|
|
186
|
-
domainDescription: string;
|
|
187
|
-
keyTerms: string[];
|
|
188
|
-
failurePatterns: string[];
|
|
189
|
-
successPatterns: string[];
|
|
190
|
-
evaluationCriteria?: Record<string, unknown>;
|
|
191
|
-
};
|
|
192
|
-
domainEvaluation?: {
|
|
193
|
-
domainRelevance: number;
|
|
194
|
-
terminologyAccuracy: number;
|
|
195
|
-
domainExpertise: number;
|
|
196
|
-
domainSpecificInsights: string[];
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* BACKWARD COMPATIBILITY: Legacy evaluation interface
|
|
201
|
-
* Maintains existing field names for backward compatibility
|
|
202
|
-
*/
|
|
203
|
-
export interface LegacyEvaluationData {
|
|
204
|
-
relevance: number;
|
|
205
|
-
accuracy: number;
|
|
206
|
-
completeness: number;
|
|
207
|
-
overall: number;
|
|
208
|
-
isOffTopic: boolean;
|
|
209
|
-
alertSeverity: "low" | "medium" | "high" | "none";
|
|
210
|
-
reasoning: string;
|
|
211
|
-
suggestedImprovements?: string;
|
|
212
|
-
evaluationModel: string;
|
|
213
|
-
evaluationTime: number;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Evaluation system configuration for multi-provider support
|
|
217
|
-
*/
|
|
218
|
-
export interface EvaluationConfig {
|
|
219
|
-
provider: string;
|
|
220
|
-
model: string;
|
|
221
|
-
mode: "fast" | "balanced" | "quality";
|
|
222
|
-
fallbackEnabled: boolean;
|
|
223
|
-
fallbackProviders: string[];
|
|
224
|
-
timeout: number;
|
|
225
|
-
maxTokens: number;
|
|
226
|
-
temperature: number;
|
|
227
|
-
preferCheap: boolean;
|
|
228
|
-
maxCostPerEval: number;
|
|
229
|
-
retryAttempts: number;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Provider model configuration for evaluation
|
|
233
|
-
*/
|
|
234
|
-
export interface ProviderModelConfig {
|
|
235
|
-
provider: string;
|
|
236
|
-
models: {
|
|
237
|
-
fast: string;
|
|
238
|
-
balanced: string;
|
|
239
|
-
quality: string;
|
|
240
|
-
};
|
|
241
|
-
costPerToken: {
|
|
242
|
-
input: number;
|
|
243
|
-
output: number;
|
|
244
|
-
};
|
|
245
|
-
requiresApiKey: string[];
|
|
246
|
-
performance: {
|
|
247
|
-
speed: number;
|
|
248
|
-
quality: number;
|
|
249
|
-
cost: number;
|
|
250
|
-
};
|
|
251
|
-
}
|
|
161
|
+
export type { AnalyticsData } from "../types/providers.js";
|
|
252
162
|
/**
|
|
253
163
|
* Enhanced result interfaces with optional analytics/evaluation
|
|
254
164
|
*/
|
package/dist/lib/core/types.js
CHANGED
|
@@ -79,6 +79,19 @@ export var GoogleAIModels;
|
|
|
79
79
|
GoogleAIModels["GEMINI_1_5_FLASH"] = "gemini-1.5-flash";
|
|
80
80
|
GoogleAIModels["GEMINI_1_5_FLASH_LITE"] = "gemini-1.5-flash-lite";
|
|
81
81
|
})(GoogleAIModels || (GoogleAIModels = {}));
|
|
82
|
+
/**
|
|
83
|
+
* Supported Models for Anthropic (Direct API)
|
|
84
|
+
*/
|
|
85
|
+
export var AnthropicModels;
|
|
86
|
+
(function (AnthropicModels) {
|
|
87
|
+
// Claude 3.5 Series (Latest)
|
|
88
|
+
AnthropicModels["CLAUDE_3_5_SONNET"] = "claude-3-5-sonnet-20241022";
|
|
89
|
+
AnthropicModels["CLAUDE_3_5_HAIKU"] = "claude-3-5-haiku-20241022";
|
|
90
|
+
// Claude 3 Series (Legacy support)
|
|
91
|
+
AnthropicModels["CLAUDE_3_SONNET"] = "claude-3-sonnet-20240229";
|
|
92
|
+
AnthropicModels["CLAUDE_3_OPUS"] = "claude-3-opus-20240229";
|
|
93
|
+
AnthropicModels["CLAUDE_3_HAIKU"] = "claude-3-haiku-20240307";
|
|
94
|
+
})(AnthropicModels || (AnthropicModels = {}));
|
|
82
95
|
/**
|
|
83
96
|
* Default provider configurations
|
|
84
97
|
*/
|
|
@@ -42,6 +42,9 @@ export class ProviderFactory {
|
|
|
42
42
|
if (providerName.toLowerCase().includes("vertex")) {
|
|
43
43
|
model = process.env.VERTEX_MODEL;
|
|
44
44
|
}
|
|
45
|
+
else if (providerName.toLowerCase().includes("bedrock")) {
|
|
46
|
+
model = process.env.BEDROCK_MODEL || process.env.BEDROCK_MODEL_ID;
|
|
47
|
+
}
|
|
45
48
|
// Fallback to registry default if no env var
|
|
46
49
|
model = model || registration.defaultModel;
|
|
47
50
|
}
|
|
@@ -51,7 +54,7 @@ export class ProviderFactory {
|
|
|
51
54
|
// Try as async factory function first (most providers are async functions)
|
|
52
55
|
result = await registration.constructor(model, providerName, sdk);
|
|
53
56
|
}
|
|
54
|
-
catch
|
|
57
|
+
catch {
|
|
55
58
|
// Fallback to constructor - ensure parameters are maintained
|
|
56
59
|
result = new registration.constructor(model, providerName, sdk);
|
|
57
60
|
}
|
|
@@ -39,9 +39,9 @@ export class ProviderRegistry {
|
|
|
39
39
|
return new AnthropicProvider(modelName, sdk);
|
|
40
40
|
}, "claude-3-5-sonnet-20241022", ["claude", "anthropic"]);
|
|
41
41
|
// Register Amazon Bedrock provider
|
|
42
|
-
ProviderFactory.registerProvider(AIProviderName.BEDROCK, async (modelName) => {
|
|
42
|
+
ProviderFactory.registerProvider(AIProviderName.BEDROCK, async (modelName, _providerName, sdk) => {
|
|
43
43
|
const { AmazonBedrockProvider } = await import("../providers/amazonBedrock.js");
|
|
44
|
-
return new AmazonBedrockProvider(modelName);
|
|
44
|
+
return new AmazonBedrockProvider(modelName, undefined, sdk);
|
|
45
45
|
}, undefined, // Let provider read BEDROCK_MODEL from .env
|
|
46
46
|
["bedrock", "aws"]);
|
|
47
47
|
// Register Azure OpenAI provider
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -83,7 +83,8 @@ export declare function getTelemetryStatus(): {
|
|
|
83
83
|
enabled: boolean;
|
|
84
84
|
initialized: boolean;
|
|
85
85
|
};
|
|
86
|
-
export type { TextGenerationOptions, TextGenerationResult, AnalyticsData,
|
|
86
|
+
export type { TextGenerationOptions, TextGenerationResult, AnalyticsData, } from "./core/types.js";
|
|
87
|
+
export type { EvaluationData } from "./types/providers.js";
|
|
87
88
|
/**
|
|
88
89
|
* BACKWARD COMPATIBILITY: Legacy generateText function
|
|
89
90
|
* Provides standalone generateText function for existing code that uses it
|
|
@@ -357,6 +357,9 @@ export class ExternalServerManager extends EventEmitter {
|
|
|
357
357
|
// Start the server
|
|
358
358
|
await this.startServer(serverId);
|
|
359
359
|
const finalInstance = this.servers.get(serverId);
|
|
360
|
+
if (!finalInstance) {
|
|
361
|
+
throw new Error(`Server ${serverId} not found after registration`);
|
|
362
|
+
}
|
|
360
363
|
// Convert RuntimeMCPServerInfo to ExternalMCPServerInstance for return
|
|
361
364
|
const convertedInstance = {
|
|
362
365
|
config: finalInstance.config,
|
|
@@ -664,6 +667,9 @@ export class ExternalServerManager extends EventEmitter {
|
|
|
664
667
|
const delay = Math.min(1000 *
|
|
665
668
|
Math.pow(this.config.restartBackoffMultiplier, instance.reconnectAttempts - 1), 30000);
|
|
666
669
|
mcpLogger.info(`[ExternalServerManager] Scheduling restart for ${serverId} in ${delay}ms (attempt ${instance.reconnectAttempts})`);
|
|
670
|
+
if (instance.restartTimer) {
|
|
671
|
+
return;
|
|
672
|
+
} // already scheduled
|
|
667
673
|
instance.restartTimer = setTimeout(async () => {
|
|
668
674
|
try {
|
|
669
675
|
await this.stopServer(serverId);
|
|
@@ -914,6 +920,7 @@ export class ExternalServerManager extends EventEmitter {
|
|
|
914
920
|
}
|
|
915
921
|
try {
|
|
916
922
|
mcpLogger.debug(`[ExternalServerManager] Registering ${instance.toolsMap.size} tools with main registry for server: ${serverId}`);
|
|
923
|
+
const registrations = [];
|
|
917
924
|
for (const [toolName, tool] of instance.toolsMap.entries()) {
|
|
918
925
|
const toolId = `${serverId}.${toolName}`;
|
|
919
926
|
const toolInfo = {
|
|
@@ -923,21 +930,23 @@ export class ExternalServerManager extends EventEmitter {
|
|
|
923
930
|
serverId: serverId,
|
|
924
931
|
category: detectCategory({ isExternal: true, serverId }),
|
|
925
932
|
};
|
|
926
|
-
// Register with main tool registry
|
|
927
933
|
try {
|
|
928
|
-
toolRegistry.registerTool(toolId, toolInfo, {
|
|
929
|
-
execute: async (params,
|
|
934
|
+
registrations.push(toolRegistry.registerTool(toolId, toolInfo, {
|
|
935
|
+
execute: async (params, _context) => {
|
|
930
936
|
// Execute tool via ExternalServerManager for proper lifecycle management
|
|
931
937
|
return await this.executeTool(serverId, toolName, params, { timeout: this.config.defaultTimeout });
|
|
932
938
|
},
|
|
933
|
-
});
|
|
939
|
+
}));
|
|
934
940
|
mcpLogger.debug(`[ExternalServerManager] Registered tool with main registry: ${toolId}`);
|
|
935
941
|
}
|
|
936
942
|
catch (registrationError) {
|
|
937
943
|
mcpLogger.warn(`[ExternalServerManager] Failed to register tool ${toolId} with main registry:`, registrationError);
|
|
938
944
|
}
|
|
939
945
|
}
|
|
940
|
-
|
|
946
|
+
const results = await Promise.allSettled(registrations);
|
|
947
|
+
const ok = results.filter((r) => r.status === "fulfilled").length;
|
|
948
|
+
const failed = results.length - ok;
|
|
949
|
+
mcpLogger.info(`[ExternalServerManager] Registered ${ok}/${results.length} tools with main registry for ${serverId}${failed ? ` (${failed} failed)` : ""}`);
|
|
941
950
|
}
|
|
942
951
|
catch (error) {
|
|
943
952
|
mcpLogger.error(`[ExternalServerManager] Failed to register tools with main registry for ${serverId}:`, error);
|
|
@@ -1010,7 +1019,6 @@ export class ExternalServerManager extends EventEmitter {
|
|
|
1010
1019
|
}
|
|
1011
1020
|
}
|
|
1012
1021
|
catch (error) {
|
|
1013
|
-
const duration = Date.now() - startTime;
|
|
1014
1022
|
instance.metrics.totalErrors++;
|
|
1015
1023
|
mcpLogger.error(`[ExternalServerManager] Tool execution failed: ${toolName} on ${serverId}`, error);
|
|
1016
1024
|
throw error;
|
package/dist/lib/mcp/factory.js
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FlexibleToolValidator - Universal Safety Checks Only
|
|
3
|
+
*
|
|
4
|
+
* Following Anthropic's MCP specification which intentionally leaves tool naming flexible,
|
|
5
|
+
* this validator only blocks truly dangerous cases to support maximum MCP tool compatibility.
|
|
6
|
+
*
|
|
7
|
+
* Phase 1 Implementation:
|
|
8
|
+
* - Universal safety checks only (empty names, control characters, excessive length)
|
|
9
|
+
* - No context-specific validation or arbitrary pattern restrictions
|
|
10
|
+
* - Designed to support ALL legitimate MCP tools (github.create_repo, filesystem.read_file, etc.)
|
|
11
|
+
*/
|
|
12
|
+
export interface FlexibleValidationResult {
|
|
13
|
+
isValid: boolean;
|
|
14
|
+
error?: string;
|
|
15
|
+
warnings?: string[];
|
|
16
|
+
}
|
|
17
|
+
export declare class FlexibleToolValidator {
|
|
18
|
+
private static readonly MAX_TOOL_NAME_LENGTH;
|
|
19
|
+
private static readonly MIN_TOOL_NAME_LENGTH;
|
|
20
|
+
/**
|
|
21
|
+
* Validate tool name with universal safety checks only
|
|
22
|
+
*
|
|
23
|
+
* This method only blocks truly dangerous cases:
|
|
24
|
+
* 1. Empty or whitespace-only names
|
|
25
|
+
* 2. Control characters that could break systems
|
|
26
|
+
* 3. Excessively long names that could cause memory issues
|
|
27
|
+
*
|
|
28
|
+
* Everything else is allowed to support maximum MCP tool compatibility.
|
|
29
|
+
*/
|
|
30
|
+
static validateToolName(toolId: string): FlexibleValidationResult;
|
|
31
|
+
/**
|
|
32
|
+
* Validate tool information with minimal safety checks
|
|
33
|
+
*/
|
|
34
|
+
static validateToolInfo(toolId: string, toolInfo: {
|
|
35
|
+
description?: string;
|
|
36
|
+
serverId?: string;
|
|
37
|
+
}): FlexibleValidationResult;
|
|
38
|
+
/**
|
|
39
|
+
* Get information about what this validator checks
|
|
40
|
+
*/
|
|
41
|
+
static getValidationInfo(): {
|
|
42
|
+
philosophy: string;
|
|
43
|
+
checks: string[];
|
|
44
|
+
whatIsAllowed: string[];
|
|
45
|
+
examples: {
|
|
46
|
+
valid: string[];
|
|
47
|
+
invalid: string[];
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FlexibleToolValidator - Universal Safety Checks Only
|
|
3
|
+
*
|
|
4
|
+
* Following Anthropic's MCP specification which intentionally leaves tool naming flexible,
|
|
5
|
+
* this validator only blocks truly dangerous cases to support maximum MCP tool compatibility.
|
|
6
|
+
*
|
|
7
|
+
* Phase 1 Implementation:
|
|
8
|
+
* - Universal safety checks only (empty names, control characters, excessive length)
|
|
9
|
+
* - No context-specific validation or arbitrary pattern restrictions
|
|
10
|
+
* - Designed to support ALL legitimate MCP tools (github.create_repo, filesystem.read_file, etc.)
|
|
11
|
+
*/
|
|
12
|
+
import { registryLogger } from "../utils/logger.js";
|
|
13
|
+
export class FlexibleToolValidator {
|
|
14
|
+
// Universal safety limits (generous to support all legitimate tools)
|
|
15
|
+
static MAX_TOOL_NAME_LENGTH = 1000; // Much more generous than npm's 214
|
|
16
|
+
static MIN_TOOL_NAME_LENGTH = 1;
|
|
17
|
+
/**
|
|
18
|
+
* Validate tool name with universal safety checks only
|
|
19
|
+
*
|
|
20
|
+
* This method only blocks truly dangerous cases:
|
|
21
|
+
* 1. Empty or whitespace-only names
|
|
22
|
+
* 2. Control characters that could break systems
|
|
23
|
+
* 3. Excessively long names that could cause memory issues
|
|
24
|
+
*
|
|
25
|
+
* Everything else is allowed to support maximum MCP tool compatibility.
|
|
26
|
+
*/
|
|
27
|
+
static validateToolName(toolId) {
|
|
28
|
+
const warnings = [];
|
|
29
|
+
// Safety Check 1: Empty or whitespace-only names
|
|
30
|
+
if (!toolId || typeof toolId !== "string") {
|
|
31
|
+
return {
|
|
32
|
+
isValid: false,
|
|
33
|
+
error: "Tool name is required and must be a string",
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
// Safety Check 2: Control characters that could break systems (check BEFORE trimming!)
|
|
37
|
+
// Only block truly dangerous control characters, not printable characters
|
|
38
|
+
//
|
|
39
|
+
// This regex blocks dangerous C0 control characters and DEL:
|
|
40
|
+
// - \x00-\x08: NULL, SOH, STX, ETX, EOT, ENQ, ACK, BEL, BS
|
|
41
|
+
// - \x0B: Vertical Tab (VT)
|
|
42
|
+
// - \x0C: Form Feed (FF)
|
|
43
|
+
// - \x0E-\x1F: SO, SI, DLE, DC1-4, NAK, SYN, ETB, CAN, EM, SUB, ESC, FS-US
|
|
44
|
+
// - \x7F: DEL
|
|
45
|
+
//
|
|
46
|
+
// Explicitly ALLOWS these printable control characters:
|
|
47
|
+
// - \x09: TAB (horizontal tab) - commonly used in text
|
|
48
|
+
// - \x0A: LF (line feed) - commonly used in text
|
|
49
|
+
// - \x0D: CR (carriage return) - commonly used in text
|
|
50
|
+
// eslint-disable-next-line no-control-regex
|
|
51
|
+
const hasControlCharacters = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/.test(toolId);
|
|
52
|
+
if (hasControlCharacters) {
|
|
53
|
+
return {
|
|
54
|
+
isValid: false,
|
|
55
|
+
error: "Tool name contains control characters that could break systems",
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const trimmedName = toolId.trim();
|
|
59
|
+
if (trimmedName.length === 0) {
|
|
60
|
+
return {
|
|
61
|
+
isValid: false,
|
|
62
|
+
error: "Tool name cannot be empty or whitespace-only",
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
// Safety Check 3: Length limits (very generous)
|
|
66
|
+
if (trimmedName.length < this.MIN_TOOL_NAME_LENGTH) {
|
|
67
|
+
return {
|
|
68
|
+
isValid: false,
|
|
69
|
+
error: `Tool name must be at least ${this.MIN_TOOL_NAME_LENGTH} character long`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (trimmedName.length > this.MAX_TOOL_NAME_LENGTH) {
|
|
73
|
+
return {
|
|
74
|
+
isValid: false,
|
|
75
|
+
error: `Tool name exceeds maximum length of ${this.MAX_TOOL_NAME_LENGTH} characters`,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// Optional warnings for unusual but not dangerous patterns
|
|
79
|
+
if (trimmedName !== toolId) {
|
|
80
|
+
warnings.push("Tool name has leading/trailing whitespace (will be trimmed)");
|
|
81
|
+
}
|
|
82
|
+
if (trimmedName.length > 200) {
|
|
83
|
+
warnings.push("Tool name is unusually long but allowed");
|
|
84
|
+
}
|
|
85
|
+
registryLogger.debug(`✅ FlexibleToolValidator: Tool '${toolId}' passed universal safety checks`);
|
|
86
|
+
return {
|
|
87
|
+
isValid: true,
|
|
88
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Validate tool information with minimal safety checks
|
|
93
|
+
*/
|
|
94
|
+
static validateToolInfo(toolId, toolInfo) {
|
|
95
|
+
// First validate the tool name
|
|
96
|
+
const nameValidation = this.validateToolName(toolId);
|
|
97
|
+
if (!nameValidation.isValid) {
|
|
98
|
+
return nameValidation;
|
|
99
|
+
}
|
|
100
|
+
const warnings = [...(nameValidation.warnings || [])];
|
|
101
|
+
// Minimal safety checks for tool info
|
|
102
|
+
if (toolInfo.description && typeof toolInfo.description !== "string") {
|
|
103
|
+
return {
|
|
104
|
+
isValid: false,
|
|
105
|
+
error: "Tool description must be a string if provided",
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
if (toolInfo.serverId && typeof toolInfo.serverId !== "string") {
|
|
109
|
+
return {
|
|
110
|
+
isValid: false,
|
|
111
|
+
error: "Tool serverId must be a string if provided",
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
registryLogger.debug(`✅ FlexibleToolValidator: Tool info for '${toolId}' passed validation`);
|
|
115
|
+
return {
|
|
116
|
+
isValid: true,
|
|
117
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Get information about what this validator checks
|
|
122
|
+
*/
|
|
123
|
+
static getValidationInfo() {
|
|
124
|
+
return {
|
|
125
|
+
philosophy: "Maximum flexibility with universal safety only - following Anthropic's MCP specification",
|
|
126
|
+
checks: [
|
|
127
|
+
"Empty or whitespace-only names",
|
|
128
|
+
"Excessive length (over 1000 characters)",
|
|
129
|
+
"Control characters that could break systems",
|
|
130
|
+
],
|
|
131
|
+
whatIsAllowed: [
|
|
132
|
+
"Dots (github.create_repo, filesystem.read_file)",
|
|
133
|
+
"Hyphens and underscores (my-tool, user_helper)",
|
|
134
|
+
"Numbers (tool1, my_tool_v2)",
|
|
135
|
+
"Unicode characters (🚀_tool, café_manager)",
|
|
136
|
+
"Mixed case (createRepo, ReadFile)",
|
|
137
|
+
"Long descriptive names (enterprise_database_connection_manager)",
|
|
138
|
+
"Any legitimate MCP tool naming pattern",
|
|
139
|
+
],
|
|
140
|
+
examples: {
|
|
141
|
+
valid: [
|
|
142
|
+
"github.create_repo",
|
|
143
|
+
"filesystem.read_file",
|
|
144
|
+
"my-custom-tool",
|
|
145
|
+
"user_helper",
|
|
146
|
+
"tool1",
|
|
147
|
+
"🚀_rocket_tool",
|
|
148
|
+
"enterprise.database.connection.manager",
|
|
149
|
+
"UPPERCASE_TOOL",
|
|
150
|
+
"mixed_Case.Tool-Name_123",
|
|
151
|
+
],
|
|
152
|
+
invalid: [
|
|
153
|
+
"", // Empty
|
|
154
|
+
" ", // Whitespace only
|
|
155
|
+
"tool\x00", // Control character
|
|
156
|
+
"a".repeat(1001), // Too long
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}
|
package/dist/lib/mcp/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare function listMCPs(): Promise<McpMetadata[]>;
|
|
|
18
18
|
/**
|
|
19
19
|
* Execute an MCP operation - simplified
|
|
20
20
|
*/
|
|
21
|
-
export declare function executeMCP<T = unknown>(
|
|
21
|
+
export declare function executeMCP<T = unknown>(_name: string, _config: unknown, _args: unknown, _context?: {
|
|
22
22
|
sessionId?: string;
|
|
23
23
|
userId?: string;
|
|
24
24
|
}): Promise<T>;
|
package/dist/lib/mcp/index.js
CHANGED
|
@@ -21,7 +21,7 @@ export async function listMCPs() {
|
|
|
21
21
|
/**
|
|
22
22
|
* Execute an MCP operation - simplified
|
|
23
23
|
*/
|
|
24
|
-
export async function executeMCP(
|
|
24
|
+
export async function executeMCP(_name, _config, _args, _context) {
|
|
25
25
|
throw new Error("MCP execution not available - ecosystem removed");
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
@@ -285,7 +285,11 @@ export class CircuitBreakerManager {
|
|
|
285
285
|
this.breakers.set(name, breaker);
|
|
286
286
|
mcpLogger.debug(`[CircuitBreakerManager] Created circuit breaker: ${name}`);
|
|
287
287
|
}
|
|
288
|
-
|
|
288
|
+
const breaker = this.breakers.get(name);
|
|
289
|
+
if (!breaker) {
|
|
290
|
+
throw new Error(`Circuit breaker ${name} not found after creation`);
|
|
291
|
+
}
|
|
292
|
+
return breaker;
|
|
289
293
|
}
|
|
290
294
|
/**
|
|
291
295
|
* Remove a circuit breaker and clean up its resources
|
|
@@ -192,6 +192,9 @@ export class MCPClientFactory {
|
|
|
192
192
|
throw new Error("Process failed to start or exited immediately");
|
|
193
193
|
}
|
|
194
194
|
// Create transport
|
|
195
|
+
if (!config.command) {
|
|
196
|
+
throw new Error(`Command is required for stdio transport`);
|
|
197
|
+
}
|
|
195
198
|
const transport = new StdioClientTransport({
|
|
196
199
|
command: config.command,
|
|
197
200
|
args: config.args || [],
|
|
@@ -44,15 +44,15 @@ export declare class MCPRegistry implements McpRegistry {
|
|
|
44
44
|
/**
|
|
45
45
|
* Register a server (compatible with new interface)
|
|
46
46
|
*/
|
|
47
|
-
registerServer(serverId: string, serverConfig?: unknown,
|
|
47
|
+
registerServer(serverId: string, serverConfig?: unknown, _context?: ExecutionContext): Promise<void>;
|
|
48
48
|
/**
|
|
49
49
|
* Execute a tool (mock implementation for tests)
|
|
50
50
|
*/
|
|
51
|
-
executeTool<T = unknown>(toolName: string, args?: unknown,
|
|
51
|
+
executeTool<T = unknown>(toolName: string, args?: unknown, _context?: ExecutionContext): Promise<T>;
|
|
52
52
|
/**
|
|
53
53
|
* List all tools (compatible with new interface)
|
|
54
54
|
*/
|
|
55
|
-
listTools(
|
|
55
|
+
listTools(_context?: ExecutionContext): Promise<ToolInfo[]>;
|
|
56
56
|
/**
|
|
57
57
|
* Register a server (legacy sync version)
|
|
58
58
|
*/
|