@juspay/neurolink 7.14.1 → 7.14.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.
Files changed (101) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cli/commands/config.d.ts +66 -66
  3. package/dist/core/baseProvider.d.ts +12 -7
  4. package/dist/core/baseProvider.js +118 -125
  5. package/dist/core/constants.d.ts +5 -0
  6. package/dist/core/constants.js +6 -0
  7. package/dist/core/dynamicModels.d.ts +4 -4
  8. package/dist/core/factory.d.ts +2 -4
  9. package/dist/core/types.d.ts +8 -22
  10. package/dist/index.d.ts +19 -4
  11. package/dist/index.js +21 -0
  12. package/dist/lib/core/baseProvider.d.ts +12 -7
  13. package/dist/lib/core/baseProvider.js +118 -125
  14. package/dist/lib/core/constants.d.ts +5 -0
  15. package/dist/lib/core/constants.js +6 -0
  16. package/dist/lib/core/dynamicModels.d.ts +8 -8
  17. package/dist/lib/core/factory.d.ts +2 -4
  18. package/dist/lib/core/types.d.ts +8 -22
  19. package/dist/lib/index.d.ts +19 -4
  20. package/dist/lib/index.js +21 -0
  21. package/dist/lib/mcp/contracts/mcpContract.d.ts +6 -19
  22. package/dist/lib/mcp/externalServerManager.d.ts +2 -4
  23. package/dist/lib/mcp/externalServerManager.js +7 -8
  24. package/dist/lib/mcp/factory.d.ts +61 -7
  25. package/dist/lib/mcp/factory.js +36 -23
  26. package/dist/lib/mcp/mcpClientFactory.d.ts +2 -1
  27. package/dist/lib/mcp/mcpClientFactory.js +73 -26
  28. package/dist/lib/mcp/registry.d.ts +1 -1
  29. package/dist/lib/mcp/toolDiscoveryService.d.ts +1 -1
  30. package/dist/lib/mcp/toolDiscoveryService.js +50 -19
  31. package/dist/lib/mcp/toolRegistry.d.ts +23 -1
  32. package/dist/lib/mcp/toolRegistry.js +108 -17
  33. package/dist/lib/models/modelResolver.js +2 -1
  34. package/dist/lib/neurolink.d.ts +12 -8
  35. package/dist/lib/neurolink.js +130 -134
  36. package/dist/lib/providers/amazonBedrock.d.ts +2 -2
  37. package/dist/lib/providers/anthropic.d.ts +3 -3
  38. package/dist/lib/providers/googleAiStudio.d.ts +2 -2
  39. package/dist/lib/providers/mistral.d.ts +3 -3
  40. package/dist/lib/providers/ollama.d.ts +2 -2
  41. package/dist/lib/providers/openAI.d.ts +3 -3
  42. package/dist/lib/providers/openaiCompatible.d.ts +2 -2
  43. package/dist/lib/providers/sagemaker/client.d.ts +2 -5
  44. package/dist/lib/providers/sagemaker/language-model.d.ts +4 -6
  45. package/dist/lib/providers/sagemaker/parsers.js +5 -4
  46. package/dist/lib/sdk/toolRegistration.d.ts +6 -6
  47. package/dist/lib/sdk/toolRegistration.js +17 -56
  48. package/dist/lib/types/generateTypes.d.ts +9 -9
  49. package/dist/lib/types/streamTypes.d.ts +4 -4
  50. package/dist/lib/types/tools.d.ts +15 -7
  51. package/dist/lib/types/typeAliases.d.ts +412 -0
  52. package/dist/lib/types/typeAliases.js +48 -0
  53. package/dist/lib/utils/factoryProcessing.d.ts +2 -1
  54. package/dist/lib/utils/factoryProcessing.js +4 -3
  55. package/dist/lib/utils/parameterValidation.d.ts +97 -0
  56. package/dist/lib/utils/parameterValidation.js +452 -0
  57. package/dist/lib/utils/transformationUtils.d.ts +204 -0
  58. package/dist/lib/utils/transformationUtils.js +334 -0
  59. package/dist/lib/utils/typeUtils.d.ts +77 -0
  60. package/dist/lib/utils/typeUtils.js +97 -0
  61. package/dist/mcp/contracts/mcpContract.d.ts +6 -19
  62. package/dist/mcp/externalServerManager.d.ts +2 -4
  63. package/dist/mcp/externalServerManager.js +7 -8
  64. package/dist/mcp/factory.d.ts +61 -7
  65. package/dist/mcp/factory.js +36 -23
  66. package/dist/mcp/mcpClientFactory.d.ts +2 -1
  67. package/dist/mcp/mcpClientFactory.js +73 -26
  68. package/dist/mcp/registry.d.ts +1 -1
  69. package/dist/mcp/toolDiscoveryService.d.ts +1 -1
  70. package/dist/mcp/toolDiscoveryService.js +50 -19
  71. package/dist/mcp/toolRegistry.d.ts +23 -1
  72. package/dist/mcp/toolRegistry.js +108 -17
  73. package/dist/models/modelResolver.js +2 -1
  74. package/dist/neurolink.d.ts +12 -8
  75. package/dist/neurolink.js +130 -134
  76. package/dist/providers/amazonBedrock.d.ts +2 -2
  77. package/dist/providers/anthropic.d.ts +3 -3
  78. package/dist/providers/googleAiStudio.d.ts +2 -2
  79. package/dist/providers/mistral.d.ts +3 -3
  80. package/dist/providers/ollama.d.ts +2 -2
  81. package/dist/providers/openAI.d.ts +3 -3
  82. package/dist/providers/openaiCompatible.d.ts +2 -2
  83. package/dist/providers/sagemaker/client.d.ts +2 -5
  84. package/dist/providers/sagemaker/language-model.d.ts +4 -6
  85. package/dist/providers/sagemaker/parsers.js +5 -4
  86. package/dist/sdk/toolRegistration.d.ts +6 -6
  87. package/dist/sdk/toolRegistration.js +17 -56
  88. package/dist/types/generateTypes.d.ts +9 -9
  89. package/dist/types/streamTypes.d.ts +4 -4
  90. package/dist/types/tools.d.ts +15 -7
  91. package/dist/types/typeAliases.d.ts +412 -0
  92. package/dist/types/typeAliases.js +48 -0
  93. package/dist/utils/factoryProcessing.d.ts +2 -1
  94. package/dist/utils/factoryProcessing.js +4 -3
  95. package/dist/utils/parameterValidation.d.ts +97 -0
  96. package/dist/utils/parameterValidation.js +452 -0
  97. package/dist/utils/transformationUtils.d.ts +204 -0
  98. package/dist/utils/transformationUtils.js +334 -0
  99. package/dist/utils/typeUtils.d.ts +77 -0
  100. package/dist/utils/typeUtils.js +97 -0
  101. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [7.14.3](https://github.com/juspay/neurolink/compare/v7.14.2...v7.14.3) (2025-08-16)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **(typescript):** eliminate all TypeScript any types for improved type safety ([45043cb](https://github.com/juspay/neurolink/commit/45043cb1e671bdec07cf93ddd8005d18df2f0de0))
6
+
7
+ ## [7.14.2](https://github.com/juspay/neurolink/compare/v7.14.1...v7.14.2) (2025-08-16)
8
+
9
+ ### Bug Fixes
10
+
11
+ - **(sdk):** add generateText backward compatibility and fix formatting consistency ([93ff23c](https://github.com/juspay/neurolink/commit/93ff23c766ca71cbe7f77821b35cf5156bbe9d1f))
12
+
1
13
  ## [7.14.1](https://github.com/juspay/neurolink/compare/v7.14.0...v7.14.1) (2025-08-15)
2
14
 
3
15
  ### Bug Fixes
@@ -136,18 +136,19 @@ declare const ConfigSchema: z.ZodObject<{
136
136
  apiKey?: string | undefined;
137
137
  }>>;
138
138
  }, "strip", z.ZodTypeAny, {
139
- bedrock?: {
139
+ "google-ai"?: {
140
140
  model: string;
141
- region?: string | undefined;
142
- accessKeyId?: string | undefined;
143
- secretAccessKey?: string | undefined;
144
- sessionToken?: string | undefined;
141
+ apiKey?: string | undefined;
145
142
  } | undefined;
146
143
  openai?: {
147
144
  model: string;
148
145
  apiKey?: string | undefined;
149
146
  baseURL?: string | undefined;
150
147
  } | undefined;
148
+ anthropic?: {
149
+ model: string;
150
+ apiKey?: string | undefined;
151
+ } | undefined;
151
152
  vertex?: {
152
153
  model: string;
153
154
  location: string;
@@ -157,9 +158,12 @@ declare const ConfigSchema: z.ZodObject<{
157
158
  clientEmail?: string | undefined;
158
159
  privateKey?: string | undefined;
159
160
  } | undefined;
160
- anthropic?: {
161
+ bedrock?: {
161
162
  model: string;
162
- apiKey?: string | undefined;
163
+ region?: string | undefined;
164
+ accessKeyId?: string | undefined;
165
+ secretAccessKey?: string | undefined;
166
+ sessionToken?: string | undefined;
163
167
  } | undefined;
164
168
  azure?: {
165
169
  model: string;
@@ -167,14 +171,6 @@ declare const ConfigSchema: z.ZodObject<{
167
171
  endpoint?: string | undefined;
168
172
  deploymentId?: string | undefined;
169
173
  } | undefined;
170
- "google-ai"?: {
171
- model: string;
172
- apiKey?: string | undefined;
173
- } | undefined;
174
- huggingface?: {
175
- model: string;
176
- apiKey?: string | undefined;
177
- } | undefined;
178
174
  ollama?: {
179
175
  model: string;
180
176
  timeout: number;
@@ -184,19 +180,24 @@ declare const ConfigSchema: z.ZodObject<{
184
180
  model: string;
185
181
  apiKey?: string | undefined;
186
182
  } | undefined;
183
+ huggingface?: {
184
+ model: string;
185
+ apiKey?: string | undefined;
186
+ } | undefined;
187
187
  }, {
188
- bedrock?: {
188
+ "google-ai"?: {
189
189
  model?: string | undefined;
190
- region?: string | undefined;
191
- accessKeyId?: string | undefined;
192
- secretAccessKey?: string | undefined;
193
- sessionToken?: string | undefined;
190
+ apiKey?: string | undefined;
194
191
  } | undefined;
195
192
  openai?: {
196
193
  model?: string | undefined;
197
194
  apiKey?: string | undefined;
198
195
  baseURL?: string | undefined;
199
196
  } | undefined;
197
+ anthropic?: {
198
+ model?: string | undefined;
199
+ apiKey?: string | undefined;
200
+ } | undefined;
200
201
  vertex?: {
201
202
  model?: string | undefined;
202
203
  projectId?: string | undefined;
@@ -206,9 +207,12 @@ declare const ConfigSchema: z.ZodObject<{
206
207
  clientEmail?: string | undefined;
207
208
  privateKey?: string | undefined;
208
209
  } | undefined;
209
- anthropic?: {
210
+ bedrock?: {
210
211
  model?: string | undefined;
211
- apiKey?: string | undefined;
212
+ region?: string | undefined;
213
+ accessKeyId?: string | undefined;
214
+ secretAccessKey?: string | undefined;
215
+ sessionToken?: string | undefined;
212
216
  } | undefined;
213
217
  azure?: {
214
218
  model?: string | undefined;
@@ -216,14 +220,6 @@ declare const ConfigSchema: z.ZodObject<{
216
220
  endpoint?: string | undefined;
217
221
  deploymentId?: string | undefined;
218
222
  } | undefined;
219
- "google-ai"?: {
220
- model?: string | undefined;
221
- apiKey?: string | undefined;
222
- } | undefined;
223
- huggingface?: {
224
- model?: string | undefined;
225
- apiKey?: string | undefined;
226
- } | undefined;
227
223
  ollama?: {
228
224
  model?: string | undefined;
229
225
  timeout?: number | undefined;
@@ -233,6 +229,10 @@ declare const ConfigSchema: z.ZodObject<{
233
229
  model?: string | undefined;
234
230
  apiKey?: string | undefined;
235
231
  } | undefined;
232
+ huggingface?: {
233
+ model?: string | undefined;
234
+ apiKey?: string | undefined;
235
+ } | undefined;
236
236
  }>>;
237
237
  profiles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
238
238
  preferences: z.ZodDefault<z.ZodObject<{
@@ -251,7 +251,7 @@ declare const ConfigSchema: z.ZodObject<{
251
251
  outputFormat: "text" | "json" | "yaml";
252
252
  enableLogging: boolean;
253
253
  enableCaching: boolean;
254
- cacheStrategy: "file" | "memory" | "redis";
254
+ cacheStrategy: "memory" | "redis" | "file";
255
255
  enableAnalyticsByDefault: boolean;
256
256
  enableEvaluationByDefault: boolean;
257
257
  defaultEvaluationDomain?: string | undefined;
@@ -261,7 +261,7 @@ declare const ConfigSchema: z.ZodObject<{
261
261
  outputFormat?: "text" | "json" | "yaml" | undefined;
262
262
  enableLogging?: boolean | undefined;
263
263
  enableCaching?: boolean | undefined;
264
- cacheStrategy?: "file" | "memory" | "redis" | undefined;
264
+ cacheStrategy?: "memory" | "redis" | "file" | undefined;
265
265
  defaultEvaluationDomain?: string | undefined;
266
266
  enableAnalyticsByDefault?: boolean | undefined;
267
267
  enableEvaluationByDefault?: boolean | undefined;
@@ -456,18 +456,19 @@ declare const ConfigSchema: z.ZodObject<{
456
456
  }>>;
457
457
  }, "strip", z.ZodTypeAny, {
458
458
  providers: {
459
- bedrock?: {
459
+ "google-ai"?: {
460
460
  model: string;
461
- region?: string | undefined;
462
- accessKeyId?: string | undefined;
463
- secretAccessKey?: string | undefined;
464
- sessionToken?: string | undefined;
461
+ apiKey?: string | undefined;
465
462
  } | undefined;
466
463
  openai?: {
467
464
  model: string;
468
465
  apiKey?: string | undefined;
469
466
  baseURL?: string | undefined;
470
467
  } | undefined;
468
+ anthropic?: {
469
+ model: string;
470
+ apiKey?: string | undefined;
471
+ } | undefined;
471
472
  vertex?: {
472
473
  model: string;
473
474
  location: string;
@@ -477,9 +478,12 @@ declare const ConfigSchema: z.ZodObject<{
477
478
  clientEmail?: string | undefined;
478
479
  privateKey?: string | undefined;
479
480
  } | undefined;
480
- anthropic?: {
481
+ bedrock?: {
481
482
  model: string;
482
- apiKey?: string | undefined;
483
+ region?: string | undefined;
484
+ accessKeyId?: string | undefined;
485
+ secretAccessKey?: string | undefined;
486
+ sessionToken?: string | undefined;
483
487
  } | undefined;
484
488
  azure?: {
485
489
  model: string;
@@ -487,14 +491,6 @@ declare const ConfigSchema: z.ZodObject<{
487
491
  endpoint?: string | undefined;
488
492
  deploymentId?: string | undefined;
489
493
  } | undefined;
490
- "google-ai"?: {
491
- model: string;
492
- apiKey?: string | undefined;
493
- } | undefined;
494
- huggingface?: {
495
- model: string;
496
- apiKey?: string | undefined;
497
- } | undefined;
498
494
  ollama?: {
499
495
  model: string;
500
496
  timeout: number;
@@ -504,8 +500,12 @@ declare const ConfigSchema: z.ZodObject<{
504
500
  model: string;
505
501
  apiKey?: string | undefined;
506
502
  } | undefined;
503
+ huggingface?: {
504
+ model: string;
505
+ apiKey?: string | undefined;
506
+ } | undefined;
507
507
  };
508
- defaultProvider: "bedrock" | "openai" | "vertex" | "anthropic" | "azure" | "google-ai" | "huggingface" | "ollama" | "mistral" | "auto";
508
+ defaultProvider: "google-ai" | "openai" | "anthropic" | "vertex" | "bedrock" | "azure" | "ollama" | "mistral" | "huggingface" | "auto";
509
509
  profiles: Record<string, any>;
510
510
  preferences: {
511
511
  maxTokens: number;
@@ -513,7 +513,7 @@ declare const ConfigSchema: z.ZodObject<{
513
513
  outputFormat: "text" | "json" | "yaml";
514
514
  enableLogging: boolean;
515
515
  enableCaching: boolean;
516
- cacheStrategy: "file" | "memory" | "redis";
516
+ cacheStrategy: "memory" | "redis" | "file";
517
517
  enableAnalyticsByDefault: boolean;
518
518
  enableEvaluationByDefault: boolean;
519
519
  defaultEvaluationDomain?: string | undefined;
@@ -554,18 +554,19 @@ declare const ConfigSchema: z.ZodObject<{
554
554
  };
555
555
  }, {
556
556
  providers?: {
557
- bedrock?: {
557
+ "google-ai"?: {
558
558
  model?: string | undefined;
559
- region?: string | undefined;
560
- accessKeyId?: string | undefined;
561
- secretAccessKey?: string | undefined;
562
- sessionToken?: string | undefined;
559
+ apiKey?: string | undefined;
563
560
  } | undefined;
564
561
  openai?: {
565
562
  model?: string | undefined;
566
563
  apiKey?: string | undefined;
567
564
  baseURL?: string | undefined;
568
565
  } | undefined;
566
+ anthropic?: {
567
+ model?: string | undefined;
568
+ apiKey?: string | undefined;
569
+ } | undefined;
569
570
  vertex?: {
570
571
  model?: string | undefined;
571
572
  projectId?: string | undefined;
@@ -575,9 +576,12 @@ declare const ConfigSchema: z.ZodObject<{
575
576
  clientEmail?: string | undefined;
576
577
  privateKey?: string | undefined;
577
578
  } | undefined;
578
- anthropic?: {
579
+ bedrock?: {
579
580
  model?: string | undefined;
580
- apiKey?: string | undefined;
581
+ region?: string | undefined;
582
+ accessKeyId?: string | undefined;
583
+ secretAccessKey?: string | undefined;
584
+ sessionToken?: string | undefined;
581
585
  } | undefined;
582
586
  azure?: {
583
587
  model?: string | undefined;
@@ -585,14 +589,6 @@ declare const ConfigSchema: z.ZodObject<{
585
589
  endpoint?: string | undefined;
586
590
  deploymentId?: string | undefined;
587
591
  } | undefined;
588
- "google-ai"?: {
589
- model?: string | undefined;
590
- apiKey?: string | undefined;
591
- } | undefined;
592
- huggingface?: {
593
- model?: string | undefined;
594
- apiKey?: string | undefined;
595
- } | undefined;
596
592
  ollama?: {
597
593
  model?: string | undefined;
598
594
  timeout?: number | undefined;
@@ -602,8 +598,12 @@ declare const ConfigSchema: z.ZodObject<{
602
598
  model?: string | undefined;
603
599
  apiKey?: string | undefined;
604
600
  } | undefined;
601
+ huggingface?: {
602
+ model?: string | undefined;
603
+ apiKey?: string | undefined;
604
+ } | undefined;
605
605
  } | undefined;
606
- defaultProvider?: "bedrock" | "openai" | "vertex" | "anthropic" | "azure" | "google-ai" | "huggingface" | "ollama" | "mistral" | "auto" | undefined;
606
+ defaultProvider?: "google-ai" | "openai" | "anthropic" | "vertex" | "bedrock" | "azure" | "ollama" | "mistral" | "huggingface" | "auto" | undefined;
607
607
  profiles?: Record<string, any> | undefined;
608
608
  preferences?: {
609
609
  maxTokens?: number | undefined;
@@ -611,7 +611,7 @@ declare const ConfigSchema: z.ZodObject<{
611
611
  outputFormat?: "text" | "json" | "yaml" | undefined;
612
612
  enableLogging?: boolean | undefined;
613
613
  enableCaching?: boolean | undefined;
614
- cacheStrategy?: "file" | "memory" | "redis" | undefined;
614
+ cacheStrategy?: "memory" | "redis" | "file" | undefined;
615
615
  defaultEvaluationDomain?: string | undefined;
616
616
  enableAnalyticsByDefault?: boolean | undefined;
617
617
  enableEvaluationByDefault?: boolean | undefined;
@@ -1,7 +1,6 @@
1
- import type { ZodType, ZodTypeDef } from "zod";
2
- import type { Schema } from "ai";
1
+ import type { ValidationSchema } from "../types/typeAliases.js";
3
2
  import type { Tool, LanguageModelV1 } from "ai";
4
- import type { AIProvider, TextGenerationOptions, EnhancedGenerateResult, AnalyticsData, AIProviderName, EvaluationData } from "../core/types.js";
3
+ import type { AIProvider, TextGenerationOptions, TextGenerationResult, EnhancedGenerateResult, AnalyticsData, AIProviderName, EvaluationData } from "../core/types.js";
5
4
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
6
5
  import type { UnknownRecord } from "../types/common.js";
7
6
  import type { NeuroLink } from "../neurolink.js";
@@ -31,20 +30,26 @@ export declare abstract class BaseProvider implements AIProvider {
31
30
  * Primary streaming method - implements AIProvider interface
32
31
  * When tools are involved, falls back to generate() with synthetic streaming
33
32
  */
34
- stream(optionsOrPrompt: StreamOptions | string, analysisSchema?: ZodType<unknown, ZodTypeDef, unknown> | Schema<unknown>): Promise<StreamResult>;
33
+ stream(optionsOrPrompt: StreamOptions | string, analysisSchema?: ValidationSchema): Promise<StreamResult>;
35
34
  /**
36
35
  * Text generation method - implements AIProvider interface
37
36
  * Tools are always available unless explicitly disabled
38
37
  */
39
- generate(optionsOrPrompt: TextGenerationOptions | string, analysisSchema?: ZodType<unknown, ZodTypeDef, unknown> | Schema<unknown>): Promise<EnhancedGenerateResult | null>;
38
+ generate(optionsOrPrompt: TextGenerationOptions | string, _analysisSchema?: ValidationSchema): Promise<EnhancedGenerateResult | null>;
40
39
  /**
41
40
  * Alias for generate method - implements AIProvider interface
42
41
  */
43
- gen(optionsOrPrompt: TextGenerationOptions | string, analysisSchema?: ZodType<unknown, ZodTypeDef, unknown> | Schema<unknown>): Promise<EnhancedGenerateResult | null>;
42
+ gen(optionsOrPrompt: TextGenerationOptions | string, analysisSchema?: ValidationSchema): Promise<EnhancedGenerateResult | null>;
43
+ /**
44
+ * BACKWARD COMPATIBILITY: Legacy generateText method
45
+ * Converts EnhancedGenerateResult to TextGenerationResult format
46
+ * Ensures existing scripts using createAIProvider().generateText() continue to work
47
+ */
48
+ generateText(options: TextGenerationOptions): Promise<TextGenerationResult>;
44
49
  /**
45
50
  * Provider-specific streaming implementation (only used when tools are disabled)
46
51
  */
47
- protected abstract executeStream(options: StreamOptions, analysisSchema?: ZodType<unknown, ZodTypeDef, unknown> | Schema<unknown>): Promise<StreamResult>;
52
+ protected abstract executeStream(options: StreamOptions, analysisSchema?: ValidationSchema): Promise<StreamResult>;
48
53
  /**
49
54
  * Get the provider name
50
55
  */