@marktrue/dsh-mobile-remote 3.2.4-alpha.1 → 3.2.4-alpha.10
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/CHANGELOG.md +207 -0
- package/README.md +2 -0
- package/docs/03-api.md +265 -4
- package/docs/04-security.md +8 -0
- package/docs/09-compatibility.md +12 -1
- package/docs/10-release.md +33 -60
- package/docs/11-notification-reliability.md +45 -0
- package/docs/12-implementation-status.md +41 -0
- package/docs/13-device-acceptance-2026-11-03.md +37 -0
- package/docs/16-next-window-handoff-2026-11-04.md +44 -0
- package/docs/17-remaining-work-review-2026-11-04.md +53 -0
- package/docs/18-device-reliability-acceptance-2026-11-04.md +63 -0
- package/docs/19-issue-followup-2026-11-04.md +39 -0
- package/docs/20-dsh-022-compatibility-2026-11-05.md +32 -0
- package/lib/client.js +23 -1
- package/lib/endpoint-registry.js +13 -2
- package/lib/git-read-bundled-provider.js +20 -10
- package/lib/git-read-service.js +22 -3
- package/lib/host-manager-update.js +178 -0
- package/lib/host-update-capabilities.js +203 -0
- package/lib/index.js +1811 -88
- package/lib/plugin-self-update.js +110 -9
- package/lib/plugin-update-controller.js +67 -1
- package/package.json +9 -6
package/lib/client.js
CHANGED
|
@@ -340,12 +340,27 @@ window.__ModuleLoader__.load({
|
|
|
340
340
|
var state = String(value.state || "unknown");
|
|
341
341
|
var transaction = value.transaction && typeof value.transaction === "object" ? value.transaction : null;
|
|
342
342
|
var appVersion = String(carrier.appVersion || transaction?.targetAppVersion || "");
|
|
343
|
+
var hostManager = value.hostManager && typeof value.hostManager === "object" ? value.hostManager : null;
|
|
344
|
+
var updateChannel = String(value.updateChannel || "");
|
|
343
345
|
return {
|
|
344
346
|
state: state,
|
|
345
347
|
reason: String(value.reason || ""),
|
|
346
348
|
candidate: candidate,
|
|
347
349
|
hasUpdate: state === "update-available" && Boolean(plugin.version),
|
|
348
350
|
canSelfUpdate: value.canSelfUpdate === true,
|
|
351
|
+
// 通道(v3.5):host-manager = 进程内更新不重启;restart = 装完要重启宿主。
|
|
352
|
+
updateChannel: updateChannel,
|
|
353
|
+
updateChannelDescription: String(value.updateChannelDescription || ""),
|
|
354
|
+
canRestartHost: value.canRestartHost === true,
|
|
355
|
+
// 是否由宿主管理器在进程内完成(界面据此选择"不中断"措辞)。
|
|
356
|
+
usesHostManager: updateChannel === "host-manager",
|
|
357
|
+
hostManagerHmrAvailable: hostManager ? hostManager.hmrAvailable === true : null,
|
|
358
|
+
// 本次更新是否会让连接短暂断开(决定要不要提前预告)。
|
|
359
|
+
updateRestartsHost: updateChannel === "host-manager"
|
|
360
|
+
? (hostManager ? hostManager.hmrAvailable === false : false)
|
|
361
|
+
: updateChannel === "restart"
|
|
362
|
+
? true
|
|
363
|
+
: (updateChannel === "" && value.canSelfUpdate === true),
|
|
349
364
|
pluginVersion: String(plugin.version || transaction?.targetVersion || ""),
|
|
350
365
|
appVersion: appVersion,
|
|
351
366
|
needsPreparation: state === "update-available" && !appVersion,
|
|
@@ -817,11 +832,18 @@ window.__ModuleLoader__.load({
|
|
|
817
832
|
jsxRuntime.jsx("div", { style: { fontSize: "12.5px", color: "var(--dsw-alias-label-secondary, #888)" }, children: statusText }),
|
|
818
833
|
progressBox,
|
|
819
834
|
model.hasUpdate ? jsxRuntime.jsx("div", { style: { fontSize: "12.5px", lineHeight: "1.6" }, children: "插件 v" + pluginVersion + (appVersion ? " · App build " + appVersion : " · App build 将在准备后核验") }) : null,
|
|
835
|
+
// v3.5:把实际更新通道讲清楚——「不重启」与「会重启」对用户是完全不同的体验,
|
|
836
|
+
// 不能只在出错时才让用户猜。
|
|
837
|
+
model.hasUpdate && model.updateChannelDescription
|
|
838
|
+
? jsxRuntime.jsx("div", { style: { fontSize: "12px", lineHeight: "1.6", color: "var(--dsw-alias-label-secondary, #888)" },
|
|
839
|
+
children: model.updateChannelDescription + (model.updateRestartsHost ? ";期间连接会短暂断开,重连后自动接续。" : ";连接不会中断。") })
|
|
840
|
+
: null,
|
|
820
841
|
operationTarget,
|
|
821
842
|
model.hasUpdate && !model.canSelfUpdate ? jsxRuntime.jsx("div", { style: { fontSize: "12px", color: "var(--dsw-alias-label-secondary, #888)" }, children: model.guidance?.summary || "当前安装形态需要按电脑端指引更新。" }) : null,
|
|
822
843
|
workflow.status === "preparing" ? jsxRuntime.jsx("div", { style: { fontSize: "12px" }, children: "正在从主机 NPM 源准备并校验 carrier;profile 尚未修改…" }) : null,
|
|
844
|
+
workflow.status === "submitting" && model.usesHostManager ? jsxRuntime.jsx("div", { style: { fontSize: "12px" }, children: "正在交给宿主插件管理器处理…" }) : null,
|
|
823
845
|
workflow.status === "submitting" ? jsxRuntime.jsx("div", { style: { fontSize: "12px" }, children: "正在提交安装事务…" }) : null,
|
|
824
|
-
workflow.status === "running" ? jsxRuntime.jsx("div", { style: { fontSize: "12px" }, children: "
|
|
846
|
+
workflow.status === "running" ? jsxRuntime.jsx("div", { style: { fontSize: "12px" }, children: model.updateRestartsHost ? "安装/重启进行中;输出会保留并可在重连后继续查看。" : "宿主插件管理器正在进程内更新;连接不会中断,输出会保留。" }) : null,
|
|
825
847
|
workflow.message ? jsxRuntime.jsx("div", { style: { fontSize: "12px", color: workflow.status === "failed" ? "var(--dsw-alias-text-danger, #e5484d)" : "inherit" }, children: workflow.message }) : null,
|
|
826
848
|
detailsPanel,
|
|
827
849
|
actionButton,
|
package/lib/endpoint-registry.js
CHANGED
|
@@ -33,8 +33,16 @@ export function extractEndpointDetails(source) {
|
|
|
33
33
|
if (out.has(path)) continue;
|
|
34
34
|
const next = markLines.find((l) => l > index);
|
|
35
35
|
const segment = lines.slice(index, next ?? Math.min(lines.length, index + 400)).join("\n");
|
|
36
|
+
// 路由**头部**(分派行 + 紧随其后的 2 行)才代表该端点的方法契约;块内更深处的
|
|
37
|
+
// GET/HEAD 分支(如 /goal 内部图片/下载分支)不能把整个端点判成 GET/HEAD。
|
|
38
|
+
const header = lines.slice(index, Math.min(lines.length, index + 3)).join("\n");
|
|
36
39
|
let methods = "GET/POST";
|
|
37
|
-
|
|
40
|
+
// issue #60 recheck-2(R02):头部显式 `(method === "GET" || method === "HEAD")`
|
|
41
|
+
// 必须抽成 GET/HEAD——HEAD 是真实分派语义,不能被默认成 GET/POST。
|
|
42
|
+
const allowsHead = /method\s*===\s*['"]GET['"]\s*\|\|\s*method\s*===\s*['"]HEAD['"]/.test(header);
|
|
43
|
+
const allowsPost = /method\s*===\s*['"]POST['"]/.test(segment) || /requirePost\(method,\s*res\)/.test(segment);
|
|
44
|
+
if (allowsHead && !allowsPost) methods = "GET/HEAD";
|
|
45
|
+
else if (/requireGet\(method,\s*res\)/.test(segment) || /method\s*!==\s*['"]GET['"]/.test(segment)) methods = "GET";
|
|
38
46
|
else if (/method\s*!==\s*['"]POST['"]/.test(segment)) methods = "POST";
|
|
39
47
|
out.set(path, methods);
|
|
40
48
|
}
|
|
@@ -109,6 +117,8 @@ export const REGISTERED_ENDPOINTS = Object.freeze([
|
|
|
109
117
|
{ path: "/balance", methods: "GET", capability: null, why: NO_CAPABILITY_NEEDED },
|
|
110
118
|
{ path: "/bootstrap", methods: "GET", capability: null, why: NO_CAPABILITY_NEEDED },
|
|
111
119
|
{ path: "/catalog", methods: "GET", capability: null, why: NO_CAPABILITY_NEEDED },
|
|
120
|
+
{ path: "/changes/diff", methods: "GET", capability: "turnTail" },
|
|
121
|
+
{ path: "/changes/summary", methods: "GET", capability: "turnTail" },
|
|
112
122
|
{ path: "/commands", methods: "GET/POST", capability: null, why: NO_CAPABILITY_NEEDED },
|
|
113
123
|
{ path: "/defaults", methods: "GET/POST", capability: null, why: NO_CAPABILITY_NEEDED },
|
|
114
124
|
{ path: "/dev/approval-test", methods: "GET/POST", capability: null, why: NO_CAPABILITY_NEEDED },
|
|
@@ -117,7 +127,7 @@ export const REGISTERED_ENDPOINTS = Object.freeze([
|
|
|
117
127
|
{ path: "/event-detail", methods: "GET", capability: "eventTimeline" },
|
|
118
128
|
{ path: "/events", methods: "GET", capability: "eventTimeline" },
|
|
119
129
|
{ path: "/feedback", methods: "GET/POST", capability: null, why: NO_CAPABILITY_NEEDED },
|
|
120
|
-
{ path: "/files", methods: "GET/
|
|
130
|
+
{ path: "/files", methods: "GET/HEAD", capability: null, why: NO_CAPABILITY_NEEDED },
|
|
121
131
|
{ path: "/files/upload", methods: "GET/POST", capability: null, why: NO_CAPABILITY_NEEDED },
|
|
122
132
|
{ path: "/git/branches", methods: "GET", capability: null, why: NO_CAPABILITY_NEEDED },
|
|
123
133
|
{ path: "/git/capabilities", methods: "GET", capability: null, why: NO_CAPABILITY_NEEDED },
|
|
@@ -158,6 +168,7 @@ export const REGISTERED_ENDPOINTS = Object.freeze([
|
|
|
158
168
|
{ path: "/subagents", methods: "GET", capability: null, why: NO_CAPABILITY_NEEDED },
|
|
159
169
|
{ path: "/subagents/interrupt", methods: "GET/POST", capability: null, why: NO_CAPABILITY_NEEDED },
|
|
160
170
|
{ path: "/todos", methods: "GET", capability: null, why: NO_CAPABILITY_NEEDED },
|
|
171
|
+
{ path: "/turn-file", methods: "GET/HEAD", capability: "turnTail" },
|
|
161
172
|
{ path: "/turn-outline", methods: "GET", capability: "turnOutline" },
|
|
162
173
|
{ path: "/update/apk", methods: "GET", capability: null, auth: "anonymous", why: NO_CAPABILITY_NEEDED },
|
|
163
174
|
{ path: "/update/manifest", methods: "GET", capability: null, auth: "required", why: NO_CAPABILITY_NEEDED },
|
|
@@ -265,18 +265,19 @@ export function createBundledGitReadProvider(ctx) {
|
|
|
265
265
|
const records = [];
|
|
266
266
|
// NUL/US-delimited fields keep tagger names and tag subjects that contain
|
|
267
267
|
// tabs intact; a tab-delimited line format would corrupt such records.
|
|
268
|
-
const text = await run(root, ["for-each-ref", "--format=%(refname)%1f%(objectname)%1f%(objecttype)%1f%(HEAD)%1f%(taggername)%1f%(taggerdate:unix)%1f%(subject)%1f%(*objectname)%1f%(*objecttype)%00", "refs/heads", "refs/remotes", "refs/tags"]);
|
|
268
|
+
const text = await run(root, ["for-each-ref", "--format=%(refname)%1f%(objectname)%1f%(objecttype)%1f%(HEAD)%1f%(taggername)%1f%(taggerdate:unix)%1f%(subject)%1f%(*objectname)%1f%(*objecttype)%1f%(type)%00", "refs/heads", "refs/remotes", "refs/tags"]);
|
|
269
269
|
for (const raw of text.split("\0")) {
|
|
270
270
|
const record = raw.replace(/^[\r\n]+|[\r\n]+$/g, "");
|
|
271
271
|
if (!record) continue;
|
|
272
272
|
const fields = record.split("\x1f");
|
|
273
|
-
if (fields.length <
|
|
273
|
+
if (fields.length < 10) continue;
|
|
274
274
|
// Peeled fields are fixed at the tail so a subject containing the
|
|
275
275
|
// unit separator cannot swallow them.
|
|
276
276
|
const [name, oid, objectType, headFlag, taggerName, taggerDate] = fields;
|
|
277
|
-
const
|
|
278
|
-
const
|
|
279
|
-
const
|
|
277
|
+
const targetType = fields.at(-1); // %(type) is the direct tag target, including on Git 2.52+.
|
|
278
|
+
const peeledType = fields.at(-2);
|
|
279
|
+
const peeledOid = fields.at(-3);
|
|
280
|
+
const subject = fields.slice(6, -3).join("\x1f");
|
|
280
281
|
if (!name || !oid) continue;
|
|
281
282
|
if (name.startsWith("refs/remotes/") && name.endsWith("/HEAD")) continue;
|
|
282
283
|
if (name.startsWith("refs/heads/") || name.startsWith("refs/remotes/")) {
|
|
@@ -301,7 +302,10 @@ export function createBundledGitReadProvider(ctx) {
|
|
|
301
302
|
continue;
|
|
302
303
|
}
|
|
303
304
|
let commitOid = null, hint;
|
|
304
|
-
if (peeledType === "commit")
|
|
305
|
+
if (targetType === "tag" && peeledType === "commit") {
|
|
306
|
+
commitOid = peeledOid;
|
|
307
|
+
hint = "nested-tag";
|
|
308
|
+
} else if (peeledType === "commit") commitOid = peeledOid;
|
|
305
309
|
else if (peeledType === "tag") {
|
|
306
310
|
// Nested tag: peel recursively; when the chain ends outside a
|
|
307
311
|
// commit we still keep the name and advertise the hint.
|
|
@@ -354,14 +358,20 @@ export function createBundledGitReadProvider(ctx) {
|
|
|
354
358
|
*/
|
|
355
359
|
async fileHistory(root, path, { maxCommits = 5000, timeoutMs = 20000 } = {}) {
|
|
356
360
|
if (typeof path !== "string" || path === "" || path.includes("\0")) throw gitError("git-command-failed", 400);
|
|
357
|
-
|
|
361
|
+
const deadline = Date.now() + timeoutMs;
|
|
362
|
+
const historyRun = (args) => spawnGit(root, args, { timeoutMs: Math.max(1, deadline - Date.now()) });
|
|
363
|
+
try {
|
|
364
|
+
const check = await historyRun(["rev-parse", "--verify", "HEAD"]);
|
|
365
|
+
if (check.timedOut) return { entries: [], truncated: true };
|
|
366
|
+
} catch (error) {
|
|
358
367
|
if (error?.code === "git-command-failed") return { entries: [], truncated: false, reason: "no-history" };
|
|
359
368
|
throw error;
|
|
360
369
|
}
|
|
361
370
|
let tracked = false;
|
|
362
371
|
try {
|
|
363
|
-
const tree = await
|
|
364
|
-
|
|
372
|
+
const tree = await historyRun(["ls-tree", "-z", "HEAD", "--", `:(literal)${path}`]);
|
|
373
|
+
if (tree.timedOut) return { entries: [], truncated: true };
|
|
374
|
+
for (const record of tree.stdout.split("\0")) {
|
|
365
375
|
const separator = record.indexOf("\t");
|
|
366
376
|
if (separator < 0) continue;
|
|
367
377
|
const entryPath = record.slice(separator + 1);
|
|
@@ -375,7 +385,7 @@ export function createBundledGitReadProvider(ctx) {
|
|
|
375
385
|
}
|
|
376
386
|
if (!tracked) return { entries: [], truncated: false, reason: "not-tracked" };
|
|
377
387
|
const cap = Math.max(1, Math.min(5000, Number(maxCommits) || 5000));
|
|
378
|
-
const result = await
|
|
388
|
+
const result = await historyRun(["--literal-pathspecs", "log", `--max-count=${cap + 1}`, "--format=%x00%H%x1f%h%x1f%an%x1f%at%x1f%s", "--name-status", "-M", "-z", "--", path]);
|
|
379
389
|
let entries = parseFileHistory(result.stdout);
|
|
380
390
|
let truncated = result.timedOut === true;
|
|
381
391
|
if (entries.length > cap) {
|
package/lib/git-read-service.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
-
import { basename, isAbsolute, relative, resolve, sep } from "node:path";
|
|
2
|
+
import { basename, dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
3
3
|
import { lstat, realpath } from "node:fs/promises";
|
|
4
4
|
import { createBundledGitReadProvider } from "./git-read-bundled-provider.js";
|
|
5
5
|
|
|
@@ -209,6 +209,7 @@ export function createGitReadService(ctx, { bundledProvider, now = () => Date.no
|
|
|
209
209
|
for (const [id, item] of historyCursors) if (item.expiresAt <= now()) historyCursors.delete(id);
|
|
210
210
|
};
|
|
211
211
|
let pollTimer = null;
|
|
212
|
+
let pollInFlight = null;
|
|
212
213
|
let unsubscribeProvider = null;
|
|
213
214
|
const validOid = (value) => typeof value === "string" && /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i.test(value);
|
|
214
215
|
const safeFilePath = (value) => typeof value === "string" && value !== "" && !isAbsolute(value) && !/^(?:[A-Za-z]:[\\/]|\\\\|[a-z][a-z\d+.-]*:\/\/)/i.test(value) && !value.split(/[\\/]/).includes("..") && !value.includes("\0");
|
|
@@ -263,7 +264,20 @@ export function createGitReadService(ctx, { bundledProvider, now = () => Date.no
|
|
|
263
264
|
// Windows-style absolute paths cannot be mapped on a POSIX host; report
|
|
264
265
|
// them as invalid instead of treating them as a relative filename.
|
|
265
266
|
if (/^(?:[A-Za-z]:[\\/]|\\\\)/.test(input) && !isAbsolute(input)) return null;
|
|
266
|
-
|
|
267
|
+
let candidate = isAbsolute(input) ? resolve(input) : resolve(root, input);
|
|
268
|
+
// Windows clients can send an 8.3 alias while the authorized repository
|
|
269
|
+
// uses its canonical long name. Canonicalize the nearest existing parent,
|
|
270
|
+
// preserving the final filename (a tracked symlink is itself a file).
|
|
271
|
+
let parent = dirname(candidate);
|
|
272
|
+
const tail = [basename(candidate)];
|
|
273
|
+
for (;;) {
|
|
274
|
+
try { candidate = resolve(await realpath(parent), ...tail); break; }
|
|
275
|
+
catch {
|
|
276
|
+
const next = dirname(parent);
|
|
277
|
+
if (next === parent) break;
|
|
278
|
+
tail.unshift(basename(parent)); parent = next;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
267
281
|
const rel = relative(root, candidate);
|
|
268
282
|
if (rel === "") throw failure("path-invalid", 400);
|
|
269
283
|
if (rel === ".." || rel.startsWith(`..${sep}`) || isAbsolute(rel)) return null;
|
|
@@ -552,7 +566,9 @@ export function createGitReadService(ctx, { bundledProvider, now = () => Date.no
|
|
|
552
566
|
}
|
|
553
567
|
return { repositoryId, path: normalized, entries: items, nextCursor, truncated: snapshot.truncated };
|
|
554
568
|
},
|
|
555
|
-
|
|
569
|
+
_pollOnce() {
|
|
570
|
+
if (pollInFlight) return pollInFlight;
|
|
571
|
+
pollInFlight = (async () => {
|
|
556
572
|
for (const [repositoryId, authorized] of bindings) {
|
|
557
573
|
try {
|
|
558
574
|
await binding(authorized.sessionId, repositoryId);
|
|
@@ -563,6 +579,8 @@ export function createGitReadService(ctx, { bundledProvider, now = () => Date.no
|
|
|
563
579
|
}
|
|
564
580
|
} catch { bindings.delete(repositoryId); refSignatures.delete(repositoryId); }
|
|
565
581
|
}
|
|
582
|
+
})().finally(() => { pollInFlight = null; });
|
|
583
|
+
return pollInFlight;
|
|
566
584
|
},
|
|
567
585
|
start() {
|
|
568
586
|
if (unsubscribeProvider || pollTimer) return;
|
|
@@ -595,6 +613,7 @@ export function createGitReadService(ctx, { bundledProvider, now = () => Date.no
|
|
|
595
613
|
pollTimer = null;
|
|
596
614
|
try { unsubscribeProvider?.(); } catch { /* optional provider teardown must not break host shutdown */ }
|
|
597
615
|
unsubscribeProvider = null;
|
|
616
|
+
return pollInFlight ?? Promise.resolve();
|
|
598
617
|
},
|
|
599
618
|
};
|
|
600
619
|
return service;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// 通过宿主原生插件管理器执行更新(DSH 0.2.2+):不重启宿主。
|
|
2
|
+
//
|
|
3
|
+
// 与 `plugin-self-update.js` 那条「改依赖 → pnpm install → 重启 → 健康确认」的传统
|
|
4
|
+
// 通道并列;本模块只在宿主提供 `pluginManager.updateBundle()` 时使用。
|
|
5
|
+
//
|
|
6
|
+
// 为什么优先用它:
|
|
7
|
+
// 1. **不重启**:宿主在 HMR 可用时移除旧版本、装新版本并在进程内重新组合 profile,
|
|
8
|
+
// 插件被重新加载而宿主进程不变——手机与桌面都不掉连接。
|
|
9
|
+
// 2. **判定权交给宿主**:registry 选择、pnpm 配置、凭据、兼容性豁免、构建脚本批准
|
|
10
|
+
// 全部由宿主那一套既有实现决定,我们不重复实现、也不绕过它的安全检查。
|
|
11
|
+
// 3. **失败即回滚**:宿主在装新版本失败/取消时会把旧版本装回去,并把结果如实报出来。
|
|
12
|
+
//
|
|
13
|
+
// 本模块不做的事:不自己跑 pnpm、不改 profile 文件、不做健康判定(宿主的
|
|
14
|
+
// `application` 字段就是结论)。
|
|
15
|
+
import { compareVersion, parseVersion } from "./plugin-update.js";
|
|
16
|
+
import { HOST_MANAGER_REASON, UPDATE_CHANNEL } from "./host-update-capabilities.js";
|
|
17
|
+
|
|
18
|
+
/** 宿主更新失败的稳定原因码(对外只暴露这一类,不含宿主异常原文)。 */
|
|
19
|
+
export const HOST_MANAGER_ERROR = {
|
|
20
|
+
/** 探测阶段就不可用。 */
|
|
21
|
+
UNAVAILABLE: "host-manager-unavailable",
|
|
22
|
+
/** 目标版本不是合法 semver。 */
|
|
23
|
+
VERSION_INVALID: "host-manager-version-invalid",
|
|
24
|
+
/** 目标版本不高于已安装版本(宿主会拒绝,这里提前挡)。 */
|
|
25
|
+
VERSION_NOT_NEWER: "host-manager-version-not-newer",
|
|
26
|
+
/** 宿主拒绝(`ChangeResult.application === 'failed'`)。 */
|
|
27
|
+
REJECTED: "host-manager-rejected",
|
|
28
|
+
/** 用户/调用方取消。 */
|
|
29
|
+
CANCELLED: "host-manager-cancelled",
|
|
30
|
+
/** 装上了但需要重启才生效。 */
|
|
31
|
+
RESTART_REQUIRED: "host-manager-restart-required",
|
|
32
|
+
/** 调用 itself 抛错。 */
|
|
33
|
+
CALL_FAILED: "host-manager-call-failed",
|
|
34
|
+
/** 被替代/覆盖(同一插件条目上有更高优先级的覆盖)。 */
|
|
35
|
+
OVERRIDDEN: "host-manager-overridden",
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 把宿主的 `ChangeResult`(以及 `updateBundle` 外层结果)压成我们自己的稳定结论。
|
|
40
|
+
*
|
|
41
|
+
* 宿主字段语义(见 dsh-plugin-manager 的 `ChangeResult` / `PluginUpdateResult`):
|
|
42
|
+
* - `application: 'applied'` → 已生效,无需重启;
|
|
43
|
+
* - `application: 'restart-required'` → 装了但下次启动才生效;
|
|
44
|
+
* - `application: 'failed' | 'cancelled'` → 未生效(`restore` 存在时表示旧版本已装回);
|
|
45
|
+
* - `application: 'overridden'` → 被其它条目覆盖。
|
|
46
|
+
*
|
|
47
|
+
* @param {object|undefined} outcome - `updateBundle()` 的返回值。
|
|
48
|
+
* @returns {{ok: boolean, reason: string, restored: boolean, from: string, to: string, step: string, detail: string}}
|
|
49
|
+
*/
|
|
50
|
+
export function interpretHostManagerUpdate(outcome) {
|
|
51
|
+
const from = typeof outcome?.from === "string" ? outcome.from : "";
|
|
52
|
+
const to = typeof outcome?.to === "string" ? outcome.to : "";
|
|
53
|
+
const step = typeof outcome?.step === "string" ? outcome.step : "";
|
|
54
|
+
const base = { from, to, step, restored: Boolean(outcome?.restore) };
|
|
55
|
+
// `updateBundle` 在「检查阶段就拒绝」时也可能没有 result。
|
|
56
|
+
const result = outcome?.result;
|
|
57
|
+
if (!result || typeof result !== "object") {
|
|
58
|
+
const reason = typeof result === "string" ? result : "";
|
|
59
|
+
return { ...base, ok: false, reason: HOST_MANAGER_ERROR.REJECTED, detail: reason };
|
|
60
|
+
}
|
|
61
|
+
switch (result.application) {
|
|
62
|
+
case "applied":
|
|
63
|
+
return { ...base, ok: true, reason: "", detail: "" };
|
|
64
|
+
case "restart-required":
|
|
65
|
+
return { ...base, ok: false, reason: HOST_MANAGER_ERROR.RESTART_REQUIRED, detail: String(result.restartReason ?? "") };
|
|
66
|
+
case "cancelled":
|
|
67
|
+
return { ...base, ok: false, reason: HOST_MANAGER_ERROR.CANCELLED, detail: "" };
|
|
68
|
+
case "overridden":
|
|
69
|
+
return { ...base, ok: false, reason: HOST_MANAGER_ERROR.OVERRIDDEN, detail: "" };
|
|
70
|
+
case "failed":
|
|
71
|
+
default: {
|
|
72
|
+
// 宿主的 error 是结构化对象(code/diagnostic);只取 code,绝不透传 diagnostic 原文
|
|
73
|
+
// (可能含 registry URL、凭据或缺路径)。
|
|
74
|
+
const code = typeof result.error?.code === "string" ? result.error.code : "";
|
|
75
|
+
return { ...base, ok: false, reason: HOST_MANAGER_ERROR.REJECTED, detail: code };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 校验目标版本可以交给宿主更新。
|
|
82
|
+
*
|
|
83
|
+
* 宿主自己也会校验(`semver.gt`),这里提前挡是为了给出**我们自己的稳定原因码**,
|
|
84
|
+
* 而不是把宿主的英文 diagnostic 抛给手机。
|
|
85
|
+
*
|
|
86
|
+
* @param {object} input
|
|
87
|
+
* @param {string} input.targetVersion - 目标版本。
|
|
88
|
+
* @param {string} input.installedVersion - 当前已安装版本。
|
|
89
|
+
* @returns {{ok: boolean, reason: string}}
|
|
90
|
+
*/
|
|
91
|
+
export function validateHostManagerTarget({ targetVersion, installedVersion } = {}) {
|
|
92
|
+
if (!parseVersion(targetVersion)) return { ok: false, reason: HOST_MANAGER_ERROR.VERSION_INVALID };
|
|
93
|
+
if (installedVersion) {
|
|
94
|
+
const comparison = compareVersion(targetVersion, installedVersion);
|
|
95
|
+
// 比较不出来时放行给宿主判定:我们的比较器只认 `X.Y.Z[-pre][+N]`,
|
|
96
|
+
// 而宿主用的是完整 semver——不因为我们的解析面更窄就误拒。
|
|
97
|
+
if (comparison !== null && comparison <= 0) {
|
|
98
|
+
return { ok: false, reason: HOST_MANAGER_ERROR.VERSION_NOT_NEWER };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return { ok: true, reason: "" };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* 通过宿主插件管理器更新本插件。
|
|
106
|
+
*
|
|
107
|
+
* 执行顺序刻意固定:
|
|
108
|
+
* 1. 探测结论必须可用(`probe.channel === host-manager`),否则直接拒绝;
|
|
109
|
+
* 2. 校验目标版本;
|
|
110
|
+
* 3. 调 `updateBundle(name, version, { registry?, requestId? })`;
|
|
111
|
+
* 4. 把结果压成稳定结论。
|
|
112
|
+
*
|
|
113
|
+
* 不在这里做重试:宿主的 `updateBundle` 内部已经处理了 registry 回退与失败回滚,
|
|
114
|
+
* 我们外加一层重试只会让「已经回滚过的事」再发生一次。
|
|
115
|
+
*
|
|
116
|
+
* @param {object} input
|
|
117
|
+
* @param {object} input.service - `pluginManager` 服务实例。
|
|
118
|
+
* @param {string} input.packageName - 本插件包名。
|
|
119
|
+
* @param {string} input.targetVersion - 目标版本。
|
|
120
|
+
* @param {string} [input.installedVersion] - 当前版本(用于提前挡降级)。
|
|
121
|
+
* @param {string} [input.registry] - 指定 registry;缺省由宿主按配置决定。
|
|
122
|
+
* @param {string} [input.requestId] - 宿主用它关联进度与日志。
|
|
123
|
+
* @param {(progress: object) => void} [input.onProgress] - 宿主 `update-state` 事件的转发。
|
|
124
|
+
* @param {object} [input.log] - 结构化日志(注入以便测试)。
|
|
125
|
+
* @returns {Promise<object>} 稳定结论。
|
|
126
|
+
*/
|
|
127
|
+
export async function runHostManagerUpdate({
|
|
128
|
+
service,
|
|
129
|
+
packageName,
|
|
130
|
+
targetVersion,
|
|
131
|
+
installedVersion = "",
|
|
132
|
+
registry,
|
|
133
|
+
requestId,
|
|
134
|
+
onProgress,
|
|
135
|
+
log = {},
|
|
136
|
+
} = {}) {
|
|
137
|
+
if (!service || typeof service.updateBundle !== "function") {
|
|
138
|
+
return { ok: false, channel: UPDATE_CHANNEL.HOST_MANAGER, reason: HOST_MANAGER_REASON.SERVICE_MISSING, from: "", to: String(targetVersion ?? ""), step: "", restored: false };
|
|
139
|
+
}
|
|
140
|
+
if (typeof packageName !== "string" || packageName === "") {
|
|
141
|
+
return { ok: false, channel: UPDATE_CHANNEL.HOST_MANAGER, reason: HOST_MANAGER_REASON.NOT_UPDATABLE, from: "", to: String(targetVersion ?? ""), step: "", restored: false };
|
|
142
|
+
}
|
|
143
|
+
const validated = validateHostManagerTarget({ targetVersion, installedVersion });
|
|
144
|
+
if (!validated.ok) {
|
|
145
|
+
return { ok: false, channel: UPDATE_CHANNEL.HOST_MANAGER, reason: validated.reason, from: String(installedVersion ?? ""), to: String(targetVersion ?? ""), step: "check", restored: false };
|
|
146
|
+
}
|
|
147
|
+
const options = {};
|
|
148
|
+
// 只在调用方明确给了 registry 时才传:缺省要比「传 undefined」更明确地走宿主配置。
|
|
149
|
+
if (typeof registry === "string" && registry !== "") options.registry = registry;
|
|
150
|
+
if (typeof requestId === "string" && requestId !== "") options.requestId = requestId;
|
|
151
|
+
let outcome;
|
|
152
|
+
try {
|
|
153
|
+
log.stage?.("host-manager", `Updating ${packageName} to ${targetVersion} through the host plugin manager`);
|
|
154
|
+
outcome = await service.updateBundle(packageName, targetVersion, Object.keys(options).length > 0 ? options : undefined);
|
|
155
|
+
} catch (error) {
|
|
156
|
+
// 宿主在锁超时/服务销毁时是 reject 而不是返回失败结果;这仍然是一次失败结论。
|
|
157
|
+
log.fail?.("host-manager", "Host plugin manager update call rejected");
|
|
158
|
+
return {
|
|
159
|
+
ok: false,
|
|
160
|
+
channel: UPDATE_CHANNEL.HOST_MANAGER,
|
|
161
|
+
reason: HOST_MANAGER_ERROR.CALL_FAILED,
|
|
162
|
+
from: String(installedVersion ?? ""),
|
|
163
|
+
to: String(targetVersion ?? ""),
|
|
164
|
+
step: "",
|
|
165
|
+
restored: false,
|
|
166
|
+
detail: typeof error?.code === "string" ? error.code : "",
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
const interpreted = interpretHostManagerUpdate(outcome);
|
|
170
|
+
if (typeof onProgress === "function") {
|
|
171
|
+
try {
|
|
172
|
+
onProgress({ step: interpreted.step, from: interpreted.from, to: interpreted.to });
|
|
173
|
+
} catch {
|
|
174
|
+
// 进度回调不应影响更新结论
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return { ...interpreted, channel: UPDATE_CHANNEL.HOST_MANAGER };
|
|
178
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
// 宿主「原生插件更新」能力探测(DSH 0.2.2+ 的 `pluginManager` 服务)。
|
|
2
|
+
//
|
|
3
|
+
// 背景:0.2.2 起 DSH 自带插件管理器(`@deepseek-ai/dsh-plugin-manager`),它把
|
|
4
|
+
// 「装/删/更新插件」做成了宿主内的服务方法,并且 **在 HMR 可用时不重启宿主**:
|
|
5
|
+
// `updateBundle()` 会先移除旧版本、再装新版本,由 `hmr.reconcileProfile()` 在进程内
|
|
6
|
+
// 重新组合 profile——插件被卸载并重新加载,宿主进程不变。
|
|
7
|
+
//
|
|
8
|
+
// 我们的自更新原先只会「改 profile 依赖 → pnpm install → 重启宿主」这一条路;当宿主
|
|
9
|
+
// 形态判断不出可重启方式(例如容器里没有 systemd、进程环境没有 DSH_PROFILE)时,
|
|
10
|
+
// 就整条降级成「请到电脑上运行 pnpm install」的手工指引。有了宿主原生能力后,
|
|
11
|
+
// 那种情形可以直接委托给宿主,彻底不需要重启,也不需要用户碰命令行。
|
|
12
|
+
//
|
|
13
|
+
// 本模块只做**探测**与**能力描述**,不执行更新(执行在 plugin-self-update.js)。
|
|
14
|
+
|
|
15
|
+
/** 更新执行通道。 */
|
|
16
|
+
export const UPDATE_CHANNEL = {
|
|
17
|
+
/** 委托宿主 `pluginManager.updateBundle()`:进程内热更新,不重启。 */
|
|
18
|
+
HOST_MANAGER: "host-manager",
|
|
19
|
+
/** 传统通道:改 profile 依赖 → pnpm install → 重启宿主并做健康确认。 */
|
|
20
|
+
RESTART: "restart",
|
|
21
|
+
/** 两者都不可用,只能给人工指引。 */
|
|
22
|
+
GUIDANCE: "guidance",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** 宿主管理器不可用的稳定原因码(对外只暴露这几类,不含内部异常原文)。 */
|
|
26
|
+
export const HOST_MANAGER_REASON = {
|
|
27
|
+
/** 宿主没有 `pluginManager` 服务(0.2.2 之前,或该 bundle 未启用)。 */
|
|
28
|
+
SERVICE_MISSING: "host-manager-service-missing",
|
|
29
|
+
/** 服务存在但没有 `updateBundle` 方法(接口被裁剪/版本不符)。 */
|
|
30
|
+
METHOD_MISSING: "host-manager-method-missing",
|
|
31
|
+
/** 宿主没报告 HMR:更新仍可安装,但结果要重启才生效。 */
|
|
32
|
+
HMR_MISSING: "host-manager-hmr-missing",
|
|
33
|
+
/** 当前安装不是「以自身包名从 registry 装的 profile 依赖」,宿主会拒绝更新。 */
|
|
34
|
+
NOT_UPDATABLE: "host-manager-not-updatable",
|
|
35
|
+
/** 探测过程抛错。 */
|
|
36
|
+
PROBE_FAILED: "host-manager-probe-failed",
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** 探测结果的稳定状态。 */
|
|
40
|
+
export const HOST_MANAGER_STATE = {
|
|
41
|
+
/** 可用且能免重启生效。 */
|
|
42
|
+
READY: "ready",
|
|
43
|
+
/** 可用,但生效需要重启(无 HMR)。 */
|
|
44
|
+
RESTART_REQUIRED: "restart-required",
|
|
45
|
+
/** 不可用。 */
|
|
46
|
+
UNSUPPORTED: "unsupported",
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 读 `pluginManager` 服务。
|
|
51
|
+
*
|
|
52
|
+
* 探测顺序刻意保守:先拿服务(`ctx.get('pluginManager')`),再确认 `updateBundle`
|
|
53
|
+
* 是可调用函数。**不看版本号**——版本号无法证明该服务真的挂在当前 profile 上
|
|
54
|
+
* (ADR 0017:能力看声明,不看版本号)。任何异常都收敛成 unsupported,不向上抛。
|
|
55
|
+
*
|
|
56
|
+
* @param {object} ctx - cordis 上下文。
|
|
57
|
+
* @returns {{available: boolean, reason: string, service: object|null}}
|
|
58
|
+
*/
|
|
59
|
+
export function probeHostPluginManager(ctx) {
|
|
60
|
+
let service;
|
|
61
|
+
try {
|
|
62
|
+
service = ctx?.get?.("pluginManager");
|
|
63
|
+
} catch {
|
|
64
|
+
return { available: false, reason: HOST_MANAGER_REASON.PROBE_FAILED, service: null };
|
|
65
|
+
}
|
|
66
|
+
if (!service || typeof service !== "object") {
|
|
67
|
+
return { available: false, reason: HOST_MANAGER_REASON.SERVICE_MISSING, service: null };
|
|
68
|
+
}
|
|
69
|
+
if (typeof service.updateBundle !== "function") {
|
|
70
|
+
return { available: false, reason: HOST_MANAGER_REASON.METHOD_MISSING, service };
|
|
71
|
+
}
|
|
72
|
+
return { available: true, reason: "", service };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 宿主是否报告 HMR(决定更新结果能否免重启生效)。
|
|
77
|
+
*
|
|
78
|
+
* `pluginManager.updateBundle` 在没有 HMR 时照样能装,只是返回
|
|
79
|
+
* `application: 'restart-required'`。这里单独探测,是为了在**开始更新之前**
|
|
80
|
+
* 就告诉用户「这次会重启」还是「这次不重启」,而不是等装完再报。
|
|
81
|
+
*
|
|
82
|
+
* @param {object} ctx - cordis 上下文。
|
|
83
|
+
* @returns {{available: boolean, reason: string}}
|
|
84
|
+
*/
|
|
85
|
+
export function probeHostHmr(ctx) {
|
|
86
|
+
let hmr;
|
|
87
|
+
try {
|
|
88
|
+
hmr = ctx?.get?.("hmr");
|
|
89
|
+
} catch {
|
|
90
|
+
return { available: false, reason: HOST_MANAGER_REASON.PROBE_FAILED };
|
|
91
|
+
}
|
|
92
|
+
if (!hmr || typeof hmr !== "object" || typeof hmr.reconcileProfile !== "function") {
|
|
93
|
+
return { available: false, reason: HOST_MANAGER_REASON.HMR_MISSING };
|
|
94
|
+
}
|
|
95
|
+
return { available: true, reason: "" };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 由 bundle 视图判断宿主会不会接受这次更新。
|
|
100
|
+
*
|
|
101
|
+
* `updateBundle` 的准入是(见 dsh-plugin-manager 的 `updateRefusal`):
|
|
102
|
+
* 必须是 profile 里的第三方依赖、从 registry 以**自身包名**安装、声明 semver 版本、
|
|
103
|
+
* 不带插件管理职责。`listBundles()` 已经把结论投影成 `updatable` 与
|
|
104
|
+
* `readOnlyReason`,这里直接采信,不重复实现那套判据。
|
|
105
|
+
*
|
|
106
|
+
* @param {object|undefined} bundle - `listBundles()` 里对应本插件的一行。
|
|
107
|
+
* @returns {{ok: boolean, reason: string}}
|
|
108
|
+
*/
|
|
109
|
+
export function hostManagerAcceptsBundle(bundle) {
|
|
110
|
+
if (!bundle || typeof bundle !== "object") {
|
|
111
|
+
return { ok: false, reason: HOST_MANAGER_REASON.NOT_UPDATABLE };
|
|
112
|
+
}
|
|
113
|
+
if (bundle.updatable !== true) {
|
|
114
|
+
return { ok: false, reason: HOST_MANAGER_REASON.NOT_UPDATABLE };
|
|
115
|
+
}
|
|
116
|
+
if (bundle.readOnlyReason !== undefined) {
|
|
117
|
+
return { ok: false, reason: HOST_MANAGER_REASON.NOT_UPDATABLE };
|
|
118
|
+
}
|
|
119
|
+
return { ok: true, reason: "" };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 汇总一次探测的结果:宿主管理器可用性 + HMR + 本插件是否可被它更新。
|
|
124
|
+
*
|
|
125
|
+
* 返回的 `channel` 是本进程**应该优先使用**的更新通道;调用方还要结合传统重启通道
|
|
126
|
+
* 是否可用再决定最终通道(见 {@link chooseUpdateChannel})。
|
|
127
|
+
*
|
|
128
|
+
* @param {object} input
|
|
129
|
+
* @param {object} input.ctx - cordis 上下文。
|
|
130
|
+
* @param {string} input.packageName - 本插件包名。
|
|
131
|
+
* @param {(name: string) => Promise<object[]>} [input.listBundles] - 宿主 `listBundles()`;缺省用服务自己的方法。
|
|
132
|
+
* @returns {Promise<object>} 探测结果(稳定字段,可直接进 bootstrap)。
|
|
133
|
+
*/
|
|
134
|
+
export async function detectHostUpdateCapabilities({ ctx, packageName, listBundles } = {}) {
|
|
135
|
+
const manager = probeHostPluginManager(ctx);
|
|
136
|
+
const hmr = probeHostHmr(ctx);
|
|
137
|
+
const base = {
|
|
138
|
+
packageName: typeof packageName === "string" ? packageName : "",
|
|
139
|
+
managerAvailable: manager.available,
|
|
140
|
+
managerReason: manager.reason,
|
|
141
|
+
hmrAvailable: hmr.available,
|
|
142
|
+
hmrReason: hmr.reason,
|
|
143
|
+
updatable: false,
|
|
144
|
+
state: HOST_MANAGER_STATE.UNSUPPORTED,
|
|
145
|
+
channel: UPDATE_CHANNEL.GUIDANCE,
|
|
146
|
+
};
|
|
147
|
+
if (!manager.available) return base;
|
|
148
|
+
const service = manager.service;
|
|
149
|
+
let bundle;
|
|
150
|
+
try {
|
|
151
|
+
const list = typeof listBundles === "function" ? listBundles : service.listBundles;
|
|
152
|
+
const bundles = await list.call(service);
|
|
153
|
+
bundle = Array.isArray(bundles) ? bundles.find((item) => item?.name === base.packageName) : undefined;
|
|
154
|
+
} catch {
|
|
155
|
+
return { ...base, managerReason: HOST_MANAGER_REASON.PROBE_FAILED };
|
|
156
|
+
}
|
|
157
|
+
const accepts = hostManagerAcceptsBundle(bundle);
|
|
158
|
+
if (!accepts.ok) {
|
|
159
|
+
return { ...base, managerReason: accepts.reason, installedVersion: bundle?.version ?? "" };
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
...base,
|
|
163
|
+
updatable: true,
|
|
164
|
+
state: hmr.available ? HOST_MANAGER_STATE.READY : HOST_MANAGER_STATE.RESTART_REQUIRED,
|
|
165
|
+
channel: UPDATE_CHANNEL.HOST_MANAGER,
|
|
166
|
+
installedVersion: bundle?.version ?? "",
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* 在「宿主原生免重启更新」与「传统重启更新」之间选通道。
|
|
172
|
+
*
|
|
173
|
+
* 规则(顺序即优先级):
|
|
174
|
+
* 1. 宿主管理器可用 → 用它(免重启,且不依赖我们能重启宿主)。
|
|
175
|
+
* 2. 否则传统重启通道可用(systemd / 前台 web)→ 用重启。
|
|
176
|
+
* 3. 都不行 → 人工指引。
|
|
177
|
+
*
|
|
178
|
+
* 注意第 1 条**不看** `hmrAvailable`:没有 HMR 时宿主管理器仍会把包装好,
|
|
179
|
+
* 只是返回 `restart-required`。这种情形仍优先走管理器——它至少保证了
|
|
180
|
+
* 「依赖真的被装上了」,比我们自己 `pnpm install` 更可靠;重启由宿主报告为准。
|
|
181
|
+
*
|
|
182
|
+
* @param {object} input
|
|
183
|
+
* @param {boolean} input.hostManagerAvailable - 宿主管理器是否可用(且本插件可被它更新)。
|
|
184
|
+
* @param {boolean} input.canRestart - 传统重启通道是否可用。
|
|
185
|
+
* @returns {{channel: string, reason: string}}
|
|
186
|
+
*/
|
|
187
|
+
export function chooseUpdateChannel({ hostManagerAvailable = false, canRestart = false } = {}) {
|
|
188
|
+
if (hostManagerAvailable) return { channel: UPDATE_CHANNEL.HOST_MANAGER, reason: "" };
|
|
189
|
+
if (canRestart) return { channel: UPDATE_CHANNEL.RESTART, reason: "" };
|
|
190
|
+
return { channel: UPDATE_CHANNEL.GUIDANCE, reason: "no-update-channel" };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** 通道 → 面向用户的一句话说明(手机与桌面共用,避免两端文案漂移)。 */
|
|
194
|
+
export function describeUpdateChannel(channel) {
|
|
195
|
+
switch (channel) {
|
|
196
|
+
case UPDATE_CHANNEL.HOST_MANAGER:
|
|
197
|
+
return "由 DSH 插件管理器在进程内更新,无需重启宿主";
|
|
198
|
+
case UPDATE_CHANNEL.RESTART:
|
|
199
|
+
return "安装新版本后重启宿主使插件生效";
|
|
200
|
+
default:
|
|
201
|
+
return "当前形态无法自动更新,需要人工处理";
|
|
202
|
+
}
|
|
203
|
+
}
|