@mrrisega/dsh-remote 0.3.4 → 0.3.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/dsh-setup.mjs +35 -1
- package/package.json +1 -1
package/dsh-setup.mjs
CHANGED
|
@@ -556,6 +556,32 @@ function copyPluginIntoProfile(profileDir, pluginDir) {
|
|
|
556
556
|
return dest;
|
|
557
557
|
}
|
|
558
558
|
|
|
559
|
+
/**
|
|
560
|
+
* 兜底:确保 dsh 能从 profile 的 node_modules 解析到 dsh-remote-ui,且指向本次拷贝的插件目录。
|
|
561
|
+
* 常见坑:
|
|
562
|
+
* - 残留的旧软链指向旧 npx 缓存(可能悬空/已清理),existsSync 判“存在”会误跳过 → 必须校验真实目标;
|
|
563
|
+
* - pnpm 布局的 profile 里跑 npm install 会崩(npm 读 .pnpm 报错),不能依赖包管理器。
|
|
564
|
+
* 因此这里:解析现有链接的真实目标,只要不等于本次拷贝目录就强制重建为绝对路径链接/拷贝。
|
|
565
|
+
* 返回 true 表示本次重建了链接。
|
|
566
|
+
*/
|
|
567
|
+
function ensurePluginLinked(profileDir, pluginLocalDir) {
|
|
568
|
+
const nmDir = path.join(profileDir, "node_modules");
|
|
569
|
+
const nmPlugin = path.join(nmDir, "dsh-remote-ui");
|
|
570
|
+
fs.mkdirSync(nmDir, { recursive: true });
|
|
571
|
+
// 已正确指向本次拷贝目录 → 无需处理
|
|
572
|
+
try {
|
|
573
|
+
if (fs.realpathSync(nmPlugin) === pluginLocalDir) return false;
|
|
574
|
+
} catch { /* 悬空或不存在 → 需要重建 */ }
|
|
575
|
+
try { fs.rmSync(nmPlugin, { recursive: true, force: true }); } catch { /* ignore */ }
|
|
576
|
+
try {
|
|
577
|
+
fs.symlinkSync(pluginLocalDir, nmPlugin, "dir");
|
|
578
|
+
} catch {
|
|
579
|
+
fs.cpSync(pluginLocalDir, nmPlugin, { recursive: true });
|
|
580
|
+
}
|
|
581
|
+
// 复核
|
|
582
|
+
try { return fs.realpathSync(nmPlugin) === pluginLocalDir; } catch { return false; }
|
|
583
|
+
}
|
|
584
|
+
|
|
559
585
|
async function pluginCmd(argv) {
|
|
560
586
|
const uninstall = hasFlag(argv, "--uninstall");
|
|
561
587
|
const profileIdx = argv.indexOf("--profile");
|
|
@@ -617,7 +643,15 @@ async function pluginCmd(argv) {
|
|
|
617
643
|
console.log(`✅ 已写入 ${patchFile}`);
|
|
618
644
|
console.log(" 执行依赖更新(pnpm 优先,未装 pnpm 自动用 npm)...");
|
|
619
645
|
const r = installProfileDeps(profileDir);
|
|
620
|
-
if (!r.ok)
|
|
646
|
+
if (!r.ok) {
|
|
647
|
+
console.warn(`⚠️ 包管理器依赖更新未完全成功(${(r.stderr || r.stdout || "").trim().slice(0, 300) || "未知错误"})`);
|
|
648
|
+
console.warn(" 将直接建立插件链接,不依赖包管理器,dsh web 仍可正常加载插件。");
|
|
649
|
+
}
|
|
650
|
+
// 兜底:不依赖 pnpm/npm 的成败,确保 node_modules 里能解析到 dsh-remote-ui
|
|
651
|
+
const linked = ensurePluginLinked(profileDir, pluginLocalDir);
|
|
652
|
+
console.log(linked
|
|
653
|
+
? `✅ 插件链接已就绪:${path.join(profileDir, "node_modules", "dsh-remote-ui")} → ${pluginLocalDir}`
|
|
654
|
+
: "✅ 插件依赖已就绪");
|
|
621
655
|
console.log(`✅ 插件安装完成。配置目录: ${CONFIG_DIR}`);
|
|
622
656
|
console.log(" 重启 dsh web(或重开 profile)后,在「设置 → 远程控制」查看面板。");
|
|
623
657
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrrisega/dsh-remote",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.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",
|