@blade-hq/agent-client 1.2.1-beta.1 → 1.2.1-beta.2
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/index.js +22 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4114,7 +4114,7 @@ function resolveAuthToken(options) {
|
|
|
4114
4114
|
|
|
4115
4115
|
// src/version.ts
|
|
4116
4116
|
var SDK_NAME = "agent-client";
|
|
4117
|
-
var SDK_VERSION = true ? "1.2.1-beta.
|
|
4117
|
+
var SDK_VERSION = true ? "1.2.1-beta.2" : "1.1.1";
|
|
4118
4118
|
|
|
4119
4119
|
// src/socket.ts
|
|
4120
4120
|
function withSdkIdentity(auth) {
|
|
@@ -4462,12 +4462,31 @@ function resolveTokenOption(tokenOption) {
|
|
|
4462
4462
|
const token = typeof tokenOption === "function" ? tokenOption() : tokenOption;
|
|
4463
4463
|
return token ? token : null;
|
|
4464
4464
|
}
|
|
4465
|
+
var SANDBOX_ONLY_HOST = "host.docker.internal";
|
|
4465
4466
|
function normalizeBaseUrl(baseUrl) {
|
|
4466
4467
|
const normalized = baseUrl.trim().replace(/\/+$/, "");
|
|
4467
|
-
if (
|
|
4468
|
+
if (typeof window === "undefined") {
|
|
4468
4469
|
return normalized;
|
|
4469
4470
|
}
|
|
4470
|
-
|
|
4471
|
+
if (!normalized) {
|
|
4472
|
+
return window.location.origin;
|
|
4473
|
+
}
|
|
4474
|
+
assertBrowserReachable(normalized);
|
|
4475
|
+
return normalized;
|
|
4476
|
+
}
|
|
4477
|
+
function assertBrowserReachable(baseUrl) {
|
|
4478
|
+
let hostname;
|
|
4479
|
+
try {
|
|
4480
|
+
hostname = new URL(baseUrl, window.location.href).hostname;
|
|
4481
|
+
} catch {
|
|
4482
|
+
return;
|
|
4483
|
+
}
|
|
4484
|
+
if (hostname !== SANDBOX_ONLY_HOST) {
|
|
4485
|
+
return;
|
|
4486
|
+
}
|
|
4487
|
+
throw new Error(
|
|
4488
|
+
`Blade Agent \u5730\u5740 ${baseUrl} \u53EA\u6709\u6C99\u76D2\u5185\u90E8\u89E3\u6790\u5F97\u5230\uFF0C\u6D4F\u89C8\u5668\u6253\u4E0D\u5F00\u3002\u8BF7\u628A\u5B83\u6539\u6210\u7528\u6237\u6D4F\u89C8\u5668\u80FD\u8BBF\u95EE\u7684\u5730\u5740\uFF08\u901A\u5E38\u662F\u8BBF\u95EE\u8FD9\u4E2A\u5E94\u7528\u65F6\u7528\u7684\u4E3B\u673A\u540D + Blade Server \u7AEF\u53E3\uFF09\u3002`
|
|
4489
|
+
);
|
|
4471
4490
|
}
|
|
4472
4491
|
function isFormData(value) {
|
|
4473
4492
|
return typeof FormData !== "undefined" && value instanceof FormData;
|