@blaxel/core 0.2.37 → 0.2.38
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/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/common/node.js +65 -8
- package/dist/cjs/common/settings.js +21 -11
- package/dist/cjs/mcp/client.js +6 -17
- package/dist/cjs/types/common/node.d.ts +2 -1
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/node.js +30 -7
- package/dist/esm/common/settings.js +21 -11
- package/dist/esm/mcp/client.js +6 -17
- package/package.json +2 -2
package/dist/esm/mcp/client.js
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
import { JSONRPCMessageSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
2
2
|
import { logger } from "../common/logger.js";
|
|
3
|
+
import { ws } from "../common/node.js";
|
|
3
4
|
import { settings } from "../common/settings.js";
|
|
4
|
-
//
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-
|
|
6
|
-
const
|
|
7
|
-
// Conditional import for Node.js WebSocket
|
|
8
|
-
let NodeWebSocket;
|
|
9
|
-
if (!isBrowser) {
|
|
10
|
-
try {
|
|
11
|
-
// Dynamic import for Node.js environment
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports
|
|
13
|
-
NodeWebSocket = require("ws");
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
console.warn("ws is not available in this environment");
|
|
17
|
-
// ws is not available
|
|
18
|
-
}
|
|
19
|
-
}
|
|
5
|
+
// Use WebSocket from centralized node module loading
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
7
|
+
const NodeWebSocket = ws;
|
|
20
8
|
//const SUBPROTOCOL = "mcp";
|
|
21
9
|
// Helper function to wait
|
|
22
10
|
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -39,7 +27,8 @@ export class BlaxelMcpClientTransport {
|
|
|
39
27
|
this._retry_max = options?.retry?.max ?? 3;
|
|
40
28
|
this._retry_delay = options?.retry?.delay ?? 1000;
|
|
41
29
|
this._headers = headers ?? {};
|
|
42
|
-
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
31
|
+
this._isBrowser = typeof globalThis !== "undefined" && (globalThis)?.window !== undefined;
|
|
43
32
|
}
|
|
44
33
|
async start() {
|
|
45
34
|
if (this._socket) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaxel/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.38",
|
|
4
4
|
"description": "Blaxel Core SDK for TypeScript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Blaxel, INC (https://blaxel.ai)",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"vite": "^5.2.0",
|
|
64
64
|
"vitest": "^1.5.0"
|
|
65
65
|
},
|
|
66
|
-
"commit": "
|
|
66
|
+
"commit": "c701e3df0f8c8fbce1dd509c59b2ed4ec296e566",
|
|
67
67
|
"scripts": {
|
|
68
68
|
"lint": "eslint src/",
|
|
69
69
|
"dev": "tsc --watch",
|