dsh-restart: Orchestrate Multi-Session, Pausable Delayed Restarts for DSH

Introduction

In DeepSeek Harness (DSH), installing plugins, changing profiles, or letting long tasks run often requires “restarting later”—but you cannot hard-kill the process, otherwise the session breaks, and dependency alignment might mess up non-official bundle states. Manually tracking time or piecing together cron jobs is inconsistent with DSH’s plugin model. Below is an introduction to dsh-restart-plugin released by maintainer INFIcer (repo INFIcer/dsh-restart), which uses the official plugin API and Node.js built-in modules to handle restart scheduling with zero external dependencies.

What is it

dsh-restart is a restart scheduling plugin for DSH: multiple sessions can each schedule a “restart in N seconds,” and the countdown only begins when all sessions are idle; mouse, keyboard, and scroll input pauses the countdown during this period; when the time comes, the plugin handles the restart process and sends a brief wake-up message to the scheduled sessions once the new instance is ready. Current version 0.1.0, license MIT, supports Windows and DSH Desktop only (engines.node requires >=20).

Core Features

Capability Description
Schedule Restart Tell the AI “restart in 30 seconds,” etc., handled by dsh_restart (action: "schedule")
Multi-session Queuing Independent tasks per session, no overlap
Start on Idle Phase is “waiting” if sessions are still running; UI shows “Paused · Waiting for sessions to be idle”
Input Pause Mouse move, key press, click, and wheel scroll all pause the countdown; resumes after ~1 second
Panel Management Hover tooltip expands to show status; modal can cancel tasks, and the session gets feedback
Immediate Restart “Immediate Restart” on the countdown card requires double-click (resets if not clicked again within 3 seconds); disabled if sessions are running
Wake-up After Restart Once the new instance is ready, only notify the scheduled sessions “Restart Completed”; wakeText is not repeated
Auto-start on Boot Check in sidebar “Plugins” -> “Restart”; current Windows user only, no admin required
Plugin Settings Protection Snapshot package.json / cordis.patch.yml of the profile before restart, write back after the old process exits, verify in the new instance
System Prompt Inject dsh-restart-guidance: restarts should use dsh_restart, do not kill the process manually

wakeText is only used to display the restart intent on the countdown card and will not be sent back as the wake-up body text.

Installation and Activation

The installation method in the documentation is linking a local directory, not dsh plugin add github:owner/repo. You need to place the repository directory on your machine first, then modify the desktop profile.

  1. Place the plugin directory in any path, e.g., E:\dsh-restart-plugin.
  2. Edit C:\Users\<your username>\.dsh\profiles\desktop\package.json: Add "dsh-restart-plugin": "link:E:/dsh-restart-plugin" to dependencies, and add "dsh-restart-plugin" to the dsh.profile.bundles array.
  3. Restart DSH once for the configuration to take effect.

There is no node_modules in the directory, and no extra dependencies need to be installed.

Typical Usage

Scheduling: Simply use semantic descriptions for the delay, e.g., “Restart in 20 seconds.” After the task is scheduled, a tooltip appears in the bottom-left corner; the countdown card only pops up when all sessions are idle and the countdown truly begins, avoiding blocking ongoing turns. To express intent on the card, pass it via wakeText.

Check Status: Ask the AI “What is the status of the restart task,” or click the bottom-left tooltip to expand the panel. After closing the modal, the bottom-left corner still shows the task with the shortest remaining time.

Cancel: Click “Cancel” on the task in the panel; the task is deleted immediately, and the session that scheduled it receives a cancellation notice.

Pause Behavior: When there is input or busy sessions, the interface uniformly says “Paused,” with the reason marked as “Input detected” or “Waiting for sessions to be idle.”

Immediate Restart: Operate in the bottom-right corner of the card; only available when all sessions are idle.

Auto-start on Boot: Check or uncheck “Auto-start on boot” in the plugin settings page; after DSH upgrades or the directory changes, the plugin will correct the startup items based on the current program location.

The return value of tool dsh_restart only shows the result and does not echo back input parameters. Scheduling example:

{
  "ok": true,
  "action": "schedule",
  "taskId": "restart-3f9c2a1b",
  "phase": "waiting",
  "busyCount": 1,
  "remainingSeconds": 30,
  "createdAt": "2026-11-13T13:00:00.000Z",
  "hint": "Use status to check progress, cancel to stop."
}

See the “Tool Return Values” section of the repository README for return fields of actions like checking status or canceling.

Plugin Settings Protection (Restart Chain)

When DSH’s command line dsh plugin aligns dependencies, it might appear as “non-official plugins are all enabled again after a restart.” This plugin adds snapshotting and restoring to self-triggered restarts:

  1. Before hard-killing the old process, snapshot the parsable package.json and cordis.patch.yml under the profile to <DSH home directory>/plugin-snapshots/<timestamp>/, keeping the most recent 5.
  2. Before all old processes exit and the new instance is launched, write the snapshots back atomically; keep .bak-restart-<timestamp> for current files before overwriting, keeping the most recent 3 per file.
  3. After the new instance port is ready, perform a byte-by-byte comparison; if inconsistent, write back and log a warning, with the result written to pluginStateRestored in the restart status.

Snapshotting or restoration failures are only logged and do not block the restart itself.

Restart Readiness Determination (Windows)

The plugin launches the Electron entry process via WMI, while the child process actually listens to the Web GUI. The readiness determination order is: confirm old PIDs have all disappeared → collect process tree from entry PID (depth and nodes have limits) → perform 127.0.0.1 TCP probe on Listen ports in the tree → outer loop max 45 times, interval 2 seconds each time. ready=true is recorded only if the port is connectable; otherwise it is restarted-unconfirmed, and success is not faked.

Applicable Scenarios and Notes

Suitable for scenarios requiring safe, collaborative delayed restarts on Windows Desktop DSH: multiple windows working simultaneously, waiting for tasks to finish before installing plugins, uniform restarts after profile changes, etc.

Please note before use:

  • The plugin runs with the current DSH process permissions; you should review the GitHub source code and MIT license yourself before installing.
  • Windows only; no watchdog is provided; if DSH fails to start after a restart, it must be opened manually.
  • Restarting will close all DSH windows and running tasks; please handle unsaved conversations first.
  • Session idle judgment: if a session is not idle for more than 30 minutes, it will be treated as idle, which may lead to misjudgment.
  • Input pause only counts operations within the DSH window; the countdown continues when focus is on another application.
  • Wake-up depends on the host’s storages/schedule.json format; if the format is incorrect, it is only logged and the wake-up is aborted, but the restart will still execute.

The community plugin directory SkillHub: INFIcer/dsh-restart exists alongside the GitHub repository, with no official affiliation to DeepSeek / Hypothesis. The DSH ecosystem philosophy is “Everything is a plugin”; this plugin is a dedicated component for restart scheduling within it.

Conclusion

Following the steps above, you can schedule restarts in natural language in multi-session scenarios, utilize idle waiting and input pauses to reduce the risk of accidental termination, and automatically receive completion notifications after restart. Details and known defects are subject to the repository README.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye