@juspay/neurolink 7.33.0 → 7.33.2

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.
Files changed (155) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/agent/directTools.d.ts +6 -6
  3. package/dist/cli/commands/config.d.ts +68 -68
  4. package/dist/cli/utils/interactiveSetup.d.ts +1 -1
  5. package/dist/cli/utils/interactiveSetup.js +1 -1
  6. package/dist/core/analytics.d.ts +1 -2
  7. package/dist/core/baseProvider.d.ts +1 -1
  8. package/dist/core/baseProvider.js +1 -0
  9. package/dist/core/dynamicModels.d.ts +1 -132
  10. package/dist/core/dynamicModels.js +0 -7
  11. package/dist/core/evaluation.d.ts +1 -39
  12. package/dist/core/evaluationProviders.d.ts +1 -17
  13. package/dist/core/evaluationProviders.js +1 -1
  14. package/dist/core/factory.d.ts +1 -3
  15. package/dist/core/factory.js +0 -1
  16. package/dist/core/modelConfiguration.d.ts +8 -69
  17. package/dist/core/modelConfiguration.js +11 -11
  18. package/dist/core/serviceRegistry.d.ts +1 -8
  19. package/dist/core/streamAnalytics.d.ts +2 -45
  20. package/dist/factories/providerFactory.d.ts +1 -1
  21. package/dist/factories/providerRegistry.js +1 -1
  22. package/dist/index.d.ts +8 -9
  23. package/dist/index.js +1 -1
  24. package/dist/lib/core/analytics.d.ts +1 -2
  25. package/dist/lib/core/baseProvider.d.ts +1 -1
  26. package/dist/lib/core/baseProvider.js +1 -0
  27. package/dist/lib/core/dynamicModels.d.ts +1 -132
  28. package/dist/lib/core/dynamicModels.js +0 -7
  29. package/dist/lib/core/evaluation.d.ts +1 -39
  30. package/dist/lib/core/evaluationProviders.d.ts +1 -17
  31. package/dist/lib/core/evaluationProviders.js +1 -1
  32. package/dist/lib/core/factory.d.ts +1 -3
  33. package/dist/lib/core/factory.js +0 -1
  34. package/dist/lib/core/modelConfiguration.d.ts +8 -69
  35. package/dist/lib/core/modelConfiguration.js +11 -11
  36. package/dist/lib/core/serviceRegistry.d.ts +1 -8
  37. package/dist/lib/core/streamAnalytics.d.ts +2 -45
  38. package/dist/lib/factories/providerFactory.d.ts +1 -1
  39. package/dist/lib/factories/providerRegistry.js +1 -1
  40. package/dist/lib/index.d.ts +5 -6
  41. package/dist/lib/index.js +1 -1
  42. package/dist/lib/mcp/externalServerManager.d.ts +18 -3
  43. package/dist/lib/mcp/externalServerManager.js +125 -3
  44. package/dist/lib/models/modelRegistry.d.ts +1 -1
  45. package/dist/lib/models/modelRegistry.js +1 -1
  46. package/dist/lib/models/modelResolver.d.ts +1 -1
  47. package/dist/lib/neurolink.d.ts +2 -2
  48. package/dist/lib/neurolink.js +4 -3
  49. package/dist/lib/providers/amazonBedrock.d.ts +1 -2
  50. package/dist/lib/providers/amazonSagemaker.d.ts +1 -1
  51. package/dist/lib/providers/anthropic.d.ts +1 -1
  52. package/dist/lib/providers/anthropic.js +1 -1
  53. package/dist/lib/providers/anthropicBaseProvider.d.ts +1 -1
  54. package/dist/lib/providers/anthropicBaseProvider.js +1 -1
  55. package/dist/lib/providers/azureOpenai.d.ts +1 -1
  56. package/dist/lib/providers/googleAiStudio.d.ts +1 -1
  57. package/dist/lib/providers/googleAiStudio.js +1 -1
  58. package/dist/lib/providers/googleVertex.d.ts +1 -1
  59. package/dist/lib/providers/googleVertex.js +1 -1
  60. package/dist/lib/providers/huggingFace.d.ts +1 -1
  61. package/dist/lib/providers/index.d.ts +1 -1
  62. package/dist/lib/providers/litellm.d.ts +1 -1
  63. package/dist/lib/providers/mistral.d.ts +1 -1
  64. package/dist/lib/providers/ollama.d.ts +1 -1
  65. package/dist/lib/providers/ollama.js +1 -1
  66. package/dist/lib/providers/openAI.d.ts +1 -1
  67. package/dist/lib/providers/openAI.js +1 -1
  68. package/dist/lib/providers/openaiCompatible.d.ts +1 -1
  69. package/dist/lib/providers/sagemaker/language-model.d.ts +2 -2
  70. package/dist/lib/types/analytics.d.ts +53 -0
  71. package/dist/lib/types/analytics.js +5 -0
  72. package/dist/lib/types/cli.d.ts +1 -1
  73. package/dist/lib/types/evaluation.d.ts +119 -0
  74. package/dist/lib/types/evaluation.js +5 -0
  75. package/dist/lib/types/evaluationProviders.d.ts +104 -0
  76. package/dist/lib/types/evaluationProviders.js +5 -0
  77. package/dist/lib/types/generateTypes.d.ts +89 -18
  78. package/dist/lib/types/index.d.ts +10 -2
  79. package/dist/lib/types/index.js +12 -0
  80. package/dist/lib/types/modelTypes.d.ts +242 -0
  81. package/dist/lib/types/modelTypes.js +30 -0
  82. package/dist/lib/types/providers.d.ts +193 -127
  83. package/dist/lib/types/providers.js +110 -18
  84. package/dist/lib/types/serviceTypes.d.ts +79 -0
  85. package/dist/lib/types/serviceTypes.js +5 -0
  86. package/dist/lib/types/streamTypes.d.ts +101 -21
  87. package/dist/lib/utils/analyticsUtils.d.ts +5 -1
  88. package/dist/lib/utils/analyticsUtils.js +13 -0
  89. package/dist/lib/utils/conversationMemoryUtils.d.ts +1 -1
  90. package/dist/lib/utils/evaluationUtils.d.ts +1 -1
  91. package/dist/lib/utils/factoryProcessing.d.ts +1 -1
  92. package/dist/lib/utils/messageBuilder.d.ts +1 -1
  93. package/dist/lib/utils/providerHealth.d.ts +1 -1
  94. package/dist/lib/utils/providerHealth.js +1 -1
  95. package/dist/lib/utils/providerUtils.d.ts +5 -0
  96. package/dist/lib/utils/providerUtils.js +6 -0
  97. package/dist/mcp/externalServerManager.d.ts +18 -3
  98. package/dist/mcp/externalServerManager.js +125 -3
  99. package/dist/models/modelRegistry.d.ts +1 -1
  100. package/dist/models/modelRegistry.js +1 -1
  101. package/dist/models/modelResolver.d.ts +1 -1
  102. package/dist/neurolink.d.ts +2 -2
  103. package/dist/neurolink.js +4 -3
  104. package/dist/providers/amazonBedrock.d.ts +1 -2
  105. package/dist/providers/amazonSagemaker.d.ts +1 -1
  106. package/dist/providers/anthropic.d.ts +1 -1
  107. package/dist/providers/anthropic.js +1 -1
  108. package/dist/providers/anthropicBaseProvider.d.ts +1 -1
  109. package/dist/providers/anthropicBaseProvider.js +1 -1
  110. package/dist/providers/azureOpenai.d.ts +1 -1
  111. package/dist/providers/googleAiStudio.d.ts +1 -1
  112. package/dist/providers/googleAiStudio.js +1 -1
  113. package/dist/providers/googleVertex.d.ts +1 -1
  114. package/dist/providers/googleVertex.js +1 -1
  115. package/dist/providers/huggingFace.d.ts +1 -1
  116. package/dist/providers/index.d.ts +1 -1
  117. package/dist/providers/litellm.d.ts +1 -1
  118. package/dist/providers/mistral.d.ts +1 -1
  119. package/dist/providers/ollama.d.ts +1 -1
  120. package/dist/providers/ollama.js +1 -1
  121. package/dist/providers/openAI.d.ts +1 -1
  122. package/dist/providers/openAI.js +1 -1
  123. package/dist/providers/openaiCompatible.d.ts +1 -1
  124. package/dist/types/analytics.d.ts +53 -0
  125. package/dist/types/analytics.js +5 -0
  126. package/dist/types/cli.d.ts +1 -1
  127. package/dist/types/evaluation.d.ts +119 -0
  128. package/dist/types/evaluation.js +5 -0
  129. package/dist/types/evaluationProviders.d.ts +104 -0
  130. package/dist/types/evaluationProviders.js +5 -0
  131. package/dist/types/generateTypes.d.ts +89 -18
  132. package/dist/types/index.d.ts +10 -2
  133. package/dist/types/index.js +12 -0
  134. package/dist/types/modelTypes.d.ts +242 -0
  135. package/dist/types/modelTypes.js +30 -0
  136. package/dist/types/providers.d.ts +193 -127
  137. package/dist/types/providers.js +110 -18
  138. package/dist/types/serviceTypes.d.ts +79 -0
  139. package/dist/types/serviceTypes.js +5 -0
  140. package/dist/types/streamTypes.d.ts +101 -21
  141. package/dist/utils/analyticsUtils.d.ts +5 -1
  142. package/dist/utils/analyticsUtils.js +13 -0
  143. package/dist/utils/conversationMemoryUtils.d.ts +1 -1
  144. package/dist/utils/evaluationUtils.d.ts +1 -1
  145. package/dist/utils/factoryProcessing.d.ts +1 -1
  146. package/dist/utils/messageBuilder.d.ts +1 -1
  147. package/dist/utils/providerHealth.d.ts +1 -1
  148. package/dist/utils/providerHealth.js +1 -1
  149. package/dist/utils/providerUtils.d.ts +5 -0
  150. package/dist/utils/providerUtils.js +6 -0
  151. package/package.json +1 -1
  152. package/dist/core/types.d.ts +0 -223
  153. package/dist/core/types.js +0 -111
  154. package/dist/lib/core/types.d.ts +0 -223
  155. package/dist/lib/core/types.js +0 -111
