@juspay/neurolink 7.14.4 → 7.14.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [7.14.6](https://github.com/juspay/neurolink/compare/v7.14.5...v7.14.6) (2025-08-18)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **(docs):** improve and update cli guide ([4039044](https://github.com/juspay/neurolink/commit/40390444950f763f4e360783f99256b16eb9aab0))
6
+
7
+ ## [7.14.5](https://github.com/juspay/neurolink/compare/v7.14.4...v7.14.5) (2025-08-18)
8
+
9
+ ### Bug Fixes
10
+
11
+ - **(mcp):** prevent memory leak from uncleared interval timer in MCPCircuitBreaker ([1f2ae47](https://github.com/juspay/neurolink/commit/1f2ae4743dc8657baac9ba28a053c4e9d199cdbc))
12
+
1
13
  ## [7.14.4](https://github.com/juspay/neurolink/compare/v7.14.3...v7.14.4) (2025-08-18)
2
14
 
3
15
  ### Bug Fixes
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  > **Enterprise AI Development Platform** with universal provider support, factory pattern architecture, and **access to 100+ AI models** through LiteLLM integration. Production-ready with TypeScript support.
11
11
 
12
- **NeuroLink** is an Enterprise AI Development Platform that unifies **11 major AI providers** with intelligent fallback and built-in tool support. Available as both a **programmatic SDK** and **professional CLI tool**. Features LiteLLM integration for **100+ models**, plus 6 core tools working across all providers. Extracted from production use at Juspay.
12
+ **NeuroLink** is an Enterprise AI Development Platform that unifies **12 major AI providers** with intelligent fallback and built-in tool support. Available as both a **programmatic SDK** and **professional CLI tool**. Features LiteLLM integration for **100+ models**, plus 6 core tools working across all providers. Extracted from production use at Juspay.
13
13
 
14
14
  ## 🎉 **NEW: LiteLLM Integration - Access 100+ AI Models**
15
15
 
@@ -102,7 +102,7 @@ npx @juspay/neurolink generate "Hello, AI" --provider openai-compatible
102
102
  export GOOGLE_AI_API_KEY="AIza-your-google-ai-api-key"
103
103
  npx @juspay/neurolink generate "Hello, AI" --provider google-ai
104
104
 
105
- # Option 3: Amazon SageMaker - Use your custom deployed models
105
+ # Option 4: Amazon SageMaker - Use your custom deployed models
106
106
  export AWS_ACCESS_KEY_ID="your-access-key"
107
107
  export AWS_SECRET_ACCESS_KEY="your-secret-key"
108
108
  export SAGEMAKER_DEFAULT_ENDPOINT="your-endpoint-name"
@@ -204,10 +204,9 @@ const neurolink = new NeuroLink({
204
204
  Method aliases that match CLI command names:
205
205
 
206
206
  ```typescript
207
- // All three methods are equivalent:
207
+ // The following methods are equivalent:
208
208
  const result1 = await provider.generate({ input: { text: "Hello" } }); // Original
209
- const result2 = await provider.generate({ input: { text: "Hello" } }); // Matches CLI 'generate'
210
- const result3 = await provider.gen({ input: { text: "Hello" } }); // Matches CLI 'gen'
209
+ const result2 = await provider.gen({ input: { text: "Hello" } }); // Matches CLI 'gen'
211
210
 
212
211
  // Use whichever style you prefer:
213
212
  const provider = createBestAIProvider();
@@ -336,7 +335,7 @@ const productData = JSON.parse(result.content);
336
335
  console.log(productData.name, productData.price, productData.features);
337
336
  ```
338
337
 
339
- **📖 [Complete Setup Guide](./docs/PROVIDER-CONFIGURATION.md)** - All providers with detailed instructions
338
+ **📖 [Complete Setup Guide](./docs/CONFIGURATION.md)** - All providers with detailed instructions
340
339
 
341
340
  ## ✨ Key Features
342
341
 
@@ -807,5 +806,3 @@ MIT © [Juspay Technologies](https://juspay.in)
807
806
  <p align="center">
808
807
  <strong>Built with ❤️ by <a href="https://juspay.in">Juspay Technologies</a></strong>
809
808
  </p>
810
- # Force fresh deployment after GitHub Pages source change
811
- # Trigger fresh CI run
@@ -91,6 +91,7 @@ export declare class MCPCircuitBreaker extends EventEmitter {
91
91
  private lastFailureTime;
92
92
  private halfOpenCalls;
93
93
  private lastStateChange;
94
+ private cleanupTimer?;
94
95
  constructor(name: string, config?: Partial<CircuitBreakerConfig>);
95
96
  /**
96
97
  * Execute an operation with circuit breaker protection
@@ -144,6 +145,12 @@ export declare class MCPCircuitBreaker extends EventEmitter {
144
145
  * Check if circuit is half-open
145
146
  */
146
147
  isHalfOpen(): boolean;
148
+ /**
149
+ * Destroy the circuit breaker and clean up resources
150
+ * This method should be called when the circuit breaker is no longer needed
151
+ * to prevent memory leaks from the cleanup timer
152
+ */
153
+ destroy(): void;
147
154
  }
148
155
  /**
149
156
  * Circuit breaker manager for multiple circuit breakers
@@ -155,7 +162,7 @@ export declare class CircuitBreakerManager {
155
162
  */
156
163
  getBreaker(name: string, config?: Partial<CircuitBreakerConfig>): MCPCircuitBreaker;
157
164
  /**
158
- * Remove a circuit breaker
165
+ * Remove a circuit breaker and clean up its resources
159
166
  */
160
167
  removeBreaker(name: string): boolean;
161
168
  /**
@@ -180,5 +187,10 @@ export declare class CircuitBreakerManager {
180
187
  halfOpenBreakers: number;
181
188
  unhealthyBreakers: string[];
182
189
  };
190
+ /**
191
+ * Destroy all circuit breakers and clean up their resources
192
+ * This should be called during application shutdown to prevent memory leaks
193
+ */
194
+ destroyAll(): void;
183
195
  }
184
196
  export declare const globalCircuitBreakerManager: CircuitBreakerManager;
@@ -17,6 +17,8 @@ export class MCPCircuitBreaker extends EventEmitter {
17
17
  lastFailureTime = 0;
18
18
  halfOpenCalls = 0;
19
19
  lastStateChange = new Date();
20
+ // Store the cleanup timer reference for proper cleanup
21
+ cleanupTimer;
20
22
  constructor(name, config = {}) {
21
23
  super();
22
24
  this.name = name;
@@ -29,8 +31,8 @@ export class MCPCircuitBreaker extends EventEmitter {
29
31
  minimumCallsBeforeCalculation: config.minimumCallsBeforeCalculation ?? 10,
30
32
  statisticsWindowSize: config.statisticsWindowSize ?? 300000, // 5 minutes
31
33
  };
32
- // Clean up old call records periodically
33
- setInterval(() => this.cleanupCallHistory(), 60000);
34
+ // Clean up old call records periodically - now storing the timer reference
35
+ this.cleanupTimer = setInterval(() => this.cleanupCallHistory(), 60000);
34
36
  }
35
37
  /**
36
38
  * Execute an operation with circuit breaker protection
@@ -250,6 +252,24 @@ export class MCPCircuitBreaker extends EventEmitter {
250
252
  isHalfOpen() {
251
253
  return this.state === "half-open";
252
254
  }
255
+ /**
256
+ * Destroy the circuit breaker and clean up resources
257
+ * This method should be called when the circuit breaker is no longer needed
258
+ * to prevent memory leaks from the cleanup timer
259
+ */
260
+ destroy() {
261
+ // Clear the interval timer to prevent memory leaks
262
+ if (this.cleanupTimer) {
263
+ clearInterval(this.cleanupTimer);
264
+ this.cleanupTimer = undefined;
265
+ mcpLogger.debug(`[CircuitBreaker:${this.name}] Cleanup timer cleared`);
266
+ }
267
+ // Clear any remaining event listeners
268
+ this.removeAllListeners();
269
+ // Clear call history to free memory
270
+ this.callHistory = [];
271
+ mcpLogger.debug(`[CircuitBreaker:${this.name}] Destroyed and cleaned up`);
272
+ }
253
273
  }
254
274
  /**
255
275
  * Circuit breaker manager for multiple circuit breakers
@@ -268,14 +288,18 @@ export class CircuitBreakerManager {
268
288
  return this.breakers.get(name);
269
289
  }
270
290
  /**
271
- * Remove a circuit breaker
291
+ * Remove a circuit breaker and clean up its resources
272
292
  */
273
293
  removeBreaker(name) {
274
- const removed = this.breakers.delete(name);
275
- if (removed) {
276
- mcpLogger.debug(`[CircuitBreakerManager] Removed circuit breaker: ${name}`);
294
+ const breaker = this.breakers.get(name);
295
+ if (breaker) {
296
+ // Destroy the breaker to clean up its timer and resources
297
+ breaker.destroy();
298
+ this.breakers.delete(name);
299
+ mcpLogger.debug(`[CircuitBreakerManager] Removed and cleaned up circuit breaker: ${name}`);
300
+ return true;
277
301
  }
278
- return removed;
302
+ return false;
279
303
  }
280
304
  /**
281
305
  * Get all circuit breaker names
@@ -333,6 +357,17 @@ export class CircuitBreakerManager {
333
357
  unhealthyBreakers,
334
358
  };
335
359
  }
360
+ /**
361
+ * Destroy all circuit breakers and clean up their resources
362
+ * This should be called during application shutdown to prevent memory leaks
363
+ */
364
+ destroyAll() {
365
+ for (const breaker of this.breakers.values()) {
366
+ breaker.destroy();
367
+ }
368
+ this.breakers.clear();
369
+ mcpLogger.info("[CircuitBreakerManager] Destroyed all circuit breakers");
370
+ }
336
371
  }
337
372
  // Global circuit breaker manager instance
338
373
  export const globalCircuitBreakerManager = new CircuitBreakerManager();
@@ -91,6 +91,7 @@ export declare class MCPCircuitBreaker extends EventEmitter {
91
91
  private lastFailureTime;
92
92
  private halfOpenCalls;
93
93
  private lastStateChange;
94
+ private cleanupTimer?;
94
95
  constructor(name: string, config?: Partial<CircuitBreakerConfig>);
95
96
  /**
96
97
  * Execute an operation with circuit breaker protection
@@ -144,6 +145,12 @@ export declare class MCPCircuitBreaker extends EventEmitter {
144
145
  * Check if circuit is half-open
145
146
  */
146
147
  isHalfOpen(): boolean;
148
+ /**
149
+ * Destroy the circuit breaker and clean up resources
150
+ * This method should be called when the circuit breaker is no longer needed
151
+ * to prevent memory leaks from the cleanup timer
152
+ */
153
+ destroy(): void;
147
154
  }
148
155
  /**
149
156
  * Circuit breaker manager for multiple circuit breakers
@@ -155,7 +162,7 @@ export declare class CircuitBreakerManager {
155
162
  */
156
163
  getBreaker(name: string, config?: Partial<CircuitBreakerConfig>): MCPCircuitBreaker;
157
164
  /**
158
- * Remove a circuit breaker
165
+ * Remove a circuit breaker and clean up its resources
159
166
  */
160
167
  removeBreaker(name: string): boolean;
161
168
  /**
@@ -180,5 +187,10 @@ export declare class CircuitBreakerManager {
180
187
  halfOpenBreakers: number;
181
188
  unhealthyBreakers: string[];
182
189
  };
190
+ /**
191
+ * Destroy all circuit breakers and clean up their resources
192
+ * This should be called during application shutdown to prevent memory leaks
193
+ */
194
+ destroyAll(): void;
183
195
  }
184
196
  export declare const globalCircuitBreakerManager: CircuitBreakerManager;
@@ -17,6 +17,8 @@ export class MCPCircuitBreaker extends EventEmitter {
17
17
  lastFailureTime = 0;
18
18
  halfOpenCalls = 0;
19
19
  lastStateChange = new Date();
20
+ // Store the cleanup timer reference for proper cleanup
21
+ cleanupTimer;
20
22
  constructor(name, config = {}) {
21
23
  super();
22
24
  this.name = name;
@@ -29,8 +31,8 @@ export class MCPCircuitBreaker extends EventEmitter {
29
31
  minimumCallsBeforeCalculation: config.minimumCallsBeforeCalculation ?? 10,
30
32
  statisticsWindowSize: config.statisticsWindowSize ?? 300000, // 5 minutes
31
33
  };
32
- // Clean up old call records periodically
33
- setInterval(() => this.cleanupCallHistory(), 60000);
34
+ // Clean up old call records periodically - now storing the timer reference
35
+ this.cleanupTimer = setInterval(() => this.cleanupCallHistory(), 60000);
34
36
  }
35
37
  /**
36
38
  * Execute an operation with circuit breaker protection
@@ -250,6 +252,24 @@ export class MCPCircuitBreaker extends EventEmitter {
250
252
  isHalfOpen() {
251
253
  return this.state === "half-open";
252
254
  }
255
+ /**
256
+ * Destroy the circuit breaker and clean up resources
257
+ * This method should be called when the circuit breaker is no longer needed
258
+ * to prevent memory leaks from the cleanup timer
259
+ */
260
+ destroy() {
261
+ // Clear the interval timer to prevent memory leaks
262
+ if (this.cleanupTimer) {
263
+ clearInterval(this.cleanupTimer);
264
+ this.cleanupTimer = undefined;
265
+ mcpLogger.debug(`[CircuitBreaker:${this.name}] Cleanup timer cleared`);
266
+ }
267
+ // Clear any remaining event listeners
268
+ this.removeAllListeners();
269
+ // Clear call history to free memory
270
+ this.callHistory = [];
271
+ mcpLogger.debug(`[CircuitBreaker:${this.name}] Destroyed and cleaned up`);
272
+ }
253
273
  }
254
274
  /**
255
275
  * Circuit breaker manager for multiple circuit breakers
@@ -268,14 +288,18 @@ export class CircuitBreakerManager {
268
288
  return this.breakers.get(name);
269
289
  }
270
290
  /**
271
- * Remove a circuit breaker
291
+ * Remove a circuit breaker and clean up its resources
272
292
  */
273
293
  removeBreaker(name) {
274
- const removed = this.breakers.delete(name);
275
- if (removed) {
276
- mcpLogger.debug(`[CircuitBreakerManager] Removed circuit breaker: ${name}`);
294
+ const breaker = this.breakers.get(name);
295
+ if (breaker) {
296
+ // Destroy the breaker to clean up its timer and resources
297
+ breaker.destroy();
298
+ this.breakers.delete(name);
299
+ mcpLogger.debug(`[CircuitBreakerManager] Removed and cleaned up circuit breaker: ${name}`);
300
+ return true;
277
301
  }
278
- return removed;
302
+ return false;
279
303
  }
280
304
  /**
281
305
  * Get all circuit breaker names
@@ -333,6 +357,17 @@ export class CircuitBreakerManager {
333
357
  unhealthyBreakers,
334
358
  };
335
359
  }
360
+ /**
361
+ * Destroy all circuit breakers and clean up their resources
362
+ * This should be called during application shutdown to prevent memory leaks
363
+ */
364
+ destroyAll() {
365
+ for (const breaker of this.breakers.values()) {
366
+ breaker.destroy();
367
+ }
368
+ this.breakers.clear();
369
+ mcpLogger.info("[CircuitBreakerManager] Destroyed all circuit breakers");
370
+ }
336
371
  }
337
372
  // Global circuit breaker manager instance
338
373
  export const globalCircuitBreakerManager = new CircuitBreakerManager();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "7.14.4",
3
+ "version": "7.14.6",
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",