dsh-dock 0.21.2 → 0.23.0
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/README.md +28 -31
- package/client.js +1494 -753
- package/features/mcpconfig/host.js +402 -0
- package/features/mcpconfig/view.js +658 -0
- package/features/modelconfig/host.js +1 -1
- package/features/modelconfig/view.js +2 -2
- package/features/notify/host.js +8 -3
- package/features/notify/view.jsx +40 -12
- package/features/providerconfig/host.js +1 -1
- package/features/providerconfig/view.js +4 -4
- package/features/tokenlog/host.js +207 -10
- package/features/tokenlog/view.jsx +95 -20
- package/index.js +5 -3
- package/package.json +3 -3
- package/src/client.jsx +7 -6
- package/src/host-core.js +3 -0
- package/src/shared.js +5 -0
- package/src/task-track.js +64 -0
- package/features/heartbeat/view.js +0 -35
- package/features/theme/view.js +0 -61
package/client.js
CHANGED
|
@@ -2126,7 +2126,7 @@ __export(client_exports, {
|
|
|
2126
2126
|
inject: () => inject
|
|
2127
2127
|
});
|
|
2128
2128
|
module.exports = __toCommonJS(client_exports);
|
|
2129
|
-
var
|
|
2129
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
2130
2130
|
|
|
2131
2131
|
// src/shared.js
|
|
2132
2132
|
var import_react = __toESM(require("react"), 1);
|
|
@@ -2319,6 +2319,7 @@ function taskActivityAt(task) {
|
|
|
2319
2319
|
}
|
|
2320
2320
|
function taskBusy(task, now, capMs) {
|
|
2321
2321
|
if (!task) return false;
|
|
2322
|
+
if (task.ptcProgram === true) return true;
|
|
2322
2323
|
const at = typeof now === "number" ? now : Date.now();
|
|
2323
2324
|
const cap = typeof capMs === "number" && capMs > 0 ? capMs : TASK_BUSY_MS;
|
|
2324
2325
|
if (task.compacting === true) {
|
|
@@ -2418,6 +2419,10 @@ function hourOf(ts) {
|
|
|
2418
2419
|
var EXPORT_COLUMNS = [
|
|
2419
2420
|
["\u65F6\u95F4", (r) => fmtTime(r.time)],
|
|
2420
2421
|
["\u4F1A\u8BDDID", (r) => r.sessionId || ""],
|
|
2422
|
+
["\u76F4\u63A5\u7236\u4F1A\u8BDDID", (r) => r.parentSessionId || ""],
|
|
2423
|
+
["\u6839\u4F1A\u8BDDID", (r) => r.rootSessionId || r.sessionId || ""],
|
|
2424
|
+
["\u4F1A\u8BDD\u5C42\u7EA7", (r) => String(r.sessionDepth || 0)],
|
|
2425
|
+
["\u4F1A\u8BDD\u7C7B\u578B", (r) => r.isSubtask ? "\u5B50\u4EFB\u52A1" : "\u4E3B\u4F1A\u8BDD"],
|
|
2421
2426
|
["\u63D0\u4F9B\u5546", (r) => r.provider || "\u2014"],
|
|
2422
2427
|
["\u6A21\u578B", (r) => r.model || "\u2014"],
|
|
2423
2428
|
["\u8F93\u5165(\u547D\u4E2D)", (r) => fmtNum(r.cacheReadTokens)],
|
|
@@ -2461,7 +2466,7 @@ function buildExportCsv(rows, rate) {
|
|
|
2461
2466
|
return lines.join("\r\n");
|
|
2462
2467
|
}
|
|
2463
2468
|
var STORE_KEY = "dsh-dock/tokenlog/filters/v1";
|
|
2464
|
-
var FILTER_FIELDS = ["fromStr", "toStr", "provider", "model", "status", "effort", "sessionId", "dim"];
|
|
2469
|
+
var FILTER_FIELDS = ["fromStr", "toStr", "provider", "model", "status", "effort", "sessionId", "sessionScope", "dim"];
|
|
2465
2470
|
function loadSavedFilters() {
|
|
2466
2471
|
try {
|
|
2467
2472
|
if (typeof localStorage === "undefined") return null;
|
|
@@ -2488,6 +2493,9 @@ function shortId(sid) {
|
|
|
2488
2493
|
if (sid.length <= 16) return sid;
|
|
2489
2494
|
return sid.slice(0, 8) + "\u2026" + sid.slice(-6);
|
|
2490
2495
|
}
|
|
2496
|
+
function sessionType(r) {
|
|
2497
|
+
return r && r.isSubtask ? "\u5B50\u4EFB\u52A1" : "\u4E3B\u4F1A\u8BDD";
|
|
2498
|
+
}
|
|
2491
2499
|
function statusInfo(r) {
|
|
2492
2500
|
if (r.status === "completed") return { code: 200, label: "200", cls: "ok", title: "\u6210\u529F" };
|
|
2493
2501
|
if (r.status === "max-tokens") return { code: 200, label: "200", cls: "warn", title: "\u5B8C\u6210(\u8FBE\u5230\u8F93\u51FA\u4E0A\u9650)" };
|
|
@@ -2723,6 +2731,9 @@ var css = `
|
|
|
2723
2731
|
.dtok-empty{text-align:center;color:var(--dsw-alias-label-secondary);padding:32px 0;font-size:13px;}
|
|
2724
2732
|
.dtok-sid{color:var(--dk-accent);cursor:pointer;text-decoration:underline dotted;}
|
|
2725
2733
|
.dtok-sid:hover{filter:brightness(1.25);}
|
|
2734
|
+
.dtok-scope-note{font-size:12px;color:var(--dsw-alias-label-secondary);padding:7px 10px;border-left:3px solid var(--dk-accent);background:var(--dsw-alias-bg-layer-1);border-radius:4px;line-height:1.5;}
|
|
2735
|
+
.dtok-session-kind{display:inline-block;margin-left:5px;padding:1px 5px;border-radius:4px;font-size:10px;color:var(--dk-accent);background:rgb(96 165 250 / .12);vertical-align:middle;}
|
|
2736
|
+
.dtok-session-tree{font-family:ui-monospace,monospace;}
|
|
2726
2737
|
.dtok-code{font-weight:700;font-family:ui-monospace,monospace;}
|
|
2727
2738
|
.dtok-code.ok{color:var(--dsw-alias-state-success-primary,#4ade80);}
|
|
2728
2739
|
.dtok-code.warn{color:var(--dk-warn);}
|
|
@@ -2863,6 +2874,10 @@ function Detail({ rec, onClose, rate }) {
|
|
|
2863
2874
|
const rateCny = Number(rate) > 0 ? Number(rate) : 7.2;
|
|
2864
2875
|
const rows = [
|
|
2865
2876
|
["\u4F1A\u8BDD ID", rec.sessionId],
|
|
2877
|
+
["\u4F1A\u8BDD\u7C7B\u578B", sessionType(rec)],
|
|
2878
|
+
["\u76F4\u63A5\u7236\u4F1A\u8BDD ID", rec.parentSessionId || "\u2014"],
|
|
2879
|
+
["\u6839\u4F1A\u8BDD ID", rec.rootSessionId || rec.sessionId],
|
|
2880
|
+
["\u4F1A\u8BDD\u5C42\u7EA7", String(rec.sessionDepth || 0)],
|
|
2866
2881
|
["\u65F6\u95F4", fmtTime(rec.time)],
|
|
2867
2882
|
["\u63D0\u4F9B\u5546", rec.provider],
|
|
2868
2883
|
["\u6A21\u578B", rec.model],
|
|
@@ -3310,6 +3325,8 @@ function TokenLogView(props) {
|
|
|
3310
3325
|
const [status, setStatus] = (0, import_react2.useState)(() => savedFilters && savedFilters.status || "");
|
|
3311
3326
|
const [effort, setEffort] = (0, import_react2.useState)(() => savedFilters && savedFilters.effort || "");
|
|
3312
3327
|
const [sessionId, setSessionId] = (0, import_react2.useState)(() => navSession || savedFilters && savedFilters.sessionId || "");
|
|
3328
|
+
const [sessionScope, setSessionScope] = (0, import_react2.useState)(() => savedFilters && savedFilters.sessionScope || "tree");
|
|
3329
|
+
const scopeTouchedRef = (0, import_react2.useRef)(!!(savedFilters && savedFilters.sessionScope));
|
|
3313
3330
|
const [dim, setDim] = (0, import_react2.useState)(() => savedFilters && savedFilters.dim || "");
|
|
3314
3331
|
const [sortKey, setSortKey] = (0, import_react2.useState)("time");
|
|
3315
3332
|
const [sortDir, setSortDir] = (0, import_react2.useState)("desc");
|
|
@@ -3335,8 +3352,8 @@ function TokenLogView(props) {
|
|
|
3335
3352
|
}, [fetchedAt]);
|
|
3336
3353
|
const pageSize = 100;
|
|
3337
3354
|
(0, import_react2.useEffect)(() => {
|
|
3338
|
-
saveFilters({ fromStr, toStr, provider, model, status, effort, sessionId, dim });
|
|
3339
|
-
}, [fromStr, toStr, provider, model, status, effort, sessionId, dim]);
|
|
3355
|
+
saveFilters({ fromStr, toStr, provider, model, status, effort, sessionId, sessionScope, dim });
|
|
3356
|
+
}, [fromStr, toStr, provider, model, status, effort, sessionId, sessionScope, dim]);
|
|
3340
3357
|
(0, import_react2.useEffect)(() => {
|
|
3341
3358
|
let cancel = false;
|
|
3342
3359
|
setLoading(true);
|
|
@@ -3350,12 +3367,14 @@ function TokenLogView(props) {
|
|
|
3350
3367
|
if (savedFilters.status) q.status = savedFilters.status;
|
|
3351
3368
|
if (savedFilters.effort) q.effort = savedFilters.effort;
|
|
3352
3369
|
if (savedFilters.sessionId) q.sessionId = savedFilters.sessionId;
|
|
3370
|
+
if (savedFilters.sessionScope) q.sessionScope = savedFilters.sessionScope;
|
|
3353
3371
|
if (savedFilters.dim) q.dim = savedFilters.dim;
|
|
3354
3372
|
}
|
|
3355
3373
|
if (navSession) q.sessionId = navSession;
|
|
3356
3374
|
rpcCall("scan", {}).then(() => cancel ? null : rpcCall("query", q)).then((d) => {
|
|
3357
3375
|
if (cancel) return;
|
|
3358
3376
|
setData(d);
|
|
3377
|
+
if (!scopeTouchedRef.current && d && (d.defaultSessionScope === "tree" || d.defaultSessionScope === "session")) setSessionScope(d.defaultSessionScope);
|
|
3359
3378
|
}).catch((e) => {
|
|
3360
3379
|
if (!cancel) setErr(String(e && e.message || e));
|
|
3361
3380
|
}).finally(() => {
|
|
@@ -3374,10 +3393,11 @@ function TokenLogView(props) {
|
|
|
3374
3393
|
if (status) q.status = status;
|
|
3375
3394
|
if (effort) q.effort = effort;
|
|
3376
3395
|
if (sessionId) q.sessionId = sessionId;
|
|
3396
|
+
if (sessionId) q.sessionScope = sessionScope;
|
|
3377
3397
|
const dimNow = dimOverride !== void 0 ? dimOverride : dim;
|
|
3378
3398
|
if (withDim && dimNow) q.dim = dimNow;
|
|
3379
3399
|
return q;
|
|
3380
|
-
}, [fromStr, toStr, provider, model, status, effort, sessionId, dim]);
|
|
3400
|
+
}, [fromStr, toStr, provider, model, status, effort, sessionId, sessionScope, dim]);
|
|
3381
3401
|
const runQuery = (0, import_react2.useCallback)((dimOverride) => {
|
|
3382
3402
|
setLoading(true);
|
|
3383
3403
|
setErr("");
|
|
@@ -3387,17 +3407,19 @@ function TokenLogView(props) {
|
|
|
3387
3407
|
}).catch((e) => setErr(String(e && e.message || e))).finally(() => setLoading(false));
|
|
3388
3408
|
}, [buildQ]);
|
|
3389
3409
|
const navAppliedRef = (0, import_react2.useRef)(navAt);
|
|
3410
|
+
const lastNavSessionRef = (0, import_react2.useRef)(navSession);
|
|
3390
3411
|
(0, import_react2.useEffect)(() => {
|
|
3391
|
-
if (!navSession || navAppliedRef.current === navAt) return;
|
|
3412
|
+
if (!navSession || navAppliedRef.current === navAt && lastNavSessionRef.current === navSession) return;
|
|
3392
3413
|
navAppliedRef.current = navAt;
|
|
3414
|
+
lastNavSessionRef.current = navSession;
|
|
3393
3415
|
setSessionId(navSession);
|
|
3394
3416
|
setLoading(true);
|
|
3395
3417
|
setErr("");
|
|
3396
|
-
rpcCall("query", Object.assign({}, buildQ(true), { sessionId: navSession })).then((d) => {
|
|
3418
|
+
rpcCall("query", Object.assign({}, buildQ(true), { sessionId: navSession, sessionScope })).then((d) => {
|
|
3397
3419
|
setData(d);
|
|
3398
3420
|
setPage(0);
|
|
3399
3421
|
}).catch((e) => setErr(String(e && e.message || e))).finally(() => setLoading(false));
|
|
3400
|
-
}, [navAt]);
|
|
3422
|
+
}, [navAt, navSession]);
|
|
3401
3423
|
const rateCny = data && data.rateUsdCny || 7.2;
|
|
3402
3424
|
const resetFilters = (0, import_react2.useCallback)(() => {
|
|
3403
3425
|
setFromStr("");
|
|
@@ -3407,7 +3429,9 @@ function TokenLogView(props) {
|
|
|
3407
3429
|
setStatus("");
|
|
3408
3430
|
setEffort("");
|
|
3409
3431
|
setSessionId("");
|
|
3432
|
+
setSessionScope("tree");
|
|
3410
3433
|
setDim("");
|
|
3434
|
+
scopeTouchedRef.current = false;
|
|
3411
3435
|
setLoading(true);
|
|
3412
3436
|
setErr("");
|
|
3413
3437
|
rpcCall("query", {}).then((d) => {
|
|
@@ -3446,6 +3470,14 @@ function TokenLogView(props) {
|
|
|
3446
3470
|
}, [sortKey, sortDir]);
|
|
3447
3471
|
const records = data && data.records || [];
|
|
3448
3472
|
const totals = data && data.totals;
|
|
3473
|
+
const scopeInfo = data && data.sessionScope;
|
|
3474
|
+
const directTotals = data && data.directTotals;
|
|
3475
|
+
const breakdown = data && data.sessionBreakdown || [];
|
|
3476
|
+
const childTotals = scopeInfo && scopeInfo.scope === "tree" ? {
|
|
3477
|
+
calls: Math.max(0, (totals && totals.calls || 0) - (directTotals && directTotals.calls || 0)),
|
|
3478
|
+
totalTokens: Math.max(0, (totals && totals.totalTokens || 0) - (directTotals && directTotals.totalTokens || 0)),
|
|
3479
|
+
cost: Math.max(0, (totals && totals.cost || 0) - (directTotals && directTotals.cost || 0))
|
|
3480
|
+
} : null;
|
|
3449
3481
|
const sessionIds = data && data.sessionIds || [];
|
|
3450
3482
|
const sorted = (0, import_react2.useMemo)(() => {
|
|
3451
3483
|
const arr = records.slice();
|
|
@@ -3466,16 +3498,28 @@ function TokenLogView(props) {
|
|
|
3466
3498
|
const pageRows = sorted.slice(pageSafe * pageSize, (pageSafe + 1) * pageSize);
|
|
3467
3499
|
const cards = totals ? [
|
|
3468
3500
|
{ v: fmtNum(totals.calls), l: "\u8C03\u7528\u6B21\u6570" },
|
|
3469
|
-
{ v: fmtCompact(totals.totalTokens), l: "\u603B Token" },
|
|
3501
|
+
{ v: fmtCompact(totals.totalTokens), l: scopeInfo && scopeInfo.scope === "tree" ? "\u7D2F\u8BA1 Token\uFF08\u542B\u5B50\u4EFB\u52A1\uFF09" : "\u603B Token" },
|
|
3470
3502
|
{ v: fmtCompact(totals.cacheReadTokens), l: "\u8F93\u5165(\u547D\u4E2D)" },
|
|
3471
3503
|
{ v: fmtCompact(totals.inputTokens), l: "\u8F93\u5165(\u672A\u547D\u4E2D)" },
|
|
3472
3504
|
{ v: totals.cacheHitPct + "%", l: "\u7F13\u5B58\u547D\u4E2D\u7387" },
|
|
3473
3505
|
{ v: fmtCompact(totals.outputTokens), l: "\u8F93\u51FA" },
|
|
3474
|
-
{ v: fmtCostCny(totals.cost, rateCny), l: "\u6D88\u8017\u91D1\u989D(\u4F30\u7B97\xB7\u4EBA\u6C11\u5E01)" },
|
|
3506
|
+
{ v: fmtCostCny(totals.cost, rateCny), l: (scopeInfo && scopeInfo.scope === "tree" ? "\u7D2F\u8BA1\u91D1\u989D" : "\u6D88\u8017\u91D1\u989D") + "(\u4F30\u7B97\xB7\u4EBA\u6C11\u5E01)" },
|
|
3475
3507
|
{ v: fmtDuration(totals.llmMs), l: "\u7D2F\u8BA1\u8017\u65F6" + (totals.timed ? " (" + totals.timed + "\u6B65)" : "") }
|
|
3476
3508
|
] : [];
|
|
3477
3509
|
const opts = (arr) => (arr || []).map((x) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: x, children: x || "(\u7A7A)" }, x || "(none)"));
|
|
3478
3510
|
const modelChoices = provider && data && data.modelsByProvider ? data.modelsByProvider[provider] || [] : data && data.models || [];
|
|
3511
|
+
const changeScope = (next) => {
|
|
3512
|
+
scopeTouchedRef.current = true;
|
|
3513
|
+
setSessionScope(next);
|
|
3514
|
+
setLoading(true);
|
|
3515
|
+
setErr("");
|
|
3516
|
+
rpcCall("config", { sessionScope: next }).catch((e) => {
|
|
3517
|
+
setErr(String(e && e.message || e));
|
|
3518
|
+
}).then(() => rpcCall("query", Object.assign({}, buildQ(true), { sessionScope: next }))).then((d) => {
|
|
3519
|
+
setData(d);
|
|
3520
|
+
setPage(0);
|
|
3521
|
+
}).catch((e) => setErr(String(e && e.message || e))).finally(() => setLoading(false));
|
|
3522
|
+
};
|
|
3479
3523
|
const summaryRows = (data && data.summary || []).map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
3480
3524
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: r.key }),
|
|
3481
3525
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtNum(r.calls) }),
|
|
@@ -3495,10 +3539,18 @@ function TokenLogView(props) {
|
|
|
3495
3539
|
const st = statusInfo(r);
|
|
3496
3540
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
3497
3541
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtTime(r.time) }),
|
|
3498
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3542
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
|
|
3543
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dtok-sid", title: "\u4F1A\u8BDD\uFF1A" + r.sessionId + (r.parentSessionId ? "\n\u76F4\u63A5\u7236\u4F1A\u8BDD\uFF1A" + r.parentSessionId : "") + "\n\u70B9\u51FB\u6309\u6B64\u4F1A\u8BDD\u7B5B\u9009", onClick: () => {
|
|
3544
|
+
setSessionId(r.sessionId);
|
|
3545
|
+
setLoading(true);
|
|
3546
|
+
setErr("");
|
|
3547
|
+
rpcCall("query", Object.assign({}, buildQ(true), { sessionId: r.sessionId })).then((d) => {
|
|
3548
|
+
setData(d);
|
|
3549
|
+
setPage(0);
|
|
3550
|
+
}).catch((e) => setErr(String(e && e.message || e))).finally(() => setLoading(false));
|
|
3551
|
+
}, children: shortId(r.sessionId) }),
|
|
3552
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dtok-session-kind", children: sessionType(r) })
|
|
3553
|
+
] }),
|
|
3502
3554
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: r.provider || "\u2014" }),
|
|
3503
3555
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: r.model || "\u2014" }),
|
|
3504
3556
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtNum(r.cacheReadTokens) }),
|
|
@@ -3538,6 +3590,14 @@ function TokenLogView(props) {
|
|
|
3538
3590
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChartsPanel, { records, rate: rateCny }, "charts-" + fetchedAt)
|
|
3539
3591
|
);
|
|
3540
3592
|
} else {
|
|
3593
|
+
if (scopeInfo && scopeInfo.sessionId) bodyNodes.push(
|
|
3594
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dtok-scope-note", children: [
|
|
3595
|
+
scopeInfo.scope === "tree" ? "\u4EFB\u52A1\u7D2F\u8BA1 = \u672C\u4F1A\u8BDD + \u5168\u90E8\u540E\u4EE3\u5B50\u4EFB\u52A1\uFF1B\u6309\u5B9E\u9645\u8C03\u7528 ID \u53BB\u91CD\uFF0C\u5B50\u4EFB\u52A1\u7EE7\u627F\u7684\u5386\u53F2\u4E0D\u4F1A\u91CD\u590D\u8BA1\u7B97\u3002" : "\u4EC5\u7EDF\u8BA1\u5F53\u524D\u4F1A\u8BDD\u81EA\u5DF1\u7684\u8C03\u7528\uFF0C\u4E0D\u5305\u542B\u6D3E\u53D1\u7684\u5B50\u4EFB\u52A1\u3002",
|
|
3596
|
+
" \u672C\u4F1A\u8BDD " + fmtCompact(directTotals && directTotals.totalTokens || 0) + " Token",
|
|
3597
|
+
childTotals ? " \xB7 \u5B50\u4EFB\u52A1 " + fmtCompact(childTotals.totalTokens) + " Token / " + fmtCostCny(childTotals.cost, rateCny) + "\uFF08" + scopeInfo.descendantCount + " \u4E2A\u4F1A\u8BDD\uFF09" : "",
|
|
3598
|
+
scopeInfo.complete === false ? " \xB7 \u8C31\u7CFB\u90E8\u5206\u7F3A\u5931\uFF0C\u4EC5\u7D2F\u8BA1\u5DF2\u77E5\u4F1A\u8BDD" : ""
|
|
3599
|
+
] }, "scope-note")
|
|
3600
|
+
);
|
|
3541
3601
|
if (cards.length) bodyNodes.push(
|
|
3542
3602
|
// key 带 fetchedAt:每次「手动查询 / 首次加载」拿到新数据时重建一次,KPI 卡重播回弹动画
|
|
3543
3603
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dtok-cards" + (fetchedAt ? " dtok-pop" : ""), children: cards.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dtok-card", style: { "--i": String(i) }, children: [
|
|
@@ -3545,6 +3605,32 @@ function TokenLogView(props) {
|
|
|
3545
3605
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "l", children: c.l })
|
|
3546
3606
|
] }, c.l)) }, "cards-" + fetchedAt)
|
|
3547
3607
|
);
|
|
3608
|
+
if (breakdown.length) bodyNodes.push(
|
|
3609
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dtok-section-title", children: [
|
|
3610
|
+
"\u4F1A\u8BDD\u7528\u91CF\u62C6\u5206\uFF08",
|
|
3611
|
+
breakdown.length,
|
|
3612
|
+
" \u4E2A\u6709\u7528\u91CF\u7684\u4F1A\u8BDD\uFF09"
|
|
3613
|
+
] }, "session-sum"),
|
|
3614
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dtok-table-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { className: "dtok-table", children: [
|
|
3615
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
3616
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u4F1A\u8BDD" }),
|
|
3617
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u7C7B\u578B" }),
|
|
3618
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u8C03\u7528" }),
|
|
3619
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u603B Token" }),
|
|
3620
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u91D1\u989D\uFF08\u4EBA\u6C11\u5E01\uFF09" })
|
|
3621
|
+
] }) }),
|
|
3622
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: breakdown.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
3623
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { className: "dtok-session-tree", title: "\u4F1A\u8BDD\uFF1A" + r.sessionId + (r.parentSessionId ? "\n\u76F4\u63A5\u7236\u4F1A\u8BDD\uFF1A" + r.parentSessionId : ""), children: [
|
|
3624
|
+
r.sessionDepth ? "\u2514 ".repeat(Math.min(r.sessionDepth, 4)) : "",
|
|
3625
|
+
shortId(r.sessionId)
|
|
3626
|
+
] }),
|
|
3627
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: r.sessionId === scopeInfo.sessionId ? "\u5F53\u524D\u4F1A\u8BDD" : sessionType(r) }),
|
|
3628
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtNum(r.calls) }),
|
|
3629
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtCompact(r.totalTokens) }),
|
|
3630
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtCostCny(r.cost, rateCny) })
|
|
3631
|
+
] }, r.sessionId)) })
|
|
3632
|
+
] }) }, "session-sum-table")
|
|
3633
|
+
);
|
|
3548
3634
|
if (summaryRows.length) bodyNodes.push(
|
|
3549
3635
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dtok-section-title", children: [
|
|
3550
3636
|
"\u7EDF\u8BA1\u5206\u7EC4: ",
|
|
@@ -3641,6 +3727,13 @@ function TokenLogView(props) {
|
|
|
3641
3727
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: "\u5168\u90E8" }),
|
|
3642
3728
|
opts(sessionIds)
|
|
3643
3729
|
] }),
|
|
3730
|
+
sessionId ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
3731
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { children: "\u4F1A\u8BDD\u53E3\u5F84" }),
|
|
3732
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { className: "dtok-select", value: sessionScope, "aria-label": "\u4F1A\u8BDD\u7528\u91CF\u53E3\u5F84", onChange: (e) => changeScope(e.target.value), children: [
|
|
3733
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "tree", children: "\u4EFB\u52A1\u7D2F\u8BA1\uFF08\u542B\u5B50\u4EFB\u52A1\uFF09" }),
|
|
3734
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "session", children: "\u4EC5\u672C\u4F1A\u8BDD" })
|
|
3735
|
+
] })
|
|
3736
|
+
] }) : null,
|
|
3644
3737
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { children: "\u63D0\u4F9B\u5546" }),
|
|
3645
3738
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { className: "dtok-select", value: provider, onChange: (e) => {
|
|
3646
3739
|
setProvider(e.target.value);
|
|
@@ -3720,7 +3813,7 @@ function TokenLogHomeStat() {
|
|
|
3720
3813
|
}
|
|
3721
3814
|
function TokenLogChip(props) {
|
|
3722
3815
|
const sid = props && props.sessionId || props && props.session && props.session.sessionId || null;
|
|
3723
|
-
const [snap, setSnap] = (0, import_react2.useState)({ totals: null, rate: 7.2, err: "" });
|
|
3816
|
+
const [snap, setSnap] = (0, import_react2.useState)({ totals: null, directTotals: null, scope: null, rate: 7.2, err: "" });
|
|
3724
3817
|
(0, import_react2.useEffect)(() => {
|
|
3725
3818
|
if (!sid) return;
|
|
3726
3819
|
let cancel = false;
|
|
@@ -3728,9 +3821,9 @@ function TokenLogChip(props) {
|
|
|
3728
3821
|
const load = () => {
|
|
3729
3822
|
if (cancel || isTokenlogRouteGone()) return null;
|
|
3730
3823
|
return rpcCall("query", { sessionId: sid }).then((d) => {
|
|
3731
|
-
if (!cancel) setSnap({ totals: d && d.totals, rate: d && d.rateUsdCny || 7.2, err: "" });
|
|
3824
|
+
if (!cancel) setSnap({ totals: d && d.totals, directTotals: d && d.directTotals, scope: d && d.sessionScope, rate: d && d.rateUsdCny || 7.2, err: "" });
|
|
3732
3825
|
}).catch((e) => {
|
|
3733
|
-
if (!cancel) setSnap((s) => ({
|
|
3826
|
+
if (!cancel) setSnap((s) => ({ ...s, err: String(e && e.message || e) }));
|
|
3734
3827
|
});
|
|
3735
3828
|
};
|
|
3736
3829
|
load();
|
|
@@ -3742,19 +3835,23 @@ function TokenLogChip(props) {
|
|
|
3742
3835
|
}, [sid]);
|
|
3743
3836
|
if (!sid) return null;
|
|
3744
3837
|
const t = snap.totals;
|
|
3838
|
+
const cumulative = snap.scope && snap.scope.scope === "tree";
|
|
3839
|
+
const own = snap.directTotals;
|
|
3840
|
+
const childTokens = cumulative ? Math.max(0, (t && t.totalTokens || 0) - (own && own.totalTokens || 0)) : 0;
|
|
3841
|
+
const childCost = cumulative ? Math.max(0, (t && t.cost || 0) - (own && own.cost || 0)) : 0;
|
|
3745
3842
|
const gone = isTokenlogRouteGone();
|
|
3746
3843
|
const hasData = !!t && !gone && !(snap.err && !t);
|
|
3747
3844
|
const labelIcon = hasData ? "\u26C1 " : "";
|
|
3748
3845
|
const labelMain = gone ? "\u7528\u91CF\xB7\u672A\u542F\u7528" : snap.err && !t ? snap.err.includes("\u91CD\u542F") || snap.err.includes("\u542F\u7528") ? "\u7528\u91CF\xB7\u672A\u542F\u7528" : "\u7528\u91CF\xB7\u5931\u8D25" : t ? fmtCompact(t.totalTokens) : "\u2026";
|
|
3749
3846
|
const labelExtra = hasData && t.cost > 0 ? " \xB7 " + fmtCostCny(t.cost, snap.rate) : "";
|
|
3750
|
-
const title = gone ? routeGoneMessage() + "\n\uFF08\u53EF\u5728\u529F\u80FD\u575E\u91CC\u542F\u7528\u300C\u7528\u91CF\u8BB0\u5F55\u300D\uFF09" : t ? "\u672C\u4F1A\u8BDD " + fmtNum(t.calls) + " \u6B21\u8C03\u7528 \xB7 " + fmtNum(t.totalTokens) + " Token \xB7 " + fmtCostCny(t.cost, snap.rate) + "\uFF08\u4F30\u7B97\uFF09\n\u70B9\u51FB\u5728\u529F\u80FD\u575E\u67E5\u770B\u7528\u91CF\u8BB0\u5F55" : (snap.err ? snap.err + "\n" : "") + "\u70B9\u51FB\u5728\u529F\u80FD\u575E\u67E5\u770B\u7528\u91CF\u8BB0\u5F55";
|
|
3847
|
+
const title = gone ? routeGoneMessage() + "\n\uFF08\u53EF\u5728\u529F\u80FD\u575E\u91CC\u542F\u7528\u300C\u7528\u91CF\u8BB0\u5F55\u300D\uFF09" : t ? (cumulative ? "\u4EFB\u52A1\u7D2F\u8BA1\uFF08\u542B\u5B50\u4EFB\u52A1\uFF09" : "\u4EC5\u672C\u4F1A\u8BDD") + " " + fmtNum(t.calls) + " \u6B21\u8C03\u7528 \xB7 " + fmtNum(t.totalTokens) + " Token \xB7 " + fmtCostCny(t.cost, snap.rate) + "\uFF08\u4F30\u7B97\uFF09" + (cumulative ? "\n\u672C\u4F1A\u8BDD " + fmtCompact(own && own.totalTokens || 0) + " Token / " + fmtCostCny(own && own.cost || 0, snap.rate) + " \xB7 \u5B50\u4EFB\u52A1 " + fmtCompact(childTokens) + " Token / " + fmtCostCny(childCost, snap.rate) + "\uFF08" + snap.scope.descendantCount + " \u4E2A\u4F1A\u8BDD\uFF09" : "") + (cumulative && snap.scope.complete === false ? "\n\u8C31\u7CFB\u90E8\u5206\u7F3A\u5931\uFF0C\u4EC5\u7D2F\u8BA1\u5DF2\u77E5\u4F1A\u8BDD" : "") + "\n\u70B9\u51FB\u5728\u529F\u80FD\u575E\u67E5\u770B\u7528\u91CF\u8BB0\u5F55" : (snap.err ? snap.err + "\n" : "") + "\u70B9\u51FB\u5728\u529F\u80FD\u575E\u67E5\u770B\u7528\u91CF\u8BB0\u5F55";
|
|
3751
3848
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
3752
3849
|
"button",
|
|
3753
3850
|
{
|
|
3754
3851
|
type: "button",
|
|
3755
3852
|
className: "dockchip" + (snap.err && !t && !gone ? " err" : ""),
|
|
3756
3853
|
title,
|
|
3757
|
-
"aria-label": "\u4F1A\u8BDD\u7528\u91CF",
|
|
3854
|
+
"aria-label": cumulative ? "\u4EFB\u52A1\u7D2F\u8BA1\u7528\u91CF\uFF08\u542B\u5B50\u4EFB\u52A1\uFF09" : "\u672C\u4F1A\u8BDD\u7528\u91CF",
|
|
3758
3855
|
onClick: () => openPanel("tokenlog", { sessionId: sid, navAt: Date.now() }),
|
|
3759
3856
|
children: [
|
|
3760
3857
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dockchip-svg", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
|
|
@@ -3764,7 +3861,7 @@ function TokenLogChip(props) {
|
|
|
3764
3861
|
] }) }),
|
|
3765
3862
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dockchip-dot", style: { background: gone ? "var(--dsw-alias-label-tertiary,#8b95ab)" : "var(--dk-warn)" } }),
|
|
3766
3863
|
labelIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dockchip-ic", children: labelIcon }) : null,
|
|
3767
|
-
hasData ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dockchip-pre-s", children: "\u7528\u91CF " }) : null,
|
|
3864
|
+
hasData ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dockchip-pre-s", children: cumulative ? "\u7D2F\u8BA1 " : "\u7528\u91CF " }) : null,
|
|
3768
3865
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dockchip-val", children: labelMain }),
|
|
3769
3866
|
labelExtra ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dockchip-x", children: labelExtra }) : null
|
|
3770
3867
|
]
|
|
@@ -3776,7 +3873,7 @@ var feature = {
|
|
|
3776
3873
|
name: "\u7528\u91CF\u8BB0\u5F55",
|
|
3777
3874
|
order: 110,
|
|
3778
3875
|
accent: "#fbbf24",
|
|
3779
|
-
description: "\u8BB0\u5F55\u5168\u90E8 LLM API \u8C03\u7528\uFF1A\u79D2\u7EA7\
|
|
3876
|
+
description: "\u8BB0\u5F55\u5168\u90E8 LLM API \u8C03\u7528\uFF1A\u79D2\u7EA7\u7B5B\u9009\u3001\u4E3B\u4EFB\u52A1+\u540E\u4EE3\u5B50\u4EFB\u52A1\u7D2F\u8BA1/\u4EC5\u672C\u4F1A\u8BDD\u5207\u6362\u3001\u4F1A\u8BDD\u7528\u91CF\u62C6\u5206\u3001Token/\u8D39\u7528\u7EDF\u8BA1\uFF08\u81EA\u5B9A\u4E49\u5355\u4EF7\u4E0E\u5CF0\u8C37\u4EF7\uFF09\u3001\u5206\u7EC4\u6C47\u603B\u3001\u660E\u7EC6\u68C0\u7D22\u4E0E CSV \u5BFC\u51FA",
|
|
3780
3877
|
css,
|
|
3781
3878
|
View: TokenLogView,
|
|
3782
3879
|
HomeStat: TokenLogHomeStat,
|
|
@@ -4344,10 +4441,10 @@ function ModelsStat() {
|
|
|
4344
4441
|
}
|
|
4345
4442
|
var feature2 = {
|
|
4346
4443
|
id: "modelconfig",
|
|
4347
|
-
name: "\u6A21\u578B\
|
|
4444
|
+
name: "\u6A21\u578B\u80FD\u529B",
|
|
4348
4445
|
order: 100,
|
|
4349
4446
|
accent: "#22d3ee",
|
|
4350
|
-
description: "\u7F16\u8F91\u5404 Provider \u6A21\u578B\u7684\u8F93\u5165\u7C7B\u578B\u4E0E\u601D\u8003\u5F3A\u5EA6\u6863\u4F4D\uFF0C\u5199\u56DE\u5B98\u65B9\u914D\u7F6E\u70ED\u751F\u6548\uFF1BProvider \u81EA\u8EAB\u7684\u589E\u5220\u6539\u5728\u300C\u6A21\u578B\
|
|
4447
|
+
description: "\u7F16\u8F91\u5404 Provider \u6A21\u578B\u7684\u8F93\u5165\u7C7B\u578B\u4E0E\u601D\u8003\u5F3A\u5EA6\u6863\u4F4D\uFF0C\u5199\u56DE\u5B98\u65B9\u914D\u7F6E\u70ED\u751F\u6548\uFF1BProvider \u81EA\u8EAB\u7684\u589E\u5220\u6539\u5728\u300C\u6A21\u578B\u7BA1\u7406\u300D\u91CC\u7BA1\u7406",
|
|
4351
4448
|
css: [
|
|
4352
4449
|
".dkm-note{color:var(--dsw-alias-label-secondary);font-size:12px;}",
|
|
4353
4450
|
".dkm-warn{color:var(--dk-warn);}",
|
|
@@ -4883,11 +4980,11 @@ function ProvidersView(props) {
|
|
|
4883
4980
|
);
|
|
4884
4981
|
const piProviders = providers.filter((p) => p.kind === "pi-ai");
|
|
4885
4982
|
const body = [
|
|
4886
|
-
import_react4.default.createElement("h2", { key: "title", className: "dkp-title" }, "\u6A21\u578B\
|
|
4983
|
+
import_react4.default.createElement("h2", { key: "title", className: "dkp-title" }, "\u6A21\u578B\u7BA1\u7406"),
|
|
4887
4984
|
import_react4.default.createElement(
|
|
4888
4985
|
"p",
|
|
4889
4986
|
{ key: "intro", className: "dkp-intro" },
|
|
4890
|
-
"\u65B0\u589E / \u7F16\u8F91 / \u5220\u9664\u81EA\u5B9A\u4E49\u6A21\u578B Provider\uFF08OpenAI \u517C\u5BB9\u3001Anthropic \u7B49\uFF09\uFF0C\u5199\u5165\u5B98\u65B9\u914D\u7F6E\u5E76\u70ED\u751F\u6548\uFF1BAPI Key \u5B58\u672C\u673A\u51ED\u636E\u5E93\uFF08\u6587\u4EF6\u4EC5 root \u53EF\u8BFB\uFF09\u3002\u5185\u7F6E DeepSeek \u5B98\u65B9 Provider \u5728\u672C\u9875\u53EA\u8BFB\uFF0C\u5176\u6A21\u578B\u76EE\u5F55\u5728\u300C\u6A21\u578B\
|
|
4987
|
+
"\u65B0\u589E / \u7F16\u8F91 / \u5220\u9664\u81EA\u5B9A\u4E49\u6A21\u578B Provider\uFF08OpenAI \u517C\u5BB9\u3001Anthropic \u7B49\uFF09\uFF0C\u5199\u5165\u5B98\u65B9\u914D\u7F6E\u5E76\u70ED\u751F\u6548\uFF1BAPI Key \u5B58\u672C\u673A\u51ED\u636E\u5E93\uFF08\u6587\u4EF6\u4EC5 root \u53EF\u8BFB\uFF09\u3002\u5185\u7F6E DeepSeek \u5B98\u65B9 Provider \u5728\u672C\u9875\u53EA\u8BFB\uFF0C\u5176\u6A21\u578B\u76EE\u5F55\u5728\u300C\u6A21\u578B\u80FD\u529B\u300D\u91CC\u7F16\u8F91\u3002\u672C\u529F\u80FD\u53EF\u5355\u72EC\u505C\u7528\uFF1A\u505C\u7528\u540E\u8FD9\u4E9B\u5199\u914D\u7F6E\u4E0E\u51FA\u7AD9\u8BF7\u6C42\u7684\u8DEF\u7531\u4E00\u5E76\u5173\u95ED\u3002"
|
|
4891
4988
|
)
|
|
4892
4989
|
];
|
|
4893
4990
|
if (snap.error) {
|
|
@@ -4974,8 +5071,8 @@ function ProvidersStat() {
|
|
|
4974
5071
|
}
|
|
4975
5072
|
var feature3 = {
|
|
4976
5073
|
id: "providerconfig",
|
|
4977
|
-
name: "\u6A21\u578B\
|
|
4978
|
-
order:
|
|
5074
|
+
name: "\u6A21\u578B\u7BA1\u7406",
|
|
5075
|
+
order: 99,
|
|
4979
5076
|
accent: "#8b5cf6",
|
|
4980
5077
|
description: "\u7BA1\u7406\u81EA\u5B9A\u4E49\u6A21\u578B Provider\uFF1A\u65B0\u589E/\u7F16\u8F91/\u5220\u9664\u3001\u62C9\u53D6\u4E0A\u6E38\u6A21\u578B\u5217\u8868\u3001\u5199\u5165 API Key\uFF08\u53EF\u5355\u72EC\u505C\u7528\uFF09",
|
|
4981
5078
|
css: [
|
|
@@ -5074,98 +5171,8 @@ var feature3 = {
|
|
|
5074
5171
|
HomeStat: ProvidersStat
|
|
5075
5172
|
};
|
|
5076
5173
|
|
|
5077
|
-
// features/heartbeat/view.js
|
|
5078
|
-
var import_react5 = __toESM(require("react"), 1);
|
|
5079
|
-
var loadedAt = Date.now();
|
|
5080
|
-
function uptimeText() {
|
|
5081
|
-
const sec = Math.max(0, Math.floor((Date.now() - loadedAt) / 1e3));
|
|
5082
|
-
const m = Math.floor(sec / 60);
|
|
5083
|
-
return "\u9762\u677F\u5DF2\u8FD0\u884C " + (m > 0 ? m + " \u5206 " : "") + sec % 60 + " \u79D2";
|
|
5084
|
-
}
|
|
5085
|
-
function HeartbeatView(props) {
|
|
5086
|
-
const ctx = props && props.ctx;
|
|
5087
|
-
const [txt, setTxt] = import_react5.default.useState(uptimeText());
|
|
5088
|
-
import_react5.default.useEffect(() => ctx && typeof ctx.interval === "function" ? ctx.interval(() => setTxt(uptimeText()), 1e3) : void 0, []);
|
|
5089
|
-
return import_react5.default.createElement("div", null, txt);
|
|
5090
|
-
}
|
|
5091
|
-
function HeartbeatStat(props) {
|
|
5092
|
-
const ctx = props && props.ctx;
|
|
5093
|
-
const [txt, setTxt] = import_react5.default.useState(uptimeText());
|
|
5094
|
-
import_react5.default.useEffect(() => ctx && typeof ctx.interval === "function" ? ctx.interval(() => setTxt(uptimeText()), 1e3) : void 0, []);
|
|
5095
|
-
return import_react5.default.createElement("span", null, txt);
|
|
5096
|
-
}
|
|
5097
|
-
var feature4 = {
|
|
5098
|
-
id: "heartbeat",
|
|
5099
|
-
name: "\u5FC3\u8DF3\u76D1\u89C6",
|
|
5100
|
-
order: 140,
|
|
5101
|
-
accent: "#34d399",
|
|
5102
|
-
description: "\u793A\u4F8B\u529F\u80FD\uFF1A\u9762\u677F\u4FA7\u8FD0\u884C\u65F6\u957F\u5FC3\u8DF3\uFF08\u7EAF Client\uFF09",
|
|
5103
|
-
defaultEnabled: false,
|
|
5104
|
-
View: HeartbeatView,
|
|
5105
|
-
HomeStat: HeartbeatStat
|
|
5106
|
-
};
|
|
5107
|
-
|
|
5108
|
-
// features/theme/view.js
|
|
5109
|
-
var import_react6 = __toESM(require("react"), 1);
|
|
5110
|
-
var import_react7 = require("react");
|
|
5111
|
-
var PREFERENCE_LABELS = { light: "\u4EAE\u8272", dark: "\u6697\u8272", system: "\u8DDF\u968F\u7CFB\u7EDF" };
|
|
5112
|
-
var THEME_LABELS = { light: "\u4EAE\u8272", dark: "\u6697\u8272" };
|
|
5113
|
-
function readThemeInfo(ctx) {
|
|
5114
|
-
const theme = ctx && ctx.get ? ctx.get("theme") : void 0;
|
|
5115
|
-
if (!theme || typeof theme.getTheme !== "function") return { err: "theme \u670D\u52A1\u4E0D\u53EF\u7528" };
|
|
5116
|
-
let snap = null;
|
|
5117
|
-
try {
|
|
5118
|
-
snap = theme.getTheme();
|
|
5119
|
-
} catch (err) {
|
|
5120
|
-
return { err: "\u8BFB\u53D6\u5931\u8D25\uFF1A" + String(err && err.message || err) };
|
|
5121
|
-
}
|
|
5122
|
-
const preference = snap && typeof snap.preference === "string" ? snap.preference : "";
|
|
5123
|
-
const activeId = snap && snap.active && typeof snap.active.id === "string" ? snap.active.id : "";
|
|
5124
|
-
const label = (PREFERENCE_LABELS[preference] || preference || "\u672A\u77E5") + (activeId && activeId !== preference && THEME_LABELS[activeId] ? "\uFF08\u5B9E\u9645" + THEME_LABELS[activeId] + "\uFF09" : "");
|
|
5125
|
-
return { label };
|
|
5126
|
-
}
|
|
5127
|
-
function useThemeInfo(ctx) {
|
|
5128
|
-
const [info, setInfo] = (0, import_react7.useState)(() => readThemeInfo(ctx));
|
|
5129
|
-
(0, import_react7.useEffect)(() => {
|
|
5130
|
-
let off = null;
|
|
5131
|
-
try {
|
|
5132
|
-
if (ctx && typeof ctx.on === "function") {
|
|
5133
|
-
off = ctx.on("theme/change", () => setInfo(readThemeInfo(ctx)));
|
|
5134
|
-
}
|
|
5135
|
-
} catch {
|
|
5136
|
-
}
|
|
5137
|
-
return () => {
|
|
5138
|
-
try {
|
|
5139
|
-
if (typeof off === "function") off();
|
|
5140
|
-
} catch {
|
|
5141
|
-
}
|
|
5142
|
-
};
|
|
5143
|
-
}, [ctx]);
|
|
5144
|
-
return info;
|
|
5145
|
-
}
|
|
5146
|
-
function ThemeView(props) {
|
|
5147
|
-
const r = useThemeInfo(props && props.ctx);
|
|
5148
|
-
if (r.err) return import_react6.default.createElement("div", null, r.err);
|
|
5149
|
-
return import_react6.default.createElement("div", null, "\u5F53\u524D\u4E3B\u9898\uFF1A" + r.label);
|
|
5150
|
-
}
|
|
5151
|
-
function ThemeStat(props) {
|
|
5152
|
-
const r = useThemeInfo(props && props.ctx);
|
|
5153
|
-
if (r.err) return import_react6.default.createElement("span", null, r.err);
|
|
5154
|
-
return import_react6.default.createElement("span", null, "\u4E3B\u9898\uFF1A" + r.label);
|
|
5155
|
-
}
|
|
5156
|
-
var feature5 = {
|
|
5157
|
-
id: "theme",
|
|
5158
|
-
name: "\u4E3B\u9898\u4FE1\u606F",
|
|
5159
|
-
order: 150,
|
|
5160
|
-
accent: "#a78bfa",
|
|
5161
|
-
description: "\u8BFB\u53D6\u5F53\u524D\u4E3B\u9898\u5FEB\u7167\uFF1A\u504F\u597D\u4E0E\u5B9E\u9645\u751F\u6548\u4E3B\u9898\uFF08\u7EAF Client\uFF0C\u4E3B\u9898\u5207\u6362\u5B9E\u65F6\u5237\u65B0\uFF09",
|
|
5162
|
-
defaultEnabled: false,
|
|
5163
|
-
View: ThemeView,
|
|
5164
|
-
HomeStat: ThemeStat
|
|
5165
|
-
};
|
|
5166
|
-
|
|
5167
5174
|
// features/balance/view.js
|
|
5168
|
-
var
|
|
5175
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
5169
5176
|
var ACCENT_PALETTE = ["#2563eb", "#0d9488", "#b45309", "#7c3aed", "#be185d", "#0369a1", "#c2410c", "#15803d", "#a21caf", "#0e7490"];
|
|
5170
5177
|
var CURATED_ACCENTS = {
|
|
5171
5178
|
"deepseek-official": "#2563eb",
|
|
@@ -5232,8 +5239,8 @@ var balanceStore = {
|
|
|
5232
5239
|
}
|
|
5233
5240
|
};
|
|
5234
5241
|
function useBalance(ctx) {
|
|
5235
|
-
const [snap, setSnap] =
|
|
5236
|
-
|
|
5242
|
+
const [snap, setSnap] = import_react5.default.useState(balanceStore.snap);
|
|
5243
|
+
import_react5.default.useEffect(() => {
|
|
5237
5244
|
const off = balanceStore.subscribe(() => setSnap(balanceStore.snap));
|
|
5238
5245
|
if (!balanceStore.snap.data && !balanceStore.snap.loading) balanceStore.load();
|
|
5239
5246
|
const disposer = ctx && typeof ctx.interval === "function" ? ctx.interval(() => balanceStore.load(), 5 * 60 * 1e3) : null;
|
|
@@ -5247,7 +5254,7 @@ function useBalance(ctx) {
|
|
|
5247
5254
|
function BalanceView(props) {
|
|
5248
5255
|
const snap = useBalance(props && props.ctx);
|
|
5249
5256
|
const load = () => balanceStore.load();
|
|
5250
|
-
|
|
5257
|
+
import_react5.default.useEffect(() => {
|
|
5251
5258
|
const pid = props && props.params && props.params.provider;
|
|
5252
5259
|
if (!pid || typeof document === "undefined") return;
|
|
5253
5260
|
const t = setTimeout(() => {
|
|
@@ -5270,15 +5277,15 @@ function BalanceView(props) {
|
|
|
5270
5277
|
const def = data && data.default ? data.default.provider : null;
|
|
5271
5278
|
const body = [];
|
|
5272
5279
|
if (snap.error) {
|
|
5273
|
-
body.push(
|
|
5280
|
+
body.push(import_react5.default.createElement("div", { key: "err", className: "dkb-note dkb-error" }, "\u4F59\u989D\u67E5\u8BE2\u5931\u8D25\uFF1A" + snap.error));
|
|
5274
5281
|
} else if (!data) {
|
|
5275
|
-
body.push(
|
|
5282
|
+
body.push(import_react5.default.createElement("div", { key: "loading", className: "dkb-note" }, snap.loading ? "\u6B63\u5728\u62C9\u53D6\u4F59\u989D\u2026" : "\u8FD8\u6CA1\u6709\u6570\u636E\uFF0C\u70B9\u51FB\u4E0B\u65B9\u5237\u65B0"));
|
|
5276
5283
|
} else if (providers.length === 0) {
|
|
5277
|
-
body.push(
|
|
5284
|
+
body.push(import_react5.default.createElement("div", { key: "empty", className: "dkb-note" }, "\u6CA1\u6709\u627E\u5230\u5DF2\u914D\u7F6E\u7684\u6A21\u578B Provider"));
|
|
5278
5285
|
} else {
|
|
5279
5286
|
const rank = (p) => p.balance && p.balance.status === "ok" ? 0 : p.balance && p.balance.status === "login-required" ? 1 : 2;
|
|
5280
5287
|
const sorted = providers.slice().sort((a, b) => rank(a) - rank(b));
|
|
5281
|
-
body.push(
|
|
5288
|
+
body.push(import_react5.default.createElement(
|
|
5282
5289
|
"div",
|
|
5283
5290
|
{ key: "rows", className: "dkb-rows" },
|
|
5284
5291
|
sorted.map((p) => {
|
|
@@ -5295,76 +5302,76 @@ function BalanceView(props) {
|
|
|
5295
5302
|
let balBody = null;
|
|
5296
5303
|
if (b && b.status === "ok" && b.kind === "quota") {
|
|
5297
5304
|
const dims = Array.isArray(b.dims) ? b.dims : [];
|
|
5298
|
-
balBody =
|
|
5299
|
-
|
|
5305
|
+
balBody = import_react5.default.createElement(
|
|
5306
|
+
import_react5.default.Fragment,
|
|
5300
5307
|
null,
|
|
5301
|
-
|
|
5308
|
+
import_react5.default.createElement(
|
|
5302
5309
|
"div",
|
|
5303
5310
|
{ className: "dkb-main" },
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5311
|
+
import_react5.default.createElement("span", { className: "dkb-main-label" }, "\u5269\u4F59\u989D\u5EA6"),
|
|
5312
|
+
import_react5.default.createElement("span", { className: "dkb-main-value" }, fmt(b.remaining) + (b.unit ? " " + b.unit : "")),
|
|
5313
|
+
import_react5.default.createElement(
|
|
5307
5314
|
"span",
|
|
5308
5315
|
{ className: "dkb-main-part" },
|
|
5309
5316
|
"\u5DF2\u7528 " + fmt(b.used) + " / \u603B " + fmt(b.limit),
|
|
5310
|
-
b.resetTime ?
|
|
5317
|
+
b.resetTime ? import_react5.default.createElement("span", null, " \xB7 \u91CD\u7F6E " + String(b.resetTime).slice(0, 10)) : null
|
|
5311
5318
|
)
|
|
5312
5319
|
),
|
|
5313
|
-
dims.map((d, i) =>
|
|
5320
|
+
dims.map((d, i) => import_react5.default.createElement(
|
|
5314
5321
|
"div",
|
|
5315
5322
|
{ key: "d" + i, className: "dkb-dim" },
|
|
5316
|
-
|
|
5317
|
-
|
|
5323
|
+
import_react5.default.createElement("span", { className: "dkb-dim-label" }, d.window === "weekly" ? "\u5468\u989D\u5EA6" : "\u5C0F\u65F6\u989D\u5EA6"),
|
|
5324
|
+
import_react5.default.createElement(
|
|
5318
5325
|
"span",
|
|
5319
5326
|
{ className: "dkb-dim-bar" },
|
|
5320
|
-
|
|
5327
|
+
import_react5.default.createElement("span", { className: "dkb-dim-fill", style: { width: (d.limit > 0 ? Math.min(100, Math.round(d.remaining / d.limit * 100)) : 0) + "%" } })
|
|
5321
5328
|
),
|
|
5322
|
-
|
|
5329
|
+
import_react5.default.createElement("span", { className: "dkb-dim-text" }, "\u5269 " + fmt(d.remaining) + " / " + fmt(d.limit))
|
|
5323
5330
|
))
|
|
5324
5331
|
);
|
|
5325
5332
|
} else if (b && b.status === "ok") {
|
|
5326
5333
|
const infos = Array.isArray(b.infos) ? b.infos : [];
|
|
5327
|
-
balBody =
|
|
5334
|
+
balBody = import_react5.default.createElement(
|
|
5328
5335
|
"div",
|
|
5329
5336
|
{ className: "dkb-mains" },
|
|
5330
5337
|
infos.map((rawInfo, idx) => {
|
|
5331
5338
|
const i = cnyBalanceInfo(rawInfo);
|
|
5332
|
-
return
|
|
5339
|
+
return import_react5.default.createElement(
|
|
5333
5340
|
"div",
|
|
5334
5341
|
{ key: idx, className: "dkb-main" },
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5342
|
+
import_react5.default.createElement("span", { className: "dkb-main-label", style: { color: accent } }, i.currency),
|
|
5343
|
+
import_react5.default.createElement("span", { className: "dkb-main-value" }, moneyText(i.totalBalance)),
|
|
5344
|
+
import_react5.default.createElement(
|
|
5338
5345
|
"span",
|
|
5339
5346
|
{ className: "dkb-main-parts" },
|
|
5340
|
-
i.grantedBalance != null ?
|
|
5341
|
-
i.toppedUpBalance != null ?
|
|
5347
|
+
i.grantedBalance != null ? import_react5.default.createElement("span", { className: "dkb-main-part", style: { color: C_GRANTED } }, "\u8D60\u9001 " + moneyText(i.grantedBalance)) : null,
|
|
5348
|
+
i.toppedUpBalance != null ? import_react5.default.createElement("span", { className: "dkb-main-part", style: { color: C_TOPUP } }, "\u5145\u503C " + moneyText(i.toppedUpBalance)) : null
|
|
5342
5349
|
)
|
|
5343
5350
|
);
|
|
5344
5351
|
})
|
|
5345
5352
|
);
|
|
5346
5353
|
} else if (b && b.status === "login-required" && b.consoleUrl) {
|
|
5347
|
-
balBody =
|
|
5354
|
+
balBody = import_react5.default.createElement(
|
|
5348
5355
|
"div",
|
|
5349
5356
|
{ className: "dkb-main" },
|
|
5350
|
-
|
|
5357
|
+
import_react5.default.createElement("a", { href: b.consoleUrl, target: "_blank", rel: "noreferrer", className: "dkb-link", style: { color: accent } }, "\u53BB\u63A7\u5236\u53F0\u67E5\u770B\u4F59\u989D \u2192")
|
|
5351
5358
|
);
|
|
5352
5359
|
} else {
|
|
5353
|
-
balBody = b && b.message ?
|
|
5360
|
+
balBody = b && b.message ? import_react5.default.createElement("div", { className: "dkb-note" }, b.message) : import_react5.default.createElement("div", { className: "dkb-note" }, "\u8BE5 Provider \u6CA1\u6709\u5DF2\u77E5\u7684\u4F59\u989D\u67E5\u8BE2\u63A5\u53E3");
|
|
5354
5361
|
}
|
|
5355
5362
|
const sub = ["ID " + p.id, p.api, p.baseURL ? p.baseURL.replace(/^https?:\/\//, "") : null].filter(Boolean).join(" \xB7 ");
|
|
5356
|
-
return
|
|
5363
|
+
return import_react5.default.createElement(
|
|
5357
5364
|
"div",
|
|
5358
5365
|
{ key: p.id, className: "dkb-row", "data-dock-provider": p.id },
|
|
5359
|
-
|
|
5366
|
+
import_react5.default.createElement(
|
|
5360
5367
|
"div",
|
|
5361
5368
|
{ className: "dkb-row-head" },
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
def === p.id ?
|
|
5365
|
-
|
|
5369
|
+
import_react5.default.createElement("span", { className: "dkb-dot", style: { background: accent } }),
|
|
5370
|
+
import_react5.default.createElement("span", { className: "dkb-name", style: { color: accent } }, p.displayName),
|
|
5371
|
+
def === p.id ? import_react5.default.createElement("span", { className: "dkb-default" }, "\u9ED8\u8BA4") : null,
|
|
5372
|
+
import_react5.default.createElement("span", { className: "dkb-badge" + (badge[1] ? " " + badge[1] : ""), style: badge[1] === "err" ? { color: C_ERR, borderColor: C_ERR } : null }, badge[0]),
|
|
5366
5373
|
// 模型数折叠提示(点开展开 chips)
|
|
5367
|
-
p.models && p.models.length > 0 ?
|
|
5374
|
+
p.models && p.models.length > 0 ? import_react5.default.createElement("button", {
|
|
5368
5375
|
type: "button",
|
|
5369
5376
|
className: "dkb-models-toggle",
|
|
5370
5377
|
title: p.models.join(", "),
|
|
@@ -5374,13 +5381,13 @@ function BalanceView(props) {
|
|
|
5374
5381
|
}
|
|
5375
5382
|
}, p.models.length + " \u4E2A\u6A21\u578B \u25BE") : null
|
|
5376
5383
|
),
|
|
5377
|
-
sub ?
|
|
5378
|
-
p.apiKeyEnv ?
|
|
5379
|
-
p.models && p.models.length > 0 ?
|
|
5384
|
+
sub ? import_react5.default.createElement("div", { className: "dkb-sub" }, sub) : null,
|
|
5385
|
+
p.apiKeyEnv ? import_react5.default.createElement("div", { className: "dkb-sub" }, "\u5BC6\u94A5: " + p.apiKeyEnv + (p.credentialConfigured ? " \u2713" : " \u2717")) : null,
|
|
5386
|
+
p.models && p.models.length > 0 ? import_react5.default.createElement(
|
|
5380
5387
|
"div",
|
|
5381
5388
|
{ className: "dkb-chips" },
|
|
5382
|
-
p.models.slice(0, 8).map((m) =>
|
|
5383
|
-
p.models.length > 8 ?
|
|
5389
|
+
p.models.slice(0, 8).map((m) => import_react5.default.createElement("span", { key: m, className: "dkb-chip", style: { border: "1px solid " + accent, color: accent, background: accent + "1a" } }, m)),
|
|
5390
|
+
p.models.length > 8 ? import_react5.default.createElement("span", { key: "more", className: "dkb-chip" }, "+" + (p.models.length - 8)) : null
|
|
5384
5391
|
) : null,
|
|
5385
5392
|
balBody
|
|
5386
5393
|
);
|
|
@@ -5388,20 +5395,20 @@ function BalanceView(props) {
|
|
|
5388
5395
|
));
|
|
5389
5396
|
}
|
|
5390
5397
|
const now = new Date(data && data.generatedAt ? data.generatedAt : Date.now());
|
|
5391
|
-
return
|
|
5398
|
+
return import_react5.default.createElement(
|
|
5392
5399
|
"div",
|
|
5393
5400
|
{ className: "dkb-rows" },
|
|
5394
|
-
|
|
5401
|
+
import_react5.default.createElement(
|
|
5395
5402
|
"div",
|
|
5396
5403
|
{ className: "dkb-note" },
|
|
5397
5404
|
data && !snap.error && providers.length > 0 ? okCount + "/" + providers.length + " \u4E2A Provider \u53EF\u67E5\u4F59\u989D\uFF08\u53EF\u67E5\u7684\u6392\u524D\u9762\uFF09" : "\u6A21\u578B\u4F59\u989D \xB7 Host \u534A\u90E8\u5B9E\u65F6\u62C9\u53D6"
|
|
5398
5405
|
),
|
|
5399
5406
|
body,
|
|
5400
|
-
|
|
5407
|
+
import_react5.default.createElement(
|
|
5401
5408
|
"div",
|
|
5402
5409
|
{ className: "dkb-foot" },
|
|
5403
|
-
|
|
5404
|
-
|
|
5410
|
+
import_react5.default.createElement("span", null, snap.loading ? "\u5237\u65B0\u4E2D\u2026" : "\u66F4\u65B0\u4E8E " + now.toLocaleTimeString()),
|
|
5411
|
+
import_react5.default.createElement("button", { type: "button", className: "dkb-refresh", onClick: load }, "\u5237\u65B0")
|
|
5405
5412
|
)
|
|
5406
5413
|
);
|
|
5407
5414
|
}
|
|
@@ -5409,14 +5416,14 @@ function BalanceStat(props) {
|
|
|
5409
5416
|
const snap = useBalance(props && props.ctx);
|
|
5410
5417
|
const data = snap.data;
|
|
5411
5418
|
const providers = data && Array.isArray(data.providers) ? data.providers : [];
|
|
5412
|
-
if (snap.error) return
|
|
5413
|
-
if (!data) return
|
|
5419
|
+
if (snap.error) return import_react5.default.createElement("span", { className: "dockm-err" }, "\u4F59\u989D\u67E5\u8BE2\u5931\u8D25\uFF08\u70B9\u51FB\u8FDB\u5165\u67E5\u770B\u8BE6\u60C5\uFF09");
|
|
5420
|
+
if (!data) return import_react5.default.createElement("span", null, snap.loading ? "\u6B63\u5728\u62C9\u53D6\u4F59\u989D\u2026" : "\u7B49\u5F85\u62C9\u53D6\u4F59\u989D");
|
|
5414
5421
|
const ok = providers.filter((p) => p.balance && p.balance.status === "ok").length;
|
|
5415
|
-
return
|
|
5422
|
+
return import_react5.default.createElement("span", null, providers.length + " \u4E2A Provider \xB7 " + ok + " \u4E2A\u53EF\u67E5\u4F59\u989D");
|
|
5416
5423
|
}
|
|
5417
5424
|
function useCurrentProvider(ctx, sessionId) {
|
|
5418
|
-
const [cur, setCur] =
|
|
5419
|
-
|
|
5425
|
+
const [cur, setCur] = import_react5.default.useState(null);
|
|
5426
|
+
import_react5.default.useEffect(() => {
|
|
5420
5427
|
let alive = true, off = null;
|
|
5421
5428
|
try {
|
|
5422
5429
|
const models = ctx && ctx.get ? ctx.get("modelDirectories") : void 0;
|
|
@@ -5479,7 +5486,7 @@ function BalanceChip(props) {
|
|
|
5479
5486
|
const selModel = sel && (sel.model || sel.selected && sel.selected.model) || null;
|
|
5480
5487
|
const title = cur ? (cur.displayName || cur.id) + (selModel ? " \xB7 \u5F53\u524D\u6A21\u578B " + selModel : "") + " \xB7 \u70B9\u51FB\u5728\u529F\u80FD\u575E\u67E5\u770B\u4F59\u989D\u8BE6\u60C5" : "\u70B9\u51FB\u6253\u5F00\u529F\u80FD\u575E \xB7 \u6A21\u578B\u4F59\u989D";
|
|
5481
5488
|
const mm = /^(余额 )([\s\S]*)$/.exec(text);
|
|
5482
|
-
return
|
|
5489
|
+
return import_react5.default.createElement(
|
|
5483
5490
|
"button",
|
|
5484
5491
|
{
|
|
5485
5492
|
type: "button",
|
|
@@ -5489,23 +5496,23 @@ function BalanceChip(props) {
|
|
|
5489
5496
|
onClick: () => openPanel("balance", def ? { provider: def } : null)
|
|
5490
5497
|
},
|
|
5491
5498
|
// 窄屏只显示这枚小图标:点它进功能坞看余额详情(title 里是完整数值)
|
|
5492
|
-
|
|
5499
|
+
import_react5.default.createElement(
|
|
5493
5500
|
"span",
|
|
5494
5501
|
{ className: "dockchip-svg", "aria-hidden": "true" },
|
|
5495
|
-
|
|
5502
|
+
import_react5.default.createElement(
|
|
5496
5503
|
"svg",
|
|
5497
5504
|
{ viewBox: "0 0 16 16", width: 13, height: 13, fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" },
|
|
5498
|
-
|
|
5499
|
-
|
|
5505
|
+
import_react5.default.createElement("path", { d: "M2.8 6.2h10.4v6.3a1 1 0 0 1-1 1H3.8a1 1 0 0 1-1-1z" }),
|
|
5506
|
+
import_react5.default.createElement("path", { d: "M5.4 6.2V4.6a2.6 2.6 0 0 1 5.2 0v1.6" })
|
|
5500
5507
|
)
|
|
5501
5508
|
),
|
|
5502
|
-
|
|
5503
|
-
mm ?
|
|
5504
|
-
mm ?
|
|
5505
|
-
|
|
5509
|
+
import_react5.default.createElement("span", { className: "dockchip-dot", style: { background: accent } }),
|
|
5510
|
+
mm ? import_react5.default.createElement("span", { className: "dockchip-pre" }, mm[1]) : null,
|
|
5511
|
+
mm ? import_react5.default.createElement("span", { className: "dockchip-pre-s" }, "\u4F59\u989D ") : null,
|
|
5512
|
+
import_react5.default.createElement("span", { className: "dockchip-val" }, mm ? mm[2] : text)
|
|
5506
5513
|
);
|
|
5507
5514
|
}
|
|
5508
|
-
var
|
|
5515
|
+
var feature4 = {
|
|
5509
5516
|
id: "balance",
|
|
5510
5517
|
name: "\u6A21\u578B\u4F59\u989D",
|
|
5511
5518
|
order: 120,
|
|
@@ -5562,7 +5569,7 @@ var feature6 = {
|
|
|
5562
5569
|
};
|
|
5563
5570
|
|
|
5564
5571
|
// features/animation/view.jsx
|
|
5565
|
-
var
|
|
5572
|
+
var import_react6 = require("react");
|
|
5566
5573
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
5567
5574
|
function rpcCall2(method, args) {
|
|
5568
5575
|
return fetch("dsh-dock/animation/" + method, {
|
|
@@ -5660,13 +5667,13 @@ var animationStore = {
|
|
|
5660
5667
|
}
|
|
5661
5668
|
};
|
|
5662
5669
|
function useAnimation() {
|
|
5663
|
-
const [snap, setSnap] = (0,
|
|
5664
|
-
(0,
|
|
5670
|
+
const [snap, setSnap] = (0, import_react6.useState)(animationStore.snap);
|
|
5671
|
+
(0, import_react6.useEffect)(() => animationStore.subscribe(() => setSnap(animationStore.snap)), []);
|
|
5665
5672
|
return snap;
|
|
5666
5673
|
}
|
|
5667
5674
|
function useTicker(ctx, active) {
|
|
5668
|
-
const [, bump] = (0,
|
|
5669
|
-
(0,
|
|
5675
|
+
const [, bump] = (0, import_react6.useState)(0);
|
|
5676
|
+
(0, import_react6.useEffect)(() => {
|
|
5670
5677
|
if (!active) return;
|
|
5671
5678
|
if (ctx && typeof ctx.interval === "function") return ctx.interval(bump, 1e3);
|
|
5672
5679
|
const t = setInterval(bump, 1e3);
|
|
@@ -5841,7 +5848,7 @@ var MATRIX_CHARS = "01</>;{}=+*#";
|
|
|
5841
5848
|
function AmbientLayer(props) {
|
|
5842
5849
|
const mode = props.mode;
|
|
5843
5850
|
const speed = props.speed;
|
|
5844
|
-
const particles = (0,
|
|
5851
|
+
const particles = (0, import_react6.useMemo)(() => {
|
|
5845
5852
|
if (mode === "matrix") return { matrix: makeBits(34, () => ({
|
|
5846
5853
|
l: Math.random() * 100,
|
|
5847
5854
|
d: 4 + Math.random() * 6,
|
|
@@ -6089,8 +6096,8 @@ function composerDockPoint(side = "right") {
|
|
|
6089
6096
|
};
|
|
6090
6097
|
}
|
|
6091
6098
|
function useSpaceDocks(enabled) {
|
|
6092
|
-
const [docks, setDocks] = (0,
|
|
6093
|
-
(0,
|
|
6099
|
+
const [docks, setDocks] = (0, import_react6.useState)(null);
|
|
6100
|
+
(0, import_react6.useEffect)(() => {
|
|
6094
6101
|
if (!enabled || typeof window === "undefined") {
|
|
6095
6102
|
setDocks(null);
|
|
6096
6103
|
return void 0;
|
|
@@ -6285,25 +6292,25 @@ function ProgrammingStuck(props) {
|
|
|
6285
6292
|
function AnimationOverlay(props) {
|
|
6286
6293
|
const ctx = props && props.ctx;
|
|
6287
6294
|
const snap = useAnimation();
|
|
6288
|
-
const [flourish, setFlourish] = (0,
|
|
6289
|
-
const [bursts, setBursts] = (0,
|
|
6290
|
-
const [deliveries, setDeliveries] = (0,
|
|
6291
|
-
const [departures, setDepartures] = (0,
|
|
6292
|
-
const prevActiveRef = (0,
|
|
6293
|
-
const burstIdRef = (0,
|
|
6294
|
-
const deliveryIdRef = (0,
|
|
6295
|
-
const departureTimersRef = (0,
|
|
6296
|
-
const lastImmediateDepartureRef = (0,
|
|
6297
|
-
(0,
|
|
6295
|
+
const [flourish, setFlourish] = (0, import_react6.useState)(null);
|
|
6296
|
+
const [bursts, setBursts] = (0, import_react6.useState)([]);
|
|
6297
|
+
const [deliveries, setDeliveries] = (0, import_react6.useState)([]);
|
|
6298
|
+
const [departures, setDepartures] = (0, import_react6.useState)([]);
|
|
6299
|
+
const prevActiveRef = (0, import_react6.useRef)(null);
|
|
6300
|
+
const burstIdRef = (0, import_react6.useRef)(0);
|
|
6301
|
+
const deliveryIdRef = (0, import_react6.useRef)(0);
|
|
6302
|
+
const departureTimersRef = (0, import_react6.useRef)(/* @__PURE__ */ new Map());
|
|
6303
|
+
const lastImmediateDepartureRef = (0, import_react6.useRef)(0);
|
|
6304
|
+
(0, import_react6.useEffect)(() => () => {
|
|
6298
6305
|
for (const timer of departureTimersRef.current.values()) clearTimeout(timer);
|
|
6299
6306
|
departureTimersRef.current.clear();
|
|
6300
6307
|
}, []);
|
|
6301
|
-
const pushBurst = (0,
|
|
6308
|
+
const pushBurst = (0, import_react6.useCallback)((type, x, y, bits) => {
|
|
6302
6309
|
const id = ++burstIdRef.current;
|
|
6303
6310
|
setBursts((prev) => prev.concat([{ id, type, x, y, bits }]).slice(-6));
|
|
6304
6311
|
setTimeout(() => setBursts((prev) => prev.filter((b) => b.id !== id)), 2600);
|
|
6305
6312
|
}, []);
|
|
6306
|
-
const launchMission = (0,
|
|
6313
|
+
const launchMission = (0, import_react6.useCallback)(() => {
|
|
6307
6314
|
const cfg2 = animationStore.snap.status && animationStore.snap.status.config;
|
|
6308
6315
|
if (!cfg2 || !cfg2.animationEnabled || cfg2.effectMode !== "space") return false;
|
|
6309
6316
|
const id = ++deliveryIdRef.current;
|
|
@@ -6326,7 +6333,7 @@ function AnimationOverlay(props) {
|
|
|
6326
6333
|
}, departure.duration));
|
|
6327
6334
|
return true;
|
|
6328
6335
|
}, []);
|
|
6329
|
-
(0,
|
|
6336
|
+
(0, import_react6.useEffect)(() => {
|
|
6330
6337
|
if (typeof document === "undefined") return;
|
|
6331
6338
|
const onClick = (e) => {
|
|
6332
6339
|
const t = e.target;
|
|
@@ -6353,8 +6360,8 @@ function AnimationOverlay(props) {
|
|
|
6353
6360
|
document.addEventListener("click", onClick, true);
|
|
6354
6361
|
return () => document.removeEventListener("click", onClick, true);
|
|
6355
6362
|
}, [pushBurst, launchMission]);
|
|
6356
|
-
const taskCountRef = (0,
|
|
6357
|
-
(0,
|
|
6363
|
+
const taskCountRef = (0, import_react6.useRef)(0);
|
|
6364
|
+
(0, import_react6.useEffect)(() => {
|
|
6358
6365
|
const st2 = snap.status;
|
|
6359
6366
|
if (!st2 || !st2.active) return;
|
|
6360
6367
|
const n = st2.active.length;
|
|
@@ -6365,7 +6372,7 @@ function AnimationOverlay(props) {
|
|
|
6365
6372
|
}
|
|
6366
6373
|
taskCountRef.current = n;
|
|
6367
6374
|
}, [snap.status, pushBurst, launchMission]);
|
|
6368
|
-
(0,
|
|
6375
|
+
(0, import_react6.useEffect)(() => {
|
|
6369
6376
|
let stopped = false;
|
|
6370
6377
|
let timer = null;
|
|
6371
6378
|
const loop = async () => {
|
|
@@ -6385,7 +6392,7 @@ function AnimationOverlay(props) {
|
|
|
6385
6392
|
document.removeEventListener("visibilitychange", onVisible);
|
|
6386
6393
|
};
|
|
6387
6394
|
}, []);
|
|
6388
|
-
(0,
|
|
6395
|
+
(0, import_react6.useEffect)(() => {
|
|
6389
6396
|
const st2 = snap.status;
|
|
6390
6397
|
if (!st2 || !st2.active) return;
|
|
6391
6398
|
const prev = prevActiveRef.current;
|
|
@@ -6433,8 +6440,8 @@ function AnimationOverlay(props) {
|
|
|
6433
6440
|
const phase = active.length > 0 ? active.reduce((best, x) => !best || (x.phaseAt || 0) > (best.phaseAt || 0) ? x : best, null).phase : "think";
|
|
6434
6441
|
const waitingTask = active.find((x) => taskWaiting(x)) || null;
|
|
6435
6442
|
const waitWord = waitingTask && taskApprovals(waitingTask).length === 0 ? "\u7B49\u5F85\u56DE\u7B54" : "\u7B49\u5F85\u786E\u8BA4";
|
|
6436
|
-
const sessionTitleRef = (0,
|
|
6437
|
-
const currentTitle = (0,
|
|
6443
|
+
const sessionTitleRef = (0, import_react6.useRef)({ at: 0, title: "" });
|
|
6444
|
+
const currentTitle = (0, import_react6.useMemo)(() => {
|
|
6438
6445
|
const c = sessionTitleRef.current;
|
|
6439
6446
|
if (typeof window === "undefined") return "";
|
|
6440
6447
|
if (Date.now() - c.at < 1e3) return c.title;
|
|
@@ -6442,19 +6449,19 @@ function AnimationOverlay(props) {
|
|
|
6442
6449
|
c.title = currentSessionTitle();
|
|
6443
6450
|
return c.title;
|
|
6444
6451
|
}, [snap.status]);
|
|
6445
|
-
const onScreenTasks = (0,
|
|
6452
|
+
const onScreenTasks = (0, import_react6.useMemo)(() => active.filter((x) => taskOnScreen(x, currentTitle)), [active, currentTitle]);
|
|
6446
6453
|
const waitingTaskOnScreen = onScreenTasks.find((x) => taskWaiting(x)) || null;
|
|
6447
6454
|
useTicker(ctx, animOn);
|
|
6448
6455
|
const now = Date.now();
|
|
6449
6456
|
const elapsed = active.length > 0 ? fmtClock(now - Math.min(...active.map((x) => x.startTime || now))) : "";
|
|
6450
|
-
const [panelOpen, setPanelOpen2] = (0,
|
|
6451
|
-
(0,
|
|
6457
|
+
const [panelOpen, setPanelOpen2] = (0, import_react6.useState)(false);
|
|
6458
|
+
(0, import_react6.useEffect)(() => {
|
|
6452
6459
|
setPanelOpen2(panelNav.open);
|
|
6453
6460
|
return subscribePanel(() => setPanelOpen2(panelNav.open));
|
|
6454
6461
|
}, []);
|
|
6455
|
-
const [speed, setSpeed] = (0,
|
|
6456
|
-
const speedRef = (0,
|
|
6457
|
-
(0,
|
|
6462
|
+
const [speed, setSpeed] = (0, import_react6.useState)(1);
|
|
6463
|
+
const speedRef = (0, import_react6.useRef)({ ticks: -1, at: 0 });
|
|
6464
|
+
(0, import_react6.useEffect)(() => {
|
|
6458
6465
|
if (!st || active.length === 0) {
|
|
6459
6466
|
speedRef.current = { ticks: -1, at: 0 };
|
|
6460
6467
|
setSpeed(1);
|
|
@@ -6480,17 +6487,17 @@ function AnimationOverlay(props) {
|
|
|
6480
6487
|
const stuckTask = onScreenTasks.find((task) => task.phase === "code" && taskStalled(task, now, 18e3)) || null;
|
|
6481
6488
|
const robotScaleFromConfig = Math.max(0.85, Math.min(2.2, Number(cfg && cfg.robotScale) || 1.35));
|
|
6482
6489
|
const speedStyle = { "--dkan-speed": Number(speed).toFixed(2) };
|
|
6483
|
-
const saveRobotScale = (0,
|
|
6490
|
+
const saveRobotScale = (0, import_react6.useCallback)((robotScale) => {
|
|
6484
6491
|
rpcCall2("config", { robotScale }).then((d) => animationStore.applyConfig(d && d.config)).catch(() => {
|
|
6485
6492
|
});
|
|
6486
6493
|
}, []);
|
|
6487
|
-
const [botPos, setBotPos] = (0,
|
|
6488
|
-
const botPosRef = (0,
|
|
6489
|
-
const botDragRef = (0,
|
|
6490
|
-
const botResizeRef = (0,
|
|
6491
|
-
const [botScaleDraft, setBotScaleDraft] = (0,
|
|
6492
|
-
const botClickBlockRef = (0,
|
|
6493
|
-
(0,
|
|
6494
|
+
const [botPos, setBotPos] = (0, import_react6.useState)(null);
|
|
6495
|
+
const botPosRef = (0, import_react6.useRef)(null);
|
|
6496
|
+
const botDragRef = (0, import_react6.useRef)(null);
|
|
6497
|
+
const botResizeRef = (0, import_react6.useRef)(null);
|
|
6498
|
+
const [botScaleDraft, setBotScaleDraft] = (0, import_react6.useState)(null);
|
|
6499
|
+
const botClickBlockRef = (0, import_react6.useRef)(false);
|
|
6500
|
+
(0, import_react6.useEffect)(() => {
|
|
6494
6501
|
try {
|
|
6495
6502
|
if (typeof localStorage === "undefined") return;
|
|
6496
6503
|
const raw = localStorage.getItem("dsh-dock/anim/robot-pos/v1");
|
|
@@ -6542,11 +6549,11 @@ function AnimationOverlay(props) {
|
|
|
6542
6549
|
}, 0);
|
|
6543
6550
|
}
|
|
6544
6551
|
};
|
|
6545
|
-
const [badgePos, setBadgePos] = (0,
|
|
6546
|
-
const badgePosRef = (0,
|
|
6547
|
-
const badgeDragRef = (0,
|
|
6548
|
-
const badgeClickBlockRef = (0,
|
|
6549
|
-
(0,
|
|
6552
|
+
const [badgePos, setBadgePos] = (0, import_react6.useState)(null);
|
|
6553
|
+
const badgePosRef = (0, import_react6.useRef)(null);
|
|
6554
|
+
const badgeDragRef = (0, import_react6.useRef)(null);
|
|
6555
|
+
const badgeClickBlockRef = (0, import_react6.useRef)(false);
|
|
6556
|
+
(0, import_react6.useEffect)(() => {
|
|
6550
6557
|
try {
|
|
6551
6558
|
if (typeof localStorage === "undefined") return;
|
|
6552
6559
|
const raw = localStorage.getItem("dsh-dock/anim/badge-pos/v1");
|
|
@@ -6606,7 +6613,7 @@ function AnimationOverlay(props) {
|
|
|
6606
6613
|
badgePosRef.current = null;
|
|
6607
6614
|
setBadgePos(null);
|
|
6608
6615
|
};
|
|
6609
|
-
const badgeClickTimer = (0,
|
|
6616
|
+
const badgeClickTimer = (0, import_react6.useRef)(null);
|
|
6610
6617
|
const onBadgeClick = () => {
|
|
6611
6618
|
if (badgeClickBlockRef.current) return;
|
|
6612
6619
|
if (badgeClickTimer.current) {
|
|
@@ -6824,11 +6831,11 @@ function ModePreview({ id }) {
|
|
|
6824
6831
|
function AnimationView(props) {
|
|
6825
6832
|
const ctx = props && props.ctx;
|
|
6826
6833
|
const snap = useAnimation(ctx);
|
|
6827
|
-
const [cfg, setCfg] = (0,
|
|
6828
|
-
const [saveErr, setSaveErr] = (0,
|
|
6829
|
-
const cfgRef = (0,
|
|
6830
|
-
const pendingSavesRef = (0,
|
|
6831
|
-
(0,
|
|
6834
|
+
const [cfg, setCfg] = (0, import_react6.useState)(null);
|
|
6835
|
+
const [saveErr, setSaveErr] = (0, import_react6.useState)("");
|
|
6836
|
+
const cfgRef = (0, import_react6.useRef)(null);
|
|
6837
|
+
const pendingSavesRef = (0, import_react6.useRef)(0);
|
|
6838
|
+
(0, import_react6.useEffect)(() => {
|
|
6832
6839
|
const c = snap.status && snap.status.config;
|
|
6833
6840
|
if (!c) return;
|
|
6834
6841
|
if (pendingSavesRef.current > 0) return;
|
|
@@ -6837,7 +6844,7 @@ function AnimationView(props) {
|
|
|
6837
6844
|
setCfg(Object.assign({}, c));
|
|
6838
6845
|
}
|
|
6839
6846
|
}, [snap.status]);
|
|
6840
|
-
(0,
|
|
6847
|
+
(0, import_react6.useEffect)(() => {
|
|
6841
6848
|
if (!animationStore.snap.status) animationStore.refresh();
|
|
6842
6849
|
}, []);
|
|
6843
6850
|
const patch = (p) => {
|
|
@@ -7312,7 +7319,7 @@ var css2 = [
|
|
|
7312
7319
|
// 减少动态时停止空间位移,保留屏幕亮暗与思考状态的淡入反馈。
|
|
7313
7320
|
"@media (prefers-reduced-motion:reduce){.dkan-amb *,.dkan-prev *,.dkan-space-system,.dkan-space-dust,.dkan-space-runner,.dkan-delivery,.dkan-departure,.dkan-freighter-engine i,.dkan-stuck-code::after,.dkan-stuck-code i{animation:none!important}.dkan-space-runner,.dkan-departure{display:none}.dkan-delivery{opacity:1;transform:translate3d(var(--dkan-to-x),var(--dkan-to-y),0)}.dkan-delivery-trail{display:none}.dk3-person,.dk3-upper3,.dk3-head3,.dk3-arm3,.dk3-elbow,.dk3-wrist3,.dk3-wheel,.dk3-code,.dk3-search-results{animation:none!important;transition:none!important}.dk3-screen,.dkan-bubble{transition:opacity .2s cubic-bezier(.23,1,.32,1)!important}}"
|
|
7314
7321
|
].join("\n");
|
|
7315
|
-
var
|
|
7322
|
+
var feature5 = {
|
|
7316
7323
|
id: "animation",
|
|
7317
7324
|
name: "\u4EFB\u52A1\u52A8\u753B",
|
|
7318
7325
|
order: 130,
|
|
@@ -7325,7 +7332,7 @@ var feature7 = {
|
|
|
7325
7332
|
};
|
|
7326
7333
|
|
|
7327
7334
|
// features/notify/view.jsx
|
|
7328
|
-
var
|
|
7335
|
+
var import_react7 = require("react");
|
|
7329
7336
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
7330
7337
|
function rpcCall3(method, args) {
|
|
7331
7338
|
return fetch("dsh-dock/notify/" + method, {
|
|
@@ -7470,8 +7477,8 @@ function voiceAllowed(cfg) {
|
|
|
7470
7477
|
return !!cfg && cfg.voiceNotify === true && voiceClientEnabled();
|
|
7471
7478
|
}
|
|
7472
7479
|
function useVoiceClientEnabled() {
|
|
7473
|
-
const [on, setOn] = (0,
|
|
7474
|
-
(0,
|
|
7480
|
+
const [on, setOn] = (0, import_react7.useState)(() => voiceClientEnabled());
|
|
7481
|
+
(0, import_react7.useEffect)(() => {
|
|
7475
7482
|
const sync = () => setOn(voiceClientEnabled());
|
|
7476
7483
|
if (typeof window === "undefined" || typeof window.addEventListener !== "function") return void 0;
|
|
7477
7484
|
window.addEventListener("storage", sync);
|
|
@@ -7479,7 +7486,7 @@ function useVoiceClientEnabled() {
|
|
|
7479
7486
|
if (typeof window.removeEventListener === "function") window.removeEventListener("storage", sync);
|
|
7480
7487
|
};
|
|
7481
7488
|
}, []);
|
|
7482
|
-
const set = (0,
|
|
7489
|
+
const set = (0, import_react7.useCallback)((next) => {
|
|
7483
7490
|
const v = next !== false;
|
|
7484
7491
|
setVoiceClientEnabled(v);
|
|
7485
7492
|
setOn(v);
|
|
@@ -7587,8 +7594,8 @@ function effectiveNotifyConfig(serverCfg) {
|
|
|
7587
7594
|
return mergeClientNotifyConfig(server, local);
|
|
7588
7595
|
}
|
|
7589
7596
|
function useNotifyConfigSource() {
|
|
7590
|
-
const [source, setSource] = (0,
|
|
7591
|
-
const set = (0,
|
|
7597
|
+
const [source, setSource] = (0, import_react7.useState)(() => notifyConfigSource());
|
|
7598
|
+
const set = (0, import_react7.useCallback)((next) => {
|
|
7592
7599
|
const value = next === "client" ? "client" : "server";
|
|
7593
7600
|
setNotifyConfigSource(value);
|
|
7594
7601
|
setSource(value);
|
|
@@ -7648,10 +7655,10 @@ function pickVoice(cfg, text) {
|
|
|
7648
7655
|
return null;
|
|
7649
7656
|
}
|
|
7650
7657
|
function useLocalVoices() {
|
|
7651
|
-
const [, force] = (0,
|
|
7652
|
-
const ref = (0,
|
|
7658
|
+
const [, force] = (0, import_react7.useState)(0);
|
|
7659
|
+
const ref = (0, import_react7.useRef)(null);
|
|
7653
7660
|
if (ref.current === null) ref.current = localVoices();
|
|
7654
|
-
(0,
|
|
7661
|
+
(0, import_react7.useEffect)(() => {
|
|
7655
7662
|
const s = synthOf();
|
|
7656
7663
|
const onChange = () => {
|
|
7657
7664
|
ref.current = localVoices();
|
|
@@ -7751,11 +7758,14 @@ function endBroadcastText(success, record, task, cfg) {
|
|
|
7751
7758
|
const mode = voiceTone(cfg);
|
|
7752
7759
|
const reason = record && record.endReason || "";
|
|
7753
7760
|
const title = record && record.title || task && task.title || "";
|
|
7761
|
+
const sub = !!(record && record.isSubtask || task && task.isSubtask);
|
|
7762
|
+
const parentTitle = record && record.parentTitle || task && task.parentTitle || "";
|
|
7754
7763
|
if (mode === "brief") {
|
|
7764
|
+
if (sub) return success ? "\u5B50\u4EFB\u52A1\u5B8C\u6210" : "\u5B50\u4EFB\u52A1\u505C\u6B62\u4E86";
|
|
7755
7765
|
return success ? "\u4EFB\u52A1\u5B8C\u6210" : "\u4EFB\u52A1\u505C\u6B62\u4E86";
|
|
7756
7766
|
}
|
|
7757
7767
|
if (mode === "medium") {
|
|
7758
|
-
const who = title ? "\u4EFB\u52A1\u300C" + truncate2(title, 30) + "\u300D" : "\u4EFB\u52A1";
|
|
7768
|
+
const who = sub ? (parentTitle ? "\u4E3B\u4EFB\u52A1\u300C" + truncate2(parentTitle, 20) + "\u300D\u7684" : "") + (title ? "\u5B50\u4EFB\u52A1\u300C" + truncate2(title, 30) + "\u300D" : "\u5B50\u4EFB\u52A1") : title ? "\u4EFB\u52A1\u300C" + truncate2(title, 30) + "\u300D" : "\u4EFB\u52A1";
|
|
7759
7769
|
const parts2 = [success ? who + "\u5B8C\u6210\u4E86" : who + "\u505C\u6B62\u4E86"];
|
|
7760
7770
|
if (!success) parts2.push("\uFF0C\u539F\u56E0\uFF1A" + endReasonSpeech(reason));
|
|
7761
7771
|
const dur2 = record && record.duration || 0;
|
|
@@ -7764,7 +7774,8 @@ function endBroadcastText(success, record, task, cfg) {
|
|
|
7764
7774
|
return parts2.join("");
|
|
7765
7775
|
}
|
|
7766
7776
|
const parts = [];
|
|
7767
|
-
if (
|
|
7777
|
+
if (sub && parentTitle) parts.push("\u4E3B\u4EFB\u52A1\uFF1A" + truncate2(parentTitle, 30) + "\u3002");
|
|
7778
|
+
if (title) parts.push((sub ? "\u5B50\u4EFB\u52A1\uFF1A" : "\u4EFB\u52A1\uFF1A") + truncate2(title, 30) + "\u3002");
|
|
7768
7779
|
parts.push(success ? "\u5DF2\u5B8C\u6210\u3002" : "\u7ED3\u675F\uFF0C\u539F\u56E0\uFF1A" + endReasonSpeech(reason) + "\u3002");
|
|
7769
7780
|
const dur = record && record.duration || 0;
|
|
7770
7781
|
if (dur > 0) parts.push("\u8017\u65F6" + fmtDur(dur) + "\u3002");
|
|
@@ -7870,8 +7881,8 @@ var notifyStore = {
|
|
|
7870
7881
|
}
|
|
7871
7882
|
};
|
|
7872
7883
|
function useNotify() {
|
|
7873
|
-
const [snap, setSnap] = (0,
|
|
7874
|
-
(0,
|
|
7884
|
+
const [snap, setSnap] = (0, import_react7.useState)(notifyStore.snap);
|
|
7885
|
+
(0, import_react7.useEffect)(() => notifyStore.subscribe(() => setSnap(notifyStore.snap)), []);
|
|
7875
7886
|
return snap;
|
|
7876
7887
|
}
|
|
7877
7888
|
function pageVisible() {
|
|
@@ -7940,19 +7951,19 @@ function openSessionByTitle(title) {
|
|
|
7940
7951
|
}
|
|
7941
7952
|
function Toast(props) {
|
|
7942
7953
|
const t = props.t;
|
|
7943
|
-
const [closing, setClosing] = (0,
|
|
7944
|
-
const close = (0,
|
|
7954
|
+
const [closing, setClosing] = (0, import_react7.useState)(!!t.closing);
|
|
7955
|
+
const close = (0, import_react7.useCallback)(() => {
|
|
7945
7956
|
setClosing(true);
|
|
7946
7957
|
}, []);
|
|
7947
|
-
const jump = (0,
|
|
7958
|
+
const jump = (0, import_react7.useCallback)(() => {
|
|
7948
7959
|
if (!t.sessionTitle && !t.sessionId) return;
|
|
7949
7960
|
const ok = openSessionById(t.sessionId) || (t.fallbackSessionId ? openSessionById(t.fallbackSessionId) : false) || (t.sessionTitle ? openSessionByTitle(t.sessionTitle) : false);
|
|
7950
7961
|
if (ok && t.kind !== "confirm" && t.kind !== "stuck") setClosing(true);
|
|
7951
7962
|
}, [t.sessionId, t.sessionTitle, t.fallbackSessionId, t.kind]);
|
|
7952
|
-
(0,
|
|
7963
|
+
(0, import_react7.useEffect)(() => {
|
|
7953
7964
|
if (t.closing && !closing) setClosing(true);
|
|
7954
7965
|
}, [t.closing, closing]);
|
|
7955
|
-
(0,
|
|
7966
|
+
(0, import_react7.useEffect)(() => {
|
|
7956
7967
|
if (!closing) return;
|
|
7957
7968
|
const timer = setTimeout(() => props.onClose(t.id), 240);
|
|
7958
7969
|
return () => clearTimeout(timer);
|
|
@@ -7993,23 +8004,23 @@ function Toast(props) {
|
|
|
7993
8004
|
function NotifyOverlay(props) {
|
|
7994
8005
|
if (props && props.ctx) overlayCtx = props.ctx;
|
|
7995
8006
|
const snap = useNotify();
|
|
7996
|
-
const [toasts, setToasts] = (0,
|
|
7997
|
-
const [stackHover, setStackHover] = (0,
|
|
7998
|
-
const prevActiveRef = (0,
|
|
7999
|
-
const remindedApprovalsRef = (0,
|
|
8000
|
-
const remindedQuestionsRef = (0,
|
|
8001
|
-
const toastSeqRef = (0,
|
|
8002
|
-
const pushToast = (0,
|
|
8007
|
+
const [toasts, setToasts] = (0, import_react7.useState)([]);
|
|
8008
|
+
const [stackHover, setStackHover] = (0, import_react7.useState)(false);
|
|
8009
|
+
const prevActiveRef = (0, import_react7.useRef)(null);
|
|
8010
|
+
const remindedApprovalsRef = (0, import_react7.useRef)(/* @__PURE__ */ new Map());
|
|
8011
|
+
const remindedQuestionsRef = (0, import_react7.useRef)(/* @__PURE__ */ new Map());
|
|
8012
|
+
const toastSeqRef = (0, import_react7.useRef)(0);
|
|
8013
|
+
const pushToast = (0, import_react7.useCallback)((toast) => {
|
|
8003
8014
|
const st = notifyStore.snap.status;
|
|
8004
8015
|
const cfg = st ? effectiveNotifyConfig(st.config) : null;
|
|
8005
8016
|
if (cfg && cfg.notifyCards === false) return;
|
|
8006
8017
|
setToasts((prev) => prev.concat([toast]).slice(-12));
|
|
8007
8018
|
}, []);
|
|
8008
|
-
(0,
|
|
8019
|
+
(0, import_react7.useEffect)(() => {
|
|
8009
8020
|
const cfg = snap.status ? effectiveNotifyConfig(snap.status.config) : null;
|
|
8010
8021
|
if (cfg && cfg.notifyCards === false) setToasts((prev) => prev.length ? [] : prev);
|
|
8011
8022
|
}, [snap.status]);
|
|
8012
|
-
(0,
|
|
8023
|
+
(0, import_react7.useEffect)(() => {
|
|
8013
8024
|
let stopped = false;
|
|
8014
8025
|
let timer = null;
|
|
8015
8026
|
const loop = async () => {
|
|
@@ -8029,7 +8040,7 @@ function NotifyOverlay(props) {
|
|
|
8029
8040
|
document.removeEventListener("visibilitychange", onVisible);
|
|
8030
8041
|
};
|
|
8031
8042
|
}, []);
|
|
8032
|
-
(0,
|
|
8043
|
+
(0, import_react7.useEffect)(() => {
|
|
8033
8044
|
const st = snap.status;
|
|
8034
8045
|
if (!st || !st.active) return;
|
|
8035
8046
|
const prev = prevActiveRef.current;
|
|
@@ -8043,7 +8054,7 @@ function NotifyOverlay(props) {
|
|
|
8043
8054
|
}
|
|
8044
8055
|
prevActiveRef.current = st.active.slice();
|
|
8045
8056
|
}, [snap.status]);
|
|
8046
|
-
(0,
|
|
8057
|
+
(0, import_react7.useEffect)(() => {
|
|
8047
8058
|
const st = snap.status;
|
|
8048
8059
|
if (!st || !st.active) return;
|
|
8049
8060
|
const cfg = effectiveNotifyConfig(st.config || {});
|
|
@@ -8103,7 +8114,7 @@ function NotifyOverlay(props) {
|
|
|
8103
8114
|
}
|
|
8104
8115
|
}
|
|
8105
8116
|
}, [snap.status]);
|
|
8106
|
-
(0,
|
|
8117
|
+
(0, import_react7.useEffect)(() => {
|
|
8107
8118
|
const st = snap.status;
|
|
8108
8119
|
if (!st || !st.active) return;
|
|
8109
8120
|
const cfg = effectiveNotifyConfig(st.config || {});
|
|
@@ -8158,7 +8169,7 @@ function NotifyOverlay(props) {
|
|
|
8158
8169
|
}
|
|
8159
8170
|
}
|
|
8160
8171
|
}, [snap.status]);
|
|
8161
|
-
(0,
|
|
8172
|
+
(0, import_react7.useEffect)(() => {
|
|
8162
8173
|
const st = snap.status;
|
|
8163
8174
|
if (!st || !st.active) return;
|
|
8164
8175
|
const live = /* @__PURE__ */ new Set();
|
|
@@ -8178,7 +8189,7 @@ function NotifyOverlay(props) {
|
|
|
8178
8189
|
return changed ? next : prev;
|
|
8179
8190
|
});
|
|
8180
8191
|
}, [snap.status]);
|
|
8181
|
-
(0,
|
|
8192
|
+
(0, import_react7.useEffect)(() => {
|
|
8182
8193
|
const timer = setInterval(() => {
|
|
8183
8194
|
if (!pageVisible()) return;
|
|
8184
8195
|
const cur = currentSelectedSession();
|
|
@@ -8198,8 +8209,8 @@ function NotifyOverlay(props) {
|
|
|
8198
8209
|
}, 500);
|
|
8199
8210
|
return () => clearInterval(timer);
|
|
8200
8211
|
}, []);
|
|
8201
|
-
const stuckSeenRef = (0,
|
|
8202
|
-
(0,
|
|
8212
|
+
const stuckSeenRef = (0, import_react7.useRef)(/* @__PURE__ */ new Map());
|
|
8213
|
+
(0, import_react7.useEffect)(() => {
|
|
8203
8214
|
const st = snap.status;
|
|
8204
8215
|
if (!st || !st.active) return;
|
|
8205
8216
|
const cfg = effectiveNotifyConfig(st.config || {});
|
|
@@ -8255,7 +8266,7 @@ function NotifyOverlay(props) {
|
|
|
8255
8266
|
});
|
|
8256
8267
|
}
|
|
8257
8268
|
}, [snap.status]);
|
|
8258
|
-
(0,
|
|
8269
|
+
(0, import_react7.useEffect)(() => {
|
|
8259
8270
|
const st = snap.status;
|
|
8260
8271
|
if (!st || !st.active) return;
|
|
8261
8272
|
const byId = new Map(st.active.map((x) => [x.sessionId, x]));
|
|
@@ -8277,22 +8288,31 @@ function NotifyOverlay(props) {
|
|
|
8277
8288
|
const success = isSuccessReason2(reason);
|
|
8278
8289
|
const info = endInfo(reason);
|
|
8279
8290
|
const event = success ? "complete" : "error";
|
|
8291
|
+
const sub = !!(record && record.isSubtask || task.isSubtask);
|
|
8292
|
+
const parentId = record && record.parentSessionId || task.parentSessionId || "";
|
|
8293
|
+
let parentTitle = record && record.parentTitle || task.parentTitle || "";
|
|
8294
|
+
if (sub && !parentTitle && parentId) {
|
|
8295
|
+
const p = (snap.status && snap.status.active || []).find((x) => x.sessionId === parentId);
|
|
8296
|
+
if (p && p.title) parentTitle = p.title;
|
|
8297
|
+
}
|
|
8298
|
+
const endRecord = Object.assign({}, record || {}, { isSubtask: sub, parentTitle });
|
|
8280
8299
|
const cardWanted = eventEnabled(cfg, "card", event);
|
|
8281
8300
|
const soundWanted = cfg.soundNotify !== false && eventEnabled(cfg, "sound", event);
|
|
8282
8301
|
const systemWanted = !!cfg.systemNotify && eventEnabled(cfg, "system", event);
|
|
8283
8302
|
if (voiceAllowed(cfg) && eventEnabled(cfg, "voice", event)) {
|
|
8284
|
-
speakVoice(endBroadcastText(success,
|
|
8303
|
+
speakVoice(endBroadcastText(success, endRecord, task, cfg), cfg);
|
|
8285
8304
|
}
|
|
8286
8305
|
const models = record && record.models && record.models.length ? record.models.join(", ") : task.models && task.models.length ? task.models.join(", ") : "\u672A\u77E5\u6A21\u578B";
|
|
8287
8306
|
const provider = record && record.provider || task.provider || "";
|
|
8288
8307
|
const startTs = record && record.startTime || task.startTime;
|
|
8289
8308
|
const endTs = record && record.endTime || Date.now();
|
|
8290
8309
|
const durText = fmtDur(record && record.duration || endTs - startTs);
|
|
8291
|
-
const title = success ? "\u4EFB\u52A1\u5B8C\u6210" : "\u4EFB\u52A1" + info.label;
|
|
8310
|
+
const title = success ? sub ? "\u5B50\u4EFB\u52A1\u5B8C\u6210" : "\u4EFB\u52A1\u5B8C\u6210" : (sub ? "\u5B50\u4EFB\u52A1" : "\u4EFB\u52A1") + info.label;
|
|
8292
8311
|
const showTitle = record && record.title || task.title || "(\u65E0\u6807\u9898)";
|
|
8293
8312
|
if (cardWanted) {
|
|
8294
8313
|
const tone = cardTone(cfg);
|
|
8295
|
-
const lines = ["\u4EFB\u52A1\uFF1A" + showTitle];
|
|
8314
|
+
const lines = [(sub ? "\u5B50\u4EFB\u52A1\uFF1A" : "\u4EFB\u52A1\uFF1A") + showTitle];
|
|
8315
|
+
if (sub) lines.push("\u4E3B\u4EFB\u52A1\uFF1A" + (parentTitle || "\uFF08\u672A\u77E5\uFF09"));
|
|
8296
8316
|
if (tone !== "brief") lines.push("\u6A21\u578B\uFF1A" + models + (provider ? "\uFF08" + provider + "\uFF09" : ""));
|
|
8297
8317
|
lines.push(tone === "brief" ? "\u8017\u65F6\uFF1A" + durText : "\u8017\u65F6\uFF1A" + durText + "\uFF08" + fmtTime2(startTs) + " \u2192 " + fmtTime2(endTs) + "\uFF09");
|
|
8298
8318
|
if (tone === "detailed") {
|
|
@@ -8310,14 +8330,16 @@ function NotifyOverlay(props) {
|
|
|
8310
8330
|
// 看到了结果,巡检 effect 据此自动收起卡片。没看过就一直挂着。
|
|
8311
8331
|
// sessionId 是权威标识(跳转/对账都用它),标题只作旧宿主回退。
|
|
8312
8332
|
sessionId: task.sessionId || "",
|
|
8313
|
-
sessionTitle: showTitle
|
|
8333
|
+
sessionTitle: showTitle,
|
|
8334
|
+
// 子任务会话通常不在侧栏里:跳不到自己时回退到父会话(与卡住卡同款)
|
|
8335
|
+
fallbackSessionId: sub && parentId ? parentId : ""
|
|
8314
8336
|
});
|
|
8315
8337
|
}
|
|
8316
8338
|
if (soundWanted) playDoneSound(success, cfg.soundEffect);
|
|
8317
8339
|
if (systemWanted && typeof document !== "undefined" && document.hidden && typeof Notification !== "undefined" && Notification.permission === "granted") {
|
|
8318
8340
|
try {
|
|
8319
8341
|
new Notification("dsh " + title, {
|
|
8320
|
-
body: showTitle + " \xB7 " + durText,
|
|
8342
|
+
body: (sub ? (parentTitle ? "\u4E3B\u4EFB\u52A1\u300C" + truncate2(parentTitle, 20) + "\u300D\u7684" : "") + "\u5B50\u4EFB\u52A1\u300C" + showTitle + "\u300D" : showTitle) + " \xB7 " + durText,
|
|
8321
8343
|
tag: "dsh-dock-notify-" + task.sessionId
|
|
8322
8344
|
});
|
|
8323
8345
|
} catch {
|
|
@@ -8451,20 +8473,20 @@ function NotifyView(props) {
|
|
|
8451
8473
|
const voices = useLocalVoices();
|
|
8452
8474
|
const [voiceClientOn, setVoiceClientOn] = useVoiceClientEnabled();
|
|
8453
8475
|
const [source, setSource] = useNotifyConfigSource();
|
|
8454
|
-
const [tab, setTab] = (0,
|
|
8455
|
-
const [clientCfg, setClientCfg] = (0,
|
|
8456
|
-
const [serverDraft, setServerDraft] = (0,
|
|
8457
|
-
const [saveErr, setSaveErr] = (0,
|
|
8458
|
-
const [testing, setTesting] = (0,
|
|
8459
|
-
const [testState, setTestState] = (0,
|
|
8460
|
-
const [feishuTesting, setFeishuTesting] = (0,
|
|
8461
|
-
const [feishuTestState, setFeishuTestState] = (0,
|
|
8462
|
-
const cfgRef = (0,
|
|
8463
|
-
const pendingSavesRef = (0,
|
|
8464
|
-
const editingWebhookRef = (0,
|
|
8465
|
-
const editingFeishuRef = (0,
|
|
8476
|
+
const [tab, setTab] = (0, import_react7.useState)("events");
|
|
8477
|
+
const [clientCfg, setClientCfg] = (0, import_react7.useState)(() => readClientNotifyConfig());
|
|
8478
|
+
const [serverDraft, setServerDraft] = (0, import_react7.useState)(null);
|
|
8479
|
+
const [saveErr, setSaveErr] = (0, import_react7.useState)("");
|
|
8480
|
+
const [testing, setTesting] = (0, import_react7.useState)(false);
|
|
8481
|
+
const [testState, setTestState] = (0, import_react7.useState)(null);
|
|
8482
|
+
const [feishuTesting, setFeishuTesting] = (0, import_react7.useState)(false);
|
|
8483
|
+
const [feishuTestState, setFeishuTestState] = (0, import_react7.useState)(null);
|
|
8484
|
+
const cfgRef = (0, import_react7.useRef)(null);
|
|
8485
|
+
const pendingSavesRef = (0, import_react7.useRef)(0);
|
|
8486
|
+
const editingWebhookRef = (0, import_react7.useRef)(false);
|
|
8487
|
+
const editingFeishuRef = (0, import_react7.useRef)(false);
|
|
8466
8488
|
const serverCfg = snap.status && snap.status.config;
|
|
8467
|
-
(0,
|
|
8489
|
+
(0, import_react7.useEffect)(() => {
|
|
8468
8490
|
if (!serverCfg) return;
|
|
8469
8491
|
if (pendingSavesRef.current > 0 || editingWebhookRef.current || editingFeishuRef.current) return;
|
|
8470
8492
|
if (serverCfg !== cfgRef.current) {
|
|
@@ -8472,13 +8494,13 @@ function NotifyView(props) {
|
|
|
8472
8494
|
setServerDraft(Object.assign({}, serverCfg));
|
|
8473
8495
|
}
|
|
8474
8496
|
}, [snap.status]);
|
|
8475
|
-
(0,
|
|
8497
|
+
(0, import_react7.useEffect)(() => {
|
|
8476
8498
|
if (source !== "client" || clientCfg || !serverCfg) return;
|
|
8477
8499
|
const clone = pickClientConfig(serverCfg);
|
|
8478
8500
|
writeClientNotifyConfig(clone);
|
|
8479
8501
|
setClientCfg(clone);
|
|
8480
8502
|
}, [source, clientCfg, serverCfg]);
|
|
8481
|
-
(0,
|
|
8503
|
+
(0, import_react7.useEffect)(() => {
|
|
8482
8504
|
if (!notifyStore.snap.status) notifyStore.refresh();
|
|
8483
8505
|
}, []);
|
|
8484
8506
|
const cfg = source === "client" ? clientCfg ? mergeClientNotifyConfig(serverCfg, clientCfg) : null : serverDraft || serverCfg;
|
|
@@ -8685,7 +8707,7 @@ function NotifyView(props) {
|
|
|
8685
8707
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row", children: [
|
|
8686
8708
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "\u6B63\u6587\u53E3\u5F84" }),
|
|
8687
8709
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ModePicker, { value: cardTone(cfg), title: "\u9875\u5185\u5361\u7247\u6B63\u6587", onChange: (v) => patch({ cardMode: v }) }),
|
|
8688
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1D\u4EFB\u52A1\u4E0E\u8017\u65F6 / \u8C01\u5361\u4F4F\uFF1B\u9002\u4E2D\uFF1D\u52A0\u6A21\u578B\u3001\u8D77\u6B62\u65F6\u95F4\u3001\u505C\u6EDE\u65F6\u957F\uFF1B\u8BE6\u7EC6\uFF1D\u5168\u90E8\uFF08\u56DE\u5408\u6B65\u9AA4\u3001Token\u3001\u6458\u8981\u6216\u9519\u8BEF\u3001\u6700\u540E\u52A8\u4F5C\uFF09" })
|
|
8710
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1D\u4EFB\u52A1\u4E0E\u8017\u65F6 / \u8C01\u5361\u4F4F\uFF1B\u9002\u4E2D\uFF1D\u52A0\u6A21\u578B\u3001\u8D77\u6B62\u65F6\u95F4\u3001\u505C\u6EDE\u65F6\u957F\uFF1B\u8BE6\u7EC6\uFF1D\u5168\u90E8\uFF08\u56DE\u5408\u6B65\u9AA4\u3001Token\u3001\u6458\u8981\u6216\u9519\u8BEF\u3001\u6700\u540E\u52A8\u4F5C\uFF09\u3002\u5B50\u4EFB\u52A1\u7ED3\u675F\u6807\u300C\u5B50\u4EFB\u52A1\u300D\u5E76\u70B9\u540D\u4E3B\u4EFB\u52A1\uFF08\u4E09\u6321\u90FD\u5E26\u5F52\u5C5E\uFF09" })
|
|
8689
8711
|
] }),
|
|
8690
8712
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row", children: [
|
|
8691
8713
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "\u5361\u7247\u6536\u7EB3" }),
|
|
@@ -8834,7 +8856,7 @@ function NotifyView(props) {
|
|
|
8834
8856
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row", children: [
|
|
8835
8857
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "\u64AD\u62A5\u53E3\u5F84" }),
|
|
8836
8858
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ModePicker, { value: voiceTone(cfg), title: "\u8BED\u97F3\u64AD\u62A5", onChange: (v) => patch({ voiceMode: v }) }),
|
|
8837
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1A\u4E00\u53E5\u300C\u4EFB\u52A1\u5B8C\u6210 / \u4EFB\u52A1\u505C\u6B62\u4E86 / \u4EFB\u52A1\u9700\u8981\u6388\u6743 / \u4E3B\u4EFB\u52A1\uFF08\u6216\u5B50\u4EFB\u52A1\uFF09\xB7\u6807\u9898 \u5361\u4F4F\u4E86\u300D\uFF1B\u9002\u4E2D\uFF1A\u70B9\u540D\u4EFB\u52A1\uFF0C\u7ED3\u675F\u5E26\u539F\u56E0\u4E0E\u8017\u65F6\u3001\u5361\u4F4F\u5E26\u505C\u6EDE\u65F6\u957F\uFF1B\u8BE6\u7EC6\uFF1A\u7ED3\u675F\u5E26\u56DE\u5408\u7EDF\u8BA1\u4E0E\u56DE\u590D\u6458\u8981\uFF0C\u9700\u6388\u6743\u5E26\u5DE5\u5177\u540D\uFF0C\u5361\u4F4F\u5E26\u6700\u540E\u52A8\u4F5C\u3002" })
|
|
8859
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1A\u4E00\u53E5\u300C\u4EFB\u52A1\u5B8C\u6210 / \u5B50\u4EFB\u52A1\u5B8C\u6210 / \u4EFB\u52A1\u505C\u6B62\u4E86 / \u4EFB\u52A1\u9700\u8981\u6388\u6743 / \u4E3B\u4EFB\u52A1\uFF08\u6216\u5B50\u4EFB\u52A1\uFF09\xB7\u6807\u9898 \u5361\u4F4F\u4E86\u300D\uFF1B\u9002\u4E2D\uFF1A\u70B9\u540D\u4EFB\u52A1\uFF08\u5B50\u4EFB\u52A1\u8FDE\u4E3B\u4EFB\u52A1\u4E00\u8D77\u70B9\u540D\uFF09\uFF0C\u7ED3\u675F\u5E26\u539F\u56E0\u4E0E\u8017\u65F6\u3001\u5361\u4F4F\u5E26\u505C\u6EDE\u65F6\u957F\uFF1B\u8BE6\u7EC6\uFF1A\u7ED3\u675F\u5E26\u56DE\u5408\u7EDF\u8BA1\u4E0E\u56DE\u590D\u6458\u8981\uFF0C\u9700\u6388\u6743\u5E26\u5DE5\u5177\u540D\uFF0C\u5361\u4F4F\u5E26\u6700\u540E\u52A8\u4F5C\u3002" })
|
|
8838
8860
|
] }),
|
|
8839
8861
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row", children: [
|
|
8840
8862
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "\u64AD\u62A5\u4E8B\u4EF6" }),
|
|
@@ -8994,7 +9016,7 @@ function NotifyView(props) {
|
|
|
8994
9016
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row", children: [
|
|
8995
9017
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "\u6D88\u606F\u53E3\u5F84" }),
|
|
8996
9018
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ModePicker, { value: cfg.pushMode || "detailed", title: "\u9489\u9489\u6D88\u606F", onChange: (v) => patch({ pushMode: v }) }),
|
|
8997
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1D\u4EFB\u52A1\u4E0E\u7ED3\u679C\uFF1B\u9002\u4E2D\uFF1D\u52A0\u6A21\u578B/\u8017\u65F6\uFF1B\u8BE6\u7EC6\uFF1D\u518D\u52A0\u56DE\u5408\u3001Token \u4E0E\u6458\u8981\u3002" })
|
|
9019
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1D\u4EFB\u52A1\u4E0E\u7ED3\u679C\uFF1B\u9002\u4E2D\uFF1D\u52A0\u6A21\u578B/\u8017\u65F6\uFF1B\u8BE6\u7EC6\uFF1D\u518D\u52A0\u56DE\u5408\u3001Token \u4E0E\u6458\u8981\u3002\u5B50\u4EFB\u52A1\u7ED3\u675F\u6807\u300C\u5B50\u4EFB\u52A1\u300D\u5E76\u70B9\u540D\u4E3B\u4EFB\u52A1\uFF08\u4E09\u6321\u90FD\u5E26\u5F52\u5C5E\uFF09\u3002" })
|
|
8998
9020
|
] }),
|
|
8999
9021
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row dknt-row-webhook", children: [
|
|
9000
9022
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "Webhook" }),
|
|
@@ -9062,7 +9084,7 @@ function NotifyView(props) {
|
|
|
9062
9084
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row", children: [
|
|
9063
9085
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "\u6D88\u606F\u53E3\u5F84" }),
|
|
9064
9086
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ModePicker, { value: cfg.pushMode || "detailed", title: "\u98DE\u4E66\u6D88\u606F", onChange: (v) => patch({ pushMode: v }) }),
|
|
9065
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1D\u4EFB\u52A1\u4E0E\u7ED3\u679C\uFF1B\u9002\u4E2D\uFF1D\u52A0\u6A21\u578B/\u8017\u65F6\uFF1B\u8BE6\u7EC6\uFF1D\u518D\u52A0\u56DE\u5408\u3001Token \u4E0E\u6458\u8981\u3002" })
|
|
9087
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1D\u4EFB\u52A1\u4E0E\u7ED3\u679C\uFF1B\u9002\u4E2D\uFF1D\u52A0\u6A21\u578B/\u8017\u65F6\uFF1B\u8BE6\u7EC6\uFF1D\u518D\u52A0\u56DE\u5408\u3001Token \u4E0E\u6458\u8981\u3002\u5B50\u4EFB\u52A1\u7ED3\u675F\u6807\u300C\u5B50\u4EFB\u52A1\u300D\u5E76\u70B9\u540D\u4E3B\u4EFB\u52A1\uFF08\u4E09\u6321\u90FD\u5E26\u5F52\u5C5E\uFF09\u3002" })
|
|
9066
9088
|
] }),
|
|
9067
9089
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row dknt-row-webhook", children: [
|
|
9068
9090
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "Webhook" }),
|
|
@@ -9232,7 +9254,7 @@ var css3 = [
|
|
|
9232
9254
|
".dknt-btn:hover{background:var(--dsw-alias-interactive-bg-hover);}",
|
|
9233
9255
|
".dknt-btn[disabled]{opacity:.5;cursor:default;}"
|
|
9234
9256
|
].join("\n");
|
|
9235
|
-
var
|
|
9257
|
+
var feature6 = {
|
|
9236
9258
|
id: "notify",
|
|
9237
9259
|
name: "\u4EFB\u52A1\u901A\u77E5",
|
|
9238
9260
|
order: 140,
|
|
@@ -9245,7 +9267,7 @@ var feature8 = {
|
|
|
9245
9267
|
};
|
|
9246
9268
|
|
|
9247
9269
|
// features/runstate/view.jsx
|
|
9248
|
-
var
|
|
9270
|
+
var import_react8 = require("react");
|
|
9249
9271
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
9250
9272
|
function rpcCall4(method, args) {
|
|
9251
9273
|
return fetch("dsh-dock/runstate/" + method, {
|
|
@@ -9332,8 +9354,8 @@ var runStateStore = {
|
|
|
9332
9354
|
}
|
|
9333
9355
|
};
|
|
9334
9356
|
function useRunState() {
|
|
9335
|
-
const [snap, setSnap] = (0,
|
|
9336
|
-
(0,
|
|
9357
|
+
const [snap, setSnap] = (0, import_react8.useState)(runStateStore.snap);
|
|
9358
|
+
(0, import_react8.useEffect)(() => runStateStore.subscribe(() => setSnap(runStateStore.snap)), []);
|
|
9337
9359
|
return snap;
|
|
9338
9360
|
}
|
|
9339
9361
|
function waitingOf(active) {
|
|
@@ -9372,7 +9394,7 @@ function RunStateView() {
|
|
|
9372
9394
|
const waitApprovals = (active || []).reduce((n, t) => n + taskApprovals(t).length, 0);
|
|
9373
9395
|
const waitQuestions = (active || []).reduce((n, t) => n + taskQuestions(t).length, 0);
|
|
9374
9396
|
const waitBannerHint = waitApprovals > 0 && waitQuestions > 0 ? waitApprovals + " \u9879\u7B49\u6279\u51C6\u3001" + waitQuestions + " \u9879\u7B49\u4F60\u56DE\u7B54" : waitApprovals > 0 ? "\u4EFB\u52A1\u505C\u5728\u9700\u8981\u4F60\u6279\u51C6\u7684\u6B65\u9AA4\u4E0A" : "\u4EFB\u52A1\u5728\u7B49\u4F60\u56DE\u7B54\u95EE\u9898";
|
|
9375
|
-
(0,
|
|
9397
|
+
(0, import_react8.useEffect)(() => {
|
|
9376
9398
|
let stopped = false;
|
|
9377
9399
|
let timer = null;
|
|
9378
9400
|
const loop = async () => {
|
|
@@ -9413,7 +9435,7 @@ function RunStateView() {
|
|
|
9413
9435
|
}
|
|
9414
9436
|
function RunStateStat(props) {
|
|
9415
9437
|
const snap = useRunState();
|
|
9416
|
-
(0,
|
|
9438
|
+
(0, import_react8.useEffect)(() => {
|
|
9417
9439
|
if (!runStateStore.snap.status) runStateStore.refresh();
|
|
9418
9440
|
}, []);
|
|
9419
9441
|
const st = snap.status;
|
|
@@ -9464,7 +9486,7 @@ var css4 = [
|
|
|
9464
9486
|
".dkrs-tag.err{color:var(--dsw-alias-state-error-primary);border-color:currentColor;}",
|
|
9465
9487
|
".dkrs-tag.warn{color:var(--dk-warn);border-color:currentColor;}"
|
|
9466
9488
|
].join("\n");
|
|
9467
|
-
var
|
|
9489
|
+
var feature7 = {
|
|
9468
9490
|
id: "runstate",
|
|
9469
9491
|
name: "\u8FD0\u884C\u72B6\u6001",
|
|
9470
9492
|
order: 150,
|
|
@@ -9476,7 +9498,7 @@ var feature9 = {
|
|
|
9476
9498
|
};
|
|
9477
9499
|
|
|
9478
9500
|
// features/tts/view.jsx
|
|
9479
|
-
var
|
|
9501
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
9480
9502
|
function synth() {
|
|
9481
9503
|
try {
|
|
9482
9504
|
const g = typeof globalThis !== "undefined" ? globalThis : null;
|
|
@@ -9576,8 +9598,8 @@ function subscribeConfig(fn) {
|
|
|
9576
9598
|
};
|
|
9577
9599
|
}
|
|
9578
9600
|
function useConfig() {
|
|
9579
|
-
const [, force] = (0,
|
|
9580
|
-
(0,
|
|
9601
|
+
const [, force] = (0, import_react9.useState)(0);
|
|
9602
|
+
(0, import_react9.useEffect)(() => subscribeConfig(() => force((n) => n + 1)), []);
|
|
9581
9603
|
return configStore.value;
|
|
9582
9604
|
}
|
|
9583
9605
|
var HOST_SAVE_DEBOUNCE_MS = 400;
|
|
@@ -9798,8 +9820,8 @@ function subscribeEngine(fn) {
|
|
|
9798
9820
|
};
|
|
9799
9821
|
}
|
|
9800
9822
|
function useEngineState() {
|
|
9801
|
-
const [snap, setSnap] = (0,
|
|
9802
|
-
(0,
|
|
9823
|
+
const [snap, setSnap] = (0, import_react9.useState)(engineSnapshot());
|
|
9824
|
+
(0, import_react9.useEffect)(() => subscribeEngine(() => setSnap(engineSnapshot())), []);
|
|
9803
9825
|
return snap;
|
|
9804
9826
|
}
|
|
9805
9827
|
function setEngineState(next) {
|
|
@@ -9978,7 +10000,7 @@ function closingMarkdown(owner) {
|
|
|
9978
10000
|
for (const b of blocks) if (b && b.kind === "text" && typeof b.text === "string") parts.push(b.text);
|
|
9979
10001
|
return parts.join("");
|
|
9980
10002
|
}
|
|
9981
|
-
var ICON_SPEAKER =
|
|
10003
|
+
var ICON_SPEAKER = import_react9.default.createElement(
|
|
9982
10004
|
"svg",
|
|
9983
10005
|
{
|
|
9984
10006
|
viewBox: "0 0 24 24",
|
|
@@ -9989,11 +10011,11 @@ var ICON_SPEAKER = import_react12.default.createElement(
|
|
|
9989
10011
|
strokeLinejoin: "round",
|
|
9990
10012
|
"aria-hidden": "true"
|
|
9991
10013
|
},
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
10014
|
+
import_react9.default.createElement("path", { d: "M11 5 6 9H3v6h3l5 4z" }),
|
|
10015
|
+
import_react9.default.createElement("path", { d: "M15.5 8.5a5 5 0 0 1 0 7" }),
|
|
10016
|
+
import_react9.default.createElement("path", { d: "M18.5 5.5a9 9 0 0 1 0 13" })
|
|
9995
10017
|
);
|
|
9996
|
-
var ICON_PAUSE =
|
|
10018
|
+
var ICON_PAUSE = import_react9.default.createElement(
|
|
9997
10019
|
"svg",
|
|
9998
10020
|
{
|
|
9999
10021
|
viewBox: "0 0 24 24",
|
|
@@ -10003,10 +10025,10 @@ var ICON_PAUSE = import_react12.default.createElement(
|
|
|
10003
10025
|
strokeLinecap: "round",
|
|
10004
10026
|
"aria-hidden": "true"
|
|
10005
10027
|
},
|
|
10006
|
-
|
|
10007
|
-
|
|
10028
|
+
import_react9.default.createElement("path", { d: "M9 6v12" }),
|
|
10029
|
+
import_react9.default.createElement("path", { d: "M15 6v12" })
|
|
10008
10030
|
);
|
|
10009
|
-
var ICON_RESUME =
|
|
10031
|
+
var ICON_RESUME = import_react9.default.createElement(
|
|
10010
10032
|
"svg",
|
|
10011
10033
|
{
|
|
10012
10034
|
viewBox: "0 0 24 24",
|
|
@@ -10017,9 +10039,9 @@ var ICON_RESUME = import_react12.default.createElement(
|
|
|
10017
10039
|
strokeLinejoin: "round",
|
|
10018
10040
|
"aria-hidden": "true"
|
|
10019
10041
|
},
|
|
10020
|
-
|
|
10042
|
+
import_react9.default.createElement("path", { d: "M8 5.5v13l11-6.5z" })
|
|
10021
10043
|
);
|
|
10022
|
-
var ICON_RESTART =
|
|
10044
|
+
var ICON_RESTART = import_react9.default.createElement(
|
|
10023
10045
|
"svg",
|
|
10024
10046
|
{
|
|
10025
10047
|
viewBox: "0 0 24 24",
|
|
@@ -10030,11 +10052,11 @@ var ICON_RESTART = import_react12.default.createElement(
|
|
|
10030
10052
|
strokeLinejoin: "round",
|
|
10031
10053
|
"aria-hidden": "true"
|
|
10032
10054
|
},
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10055
|
+
import_react9.default.createElement("path", { d: "M3.5 8.5V4.5" }),
|
|
10056
|
+
import_react9.default.createElement("path", { d: "M3.5 8.5h4" }),
|
|
10057
|
+
import_react9.default.createElement("path", { d: "M5.6 5.1a8.5 8.5 0 1 1-2.1 5.4" })
|
|
10036
10058
|
);
|
|
10037
|
-
var ICON_STOP =
|
|
10059
|
+
var ICON_STOP = import_react9.default.createElement(
|
|
10038
10060
|
"svg",
|
|
10039
10061
|
{
|
|
10040
10062
|
viewBox: "0 0 24 24",
|
|
@@ -10044,9 +10066,9 @@ var ICON_STOP = import_react12.default.createElement(
|
|
|
10044
10066
|
strokeLinejoin: "round",
|
|
10045
10067
|
"aria-hidden": "true"
|
|
10046
10068
|
},
|
|
10047
|
-
|
|
10069
|
+
import_react9.default.createElement("rect", { x: "6.5", y: "6.5", width: "11", height: "11", rx: "2" })
|
|
10048
10070
|
);
|
|
10049
|
-
var ICON_GEAR =
|
|
10071
|
+
var ICON_GEAR = import_react9.default.createElement(
|
|
10050
10072
|
"svg",
|
|
10051
10073
|
{
|
|
10052
10074
|
viewBox: "0 0 24 24",
|
|
@@ -10057,14 +10079,14 @@ var ICON_GEAR = import_react12.default.createElement(
|
|
|
10057
10079
|
strokeLinejoin: "round",
|
|
10058
10080
|
"aria-hidden": "true"
|
|
10059
10081
|
},
|
|
10060
|
-
|
|
10061
|
-
|
|
10082
|
+
import_react9.default.createElement("circle", { cx: "12", cy: "12", r: "3.2" }),
|
|
10083
|
+
import_react9.default.createElement("path", { d: "M12 2.8v3M12 18.2v3M2.8 12h3M18.2 12h3M5.5 5.5l2.1 2.1M16.4 16.4l2.1 2.1M18.5 5.5l-2.1 2.1M7.6 16.4l-2.1 2.1" })
|
|
10062
10084
|
);
|
|
10063
10085
|
function TtsQuickPop(props) {
|
|
10064
10086
|
const cfg = useConfig();
|
|
10065
10087
|
const anchor = props.anchor || { x: 120, y: 120 };
|
|
10066
|
-
const boxRef = (0,
|
|
10067
|
-
(0,
|
|
10088
|
+
const boxRef = (0, import_react9.useRef)(null);
|
|
10089
|
+
(0, import_react9.useEffect)(() => {
|
|
10068
10090
|
if (typeof document === "undefined") return void 0;
|
|
10069
10091
|
const onDown = (e) => {
|
|
10070
10092
|
if (boxRef.current && !boxRef.current.contains(e.target)) props.onClose();
|
|
@@ -10082,7 +10104,7 @@ function TtsQuickPop(props) {
|
|
|
10082
10104
|
const vw = typeof globalThis !== "undefined" && globalThis.innerWidth ? globalThis.innerWidth : 1440;
|
|
10083
10105
|
const left = Math.max(8, Math.min(anchor.x - 4, vw - 256));
|
|
10084
10106
|
const portalTarget = typeof document !== "undefined" && document.body ? document.body : null;
|
|
10085
|
-
const pop =
|
|
10107
|
+
const pop = import_react9.default.createElement(
|
|
10086
10108
|
"div",
|
|
10087
10109
|
{
|
|
10088
10110
|
ref: boxRef,
|
|
@@ -10091,11 +10113,11 @@ function TtsQuickPop(props) {
|
|
|
10091
10113
|
role: "dialog",
|
|
10092
10114
|
"aria-label": "\u6717\u8BFB\u5FEB\u901F\u8BBE\u7F6E"
|
|
10093
10115
|
},
|
|
10094
|
-
|
|
10116
|
+
import_react9.default.createElement(
|
|
10095
10117
|
"div",
|
|
10096
10118
|
{ className: "dktts-pop-h" },
|
|
10097
|
-
|
|
10098
|
-
|
|
10119
|
+
import_react9.default.createElement("b", null, "\u6717\u8BFB\u8BBE\u7F6E"),
|
|
10120
|
+
import_react9.default.createElement("button", {
|
|
10099
10121
|
type: "button",
|
|
10100
10122
|
className: "dktts-pop-x",
|
|
10101
10123
|
"aria-label": "\u5173\u95ED",
|
|
@@ -10103,11 +10125,11 @@ function TtsQuickPop(props) {
|
|
|
10103
10125
|
onClick: props.onClose
|
|
10104
10126
|
}, "\u2715")
|
|
10105
10127
|
),
|
|
10106
|
-
|
|
10128
|
+
import_react9.default.createElement(
|
|
10107
10129
|
"div",
|
|
10108
10130
|
{ className: "dktts-pop-row" },
|
|
10109
|
-
|
|
10110
|
-
|
|
10131
|
+
import_react9.default.createElement("span", null, "\u8BED\u901F"),
|
|
10132
|
+
import_react9.default.createElement("input", {
|
|
10111
10133
|
type: "range",
|
|
10112
10134
|
min: "0.5",
|
|
10113
10135
|
max: "2",
|
|
@@ -10116,13 +10138,13 @@ function TtsQuickPop(props) {
|
|
|
10116
10138
|
"aria-label": "\u8BED\u901F",
|
|
10117
10139
|
onChange: (e) => setConfig({ rate: Number(e.target.value) || 1 })
|
|
10118
10140
|
}),
|
|
10119
|
-
|
|
10141
|
+
import_react9.default.createElement("span", { className: "dktts-pop-val" }, cfg.rate.toFixed(2) + "\xD7")
|
|
10120
10142
|
),
|
|
10121
|
-
|
|
10143
|
+
import_react9.default.createElement(
|
|
10122
10144
|
"div",
|
|
10123
10145
|
{ className: "dktts-pop-row" },
|
|
10124
|
-
|
|
10125
|
-
|
|
10146
|
+
import_react9.default.createElement("span", null, "\u97F3\u91CF"),
|
|
10147
|
+
import_react9.default.createElement("input", {
|
|
10126
10148
|
type: "range",
|
|
10127
10149
|
min: "0",
|
|
10128
10150
|
max: "1",
|
|
@@ -10131,13 +10153,13 @@ function TtsQuickPop(props) {
|
|
|
10131
10153
|
"aria-label": "\u97F3\u91CF",
|
|
10132
10154
|
onChange: (e) => setConfig({ volume: Number(e.target.value) })
|
|
10133
10155
|
}),
|
|
10134
|
-
|
|
10156
|
+
import_react9.default.createElement("span", { className: "dktts-pop-val" }, Math.round(cfg.volume * 100) + "%")
|
|
10135
10157
|
),
|
|
10136
|
-
|
|
10158
|
+
import_react9.default.createElement(
|
|
10137
10159
|
"div",
|
|
10138
10160
|
{ className: "dktts-pop-foot" },
|
|
10139
|
-
|
|
10140
|
-
|
|
10161
|
+
import_react9.default.createElement("span", { className: "dktts-pop-tip" }, "\u4E0B\u4E00\u53E5\u8D77\u751F\u6548"),
|
|
10162
|
+
import_react9.default.createElement("button", {
|
|
10141
10163
|
type: "button",
|
|
10142
10164
|
className: "dktts-pop-more",
|
|
10143
10165
|
onClick: () => {
|
|
@@ -10147,7 +10169,7 @@ function TtsQuickPop(props) {
|
|
|
10147
10169
|
}, "\u66F4\u591A\u8BBE\u7F6E \u2192")
|
|
10148
10170
|
)
|
|
10149
10171
|
);
|
|
10150
|
-
return portalTarget && typeof
|
|
10172
|
+
return portalTarget && typeof import_react9.default.createPortal === "function" ? import_react9.default.createPortal(pop, portalTarget) : pop;
|
|
10151
10173
|
}
|
|
10152
10174
|
var AUTO_PLAY_FRESH_MS = 8e3;
|
|
10153
10175
|
var BAD_END = { error: 1, aborted: 1, blocked: 1, "max-tokens": 1, interrupted: 1 };
|
|
@@ -10177,7 +10199,7 @@ function TtsTurnTail(props) {
|
|
|
10177
10199
|
const active = hasText && eng.phase !== "idle" && eng.key === key;
|
|
10178
10200
|
const paused = active && eng.phase === "paused";
|
|
10179
10201
|
const playing = active && eng.phase === "playing";
|
|
10180
|
-
(0,
|
|
10202
|
+
(0, import_react9.useEffect)(() => {
|
|
10181
10203
|
ensureConfigLoaded();
|
|
10182
10204
|
}, []);
|
|
10183
10205
|
const startThis = () => {
|
|
@@ -10185,9 +10207,9 @@ function TtsTurnTail(props) {
|
|
|
10185
10207
|
const plain = capSpeechText(plainForSpeech(md, configStore.value), configStore.value);
|
|
10186
10208
|
speak({ key, text: plain, cfg: configStore.value, label: "\u7B2C " + (turnNo + 1) + " \u56DE\u5408" });
|
|
10187
10209
|
};
|
|
10188
|
-
const autoDoneRef = (0,
|
|
10189
|
-
const [quick, setQuick] = (0,
|
|
10190
|
-
(0,
|
|
10210
|
+
const autoDoneRef = (0, import_react9.useRef)(false);
|
|
10211
|
+
const [quick, setQuick] = (0, import_react9.useState)(null);
|
|
10212
|
+
(0, import_react9.useEffect)(() => {
|
|
10191
10213
|
if (autoDoneRef.current) return;
|
|
10192
10214
|
autoDoneRef.current = true;
|
|
10193
10215
|
if (!hasText || !supported) return;
|
|
@@ -10235,10 +10257,10 @@ function TtsTurnTail(props) {
|
|
|
10235
10257
|
ensureConfigLoaded();
|
|
10236
10258
|
setQuick(rect2 ? { x: rect2.left, y: rect2.bottom } : { x: 120, y: 120 });
|
|
10237
10259
|
};
|
|
10238
|
-
return
|
|
10260
|
+
return import_react9.default.createElement(
|
|
10239
10261
|
"div",
|
|
10240
10262
|
{ className: "dktts-tail" },
|
|
10241
|
-
|
|
10263
|
+
import_react9.default.createElement("button", {
|
|
10242
10264
|
type: "button",
|
|
10243
10265
|
className: "dktts-btn" + (active ? " on" : "") + (supported ? "" : " off"),
|
|
10244
10266
|
"aria-label": mainTitle,
|
|
@@ -10246,7 +10268,7 @@ function TtsTurnTail(props) {
|
|
|
10246
10268
|
title: mainTitle,
|
|
10247
10269
|
onClick: onMain
|
|
10248
10270
|
}, playing ? ICON_PAUSE : paused ? ICON_RESUME : ICON_SPEAKER),
|
|
10249
|
-
active ?
|
|
10271
|
+
active ? import_react9.default.createElement("button", {
|
|
10250
10272
|
type: "button",
|
|
10251
10273
|
className: "dktts-btn",
|
|
10252
10274
|
"aria-label": "\u91CD\u65B0\u6717\u8BFB",
|
|
@@ -10255,7 +10277,7 @@ function TtsTurnTail(props) {
|
|
|
10255
10277
|
restartSpeech();
|
|
10256
10278
|
}
|
|
10257
10279
|
}, ICON_RESTART) : null,
|
|
10258
|
-
active ?
|
|
10280
|
+
active ? import_react9.default.createElement("button", {
|
|
10259
10281
|
type: "button",
|
|
10260
10282
|
className: "dktts-btn",
|
|
10261
10283
|
"aria-label": "\u505C\u6B62",
|
|
@@ -10264,7 +10286,7 @@ function TtsTurnTail(props) {
|
|
|
10264
10286
|
stopSpeech();
|
|
10265
10287
|
}
|
|
10266
10288
|
}, ICON_STOP) : null,
|
|
10267
|
-
|
|
10289
|
+
import_react9.default.createElement("button", {
|
|
10268
10290
|
type: "button",
|
|
10269
10291
|
className: "dktts-btn" + (quick ? " on" : ""),
|
|
10270
10292
|
"aria-label": "\u6717\u8BFB\u8BBE\u7F6E\uFF08\u8BED\u901F / \u97F3\u91CF\uFF09",
|
|
@@ -10272,22 +10294,22 @@ function TtsTurnTail(props) {
|
|
|
10272
10294
|
title: "\u6717\u8BFB\u8BBE\u7F6E\uFF08\u8BED\u901F / \u97F3\u91CF\uFF09",
|
|
10273
10295
|
onClick: openQuick
|
|
10274
10296
|
}, ICON_GEAR),
|
|
10275
|
-
|
|
10297
|
+
import_react9.default.createElement(
|
|
10276
10298
|
"span",
|
|
10277
10299
|
{ className: "dktts-state" + (active ? " on" : "") },
|
|
10278
10300
|
playing ? "\u6B63\u5728\u6717\u8BFB\u672C\u56DE\u5408" : paused ? "\u5DF2\u6682\u505C \xB7 \u70B9 \u25B6 \u7EE7\u7EED\uFF0C\u4E0D\u91CD\u5934" : ""
|
|
10279
10301
|
),
|
|
10280
|
-
quick ?
|
|
10302
|
+
quick ? import_react9.default.createElement(TtsQuickPop, { anchor: quick, onClose: () => setQuick(null) }) : null
|
|
10281
10303
|
);
|
|
10282
10304
|
}
|
|
10283
10305
|
function TtsOverlay() {
|
|
10284
10306
|
const cfg = useConfig();
|
|
10285
|
-
const seenRef = (0,
|
|
10286
|
-
const primedRef = (0,
|
|
10287
|
-
(0,
|
|
10307
|
+
const seenRef = (0, import_react9.useRef)(null);
|
|
10308
|
+
const primedRef = (0, import_react9.useRef)(false);
|
|
10309
|
+
(0, import_react9.useEffect)(() => {
|
|
10288
10310
|
ensureConfigLoaded();
|
|
10289
10311
|
}, []);
|
|
10290
|
-
(0,
|
|
10312
|
+
(0, import_react9.useEffect)(() => {
|
|
10291
10313
|
if (!cfg.autoPlay) return void 0;
|
|
10292
10314
|
if (!ttsSupported()) return void 0;
|
|
10293
10315
|
if (seenRef.current === null) seenRef.current = /* @__PURE__ */ new Set();
|
|
@@ -10350,17 +10372,17 @@ function TtsOverlay() {
|
|
|
10350
10372
|
return null;
|
|
10351
10373
|
}
|
|
10352
10374
|
function TtsRow(props) {
|
|
10353
|
-
return
|
|
10375
|
+
return import_react9.default.createElement(
|
|
10354
10376
|
"div",
|
|
10355
10377
|
{ className: "dktts-row" },
|
|
10356
|
-
|
|
10357
|
-
|
|
10358
|
-
props.note ?
|
|
10378
|
+
import_react9.default.createElement("span", { className: "dktts-label" }, props.label),
|
|
10379
|
+
import_react9.default.createElement("span", { className: "dktts-ctl" }, props.children),
|
|
10380
|
+
props.note ? import_react9.default.createElement("span", { className: "dktts-note" }, props.note) : null
|
|
10359
10381
|
);
|
|
10360
10382
|
}
|
|
10361
10383
|
function TtsSwitch(props) {
|
|
10362
10384
|
const on = props.value === true;
|
|
10363
|
-
return
|
|
10385
|
+
return import_react9.default.createElement(
|
|
10364
10386
|
"button",
|
|
10365
10387
|
{
|
|
10366
10388
|
type: "button",
|
|
@@ -10371,17 +10393,17 @@ function TtsSwitch(props) {
|
|
|
10371
10393
|
title: on ? "\u5DF2\u542F\u7528\uFF08\u70B9\u51FB\u505C\u7528\uFF09" : "\u5DF2\u505C\u7528\uFF08\u70B9\u51FB\u542F\u7528\uFF09",
|
|
10372
10394
|
onClick: () => props.onChange(!on)
|
|
10373
10395
|
},
|
|
10374
|
-
|
|
10396
|
+
import_react9.default.createElement("span", { className: "dktts-sw-dot" }),
|
|
10375
10397
|
on ? "\u542F\u7528" : "\u505C\u7528"
|
|
10376
10398
|
);
|
|
10377
10399
|
}
|
|
10378
10400
|
function TtsView() {
|
|
10379
10401
|
const cfg = useConfig();
|
|
10380
10402
|
const eng = useEngineState();
|
|
10381
|
-
const [, force] = (0,
|
|
10382
|
-
const [saved, setSaved] = (0,
|
|
10383
|
-
const voices = (0,
|
|
10384
|
-
(0,
|
|
10403
|
+
const [, force] = (0, import_react9.useState)(0);
|
|
10404
|
+
const [saved, setSaved] = (0, import_react9.useState)("");
|
|
10405
|
+
const voices = (0, import_react9.useRef)(localVoices2());
|
|
10406
|
+
(0, import_react9.useEffect)(() => {
|
|
10385
10407
|
ensureConfigLoaded();
|
|
10386
10408
|
const s = synth();
|
|
10387
10409
|
if (!s || typeof s.addEventListener !== "function") return;
|
|
@@ -10401,7 +10423,7 @@ function TtsView() {
|
|
|
10401
10423
|
}
|
|
10402
10424
|
};
|
|
10403
10425
|
}, []);
|
|
10404
|
-
(0,
|
|
10426
|
+
(0, import_react9.useEffect)(() => {
|
|
10405
10427
|
if (voices.current.length === 0) {
|
|
10406
10428
|
voices.current = localVoices2();
|
|
10407
10429
|
force((n) => n + 1);
|
|
@@ -10438,101 +10460,101 @@ function TtsView() {
|
|
|
10438
10460
|
if (zh.length) grouped.push(["\u4E2D\u6587\u97F3\u8272", zh]);
|
|
10439
10461
|
if (other.length) grouped.push(["\u5176\u4ED6\u97F3\u8272", other]);
|
|
10440
10462
|
}
|
|
10441
|
-
return
|
|
10463
|
+
return import_react9.default.createElement(
|
|
10442
10464
|
"div",
|
|
10443
10465
|
{ className: "dktts-root" },
|
|
10444
|
-
|
|
10466
|
+
import_react9.default.createElement(
|
|
10445
10467
|
"div",
|
|
10446
10468
|
{ className: "dktts-intro" },
|
|
10447
10469
|
"\u773C\u775B\u4E0D\u8212\u670D\u65F6\u8BA9 dsh \u628A\u56DE\u590D\u8BFB\u51FA\u6765\u3002\u7528\u7684\u662F",
|
|
10448
|
-
|
|
10470
|
+
import_react9.default.createElement("b", null, "\u6D4F\u89C8\u5668\u81EA\u5E26\u7684\u8BED\u97F3\u5408\u6210"),
|
|
10449
10471
|
"\uFF08Web Speech API\uFF09\uFF0C\u58F0\u97F3\u4ECE\u4F60\u5F53\u524D\u8FD9\u53F0\u8BBE\u5907\u7684\u626C\u58F0\u5668\u51FA\u6765\uFF0C\u4E0D\u6D88\u8017 token\u3001\u4E0D\u7ECF\u8FC7\u670D\u52A1\u5668\u3002",
|
|
10450
10472
|
"\u6BCF\u6761\u56DE\u590D\u4E0B\u65B9\u4F1A\u51FA\u73B0\u4E00\u4E2A",
|
|
10451
|
-
|
|
10473
|
+
import_react9.default.createElement("b", null, " \u{1F50A} \u5587\u53ED"),
|
|
10452
10474
|
"\uFF0C\u70B9\u4E00\u4E0B\u5C31\u8BFB\u8FD9\u6761\uFF1B\u4E5F\u53EF\u4EE5\u6253\u5F00\u300C\u81EA\u52A8\u6717\u8BFB\u300D\uFF0C\u56DE\u5408\u7ED3\u675F\u540E\u76F4\u63A5\u8BFB\u6700\u540E\u4E00\u6761\u56DE\u590D\u3002"
|
|
10453
10475
|
),
|
|
10454
|
-
!supported ?
|
|
10476
|
+
!supported ? import_react9.default.createElement(
|
|
10455
10477
|
"div",
|
|
10456
10478
|
{ className: "dktts-warn" },
|
|
10457
10479
|
"\u8FD9\u4E2A\u6D4F\u89C8\u5668\u4E0D\u63D0\u4F9B\u8BED\u97F3\u5408\u6210\u80FD\u529B\uFF08speechSynthesis \u4E0D\u53EF\u7528\uFF09\u3002\u6362 Chrome / Edge / Safari \u5373\u53EF\uFF1BLinux \u4E0A\u7684 Chromium \u9700\u8981\u88C5\u8BED\u97F3\u5305\uFF08\u5982 espeak-ng\uFF09\uFF0C\u6216\u5728\u7CFB\u7EDF\u8BBE\u7F6E\u91CC\u6DFB\u52A0\u8BED\u97F3\u3002"
|
|
10458
10480
|
) : null,
|
|
10459
|
-
supported && list.length === 0 ?
|
|
10481
|
+
supported && list.length === 0 ? import_react9.default.createElement(
|
|
10460
10482
|
"div",
|
|
10461
10483
|
{ className: "dktts-warn" },
|
|
10462
10484
|
"\u672C\u673A\u6682\u65F6\u8BFB\u4E0D\u5230\u4EFB\u4F55\u97F3\u8272\u3002\u901A\u5E38\u662F\u7CFB\u7EDF\u8FD8\u6CA1\u88C5/\u6CA1\u542F\u7528\u8BED\u97F3\uFF1AWindows \u5230\u300C\u8BBE\u7F6E \u2192 \u65F6\u95F4\u548C\u8BED\u8A00 \u2192 \u8BED\u97F3\u300D\u6DFB\u52A0\u4E2D\u6587\u8BED\u97F3\uFF0CmacOS \u5230\u300C\u7CFB\u7EDF\u8BBE\u7F6E \u2192 \u65E0\u969C\u788D \u2192 \u6717\u8BFB\u5185\u5BB9\u300D\u6DFB\u52A0\u97F3\u8272\uFF0C\u7136\u540E\u5237\u65B0\u9875\u9762\u3002"
|
|
10463
10485
|
) : null,
|
|
10464
|
-
|
|
10486
|
+
import_react9.default.createElement(
|
|
10465
10487
|
"div",
|
|
10466
10488
|
{ className: "dktts-card" },
|
|
10467
|
-
|
|
10468
|
-
|
|
10489
|
+
import_react9.default.createElement("div", { className: "dktts-card-h" }, "\u6717\u8BFB\u65F6\u673A"),
|
|
10490
|
+
import_react9.default.createElement(TtsRow, {
|
|
10469
10491
|
label: "\u81EA\u52A8\u6717\u8BFB",
|
|
10470
10492
|
note: "\u56DE\u5408\u7ED3\u675F\u540E\u81EA\u52A8\u8BFB\u6700\u540E\u4E00\u6761\u56DE\u590D\uFF1B\u4F60\u6B63\u5728\u770B\u7684\u8FD9\u6761\u4F1A\u8BDD\u624D\u8BFB\uFF0C\u540E\u53F0\u4F1A\u8BDD\u4E0D\u8BFB\u3002"
|
|
10471
|
-
},
|
|
10493
|
+
}, import_react9.default.createElement(TtsSwitch, {
|
|
10472
10494
|
label: "\u81EA\u52A8\u6717\u8BFB",
|
|
10473
10495
|
value: cfg.autoPlay,
|
|
10474
10496
|
onChange: (v) => patch({ autoPlay: v })
|
|
10475
10497
|
})),
|
|
10476
|
-
|
|
10498
|
+
import_react9.default.createElement(TtsRow, {
|
|
10477
10499
|
label: "\u51FA\u9519 / \u4E2D\u6B62\u4E5F\u8BFB",
|
|
10478
10500
|
note: "\u5173\u95ED\u540E\u53EA\u5728\u6B63\u5E38\u5B8C\u6210\u65F6\u8BFB\u3002"
|
|
10479
|
-
},
|
|
10501
|
+
}, import_react9.default.createElement(TtsSwitch, {
|
|
10480
10502
|
label: "\u51FA\u9519\u4E5F\u8BFB",
|
|
10481
10503
|
value: cfg.autoPlayOnFinish,
|
|
10482
10504
|
onChange: (v) => patch({ autoPlayOnFinish: v })
|
|
10483
10505
|
})),
|
|
10484
|
-
|
|
10506
|
+
import_react9.default.createElement(TtsRow, {
|
|
10485
10507
|
label: "\u65B0\u5185\u5BB9\u6253\u65AD\u5F53\u524D\u6717\u8BFB",
|
|
10486
10508
|
note: "\u5173\u95ED\u5219\u6392\u961F\uFF1A\u65B0\u7684\u90A3\u6761\u7B49\u5F53\u524D\u8BFB\u5B8C\u518D\u8BFB\uFF08\u53EA\u4FDD\u7559\u6700\u65B0\u4E00\u6761\uFF09\u3002"
|
|
10487
|
-
},
|
|
10509
|
+
}, import_react9.default.createElement(TtsSwitch, {
|
|
10488
10510
|
label: "\u6253\u65AD",
|
|
10489
10511
|
value: cfg.interruptOnNew,
|
|
10490
10512
|
onChange: (v) => patch({ interruptOnNew: v })
|
|
10491
10513
|
}))
|
|
10492
10514
|
),
|
|
10493
|
-
|
|
10515
|
+
import_react9.default.createElement(
|
|
10494
10516
|
"div",
|
|
10495
10517
|
{ className: "dktts-card" },
|
|
10496
|
-
|
|
10497
|
-
|
|
10518
|
+
import_react9.default.createElement("div", { className: "dktts-card-h" }, "\u58F0\u97F3"),
|
|
10519
|
+
import_react9.default.createElement(
|
|
10498
10520
|
TtsRow,
|
|
10499
10521
|
{ label: "\u97F3\u8272", note: "\u97F3\u8272\u662F\u672C\u673A\u6D4F\u89C8\u5668\u7ED9\u7684\uFF0C\u6362\u8BBE\u5907\u53EF\u80FD\u8981\u91CD\u9009\u3002" },
|
|
10500
|
-
|
|
10522
|
+
import_react9.default.createElement(
|
|
10501
10523
|
"select",
|
|
10502
10524
|
{
|
|
10503
10525
|
className: "dktts-select",
|
|
10504
10526
|
value: cfg.voiceURI,
|
|
10505
10527
|
onChange: (e) => patch({ voiceURI: e.target.value })
|
|
10506
10528
|
},
|
|
10507
|
-
|
|
10508
|
-
grouped.map(([gname, vs]) =>
|
|
10529
|
+
import_react9.default.createElement("option", { value: "" }, "\u81EA\u52A8\uFF08\u6309\u8BED\u8A00\u6311\uFF09"),
|
|
10530
|
+
grouped.map(([gname, vs]) => import_react9.default.createElement(
|
|
10509
10531
|
"optgroup",
|
|
10510
10532
|
{ key: gname, label: gname },
|
|
10511
|
-
vs.map((v) =>
|
|
10533
|
+
vs.map((v) => import_react9.default.createElement("option", {
|
|
10512
10534
|
key: v.voiceURI,
|
|
10513
10535
|
value: v.voiceURI
|
|
10514
10536
|
}, (v.name || v.voiceURI) + "\uFF08" + (v.lang || "?") + "\uFF09"))
|
|
10515
10537
|
))
|
|
10516
10538
|
)
|
|
10517
10539
|
),
|
|
10518
|
-
|
|
10540
|
+
import_react9.default.createElement(
|
|
10519
10541
|
TtsRow,
|
|
10520
10542
|
{ label: "\u5F3A\u5236\u8BED\u8A00", note: "\u7559\u7A7A\u5219\u4E2D\u6587\u6587\u672C\u4F18\u5148\u6311\u4E2D\u6587\u97F3\u8272\u3002" },
|
|
10521
|
-
|
|
10543
|
+
import_react9.default.createElement(
|
|
10522
10544
|
"select",
|
|
10523
10545
|
{
|
|
10524
10546
|
className: "dktts-select",
|
|
10525
10547
|
value: cfg.lang,
|
|
10526
10548
|
onChange: (e) => patch({ lang: e.target.value })
|
|
10527
10549
|
},
|
|
10528
|
-
|
|
10529
|
-
["zh-CN", "zh-TW", "en-US", "en-GB", "ja-JP", "ko-KR"].map((l) =>
|
|
10550
|
+
import_react9.default.createElement("option", { value: "" }, "\u81EA\u52A8"),
|
|
10551
|
+
["zh-CN", "zh-TW", "en-US", "en-GB", "ja-JP", "ko-KR"].map((l) => import_react9.default.createElement("option", {
|
|
10530
10552
|
key: l,
|
|
10531
10553
|
value: l
|
|
10532
10554
|
}, l))
|
|
10533
10555
|
)
|
|
10534
10556
|
),
|
|
10535
|
-
|
|
10557
|
+
import_react9.default.createElement(TtsSlider, {
|
|
10536
10558
|
label: "\u8BED\u901F",
|
|
10537
10559
|
suffix: cfg.rate.toFixed(2) + "\xD7",
|
|
10538
10560
|
min: "0.5",
|
|
@@ -10542,7 +10564,7 @@ function TtsView() {
|
|
|
10542
10564
|
aria: "\u8BED\u901F",
|
|
10543
10565
|
onChange: (v) => patch({ rate: v })
|
|
10544
10566
|
}),
|
|
10545
|
-
|
|
10567
|
+
import_react9.default.createElement(TtsSlider, {
|
|
10546
10568
|
label: "\u97F3\u8C03",
|
|
10547
10569
|
suffix: cfg.pitch.toFixed(2),
|
|
10548
10570
|
min: "0",
|
|
@@ -10552,7 +10574,7 @@ function TtsView() {
|
|
|
10552
10574
|
aria: "\u97F3\u8C03",
|
|
10553
10575
|
onChange: (v) => patch({ pitch: v })
|
|
10554
10576
|
}),
|
|
10555
|
-
|
|
10577
|
+
import_react9.default.createElement(TtsSlider, {
|
|
10556
10578
|
label: "\u97F3\u91CF",
|
|
10557
10579
|
suffix: Math.round(cfg.volume * 100) + "%",
|
|
10558
10580
|
min: "0",
|
|
@@ -10563,24 +10585,24 @@ function TtsView() {
|
|
|
10563
10585
|
onChange: (v) => patch({ volume: v })
|
|
10564
10586
|
})
|
|
10565
10587
|
),
|
|
10566
|
-
|
|
10588
|
+
import_react9.default.createElement(
|
|
10567
10589
|
"div",
|
|
10568
10590
|
{ className: "dktts-card" },
|
|
10569
|
-
|
|
10570
|
-
|
|
10591
|
+
import_react9.default.createElement("div", { className: "dktts-card-h" }, "\u5FF5\u4EC0\u4E48\uFF08\u56DE\u590D\u6B63\u6587\u7684\u6E05\u6D17\uFF09"),
|
|
10592
|
+
import_react9.default.createElement(
|
|
10571
10593
|
TtsRow,
|
|
10572
10594
|
{ label: "\u8DF3\u8FC7\u4EE3\u7801\u5757", note: "\u5173\u95ED\u5219\u8FDE\u4EE3\u7801\u4E00\u8D77\u5FF5\uFF08\u53EA\u53BB\u7B26\u53F7\uFF09\u3002" },
|
|
10573
|
-
|
|
10595
|
+
import_react9.default.createElement(TtsSwitch, { label: "\u8DF3\u8FC7\u4EE3\u7801\u5757", value: cfg.skipCode, onChange: (v) => patch({ skipCode: v }) })
|
|
10574
10596
|
),
|
|
10575
|
-
|
|
10597
|
+
import_react9.default.createElement(
|
|
10576
10598
|
TtsRow,
|
|
10577
10599
|
{ label: "\u8DF3\u8FC7\u8868\u683C", note: "\u8868\u683C\u9010\u683C\u5FF5\u51FA\u6765\u6CA1\u6709\u610F\u4E49\uFF0C\u9ED8\u8BA4\u8DF3\u8FC7\u3002" },
|
|
10578
|
-
|
|
10600
|
+
import_react9.default.createElement(TtsSwitch, { label: "\u8DF3\u8FC7\u8868\u683C", value: cfg.skipTables, onChange: (v) => patch({ skipTables: v }) })
|
|
10579
10601
|
),
|
|
10580
|
-
|
|
10602
|
+
import_react9.default.createElement(
|
|
10581
10603
|
TtsRow,
|
|
10582
10604
|
{ label: "\u53EA\u8BFB\u524D N \u53E5", note: "0 = \u4E0D\u9650\u3002\u60F3\u53EA\u542C\u7ED3\u8BBA\u65F6\u8BBE 3~5 \u53E5\u3002" },
|
|
10583
|
-
|
|
10605
|
+
import_react9.default.createElement("input", {
|
|
10584
10606
|
type: "number",
|
|
10585
10607
|
className: "dktts-num",
|
|
10586
10608
|
min: "0",
|
|
@@ -10591,10 +10613,10 @@ function TtsView() {
|
|
|
10591
10613
|
onChange: (e) => patch({ maxSentences: Math.max(0, Math.round(Number(e.target.value) || 0)) })
|
|
10592
10614
|
})
|
|
10593
10615
|
),
|
|
10594
|
-
|
|
10616
|
+
import_react9.default.createElement(
|
|
10595
10617
|
TtsRow,
|
|
10596
10618
|
{ label: "\u5B57\u6570\u4E0A\u9650", note: "0 = \u4E0D\u9650\uFF1B\u8D85\u51FA\u90E8\u5206\u5FF5\u300C\u4EE5\u4E0B\u7565\u300D\u3002" },
|
|
10597
|
-
|
|
10619
|
+
import_react9.default.createElement("input", {
|
|
10598
10620
|
type: "number",
|
|
10599
10621
|
className: "dktts-num",
|
|
10600
10622
|
min: "0",
|
|
@@ -10607,20 +10629,20 @@ function TtsView() {
|
|
|
10607
10629
|
)
|
|
10608
10630
|
),
|
|
10609
10631
|
// —— 播放控制:试听 + 正在读时的 暂停/继续 · 重新朗读 · 停止 ——
|
|
10610
|
-
|
|
10632
|
+
import_react9.default.createElement(
|
|
10611
10633
|
"div",
|
|
10612
10634
|
{ className: "dktts-card" },
|
|
10613
|
-
|
|
10614
|
-
|
|
10635
|
+
import_react9.default.createElement("div", { className: "dktts-card-h" }, "\u64AD\u653E\u63A7\u5236"),
|
|
10636
|
+
import_react9.default.createElement(
|
|
10615
10637
|
"div",
|
|
10616
10638
|
{ className: "dktts-transport" },
|
|
10617
|
-
|
|
10639
|
+
import_react9.default.createElement("button", {
|
|
10618
10640
|
type: "button",
|
|
10619
10641
|
className: "dktts-primary",
|
|
10620
10642
|
onClick: preview,
|
|
10621
10643
|
disabled: !supported
|
|
10622
10644
|
}, "\u8BD5\u542C"),
|
|
10623
|
-
active ?
|
|
10645
|
+
active ? import_react9.default.createElement("button", {
|
|
10624
10646
|
type: "button",
|
|
10625
10647
|
className: "dktts-ghost",
|
|
10626
10648
|
onClick: () => {
|
|
@@ -10628,38 +10650,38 @@ function TtsView() {
|
|
|
10628
10650
|
else resumeSpeech();
|
|
10629
10651
|
}
|
|
10630
10652
|
}, playing ? "\u6682\u505C" : "\u7EE7\u7EED") : null,
|
|
10631
|
-
active ?
|
|
10653
|
+
active ? import_react9.default.createElement("button", {
|
|
10632
10654
|
type: "button",
|
|
10633
10655
|
className: "dktts-ghost",
|
|
10634
10656
|
onClick: () => {
|
|
10635
10657
|
restartSpeech();
|
|
10636
10658
|
}
|
|
10637
10659
|
}, "\u91CD\u65B0\u6717\u8BFB") : null,
|
|
10638
|
-
active ?
|
|
10660
|
+
active ? import_react9.default.createElement("button", {
|
|
10639
10661
|
type: "button",
|
|
10640
10662
|
className: "dktts-ghost",
|
|
10641
10663
|
onClick: () => {
|
|
10642
10664
|
stopSpeech();
|
|
10643
10665
|
}
|
|
10644
10666
|
}, "\u505C\u6B62") : null,
|
|
10645
|
-
|
|
10667
|
+
import_react9.default.createElement(
|
|
10646
10668
|
"span",
|
|
10647
10669
|
{ className: "dktts-playing" },
|
|
10648
10670
|
playing ? "\u6B63\u5728\u6717\u8BFB\uFF1A" + (eng.label || "\u5185\u5BB9") : paused ? "\u5DF2\u6682\u505C\uFF1A" + (eng.label || "\u5185\u5BB9") + "\uFF08\u70B9\u300C\u7EE7\u7EED\u300D\u4E0D\u91CD\u5934\uFF09" : saved ? "\u2713 " + saved : "\u3000"
|
|
10649
10671
|
)
|
|
10650
10672
|
)
|
|
10651
10673
|
),
|
|
10652
|
-
|
|
10674
|
+
import_react9.default.createElement(
|
|
10653
10675
|
"div",
|
|
10654
10676
|
{ className: "dktts-note-line" },
|
|
10655
10677
|
"\u63D0\u793A\uFF1A\u6D4F\u89C8\u5668\u8981\u6C42\u300C\u5148\u6709\u7528\u6237\u624B\u52BF\u624D\u5141\u8BB8\u51FA\u58F0\u300D\u3002\u521A\u6253\u5F00\u9875\u9762\u5C31\u81EA\u52A8\u6717\u8BFB\u53EF\u80FD\u88AB\u6D4F\u89C8\u5668\u62E6\u6389\u2014\u2014",
|
|
10656
10678
|
"\u70B9\u4E00\u4E0B\u9875\u9762\u4E0A\u4EFB\u610F\u4F4D\u7F6E\uFF0C\u6216\u76F4\u63A5\u7528\u56DE\u590D\u4E0B\u65B9\u7684\u5587\u53ED\u6309\u94AE\u3002"
|
|
10657
10679
|
),
|
|
10658
|
-
configStore.note ?
|
|
10659
|
-
configStore.routeGone ?
|
|
10680
|
+
configStore.note ? import_react9.default.createElement("div", { className: "dktts-warn" }, configStore.note) : null,
|
|
10681
|
+
configStore.routeGone ? import_react9.default.createElement(
|
|
10660
10682
|
"div",
|
|
10661
10683
|
{ className: "dktts-links" },
|
|
10662
|
-
|
|
10684
|
+
import_react9.default.createElement("button", {
|
|
10663
10685
|
type: "button",
|
|
10664
10686
|
className: "dktts-ghost",
|
|
10665
10687
|
onClick: () => {
|
|
@@ -10673,14 +10695,14 @@ function TtsView() {
|
|
|
10673
10695
|
);
|
|
10674
10696
|
}
|
|
10675
10697
|
function TtsSlider(props) {
|
|
10676
|
-
return
|
|
10698
|
+
return import_react9.default.createElement(
|
|
10677
10699
|
"div",
|
|
10678
10700
|
{ className: "dktts-row" },
|
|
10679
|
-
|
|
10680
|
-
|
|
10701
|
+
import_react9.default.createElement("span", { className: "dktts-label" }, props.label),
|
|
10702
|
+
import_react9.default.createElement(
|
|
10681
10703
|
"span",
|
|
10682
10704
|
{ className: "dktts-slider" },
|
|
10683
|
-
|
|
10705
|
+
import_react9.default.createElement("input", {
|
|
10684
10706
|
type: "range",
|
|
10685
10707
|
min: props.min,
|
|
10686
10708
|
max: props.max,
|
|
@@ -10689,17 +10711,17 @@ function TtsSlider(props) {
|
|
|
10689
10711
|
"aria-label": props.aria,
|
|
10690
10712
|
onChange: (e) => props.onChange(Number(e.target.value))
|
|
10691
10713
|
}),
|
|
10692
|
-
|
|
10714
|
+
import_react9.default.createElement("span", { className: "dktts-slider-val" }, props.suffix)
|
|
10693
10715
|
),
|
|
10694
10716
|
null
|
|
10695
10717
|
);
|
|
10696
10718
|
}
|
|
10697
10719
|
function TtsStat() {
|
|
10698
10720
|
const cfg = useConfig();
|
|
10699
|
-
(0,
|
|
10721
|
+
(0, import_react9.useEffect)(() => {
|
|
10700
10722
|
ensureConfigLoaded();
|
|
10701
10723
|
}, []);
|
|
10702
|
-
return
|
|
10724
|
+
return import_react9.default.createElement(
|
|
10703
10725
|
"span",
|
|
10704
10726
|
null,
|
|
10705
10727
|
"\u81EA\u52A8\u6717\u8BFB\uFF1A",
|
|
@@ -10769,7 +10791,7 @@ var CSS = [
|
|
|
10769
10791
|
".dktts-pop-more{border:none;background:transparent;color:var(--dk-accent);cursor:pointer;font-size:12px;padding:2px 0;}",
|
|
10770
10792
|
".dktts-pop-more:hover{text-decoration:underline;}"
|
|
10771
10793
|
].join("\n");
|
|
10772
|
-
var
|
|
10794
|
+
var feature8 = {
|
|
10773
10795
|
id: "tts",
|
|
10774
10796
|
name: "\u8BED\u97F3\u6717\u8BFB",
|
|
10775
10797
|
order: 160,
|
|
@@ -10786,10 +10808,10 @@ var feature10 = {
|
|
|
10786
10808
|
};
|
|
10787
10809
|
|
|
10788
10810
|
// features/games/view.jsx
|
|
10789
|
-
var
|
|
10811
|
+
var import_react19 = require("react");
|
|
10790
10812
|
|
|
10791
10813
|
// features/games/games/shared.jsx
|
|
10792
|
-
var
|
|
10814
|
+
var import_react10 = require("react");
|
|
10793
10815
|
function isTypingTarget(event) {
|
|
10794
10816
|
const tag = event.target && event.target.tagName || "";
|
|
10795
10817
|
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return true;
|
|
@@ -10797,9 +10819,9 @@ function isTypingTarget(event) {
|
|
|
10797
10819
|
return false;
|
|
10798
10820
|
}
|
|
10799
10821
|
function useGameControls(stageRef, paused, onKeyDown, onKeyUp) {
|
|
10800
|
-
const pausedRef = (0,
|
|
10822
|
+
const pausedRef = (0, import_react10.useRef)(!!paused);
|
|
10801
10823
|
pausedRef.current = !!paused;
|
|
10802
|
-
(0,
|
|
10824
|
+
(0, import_react10.useEffect)(() => {
|
|
10803
10825
|
if (pausedRef.current) return;
|
|
10804
10826
|
const el = stageRef && stageRef.current;
|
|
10805
10827
|
if (!el) return;
|
|
@@ -10811,7 +10833,7 @@ function useGameControls(stageRef, paused, onKeyDown, onKeyUp) {
|
|
|
10811
10833
|
}, 60);
|
|
10812
10834
|
return () => clearTimeout(t);
|
|
10813
10835
|
}, [paused]);
|
|
10814
|
-
(0,
|
|
10836
|
+
(0, import_react10.useEffect)(() => {
|
|
10815
10837
|
const inStage = (event) => {
|
|
10816
10838
|
const el = stageRef && stageRef.current;
|
|
10817
10839
|
return !!el && (el === event.target || el.contains(event.target));
|
|
@@ -10904,7 +10926,7 @@ function playSfx(name) {
|
|
|
10904
10926
|
}
|
|
10905
10927
|
|
|
10906
10928
|
// features/games/games/tetris.jsx
|
|
10907
|
-
var
|
|
10929
|
+
var import_react11 = require("react");
|
|
10908
10930
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
10909
10931
|
var COLS = 10;
|
|
10910
10932
|
var ROWS = 20;
|
|
@@ -11065,12 +11087,12 @@ var KEY_ACTIONS = {
|
|
|
11065
11087
|
"Enter": "drop"
|
|
11066
11088
|
};
|
|
11067
11089
|
function TetrisGame(props) {
|
|
11068
|
-
const [state, setState] = (0,
|
|
11069
|
-
const [manualPause, setManualPause] = (0,
|
|
11070
|
-
const pausedRef = (0,
|
|
11090
|
+
const [state, setState] = (0, import_react11.useState)(initial);
|
|
11091
|
+
const [manualPause, setManualPause] = (0, import_react11.useState)(false);
|
|
11092
|
+
const pausedRef = (0, import_react11.useRef)(!!(props && props.paused));
|
|
11071
11093
|
pausedRef.current = !!(props && props.paused) || manualPause;
|
|
11072
|
-
const stageRef = (0,
|
|
11073
|
-
const act = (0,
|
|
11094
|
+
const stageRef = (0, import_react11.useRef)(null);
|
|
11095
|
+
const act = (0, import_react11.useCallback)((action) => setState((s) => {
|
|
11074
11096
|
if (pausedRef.current) return s;
|
|
11075
11097
|
if (action === "left") {
|
|
11076
11098
|
playSfx("move");
|
|
@@ -11092,21 +11114,21 @@ function TetrisGame(props) {
|
|
|
11092
11114
|
}
|
|
11093
11115
|
return s;
|
|
11094
11116
|
}), []);
|
|
11095
|
-
const softRef = (0,
|
|
11096
|
-
const stateRef = (0,
|
|
11117
|
+
const softRef = (0, import_react11.useRef)(null);
|
|
11118
|
+
const stateRef = (0, import_react11.useRef)(state);
|
|
11097
11119
|
stateRef.current = state;
|
|
11098
|
-
const holdIdRef = (0,
|
|
11099
|
-
const stopSoft = (0,
|
|
11120
|
+
const holdIdRef = (0, import_react11.useRef)(null);
|
|
11121
|
+
const stopSoft = (0, import_react11.useCallback)(() => {
|
|
11100
11122
|
if (softRef.current) {
|
|
11101
11123
|
clearInterval(softRef.current);
|
|
11102
11124
|
softRef.current = null;
|
|
11103
11125
|
}
|
|
11104
11126
|
}, []);
|
|
11105
|
-
(0,
|
|
11127
|
+
(0, import_react11.useEffect)(() => {
|
|
11106
11128
|
if (state.over || manualPause || props.paused) stopSoft();
|
|
11107
11129
|
return stopSoft;
|
|
11108
11130
|
}, [state.over, manualPause, props.paused, stopSoft]);
|
|
11109
|
-
const onKeyDown = (0,
|
|
11131
|
+
const onKeyDown = (0, import_react11.useCallback)((event) => {
|
|
11110
11132
|
const action = KEY_ACTIONS[event.key];
|
|
11111
11133
|
if (action) {
|
|
11112
11134
|
event.preventDefault();
|
|
@@ -11138,13 +11160,13 @@ function TetrisGame(props) {
|
|
|
11138
11160
|
setManualPause(false);
|
|
11139
11161
|
}
|
|
11140
11162
|
}, [act, stopSoft]);
|
|
11141
|
-
const onKeyUp = (0,
|
|
11163
|
+
const onKeyUp = (0, import_react11.useCallback)((event) => {
|
|
11142
11164
|
if (KEY_ACTIONS[event.key] === "down") stopSoft();
|
|
11143
11165
|
}, [stopSoft]);
|
|
11144
|
-
(0,
|
|
11166
|
+
(0, import_react11.useEffect)(() => {
|
|
11145
11167
|
if (state.over) playSfx("over");
|
|
11146
11168
|
}, [state.over]);
|
|
11147
|
-
(0,
|
|
11169
|
+
(0, import_react11.useEffect)(() => {
|
|
11148
11170
|
if (pausedRef.current || state.over) return;
|
|
11149
11171
|
const speed = Math.max(80, 720 - (state.level - 1) * 70);
|
|
11150
11172
|
const timer = setInterval(() => act("down"), speed);
|
|
@@ -11250,7 +11272,7 @@ var tetrisGame = { Game: TetrisGame, Preview: TetrisPreview, css: `
|
|
|
11250
11272
|
` };
|
|
11251
11273
|
|
|
11252
11274
|
// features/games/games/sokoban.jsx
|
|
11253
|
-
var
|
|
11275
|
+
var import_react12 = require("react");
|
|
11254
11276
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
11255
11277
|
var LEVELS = [
|
|
11256
11278
|
["######", "# #", "#@$ .#", "# #", "######"],
|
|
@@ -11345,28 +11367,28 @@ function undo(state) {
|
|
|
11345
11367
|
}
|
|
11346
11368
|
var DIRS = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1], w: [-1, 0], s: [1, 0], a: [0, -1], d: [0, 1], W: [-1, 0], S: [1, 0], A: [0, -1], D: [0, 1] };
|
|
11347
11369
|
function SokobanGame(props) {
|
|
11348
|
-
const [level, setLevel] = (0,
|
|
11349
|
-
const [state, setState] = (0,
|
|
11350
|
-
const stageRef = (0,
|
|
11351
|
-
const levelRef = (0,
|
|
11370
|
+
const [level, setLevel] = (0, import_react12.useState)(0);
|
|
11371
|
+
const [state, setState] = (0, import_react12.useState)(() => makeInitial(0));
|
|
11372
|
+
const stageRef = (0, import_react12.useRef)(null);
|
|
11373
|
+
const levelRef = (0, import_react12.useRef)(level);
|
|
11352
11374
|
levelRef.current = level;
|
|
11353
|
-
const move = (0,
|
|
11354
|
-
const prevWon = (0,
|
|
11355
|
-
(0,
|
|
11375
|
+
const move = (0, import_react12.useCallback)((dr, dc) => setState((s) => step(s, dr, dc)), []);
|
|
11376
|
+
const prevWon = (0, import_react12.useRef)(false);
|
|
11377
|
+
(0, import_react12.useEffect)(() => {
|
|
11356
11378
|
if (state.wonNew && !prevWon.current) playSfx("win");
|
|
11357
11379
|
prevWon.current = state.wonNew;
|
|
11358
11380
|
}, [state.wonNew]);
|
|
11359
|
-
const nextLevel = (0,
|
|
11381
|
+
const nextLevel = (0, import_react12.useCallback)(() => {
|
|
11360
11382
|
const n = (levelRef.current + 1) % LEVELS.length;
|
|
11361
11383
|
setLevel(n);
|
|
11362
11384
|
setState(makeInitial(n));
|
|
11363
11385
|
}, []);
|
|
11364
|
-
const pickLevel = (0,
|
|
11386
|
+
const pickLevel = (0, import_react12.useCallback)((i) => {
|
|
11365
11387
|
setLevel(i);
|
|
11366
11388
|
setState(makeInitial(i));
|
|
11367
11389
|
}, []);
|
|
11368
|
-
const reset = (0,
|
|
11369
|
-
const onKeyDown = (0,
|
|
11390
|
+
const reset = (0, import_react12.useCallback)(() => setState(makeInitial(levelRef.current)), []);
|
|
11391
|
+
const onKeyDown = (0, import_react12.useCallback)((event) => {
|
|
11370
11392
|
const d = DIRS[event.key];
|
|
11371
11393
|
if (d) {
|
|
11372
11394
|
event.preventDefault();
|
|
@@ -11451,7 +11473,7 @@ var sokobanGame = { Game: SokobanGame, Preview: SokobanPreview, css: `
|
|
|
11451
11473
|
` };
|
|
11452
11474
|
|
|
11453
11475
|
// features/games/games/gomoku.jsx
|
|
11454
|
-
var
|
|
11476
|
+
var import_react13 = require("react");
|
|
11455
11477
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
11456
11478
|
var GOMOKU_LINES = (() => {
|
|
11457
11479
|
const P = (n) => n * 100 + 50;
|
|
@@ -11568,22 +11590,22 @@ function aiMove(board) {
|
|
|
11568
11590
|
return best || [7, 7];
|
|
11569
11591
|
}
|
|
11570
11592
|
function GomokuGame(props) {
|
|
11571
|
-
const [board, setBoard] = (0,
|
|
11572
|
-
const [turn, setTurn] = (0,
|
|
11573
|
-
const [winner, setWinner] = (0,
|
|
11574
|
-
const [winCells, setWinCells] = (0,
|
|
11575
|
-
const [showResult, setShowResult] = (0,
|
|
11576
|
-
const [last, setLast] = (0,
|
|
11577
|
-
const [history, setHistory] = (0,
|
|
11578
|
-
const [thinking, setThinking] = (0,
|
|
11579
|
-
const boardRef = (0,
|
|
11580
|
-
const stageRef = (0,
|
|
11593
|
+
const [board, setBoard] = (0, import_react13.useState)(emptyBoard2);
|
|
11594
|
+
const [turn, setTurn] = (0, import_react13.useState)("b");
|
|
11595
|
+
const [winner, setWinner] = (0, import_react13.useState)(null);
|
|
11596
|
+
const [winCells, setWinCells] = (0, import_react13.useState)(null);
|
|
11597
|
+
const [showResult, setShowResult] = (0, import_react13.useState)(false);
|
|
11598
|
+
const [last, setLast] = (0, import_react13.useState)(null);
|
|
11599
|
+
const [history, setHistory] = (0, import_react13.useState)([]);
|
|
11600
|
+
const [thinking, setThinking] = (0, import_react13.useState)(false);
|
|
11601
|
+
const boardRef = (0, import_react13.useRef)(board);
|
|
11602
|
+
const stageRef = (0, import_react13.useRef)(null);
|
|
11581
11603
|
boardRef.current = board;
|
|
11582
|
-
const turnRef = (0,
|
|
11604
|
+
const turnRef = (0, import_react13.useRef)(turn);
|
|
11583
11605
|
turnRef.current = turn;
|
|
11584
|
-
const winRef = (0,
|
|
11606
|
+
const winRef = (0, import_react13.useRef)(winner);
|
|
11585
11607
|
winRef.current = winner;
|
|
11586
|
-
const finish = (0,
|
|
11608
|
+
const finish = (0, import_react13.useCallback)((b, r, c, color) => {
|
|
11587
11609
|
const line = winLine(b, r, c, color);
|
|
11588
11610
|
if (line) {
|
|
11589
11611
|
setWinner(color);
|
|
@@ -11597,7 +11619,7 @@ function GomokuGame(props) {
|
|
|
11597
11619
|
playSfx("clear");
|
|
11598
11620
|
} else playSfx("stone");
|
|
11599
11621
|
}, []);
|
|
11600
|
-
const place = (0,
|
|
11622
|
+
const place = (0, import_react13.useCallback)((r, c, color) => {
|
|
11601
11623
|
if (boardRef.current[r][c]) return false;
|
|
11602
11624
|
const next = boardRef.current.map((row) => row.slice());
|
|
11603
11625
|
next[r][c] = color;
|
|
@@ -11608,7 +11630,7 @@ function GomokuGame(props) {
|
|
|
11608
11630
|
finish(next, r, c, color);
|
|
11609
11631
|
return true;
|
|
11610
11632
|
}, [finish]);
|
|
11611
|
-
(0,
|
|
11633
|
+
(0, import_react13.useEffect)(() => {
|
|
11612
11634
|
if (turn !== "w" || winner || props.paused) return;
|
|
11613
11635
|
setThinking(true);
|
|
11614
11636
|
const t = setTimeout(() => {
|
|
@@ -11619,12 +11641,12 @@ function GomokuGame(props) {
|
|
|
11619
11641
|
}, 260);
|
|
11620
11642
|
return () => clearTimeout(t);
|
|
11621
11643
|
}, [turn, winner, props.paused, place]);
|
|
11622
|
-
const onCell = (0,
|
|
11644
|
+
const onCell = (0, import_react13.useCallback)((r, c) => {
|
|
11623
11645
|
if (winRef.current || turnRef.current !== "b" || thinking || boardRef.current[r][c]) return;
|
|
11624
11646
|
place(r, c, "b");
|
|
11625
11647
|
setTurn("w");
|
|
11626
11648
|
}, [thinking, place]);
|
|
11627
|
-
const reset = (0,
|
|
11649
|
+
const reset = (0, import_react13.useCallback)(() => {
|
|
11628
11650
|
setBoard(emptyBoard2());
|
|
11629
11651
|
setTurn("b");
|
|
11630
11652
|
setWinner(null);
|
|
@@ -11634,7 +11656,7 @@ function GomokuGame(props) {
|
|
|
11634
11656
|
setHistory([]);
|
|
11635
11657
|
setThinking(false);
|
|
11636
11658
|
}, []);
|
|
11637
|
-
const undo2 = (0,
|
|
11659
|
+
const undo2 = (0, import_react13.useCallback)(() => {
|
|
11638
11660
|
if (thinking || history.length < 2) return;
|
|
11639
11661
|
const h = history.slice(0, -2);
|
|
11640
11662
|
const next = emptyBoard2();
|
|
@@ -11648,7 +11670,7 @@ function GomokuGame(props) {
|
|
|
11648
11670
|
setShowResult(false);
|
|
11649
11671
|
setLast(h.length ? h[h.length - 1] : null);
|
|
11650
11672
|
}, [history, thinking]);
|
|
11651
|
-
const onKeyDown = (0,
|
|
11673
|
+
const onKeyDown = (0, import_react13.useCallback)((event) => {
|
|
11652
11674
|
if (event.key.toLowerCase() === "r") {
|
|
11653
11675
|
event.preventDefault();
|
|
11654
11676
|
reset();
|
|
@@ -11747,7 +11769,7 @@ var gomokuGame = { Game: GomokuGame, Preview: GomokuPreview, css: `
|
|
|
11747
11769
|
` };
|
|
11748
11770
|
|
|
11749
11771
|
// features/games/games/xiangqi.jsx
|
|
11750
|
-
var
|
|
11772
|
+
var import_react14 = require("react");
|
|
11751
11773
|
|
|
11752
11774
|
// features/games/xiangqi-core.js
|
|
11753
11775
|
var ROWS2 = 10;
|
|
@@ -12112,35 +12134,35 @@ function moveNotation(board, fr, fc, tr, tc) {
|
|
|
12112
12134
|
return pieceChar(p) + num(file(fc)) + verb + num(to);
|
|
12113
12135
|
}
|
|
12114
12136
|
function XiangqiGame(props) {
|
|
12115
|
-
const [board, setBoard] = (0,
|
|
12116
|
-
const [turn, setTurn] = (0,
|
|
12117
|
-
const [sel, setSel] = (0,
|
|
12118
|
-
const [targets, setTargets] = (0,
|
|
12119
|
-
const [over, setOver] = (0,
|
|
12120
|
-
const [check, setCheck] = (0,
|
|
12121
|
-
const [last, setLast] = (0,
|
|
12122
|
-
const [lastMove, setLastMove] = (0,
|
|
12123
|
-
const [moveLog, setMoveLog] = (0,
|
|
12124
|
-
const [moving, setMoving] = (0,
|
|
12125
|
-
const [thinking, setThinking] = (0,
|
|
12126
|
-
const [history, setHistory] = (0,
|
|
12127
|
-
const [repKeys, setRepKeys] = (0,
|
|
12128
|
-
const pushKey = (0,
|
|
12129
|
-
const stageRef = (0,
|
|
12130
|
-
const boardRef = (0,
|
|
12137
|
+
const [board, setBoard] = (0, import_react14.useState)(initialBoard);
|
|
12138
|
+
const [turn, setTurn] = (0, import_react14.useState)("r");
|
|
12139
|
+
const [sel, setSel] = (0, import_react14.useState)(null);
|
|
12140
|
+
const [targets, setTargets] = (0, import_react14.useState)([]);
|
|
12141
|
+
const [over, setOver] = (0, import_react14.useState)(null);
|
|
12142
|
+
const [check, setCheck] = (0, import_react14.useState)(false);
|
|
12143
|
+
const [last, setLast] = (0, import_react14.useState)(null);
|
|
12144
|
+
const [lastMove, setLastMove] = (0, import_react14.useState)(null);
|
|
12145
|
+
const [moveLog, setMoveLog] = (0, import_react14.useState)([]);
|
|
12146
|
+
const [moving, setMoving] = (0, import_react14.useState)(null);
|
|
12147
|
+
const [thinking, setThinking] = (0, import_react14.useState)(false);
|
|
12148
|
+
const [history, setHistory] = (0, import_react14.useState)([]);
|
|
12149
|
+
const [repKeys, setRepKeys] = (0, import_react14.useState)(() => [posKey(initialBoard())]);
|
|
12150
|
+
const pushKey = (0, import_react14.useCallback)((b) => setRepKeys((ks) => ks[ks.length - 1] === posKey(b) ? ks : ks.concat(posKey(b))), []);
|
|
12151
|
+
const stageRef = (0, import_react14.useRef)(null);
|
|
12152
|
+
const boardRef = (0, import_react14.useRef)(board);
|
|
12131
12153
|
boardRef.current = board;
|
|
12132
|
-
const turnRef = (0,
|
|
12154
|
+
const turnRef = (0, import_react14.useRef)(turn);
|
|
12133
12155
|
turnRef.current = turn;
|
|
12134
|
-
const overRef = (0,
|
|
12156
|
+
const overRef = (0, import_react14.useRef)(over);
|
|
12135
12157
|
overRef.current = over;
|
|
12136
|
-
const thinkingRef = (0,
|
|
12158
|
+
const thinkingRef = (0, import_react14.useRef)(thinking);
|
|
12137
12159
|
thinkingRef.current = thinking;
|
|
12138
|
-
const historyRef = (0,
|
|
12160
|
+
const historyRef = (0, import_react14.useRef)(history);
|
|
12139
12161
|
historyRef.current = history;
|
|
12140
|
-
const movingRef = (0,
|
|
12141
|
-
const pendingRef = (0,
|
|
12142
|
-
const animTimerRef = (0,
|
|
12143
|
-
const animateMove = (0,
|
|
12162
|
+
const movingRef = (0, import_react14.useRef)(false);
|
|
12163
|
+
const pendingRef = (0, import_react14.useRef)(null);
|
|
12164
|
+
const animTimerRef = (0, import_react14.useRef)(null);
|
|
12165
|
+
const animateMove = (0, import_react14.useCallback)((b, fr, fc, tr, tc, after) => {
|
|
12144
12166
|
const piece = boardRef.current[fr][fc];
|
|
12145
12167
|
const capture = !!boardRef.current[tr][tc];
|
|
12146
12168
|
pendingRef.current = { board: b, after };
|
|
@@ -12167,7 +12189,7 @@ function XiangqiGame(props) {
|
|
|
12167
12189
|
}
|
|
12168
12190
|
}, 260);
|
|
12169
12191
|
}, []);
|
|
12170
|
-
const restart = (0,
|
|
12192
|
+
const restart = (0, import_react14.useCallback)(() => {
|
|
12171
12193
|
if (animTimerRef.current) {
|
|
12172
12194
|
clearTimeout(animTimerRef.current);
|
|
12173
12195
|
animTimerRef.current = null;
|
|
@@ -12190,7 +12212,7 @@ function XiangqiGame(props) {
|
|
|
12190
12212
|
setMoving(null);
|
|
12191
12213
|
setRepKeys([posKey(b)]);
|
|
12192
12214
|
}, []);
|
|
12193
|
-
const undo2 = (0,
|
|
12215
|
+
const undo2 = (0, import_react14.useCallback)(() => {
|
|
12194
12216
|
if (thinkingRef.current || overRef.current || turnRef.current !== "r" || movingRef.current) return;
|
|
12195
12217
|
const h = historyRef.current;
|
|
12196
12218
|
if (h.length < 2) return;
|
|
@@ -12208,7 +12230,7 @@ function XiangqiGame(props) {
|
|
|
12208
12230
|
setCheck(inCheck(b, "r"));
|
|
12209
12231
|
setRepKeys(hist.map(posKey).concat(posKey(b)));
|
|
12210
12232
|
}, []);
|
|
12211
|
-
const moveRed = (0,
|
|
12233
|
+
const moveRed = (0, import_react14.useCallback)((tr, tc) => {
|
|
12212
12234
|
if (turnRef.current !== "r" || overRef.current || !sel || movingRef.current) return;
|
|
12213
12235
|
const fr = sel[0], fc = sel[1];
|
|
12214
12236
|
const nb = applyMove(boardRef.current, fr, fc, tr, tc);
|
|
@@ -12222,7 +12244,7 @@ function XiangqiGame(props) {
|
|
|
12222
12244
|
} else setCheck(inCheck(nb, "b"));
|
|
12223
12245
|
});
|
|
12224
12246
|
}, [sel, pushKey, animateMove]);
|
|
12225
|
-
const select = (0,
|
|
12247
|
+
const select = (0, import_react14.useCallback)((r, c) => {
|
|
12226
12248
|
if (overRef.current || turnRef.current !== "r" || thinkingRef.current || movingRef.current) return;
|
|
12227
12249
|
const p = boardRef.current[r][c];
|
|
12228
12250
|
if (p && p.c === "r") {
|
|
@@ -12238,7 +12260,7 @@ function XiangqiGame(props) {
|
|
|
12238
12260
|
setSel(null);
|
|
12239
12261
|
setTargets([]);
|
|
12240
12262
|
}, [sel, targets, moveRed]);
|
|
12241
|
-
(0,
|
|
12263
|
+
(0, import_react14.useEffect)(() => {
|
|
12242
12264
|
if (turn !== "b" || over || props.paused || movingRef.current) return;
|
|
12243
12265
|
const t = setTimeout(() => {
|
|
12244
12266
|
const seenCounts = /* @__PURE__ */ new Map();
|
|
@@ -12262,7 +12284,7 @@ function XiangqiGame(props) {
|
|
|
12262
12284
|
setThinking(true);
|
|
12263
12285
|
return () => clearTimeout(t);
|
|
12264
12286
|
}, [turn, over, props.paused, repKeys, pushKey, animateMove]);
|
|
12265
|
-
const onKeyDown = (0,
|
|
12287
|
+
const onKeyDown = (0, import_react14.useCallback)((event) => {
|
|
12266
12288
|
if (event.key.toLowerCase() === "r") {
|
|
12267
12289
|
event.preventDefault();
|
|
12268
12290
|
restart();
|
|
@@ -12273,14 +12295,14 @@ function XiangqiGame(props) {
|
|
|
12273
12295
|
}, [restart, undo2]);
|
|
12274
12296
|
useGameControls(stageRef, props.paused, onKeyDown);
|
|
12275
12297
|
const status = over === "r" ? "\u7EA2\u65B9\u80DC \xB7 \u606D\u559C" : over === "b" ? "\u9ED1\u65B9\u80DC \xB7 AI \u8D62" : moving ? moving.piece.c === "r" ? "\u7EA2\u65B9\u8D70\u5B50\u2026" : "AI \u8D70\u5B50\u2026" : thinking ? "AI \u601D\u8003\u4E2D\u2026" : check ? "\u5C06\u519B\uFF01" : turn === "r" ? "\u8F6E\u5230\u4F60\uFF08\u7EA2\u65B9\uFF09" : "\u8F6E\u5230 AI\uFF08\u9ED1\u65B9\uFF09";
|
|
12276
|
-
const prevCheck = (0,
|
|
12277
|
-
(0,
|
|
12298
|
+
const prevCheck = (0, import_react14.useRef)(false);
|
|
12299
|
+
(0, import_react14.useEffect)(() => {
|
|
12278
12300
|
if (over === "r") playSfx("win");
|
|
12279
12301
|
else if (over === "b") playSfx("over");
|
|
12280
12302
|
else if (!thinking && check && !prevCheck.current) playSfx("check");
|
|
12281
12303
|
prevCheck.current = !thinking && check;
|
|
12282
12304
|
}, [check, thinking, over]);
|
|
12283
|
-
(0,
|
|
12305
|
+
(0, import_react14.useEffect)(() => () => {
|
|
12284
12306
|
if (animTimerRef.current) clearTimeout(animTimerRef.current);
|
|
12285
12307
|
}, []);
|
|
12286
12308
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "dgame-game", "aria-label": "\u8C61\u68CB", children: [
|
|
@@ -12385,7 +12407,7 @@ var xiangqiGame = { Game: XiangqiGame, Preview: XiangqiPreview, css: `
|
|
|
12385
12407
|
` };
|
|
12386
12408
|
|
|
12387
12409
|
// features/games/games/snake.jsx
|
|
12388
|
-
var
|
|
12410
|
+
var import_react15 = require("react");
|
|
12389
12411
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
12390
12412
|
var SIZE2 = 16;
|
|
12391
12413
|
var DIRS3 = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1], w: [-1, 0], s: [1, 0], a: [0, -1], d: [0, 1], W: [-1, 0], S: [1, 0], A: [0, -1], D: [0, 1] };
|
|
@@ -12430,26 +12452,26 @@ function step2(state, dir) {
|
|
|
12430
12452
|
return Object.assign({}, state, { snake });
|
|
12431
12453
|
}
|
|
12432
12454
|
function SnakeGame(props) {
|
|
12433
|
-
const [state, setState] = (0,
|
|
12434
|
-
const [paused, setPaused] = (0,
|
|
12435
|
-
const [speedMode, setSpeedMode] = (0,
|
|
12436
|
-
const stageRef = (0,
|
|
12437
|
-
const dirRef = (0,
|
|
12438
|
-
const overRef = (0,
|
|
12455
|
+
const [state, setState] = (0, import_react15.useState)(initial2);
|
|
12456
|
+
const [paused, setPaused] = (0, import_react15.useState)(false);
|
|
12457
|
+
const [speedMode, setSpeedMode] = (0, import_react15.useState)(loadSpeedMode);
|
|
12458
|
+
const stageRef = (0, import_react15.useRef)(null);
|
|
12459
|
+
const dirRef = (0, import_react15.useRef)(state.dir);
|
|
12460
|
+
const overRef = (0, import_react15.useRef)(state.over);
|
|
12439
12461
|
overRef.current = state.over;
|
|
12440
|
-
const pausedRef = (0,
|
|
12462
|
+
const pausedRef = (0, import_react15.useRef)(!!(props && props.paused) || paused);
|
|
12441
12463
|
pausedRef.current = !!(props && props.paused) || paused;
|
|
12442
|
-
const start = (0,
|
|
12464
|
+
const start = (0, import_react15.useCallback)(() => {
|
|
12443
12465
|
const init = initial2();
|
|
12444
12466
|
init.started = true;
|
|
12445
12467
|
dirRef.current = init.dir;
|
|
12446
12468
|
setState(init);
|
|
12447
12469
|
setPaused(false);
|
|
12448
12470
|
}, []);
|
|
12449
|
-
const begin = (0,
|
|
12471
|
+
const begin = (0, import_react15.useCallback)(() => {
|
|
12450
12472
|
setState((s) => s.started || s.over ? s : Object.assign({}, s, { started: true }));
|
|
12451
12473
|
}, []);
|
|
12452
|
-
const changeDir = (0,
|
|
12474
|
+
const changeDir = (0, import_react15.useCallback)((nv) => {
|
|
12453
12475
|
if (overRef.current || pausedRef.current) return;
|
|
12454
12476
|
const cur = dirRef.current;
|
|
12455
12477
|
const opp = OPPOSITE[cur[0] + "," + cur[1]];
|
|
@@ -12457,24 +12479,24 @@ function SnakeGame(props) {
|
|
|
12457
12479
|
dirRef.current = nv;
|
|
12458
12480
|
begin();
|
|
12459
12481
|
}, [begin]);
|
|
12460
|
-
(0,
|
|
12482
|
+
(0, import_react15.useEffect)(() => {
|
|
12461
12483
|
if (state.over) playSfx("over");
|
|
12462
12484
|
}, [state.over]);
|
|
12463
|
-
(0,
|
|
12485
|
+
(0, import_react15.useEffect)(() => {
|
|
12464
12486
|
if (!state.started || state.over || pausedRef.current) return;
|
|
12465
12487
|
const mode = SPEED_MODES[speedMode] || SPEED_MODES.slow;
|
|
12466
12488
|
const speed = Math.max(mode.min, mode.base - state.score * mode.stepMs);
|
|
12467
12489
|
const timer = setInterval(() => setState((s) => s.over || !s.started || pausedRef.current ? s : step2(s, dirRef.current)), speed);
|
|
12468
12490
|
return () => clearInterval(timer);
|
|
12469
12491
|
}, [state.started, state.over, state.score, props.paused, paused, speedMode]);
|
|
12470
|
-
const pickSpeed = (0,
|
|
12492
|
+
const pickSpeed = (0, import_react15.useCallback)((m) => {
|
|
12471
12493
|
setSpeedMode(m);
|
|
12472
12494
|
try {
|
|
12473
12495
|
localStorage.setItem("dsh-dock.snake.speed", m);
|
|
12474
12496
|
} catch {
|
|
12475
12497
|
}
|
|
12476
12498
|
}, []);
|
|
12477
|
-
const onKeyDown = (0,
|
|
12499
|
+
const onKeyDown = (0, import_react15.useCallback)((event) => {
|
|
12478
12500
|
const d = DIRS3[event.key];
|
|
12479
12501
|
if (d) {
|
|
12480
12502
|
event.preventDefault();
|
|
@@ -12574,7 +12596,7 @@ var snakeGame = { Game: SnakeGame, Preview: SnakePreview, css: `
|
|
|
12574
12596
|
` };
|
|
12575
12597
|
|
|
12576
12598
|
// features/games/games/breakout.jsx
|
|
12577
|
-
var
|
|
12599
|
+
var import_react16 = require("react");
|
|
12578
12600
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
12579
12601
|
var W = 320;
|
|
12580
12602
|
var H = 360;
|
|
@@ -12654,22 +12676,22 @@ function collideRect(x, y, r, bx, by, bw, bh) {
|
|
|
12654
12676
|
return dx * dx + dy * dy < r * r;
|
|
12655
12677
|
}
|
|
12656
12678
|
function BreakoutGame(props) {
|
|
12657
|
-
const canvasRef = (0,
|
|
12658
|
-
const [score, setScore] = (0,
|
|
12659
|
-
const [lives, setLives] = (0,
|
|
12660
|
-
const [level, setLevel] = (0,
|
|
12661
|
-
const [status, setStatus] = (0,
|
|
12662
|
-
const keys = (0,
|
|
12663
|
-
const pausedRef = (0,
|
|
12679
|
+
const canvasRef = (0, import_react16.useRef)(null);
|
|
12680
|
+
const [score, setScore] = (0, import_react16.useState)(0);
|
|
12681
|
+
const [lives, setLives] = (0, import_react16.useState)(3);
|
|
12682
|
+
const [level, setLevel] = (0, import_react16.useState)(1);
|
|
12683
|
+
const [status, setStatus] = (0, import_react16.useState)("play");
|
|
12684
|
+
const keys = (0, import_react16.useRef)({});
|
|
12685
|
+
const pausedRef = (0, import_react16.useRef)(!!(props && props.paused));
|
|
12664
12686
|
pausedRef.current = !!(props && props.paused);
|
|
12665
|
-
const game = (0,
|
|
12666
|
-
const scoreRef = (0,
|
|
12687
|
+
const game = (0, import_react16.useRef)(null);
|
|
12688
|
+
const scoreRef = (0, import_react16.useRef)(0);
|
|
12667
12689
|
scoreRef.current = score;
|
|
12668
|
-
const statusRef = (0,
|
|
12690
|
+
const statusRef = (0, import_react16.useRef)("play");
|
|
12669
12691
|
statusRef.current = status;
|
|
12670
|
-
const livesRef = (0,
|
|
12692
|
+
const livesRef = (0, import_react16.useRef)(3);
|
|
12671
12693
|
livesRef.current = lives;
|
|
12672
|
-
const start = (0,
|
|
12694
|
+
const start = (0, import_react16.useCallback)((lvl) => {
|
|
12673
12695
|
const bricks = makeBricks(lvl);
|
|
12674
12696
|
game.current = {
|
|
12675
12697
|
stars: Array.from({ length: 46 }, () => ({ x: Math.random() * W, y: Math.random() * H, a: 0.25 + Math.random() * 0.5 })),
|
|
@@ -12679,20 +12701,20 @@ function BreakoutGame(props) {
|
|
|
12679
12701
|
speed: SPEED * (1 + (lvl - 1) * 0.09)
|
|
12680
12702
|
};
|
|
12681
12703
|
}, []);
|
|
12682
|
-
(0,
|
|
12704
|
+
(0, import_react16.useEffect)(() => {
|
|
12683
12705
|
start(1);
|
|
12684
12706
|
setScore(0);
|
|
12685
12707
|
setLives(3);
|
|
12686
12708
|
setStatus("play");
|
|
12687
12709
|
}, [start]);
|
|
12688
|
-
const launchBall = (0,
|
|
12710
|
+
const launchBall = (0, import_react16.useCallback)(() => {
|
|
12689
12711
|
const g = game.current;
|
|
12690
12712
|
if (!g) return;
|
|
12691
12713
|
g.ball.vx = (Math.random() > 0.5 ? 1 : -1) * SPEED;
|
|
12692
12714
|
g.ball.vy = -SPEED;
|
|
12693
12715
|
g.launched = true;
|
|
12694
12716
|
}, []);
|
|
12695
|
-
const resetBall = (0,
|
|
12717
|
+
const resetBall = (0, import_react16.useCallback)(() => {
|
|
12696
12718
|
const g = game.current;
|
|
12697
12719
|
if (g) {
|
|
12698
12720
|
g.ball.x = W / 2;
|
|
@@ -12702,7 +12724,7 @@ function BreakoutGame(props) {
|
|
|
12702
12724
|
g.launched = false;
|
|
12703
12725
|
}
|
|
12704
12726
|
}, []);
|
|
12705
|
-
(0,
|
|
12727
|
+
(0, import_react16.useEffect)(() => {
|
|
12706
12728
|
const frame = () => {
|
|
12707
12729
|
const g = game.current;
|
|
12708
12730
|
const ctx = canvasRef.current && canvasRef.current.getContext("2d");
|
|
@@ -12788,7 +12810,7 @@ function BreakoutGame(props) {
|
|
|
12788
12810
|
});
|
|
12789
12811
|
return () => cancelAnimationFrame(raf);
|
|
12790
12812
|
}, [resetBall]);
|
|
12791
|
-
const onKeyDown = (0,
|
|
12813
|
+
const onKeyDown = (0, import_react16.useCallback)((event) => {
|
|
12792
12814
|
if (pausedRef.current) return;
|
|
12793
12815
|
if (event.key === "ArrowLeft") {
|
|
12794
12816
|
event.preventDefault();
|
|
@@ -12809,11 +12831,11 @@ function BreakoutGame(props) {
|
|
|
12809
12831
|
livesRef.current = 3;
|
|
12810
12832
|
}
|
|
12811
12833
|
}, [launchBall, start]);
|
|
12812
|
-
const onKeyUp = (0,
|
|
12834
|
+
const onKeyUp = (0, import_react16.useCallback)((event) => {
|
|
12813
12835
|
if (event.key === "ArrowLeft") keys.current.left = false;
|
|
12814
12836
|
else if (event.key === "ArrowRight") keys.current.right = false;
|
|
12815
12837
|
}, []);
|
|
12816
|
-
const onPointerMove = (0,
|
|
12838
|
+
const onPointerMove = (0, import_react16.useCallback)((e) => {
|
|
12817
12839
|
const g = game.current, cv = canvasRef.current;
|
|
12818
12840
|
if (!g || !cv) return;
|
|
12819
12841
|
const rect2 = cv.getBoundingClientRect();
|
|
@@ -12905,7 +12927,7 @@ var breakoutGame = { Game: BreakoutGame, Preview: BreakoutPreview, css: `
|
|
|
12905
12927
|
` };
|
|
12906
12928
|
|
|
12907
12929
|
// features/games/games/racer.jsx
|
|
12908
|
-
var
|
|
12930
|
+
var import_react17 = require("react");
|
|
12909
12931
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
12910
12932
|
var W2 = 300;
|
|
12911
12933
|
var H2 = 420;
|
|
@@ -12932,15 +12954,15 @@ function rect(ctx, x, y, w, h, r, fill) {
|
|
|
12932
12954
|
ctx.fill();
|
|
12933
12955
|
}
|
|
12934
12956
|
function RacerGame(props) {
|
|
12935
|
-
const canvasRef = (0,
|
|
12936
|
-
const [status, setStatus] = (0,
|
|
12937
|
-
const game = (0,
|
|
12938
|
-
const keys = (0,
|
|
12939
|
-
const statusRef = (0,
|
|
12957
|
+
const canvasRef = (0, import_react17.useRef)(null);
|
|
12958
|
+
const [status, setStatus] = (0, import_react17.useState)("play");
|
|
12959
|
+
const game = (0, import_react17.useRef)(null);
|
|
12960
|
+
const keys = (0, import_react17.useRef)({});
|
|
12961
|
+
const statusRef = (0, import_react17.useRef)("play");
|
|
12940
12962
|
statusRef.current = status;
|
|
12941
|
-
const pausedRef = (0,
|
|
12963
|
+
const pausedRef = (0, import_react17.useRef)(!!(props && props.paused));
|
|
12942
12964
|
pausedRef.current = !!(props && props.paused);
|
|
12943
|
-
const reset = (0,
|
|
12965
|
+
const reset = (0, import_react17.useCallback)(() => {
|
|
12944
12966
|
game.current = {
|
|
12945
12967
|
stars: Array.from({ length: 50 }, () => ({ x: Math.random() * W2, y: Math.random() * H2, a: 0.2 + Math.random() * 0.5 })),
|
|
12946
12968
|
player: { x: laneX(1), y: H2 - CAR_H - 16, w: CAR_W, h: CAR_H },
|
|
@@ -12954,15 +12976,15 @@ function RacerGame(props) {
|
|
|
12954
12976
|
over: false
|
|
12955
12977
|
};
|
|
12956
12978
|
}, []);
|
|
12957
|
-
(0,
|
|
12979
|
+
(0, import_react17.useEffect)(() => {
|
|
12958
12980
|
reset();
|
|
12959
12981
|
setStatus("play");
|
|
12960
12982
|
}, [reset]);
|
|
12961
|
-
const launch = (0,
|
|
12983
|
+
const launch = (0, import_react17.useCallback)(() => {
|
|
12962
12984
|
reset();
|
|
12963
12985
|
setStatus("play");
|
|
12964
12986
|
}, [reset]);
|
|
12965
|
-
(0,
|
|
12987
|
+
(0, import_react17.useEffect)(() => {
|
|
12966
12988
|
const draw2 = () => {
|
|
12967
12989
|
const g = game.current, ctx = canvasRef.current && canvasRef.current.getContext("2d");
|
|
12968
12990
|
if (!g || !ctx) return;
|
|
@@ -13064,7 +13086,7 @@ function RacerGame(props) {
|
|
|
13064
13086
|
});
|
|
13065
13087
|
return () => cancelAnimationFrame(raf);
|
|
13066
13088
|
}, []);
|
|
13067
|
-
const onKeyDown = (0,
|
|
13089
|
+
const onKeyDown = (0, import_react17.useCallback)((event) => {
|
|
13068
13090
|
if (pausedRef.current) return;
|
|
13069
13091
|
if (event.key === "ArrowLeft") {
|
|
13070
13092
|
event.preventDefault();
|
|
@@ -13077,11 +13099,11 @@ function RacerGame(props) {
|
|
|
13077
13099
|
launch();
|
|
13078
13100
|
}
|
|
13079
13101
|
}, [launch]);
|
|
13080
|
-
const onKeyUp = (0,
|
|
13102
|
+
const onKeyUp = (0, import_react17.useCallback)((event) => {
|
|
13081
13103
|
if (event.key === "ArrowLeft") keys.current.left = false;
|
|
13082
13104
|
else if (event.key === "ArrowRight") keys.current.right = false;
|
|
13083
13105
|
}, []);
|
|
13084
|
-
const onPointerMove = (0,
|
|
13106
|
+
const onPointerMove = (0, import_react17.useCallback)((e) => {
|
|
13085
13107
|
const g = game.current, cv = canvasRef.current;
|
|
13086
13108
|
if (!g || !cv) return;
|
|
13087
13109
|
const rect0 = cv.getBoundingClientRect();
|
|
@@ -13142,7 +13164,7 @@ var racerGame = { Game: RacerGame, Preview: RacerPreview, css: `
|
|
|
13142
13164
|
` };
|
|
13143
13165
|
|
|
13144
13166
|
// features/games/games/tank.jsx
|
|
13145
|
-
var
|
|
13167
|
+
var import_react18 = require("react");
|
|
13146
13168
|
|
|
13147
13169
|
// features/games/tank-core.js
|
|
13148
13170
|
var GRID = 15;
|
|
@@ -13350,27 +13372,27 @@ var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
|
13350
13372
|
var DIR_ANGLE = { up: 0, right: 90, down: 180, left: 270 };
|
|
13351
13373
|
var ENEMY_COLORS = ["#f87171", "#fb923c", "#c084fc", "#4ade80", "#38bdf8"];
|
|
13352
13374
|
function TankGame(props) {
|
|
13353
|
-
const [snap, setSnap] = (0,
|
|
13354
|
-
const [status, setStatus] = (0,
|
|
13355
|
-
const snapRef = (0,
|
|
13375
|
+
const [snap, setSnap] = (0, import_react18.useState)(initialState);
|
|
13376
|
+
const [status, setStatus] = (0, import_react18.useState)("play");
|
|
13377
|
+
const snapRef = (0, import_react18.useRef)(snap);
|
|
13356
13378
|
snapRef.current = snap;
|
|
13357
|
-
const keys = (0,
|
|
13358
|
-
const pausedRef = (0,
|
|
13379
|
+
const keys = (0, import_react18.useRef)({ dir: null, shoot: false });
|
|
13380
|
+
const pausedRef = (0, import_react18.useRef)(!!(props && props.paused));
|
|
13359
13381
|
pausedRef.current = !!(props && props.paused);
|
|
13360
|
-
const statusRef = (0,
|
|
13382
|
+
const statusRef = (0, import_react18.useRef)("play");
|
|
13361
13383
|
statusRef.current = status;
|
|
13362
|
-
const boardRef = (0,
|
|
13363
|
-
const start = (0,
|
|
13384
|
+
const boardRef = (0, import_react18.useRef)(null);
|
|
13385
|
+
const start = (0, import_react18.useCallback)(() => {
|
|
13364
13386
|
setSnap(initialState());
|
|
13365
13387
|
setStatus("play");
|
|
13366
13388
|
statusRef.current = "play";
|
|
13367
13389
|
}, []);
|
|
13368
|
-
const nextLvl = (0,
|
|
13390
|
+
const nextLvl = (0, import_react18.useCallback)(() => {
|
|
13369
13391
|
setSnap((s) => nextWave(s));
|
|
13370
13392
|
setStatus("play");
|
|
13371
13393
|
statusRef.current = "play";
|
|
13372
13394
|
}, []);
|
|
13373
|
-
(0,
|
|
13395
|
+
(0, import_react18.useEffect)(() => {
|
|
13374
13396
|
const timer = setInterval(() => {
|
|
13375
13397
|
if (pausedRef.current) return;
|
|
13376
13398
|
setSnap((s) => {
|
|
@@ -13389,8 +13411,8 @@ function TankGame(props) {
|
|
|
13389
13411
|
}, 120);
|
|
13390
13412
|
return () => clearInterval(timer);
|
|
13391
13413
|
}, []);
|
|
13392
|
-
const stageRef = (0,
|
|
13393
|
-
const onKeyDown = (0,
|
|
13414
|
+
const stageRef = (0, import_react18.useRef)(null);
|
|
13415
|
+
const onKeyDown = (0, import_react18.useCallback)((event) => {
|
|
13394
13416
|
if (pausedRef.current) return;
|
|
13395
13417
|
const map = { ArrowUp: "up", ArrowDown: "down", ArrowLeft: "left", ArrowRight: "right", w: "up", s: "down", a: "left", d: "right", W: "up", S: "down", A: "left", D: "right" };
|
|
13396
13418
|
const dir = map[event.key];
|
|
@@ -13407,7 +13429,7 @@ function TankGame(props) {
|
|
|
13407
13429
|
start();
|
|
13408
13430
|
}
|
|
13409
13431
|
}, [start]);
|
|
13410
|
-
const onKeyUp = (0,
|
|
13432
|
+
const onKeyUp = (0, import_react18.useCallback)((event) => {
|
|
13411
13433
|
const map = { ArrowUp: "up", ArrowDown: "down", ArrowLeft: "left", ArrowRight: "right", w: "up", s: "down", a: "left", d: "right", W: "up", S: "down", A: "left", D: "right" };
|
|
13412
13434
|
const dir = map[event.key];
|
|
13413
13435
|
if (dir && keys.current.dir === dir) keys.current.dir = null;
|
|
@@ -13549,8 +13571,8 @@ function initialDash() {
|
|
|
13549
13571
|
return { lane: 1, rocks: [], score: 0, shield: 3, running: true, nextId: 1 };
|
|
13550
13572
|
}
|
|
13551
13573
|
function useTaskPulse() {
|
|
13552
|
-
const [status, setStatus] = (0,
|
|
13553
|
-
const refresh = (0,
|
|
13574
|
+
const [status, setStatus] = (0, import_react19.useState)({ loading: true, active: [], error: false });
|
|
13575
|
+
const refresh = (0, import_react19.useCallback)(() => fetch("dsh-dock/animation/status", {
|
|
13554
13576
|
method: "POST",
|
|
13555
13577
|
headers: { "content-type": "application/json" },
|
|
13556
13578
|
body: "{}"
|
|
@@ -13558,7 +13580,7 @@ function useTaskPulse() {
|
|
|
13558
13580
|
if (!payload || !payload.ok) throw new Error("status unavailable");
|
|
13559
13581
|
setStatus({ loading: false, active: Array.isArray(payload.data && payload.data.active) ? payload.data.active : [], error: false });
|
|
13560
13582
|
}).catch(() => setStatus((current) => ({ loading: false, active: current.active || [], error: true }))), []);
|
|
13561
|
-
(0,
|
|
13583
|
+
(0, import_react19.useEffect)(() => {
|
|
13562
13584
|
refresh();
|
|
13563
13585
|
const timer = setInterval(refresh, 2600);
|
|
13564
13586
|
return () => clearInterval(timer);
|
|
@@ -13566,14 +13588,14 @@ function useTaskPulse() {
|
|
|
13566
13588
|
return status;
|
|
13567
13589
|
}
|
|
13568
13590
|
function DashGame(props) {
|
|
13569
|
-
const [dash, setDash] = (0,
|
|
13570
|
-
const pausedRef = (0,
|
|
13591
|
+
const [dash, setDash] = (0, import_react19.useState)(initialDash);
|
|
13592
|
+
const pausedRef = (0, import_react19.useRef)(!!(props && props.paused));
|
|
13571
13593
|
pausedRef.current = !!(props && props.paused);
|
|
13572
|
-
const move = (0,
|
|
13594
|
+
const move = (0, import_react19.useCallback)((delta) => setDash((current) => Object.assign({}, current, {
|
|
13573
13595
|
lane: Math.max(0, Math.min(LANES - 1, current.lane + delta))
|
|
13574
13596
|
})), []);
|
|
13575
|
-
const stageRef = (0,
|
|
13576
|
-
const onKeyDown = (0,
|
|
13597
|
+
const stageRef = (0, import_react19.useRef)(null);
|
|
13598
|
+
const onKeyDown = (0, import_react19.useCallback)((event) => {
|
|
13577
13599
|
if (event.key === "ArrowLeft" || event.key.toLowerCase() === "a") {
|
|
13578
13600
|
event.preventDefault();
|
|
13579
13601
|
move(-1);
|
|
@@ -13586,7 +13608,7 @@ function DashGame(props) {
|
|
|
13586
13608
|
}
|
|
13587
13609
|
}, [move, dash.running]);
|
|
13588
13610
|
useGameControls(stageRef, props.paused, onKeyDown);
|
|
13589
|
-
(0,
|
|
13611
|
+
(0, import_react19.useEffect)(() => {
|
|
13590
13612
|
const timer = setInterval(() => {
|
|
13591
13613
|
if (pausedRef.current || typeof document !== "undefined" && document.hidden) return;
|
|
13592
13614
|
setDash((current) => {
|
|
@@ -13663,10 +13685,10 @@ function DashGame(props) {
|
|
|
13663
13685
|
] });
|
|
13664
13686
|
}
|
|
13665
13687
|
function ReactorGame(props) {
|
|
13666
|
-
const [cells, setCells] = (0,
|
|
13667
|
-
const [moves, setMoves] = (0,
|
|
13668
|
-
const [cursor, setCursor] = (0,
|
|
13669
|
-
const gridRef = (0,
|
|
13688
|
+
const [cells, setCells] = (0, import_react19.useState)(makeReactor);
|
|
13689
|
+
const [moves, setMoves] = (0, import_react19.useState)(0);
|
|
13690
|
+
const [cursor, setCursor] = (0, import_react19.useState)(4);
|
|
13691
|
+
const gridRef = (0, import_react19.useRef)(null);
|
|
13670
13692
|
const solved = cells.every(Boolean);
|
|
13671
13693
|
const toggle = (index) => {
|
|
13672
13694
|
if (solved) return;
|
|
@@ -13876,8 +13898,8 @@ var gamesBus = {
|
|
|
13876
13898
|
}
|
|
13877
13899
|
};
|
|
13878
13900
|
function useGameWin() {
|
|
13879
|
-
const [state, setState] = (0,
|
|
13880
|
-
(0,
|
|
13901
|
+
const [state, setState] = (0, import_react19.useState)(gamesBus.state);
|
|
13902
|
+
(0, import_react19.useEffect)(() => gamesBus.subscribe(() => setState(gamesBus.state)), []);
|
|
13881
13903
|
return state;
|
|
13882
13904
|
}
|
|
13883
13905
|
var CATS = [
|
|
@@ -13993,12 +14015,12 @@ function snapFabX(side) {
|
|
|
13993
14015
|
function GameWindow(props) {
|
|
13994
14016
|
const game = props.game;
|
|
13995
14017
|
const status = useTaskPulse();
|
|
13996
|
-
const [win, setWin] = (0,
|
|
13997
|
-
const winRef = (0,
|
|
14018
|
+
const [win, setWin] = (0, import_react19.useState)(() => typeof window === "undefined" ? { mode: "normal", x: 14, y: 14, w: 470, h: 600 } : restoreWinGeom());
|
|
14019
|
+
const winRef = (0, import_react19.useRef)(win);
|
|
13998
14020
|
winRef.current = win;
|
|
13999
|
-
const pickerRef = (0,
|
|
14021
|
+
const pickerRef = (0, import_react19.useRef)(props.picker);
|
|
14000
14022
|
pickerRef.current = props.picker;
|
|
14001
|
-
(0,
|
|
14023
|
+
(0, import_react19.useEffect)(() => {
|
|
14002
14024
|
const onKey = (e) => {
|
|
14003
14025
|
if (e.key !== "Escape") return;
|
|
14004
14026
|
if (pickerRef.current) gamesBus.closePicker();
|
|
@@ -14086,12 +14108,12 @@ function GameWindow(props) {
|
|
|
14086
14108
|
] });
|
|
14087
14109
|
}
|
|
14088
14110
|
function GameFab(props) {
|
|
14089
|
-
const [pos, setPos] = (0,
|
|
14090
|
-
const [dragging, setDragging] = (0,
|
|
14091
|
-
const dragRef = (0,
|
|
14092
|
-
const clickBlockRef = (0,
|
|
14093
|
-
const sideRef = (0,
|
|
14094
|
-
(0,
|
|
14111
|
+
const [pos, setPos] = (0, import_react19.useState)(null);
|
|
14112
|
+
const [dragging, setDragging] = (0, import_react19.useState)(false);
|
|
14113
|
+
const dragRef = (0, import_react19.useRef)(null);
|
|
14114
|
+
const clickBlockRef = (0, import_react19.useRef)(false);
|
|
14115
|
+
const sideRef = (0, import_react19.useRef)("left");
|
|
14116
|
+
(0, import_react19.useEffect)(() => {
|
|
14095
14117
|
if (typeof window === "undefined") return;
|
|
14096
14118
|
let next = { side: "left", y: Math.round(window.innerHeight * 0.34) };
|
|
14097
14119
|
try {
|
|
@@ -14106,7 +14128,7 @@ function GameFab(props) {
|
|
|
14106
14128
|
y: Math.min(Math.max(8, next.y), Math.max(8, window.innerHeight - FAB_H - 8))
|
|
14107
14129
|
});
|
|
14108
14130
|
}, []);
|
|
14109
|
-
(0,
|
|
14131
|
+
(0, import_react19.useEffect)(() => {
|
|
14110
14132
|
if (typeof window === "undefined") return;
|
|
14111
14133
|
const update = () => {
|
|
14112
14134
|
if (dragRef.current) return;
|
|
@@ -14201,8 +14223,8 @@ function GamepadIcon(props) {
|
|
|
14201
14223
|
}
|
|
14202
14224
|
function GamesOverlay() {
|
|
14203
14225
|
const winState = useGameWin();
|
|
14204
|
-
const [panelOpen, setPanelOpen2] = (0,
|
|
14205
|
-
(0,
|
|
14226
|
+
const [panelOpen, setPanelOpen2] = (0, import_react19.useState)(panelNav.open);
|
|
14227
|
+
(0, import_react19.useEffect)(() => {
|
|
14206
14228
|
setPanelOpen2(panelNav.open);
|
|
14207
14229
|
return subscribePanel(() => setPanelOpen2(panelNav.open));
|
|
14208
14230
|
}, []);
|
|
@@ -14305,7 +14327,7 @@ var dgcovGroupCss = `
|
|
|
14305
14327
|
|
|
14306
14328
|
`;
|
|
14307
14329
|
var css5 = [baseCss, tetrisGame.css, sokobanGame.css, gomokuGame.css, xiangqiGame.css, snakeGame.css, breakoutGame.css, racerGame.css, tankGame.css, dgcovGroupCss].filter(Boolean).join("\n");
|
|
14308
|
-
var
|
|
14330
|
+
var feature9 = {
|
|
14309
14331
|
id: "games",
|
|
14310
14332
|
name: "\u8DA3\u5473\u6E38\u620F",
|
|
14311
14333
|
order: 135,
|
|
@@ -14319,7 +14341,7 @@ var feature11 = {
|
|
|
14319
14341
|
};
|
|
14320
14342
|
|
|
14321
14343
|
// features/mobile-relay/view.jsx
|
|
14322
|
-
var
|
|
14344
|
+
var import_react20 = require("react");
|
|
14323
14345
|
var import_qrcode = __toESM(require_browser(), 1);
|
|
14324
14346
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
14325
14347
|
function rpc(method, payload) {
|
|
@@ -14356,8 +14378,8 @@ function RelayIcon({ name, size = 18 }) {
|
|
|
14356
14378
|
] });
|
|
14357
14379
|
}
|
|
14358
14380
|
function useCompact() {
|
|
14359
|
-
const [compact, setCompact] = (0,
|
|
14360
|
-
(0,
|
|
14381
|
+
const [compact, setCompact] = (0, import_react20.useState)(() => typeof window !== "undefined" && window.matchMedia("(max-width: 680px)").matches);
|
|
14382
|
+
(0, import_react20.useEffect)(() => {
|
|
14361
14383
|
const media = window.matchMedia("(max-width: 680px)");
|
|
14362
14384
|
const update = () => setCompact(media.matches);
|
|
14363
14385
|
update();
|
|
@@ -14368,23 +14390,23 @@ function useCompact() {
|
|
|
14368
14390
|
}
|
|
14369
14391
|
function RemoteCard() {
|
|
14370
14392
|
const compact = useCompact();
|
|
14371
|
-
const [lan, setLan] = (0,
|
|
14372
|
-
const [username, setUsername] = (0,
|
|
14373
|
-
const [password, setPassword] = (0,
|
|
14374
|
-
const [newPassword, setNewPassword] = (0,
|
|
14375
|
-
const [port, setPort] = (0,
|
|
14376
|
-
const [address, setAddress] = (0,
|
|
14377
|
-
const [qr, setQr] = (0,
|
|
14378
|
-
const [busy, setBusy] = (0,
|
|
14379
|
-
const [message, setMessage] = (0,
|
|
14380
|
-
const [messageKind, setMessageKind] = (0,
|
|
14381
|
-
const [changing, setChanging] = (0,
|
|
14382
|
-
const [remote, setRemote] = (0,
|
|
14383
|
-
const notify = (0,
|
|
14393
|
+
const [lan, setLan] = (0, import_react20.useState)(null);
|
|
14394
|
+
const [username, setUsername] = (0, import_react20.useState)("");
|
|
14395
|
+
const [password, setPassword] = (0, import_react20.useState)("");
|
|
14396
|
+
const [newPassword, setNewPassword] = (0, import_react20.useState)("");
|
|
14397
|
+
const [port, setPort] = (0, import_react20.useState)("");
|
|
14398
|
+
const [address, setAddress] = (0, import_react20.useState)("");
|
|
14399
|
+
const [qr, setQr] = (0, import_react20.useState)("");
|
|
14400
|
+
const [busy, setBusy] = (0, import_react20.useState)("");
|
|
14401
|
+
const [message, setMessage] = (0, import_react20.useState)("");
|
|
14402
|
+
const [messageKind, setMessageKind] = (0, import_react20.useState)("error");
|
|
14403
|
+
const [changing, setChanging] = (0, import_react20.useState)(false);
|
|
14404
|
+
const [remote, setRemote] = (0, import_react20.useState)(false);
|
|
14405
|
+
const notify = (0, import_react20.useCallback)((text, kind) => {
|
|
14384
14406
|
setMessage(text);
|
|
14385
14407
|
setMessageKind(kind || "error");
|
|
14386
14408
|
}, []);
|
|
14387
|
-
const refresh = (0,
|
|
14409
|
+
const refresh = (0, import_react20.useCallback)(async () => {
|
|
14388
14410
|
try {
|
|
14389
14411
|
const data = await rpc("lan");
|
|
14390
14412
|
setLan(data);
|
|
@@ -14394,19 +14416,19 @@ function RemoteCard() {
|
|
|
14394
14416
|
notify(e && e.message ? e.message : String(e));
|
|
14395
14417
|
}
|
|
14396
14418
|
}, [notify]);
|
|
14397
|
-
(0,
|
|
14419
|
+
(0, import_react20.useEffect)(() => {
|
|
14398
14420
|
refresh();
|
|
14399
14421
|
const timer = setInterval(refresh, 3e3);
|
|
14400
14422
|
return () => clearInterval(timer);
|
|
14401
14423
|
}, [refresh]);
|
|
14402
|
-
(0,
|
|
14424
|
+
(0, import_react20.useEffect)(() => {
|
|
14403
14425
|
fetch("/__dsh_auth/health", { method: "POST" }).then((r) => setRemote(Boolean(r.ok))).catch(() => setRemote(false));
|
|
14404
14426
|
}, []);
|
|
14405
14427
|
const active = Boolean(lan && lan.gatewayActive);
|
|
14406
14428
|
const gatewayPort = lan && lan.gatewayPort ? lan.gatewayPort : 3081;
|
|
14407
14429
|
const suggestedPort = lan && lan.mainPort ? lan.mainPort + 1 : gatewayPort;
|
|
14408
|
-
const lanLink = (0,
|
|
14409
|
-
(0,
|
|
14430
|
+
const lanLink = (0, import_react20.useMemo)(() => address && active ? "http://" + address + ":" + gatewayPort : "", [address, active, gatewayPort]);
|
|
14431
|
+
(0, import_react20.useEffect)(() => {
|
|
14410
14432
|
let live = true;
|
|
14411
14433
|
if (!lanLink) {
|
|
14412
14434
|
setQr("");
|
|
@@ -14623,8 +14645,8 @@ function MobileRelayView() {
|
|
|
14623
14645
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RemoteCard, {});
|
|
14624
14646
|
}
|
|
14625
14647
|
function MobileRelayHomeStat() {
|
|
14626
|
-
const [summary, setSummary] = (0,
|
|
14627
|
-
(0,
|
|
14648
|
+
const [summary, setSummary] = (0, import_react20.useState)("\u672A\u5F00\u542F\uFF0C\u5F00\u542F\u540E\u53EF\u8FDC\u7A0B\u767B\u5F55");
|
|
14649
|
+
(0, import_react20.useEffect)(() => {
|
|
14628
14650
|
const refresh = () => {
|
|
14629
14651
|
rpc("lan").then((data) => {
|
|
14630
14652
|
const devices = typeof data.devices === "number" && data.devices > 0 ? " \xB7 " + data.devices + " \u53F0\u8BBE\u5907\u5728\u7EBF" : "";
|
|
@@ -14638,7 +14660,7 @@ function MobileRelayHomeStat() {
|
|
|
14638
14660
|
}, []);
|
|
14639
14661
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: summary });
|
|
14640
14662
|
}
|
|
14641
|
-
var
|
|
14663
|
+
var feature10 = {
|
|
14642
14664
|
id: "mobile-relay",
|
|
14643
14665
|
name: "\u8FDC\u7A0B\u8BBF\u95EE",
|
|
14644
14666
|
order: 80,
|
|
@@ -14652,9 +14674,726 @@ var feature12 = {
|
|
|
14652
14674
|
HomeStat: MobileRelayHomeStat
|
|
14653
14675
|
};
|
|
14654
14676
|
|
|
14677
|
+
// features/mcpconfig/view.js
|
|
14678
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
14679
|
+
var ENDPOINT = "dsh-dock/mcpconfig";
|
|
14680
|
+
var SERVER_NAME_RE = /^[A-Za-z0-9_-]{1,32}$/;
|
|
14681
|
+
var ENV_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
14682
|
+
var DEFAULT_TOOL_TIMEOUT_MS = 6e4;
|
|
14683
|
+
var TRANSPORTS = [
|
|
14684
|
+
{ value: "stdio", label: "stdio\uFF08\u672C\u673A\u5B50\u8FDB\u7A0B\uFF09" },
|
|
14685
|
+
{ value: "streamable-http", label: "streamable-http\uFF08\u8FDC\u7AEF HTTP\uFF09" }
|
|
14686
|
+
];
|
|
14687
|
+
var STATE_TEXT = { active: "\u8FD0\u884C\u4E2D", inactive: "\u672A\u8FDE\u63A5", failed: "\u5931\u8D25", disabled: "\u5DF2\u505C\u7528", unknown: "\u672A\u77E5" };
|
|
14688
|
+
function timeoutSignal(ms) {
|
|
14689
|
+
try {
|
|
14690
|
+
if (typeof AbortSignal !== "undefined" && typeof AbortSignal.timeout === "function") return AbortSignal.timeout(ms);
|
|
14691
|
+
} catch (e) {
|
|
14692
|
+
}
|
|
14693
|
+
return void 0;
|
|
14694
|
+
}
|
|
14695
|
+
function errorText(body, fallback) {
|
|
14696
|
+
if (body && typeof body.error === "string" && body.error) return body.error;
|
|
14697
|
+
if (body && body.error && typeof body.error.message === "string" && body.error.message) return body.error.message;
|
|
14698
|
+
return fallback;
|
|
14699
|
+
}
|
|
14700
|
+
function messageOf(e) {
|
|
14701
|
+
return e && e.message || String(e);
|
|
14702
|
+
}
|
|
14703
|
+
function linesToEnv(text) {
|
|
14704
|
+
const out = {};
|
|
14705
|
+
for (const line of String(text || "").split(/\r?\n/)) {
|
|
14706
|
+
const raw = line.trim();
|
|
14707
|
+
if (!raw) continue;
|
|
14708
|
+
const at = raw.indexOf("=");
|
|
14709
|
+
if (at < 0) {
|
|
14710
|
+
out[raw] = "";
|
|
14711
|
+
continue;
|
|
14712
|
+
}
|
|
14713
|
+
const key = raw.slice(0, at).trim();
|
|
14714
|
+
if (key) out[key] = raw.slice(at + 1).trim();
|
|
14715
|
+
}
|
|
14716
|
+
return out;
|
|
14717
|
+
}
|
|
14718
|
+
function linesToHeaders(text) {
|
|
14719
|
+
const out = {};
|
|
14720
|
+
for (const line of String(text || "").split(/\r?\n/)) {
|
|
14721
|
+
const raw = line.trim();
|
|
14722
|
+
if (!raw) continue;
|
|
14723
|
+
const at = raw.indexOf(":");
|
|
14724
|
+
if (at < 0) {
|
|
14725
|
+
out[raw] = "";
|
|
14726
|
+
continue;
|
|
14727
|
+
}
|
|
14728
|
+
const key = raw.slice(0, at).trim();
|
|
14729
|
+
if (key) out[key] = raw.slice(at + 1).trim();
|
|
14730
|
+
}
|
|
14731
|
+
return out;
|
|
14732
|
+
}
|
|
14733
|
+
function mapToEnvText(map) {
|
|
14734
|
+
return Object.keys(map || {}).map((k) => {
|
|
14735
|
+
const v = map[k];
|
|
14736
|
+
return k + "=" + (typeof v === "string" ? v : v === void 0 || v === null ? "" : JSON.stringify(v));
|
|
14737
|
+
}).join("\n");
|
|
14738
|
+
}
|
|
14739
|
+
function mapToHeadersText(map) {
|
|
14740
|
+
return Object.keys(map || {}).map((k) => {
|
|
14741
|
+
const v = map[k];
|
|
14742
|
+
return k + ": " + (typeof v === "string" ? v : v === void 0 || v === null ? "" : JSON.stringify(v));
|
|
14743
|
+
}).join("\n");
|
|
14744
|
+
}
|
|
14745
|
+
function argsToText(args) {
|
|
14746
|
+
return (Array.isArray(args) ? args : []).map((x) => typeof x === "string" ? x : String(x)).join("\n");
|
|
14747
|
+
}
|
|
14748
|
+
function textToArgs(text) {
|
|
14749
|
+
return String(text || "").split(/\r?\n/).map((x) => x.trim()).filter(Boolean);
|
|
14750
|
+
}
|
|
14751
|
+
function toDraft(server) {
|
|
14752
|
+
const s = server && typeof server === "object" ? server : {};
|
|
14753
|
+
return {
|
|
14754
|
+
serverName: typeof s.serverName === "string" ? s.serverName : "",
|
|
14755
|
+
transport: s.transport === "streamable-http" ? "streamable-http" : "stdio",
|
|
14756
|
+
command: typeof s.command === "string" ? s.command : "",
|
|
14757
|
+
args: Array.isArray(s.args) ? s.args.filter((x) => typeof x === "string") : [],
|
|
14758
|
+
env: s.env && typeof s.env === "object" && !Array.isArray(s.env) ? s.env : {},
|
|
14759
|
+
cwd: typeof s.cwd === "string" ? s.cwd : "",
|
|
14760
|
+
url: typeof s.url === "string" ? s.url : "",
|
|
14761
|
+
headers: s.headers && typeof s.headers === "object" && !Array.isArray(s.headers) ? s.headers : {},
|
|
14762
|
+
enabled: s.enabled !== false,
|
|
14763
|
+
failOnStartupError: s.failOnStartupError === true,
|
|
14764
|
+
toolCallTimeoutMs: Number.isFinite(s.toolCallTimeoutMs) && s.toolCallTimeoutMs > 0 ? s.toolCallTimeoutMs : DEFAULT_TOOL_TIMEOUT_MS,
|
|
14765
|
+
// 只读展示字段(POST 不含这些)
|
|
14766
|
+
state: typeof s.state === "string" ? s.state : "unknown",
|
|
14767
|
+
error: typeof s.error === "string" && s.error ? s.error : null,
|
|
14768
|
+
tools: Array.isArray(s.tools) ? s.tools.filter((x) => typeof x === "string") : [],
|
|
14769
|
+
toolCount: Number.isFinite(s.toolCount) ? s.toolCount : Array.isArray(s.tools) ? s.tools.length : 0
|
|
14770
|
+
};
|
|
14771
|
+
}
|
|
14772
|
+
function toSaveShape(draft) {
|
|
14773
|
+
const base = {
|
|
14774
|
+
serverName: draft.serverName,
|
|
14775
|
+
transport: draft.transport === "streamable-http" ? "streamable-http" : "stdio",
|
|
14776
|
+
enabled: draft.enabled !== false,
|
|
14777
|
+
failOnStartupError: draft.failOnStartupError === true,
|
|
14778
|
+
toolCallTimeoutMs: draft.toolCallTimeoutMs || DEFAULT_TOOL_TIMEOUT_MS
|
|
14779
|
+
};
|
|
14780
|
+
if (base.transport === "streamable-http") {
|
|
14781
|
+
return Object.assign(base, { url: draft.url || "", headers: draft.headers || {} });
|
|
14782
|
+
}
|
|
14783
|
+
return Object.assign(base, {
|
|
14784
|
+
command: draft.command || "",
|
|
14785
|
+
args: Array.isArray(draft.args) ? draft.args : [],
|
|
14786
|
+
env: draft.env || {},
|
|
14787
|
+
cwd: draft.cwd || ""
|
|
14788
|
+
});
|
|
14789
|
+
}
|
|
14790
|
+
function emptyForm() {
|
|
14791
|
+
return {
|
|
14792
|
+
mode: "create",
|
|
14793
|
+
index: -1,
|
|
14794
|
+
serverName: "",
|
|
14795
|
+
transport: "stdio",
|
|
14796
|
+
command: "",
|
|
14797
|
+
argsText: "",
|
|
14798
|
+
envText: "",
|
|
14799
|
+
cwd: "",
|
|
14800
|
+
url: "",
|
|
14801
|
+
headersText: "",
|
|
14802
|
+
toolCallTimeoutMs: String(DEFAULT_TOOL_TIMEOUT_MS),
|
|
14803
|
+
failOnStartupError: false,
|
|
14804
|
+
enabled: true
|
|
14805
|
+
};
|
|
14806
|
+
}
|
|
14807
|
+
function formFrom(draft, index) {
|
|
14808
|
+
return {
|
|
14809
|
+
mode: "edit",
|
|
14810
|
+
index,
|
|
14811
|
+
serverName: draft.serverName,
|
|
14812
|
+
transport: draft.transport,
|
|
14813
|
+
command: draft.command || "",
|
|
14814
|
+
argsText: argsToText(draft.args),
|
|
14815
|
+
envText: mapToEnvText(draft.env),
|
|
14816
|
+
cwd: draft.cwd || "",
|
|
14817
|
+
url: draft.url || "",
|
|
14818
|
+
headersText: mapToHeadersText(draft.headers),
|
|
14819
|
+
toolCallTimeoutMs: String(draft.toolCallTimeoutMs || DEFAULT_TOOL_TIMEOUT_MS),
|
|
14820
|
+
failOnStartupError: !!draft.failOnStartupError,
|
|
14821
|
+
enabled: draft.enabled !== false
|
|
14822
|
+
};
|
|
14823
|
+
}
|
|
14824
|
+
function formToDraft(form, drafts) {
|
|
14825
|
+
const serverName = String(form.serverName || "").trim();
|
|
14826
|
+
if (!SERVER_NAME_RE.test(serverName)) {
|
|
14827
|
+
return { error: "serverName \u975E\u6CD5\uFF1A\u987B\u5339\u914D " + SERVER_NAME_RE + "\uFF081~32 \u4F4D\u5B57\u6BCD\u3001\u6570\u5B57\u3001_ \u6216 -\uFF09" };
|
|
14828
|
+
}
|
|
14829
|
+
const duplicate = drafts.some((d, i) => i !== form.index && d.serverName === serverName);
|
|
14830
|
+
if (duplicate) return { error: "serverName\u300C" + serverName + "\u300D\u5DF2\u5B58\u5728\uFF0C\u8BF7\u6362\u4E00\u4E2A\u540D\u5B57" };
|
|
14831
|
+
const transport = form.transport === "streamable-http" ? "streamable-http" : "stdio";
|
|
14832
|
+
const timeoutRaw = String(form.toolCallTimeoutMs === void 0 ? "" : form.toolCallTimeoutMs).trim();
|
|
14833
|
+
const timeout = timeoutRaw === "" ? DEFAULT_TOOL_TIMEOUT_MS : Number(timeoutRaw);
|
|
14834
|
+
if (!Number.isFinite(timeout) || timeout <= 0) return { error: "toolCallTimeoutMs \u987B\u4E3A\u6B63\u6574\u6570\uFF08\u6BEB\u79D2\uFF09\uFF0C\u9ED8\u8BA4 " + DEFAULT_TOOL_TIMEOUT_MS };
|
|
14835
|
+
const base = {
|
|
14836
|
+
serverName,
|
|
14837
|
+
transport,
|
|
14838
|
+
enabled: form.mode === "create" ? form.enabled !== false : drafts[form.index] ? drafts[form.index].enabled !== false : true,
|
|
14839
|
+
failOnStartupError: !!form.failOnStartupError,
|
|
14840
|
+
toolCallTimeoutMs: Math.floor(timeout)
|
|
14841
|
+
};
|
|
14842
|
+
if (transport === "streamable-http") {
|
|
14843
|
+
const url = String(form.url || "").trim();
|
|
14844
|
+
if (!/^https?:\/\//i.test(url)) return { error: "url \u975E\u6CD5\uFF1A\u987B\u4EE5 http:// \u6216 https:// \u5F00\u5934" };
|
|
14845
|
+
const headers = linesToHeaders(form.headersText);
|
|
14846
|
+
for (const key of Object.keys(headers)) {
|
|
14847
|
+
if (!/^[A-Za-z0-9-]+$/.test(key)) return { error: "header \u540D\u975E\u6CD5\uFF1A" + key };
|
|
14848
|
+
}
|
|
14849
|
+
return { draft: Object.assign(base, { url, headers, command: "", args: [], env: {}, cwd: "" }) };
|
|
14850
|
+
}
|
|
14851
|
+
const command = String(form.command || "").trim();
|
|
14852
|
+
if (!command) return { error: "stdio \u4F20\u8F93\u5FC5\u987B\u586B\u5199 command\uFF08\u53EF\u6267\u884C\u6587\u4EF6\u8DEF\u5F84\uFF09" };
|
|
14853
|
+
const env = linesToEnv(form.envText);
|
|
14854
|
+
for (const key of Object.keys(env)) {
|
|
14855
|
+
if (!ENV_KEY_RE.test(key)) return { error: "\u73AF\u5883\u53D8\u91CF\u540D\u975E\u6CD5\uFF1A" + key + "\uFF08\u987B\u5339\u914D " + ENV_KEY_RE + "\uFF09" };
|
|
14856
|
+
}
|
|
14857
|
+
return { draft: Object.assign(base, { command, args: textToArgs(form.argsText), env, cwd: String(form.cwd || "").trim(), url: "", headers: {} }) };
|
|
14858
|
+
}
|
|
14859
|
+
function stateDotClass(state) {
|
|
14860
|
+
if (state === "active") return "dkmc-dot ok";
|
|
14861
|
+
if (state === "failed") return "dkmc-dot err";
|
|
14862
|
+
if (state === "inactive") return "dkmc-dot idle";
|
|
14863
|
+
return "dkmc-dot off";
|
|
14864
|
+
}
|
|
14865
|
+
function stateClass(state) {
|
|
14866
|
+
if (state === "active") return "dkmc-state ok";
|
|
14867
|
+
if (state === "failed") return "dkmc-state err";
|
|
14868
|
+
return "dkmc-state";
|
|
14869
|
+
}
|
|
14870
|
+
function Field(props) {
|
|
14871
|
+
return import_react21.default.createElement(
|
|
14872
|
+
"div",
|
|
14873
|
+
{ className: "dkmc-field" },
|
|
14874
|
+
import_react21.default.createElement("label", { className: "dkmc-flabel" }, props.label),
|
|
14875
|
+
props.children,
|
|
14876
|
+
props.hint ? import_react21.default.createElement("p", { className: "dkmc-hint" }, props.hint) : null
|
|
14877
|
+
);
|
|
14878
|
+
}
|
|
14879
|
+
function ServerForm(props) {
|
|
14880
|
+
const form = props.form;
|
|
14881
|
+
const patch = props.patch;
|
|
14882
|
+
const onSave = props.onSave;
|
|
14883
|
+
const onCancel = props.onCancel;
|
|
14884
|
+
const saving = props.saving;
|
|
14885
|
+
const onExample = props.onExample;
|
|
14886
|
+
const input = (p) => import_react21.default.createElement("input", Object.assign({ className: "dkmc-input" }, p));
|
|
14887
|
+
const isEdit = form.mode === "edit";
|
|
14888
|
+
return import_react21.default.createElement(
|
|
14889
|
+
"div",
|
|
14890
|
+
{ className: "dkmc-editor" },
|
|
14891
|
+
import_react21.default.createElement(
|
|
14892
|
+
"div",
|
|
14893
|
+
{ className: "dkmc-editor-head" },
|
|
14894
|
+
import_react21.default.createElement("span", { className: "dkmc-editor-title" }, isEdit ? "\u7F16\u8F91 MCP \u670D\u52A1\u5668" : "\u65B0\u589E MCP \u670D\u52A1\u5668"),
|
|
14895
|
+
import_react21.default.createElement("span", { className: "dkmc-editor-sub" }, isEdit ? form.serverName : "\u5199\u56DE cordis.patch.yml \u7684\u6258\u7BA1\u5757\u5E76\u70ED\u5E94\u7528"),
|
|
14896
|
+
!isEdit && typeof onExample === "function" ? import_react21.default.createElement("button", {
|
|
14897
|
+
type: "button",
|
|
14898
|
+
className: "dkmc-btn ghost sm dkmc-example",
|
|
14899
|
+
title: "\u4E00\u952E\u586B\u5165\u672C\u673A Xiaomi-OCR MCP \u670D\u52A1\u5668\u914D\u7F6E",
|
|
14900
|
+
disabled: saving,
|
|
14901
|
+
onClick: onExample
|
|
14902
|
+
}, "\u586B\u5165\u672C\u673A Xiaomi-OCR \u793A\u4F8B") : null
|
|
14903
|
+
),
|
|
14904
|
+
props.error ? import_react21.default.createElement("p", { className: "dkmc-error" }, props.error) : null,
|
|
14905
|
+
Field({
|
|
14906
|
+
label: "serverName",
|
|
14907
|
+
hint: "\u5DE5\u5177\u540D\u524D\u7F00\uFF1A\u6A21\u578B\u770B\u5230\u7684\u662F mcp__<serverName>__<tool>\uFF1B\u987B\u5339\u914D " + SERVER_NAME_RE
|
|
14908
|
+
}, input({
|
|
14909
|
+
value: form.serverName,
|
|
14910
|
+
placeholder: "xiaomi_ocr",
|
|
14911
|
+
disabled: isEdit,
|
|
14912
|
+
onChange: (e) => patch({ serverName: e.target.value })
|
|
14913
|
+
})),
|
|
14914
|
+
Field({ label: "\u4F20\u8F93\u65B9\u5F0F" }, import_react21.default.createElement(
|
|
14915
|
+
"select",
|
|
14916
|
+
{
|
|
14917
|
+
className: "dkmc-input dkmc-select",
|
|
14918
|
+
value: form.transport,
|
|
14919
|
+
onChange: (e) => patch({ transport: e.target.value })
|
|
14920
|
+
},
|
|
14921
|
+
TRANSPORTS.map((t) => import_react21.default.createElement("option", { key: t.value, value: t.value }, t.label))
|
|
14922
|
+
)),
|
|
14923
|
+
form.transport === "streamable-http" ? Field(
|
|
14924
|
+
{ label: "url", hint: "MCP \u7AEF\u70B9\uFF08Streamable HTTP\uFF09\uFF0C\u987B\u4EE5 http:// \u6216 https:// \u5F00\u5934" },
|
|
14925
|
+
input({ value: form.url, placeholder: "http://127.0.0.1:3000/mcp", onChange: (e) => patch({ url: e.target.value }) })
|
|
14926
|
+
) : Field(
|
|
14927
|
+
{ label: "command", hint: "\u53EF\u6267\u884C\u6587\u4EF6\u7EDD\u5BF9\u8DEF\u5F84\u6216 PATH \u4E2D\u7684\u547D\u4EE4" },
|
|
14928
|
+
input({ value: form.command, placeholder: "/usr/bin/python3", onChange: (e) => patch({ command: e.target.value }) })
|
|
14929
|
+
),
|
|
14930
|
+
form.transport === "streamable-http" ? Field(
|
|
14931
|
+
{ label: "headers\uFF08\u6BCF\u884C\u4E00\u4E2A KEY: VALUE\uFF09", hint: "\u5982 Authorization: Bearer xxx\uFF1B\u503C\u4E3A\u7A7A\u7684\u884C\u5FFD\u7565" },
|
|
14932
|
+
import_react21.default.createElement("textarea", {
|
|
14933
|
+
className: "dkmc-input dkmc-textarea",
|
|
14934
|
+
rows: 4,
|
|
14935
|
+
spellCheck: false,
|
|
14936
|
+
value: form.headersText,
|
|
14937
|
+
placeholder: "Authorization: Bearer xxxxx",
|
|
14938
|
+
onChange: (e) => patch({ headersText: e.target.value })
|
|
14939
|
+
})
|
|
14940
|
+
) : import_react21.default.createElement(
|
|
14941
|
+
import_react21.default.Fragment,
|
|
14942
|
+
null,
|
|
14943
|
+
Field(
|
|
14944
|
+
{ label: "args\uFF08\u6BCF\u884C\u4E00\u4E2A\u53C2\u6570\uFF09" },
|
|
14945
|
+
import_react21.default.createElement("textarea", {
|
|
14946
|
+
className: "dkmc-input dkmc-textarea",
|
|
14947
|
+
rows: 4,
|
|
14948
|
+
spellCheck: false,
|
|
14949
|
+
value: form.argsText,
|
|
14950
|
+
placeholder: "/www/wwwroot/xiaomi-ocr/mcp_ocr.py",
|
|
14951
|
+
onChange: (e) => patch({ argsText: e.target.value })
|
|
14952
|
+
})
|
|
14953
|
+
),
|
|
14954
|
+
Field(
|
|
14955
|
+
{ label: "env\uFF08\u6BCF\u884C\u4E00\u4E2A KEY=VALUE\uFF09", hint: "\u73AF\u5883\u53D8\u91CF\u4F1A\u660E\u6587\u5199\u8FDB profile \u8865\u4E01\u5C42\uFF08\u6587\u4EF6 0600\uFF0C\u4EC5\u672C\u673A\u53EF\u8BFB\uFF09\uFF1B\u6CA1\u6709\u53EF\u7559\u7A7A" },
|
|
14956
|
+
import_react21.default.createElement("textarea", {
|
|
14957
|
+
className: "dkmc-input dkmc-textarea",
|
|
14958
|
+
rows: 3,
|
|
14959
|
+
spellCheck: false,
|
|
14960
|
+
value: form.envText,
|
|
14961
|
+
placeholder: "PYTHONUNBUFFERED=1",
|
|
14962
|
+
onChange: (e) => patch({ envText: e.target.value })
|
|
14963
|
+
})
|
|
14964
|
+
),
|
|
14965
|
+
Field(
|
|
14966
|
+
{ label: "cwd\uFF08\u53EF\u9009\uFF09" },
|
|
14967
|
+
input({ value: form.cwd, placeholder: "/www/wwwroot/xiaomi-ocr", onChange: (e) => patch({ cwd: e.target.value }) })
|
|
14968
|
+
)
|
|
14969
|
+
),
|
|
14970
|
+
import_react21.default.createElement(
|
|
14971
|
+
"details",
|
|
14972
|
+
{ className: "dkmc-advanced" },
|
|
14973
|
+
import_react21.default.createElement("summary", { className: "dkmc-summary" }, "\u9AD8\u7EA7"),
|
|
14974
|
+
import_react21.default.createElement(
|
|
14975
|
+
"div",
|
|
14976
|
+
{ className: "dkmc-advanced-body" },
|
|
14977
|
+
Field(
|
|
14978
|
+
{ label: "toolCallTimeoutMs", hint: "\u5355\u6B21 MCP \u5DE5\u5177\u8C03\u7528\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09\uFF0C\u9ED8\u8BA4 " + DEFAULT_TOOL_TIMEOUT_MS },
|
|
14979
|
+
input({ value: form.toolCallTimeoutMs, inputMode: "numeric", placeholder: String(DEFAULT_TOOL_TIMEOUT_MS), onChange: (e) => patch({ toolCallTimeoutMs: e.target.value }) })
|
|
14980
|
+
),
|
|
14981
|
+
import_react21.default.createElement(
|
|
14982
|
+
"label",
|
|
14983
|
+
{ className: "dkmc-check" },
|
|
14984
|
+
import_react21.default.createElement("input", {
|
|
14985
|
+
type: "checkbox",
|
|
14986
|
+
checked: !!form.failOnStartupError,
|
|
14987
|
+
onChange: () => patch({ failOnStartupError: !form.failOnStartupError })
|
|
14988
|
+
}),
|
|
14989
|
+
"\u9996\u6B21\u8FDE\u63A5\u5931\u8D25\u65F6\u62D2\u7EDD\u542F\u7528\u8BE5\u884C\uFF08failOnStartupError\uFF09"
|
|
14990
|
+
)
|
|
14991
|
+
)
|
|
14992
|
+
),
|
|
14993
|
+
import_react21.default.createElement(
|
|
14994
|
+
"div",
|
|
14995
|
+
{ className: "dkmc-editor-actions" },
|
|
14996
|
+
import_react21.default.createElement("button", { type: "button", className: "dkmc-btn ghost", disabled: saving, onClick: onCancel }, "\u53D6\u6D88"),
|
|
14997
|
+
import_react21.default.createElement(
|
|
14998
|
+
"button",
|
|
14999
|
+
{ type: "button", className: "dkmc-btn primary", disabled: saving, onClick: onSave },
|
|
15000
|
+
saving ? "\u4FDD\u5B58\u4E2D\u2026" : isEdit ? "\u4FDD\u5B58\u4FEE\u6539" : "\u65B0\u589E\u5E76\u4FDD\u5B58"
|
|
15001
|
+
)
|
|
15002
|
+
)
|
|
15003
|
+
);
|
|
15004
|
+
}
|
|
15005
|
+
function McpConfigView() {
|
|
15006
|
+
const [snap, setSnap] = import_react21.default.useState({ loading: true, error: null, data: null });
|
|
15007
|
+
const [drafts, setDrafts] = import_react21.default.useState([]);
|
|
15008
|
+
const [form, setForm] = import_react21.default.useState(null);
|
|
15009
|
+
const [formError, setFormError] = import_react21.default.useState(null);
|
|
15010
|
+
const [saving, setSaving] = import_react21.default.useState(false);
|
|
15011
|
+
const [msg, setMsg] = import_react21.default.useState(null);
|
|
15012
|
+
const [delArm, setDelArm] = import_react21.default.useState(null);
|
|
15013
|
+
const refresh = async () => {
|
|
15014
|
+
setSnap((s) => Object.assign({}, s, { loading: true, error: null }));
|
|
15015
|
+
try {
|
|
15016
|
+
if (typeof fetch !== "function") throw new Error("\u5F53\u524D\u73AF\u5883\u6CA1\u6709 fetch\uFF0C\u65E0\u6CD5\u8BFB\u53D6 MCP \u914D\u7F6E");
|
|
15017
|
+
const res = await fetch(ENDPOINT, { cache: "no-store", signal: timeoutSignal(6e4) });
|
|
15018
|
+
const body2 = await res.json().catch(() => null);
|
|
15019
|
+
if (!res.ok) throw new Error(errorText(body2, "MCP \u914D\u7F6E\u63A5\u53E3 HTTP " + res.status));
|
|
15020
|
+
if (!body2 || body2.ok === false) throw new Error(errorText(body2, "MCP \u914D\u7F6E\u63A5\u53E3\u8FD4\u56DE\u5F02\u5E38"));
|
|
15021
|
+
const list = Array.isArray(body2.servers) ? body2.servers : body2.data && Array.isArray(body2.data.servers) ? body2.data.servers : [];
|
|
15022
|
+
setSnap({ loading: false, error: null, data: body2 });
|
|
15023
|
+
setDrafts(list.map(toDraft));
|
|
15024
|
+
} catch (e) {
|
|
15025
|
+
setSnap({ loading: false, error: messageOf(e), data: null });
|
|
15026
|
+
}
|
|
15027
|
+
};
|
|
15028
|
+
import_react21.default.useEffect(() => {
|
|
15029
|
+
refresh();
|
|
15030
|
+
}, []);
|
|
15031
|
+
const commit = async (nextDrafts, successText) => {
|
|
15032
|
+
if (saving) return false;
|
|
15033
|
+
const previous = drafts;
|
|
15034
|
+
setSaving(true);
|
|
15035
|
+
setFormError(null);
|
|
15036
|
+
setMsg(null);
|
|
15037
|
+
setDrafts(nextDrafts);
|
|
15038
|
+
try {
|
|
15039
|
+
if (typeof fetch !== "function") throw new Error("\u5F53\u524D\u73AF\u5883\u6CA1\u6709 fetch\uFF0C\u65E0\u6CD5\u4FDD\u5B58 MCP \u914D\u7F6E");
|
|
15040
|
+
const res = await fetch(ENDPOINT, {
|
|
15041
|
+
method: "POST",
|
|
15042
|
+
headers: { "content-type": "application/json" },
|
|
15043
|
+
body: JSON.stringify({ action: "save", servers: nextDrafts.map(toSaveShape) }),
|
|
15044
|
+
cache: "no-store",
|
|
15045
|
+
signal: timeoutSignal(6e4)
|
|
15046
|
+
});
|
|
15047
|
+
const body2 = await res.json().catch(() => null);
|
|
15048
|
+
if (!res.ok || !body2 || body2.ok === false) {
|
|
15049
|
+
const extra = body2 && body2.rolledBack ? "\uFF08\u5DF2\u56DE\u6EDA\u5230\u4FDD\u5B58\u524D\u7684\u914D\u7F6E\uFF09" : body2 && body2.needsRestart ? "\uFF08\u914D\u7F6E\u53EF\u80FD\u5DF2\u5199\u5165\uFF0C\u9700\u91CD\u542F DSH \u68C0\u67E5\uFF09" : "";
|
|
15050
|
+
throw new Error(errorText(body2, "\u4FDD\u5B58\u5931\u8D25\uFF1AHTTP " + res.status) + extra);
|
|
15051
|
+
}
|
|
15052
|
+
const notes = [];
|
|
15053
|
+
if (body2.restartRequired) notes.push("\u5DF2\u4FDD\u5B58\uFF0C\u91CD\u542F DSH \u540E\u751F\u6548");
|
|
15054
|
+
else if (body2.applied === false) notes.push("\u5DF2\u4FDD\u5B58\uFF0C\u7B49\u5F85 DSH \u5E94\u7528");
|
|
15055
|
+
else notes.push(body2.changed === false ? "\u914D\u7F6E\u6CA1\u6709\u53D8\u5316" : "\u5DF2\u5E94\u7528");
|
|
15056
|
+
for (const w of Array.isArray(body2.warnings) ? body2.warnings : []) notes.push(String(w));
|
|
15057
|
+
setMsg({ tone: "ok", text: successText + "\uFF1B" + notes.join("\uFF1B") });
|
|
15058
|
+
setForm(null);
|
|
15059
|
+
setFormError(null);
|
|
15060
|
+
setDelArm(null);
|
|
15061
|
+
await refresh();
|
|
15062
|
+
return true;
|
|
15063
|
+
} catch (e) {
|
|
15064
|
+
setDrafts(previous);
|
|
15065
|
+
setFormError(messageOf(e));
|
|
15066
|
+
return false;
|
|
15067
|
+
} finally {
|
|
15068
|
+
setSaving(false);
|
|
15069
|
+
}
|
|
15070
|
+
};
|
|
15071
|
+
const openCreate = () => {
|
|
15072
|
+
setForm(emptyForm());
|
|
15073
|
+
setFormError(null);
|
|
15074
|
+
setMsg(null);
|
|
15075
|
+
setDelArm(null);
|
|
15076
|
+
};
|
|
15077
|
+
const openEdit = (draft, index) => {
|
|
15078
|
+
setForm(formFrom(draft, index));
|
|
15079
|
+
setFormError(null);
|
|
15080
|
+
setMsg(null);
|
|
15081
|
+
setDelArm(null);
|
|
15082
|
+
};
|
|
15083
|
+
const closeForm = () => {
|
|
15084
|
+
setForm(null);
|
|
15085
|
+
setFormError(null);
|
|
15086
|
+
};
|
|
15087
|
+
const patchForm = (patch) => {
|
|
15088
|
+
setForm((f) => Object.assign({}, f, patch));
|
|
15089
|
+
setFormError(null);
|
|
15090
|
+
};
|
|
15091
|
+
const saveForm = () => {
|
|
15092
|
+
if (!form || saving) return;
|
|
15093
|
+
const result = formToDraft(form, drafts);
|
|
15094
|
+
if (result.error) {
|
|
15095
|
+
setFormError(result.error);
|
|
15096
|
+
return;
|
|
15097
|
+
}
|
|
15098
|
+
const draft = result.draft;
|
|
15099
|
+
const next = form.mode === "edit" ? drafts.map((d, i) => i === form.index ? Object.assign({}, d, draft) : d) : drafts.concat([draft]);
|
|
15100
|
+
const text = (form.mode === "edit" ? "\u5DF2\u66F4\u65B0\u300C" : "\u5DF2\u65B0\u589E\u300C") + draft.serverName + "\u300D";
|
|
15101
|
+
commit(next, text);
|
|
15102
|
+
};
|
|
15103
|
+
const toggle = (draft) => {
|
|
15104
|
+
const next = drafts.map((d) => d.serverName === draft.serverName ? Object.assign({}, d, { enabled: !d.enabled }) : d);
|
|
15105
|
+
commit(next, "\u5DF2" + (draft.enabled ? "\u505C\u7528\u300C" : "\u542F\u7528\u300C") + draft.serverName + "\u300D");
|
|
15106
|
+
};
|
|
15107
|
+
const remove = (draft) => {
|
|
15108
|
+
if (delArm !== draft.serverName) {
|
|
15109
|
+
setDelArm(draft.serverName);
|
|
15110
|
+
setMsg(null);
|
|
15111
|
+
setFormError(null);
|
|
15112
|
+
return;
|
|
15113
|
+
}
|
|
15114
|
+
setDelArm(null);
|
|
15115
|
+
const next = drafts.filter((d) => d.serverName !== draft.serverName);
|
|
15116
|
+
if (form && form.mode === "edit" && form.serverName === draft.serverName) closeForm();
|
|
15117
|
+
commit(next, "\u5DF2\u5220\u9664\u300C" + draft.serverName + "\u300D");
|
|
15118
|
+
};
|
|
15119
|
+
const fillXiaomiExample = () => {
|
|
15120
|
+
if (drafts.some((d) => d.serverName === "xiaomi_ocr")) {
|
|
15121
|
+
setMsg({ tone: "warn", text: "\u5217\u8868\u91CC\u5DF2\u7ECF\u6709 xiaomi_ocr\uFF08\u53EF\u76F4\u63A5\u70B9\u8BE5\u5361\u7247\u7684\u300C\u7F16\u8F91\u300D\u67E5\u770B/\u4FEE\u6539\uFF09" });
|
|
15122
|
+
return;
|
|
15123
|
+
}
|
|
15124
|
+
setForm(Object.assign(emptyForm(), {
|
|
15125
|
+
serverName: "xiaomi_ocr",
|
|
15126
|
+
transport: "stdio",
|
|
15127
|
+
command: "/usr/bin/python3",
|
|
15128
|
+
argsText: "/www/wwwroot/xiaomi-ocr/mcp_ocr.py",
|
|
15129
|
+
cwd: "/www/wwwroot/xiaomi-ocr",
|
|
15130
|
+
envText: "",
|
|
15131
|
+
toolCallTimeoutMs: "300000",
|
|
15132
|
+
failOnStartupError: false
|
|
15133
|
+
}));
|
|
15134
|
+
setFormError(null);
|
|
15135
|
+
setMsg(null);
|
|
15136
|
+
};
|
|
15137
|
+
const data = snap.data;
|
|
15138
|
+
const patchPath = data && typeof data.patchPath === "string" ? data.patchPath : "";
|
|
15139
|
+
const hmrAvailable = !!(data && data.hmrAvailable);
|
|
15140
|
+
const warnings = data ? Array.isArray(data.warnings) ? data.warnings.filter((w) => typeof w === "string" && w) : typeof data.warning === "string" && data.warning ? [data.warning] : [] : [];
|
|
15141
|
+
const serverCount = drafts.length;
|
|
15142
|
+
const enabledCount = drafts.filter((d) => d.enabled).length;
|
|
15143
|
+
const toolsTotal = drafts.reduce((n, d) => n + (Number.isFinite(d.toolCount) ? d.toolCount : 0), 0);
|
|
15144
|
+
const body = [
|
|
15145
|
+
import_react21.default.createElement(
|
|
15146
|
+
"div",
|
|
15147
|
+
{ key: "head", className: "dkmc-head" },
|
|
15148
|
+
import_react21.default.createElement(
|
|
15149
|
+
"div",
|
|
15150
|
+
{ className: "dkmc-head-title" },
|
|
15151
|
+
import_react21.default.createElement("h2", { className: "dkmc-title" }, "MCP\u7BA1\u7406"),
|
|
15152
|
+
import_react21.default.createElement(
|
|
15153
|
+
"span",
|
|
15154
|
+
{ className: "dkmc-badge " + (hmrAvailable ? "ok" : "warn"), title: hmrAvailable ? "\u4FDD\u5B58\u540E\u7531 dsh-hmr \u539F\u5730\u91CD\u8F7D\uFF0C\u65E0\u9700\u91CD\u542F" : "\u5F53\u524D profile \u672A\u542F\u7528 HMR\uFF1A\u4FDD\u5B58\u540E\u9700\u91CD\u542F DSH \u751F\u6548" },
|
|
15155
|
+
hmrAvailable ? "\u5373\u65F6\u751F\u6548" : "\u9700\u91CD\u542F DSH \u751F\u6548"
|
|
15156
|
+
)
|
|
15157
|
+
),
|
|
15158
|
+
import_react21.default.createElement(
|
|
15159
|
+
"p",
|
|
15160
|
+
{ className: "dkmc-intro" },
|
|
15161
|
+
"\u7BA1\u7406 DSH \u4F7F\u7528\u7684 MCP \u670D\u52A1\u5668\uFF08\u65B0\u589E / \u7F16\u8F91 / \u5220\u9664 / \u542F\u505C\uFF09\uFF0C\u4FDD\u5B58\u540E\u5199\u56DE\u5F53\u524D profile \u7684 cordis \u8865\u4E01\u5C42\u6258\u7BA1\u5757\uFF1B\u8FDE\u63A5\u6210\u529F\u540E\u6A21\u578B\u5DE5\u5177\u5217\u8868\u51FA\u73B0 mcp__<serverName>__<tool>\u3002"
|
|
15162
|
+
)
|
|
15163
|
+
),
|
|
15164
|
+
import_react21.default.createElement(
|
|
15165
|
+
"div",
|
|
15166
|
+
{ key: "meta", className: "dkmc-meta" },
|
|
15167
|
+
import_react21.default.createElement("span", { className: "dkmc-meta-label" }, "\u8865\u4E01\u6587\u4EF6"),
|
|
15168
|
+
import_react21.default.createElement("code", { className: "dkmc-path", title: patchPath || void 0 }, patchPath || "\uFF08\u5C1A\u672A\u8BFB\u53D6\uFF09"),
|
|
15169
|
+
import_react21.default.createElement(
|
|
15170
|
+
"button",
|
|
15171
|
+
{ type: "button", className: "dkmc-btn ghost sm", disabled: snap.loading || saving, onClick: () => {
|
|
15172
|
+
setMsg(null);
|
|
15173
|
+
refresh();
|
|
15174
|
+
} },
|
|
15175
|
+
snap.loading ? "\u5237\u65B0\u4E2D\u2026" : "\u5237\u65B0"
|
|
15176
|
+
)
|
|
15177
|
+
)
|
|
15178
|
+
];
|
|
15179
|
+
if (warnings.length > 0) {
|
|
15180
|
+
body.push(import_react21.default.createElement(
|
|
15181
|
+
"ul",
|
|
15182
|
+
{ key: "warnings", className: "dkmc-warnings" },
|
|
15183
|
+
warnings.map((w, i) => import_react21.default.createElement("li", { key: i, className: "dkmc-warning" }, w))
|
|
15184
|
+
));
|
|
15185
|
+
}
|
|
15186
|
+
if (snap.error) {
|
|
15187
|
+
body.push(import_react21.default.createElement("p", { key: "loaderr", className: "dkmc-error" }, "MCP \u914D\u7F6E\u8BFB\u53D6\u5931\u8D25\uFF1A" + snap.error));
|
|
15188
|
+
}
|
|
15189
|
+
if (msg) {
|
|
15190
|
+
body.push(import_react21.default.createElement("p", {
|
|
15191
|
+
key: "msg",
|
|
15192
|
+
className: "dkmc-msg " + (msg.tone === "ok" ? "ok" : msg.tone === "warn" ? "warn" : "err"),
|
|
15193
|
+
role: "status"
|
|
15194
|
+
}, msg.text));
|
|
15195
|
+
}
|
|
15196
|
+
if (!data) {
|
|
15197
|
+
body.push(import_react21.default.createElement(
|
|
15198
|
+
"div",
|
|
15199
|
+
{ key: "empty-loading", className: "dkmc-empty" },
|
|
15200
|
+
snap.loading ? "\u6B63\u5728\u8BFB\u53D6 MCP \u670D\u52A1\u5668\u2026" : "\u6682\u65F6\u8BFB\u4E0D\u5230 MCP \u914D\u7F6E\uFF0C\u70B9\u4E0A\u65B9\u300C\u5237\u65B0\u300D\u91CD\u8BD5"
|
|
15201
|
+
));
|
|
15202
|
+
} else {
|
|
15203
|
+
body.push(import_react21.default.createElement(
|
|
15204
|
+
"div",
|
|
15205
|
+
{ key: "summary", className: "dkmc-summary-line" },
|
|
15206
|
+
"\u5171 " + serverCount + " \u53F0\u670D\u52A1\u5668 \xB7 " + enabledCount + " \u53F0\u542F\u7528 \xB7 \u5DF2\u6CE8\u518C\u5DE5\u5177 " + toolsTotal + " \u4E2A"
|
|
15207
|
+
));
|
|
15208
|
+
if (drafts.length === 0) {
|
|
15209
|
+
body.push(import_react21.default.createElement("div", { key: "empty", className: "dkmc-empty" }, "\u8FD8\u6CA1\u6709 MCP \u670D\u52A1\u5668\u2014\u2014\u70B9\u4E0B\u65B9\u300C\u65B0\u589E MCP \u670D\u52A1\u5668\u300D\u6DFB\u52A0\uFF0C\u6216\u5148\u586B\u5165\u672C\u673A Xiaomi-OCR \u793A\u4F8B\u3002"));
|
|
15210
|
+
} else {
|
|
15211
|
+
body.push(import_react21.default.createElement(
|
|
15212
|
+
"ul",
|
|
15213
|
+
{ key: "cards", className: "dkmc-cards" },
|
|
15214
|
+
drafts.map((draft, index) => {
|
|
15215
|
+
const editing = !!form && form.mode === "edit" && form.index === index;
|
|
15216
|
+
const state = draft.state || "unknown";
|
|
15217
|
+
const stateText = STATE_TEXT[state] || STATE_TEXT.unknown;
|
|
15218
|
+
const toolTitle = draft.tools && draft.tools.length > 0 ? draft.tools.join("\n") : "\u5C1A\u672A\u6CE8\u518C\u5DE5\u5177";
|
|
15219
|
+
return import_react21.default.createElement(
|
|
15220
|
+
"li",
|
|
15221
|
+
{ key: draft.serverName + ":" + index, className: "dkmc-card" + (editing ? " editing" : "") },
|
|
15222
|
+
import_react21.default.createElement(
|
|
15223
|
+
"div",
|
|
15224
|
+
{ className: "dkmc-rowhead" },
|
|
15225
|
+
import_react21.default.createElement("span", { className: "dkmc-name" }, draft.serverName || "\uFF08\u672A\u547D\u540D\uFF09"),
|
|
15226
|
+
import_react21.default.createElement("span", { className: "dkmc-tag" }, draft.transport === "streamable-http" ? "HTTP" : "stdio"),
|
|
15227
|
+
import_react21.default.createElement(
|
|
15228
|
+
"span",
|
|
15229
|
+
{ className: stateClass(state), title: stateText },
|
|
15230
|
+
import_react21.default.createElement("span", { className: stateDotClass(state), "aria-hidden": true }),
|
|
15231
|
+
stateText
|
|
15232
|
+
),
|
|
15233
|
+
import_react21.default.createElement("span", { className: "dkmc-tools", title: toolTitle }, (Number.isFinite(draft.toolCount) ? draft.toolCount : 0) + " \u4E2A\u5DE5\u5177"),
|
|
15234
|
+
import_react21.default.createElement(
|
|
15235
|
+
"span",
|
|
15236
|
+
{ className: "dkmc-actions" },
|
|
15237
|
+
import_react21.default.createElement("button", {
|
|
15238
|
+
type: "button",
|
|
15239
|
+
className: "dkmc-switch" + (draft.enabled ? " on" : ""),
|
|
15240
|
+
role: "switch",
|
|
15241
|
+
"aria-checked": draft.enabled,
|
|
15242
|
+
"aria-label": (draft.enabled ? "\u505C\u7528" : "\u542F\u7528") + draft.serverName,
|
|
15243
|
+
title: draft.enabled ? "\u505C\u7528\uFF08\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\uFF09" : "\u542F\u7528\uFF08\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\uFF09",
|
|
15244
|
+
disabled: saving,
|
|
15245
|
+
onClick: () => toggle(draft)
|
|
15246
|
+
}, draft.enabled ? "\u5DF2\u542F\u7528" : "\u5DF2\u505C\u7528"),
|
|
15247
|
+
import_react21.default.createElement("button", {
|
|
15248
|
+
type: "button",
|
|
15249
|
+
className: "dkmc-btn ghost sm",
|
|
15250
|
+
"aria-expanded": editing,
|
|
15251
|
+
disabled: saving,
|
|
15252
|
+
onClick: () => editing ? closeForm() : openEdit(draft, index)
|
|
15253
|
+
}, editing ? "\u6536\u8D77" : "\u7F16\u8F91"),
|
|
15254
|
+
import_react21.default.createElement("button", {
|
|
15255
|
+
type: "button",
|
|
15256
|
+
className: "dkmc-btn danger sm" + (delArm === draft.serverName ? " arm" : ""),
|
|
15257
|
+
title: delArm === draft.serverName ? "\u518D\u70B9\u4E00\u6B21\u786E\u8BA4\u5220\u9664" : "\u5220\u9664\u8BE5 MCP \u670D\u52A1\u5668",
|
|
15258
|
+
disabled: saving,
|
|
15259
|
+
onClick: () => remove(draft)
|
|
15260
|
+
}, delArm === draft.serverName ? "\u786E\u8BA4\u5220\u9664\uFF1F" : "\u5220\u9664")
|
|
15261
|
+
)
|
|
15262
|
+
),
|
|
15263
|
+
draft.error ? import_react21.default.createElement("p", { className: "dkmc-error dkmc-error-line", title: draft.error }, draft.error) : null,
|
|
15264
|
+
editing ? import_react21.default.createElement(ServerForm, {
|
|
15265
|
+
form,
|
|
15266
|
+
patch: patchForm,
|
|
15267
|
+
error: formError,
|
|
15268
|
+
saving,
|
|
15269
|
+
onSave: saveForm,
|
|
15270
|
+
onCancel: closeForm
|
|
15271
|
+
}) : null
|
|
15272
|
+
);
|
|
15273
|
+
})
|
|
15274
|
+
));
|
|
15275
|
+
}
|
|
15276
|
+
}
|
|
15277
|
+
body.push(import_react21.default.createElement(
|
|
15278
|
+
"div",
|
|
15279
|
+
{ key: "add", className: "dkmc-addblock" },
|
|
15280
|
+
form && form.mode === "create" ? import_react21.default.createElement(
|
|
15281
|
+
"div",
|
|
15282
|
+
{ className: "dkmc-card dkmc-addcard" },
|
|
15283
|
+
import_react21.default.createElement(ServerForm, {
|
|
15284
|
+
form,
|
|
15285
|
+
patch: patchForm,
|
|
15286
|
+
error: formError,
|
|
15287
|
+
saving,
|
|
15288
|
+
onExample: fillXiaomiExample,
|
|
15289
|
+
onSave: saveForm,
|
|
15290
|
+
onCancel: closeForm
|
|
15291
|
+
})
|
|
15292
|
+
) : import_react21.default.createElement(
|
|
15293
|
+
"div",
|
|
15294
|
+
{ className: "dkmc-addrow" },
|
|
15295
|
+
import_react21.default.createElement("button", { type: "button", className: "dkmc-addbtn", disabled: saving, onClick: openCreate }, "\uFF0B \u65B0\u589E MCP \u670D\u52A1\u5668"),
|
|
15296
|
+
import_react21.default.createElement("button", { type: "button", className: "dkmc-btn ghost", disabled: saving, onClick: fillXiaomiExample }, "\u586B\u5165\u672C\u673A Xiaomi-OCR \u793A\u4F8B")
|
|
15297
|
+
)
|
|
15298
|
+
));
|
|
15299
|
+
return import_react21.default.createElement("div", { className: "dkmc-page" }, body);
|
|
15300
|
+
}
|
|
15301
|
+
var feature11 = {
|
|
15302
|
+
id: "mcpconfig",
|
|
15303
|
+
name: "MCP\u7BA1\u7406",
|
|
15304
|
+
order: 101,
|
|
15305
|
+
accent: "#a855f7",
|
|
15306
|
+
description: "\u7BA1\u7406 DSH \u4F7F\u7528\u7684 MCP \u670D\u52A1\u5668\uFF08\u589E\u5220\u6539/\u542F\u505C/\u5DE5\u5177\u72B6\u6001\uFF09",
|
|
15307
|
+
defaultEnabled: false,
|
|
15308
|
+
View: McpConfigView,
|
|
15309
|
+
css: [
|
|
15310
|
+
// ---- MCP 管理页(dkmc- 前缀;排版/尺寸对齐 providerconfig 的 dkp- 页) ----
|
|
15311
|
+
".dkmc-page{width:100%;max-width:760px;display:flex;flex-direction:column;gap:12px;color:var(--dsw-alias-label-primary);font-size:13px;}",
|
|
15312
|
+
".dkmc-head{display:flex;flex-direction:column;gap:6px;}",
|
|
15313
|
+
".dkmc-head-title{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}",
|
|
15314
|
+
".dkmc-title{margin:0;font-size:16px;font-weight:500;line-height:24px;}",
|
|
15315
|
+
".dkmc-intro{margin:0;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:20px;}",
|
|
15316
|
+
".dkmc-badge{flex:none;border-radius:999px;padding:2px 9px;font-size:11px;line-height:16px;border:1px solid currentColor;}",
|
|
15317
|
+
".dkmc-badge.ok{color:var(--dsw-alias-state-success-primary);}",
|
|
15318
|
+
".dkmc-badge.warn{color:var(--dk-warn);}",
|
|
15319
|
+
".dkmc-meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:8px 10px;border:.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg,10px);background:var(--dsw-alias-bg-layer-1);}",
|
|
15320
|
+
".dkmc-meta-label{flex:none;color:var(--dsw-alias-label-tertiary);font-size:12px;}",
|
|
15321
|
+
".dkmc-path{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-secondary);font-family:var(--ds-font-family-code,ui-monospace,monospace);font-size:12px;}",
|
|
15322
|
+
".dkmc-warnings{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px;}",
|
|
15323
|
+
".dkmc-warning{color:var(--dk-warn);font-size:12px;line-height:18px;}",
|
|
15324
|
+
".dkmc-error{margin:0;color:var(--dsw-alias-state-error-primary);font-size:12px;line-height:18px;word-break:break-word;}",
|
|
15325
|
+
".dkmc-error-line{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
|
|
15326
|
+
".dkmc-msg{margin:0;font-size:12px;line-height:18px;word-break:break-word;}",
|
|
15327
|
+
".dkmc-msg.ok{color:var(--dsw-alias-state-success-primary);}",
|
|
15328
|
+
".dkmc-msg.warn{color:var(--dk-warn);}",
|
|
15329
|
+
".dkmc-msg.err{color:var(--dsw-alias-state-error-primary);}",
|
|
15330
|
+
".dkmc-summary-line{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px;}",
|
|
15331
|
+
".dkmc-empty{border:1px dashed var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg,10px);padding:16px 12px;text-align:center;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px;}",
|
|
15332
|
+
".dkmc-cards{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px;}",
|
|
15333
|
+
".dkmc-card{box-sizing:border-box;margin:0;border:.5px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-settings-card-fill,var(--dsw-alias-bg-layer-1));border-radius:var(--dsw-radius-lg,10px);padding:10px 12px;display:flex;flex-direction:column;gap:8px;}",
|
|
15334
|
+
".dkmc-card.editing{border-color:color-mix(in srgb,var(--dk-accent) 45%,var(--dsw-alias-border-l2));}",
|
|
15335
|
+
".dkmc-rowhead{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}",
|
|
15336
|
+
".dkmc-name{font-size:14px;font-weight:600;line-height:22px;overflow:hidden;text-overflow:ellipsis;max-width:100%;}",
|
|
15337
|
+
".dkmc-tag{flex:none;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-xs,4px);color:var(--dsw-alias-label-secondary);padding:1px 6px;font-size:11px;line-height:16px;}",
|
|
15338
|
+
".dkmc-state{flex:none;display:inline-flex;align-items:center;gap:5px;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px;white-space:nowrap;}",
|
|
15339
|
+
".dkmc-state.ok{color:var(--dsw-alias-state-success-primary);}",
|
|
15340
|
+
".dkmc-state.err{color:var(--dsw-alias-state-error-primary);}",
|
|
15341
|
+
".dkmc-dot{width:7px;height:7px;border-radius:50%;flex:none;background:var(--dsw-alias-label-tertiary);}",
|
|
15342
|
+
".dkmc-dot.ok{background:var(--dsw-alias-state-success-primary);box-shadow:0 0 4px color-mix(in srgb,var(--dsw-alias-state-success-primary) 55%,transparent);}",
|
|
15343
|
+
".dkmc-dot.err{background:var(--dsw-alias-state-error-primary);}",
|
|
15344
|
+
".dkmc-dot.idle{background:transparent;border:1.5px solid var(--dsw-alias-label-secondary);}",
|
|
15345
|
+
".dkmc-dot.off{background:transparent;border:1.5px solid var(--dsw-alias-label-tertiary);opacity:.75;}",
|
|
15346
|
+
".dkmc-tools{flex:none;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px;white-space:nowrap;cursor:default;}",
|
|
15347
|
+
".dkmc-actions{flex:none;margin-left:auto;display:inline-flex;align-items:center;gap:4px;flex-wrap:wrap;}",
|
|
15348
|
+
".dkmc-switch{cursor:pointer;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:3px 10px;font-family:inherit;font-size:11px;line-height:16px;}",
|
|
15349
|
+
".dkmc-switch.on{color:var(--dsw-alias-state-success-primary);border-color:currentColor;}",
|
|
15350
|
+
".dkmc-switch[disabled]{opacity:.45;cursor:default;}",
|
|
15351
|
+
".dkmc-btn{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:4px;height:32px;padding:0 12px;border:none;border-radius:var(--dsw-radius-md,8px);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:20px;cursor:pointer;}",
|
|
15352
|
+
".dkmc-btn.ghost{border:.5px solid var(--dsw-alias-border-l3);}",
|
|
15353
|
+
".dkmc-btn.ghost:hover{background:var(--dsw-alias-interactive-bg-hover);}",
|
|
15354
|
+
".dkmc-btn.primary{background:var(--dsw-alias-button-primary-fill,var(--dk-accent));color:var(--dsw-alias-label-primary-foreground,#fff);}",
|
|
15355
|
+
".dkmc-btn.danger{color:var(--dsw-alias-state-error-primary);}",
|
|
15356
|
+
".dkmc-btn.danger:hover{background:var(--dsw-alias-interactive-bg-hover-danger,rgba(220,38,38,.1));}",
|
|
15357
|
+
".dkmc-btn.arm{color:var(--dsw-alias-state-error-primary);border:.5px solid currentColor;}",
|
|
15358
|
+
".dkmc-btn.sm{height:26px;padding:0 9px;border-radius:var(--dsw-radius-sm,6px);font-size:11px;line-height:16px;}",
|
|
15359
|
+
".dkmc-btn[disabled]{opacity:.4;cursor:default;}",
|
|
15360
|
+
".dkmc-editor{border-radius:var(--dsw-radius-lg,10px);background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-1));padding:12px 14px;display:flex;flex-direction:column;gap:12px;}",
|
|
15361
|
+
".dkmc-editor-head{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;}",
|
|
15362
|
+
".dkmc-editor-title{font-size:13px;font-weight:600;line-height:20px;}",
|
|
15363
|
+
".dkmc-editor-sub{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px;}",
|
|
15364
|
+
".dkmc-example{margin-left:auto;flex:none;}",
|
|
15365
|
+
".dkmc-field{display:flex;flex-direction:column;gap:5px;min-width:0;}",
|
|
15366
|
+
".dkmc-flabel{display:inline-flex;align-items:center;gap:8px;color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:500;line-height:18px;}",
|
|
15367
|
+
".dkmc-hint{margin:0;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px;word-break:break-word;}",
|
|
15368
|
+
".dkmc-input{box-sizing:border-box;width:100%;height:32px;padding:0 10px;border:.5px solid var(--dsw-alias-border-l4,var(--dsw-alias-border-l2));border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:20px;}",
|
|
15369
|
+
".dkmc-input:focus{border-color:var(--dsw-alias-state-business-primary,var(--dk-accent));outline:none;}",
|
|
15370
|
+
".dkmc-input::placeholder{color:var(--dsw-alias-label-dimmed,var(--dsw-alias-label-tertiary));}",
|
|
15371
|
+
".dkmc-input:disabled{opacity:.6;cursor:default;}",
|
|
15372
|
+
".dkmc-textarea{height:auto;min-height:64px;padding:8px 10px;resize:vertical;line-height:1.5;font-family:var(--ds-font-family-code,ui-monospace,monospace);font-size:12px;}",
|
|
15373
|
+
"select.dkmc-input{appearance:auto;cursor:pointer;max-width:280px;}",
|
|
15374
|
+
".dkmc-check{display:inline-flex;align-items:center;gap:6px;cursor:pointer;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;}",
|
|
15375
|
+
".dkmc-check input{accent-color:var(--dk-accent);margin:0;}",
|
|
15376
|
+
".dkmc-advanced{border-top:.5px solid var(--dsw-alias-border-l2);padding-top:10px;}",
|
|
15377
|
+
".dkmc-summary{display:flex;align-items:center;gap:6px;width:fit-content;margin-left:-4px;padding:2px 4px;border-radius:var(--dsw-radius-sm,6px);list-style:none;cursor:pointer;color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:500;line-height:18px;}",
|
|
15378
|
+
".dkmc-summary::-webkit-details-marker{display:none;}",
|
|
15379
|
+
'.dkmc-summary::before{content:"";width:5px;height:5px;border-right:1.5px solid;border-bottom:1.5px solid;transform:rotate(-45deg);transition:transform .12s;}',
|
|
15380
|
+
".dkmc-advanced[open]>.dkmc-summary::before{transform:rotate(45deg);}",
|
|
15381
|
+
".dkmc-advanced-body{display:flex;flex-direction:column;gap:12px;padding-top:12px;}",
|
|
15382
|
+
".dkmc-editor-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;border-top:.5px solid var(--dsw-alias-border-l2);padding-top:10px;}",
|
|
15383
|
+
".dkmc-addblock{display:flex;align-items:stretch;}",
|
|
15384
|
+
".dkmc-addrow{display:flex;align-items:stretch;gap:8px;flex-wrap:wrap;}",
|
|
15385
|
+
".dkmc-addbtn{box-sizing:border-box;flex:1 1 220px;min-width:180px;height:44px;display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px dashed var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg,10px);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:14px;line-height:22px;cursor:pointer;}",
|
|
15386
|
+
".dkmc-addbtn:hover{background:var(--dsw-alias-interactive-bg-hover);}",
|
|
15387
|
+
".dkmc-addbtn[disabled]{opacity:.4;cursor:default;}",
|
|
15388
|
+
".dkmc-addcard{flex:1 1 auto;padding:12px 14px;}",
|
|
15389
|
+
".dkmc-addcard .dkmc-editor{background:transparent;padding:0;}",
|
|
15390
|
+
"@media (max-width:680px){.dkmc-page{max-width:none;gap:14px}.dkmc-intro{font-size:13px;line-height:20px}.dkmc-editor{padding:12px}.dkmc-addcard{padding:12px 14px}.dkmc-btn{height:40px}.dkmc-btn.sm{height:34px}.dkmc-addbtn{height:48px;flex:1 1 100%}.dkmc-actions{width:100%;margin-left:0;justify-content:flex-end}.dkmc-name{font-size:15px}}"
|
|
15391
|
+
].join("\n")
|
|
15392
|
+
};
|
|
15393
|
+
|
|
14655
15394
|
// src/client.jsx
|
|
14656
|
-
var DOCK_VERSION = "0.
|
|
14657
|
-
var BUILTIN_FEATURES = [feature, feature2, feature3, feature4, feature5, feature6, feature7, feature8, feature9, feature10
|
|
15395
|
+
var DOCK_VERSION = "0.23.0";
|
|
15396
|
+
var BUILTIN_FEATURES = [feature, feature2, feature3, feature11, feature4, feature5, feature6, feature7, feature8, feature9, feature10];
|
|
14658
15397
|
var PLANNED_FEATURES = [];
|
|
14659
15398
|
var PLANNED_NOTES = {};
|
|
14660
15399
|
var externalDefs = [];
|
|
@@ -14774,8 +15513,10 @@ var SHELL_CSS = [
|
|
|
14774
15513
|
".dockm-page-wide-btn{flex:none;margin-left:auto;display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 10px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-secondary);font-family:inherit;font-size:12px;cursor:pointer;}",
|
|
14775
15514
|
".dockm-page-wide-btn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
|
|
14776
15515
|
/* 面板页的左侧菜单收窄:给右侧列表/表格让出宽度,别留大片空白 */
|
|
14777
|
-
|
|
14778
|
-
|
|
15516
|
+
// 左侧菜单列:内容只有 8px 圆点 + 4 字标签,140px 会留一大条空白(用户反馈「这个宽度可以缩小点」)。
|
|
15517
|
+
// 用 border-box 收到 110px(含内距):既够放最长标签「MCP管理 / 远程访问」,又把右侧死区收掉,正文区更宽。
|
|
15518
|
+
".dockm-page .dockm-nav{box-sizing:border-box;width:110px;padding:8px 7px;}",
|
|
15519
|
+
".dockm-page .dockm-nav-item{padding:7px 8px;font-size:12.5px;gap:6px;overflow:hidden;}",
|
|
14779
15520
|
".dockm-page-body>.dockm-body{flex:1;min-height:0;}",
|
|
14780
15521
|
".dockm-page-icon{flex:none;display:flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:10px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);}",
|
|
14781
15522
|
".dockm-page-titles{min-width:0;}",
|
|
@@ -14895,8 +15636,8 @@ function ensureCss() {
|
|
|
14895
15636
|
}
|
|
14896
15637
|
}
|
|
14897
15638
|
function useExternalVersion() {
|
|
14898
|
-
const [, bump] =
|
|
14899
|
-
|
|
15639
|
+
const [, bump] = import_react22.default.useReducer((n) => n + 1, 0);
|
|
15640
|
+
import_react22.default.useEffect(() => {
|
|
14900
15641
|
externalListeners.add(bump);
|
|
14901
15642
|
return () => {
|
|
14902
15643
|
externalListeners.delete(bump);
|
|
@@ -14906,25 +15647,25 @@ function useExternalVersion() {
|
|
|
14906
15647
|
var lastGeom = { x: null, y: null, w: null, h: null };
|
|
14907
15648
|
function DockIcon(props) {
|
|
14908
15649
|
const size = props && props.size || 16;
|
|
14909
|
-
return
|
|
15650
|
+
return import_react22.default.createElement(
|
|
14910
15651
|
"svg",
|
|
14911
15652
|
{ width: size, height: size, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.3, "aria-hidden": true },
|
|
14912
|
-
|
|
14913
|
-
|
|
14914
|
-
|
|
14915
|
-
|
|
15653
|
+
import_react22.default.createElement("rect", { x: 2.5, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
|
|
15654
|
+
import_react22.default.createElement("rect", { x: 9, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
|
|
15655
|
+
import_react22.default.createElement("rect", { x: 2.5, y: 9, width: 4.4, height: 4.4, rx: 1.2 }),
|
|
15656
|
+
import_react22.default.createElement("rect", { x: 9, y: 9, width: 4.4, height: 4.4, rx: 1.2 })
|
|
14916
15657
|
);
|
|
14917
15658
|
}
|
|
14918
15659
|
function DockWorkspace() {
|
|
14919
|
-
const [nav, setNav] =
|
|
14920
|
-
|
|
15660
|
+
const [nav, setNav] = import_react22.default.useState({ open: panelNav.open, active: panelNav.active, params: panelNav.params });
|
|
15661
|
+
import_react22.default.useEffect(() => subscribePanel(() => setNav({ open: panelNav.open, active: panelNav.active, params: panelNav.params })), []);
|
|
14921
15662
|
const active = nav.active;
|
|
14922
15663
|
const navParams = nav.params;
|
|
14923
15664
|
const setActive = navigatePanel;
|
|
14924
|
-
const [, force] =
|
|
15665
|
+
const [, force] = import_react22.default.useReducer((n) => n + 1, 0);
|
|
14925
15666
|
useExternalVersion();
|
|
14926
|
-
const contentRef =
|
|
14927
|
-
|
|
15667
|
+
const contentRef = import_react22.default.useRef(null);
|
|
15668
|
+
import_react22.default.useEffect(() => {
|
|
14928
15669
|
if (contentRef.current) contentRef.current.scrollTop = 0;
|
|
14929
15670
|
}, [active]);
|
|
14930
15671
|
const MODULES = allModules();
|
|
@@ -14932,26 +15673,26 @@ function DockWorkspace() {
|
|
|
14932
15673
|
const mod = isHome ? null : MODULES.find((m) => m.id === active) || MODULES[0];
|
|
14933
15674
|
const st = mod ? stateOf(mod.id) : null;
|
|
14934
15675
|
const View = mod ? mod.View : null;
|
|
14935
|
-
const viewNode = mod && View ?
|
|
15676
|
+
const viewNode = mod && View ? import_react22.default.createElement(
|
|
14936
15677
|
"div",
|
|
14937
15678
|
{ className: "dockm-view" },
|
|
14938
|
-
|
|
15679
|
+
import_react22.default.createElement(
|
|
14939
15680
|
FeatureBoundary,
|
|
14940
15681
|
{ key: mod.id, label: mod.name },
|
|
14941
|
-
|
|
15682
|
+
import_react22.default.createElement(View, { ctx: ctxRef.current, feature: mod, params: navParams })
|
|
14942
15683
|
)
|
|
14943
15684
|
) : null;
|
|
14944
15685
|
const enabledCount = MODULES.filter((m) => {
|
|
14945
15686
|
const s = stateOf(m.id);
|
|
14946
15687
|
return !!(s && s.enabled);
|
|
14947
15688
|
}).length;
|
|
14948
|
-
return
|
|
15689
|
+
return import_react22.default.createElement(
|
|
14949
15690
|
"div",
|
|
14950
15691
|
{ className: "dockm-body" },
|
|
14951
|
-
|
|
15692
|
+
import_react22.default.createElement(
|
|
14952
15693
|
"nav",
|
|
14953
15694
|
{ className: "dockm-nav", "aria-label": "\u529F\u80FD\u6A21\u5757" },
|
|
14954
|
-
|
|
15695
|
+
import_react22.default.createElement(
|
|
14955
15696
|
"button",
|
|
14956
15697
|
{
|
|
14957
15698
|
type: "button",
|
|
@@ -14959,10 +15700,10 @@ function DockWorkspace() {
|
|
|
14959
15700
|
className: "dockm-nav-item" + (isHome ? " on" : ""),
|
|
14960
15701
|
onClick: () => setActive("home")
|
|
14961
15702
|
},
|
|
14962
|
-
|
|
14963
|
-
|
|
15703
|
+
import_react22.default.createElement("span", { className: "dockm-navhome" }, import_react22.default.createElement(DockIcon, null)),
|
|
15704
|
+
import_react22.default.createElement("span", null, "\u9996\u9875")
|
|
14964
15705
|
),
|
|
14965
|
-
MODULES.map((m) =>
|
|
15706
|
+
MODULES.map((m) => import_react22.default.createElement(
|
|
14966
15707
|
"button",
|
|
14967
15708
|
{
|
|
14968
15709
|
type: "button",
|
|
@@ -14970,42 +15711,42 @@ function DockWorkspace() {
|
|
|
14970
15711
|
className: "dockm-nav-item" + (m.id === active ? " on" : ""),
|
|
14971
15712
|
onClick: () => setActive(m.id)
|
|
14972
15713
|
},
|
|
14973
|
-
|
|
14974
|
-
|
|
14975
|
-
m.planned ?
|
|
14976
|
-
m.external ?
|
|
15714
|
+
import_react22.default.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
|
|
15715
|
+
import_react22.default.createElement("span", null, m.name),
|
|
15716
|
+
m.planned ? import_react22.default.createElement("span", { className: "dockm-badge" }, "\u89C4\u5212\u4E2D") : null,
|
|
15717
|
+
m.external ? import_react22.default.createElement("span", { className: "dockm-badge" }, "\u5916\u90E8") : null
|
|
14977
15718
|
))
|
|
14978
15719
|
),
|
|
14979
|
-
|
|
15720
|
+
import_react22.default.createElement(
|
|
14980
15721
|
"div",
|
|
14981
15722
|
{ className: "dockm-content", ref: contentRef },
|
|
14982
|
-
|
|
15723
|
+
import_react22.default.createElement(
|
|
14983
15724
|
"div",
|
|
14984
15725
|
{ className: "dockm-content-head" },
|
|
14985
|
-
|
|
15726
|
+
import_react22.default.createElement(
|
|
14986
15727
|
"div",
|
|
14987
15728
|
{ className: "dockm-name" },
|
|
14988
|
-
isHome ?
|
|
15729
|
+
isHome ? import_react22.default.createElement("span", { className: "dockm-navhome" }, import_react22.default.createElement(DockIcon, null)) : import_react22.default.createElement("span", { className: "dockm-dot", style: { background: mod.accent } }),
|
|
14989
15730
|
isHome ? "\u9996\u9875" : mod.name,
|
|
14990
|
-
!isHome && mod.planned ?
|
|
14991
|
-
!isHome && mod.external ?
|
|
15731
|
+
!isHome && mod.planned ? import_react22.default.createElement("span", { className: "dockm-badge" }, "\u89C4\u5212\u4E2D") : null,
|
|
15732
|
+
!isHome && mod.external ? import_react22.default.createElement("span", { className: "dockm-badge" }, "\u5916\u90E8\u5305" + (mod.package ? " \xB7 " + mod.package : "")) : null
|
|
14992
15733
|
),
|
|
14993
|
-
|
|
15734
|
+
import_react22.default.createElement(
|
|
14994
15735
|
"div",
|
|
14995
15736
|
{ className: "dockm-desc" },
|
|
14996
15737
|
isHome ? "\u6240\u6709\u5B50\u529F\u80FD\u603B\u63FD\uFF1A\u8FD0\u884C\u72B6\u6001\u3001\u6982\u8981\u4E0E\u5FEB\u6377\u5F00\u5173\uFF0C\u70B9\u51FB\u5361\u7247\u8FDB\u5165\u5BF9\u5E94\u529F\u80FD\u9875\u3002" : mod.description
|
|
14997
15738
|
)
|
|
14998
15739
|
),
|
|
14999
|
-
isHome ?
|
|
15000
|
-
|
|
15740
|
+
isHome ? import_react22.default.createElement("div", { className: "dockm-view" }, import_react22.default.createElement(HomeView, { ctx: ctxRef.current, onOpen: setActive, onToggle: force })) : mod.planned ? import_react22.default.createElement("div", { className: "dockm-note" }, PLANNED_NOTES[mod.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : st && st.enabled && viewNode ? viewNode : st && st.error ? import_react22.default.createElement("div", { className: "dockm-note dockm-err" }, "\u529F\u80FD\u51FA\u9519\uFF1A" + st.error) : import_react22.default.createElement("div", { className: "dockm-note" }, "\u8BE5\u529F\u80FD\u5F53\u524D\u4E3A\u505C\u7528\u72B6\u6001\uFF08\u5F00\u5173\u5DF2\u6301\u4E45\u5316\uFF0C\u91CD\u542F\u540E\u4FDD\u6301\uFF09"),
|
|
15741
|
+
import_react22.default.createElement(
|
|
15001
15742
|
"div",
|
|
15002
15743
|
{ className: "dockm-foot" },
|
|
15003
|
-
|
|
15004
|
-
!isHome && mod && !mod.planned && st ?
|
|
15744
|
+
import_react22.default.createElement("span", null, isHome ? "\u529F\u80FD\u575E v" + DOCK_VERSION + " \xB7 \u5171 " + MODULES.length + " \u4E2A\u529F\u80FD\u6A21\u5757\uFF0C" + enabledCount + " \u4E2A\u5DF2\u542F\u7528" : "\u529F\u80FD\u575E v" + DOCK_VERSION + " \xB7 \u65B0\u529F\u80FD\u6309\u8DEF\u7EBF\u56FE\u8FFD\u52A0"),
|
|
15745
|
+
!isHome && mod && !mod.planned && st ? import_react22.default.createElement(
|
|
15005
15746
|
"span",
|
|
15006
15747
|
{ className: "dockm-foot-sw" },
|
|
15007
|
-
|
|
15008
|
-
|
|
15748
|
+
import_react22.default.createElement("span", { className: "dockm-foot-swlabel" + (st.enabled ? " on" : "") }, st.enabled ? "\u5DF2\u542F\u7528" : "\u5DF2\u505C\u7528"),
|
|
15749
|
+
import_react22.default.createElement("button", {
|
|
15009
15750
|
type: "button",
|
|
15010
15751
|
className: "dock-sw" + (st.enabled ? " on" : ""),
|
|
15011
15752
|
role: "switch",
|
|
@@ -15018,11 +15759,11 @@ function DockWorkspace() {
|
|
|
15018
15759
|
}
|
|
15019
15760
|
})
|
|
15020
15761
|
) : null,
|
|
15021
|
-
!isHome && mod && typeof mod.Chip === "function" ?
|
|
15762
|
+
!isHome && mod && typeof mod.Chip === "function" ? import_react22.default.createElement(
|
|
15022
15763
|
"span",
|
|
15023
15764
|
{ className: "dockm-foot-sw" },
|
|
15024
|
-
|
|
15025
|
-
|
|
15765
|
+
import_react22.default.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(mod.id) ? " on" : "") }, "\u4F1A\u8BDD\u9875\u5C0F\u63A7\u4EF6"),
|
|
15766
|
+
import_react22.default.createElement("button", {
|
|
15026
15767
|
type: "button",
|
|
15027
15768
|
className: "dock-sw" + (chipShown(mod.id) ? " on" : ""),
|
|
15028
15769
|
role: "switch",
|
|
@@ -15040,12 +15781,12 @@ function DockWorkspace() {
|
|
|
15040
15781
|
);
|
|
15041
15782
|
}
|
|
15042
15783
|
function DockModal() {
|
|
15043
|
-
const [nav, setNav] =
|
|
15044
|
-
|
|
15784
|
+
const [nav, setNav] = import_react22.default.useState({ open: panelNav.open });
|
|
15785
|
+
import_react22.default.useEffect(() => subscribePanel(() => setNav({ open: panelNav.open })), []);
|
|
15045
15786
|
const open = nav.open || typeof document === "undefined";
|
|
15046
|
-
const [win, setWin] =
|
|
15047
|
-
const dlgRef =
|
|
15048
|
-
|
|
15787
|
+
const [win, setWin] = import_react22.default.useState(() => ({ mode: "normal", x: null, y: null, w: null, h: null }));
|
|
15788
|
+
const dlgRef = import_react22.default.useRef(null);
|
|
15789
|
+
import_react22.default.useEffect(() => {
|
|
15049
15790
|
if (lastGeom.w) setWin({ mode: "normal", x: lastGeom.x, y: lastGeom.y, w: lastGeom.w, h: lastGeom.h });
|
|
15050
15791
|
}, []);
|
|
15051
15792
|
function beginDrag(e, type) {
|
|
@@ -15085,10 +15826,10 @@ function DockModal() {
|
|
|
15085
15826
|
width: win.w != null ? win.w : void 0,
|
|
15086
15827
|
height: win.mode === "min" ? "auto" : win.h != null ? win.h : void 0
|
|
15087
15828
|
} : null;
|
|
15088
|
-
return
|
|
15829
|
+
return import_react22.default.createElement(
|
|
15089
15830
|
"div",
|
|
15090
15831
|
{ className: "dockm-backdrop", onClick: () => setPanelOpen(false) },
|
|
15091
|
-
|
|
15832
|
+
import_react22.default.createElement(
|
|
15092
15833
|
"div",
|
|
15093
15834
|
{
|
|
15094
15835
|
className: "dockm-dialog" + (win.mode === "max" ? " dockm-max" : "") + (win.mode === "min" ? " dockm-min" : ""),
|
|
@@ -15096,59 +15837,59 @@ function DockModal() {
|
|
|
15096
15837
|
ref: dlgRef,
|
|
15097
15838
|
onClick: (e) => e.stopPropagation()
|
|
15098
15839
|
},
|
|
15099
|
-
|
|
15840
|
+
import_react22.default.createElement(
|
|
15100
15841
|
"div",
|
|
15101
15842
|
{
|
|
15102
15843
|
className: "dockm-head",
|
|
15103
15844
|
onPointerDown: (e) => beginDrag(e, "move"),
|
|
15104
15845
|
onDoubleClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "max" ? "normal" : "max" }))
|
|
15105
15846
|
},
|
|
15106
|
-
|
|
15107
|
-
|
|
15108
|
-
|
|
15109
|
-
|
|
15847
|
+
import_react22.default.createElement(DockIcon, null),
|
|
15848
|
+
import_react22.default.createElement("span", { className: "dockm-title" }, "\u529F\u80FD\u575E"),
|
|
15849
|
+
import_react22.default.createElement("span", { className: "dockm-sub" }, "dsh-dock \xB7 \u4E5F\u53EF\u5728 \u8BBE\u7F6E \u2192 \u529F\u80FD\u575E \u6253\u5F00\u7BA1\u7406\u9875"),
|
|
15850
|
+
import_react22.default.createElement(
|
|
15110
15851
|
"span",
|
|
15111
15852
|
{ className: "dockm-ctrls" },
|
|
15112
|
-
|
|
15853
|
+
import_react22.default.createElement("button", {
|
|
15113
15854
|
type: "button",
|
|
15114
15855
|
className: "dockm-win",
|
|
15115
15856
|
title: win.mode === "min" ? "\u8FD8\u539F" : "\u6700\u5C0F\u5316",
|
|
15116
15857
|
onClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "min" ? "normal" : "min" }))
|
|
15117
15858
|
}, "\u2581"),
|
|
15118
|
-
|
|
15859
|
+
import_react22.default.createElement("button", {
|
|
15119
15860
|
type: "button",
|
|
15120
15861
|
className: "dockm-win",
|
|
15121
15862
|
title: win.mode === "max" ? "\u8FD8\u539F" : "\u6700\u5927\u5316",
|
|
15122
15863
|
onClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "max" ? "normal" : "max" }))
|
|
15123
15864
|
}, win.mode === "max" ? "\u2750" : "\u25A2"),
|
|
15124
|
-
|
|
15865
|
+
import_react22.default.createElement("button", { type: "button", className: "dockm-close", "aria-label": "\u5173\u95ED", title: "\u5173\u95ED", onClick: () => setPanelOpen(false) }, "\u2715")
|
|
15125
15866
|
)
|
|
15126
15867
|
),
|
|
15127
|
-
|
|
15128
|
-
win.mode === "normal" ?
|
|
15868
|
+
import_react22.default.createElement(DockWorkspace, null),
|
|
15869
|
+
win.mode === "normal" ? import_react22.default.createElement("div", { className: "dockm-resize", onPointerDown: (e) => beginDrag(e, "size") }) : null
|
|
15129
15870
|
)
|
|
15130
15871
|
);
|
|
15131
15872
|
}
|
|
15132
15873
|
function HomeView(props) {
|
|
15133
15874
|
const ctx = props && props.ctx;
|
|
15134
|
-
const [, force] =
|
|
15875
|
+
const [, force] = import_react22.default.useReducer((n) => n + 1, 0);
|
|
15135
15876
|
useExternalVersion();
|
|
15136
15877
|
const open = (id) => {
|
|
15137
15878
|
if (props && typeof props.onOpen === "function") props.onOpen(id);
|
|
15138
15879
|
};
|
|
15139
|
-
return
|
|
15880
|
+
return import_react22.default.createElement(
|
|
15140
15881
|
"div",
|
|
15141
15882
|
{ className: "dockh-grid" },
|
|
15142
15883
|
allModules().map((m) => {
|
|
15143
15884
|
const st = stateOf(m.id);
|
|
15144
15885
|
const enabled = !!(st && st.enabled);
|
|
15145
15886
|
const Stat = m.HomeStat;
|
|
15146
|
-
const statNode = m.planned ?
|
|
15887
|
+
const statNode = m.planned ? import_react22.default.createElement("span", null, PLANNED_NOTES[m.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : enabled && Stat ? import_react22.default.createElement(
|
|
15147
15888
|
FeatureBoundary,
|
|
15148
15889
|
{ key: m.id, label: m.name },
|
|
15149
|
-
|
|
15150
|
-
) :
|
|
15151
|
-
return
|
|
15890
|
+
import_react22.default.createElement(Stat, { ctx })
|
|
15891
|
+
) : import_react22.default.createElement("span", null, "\u5DF2\u505C\u7528\uFF0C\u542F\u7528\u540E\u5728\u6B64\u5C55\u793A\u8FD0\u884C\u6982\u8981");
|
|
15892
|
+
return import_react22.default.createElement(
|
|
15152
15893
|
"div",
|
|
15153
15894
|
{
|
|
15154
15895
|
key: m.id,
|
|
@@ -15163,21 +15904,21 @@ function HomeView(props) {
|
|
|
15163
15904
|
}
|
|
15164
15905
|
}
|
|
15165
15906
|
},
|
|
15166
|
-
|
|
15907
|
+
import_react22.default.createElement(
|
|
15167
15908
|
"div",
|
|
15168
15909
|
{ className: "dockh-head" },
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
m.external ?
|
|
15910
|
+
import_react22.default.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
|
|
15911
|
+
import_react22.default.createElement("span", { className: "dockh-name" }, m.name),
|
|
15912
|
+
m.external ? import_react22.default.createElement("span", { className: "dockh-badge", title: m.package || void 0 }, "\u5916\u90E8") : null,
|
|
15172
15913
|
// 状态标识:圆点 + 文字(纯展示,与开关视觉区分)
|
|
15173
|
-
|
|
15914
|
+
import_react22.default.createElement(
|
|
15174
15915
|
"span",
|
|
15175
15916
|
{ className: "dockh-status" + (m.planned ? " plan" : enabled ? "" : " off") },
|
|
15176
|
-
|
|
15177
|
-
|
|
15917
|
+
import_react22.default.createElement("span", { className: "dockh-sdot" }),
|
|
15918
|
+
import_react22.default.createElement("span", null, m.planned ? "\u89C4\u5212\u4E2D" : enabled ? "\u8FD0\u884C\u4E2D" : "\u5DF2\u505C\u7528")
|
|
15178
15919
|
),
|
|
15179
15920
|
// 启停开关(规划中的功能不显示)
|
|
15180
|
-
m.planned ? null :
|
|
15921
|
+
m.planned ? null : import_react22.default.createElement("button", {
|
|
15181
15922
|
type: "button",
|
|
15182
15923
|
className: "dock-sw" + (enabled ? " on" : ""),
|
|
15183
15924
|
role: "switch",
|
|
@@ -15192,12 +15933,12 @@ function HomeView(props) {
|
|
|
15192
15933
|
}
|
|
15193
15934
|
})
|
|
15194
15935
|
),
|
|
15195
|
-
|
|
15196
|
-
|
|
15197
|
-
|
|
15936
|
+
import_react22.default.createElement("div", { className: "dockh-desc" }, m.description),
|
|
15937
|
+
import_react22.default.createElement("div", { className: "dockh-stat" }, statNode),
|
|
15938
|
+
import_react22.default.createElement(
|
|
15198
15939
|
"div",
|
|
15199
15940
|
{ className: "dockh-foot" },
|
|
15200
|
-
|
|
15941
|
+
import_react22.default.createElement("span", { className: "dockh-go" }, "\u67E5\u770B\u8BE6\u60C5 \u2192")
|
|
15201
15942
|
)
|
|
15202
15943
|
);
|
|
15203
15944
|
})
|
|
@@ -15205,16 +15946,16 @@ function HomeView(props) {
|
|
|
15205
15946
|
}
|
|
15206
15947
|
function DockPanel(props) {
|
|
15207
15948
|
const ctx = ctxRef.current;
|
|
15208
|
-
const [, force] =
|
|
15949
|
+
const [, force] = import_react22.default.useReducer((n) => n + 1, 0);
|
|
15209
15950
|
useExternalVersion();
|
|
15210
15951
|
const toggle = (id) => {
|
|
15211
15952
|
toggleFeature(id);
|
|
15212
15953
|
force();
|
|
15213
15954
|
};
|
|
15214
|
-
return
|
|
15955
|
+
return import_react22.default.createElement(
|
|
15215
15956
|
"div",
|
|
15216
15957
|
{ className: "dock-root" },
|
|
15217
|
-
|
|
15958
|
+
import_react22.default.createElement(
|
|
15218
15959
|
"div",
|
|
15219
15960
|
{ className: "dock-intro" },
|
|
15220
15961
|
"\u529F\u80FD\u575E\uFF08dsh-dock\uFF09\xB7 \u6240\u6709\u5C0F\u529F\u80FD\u96C6\u4E2D\u5728\u8FD9\u4E00\u4E2A\u9762\u677F\u91CC\u7BA1\u7406\u3002v0.4.0 \u8D77\u6BCF\u4E2A\u529F\u80FD\u662F\u72EC\u7ACB\u6A21\u5757\uFF08features/<id>/\uFF09\uFF0C",
|
|
@@ -15223,25 +15964,25 @@ function DockPanel(props) {
|
|
|
15223
15964
|
allModules().map((f) => {
|
|
15224
15965
|
const st = stateOf(f.id);
|
|
15225
15966
|
const View = f.View;
|
|
15226
|
-
const viewNode = !f.planned && st.enabled && View ?
|
|
15967
|
+
const viewNode = !f.planned && st.enabled && View ? import_react22.default.createElement(
|
|
15227
15968
|
"div",
|
|
15228
15969
|
{ className: "dock-body" },
|
|
15229
|
-
|
|
15970
|
+
import_react22.default.createElement(
|
|
15230
15971
|
FeatureBoundary,
|
|
15231
15972
|
{ key: f.id, label: f.name },
|
|
15232
|
-
|
|
15973
|
+
import_react22.default.createElement(View, { ctx, feature: f, params: props && props.params })
|
|
15233
15974
|
)
|
|
15234
15975
|
) : null;
|
|
15235
|
-
return
|
|
15976
|
+
return import_react22.default.createElement(
|
|
15236
15977
|
"div",
|
|
15237
15978
|
{ className: "dock-card", key: f.id },
|
|
15238
|
-
|
|
15979
|
+
import_react22.default.createElement(
|
|
15239
15980
|
"div",
|
|
15240
15981
|
{ className: "dock-card-head" },
|
|
15241
|
-
|
|
15242
|
-
|
|
15243
|
-
|
|
15244
|
-
f.planned ?
|
|
15982
|
+
import_react22.default.createElement("span", { className: "dock-dot" + (st.error ? " err" : st.enabled ? " on" : "") }),
|
|
15983
|
+
import_react22.default.createElement("span", { className: "dock-name" }, f.name),
|
|
15984
|
+
import_react22.default.createElement("span", { className: "dock-desc" }, f.description + (f.external ? "\uFF08\u6765\u81EA\u5916\u90E8\u5305" + (f.package ? " " + f.package : "") + "\uFF09" : "")),
|
|
15985
|
+
f.planned ? import_react22.default.createElement("span", { className: "dock-badge" }, "\u89C4\u5212\u4E2D") : import_react22.default.createElement("button", {
|
|
15245
15986
|
type: "button",
|
|
15246
15987
|
className: "dock-sw" + (st.enabled ? " on" : ""),
|
|
15247
15988
|
role: "switch",
|
|
@@ -15250,11 +15991,11 @@ function DockPanel(props) {
|
|
|
15250
15991
|
title: st.enabled ? "\u505C\u7528\u300C" + f.name + "\u300D" : "\u542F\u7528\u300C" + f.name + "\u300D",
|
|
15251
15992
|
onClick: () => toggle(f.id)
|
|
15252
15993
|
}),
|
|
15253
|
-
!f.planned && typeof f.Chip === "function" ?
|
|
15994
|
+
!f.planned && typeof f.Chip === "function" ? import_react22.default.createElement(
|
|
15254
15995
|
"span",
|
|
15255
15996
|
{ className: "dockm-foot-sw" },
|
|
15256
|
-
|
|
15257
|
-
|
|
15997
|
+
import_react22.default.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(f.id) ? " on" : "") }, "\u4F1A\u8BDD\u9875\u5C0F\u63A7\u4EF6"),
|
|
15998
|
+
import_react22.default.createElement("button", {
|
|
15258
15999
|
type: "button",
|
|
15259
16000
|
className: "dock-sw" + (chipShown(f.id) ? " on" : ""),
|
|
15260
16001
|
role: "switch",
|
|
@@ -15268,7 +16009,7 @@ function DockPanel(props) {
|
|
|
15268
16009
|
})
|
|
15269
16010
|
) : null
|
|
15270
16011
|
),
|
|
15271
|
-
f.planned ?
|
|
16012
|
+
f.planned ? import_react22.default.createElement("div", { className: "dock-body" }, PLANNED_NOTES[f.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : st.error ? import_react22.default.createElement("div", { className: "dock-body dockm-err" }, "\u529F\u80FD\u51FA\u9519\uFF1A" + st.error) : null,
|
|
15272
16013
|
viewNode
|
|
15273
16014
|
);
|
|
15274
16015
|
})
|
|
@@ -15276,7 +16017,7 @@ function DockPanel(props) {
|
|
|
15276
16017
|
}
|
|
15277
16018
|
function DockPage() {
|
|
15278
16019
|
const ctx = ctxRef.current;
|
|
15279
|
-
const [wide, setWide] =
|
|
16020
|
+
const [wide, setWide] = import_react22.default.useState(false);
|
|
15280
16021
|
const toggleWide = () => {
|
|
15281
16022
|
try {
|
|
15282
16023
|
const layout = ctx && typeof ctx.get === "function" ? ctx.get("layout") : null;
|
|
@@ -15287,20 +16028,20 @@ function DockPage() {
|
|
|
15287
16028
|
} catch (e) {
|
|
15288
16029
|
}
|
|
15289
16030
|
};
|
|
15290
|
-
return
|
|
16031
|
+
return import_react22.default.createElement(
|
|
15291
16032
|
"div",
|
|
15292
16033
|
{ className: "dockm-page" + (wide ? " dockm-page-wide" : "") },
|
|
15293
|
-
|
|
16034
|
+
import_react22.default.createElement(
|
|
15294
16035
|
"div",
|
|
15295
16036
|
{ className: "dockm-page-head" },
|
|
15296
|
-
|
|
15297
|
-
|
|
16037
|
+
import_react22.default.createElement("span", { className: "dockm-page-icon" }, import_react22.default.createElement(DockIcon, { size: 20 })),
|
|
16038
|
+
import_react22.default.createElement(
|
|
15298
16039
|
"div",
|
|
15299
16040
|
{ className: "dockm-page-titles" },
|
|
15300
|
-
|
|
15301
|
-
|
|
16041
|
+
import_react22.default.createElement("div", { className: "dockm-page-title" }, "\u529F\u80FD\u575E"),
|
|
16042
|
+
import_react22.default.createElement("div", { className: "dockm-page-sub" }, "\u6240\u6709\u5C0F\u529F\u80FD\u96C6\u4E2D\u5728\u8FD9\u91CC\u7BA1\u7406\u3002\u4FA7\u680F\u56FE\u6807\u53EF\u5728\u300C\u66F4\u591A\u300D\u83DC\u5355\u91CC Pin \u5230\u9876\u90E8\uFF0C\u6216\u53D6\u6D88\u56FA\u5B9A\u6536\u8FDB\u66F4\u591A\u3002")
|
|
15302
16043
|
),
|
|
15303
|
-
|
|
16044
|
+
import_react22.default.createElement("button", {
|
|
15304
16045
|
type: "button",
|
|
15305
16046
|
className: "dockm-page-wide-btn",
|
|
15306
16047
|
title: wide ? "\u8FD8\u539F\u4FA7\u680F\u5BBD\u5EA6" : "\u6536\u8D77\u5DE6\u4FA7\u680F\uFF0C\u5168\u5C4F\u663E\u793A\u529F\u80FD\u575E",
|
|
@@ -15308,19 +16049,19 @@ function DockPage() {
|
|
|
15308
16049
|
onClick: toggleWide
|
|
15309
16050
|
}, wide ? "\u2750 \u8FD8\u539F" : "\u25A2 \u5168\u5C4F")
|
|
15310
16051
|
),
|
|
15311
|
-
|
|
16052
|
+
import_react22.default.createElement("div", { className: "dockm-page-body" }, import_react22.default.createElement(DockWorkspace, null))
|
|
15312
16053
|
);
|
|
15313
16054
|
}
|
|
15314
16055
|
function DockChips(props) {
|
|
15315
|
-
const [, force] =
|
|
15316
|
-
|
|
16056
|
+
const [, force] = import_react22.default.useReducer((n) => n + 1, 0);
|
|
16057
|
+
import_react22.default.useEffect(() => subscribeFeatureState(() => force()), []);
|
|
15317
16058
|
const items = [];
|
|
15318
16059
|
for (const f of allModules()) {
|
|
15319
16060
|
if (f.planned || !stateOf(f.id).enabled || !chipShown(f.id) || typeof f.Chip !== "function") continue;
|
|
15320
|
-
items.push(
|
|
16061
|
+
items.push(import_react22.default.createElement(
|
|
15321
16062
|
FeatureBoundary,
|
|
15322
16063
|
{ key: f.id, label: f.name },
|
|
15323
|
-
|
|
16064
|
+
import_react22.default.createElement(f.Chip, {
|
|
15324
16065
|
ctx: props.ctx,
|
|
15325
16066
|
feature: f,
|
|
15326
16067
|
session: props.session,
|
|
@@ -15330,38 +16071,38 @@ function DockChips(props) {
|
|
|
15330
16071
|
));
|
|
15331
16072
|
}
|
|
15332
16073
|
if (items.length === 0) return null;
|
|
15333
|
-
return
|
|
16074
|
+
return import_react22.default.createElement("div", { className: "dockchip-row" }, items);
|
|
15334
16075
|
}
|
|
15335
16076
|
function FeatureOverlays() {
|
|
15336
|
-
const [, force] =
|
|
16077
|
+
const [, force] = import_react22.default.useReducer((n) => n + 1, 0);
|
|
15337
16078
|
useExternalVersion();
|
|
15338
|
-
|
|
16079
|
+
import_react22.default.useEffect(() => subscribeFeatureState(() => force()), []);
|
|
15339
16080
|
const items = [];
|
|
15340
16081
|
for (const f of allModules()) {
|
|
15341
16082
|
if (f.planned || !stateOf(f.id).enabled || typeof f.Overlay !== "function") continue;
|
|
15342
|
-
items.push(
|
|
16083
|
+
items.push(import_react22.default.createElement(
|
|
15343
16084
|
FeatureBoundary,
|
|
15344
16085
|
{ key: f.id, label: f.name },
|
|
15345
|
-
|
|
16086
|
+
import_react22.default.createElement(f.Overlay, { ctx: ctxRef.current, feature: f })
|
|
15346
16087
|
));
|
|
15347
16088
|
}
|
|
15348
16089
|
if (items.length === 0) return null;
|
|
15349
|
-
return
|
|
16090
|
+
return import_react22.default.createElement(import_react22.default.Fragment, null, items);
|
|
15350
16091
|
}
|
|
15351
16092
|
function FeatureTurnTail(props) {
|
|
15352
|
-
const [, force] =
|
|
15353
|
-
|
|
16093
|
+
const [, force] = import_react22.default.useReducer((n) => n + 1, 0);
|
|
16094
|
+
import_react22.default.useEffect(() => subscribeFeatureState(() => force()), []);
|
|
15354
16095
|
const items = [];
|
|
15355
16096
|
for (const f of allModules()) {
|
|
15356
16097
|
if (f.planned || !stateOf(f.id).enabled || typeof f.TurnTail !== "function") continue;
|
|
15357
|
-
items.push(
|
|
16098
|
+
items.push(import_react22.default.createElement(
|
|
15358
16099
|
FeatureBoundary,
|
|
15359
16100
|
{ key: f.id, label: f.name },
|
|
15360
|
-
|
|
16101
|
+
import_react22.default.createElement(f.TurnTail, Object.assign({}, props, { ctx: ctxRef.current, feature: f }))
|
|
15361
16102
|
));
|
|
15362
16103
|
}
|
|
15363
16104
|
if (items.length === 0) return null;
|
|
15364
|
-
return
|
|
16105
|
+
return import_react22.default.createElement(import_react22.default.Fragment, null, items);
|
|
15365
16106
|
}
|
|
15366
16107
|
var ctxRef = { current: null };
|
|
15367
16108
|
function apply(ctx) {
|
|
@@ -15372,31 +16113,31 @@ function apply(ctx) {
|
|
|
15372
16113
|
if (slots === void 0) return;
|
|
15373
16114
|
slots.inject("sidebar.panellist", () => slots.register(
|
|
15374
16115
|
{ name: "sidebar.panellist", id: "dsh-dock", order: 30, label: "\u529F\u80FD\u575E" },
|
|
15375
|
-
(props) =>
|
|
16116
|
+
(props) => import_react22.default.createElement(DockIcon, { size: props && props.size || 18 })
|
|
15376
16117
|
));
|
|
15377
16118
|
slots.inject("main", () => slots.register(
|
|
15378
16119
|
{ name: "main", key: "dsh-dock", label: "\u529F\u80FD\u575E" },
|
|
15379
|
-
() =>
|
|
16120
|
+
() => import_react22.default.createElement(DockPage, null)
|
|
15380
16121
|
));
|
|
15381
16122
|
slots.inject("shell.overlay", () => slots.register(
|
|
15382
16123
|
{ name: "shell.overlay", id: "dsh-dock-panel", order: 21, label: "\u529F\u80FD\u575E\u9762\u677F" },
|
|
15383
|
-
() =>
|
|
16124
|
+
() => import_react22.default.createElement(DockModal, null)
|
|
15384
16125
|
));
|
|
15385
16126
|
slots.inject("shell.overlay", () => slots.register(
|
|
15386
16127
|
{ name: "shell.overlay", id: "dsh-dock-feature-overlays", order: 22, label: "\u529F\u80FD\u575E\u5168\u5C40\u6D6E\u5C42" },
|
|
15387
|
-
() =>
|
|
16128
|
+
() => import_react22.default.createElement(FeatureOverlays, null)
|
|
15388
16129
|
));
|
|
15389
16130
|
slots.inject("settings.section", () => slots.register(
|
|
15390
16131
|
{ name: "settings.section", id: "dsh-dock", order: 90, label: "\u529F\u80FD\u575E" },
|
|
15391
|
-
(props) =>
|
|
16132
|
+
(props) => import_react22.default.createElement(DockPanel, props)
|
|
15392
16133
|
));
|
|
15393
16134
|
slots.inject("conversation.input.left", () => slots.register(
|
|
15394
16135
|
{ name: "conversation.input.left", id: "dsh-dock-chips", order: 10, label: "\u529F\u80FD\u575E" },
|
|
15395
|
-
(zone) =>
|
|
16136
|
+
(zone) => import_react22.default.createElement(DockChips, Object.assign({}, zone, { ctx: ctxRef.current }))
|
|
15396
16137
|
));
|
|
15397
16138
|
slots.inject("conversation.chat.turnTail", () => slots.register(
|
|
15398
16139
|
{ name: "conversation.chat.turnTail", id: "dsh-dock-turn-tail", order: 40, label: "\u529F\u80FD\u575E" },
|
|
15399
|
-
(owner) =>
|
|
16140
|
+
(owner) => import_react22.default.createElement(FeatureTurnTail, owner)
|
|
15400
16141
|
));
|
|
15401
16142
|
}
|
|
15402
16143
|
var inject = ["timer"];
|