@juspay/neurolink 7.51.1 → 7.51.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 (46) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/core/conversationMemoryFactory.d.ts +1 -4
  3. package/dist/core/redisConversationMemoryManager.d.ts +4 -0
  4. package/dist/core/redisConversationMemoryManager.js +4 -0
  5. package/dist/lib/core/conversationMemoryFactory.d.ts +1 -4
  6. package/dist/lib/core/redisConversationMemoryManager.d.ts +4 -0
  7. package/dist/lib/core/redisConversationMemoryManager.js +4 -0
  8. package/dist/lib/neurolink.d.ts +2 -1
  9. package/dist/lib/types/common.d.ts +18 -61
  10. package/dist/lib/types/content.d.ts +21 -10
  11. package/dist/lib/types/contextTypes.d.ts +11 -11
  12. package/dist/lib/types/conversation.d.ts +27 -27
  13. package/dist/lib/types/domainTypes.d.ts +12 -12
  14. package/dist/lib/types/evaluationTypes.d.ts +12 -12
  15. package/dist/lib/types/externalMcp.d.ts +20 -20
  16. package/dist/lib/types/guardrails.d.ts +18 -18
  17. package/dist/lib/types/middlewareTypes.d.ts +86 -23
  18. package/dist/lib/types/providers.d.ts +72 -61
  19. package/dist/lib/types/providers.js +3 -0
  20. package/dist/lib/types/sdkTypes.d.ts +2 -2
  21. package/dist/lib/types/streamTypes.d.ts +8 -8
  22. package/dist/lib/types/tools.d.ts +79 -1
  23. package/dist/lib/types/utilities.d.ts +29 -0
  24. package/dist/lib/types/utilities.js +5 -0
  25. package/dist/lib/utils/providerConfig.d.ts +3 -22
  26. package/dist/lib/utils/timeout.d.ts +1 -16
  27. package/dist/neurolink.d.ts +2 -1
  28. package/dist/types/common.d.ts +18 -61
  29. package/dist/types/content.d.ts +21 -10
  30. package/dist/types/contextTypes.d.ts +11 -11
  31. package/dist/types/conversation.d.ts +27 -27
  32. package/dist/types/domainTypes.d.ts +12 -12
  33. package/dist/types/evaluationTypes.d.ts +12 -12
  34. package/dist/types/externalMcp.d.ts +20 -20
  35. package/dist/types/guardrails.d.ts +18 -18
  36. package/dist/types/middlewareTypes.d.ts +86 -23
  37. package/dist/types/providers.d.ts +72 -61
  38. package/dist/types/providers.js +3 -0
  39. package/dist/types/sdkTypes.d.ts +2 -2
  40. package/dist/types/streamTypes.d.ts +8 -8
  41. package/dist/types/tools.d.ts +79 -1
  42. package/dist/types/utilities.d.ts +29 -0
  43. package/dist/types/utilities.js +4 -0
  44. package/dist/utils/providerConfig.d.ts +3 -22
  45. package/dist/utils/timeout.d.ts +1 -16
  46. package/package.json +1 -1
@@ -3,10 +3,10 @@ import type { JsonValue } from "../types/common.js";
3
3
  import type { EvaluationData } from "./evaluation.js";
4
4
  import type { GetPromptFunction } from "./evaluationTypes.js";
5
5
  /**
6
- * Metadata interface for NeuroLink middleware
6
+ * Metadata type for NeuroLink middleware
7
7
  * Provides additional information about middleware without affecting execution
8
8
  */
