@mcp-use/client 2.4.5 → 2.4.6-canary.1
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/.tsbuildinfo +1 -1
- package/dist/auth/url.d.ts +2 -3
- package/dist/auth/url.d.ts.map +1 -1
- package/dist/code-mode/executor-vm.d.ts.map +1 -1
- package/dist/index-browser.js +7 -17
- package/dist/index-browser.js.map +1 -1
- package/dist/index.js +46 -22
- package/dist/index.js.map +1 -1
- package/dist/react/index.js +7 -17
- package/dist/react/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1659,7 +1659,7 @@ init_connector_telemetry();
|
|
|
1659
1659
|
init_logging();
|
|
1660
1660
|
|
|
1661
1661
|
// src/utils/version.ts
|
|
1662
|
-
var VERSION = "2.4.
|
|
1662
|
+
var VERSION = "2.4.6-canary.1";
|
|
1663
1663
|
function getPackageVersion() {
|
|
1664
1664
|
return VERSION;
|
|
1665
1665
|
}
|
|
@@ -2306,27 +2306,17 @@ import { validateClientMetadataUrl } from "@modelcontextprotocol/client";
|
|
|
2306
2306
|
|
|
2307
2307
|
// src/auth/url.ts
|
|
2308
2308
|
function sanitizeUrl(raw) {
|
|
2309
|
-
const abort = () => {
|
|
2310
|
-
throw new Error(`Invalid url to pass to open(): ${raw}`);
|
|
2311
|
-
};
|
|
2312
2309
|
let url;
|
|
2313
2310
|
try {
|
|
2314
2311
|
url = new URL(raw);
|
|
2315
|
-
} catch
|
|
2316
|
-
|
|
2317
|
-
}
|
|
2318
|
-
if (url.protocol !== "
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
if (url.password) url.password = encodeURIComponent(url.password);
|
|
2322
|
-
url.pathname = url.pathname.slice(0, 1) + encodeURIComponent(url.pathname.slice(1)).replace(/%2f/gi, "/");
|
|
2323
|
-
url.search = url.search.slice(0, 1) + Array.from(url.searchParams.entries()).map(sanitizeParam).join("&");
|
|
2324
|
-
url.hash = url.hash.slice(0, 1) + encodeURIComponent(url.hash.slice(1));
|
|
2312
|
+
} catch {
|
|
2313
|
+
throw new Error(`Invalid url to pass to open(): ${raw}`);
|
|
2314
|
+
}
|
|
2315
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
2316
|
+
throw new Error(`Invalid url to pass to open(): ${raw}`);
|
|
2317
|
+
}
|
|
2325
2318
|
return url.href;
|
|
2326
2319
|
}
|
|
2327
|
-
function sanitizeParam([k, v]) {
|
|
2328
|
-
return `${encodeURIComponent(k)}${v.length > 0 ? `=${encodeURIComponent(v)}` : ""}`;
|
|
2329
|
-
}
|
|
2330
2320
|
|
|
2331
2321
|
// src/auth/session-store.ts
|
|
2332
2322
|
var OAuthSessionStore = class _OAuthSessionStore {
|
|
@@ -5266,6 +5256,44 @@ function isVMAvailable() {
|
|
|
5266
5256
|
tryLoadVM();
|
|
5267
5257
|
return vm !== null;
|
|
5268
5258
|
}
|
|
5259
|
+
function formatLogArgument(arg) {
|
|
5260
|
+
try {
|
|
5261
|
+
if (typeof arg !== "object" || arg === null) return String(arg);
|
|
5262
|
+
if (isErrorObject(arg)) return formatError(arg);
|
|
5263
|
+
return JSON.stringify(arg, jsonLogReplacer(), 2);
|
|
5264
|
+
} catch {
|
|
5265
|
+
try {
|
|
5266
|
+
return String(arg);
|
|
5267
|
+
} catch {
|
|
5268
|
+
return "[unserializable value]";
|
|
5269
|
+
}
|
|
5270
|
+
}
|
|
5271
|
+
}
|
|
5272
|
+
function isErrorObject(value) {
|
|
5273
|
+
return Object.prototype.toString.call(value) === "[object Error]";
|
|
5274
|
+
}
|
|
5275
|
+
var MAX_ERROR_CAUSE_DEPTH = 5;
|
|
5276
|
+
function formatError(error, depth = 0) {
|
|
5277
|
+
const text = String(error);
|
|
5278
|
+
const cause = error.cause;
|
|
5279
|
+
if (cause === void 0 || depth >= MAX_ERROR_CAUSE_DEPTH) return text;
|
|
5280
|
+
const causeText = isErrorObject(cause) ? formatError(cause, depth + 1) : formatLogArgument(cause);
|
|
5281
|
+
return `${text} (cause: ${causeText})`;
|
|
5282
|
+
}
|
|
5283
|
+
function jsonLogReplacer() {
|
|
5284
|
+
const ancestors = [];
|
|
5285
|
+
return function(_key, value) {
|
|
5286
|
+
if (typeof value === "bigint") return `${value}n`;
|
|
5287
|
+
if (typeof value !== "object" || value === null) return value;
|
|
5288
|
+
if (isErrorObject(value)) return formatError(value);
|
|
5289
|
+
while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) {
|
|
5290
|
+
ancestors.pop();
|
|
5291
|
+
}
|
|
5292
|
+
if (ancestors.includes(value)) return "[Circular]";
|
|
5293
|
+
ancestors.push(value);
|
|
5294
|
+
return value;
|
|
5295
|
+
};
|
|
5296
|
+
}
|
|
5269
5297
|
var VMCodeExecutor = class extends BaseCodeExecutor {
|
|
5270
5298
|
defaultTimeout;
|
|
5271
5299
|
memoryLimitMb;
|
|
@@ -5346,11 +5374,7 @@ var VMCodeExecutor = class extends BaseCodeExecutor {
|
|
|
5346
5374
|
*/
|
|
5347
5375
|
async _buildContext(logs) {
|
|
5348
5376
|
const logHandler = (...args) => {
|
|
5349
|
-
logs.push(
|
|
5350
|
-
args.map(
|
|
5351
|
-
(arg) => typeof arg === "object" ? JSON.stringify(arg, null, 2) : String(arg)
|
|
5352
|
-
).join(" ")
|
|
5353
|
-
);
|
|
5377
|
+
logs.push(args.map(formatLogArgument).join(" "));
|
|
5354
5378
|
};
|
|
5355
5379
|
const sandbox = {
|
|
5356
5380
|
console: {
|