dsh-selfupdater 0.4.19 → 0.4.20

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.
@@ -648,7 +648,10 @@ function apply(ctx) {
648
648
  ...data,
649
649
  message: agedMessage('dsh', data.message, FINAL_MSG_STATES.includes(data.state)),
650
650
  };
651
- upgradeStarting = false; // 服务端状态已接管视觉
651
+ // 仅当服务端给出"进行中"或终态时才撤销乐观视觉:perform 受理初期
652
+ // 状态可能仍是旧的 idle,若此时撤销会退回"发现新版本"且按钮恢复
653
+ // 可点,造成重复点击(0.4.19 实测踩坑)。
654
+ if (isBusyState(latestStatus) || FINAL_MSG_STATES.includes(data.state)) upgradeStarting = false;
652
655
  } catch { /* 服务重启期间拉不到状态属正常:保持 starting 视觉 */ }
653
656
  refresh();
654
657
  // 升级中高频轮询,空闲低频保活。
package/lib/index.js CHANGED
@@ -310,6 +310,15 @@ export function apply(ctx) {
310
310
  sendJson(res, 500, { error: `写入锁文件失败:${err.message}` });
311
311
  return;
312
312
  }
313
+ // 受理即落盘 running 状态:给前端乐观视觉一个服务端依据(转圈 + 按钮禁用),
314
+ // 避免宿主退出前轮询仍读到旧的 idle/"发现新版本" 而误判升级没发生、
315
+ // 允许重复点击。latestVersion 等历史字段原样保留,供归位判定使用。
316
+ writeStatus(dshStateDir, {
317
+ ...readStatus(dshStateDir),
318
+ state: 'running',
319
+ message: '升级已受理,服务即将切换到升级脚本…',
320
+ updatedAt: new Date().toISOString(),
321
+ });
313
322
  const child = spawn(process.execPath, [
314
323
  join(PLUGIN_ROOT, 'lib', 'updater.mjs'),
315
324
  '--pid', String(process.pid),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-selfupdater",
3
- "version": "0.4.19",
3
+ "version": "0.4.20",
4
4
  "description": "Self-update plugin for DeepSeek Harness: DSH core upgrades via detached swap script; plugin self-update installs in-place without killing the host and prompts for restart. DSH 主程序与已装插件的一站式在线更新插件。",
5
5
  "license": "MIT",
6
6
  "type": "module",