@juspay/neurolink 7.7.1 → 7.9.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/README.md +34 -2
  3. package/dist/cli/commands/config.d.ts +3 -3
  4. package/dist/cli/commands/sagemaker.d.ts +11 -0
  5. package/dist/cli/commands/sagemaker.js +778 -0
  6. package/dist/cli/factories/commandFactory.js +7 -2
  7. package/dist/cli/index.js +3 -0
  8. package/dist/cli/utils/interactiveSetup.js +28 -0
  9. package/dist/core/baseProvider.d.ts +2 -2
  10. package/dist/core/types.d.ts +16 -4
  11. package/dist/core/types.js +24 -3
  12. package/dist/factories/providerFactory.js +10 -1
  13. package/dist/factories/providerRegistry.js +6 -1
  14. package/dist/lib/core/baseProvider.d.ts +2 -2
  15. package/dist/lib/core/types.d.ts +16 -4
  16. package/dist/lib/core/types.js +24 -3
  17. package/dist/lib/factories/providerFactory.js +10 -1
  18. package/dist/lib/factories/providerRegistry.js +6 -1
  19. package/dist/lib/neurolink.d.ts +15 -0
  20. package/dist/lib/neurolink.js +73 -1
  21. package/dist/lib/providers/amazonSagemaker.d.ts +67 -0
  22. package/dist/lib/providers/amazonSagemaker.js +149 -0
  23. package/dist/lib/providers/googleVertex.d.ts +4 -0
  24. package/dist/lib/providers/googleVertex.js +44 -3
  25. package/dist/lib/providers/index.d.ts +4 -0
  26. package/dist/lib/providers/index.js +4 -0
  27. package/dist/lib/providers/sagemaker/adaptive-semaphore.d.ts +86 -0
  28. package/dist/lib/providers/sagemaker/adaptive-semaphore.js +212 -0
  29. package/dist/lib/providers/sagemaker/client.d.ts +156 -0
  30. package/dist/lib/providers/sagemaker/client.js +462 -0
  31. package/dist/lib/providers/sagemaker/config.d.ts +73 -0
  32. package/dist/lib/providers/sagemaker/config.js +308 -0
  33. package/dist/lib/providers/sagemaker/detection.d.ts +176 -0
  34. package/dist/lib/providers/sagemaker/detection.js +596 -0
  35. package/dist/lib/providers/sagemaker/diagnostics.d.ts +37 -0
  36. package/dist/lib/providers/sagemaker/diagnostics.js +137 -0
  37. package/dist/lib/providers/sagemaker/error-constants.d.ts +78 -0
  38. package/dist/lib/providers/sagemaker/error-constants.js +227 -0
  39. package/dist/lib/providers/sagemaker/errors.d.ts +83 -0
  40. package/dist/lib/providers/sagemaker/errors.js +216 -0
  41. package/dist/lib/providers/sagemaker/index.d.ts +35 -0
  42. package/dist/lib/providers/sagemaker/index.js +67 -0
  43. package/dist/lib/providers/sagemaker/language-model.d.ts +182 -0
  44. package/dist/lib/providers/sagemaker/language-model.js +755 -0
  45. package/dist/lib/providers/sagemaker/parsers.d.ts +136 -0
  46. package/dist/lib/providers/sagemaker/parsers.js +625 -0
  47. package/dist/lib/providers/sagemaker/streaming.d.ts +39 -0
  48. package/dist/lib/providers/sagemaker/streaming.js +320 -0
  49. package/dist/lib/providers/sagemaker/structured-parser.d.ts +117 -0
  50. package/dist/lib/providers/sagemaker/structured-parser.js +625 -0
  51. package/dist/lib/providers/sagemaker/types.d.ts +456 -0
  52. package/dist/lib/providers/sagemaker/types.js +7 -0
  53. package/dist/lib/sdk/toolRegistration.d.ts +1 -1
  54. package/dist/lib/sdk/toolRegistration.js +13 -5
  55. package/dist/lib/types/cli.d.ts +36 -1
  56. package/dist/lib/utils/providerHealth.js +19 -4
  57. package/dist/neurolink.d.ts +15 -0
  58. package/dist/neurolink.js +73 -1
  59. package/dist/providers/amazonSagemaker.d.ts +67 -0
  60. package/dist/providers/amazonSagemaker.js +149 -0
  61. package/dist/providers/googleVertex.d.ts +4 -0
  62. package/dist/providers/googleVertex.js +44 -3
  63. package/dist/providers/index.d.ts +4 -0
  64. package/dist/providers/index.js +4 -0
  65. package/dist/providers/sagemaker/adaptive-semaphore.d.ts +86 -0
  66. package/dist/providers/sagemaker/adaptive-semaphore.js +212 -0
  67. package/dist/providers/sagemaker/client.d.ts +156 -0
  68. package/dist/providers/sagemaker/client.js +462 -0
  69. package/dist/providers/sagemaker/config.d.ts +73 -0
  70. package/dist/providers/sagemaker/config.js +308 -0
  71. package/dist/providers/sagemaker/detection.d.ts +176 -0
  72. package/dist/providers/sagemaker/detection.js +596 -0
  73. package/dist/providers/sagemaker/diagnostics.d.ts +37 -0
  74. package/dist/providers/sagemaker/diagnostics.js +137 -0
  75. package/dist/providers/sagemaker/error-constants.d.ts +78 -0
  76. package/dist/providers/sagemaker/error-constants.js +227 -0
  77. package/dist/providers/sagemaker/errors.d.ts +83 -0
  78. package/dist/providers/sagemaker/errors.js +216 -0
  79. package/dist/providers/sagemaker/index.d.ts +35 -0
  80. package/dist/providers/sagemaker/index.js +67 -0
  81. package/dist/providers/sagemaker/language-model.d.ts +182 -0
  82. package/dist/providers/sagemaker/language-model.js +755 -0
  83. package/dist/providers/sagemaker/parsers.d.ts +136 -0
  84. package/dist/providers/sagemaker/parsers.js +625 -0
  85. package/dist/providers/sagemaker/streaming.d.ts +39 -0
  86. package/dist/providers/sagemaker/streaming.js +320 -0
  87. package/dist/providers/sagemaker/structured-parser.d.ts +117 -0
  88. package/dist/providers/sagemaker/structured-parser.js +625 -0
  89. package/dist/providers/sagemaker/types.d.ts +456 -0
  90. package/dist/providers/sagemaker/types.js +7 -0
  91. package/dist/sdk/toolRegistration.d.ts +1 -1
  92. package/dist/sdk/toolRegistration.js +13 -5
  93. package/dist/types/cli.d.ts +36 -1
  94. package/dist/utils/providerHealth.js +19 -4
  95. package/package.json +8 -2
