- Home
- Plugin
- Miglioramenti UI
- dsh-quick-restart
S
dsh-quick-restart
summertig/dsh-quick-restart
One-click full restart for DeepSeek Harness: a button in the session header gracefully quits the app, relaunches it, and brings the browser back to the new random port; asks for confirmation only while a session task is running. macOS. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.
Installazione
dsh plugin --profile web add github:summertig/dsh-quick-restartREADME
dsh-quick-restart · DSH 快速重启按钮
DSH(DeepSeek Harness)会话头右上角的一键完全重启按钮:完全退出 → 自动重新打开 → 自动把浏览器带回新地址。改插件、改配置后需要重启生效时,不用再手动退出再打开。
功能背景
- 高频重启的现实痛点:DSH 插件以
pnpm link装进 profile,任何插件/配置改动都要「完全关闭再打开」才生效;改得勤的时候一天重启十几次,手动退出→打开→找回标签页非常磨人。 - 宿主没有任何暴露出来的重启通道(asar 源码实证):
Restart App and Host菜单项只存在于 development 模式(app.relaunch(); quitWithoutConfirmation()),正式版没有;- Web UI 的 IPC 通道清单里没有 quit / relaunch 命令,重启逻辑全部锁在主进程内部。
- 重启后浏览器地址必变:desktop host 以
--port 0启动 web server,端口每次启动随机且无持久化——重启完浏览器还停在旧地址上,只能手动去桌面窗口找新端口。因此「重启」必须自带「把浏览器带回新地址」的回连闭环。 - 为什么做成独立插件而不是改宿主:改
app.asar会在下次升级时被整体覆盖;插件机制(host 半片 + client 半片)是被官方支持的扩展点,升级免疫。
使用说明
按钮与交互
- 位置:会话标题栏右侧工具区(
conversation.session.header.utilities槽位),排在第一位,线性刷新图标,悬停提示「完全重启 DSH」、图标旋转一圈;仅在打开会话时渲染(宿主槽位契约,scope 为 session)。 - 点击行为:
- 有正在运行的会话任务 → 弹确认层(说明任务会被中断),确认后才重启;
- 没有运行中的任务 → 直接重启,不多问一句;
- 运行状态判定用
ctx.sessions.list快照的running位(宿主 live running-state);判定异常时保守弹确认,绝不误杀任务。
- 重启全程:
- 覆盖层「DSH 正在重启…」铺满页面;
- 孤儿脚本(脱离进程组,宿主退出不影响它)执行:优雅退出(
osascript quit;有活动任务时宿主自己会弹任务中断确认框,留 90 秒宽限)→ 轮询确认进程完全消失 →open -a重新启动; - 浏览器场景:等插件在新进程里报出新的 runId(端口每次启动必变),从状态文件取新端口自动打开新地址;桌面内嵌窗口(
dsh-app:协议)场景跳过回连,窗口由 Electron 单实例自动恢复。
安装(desktop profile)
从 npm 安装(推荐):
~/.dsh/profiles/desktop/package.json:- dependencies 增加
"@summertig/dsh-quick-restart": "^1.0.0"; dsh.profile.bundles数组追加"@summertig/dsh-quick-restart";
- dependencies 增加
cd ~/.dsh/profiles/desktop && pnpm install- 重启一次 DSH 生效。
开发模式(pnpm link 本机源码):dependencies 写 "@local/dsh-quick-restart": "link:<本仓库路径>",bundles 写 "@local/dsh-quick-restart",其余同上。
手动等价操作(不依赖按钮)
zsh <本仓库路径>/restart.sh browser
诊断
~/.dsh/dsh-quick-restart-state.json:本次会话 runId 与 Web 端口(脚本判定「新会话已就绪」的依据)~/.dsh/dsh-quick-restart.log:重启脚本全程日志~/.dsh/dsh-quick-restart-host.log:宿主半片日志(module loaded → apply → register ok → restart armed)
文件结构
| 文件 | 职责 |
|---|---|
index.js | 宿主半片:维护状态文件(runId/端口),注册 /dsh-quick-restart/* 路由,POST 拉起孤儿脚本 |
client.js | Web 半片:conversation.session.header.utilities 槽位注入按钮 + 确认弹层(portal)+ 重启覆盖层 + running 判定 |
restart.sh | 孤儿脚本:quit → 等完全退出 → open 重开 → 等新 runId → 回连浏览器 |
cordis.patch.yml | Cordis bundle patch:把本插件插进 profile 的插件清单 |
版本变更见 CHANGELOG.md。
Plugin correlati
Z
dsh-web (dsh-task-board)
zhu1090093659/dsh-web
10.7k22 ore faMiglioramenti UIApache-2.0
Z
dsh-web (dsh-web-all)
zhu1090093659/dsh-web
10.7k22 ore faMiglioramenti UIApache-2.0
C
dsh-TUI
ccch1mneyyy/dsh-tui
8.7k4 ore faMiglioramenti UIMIT
Z
dsh-web-ui (dsh-task-board)
zhu1090093659/dsh-web-ui
6.3k3 mesi faMiglioramenti UIApache-2.0