@blaxel/core 0.2.16-dev.100 → 0.2.16-dev.99

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.
@@ -15,6 +15,7 @@ let dotenv = null;
15
15
  exports.dotenv = dotenv;
16
16
  let ws = null;
17
17
  exports.ws = ws;
18
+ const isBrowser = typeof globalThis !== "undefined" && globalThis && globalThis.window !== undefined;
18
19
  if (isNode) {
19
20
  try {
20
21
  exports.fs = fs = eval("require")("fs");
@@ -27,3 +28,12 @@ if (isNode) {
27
28
  console.warn("fs, os, path, dotenv, ws are not available in this environment");
28
29
  }
29
30
  }
31
+ // cloudflare
32
+ else if (!isBrowser) {
33
+ try {
34
+ exports.ws = ws = eval("require")("ws");
35
+ }
36
+ catch (e) {
37
+ console.warn("ws is not available in this environment");
38
+ }
39
+ }
@@ -7,10 +7,6 @@ const node_js_1 = require("../common/node.js");
7
7
  const settings_js_1 = require("../common/settings.js");
8
8
  // Detect environment
9
9
  const isBrowser = typeof globalThis !== "undefined" && globalThis && globalThis.window !== undefined;
10
- // Add Cloudflare detection
11
- const isCloudflare = typeof globalThis !== "undefined" &&
12
- typeof globalThis.WebSocket !== "undefined" &&
13
- !globalThis.window;
14
10
  //const SUBPROTOCOL = "mcp";
15
11
  const MAX_RETRIES = 3;
16
12
  const RETRY_DELAY_MS = 1000;
@@ -59,12 +55,9 @@ class BlaxelMcpClientTransport {
59
55
  _connect() {
60
56
  return new Promise((resolve, reject) => {
61
57
  try {
62
- let url = this._url.toString();
63
58
  if (this._isBrowser) {
64
- url += `?token=${settings_js_1.settings.token}`;
65
- }
66
- if (isCloudflare || this._isBrowser) {
67
- // Use native WebSocket (works in both browser and Cloudflare)
59
+ // Use native browser WebSocket
60
+ const url = `${this._url.toString()}?token=${settings_js_1.settings.token}`;
68
61
  this._socket = new WebSocket(url);
69
62
  }
70
63
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/core",
3
- "version": "0.2.16-dev.100",
3
+ "version": "0.2.16-dev.99",
4
4
  "description": "Blaxel Core SDK for TypeScript",
5
5
  "license": "MIT",
6
6
  "author": "Blaxel, INC (https://blaxel.ai)",