@@ -0,0 +1,456 @@
1
+ /**
2
+ * TypeScript type definitions for Amazon SageMaker Provider
3
+ *
4
+ * This module contains all interfaces and types for SageMaker integration
5
+ * with the NeuroLink ecosystem and Vercel AI SDK compatibility.
6
+ */
7
+ /**
8
+ * AWS configuration options for SageMaker client
9
+ */
10
+ export interface SageMakerConfig {
11
+ /** AWS region for SageMaker service */
12
+ region: string;
13
+ /** AWS access key ID */
14
+ accessKeyId: string;
15
+ /** AWS secret access key */
16
+ secretAccessKey: string;
17
+ /** AWS session token (optional, for temporary credentials) */
18
+ sessionToken?: string;
19
+ /** Request timeout in milliseconds */
20
+ timeout?: number;
21
+ /** Maximum number of retry attempts */
22
+ maxRetries?: number;
23
+ /** Custom SageMaker endpoint URL (optional) */
24
+ endpoint?: string;
25
+ }
26
+ /**
27
+ * Model-specific configuration for SageMaker endpoints
28
+ */
29
+ export interface SageMakerModelConfig {
30
+ /** SageMaker endpoint name */
31
+ endpointName: string;
32
+ /** Model type for request/response formatting */
33
+ modelType?: "llama" | "mistral" | "claude" | "huggingface" | "jumpstart" | "custom";
34
+ /** Content type for requests */
35
+ contentType?: string;
36
+ /** Accept header for responses */
37
+ accept?: string;
38
+ /** Custom attributes for the endpoint */
39
+ customAttributes?: string;
40
+ /** Input format specification */
41
+ inputFormat?: "huggingface" | "jumpstart" | "custom";
42
+ /** Output format specification */
43
+ outputFormat?: "huggingface" | "jumpstart" | "custom";
44
+ /** Maximum tokens for generation */
45
+ maxTokens?: number;
46
+ /** Temperature parameter */
47
+ temperature?: number;
48
+ /** Top-p parameter */
49
+ topP?: number;
50
+ /** Stop sequences */
51
+ stopSequences?: string[];
52
+ /** Initial concurrency for batch processing */
53
+ initialConcurrency?: number;
54
+ /** Maximum concurrency for batch processing */
55
+ maxConcurrency?: number;
56
+ /** Minimum concurrency for batch processing */
57
+ minConcurrency?: number;
58
+ /** Maximum concurrent detection tests */
59
+ maxConcurrentDetectionTests?: number;
60
+ }
61
+ /**
62
+ * SageMaker endpoint information and metadata
63
+ */
64
+ export interface SageMakerEndpointInfo {
65
+ /** Endpoint name */
66
+ endpointName: string;
67
+ /** Endpoint ARN */
68
+ endpointArn: string;
69
+ /** Associated model name */
70
+ modelName: string;
71
+ /** EC2 instance type */
72
+ instanceType: string;
73
+ /** Endpoint creation timestamp */
74
+ creationTime: string;
75
+ /** Last modification timestamp */
76
+ lastModifiedTime: string;
77
+ /** Current endpoint status */
78
+ endpointStatus: "InService" | "Creating" | "Updating" | "SystemUpdating" | "RollingBack" | "Deleting" | "Failed";
79
+ /** Current instance count */
80
+ currentInstanceCount?: number;
81
+ /** Variant weights for A/B testing */
82
+ productionVariants?: Array<{
83
+ variantName: string;
84
+ modelName: string;
85
+ initialInstanceCount: number;
86
+ instanceType: string;
87
+ currentWeight?: number;
88
+ }>;
89
+ }
90
+ /**
91
+ * Token usage and billing information
92
+ */
93
+ export interface SageMakerUsage {
94
+ /** Number of prompt tokens */
95
+ promptTokens: number;
96
+ /** Number of completion tokens */
97
+ completionTokens: number;
98
+ /** Total tokens used */
99
+ totalTokens: number;
100
+ /** Request processing time in milliseconds */
101
+ requestTime?: number;
102
+ /** Model inference time in milliseconds */
103
+ inferenceTime?: number;
104
+ /** Estimated cost in USD */
105
+ estimatedCost?: number;
106
+ }
107
+ /**
108
+ * Parameters for SageMaker endpoint invocation
109
+ */
110
+ export interface InvokeEndpointParams {
111
+ /** Endpoint name to invoke */
112
+ EndpointName: string;
113
+ /** Request body as string or Uint8Array */
114
+ Body: string | Uint8Array;
115
+ /** Content type of the request */
116
+ ContentType?: string;
117
+ /** Accept header for response format */
118
+ Accept?: string;
119
+ /** Custom attributes for the request */
120
+ CustomAttributes?: string;
121
+ /** Target model for multi-model endpoints */
122
+ TargetModel?: string;
123
+ /** Target variant for A/B testing */
124
+ TargetVariant?: string;
125
+ /** Inference ID for request tracking */
126
+ InferenceId?: string;
127
+ }
128
+ /**
129
+ * Response from SageMaker endpoint invocation
130
+ */
131
+ export interface InvokeEndpointResponse {
132
+ /** Response body */
133
+ Body?: Uint8Array;
134
+ /** Content type of the response */
135
+ ContentType?: string;
136
+ /** Invoked production variant */
137
+ InvokedProductionVariant?: string;
138
+ /** Custom attributes in the response */
139
+ CustomAttributes?: string;
140
+ }
141
+ /**
142
+ * Streaming response chunk from SageMaker
143
+ */
144
+ export interface SageMakerStreamChunk {
145
+ /** Text content in the chunk */
146
+ content?: string;
147
+ /** Indicates if this is the final chunk */
148
+ done?: boolean;
149
+ /** Usage information (only in final chunk) */
150
+ usage?: SageMakerUsage;
151
+ /** Error information if chunk contains error */
152
+ error?: string;
153
+ /** Finish reason for generation */
154
+ finishReason?: "stop" | "length" | "tool-calls" | "content-filter" | "unknown";
155
+ /** Tool call in progress (Phase 2.3) */
156
+ toolCall?: SageMakerStreamingToolCall;
157
+ /** Tool result chunk (Phase 2.3) */
158
+ toolResult?: SageMakerStreamingToolResult;
159
+ /** Structured output streaming (Phase 2.3) */
160
+ structuredOutput?: SageMakerStructuredOutput;
161
+ }
162
+ /**
163
+ * Tool call information for function calling
164
+ */
165
+ export interface SageMakerToolCall {
166
+ /** Tool call identifier */
167
+ id: string;
168
+ /** Tool/function name */
169
+ name: string;
170
+ /** Tool arguments as JSON object */
171
+ arguments: Record<string, unknown>;
172
+ /** Tool call type */
173
+ type: "function";
174
+ }
175
+ /**
176
+ * Tool result information
177
+ */
178
+ export interface SageMakerToolResult {
179
+ /** Tool call identifier */
180
+ toolCallId: string;
181
+ /** Tool name */
182
+ toolName: string;
183
+ /** Tool result data */
184
+ result: unknown;
185
+ /** Execution status */
186
+ status: "success" | "error";
187
+ /** Error message if status is error */
188
+ error?: string;
189
+ }
190
+ /**
191
+ * Streaming tool call information (Phase 2.3)
192
+ */
193
+ export interface SageMakerStreamingToolCall {
194
+ /** Tool call identifier */
195
+ id: string;
196
+ /** Tool/function name */
197
+ name?: string;
198
+ /** Partial or complete arguments as JSON string */
199
+ arguments?: string;
200
+ /** Tool call type */
201
+ type: "function";
202
+ /** Indicates if this tool call is complete */
203
+ complete?: boolean;
204
+ /** Delta text for incremental argument building */
205
+ argumentsDelta?: string;
206
+ }
207
+ /**
208
+ * Streaming tool result information (Phase 2.3)
209
+ */
210
+ export interface SageMakerStreamingToolResult {
211
+ /** Tool call identifier */
212
+ toolCallId: string;
213
+ /** Tool name */
214
+ toolName: string;
215
+ /** Partial or complete result data */
216
+ result?: unknown;
217
+ /** Result delta for incremental responses */
218
+ resultDelta?: string;
219
+ /** Execution status */
220
+ status: "pending" | "running" | "success" | "error";
221
+ /** Error message if status is error */
222
+ error?: string;
223
+ /** Indicates if this result is complete */
224
+ complete?: boolean;
225
+ }
226
+ /**
227
+ * Structured output streaming information (Phase 2.3)
228
+ */
229
+ export interface SageMakerStructuredOutput {
230
+ /** Partial JSON object being built */
231
+ partialObject?: Record<string, unknown>;
232
+ /** JSON delta text */
233
+ jsonDelta?: string;
234
+ /** Current parsing path (e.g., "user.name") */
235
+ currentPath?: string;
236
+ /** Schema validation errors */
237
+ validationErrors?: string[];
238
+ /** Indicates if JSON is complete and valid */
239
+ complete?: boolean;
240
+ /** JSON schema being validated against */
241
+ schema?: Record<string, unknown>;
242
+ }
243
+ /**
244
+ * Enhanced generation request options
245
+ */
246
+ export interface SageMakerGenerationOptions {
247
+ /** Input prompt text */
248
+ prompt: string;
249
+ /** System prompt for context */
250
+ systemPrompt?: string;
251
+ /** Maximum tokens to generate */
252
+ maxTokens?: number;
253
+ /** Temperature for randomness (0-1) */
254
+ temperature?: number;
255
+ /** Top-p nucleus sampling (0-1) */
256
+ topP?: number;
257
+ /** Top-k sampling */
258
+ topK?: number;
259
+ /** Stop sequences to end generation */
260
+ stopSequences?: string[];
261
+ /** Enable streaming response */
262
+ stream?: boolean;
263
+ /** Tools available for function calling */
264
+ tools?: Array<{
265
+ name: string;
266
+ description: string;
267
+ parameters: Record<string, unknown>;
268
+ }>;
269
+ /** Tool choice mode */
270
+ toolChoice?: "auto" | "none" | {
271
+ type: "tool";
272
+ name: string;
273
+ };
274
+ }
275
+ /**
276
+ * Generation response from SageMaker
277
+ */
278
+ export interface SageMakerGenerationResponse {
279
+ /** Generated text content */
280
+ text: string;
281
+ /** Token usage information */
282
+ usage: SageMakerUsage;
283
+ /** Finish reason for generation */
284
+ finishReason: "stop" | "length" | "tool-calls" | "content-filter" | "unknown";
285
+ /** Tool calls made during generation */
286
+ toolCalls?: SageMakerToolCall[];
287
+ /** Tool results if tools were executed */
288
+ toolResults?: SageMakerToolResult[];
289
+ /** Additional metadata */
290
+ metadata?: Record<string, unknown>;
291
+ /** Model version or identifier */
292
+ modelVersion?: string;
293
+ }
294
+ /**
295
+ * Error codes specific to SageMaker operations
296
+ */
297
+ export type SageMakerErrorCode = "VALIDATION_ERROR" | "MODEL_ERROR" | "INTERNAL_ERROR" | "SERVICE_UNAVAILABLE" | "CREDENTIALS_ERROR" | "NETWORK_ERROR" | "ENDPOINT_NOT_FOUND" | "THROTTLING_ERROR" | "UNKNOWN_ERROR";
298
+ /**
299
+ * SageMaker-specific error information
300
+ */
301
+ export interface SageMakerErrorInfo {
302
+ /** Error code */
303
+ code: SageMakerErrorCode;
304
+ /** Human-readable error message */
305
+ message: string;
306
+ /** HTTP status code if applicable */
307
+ statusCode?: number;
308
+ /** Original error from AWS SDK */
309
+ cause?: Error;
310
+ /** Endpoint name where error occurred */
311
+ endpoint?: string;
312
+ /** Request ID for debugging */
313
+ requestId?: string;
314
+ /** Retry suggestion */
315
+ retryable?: boolean;
316
+ }
317
+ /**
318
+ * Batch inference job configuration
319
+ */
320
+ export interface BatchInferenceConfig {
321
+ /** Input S3 location */
322
+ inputS3Uri: string;
323
+ /** Output S3 location */
324
+ outputS3Uri: string;
325
+ /** SageMaker model name */
326
+ modelName: string;
327
+ /** Instance type for batch job */
328
+ instanceType: string;
329
+ /** Instance count for batch job */
330
+ instanceCount: number;
331
+ /** Maximum payload size in MB */
332
+ maxPayloadInMB?: number;
333
+ /** Batch strategy */
334
+ batchStrategy?: "MultiRecord" | "SingleRecord";
335
+ }
336
+ /**
337
+ * Model deployment configuration
338
+ */
339
+ export interface ModelDeploymentConfig {
340
+ /** Model name */
341
+ modelName: string;
342
+ /** Endpoint name */
343
+ endpointName: string;
344
+ /** EC2 instance type */
345
+ instanceType: string;
346
+ /** Initial instance count */
347
+ initialInstanceCount: number;
348
+ /** Model data S3 location */
349
+ modelDataUrl: string;
350
+ /** Container image URI */
351
+ image: string;
352
+ /** IAM execution role ARN */
353
+ executionRoleArn: string;
354
+ /** Resource tags */
355
+ tags?: Record<string, string>;
356
+ /** Auto scaling configuration */
357
+ autoScaling?: {
358
+ minCapacity: number;
359
+ maxCapacity: number;
360
+ targetValue: number;
361
+ scaleUpCooldown: number;
362
+ scaleDownCooldown: number;
363
+ };
364
+ }
365
+ /**
366
+ * Endpoint metrics and monitoring data
367
+ */
368
+ export interface EndpointMetrics {
369
+ /** Endpoint name */
370
+ endpointName: string;
371
+ /** Total invocations */
372
+ invocations: number;
373
+ /** Average latency in milliseconds */
374
+ averageLatency: number;
375
+ /** Error rate percentage */
376
+ errorRate: number;
377
+ /** CPU utilization percentage */
378
+ cpuUtilization?: number;
379
+ /** Memory utilization percentage */
380
+ memoryUtilization?: number;
381
+ /** Instance count */
382
+ instanceCount: number;
383
+ /** Timestamp of metrics */
384
+ timestamp: string;
385
+ }
386
+ /**
387
+ * Cost estimation data
388
+ */
389
+ export interface CostEstimate {
390
+ /** Estimated cost in USD */
391
+ estimatedCost: number;
392
+ /** Currency code */
393
+ currency: string;
394
+ /** Cost breakdown */
395
+ breakdown: {
396
+ /** Instance hours cost */
397
+ instanceCost: number;
398
+ /** Request-based cost */
399
+ requestCost: number;
400
+ /** Total processing hours */
401
+ totalHours: number;
402
+ };
403
+ /** Time period for estimate */
404
+ period?: {
405
+ start: string;
406
+ end: string;
407
+ };
408
+ }
409
+ /**
410
+ * SageMaker generation result interface for better type safety
411
+ */
412
+ export interface SageMakerGenerateResult {
413
+ text?: string;
414
+ reasoning?: string | Array<{
415
+ type: "text";
416
+ text: string;
417
+ signature?: string;
418
+ } | {
419
+ type: "redacted";
420
+ data: string;
421
+ }>;
422
+ files?: Array<{
423
+ data: string | Uint8Array;
424
+ mimeType: string;
425
+ }>;
426
+ logprobs?: Array<{
427
+ token: string;
428
+ logprob: number;
429
+ topLogprobs: Array<{
430
+ token: string;
431
+ logprob: number;
432
+ }>;
433
+ }>;
434
+ usage: {
435
+ promptTokens: number;
436
+ completionTokens: number;
437
+ totalTokens?: number;
438
+ };
439
+ finishReason: "stop" | "length" | "content-filter" | "tool-calls" | "error" | "unknown";
440
+ warnings?: Array<{
441
+ type: "other";
442
+ message: string;
443
+ }>;
444
+ rawCall: {
445
+ rawPrompt: unknown;
446
+ rawSettings: Record<string, unknown>;
447
+ };
448
+ rawResponse?: {
449
+ headers?: Record<string, string>;
450
+ };
451
+ request?: {
452
+ body?: string;
453
+ };
454
+ toolCalls?: SageMakerToolCall[];
455
+ object?: unknown;
456
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * TypeScript type definitions for Amazon SageMaker Provider
3
+ *
4
+ * This module contains all interfaces and types for SageMaker integration
5
+ * with the NeuroLink ecosystem and Vercel AI SDK compatibility.
6
+ */
7
+ export {};
@@ -13,7 +13,7 @@ import type { JsonValue } from "../types/common.js";
13
13
  */
14
14
  declare const VALIDATION_CONFIG: {
15
15
  readonly NAME_MIN_LENGTH: 2;
16
- readonly NAME_MAX_LENGTH: 50;
16
+ readonly NAME_MAX_LENGTH: number;
17
17
  readonly DESCRIPTION_MIN_LENGTH: 10;
18
18
  readonly DESCRIPTION_MAX_LENGTH: number;
19
19
  readonly RESERVED_NAMES: Set<string>;
@@ -8,15 +8,19 @@ import { logger } from "../utils/logger.js";
8
8
  /**
9
9
  * Configuration constants for tool validation
10
10
  */
11
- const envValue = parseInt(process.env.NEUROLINK_TOOL_DESCRIPTION_MAX_LENGTH || "200", 10);
12
- const DEFAULT_DESCRIPTION_MAX_LENGTH = Number.isInteger(envValue) && envValue > 0 ? envValue : 200;
11
+ const envDescValue = parseInt(process.env.NEUROLINK_TOOL_DESCRIPTION_MAX_LENGTH || "200", 10);
12
+ // Allow 0 to mean unlimited (no length restriction)
13
+ const DEFAULT_DESCRIPTION_MAX_LENGTH = Number.isInteger(envDescValue) && envDescValue >= 0 ? envDescValue : 200;
14
+ const envNameValue = parseInt(process.env.NEUROLINK_TOOL_NAME_MAX_LENGTH || "50", 10);
15
+ // Allow 0 to mean unlimited (no length restriction)
16
+ const DEFAULT_NAME_MAX_LENGTH = Number.isInteger(envNameValue) && envNameValue >= 0 ? envNameValue : 50;
13
17
  /**
14
18
  * Enhanced validation configuration
15
19
  */
16
20
  const VALIDATION_CONFIG = {
17
21
  // Tool name constraints
18
22
  NAME_MIN_LENGTH: 2,
19
- NAME_MAX_LENGTH: 50,
23
+ NAME_MAX_LENGTH: DEFAULT_NAME_MAX_LENGTH,
20
24
  // Description constraints
21
25
  DESCRIPTION_MIN_LENGTH: 10,
22
26
  DESCRIPTION_MAX_LENGTH: DEFAULT_DESCRIPTION_MAX_LENGTH,
@@ -210,7 +214,9 @@ function validateToolName(name) {
210
214
  `Minimum length: ${VALIDATION_CONFIG.NAME_MIN_LENGTH} characters. ` +
211
215
  `Example: 'get_data', 'send_email'`);
212
216
  }
213
- if (trimmedName.length > VALIDATION_CONFIG.NAME_MAX_LENGTH) {
217
+ // Only check name length if limit is greater than 0 (0 means unlimited)
218
+ if (VALIDATION_CONFIG.NAME_MAX_LENGTH > 0 &&
219
+ trimmedName.length > VALIDATION_CONFIG.NAME_MAX_LENGTH) {
214
220
  throw new Error(`Tool name too long: '${name}' (${trimmedName.length} chars). ` +
215
221
  `Maximum length: ${VALIDATION_CONFIG.NAME_MAX_LENGTH} characters. ` +
216
222
  `Consider shortening: '${trimmedName.substring(0, 20)}...'`);
@@ -254,7 +260,9 @@ function validateToolDescription(name, description) {
254
260
  `The description should clearly explain what the tool does and when to use it. ` +
255
261
  `Example: "Fetches current weather data for a specified location using coordinates or city name"`);
256
262
  }
257
- if (trimmedDescription.length > VALIDATION_CONFIG.DESCRIPTION_MAX_LENGTH) {
263
+ // Only check description length if limit is greater than 0 (0 means unlimited)
264
+ if (VALIDATION_CONFIG.DESCRIPTION_MAX_LENGTH > 0 &&
265
+ trimmedDescription.length > VALIDATION_CONFIG.DESCRIPTION_MAX_LENGTH) {
258
266
  throw new Error(`Tool '${name}' description too long: ${trimmedDescription.length} characters. ` +
259
267
  `Maximum length: ${VALIDATION_CONFIG.DESCRIPTION_MAX_LENGTH} characters. ` +
260
268
  `Current description: "${trimmedDescription.substring(0, 50)}..." ` +
@@ -12,7 +12,7 @@ export interface BaseCommandArgs {
12
12
  /** Enable debug output */
13
13
  debug?: boolean;
14
14
  /** Output format */
15
- format?: "text" | "json" | "table";
15
+ format?: "text" | "json" | "table" | "yaml";
16
16
  /** Verbose output */
17
17
  verbose?: boolean;
18
18
  /** Quiet mode */
@@ -153,6 +153,41 @@ export interface OllamaCommandArgs extends BaseCommandArgs {
153
153
  /** Show model information */
154
154
  show?: boolean;
155
155
  }
156
+ /**
157
+ * SageMaker command arguments
158
+ */
159
+ export interface SageMakerCommandArgs extends BaseCommandArgs {
160
+ /** SageMaker endpoint name */
161
+ endpoint?: string;
162
+ /** Model name for the endpoint */
163
+ model?: string;
164
+ /** Test prompt for endpoint testing */
165
+ prompt?: string;
166
+ /** List endpoints */
167
+ list?: boolean;
168
+ /** Show configuration */
169
+ config?: boolean;
170
+ /** Setup configuration */
171
+ setup?: boolean;
172
+ /** Clear configuration cache */
173
+ clearCache?: boolean;
174
+ /** Run benchmark test */
175
+ benchmark?: boolean;
176
+ /** Duration for benchmark test (in seconds) */
177
+ duration?: number;
178
+ /** Concurrency level for benchmark */
179
+ concurrency?: number;
180
+ /** Number of requests for benchmark */
181
+ requests?: number;
182
+ /** Maximum tokens per request */
183
+ maxTokens?: number;
184
+ /** Validate endpoint configuration */
185
+ validate?: boolean;
186
+ /** AWS region override */
187
+ region?: string;
188
+ /** Force operation without confirmation */
189
+ force?: boolean;
190
+ }
156
191
  /**
157
192
  * Provider status command arguments
158
193
  */
@@ -229,11 +229,19 @@ export class ProviderHealthChecker {
229
229
  * Check model availability (if possible without making API calls)
230
230
  */
231
231
  static async checkModelAvailability(providerName, healthStatus) {
232
- // For now, we'll do basic model name validation
233
- // In the future, this could be enhanced with actual API calls
232
+ // Basic model name validation and recommendations
234
233
  const commonModels = this.getCommonModelsForProvider(providerName);
235
234
  if (commonModels.length > 0) {
236
- healthStatus.recommendations.push(`Common models for ${providerName}: ${commonModels.slice(0, 3).join(", ")}`);
235
+ if (providerName === AIProviderName.VERTEX) {
236
+ // Provide more detailed information for Vertex AI
237
+ healthStatus.recommendations.push(`Available models for ${providerName}:\n` +
238
+ ` Google Models: gemini-1.5-pro, gemini-1.5-flash\n` +
239
+ ` Claude Models: claude-3-5-sonnet-20241022, claude-3-sonnet-20240229, claude-3-haiku-20240307, claude-3-opus-20240229\n` +
240
+ ` Note: Claude models require Anthropic integration to be enabled in your Google Cloud project`);
241
+ }
242
+ else {
243
+ healthStatus.recommendations.push(`Common models for ${providerName}: ${commonModels.slice(0, 3).join(", ")}`);
244
+ }
237
245
  }
238
246
  }
239
247
  /**
@@ -408,7 +416,14 @@ export class ProviderHealthChecker {
408
416
  case AIProviderName.GOOGLE_AI:
409
417
  return ["gemini-1.5-pro", "gemini-1.5-flash", "gemini-pro"];
410
418
  case AIProviderName.VERTEX:
411
- return ["gemini-1.5-pro", "gemini-1.5-flash"];
419
+ return [
420
+ "gemini-1.5-pro",
421
+ "gemini-1.5-flash",
422
+ "claude-3-5-sonnet-20241022",
423
+ "claude-3-sonnet-20240229",
424
+ "claude-3-haiku-20240307",
425
+ "claude-3-opus-20240229",
426
+ ];
412
427
  case AIProviderName.BEDROCK:
413
428
  return [
414
429
  "anthropic.claude-3-sonnet-20240229-v1:0",
@@ -10,6 +10,7 @@ import type { GenerateOptions, GenerateResult } from "./types/generateTypes.js";
10
10
  import type { StreamOptions, StreamResult } from "./types/streamTypes.js";
11
11
  import type { SimpleTool } from "./sdk/toolRegistration.js";
12
12
  import type { InMemoryMCPServerConfig } from "./types/mcpTypes.js";
13
+ import { EventEmitter } from "events";
13
14
  export interface ProviderStatus {
14
15
  provider: string;
15
16
  status: "working" | "failed" | "not-configured";
@@ -41,10 +42,19 @@ export interface MCPServerInfo {
41
42
  }
42
43
  export declare class NeuroLink {
43
44
  private mcpInitialized;
45
+ private emitter;
44
46
  private customTools;
45
47
  private inMemoryServers;
46
48
  private toolCircuitBreakers;
47
49
  private toolExecutionMetrics;
50
+ /**
51
+ * Helper method to emit tool end event in a consistent way
52
+ * Used by executeTool in both success and error paths
53
+ * @param toolName - Name of the tool
54
+ * @param startTime - Timestamp when tool execution started
55
+ * @param success - Whether the tool execution was successful
56
+ */
57
+ private emitToolEndEvent;
48
58
  constructor();
49
59
  /**
50
60
  * Initialize MCP registry with enhanced error handling and resource cleanup
@@ -101,6 +111,11 @@ export declare class NeuroLink {
101
111
  * Future-ready for multi-modal capabilities with current text focus
102
112
  */
103
113
  stream(options: StreamOptions): Promise<StreamResult>;
114
+ /**
115
+ * Get the EventEmitter to listen to NeuroLink events
116
+ * @returns EventEmitter instance
117
+ */
118
+ getEventEmitter(): EventEmitter<[never]>;
104
119
  /**
105
120
  * Register a custom tool that will be available to all AI providers
106
121
  * @param name - Unique name for the tool