@blaxel/core 0.2.23-dev.171 → 0.2.23-dev.173
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/dist/mcp/client.js +7 -8
- package/package.json +1 -1
package/dist/mcp/client.js
CHANGED
|
@@ -49,25 +49,23 @@ class BlaxelMcpClientTransport {
|
|
|
49
49
|
throw new Error("Blaxel already started! If using Client class, note that connect() calls start() automatically.");
|
|
50
50
|
}
|
|
51
51
|
let attempts = 0;
|
|
52
|
-
|
|
52
|
+
const maxAttempts = Math.max(1, this._retry_max + 1); // Ensure at least 1 attempt
|
|
53
|
+
while (attempts < maxAttempts) {
|
|
53
54
|
try {
|
|
54
55
|
await this._connect();
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
58
|
catch (error) {
|
|
59
|
+
attempts++;
|
|
58
60
|
if (error instanceof Error) {
|
|
59
61
|
logger_js_1.logger.warn(error.stack ?? error.message);
|
|
60
62
|
}
|
|
61
|
-
attempts
|
|
62
|
-
if (attempts === this._retry_max) {
|
|
63
|
+
if (attempts >= maxAttempts) {
|
|
63
64
|
throw error;
|
|
64
65
|
}
|
|
65
66
|
logger_js_1.logger.debug(`WebSocket connection attempt ${attempts} failed, retrying in ${this._retry_delay}ms...`);
|
|
66
67
|
await delay(this._retry_delay);
|
|
67
68
|
}
|
|
68
|
-
finally {
|
|
69
|
-
attempts++;
|
|
70
|
-
}
|
|
71
69
|
}
|
|
72
70
|
}
|
|
73
71
|
_connect() {
|
|
@@ -197,7 +195,8 @@ class BlaxelMcpClientTransport {
|
|
|
197
195
|
}
|
|
198
196
|
async send(message) {
|
|
199
197
|
let attempts = 0;
|
|
200
|
-
|
|
198
|
+
const maxAttempts = Math.max(1, this._retry_max + 1); // Ensure at least 1 attempt
|
|
199
|
+
while (attempts < maxAttempts) {
|
|
201
200
|
try {
|
|
202
201
|
if (!this._socket || !this.isConnected) {
|
|
203
202
|
if (!this._socket) {
|
|
@@ -236,7 +235,7 @@ class BlaxelMcpClientTransport {
|
|
|
236
235
|
}
|
|
237
236
|
catch (error) {
|
|
238
237
|
attempts++;
|
|
239
|
-
if (attempts
|
|
238
|
+
if (attempts >= maxAttempts) {
|
|
240
239
|
throw error;
|
|
241
240
|
}
|
|
242
241
|
logger_js_1.logger.warn(`WebSocket send attempt ${attempts} failed, retrying in ${this._retry_delay}ms...`);
|