dsh-wechat-remote 1.7.3 → 1.7.4

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Agent远程管理助手 · DSH 插件安装器
2
2
 
3
- 当前安装器版本为 1.7.3,安装的正式插件仍为 1.7.2。已正常使用插件 1.7.2 的用户,无需因此重新安装。
3
+ 当前安装器版本为 1.7.4,安装的正式插件仍为 1.7.2。已正常使用插件 1.7.2 的用户,无需因此重新安装。
4
4
 
5
5
  首次安装和升级旧插件使用同一个命令:
6
6
 
@@ -12,9 +12,11 @@ npx -y dsh-wechat-remote@latest
12
12
 
13
13
  安装器安装正式插件,保留原配置、配对和会话,不会升级 DSH 本体。请先结束运行中的任务;安装完成后自动重启原 DSH 并尝试打开 WebUI。
14
14
 
15
- DSH 的新版本、预览版本或未登记的主机架构不会仅因缺少验证记录而被拒绝安装。安装器仍检查必要运行能力、安装包完整性和已知不兼容问题,安装失败会回退;这不代表所有宿主组合均已通过功能验证。
15
+ DSH 的新版本、预览版本或未登记的主机架构不会仅因缺少验证记录而被拒绝安装。安装器仍检查必要运行能力、安装包完整性和已知不兼容问题,并保留失败恢复所需的备份;无法确认恢复结果时会提示保留数据。这不代表所有宿主组合均已通过功能验证。
16
16
 
17
- 支持已验证的 DSH `0.1.1-rc.2`、`0.1.2-rc.1`、`0.1.5-rc.1`,Windows / macOS Intel / Linux x64。普通 Node 启动、独立的 macOS launchd 和 Linux 用户级 systemd 服务可自动恢复;无法确认启动方式时不自动停止主机。
17
+ 支持已验证的 DSH `0.1.1-rc.2`、`0.1.2-rc.1`、`0.1.5-rc.1`,Windows / macOS Intel / Linux x64。普通 Node 启动、独立的 macOS launchd 和 Linux 用户级 systemd 服务可自动恢复;无法确认启动方式时不自动停止主机。
18
+
19
+ 另已在 ARM64 Linux 电视盒子上验证 DSH `0.1.5-rc.1` 的首次安装、重复执行及重装。1.7.4 改善较慢主机启动时被误判为安装超时的问题;安装过程中请等待完成,勿重复执行命令。
18
20
 
19
21
  旧插件 1.7.1 在 DSH 0.1.5 上无法一键更新时,可用本安装命令过渡一次。从插件 1.7.2 起,后续已验证的兼容更新不再受旧的 DSH 版本列表限制;不需要因此降低 DSH 版本或删除节点。
20
22
 
