edusrez/dsh-smart-restart1

dsh-smart-restart

DSH host plugin that detects when the DeepSeek Harness service has restarted and wakes the main agent at boot with a notice, so interrupted work can be resumed.

包名
dsh-smart-restart
版本
0.3.0
许可证
MIT
最近更新
2026年8月18日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:edusrez/dsh-smart-restart

Configuration

All behavior is controlled through the plugin row's config:

KeyTypeDefaultDescription
enabledbooleantrueMaster switch; false skips all processing.
stateDirstring.smart-restartSub-directory under `` where marker.json, pending-notice.json and shutdown-notice.json are written.
targetstringprimaryWhich agent(s) to notify when there is no pending/shutdown notice: primary | all | ``.
wakeupbooleantruetrueagent.followup() wakes the agent and delivers; falseagent.inject() queues model-facing context only (no wake).
noticestring''Optional custom notice text; returned verbatim when non-empty, else the default.
restartUnitstring''Systemd unit to restart when smart_restart is invoked (e.g. dsh.service or dsh-deepartments-dev.service). Must be set per profile; empty → the tool fails safe with a clear error.
toolEnabledbooleantrueWhether the smart_restart tool is registered (available to agent sessions).
shutdownGraceMsnumber600000Grace window (ms, default 10 minutes) before shutdown within which last agent activity counts as "agent-involved" for the smart shutdown auto-notification. If the last-active session was idle beyond this window on shutdown, the pin is skipped and delivery falls back to target.

target semantics (fallback path only — a pending notice or a usable shutdown notice overrides target for that boot):

  • primary — the first root agent to start (the main agent). Delivery is guarded so exactly one primary is notified.
  • all — every root agent.
  • `` — an exact session id, pinned to one specific agent.

Full example patch row, restating every key with a custom notice and an explicit restartUnit:

- insert:
    - id: smart-restart
      name: dsh-smart-restart
      config:
        enabled: true
        stateDir: .smart-restart
        target: primary
        wakeup: true
        notice: "The DSH service restarted. Please check for interrupted work and report your status in one line."
        restartUnit: dsh.service
        toolEnabled: true
        shutdownGraceMs: 600000

Single delivery channel. When wakeup is enabled the notice is delivered via agent.followup(); when disabled, via agent.inject(). It is never both with the same message — a followup that queues into the inbox and a parallel inject of the same message would collide with Inbox's "already pending" validation.