@mrrisega/dsh-remote 0.4.5 → 0.4.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrisega/dsh-remote",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "手机远程控制 DeepSeek Harness · Remote control DeepSeek Harness (dsh web) from any phone browser — 100% 全功能 App 级体验:发消息、看工具执行、审批权限、改设置、管凭据,含特权操作,免内网穿透。一条命令安装 npx @mrrisega/dsh-remote。Mobile remote control for DSH, self-host or SaaS, no server needed on LAN.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -362,7 +362,9 @@ function appendLogLine(relayDir, name, line) {
362
362
 
363
363
  /** 插件市场只装了 UI 插件;若桌面缺 dsh-remote 运行环境(dsh-setup.mjs=bridge/自启动),
364
364
  * 由插件在后台自动执行一次 `npx @mrrisega/dsh-remote` 补齐,用户无需手动跑命令。
365
- * 已有环境(包括手动 npx 装过)直接跳过。返回 true=已就绪。 */
365
+ * 已有环境(包括手动 npx 装过)直接跳过。返回 true=已就绪。
366
+ * 注意:默认优先官方源——镜像(npmmirror)可能滞后于刚发布的版本,装到旧版会把
367
+ * 已被 0.4.5 移除的“用户 include”重新写回 profile(历史上造成 dsh web 重复 ID 崩溃)。 */
366
368
  function ensureRuntime(relayDir) {
367
369
  if (existsSync(join(relayDir, "dsh-setup.mjs"))) return true;
368
370
  const marker = join(relayDir, PROVISION_MARKER);
@@ -372,7 +374,7 @@ function ensureRuntime(relayDir) {
372
374
  const log = join(relayDir, AUTO_INSTALL_LOG);
373
375
  const child = spawn(npxCommand(), ["--yes", "@mrrisega/dsh-remote"], {
374
376
  detached: true,
375
- env: spawnEnv(),
377
+ env: spawnEnv({ npm_config_registry: "https://registry.npmjs.org" }),
376
378
  stdio: ["ignore", openSync(log, "a"), openSync(log, "a")]
377
379
  });
378
380
  writeMarker(marker, child.pid); // 记 pid:宿主重启后可立即清理死进程残留
@@ -711,7 +713,7 @@ async function proxyFeedback(relayDir, req, res, pathname) {
711
713
  // ---------- 自管理:版本 / 在线更新 / 彻底卸载(面板内“版本与更新”卡片) ----------
712
714
 
713
715
  /** 插件自身发布版本(与 dsh-remote 根包同步递增)。 */
714
- const PLUGIN_VERSION = "0.4.5";
716
+ const PLUGIN_VERSION = "0.4.6";
715
717
  const UPDATE_LOG = ".dsh-update.log";
716
718
  const UPDATE_MARKER = ".dsh-update-running";
717
719
 
@@ -740,10 +742,12 @@ function spawnUpdater(relayDir, extraEnv) {
740
742
  }
741
743
 
742
744
  /**
743
- * 后台执行在线一键更新:npx @mrrisega/dsh-remote@latest(幂等自愈:补运行环境/更新 bridge/重写 include)。
745
+ * 后台执行在线一键更新:npx @mrrisega/dsh-remote@latest(幂等自愈:补运行环境/更新 bridge/收敛 include)。
744
746
  * 稳健性:
745
747
  * - npx 用绝对路径 + PATH 补全解析(App 拉起的 dsh web PATH 最小化时不再 ENOENT 静默失败);
746
- * - 默认 npx 源(国内常为 npmmirror)未同步到最新版导致失败时,自动用官方 npm 源重试一次;
748
+ * - 【官方源优先】镜像(npmmirror)滞后时会把旧版(如 0.4.4)当成最新安装,旧 pluginCmd 会把
749
+ * 已被移除的“用户 include”重新写回 profile → dsh web 重启重复 ID 崩溃。故先试官方源,
750
+ * 失败(国内网络)才回退用户默认镜像源;
747
751
  * - marker 记录 pid,子进程退出/出错即清理;宿主重启后由 sweepStaleMarkers 立即清掉死进程残留。
748
752
  */
749
753
  function runOnlineUpdate(relayDir) {
@@ -756,16 +760,17 @@ function runOnlineUpdate(relayDir) {
756
760
  let retried = false;
757
761
  const clear = () => { try { rmSync(marker, { force: true }); } catch { /* ignore */ } };
758
762
  const run = () => {
759
- const child = spawnUpdater(relayDir, retried ? { npm_config_registry: "https://registry.npmjs.org" } : {});
763
+ // 第一次:官方 npm 源;失败(exit≠0/网络)才回退用户默认源(通常为国内镜像)
764
+ const child = spawnUpdater(relayDir, retried ? {} : { npm_config_registry: "https://registry.npmjs.org" });
760
765
  writeMarker(marker, child.pid);
761
766
  child.on("exit", (code) => {
762
767
  if (!retried && code !== 0) {
763
768
  retried = true;
764
- appendLogLine(relayDir, UPDATE_LOG, `[update] 默认源安装失败(exit=${code}),改用官方 npm 源重试…`);
769
+ appendLogLine(relayDir, UPDATE_LOG, `[update] 官方源安装失败(exit=${code}),回退默认源(npmmirror )重试…`);
765
770
  run();
766
771
  return;
767
772
  }
768
- appendLogLine(relayDir, UPDATE_LOG, `[update] npx 退出 code=${code ?? "?"}(默认源${retried ? "/官方源" : ""})`);
773
+ appendLogLine(relayDir, UPDATE_LOG, `[update] npx 退出 code=${code ?? "?"}(${retried ? "默认源" : "官方源"})`);
769
774
  clear();
770
775
  });
771
776
  child.on("error", (e) => {