@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/cjs/common/node.js
CHANGED
|
@@ -1,10 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.path = exports.os = exports.fs = exports.dotenv = void 0;
|
|
4
2
|
/* eslint-disable */
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.ws = exports.path = exports.os = exports.fs = exports.dotenv = void 0;
|
|
38
|
+
// Import Node.js built-in modules using ES6 imports for ESM compatibility
|
|
39
|
+
const fsImport = __importStar(require("fs"));
|
|
40
|
+
const osImport = __importStar(require("os"));
|
|
41
|
+
const pathImport = __importStar(require("path"));
|
|
42
|
+
// Detect environments
|
|
5
43
|
const isNode = typeof process !== "undefined" &&
|
|
6
44
|
process.versions != null &&
|
|
7
45
|
process.versions.node != null;
|
|
46
|
+
const isBrowser = typeof globalThis !== "undefined" && globalThis?.window !== undefined;
|
|
47
|
+
// Initialize modules
|
|
8
48
|
let fs = null;
|
|
9
49
|
exports.fs = fs;
|
|
10
50
|
let os = null;
|
|
@@ -13,14 +53,31 @@ let path = null;
|
|
|
13
53
|
exports.path = path;
|
|
14
54
|
let dotenv = null;
|
|
15
55
|
exports.dotenv = dotenv;
|
|
16
|
-
|
|
56
|
+
let ws = null;
|
|
57
|
+
exports.ws = ws;
|
|
58
|
+
if (isNode && !isBrowser) {
|
|
59
|
+
// Use the imported modules directly
|
|
60
|
+
exports.fs = fs = fsImport;
|
|
61
|
+
exports.os = os = osImport;
|
|
62
|
+
exports.path = path = pathImport;
|
|
63
|
+
// Try to load dotenv and ws using require since they're not built-ins
|
|
17
64
|
try {
|
|
18
|
-
exports.fs = fs = eval("require")("fs");
|
|
19
|
-
exports.os = os = eval("require")("os");
|
|
20
|
-
exports.path = path = eval("require")("path");
|
|
21
65
|
exports.dotenv = dotenv = eval("require")("dotenv");
|
|
66
|
+
exports.ws = ws = eval("require")("ws");
|
|
22
67
|
}
|
|
23
|
-
catch (
|
|
24
|
-
|
|
68
|
+
catch (requireError) {
|
|
69
|
+
// Try alternative loading for ESM
|
|
70
|
+
try {
|
|
71
|
+
exports.dotenv = dotenv = eval("require")("dotenv");
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// console.warn("dotenv not available");
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
exports.ws = ws = eval("require")("ws");
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// console.warn("ws not available");
|
|
81
|
+
}
|
|
25
82
|
}
|
|
26
83
|
}
|
|
@@ -6,10 +6,17 @@ const env_js_1 = require("../common/env.js");
|
|
|
6
6
|
// Function to get package version
|
|
7
7
|
function getPackageVersion() {
|
|
8
8
|
try {
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
// Check if require is available (CommonJS environment)
|
|
10
|
+
if (typeof require !== "undefined") {
|
|
11
|
+
// Try to require package.json (Node.js only, gracefully fails in browser)
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
13
|
+
const packageJson = {"version":"0.2.38","commit":"c701e3df0f8c8fbce1dd509c59b2ed4ec296e566"};
|
|
14
|
+
return packageJson.version || "unknown";
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
// ESM environment - return unknown
|
|
18
|
+
return "unknown";
|
|
19
|
+
}
|
|
13
20
|
}
|
|
14
21
|
catch {
|
|
15
22
|
// Fallback for browser environments or if require fails
|
|
@@ -53,13 +60,16 @@ function getOsArch() {
|
|
|
53
60
|
// Function to get commit hash
|
|
54
61
|
function getCommitHash() {
|
|
55
62
|
try {
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
// Check if require is available (CommonJS environment)
|
|
64
|
+
if (typeof require !== "undefined") {
|
|
65
|
+
// Try to require package.json and look for commit field (set during build)
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
67
|
+
const packageJson = {"version":"0.2.38","commit":"c701e3df0f8c8fbce1dd509c59b2ed4ec296e566"};
|
|
68
|
+
// Check for commit in various possible locations
|
|
69
|
+
const commit = packageJson.commit || packageJson.buildInfo?.commit;
|
|
70
|
+
if (commit) {
|
|
71
|
+
return commit.length > 7 ? commit.substring(0, 7) : commit;
|
|
72
|
+
}
|
|
63
73
|
}
|
|
64
74
|
}
|
|
65
75
|
catch {
|
package/dist/cjs/mcp/client.js
CHANGED
|
@@ -3,23 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BlaxelMcpClientTransport = void 0;
|
|
4
4
|
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
5
5
|
const logger_js_1 = require("../common/logger.js");
|
|
6
|
+
const node_js_1 = require("../common/node.js");
|
|
6
7
|
const settings_js_1 = require("../common/settings.js");
|
|
7
|
-
//
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-
|
|
9
|
-
const
|
|
10
|
-
// Conditional import for Node.js WebSocket
|
|
11
|
-
let NodeWebSocket;
|
|
12
|
-
if (!isBrowser) {
|
|
13
|
-
try {
|
|
14
|
-
// Dynamic import for Node.js environment
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports
|
|
16
|
-
NodeWebSocket = require("ws");
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
console.warn("ws is not available in this environment");
|
|
20
|
-
// ws is not available
|
|
21
|
-
}
|
|
22
|
-
}
|
|
8
|
+
// Use WebSocket from centralized node module loading
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
10
|
+
const NodeWebSocket = node_js_1.ws;
|
|
23
11
|
//const SUBPROTOCOL = "mcp";
|
|
24
12
|
// Helper function to wait
|
|
25
13
|
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -42,7 +30,8 @@ class BlaxelMcpClientTransport {
|
|
|
42
30
|
this._retry_max = options?.retry?.max ?? 3;
|
|
43
31
|
this._retry_delay = options?.retry?.delay ?? 1000;
|
|
44
32
|
this._headers = headers ?? {};
|
|
45
|
-
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
34
|
+
this._isBrowser = typeof globalThis !== "undefined" && (globalThis)?.window !== undefined;
|
|
46
35
|
}
|
|
47
36
|
async start() {
|
|
48
37
|
if (this._socket) {
|
|
@@ -2,4 +2,5 @@ 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
|
-
|
|
5
|
+
declare let ws: any;
|
|
6
|
+
export { dotenv, fs, os, path, ws };
|