@juspay/neurolink 7.14.3 → 7.14.5
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.5](https://github.com/juspay/neurolink/compare/v7.14.4...v7.14.5) (2025-08-18)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- **(mcp):** prevent memory leak from uncleared interval timer in MCPCircuitBreaker ([1f2ae47](https://github.com/juspay/neurolink/commit/1f2ae4743dc8657baac9ba28a053c4e9d199cdbc))
|
|
6
|
+
|
|
7
|
+
## [7.14.4](https://github.com/juspay/neurolink/compare/v7.14.3...v7.14.4) (2025-08-18)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **(docs):** use pnpm in setup script and correct modelServer run command BZ-43341 ([fcfa465](https://github.com/juspay/neurolink/commit/fcfa465ef5af7656dc066fd5901c738588609d4e))
|
|
12
|
+
|
|
1
13
|
## [7.14.3](https://github.com/juspay/neurolink/compare/v7.14.2...v7.14.3) (2025-08-16)
|
|
2
14
|
|
|
3
15
|
### Bug Fixes
|
|
@@ -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
|
|
275
|
-
if (
|
|
276
|
-
|
|
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
|
|
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
|
|
275
|
-
if (
|
|
276
|
-
|
|
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
|
|
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.
|
|
3
|
+
"version": "7.14.5",
|
|
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",
|