Passer au contenu principal
L

dsh-restart-button

lightfrom/dsh-restart-button

Adds a one-click Restart action to the DeepSeek Harness sidebar: it quits the app, relaunches it, and refreshes the page once the new instance answers.

Installer

dsh plugin --profile web add github:lightfrom/dsh-restart-button

README

Restart Button for DeepSeek Harness

CI

A Restart button in the sidebar foot, next to Settings. One click quits DeepSeek Harness and starts it again; the page reloads by itself once the new instance answers.

中文文档

Overview

DeepSeek Harness has no built-in way to restart itself from the interface: you close the window and open the application again. This plugin puts that whole sequence behind one button and keeps the browser page in the loop, so a restart feels like a page reload instead of a lost session.

The plugin is a normal DSH bundle. It can be switched off from Settings → Plugins at any time, and turning it off removes the button, its route and its styles without a restart.

Key Features

  • One click, no confirmation. The button starts the restart immediately.
  • The page survives. It shows Restarting, waits for the replacement, then reloads onto the new instance.
  • Correct on both launch modes. The desktop application is relaunched as the application (not as a second headless Host), and a plain dsh web launch replays its own command line. Either way the old listener is gone before the replacement binds, so the restart does not end in EADDRINUSE.
  • Guarded endpoint. POST /__local-restart/restart goes through the composition's own connection fence (Host/Origin plus the browser session), so another local process cannot restart your Harness.
  • Live switch. enabled is the only setting; toggling it disposes or mounts the plugin row without restarting.
  • Bilingual. The button, the plugin card and the dictionaries ship in Simplified Chinese and English.

Screenshot

The restart action sits at the bottom of the sidebar, below the workspace list and above the account row:

The Restart button at the bottom of the DeepSeek Harness sidebar

Architecture

Three parts, split by what each one is allowed to do:

 Browser page                Host process                 Detached helper
 ────────────                ────────────                 ─────────────────
 click
   │ POST /__local-restart/restart
   ├────────────────────────▶ fence check
   │                          spawn helper ─────────────▶ waits for the port
   │ 202 Accepted                                          to be released
   │                          exit                          │
   │ poll GET /__local-restart/ping                        │ close the app
   │                          (gone)                        │ start it again
   │                                                        ▼
   └──────────── reload ◀──────────── new instance listens ─┘
  • index.js (Host) registers the route and starts the helper with the invocation the replacement must use.
  • restart-helper.mjs is detached with stdio: 'ignore', so it outlives the process it replaces. It closes the application, waits for the port, starts the replacement and logs every step.
  • client.js (Client) registers the sidebar button and runs the wait-then-reload loop.
  • restart-utils.mjs holds the dependency-free pieces the Host half uses: the single-flight guard (409 while a restart is running), exclusive creation of the log file, and a capped body drain for authorized requests.

Project Structure

dsh-restart-button/
├── .github/workflows/ci.yml   Syntax, packaging gate and tests on push
├── assets/
│   ├── icon-180.png           Raster storefront icon (PNG)
│   └── restart-button-sidebar.png  Screenshot used by this README
├── client.js                  Client half: the sidebar button and reload loop
├── cordis.patch.yml           Bundle patch that inserts the plugin row
├── docs/verification.md       Checks run for the 1.0.x releases and their results
├── icon.svg                   Plugin card icon
├── index.js                   Host half: guarded endpoint and helper spawn
├── locale/
│   ├── en.json                Plugin card title and description (English)
│   └── zh.json                Plugin card title and description (Chinese)
├── package.json               Manifest: exports, dsh.bundle, dsh.client
├── restart-helper.mjs         Detached helper that performs the restart
├── restart-utils.mjs          Guard, exclusive log file and bounded body drain
├── scripts/verify-package.mjs Packaging gate used by `prepack`
├── test/plugin.test.mjs       Structure, i18n, dependency and secret tests
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md                  This file
├── README_CN.md               Chinese README
└── SECURITY.md

Requirements

  • DeepSeek Harness Desktop, or a standalone dsh CLI. Development and the live check were done on Windows; the POSIX branches in the helper are present but have not been exercised. The packaged dsh.cmd shim exports ELECTRON_RUN_AS_NODE=1, so a launch through it is classified as the desktop Host; its restart reopens the desktop application instead of replaying that CLI invocation.
  • Node.js 20 or newer for development and for the test suite. The plugin itself runs inside Harness and only uses node: builtins plus @deepseek-ai/schemastery, which Harness already provides; it is declared as a peer dependency instead of being bundled.

Installation

The plugin is not published to npm, so install it from the artifact or the repository. Every method below ends with a restart of Harness: bundle patches are composed at launch.

From the packaged tarball (recommended; pnpm add accepts a local file). Download it from the v1.0.2 release (the release also carries SHA256SUMS.txt and a source zip):

dsh plugin --profile desktop add ./dsh-restart-button-1.0.2.tgz

From a clone of this repository:

git clone https://github.com/Lightfrom/dsh-restart-button.git
dsh plugin --profile desktop add ./dsh-restart-button

