dsh-composer-ux 0.16.0 → 0.16.2

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 CHANGED
@@ -2,6 +2,42 @@
2
2
 
3
3
  本项目遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
4
4
 
5
+ ## [0.16.2] — 2026-09-30(杀壳之前先确认"能把应用拉回来")
6
+
7
+ 这一版堵的是 **0.16.0 自己引入的**失败模式:先杀壳、再用 exe 重建 —— 如果 exe 路径拿不到或
8
+ 文件已不在,就会变成"壳没了、应用也没起来",比原来的弹框糟糕得多。参考插件的 README 里
9
+ 正好记着这条死法:`relaunch aborted: executable missing`。
10
+
11
+ **改法**:杀壳之前先 `fs.existsSync(appExe)`;**拿不到就绝不杀壳**,退回"只换宿主"那条老路
12
+ (壳还活着,它的恢复框至少还能救回来),并在日志里写明原因。
13
+
14
+ ## 验证
15
+
16
+ - `npm test`:**24 个套件 2382 passed / 0 failed**(行为测试从 11 条涨到 14 条,
17
+ 其中一条直接验证「exe 缺失 ⇒ 一次 taskkill 都没有」)。
18
+ - 变异:**164/164 全部咬住**。
19
+
20
+ ## [0.16.1] — 2026-09-30(把桌面重启从「查文本的测试」升级成「真跑一遍」)
21
+
22
+ 0.16.0 的测试断言是在**助手源码字符串**里找关键字 —— 这一版之前已经栽过三次同类问题
23
+ (FN / FO / D:注释掉一行、或在别处加一处同类代码,查文本的断言照样能过)。
24
+
25
+ 新增套件 `test/restart-helper-desktop.mjs`(**第 24 个套件**):注入假的 `child_process` /
26
+ `fs` / `net`,**真的执行**助手源码,只认副作用 ——
27
+
28
+ - 只杀壳、只给 `/PID`(❌ 不带 `/T`、❌ 不按映像名扫);
29
+ - 先探 `tasklist` 再重建,且旧宿主还活着时反复探测、超时后仍然重建;
30
+ - 重建时子进程环境里**真的**没有 `ELECTRON_RUN_AS_NODE`(这是最容易写错的一步);
31
+ - web 形态一个进程都不杀,照旧重拉同一条命令。
32
+
33
+ 写这条套件的过程本身就证明它有价值:第一次跑就抓出两处**只有真跑才会暴露**的问题
34
+ (我原以为"查文本"能覆盖的那些点其实没被覆盖)。
35
+
36
+ ## 验证
37
+
38
+ - `npm test`:**24 个套件 2379 passed / 0 failed**。
39
+ - 变异:**164/164**(本次没动 `src/`,变异集合不变)。
40
+
5
41
  ## [0.16.0] — 2026-09-30(桌面重启改成「连壳一起换掉」—— 不再弹那个恢复框)
6
42
 
7
43
  前置事实(0.15.5 修好命令行之后发现的):桌面壳把宿主子进程的 close **一律**判成失败
package/README.md CHANGED
@@ -640,7 +640,7 @@ node build.mjs # 产出 lib/index.js + lib/client.js
640
640
  # ⚠️ 宿主半会**内联** schemastery / cosmokit:
641
641
  # 优先用 DSH 检出里的 vendor 副本,检出不在时退到 node_modules
642
642
  # 里同版本的 npm 包(两者逐字节相同)——CI 上走的就是退路
643
- npm test # 23 个套件;当前 2368 passed, 0 failed(2026-09-29 实测;CI 三平台同样全绿)
643
+ npm test # 24 个套件;当前 2382 passed, 0 failed(2026-09-29 实测;CI 三平台同样全绿)
644
644
  # 走 scripts/run-tests.mjs:顺带把"多少套件/多少条"记进 test/.last-run.json
645
645
  npm run test:mutations # 手动跑:变异测试,证明那套护栏真的在咬人(164 条,须单独跑)
646
646
  # 同样记录结果,供下面的文档门禁核对
package/lib/index.js CHANGED
@@ -4062,6 +4062,12 @@ function restartHelperSource(input) {
4062
4062
  "const desktopMain = async () => {",
4063
4063
  ' const out = fs.openSync(logOut, "a")',
4064
4064
  ' const err = fs.openSync(logErr, "a")',
4065
+ " // \u8D77\u98DE\u524D\u68C0\u67E5\uFF1A\u62FF\u4E0D\u5230\u5E94\u7528 exe \u5C31**\u7EDD\u4E0D\u6740\u58F3** \u2014\u2014 \u6740\u5B8C\u6CA1\u4EBA\u80FD\u628A\u5B83\u62C9\u56DE\u6765",
4066
+ " //\uFF08\u53C2\u8003\u63D2\u4EF6 README \u91CC\u90A3\u6761 relaunch aborted: executable missing \u5C31\u662F\u8FD9\u4E2A\u6B7B\u6CD5\uFF09\u3002",
4067
+ " if (!desktop.appExe || !fs.existsSync(desktop.appExe)) {",
4068
+ ' note("app executable missing (" + String(desktop.appExe) + "); falling back to host-only restart")',
4069
+ " return main()",
4070
+ " }",
4065
4071
  ' // \u53EA /PID\uFF1A/T \u4F1A\u628A"\u8D1F\u8D23\u91CD\u542F\u7684\u52A9\u624B\u81EA\u5DF1"\u4E00\u8D77\u5E26\u8D70\uFF08\u53C2\u8003\u63D2\u4EF6\u8E29\u8FC7\u7684\u5751\uFF09\u3002',
4066
4072
  " try {",
4067
4073
  ' const killer = spawn("taskkill", ["/F", "/PID", String(desktop.shellPid)], { windowsHide: true, stdio: ["ignore", out, err] })',