DeepSeek Harness plugin

dsh-autoresume

Auto-continue an interrupted dsh session after a web restart by injecting a "continue" follow-up; one-shot per process, no duplicate-injection loops.

Jump to install

Source facts

Repository
shengyvself/dsh-autoresume
Latest update
Aug 18, 2026
Category
Workflow & Automation
GitHub stars
0

Install

Start with a prompt that asks an agent to read the source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to read the page and repository first.

Do not install anything yet. Read this DeepSeek Harness plugin and explain what it does, which files, networks, or credentials it can access, and how to install and remove it.

Plugin page: https://deepseekplugins.org/plugins/shengyvself/dsh-autoresume
GitHub: https://github.com/shengyvself/dsh-autoresume
Plugin: dsh-autoresume
Author: shengyvself
Install command: dsh plugin --profile web add github:shengyvself/dsh-autoresume

Do not run the install command until I confirm.

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer3 files
README.mdSource · read only

dsh-autoresume — dsh 会话重启自动续跑插件

web 进程重启后,若目标会话停在"被打断的中间态"(open turn / 无结果的 tool call / turn/end interrupted), 自动向该会话注入一条「继续」,让 agent 接着干活——无需人工干预。

特性

  • 只服务一个配置的 targetSessionId,绝不扫描其他会话
  • 通过 ctx.sessionPersistence.inspect() 读取会话持久化事件流做状态判定
  • 判定逻辑:

- interrupted(注入「继续」):turn/step 打开未闭合、存在无对应 tool/resulttool/call、最后一个 turn/end 原因为 interrupted - completed(不动作):最后是 assistant/message,或 turn/endcompleted 且其后无新用户消息 - settled(不动作):cancelled / error 等已闭合终态;以及闭合轮次后出现的手动用户消息

  • 注入方式:ctx.agents.get(target)agent.followup(userMessage)(消息 source.kind=plugin, form=notice
  • 进程级一次性:每个 web 进程只判定/注入一次;bootGraceMs 宽限窗口内有效(profile HMR 装卸插件不误触发)
  • 目标会话未就绪时按 pollIntervalMs 重查

安装

# 1. 构建
npm run build

# 2. 注册到 web profile
dsh plugin --profile web add /path/to/dsh-autoresume

# 3. 配置目标会话(编辑 web profile 的 cordis.patch.yml)
- insert:
    - id: dsh-autoresume
      name: 'dsh-autoresume'
      config:
        targetSessionId: '<your-session-id>'   # 必填

# 4. 验证注册
dsh --profile web --dump-config   # 应出现 id: dsh-autoresume

# 5. 重启生效
sudo systemctl restart dsh-web

配置项

默认说明
targetSessionId(必填)要自动续跑的目标会话 ID;未配置则插件不动作
bootGraceMs120000web 进程启动后允许判定的宽限窗口(毫秒)
initialDelayMs3000首次检查延迟(等会话恢复)
pollIntervalMs5000会话未就绪时的重查间隔
promptText继续(自动)注入的续跑提示词

工作原理

web 重启 → 插件加载 → 宽限窗口内 inspect(目标会话)
  ├─ interrupted → agent.followup('继续(自动)') → 自动接续
  ├─ completed / settled → 不动作(避免重复注入)
  └─ 会话未就绪 → 5s 后重查

架构

src/
├── service.js    # 服务端:状态机判定 + 注入(构建到 lib/)
└── client.js     # 客户端占位(构建到 lib/)
scripts/
├── build.mjs     # 构建:src → lib
└── self-test.mjs # 状态机单测(9 用例)

开发

npm run build   # src → lib
npm test        # 状态机自测

故障排查

现象原因处理
插件不动作targetSessionId 未配置检查 cordis.patch.yml 配置项
注入后 agent 不接续会话处于 running 而非 idle插件只在 idle 时注入,等其空闲
重启后无「继续」超过 bootGraceMs 窗口增大窗口或确认在启动后 2 分钟内判定
HMR 装卸后误触发——已防:判定仅在新进程启动宽限内进行

卸载

dsh plugin --profile web remove dsh-autoresume

License

Apache-2.0