Bundle
dsh-restart-now
Restart DSH Desktop from the sidebar or Settings. After confirmation, closes and relaunches the app; only active in the desktop host. · DSH 桌面版一键重启:从侧栏或设置页发起,确认后关闭并重新拉起应用;仅在桌面宿主生效。
- Source
- Mr54233
- License
- MIT
- Updated
- Updated 7 days ago
Readme
# dsh-restart-now DSH 桌面版一键重启插件:在侧边栏底部与设置页各加一个「重启应用」入口, 点击后安全地退出并重新拉起 DeepSeek Harness 桌面应用。 ## 工作原理 - **宿主半边**(`lib/index.js`)注册两条路由: - `GET /plugins/dsh-restart-now/environment` —— 环境探测(desktop / web) - `POST /plugins/dsh-restart-now/restart` —— 重启动作 - **门禁顺序**:`allowRestart` 总开关 → 环境判定(非 desktop 一律 403, 绝不触碰 web 环境的进程)→ Q6 围栏(loopback 直连 + 无转发头 + `Origin==Host`,防浏览器端任意页面打本机端口)→ exe 存在性 fail-fast。 - **重启机制**(v0.7 勘误,WMI 逃逸树 + 单一杀手):宿主把助手脚本写到 `%TEMP%\dsh-restart-now-helper-<stamp>.cjs`,经 WMI(`Win32_Process.Create`, 父进程为 WmiPrvSE,脱离宿主进程树,不会被 taskkill 连坐)拉起 node 助手; 助手全权执行:延时 → `taskkill /PID <ppid> /T /F` → 轮询旧进程退出 → 重新拉起 `DeepSeek Harness.exe`。失败写 `%TEMP%\dsh-restart-now-*.err.log`。 - **客户端半边**(`lib/client.js`)启动时探测环境,仅 desktop 挂载 `sidebar.footer.action` 与 `settings.section` 双入口;web 环境零挂载。 ## 配置 设置页「重启应用」区块可直接编辑并保存(落 `restart-now.config.json`); 也可在 profile 的 `cordis.patch.yml` 条目 `config` 块中设置。 优先级:代码默认 < patch 条目 < 配置文件(UI 保存写入文件层)。 | 键 | 默认 | 说明 | | --- | --- | --- | | `allowRestart` | `true` | 总开关,false 时动作口返回 403 disabled | | `confirm` | `true` | 点击后二次确认 | | `hideSidebarButton` | `false` | 隐藏侧栏底部重启入口(保存后立即生效) | | `delayMs` | `50` | 应答后到杀树的延时(毫秒,0–60000) | | `exePath` | `''` | exe 绝对路径;留空时从当前安装位置自动推导 | ## 安装 在 DSH 桌面版所在机器上运行: ```powershell dsh plugin --profile desktop add dsh-restart-now ``` DSH CLI 会通过 pnpm 从 npm 安装插件,并将其登记到桌面 profile;不需要下载或解压项目源码。安装完成后重启 DSH。升级时再次运行该命令。 ## 适用范围 - **操作系统**:暂时仅支持 Windows 10/11。重启链路(WMI `Win32_Process.Create`、 wscript VBS 派发、`taskkill /T`、`DeepSeek Harness.exe` 路径推导)目前全部是 Windows 机制;在其他系统上安装后插件不挂载任何入口,动作口返回 403 `unsupported-platform`。macOS / Linux 支持在计划中。 - **DSH Desktop**:0.2.0 及以上(验证于 0.2.0-rc.2)。注意 `DeepSeek Harness.exe` 文件属性里的 44.0.0 是内嵌 Electron 运行时版本,不是产品版本;产品版本以 `dsh --version` / 包 `@deepseek-ai/dsh-desktop` 为准。Web profile / `dsh web` 下插件不生效(不挂载入口,动作口拒绝并提示使用 dshmarket 的宿主重启)。 ## 开发 ```powershell npm test # node:test ```
Install
dsh plugin --profile web add github:Mr54233/dsh-restart-now
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-restart-now from the hub
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.