chenkai2/dsh-daemon

dsh daemon: register the DeepSeek Harness web server (dsh web) as an auto-start, self-healing background service (LaunchAgent / systemd / cron + watchdog)

Project Overview项目介绍

This is a native plugin built exclusively for DeepSeek Harness (DSH) that registers DSH’s dsh web service as an auto-starting, self-healing background daemon. To install via the recommended method, you must have DSH v0.1.9 or newer, and pnpm available on your system PATH. It supports automatic startup on user login, automatic restart after system wake from sleep, and 30-second interval health checks that trigger a service restart after 3 consecutive failures. It works across macOS, Linux, and Windows, with platform-specific service registration tailored to each OS’s native manager.

After installation, the plugin registers seven agent-callable tools that let DSH agents handle common daemon tasks: install, uninstall, reinstall, check status, start, stop, and update. It also installs a lightweight dsh-daemon CLI command in your Node.js bin directory, so you can manage the daemon directly from your terminal without opening the DSH GUI. All install and uninstall operations leave currently running DSH sessions untouched, so you will never lose work in progress due to plugin management. Developers can test the plugin dynamically without installing it to their DSH profile, which simplifies development and debugging.

The plugin is released under the open-source MIT license, and requires the danger-full-access permission because it manages user-level system service files and executes system commands. Windows support is fully implemented to match macOS and Linux behavior, but it has not been verified on production Windows machines, so users should note this limitation when installing on Windows. Automatic plugin updates will automatically regenerate the watchdog script and restart the daemon, so users almost never need to manually intervene after initial installation. Node.js 18 or newer is required for the watchdog script to run correctly.

这是一款专为 DeepSeek Harness (DSH) 开发的原生插件,作用是将 DSH 的 dsh web 网络服务注册为可自启动、自愈的后台守护进程。它支持开机登录自动启动、系统睡眠唤醒后自动重启、每30秒(可配置)进行一次健康检查,连续3次检查失败后自动重启服务,适配macOS、Linux、Windows三大主流桌面系统。可通过DSH官方插件管理器安装到web配置文件,要求PATH环境变量中带有pnpm包管理器。

插件提供了7个可供DSH智能体调用的工具,分别实现安装、卸载、重装、状态查询、启动、停止、更新守护进程的功能,同时还在Node的bin目录生成轻量 dsh-daemon 命令行工具,支持不打开GUI即可在终端管理守护进程。安装和卸载过程不会影响当前正在运行的DSH会话,避免了操作中断工作流。面向开发人员还提供了动态调试方式,无需安装即可测试插件功能。

插件采用MIT许可免费开源,使用过程中需要请求 danger-full-access 权限,因为需要管理用户级系统服务和状态文件。Windows平台的功能已经按照同等行为实现,但尚未在真实Windows设备上经过完整验证,使用时需要注意这一点。升级插件后会自动重新生成守护进程脚本,无需用户手动执行重装操作,日常使用基本无需人工干预。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 3 stars - very few users, little community feedback星标只有 3,几乎没人在用,遇到问题缺少社区反馈
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 @chenkai114/dsh-daemon

把 chenkai2/dsh-daemon 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-daemon

中文 | English

将 DeepSeek Harness 网络服务(dsh web)注册为自启动、自愈的后台服务。

安装后,dsh web 将:

  • 登录时自动启动(LaunchAgent RunAtLoad / systemd WantedBy=default.target / cron @reboot)
  • 睡眠唤醒后自动重启
  • 自愈:watchdog 每 30 秒(可配置)健康检查一次 http://127.0.0.1:<port>/health,连续 3 次失败后重启服务
  • 不依赖当前会话:watchdog 是独立生成的脚本,而非内存中的插件

安装/卸载永远不会触碰当前正在运行的会话。

账号对应关系(npm scope / GitHub 账号)见 CONTEXT.md。


使用方式

方式 A —— 用 dsh plugin 安装(v0.1.9+,推荐)

  1. 用官方插件管理器将包安装到 web profile(在 profile 目录内运行 pnpm,使 loader 能解析到它;仅全局安装不够——见下):

    dsh plugin --profile web add @chenkai114/dsh-daemon
    

    (需要 PATH 上有 pnpm——用 corepack enable 一次性启用。)

    为什么不能只 npm install -g?loader 以 Node ESM 解析导入 name: 行,解析锚点是 profile 目录(~/.dsh/profiles/web/);全局 node_modules 不在该解析链上(NODE_PATH 对 ESM 无效)。profile 自己的 node_modules——由 pnpm 管理——才是包可达的原因。

  2. 重启 dsh web。包声明了 dsh.bundle manifest,dsh plugin add 会把它自动加入 dsh.profile.bundles,启动时作为 bundle 层挂载——不需要(也不应该)再手动往 ~/.dsh/profiles/web/cordis.patch.yml 里 insert 同一行,否则会触发 duplicate loader entry id: dsh-daemon 启动失败。

    七个 dsh_daemon_* 工具即可供每个 agent 使用——直接让 agent 运行 dsh_daemon_install。

以后升级:dsh plugin --profile web update @chenkai114/dsh-daemon(并重启)。

⚠️ 从 v0.1.8 及更早版本升级:如果你之前按旧文档在 ~/.dsh/profiles/web/cordis.patch.yml 里手动加过 - insert: dsh-daemon 行,升级后必须删掉那一行(保留文件里其他内容),否则 bundle 层 + 手动层会插入同一个 id: dsh-daemon 两次,dsh web 启动时报 duplicate loader entry id。删除后重启即可。

权限说明:daemon 管理用户级系统服务(LaunchAgent plist、$DSH_HOME 下的状态文件),因此插件对其文件与命令操作请求 danger-full-access。若部署拒绝提权,工具会以沙箱拒绝失败。

方式 B —— 动态 Cordis 插件(无需安装)

将 lib/index.js 的内容粘贴到 cordis_define 的 code.host 字段并运行。这正是插件在真实会话中开发与验证的方式:沙箱提供 harness 全局,文件以 return plugin; 结尾。

端口

默认端口为当前监听的 webServer 端口(通常 3080),其次 DSH_WEB_PORT,再其次工具显式 port 参数。更换端口后运行 dsh_daemon_reinstall。


架构

守护进程是一个watchdog 监督者,由三部分组成。

1. 平台注册

一个按用户注册的服务,负责在登录时启动 watchdog 并保持其存活:

平台 机制
macOS LaunchAgent ~/Library/LaunchAgents/com.deepseek-ai.dsh-watchdog.plist —— ProgramArguments=[node, watchdog.js]、RunAtLoad、KeepAlive{SuccessfulExit:false}、ThrottleInterval=10,环境变量携带 DSH_WEB_PORT 与 DSH_HOME。通过 launchctl load -w 加载。
Linux systemd 用户单元 ~/.config/systemd/user/dsh-watchdog.service —— Type=simple、Restart=always、RestartSec=10、StartLimitIntervalSec=0;通过 systemctl --user enable --now 启用。systemd 不可用时回退为 cron @reboot 条目。
Windows VBS 启动器 + 计划任务 —— 任务 DshWatchdog(XML 在 $DSH_HOME/daemon/dsh-watchdog-task.xml,UTF-16LE)在登录时运行 wscript.exe //B dsh-watchdog.vbs;VBS 设置 DSH_WEB_PORT/DSH_HOME 并以隐藏窗口启动 node watchdog.js。RestartOnFailure PT1M/999,MultipleInstancesPolicy=IgnoreNew。通过 schtasks /Create 注册。

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-spec-collab 下一个 Next dsh-mcp-apps →