dsh-power
 
English | 中文
A power button for the DeepSeek Harness Web GUI: shut down or restart DSH from the sidebar, right above Settings.
Features
- 🚫 Never closes the wrong browser window — the page closes itself via
window.close(); the host process never kills Chrome. - 🧭 Environment-adaptive — no hardcoded path or port. The restart command is rebuilt from the running process, and the reopen URL follows the actual listen port.
- 🌍 Cross-platform — Windows (windowless
wscripthelper), macOS (open), Linux (xdg-open). - ⚡ Zero configuration — works immediately after install.
Quick start
Requires a DeepSeek Harness web profile (@deepseek-ai/dsh >= 0.1.0-rc.6).
dsh plugin --profile web add "github:jcfung1122/dsh-power"Restart the running dsh web, hard-refresh the browser, and the power icon appears above Settings.
Remove:
dsh plugin --profile web remove dsh-powerUsage
Hover the power icon and pick:

- Shut down DSH — closes only this page and stops the service gracefully; other browser windows are unaffected.
- Restart Web UI — relaunches the service and reopens the page automatically.
Both ask for confirmation first.
Configuration
Usually no configuration is needed. To override, add it to cordis.patch.yml:
- id: power
config:
restartWaitMs: 7000 # how long to wait for the old process to release the port (ms)
restartCommand: "" # full restart command for supervisor-managed deployments
reopenUrl: "" # override the auto-detected reopen URL| Key | Default | Description |
|---|---|---|
restartWaitMs | 7000 | How long to wait for the old process to release the port before relaunching. |
restartCommand | (auto) | Full restart command; defaults to rebuilding it from the current process. |
reopenUrl | (auto) | Reopen URL; defaults to http://127.0.0.1:<port>. |
How it works
The host half registers two loopback-only POST routes: /api/power/shutdown and /api/power/restart. shutdown requests the launcher-provided appExit to exit gracefully; restart rebuilds the launch command from process.argv, reads the reopen URL from the web server port, then detaches a cross-platform helper (Windows uses a windowless VBS to escape the parent job; macOS/Linux use sh + open/xdg-open) and exits. After confirmation, the browser closes this page with window.close().
Privacy & security
- Both endpoints are exact routes outside the RPC trust boundary; each handler fences itself: POST-only and loopback peer only.
- No session, prompt, or model data is read.
Development
npm test # pure JS, no build step; the browser half is also materialized and tested in Node
npm pack --dry-runThe browser half has no build step: it is a hand-written __ModuleLoader__ bundle, and React arrives from the host as a peer.
License
[MIT](LICENSE)