moon16u/dsh-pouch

dsh-plugin-restart

安全的分离式 DSH 重启:/restart 与 /dsh-restart 斜杠命令(原生候选样式)加 dsh_restart Agent 工具;分离的 worker 在 3 秒后重启 DSH,会话不冻结。

‍ 开发与运行时cordisdeepseek-harnessdsh

@moon16u/dsh-plugin-restart

English | 中文

Safe, detached DSH process restart commands (/restart, /dsh-restart) and agent tool (dsh_restart) with native Web UI candidate styling.

Features

  • Zero Freeze: Schedules restart in a detached worker process with a 3-second grace period.
  • Slash Commands: Run /restart (or backwards-compatible /dsh-restart) in chat to trigger an immediate, smooth restart.
  • Native Web UI Candidate: Renders as 🔄 Restart restart with an icon, bilingual localized descriptions, and one-click/Enter execution (no hint prompt obstruction).
  • Agent Tool: Enables the AI Agent to self-heal and restart DSH when requested.
  • Failure Visibility: If a restart fails (new process dies or never becomes ready), dsh-restart.sh serves a self-contained error page on the port — failure reason, log tails, and a "restart DSH" button that releases the port and retries. The service always exits by itself, so it can never block a later manual start. The next successful start also surfaces a one-line "previous restart failed" notice in chat (restart-failed.json marker).

Installation

Install this plugin as its own DSH bundle:

dsh plugin --profile web add @moon16u/dsh-plugin-restart

Restart dsh web once after installing (bundle layers compose at startup). No manual cordis.patch.yml edits needed — the package carries its own patch.

Testing

npm test

The suite sets DSH_RESTART_DRY_RUN=1, which makes scheduling write the helper file but never spawn it, and points DSH_HOME at a temporary directory so the helper it writes can never overwrite a live instance's. Without the flag every handler invocation schedules a REAL detached restart of whatever DSH instance $DSH_HOME points at.

License

MIT