knlght/DSH-shutdown

Plugin插件 Native原生 ⭐ 2 MIT Search & Web Access搜索与联网

One-click shutdown of DeepSeek Harness service: Settings shutdown page + secondary confirmation + graceful exit, no background processes left behind when closing the browser.

Project Overview项目介绍

This repository is a native plugin built exclusively for DeepSeek Harness (DSH), designed to solve the common problem that closing the browser does not terminate DSH's background process, which continues to consume system memory and hold network ports. It adds a visual control entry directly in DSH's settings page, so users do not need to use command line tools to shut down or restart the DSH service. To install the plugin, you can run the DSH CLI command dsh plugin --profile web add <this repository or npm package name>, then restart the DSH web service to activate it.

After installation, the plugin adds a new "Service Control" tab at the bottom of the DSH settings sidebar. When you click the shut down or restart button, a confirmation prompt will pop up to prevent accidental misoperation. After you confirm the operation, the page will display a clear success message and automatically try to close the current tab. The plugin follows DSH's native design system, uses DSH theme tokens for all buttons and colors, and adapts automatically to both light and dark mode. For restart requests, the DSH launcher script will catch the special exit code and automatically relaunch the DSH web service.

The plugin includes built-in CSRF protection to prevent malicious websites from forcibly shutting down your local DSH service. It checks the Origin header for browser requests, blocks all cross-origin requests with a 403 error, and allows requests from localhost, matching Origin/Host for custom hosts, and non-browser requests like curl. It is released under the open-source MIT license, so anyone can use, modify, or contribute to the project without any cost or restriction. Users are reminded to wait for any ongoing conversation to finish before shutting down or restarting the service to avoid data issues.

knlght/DSH-shutdown 是一款专门为 DeepSeek Harness (DSH) 开发的原生插件,核心功能是为 DSH 提供一键关闭和重启后台服务的能力。默认情况下,关闭浏览器不会终止 DSH 后台进程,导致进程持续占用端口和内存,本插件在 DSH 的设置页面新增了可视化操作入口,用户无需使用命令行即可完成服务管控操作。

安装完成后,插件会在 DSH 设置页面侧栏最底部新增「服务开关」标签页,用户点击关闭或重启按钮后会弹出二次确认窗口,防止误触操作。操作完成后页面会给出清晰的成功反馈,还会自动尝试关闭当前标签页,重启操作会被 DSH 的启动脚本捕获并自动重新拉起 DSH 服务,整个流程无需手动干预。

本插件使用 MIT 许可免费开源,自带 CSRF 防护功能,针对浏览器跨源请求和同源请求分别设置了校验规则,防止恶意网站非法关闭本地 DSH 服务。安装可以通过 DSH 命令行工具完成,执行 dsh plugin --profile web add 本仓库 后重启 DSH web 即可生效。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:knlght/DSH-shutdown

把 knlght/DSH-shutdown 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-shutdown

一键关闭 / 重启 DSH 服务

Settings「服务开关」页 · 二次确认 · 优雅退出 / 自动重启

关掉浏览器不再留下后台进程,也能一键重启服务。
🌏 中文 · English

✨ 为什么需要

关闭浏览器不会结束 dsh 的后台服务进程——服务继续占用端口与内存。本插件在页面内提供一键关机/重启入口,无需命令行。

✨ 功能一览

  • 🖥️ Settings「服务开关」页:侧栏最底部新增「服务开关」页签
  • 🛡️ 二次确认:点「关闭 DSH 服务」或「重启 DSH 服务」→ 出现「确认 / 取消」双按钮,防误触
  • ✅ 成功反馈:确认后页面立即显示绿色「关闭成功 / 重启中」面板(并尝试自动关闭标签页)
  • 🔁 自动重启:重启请求会让宿主进程以特殊退出码退出,由 launcher/dsh-web.ps1 启动脚本捕获后自动重新拉起(根目录 dsh-web.cmd/dsh-web.ps1 为快捷入口)
  • 🎨 原生风格:按钮与配色全部引用 DSH 主题 token(--dsw-alias-*),明暗自适应

📦 安装

dsh plugin --profile web add <本仓库 / npm 包名>
# 重启 dsh web 生效

🧠 设计要点

  • 关机端点:/_dsh/shutdown(仅 POST)——服务先返回「正在关闭」响应,500ms 后 process.exit(0) 优雅退出
  • 重启端点:/_dsh/restart(仅 POST)——服务先返回「正在重启」响应,500ms 后以退出码 42 退出;dsh-web.ps1 检测到该退出码会自动重新启动 dsh web
  • 会话日志为逐事件落盘,空闲时退出安全;正在进行的对话请等待其完成后再操作
  • 浏览器安全策略下脚本只能关闭自己打开的窗口——手动打开的标签页会保留成功面板,两种情况下你都能确认结果

🧩 生态

打上 dsh-shutdown topic 的插件可接入同一生态。欢迎通过 PR 改进本插件。

📄 许可

MIT

🔒 安全说明

关机端点会终止整个服务,是破坏性最强的操作,因此端点自身带有跨站请求(CSRF)防护:

  • 浏览器发起的请求:校验 Origin 头。来自外部站点的一律返回 403,防止任意网页在后台关闭你本机的 DSH——浏览器不会为这类跨源简单 POST 做预检,所以端点必须自己把关
  • 同源访问:127.0.0.1 / localhost / ::1 直接放行;通过局域网 IP 或自定义主机名访问(dsh web --host 0.0.0.0)时,要求 Origin 与 Host 一致
  • 无 Origin 的请求:curl、启动脚本等非浏览器客户端放行,不影响脚本化使用

📝 更新日志

v0.2.0

  • 新增 CSRF 防护(详见上方安全说明)
  • 修复 前端在端点返回 500 等错误时仍显示「关闭成功」——此前只要 fetch 未抛异常就当作成功,现在区分网络层失败、响应解析失败与 HTTP 错误三类情况
  • 修复 插件卸载 / 热重载时未撤销 slots.inject 注册,可能导致设置页残留重复条目
  • 新增 17 个行为测试(host 10 + client 7),覆盖 CSRF 守卫、退出码语义、卸载清理与响应判定
← 上一个 Prev dsh-coding-plans 下一个 Next dsh-custom-subagents →