dsh-crossterm 0.8.14 → 0.8.15
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 +15 -0
- package/README.md +12 -19
- package/client/client.js +38 -5
- package/lib/bus.js +1 -1
- package/lib/web.js +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# dsh-crossterm 变更记录
|
|
2
2
|
|
|
3
|
+
## 0.8.15 — 2026-10-20
|
|
4
|
+
|
|
5
|
+
**为什么发这版**:YOCE_C 从 0.8.13 点更新到 0.8.14 后回归发现,没重启前 `/status` 仍只有 `version=0.8.13`、
|
|
6
|
+
`/check` 也继续报有更新 —— 因为 `installed` / `needRestart` 是 0.8.14 的**服务端**代码才加的,
|
|
7
|
+
当前进程还跑着 0.8.13,升级当次天然读不到。结论:待重启的提示不能只靠服务端新字段。
|
|
8
|
+
|
|
9
|
+
- **client 自带版本号**:`client/client.js` 顶部新增 `const CLIENT_VERSION = "0.8.15"`,随包发布,等于磁盘上的版本。
|
|
10
|
+
- **点完更新立刻提示**:`onUpdate` 从 `/update` 响应取 `installed` 与 `before`(0.8.13 起响应里本来就有 `needRestart`),
|
|
11
|
+
装成了就 `setRestartPending(true)`,不依赖服务端 `status.needRestart`。
|
|
12
|
+
- **持续推导**:渲染处按「磁盘版本 > 进程版本」判断,`needRestart = status.needRestart || restartPending || onDiskNewer`,
|
|
13
|
+
旧进程也提示得出来;「待重启」行的版本号缺失时用 `CLIENT_VERSION` 兜底。
|
|
14
|
+
- **`/check` 并列返回 `running`**(= 进程版本,与 `current` 同值),旧客户端也能照常解析。
|
|
15
|
+
|
|
16
|
+
回归:`probe-0815.mjs` 19 项。
|
|
17
|
+
|
|
3
18
|
## 0.8.14 — 2026-10-20
|
|
4
19
|
|
|
5
20
|
### 修「更新按钮看起来没用」(YOCE_C 实测反馈)
|
package/README.md
CHANGED
|
@@ -28,32 +28,25 @@ A 终端看不到 B 终端里有哪个会话、在干什么,也没法把一条
|
|
|
28
28
|
> `locatePkgJson()` 对子路径行返回 undefined),而插件页顶部标题与这一行共用同一份 `locale/zh.json` 的 meta,
|
|
29
29
|
> 所以它单独做入口(配置卡片 + 自动更新开关),标题带「(自更新)」;卡片头用 `shortTitle` 显示短名「跨端互通」。
|
|
30
30
|
|
|
31
|
-
**本版更新(0.8.
|
|
31
|
+
**本版更新(0.8.15)**
|
|
32
|
+
|
|
33
|
+
- **升级当次就能提示「待重启」**:以前这一步要等服务端换成新版才认得出来(YOCE_C 回归的第 3/4 步就是这样「看不见」)。
|
|
34
|
+
现在浏览器 client 自己带版本号(`CLIENT_VERSION`),点完更新就从 `/update` 响应的 `installed` / `before` 判断,
|
|
35
|
+
立刻把卡片切成「已装待重启」;渲染时还会按「磁盘版本 > 进程版本」持续推导,旧进程也提示得出来。
|
|
36
|
+
- `/check` 多返回一个 `running`(= 进程版本),与 `current` 并列,旧客户端也能照常解析。
|
|
37
|
+
- 本机是 `link:` 源码版,没有这层差别;以上对用 npm 安装的设备生效。
|
|
38
|
+
|
|
39
|
+
**上一版(0.8.14)**
|
|
32
40
|
|
|
33
41
|
- **「更新」按钮不再看起来没用**:装完新版但还没重启时,卡片多一行「待重启」、
|
|
34
42
|
更新按钮变成不可点的「已装待重启」,接口 `/check` 改回 `needRestart=true` 而不是继续报「有更新」。
|
|
35
43
|
- 根因是状态表达:宿主进程里还是旧版本号,而磁盘上已经装了新版 —— 现在这两个版本分开显示。
|
|
36
44
|
- 本机是 `link:` 源码版(磁盘版本永远等于源码版本),所以这行只会在 npm 安装的设备上出现。
|
|
37
45
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- **已经是最新就不装**:点「更新」时若 npm 最新版 ≤ 当前版本,直接回「已经是最新(0.8.12),不用更新」,
|
|
41
|
-
不再跑一次 15 秒的安装、也不再重写 `node_modules`。
|
|
42
|
-
- **没写收件人的信优先投给维护者**:跨设备信封没写收件人(或写的名字本机认不出)时,原来按「最近活跃会话」投,
|
|
43
|
-
可能落进 QQ 或无关会话 —— YOCE_C 的 0.8.12 验收报告就投到了 `im:qq_39`。现在先找 `MAINTAINERS.md` 里的
|
|
44
|
-
主维护会话,命中就用它,否则仍按最近活跃投。
|
|
45
|
-
- 本机是 `link:` 源码版,点更新仍提示「改源码后重启」;以上对用 npm 安装的其他设备生效。
|
|
46
|
-
|
|
47
|
-
**上一版(0.8.12)**
|
|
48
|
-
|
|
49
|
-
- **修「点更新必定失败」**:0.8.11 给三级兜底都加了 `--prefer-online`,而这是 pnpm 11 的非法选项;
|
|
50
|
-
现在只给 pnpm 那步加它认识的 `--config.prefer-offline=false`。
|
|
51
|
-
- **新版本发布不到 24h 也能装**:撞 `minimumReleaseAge` 策略时自动用 `--config.minimumReleaseAge=0` 重试一次。
|
|
52
|
-
- **npm 最新版读得准了**:两个源都问、取最大版本(原来谁先返回用谁,镜像滞后会把版本号读旧)。
|
|
53
|
-
|
|
54
|
-
**更早(0.8.11 / 0.8.10 / 0.8.9 / 0.8.8 / 0.8.7 / 0.8.6 / 0.8.5 / 0.8.0)**
|
|
46
|
+
**更早(0.8.13 / 0.8.12 / 0.8.11 / 0.8.10 / 0.8.9 / 0.8.8 / 0.8.7 / 0.8.6 / 0.8.5 / 0.8.0)**
|
|
55
47
|
|
|
56
|
-
- 0.8.
|
|
48
|
+
- 0.8.13:已经是最新就不装;没写收件人的信优先投给 `MAINTAINERS.md` 里的维护者会话。
|
|
49
|
+
- 0.8.12 / 0.8.11:修「点更新必定失败」(pnpm 不认 `--prefer-online`)、装低自动回滚、最新版取两个源的最大值。
|
|
57
50
|
- 0.8.10 / 0.8.9 / 0.8.8 / 0.8.7:云端设备只列别人、带权限与状态、版本仅在差异时显示;插件页标题改「跨端互通(自更新)」;
|
|
58
51
|
入口组件从「总开关」改为「自更新开关」,四个业务组件互不依赖。
|
|
59
52
|
- 0.8.5:负责人留痕 `MAINTAINERS.md`、运行日志可轮转、卡片「维护者」行与「运行日志」按钮。
|
package/client/client.js
CHANGED
|
@@ -8,6 +8,21 @@ window.__ModuleLoader__.load({
|
|
|
8
8
|
const React = require("react");
|
|
9
9
|
const h = React.createElement;
|
|
10
10
|
|
|
11
|
+
// 0.8.15:这份 client 随包发布,它的版本号就是「磁盘上的版本」。
|
|
12
|
+
// 服务端进程可能还是旧版(装完没重启),拿它跟 /status.version 一比就知道该不该提示重启 ——
|
|
13
|
+
// 这样绕开了「旧进程读不到新字段」的死角(YOCE_C 的回归结论)。
|
|
14
|
+
const CLIENT_VERSION = "0.8.15";
|
|
15
|
+
|
|
16
|
+
const cmpVer = (a, b) => {
|
|
17
|
+
const pa = String(a || "").split(".").map((x) => Number(x) || 0);
|
|
18
|
+
const pb = String(b || "").split(".").map((x) => Number(x) || 0);
|
|
19
|
+
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
|
|
20
|
+
const d = (pa[i] || 0) - (pb[i] || 0);
|
|
21
|
+
if (d !== 0) return d < 0 ? -1 : 1;
|
|
22
|
+
}
|
|
23
|
+
return 0;
|
|
24
|
+
};
|
|
25
|
+
|
|
11
26
|
const S = {
|
|
12
27
|
card: {
|
|
13
28
|
border: "1px solid rgba(128,128,128,.28)",
|
|
@@ -246,6 +261,10 @@ window.__ModuleLoader__.load({
|
|
|
246
261
|
const [showLog, setShowLog] = React.useState(false);
|
|
247
262
|
const [runLog, setRunLog] = React.useState(null);
|
|
248
263
|
const [showRunLog, setShowRunLog] = React.useState(false);
|
|
264
|
+
// 0.8.15:本次页面会话里「刚装完、还没重启」的一次性标记。
|
|
265
|
+
// 旧版服务端不会返回 status.installed / needRestart,但 /update 的响应里一直带着
|
|
266
|
+
// installed 与 before(0.8.13 起还带 needRestart),所以升级当次就能立刻提示。
|
|
267
|
+
const [restartPending, setRestartPending] = React.useState(false);
|
|
249
268
|
|
|
250
269
|
const load = React.useCallback(() => {
|
|
251
270
|
call("/crossterm/api/status")
|
|
@@ -310,7 +329,8 @@ window.__ModuleLoader__.load({
|
|
|
310
329
|
try {
|
|
311
330
|
const data = await call("/crossterm/api/check", "POST");
|
|
312
331
|
if (!data || !data.ok) setMsg("检查失败:" + ((data && data.message) || "未知错误"));
|
|
313
|
-
else if (data.needRestart
|
|
332
|
+
else if (data.needRestart || (data.installed && cmpVer(data.installed, data.current) > 0))
|
|
333
|
+
setMsg(`已装 ${data.installed || "新版"},重启 DSH 后生效(当前进程还在跑 ${data.current})`);
|
|
314
334
|
else if (data.updateAvailable) setMsg(`发现新版本 ${data.latest}(当前 ${data.current})`);
|
|
315
335
|
else if (data.ahead) setMsg(`本地 ${data.current} 领先已发布版 ${data.latest}`);
|
|
316
336
|
else setMsg(`已是最新版本 ${data.current}`);
|
|
@@ -327,6 +347,14 @@ window.__ModuleLoader__.load({
|
|
|
327
347
|
try {
|
|
328
348
|
const data = await call("/crossterm/api/update", "POST");
|
|
329
349
|
const text = (data && data.message) || (data && data.ok ? "已更新" : "未能更新");
|
|
350
|
+
// 0.8.15:装完就记一笔「待重启」。旧版服务端的 /status 不返回 installed/needRestart,
|
|
351
|
+
// 但 /update 的响应里有 installed / before(0.8.13 起还有 needRestart),够判断了。
|
|
352
|
+
const after = data && (data.installed || "");
|
|
353
|
+
const beforeVer = data && (data.before || "");
|
|
354
|
+
const justInstalled = Boolean(
|
|
355
|
+
data && data.ok && (data.needRestart === true || (after && beforeVer && after !== beforeVer)),
|
|
356
|
+
);
|
|
357
|
+
if (justInstalled) setRestartPending(true);
|
|
330
358
|
const steps = (data && data.steps) || [];
|
|
331
359
|
// 失败时把每条尝试(dsh / DSH 自带 cli / pnpm)的退出码与输出带上,方便远端排查
|
|
332
360
|
const detail = data && data.ok
|
|
@@ -335,6 +363,7 @@ window.__ModuleLoader__.load({
|
|
|
335
363
|
? "\n\n" + steps.map((s) => `[${s.label}] 退出码 ${s.code} · ${Math.round((s.ms || 0) / 1000)}s` + (s.out ? `\n${String(s.out).slice(-400)}` : "")).join("\n\n")
|
|
336
364
|
: "";
|
|
337
365
|
setMsg(text + detail);
|
|
366
|
+
if (justInstalled) void load();
|
|
338
367
|
} catch (error) {
|
|
339
368
|
setMsg("更新失败:" + String((error && error.message) || error));
|
|
340
369
|
} finally {
|
|
@@ -447,9 +476,13 @@ window.__ModuleLoader__.load({
|
|
|
447
476
|
|
|
448
477
|
const version = status ? "v" + status.version : "";
|
|
449
478
|
const mode = status && status.install ? status.install.mode : "";
|
|
450
|
-
// 0.8.14:磁盘版本 > 进程版本 =
|
|
451
|
-
|
|
452
|
-
const
|
|
479
|
+
// 0.8.14/0.8.15:磁盘版本 > 进程版本 = 已装好但还没重启。
|
|
480
|
+
// 磁盘版本优先看服务端的 status.installed;旧版服务端没这个字段时用 client 自带的版本号兜底。
|
|
481
|
+
const diskVer = (status && status.installed) || (status ? CLIENT_VERSION : "");
|
|
482
|
+
const onDiskNewer = Boolean(status && status.version && diskVer && cmpVer(status.version, diskVer) < 0);
|
|
483
|
+
const installedVer = (status && status.installed) || (onDiskNewer ? CLIENT_VERSION : "");
|
|
484
|
+
const needRestart = Boolean((status && status.needRestart) || restartPending || onDiskNewer);
|
|
485
|
+
const cloud = (status && status.cloud) || {};
|
|
453
486
|
const autoUpdate = (status && status.autoUpdate) || {};
|
|
454
487
|
const home = (status && status.home) || null;
|
|
455
488
|
const subtitle = status
|
|
@@ -504,7 +537,7 @@ window.__ModuleLoader__.load({
|
|
|
504
537
|
needRestart
|
|
505
538
|
? h(FriendlyRow, {
|
|
506
539
|
label: "待重启",
|
|
507
|
-
value: `已装 v${installedVer},重启 DSH 后生效(当前进程还在跑 v${status && status.version})`,
|
|
540
|
+
value: `已装 v${installedVer || "新版"},重启 DSH 后生效(当前进程还在跑 v${status && status.version})`,
|
|
508
541
|
})
|
|
509
542
|
: null,
|
|
510
543
|
h(FriendlyRow, {
|
package/lib/bus.js
CHANGED
|
@@ -23,7 +23,7 @@ import path from 'node:path'
|
|
|
23
23
|
import crypto from 'node:crypto'
|
|
24
24
|
import { rotateIfNeeded } from './logs.js'
|
|
25
25
|
|
|
26
|
-
export const VERSION = '0.8.
|
|
26
|
+
export const VERSION = '0.8.15'
|
|
27
27
|
|
|
28
28
|
/** DSH 的家目录:与宿主其它状态(sessions / profiles)同一个根,多终端天然共享 */
|
|
29
29
|
export function dshHome() {
|
package/lib/web.js
CHANGED
|
@@ -861,7 +861,9 @@ export function registerWeb(ctx, term, log) {
|
|
|
861
861
|
const base = installed && compareVersion(installed, VERSION) > 0 ? installed : VERSION
|
|
862
862
|
const updateAvailable = !needRestart && compareVersion(latest, base) > 0
|
|
863
863
|
const ahead = !needRestart && compareVersion(VERSION, latest) > 0
|
|
864
|
-
|
|
864
|
+
// current 是「进程正在跑的版本」,installed 是「磁盘上的版本」,两个都给,
|
|
865
|
+
// 别让客户端只能靠猜(0.8.15 起多给一个 running 别名,语义更直白)。
|
|
866
|
+
json(res, 200, { ok: true, current: VERSION, running: VERSION, installed, latest, updateAvailable, ahead, needRestart })
|
|
865
867
|
} catch (error) {
|
|
866
868
|
json(res, 200, { ok: false, message: String((error && error.message) || error) })
|
|
867
869
|
}
|