@lob-ox/core-darwin-x64 0.0.23 → 0.0.24
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/core.cjs +73 -23
- package/package.json +1 -1
- package/ui-react/assets/{InstancesPage-DTy-dQ-L.js → InstancesPage-BVnW9tb_.js} +1 -1
- package/ui-react/assets/{LanPage-DGGWJGab.js → LanPage-BJ2KUgU3.js} +1 -1
- package/ui-react/assets/{OverviewPage-FLGxQPCE.js → OverviewPage-CUpB_jPT.js} +1 -1
- package/ui-react/assets/{PluginsPage-BBfj4bk7.js → PluginsPage-BXeTJUaz.js} +1 -1
- package/ui-react/assets/{RouterPage-MZBwIV9n.js → RouterPage-BZpitfJP.js} +1 -1
- package/ui-react/assets/{SettingsPage-BkG-APXm.js → SettingsPage-C9BExpmt.js} +1 -1
- package/ui-react/assets/{TasksPage-B50BoixQ.js → TasksPage-ByQm7Qvd.js} +1 -1
- package/ui-react/assets/{openExternal-Ayshj45y.js → openExternal-CelnbVOI.js} +1 -1
- package/ui-react/assets/{supervisor-DWUbDZTX.js → supervisor-DgkkfHOR.js} +2 -2
- package/ui-react/supervisor.html +1 -1
package/core.cjs
CHANGED
|
@@ -1630,7 +1630,7 @@ var require_version = __commonJS({
|
|
|
1630
1630
|
var fs2 = require("node:fs");
|
|
1631
1631
|
var path2 = require("node:path");
|
|
1632
1632
|
function guardVersion() {
|
|
1633
|
-
if (true) return String("0.0.
|
|
1633
|
+
if (true) return String("0.0.24");
|
|
1634
1634
|
try {
|
|
1635
1635
|
return JSON.parse(fs2.readFileSync(path2.join(__dirname, "..", "..", "package.json"), "utf8")).version || "unknown";
|
|
1636
1636
|
} catch {
|
|
@@ -4665,7 +4665,7 @@ var require_orphan_scan = __commonJS({
|
|
|
4665
4665
|
for (const d of daemons) {
|
|
4666
4666
|
if (!d.active()) continue;
|
|
4667
4667
|
if (!d.want() && !d.managed()) {
|
|
4668
|
-
issues.push({ kind: d.kind, port: d.port, why: "\u7AEF\u53E3\u88AB\u76D1\u542C\u4F46\u672C\
|
|
4668
|
+
issues.push({ kind: d.kind, port: d.port, why: "\u7AEF\u53E3\u88AB\u76D1\u542C\u4F46\u672C\u5185\u6838\u671F\u671B\u505C\u6B62\u4E14\u65E0\u7BA1\u7406\u9501\uFF08\u5F02\u4E3B/\u6B8B\u7559 daemon\uFF09" });
|
|
4669
4669
|
}
|
|
4670
4670
|
}
|
|
4671
4671
|
try {
|
|
@@ -5438,7 +5438,7 @@ var require_guard = __commonJS({
|
|
|
5438
5438
|
ok: false,
|
|
5439
5439
|
code: "KERNEL_UPDATE_SINGLE_WRITER",
|
|
5440
5440
|
owner: "desktop-shell",
|
|
5441
|
-
error: "\
|
|
5441
|
+
error: "\u5185\u6838\u91CD\u542F\u7531\u684C\u9762\u58F3\u7ECF\u670D\u52A1\u7BA1\u7406\u5668\u6267\u884C\uFF08\u5185\u6838\u4ECE\u4E0D\u91CD\u542F\u81EA\u5DF1\uFF09\uFF1A\u66F4\u65B0\u5185\u6838\u8BF7\u7528\u684C\u9762\u58F3\u3002"
|
|
5442
5442
|
});
|
|
5443
5443
|
}
|
|
5444
5444
|
if (req.method === "GET" && pathname === "/env/native") {
|
|
@@ -6373,9 +6373,9 @@ var require_contract = __commonJS({
|
|
|
6373
6373
|
{ path: "/status", methods: ["GET"], domain: "lifecycle", category: "public", consumers: ["UI(polling)", "CLI(status)"], note: "\u72B6\u6001\u6458\u8981" },
|
|
6374
6374
|
{ path: "/events", methods: ["GET"], domain: "lifecycle", category: "public", consumers: ["UI(timeline)"], note: "\u589E\u91CF\u4E8B\u4EF6" },
|
|
6375
6375
|
{ path: "/healthz", methods: ["GET"], domain: "lifecycle", category: "public", consumers: ["\u58F3(\u63E1\u624B\u63A2\u9488)"], note: "\u5B58\u6D3B\u63A2\u9488" },
|
|
6376
|
-
{ path: "/readyz", methods: ["GET"], domain: "lifecycle", category: "operational", consumers: ["\u76D1\u63A7/\u7F16\u6392\u63A2\u9488"], note: "\u5C31\u7EEA\u63A2\u9488\uFF08\
|
|
6376
|
+
{ path: "/readyz", methods: ["GET"], domain: "lifecycle", category: "operational", consumers: ["\u76D1\u63A7/\u7F16\u6392\u63A2\u9488"], note: "\u5C31\u7EEA\u63A2\u9488\uFF08\u5185\u6838\u5DF2\u521D\u59CB\u5316\u4E14\u672A\u505C\u673A\uFF09" },
|
|
6377
6377
|
{ path: "/session/status", methods: ["GET"], domain: "lifecycle", category: "public", consumers: ["\u58F3(get_session_state)"], note: "\u4F1A\u8BDD\u6001\u8BFB\u53D6\u53E3" },
|
|
6378
|
-
{ path: "/session/stop", methods: ["POST"], domain: "lifecycle", category: "public", consumers: ["\u58F3(\u9000\u51FA\u63E1\u624B)"], note: "\u505C\u5168\u90E8\u88AB\u7BA1\u5BF9\u8C61 + \u56DE\u6267\uFF08\
|
|
6378
|
+
{ path: "/session/stop", methods: ["POST"], domain: "lifecycle", category: "public", consumers: ["\u58F3(\u9000\u51FA\u63E1\u624B)"], note: "\u505C\u5168\u90E8\u88AB\u7BA1\u5BF9\u8C61 + \u56DE\u6267\uFF08\u5185\u6838\u4E0D\u81EA\u505C\uFF09" },
|
|
6379
6379
|
{ path: "/metrics", methods: ["GET"], domain: "lifecycle", category: "operational", consumers: ["\u76D1\u63A7\u63A5\u5165"], note: "\u76D1\u63A7\uFF1A\u4E8B\u4EF6\u6D41\u6D3E\u751F\u9065\u6D4B\uFF08bySource/topTypes/\u4E8B\u4EF6\u7387\uFF09" },
|
|
6380
6380
|
{ path: "/logs/tail", methods: ["GET"], domain: "lifecycle", category: "operational", consumers: ["\u8FDC\u7A0B\u8BCA\u65AD"], note: "\u8BCA\u65AD\uFF1A\u5404 stream \u65E5\u5FD7\u5C3E\u90E8\uFF08\u8DE8\u673A\u6392\u969C\uFF1B\u672C\u673A CLI \u76F4\u8BFB\u6587\u4EF6\uFF09" },
|
|
6381
6381
|
{ path: "/logs/export", methods: ["GET"], domain: "lifecycle", category: "operational", consumers: ["\u5BA1\u8BA1/\u79BB\u7EBF\u5907\u4EFD"], note: "\u5BA1\u8BA1\uFF1A\u805A\u5408\u6D41 JSONL \u5BFC\u51FA\uFF08\u79BB\u7EBF\u5907\u4EFD/\u5408\u89C4\u7559\u75D5\uFF09" },
|
|
@@ -6399,7 +6399,7 @@ var require_contract = __commonJS({
|
|
|
6399
6399
|
{ path: "/settings/lan", methods: ["GET", "POST"], domain: "guard", category: "public", consumers: ["UI(StartupCard)"], note: "\u9762\u677F\u5C40\u57DF\u7F51\u8BBF\u95EE\u5F00\u5173" },
|
|
6400
6400
|
{ path: "/self-update/status", methods: ["GET"], domain: "guard", category: "public", consumers: ["UI(AboutCard)"], note: "\u5185\u6838\u66F4\u65B0\u72B6\u6001\uFF08\u53EA\u8BFB\uFF1B\u5B89\u88C5\u5F52\u684C\u9762\u58F3\uFF09" },
|
|
6401
6401
|
{ path: "/self-update/apply", methods: ["POST"], domain: "guard", category: "deprecated", consumers: ["\u65E0"], note: "\u5355\u5199\u5165\u8005=\u58F3\uFF1A\u8FD4\u56DE 410 KERNEL_UPDATE_SINGLE_WRITER\uFF1B\u66FF\u4EE3 = \u684C\u9762\u58F3 kernel_update_apply" },
|
|
6402
|
-
{ path: "/self-update/restart-guard", methods: ["POST"], domain: "guard", category: "deprecated", consumers: ["\u65E0"], note: "\
|
|
6402
|
+
{ path: "/self-update/restart-guard", methods: ["POST"], domain: "guard", category: "deprecated", consumers: ["\u65E0"], note: "\u5185\u6838\u4E0D\u81EA\u91CD\u542F\uFF1A\u8FD4\u56DE 410\uFF1B\u66FF\u4EE3 = \u58F3\u5728\u5B89\u88C5\u540E\u7ECF\u670D\u52A1\u7BA1\u7406\u5668\u91CD\u542F\u5185\u6838" },
|
|
6403
6403
|
{ path: "/native/status", methods: ["GET"], domain: "native", category: "public", consumers: ["UI(OverviewPage)", "CLI(status)"], note: "\u5B89\u88C5\u72B6\u6001 + \u7248\u672C + \u5347\u7EA7\u72B6\u6001\u673A" },
|
|
6404
6404
|
{ path: "/native/check-update", methods: ["POST"], domain: "native", category: "public", consumers: ["UI(OverviewPage)"], note: "\u89E6\u53D1\u7248\u672C\u68C0\u67E5" },
|
|
6405
6405
|
{ path: "/native/install", methods: ["POST"], domain: "native", category: "public", consumers: ["UI(OverviewPage)", "CLI"], note: "\u5F02\u6B65\u5B89\u88C5\uFF08202\uFF09" },
|
|
@@ -6416,7 +6416,7 @@ var require_contract = __commonJS({
|
|
|
6416
6416
|
{ path: "/router/status", methods: ["GET"], domain: "router", category: "public", consumers: ["UI(RouterPage)"], note: "\u4E2D\u8F6C\u72B6\u6001 + \u7528\u91CF" },
|
|
6417
6417
|
{ path: "/router/providers", methods: ["GET"], domain: "router", category: "public", consumers: ["UI(RouterPage)"], note: "\u4F9B\u5E94\u5546 + \u8D26\u53F7 + \u5B9E\u4F8B\u89C6\u56FE" },
|
|
6418
6418
|
{ path: "/router/ports", methods: ["GET"], domain: "router", category: "internal", consumers: ["p2p-api \u5951\u7EA6\u6D4B\u8BD5\uFF08\u57DF\u5206\u79BB\u9A8C\u8BC1\uFF09"], note: "router \u81EA\u6CBB\u6BB5\u7AEF\u53E3\u89C6\u56FE\uFF08daemon \u6A21\u5F0F\u7269\u7406\u5206\u79BB\uFF09" },
|
|
6419
|
-
{ path: "/router/domain-summary", methods: ["GET"], domain: "router", category: "internal", consumers: ["\
|
|
6419
|
+
{ path: "/router/domain-summary", methods: ["GET"], domain: "router", category: "internal", consumers: ["\u5185\u6838\u76D1\u7763\u62CD\u81EA\u6D88\u8D39\uFF08\u5199\u76EE\u5F55 domainSummary\uFF09"], note: "\u57DF\u6458\u8981\u53EA\u8BFB\u7F13\u5B58" },
|
|
6420
6420
|
{ path: "/router/providers/account/discard", methods: ["POST"], domain: "router", category: "public", consumers: ["UI(RouterPage)"], note: "\u8D26\u53F7\u4E22\u5F03" },
|
|
6421
6421
|
{ path: "/router/providers/activate", methods: ["POST"], domain: "router", category: "public", consumers: ["UI(RouterPage)"], note: "\u6FC0\u6D3B\u4F9B\u5E94\u5546" },
|
|
6422
6422
|
{ path: "/router/providers/add", methods: ["POST"], domain: "router", category: "public", consumers: ["UI(RouterPage)"], note: "\u65B0\u589E\u4F9B\u5E94\u5546" },
|
|
@@ -9844,7 +9844,7 @@ var require_darwin = __commonJS({
|
|
|
9844
9844
|
const file = laFile(GUARD_LABEL);
|
|
9845
9845
|
if (on) {
|
|
9846
9846
|
if (!fs2.existsSync(file)) {
|
|
9847
|
-
errors.push("\
|
|
9847
|
+
errors.push("\u5185\u6838\u670D\u52A1\u5B9A\u4E49\u7F3A\u5931\uFF08" + file + "\uFF09\uFF1A\u5B9A\u4E49\u7531\u684C\u9762\u58F3\u5EFA\u7ACB\uFF0C\u8BF7\u5148\u542F\u52A8\u4E00\u6B21\u684C\u9762\u58F3");
|
|
9848
9848
|
} else {
|
|
9849
9849
|
if (!macSetEnabled(GUARD_LABEL, true)) errors.push("launchctl enable \u5931\u8D25");
|
|
9850
9850
|
if (!macLoaded(GUARD_LABEL) && !macBootstrap(file)) errors.push("launchctl bootstrap \u5931\u8D25");
|
|
@@ -10279,7 +10279,7 @@ var require_bootstrap = __commonJS({
|
|
|
10279
10279
|
try {
|
|
10280
10280
|
host._refreshEnvironmentForm();
|
|
10281
10281
|
} catch (e) {
|
|
10282
|
-
host.logger.warn && host.logger.warn("[environment] \u542F\u52A8\u5237\u65B0\u5F02\u5E38\uFF08\u4E0D\u5F71\u54CD\
|
|
10282
|
+
host.logger.warn && host.logger.warn("[environment] \u542F\u52A8\u5237\u65B0\u5F02\u5E38\uFF08\u4E0D\u5F71\u54CD\u5185\u6838\u4E3B\u5FAA\u73AF\uFF09: " + (e && e.message || e));
|
|
10283
10283
|
}
|
|
10284
10284
|
}, ENV_FORM_STARTUP_DELAY_MS);
|
|
10285
10285
|
if (envTimer && envTimer.unref) envTimer.unref();
|
|
@@ -10315,7 +10315,7 @@ var require_bootstrap = __commonJS({
|
|
|
10315
10315
|
host.logger.info && host.logger.info("[environment] \u5DF2\u5237\u65B0\uFF1A" + Object.keys(secs).length + " \u4E2A\u7EF4\u5EA6\uFF0C\u6D4F\u89C8\u5668\u5019\u9009 " + (f && f.browsers && f.browsers.length || 0) + " \u4E2A\uFF0C\u5206\u53D1\u4F9D\u636E " + (f && f.pick && f.pick.how || "?"));
|
|
10316
10316
|
return f;
|
|
10317
10317
|
}).catch((e) => {
|
|
10318
|
-
host.logger.warn && host.logger.warn("[environment] \u5237\u65B0\u5931\u8D25\uFF08\u4E0D\u5F71\u54CD\
|
|
10318
|
+
host.logger.warn && host.logger.warn("[environment] \u5237\u65B0\u5931\u8D25\uFF08\u4E0D\u5F71\u54CD\u5185\u6838\u4E3B\u5FAA\u73AF\uFF09: " + (e && e.message || e));
|
|
10319
10319
|
return null;
|
|
10320
10320
|
});
|
|
10321
10321
|
}
|
|
@@ -11831,7 +11831,7 @@ var require_shutdown = __commonJS({
|
|
|
11831
11831
|
return 0;
|
|
11832
11832
|
}
|
|
11833
11833
|
if (n > 0) {
|
|
11834
|
-
host.logger && host.logger.warn && host.logger.warn("[shutdown] \u4E2D\u6B62\u5728\u9014 npm \u4EFB\u52A1 " + n + " \u4E2A\uFF08" + reason + "\uFF09\uFF1A\u672C\u6B21\u5B89\u88C5/\u5378\u8F7D\u672A\u5B8C\u6210\uFF0C\u53EF\u5728\
|
|
11834
|
+
host.logger && host.logger.warn && host.logger.warn("[shutdown] \u4E2D\u6B62\u5728\u9014 npm \u4EFB\u52A1 " + n + " \u4E2A\uFF08" + reason + "\uFF09\uFF1A\u672C\u6B21\u5B89\u88C5/\u5378\u8F7D\u672A\u5B8C\u6210\uFF0C\u53EF\u5728\u5185\u6838\u6062\u590D\u540E\u91CD\u65B0\u53D1\u8D77");
|
|
11835
11835
|
host.events && host.events.append("shutdown_npm_aborted", { count: n, reason });
|
|
11836
11836
|
}
|
|
11837
11837
|
return n;
|
|
@@ -11922,7 +11922,7 @@ var require_shutdown = __commonJS({
|
|
|
11922
11922
|
host._setSessionState("stopped");
|
|
11923
11923
|
host.writeState(true);
|
|
11924
11924
|
host.events && host.events.append("session_stopped", {});
|
|
11925
|
-
host.logger.info("[session] \u88AB\u7BA1\u5BF9\u8C61\u5DF2\u5168\u90E8\u505C\u6B62\uFF1B\u7B49\u5F85\u5916\u90E8\u6240\u6709\u8005\uFF08\u58F3/systemd\uFF09\u505C\u6B62\
|
|
11925
|
+
host.logger.info("[session] \u88AB\u7BA1\u5BF9\u8C61\u5DF2\u5168\u90E8\u505C\u6B62\uFF1B\u7B49\u5F85\u5916\u90E8\u6240\u6709\u8005\uFF08\u58F3/systemd\uFF09\u505C\u6B62\u5185\u6838\u8FDB\u7A0B");
|
|
11926
11926
|
return { ok: true, sessionState: "stopped" };
|
|
11927
11927
|
}
|
|
11928
11928
|
function _stopMainDsh(host) {
|
|
@@ -12431,7 +12431,7 @@ var require_signals = __commonJS({
|
|
|
12431
12431
|
const own = d.readMainOwner();
|
|
12432
12432
|
if (own && own.dshPid === pid && own.guardPid && own.guardPid !== process.pid && pidlook.isAlive && pidlook.isAlive(own.guardPid)) {
|
|
12433
12433
|
d.logger() && d.logger().warn && d.logger().warn(
|
|
12434
|
-
"refuse adopt pid=" + pid + "\uFF1A\u5F52\u5C5E\u51ED\u636E\u6307\u5411\u53E6\u4E00\u5B58\u6D3B\
|
|
12434
|
+
"refuse adopt pid=" + pid + "\uFF1A\u5F52\u5C5E\u51ED\u636E\u6307\u5411\u53E6\u4E00\u5B58\u6D3B\u5185\u6838 pid=" + own.guardPid + "\uFF08\u4E0D\u53CC\u7BA1\u5BB6\u4E92\u6740\uFF09"
|
|
12435
12435
|
);
|
|
12436
12436
|
return false;
|
|
12437
12437
|
}
|
|
@@ -13027,11 +13027,11 @@ var require_runtime2 = __commonJS({
|
|
|
13027
13027
|
ctlPort: isLan ? d.ctl().lanPort() : d.ctl().routerPort(),
|
|
13028
13028
|
cmdMark: isLan ? "lan-daemon" : "router-daemon",
|
|
13029
13029
|
identityFile: path2.join(dir, kind + "-daemon.identity.json"),
|
|
13030
|
-
// R3 / 攻击链 A
|
|
13030
|
+
// R3 / 攻击链 A 的最后一环:内核 spawn daemon 时生成并注入机箱令牌。
|
|
13031
13031
|
// ctl 面已加鉴权(platform/ctl/server.js),未配置 DSH_CTL_TOKEN 时该鉴权
|
|
13032
13032
|
// 不启用——所以这里必须注入,否则生产环境 ctl 仍是只查形态的无认证面。
|
|
13033
|
-
//
|
|
13034
|
-
//
|
|
13033
|
+
// 令牌由内核进程内生成一次并缓存,同一内核 spawn 的所有 daemon 共享;
|
|
13034
|
+
// 内核自身调用 ctl 时也读同一值(platform/service/log/tail.js 读 env)。
|
|
13035
13035
|
spawnEnv: () => {
|
|
13036
13036
|
const env = { DSH_SUPERVISOR_CONFIG: cfgPath };
|
|
13037
13037
|
if (!d.readCtlToken()) {
|
|
@@ -13482,7 +13482,7 @@ var require_router2 = __commonJS({
|
|
|
13482
13482
|
routerProviders() {
|
|
13483
13483
|
const d = depsOf(this);
|
|
13484
13484
|
const presets = d.router().constructor.presets();
|
|
13485
|
-
const local = () => ({ presets, providers: d.router().listProviders(), proxyApps: d.router().proxyApps(), _stale: true, _staleReason: "daemon \u5931\u8054/ctl \u5931\u8D25\u5E94\u6025\u89C6\u56FE\uFF08\
|
|
13485
|
+
const local = () => ({ presets, providers: d.router().listProviders(), proxyApps: d.router().proxyApps(), _stale: true, _staleReason: "daemon \u5931\u8054/ctl \u5931\u8D25\u5E94\u6025\u89C6\u56FE\uFF08\u5185\u6838\u5185\u5D4C\u53EA\u8BFB\u526F\u672C\uFF09" });
|
|
13486
13486
|
if (!d.routerDaemonActive()) return local();
|
|
13487
13487
|
const rt = d.routerApi();
|
|
13488
13488
|
return Promise.all([Promise.resolve(rt.listProviders()), Promise.resolve(rt.proxyApps())]).then(([providers, proxyApps]) => ({ presets, providers, proxyApps })).catch((e) => {
|
|
@@ -17067,7 +17067,7 @@ var require_task_store = __commonJS({
|
|
|
17067
17067
|
for (const t of raw.tasks) {
|
|
17068
17068
|
if (t.state === "running" || t.state === "pending") {
|
|
17069
17069
|
t.state = "failed";
|
|
17070
|
-
t.error = t.error || "\
|
|
17070
|
+
t.error = t.error || "\u5185\u6838\u91CD\u542F\uFF0C\u4EFB\u52A1\u4E2D\u65AD";
|
|
17071
17071
|
t.finishedAt = Date.now();
|
|
17072
17072
|
if (onRecover) onRecover(t);
|
|
17073
17073
|
}
|
|
@@ -17522,7 +17522,7 @@ var require_core5 = __commonJS({
|
|
|
17522
17522
|
}
|
|
17523
17523
|
});
|
|
17524
17524
|
platform.environment.registerSection("startup", {
|
|
17525
|
-
label: "\u542F\u52A8\u65E2\u6210\u4E8B\u5B9E\uFF08\
|
|
17525
|
+
label: "\u542F\u52A8\u65E2\u6210\u4E8B\u5B9E\uFF08\u5185\u6838\u8FD9\u4E00\u62CD\u8DD1\u8FC7\u4EC0\u4E48\uFF09",
|
|
17526
17526
|
probe: () => {
|
|
17527
17527
|
const s = host._startupFacts;
|
|
17528
17528
|
if (!s) return null;
|
|
@@ -18420,6 +18420,7 @@ var require_carrier = __commonJS({
|
|
|
18420
18420
|
var require_instance_lifecycle = __commonJS({
|
|
18421
18421
|
"src/domains/router/providers/instance-lifecycle.js"(exports2, module2) {
|
|
18422
18422
|
"use strict";
|
|
18423
|
+
var fs2 = require("node:fs");
|
|
18423
18424
|
var { INSTANCE_STATES } = require_model3();
|
|
18424
18425
|
var pidlook = require_pidlookup();
|
|
18425
18426
|
var carrier = require_carrier();
|
|
@@ -18472,9 +18473,22 @@ var require_instance_lifecycle = __commonJS({
|
|
|
18472
18473
|
} catch {
|
|
18473
18474
|
}
|
|
18474
18475
|
carrier.signalTermination(pid);
|
|
18476
|
+
if (inst.pidFile) {
|
|
18477
|
+
try {
|
|
18478
|
+
const recorded = parseInt(fs2.readFileSync(inst.pidFile, "utf8"), 10);
|
|
18479
|
+
if (!Number.isInteger(recorded) || recorded === pid) {
|
|
18480
|
+
try {
|
|
18481
|
+
fs2.unlinkSync(inst.pidFile);
|
|
18482
|
+
} catch {
|
|
18483
|
+
}
|
|
18484
|
+
}
|
|
18485
|
+
} catch {
|
|
18486
|
+
}
|
|
18487
|
+
}
|
|
18475
18488
|
inst.pid = null;
|
|
18476
18489
|
inst.status = INSTANCE_STATES.COLD;
|
|
18477
18490
|
inst.healthy = false;
|
|
18491
|
+
inst.pidFile = null;
|
|
18478
18492
|
provider._persist();
|
|
18479
18493
|
}
|
|
18480
18494
|
function retryPendingStop(provider, acc) {
|
|
@@ -19418,6 +19432,18 @@ var require_probe5 = __commonJS({
|
|
|
19418
19432
|
}
|
|
19419
19433
|
});
|
|
19420
19434
|
} catch (e) {
|
|
19435
|
+
if (pidFile) {
|
|
19436
|
+
try {
|
|
19437
|
+
const recorded = parseInt(fs2.readFileSync(pidFile, "utf8"), 10);
|
|
19438
|
+
if (!Number.isInteger(recorded)) {
|
|
19439
|
+
try {
|
|
19440
|
+
fs2.unlinkSync(pidFile);
|
|
19441
|
+
} catch {
|
|
19442
|
+
}
|
|
19443
|
+
}
|
|
19444
|
+
} catch {
|
|
19445
|
+
}
|
|
19446
|
+
}
|
|
19421
19447
|
return { ok: false, started: false, error: "spawn \u5931\u8D25: " + e.message };
|
|
19422
19448
|
}
|
|
19423
19449
|
const child = handle.child;
|
|
@@ -19440,6 +19466,18 @@ var require_probe5 = __commonJS({
|
|
|
19440
19466
|
inst.healthy = false;
|
|
19441
19467
|
inst.status = INSTANCE_STATES.COLD;
|
|
19442
19468
|
}
|
|
19469
|
+
if (inst.pidFile && pidFile) {
|
|
19470
|
+
try {
|
|
19471
|
+
const recorded = parseInt(fs2.readFileSync(pidFile, "utf8"), 10);
|
|
19472
|
+
if (!Number.isInteger(recorded) || recorded === child.pid) {
|
|
19473
|
+
try {
|
|
19474
|
+
fs2.unlinkSync(pidFile);
|
|
19475
|
+
} catch {
|
|
19476
|
+
}
|
|
19477
|
+
}
|
|
19478
|
+
} catch {
|
|
19479
|
+
}
|
|
19480
|
+
}
|
|
19443
19481
|
if (provider.events) provider.events.append("proxy_instance_stopped", { app: provider.proxyAppId, port, code });
|
|
19444
19482
|
});
|
|
19445
19483
|
child.on("error", (err) => {
|
|
@@ -19448,6 +19486,18 @@ var require_probe5 = __commonJS({
|
|
|
19448
19486
|
inst.healthy = false;
|
|
19449
19487
|
inst.status = INSTANCE_STATES.COLD;
|
|
19450
19488
|
}
|
|
19489
|
+
if (inst.pidFile && pidFile) {
|
|
19490
|
+
try {
|
|
19491
|
+
const recorded = parseInt(fs2.readFileSync(pidFile, "utf8"), 10);
|
|
19492
|
+
if (!Number.isInteger(recorded) || recorded === child.pid) {
|
|
19493
|
+
try {
|
|
19494
|
+
fs2.unlinkSync(pidFile);
|
|
19495
|
+
} catch {
|
|
19496
|
+
}
|
|
19497
|
+
}
|
|
19498
|
+
} catch {
|
|
19499
|
+
}
|
|
19500
|
+
}
|
|
19451
19501
|
if (provider.events) provider.events.append("proxy_instance_failed", { app: provider.proxyAppId, port, error: err.message });
|
|
19452
19502
|
});
|
|
19453
19503
|
provider._persist();
|
|
@@ -29495,13 +29545,13 @@ function migrateStateRoot() {
|
|
|
29495
29545
|
process.exit(1);
|
|
29496
29546
|
}
|
|
29497
29547
|
function legacyNotice(legacy) {
|
|
29498
|
-
return "\u65E7\u7248\u72B6\u6001\u6839 " + legacy.root + "\uFF08" + legacy.supervisorDir + " / " + legacy.shellDir + "\uFF09" + (legacy.lockPid ? "\uFF1B\u65E7\
|
|
29548
|
+
return "\u65E7\u7248\u72B6\u6001\u6839 " + legacy.root + "\uFF08" + legacy.supervisorDir + " / " + legacy.shellDir + "\uFF09" + (legacy.lockPid ? "\uFF1B\u65E7\u5185\u6838\u9501 " + legacy.lockFile + "\uFF08pid " + legacy.lockPid + "\uFF09" : "");
|
|
29499
29549
|
}
|
|
29500
29550
|
function checkLegacyInstall() {
|
|
29501
29551
|
const legacy = stateRoot.detectLegacyInstall();
|
|
29502
29552
|
if (legacy.guardRunning) {
|
|
29503
|
-
console.error("[legacy] \u62D2\u7EDD\u7EE7\u7EED\uFF08\u9632\
|
|
29504
|
-
console.error("[legacy] \u65B0\u65E7\u4E24\u7248\u4E0D\u5171\u5B58\uFF1A\u8BF7\u5148\u5378\u8F7D\u65E7\u7248\u672C\uFF08\u505C\u6389\u65E7\
|
|
29553
|
+
console.error("[legacy] \u62D2\u7EDD\u7EE7\u7EED\uFF08\u9632\u65B0\u65E7\u4E24\u4EFD\u5E76\u5B58\uFF09\uFF1A\u68C0\u6D4B\u5230\u65E7\u7248\u5185\u6838\u4ECD\u5728\u8FD0\u884C \u2014\u2014 " + legacyNotice(legacy));
|
|
29554
|
+
console.error("[legacy] \u65B0\u65E7\u4E24\u7248\u4E0D\u5171\u5B58\uFF1A\u8BF7\u5148\u5378\u8F7D\u65E7\u7248\u672C\uFF08\u505C\u6389\u65E7\u5185\u6838\uFF1A\u65E7\u670D\u52A1\u7BA1\u7406\u5668/\u8BA1\u5212\u4EFB\u52A1\uFF0C\u6216\u4ECE\u65E7\u9762\u677F\u9000\u51FA\uFF09\uFF0C\u786E\u8BA4\u65E7\u8FDB\u7A0B\u5DF2\u9000\u51FA\u540E\u91CD\u8BD5\u3002");
|
|
29505
29555
|
console.error("[legacy] \u82E5\u65E7\u7248\u786E\u5DF2\u5378\u8F7D\u3001\u8BE5\u9501\u53EA\u662F\u6B8B\u7559\uFF0C\u5220\u9664 " + legacy.lockFile + " \u5373\u53EF\uFF08\u672C\u7248\u4E0D\u4F1A\u66FF\u4F60\u5220\u65E7\u6839\u91CC\u7684\u4EFB\u4F55\u6587\u4EF6\uFF09\u3002");
|
|
29506
29556
|
process.exit(1);
|
|
29507
29557
|
}
|
|
@@ -29721,7 +29771,7 @@ function cmdSelfUpdate(action) {
|
|
|
29721
29771
|
const s = await apiRequest("GET", "/self-update/status");
|
|
29722
29772
|
if (s.error) return console.log("\u68C0\u67E5\u5931\u8D25: " + s.error);
|
|
29723
29773
|
if (s.ok) {
|
|
29724
|
-
console.log("\
|
|
29774
|
+
console.log("\u5185\u6838\u5F53\u524D\u7248\u672C: " + s.installed);
|
|
29725
29775
|
console.log("\u6700\u65B0\u7248\u672C: " + s.latest);
|
|
29726
29776
|
console.log(s.updateAvailable ? "\u2192 \u6709\u53EF\u7528\u66F4\u65B0\uFF1A\u8BF7\u5728\u684C\u9762\u58F3\u9762\u677F\u300C\u5173\u4E8E\u300D\u4E2D\u70B9\u300C\u66F4\u65B0\u300D" : "\u5DF2\u662F\u6700\u65B0\u3002");
|
|
29727
29777
|
}
|
package/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{F as e,I as t,L as n,N as r,O as i,R as a,S as o,U as s,V as c,_ as l,a as u,b as d,c as f,g as p,k as m,n as h,o as g,t as _,v,x as y,y as b}from"./supervisor-DSBgs_XY.js";import{n as x,o as S}from"./openExternal-
|
|
1
|
+
import{F as e,I as t,L as n,N as r,O as i,R as a,S as o,U as s,V as c,_ as l,a as u,b as d,c as f,g as p,k as m,n as h,o as g,t as _,v,x as y,y as b}from"./supervisor-DSBgs_XY.js";import{n as x,o as S}from"./openExternal-CelnbVOI.js";import{n as C,t as w}from"./rocket-cmjG68ou.js";import{c as T,l as E,p as D,s as O}from"./supervisor-DgkkfHOR.js";import{t as k}from"./useSupervisorAction-U8T1qRbC.js";import{c as A,i as j,o as M,r as N,t as P}from"./widgets-DV5fuKzB.js";var F=r(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),I=r(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),L=r(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),R=s(c(),1),z=a();function B({onRegisterActions:r}){let{snap:a}=_(),{busy:s,run:c}=k(),B=e(),[V,H]=(0,R.useState)(!1),[U,W]=(0,R.useState)(``),[G,K]=(0,R.useState)(``),[q,J]=(0,R.useState)(``),Y=a.instances?.instances??[],[X,Z]=(0,R.useState)(null);(0,R.useEffect)(()=>{let e=!0;return u.envStatus().then(t=>{e&&Z(t.capabilities??null)}).catch(()=>void 0),()=>{e=!1}},[]);let Q=X!==null&&X.sandboxLaunch===!1;(0,R.useEffect)(()=>(r?.({onAdd:()=>H(!0)}),()=>r?.(null)),[r]);let $=(e,t)=>c(e,t),ee=e=>c(e,()=>x(()=>u.instanceOpenWeb(e)).then(()=>void 0));async function te(){if(Q){i.error(`当前平台不支持沙箱实例(见 /env/status 能力矩阵)`);return}let e=parseInt(G,10);if(!Number.isFinite(e)||e<=0){i.error(`请填写有效端口`);return}let t=q?q.split(/\n/).map(e=>e.trim()).filter(Boolean):[];try{let n=await u.instanceAdd({name:U.trim()||`沙箱 `+e,port:e,command:t});if(n&&n.ok===!1){i.error(n.error||`添加失败`);return}i.success(`已添加实例`),H(!1),W(``),K(``),J(``),h.refresh()}catch(e){i.error(String(e))}}async function ne(e){await c(e.id,async()=>{let t=await u.instanceCheckUpdate(e.id);t.updateAvailable?(i.success(`发现新版 `+t.latest+`,可点「更新」升级`),ie(t=>new Map(t).set(e.id,!0))):t.latest?i.info(`已是最新 `+t.latest):i.error(t.error||`版本检测失败`)})}let[re,ie]=(0,R.useState)(new Map);async function ae(e){await B({title:`升级该沙箱实例的 DSH 到最新版?`,description:`实例会短暂重启,进行中的请求中断。`,confirmText:`升级`})&&await c(e.id,()=>u.instanceUpgrade(e.id),{success:`升级已开始…`})}async function oe(e){await B({title:`删除实例「`+e.name+`」?`,description:`将彻底删除该沙箱实例(含配置与运行时数据)。此操作不可恢复。`,confirmText:`删除实例`,tone:`destructive`})&&await c(e.id,async()=>{let t=await u.instanceRemove(e.id);t&&t.ok!==!1&&t.dataPreserved===!0?i.warning(`实例已移除,但因其单元仍在运行,数据目录已保留(未删除)——请先停止实例再删数据`):t&&t.ok===!1&&i.error(t.error||`删除失败`),h.refresh()})}let se=({it:e})=>{let r=e.state?.running??!1,i=e.state?.lifecyclePhase,a=T(i,r),o=e.updateJob,c=o?.state===`running`,l=e.state?.usage,d=l&&typeof l.memMb==`number`?l.memMb:null,p=l&&typeof l.cpuPct==`number`?l.cpuPct:null,h=s===e.id;return(0,z.jsxs)(P,{className:`overflow-visible`,children:[(0,z.jsxs)(`div`,{className:`grid grid-cols-1 @min-[720px]:grid-cols-[minmax(0,5fr)_minmax(0,6fr)]`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-border px-6 py-5 md:border-b-0 md:border-r`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,z.jsx)(`strong`,{className:`truncate text-lg font-semibold tracking-[-0.01em] text-foreground`,children:e.name}),e.version?(0,z.jsxs)(`span`,{className:`font-mono text-sm text-muted-foreground`,children:[`v`,e.version]}):null]}),re.get(e.id)?(0,z.jsxs)(t,{className:`text-primary-foreground`,onClick:()=>void ae(e),size:`chip`,children:[(0,z.jsx)(I,{className:`size-3`}),`更新`]}):(0,z.jsxs)(t,{className:`bg-primary/10 text-primary hover:bg-primary/15`,disabled:h||c,onClick:()=>void ne(e),size:`chip`,variant:`ghost`,children:[(0,z.jsx)(I,{className:n(`size-3`,h&&`animate-spin`)}),`检测更新`]})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(A,{tone:a.tone,ping:a.tone===`ok`}),(0,z.jsx)(`span`,{className:`text-base font-semibold leading-none text-foreground`,children:a.label})]}),c?(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,z.jsx)(f,{className:`size-3`}),`正在升级 DeepSeek Harness(`,o?.step||``,`)…`]}):null,e.state?.installing?(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,z.jsx)(f,{className:`size-3`}),`正在安装…`]}):null,i===`FAILED`?(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-destructive`,children:[(0,z.jsx)(m,{className:`size-3.5`}),(0,z.jsx)(`span`,{className:`truncate`,children:e.state?.lastError||e.state?.installError||`启动反复失败,已停止自动重启,可手动重试`})]}):null]}),(0,z.jsx)(`div`,{className:`flex items-center bg-[image:var(--panel-accent-gradient)] px-6 py-5`,children:(0,z.jsxs)(`div`,{className:`grid w-full grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-4`,children:[(0,z.jsx)(j,{icon:(0,z.jsx)(D,{className:`size-4`}),label:`端口`,value:String(e.port),mono:!0}),(0,z.jsx)(j,{icon:(0,z.jsx)(L,{className:`size-4`}),label:`PID`,value:e.state?.pid?String(e.state.pid):`—`,mono:!0}),(0,z.jsx)(j,{icon:(0,z.jsx)(I,{className:`size-4`}),label:`重启次数`,value:String(e.state?.restartCount??0),mono:!0}),(0,z.jsx)(j,{icon:(0,z.jsx)(m,{className:`size-4`}),label:`最近故障`,value:e.state?.lastFailure?O(e.state.lastFailure):`无`,warn:!!e.state?.lastFailure})]})})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-border/60 px-6 py-3`,children:[(0,z.jsxs)(`span`,{className:`hidden min-w-0 items-center lg:inline-flex gap-2 text-xs text-muted-foreground`,children:[(0,z.jsx)(N,{kind:`sandbox`}),(0,z.jsx)(M,{tone:e.remoteMode&&e.remoteMode!==`off`?`boot`:`off`,children:e.remoteMode===`wan`?`远程·公网`:e.remoteMode===`lan`?`远程·局域网`:`远程关闭`}),d===null&&p===null?null:(0,z.jsxs)(`span`,{className:`whitespace-nowrap`,title:`监督拍实测值(最近一次采样;停止或未采到不显示)`,children:[`占用 `,d===null?`—`:`${d}MB`,p===null?``:` · CPU ${Math.round(p)}%`]})]}),(0,z.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[(0,z.jsxs)(t,{disabled:!r,onClick:()=>void ee(e.id),size:`sm`,title:`打开 DSH Web(自动带认证连接)`,variant:`outline`,className:`hidden md:inline-flex`,children:[(0,z.jsx)(S,{className:`size-4`}),`DSH Web`]}),(0,z.jsx)(t,{disabled:c,onClick:()=>void $(e.id,()=>r?u.instanceStop(e.id):u.instanceStart(e.id)),size:`sm`,variant:`outline`,children:r?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(C,{className:`size-4 text-status-error`}),`停止实例`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(w,{className:`size-4 text-primary`}),`启动实例`]})}),(0,z.jsxs)(t,{className:`hidden h-[30px] md:inline-flex`,disabled:h,onClick:()=>void oe(e),size:`sm`,variant:`destructive`,children:[(0,z.jsx)(E,{className:`size-4`}),`删除`]})]})]})]})};return(0,z.jsxs)(`div`,{className:`grid content-start gap-4`,children:[Q?(0,z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2.5 text-xs text-muted-foreground`,children:[(0,z.jsx)(m,{className:`mt-0.5 size-3.5 shrink-0 text-amber-500`}),(0,z.jsxs)(`span`,{children:[`当前平台(`,X?.platform||`未知`,`)不支持沙箱实例(能力矩阵见 /env/status 的 capabilities.sandboxLaunch;限额执行档位见 capabilities.sandboxEnforcement)。 原生 DSH 主实例不受影响。`]})]}):null,Y.length?(0,z.jsx)(`div`,{className:`grid gap-3`,children:Y.map(e=>(0,z.jsx)(se,{it:e},e.id))}):(0,z.jsx)(`div`,{className:`grid min-h-[220px] place-items-center rounded-lg border border-dashed border-border text-center`,children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(F,{className:`mx-auto mb-3 size-8 text-muted-foreground`}),(0,z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`尚未添加沙箱实例`}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:Q?`当前平台不支持沙箱实例(见上方说明)`:`点击顶部「添加实例」创建沙箱`})]})}),(0,z.jsx)(v,{open:V,onOpenChange:H,children:(0,z.jsxs)(b,{className:`max-w-[440px]`,children:[(0,z.jsx)(y,{children:(0,z.jsx)(o,{children:`添加 DSH 实例`})}),(0,z.jsxs)(`div`,{className:`grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,z.jsx)(p,{children:`实例名称`}),(0,z.jsx)(l,{placeholder:`如 沙箱二开`,value:U,onChange:e=>W(e.target.value)})]}),(0,z.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,z.jsx)(p,{children:`监听端口`}),(0,z.jsx)(l,{inputMode:`numeric`,placeholder:`如 3082`,value:G,onChange:e=>K(e.target.value)})]}),(0,z.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,z.jsx)(p,{children:`启动命令(每项一参数,可留空用默认)`}),(0,z.jsx)(g,{className:`min-h-[72px] font-mono text-sm`,placeholder:`node
|
|
2
2
|
/usr/local/bin/dsh
|
|
3
3
|
web`,value:q,onChange:e=>J(e.target.value)})]}),(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`留空则使用默认启动命令;各实例共享系统资源,不做内存/CPU 限制。`})]}),(0,z.jsxs)(d,{children:[(0,z.jsx)(t,{onClick:()=>H(!1),variant:`outline`,children:`取消`}),(0,z.jsx)(t,{onClick:()=>void te(),children:`添加`})]})]})})]})}export{B as InstancesPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{F as e,H as t,I as n,L as r,N as i,O as a,R as o,S as s,U as c,V as l,_ as u,a as d,b as f,g as p,s as m,t as h,v as g,x as _,y as v}from"./supervisor-DSBgs_XY.js";import{n as y,o as b,r as ee}from"./openExternal-
|
|
1
|
+
import{F as e,H as t,I as n,L as r,N as i,O as a,R as o,S as s,U as c,V as l,_ as u,a as d,b as f,g as p,s as m,t as h,v as g,x as _,y as v}from"./supervisor-DSBgs_XY.js";import{n as y,o as b,r as ee}from"./openExternal-CelnbVOI.js";import{t as x}from"./useSupervisorAction-U8T1qRbC.js";import{n as S,o as C,r as w,t as T}from"./widgets-DV5fuKzB.js";var te=i(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),ne=i(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),re=i(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),ie=i(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),ae=i(`landmark`,[[`path`,{d:`M10 18v-7`,key:`wt116b`}],[`path`,{d:`M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z`,key:`yxxwt6`}],[`path`,{d:`M14 18v-7`,key:`vav6t3`}],[`path`,{d:`M18 18v-7`,key:`aexdmj`}],[`path`,{d:`M3 22h18`,key:`8prr45`}],[`path`,{d:`M6 18v-7`,key:`1ivflk`}]]),oe=i(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),se=i(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),E=t(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),D=t(((e,t)=>{var n=E();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),O=t(((e,t)=>{t.exports=D()()})),k=c(l(),1),A=c(O(),1),j=function(e,t){let n=e,r=N[t],i=null,a=0,o=null,s=[],c={},l=function(e,t){a=n*4+17,i=function(e){let t=Array(e);for(let n=0;n<e;n+=1){t[n]=Array(e);for(let r=0;r<e;r+=1)t[n][r]=null}return t}(a),u(0,0),u(a-7,0),u(0,a-7),p(),f(),h(e,t),n>=7&&m(e),o??=v(n,r,s),g(o,t)},u=function(e,t){for(let n=-1;n<=7;n+=1)if(!(e+n<=-1||a<=e+n))for(let r=-1;r<=7;r+=1)t+r<=-1||a<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?i[e+n][t+r]=!0:i[e+n][t+r]=!1)},d=function(){let e=0,t=0;for(let n=0;n<8;n+=1){l(!0,n);let r=F.getLostPoint(c);(n==0||e>r)&&(e=r,t=n)}return t},f=function(){for(let e=8;e<a-8;e+=1)i[e][6]??(i[e][6]=e%2==0);for(let e=8;e<a-8;e+=1)i[6][e]??(i[6][e]=e%2==0)},p=function(){let e=F.getPatternPosition(n);for(let t=0;t<e.length;t+=1)for(let n=0;n<e.length;n+=1){let r=e[t],a=e[n];if(i[r][a]==null)for(let e=-2;e<=2;e+=1)for(let t=-2;t<=2;t+=1)e==-2||e==2||t==-2||t==2||e==0&&t==0?i[r+e][a+t]=!0:i[r+e][a+t]=!1}},m=function(e){let t=F.getBCHTypeNumber(n);for(let n=0;n<18;n+=1){let r=!e&&(t>>n&1)==1;i[Math.floor(n/3)][n%3+a-8-3]=r}for(let n=0;n<18;n+=1){let r=!e&&(t>>n&1)==1;i[n%3+a-8-3][Math.floor(n/3)]=r}},h=function(e,t){let n=r<<3|t,o=F.getBCHTypeInfo(n);for(let t=0;t<15;t+=1){let n=!e&&(o>>t&1)==1;t<6?i[t][8]=n:t<8?i[t+1][8]=n:i[a-15+t][8]=n}for(let t=0;t<15;t+=1){let n=!e&&(o>>t&1)==1;t<8?i[8][a-t-1]=n:t<9?i[8][15-t-1+1]=n:i[8][15-t-1]=n}i[a-8][8]=!e},g=function(e,t){let n=-1,r=a-1,o=7,s=0,c=F.getMaskFunction(t);for(let t=a-1;t>0;t-=2)for(t==6&&--t;;){for(let n=0;n<2;n+=1)if(i[r][t-n]==null){let a=!1;s<e.length&&(a=(e[s]>>>o&1)==1),c(r,t-n)&&(a=!a),i[r][t-n]=a,--o,o==-1&&(s+=1,o=7)}if(r+=n,r<0||a<=r){r-=n,n=-n;break}}},_=function(e,t){let n=0,r=0,i=0,a=Array(t.length),o=Array(t.length);for(let s=0;s<t.length;s+=1){let c=t[s].dataCount,l=t[s].totalCount-c;r=Math.max(r,c),i=Math.max(i,l),a[s]=Array(c);for(let t=0;t<a[s].length;t+=1)a[s][t]=255&e.getBuffer()[t+n];n+=c;let u=F.getErrorCorrectPolynomial(l),d=L(a[s],u.getLength()-1).mod(u);o[s]=Array(u.getLength()-1);for(let e=0;e<o[s].length;e+=1){let t=e+d.getLength()-o[s].length;o[s][e]=t>=0?d.getAt(t):0}}let s=0;for(let e=0;e<t.length;e+=1)s+=t[e].totalCount;let c=Array(s),l=0;for(let e=0;e<r;e+=1)for(let n=0;n<t.length;n+=1)e<a[n].length&&(c[l]=a[n][e],l+=1);for(let e=0;e<i;e+=1)for(let n=0;n<t.length;n+=1)e<o[n].length&&(c[l]=o[n][e],l+=1);return c},v=function(e,t,n){let r=R.getRSBlocks(e,t),i=z();for(let t=0;t<n.length;t+=1){let r=n[t];i.put(r.getMode(),4),i.put(r.getLength(),F.getLengthInBits(r.getMode(),e)),r.write(i)}let a=0;for(let e=0;e<r.length;e+=1)a+=r[e].dataCount;if(i.getLengthInBits()>a*8)throw`code length overflow. (`+i.getLengthInBits()+`>`+a*8+`)`;for(i.getLengthInBits()+4<=a*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=a*8||(i.put(236,8),i.getLengthInBits()>=a*8));)i.put(17,8);return _(i,r)};c.addData=function(e,t){t||=`Byte`;let n=null;switch(t){case`Numeric`:n=B(e);break;case`Alphanumeric`:n=V(e);break;case`Byte`:n=H(e);break;case`Kanji`:n=U(e);break;default:throw`mode:`+t}s.push(n),o=null},c.isDark=function(e,t){if(e<0||a<=e||t<0||a<=t)throw e+`,`+t;return i[e][t]},c.getModuleCount=function(){return a},c.make=function(){if(n<1){let e=1;for(;e<40;e++){let t=R.getRSBlocks(e,r),n=z();for(let t=0;t<s.length;t++){let r=s[t];n.put(r.getMode(),4),n.put(r.getLength(),F.getLengthInBits(r.getMode(),e)),r.write(n)}let i=0;for(let e=0;e<t.length;e++)i+=t[e].dataCount;if(n.getLengthInBits()<=i*8)break}n=e}l(!1,d())},c.createTableTag=function(e,t){e||=2,t=t===void 0?e*4:t;let n=``;n+=`<table style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: `+t+`px;`,n+=`">`,n+=`<tbody>`;for(let t=0;t<c.getModuleCount();t+=1){n+=`<tr>`;for(let r=0;r<c.getModuleCount();r+=1)n+=`<td style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: 0px;`,n+=` width: `+e+`px;`,n+=` height: `+e+`px;`,n+=` background-color: `,n+=c.isDark(t,r)?`#000000`:`#ffffff`,n+=`;`,n+=`"/>`;n+=`</tr>`}return n+=`</tbody>`,n+=`</table>`,n},c.createSvgTag=function(e,t,n,r){let i={};typeof arguments[0]==`object`&&(i=arguments[0],e=i.cellSize,t=i.margin,n=i.alt,r=i.title),e||=2,t=t===void 0?e*4:t,n=typeof n==`string`?{text:n}:n||{},n.text=n.text||null,n.id=n.text?n.id||`qrcode-description`:null,r=typeof r==`string`?{text:r}:r||{},r.text=r.text||null,r.id=r.text?r.id||`qrcode-title`:null;let a=c.getModuleCount()*e+t*2,o,s,l,u,d=``,f;for(f=`l`+e+`,0 0,`+e+` -`+e+`,0 0,-`+e+`z `,d+=`<svg version="1.1" xmlns="http://www.w3.org/2000/svg"`,d+=i.scalable?``:` width="`+a+`px" height="`+a+`px"`,d+=` viewBox="0 0 `+a+` `+a+`" `,d+=` preserveAspectRatio="xMinYMin meet"`,d+=r.text||n.text?` role="img" aria-labelledby="`+y([r.id,n.id].join(` `).trim())+`"`:``,d+=`>`,d+=r.text?`<title id="`+y(r.id)+`">`+y(r.text)+`</title>`:``,d+=n.text?`<description id="`+y(n.id)+`">`+y(n.text)+`</description>`:``,d+=`<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>`,d+=`<path d="`,l=0;l<c.getModuleCount();l+=1)for(u=l*e+t,o=0;o<c.getModuleCount();o+=1)c.isDark(l,o)&&(s=o*e+t,d+=`M`+s+`,`+u+f);return d+=`" stroke="transparent" fill="black"/>`,d+=`</svg>`,d},c.createDataURL=function(e,t){e||=2,t=t===void 0?e*4:t;let n=c.getModuleCount()*e+t*2,r=t,i=n-t;return J(n,n,function(t,n){if(r<=t&&t<i&&r<=n&&n<i){let i=Math.floor((t-r)/e),a=Math.floor((n-r)/e);return+!c.isDark(a,i)}return 1})},c.createImgTag=function(e,t,n){e||=2,t=t===void 0?e*4:t;let r=c.getModuleCount()*e+t*2,i=``;return i+=`<img`,i+=` src="`,i+=c.createDataURL(e,t),i+=`"`,i+=` width="`,i+=r,i+=`"`,i+=` height="`,i+=r,i+=`"`,n&&(i+=` alt="`,i+=y(n),i+=`"`),i+=`/>`,i};let y=function(e){let t=``;for(let n=0;n<e.length;n+=1){let r=e.charAt(n);switch(r){case`<`:t+=`<`;break;case`>`:t+=`>`;break;case`&`:t+=`&`;break;case`"`:t+=`"`;break;default:t+=r}}return t},b=function(e){e=e===void 0?2:e;let t=c.getModuleCount()*1+e*2,n=e,r=t-e,i,a,o,s,l,u={"██":`█`,"█ ":`▀`," █":`▄`," ":` `},d={"██":`▀`,"█ ":`▀`," █":` `," ":` `},f=``;for(i=0;i<t;i+=2){for(o=Math.floor((i-n)/1),s=Math.floor((i+1-n)/1),a=0;a<t;a+=1)l=`█`,n<=a&&a<r&&n<=i&&i<r&&c.isDark(o,Math.floor((a-n)/1))&&(l=` `),n<=a&&a<r&&n<=i+1&&i+1<r&&c.isDark(s,Math.floor((a-n)/1))?l+=` `:l+=`█`,f+=e<1&&i+1>=r?d[l]:u[l];f+=`
|
|
2
2
|
`}return t%2&&e>0?f.substring(0,f.length-t-1)+Array(t+1).join(`▀`):f.substring(0,f.length-1)};return c.createASCII=function(e,t){if(e||=1,e<2)return b(t);--e,t=t===void 0?e*2:t;let n=c.getModuleCount()*e+t*2,r=t,i=n-t,a,o,s,l,u=Array(e+1).join(`██`),d=Array(e+1).join(` `),f=``,p=``;for(a=0;a<n;a+=1){for(s=Math.floor((a-r)/e),p=``,o=0;o<n;o+=1)l=1,r<=o&&o<i&&r<=a&&a<i&&c.isDark(s,Math.floor((o-r)/e))&&(l=0),p+=l?u:d;for(s=0;s<e;s+=1)f+=p+`
|
|
3
3
|
`}return f.substring(0,f.length-1)},c.renderTo2dContext=function(e,t){t||=2;let n=c.getModuleCount();for(let r=0;r<n;r++)for(let i=0;i<n;i++)e.fillStyle=c.isDark(r,i)?`black`:`white`,e.fillRect(i*t,r*t,t,t)},c};j.stringToBytes=function(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);t.push(r&255)}return t},j.createStringToBytes=function(e,t){let n=function(){let n=K(e),r=function(){let e=n.read();if(e==-1)throw`eof`;return e},i=0,a={};for(;;){let e=n.read();if(e==-1)break;let t=r(),o=r(),s=r(),c=String.fromCharCode(e<<8|t);a[c]=o<<8|s,i+=1}if(i!=t)throw i+` != `+t;return a}();return function(e){let t=[];for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);if(i<128)t.push(i);else{let i=n[e.charAt(r)];typeof i==`number`?(i&255)==i?t.push(i):(t.push(i>>>8),t.push(i&255)):t.push(63)}}return t}};var M={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},N={L:1,M:0,Q:3,H:2},P={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},F=function(){let e=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],t=1335,n=7973,r={},i=function(e){let t=0;for(;e!=0;)t+=1,e>>>=1;return t};return r.getBCHTypeInfo=function(e){let n=e<<10;for(;i(n)-i(t)>=0;)n^=t<<i(n)-i(t);return(e<<10|n)^21522},r.getBCHTypeNumber=function(e){let t=e<<12;for(;i(t)-i(n)>=0;)t^=n<<i(t)-i(n);return e<<12|t},r.getPatternPosition=function(t){return e[t-1]},r.getMaskFunction=function(e){switch(e){case P.PATTERN000:return function(e,t){return(e+t)%2==0};case P.PATTERN001:return function(e,t){return e%2==0};case P.PATTERN010:return function(e,t){return t%3==0};case P.PATTERN011:return function(e,t){return(e+t)%3==0};case P.PATTERN100:return function(e,t){return(Math.floor(e/2)+Math.floor(t/3))%2==0};case P.PATTERN101:return function(e,t){return e*t%2+e*t%3==0};case P.PATTERN110:return function(e,t){return(e*t%2+e*t%3)%2==0};case P.PATTERN111:return function(e,t){return(e*t%3+(e+t)%2)%2==0};default:throw`bad maskPattern:`+e}},r.getErrorCorrectPolynomial=function(e){let t=L([1],0);for(let n=0;n<e;n+=1)t=t.multiply(L([1,I.gexp(n)],0));return t},r.getLengthInBits=function(e,t){if(1<=t&&t<10)switch(e){case M.MODE_NUMBER:return 10;case M.MODE_ALPHA_NUM:return 9;case M.MODE_8BIT_BYTE:return 8;case M.MODE_KANJI:return 8;default:throw`mode:`+e}else if(t<27)switch(e){case M.MODE_NUMBER:return 12;case M.MODE_ALPHA_NUM:return 11;case M.MODE_8BIT_BYTE:return 16;case M.MODE_KANJI:return 10;default:throw`mode:`+e}else if(t<41)switch(e){case M.MODE_NUMBER:return 14;case M.MODE_ALPHA_NUM:return 13;case M.MODE_8BIT_BYTE:return 16;case M.MODE_KANJI:return 12;default:throw`mode:`+e}else throw`type:`+t},r.getLostPoint=function(e){let t=e.getModuleCount(),n=0;for(let r=0;r<t;r+=1)for(let i=0;i<t;i+=1){let a=0,o=e.isDark(r,i);for(let n=-1;n<=1;n+=1)if(!(r+n<0||t<=r+n))for(let s=-1;s<=1;s+=1)i+s<0||t<=i+s||(n!=0||s!=0)&&o==e.isDark(r+n,i+s)&&(a+=1);a>5&&(n+=3+a-5)}for(let r=0;r<t-1;r+=1)for(let i=0;i<t-1;i+=1){let t=0;e.isDark(r,i)&&(t+=1),e.isDark(r+1,i)&&(t+=1),e.isDark(r,i+1)&&(t+=1),e.isDark(r+1,i+1)&&(t+=1),(t==0||t==4)&&(n+=3)}for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(r,i)&&!e.isDark(r,i+1)&&e.isDark(r,i+2)&&e.isDark(r,i+3)&&e.isDark(r,i+4)&&!e.isDark(r,i+5)&&e.isDark(r,i+6)&&(n+=40);for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(i,r)&&!e.isDark(i+1,r)&&e.isDark(i+2,r)&&e.isDark(i+3,r)&&e.isDark(i+4,r)&&!e.isDark(i+5,r)&&e.isDark(i+6,r)&&(n+=40);let r=0;for(let n=0;n<t;n+=1)for(let i=0;i<t;i+=1)e.isDark(i,n)&&(r+=1);let i=Math.abs(100*r/t/t-50)/5;return n+=i*10,n},r}(),I=function(){let e=Array(256),t=Array(256);for(let t=0;t<8;t+=1)e[t]=1<<t;for(let t=8;t<256;t+=1)e[t]=e[t-4]^e[t-5]^e[t-6]^e[t-8];for(let n=0;n<255;n+=1)t[e[n]]=n;let n={};return n.glog=function(e){if(e<1)throw`glog(`+e+`)`;return t[e]},n.gexp=function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return e[t]},n}(),L=function(e,t){if(e.length===void 0)throw e.length+`/`+t;let n=function(){let n=0;for(;n<e.length&&e[n]==0;)n+=1;let r=Array(e.length-n+t);for(let t=0;t<e.length-n;t+=1)r[t]=e[t+n];return r}(),r={};return r.getAt=function(e){return n[e]},r.getLength=function(){return n.length},r.multiply=function(e){let t=Array(r.getLength()+e.getLength()-1);for(let n=0;n<r.getLength();n+=1)for(let i=0;i<e.getLength();i+=1)t[n+i]^=I.gexp(I.glog(r.getAt(n))+I.glog(e.getAt(i)));return L(t,0)},r.mod=function(e){if(r.getLength()-e.getLength()<0)return r;let t=I.glog(r.getAt(0))-I.glog(e.getAt(0)),n=Array(r.getLength());for(let e=0;e<r.getLength();e+=1)n[e]=r.getAt(e);for(let r=0;r<e.getLength();r+=1)n[r]^=I.gexp(I.glog(e.getAt(r))+t);return L(n,0).mod(e)},r},R=function(){let e=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t=function(e,t){let n={};return n.totalCount=e,n.dataCount=t,n},n={},r=function(t,n){switch(n){case N.L:return e[(t-1)*4+0];case N.M:return e[(t-1)*4+1];case N.Q:return e[(t-1)*4+2];case N.H:return e[(t-1)*4+3];default:return}};return n.getRSBlocks=function(e,n){let i=r(e,n);if(i===void 0)throw`bad rs block @ typeNumber:`+e+`/errorCorrectionLevel:`+n;let a=i.length/3,o=[];for(let e=0;e<a;e+=1){let n=i[e*3+0],r=i[e*3+1],a=i[e*3+2];for(let e=0;e<n;e+=1)o.push(t(r,a))}return o},n}(),z=function(){let e=[],t=0,n={};return n.getBuffer=function(){return e},n.getAt=function(t){let n=Math.floor(t/8);return(e[n]>>>7-t%8&1)==1},n.put=function(e,t){for(let r=0;r<t;r+=1)n.putBit((e>>>t-r-1&1)==1)},n.getLengthInBits=function(){return t},n.putBit=function(n){let r=Math.floor(t/8);e.length<=r&&e.push(0),n&&(e[r]|=128>>>t%8),t+=1},n},B=function(e){let t=M.MODE_NUMBER,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+2<t.length;)e.put(i(t.substring(r,r+3)),10),r+=3;r<t.length&&(t.length-r==1?e.put(i(t.substring(r,r+1)),4):t.length-r==2&&e.put(i(t.substring(r,r+2)),7))};let i=function(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*10+a(e.charAt(n));return t},a=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;throw`illegal char :`+e};return r},V=function(e){let t=M.MODE_ALPHA_NUM,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+1<t.length;)e.put(i(t.charAt(r))*45+i(t.charAt(r+1)),11),r+=2;r<t.length&&e.put(i(t.charAt(r)),6)};let i=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;if(`A`<=e&&e<=`Z`)return e.charCodeAt(0)-65+10;switch(e){case` `:return 36;case`$`:return 37;case`%`:return 38;case`*`:return 39;case`+`:return 40;case`-`:return 41;case`.`:return 42;case`/`:return 43;case`:`:return 44;default:throw`illegal char :`+e}};return r},H=function(e){let t=M.MODE_8BIT_BYTE,n=j.stringToBytes(e),r={};return r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){for(let t=0;t<n.length;t+=1)e.put(n[t],8)},r},U=function(e){let t=M.MODE_KANJI,n=j.stringToBytes;(function(e,t){let r=n(e);if(r.length!=2||(r[0]<<8|r[1])!=t)throw`sjis not supported.`})(`友`,38726);let r=n(e),i={};return i.getMode=function(){return t},i.getLength=function(e){return~~(r.length/2)},i.write=function(e){let t=r,n=0;for(;n+1<t.length;){let r=(255&t[n])<<8|255&t[n+1];if(33088<=r&&r<=40956)r-=33088;else if(57408<=r&&r<=60351)r-=49472;else throw`illegal char at `+(n+1)+`/`+r;r=(r>>>8&255)*192+(r&255),e.put(r,13),n+=2}if(n<t.length)throw`illegal char at `+(n+1)},i},W=function(){let e=[],t={};return t.writeByte=function(t){e.push(t&255)},t.writeShort=function(e){t.writeByte(e),t.writeByte(e>>>8)},t.writeBytes=function(e,n,r){n||=0,r||=e.length;for(let i=0;i<r;i+=1)t.writeByte(e[i+n])},t.writeString=function(e){for(let n=0;n<e.length;n+=1)t.writeByte(e.charCodeAt(n))},t.toByteArray=function(){return e},t.toString=function(){let t=``;t+=`[`;for(let n=0;n<e.length;n+=1)n>0&&(t+=`,`),t+=e[n];return t+=`]`,t},t},G=function(){let e=0,t=0,n=0,r=``,i={},a=function(e){r+=String.fromCharCode(o(e&63))},o=function(e){if(e<0)throw`n:`+e;if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(e==62)return 43;if(e==63)return 47;throw`n:`+e};return i.writeByte=function(r){for(e=e<<8|r&255,t+=8,n+=1;t>=6;)a(e>>>t-6),t-=6},i.flush=function(){if(t>0&&(a(e<<6-t),e=0,t=0),n%3!=0){let e=3-n%3;for(let t=0;t<e;t+=1)r+=`=`}},i.toString=function(){return r},i},K=function(e){let t=e,n=0,r=0,i=0,a={};a.read=function(){for(;i<8;){if(n>=t.length){if(i==0)return-1;throw`unexpected end of file./`+i}let e=t.charAt(n);if(n+=1,e==`=`)return i=0,-1;e.match(/^\s$/)||(r=r<<6|o(e.charCodeAt(0)),i+=6)}let e=r>>>i-8&255;return i-=8,e};let o=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(e==43)return 62;if(e==47)return 63;throw`c:`+e};return a},q=function(e,t){let n=e,r=t,i=Array(e*t),a={};a.setPixel=function(e,t,r){i[t*n+e]=r},a.write=function(e){e.writeString(`GIF87a`),e.writeShort(n),e.writeShort(r),e.writeByte(128),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(255),e.writeByte(255),e.writeByte(255),e.writeString(`,`),e.writeShort(0),e.writeShort(0),e.writeShort(n),e.writeShort(r),e.writeByte(0);let t=s(2);e.writeByte(2);let i=0;for(;t.length-i>255;)e.writeByte(255),e.writeBytes(t,i,255),i+=255;e.writeByte(t.length-i),e.writeBytes(t,i,t.length-i),e.writeByte(0),e.writeString(`;`)};let o=function(e){let t=e,n=0,r=0,i={};return i.write=function(e,i){if(e>>>i)throw`length over`;for(;n+i>=8;)t.writeByte(255&(e<<n|r)),i-=8-n,e>>>=8-n,r=0,n=0;r=e<<n|r,n+=i},i.flush=function(){n>0&&t.writeByte(r)},i},s=function(e){let t=1<<e,n=(1<<e)+1,r=e+1,a=c();for(let e=0;e<t;e+=1)a.add(String.fromCharCode(e));a.add(String.fromCharCode(t)),a.add(String.fromCharCode(n));let s=W(),l=o(s);l.write(t,r);let u=0,d=String.fromCharCode(i[u]);for(u+=1;u<i.length;){let e=String.fromCharCode(i[u]);u+=1,a.contains(d+e)?d+=e:(l.write(a.indexOf(d),r),a.size()<4095&&(a.size()==1<<r&&(r+=1),a.add(d+e)),d=e)}return l.write(a.indexOf(d),r),l.write(n,r),l.flush(),s.toByteArray()},c=function(){let e={},t=0,n={};return n.add=function(r){if(n.contains(r))throw`dup key:`+r;e[r]=t,t+=1},n.size=function(){return t},n.indexOf=function(t){return e[t]},n.contains=function(t){return e[t]!==void 0},n};return a},J=function(e,t,n){let r=q(e,t);for(let i=0;i<t;i+=1)for(let t=0;t<e;t+=1)r.setPixel(t,i,n(t,i));let i=W();r.write(i);let a=G(),o=i.toByteArray();for(let e=0;e<o.length;e+=1)a.writeByte(o[e]);return a.flush(),`data:image/gif;base64,`+a};j.stringToBytes;function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Y.apply(null,arguments)}function X(e,t){if(e==null)return{};var n,r,i=ce(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ce(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var le=[`bgColor`,`bgD`,`fgD`,`fgColor`,`size`,`title`,`viewBoxSize`,`xmlns`],ue={bgColor:A.default.oneOfType([A.default.object,A.default.string]).isRequired,bgD:A.default.string.isRequired,fgColor:A.default.oneOfType([A.default.object,A.default.string]).isRequired,fgD:A.default.string.isRequired,size:A.default.number.isRequired,title:A.default.string,viewBoxSize:A.default.number.isRequired,xmlns:A.default.string},Z=(0,k.forwardRef)(function(e,t){var n=e.bgColor,r=e.bgD,i=e.fgD,a=e.fgColor,o=e.size,s=e.title,c=e.viewBoxSize,l=e.xmlns,u=l===void 0?`http://www.w3.org/2000/svg`:l,d=X(e,le);return k.createElement(`svg`,Y({},d,{height:o,ref:t,viewBox:`0 0 ${c} ${c}`,width:o,xmlns:u}),s?k.createElement(`title`,null,s):null,k.createElement(`path`,{d:r,fill:n}),k.createElement(`path`,{d:i,fill:a}))});Z.displayName=`QRCodeSvg`,Z.propTypes=ue;var de=[`bgColor`,`fgColor`,`level`,`size`,`value`];j.stringToBytes=function(e){return Array.from(new TextEncoder().encode(e))};var fe={bgColor:A.default.oneOfType([A.default.object,A.default.string]),fgColor:A.default.oneOfType([A.default.object,A.default.string]),level:A.default.string,size:A.default.number,value:A.default.string.isRequired},Q=(0,k.forwardRef)(function(e,t){var n=e.bgColor,r=n===void 0?`#FFFFFF`:n,i=e.fgColor,a=i===void 0?`#000000`:i,o=e.level,s=o===void 0?`L`:o,c=e.size,l=c===void 0?256:c,u=e.value,d=X(e,de),f=j(0,s);f.addData(u),f.make();var p=f.getModuleCount(),m=Array.from({length:p},function(e,t){return Array.from({length:p},function(e,n){return f.isDark(t,n)})});return k.createElement(Z,Y({},d,{bgColor:r,bgD:m.map(function(e,t){return e.map(function(e,n){return e?``:`M ${n} ${t} l 1 0 0 1 -1 0 Z`}).join(` `)}).join(` `),fgColor:a,fgD:m.map(function(e,t){return e.map(function(e,n){return e?`M ${n} ${t} l 1 0 0 1 -1 0 Z`:``}).join(` `)}).join(` `),ref:t,size:l,viewBoxSize:p}))});Q.displayName=`QRCode`,Q.propTypes=fe;var $=o(),pe=e=>({mode:e,ready:!1,accessUrl:null,reasons:[`远程服务未就绪`]});function me(){let{snap:t}=h(),{busy:i,run:o}=x(),c=[...t.instances?.native?[t.instances.native]:[],...t.instances?.instances??[]],l=t.lan?.items??[],E=t.frp,[D,O]=(0,k.useState)(``),[A,j]=(0,k.useState)(`7000`),[M,N]=(0,k.useState)(``),[P,F]=(0,k.useState)(!1),[I,L]=(0,k.useState)(null),[R,z]=(0,k.useState)(``),[B,V]=(0,k.useState)(!1),H=e();(0,k.useEffect)(()=>{!E||P||(O(E.settings.serverAddr||``),j(String(E.settings.serverPort||7e3)),F(!0))},[E,P]);function U(){let e={serverAddr:D,serverPort:parseInt(A,10)||7e3},t=M.trim();return t&&(e.authToken=t),e}async function W(e,t,n){let r=!1,i=await o(e.id,()=>d.remoteSetMode(e.id,t).then(e=>(r=e?.tokenAutoAllocated===!0,e)),{success:n});return i&&r&&a.info(`已自动生成访问令牌,点钥匙按钮可查看或修改`),i}async function G(e){await H({title:`开启远程控制?`,description:`「`+(e.name||e.id)+`」将开启局域网反向代理,同网段设备可访问该实例(无访问令牌时自动生成一个,可在钥匙按钮处查看)。`,confirmText:`开启远程控制`})&&await W(e,`lan`,`已开启远程控制(局域网)`)}async function K(e){await H({title:`切换到公网访问?`,description:`「`+(e.name||e.id)+`」的访问端口将映射到公网(frps),互联网上任何人都可尝试触达(访问令牌是硬性前置,缺失时自动生成)。`,confirmText:`切换到公网`})&&await W(e,`wan`,`已切换到公网访问`)}function q(e,t){z(t??``),V(!1),L({id:e.id,name:e.name,current:t})}async function J(){let e=I;if(!e)return;let t=R.trim();if(!t){a.error(`令牌不能为空`);return}if(t.length<8){a.error(`远程访问令牌至少 8 位(公网暴露可被暴力枚举)`);return}L(null),(e.current===null||e.current!==t)&&await o(e.id,()=>d.remoteSetToken(e.id,t),{success:`访问令牌已设置`})}async function Y(){await o(`frp-save`,()=>d.remoteFrpServer(U()),{success:`已保存 FRP 配置`})}return(0,$.jsxs)(`div`,{className:`grid content-start gap-4`,children:[(0,$.jsxs)(`div`,{className:`grid items-start gap-4 @min-[900px]:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,$.jsxs)(T,{children:[(0,$.jsx)(S,{title:`远程控制`,subtitle:`为本地 DSH 实例开启远程访问:局域网直连或经 FRP 公网(需实例运行中)`}),(0,$.jsx)(`div`,{className:`grid`,children:c.length?c.map(e=>{let t=e.state?.running??!1,a=l.find(t=>t.dshPort===e.port),o=e.remoteMode??`off`,s=o===`off`?null:a?.remote??pe(o),c=s?.accessUrl??null,u=typeof e.remoteToken==`string`&&e.remoteToken.trim()?e.remoteToken.trim():null,d=s?.ready&&c?u?c+`?token=`+encodeURIComponent(u):c:null,f=u!==null||!!a?.tokenSet,p=o===`off`?(0,$.jsx)(C,{tone:`off`,children:`远程关闭`}):s?.ready?(0,$.jsx)(C,{tone:o===`wan`?`boot`:`ok`,children:o===`wan`?`公网就绪`:`局域网就绪`}):(0,$.jsx)(`span`,{title:(s?.reasons??[]).join(`;`),children:(0,$.jsx)(C,{tone:`off`,children:`远程停止`})});return(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)_auto] items-stretch gap-4 border-b border-border/60 px-5 py-4 last:border-b-0`,children:[d?(0,$.jsx)(`div`,{className:`flex shrink-0 items-center rounded-lg border border-border bg-white p-1.5`,title:u?`扫码访问该实例远程地址(已带访问令牌,一次出示后凭 Cookie)`:`扫码访问该实例远程地址`,children:(0,$.jsx)(Q,{value:d,size:88})}):(0,$.jsx)(`div`,{className:`grid size-[96px] shrink-0 place-items-center rounded-lg border border-dashed border-border/70 text-center text-[11px] leading-tight text-muted-foreground/60`,children:t?o===`off`?`开启远程后生成二维码`:`远程就绪后生成二维码`:`启动后可用`}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`pt-2.5 flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(w,{kind:e.kind}),(0,$.jsx)(`strong`,{className:`truncate text-sm font-semibold text-foreground`,children:e.name}),p]}),(0,$.jsxs)(`div`,{className:`mt-auto grid content-end gap-1.5 pb-1`,children:[(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`端口 `,e.port,o!==`off`&&a?.wanPort?` · 访问端口 `+a.wanPort+(o===`wan`?`(公网同号)`:``):``]}),c?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void y(()=>ee(c)),className:`inline-flex max-w-full items-center gap-1 truncate text-xs text-primary hover:underline`,title:u?`令牌绝不进浏览器启动参数,故直接打开需自行附加 ?token=;扫码可直达`:`在系统浏览器中打开该地址`,children:[(0,$.jsx)(b,{className:`size-3 shrink-0`}),c]}):!t||o===`off`?(0,$.jsx)(`div`,{className:`text-xs text-muted-foreground/70`,children:t?`远程未开启`:`实例未运行,启动后可开启远程`}):null,s&&!s.ready?(0,$.jsx)(`div`,{className:`text-xs text-muted-foreground/70`,children:(s.reasons??[]).slice(0,2).join(`;`)||`等待代理分配访问地址…`}):null]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col items-end justify-center gap-2`,children:[(0,$.jsxs)(`div`,{className:r(`flex items-center gap-2`,!t&&`pointer-events-none opacity-50`),children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`远程控制`}),(0,$.jsx)(m,{checked:o!==`off`,disabled:!t||i===e.id,onCheckedChange:t=>{if(!t){W(e,`off`,`已关闭远程控制`);return}G(e)}})]}),o!==`off`&&(0,$.jsxs)(`div`,{className:r(`flex items-center gap-1`,(!t||i===e.id)&&`pointer-events-none opacity-50`),children:[(0,$.jsxs)(n,{className:`h-7 px-2 text-xs`,size:`chip`,variant:o===`lan`?`default`:`outline`,title:`局域网反向代理访问(同网段)`,onClick:()=>{o!==`lan`&&W(e,`lan`,`已切换到局域网访问`)},children:[(0,$.jsx)(ae,{className:`size-3.5`}),`局域网`]}),(0,$.jsxs)(n,{className:`h-7 px-2 text-xs`,size:`chip`,variant:o===`wan`?`default`:`outline`,title:E?.settings?.serverAddr?`经 FRP 暴露到公网(需访问令牌)`:`需先在右侧配置 frps 服务器地址`,onClick:()=>{o!==`wan`&&K(e)},children:[(0,$.jsx)(re,{className:`size-3.5`}),`公网`]})]}),(0,$.jsx)(n,{className:`h-7 px-1.5`,disabled:i===e.id,onClick:()=>void q(e,u),size:`chip`,title:f?`访问令牌已设置(点击查看或修改)`:`未设访问令牌:局域网侧同网段可直接访问,公网模式会被安全闸拒绝,点击设置`,variant:`outline`,children:(0,$.jsx)(ie,{className:r(`size-3.5`,f?`text-status-ok`:`text-amber-500`)})})]})]},e.id)}):(0,$.jsx)(`div`,{className:`px-5 py-8 text-center text-sm text-muted-foreground`,children:`暂无实例(在「实例管理」添加后将出现在这里)`})})]}),(0,$.jsxs)(T,{children:[(0,$.jsx)(S,{title:`公网访问(FRP 内网穿透)`,subtitle:`存在「公网」模式的实例时 frpc 自动常驻并建立隧道`,actions:(0,$.jsx)(C,{tone:E?.running?`ok`:E?.installed?`warn`:`off`,children:E?.running?`frpc 运行中`:E?.installed?`已安装 · 未运行`:`未安装`})}),(0,$.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsx)(p,{children:`frps 地址`}),(0,$.jsx)(u,{placeholder:`如 1.2.3.4`,value:D,onChange:e=>O(e.target.value)})]}),(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsx)(p,{children:`frps 端口`}),(0,$.jsx)(u,{inputMode:`numeric`,placeholder:`7000`,value:A,onChange:e=>j(e.target.value)})]}),(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsx)(p,{children:`auth token`}),(0,$.jsx)(u,{type:`password`,autoComplete:`new-password`,placeholder:E?.settings?.authTokenSet?`已设置 · 留空不修改,输入即轮换`:`frps 的 auth.token`,value:M,onChange:e=>N(e.target.value)})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-5 pb-4`,children:[(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[E?.installed?``:`需安装 frpc`,(E?.instancesExposed?.length??0)>0?` · 公网实例 `+E?.instancesExposed?.length+` 个`:` · 无公网模式实例`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(n,{disabled:i===`frp-inst`,onClick:()=>void o(`frp-inst`,()=>d.remoteFrpInstall(),{success:`frpc 安装完成`}),variant:`outline`,children:[(0,$.jsx)(se,{className:`size-4`}),`安装 frpc`]}),(0,$.jsxs)(n,{disabled:i===`frp-save`,onClick:()=>void Y(),children:[(0,$.jsx)(oe,{className:`size-4`}),`保存并应用`]})]})]}),E?.logTail?.length?(0,$.jsx)(`pre`,{className:`mx-5 mb-4 max-h-[160px] overflow-auto whitespace-pre-wrap break-all rounded-md bg-muted/70 p-3 font-mono text-xs leading-relaxed text-muted-foreground`,children:E.logTail.join(`
|
|
4
4
|
`)}):null]})]}),(0,$.jsx)(g,{open:!!I,onOpenChange:e=>!e&&L(null),children:(0,$.jsxs)(v,{className:`max-w-[420px]`,children:[(0,$.jsx)(_,{children:(0,$.jsxs)(s,{children:[`访问令牌`,I?.name?` · `+I.name:``]})}),(0,$.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`远程访问需携带此令牌:首次在地址后附加 `,(0,$.jsx)(`code`,{className:`break-all`,children:`?token=令牌`}),`(只需一次,之后凭会话 Cookie 访问)。`,I?.current==null?`令牌明文只在内核所在机器上下发,当前面板读不到现值——输入即设为新令牌。`:`公网模式硬性要求它;此处显示的是当前生效值,改成新值即轮换。`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(u,{className:`flex-1`,type:B?`text`:`password`,autoComplete:`off`,placeholder:`输入访问令牌`,value:R,onChange:e=>z(e.target.value),onKeyDown:e=>{e.key===`Enter`&&J()}}),I?.current!=null&&(0,$.jsx)(n,{className:`h-9 px-2`,size:`chip`,variant:`outline`,title:B?`隐藏令牌`:`显示令牌`,onClick:()=>V(e=>!e),children:B?(0,$.jsx)(te,{className:`size-4`}):(0,$.jsx)(ne,{className:`size-4`})})]}),(0,$.jsxs)(f,{children:[(0,$.jsx)(n,{variant:`outline`,onClick:()=>L(null),children:`取消`}),(0,$.jsx)(n,{disabled:!R.trim()||i===I?.id,onClick:()=>void J(),children:`保存`})]})]})})]})}export{me as LanPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{F as e,I as t,L as n,N as r,O as i,R as a,S as o,U as s,V as c,a as l,b as ee,h as u,k as d,m as f,t as p,v as m,x as h,y as te}from"./supervisor-DSBgs_XY.js";import{n as g,o as _}from"./openExternal-Ayshj45y.js";import{n as v,t as y}from"./rocket-cmjG68ou.js";import{t as b}from"./refresh-cw-GKBYw9-E.js";import{l as x,n as S,p as C,r as w,s as T}from"./supervisor-DWUbDZTX.js";import{t as E}from"./useSupervisorAction-U8T1qRbC.js";import{c as D,i as O,n as k,o as A,t as j}from"./widgets-DV5fuKzB.js";import{n as M,t as N}from"./format-QeaTKFhQ.js";var P=r(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),F=r(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),I=r(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),L=s(c(),1),R=a();function z(e,t){return e===`dsh-main`||e===`supervisor-api`?`boot`:(t||``).startsWith(`inst:`)?`ok`:e===`relay`?`warn`:e.startsWith(`managed:`)?`boot`:`off`}function B(e){let t={"dsh-main":`DSH 主实例`,"supervisor-api":`管家 API`,user:`沙箱实例`,relay:`局域网隧道`,oauthCallback:`登录回调`,proxyInstance:`反代实例`,providerApi:`供应商 API`,"managed:router-daemon":`智能路由`,"managed:lan-daemon":`远程控制`,dynamic:`动态端口`},n=/^managed:(.+)$/.exec(e.role);return n?t[e.role]??n[1]:t[e.role]??e.role}function V(e,t){let n=e.owner||``;if(e.role===`proxyInstance`){let e=(n.split(`:`).pop()||``).slice(-4),r=(t??[]).find(t=>(t.accounts??[]).some(t=>(t.maskedKey||``).endsWith(e)));return r?r.name:`反代`}return n.startsWith(`inst:`)?`沙箱实例`:n.startsWith(`system:`)?`系统`:n.startsWith(`relay:`)?`局域网隧道`:n.startsWith(`dynamic:`)?`动态`:n.startsWith(`providerApi:`)?`供应商`:n.startsWith(`oauth:`)?`登录回调`:n===`router-daemon`||e.role===`managed:router-daemon`?`智能路由`:n===`lan-daemon`||e.role===`managed:lan-daemon`?`远程控制`:e.role===`oauthCallback`?`登录回调`:e.role}function H({providers:e=[]}){let{snap:t}=p(),r=t.ports?.records??null,i=(0,L.useMemo)(()=>r?[...r.filter(e=>e.role!==`supervisor-api`||e.port!==3100&&e.port!==3101)].sort((e,t)=>!!e.active==!!t.active?e.port-t.port:e.active?-1:1):null,[r]);return(0,R.jsxs)(j,{className:`flex min-h-0 flex-col overflow-hidden`,children:[(0,R.jsx)(k,{title:`运行状态`,subtitle:`核心服务与端口实时状态`,actions:i?(0,R.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[i.length,` 端口`]}):null}),i?(0,R.jsxs)(`div`,{className:`min-h-0 overflow-x-auto`,children:[(0,R.jsxs)(`div`,{className:`grid min-w-[400px] grid-cols-[56px_minmax(0,1fr)_auto_66px] items-center gap-2 border-b border-border/60 bg-muted/60 px-4 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,R.jsx)(`span`,{children:`端口`}),(0,R.jsx)(`span`,{children:`服务`}),(0,R.jsx)(`span`,{className:`text-right`,children:`归属`}),(0,R.jsx)(`span`,{className:`text-right`,children:`状态`})]}),(0,R.jsx)(`div`,{className:`max-h-[340px] overflow-y-auto overscroll-contain`,children:i.map((t,r)=>(0,R.jsxs)(`div`,{className:n(`grid grid-cols-[56px_minmax(0,1fr)_auto_66px] items-center gap-2 px-4 py-2 hover:bg-muted/40`,r>0&&`border-t border-border/50`),children:[(0,R.jsx)(`code`,{className:`font-mono text-sm tabular-nums text-foreground`,children:t.port}),(0,R.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:(0,R.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:B(t)})}),(0,R.jsx)(`div`,{className:`flex justify-end`,children:(0,R.jsx)(A,{tone:z(t.role,t.owner),children:V(t,e)})}),(0,R.jsx)(`div`,{className:`flex justify-end`,children:t.active===!0?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap text-[11px] text-status-ok`,children:[(0,R.jsx)(F,{className:`size-3`}),`运行中`]}):t.active===!1?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap text-[11px] text-muted-foreground`,children:[(0,R.jsx)(F,{className:`size-3 opacity-50`}),`未运行`]}):(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap text-[11px] text-muted-foreground`,children:[(0,R.jsx)(F,{className:`size-3 opacity-40`}),`状态未知`]})})]},t.port+`-`+t.owner))})]}):(0,R.jsx)(`div`,{className:`px-5 py-6 text-center text-xs text-muted-foreground`,children:`运行状态加载中…`})]})}function U(e){if(!e)return`未读出`;let t=String(e.state||`?`),n=e.detail?`(`+String(e.detail)+`)`:``;return(String(e.label||``)||`条目`)+` `+t+n}function W(e){return!e||e.state===`pending`?`未探测(点「重新探测」补齐)`:e.state===`error`?`探测失败:`+(e.error||`未给出原因`):e.state===`empty`?`已探测,无内容`:`已探测`+(e.at?` `+new Date(e.at).toLocaleTimeString():``)}function G(e){let t=e||{};return t.state===`on`?`在用(`+(t.server||t.pac||`地址未读出`)+`)`:t.state===`off`?`系统里明确未启用`:t.state===`unknown`?`取不到`+(t.source?`(`+t.source+`)`:``)+`,按判不出处理`:`未探测`}function K(e){return e===!0?`可达`:e===!1?`不通`:`判不出`}function q(e){return(e.section?e.section+`:`:``)+e.source+`:`+String(e.detail??``)}function J(e){return typeof e!=`number`||!Number.isFinite(e)||e<0?`时间未读出`:e<6e4?`刚刚`:e<36e5?Math.floor(e/6e4)+` 分钟前`:e<864e5?Math.floor(e/36e5)+` 小时前`:Math.floor(e/864e5)+` 天前`}function Y(e){return e===!0?`是`:e===!1?`否`:`未读出`}function X(e,t,n){let r=t||``,i=n||``,a=r&&i&&r!==i?`(两份不一致:装内核用的是壳那套,本进程解析到的是内核这套)`:``;return e+` 内核 `+(r||`未读出`)+` / 壳 `+(i||`未报`)+a}function ne(e){let t=e.ok===!0?`通`:e.ok===!1?`不通`:`判不出`;return(e.probe||`明细`)+` `+t+(e.target?`(`+e.target+`)`:``)+(typeof e.ms==`number`?` `+e.ms+` 毫秒`:``)}function Z(e,t){return e?t?`没落盘(这一拍读的是内核缓存拍)`:e.written===!0?`已写入`:e.error?`失败:`+e.error:`没落盘(也没报错误)`:`未给出(这一拍没装配)`}function re(e,t){if(t)return`读不回:`+t;if(!e)return`未读`;if(e.available===!0){let t=typeof e.at==`number`?new Date(e.at).toLocaleString():`时间未读出`,n=e.data&&e.data.browsers?e.data.browsers.length:null;return t+`(`+J(e.ageMs)+`)`+(n===null?``:`,候选 `+n+` 个`)}return e.reason===`never-written`?`这台机器还没落过盘`:`快照文件读不出或版本不符(不是没写过,得查文件)`}function ie(e){let t=e||{},n=Object.keys(t).filter(e=>t[e]!==`ok`);return n.length?`未补齐:`+n.join(`、`):`全部维度补齐`}function ae(e){let t=e&&e.name?e.name:`未定出`;return!e||!e.how?`现在会用:`+t:e.how===`user-preference`?`现在会用:`+t+`(你选的)`:e.how===`candidate-rank`?`现在会用:`+t+`(系统未报默认项,按候选次序取首个,可在此改)`:e.how===`only-installed`?`现在会用:`+t+`(本机唯一候选)`:e.how===`none-found`?`本机未探到可用浏览器,请安装或启用一个后重新探测`:`现在会用:`+t+`(系统默认项)`}var Q=`__system__`;function $(){let[e,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(null),[s,c]=(0,L.useState)(null),[p,g]=(0,L.useState)(null),[v,y]=(0,L.useState)(!1),[x,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(null),[T,E]=(0,L.useState)(null),D=(0,L.useRef)(new Map),O=(0,L.useCallback)(e=>{let t=D.current.get(e);if(t)return t;let n=(async()=>{e&&y(!0);try{let t=await l.environment(e);a(t),c(null)}catch(e){c(String(e.message||e))}y(!1),l.environmentLast().then(e=>{w(e),E(null)}).catch(e=>{w(null),E(String(e.message||e))})})().finally(()=>{D.current.delete(e)});return D.current.set(e,n),n},[]);(0,L.useEffect)(()=>{e&&O(!1)},[e,O]);let k=async e=>{S(!0);let t={ok:!1,error:`偏好写入未返回结果`};try{t=await l.setExternalBrowser(e)}catch(e){t={ok:!1,error:String(e.message||e)}}if(S(!1),!t||t.ok!==!0){c(t&&t.error||`偏好写入失败`);return}c(null),g(null),await O(!0)},A=i?.browsers??[],j=i?.sections,M=i?.pick?.stale===!0,N=i?.preference?.id||Q,P=p===null?N:p,F=j?.startup?.data,I=j?.shell?.data,z=I?.registry,B=z?.probes||[],V=I?.records||[],H=z?.latencyMs,$=z?.probesTotal??0,oe=j?.runtime?.data?.node?.version||null,se=j?.runtime?.data?.npm?.detail||null;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 whitespace-nowrap`,children:[(0,R.jsxs)(t,{size:`sm`,variant:`ghost`,className:`h-6 gap-1 px-1.5 text-xs text-muted-foreground`,onClick:()=>r(!0),children:[(0,R.jsx)(_,{className:`size-3`}),`环境表单`]}),i?.pick?.name?(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground/70`,children:i.pick.name}):null]}),(0,R.jsx)(m,{open:e,onOpenChange:r,children:(0,R.jsxs)(te,{className:`max-w-[560px]`,children:[(0,R.jsx)(h,{children:(0,R.jsx)(o,{children:`本机环境表单`})}),(0,R.jsxs)(`div`,{className:`grid max-h-[60vh] gap-3 overflow-y-auto text-sm`,children:[(0,R.jsx)(`p`,{className:n(`text-xs`,M||!A.length?`font-semibold text-warning`:`text-muted-foreground`),children:ae(i?.pick)}),M?(0,R.jsxs)(`p`,{className:`inline-flex items-start gap-1.5 rounded-md bg-warning-background px-2 py-1.5 text-xs font-semibold text-warning`,children:[(0,R.jsx)(d,{className:`mt-0.5 size-3.5 shrink-0`}),`你先前选的浏览器已不在本机候选清单(可能已卸载或路径变更),下方选择已回落到系统判定,请重选或清除。`]}):null,s?(0,R.jsx)(`p`,{className:`text-xs text-status-error`,children:s}):null,(0,R.jsxs)(`div`,{className:`grid gap-2 rounded-md border border-border/60 px-3 py-2.5`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium`,children:`打开地址用哪个浏览器`}),(0,R.jsxs)(f,{value:P,onValueChange:g,className:`grid gap-1.5`,children:[(0,R.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-2 text-xs`,children:[(0,R.jsx)(u,{value:Q,id:`env-pref-system`}),(0,R.jsx)(`span`,{children:`跟随系统默认(本机探不到默认项时按候选次序)`})]}),A.map(e=>(0,R.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-2 text-xs`,children:[(0,R.jsx)(u,{value:e.id,id:`env-pref-`+e.id}),(0,R.jsx)(`span`,{children:e.name||e.bin}),(0,R.jsx)(`span`,{className:`text-muted-foreground/70`,children:e.engine}),e.isDefault?(0,R.jsx)(`span`,{className:`text-muted-foreground/70`,children:`系统默认`}):null]},e.id))]}),A.length?(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(t,{size:`sm`,variant:`outline`,disabled:x||P===N,onClick:()=>void k(P===Q?``:P),children:`保存偏好`}),(0,R.jsx)(t,{size:`sm`,variant:`ghost`,disabled:x||N===Q,onClick:()=>void k(``),children:`清除`})]}):(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`候选为空:重新探测后仍为空时,请先在系统里安装或启用一个浏览器。`})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-border/60 px-3 py-2.5`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium`,children:`出网条件(隔离登录窗口的分发依据)`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:W(j?.egress)}),j?.egress?.data?(0,R.jsxs)(`div`,{className:`grid gap-0.5 text-xs`,children:[(0,R.jsxs)(`span`,{className:`text-muted-foreground`,children:[`系统代理:`,G(j?.egress?.data?.proxy)]}),Object.entries(j?.egress?.data?.targets||{}).map(([e,t])=>(0,R.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,`:`,K(t?.ok),t?.stage?`(停在 `+t.stage+(t.detail?` `+t.detail:``)+`)`:``]},e)),Object.keys(j?.egress?.data?.targets||{}).length?null:(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`还没有目标域被问过:一键登录时会当场判定并记在这里。`})]}):null,j?.egress?.data?.proxy?.state===`off`?(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`没有在用系统代理时,直连不通的授权域只能靠现有浏览器窗口的既有出网路径打开(隔离冷档案会是空白页)。`}):null]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-border/60 px-3 py-2.5`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium`,children:`运行时与 DSH(安装/升级动作的分发依据)`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:W(j?.runtime)}),j?.runtime?.data?(0,R.jsxs)(`div`,{className:`grid gap-0.5 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{children:[U(j?.runtime?.data?.node),` · `,U(j?.runtime?.data?.npm),` · `,U(j?.runtime?.data?.git)]}),j?.runtime?.data?.node?.min?(0,R.jsxs)(`span`,{className:`break-all`,children:[`Node 门槛:`,(j?.runtime?.data?.node).min,(j?.runtime?.data?.node).meets===!1?` ⇒ 本机版本低于门槛,不采纳现有 Node(会安装达标的官方版本)`:` ⇒ 已达门槛`]}):null,(0,R.jsxs)(`span`,{children:[`镜像源:`,j?.runtime?.data?.registry?.origin||`未读出`,j?.runtime?.data?.registry?.mode?`(`+j.runtime.data.registry.mode+`)`:``,` · 候选 `+(j?.runtime?.data?.registry?.candidates||[]).length+` 个`]}),(0,R.jsxs)(`span`,{className:`break-all`,children:[`全局前缀:`,j?.runtime?.data?.prefix||`未实测(npm root -g 未返回)`]})]}):null,(0,R.jsx)(`span`,{className:`text-xs font-medium`,children:`桌面壳所见(装内核时真正用的那一套,与上面的内核读数并排对照)`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:W(j?.shell)}),I?(0,R.jsxs)(`div`,{className:`grid gap-0.5 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{children:I.available===!0?`壳上报于 `+J(I.ageMs)+`,写入者 `+(I.writtenBy||`未署名`)+`(报告版本 `+(I.schema??`未读出`)+`)`:I.reason===`never-written`?`这台机器的壳还没报过:内核由命令行或别的进程拉起时这是常态,不是故障`:`壳报的文件读不出或版本不符(不是没写过,得查那个文件)`}),I.available===!0?(0,R.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,R.jsx)(`span`,{className:`break-all`,children:X(`Node:`,oe,I.node?.version)}),(0,R.jsx)(`span`,{className:`break-all`,children:X(`npm:`,se,I.npm?.version)}),(0,R.jsx)(`span`,{className:`break-all`,children:X(`镜像源:`,j?.runtime?.data?.registry?.origin,I.registry?.best)}),(0,R.jsx)(`span`,{className:`break-all`,children:X(`全局前缀:`,j?.runtime?.data?.prefix,I.prefix?.dir)}),I.node&&I.node.ok!==!0?(0,R.jsxs)(`span`,{children:[`壳判 Node 达标:`,Y(I.node.ok),`(`,I.node.version||`版本未报`,`,门槛 `,I.node.min||`未报`,`)`]}):null,I.prefix&&I.prefix.writable!==!0?(0,R.jsxs)(`span`,{className:`break-all`,children:[`壳判前缀可写:`,Y(I.prefix.writable),I.prefix.why?`(`+I.prefix.why+`)`:``]}):null,B.length||z?.best?(0,R.jsxs)(`span`,{className:`break-all`,children:[`壳的镜像源候选:`,B.map(e=>(e.url||`?`)+` `+K(e.ok)).join(`、`),typeof H==`number`?`(择优选中用时 `+H+` 毫秒)`:``,$>B.length?`(报告里共 `+$+` 个候选,此处只列前 `+B.length+` 个)`:``]}):null,V.length?(0,R.jsxs)(`span`,{children:[`壳的探测明细 `,V.length,` 条:`,V.slice(0,8).map(ne).join(`;`),V.length>8?`…其余见内核快照文件`:``,I.droppedRecords?`(报告送达时被截断 `+I.droppedRecords+` 条)`:``]}):null]}):null]}):null,(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:W(j?.dsh)}),j?.dsh?.data?(0,R.jsxs)(`div`,{className:`grid gap-0.5 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{children:[U(j?.dsh?.data?.dsh),` · `,U(j?.dsh?.data?.selfUpdate)]}),(0,R.jsxs)(`span`,{children:[`监控:`,j?.dsh?.data?.managed?`守卫托管`:`未托管`,j?.dsh?.data?.phase?` · `+j.dsh.data.phase:``]})]}):null]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-border/60 px-3 py-2.5`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium`,children:`启动既成事实(守卫这一拍真的跑过什么)`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:W(j?.startup)}),F?(0,R.jsxs)(`div`,{className:`grid gap-0.5 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{children:[`守卫启动于 `,typeof F.bootAt==`number`?new Date(F.bootAt).toLocaleTimeString():`未读出`,`,环境表单首拍排在启动后 `,F.envDelayMs??`未读出`,` 毫秒`]}),(0,R.jsxs)(`span`,{children:[`选路:自动启动 `,Y(F.routerAutostart),`,模式 `,F.routerMode||`未读出(这一拍没走到那步)`]}),(0,R.jsxs)(`span`,{children:[`更新检查:`,F.updateCheck?F.updateCheck.enabled?`开(首查排在启动后 `+(F.updateCheck.initialDelayMs??`未读出`)+` 毫秒,之后每 `+(F.updateCheck.intervalMs??`未读出`)+` 毫秒)`:`关(配置里就禁掉了,这同样是一条既成事实)`:`未记录`]}),(0,R.jsxs)(`span`,{children:[`壳监控:`,Y(F.shellWatchdog)]}),(0,R.jsx)(`span`,{children:F.lastRefresh?`最近一次表单刷新于 `+(typeof F.lastRefresh.at==`number`?new Date(F.lastRefresh.at).toLocaleTimeString():`未读出`)+`,耗时 `+(F.lastRefresh.tookMs??`未读出`)+` 毫秒,浏览器 `+(F.lastRefresh.browsers??`未读出`)+` 个,分发依据 `+(F.lastRefresh.pick||`未定出`)+`,落盘 `+Y(F.lastRefresh.snapshotWritten)+`;`+ie(F.lastRefresh.dims):`这一拍还没跑过表单刷新(首拍排在上面那个延迟之后)`})]}):null]}),(0,R.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`平台`}),(0,R.jsx)(`dd`,{className:`font-mono`,children:[i?.identity?.platform,i?.identity?.arch].filter(Boolean).join(` / `)||`—`}),(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`图形会话`}),(0,R.jsx)(`dd`,{children:i?.session?.available?`可用(`+(i?.session?.reason||`—`)+`)`:`不可用(`+(i?.session?.reason||`—`)+`)`}),(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`系统默认项`}),(0,R.jsx)(`dd`,{children:i?.default?i.default.id+`(来源 `+(i.default.source||`未读出`)+`)`:`未读出`}),(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`候选`}),(0,R.jsx)(`dd`,{children:A.length?A.map(e=>(e.name||e.bin)+`[`+(e.sources||[]).join(`+`)+`]`).join(`、`):`无`}),(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`探测留痕`}),(0,R.jsx)(`dd`,{className:`grid gap-0.5`,children:(i?.probed??[]).map((e,t)=>(0,R.jsx)(`span`,{className:`text-muted-foreground/80`,children:q(e)},t))}),(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`快照落盘`}),(0,R.jsxs)(`dd`,{className:`break-all font-mono text-muted-foreground/80`,children:[Z(i?.snapshot,i?.cached===!0),(0,R.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[` `,i?.snapshot?.path||`未给出路径`]})]}),(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`上一拍留痕`}),(0,R.jsx)(`dd`,{className:`text-muted-foreground`,children:re(C,T)})]})]}),(0,R.jsxs)(ee,{children:[(0,R.jsxs)(t,{variant:`outline`,disabled:v,onClick:()=>void O(!0),children:[(0,R.jsx)(b,{className:`size-4`}),v?`探测中…`:`重新探测`]}),(0,R.jsx)(t,{onClick:()=>r(!1),children:`关闭`})]})]})})]})}function oe(){let{snap:n}=p(),{busy:r,run:a}=E(),s=e(),[c,u]=(0,L.useState)(!1),d=n.status,f=d?.native,k=f?.installed??!1,A=f?.state||(k?`installed`:`uninstalled`),M=A===`installing`,N=M||A===`uninstalling`,F=d?.version,z=d?.upgrade,B=w[d?.phase??``]??{label:d?.phase||`未知`,tone:`off`},V=!!d?.dshPid,U=z?.state===`running`,W=(0,L.useMemo)(()=>n.events.filter(e=>!S[e.type]?.noise),[n.events]);async function G(){await a(`dsh`,()=>V?l.lifecycleStop(`dsh`):l.lifecycleStart(`dsh`),{success:V?`正在停止 DSH…`:`正在启动 DSH…`})}async function K(){await s({title:`停止 DSH?`,description:`主干 DeepSeek Harness 正在运行;停止会中断进行中的请求,远程访问同时不可用。`,confirmText:`停止 DSH`})&&await G()}async function q(){await a(`web`,()=>g(()=>l.instanceOpenWeb(`main`)).then(()=>void 0))}async function J(){await a(`chk`,async()=>{let e=await l.nativeCheckUpdate();if(e?.ok===!1){i.error(e.error||`检测失败`);return}e?.updateAvailable&&e.latest?i.success(`发现新版本 `+e.latest+(e.installed?`(当前 `+e.installed+`),可一键升级`:``)):i.success(`已是最新版本`+(e.installed?`(`+e.installed+`)`:``))})}async function Y(){u(!1),await a(`upg`,()=>l.nativeUpgrade(),{success:`升级已开始,请耐心等待…`})}async function X(){await s({title:`在线安装最新版 DeepSeek Harness?`,description:`需数分钟,自动适配最快镜像源。`,confirmText:`安装`})&&await a(`inst`,()=>l.nativeInstall(),{success:`开始安装 DeepSeek Harness…`})}async function ne(){await s({title:`彻底卸载 DeepSeek Harness?`,description:`删除全部文件、数据、缓存与日志,不留残留。`,confirmText:`卸载 DSH`,tone:`destructive`})&&await a(`uni`,()=>l.nativeUninstall(),{success:`开始卸载…`})}let Z=k&&(f?.version||F?.installed)||`—`;return(0,R.jsxs)(`div`,{className:`grid content-start gap-4`,children:[(0,R.jsxs)(j,{children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-1 @min-[720px]:grid-cols-[minmax(0,5fr)_minmax(0,6fr)]`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-5 border-b border-border px-6 py-5 md:border-b-0 md:border-r`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,R.jsx)(`h3`,{className:`truncate text-xl font-semibold tracking-[-0.01em] text-foreground`,children:`DeepSeek Harness`}),(0,R.jsxs)(`span`,{className:`shrink-0 font-mono text-sm text-muted-foreground`,children:[`v`,Z]})]}),r===`chk`?(0,R.jsxs)(t,{size:`chip`,disabled:!0,children:[(0,R.jsx)(b,{className:`size-3 animate-spin`}),`检测中…`]}):F?.updateAvailable&&F.latest?(0,R.jsxs)(t,{className:`text-primary-foreground`,size:`chip`,onClick:()=>u(!0),children:[(0,R.jsx)(P,{className:`size-3`}),`升级到 v`,F.latest]}):U?(0,R.jsxs)(t,{size:`chip`,disabled:!0,children:[(0,R.jsx)(b,{className:`size-3 animate-spin`}),`升级中…`]}):(0,R.jsxs)(t,{className:`bg-primary/10 text-primary hover:bg-primary/15`,onClick:()=>void J(),size:`chip`,variant:`ghost`,children:[(0,R.jsx)(b,{className:`size-3`}),`检测更新`]})]}),N?(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(D,{tone:`boot`,ping:!0}),(0,R.jsx)(`span`,{className:`text-base font-semibold leading-none text-foreground`,children:M?`正在安装 DeepSeek Harness…`:`正在卸载 DeepSeek Harness…`})]}):(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(D,{tone:B.tone,ping:B.tone===`ok`}),(0,R.jsx)(`span`,{className:`text-base font-semibold leading-none text-foreground`,children:B.label})]}),U&&z?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-primary`}),`正在升级(`,z.step||z.targetVersion||``,`)…`]}):null,z?.state===`failed`?(0,R.jsxs)(`p`,{className:`text-xs text-destructive`,children:[`升级失败:`,z.lastError||`未知原因`,z.rolledBack?`(已回滚)`:``]}):null,N&&(f?.installLog??[]).length?(0,R.jsx)(`pre`,{className:`max-h-[120px] overflow-auto whitespace-pre-wrap break-all rounded-md bg-muted/70 p-3 font-mono text-xs leading-relaxed text-muted-foreground`,children:(f?.installLog??[]).slice(-6).join(`
|
|
1
|
+
import{F as e,I as t,L as n,N as r,O as i,R as a,S as o,U as s,V as c,a as l,b as ee,h as u,k as d,m as f,t as p,v as m,x as h,y as te}from"./supervisor-DSBgs_XY.js";import{n as g,o as _}from"./openExternal-CelnbVOI.js";import{n as v,t as y}from"./rocket-cmjG68ou.js";import{t as b}from"./refresh-cw-GKBYw9-E.js";import{l as x,n as S,p as C,r as w,s as T}from"./supervisor-DgkkfHOR.js";import{t as E}from"./useSupervisorAction-U8T1qRbC.js";import{c as D,i as O,n as k,o as A,t as j}from"./widgets-DV5fuKzB.js";import{n as M,t as N}from"./format-QeaTKFhQ.js";var P=r(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),F=r(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),I=r(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),L=s(c(),1),R=a();function z(e,t){return e===`dsh-main`||e===`supervisor-api`?`boot`:(t||``).startsWith(`inst:`)?`ok`:e===`relay`?`warn`:e.startsWith(`managed:`)?`boot`:`off`}function B(e){let t={"dsh-main":`DSH 主实例`,"supervisor-api":`管家 API`,user:`沙箱实例`,relay:`局域网隧道`,oauthCallback:`登录回调`,proxyInstance:`反代实例`,providerApi:`供应商 API`,"managed:router-daemon":`智能路由`,"managed:lan-daemon":`远程控制`,dynamic:`动态端口`},n=/^managed:(.+)$/.exec(e.role);return n?t[e.role]??n[1]:t[e.role]??e.role}function V(e,t){let n=e.owner||``;if(e.role===`proxyInstance`){let e=(n.split(`:`).pop()||``).slice(-4),r=(t??[]).find(t=>(t.accounts??[]).some(t=>(t.maskedKey||``).endsWith(e)));return r?r.name:`反代`}return n.startsWith(`inst:`)?`沙箱实例`:n.startsWith(`system:`)?`系统`:n.startsWith(`relay:`)?`局域网隧道`:n.startsWith(`dynamic:`)?`动态`:n.startsWith(`providerApi:`)?`供应商`:n.startsWith(`oauth:`)?`登录回调`:n===`router-daemon`||e.role===`managed:router-daemon`?`智能路由`:n===`lan-daemon`||e.role===`managed:lan-daemon`?`远程控制`:e.role===`oauthCallback`?`登录回调`:e.role}function H({providers:e=[]}){let{snap:t}=p(),r=t.ports?.records??null,i=(0,L.useMemo)(()=>r?[...r.filter(e=>e.role!==`supervisor-api`||e.port!==3100&&e.port!==3101)].sort((e,t)=>!!e.active==!!t.active?e.port-t.port:e.active?-1:1):null,[r]);return(0,R.jsxs)(j,{className:`flex min-h-0 flex-col overflow-hidden`,children:[(0,R.jsx)(k,{title:`运行状态`,subtitle:`核心服务与端口实时状态`,actions:i?(0,R.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[i.length,` 端口`]}):null}),i?(0,R.jsxs)(`div`,{className:`min-h-0 overflow-x-auto`,children:[(0,R.jsxs)(`div`,{className:`grid min-w-[400px] grid-cols-[56px_minmax(0,1fr)_auto_66px] items-center gap-2 border-b border-border/60 bg-muted/60 px-4 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,R.jsx)(`span`,{children:`端口`}),(0,R.jsx)(`span`,{children:`服务`}),(0,R.jsx)(`span`,{className:`text-right`,children:`归属`}),(0,R.jsx)(`span`,{className:`text-right`,children:`状态`})]}),(0,R.jsx)(`div`,{className:`max-h-[340px] overflow-y-auto overscroll-contain`,children:i.map((t,r)=>(0,R.jsxs)(`div`,{className:n(`grid grid-cols-[56px_minmax(0,1fr)_auto_66px] items-center gap-2 px-4 py-2 hover:bg-muted/40`,r>0&&`border-t border-border/50`),children:[(0,R.jsx)(`code`,{className:`font-mono text-sm tabular-nums text-foreground`,children:t.port}),(0,R.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:(0,R.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:B(t)})}),(0,R.jsx)(`div`,{className:`flex justify-end`,children:(0,R.jsx)(A,{tone:z(t.role,t.owner),children:V(t,e)})}),(0,R.jsx)(`div`,{className:`flex justify-end`,children:t.active===!0?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap text-[11px] text-status-ok`,children:[(0,R.jsx)(F,{className:`size-3`}),`运行中`]}):t.active===!1?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap text-[11px] text-muted-foreground`,children:[(0,R.jsx)(F,{className:`size-3 opacity-50`}),`未运行`]}):(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap text-[11px] text-muted-foreground`,children:[(0,R.jsx)(F,{className:`size-3 opacity-40`}),`状态未知`]})})]},t.port+`-`+t.owner))})]}):(0,R.jsx)(`div`,{className:`px-5 py-6 text-center text-xs text-muted-foreground`,children:`运行状态加载中…`})]})}function U(e){if(!e)return`未读出`;let t=String(e.state||`?`),n=e.detail?`(`+String(e.detail)+`)`:``;return(String(e.label||``)||`条目`)+` `+t+n}function W(e){return!e||e.state===`pending`?`未探测(点「重新探测」补齐)`:e.state===`error`?`探测失败:`+(e.error||`未给出原因`):e.state===`empty`?`已探测,无内容`:`已探测`+(e.at?` `+new Date(e.at).toLocaleTimeString():``)}function G(e){let t=e||{};return t.state===`on`?`在用(`+(t.server||t.pac||`地址未读出`)+`)`:t.state===`off`?`系统里明确未启用`:t.state===`unknown`?`取不到`+(t.source?`(`+t.source+`)`:``)+`,按判不出处理`:`未探测`}function K(e){return e===!0?`可达`:e===!1?`不通`:`判不出`}function q(e){return(e.section?e.section+`:`:``)+e.source+`:`+String(e.detail??``)}function J(e){return typeof e!=`number`||!Number.isFinite(e)||e<0?`时间未读出`:e<6e4?`刚刚`:e<36e5?Math.floor(e/6e4)+` 分钟前`:e<864e5?Math.floor(e/36e5)+` 小时前`:Math.floor(e/864e5)+` 天前`}function Y(e){return e===!0?`是`:e===!1?`否`:`未读出`}function X(e,t,n){let r=t||``,i=n||``,a=r&&i&&r!==i?`(两份不一致:装内核用的是壳那套,本进程解析到的是内核这套)`:``;return e+` 内核 `+(r||`未读出`)+` / 壳 `+(i||`未报`)+a}function ne(e){let t=e.ok===!0?`通`:e.ok===!1?`不通`:`判不出`;return(e.probe||`明细`)+` `+t+(e.target?`(`+e.target+`)`:``)+(typeof e.ms==`number`?` `+e.ms+` 毫秒`:``)}function Z(e,t){return e?t?`没落盘(这一拍读的是内核缓存拍)`:e.written===!0?`已写入`:e.error?`失败:`+e.error:`没落盘(也没报错误)`:`未给出(这一拍没装配)`}function re(e,t){if(t)return`读不回:`+t;if(!e)return`未读`;if(e.available===!0){let t=typeof e.at==`number`?new Date(e.at).toLocaleString():`时间未读出`,n=e.data&&e.data.browsers?e.data.browsers.length:null;return t+`(`+J(e.ageMs)+`)`+(n===null?``:`,候选 `+n+` 个`)}return e.reason===`never-written`?`这台机器还没落过盘`:`快照文件读不出或版本不符(不是没写过,得查文件)`}function ie(e){let t=e||{},n=Object.keys(t).filter(e=>t[e]!==`ok`);return n.length?`未补齐:`+n.join(`、`):`全部维度补齐`}function ae(e){let t=e&&e.name?e.name:`未定出`;return!e||!e.how?`现在会用:`+t:e.how===`user-preference`?`现在会用:`+t+`(你选的)`:e.how===`candidate-rank`?`现在会用:`+t+`(系统未报默认项,按候选次序取首个,可在此改)`:e.how===`only-installed`?`现在会用:`+t+`(本机唯一候选)`:e.how===`none-found`?`本机未探到可用浏览器,请安装或启用一个后重新探测`:`现在会用:`+t+`(系统默认项)`}var Q=`__system__`;function $(){let[e,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(null),[s,c]=(0,L.useState)(null),[p,g]=(0,L.useState)(null),[v,y]=(0,L.useState)(!1),[x,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(null),[T,E]=(0,L.useState)(null),D=(0,L.useRef)(new Map),O=(0,L.useCallback)(e=>{let t=D.current.get(e);if(t)return t;let n=(async()=>{e&&y(!0);try{let t=await l.environment(e);a(t),c(null)}catch(e){c(String(e.message||e))}y(!1),l.environmentLast().then(e=>{w(e),E(null)}).catch(e=>{w(null),E(String(e.message||e))})})().finally(()=>{D.current.delete(e)});return D.current.set(e,n),n},[]);(0,L.useEffect)(()=>{e&&O(!1)},[e,O]);let k=async e=>{S(!0);let t={ok:!1,error:`偏好写入未返回结果`};try{t=await l.setExternalBrowser(e)}catch(e){t={ok:!1,error:String(e.message||e)}}if(S(!1),!t||t.ok!==!0){c(t&&t.error||`偏好写入失败`);return}c(null),g(null),await O(!0)},A=i?.browsers??[],j=i?.sections,M=i?.pick?.stale===!0,N=i?.preference?.id||Q,P=p===null?N:p,F=j?.startup?.data,I=j?.shell?.data,z=I?.registry,B=z?.probes||[],V=I?.records||[],H=z?.latencyMs,$=z?.probesTotal??0,oe=j?.runtime?.data?.node?.version||null,se=j?.runtime?.data?.npm?.detail||null;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 whitespace-nowrap`,children:[(0,R.jsxs)(t,{size:`sm`,variant:`ghost`,className:`h-6 gap-1 px-1.5 text-xs text-muted-foreground`,onClick:()=>r(!0),children:[(0,R.jsx)(_,{className:`size-3`}),`环境表单`]}),i?.pick?.name?(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground/70`,children:i.pick.name}):null]}),(0,R.jsx)(m,{open:e,onOpenChange:r,children:(0,R.jsxs)(te,{className:`max-w-[560px]`,children:[(0,R.jsx)(h,{children:(0,R.jsx)(o,{children:`本机环境表单`})}),(0,R.jsxs)(`div`,{className:`grid max-h-[60vh] gap-3 overflow-y-auto text-sm`,children:[(0,R.jsx)(`p`,{className:n(`text-xs`,M||!A.length?`font-semibold text-warning`:`text-muted-foreground`),children:ae(i?.pick)}),M?(0,R.jsxs)(`p`,{className:`inline-flex items-start gap-1.5 rounded-md bg-warning-background px-2 py-1.5 text-xs font-semibold text-warning`,children:[(0,R.jsx)(d,{className:`mt-0.5 size-3.5 shrink-0`}),`你先前选的浏览器已不在本机候选清单(可能已卸载或路径变更),下方选择已回落到系统判定,请重选或清除。`]}):null,s?(0,R.jsx)(`p`,{className:`text-xs text-status-error`,children:s}):null,(0,R.jsxs)(`div`,{className:`grid gap-2 rounded-md border border-border/60 px-3 py-2.5`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium`,children:`打开地址用哪个浏览器`}),(0,R.jsxs)(f,{value:P,onValueChange:g,className:`grid gap-1.5`,children:[(0,R.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-2 text-xs`,children:[(0,R.jsx)(u,{value:Q,id:`env-pref-system`}),(0,R.jsx)(`span`,{children:`跟随系统默认(本机探不到默认项时按候选次序)`})]}),A.map(e=>(0,R.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-2 text-xs`,children:[(0,R.jsx)(u,{value:e.id,id:`env-pref-`+e.id}),(0,R.jsx)(`span`,{children:e.name||e.bin}),(0,R.jsx)(`span`,{className:`text-muted-foreground/70`,children:e.engine}),e.isDefault?(0,R.jsx)(`span`,{className:`text-muted-foreground/70`,children:`系统默认`}):null]},e.id))]}),A.length?(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(t,{size:`sm`,variant:`outline`,disabled:x||P===N,onClick:()=>void k(P===Q?``:P),children:`保存偏好`}),(0,R.jsx)(t,{size:`sm`,variant:`ghost`,disabled:x||N===Q,onClick:()=>void k(``),children:`清除`})]}):(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`候选为空:重新探测后仍为空时,请先在系统里安装或启用一个浏览器。`})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-border/60 px-3 py-2.5`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium`,children:`出网条件(隔离登录窗口的分发依据)`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:W(j?.egress)}),j?.egress?.data?(0,R.jsxs)(`div`,{className:`grid gap-0.5 text-xs`,children:[(0,R.jsxs)(`span`,{className:`text-muted-foreground`,children:[`系统代理:`,G(j?.egress?.data?.proxy)]}),Object.entries(j?.egress?.data?.targets||{}).map(([e,t])=>(0,R.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,`:`,K(t?.ok),t?.stage?`(停在 `+t.stage+(t.detail?` `+t.detail:``)+`)`:``]},e)),Object.keys(j?.egress?.data?.targets||{}).length?null:(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`还没有目标域被问过:一键登录时会当场判定并记在这里。`})]}):null,j?.egress?.data?.proxy?.state===`off`?(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`没有在用系统代理时,直连不通的授权域只能靠现有浏览器窗口的既有出网路径打开(隔离冷档案会是空白页)。`}):null]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-border/60 px-3 py-2.5`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium`,children:`运行时与 DSH(安装/升级动作的分发依据)`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:W(j?.runtime)}),j?.runtime?.data?(0,R.jsxs)(`div`,{className:`grid gap-0.5 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{children:[U(j?.runtime?.data?.node),` · `,U(j?.runtime?.data?.npm),` · `,U(j?.runtime?.data?.git)]}),j?.runtime?.data?.node?.min?(0,R.jsxs)(`span`,{className:`break-all`,children:[`Node 门槛:`,(j?.runtime?.data?.node).min,(j?.runtime?.data?.node).meets===!1?` ⇒ 本机版本低于门槛,不采纳现有 Node(会安装达标的官方版本)`:` ⇒ 已达门槛`]}):null,(0,R.jsxs)(`span`,{children:[`镜像源:`,j?.runtime?.data?.registry?.origin||`未读出`,j?.runtime?.data?.registry?.mode?`(`+j.runtime.data.registry.mode+`)`:``,` · 候选 `+(j?.runtime?.data?.registry?.candidates||[]).length+` 个`]}),(0,R.jsxs)(`span`,{className:`break-all`,children:[`全局前缀:`,j?.runtime?.data?.prefix||`未实测(npm root -g 未返回)`]})]}):null,(0,R.jsx)(`span`,{className:`text-xs font-medium`,children:`桌面壳所见(装内核时真正用的那一套,与上面的内核读数并排对照)`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:W(j?.shell)}),I?(0,R.jsxs)(`div`,{className:`grid gap-0.5 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{children:I.available===!0?`壳上报于 `+J(I.ageMs)+`,写入者 `+(I.writtenBy||`未署名`)+`(报告版本 `+(I.schema??`未读出`)+`)`:I.reason===`never-written`?`这台机器的壳还没报过:内核由命令行或别的进程拉起时这是常态,不是故障`:`壳报的文件读不出或版本不符(不是没写过,得查那个文件)`}),I.available===!0?(0,R.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,R.jsx)(`span`,{className:`break-all`,children:X(`Node:`,oe,I.node?.version)}),(0,R.jsx)(`span`,{className:`break-all`,children:X(`npm:`,se,I.npm?.version)}),(0,R.jsx)(`span`,{className:`break-all`,children:X(`镜像源:`,j?.runtime?.data?.registry?.origin,I.registry?.best)}),(0,R.jsx)(`span`,{className:`break-all`,children:X(`全局前缀:`,j?.runtime?.data?.prefix,I.prefix?.dir)}),I.node&&I.node.ok!==!0?(0,R.jsxs)(`span`,{children:[`壳判 Node 达标:`,Y(I.node.ok),`(`,I.node.version||`版本未报`,`,门槛 `,I.node.min||`未报`,`)`]}):null,I.prefix&&I.prefix.writable!==!0?(0,R.jsxs)(`span`,{className:`break-all`,children:[`壳判前缀可写:`,Y(I.prefix.writable),I.prefix.why?`(`+I.prefix.why+`)`:``]}):null,B.length||z?.best?(0,R.jsxs)(`span`,{className:`break-all`,children:[`壳的镜像源候选:`,B.map(e=>(e.url||`?`)+` `+K(e.ok)).join(`、`),typeof H==`number`?`(择优选中用时 `+H+` 毫秒)`:``,$>B.length?`(报告里共 `+$+` 个候选,此处只列前 `+B.length+` 个)`:``]}):null,V.length?(0,R.jsxs)(`span`,{children:[`壳的探测明细 `,V.length,` 条:`,V.slice(0,8).map(ne).join(`;`),V.length>8?`…其余见内核快照文件`:``,I.droppedRecords?`(报告送达时被截断 `+I.droppedRecords+` 条)`:``]}):null]}):null]}):null,(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:W(j?.dsh)}),j?.dsh?.data?(0,R.jsxs)(`div`,{className:`grid gap-0.5 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{children:[U(j?.dsh?.data?.dsh),` · `,U(j?.dsh?.data?.selfUpdate)]}),(0,R.jsxs)(`span`,{children:[`监控:`,j?.dsh?.data?.managed?`内核托管`:`未托管`,j?.dsh?.data?.phase?` · `+j.dsh.data.phase:``]})]}):null]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-border/60 px-3 py-2.5`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium`,children:`启动既成事实(内核这一拍真的跑过什么)`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:W(j?.startup)}),F?(0,R.jsxs)(`div`,{className:`grid gap-0.5 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{children:[`内核启动于 `,typeof F.bootAt==`number`?new Date(F.bootAt).toLocaleTimeString():`未读出`,`,环境表单首拍排在启动后 `,F.envDelayMs??`未读出`,` 毫秒`]}),(0,R.jsxs)(`span`,{children:[`选路:自动启动 `,Y(F.routerAutostart),`,模式 `,F.routerMode||`未读出(这一拍没走到那步)`]}),(0,R.jsxs)(`span`,{children:[`更新检查:`,F.updateCheck?F.updateCheck.enabled?`开(首查排在启动后 `+(F.updateCheck.initialDelayMs??`未读出`)+` 毫秒,之后每 `+(F.updateCheck.intervalMs??`未读出`)+` 毫秒)`:`关(配置里就禁掉了,这同样是一条既成事实)`:`未记录`]}),(0,R.jsxs)(`span`,{children:[`壳监控:`,Y(F.shellWatchdog)]}),(0,R.jsx)(`span`,{children:F.lastRefresh?`最近一次表单刷新于 `+(typeof F.lastRefresh.at==`number`?new Date(F.lastRefresh.at).toLocaleTimeString():`未读出`)+`,耗时 `+(F.lastRefresh.tookMs??`未读出`)+` 毫秒,浏览器 `+(F.lastRefresh.browsers??`未读出`)+` 个,分发依据 `+(F.lastRefresh.pick||`未定出`)+`,落盘 `+Y(F.lastRefresh.snapshotWritten)+`;`+ie(F.lastRefresh.dims):`这一拍还没跑过表单刷新(首拍排在上面那个延迟之后)`})]}):null]}),(0,R.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`平台`}),(0,R.jsx)(`dd`,{className:`font-mono`,children:[i?.identity?.platform,i?.identity?.arch].filter(Boolean).join(` / `)||`—`}),(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`图形会话`}),(0,R.jsx)(`dd`,{children:i?.session?.available?`可用(`+(i?.session?.reason||`—`)+`)`:`不可用(`+(i?.session?.reason||`—`)+`)`}),(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`系统默认项`}),(0,R.jsx)(`dd`,{children:i?.default?i.default.id+`(来源 `+(i.default.source||`未读出`)+`)`:`未读出`}),(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`候选`}),(0,R.jsx)(`dd`,{children:A.length?A.map(e=>(e.name||e.bin)+`[`+(e.sources||[]).join(`+`)+`]`).join(`、`):`无`}),(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`探测留痕`}),(0,R.jsx)(`dd`,{className:`grid gap-0.5`,children:(i?.probed??[]).map((e,t)=>(0,R.jsx)(`span`,{className:`text-muted-foreground/80`,children:q(e)},t))}),(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`快照落盘`}),(0,R.jsxs)(`dd`,{className:`break-all font-mono text-muted-foreground/80`,children:[Z(i?.snapshot,i?.cached===!0),(0,R.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[` `,i?.snapshot?.path||`未给出路径`]})]}),(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:`上一拍留痕`}),(0,R.jsx)(`dd`,{className:`text-muted-foreground`,children:re(C,T)})]})]}),(0,R.jsxs)(ee,{children:[(0,R.jsxs)(t,{variant:`outline`,disabled:v,onClick:()=>void O(!0),children:[(0,R.jsx)(b,{className:`size-4`}),v?`探测中…`:`重新探测`]}),(0,R.jsx)(t,{onClick:()=>r(!1),children:`关闭`})]})]})})]})}function oe(){let{snap:n}=p(),{busy:r,run:a}=E(),s=e(),[c,u]=(0,L.useState)(!1),d=n.status,f=d?.native,k=f?.installed??!1,A=f?.state||(k?`installed`:`uninstalled`),M=A===`installing`,N=M||A===`uninstalling`,F=d?.version,z=d?.upgrade,B=w[d?.phase??``]??{label:d?.phase||`未知`,tone:`off`},V=!!d?.dshPid,U=z?.state===`running`,W=(0,L.useMemo)(()=>n.events.filter(e=>!S[e.type]?.noise),[n.events]);async function G(){await a(`dsh`,()=>V?l.lifecycleStop(`dsh`):l.lifecycleStart(`dsh`),{success:V?`正在停止 DSH…`:`正在启动 DSH…`})}async function K(){await s({title:`停止 DSH?`,description:`主干 DeepSeek Harness 正在运行;停止会中断进行中的请求,远程访问同时不可用。`,confirmText:`停止 DSH`})&&await G()}async function q(){await a(`web`,()=>g(()=>l.instanceOpenWeb(`main`)).then(()=>void 0))}async function J(){await a(`chk`,async()=>{let e=await l.nativeCheckUpdate();if(e?.ok===!1){i.error(e.error||`检测失败`);return}e?.updateAvailable&&e.latest?i.success(`发现新版本 `+e.latest+(e.installed?`(当前 `+e.installed+`),可一键升级`:``)):i.success(`已是最新版本`+(e.installed?`(`+e.installed+`)`:``))})}async function Y(){u(!1),await a(`upg`,()=>l.nativeUpgrade(),{success:`升级已开始,请耐心等待…`})}async function X(){await s({title:`在线安装最新版 DeepSeek Harness?`,description:`需数分钟,自动适配最快镜像源。`,confirmText:`安装`})&&await a(`inst`,()=>l.nativeInstall(),{success:`开始安装 DeepSeek Harness…`})}async function ne(){await s({title:`彻底卸载 DeepSeek Harness?`,description:`删除全部文件、数据、缓存与日志,不留残留。`,confirmText:`卸载 DSH`,tone:`destructive`})&&await a(`uni`,()=>l.nativeUninstall(),{success:`开始卸载…`})}let Z=k&&(f?.version||F?.installed)||`—`;return(0,R.jsxs)(`div`,{className:`grid content-start gap-4`,children:[(0,R.jsxs)(j,{children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-1 @min-[720px]:grid-cols-[minmax(0,5fr)_minmax(0,6fr)]`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-5 border-b border-border px-6 py-5 md:border-b-0 md:border-r`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,R.jsx)(`h3`,{className:`truncate text-xl font-semibold tracking-[-0.01em] text-foreground`,children:`DeepSeek Harness`}),(0,R.jsxs)(`span`,{className:`shrink-0 font-mono text-sm text-muted-foreground`,children:[`v`,Z]})]}),r===`chk`?(0,R.jsxs)(t,{size:`chip`,disabled:!0,children:[(0,R.jsx)(b,{className:`size-3 animate-spin`}),`检测中…`]}):F?.updateAvailable&&F.latest?(0,R.jsxs)(t,{className:`text-primary-foreground`,size:`chip`,onClick:()=>u(!0),children:[(0,R.jsx)(P,{className:`size-3`}),`升级到 v`,F.latest]}):U?(0,R.jsxs)(t,{size:`chip`,disabled:!0,children:[(0,R.jsx)(b,{className:`size-3 animate-spin`}),`升级中…`]}):(0,R.jsxs)(t,{className:`bg-primary/10 text-primary hover:bg-primary/15`,onClick:()=>void J(),size:`chip`,variant:`ghost`,children:[(0,R.jsx)(b,{className:`size-3`}),`检测更新`]})]}),N?(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(D,{tone:`boot`,ping:!0}),(0,R.jsx)(`span`,{className:`text-base font-semibold leading-none text-foreground`,children:M?`正在安装 DeepSeek Harness…`:`正在卸载 DeepSeek Harness…`})]}):(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(D,{tone:B.tone,ping:B.tone===`ok`}),(0,R.jsx)(`span`,{className:`text-base font-semibold leading-none text-foreground`,children:B.label})]}),U&&z?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-primary`}),`正在升级(`,z.step||z.targetVersion||``,`)…`]}):null,z?.state===`failed`?(0,R.jsxs)(`p`,{className:`text-xs text-destructive`,children:[`升级失败:`,z.lastError||`未知原因`,z.rolledBack?`(已回滚)`:``]}):null,N&&(f?.installLog??[]).length?(0,R.jsx)(`pre`,{className:`max-h-[120px] overflow-auto whitespace-pre-wrap break-all rounded-md bg-muted/70 p-3 font-mono text-xs leading-relaxed text-muted-foreground`,children:(f?.installLog??[]).slice(-6).join(`
|
|
2
2
|
`)}):null]}),(0,R.jsx)(`div`,{className:`flex items-center bg-[image:var(--panel-accent-gradient)] px-6 py-5`,children:(0,R.jsxs)(`div`,{className:`grid w-full grid-cols-2 gap-x-6 gap-y-4 @min-[560px]:grid-cols-4`,children:[(0,R.jsx)(O,{icon:(0,R.jsx)(C,{className:`size-4`}),label:`端口`,value:d?.dshPort?String(d.dshPort):`—`,mono:!0}),(0,R.jsx)(O,{icon:(0,R.jsx)(I,{className:`size-4`}),label:`PID`,value:d?.dshPid?String(d.dshPid):`—`,mono:!0}),(0,R.jsx)(O,{icon:(0,R.jsx)(b,{className:`size-4`}),label:`重启次数`,value:String(d?.restartCount??0),mono:!0}),(0,R.jsx)(O,{icon:(0,R.jsx)(P,{className:`size-4`}),label:`最近故障`,value:d?.lastFailure?T(d?.lastFailure):`无`,warn:!!d?.lastFailure})]})})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-border/60 px-6 py-3`,children:[(0,R.jsx)(`div`,{className:`hidden lg:block`,children:(0,R.jsx)(se,{})}),(0,R.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[!k&&!N?(0,R.jsxs)(t,{size:`sm`,disabled:r===`inst`,onClick:()=>void X(),children:[(0,R.jsx)(y,{className:`size-4`}),`安装 DSH`]}):k&&!N&&!U?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(t,{disabled:!V,onClick:()=>void q(),size:`sm`,variant:`outline`,className:`hidden md:inline-flex`,children:[(0,R.jsx)(_,{className:`size-4`}),`DSH Web`]}),(0,R.jsx)(t,{disabled:r===`dsh`,onClick:()=>void(V?K():G()),size:`sm`,variant:`outline`,children:V?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(v,{className:`size-4 text-status-error`}),`停止 DSH`]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(y,{className:`size-4 text-primary`}),`启动 DSH`]})}),(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-5 w-px bg-border`})]}):null,k&&!N?(0,R.jsx)(R.Fragment,{children:(0,R.jsxs)(t,{className:`hidden h-[30px] md:inline-flex`,disabled:r===`uni`,onClick:()=>void ne(),size:`sm`,variant:`destructive`,children:[(0,R.jsx)(x,{className:`size-4`}),`卸载 DSH`]})}):null]})]})]}),(0,R.jsxs)(`div`,{className:`grid items-start gap-4 @min-[860px]:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,R.jsx)(ce,{events:W}),(0,R.jsx)(H,{providers:n.providers?.providers??[]})]}),(0,R.jsx)(m,{open:c,onOpenChange:u,children:(0,R.jsxs)(te,{className:`max-w-[420px]`,children:[(0,R.jsx)(h,{children:(0,R.jsx)(o,{children:`升级 DeepSeek Harness`})}),(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-center gap-3 rounded-md bg-muted px-4 py-3`,children:[(0,R.jsxs)(`div`,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`当前版本`}),(0,R.jsx)(`strong`,{className:`font-mono text-base text-foreground`,children:F?.installed||Z})]}),(0,R.jsx)(P,{className:`size-4 text-muted-foreground`}),(0,R.jsxs)(`div`,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`新版本`}),(0,R.jsx)(`strong`,{className:`font-mono text-base text-primary`,children:F?.latest||`—`})]})]}),(0,R.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`升级将先停止 DSH、安装新版本后自动拉起(需数分钟)。期间进行中的请求会中断,失败会自动回滚到当前版本。`})]}),(0,R.jsxs)(ee,{children:[(0,R.jsx)(t,{onClick:()=>u(!1),variant:`outline`,children:`取消`}),(0,R.jsx)(t,{disabled:r===`upg`||U,onClick:()=>void Y(),children:r===`upg`||U?`升级中…`:`开始升级`})]})]})})]})}function se(){let[e,t]=(0,L.useState)(null),[r,i]=(0,L.useState)(null);(0,L.useEffect)(()=>{let e=!0,n=async()=>{let[n,r]=await Promise.all([l.nodeLts().catch(()=>null),l.envStatus().catch(()=>null)]);e&&(t(n),i(r?.catalog?.items??null))};n();let r=setInterval(n,6e5);return()=>{e=!1,clearInterval(r)}},[]);let a=Object.entries(r??{}).filter(([,e])=>e.required);return!e?.current&&a.length===0?(0,R.jsx)(`span`,{className:`min-w-[120px] text-xs text-muted-foreground`,children:`环境检测…`}):(0,R.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`whitespace-nowrap`,children:`环境检测`}),a.map(([e,t])=>{let r=t.state===`ok`||t.state===`configured`;return(0,R.jsxs)(`span`,{title:t.detail||void 0,className:n(`inline-flex items-center gap-1 whitespace-nowrap rounded-full px-2 py-0.5`,r?`text-muted-foreground/70`:`bg-warning-background font-semibold text-warning`),children:[!r&&(0,R.jsx)(d,{className:`size-3`}),t.label,` `,t.detail||`—`]},e)}),(0,R.jsx)($,{}),e?.ltsLine===!1?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap rounded-full bg-warning-background px-2 py-0.5 font-semibold text-warning`,title:e.suggested||void 0,children:[(0,R.jsx)(d,{className:`size-3`}),`非 LTS 线(建议偶数主版本)`]}):e?.ltsLine===!0?(0,R.jsx)(`span`,{className:`hidden whitespace-nowrap text-muted-foreground/70 sm:inline`,children:`LTS 线`}):null]})}function ce({events:e}){let[t,n]=(0,L.useState)(12),r=e.length,i=e.length?e[0]?.seq:void 0;(0,L.useEffect)(()=>{n(12)},[i,r]);let a=(0,L.useRef)(null),o=(0,L.useRef)(!1);(0,L.useEffect)(()=>{let e=a.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(o.current||(o.current=!0,n(e=>Math.min(e+12,r)),setTimeout(()=>{o.current=!1},80)))},{rootMargin:`120px 0px`});return t.observe(e),()=>t.disconnect()},[r]);let s=e.slice(0,t),c=t<r;return(0,R.jsxs)(j,{className:`flex min-h-0 flex-col overflow-hidden`,children:[(0,R.jsx)(k,{title:`事件日志`,subtitle:`核心运行状态遥测`,actions:(0,R.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:r})}),r?(0,R.jsxs)(`div`,{className:`flex max-h-[450px] min-h-0 flex-col overflow-y-auto overscroll-contain`,children:[s.map((e,t)=>(0,R.jsx)(le,{e},e.seq??t)),(0,R.jsx)(`div`,{ref:a,className:`px-5 py-2 text-center text-[11px] text-muted-foreground`,children:c?`下滑加载更多…`:`已加载全部`})]}):(0,R.jsx)(`div`,{className:`px-5 py-6 text-center text-xs text-muted-foreground`,children:`暂无核心运行状态事件`})]})}function le({e}){let t=S[e.type],n=t?.tone??`boot`,r=t?.label??e.type,i=ue(e);return(0,R.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[64px_auto_minmax(0,1fr)] items-center gap-2.5 border-b border-border/60 px-5 py-2 last:border-b-0 max-[640px]:grid-cols-[56px_auto_minmax(0,1fr)] max-[640px]:gap-2`,children:[(0,R.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:N(e.ts)}),(0,R.jsx)(A,{tone:n,children:r}),(0,R.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:i})]})}function ue(e){let t=e.data;if(!t)return``;let n=e=>M(typeof e==`number`?e:null);if(typeof t.message==`string`)return t.message;if(typeof t.reason==`string`)return T(t.reason);if(typeof t.desired==`string`)return`期望 `+t.desired;if(e.type===`router_usage`)return(t.model||``)+(t.model?` · `:``)+n(t.tokens)+` tokens`;if(e.type===`router_pick`)return[t.provider||``,t.key||``].filter(Boolean).join(` · `);if(e.type===`account_ready`||e.type===`account_frozen`||e.type===`account_banned`||e.type===`account_recovered`||e.type===`account_review`||e.type===`account_exhausted`)return(t.key||``)+(t.key?` · `:``)+(t.provider||``);if(e.type===`provider_quota_refreshed`)return(t.provider||``)+` 额度已刷新`;if(e.type===`proxy_update_available`)return[t.pkg||``,t.from||``,t.to||``].filter(Boolean).join(` → `);if(e.type===`proxy_instance_started`)return`port=`+(t.port??``)+(t.pid?` pid=`+t.pid:``);if(e.type===`harness_remote_changed`||e.type===`inst_remote_changed`)return(t.name||(t.id===`main`?`原生 DSH`:t.id||`实例`))+` · 远程控制 → `+(t.mode===`lan`?`局域网`:t.mode===`wan`?`公网`:`关闭`);if(e.type===`harness_remote_token_changed`||e.type===`inst_remote_token_changed`)return(t.name||(t.id===`main`?`原生 DSH`:t.id||`实例`))+` · 访问令牌`+(t.tokenSet===!0?` → 已设置`:` → 已清除`);let r=[];return t.pid!==void 0&&r.push(`pid=`+t.pid),t.port!==void 0&&r.push(`port=`+String(t.port)),t.version!==void 0&&r.push(`v`+String(t.version)),t.model&&t.tokens!==void 0&&r.push(n(t.tokens)+` tok`),t.ms!==void 0&&r.push(n(t.ms)+`ms`),r.join(` · `)}export{oe as OverviewPage};
|