dsh-composer-pause
Codex 式的暂停 / 继续按钮 —— 装进 DeepSeek Harness(DSH)Web 的输入框:运行中点 ⏸ 中断当前这一轮执行,再点 ▶ 让会话继续跑下去。
为什么需要它
DSH 内置的「停止生成」只在输入框为空时接管主按钮(源码:dsh-client-ui-conversation 的 primaryStops = running && subagent === null && (empty || blocked !== undefined))。只要输入框里有草稿,主按钮就退回成禁用灰箭头——停不掉,也没有任何一键续跑入口。
本插件在输入框右侧常驻一个独立按钮,不受草稿内容影响。
暂停 / 继续 到底是什么语义
| 会话状态 | 按钮 | 点击后发生了什么 |
|---|---|---|
| 正在生成 | ⏸ | 先停掉目标的自动续行(若该会话有已武装的 goal),再 session.cancel() 中断当前轮 |
| 已中断 | ▶ | 恢复执行:走宿主的一等公民机制,而不是往对话里塞一条用户消息 |
| 空闲且未中断 | 不渲染 | — |
▶ 的恢复策略(按优先级):
- 会话有已停止的 goal(
phase: paused,或 active 但续行已停用)→ 调goals/resume,把续行交回dsh-goal-round-driver。 - 会话没有 goal → 调
goals/create,创建即armed,同样交给 round driver 起轮。 - 调用后验证:最多等 3.2 秒看会话是否真的跑起来(
snapshot.running)。如果 round driver 没有接着执行(例如 goal 处于blocked、或该版的 driver 没有在空闲状态下起轮),才回退发送一条「继续」提示词——回退是兜底,不是主路径。
实测(隔离实例,非日常环境):中断后点 ▶,会话直接进入生成、第二轮 goal round 开始执行,会话里出现的是**「进行中的目标」**而不是用户消息——也就是你描述的"对原会话发起一次 resume/continue 执行",而不是"系统替你发了一句 user: 继续"。
说实话的边界:DSH 目前没有"静默恢复某个被中断的 Turn"的宿主原语;插件能拿到的一等公民续行能力就是 goal + round driver。所以续跑会以一个目标的形式出现在界面上(goal round 由宿主发起,不是你发的消息)。要做到完全零痕迹,需要引擎侧新增原语,插件碰不到。
安装
方式一:DSH Desktop 插件市场 / 设置页(推荐,安装器同时写入依赖与 dsh.profile.bundles)
方式二:命令行(装完需确保包名出现在该 profile package.json 的 dsh.profile.bundles 里)
dsh plugin --profile web add github:Yagami0502/dsh-composer-pause
配置(浏览器 localStorage)
| 键 | 取值 | 默认 | 含义 |
|---|---|---|---|
dsh-composer-pause:resume-mode |
goal | message |
goal |
▶ 走 goal 恢复执行,还是回退成继续消息 |
dsh-composer-pause:continue-text |
任意文本 | 跟随界面语言 | 回退模式下发送的文案 |
dsh-composer-pause:paused |
{sessionId: true} |
— | 每个会话的中断标记,刷新后 ▶ 仍在 |
兼容性
- 需要带
conversation.input.right槽位的 DSH Web(dsh web/ DSH Desktop);goal 路线另需dsh-goal+dsh-goal-round-driver(dsh-base默认挂载)。 - 零构建零依赖:
lib/client.js以window.__ModuleLoader__.load({ id, factory })形式提供,宿主按exports["./client"]读字节拼进 combo;除宿主已外部化的react外不 require 任何模块。 - 不 patch 宿主任何文件,只注册官方槽位;卸载即完全移除。
English
A Codex-style pause / continue control for the DSH web composer. ⏸ pauses an armed goal (so the round driver cannot restart work) and then cancels the running turn; ▶ resumes execution through the harness' own goal machinery — goals/resume for a stopped goal, goals/create when the session has none — so the round driver carries on from the existing context instead of you typing "continue". A visible continue prompt remains as the documented fallback (resume-mode=message). Zero build step, zero runtime dependencies, no host files patched.
License
MIT
No comments yet. Be the first to write one.