9
- export interface NeuroLinkMiddlewareMetadata {
9
+ export type NeuroLinkMiddlewareMetadata = {
10
10
  /** Unique identifier for the middleware */
11
11
  id: string;
12
12
  /** Human-readable name */
@@ -19,30 +19,30 @@ export interface NeuroLinkMiddlewareMetadata {
19
19
  defaultEnabled?: boolean;
20
20
  /** Configuration schema for the middleware */
21
21
  configSchema?: Record<string, unknown>;
22
- }
22
+ };
23
23
  /**
24
24
  * NeuroLink middleware with metadata
25
25
  * Combines standard AI SDK middleware with NeuroLink-specific metadata
26
26
  */
27
- export interface NeuroLinkMiddleware extends LanguageModelV1Middleware {
27
+ export type NeuroLinkMiddleware = LanguageModelV1Middleware & {
28
28
  /** Middleware metadata */
29
29
  readonly metadata: NeuroLinkMiddlewareMetadata;
30
- }
30
+ };
31
31
  /**
32
32
  * Middleware configuration options
33
33
  */
34
- export interface MiddlewareConfig {
34
+ export type MiddlewareConfig = {
35
35
  /** Whether the middleware is enabled */
36
36
  enabled?: boolean;
37
37
  /** Middleware-specific configuration */
38
38
  config?: Record<string, unknown>;
39
39
  /** Conditions under which to apply this middleware */
40
40
  conditions?: MiddlewareConditions;
41
- }
41
+ };
42
42
  /**
43
43
  * Conditions for applying middleware
44
44
  */
45
- export interface MiddlewareConditions {
45
+ export type MiddlewareConditions = {
46
46
  /** Apply only to specific providers */
47
47
  providers?: string[];
48
48
  /** Apply only to specific models */
@@ -51,11 +51,11 @@ export interface MiddlewareConditions {
51
51
  options?: Record<string, unknown>;
52
52
  /** Custom condition function */
53
53
  custom?: (context: MiddlewareContext) => boolean;
54
- }
54
+ };
55
55
  /**
56
56
  * Context passed to middleware for decision making
57
57
  */
58
- export interface MiddlewareContext {
58
+ export type MiddlewareContext = {
59
59
  /** Provider name */
60
60
  provider: string;
61
61
  /** Model name */
@@ -69,22 +69,22 @@ export interface MiddlewareContext {
69
69
  };
70
70
  /** Additional metadata */
71
71
  metadata?: Record<string, JsonValue>;
72
- }
72
+ };
73
73
  /**
74
74
  * Middleware registration options
75
75
  */
76
- export interface MiddlewareRegistrationOptions {
76
+ export type MiddlewareRegistrationOptions = {
77
77
  /** Whether to replace existing middleware with same ID */
78
78
  replace?: boolean;
79
79
  /** Whether to enable the middleware by default */
80
80
  defaultEnabled?: boolean;
81
81
  /** Global configuration for the middleware */
82
82
  globalConfig?: Record<string, JsonValue>;
83
- }
83
+ };
84
84
  /**
85
85
  * Middleware execution result
86
86
  */
87
- export interface MiddlewareExecutionResult {
87
+ export type MiddlewareExecutionResult = {
88
88
  /** Whether the middleware was applied */
89
89
  applied: boolean;
90
90
  /** Execution time in milliseconds */
@@ -93,11 +93,11 @@ export interface MiddlewareExecutionResult {
93
93
  error?: Error;
94
94
  /** Additional metadata from the middleware */
95
95
  metadata?: Record<string, JsonValue>;
96
- }
96
+ };
97
97
  /**
98
98
  * Middleware chain execution statistics
99
99
  */
100
- export interface MiddlewareChainStats {
100
+ export type MiddlewareChainStats = {
101
101
  /** Total number of middleware in the chain */
102
102
  totalMiddleware: number;
103
103
  /** Number of middleware that were applied */
@@ -106,7 +106,7 @@ export interface MiddlewareChainStats {
106
106
  totalExecutionTime: number;
107
107
  /** Individual middleware execution results */
108
108
  results: Record<string, MiddlewareExecutionResult>;
109
- }
109
+ };
110
110
  /**
111
111
  * Built-in middleware types
112
112
  */
@@ -114,18 +114,18 @@ export type BuiltInMiddlewareType = "analytics" | "guardrails" | "logging" | "ca
114
114
  /**
115
115
  * Middleware preset configurations
116
116
  */
117
- export interface MiddlewarePreset {
117
+ export type MiddlewarePreset = {
118
118
  /** Preset name */
119
119
  name: string;
120
120
  /** Description of the preset */
121
121
  description: string;
122
122
  /** Middleware configurations in the preset */
123
123
  config: Record<string, MiddlewareConfig>;
124
- }
124
+ };
125
125
  /**
126
126
  * Factory options for middleware
127
127
  */
128
- export interface MiddlewareFactoryOptions {
128
+ export type MiddlewareFactoryOptions = {
129
129
  /** Custom middleware to register on initialization */
130
130
  middleware?: NeuroLinkMiddleware[];
131
131
  /** Enable specific middleware */
@@ -145,11 +145,11 @@ export interface MiddlewareFactoryOptions {
145
145
  /** Whether to collect execution statistics */
146
146
  collectStats?: boolean;
147
147
  };
148
- }
148
+ };
149
149
  /**
150
150
  * Configuration for the Auto-Evaluation Middleware.
151
151
  */
152
- export interface AutoEvaluationConfig {
152
+ export type AutoEvaluationConfig = {
153
153
  /** The minimum score (1-10) for a response to be considered passing. */
154
154
  threshold?: number;
155
155
  /** The maximum number of retry attempts before failing. */
@@ -169,4 +169,67 @@ export interface AutoEvaluationConfig {
169
169
  highSeverityThreshold?: number;
170
170
  promptGenerator?: GetPromptFunction;
171
171
  provider?: string;
172
- }
172
+ };
173
+ /**
174
+ * Middleware factory configuration options
175
+ */
176
+ export type MiddlewareFactoryConfig = {
177
+ enabled: boolean;
178
+ type: string;
179
+ priority?: number;
180
+ config?: Record<string, unknown>;
181
+ };
182
+ /**
183
+ * Middleware registry entry
184
+ */
185
+ export type MiddlewareRegistryEntry = {
186
+ name: string;
187
+ factory: MiddlewareFactory;
188
+ defaultConfig: Record<string, unknown>;
189
+ description?: string;
190
+ version?: string;
191
+ };
192
+ /**
193
+ * Middleware factory function type
194
+ */
195
+ export type MiddlewareFactory = (config: Record<string, unknown>) => LanguageModelV1Middleware;
196
+ /**
197
+ * Middleware validation result
198
+ */
199
+ export type MiddlewareValidationResult = {
200
+ valid: boolean;
201
+ errors: string[];
202
+ warnings: string[];
203
+ };
204
+ /**
205
+ * Middleware execution context
206
+ */
207
+ export type MiddlewareExecutionContext = {
208
+ requestId: string;
209
+ timestamp: number;
210
+ provider: string;
211
+ model: string;
212
+ userId?: string;
213
+ sessionId?: string;
214
+ metadata?: Record<string, unknown>;
215
+ };
216
+ /**
217
+ * Middleware performance metrics
218
+ */
219
+ export type MiddlewareMetrics = {
220
+ name: string;
221
+ executionTime: number;
222
+ status: "success" | "error" | "skipped";
223
+ error?: string;
224
+ inputSize: number;
225
+ outputSize: number;
226
+ };
227
+ /**
228
+ * Middleware chain configuration
229
+ */
230
+ export type MiddlewareChainConfig = {
231
+ middlewares: MiddlewareFactoryConfig[];
232
+ errorHandling: "continue" | "stop" | "rollback";
233
+ timeout?: number;
234
+ retries?: number;
235
+ };
@@ -7,12 +7,6 @@ import type { ValidationSchema } from "./typeAliases.js";
7
7
  import type { EnhancedGenerateResult, GenerateResult, TextGenerationOptions } from "./generateTypes.js";
8
8
  import type { StreamOptions, StreamResult } from "./streamTypes.js";
9
9
  import type { ExternalMCPToolInfo } from "./externalMcp.js";
10
- /**
11
- * Generic AI SDK model interface
12
- */
13
- export type AISDKModel = {
14
- [key: string]: unknown;
15
- };
16
10
  /**
17
11
  * Supported AI Provider Names
18
12
  */
@@ -105,6 +99,12 @@ export declare enum APIVersions {
105
99
  GOOGLE_AI_BETA = "v1beta",
106
100
  ANTHROPIC_CURRENT = "2023-06-01"
107
101
  }
102
+ /**
103
+ * Generic AI SDK model interface
104
+ */
105
+ export type AISDKModel = {
106
+ [key: string]: unknown;
107
+ };
108
108
  /**
109
109
  * Union type of all supported model names
110
110
  */
@@ -284,7 +284,18 @@ export type IndividualProviderConfig = {
284
284
  [key: string]: unknown;
285
285
  };
286
286
  /**
287
- * AI Provider interface with flexible parameter support (converted from interface)
287
+ * Configuration options for provider validation
288
+ */
289
+ export type ProviderConfigOptions = {
290
+ providerName: string;
291
+ envVarName: string;
292
+ setupUrl: string;
293
+ description: string;
294
+ instructions: string[];
295
+ fallbackEnvVars?: string[];
296
+ };
297
+ /**
298
+ * AI Provider type with flexible parameter support
288
299
  */
289
300
  export type AIProvider = {
290
301
  stream(optionsOrPrompt: StreamOptions | string, analysisSchema?: ValidationSchema): Promise<StreamResult>;
@@ -314,59 +325,6 @@ export type ProviderCreationError = {
314
325
  provider: string;
315
326
  details?: Record<string, unknown>;
316
327
  };
317
- /**
318
- * Amazon Bedrock specific types
319
- */
320
- export declare namespace BedrockTypes {
321
- interface Client {
322
- send(command: unknown): Promise<unknown>;
323
- config: {
324
- region?: string;
325
- credentials?: unknown;
326
- };
327
- }
328
- interface InvokeModelCommand {
329
- input: {
330
- modelId: string;
331
- body: string;
332
- contentType?: string;
333
- };
334
- }
335
- }
336
- /**
337
- * Mistral specific types
338
- */
339
- export declare namespace MistralTypes {
340
- interface Client {
341
- chat?: {
342
- complete?: (options: unknown) => Promise<unknown>;
343
- stream?: (options: unknown) => AsyncIterable<unknown>;
344
- };
345
- }
346
- }
347
- /**
348
- * OpenTelemetry specific types (for telemetry service)
349
- */
350
- export declare namespace TelemetryTypes {
351
- interface Meter {
352
- createCounter(name: string, options?: unknown): Counter;
353
- createHistogram(name: string, options?: unknown): Histogram;
354
- }
355
- interface Tracer {
356
- startSpan(name: string, options?: unknown): Span;
357
- }
358
- interface Counter {
359
- add(value: number, attributes?: UnknownRecord): void;
360
- }
361
- interface Histogram {
362
- record(value: number, attributes?: UnknownRecord): void;
363
- }
364
- interface Span {
365
- end(): void;
366
- setStatus(status: unknown): void;
367
- recordException(exception: unknown): void;
368
- }
369
- }
370
328
  /**
371
329
  * Provider factory function type
372
330
  */
@@ -1028,7 +986,7 @@ export type EndpointMetrics = {
1028
986
  memoryUtilization?: number;
1029
987
  /** Instance count */
1030
988
  instanceCount: number;
1031
- /** Timestamp of metrics */
989
+ /** Timestamp of metrics as ISO 8601 date string */
1032
990
  timestamp: string;
1033
991
  };
1034
992
  /**
@@ -1102,3 +1060,56 @@ export type SageMakerGenerateResult = {
1102
1060
  toolCalls?: SageMakerToolCall[];
1103
1061
  object?: unknown;
1104
1062
  };
1063
+ /**
1064
+ * Amazon Bedrock specific types
1065
+ */
1066
+ export declare namespace BedrockTypes {
1067
+ interface Client {
1068
+ send(command: unknown): Promise<unknown>;
1069
+ config: {
1070
+ region?: string;
1071
+ credentials?: unknown;
1072
+ };
1073
+ }
1074
+ interface InvokeModelCommand {
1075
+ input: {
1076
+ modelId: string;
1077
+ body: string;
1078
+ contentType?: string;
1079
+ };
1080
+ }
1081
+ }
1082
+ /**
1083
+ * Mistral specific types
1084
+ */
1085
+ export declare namespace MistralTypes {
1086
+ interface Client {
1087
+ chat?: {
1088
+ complete?: (options: unknown) => Promise<unknown>;
1089
+ stream?: (options: unknown) => AsyncIterable<unknown>;
1090
+ };
1091
+ }
1092
+ }
1093
+ /**
1094
+ * OpenTelemetry specific types (for telemetry service)
1095
+ */
1096
+ export declare namespace TelemetryTypes {
1097
+ interface Meter {
1098
+ createCounter(name: string, options?: unknown): Counter;
1099
+ createHistogram(name: string, options?: unknown): Histogram;
1100
+ }
1101
+ interface Tracer {
1102
+ startSpan(name: string, options?: unknown): Span;
1103
+ }
1104
+ interface Counter {
1105
+ add(value: number, attributes?: UnknownRecord): void;
1106
+ }
1107
+ interface Histogram {
1108
+ record(value: number, attributes?: UnknownRecord): void;
1109
+ }
1110
+ interface Span {
1111
+ end(): void;
1112
+ setStatus(status: unknown): void;
1113
+ recordException(exception: unknown): void;
1114
+ }
1115
+ }
@@ -1,6 +1,9 @@
1
1
  /**
2
2
  * Provider-specific type definitions for NeuroLink
3
3
  */
4
+ // ============================================================================
5
+ // ENUMS
6
+ // ============================================================================
4
7
  /**
5
8
  * Supported AI Provider Names
6
9
  */
@@ -8,9 +8,9 @@
8
8
  export type { StreamResult, StreamingProgressData, StreamingMetadata, ProgressCallback, ToolCall as StreamToolCall, // Note: Renamed in main index to avoid conflict with tools.js ToolCall
9
9
  ToolResult as StreamToolResult, // Note: Renamed in main index to avoid conflict with tools.js ToolResult
10
10
  ToolCallResults, ToolCalls, StreamOptions, StreamingOptions, EnhancedStreamProvider, StreamTextResult, AISDKUsage, StreamAnalyticsCollector, ResponseMetadata, AudioInputSpec, AudioChunk, PCMEncoding, } from "./streamTypes.js";
11
- export type { ToolExecutionEvent, ToolExecutionSummary, TypedEventEmitter, NeuroLinkEvents, StreamEvent, ToolExecutionContext, AsyncFunction, SyncFunction, AnyFunction, } from "./common.js";
11
+ export type { TypedEventEmitter, NeuroLinkEvents, StreamEvent, AsyncFunction, SyncFunction, AnyFunction, } from "./common.js";
12
12
  export type { NeuroLinkConfig, ProviderConfig, PerformanceConfig, CacheConfig, FallbackConfig, RetryConfig, AnalyticsConfig, ToolConfig, BackupInfo, BackupMetadata, ConfigValidationResult, ConfigUpdateOptions, } from "./configTypes.js";
13
- export type { ToolArgs, ToolContext, ToolResult, ToolDefinition, SimpleTool, AvailableTool, ToolExecution, BaseToolArgs, ToolExecutionMetadata, ToolParameterSchema, ZodUnknownSchema, ZodAnySchema, ZodObjectSchema, ZodStringSchema, } from "./tools.js";
13
+ export type { ToolArgs, ToolContext, ToolResult, ToolDefinition, SimpleTool, AvailableTool, ToolExecution, BaseToolArgs, ToolExecutionEvent, ToolExecutionSummary, ToolExecutionContext, ToolExecutionMetadata, ToolParameterSchema, ZodUnknownSchema, ZodAnySchema, ZodObjectSchema, ZodStringSchema, } from "./tools.js";
14
14
  export type { AISDKModel, ProviderError, AIModelProviderConfig, AIProviderName, ProviderName, ModelCapability, ModelUseCase, ModelFilter, ModelResolutionContext, ModelStats, ModelPricing, ProviderCapabilities, } from "./providers.js";
15
15
  export type { GenerateOptions, GenerateResult, UnifiedGenerationOptions, EnhancedProvider, FactoryEnhancedProvider, TextGenerationOptions, TextGenerationResult, EnhancedGenerateResult, } from "./generateTypes.js";
16
16
  export type { TokenUsage, AnalyticsData } from "./analytics.js";
@@ -2,10 +2,10 @@ import type { Tool } from "ai";
2
2
  import type { ValidationSchema, StandardRecord } from "./typeAliases.js";
3
3
  import type { AIModelProviderConfig } from "./providers.js";
4
4
  import type { TextContent, ImageContent } from "./content.js";
5
- import type { AIProviderName, AnalyticsData } from "../types/index.js";
5
+ import type { AIProviderName, AnalyticsData, ToolExecutionEvent, ToolExecutionSummary } from "../types/index.js";
6
6
  import type { TokenUsage } from "./analytics.js";
7
7
  import type { EvaluationData } from "../index.js";
8
- import type { UnknownRecord, JsonValue, ToolExecutionEvent, ToolExecutionSummary } from "./common.js";
8
+ import type { UnknownRecord, JsonValue } from "./common.js";
9
9
  import type { MiddlewareFactoryOptions } from "../types/middlewareTypes.js";
10
10
  import type { ChatMessage } from "./conversation.js";
11
11
  /**
@@ -108,19 +108,19 @@ export type StreamAnalyticsData = {
108
108
  * Future-ready for multi-modal capabilities while maintaining text focus
109
109
  */
110
110
  export type PCMEncoding = "PCM16LE";
111
- export interface AudioInputSpec {
111
+ export type AudioInputSpec = {
112
112
  frames: AsyncIterable<Buffer>;
113
113
  sampleRateHz?: number;
114
114
  encoding?: PCMEncoding;
115
115
  channels?: 1;
116
- }
117
- export interface AudioChunk {
116
+ };
117
+ export type AudioChunk = {
118
118
  data: Buffer;
119
119
  sampleRateHz: number;
120
120
  channels: number;
121
121
  encoding: PCMEncoding;
122
- }
123
- export interface StreamOptions {
122
+ };
123
+ export type StreamOptions = {
124
124
  input: {
125
125
  text: string;
126
126
  audio?: AudioInputSpec;
@@ -179,7 +179,7 @@ export interface StreamOptions {
179
179
  };
180
180
  conversationMessages?: ChatMessage[];
181
181
  middleware?: MiddlewareFactoryOptions;
182
- }
182
+ };
183
183
  /**
184
184
  * Stream function result type - Primary output format for streaming
185
185
  * Future-ready for multi-modal outputs while maintaining text focus
@@ -3,7 +3,7 @@
3
3
  * argument patterns, execution metadata, context, and result types.
4
4
  */
5
5
  import { z } from "zod";
6
- import type { Result, JsonValue, ErrorInfo } from "./common.js";
6
+ import type { ErrorInfo, JsonObject, JsonValue, Result, UnknownRecord } from "./common.js";
7
7
  import type { StandardRecord, ZodUnknownSchema } from "./typeAliases.js";
8
8
  /**
9
9
  * Commonly used Zod schema type aliases for cleaner type declarations
@@ -176,6 +176,63 @@ export type ToolMetadata = {
176
176
  documentation?: string;
177
177
  [key: string]: JsonValue | undefined;
178
178
  };
179
+ /**
180
+ * Tool call object type for type-safe access to tool call properties
181
+ */
182
+ export type ToolCallObject = UnknownRecord & {
183
+ toolName?: string;
184
+ name?: string;
185
+ toolCallId?: string;
186
+ id?: string;
187
+ args?: UnknownRecord;
188
+ arguments?: UnknownRecord;
189
+ };
190
+ /**
191
+ * Tool execution context for tracking
192
+ */
193
+ export type ToolExecutionContext = {
194
+ executionId: string;
195
+ tool: string;
196
+ startTime: number;
197
+ endTime?: number;
198
+ result?: unknown;
199
+ error?: string;
200
+ metadata?: JsonObject;
201
+ };
202
+ /**
203
+ * NeuroLink Native Event System Types
204
+ */
205
+ /**
206
+ * Tool execution event for real-time streaming
207
+ */
208
+ export type ToolExecutionEvent = {
209
+ type: "tool:start" | "tool:end";
210
+ tool: string;
211
+ input?: unknown;
212
+ result?: unknown;
213
+ error?: string;
214
+ timestamp: number;
215
+ duration?: number;
216
+ executionId: string;
217
+ };
218
+ /**
219
+ * Tool execution summary for completed executions
220
+ */
221
+ export type ToolExecutionSummary = {
222
+ tool: string;
223
+ startTime: number;
224
+ endTime: number;
225
+ duration: number;
226
+ success: boolean;
227
+ result?: unknown;
228
+ error?: string;
229
+ executionId: string;
230
+ metadata?: {
231
+ serverId?: string;
232
+ toolCategory?: "direct" | "custom" | "mcp";
233
+ isExternal?: boolean;
234
+ };
235
+ };
179
236
  /**
180
237
  * Tool definition type
181
238
  */
@@ -215,6 +272,27 @@ export type ToolExecution = {
215
272
  executionTime: number;
216
273
  timestamp: number;
217
274
  };
275
+ /**
276
+ * Pending tool execution type for Redis memory manager
277
+ * Temporary storage for tool execution data to avoid race conditions
278
+ */
279
+ export type PendingToolExecution = {
280
+ toolCalls: Array<{
281
+ toolCallId?: string;
282
+ toolName?: string;
283
+ args?: Record<string, unknown>;
284
+ timestamp?: Date;
285
+ [key: string]: unknown;
286
+ }>;
287
+ toolResults: Array<{
288
+ toolCallId?: string;
289
+ result?: unknown;
290
+ error?: string;
291
+ timestamp?: Date;
292
+ [key: string]: unknown;
293
+ }>;
294
+ timestamp: number;
295
+ };
218
296
  /**
219
297
  * Available tool information
220
298
  */
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Utility module types - extracted from utils module files
3
+ */
4
+ export type TimeoutConfig = {
5
+ operation: string;
6
+ timeout?: number | string;
7
+ gracefulShutdown?: boolean;
8
+ retryOnTimeout?: boolean;
9
+ maxRetries?: number;
10
+ abortSignal?: AbortSignal;
11
+ };
12
+ export type TimeoutResult<T> = {
13
+ success: boolean;
14
+ data?: T;
15
+ error?: Error;
16
+ timedOut: boolean;
17
+ executionTime: number;
18
+ retriesUsed: number;
19
+ };
20
+ /**
21
+ * Enhanced validation result with format checking
22
+ */
23
+ export type APIValidationResult = {
24
+ isValid: boolean;
25
+ apiKey: string;
26
+ formatValid?: boolean;
27
+ errorType?: "missing" | "format" | "config";
28
+ error?: string;
29
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Utility module types - extracted from utils module files
3
+ */
4
+ export {};
@@ -4,17 +4,8 @@
4
4
  * Eliminates duplicate error messages and configuration logic
5
5
  * Enhanced with format validation and advanced error classification
6
6
  */
7
- /**
8
- * Configuration options for provider validation
9
- */
10
- export interface ProviderConfigOptions {
11
- providerName: string;
12
- envVarName: string;
13
- setupUrl: string;
14
- description: string;
15
- instructions: string[];
16
- fallbackEnvVars?: string[];
17
- }
7
+ import type { APIValidationResult } from "../types/utilities.js";
8
+ import type { ProviderConfigOptions } from "../types/providers.js";
18
9
  /**
19
10
  * API key format validation patterns (extracted from advanced validation system)
20
11
  * Exported for use across the codebase to replace scattered regex patterns
@@ -40,16 +31,6 @@ export declare const PROJECT_ID_FORMAT: {
40
31
  readonly MAX_LENGTH: 30;
41
32
  readonly PATTERN: RegExp;
42
33
  };
43
- /**
44
- * Enhanced validation result with format checking
45
- */
46
- export interface ValidationResult {
47
- isValid: boolean;
48
- apiKey: string;
49
- formatValid?: boolean;
50
- errorType?: "missing" | "format" | "config";
51
- error?: string;
52
- }
53
34
  /**
54
35
  * Validates API key format for a specific provider
55
36
  * @param providerKey Provider identifier (e.g., 'openai', 'anthropic')
@@ -63,7 +44,7 @@ export declare function validateApiKeyFormat(providerKey: string, apiKey: string
63
44
  * @param enableFormatValidation Whether to validate API key format
64
45
  * @returns Validation result with detailed information
65
46
  */
66
- export declare function validateApiKeyEnhanced(config: ProviderConfigOptions, enableFormatValidation?: boolean): ValidationResult;
47
+ export declare function validateApiKeyEnhanced(config: ProviderConfigOptions, enableFormatValidation?: boolean): APIValidationResult;
67
48
  /**
68
49
  * Validates an API key for a provider and returns it (BACKWARD COMPATIBLE)
69
50
  * Throws detailed error message if validation fails
@@ -4,6 +4,7 @@
4
4
  * Provides flexible timeout parsing and error handling for AI operations.
5
5
  * Supports multiple time formats: milliseconds, seconds, minutes, hours.
6
6
  */
7
+ import type { TimeoutConfig, TimeoutResult } from "../types/utilities.js";
7
8
  /**
8
9
  * Custom error class for timeout operations
9
10
  */
@@ -66,22 +67,6 @@ export declare function getDefaultTimeout(provider: string, operation?: "generat
66
67
  * @returns Promise that rejects with TimeoutError
67
68
  */
68
69
  export declare function createTimeoutPromise(timeout: number | string | undefined, provider: string, operation: "generate" | "stream"): Promise<never> | null;
69
- export interface TimeoutConfig {
70
- operation: string;
71
- timeout?: number | string;
72
- gracefulShutdown?: boolean;
73
- retryOnTimeout?: boolean;
74
- maxRetries?: number;
75
- abortSignal?: AbortSignal;
76
- }
77
- export interface TimeoutResult<T> {
78
- success: boolean;
79
- data?: T;
80
- error?: Error;
81
- timedOut: boolean;
82
- executionTime: number;
83
- retriesUsed: number;
84
- }
85
70
  /**
86
71
  * Enhanced timeout manager with proper cleanup and abort controller integration
87
72
  * Consolidated from timeout-manager.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "7.51.1",
3
+ "version": "7.51.2",
4
4
  "description": "Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and deploy AI applications with 9 major providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.",
5
5
  "author": {
6
6
  "name": "Juspay Technologies",