@mrrisega/dsh-remote 0.3.4 → 0.3.5

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/dsh-setup.mjs +32 -1
  2. package/package.json +1 -1
package/dsh-setup.mjs CHANGED
@@ -556,6 +556,29 @@ function copyPluginIntoProfile(profileDir, pluginDir) {
556
556
  return dest;
557
557
  }
558
558
 
559
+ /**
560
+ * 兜底:确保 dsh 能从 profile 的 node_modules 解析到 dsh-remote-ui。
561
+ * 部分机器上 pnpm/npm 可能因网络、锁文件或旧 node_modules 布局没真正放下链接,
562
+ * 导致 dsh web 启动报 "Cannot find package 'dsh-remote-ui'"。这里直接自建链接/拷贝,
563
+ * 保证“装完就能用”,不依赖包管理器的成败。返回 true 表示本次补建了链接。
564
+ */
565
+ function ensurePluginLinked(profileDir, pluginLocalDir) {
566
+ const nmPlugin = path.join(profileDir, "node_modules", "dsh-remote-ui");
567
+ if (fs.existsSync(nmPlugin)) return false; // 已可解析(含目标仍有效的软链)
568
+ try {
569
+ fs.mkdirSync(path.join(profileDir, "node_modules"), { recursive: true });
570
+ fs.symlinkSync(pluginLocalDir, nmPlugin, "dir");
571
+ return true;
572
+ } catch {
573
+ try {
574
+ fs.cpSync(pluginLocalDir, nmPlugin, { recursive: true });
575
+ return true;
576
+ } catch {
577
+ return false;
578
+ }
579
+ }
580
+ }
581
+
559
582
  async function pluginCmd(argv) {
560
583
  const uninstall = hasFlag(argv, "--uninstall");
561
584
  const profileIdx = argv.indexOf("--profile");
@@ -617,7 +640,15 @@ async function pluginCmd(argv) {
617
640
  console.log(`✅ 已写入 ${patchFile}`);
618
641
  console.log(" 执行依赖更新(pnpm 优先,未装 pnpm 自动用 npm)...");
619
642
  const r = installProfileDeps(profileDir);
620
- if (!r.ok) console.warn(`⚠️ 依赖更新失败:${r.stderr.trim() || r.stdout.trim()}(请手动在 ${profileDir} 执行 pnpm install 或 npm install)`);
643
+ if (!r.ok) {
644
+ console.warn(`⚠️ 包管理器依赖更新未完全成功(${(r.stderr || r.stdout || "").trim().slice(0, 300) || "未知错误"})`);
645
+ console.warn(" 将直接建立插件链接,不依赖包管理器,dsh web 仍可正常加载插件。");
646
+ }
647
+ // 兜底:不依赖 pnpm/npm 的成败,确保 node_modules 里能解析到 dsh-remote-ui
648
+ const linked = ensurePluginLinked(profileDir, pluginLocalDir);
649
+ console.log(linked
650
+ ? `✅ 插件链接已就绪:${path.join(profileDir, "node_modules", "dsh-remote-ui")} → ${pluginLocalDir}`
651
+ : "✅ 插件依赖已就绪");
621
652
  console.log(`✅ 插件安装完成。配置目录: ${CONFIG_DIR}`);
622
653
  console.log(" 重启 dsh web(或重开 profile)后,在「设置 → 远程控制」查看面板。");
623
654
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrisega/dsh-remote",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
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",