@blaxel/core 0.2.43-dev.194 → 0.2.43-dev.196

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.
@@ -34,18 +34,14 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  };
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.path = exports.os = exports.fs = exports.dotenv = void 0;
37
+ exports.ws = exports.path = exports.os = exports.fs = exports.dotenv = void 0;
38
38
  exports.getWebSocket = getWebSocket;
39
- // Import Node.js built-in modules using ES6 imports for ESM compatibility
40
- const fsImport = __importStar(require("fs"));
41
- const osImport = __importStar(require("os"));
42
- const pathImport = __importStar(require("path"));
43
39
  // Detect environments
44
40
  const isNode = typeof process !== "undefined" &&
45
41
  process.versions != null &&
46
42
  process.versions.node != null;
47
43
  const isBrowser = typeof globalThis !== "undefined" && globalThis?.window !== undefined;
48
- // Initialize modules
44
+ // Initialize modules without statically importing Node built-ins.
49
45
  let fs = null;
50
46
  exports.fs = fs;
51
47
  let os = null;
@@ -55,11 +51,27 @@ exports.path = path;
55
51
  let dotenv = null;
56
52
  exports.dotenv = dotenv;
57
53
  let ws = null; // Used internally by getWebSocket() for caching
54
+ exports.ws = ws;
58
55
  if (isNode && !isBrowser) {
59
- // Use the imported modules directly - these are Node.js built-ins, always available
60
- exports.fs = fs = fsImport;
61
- exports.os = os = osImport;
62
- exports.path = path = pathImport;
56
+ // Load Node-only modules lazily using eval("require") to avoid bundler static analysis
57
+ try {
58
+ exports.fs = fs = eval("require")("fs");
59
+ }
60
+ catch {
61
+ exports.fs = fs = null;
62
+ }
63
+ try {
64
+ exports.os = os = eval("require")("os");
65
+ }
66
+ catch {
67
+ exports.os = os = null;
68
+ }
69
+ try {
70
+ exports.path = path = eval("require")("path");
71
+ }
72
+ catch {
73
+ exports.path = path = null;
74
+ }
63
75
  // Try to load optional dependencies
64
76
  try {
65
77
  exports.dotenv = dotenv = eval("require")("dotenv");
@@ -69,11 +81,11 @@ if (isNode && !isBrowser) {
69
81
  exports.dotenv = dotenv = null;
70
82
  }
71
83
  try {
72
- ws = eval("require")("ws");
84
+ exports.ws = ws = eval("require")("ws");
73
85
  }
74
86
  catch {
75
87
  // Will be loaded dynamically via getWebSocket() when needed
76
- ws = null;
88
+ exports.ws = ws = null;
77
89
  }
78
90
  }
79
91
  // Async function to get WebSocket in any environment
@@ -98,7 +110,7 @@ async function getWebSocket() {
98
110
  const wsModule = await Promise.resolve().then(() => __importStar(require("ws")));
99
111
  const loadedWs = wsModule.default || wsModule;
100
112
  // Cache it for future use
101
- ws = loadedWs;
113
+ exports.ws = ws = loadedWs;
102
114
  return loadedWs;
103
115
  }
104
116
  catch (error) {
@@ -10,7 +10,7 @@ function getPackageVersion() {
10
10
  if (typeof require !== "undefined") {
11
11
  // Try to require package.json (Node.js only, gracefully fails in browser)
12
12
  // eslint-disable-next-line @typescript-eslint/no-require-imports
13
- const packageJson = {"version":"0.2.43-dev.194","commit":"eaaada70f38d291b78d12e2a295e9987cfc3d09b"};
13
+ const packageJson = {"version":"0.2.43-dev.196","commit":"06f9febf3efcdd8e281706bd186624c5f0c0a51b"};
14
14
  return packageJson.version || "unknown";
15
15
  }
16
16
  else {
@@ -39,12 +39,10 @@ function getOsArch() {
39
39
  }
40
40
  // Browser environment - use fixed detection
41
41
  try {
42
- // @ts-ignore - navigator is available in browser environments
43
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
44
- if (typeof navigator !== 'undefined' && navigator?.platform) {
45
- // @ts-ignore - navigator.platform is available in browser environments
46
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
47
- const navPlatform = navigator.platform.toLowerCase();
42
+ const g = globalThis;
43
+ const platformValue = g.navigator?.platform;
44
+ if (typeof platformValue === 'string') {
45
+ const navPlatform = platformValue.toLowerCase();
48
46
  const platform = navPlatform.includes('win') ? 'windows' :
49
47
  navPlatform.includes('mac') ? 'darwin' :
50
48
  navPlatform.includes('linux') ? 'linux' : 'browser';
@@ -64,7 +62,7 @@ function getCommitHash() {
64
62
  if (typeof require !== "undefined") {
65
63
  // Try to require package.json and look for commit field (set during build)
66
64
  // eslint-disable-next-line @typescript-eslint/no-require-imports
67
- const packageJson = {"version":"0.2.43-dev.194","commit":"eaaada70f38d291b78d12e2a295e9987cfc3d09b"};
65
+ const packageJson = {"version":"0.2.43-dev.196","commit":"06f9febf3efcdd8e281706bd186624c5f0c0a51b"};
68
66
  // Check for commit in various possible locations
69
67
  const commit = packageJson.commit || packageJson.buildInfo?.commit;
70
68
  if (commit) {
package/dist/cjs/index.js CHANGED
@@ -19,6 +19,7 @@ __exportStar(require("./agents/index.js"), exports);
19
19
  __exportStar(require("./client/client.js"), exports);
20
20
  __exportStar(require("./common/autoload.js"), exports);
21
21
  __exportStar(require("./common/env.js"), exports);
22
+ __exportStar(require("./common/node.js"), exports);
22
23
  __exportStar(require("./common/errors.js"), exports);
23
24
  __exportStar(require("./common/internal.js"), exports);
24
25
  __exportStar(require("./common/logger.js"), exports);
@@ -1,4 +1,3 @@
1
1
  "use strict";
2
- /* eslint-disable */
3
2
  // This file is auto-generated by @hey-api/openapi-ts
4
3
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -226,7 +226,8 @@ class McpTool {
226
226
  }
227
227
  catch (error) {
228
228
  // Default to websocket if we can't determine the transport type
229
- logger_js_1.logger.warn(`Failed to detect transport type for ${this.name}: ${error}. Defaulting to websocket.`);
229
+ const message = error instanceof Error ? error.message : String(error);
230
+ logger_js_1.logger.warn(`Failed to detect transport type for ${this.name}: ${message}. Defaulting to websocket.`);
230
231
  this.transportName = "websocket";
231
232
  }
232
233
  }
@@ -2,5 +2,6 @@ declare let fs: typeof import("fs") | null;
2
2
  declare let os: typeof import("os") | null;
3
3
  declare let path: typeof import("path") | null;
4
4
  declare let dotenv: typeof import("dotenv") | null;
5
+ declare let ws: any;
5
6
  export declare function getWebSocket(): Promise<any>;
6
- export { dotenv, fs, os, path };
7
+ export { dotenv, fs, os, path, ws };
@@ -3,6 +3,7 @@ export * from "./agents/index.js";
3
3
  export * from "./client/client.js";
4
4
  export * from "./common/autoload.js";
5
5
  export * from "./common/env.js";
6
+ export * from "./common/node.js";
6
7
  export * from "./common/errors.js";
7
8
  export * from "./common/internal.js";
8
9
  export * from "./common/logger.js";