From npm, once it is published:

dsh plugin --profile desktop add dsh-restart-button

Replace desktop with the profile you actually run (dsh --profile <name>).

Then quit and relaunch Harness. The button appears in the sidebar footer, beside Settings. If an earlier development build of this plugin is still installed under another package name, remove it first so only one restart button is registered.

To uninstall:

dsh plugin --profile desktop remove dsh-restart-button

Configuration

The row has one option:

OptionDefaultMeaning
enabledtrueRegister the button and the restart route. false leaves nothing behind.

Settings → Plugins → Restart Button toggles the same option, live. A patch file can also set it:

- id: dsh-restart-button
  config:
    enabled: false

Quick Start

  1. Install the bundle (see above) and relaunch Harness.
  2. Find Restart (中文界面: 重启) at the bottom of the sidebar.
  3. Click it. The label changes to Restarting, the window closes, and the page reloads when the new instance is listening.

The restart takes several seconds: the application has to finish quitting before the replacement starts. The helper log records how long each step took.

Usage

  • Restarting the desktop application is the primary use case: the helper closes the application through its own close path, waits for the Host port to be released, then starts the application executable again with a normal window.
  • Restarting dsh web from a terminal replays the original command line and working directory. The terminal that started it can be left alone.
  • Turning the feature off before a demo: Settings → Plugins → Restart Button → off.

API Reference

Two routes, both under /__local-restart. They are internal to the page and are not a public API.

MethodPathResponse
GET/__local-restart/ping200 {"ok":true,"port":51885} while the instance is alive
POST/__local-restart/restart202 with {ok, port, helperPid, log} when the restart was scheduled
POST/__local-restart/restart401 when the caller has no session credential; 405 for a non-POST method
anyother paths under the prefix404

POST is checked by connection.requestRejection, the same Host/Origin and session fence every other route in Harness uses. The reply is sent before the process exits, which is why the page treats a hung fetch as success and then polls /ping.

Examples

Check that the Host half is alive without clicking anything:

curl http://127.0.0.1:51885/__local-restart/ping
# {"ok":true,"port":51885}

A restart without a browser session is refused (expected, not a bug):

curl -i -X POST http://127.0.0.1:51885/__local-restart/restart
# HTTP/1.1 401 Unauthorized

Switch the row off from the profile's patch file, then relaunch:

# ~/.dsh/profiles/desktop/cordis.patch.yml
- id: dsh-restart-button
  config:
    enabled: false

Testing

The suite uses only node: builtins, so no install step is needed:

node --test                 # 12 structure/contract/helper-behaviour tests
node scripts/verify-package.mjs   # packaging gate (also runs in prepack)
node --check index.js client.js restart-helper.mjs restart-utils.mjs

scripts/verify-package.mjs is the gate npm pack / pnpm pack runs: it fails on a missing published file, a patch that names another package, an incomplete locale catalog, or credential/home-path material in a shipped file.

The tests do not start Harness. What was verified against a running instance, and what was not, is recorded in docs/verification.md.

Releasing

  1. Bump version, update CHANGELOG, run the checks in Testing, then npm pack.
  2. Create a GitHub Release and upload the tarball as dsh-restart-button-<version>.tgz (the source zip and SHA256SUMS.txt are optional extras).
  3. The Stable release asset workflow copies that tarball to dsh-restart-button.tgz, which is the URL the plugin catalogue installs from, so releases/latest/download/dsh-restart-button.tgz always serves the newest release.

Troubleshooting

The button does not appear. Confirm the bundle is installed (dsh plugin --profile desktop list), that the row is not disabled on the Plugins page, and that the sidebar is in its expanded state; the button is placed in sidebar.footer.action.

The click works but Harness does not come back. Every step is appended to %TEMP%\dsh-restart-<timestamp>.log ($TMPDIR on macOS/Linux). The log says which step stopped: closing the application, waiting for the port, or starting the replacement.

The replacement exits with EADDRINUSE. Another Harness instance still holds the port. Quit the old instance, then click again.

The page stays on Restarting. The replacement did not answer within the 3-minute window; the label turns into Restart failed. Start Harness manually and read the helper log.

On Linux under Wayland the window may take longer to reappear. The helper starts the executable detached and does not wait for a window; the page reload is the signal that the backend is up.

Roadmap

  • Optional confirmation step (config flag), for users who click by accident.
  • A keyboard shortcut for the same action.
  • Cover the plain dsh tui launch mode explicitly.

These are planned, not implemented. Nothing above is available in 1.0.x.

Contributing

Issues and pull requests are welcome. Read CONTRIBUTING.md first: it lists the checks a change must pass and the one rule this plugin never breaks (the endpoint stays behind the connection fence).

Security

The endpoint is restricted to the page that owns this application, and the helper only replays a local invocation. The trust model, the log-file contents and the reporting process are in SECURITY.md.

License

MIT © 2026 Lightfrom.

Acknowledgements

Built as a plugin for DeepSeek Harness. The sidebar layout, theme tokens and slot API come from the Harness client.

Plugins associés