@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.
@@ -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
- // Detect environment
5
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
6
- const isBrowser = typeof globalThis !== "undefined" && globalThis.window !== undefined;
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
- this._isBrowser = isBrowser;
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.37",
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": "e09481a460ec7f5ee25a01da9bac6214e3a3f745",
66
+ "commit": "c701e3df0f8c8fbce1dd509c59b2ed4ec296e566",
67
67
  "scripts": {
68
68
  "lint": "eslint src/",
69
69
  "dev": "tsc --watch",