@@ -58,7 +58,7 @@ export async function waitForJson(filename, accept, timeout = 20000) {
58
58
  * A listening WebUI is not proof that the asynchronous profile reload finished.
59
59
  * Keep the same control entry/token while waiting; never restart a live host. */
60
60
  export async function waitForInstallControl(filename, {
61
- accept, ensureRunning, onWaiting = () => {}, timeoutMs = 60000, initialWaitMs = 5000,
61
+ accept, ensureRunning, onWaiting = () => {}, timeoutMs = 180000, initialWaitMs = 5000,
62
62
  }) {
63
63
  const deadline = Date.now() + timeoutMs
64
64
  try { return await waitForJson(filename, accept, Math.min(initialWaitMs, timeoutMs)) }
package/bin/setup.mjs CHANGED
@@ -76,7 +76,11 @@ export async function install({ profileName = 'web', cli = findDsh(), assetsRoot
76
76
  launched = spawn(process.execPath, [cli, '--profile', profileName, '--no-open'], {
77
77
  cwd: process.cwd(), env: process.env, detached: true, windowsHide: true, stdio: ['ignore', log, log] })
78
78
  fs.closeSync(log); launched.on('error', () => {}); launched.unref()
79
- for (let i = 0; i < 100 && !fs.existsSync(path.join(profile, 'package.json')); i++) await sleep(100)
79
+ const initializedBy = Date.now() + 180000
80
+ while (!fs.existsSync(path.join(profile, 'package.json')) && Date.now() < initializedBy) {
81
+ if (launched.exitCode !== null || launched.signalCode !== null) break
82
+ await sleep(100)
83
+ }
80
84
  if (!fs.existsSync(path.join(profile, 'package.json'))) throw new Error('DSH 未能初始化 profile;详情见本机安装记录。')
81
85
  await sleep(2000)
82
86
  }
@@ -354,7 +354,7 @@ async function describe(job, deadline) {
354
354
  if (!value?.ok || value.value.agentVersion !== job.dshVersion) throw new Error("DSH \u7248\u672C\u6216\u63CF\u8FF0\u670D\u52A1\u4E0D\u5339\u914D");
355
355
  return value.value;
356
356
  }
357
- async function healthy(job, version, timeoutMs = 6e4) {
357
+ async function healthy(job, version, timeoutMs = 18e4) {
358
358
  const deadline = AbortSignal.timeout(timeoutMs);
359
359
  while (!deadline.aborted) {
360
360
  try {
@@ -416,13 +416,15 @@ async function stopOriginal(job) {
416
416
  }
417
417
  throw new Error("\u539F DSH \u5C1A\u672A\u7ED3\u675F\uFF0C\u672A\u66FF\u6362\u63D2\u4EF6");
418
418
  }
419
- async function stopRestarted(child) {
419
+ async function stopRestarted(child, timeoutMs = 3e4) {
420
420
  if (child.exitCode !== null || child.signalCode !== null) return;
421
421
  child.kill("SIGTERM");
422
- for (let i = 0; i < 100; i++) {
422
+ const deadline = Date.now() + timeoutMs;
423
+ while (Date.now() < deadline) {
423
424
  if (child.exitCode !== null || child.signalCode !== null) return;
424
- await wait(100);
425
+ await wait(Math.min(100, Math.max(1, deadline - Date.now())));
425
426
  }
427
+ if (child.exitCode !== null || child.signalCode !== null) return;
426
428
  throw new Error("\u66F4\u65B0\u540E\u7684 DSH \u672A\u6309\u65F6\u505C\u6B62");
427
429
  }
428
430
  async function stopChild(pid) {
@@ -533,7 +535,14 @@ async function executeUpdate(job, progress, quiesce) {
533
535
  assertPreserved(before, durableSnapshot(job));
534
536
  rollback = true;
535
537
  writePrivateJsonAtomic(path3.join(job.directory, "verification-complete.json"), { id: job.id });
536
- } catch {
538
+ } catch (rollbackError) {
539
+ try {
540
+ writePrivateJsonAtomic(path3.join(job.directory, "rollback-failure.json"), {
541
+ message: rollbackError instanceof Error ? rollbackError.message : "unknown",
542
+ stack: rollbackError instanceof Error ? rollbackError.stack : void 0
543
+ });
544
+ } catch {
545
+ }
537
546
  return { phase: "attention", progress: 100, message: "\u81EA\u52A8\u6062\u590D\u672A\u5B8C\u6210\u3002\u5907\u4EFD\u5DF2\u4FDD\u7559\uFF0C\u8BF7\u6309\u4E3B\u673A\u66F4\u65B0\u8BB0\u5F55\u6062\u590D\uFF1B\u4E0D\u8981\u5220\u9664\u8282\u70B9\u6216\u6570\u636E\u3002", terminal: true, ok: false, rollback: false };
538
547
  }
539
548
  }
@@ -675,5 +684,6 @@ export {
675
684
  healthy,
676
685
  migrateLegacyGrantOwner,
677
686
  releaseOwnedUpdateLock,
687
+ stopRestarted,
678
688
  validateJob
679
689
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-wechat-remote",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "private": false,
5
5
  "description": "Agent远程管理助手:DSH 微信连接插件的一键安装与升级",
6
6
  "type": "module",