Introduction

DSH (DeepSeek Harness) uses a plugin-based architecture. During development or debugging, restarting DSH Desktop is a common requirement when applying configuration updates or plugin changes. Manually restarting the application is not only inefficient but may also interrupt the current context session. This plugin aims to provide a standardized set of restart entry points, covering the command line, settings panel, and API interface.

Core Features

This plugin is maintained by MicroWearld and provides the following core capabilities:

  1. Restart the Application Itself: Keep the current Profile unchanged and restart the DSH Desktop application process.
  2. Switch Profile and Restart: Support switching to a specified Profile and performing the restart operation.
  3. Multiple Entry Points: Provide unified operation entry points through the command line, Web settings panel, standalone Web page, and API interface.

Installation and Enablement

In the DSH Desktop terminal (or any dsh CLI), run the following command for the desktop profile:

dsh plugin --profile desktop add "link:D:/workspace/dsh-quick-restart-desktop"

After installation, you need to restart DSH Desktop for the plugin to be activated with the next Loader composition.

Typical Usage

1. Command-Line Entry

The plugin registers the following slash commands:

  • /desktop-restart: Restart the current Profile’s application itself.
  • /desktop-restart <profile>: Switch to the specified Profile and restart.
  • /desktop-profiles: List the current Profile and all discoverable Profiles.

2. Settings and Web Entry

  • Settings Page: In the settings page, go to the “Quick Restart” panel. The first row is the main “Restart DSH Desktop” button, and other rows correspond to “Switch to and restart with this profile”.
  • Standalone Page: Open http://localhost:<port>/desktop-restart directly in a browser to view the full panel and operation buttons.

3. API Interface

The plugin provides a JSON-based HTTP API, listening on 127.0.0.1:

  • Restart API: POST /desktop-restart/api/restart
    • Request body: { profile?: string }. If no parameter is provided or the parameter is the current Profile, restart the application itself; otherwise, switch and restart.
    • Behavior: Immediately return “Accepted” without waiting for the process to exit.
    • Limitations: Requires JSON content-type; return 413 if the Body exceeds 64 KiB.
  • Status Query API: GET /desktop-restart/api/state
    • Response: { current, profiles[] }.

Technical Details and Security

  • Protocol Dependencies: Restarting the application itself depends on desktopRuntime.requestRestart() (an internal API); switching Profile depends on desktopProfiles.select() (an official contract).
  • Security Boundaries: The API has no authentication protection, but the webServer binds only to the loopback address (127.0.0.1), and restart requests require JSON content-type, effectively defending against cross-origin form attacks.
  • Compatibility: In a standard dsh web environment (without desktopProfiles), the plugin loads normally but mounts no functionality, avoiding errors.

Notes

  • Tray Menu: The DSH Desktop tray menu already includes built-in Profile switching, handled by the desktop-profiles plugin. This plugin does not register tray entries.
  • Permissions: This plugin runs with the permissions of the current dsh process. It is recommended to review the source code and license (MIT) before installation.

Summary

This plugin uses standardized interfaces to solve DSH Desktop restart and Profile switching needs, suitable for development debugging and automation script scenarios.