dsh-web-service: Hosting `dsh web` as a Windows Service

Preface

The dsh web in DeepSeek Harness runs the Web UI as a foreground process: close the command line window and the interface disappears; after user logout or machine reboot, it won’t auto-recover either. If you want a “connect anytime” DSH host on your LAN, you need to hand the process over to the Windows Service Control Manager (SCM).

A regular Node program cannot be registered as a Windows service directly — SCM requires calling StartServiceCtrlDispatcher and periodically reporting heartbeats, otherwise it will be judged as unresponsive and terminated after about 30 seconds. Therefore, in practice, you need to use a native wrapper such as nssm or WinSW sandwiched between SCM and node.exe. When configuring the wrapper manually, it’s easy to stumble on details like ~ pointing to the system configuration directory under LocalSystem, DSH_HOME and profile paths, log rotation, and restart policies. The community plugin dsh-web-service (maintainer zheyuanlinye7) handles these steps in one go via MCP tools and CLI, and comes with diagnostic capabilities based on real failure logs.

What is this

dsh-web-service is a client-side plugin in the DeepSeek Harness ecosystem: it doesn’t modify dsh itself, nor does it download nssm / WinSW binaries for you. It only uses the wrapper already present on the machine, generating complete service parameters and handling registration, start/stop, and diagnostics. The current package version is 0.1.0, license MIT, platform restriction Windows (win32), Node.js >= 22, and the dsh engine is declared as >=0.2.0-rc.1 <0.3.0.

Directory page: SkillHub - dsh-web-service
Source code and documentation: GitHub - zheyuanlinye7/dsh-web-service

Core Features

Install and Repair the Service

The plugin detects node, @deepseek-ai/dsh/lib/bin.js, $DSH_HOME, the profile directory, nssm or WinSW, generates complete parameters, registers the service, and after startup probes whether the port is available.

Diagnostics

Parses the service log and translates the reasons for “won’t start” into readable conclusions, such as port in use, profile plugin peer incompatibility with the new dsh version, plugin tree load failure, profile directory not found, permission denied, and provides actionable fix suggestions. The README notes: the diagnostic rules come from real-machine log samples, not hypothetical scenarios.

Control and Dry-run

  • Control: start / stop / restart, and waits for SCM to report the new state, rather than relying solely on the exit code of sc start.
  • plan: read-only dry-run, prints the commands to be executed and the files to be written, without writing anything to disk.

Two Wrappers

Supports nssm (public domain) and WinSW (MIT), auto-detects paths; can also explicitly specify with --nssm / --winsw.

What it doesn’t do

  • Does not bundle or download any third-party executable files.
  • Does not patch DSH source code, does not change dsh’s listening/binding logic.
  • status, plan, diagnose are read-only and require no administrator privileges; install / uninstall / start / stop require elevation.

Installation and MCP Enablement

Install from GitHub into the web profile:

dsh plugin --profile web add "github:zheyuanlinye7/dsh-web-service"

After installation, restart dsh once. The cordis.patch.yml in the plugin package mounts the MCP client, but it is disabled by default (to avoid gaining admin-level capabilities just by installing the package):

- id: mcp-dsh-web-service
  name: '@deepseek-ai/dsh-mcp-client'
  disabled: true

If you want the agent to manage the service, enable this item on the DSH Plugins page (or change disabled to false) and then restart.

Prerequisites

  • Windows, Node.js 22+
  • nssm or WinSW already placed on the machine (the plugin can auto-discover them in PATH or common directories; see the detection scope explanation in the README)

Typical Usage

Command Line

First check the current status, then dry-run, and finally install in an elevated terminal; use diagnostics when it won’t start:

npx dsh-web-service status
npx dsh-web-service plan
npx dsh-web-service install
npx dsh-web-service diagnose

Let the Agent Operate via MCP

After enabling MCP, you can directly state your needs, e.g.: install dsh web as a Windows service, port 3080, auto-start on boot. Available tools include mcp__winsvc__service_status, service_plan, service_install, service_uninstall, service_control, service_diagnose, service_logs (see the README table in the repository for names and purposes).

Common Configuration

CLI and MCP share a set of options (CLI uses --dry-run, MCP uses dryRun: true). A selection of default values is as follows:

Option Default Description
--name dsh-web Service name
--profile web Hosted dsh profile
--port 3080 Listening port
--dsh-home $DSH_HOME → ~/.dsh Harness home directory
--account LocalSystem Service account
--log <user dir>\<service name>.log stdout/stderr merged, 10 MB rotation

See the GitHub README for the full option table.

How It Works (What It Does During Installation)

Installing a service is essentially getting five things right (as summarized in the README):

  1. Process command: e.g. node.exe ...\dsh\lib\bin.js web --no-open --port 3080
  2. Environment variables: Under LocalSystem, DSH_HOME, USERPROFILE, APPDATA, etc. must be explicitly set, otherwise dsh will look for configurations in the system profile directory.
  3. Working directory: Must be a directory that actually exists.
  4. Logging: Merge stdout/stderr, enable rotation, to avoid unbounded log growth.
  5. Exit policy: Delayed restart after crash, graceful exit window when stopped.

For a more detailed architectural explanation, see docs/architecture.md in the repository.

Suitable Scenarios and Caveats

Suitable for: Running dsh web long-term on Windows, requiring auto-start on boot, no console window, still listening after user logout; willing to prepare nssm or WinSW yourself and accept administrator privileges during service installation.

Security: --host 0.0.0.0 exposes the Web UI to the LAN; dsh has token-based browser session authentication for the Web UI. If there are changes in the environment that bypass authentication, the risk to any device that can access the port will be amplified — you need to assess this yourself before enabling it.

Ecosystem note: The DeepSeek Harness community plugin directory (such as SkillHub) is an independent site with no official affiliation with DeepSeek / High-Flyer; before installing third-party plugins, it is recommended to read the source code and LICENSE, and confirm compatibility with the current dsh version.

Links

  • Directory page: https://www.skillhub.cn/plugins/zheyuanlinye7/dsh-web-service
  • GitHub: https://github.com/zheyuanlinye7/dsh-web-service

With the steps above, you can turn dsh web on Windows from a foreground process that “only lives while the window is open” into an SCM-managed background service, and use the same CLI / MCP toolset for status checking, installation dry-run, and fault diagnosis.

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

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

Xiaoye