dsh-selfupdater 0.4.23 → 0.4.24

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.
Files changed (2) hide show
  1. package/lib/updater.mjs +6 -5
  2. package/package.json +1 -1
package/lib/updater.mjs CHANGED
@@ -404,17 +404,18 @@ function writeSupervisorPidFile(pid) {
404
404
  }
405
405
 
406
406
  /**
407
- * 健康检查:轮询本地端口,要求 2xx 才算健康。
408
- * 0.4.23 修正:旧实现"有任何 HTTP 响应即算活",若探测链路上存在错误页
409
- * 中间层(如代理在后端死亡时返回 502 页面),会把故障误判为健康、
410
- * 错过回滚时机 —— "侥幸正确"必须变成"设计正确"。
407
+ * 健康检查:轮询本地端口,判定服务是否真正就绪。
408
+ * 0.4.23:从"有任何响应即健康"收紧为要求 res.ok,防错误页中间层误判。
409
+ * 0.4.24:本机实测 alpha.4 起 Web 端点启用了 token 鉴权,未带 token 访问
410
+ * `/` 返回 401 —— 这是真实后端的应答(服务已就绪),必须放行;
411
+ * 代理错误页通常是 502/503,仍会被正确拒绝。
411
412
  */
412
413
  async function waitHealthy(timeoutMs) {
413
414
  const deadline = Date.now() + timeoutMs;
414
415
  while (Date.now() < deadline) {
415
416
  try {
416
417
  const res = await fetch(`http://127.0.0.1:${port}/`, { signal: AbortSignal.timeout(3000) });
417
- if (res.ok) return true;
418
+ if (res.ok || res.status === 401 || res.status === 403) return true;
418
419
  } catch { /* 未就绪继续等 */ }
419
420
  await sleep(2000);
420
421
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-selfupdater",
3
- "version": "0.4.23",
3
+ "version": "0.4.24",
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",