Adds a restart button to the macOS DSH desktop sidebar that fully quits and reopens the app; on other platforms the button hides itself.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:Arc-huangjingtong/dsh-restart
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
简体中文 | English
A one-click restart button for the DeepSeek Harness desktop app.
A small pill sits in the sidebar header, immediately left of the sidebar-collapse button. Click it, confirm, and the app fully quits and reopens by itself — no more ⌘Q plus reopening from the Dock.

Features
- One click, one restart: confirm dialog → the app quits → it comes back automatically (about 4–6 seconds).
- Truly relaunched: waits for every DSH process (main, host, GPU/renderer helpers) to exit before opening, so the new instance cannot collide with a stale single-instance lock.
- Correct environment:
open(1)forwards the caller's environment. The DSH host runs the Electron binary withELECTRON_RUN_AS_NODE=1, so the helper strips Electron/Node runtime variables before relaunching. Without that, the "app" starts in Node mode: the Dock bounces, no window appears, and the process exits. - Verified startup: after
open, the helper checks that the new main process appears and survives a short stability window, activates the window, and retries up to three times. - Logs: every attempt is appended to
~/.dsh/restart.log. - Loopback only: the restart endpoint rejects cross-origin requests.
- macOS only: on other hosts the button hides itself and the API returns 501.
Requirements
- macOS (uses
osascript,open, and process inspection throughps). - DeepSeek Harness desktop app. Tested against DSH
0.2.1-rc.5.
Install
The repository is a standard DSH bundle (dsh.bundle + dsh.client).
Option 1: Plugins page (recommended)
- Open DSH → Settings → Plugins → Add plugin.
- Choose this repository directory (the folder containing
package.json). - Fully quit and reopen DSH once. The plugin cannot load itself before it has been loaded.
Option 2: CLI
dsh plugin --profile desktop add /absolute/path/to/this/repo
Then fully quit DSH and reopen it.
The plugin is installed into the
desktopprofile as alink:dependency. Keep this directory in place; moving or deleting it will make DSH skip the plugin on the next boot.
Usage
After the first restart, a 72×28 pill with a refresh glyph and the label Restart appears in the sidebar header, left of the collapse button.
- Click Restart.
- Confirm in the dialog — running sessions and tasks will be interrupted.
- The window disappears and returns by itself in about 4–6 seconds.
The pill re-measures its position when the sidebar is resized, the window is resized, the sidebar collapses, or fullscreen changes. If there is no room to its left (fullscreen puts the collapse button on the left), it moves to the button's right.
How it works
Host half — index.js
Registers two same-origin routes through ctx.connection.fetch:
| Route | Purpose |
|---|---|
GET /api/dsh-restart/status |
{ canRestart, platform }; the client hides the pill when canRestart is false |
POST /api/dsh-restart/restart |
Rejects cross-origin callers, then spawns the helper with detached: true and unref() |
Helper — scripts/restart-dsh.sh
- Asks the app to quit with AppleScript.
- Waits until all app processes disappear (up to 10 s), then falls back to
TERM, thenKILL. - Waits 1.5 s for LaunchServices and the old instance to unwind.
- Relaunches with
ELECTRON_RUN_AS_NODE,NODE_OPTIONS, and the other Electron/Node variables unset. - Verifies the new main process appears, activates the window, and checks it survives 1.5 s.
- Retries up to three times, waiting 2 s between attempts.
Client half — client.js
Registers a fixed-position button into shell.overlay. It finds the sidebar header row via its data-window-drag marker, measures the collapse toggle, and aligns the pill to its left. It also owns the confirmation dialog, busy state, error handling, and Chinese/English copy.
Configuration
The helper reads these environment variables:
| Variable | Default | Meaning |
|---|---|---|
DSH_RESTART_SETTLE_SECONDS |
1.5 |
Wait after every app process exits, before open |
DSH_RESTART_STABILITY_SECONDS |
1.5 |
How long the new main process must stay alive |
DSH_RESTART_RETRY_DELAY_SECONDS |
2 |
Wait between launch attempts |
To make restarts faster, lower the first two to 1. To make them more forgiving on a slow machine, raise them.
Troubleshooting
No pill after installing: the plugin loads only when the host starts. Fully quit and reopen DSH; a page refresh is not enough.
Restart does nothing: check
~/.dsh/restart.log. Each attempt records the main PIDs,ELECTRON_RUN_AS_NODE,open attempt …, and eitherrelaunched (pids: …)or an error.Dry run (prints the detected PIDs without quitting):
DRY_RUN=1 bash scripts/restart-dsh.shpgrep -fcaveat: on macOS,pgrep -fcannot see this Electron main process, so the helper identifies processes throughps -axo pid=,comm=instead. Do not replace it withpgrep.Run directly from a terminal (same effect as the button):
bash scripts/restart-dsh.sh
Development
npm run check # syntax-check index.js, client.js and the helper
npm run dry-run # helper dry run
Limitations
- macOS only.
- Restarting interrupts running sessions and tasks.
- The plugin lives in the
desktopprofile; a different DSH profile needs its own install. - The button relies on the sidebar's
data-window-dragheader row. A future DSH layout change may require adjusting the selector.
License
MIT
Links
More in this category
zhu1090093659/dsh-web#packages/dsh-task-board★ 10172
Task board for the dsh web GUI: a sidebar multi-column kanban whose cards run in real DSH agent sessions and can also be scheduled with cron expressions, executed host-side even with the browser closed.
zhu1090093659/dsh-web#packages/dsh-web-all★ 10172
Plugin and skin collection for the DSH Web UI: task board, Git graph, right-side panel, remote mobile UI, pet, live token stats, and a skin center.
ccch1mneyyy/dsh-TUI★ 7101
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 6959
A fixed-corner whale widget for the DSH web GUI — balance, today's usage and per-turn cost with peak/off-peak pricing, editable balance-alert and daily-budget bubbles, a module-based custom bubble queue with A/B weighted choices and random lines or images, 30+ vendor templates (OpenAI, OpenRouter, Kimi, SiliconFlow, Ark, Zhipu, MiniMax and more) with per-model balance and subscription quota, plus task-end sound, imported audio, custom roles and a resource manager. Local-only, no telemetry.
omdsh-dev/DSH-better-sidebar★ 4959
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
Devin-AXIS/deepseek-design#deepseek-idesign★ 1744
Visual design studio for websites, app prototypes, posters, cards, reports, and magazines, with templates, direct element editing, selection-aware AI draft handoff, and export.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.