SMPcosy/dsh-plugin-easy2restart

dsh-plugin-easy2restart

DSH plugin: double-click the sidebar restart button to fully relaunch DeepSeek Harness; it is greyed out while an agent

未分類automationdeepseek-harnessdsh

dsh-plugin-easy2restart

🀄 中文(默认展开)

已发布到官方NPM

DSH 重启插件:双击侧边栏重启按钮即可整体重启 DeepSeek Harness,会话运行时按钮置灰禁用。

DeepSeek Harness 重启插件:在左侧边栏账号头像/设置上方放一个「⟳ 重启 DSH」按钮,双击即可整进程重启 DeepSeek Harness;当有 Agent 会话正在运行时,按钮自动置灰禁用,避免打断进行中的工作。

功能

  • 侧边栏 sidebar.footer.action 位置注入重启按钮(账号头像/设置上方)。
  • 双击按钮 → 宿主用 Windows 计划任务拉起一个脱离 DSH 进程树的 PowerShell 脚本,taskkill /T 强杀整个 DSH 进程树,随后重新启动 DeepSeek Harness.exe。
  • 有 Agent 会话运行中时按钮置灰禁用(依据 DSH 会话状态 running)。
  • 无会话运行时按钮可点;宿主管理保存一个「重启待办」,便于后续扩展「重启后回到原会话」等流程。
dsh-pluin-restart-02 dsh-pluin-restart-01

依赖

  • DeepSeek Harness 桌面版(0.2.0-rc 以上)
  • Node.js ≥ 22

安装

前提:dsh 命令在 PATH 中(DeepSeek Harness 自带)。

dsh-plugin-easy2restart

复制上述内容(插件名),进行如下操作: dsh-plugin-easy2restart安装图示​

若发布到 registry:

dsh plugin --profile desktop add dsh-plugin-easy2restart

装完重启 DeepSeek Harness,侧边栏底部账号头像上方即出现「⟳」按钮。

使用

  • 双击「⟳」按钮即可重启 DSH。
  • 当有会话正在运行时按钮为灰色(不可点),会话空闲时可正常重启。
  • 重启由计划任务拉起,与 DSH 自身退出无关,即使 DSH 被强杀也能自动重新启动。

卸载

dsh plugin --profile desktop remove dsh-plugin-easy2restart

然后重启 DSH 使改动生效。

工作原理(简述)

  • lib/index.js(宿主/Cordis 插件):注册 /api/dsh-plugin-easy2restart/* HTTP 路由;/restart 记录待办并调用 scheduleRestart,该函数用 schtasks 创建一个立即运行的重启任务,由计划任务服务启动(脱离 DSH 进程树),执行 restart/restart.ps1。
  • restart/restart.ps1:taskkill /PID <主进程> /T /F 结束整个 DSH 进程树,等待退出后重新 Start-Process DeepSeek Harness.exe。
  • lib/client.js(Web 客户端):注入 sidebar.footer.action 渲染按钮;用 useSessionStatus 判断是否有会话在运行以决定是否禁用。

目录结构

dsh-plugin-easy2restart/
├─ package.json         # 插件清单(dsh.client / dsh.bundle 声明)
├─ cordis.patch.yml     # bundle 挂载声明
├─ lib/
│  ├─ index.js          # 宿主端:HTTP 路由 + 重启调度
│  └─ client.js         # 客户端端:侧边栏按钮
└─ restart/
   └─ restart.ps1       # 重启脚本(杀进程树 + 重启 exe)

备注

  • 这是改安装版主程序之外的一种插件方式:直接以本地 bundle 加入 profile,不修改 app.asar。
  • 若希望「重启完成后自动回到原会话并填入『重启完成』」,可在 /restart 的待办(~/.dsh/storages/dsh-plugin-easy2restart/pending.json)基础上扩展(当前版本不自动填写输入框)。

License

MIT

🌐 English

Published on official NPM

DSH restart plugin: double-click the sidebar restart button to fully relaunch DeepSeek Harness; the button is greyed out while an agent session is running.

A DeepSeek Harness restart plugin: it places a "⟳ Restart DSH" button in the left sidebar above the account avatar / settings; double-click it to restart the whole DeepSeek Harness process. While an agent session is running, the button is automatically greyed out to avoid interrupting work in progress.

Features

  • Injects the restart button into the sidebar.footer.action slot (above the account avatar / settings).
  • Double-click → the host launches a PowerShell script detached from the DSH process tree via Windows Task Scheduler; the script uses taskkill /T to force-kill the whole DSH process tree, then relaunches DeepSeek Harness.exe.
  • The button is greyed out while an agent session is running (based on the DSH session status running).
  • When no session is running, the button is clickable; the host keeps a "restart pending" record so that flows such as "return to the original session after restart" can be added later.
dsh-pluin-restart-02 dsh-pluin-restart-01

Requirements

  • DeepSeek Harness desktop (0.2.0-rc or later)
  • Node.js ≥ 22

Installation

Prerequisite: the dsh command must be on PATH (bundled with DeepSeek Harness).

dsh-plugin-easy2restart

Copy the plugin name above, then follow the steps below: dsh-plugin-easy2restart install illustration

If publishing to a registry:

dsh plugin --profile desktop add dsh-plugin-easy2restart

After installing, restart DeepSeek Harness; the "⟳" button then appears at the bottom of the sidebar, above the account avatar.

Usage

  • Double-click the "⟳" button to restart DSH.
  • The button is greyed out (not clickable) while a session is running; it works normally when the session is idle.
  • The restart is launched by a scheduled task and is independent of DSH exiting itself, so DSH restarts automatically even if it is force-killed.

Uninstall

dsh plugin --profile desktop remove dsh-plugin-easy2restart

Then restart DSH for the change to take effect.

How it works (brief)

  • lib/index.js (host / Cordis plugin): registers the /api/dsh-plugin-easy2restart/* HTTP routes; /restart records the pending entry and calls scheduleRestart, which uses schtasks to create an immediately-running restart task. The task is started by the Task Scheduler service (detached from the DSH process tree) and executes restart/restart.ps1.
  • restart/restart.ps1: taskkill /PID <main process> /T /F terminates the whole DSH process tree, waits for it to exit, then runs Start-Process DeepSeek Harness.exe.
  • lib/client.js (Web client): injects into sidebar.footer.action to render the button; uses useSessionStatus to decide whether to disable it.

Directory structure

dsh-plugin-easy2restart/
├─ package.json         # plugin manifest (dsh.client / dsh.bundle declarations)
├─ cordis.patch.yml     # bundle mount declaration
├─ lib/
│  ├─ index.js          # host side: HTTP routes + restart scheduling
│  └─ client.js         # client side: sidebar button
└─ restart/
   └─ restart.ps1       # restart script (kill process tree + relaunch exe)

Notes

  • This is an alternative to modifying the installed main program: the plugin is added to the profile directly as a local bundle, without touching app.asar.
  • If you want "after the restart, automatically return to the original session and fill in 'restart complete'", you can extend it based on the pending record of /restart (~/.dsh/storages/dsh-plugin-easy2restart/pending.json); the current version does not fill the input box automatically.

License

MIT