Saltar al contenido principal
R

dsh-app-restart

rayzan-j/dsh-app-restart

Adds a restart button to the Session header, so a plugin change no longer needs the tray menu in the bottom-right corner of the screen. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.

Instalar

dsh plugin --profile web add github:rayzan-j/dsh-app-restart

README

dsh-app-restart

Restart the DeepSeek Harness desktop app from a button in the Session header.

中文说明

The shell's only restart entry is the tray menu in the bottom-right corner of the screen. While you are iterating on a Host-side plugin you pay that trip over and over. This bundle puts the same action in the window: one 28px icon next to the header's other utilities.

PressWhat happens
First clickthe button turns red and reads 再点一次重启 / Press again to restart for four seconds
Second clickthe page shows 正在重启…, then the app closes and reopens
Ctrl+Alt+Shift+Rarms the button exactly like a click, so a stray chord restarts nothing

A restart ends the page, so the press is deliberately two steps; there is no way to restart by accident.

Install

In DSH, open Plugins → Add plugin and enter one of:

  • dsh-app-restart — from npm
  • RayZan-J/dsh-app-restart — straight from this repository
  • an absolute path to a clone of this repository

Enable the bundle, then reload the page once so the button loads.

How it works

A plugin runs inside the shell's Node host, which has no app.relaunch(): the only message the parent channel accepts from it is a shutdown request. So the bundle reproduces the tray item from the outside.

  1. The page POSTs to /app-restart/restart with an x-app-restart header. The desktop window sends no Origin at all: the shell serves it from dsh-app://app and deletes that header before forwarding the call to this listener.
  2. The Host writes a PowerShell helper to $DSH_HOME/app-restart/ — restart.ps1 plus a restart.json naming the request — and starts it through cmd /c start, which gives it a console and a parent chain of its own. The helper has to outlive the process that spawns it.
  3. The helper waits, asks the app to close, stops whatever is left of the same executable, and starts it again.
  4. Every step is appended to $DSH_HOME/app-restart/restart.log.

Limits

  • Desktop app only. A page served by dsh web has no shell to relaunch; the button reports not-the-desktop-app and does nothing.

  • A restart ends the page and any turn that is running. Session logs, queued messages and drafts are on disk and come back.

  • The close request usually falls through to a hard stop: a shell that only hides its window never leaves the process table. Session events are committed one at a time, so a restart does not roll back what was already written.

  • A page opened from a reverse-proxy hostname is refused (cross-origin-restart); only the Host's own origin, or the app window's origin-less call, may restart it.

  • If the app does not come back, start it by hand — the log names the step that failed. The helper can also be run manually, using the request restart.json describes:

    powershell -NoProfile -ExecutionPolicy Bypass -File "$env:DSH_HOME\app-restart\restart.ps1"
    

Licence

MIT

Plugins relacionados