dsh-autorestart 0.8.2 → 0.8.3
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 +32 -1
- package/README.md +7 -6
- package/client.js +952 -56
- package/docs/README.zh.md +5 -5
- package/index.js +26 -7
- package/lib/checkpoint.js +23 -4
- package/lib/restart-phase.js +52 -11
- package/locale/en.json +26 -5
- package/locale/zh.json +26 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.3 — 2026-10-29
|
|
4
|
+
|
|
5
|
+
**重启阶段搬到界面正中:不再挤在输入框那一行被截断,靠数字说话,也不是常驻。**
|
|
6
|
+
|
|
7
|
+
### 现场(真机截图)
|
|
8
|
+
|
|
9
|
+
阶段那行字挤在输入框工具行的小胶囊里(22px 高、一行宽)。窗口不宽时「正在等待所有会话空闲…(还有 1 个会话在忙)」被省略号吃掉,用户看不出卡在哪、还要不要等。另一次截图里浮层上的「等待会话空闲」挂了十分钟不消失——那笔重启只是在**排队等空闲**,其实什么动作都没在跑。
|
|
10
|
+
|
|
11
|
+
### 改
|
|
12
|
+
|
|
13
|
+
- **阶段改为主界面居中浮层**(`shell.overlay` 槽位,id `autorestart-restart-overlay`):320px 固定宽、水平垂直居中、圆角、半透明,`pointer-events: none`——点哪里都照样点到下面的界面,不挡输入。
|
|
14
|
+
- `snapshotting`:「DSH 重启前备份中」+ **真实进度条** + 「12.3 / 40 MB」+ 百分比(数字来自拷贝循环的实测字节,没测到就一个数字都不写);
|
|
15
|
+
- `restarting`:「正在重启…」,一直挂着,直到宿主真的退出;
|
|
16
|
+
- `back`:「已回来」,**1.5 秒**后自动消失;
|
|
17
|
+
- `waiting`:**浮层不出现**——只是排队等空闲,没有任何动作在跑,会话数交给胶囊去说;
|
|
18
|
+
- state.json 里残留的旧阶段(`pendingRestart === false`)和页面的第一帧,都**不画**。
|
|
19
|
+
- **窄窗按字号缩放,不截断**:浮层里没有 `text-overflow`、没有省略号、不换行;窗口不够宽时用 `clamp()` 缩字号,数字永远完整可读。
|
|
20
|
+
- **底部胶囊恢复短句**(≤12 字、单行):等空闲时「待重启 · 空闲后自动重启」/「待重启 · 等待 N 个会话」;备份中 / 重启中 / 回来时整行换成「重启前备份中」/「正在重启…」/「已回来」。长句只留 tooltip,细节全部交给浮层。
|
|
21
|
+
- **胶囊与面板的数字同源**:修掉「胶囊说还有 1 个会话、点开面板却说等 0 个任务」。两处现在读同一个 `blocking` 数字——Host 在 `restartPhase.blocking` 里单独报出它,不再只藏在句子中。
|
|
22
|
+
- **设置修改有回执**:改完设置,面板里给回执——成功是绿色「已生效」+ 时间;失败是红色并保留原因、不自动消失。
|
|
23
|
+
- **回执贴在设置面板内部顶部**(`position:sticky` + `top:0`,往下滚动设置内容也一直可见;条高 30px,覆盖不挤压表单),不再浮到窗口层——`shell.overlay` 上那条注册已删,提示只出现在本插件的设置页里,关掉设置页即清空。
|
|
24
|
+
- **口径统一**:悬停提示里的「任务」改成「会话」(英文 session(s)),和胶囊、面板保持一致。
|
|
25
|
+
- **体积按大小自动选单位**:一份 92 KB 的 profile(Web/WSL)如果按 MB 印就是「0 MB」甚至「0.0 MB」,等于把一次真的备份说成什么都没干。现在 `92 KB` / `156 MB` / `12.3 MB` / `0 B` 各按大小选单位,进度行两侧也各带单位(`12.3 MB / 40 MB`)。浮层**没有任何保底显示时长**:备份快就一闪而过,慢就一直在,出现与消失完全跟随真实阶段(用户拍板:「浮层不用保底时间,短就算了,不用硬加长」)。Host 侧 `restartPhase.snapshotBytes` 仍跨阶段记录真实体积,供界面与诊断使用。
|
|
26
|
+
- **说清是什么备份**:光看「正在备份」看不出备份的是什么,所以浮层改成「DSH 重启前备份中」、胶囊改成「重启前备份中」(英文 "Backing up before DSH restart" / "Backing up…"),进度条与 MB 数字不变。设置页与 tooltip 那句长句也一起改成同一个说法:「DSH 重启前备份中(预计 X 秒,已完成 Y MB)…」(英文 "Backing up before DSH restart (about Xs, Y MB done)…"),「慢就明说」那条也把主语补成「DSH 重启前备份比预期慢…」,全产品不再出现孤立的「正在备份」。
|
|
27
|
+
|
|
28
|
+
### 验证
|
|
29
|
+
|
|
30
|
+
- 单元测试 **760 → 801 项全绿**(新增 `test/restart-overlay.test.mjs` 19 条、`test/settings-save-notice.test.mjs`、`test/pill-count-source.test.mjs`)。
|
|
31
|
+
- 两个演练仍是 exit 0:`node scripts/drill-watchdog.mjs`、`powershell -File scripts/drill-rescue.ps1`。
|
|
32
|
+
- 客户端 bundle 仍是整文件一个 IIFE(`test/client-bundle-isolation.test.mjs` 守着)。
|
|
33
|
+
|
|
3
34
|
## 0.8.2 — 2026-10-29
|
|
4
35
|
|
|
5
36
|
**线上缺陷修复:宿主起来之后没有撤销看门狗,会把好环境回滚掉。**
|
|
@@ -37,7 +68,7 @@ health 路由里那段"写 marker + 撤看门狗"的代码读的是 `stateDirOf(
|
|
|
37
68
|
|
|
38
69
|
用户反馈:"点『0 秒后重启』之后十几秒什么都不动,其实在备份 156MB,我会以为按钮没反应 / 0 秒是假的 / 有 bug。"
|
|
39
70
|
|
|
40
|
-
- **四个阶段立刻可见**:`waiting`「正在等待所有会话空闲…」→ `snapshotting`「正在备份配置和插件(预计 X 秒,已完成 Y MB
|
|
71
|
+
- **四个阶段立刻可见**:`waiting`「正在等待所有会话空闲…」→ `snapshotting`「正在备份配置和插件(预计 X 秒,已完成 Y MB)…」(0.8.3 起改为「DSH 重启前备份中(预计 X 秒,已完成 Y MB)…」)→ `restarting`「正在重启,稍后自动继续…」→ `back`「已回来,接着干」。阶段写在 checkpoint(`restartPhase`)里,点击的**同一次调用**就把 `waiting` 落盘并 persist,界面下一次轮询(2 秒一次,且点击后立即再拉一次)就能看到。
|
|
41
72
|
- **备份进度是真的**:`createBackup` 改成**文件级拷贝循环**(原来是 `fs.cpSync` 一次性拷完,既没进度也不能取消),边拷边报 `{ files, bytes, total }`,`total` 是拷之前量出来的真实总量;拷贝过程**每 120ms / 每 40 个文件让出一次事件循环**,所以取消请求能在拷贝途中被服务,进度也能在拷贝途中到界面。
|
|
42
73
|
- **备份阶段可取消**:取消后拷贝在下一个文件处停下,**半成品快照目录被删掉**(不留一个看着能还原的假备份),请求被撤回、宿主不重启;**进入 `restarting` 后取消被拒绝**(HTTP 409 + `reason: not-cancellable` + 原因),界面按钮置灰并说明"正在重启,已经不能取消了"。
|
|
43
74
|
- **两处都能读到**:`/__dsh_autorestart/health?state=1` 与 `/health` 都带 `restartPhase`(阶段、双语文字、可取消性、`slow`)和 `progress`(files/bytes/total/percent/ageMs)。
|
package/README.md
CHANGED
|
@@ -36,9 +36,10 @@ round starts, so the session goes idle and the restart can proceed. The goal is
|
|
|
36
36
|
restart and continues.
|
|
37
37
|
|
|
38
38
|
The browser shows the state: a compact "pending restart" pill on the left side of the input toolbar
|
|
39
|
-
and a small dot next to the session title in the sidebar. The pill's text reports how many
|
|
40
|
-
are still in the way
|
|
41
|
-
|
|
39
|
+
and a small dot next to the session title in the sidebar. The pill's text reports how many
|
|
40
|
+
**conversations** are still in the way (`待重启 · 等待 2 个会话` / `pending restart · waiting for 2
|
|
41
|
+
session(s)`) — a conversation and its own subagents count as one, and the tooltip explains that
|
|
42
|
+
queued-but-not-started work counts too; it does not open a details panel. The
|
|
42
43
|
dot breathes when the restart is about to fire.
|
|
43
44
|
|
|
44
45
|
Every blocker says **what it is**: a conversation is named by its own title, and a **subagent** is
|
|
@@ -198,7 +199,7 @@ what it adds before you install it.
|
|
|
198
199
|
|
|
199
200
|
## Install
|
|
200
201
|
|
|
201
|
-
Current version: **0.8.
|
|
202
|
+
Current version: **0.8.3**.
|
|
202
203
|
|
|
203
204
|
From npm — the package is published under the name `dsh-autorestart`:
|
|
204
205
|
|
|
@@ -271,7 +272,7 @@ The capsule in the composer row is 22px high and ONE line wide, so it carries nu
|
|
|
271
272
|
(`待重启 · 已等 16 分钟 · 3 项任务在跑`) — never a name and never a hint. Clicking it (or pressing
|
|
272
273
|
Enter/Space on it) opens a small panel above it:
|
|
273
274
|
|
|
274
|
-
- how many
|
|
275
|
+
- how many conversations the restart is waiting for (the same number the capsule shows);
|
|
275
276
|
- how many OTHER sessions wait for the same restart;
|
|
276
277
|
- one button: **Cancel my restart**.
|
|
277
278
|
|
|
@@ -416,7 +417,7 @@ with its plugins is ~150 MB). The button looked dead. It is not — and now it s
|
|
|
416
417
|
| Stage | What the interface shows | Where the data comes from |
|
|
417
418
|
|---|---|---|
|
|
418
419
|
| `waiting` | "Waiting for every conversation to be idle…" (+ how many are busy) | the idle gate's blockers |
|
|
419
|
-
| `snapshotting` | "Backing up the
|
|
420
|
+
| `snapshotting` | The centred card: "Backing up before DSH restart" + a real progress bar, "12.3 MB / 40 MB" and a percentage; the settings page and the tooltip keep the long line, in the same words ("Backing up before DSH restart (about 12s, 78 MB done)…"). The card has NO minimum shown time: it lives exactly as long as the Host reports the stage (a 92 KB copy is gone in about 5 ms, a slow one stays as long as it runs); the size picks its own unit (KB or MB) so a small backup never reads "0 MB" | the REAL copy loop: files and bytes written, measured total |
|
|
420
421
|
| `restarting` | "Restarting; the work continues by itself in a moment…" | the host is on its way out |
|
|
421
422
|
| `back` | "Back — carrying on where we left off" | the new host, once it boots |
|
|
422
423
|
|