dsh-self-restart
其他 活跃维护

dsh-self-restart

alchemistwu/dsh-self-restart

支持代理进程安全重启DSH桌面端主程序,规避子进程无法直接操作父进程的系统限制,内置多级安全校验避免异常中断,保障重启流程稳定可靠。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
TypeScript
主要语言
None
开源协议
10 KB
仓库大小
24 天前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:alchemistwu/dsh-self-restart
git clone https://github.com/alchemistwu/dsh-self-restart.git
git clone git@github.com:alchemistwu/dsh-self-restart.git
README.md main

dsh-self-restart

Let the agent restart DSH Desktop itself — safely.

Why

The agent's shell tool runs as a child of the Desktop main process. Any
watchdog it spawns with nohup/disown dies with the Desktop process tree
(those only survive SIGHUP). This plugin materializes a watchdog script and
a double-fork + setsid() launcher: the watchdog escapes into its own
session, gets reparented to launchd, then kills Desktop, relaunches it, and
polls a health URL — writing progress to a status file the next turn reads.

Verified end-to-end: kill → relaunch → healthy in ~3 seconds.

Usage

The agent calls the desktop_restart tool. The call never meaningfully
returns — the turn dies mid-stream. The plugin records which session asked;
after the watchdog reports HEALTHY, the next boot resumes that session and
wakes it with a followup message
, so the agent continues its post-restart
verification without a user poke. Status file for manual inspection:

cat /tmp/dsh-self-restart.status
# 2026-09-02T01:27:40Z killing
# 2026-09-02T01:27:41Z relaunching
# 2026-09-02T01:27:43Z HEALTHY after 3s

Config

- id: self-restart
  config:
    appPath: /Applications/DSH Desktop.app   # default
    healthUrl: http://127.0.0.1:43120/       # default
    statusFile: /tmp/dsh-self-restart.status # default

Test

npm test   # node --experimental-strip-types --test