dsh-setting-restart:在 Settings → General 中一键重启 DSH 服务

前言

DSH 的扩展方式偏插件化,很多界面入口和宿主能力都可以通过插件挂载。对于 web profile 的使用者来说,重启服务如果还要切回终端,操作会多一步。dsh-setting-restart 提供的是一个通用设置页内的一键重启入口:在 Settings → General 底部出现“一键重启”行,点击后执行 DSH 服务重启,并在浏览器端自动重连。

下面介绍它的定位、核心功能、安装启用方式、典型用法和配置注意事项。

插件定位

dsh-setting-restart893413974-bit 维护的 DSH 插件,许可证为 MIT。它面向已经使用 DeepSeek Harness web profile 的开发者,把重启动作放进设置页,减少在浏览器和终端之间来回切换。

运行要求如下:

  • DeepSeek Harness dsh ≥ 0.1.0-rc.6(web profile)
  • Node.js ≥ 20

核心功能

  • Settings → General 页面底部提供“一键重启”行。
  • 该重启行通过最大 slot order 固定显示在页面最底部。
  • 重启为真实进程重启:宿主启动 detached helper,退出后 helper 重新拉起相同的 dsh 命令。
  • 浏览器标签页在新实例绑定同一端口后自动重连。
  • 提供简体中文 / English 双语 UI 文案。
  • 通过 DSH Typert RPC registry 执行严格调用 settingRestart/restart

安装与启用

1、先安装到 web profile:

dsh plugin --profile web add dsh-setting-restart

2、在 profile 的用户补丁层添加 insert 条目。将下面的条目添加到 $DSH_HOME/profiles/web/cordis.patch.yml

# $DSH_HOME/profiles/web/cordis.patch.yml
- insert:
    - id: setting-restart
      name: dsh-setting-restart

3、启动或重启服务:

dsh web

4、打开 Settings → General,确认页面底部出现“一键重启”行。点击“重启”后,服务进入上述重启流程,页面在新实例绑定同一端口后自动重连。

如果希望同一插件对所有 profile 生效,也可以将相同的 patch 添加到 home-level $DSH_HOME/cordis.patch.yml

典型用法

先执行 dsh web 启动服务。随后打开 Settings → General,页面底部会出现“一键重启”行。

点击“重启”后,宿主会启动 detached helper,随后退出当前进程;helper 会重新拉起相同的 dsh 命令。新实例绑定同一端口后,原浏览器标签页会自动重连。

配置

insert 条目支持可选 config 块。下面示例给出可配置项和默认值:

- insert:
    - id: setting-restart
      name: dsh-setting-restart
      config:
        exitDelayMs: 1200
        waitForExitMs: 30000
        respawn: true
  • exitDelayMs 默认 1200
  • waitForExitMs 默认 30000
  • respawn 默认 true;如果服务已由 systemdpm2 等 supervisor 自动重启,可将其设为 false

适用场景与注意

适合以下场景:

  • 已使用 DSH web profile,希望在浏览器设置页内重启服务。
  • 需要把重启入口固定放在 Settings → General 底部。
  • 服务不由外部 supervisor 管理,希望插件完成真实进程重启和自动重连。

需要注意:

  • 插件以当前 dsh 进程权限运行,安装前应检查源码、接口和许可证。
  • 如果已有 systemdpm2 等 supervisor 管理进程,建议把 respawn 设为 false,避免重复拉起。
  • 使用前确认本机满足 dsh ≥ 0.1.0-rc.6 与 Node.js ≥ 20 的版本要求。

结尾

dsh-setting-restart 的价值在于把 DSH 服务重启收敛到通用设置页:入口固定、动作明确、页面可自动重连。GitHub 仓库:https://github.com/893413974-bit/dsh-setting-restart

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