Introduction

In the use cases of DeepSeek Harness (DSH), if model inference or background services are running inside a WSL distro, the distro may be automatically closed by the Windows system after a period of idling. This can cause the DSH host to lose connection with its child processes, affecting the continuity of tasks.

The wsl-keepalive plugin provides a “Keepalive” switch in the DSH WebUI under Settings → Plugins. It allows the host to control the starting and stopping of dbus-daemon, thereby preventing the WSL distro from being closed due to idle time. The plugin also provides status monitoring and configuration management.

Features

  • Keepalive switch: Adds a “Keepalive” row in the WebUI settings, enabling one-click start or stop of WSL keepalive.
  • Status and PID display: The subtitle displays “Enabled · PID ” or “Disabled” in real time, and shows the distro name.
  • Prevent duplicate startup: Before starting, it checks via pgrep -x dbus-daemon to avoid launching duplicate processes.
  • Precise stop: When disabling, it only executes kill on the specific PID recorded in memory or detected, rather than indiscriminately terminating all dbus-daemon processes in the system.
  • Automatic wsl.exe detection: If wsl-exec-path is not configured, the plugin automatically detects /mnt/c/Windows/System32/wsl.exe.
  • Command configuration validation: When editing the distro name, username, or wsl.exe path, the system performs runtime validation. If validation fails, the modification is reverted and a red error message is shown; if successful, it is saved to disk.
  • Configuration persistence: The configuration file is stored at ${DSH_HOME:-~/.dsh}/wsl-keepalive.json and is automatically loaded after restart.
  • Localized display: Supports switching between Chinese and English interfaces, with English as the default/fallback.

Prerequisites

The environment running DSH Web must meet the following conditions:

  1. WSL interop: wsl.exe --exec can be invoked from inside WSL.
  2. wsl.exe accessible: /mnt/c/Windows/System32/wsl.exe or the path specified in the configuration must exist.
  3. dbus-launch: /usr/bin/dbus-launch must already be installed in the target WSL distro.
  4. Node.js environment: The build toolchain requires Node.js version ^22.19.0 or >=24.0.0.
  5. DSH Web: The plugin must be installed via the Web profile.

Installation and Enablement

Install the plugin using the following command:

dsh plugin --profile web add "github:TheColdWorld/dsh-wsl-keepalive"

After installation, restart DSH. The “Keepalive” switch can be found on the WebUI Settings → Plugins page.

Configuration Notes

The configuration file is located at ${DSH_HOME:-~/.dsh}/wsl-keepalive.json. It is read when the plugin starts; if the file is missing or fields are empty, default values are used.

{
  "wsl-dist-name": "",
  "wsl-user-name": "",
  "wsl-exec-path": "/mnt/c/Windows/System32/wsl.exe"
}
  • wsl-dist-name: Target distro name. If non-empty, -d <name> is appended to the command. If validation finds that the distro does not exist after the modification, the change is reverted.
  • wsl-user-name: Username for running the keepalive process. If non-empty, --user <name> is appended to the command. If the user does not exist, the change is reverted.
  • wsl-exec-path: Absolute path to wsl.exe in the Linux filesystem. If empty, /mnt/c/Windows/System32/wsl.exe is automatically detected. If the path is invalid, the change is reverted.

In the WebUI “WSL Keepalive” tab, under the “Command Configuration” section, changes can be submitted by blurring the field or pressing Enter. If validation passes, the changes are written to the file.

Notes

  • This plugin is an unofficial third-party project, fully AI-generated, and distributed under the MIT license.
  • The plugin runs with the permissions of the current DSH process. Ensure the source code and license meet your security requirements.
  • The plugin communicates with the host via /api/wsl-keepalive/* endpoints. The host must have HTTP transport capability.