@@ -2,45 +2,115 @@
2
2
  * Provider-specific type definitions for NeuroLink
3
3
  */
4
4
  import type { UnknownRecord, JsonValue } from "./common.js";
5
+ import type { Tool } from "ai";
6
+ import type { ValidationSchema } from "./typeAliases.js";
7
+ import type { EnhancedGenerateResult, GenerateResult, TextGenerationOptions } from "./generateTypes.js";
8
+ import type { StreamOptions, StreamResult } from "./streamTypes.js";
9
+ import type { ExternalMCPToolInfo } from "./externalMcp.js";
5
10
  /**
6
11
  * Generic AI SDK model interface
7
12
  */
8
- export interface AISDKModel {
13
+ export type AISDKModel = {
9
14
  [key: string]: unknown;
15
+ };
16
+ /**
17
+ * Supported AI Provider Names
18
+ */
19
+ export declare enum AIProviderName {
20
+ BEDROCK = "bedrock",
21
+ OPENAI = "openai",
22
+ OPENAI_COMPATIBLE = "openai-compatible",
23
+ VERTEX = "vertex",
24
+ ANTHROPIC = "anthropic",
25
+ AZURE = "azure",
26
+ GOOGLE_AI = "google-ai",
27
+ HUGGINGFACE = "huggingface",
28
+ OLLAMA = "ollama",
29
+ MISTRAL = "mistral",
30
+ LITELLM = "litellm",
31
+ SAGEMAKER = "sagemaker",
32
+ AUTO = "auto"
10
33
  }
11
34
  /**
12
- * Provider error information
35
+ * Supported Models for Amazon Bedrock
13
36
  */
14
- export interface ProviderError extends Error {
15
- code?: string | number;
16
- statusCode?: number;
17
- provider?: string;
18
- originalError?: unknown;
37
+ export declare enum BedrockModels {
38
+ CLAUDE_3_SONNET = "anthropic.claude-3-sonnet-20240229-v1:0",
39
+ CLAUDE_3_HAIKU = "anthropic.claude-3-haiku-20240307-v1:0",
40
+ CLAUDE_3_5_SONNET = "anthropic.claude-3-5-sonnet-20240620-v1:0",
41
+ CLAUDE_3_7_SONNET = "arn:aws:bedrock:us-east-2:225681119357:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0"
19
42
  }
20
43
  /**
21
- * Token usage information
44
+ * Supported Models for OpenAI
22
45
  */
23
- export interface TokenUsage {
24
- input: number;
25
- output: number;
26
- total: number;
46
+ export declare enum OpenAIModels {
47
+ GPT_4 = "gpt-4",
48
+ GPT_4_TURBO = "gpt-4-turbo",
49
+ GPT_4O = "gpt-4o",
50
+ GPT_4O_MINI = "gpt-4o-mini",
51
+ GPT_3_5_TURBO = "gpt-3.5-turbo"
27
52
  }
28
53
  /**
29
- * Analytics data structure
54
+ * Supported Models for Google Vertex AI
30
55
  */
31
- export interface AnalyticsData {
32
- provider: string;
33
- model?: string;
34
- tokenUsage: TokenUsage;
35
- requestDuration: number;
36
- timestamp: string;
37
- cost?: number;
38
- context?: JsonValue;
56
+ export declare enum VertexModels {
57
+ CLAUDE_4_0_SONNET = "claude-sonnet-4@20250514",
58
+ CLAUDE_4_0_OPUS = "claude-opus-4@20250514",
59
+ CLAUDE_3_5_SONNET = "claude-3-5-sonnet-20241022",
60
+ CLAUDE_3_5_HAIKU = "claude-3-5-haiku-20241022",
61
+ CLAUDE_3_SONNET = "claude-3-sonnet-20240229",
62
+ CLAUDE_3_OPUS = "claude-3-opus-20240229",
63
+ CLAUDE_3_HAIKU = "claude-3-haiku-20240307",
64
+ GEMINI_2_5_PRO = "gemini-2.5-pro",
65
+ GEMINI_2_5_FLASH = "gemini-2.5-flash",
66
+ GEMINI_2_5_FLASH_LITE = "gemini-2.5-flash-lite",
67
+ GEMINI_2_0_FLASH_001 = "gemini-2.0-flash-001",
68
+ GEMINI_1_5_PRO = "gemini-1.5-pro",
69
+ GEMINI_1_5_FLASH = "gemini-1.5-flash"
39
70
  }
71
+ /**
72
+ * Supported Models for Google AI Studio
73
+ */
74
+ export declare enum GoogleAIModels {
75
+ GEMINI_2_5_PRO = "gemini-2.5-pro",
76
+ GEMINI_2_5_FLASH = "gemini-2.5-flash",
77
+ GEMINI_2_5_FLASH_LITE = "gemini-2.5-flash-lite",
78
+ GEMINI_2_0_FLASH_001 = "gemini-2.0-flash-001",
79
+ GEMINI_1_5_PRO = "gemini-1.5-pro",
80
+ GEMINI_1_5_FLASH = "gemini-1.5-flash",
81
+ GEMINI_1_5_FLASH_LITE = "gemini-1.5-flash-lite"
82
+ }
83
+ /**
84
+ * Supported Models for Anthropic (Direct API)
85
+ */
86
+ export declare enum AnthropicModels {
87
+ CLAUDE_3_5_SONNET = "claude-3-5-sonnet-20241022",
88
+ CLAUDE_3_5_HAIKU = "claude-3-5-haiku-20241022",
89
+ CLAUDE_3_SONNET = "claude-3-sonnet-20240229",
90
+ CLAUDE_3_OPUS = "claude-3-opus-20240229",
91
+ CLAUDE_3_HAIKU = "claude-3-haiku-20240307"
92
+ }
93
+ /**
94
+ * Union type of all supported model names
95
+ */
96
+ export type SupportedModelName = BedrockModels | OpenAIModels | VertexModels | GoogleAIModels | AnthropicModels;
97
+ /**
98
+ * Extract provider names from enum
99
+ */
100
+ export type ProviderName = keyof typeof AIProviderName;
101
+ /**
102
+ * Provider error information
103
+ */
104
+ export type ProviderError = Error & {
105
+ code?: string | number;
106
+ statusCode?: number;
107
+ provider?: string;
108
+ originalError?: unknown;
109
+ };
40
110
  /**
41
111
  * AWS Credential Configuration for Bedrock provider
42
112
  */
43
- export interface AWSCredentialConfig {
113
+ export type AWSCredentialConfig = {
44
114
  region?: string;
45
115
  profile?: string;
46
116
  roleArn?: string;
@@ -53,11 +123,11 @@ export interface AWSCredentialConfig {
53
123
  enableDebugLogging?: boolean;
54
124
  /** Optional service endpoint override (e.g., VPC/Gov endpoints) */
55
125
  endpoint?: string;
56
- }
126
+ };
57
127
  /**
58
128
  * AWS Credential Validation Result
59
129
  */
60
- export interface CredentialValidationResult {
130
+ export type CredentialValidationResult = {
61
131
  isValid: boolean;
62
132
  credentialSource: string;
63
133
  region: string;
@@ -69,17 +139,17 @@ export interface CredentialValidationResult {
69
139
  hasSessionToken: boolean;
70
140
  providerConfig: Readonly<Required<AWSCredentialConfig>>;
71
141
  };
72
- }
142
+ };
73
143
  /**
74
144
  * Service Connectivity Test Result
75
145
  */
76
- export interface ServiceConnectivityResult {
146
+ export type ServiceConnectivityResult = {
77
147
  bedrockAccessible: boolean;
78
148
  availableModels: number;
79
149
  responseTimeMs: number;
80
150
  error?: string;
81
151
  sampleModels: string[];
82
- }
152
+ };
83
153
  /**
84
154
  * Model Capabilities - Maximally Reusable
85
155
  */
@@ -88,10 +158,18 @@ export type ModelCapability = "text" | "vision" | "function-calling" | "embeddin
88
158
  * Model Use Cases - High Reusability
89
159
  */
90
160
  export type ModelUseCase = "chat" | "completion" | "analysis" | "coding" | "creative" | "reasoning" | "translation" | "summarization" | "classification";
161
+ /**
162
+ * Provider health status
163
+ */
164
+ export type ProviderHealthStatus = "healthy" | "degraded" | "unhealthy" | "unknown";
165
+ /**
166
+ * Stream processing phases
167
+ */
168
+ export type StreamPhase = "initializing" | "streaming" | "processing" | "complete" | "error";
91
169
  /**
92
170
  * Model Filter Configuration - High Reusability
93
171
  */
94
- export interface ModelFilter {
172
+ export type ModelFilter = {
95
173
  provider?: string;
96
174
  capability?: ModelCapability;
97
175
  useCase?: ModelUseCase;
@@ -99,11 +177,11 @@ export interface ModelFilter {
99
177
  requireFunctionCalling?: boolean;
100
178
  maxTokens?: number;
101
179
  costLimit?: number;
102
- }
180
+ };
103
181
  /**
104
182
  * Model Resolution Context - High Reusability
105
183
  */
106
- export interface ModelResolutionContext {
184
+ export type ModelResolutionContext = {
107
185
  requireCapabilities?: ModelCapability[];
108
186
  preferredProviders?: string[];
109
187
  useCase?: ModelUseCase;
@@ -115,11 +193,11 @@ export interface ModelResolutionContext {
115
193
  maxLatency?: number;
116
194
  minQuality?: number;
117
195
  };
118
- }
196
+ };
119
197
  /**
120
198
  * Model Statistics Object - High Reusability
121
199
  */
122
- export interface ModelStats {
200
+ export type ModelStats = {
123
201
  name: string;
124
202
  provider: string;
125
203
  capabilities: ModelCapability[];
@@ -136,11 +214,11 @@ export interface ModelStats {
136
214
  version?: string;
137
215
  lastUpdated?: Date;
138
216
  };
139
- }
217
+ };
140
218
  /**
141
219
  * Model Pricing Information - High Reusability
142
220
  */
143
- export interface ModelPricing {
221
+ export type ModelPricing = {
144
222
  inputTokens?: {
145
223
  price: number;
146
224
  currency: string;
@@ -160,107 +238,67 @@ export interface ModelPricing {
160
238
  min?: number;
161
239
  max?: number;
162
240
  free?: boolean;
163
- }
164
- /**
165
- * Response quality evaluation scores - Comprehensive evaluation interface
166
- */
167
- export interface EvaluationData {
168
- relevance: number;
169
- accuracy: number;
170
- completeness: number;
171
- overall: number;
172
- domainAlignment?: number;
173
- terminologyAccuracy?: number;
174
- toolEffectiveness?: number;
175
- isOffTopic: boolean;
176
- alertSeverity: "low" | "medium" | "high" | "none";
177
- reasoning: string;
178
- suggestedImprovements?: string;
179
- evaluationModel: string;
180
- evaluationTime: number;
181
- evaluationDomain?: string;
182
- evaluationProvider?: string;
183
- evaluationAttempt?: number;
184
- evaluationConfig?: {
185
- mode: string;
186
- fallbackUsed: boolean;
187
- costEstimate: number;
188
- };
189
- domainConfig?: {
190
- domainName: string;
191
- domainDescription: string;
192
- keyTerms: string[];
193
- failurePatterns: string[];
194
- successPatterns: string[];
195
- evaluationCriteria?: Record<string, unknown>;
196
- };
197
- domainEvaluation?: {
198
- domainRelevance: number;
199
- terminologyAccuracy: number;
200
- domainExpertise: number;
201
- domainSpecificInsights: string[];
202
- };
203
- }
204
- /**
205
- * Enhanced evaluation context for comprehensive response assessment
206
- */
207
- export interface EvaluationContext {
208
- userQuery: string;
209
- aiResponse: string;
210
- context?: Record<string, unknown>;
211
- primaryDomain?: string;
212
- assistantRole?: string;
213
- conversationHistory?: Array<{
214
- role: "user" | "assistant";
215
- content: string;
216
- timestamp?: string;
217
- }>;
218
- toolUsage?: Array<{
219
- toolName: string;
220
- input: unknown;
221
- output: unknown;
222
- executionTime: number;
223
- }>;
224
- expectedOutcome?: string;
225
- evaluationCriteria?: string[];
226
- }
227
- /**
228
- * Evaluation result interface that extends EvaluationData with additional context
229
- */
230
- export interface EvaluationResult extends EvaluationData {
231
- contextUtilization?: {
232
- conversationUsed: boolean;
233
- toolsUsed: boolean;
234
- domainKnowledgeUsed: boolean;
235
- };
236
- evaluationContext?: {
237
- domain: string;
238
- toolsEvaluated: string[];
239
- conversationTurns: number;
240
- };
241
- }
241
+ };
242
242
  /**
243
243
  * Provider capabilities
244
244
  */
245
- export interface ProviderCapabilities {
245
+ export type ProviderCapabilities = {
246
246
  supportsStreaming: boolean;
247
247
  supportsTools: boolean;
248
248
  supportsImages: boolean;
249
249
  supportsAudio: boolean;
250
250
  maxTokens?: number;
251
251
  supportedModels: string[];
252
- }
252
+ };
253
253
  /**
254
- * Provider configuration
254
+ * Provider configuration specifying provider and its available models (from core types)
255
255
  */
256
- export interface ProviderConfig {
256
+ export type ProviderConfig = {
257
+ provider: AIProviderName;
258
+ models: SupportedModelName[];
259
+ };
260
+ /**
261
+ * Provider configuration for individual providers
262
+ */
263
+ export type IndividualProviderConfig = {
257
264
  apiKey?: string;
258
265
  baseURL?: string;
259
266
  timeout?: number;
260
267
  retries?: number;
261
268
  model?: string;
262
269
  [key: string]: unknown;
263
- }
270
+ };
271
+ /**
272
+ * AI Provider interface with flexible parameter support (converted from interface)
273
+ */
274
+ export type AIProvider = {
275
+ stream(optionsOrPrompt: StreamOptions | string, analysisSchema?: ValidationSchema): Promise<StreamResult>;
276
+ generate(optionsOrPrompt: TextGenerationOptions | string, analysisSchema?: ValidationSchema): Promise<EnhancedGenerateResult | null>;
277
+ gen(optionsOrPrompt: TextGenerationOptions | string, analysisSchema?: ValidationSchema): Promise<EnhancedGenerateResult | null>;
278
+ setupToolExecutor(sdk: {
279
+ customTools: Map<string, unknown>;
280
+ executeTool: (toolName: string, params: unknown) => Promise<unknown>;
281
+ }, functionTag: string): void;
282
+ };
283
+ /**
284
+ * Provider attempt result for iteration tracking (converted from interface)
285
+ */
286
+ export type ProviderAttempt = {
287
+ provider: AIProviderName;
288
+ model: SupportedModelName;
289
+ success: boolean;
290
+ error?: string;
291
+ stack?: string;
292
+ };
293
+ /**
294
+ * Error types for provider creation
295
+ */
296
+ export type ProviderCreationError = {
297
+ code: "INVALID_PROVIDER" | "CONFIGURATION_ERROR" | "INSTANTIATION_ERROR";
298
+ message: string;
299
+ provider: string;
300
+ details?: Record<string, unknown>;
301
+ };
264
302
  /**
265
303
  * Amazon Bedrock specific types
266
304
  */
@@ -321,23 +359,51 @@ export type ProviderFactory = (modelName?: string, providerName?: string, sdk?:
321
359
  /**
322
360
  * Provider constructor type
323
361
  */
324
- export interface ProviderConstructor {
362
+ export type ProviderConstructor = {
325
363
  new (modelName?: string, providerName?: string, sdk?: unknown): unknown;
326
- }
364
+ };
327
365
  /**
328
366
  * Provider registration entry
329
367
  */
330
- export interface ProviderRegistration {
368
+ export type ProviderRegistration = {
331
369
  name: string;
332
370
  constructor: ProviderConstructor | ProviderFactory;
333
371
  capabilities?: ProviderCapabilities;
334
- defaultConfig?: ProviderConfig;
335
- }
372
+ defaultConfig?: IndividualProviderConfig;
373
+ };
336
374
  /**
337
- * Type guard for provider error
375
+ * Provider metadata type
338
376
  */
339
- export declare function isProviderError(error: unknown): error is ProviderError;
377
+ export type ProviderMetadata = {
378
+ name: string;
379
+ version: string;
380
+ capabilities: ProviderCapability[];
381
+ models: string[];
382
+ healthStatus: ProviderHealthStatus;
383
+ };
384
+ /**
385
+ * Provider capability type
386
+ */
387
+ export type ProviderCapability = "text-generation" | "streaming" | "tool-calling" | "image-generation" | "embeddings";
388
+ /**
389
+ * Extended tool type that combines AI SDK tools with external MCP tool info
390
+ */
391
+ export type ExtendedTool = Tool & Partial<ExternalMCPToolInfo>;
392
+ /**
393
+ * AI SDK generate result with steps support (extends GenerateResult)
394
+ */
395
+ export type AISDKGenerateResult = GenerateResult & {
396
+ steps?: Array<{
397
+ toolCalls?: Array<{
398
+ toolName?: string;
399
+ name?: string;
400
+ [key: string]: unknown;
401
+ }>;
402
+ [key: string]: unknown;
403
+ }>;
404
+ [key: string]: unknown;
405
+ };
340
406
  /**
341
- * Type guard for token usage
407
+ * Default provider configurations
342
408
  */
343
- export declare function isTokenUsage(value: unknown): value is TokenUsage;
409
+ export declare const DEFAULT_PROVIDER_CONFIGS: ProviderConfig[];
@@ -2,21 +2,113 @@
2
2
  * Provider-specific type definitions for NeuroLink
3
3
  */
4
4
  /**
5
- * Type guard for provider error
6
- */
7
- export function isProviderError(error) {
8
- return error instanceof Error && "provider" in error;
9
- }
10
- /**
11
- * Type guard for token usage
12
- */
13
- export function isTokenUsage(value) {
14
- return (typeof value === "object" &&
15
- value !== null &&
16
- "input" in value &&
17
- "output" in value &&
18
- "total" in value &&
19
- typeof value.input === "number" &&
20
- typeof value.output === "number" &&
21
- typeof value.total === "number");
22
- }
5
+ * Supported AI Provider Names
6
+ */
7
+ export var AIProviderName;
8
+ (function (AIProviderName) {
9
+ AIProviderName["BEDROCK"] = "bedrock";
10
+ AIProviderName["OPENAI"] = "openai";
11
+ AIProviderName["OPENAI_COMPATIBLE"] = "openai-compatible";
12
+ AIProviderName["VERTEX"] = "vertex";
13
+ AIProviderName["ANTHROPIC"] = "anthropic";
14
+ AIProviderName["AZURE"] = "azure";
15
+ AIProviderName["GOOGLE_AI"] = "google-ai";
16
+ AIProviderName["HUGGINGFACE"] = "huggingface";
17
+ AIProviderName["OLLAMA"] = "ollama";
18
+ AIProviderName["MISTRAL"] = "mistral";
19
+ AIProviderName["LITELLM"] = "litellm";
20
+ AIProviderName["SAGEMAKER"] = "sagemaker";
21
+ AIProviderName["AUTO"] = "auto";
22
+ })(AIProviderName || (AIProviderName = {}));
23
+ /**
24
+ * Supported Models for Amazon Bedrock
25
+ */
26
+ export var BedrockModels;
27
+ (function (BedrockModels) {
28
+ BedrockModels["CLAUDE_3_SONNET"] = "anthropic.claude-3-sonnet-20240229-v1:0";
29
+ BedrockModels["CLAUDE_3_HAIKU"] = "anthropic.claude-3-haiku-20240307-v1:0";
30
+ BedrockModels["CLAUDE_3_5_SONNET"] = "anthropic.claude-3-5-sonnet-20240620-v1:0";
31
+ BedrockModels["CLAUDE_3_7_SONNET"] = "arn:aws:bedrock:us-east-2:225681119357:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0";
32
+ })(BedrockModels || (BedrockModels = {}));
33
+ /**
34
+ * Supported Models for OpenAI
35
+ */
36
+ export var OpenAIModels;
37
+ (function (OpenAIModels) {
38
+ OpenAIModels["GPT_4"] = "gpt-4";
39
+ OpenAIModels["GPT_4_TURBO"] = "gpt-4-turbo";
40
+ OpenAIModels["GPT_4O"] = "gpt-4o";
41
+ OpenAIModels["GPT_4O_MINI"] = "gpt-4o-mini";
42
+ OpenAIModels["GPT_3_5_TURBO"] = "gpt-3.5-turbo";
43
+ })(OpenAIModels || (OpenAIModels = {}));
44
+ /**
45
+ * Supported Models for Google Vertex AI
46
+ */
47
+ export var VertexModels;
48
+ (function (VertexModels) {
49
+ // Claude 4 Series (Latest - May 2025)
50
+ VertexModels["CLAUDE_4_0_SONNET"] = "claude-sonnet-4@20250514";
51
+ VertexModels["CLAUDE_4_0_OPUS"] = "claude-opus-4@20250514";
52
+ // Claude 3.5 Series (Still supported)
53
+ VertexModels["CLAUDE_3_5_SONNET"] = "claude-3-5-sonnet-20241022";
54
+ VertexModels["CLAUDE_3_5_HAIKU"] = "claude-3-5-haiku-20241022";
55
+ // Claude 3 Series (Legacy support)
56
+ VertexModels["CLAUDE_3_SONNET"] = "claude-3-sonnet-20240229";
57
+ VertexModels["CLAUDE_3_OPUS"] = "claude-3-opus-20240229";
58
+ VertexModels["CLAUDE_3_HAIKU"] = "claude-3-haiku-20240307";
59
+ // Gemini 2.5 Series (Latest - 2025)
60
+ VertexModels["GEMINI_2_5_PRO"] = "gemini-2.5-pro";
61
+ VertexModels["GEMINI_2_5_FLASH"] = "gemini-2.5-flash";
62
+ VertexModels["GEMINI_2_5_FLASH_LITE"] = "gemini-2.5-flash-lite";
63
+ // Gemini 2.0 Series
64
+ VertexModels["GEMINI_2_0_FLASH_001"] = "gemini-2.0-flash-001";
65
+ // Gemini 1.5 Series (Legacy support)
66
+ VertexModels["GEMINI_1_5_PRO"] = "gemini-1.5-pro";
67
+ VertexModels["GEMINI_1_5_FLASH"] = "gemini-1.5-flash";
68
+ })(VertexModels || (VertexModels = {}));
69
+ /**
70
+ * Supported Models for Google AI Studio
71
+ */
72
+ export var GoogleAIModels;
73
+ (function (GoogleAIModels) {
74
+ // Gemini 2.5 Series (Latest - 2025)
75
+ GoogleAIModels["GEMINI_2_5_PRO"] = "gemini-2.5-pro";
76
+ GoogleAIModels["GEMINI_2_5_FLASH"] = "gemini-2.5-flash";
77
+ GoogleAIModels["GEMINI_2_5_FLASH_LITE"] = "gemini-2.5-flash-lite";
78
+ // Gemini 2.0 Series
79
+ GoogleAIModels["GEMINI_2_0_FLASH_001"] = "gemini-2.0-flash-001";
80
+ // Gemini 1.5 Series (Legacy support)
81
+ GoogleAIModels["GEMINI_1_5_PRO"] = "gemini-1.5-pro";
82
+ GoogleAIModels["GEMINI_1_5_FLASH"] = "gemini-1.5-flash";
83
+ GoogleAIModels["GEMINI_1_5_FLASH_LITE"] = "gemini-1.5-flash-lite";
84
+ })(GoogleAIModels || (GoogleAIModels = {}));
85
+ /**
86
+ * Supported Models for Anthropic (Direct API)
87
+ */
88
+ export var AnthropicModels;
89
+ (function (AnthropicModels) {
90
+ // Claude 3.5 Series (Latest)
91
+ AnthropicModels["CLAUDE_3_5_SONNET"] = "claude-3-5-sonnet-20241022";
92
+ AnthropicModels["CLAUDE_3_5_HAIKU"] = "claude-3-5-haiku-20241022";
93
+ // Claude 3 Series (Legacy support)
94
+ AnthropicModels["CLAUDE_3_SONNET"] = "claude-3-sonnet-20240229";
95
+ AnthropicModels["CLAUDE_3_OPUS"] = "claude-3-opus-20240229";
96
+ AnthropicModels["CLAUDE_3_HAIKU"] = "claude-3-haiku-20240307";
97
+ })(AnthropicModels || (AnthropicModels = {}));
98
+ /**
99
+ * Default provider configurations
100
+ */
101
+ export const DEFAULT_PROVIDER_CONFIGS = [
102
+ {
103
+ provider: AIProviderName.BEDROCK,
104
+ models: [BedrockModels.CLAUDE_3_7_SONNET, BedrockModels.CLAUDE_3_5_SONNET],
105
+ },
106
+ {
107
+ provider: AIProviderName.VERTEX,
108
+ models: [VertexModels.CLAUDE_4_0_SONNET, VertexModels.GEMINI_2_5_FLASH],
109
+ },
110
+ {
111
+ provider: AIProviderName.OPENAI,
112
+ models: [OpenAIModels.GPT_4O, OpenAIModels.GPT_4O_MINI],
113
+ },
114
+ ];
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Service-related type definitions for NeuroLink
3
+ * Service registry, dependency injection, and service management types
4
+ */
5
+ import type { UnknownRecord } from "./common.js";
6
+ /**
7
+ * Service factory function type
8
+ */
9
+ export type ServiceFactory<T = unknown> = () => T | Promise<T>;
10
+ /**
11
+ * Service registration configuration
12
+ */
13
+ export type ServiceRegistration<T = unknown> = {
14
+ factory: ServiceFactory<T>;
15
+ singleton: boolean;
16
+ instance?: T;
17
+ };
18
+ /**
19
+ * Service definition with metadata and status
20
+ */
21
+ export type ServiceDefinition<T = UnknownRecord> = {
22
+ name: string;
23
+ version: string;
24
+ instance: T;
25
+ metadata: ServiceMetadata;
26
+ status: ServiceStatus;
27
+ };
28
+ /**
29
+ * Service metadata for describing service capabilities
30
+ */
31
+ export type ServiceMetadata = {
32
+ description: string;
33
+ tags: string[];
34
+ dependencies: string[];
35
+ capabilities: string[];
36
+ };
37
+ /**
38
+ * Service status enumeration
39
+ */
40
+ export type ServiceStatus = "active" | "inactive" | "error" | "initializing";
41
+ /**
42
+ * Service health information
43
+ */
44
+ export type ServiceHealth = {
45
+ status: ServiceStatus;
46
+ lastChecked: Date;
47
+ uptime: number;
48
+ errorCount: number;
49
+ dependencies: ServiceDependencyHealth[];
50
+ };
51
+ /**
52
+ * Service dependency health status
53
+ */
54
+ export type ServiceDependencyHealth = {
55
+ name: string;
56
+ status: ServiceStatus;
57
+ lastChecked: Date;
58
+ responseTime?: number;
59
+ };
60
+ /**
61
+ * Service configuration options
62
+ */
63
+ export type ServiceConfigOptions = {
64
+ singleton?: boolean;
65
+ lazy?: boolean;
66
+ timeout?: number;
67
+ retries?: number;
68
+ dependencies?: string[];
69
+ };
70
+ /**
71
+ * Service registry statistics
72
+ */
73
+ export type ServiceRegistryStats = {
74
+ totalServices: number;
75
+ activeServices: number;
76
+ failedServices: number;
77
+ initializingServices: number;
78
+ circularDependencies: string[][];
79
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Service-related type definitions for NeuroLink
3
+ * Service registry, dependency injection, and service management types
4
+ */
5
+ export {};