Adds pause, resume, and cancel capabilities to DSH Web dialogue tasks, supporting two pause granularity levels (safe and forced), with resume continuing from the pause point without redoing completed work.
- Language
- JavaScript
- License
- MIT
- Branch
- main
Install
$ dsh plugin --profile web add dsh-task-controlRun the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial
Install via your agent
Install the DeepSeek Harness plugin p2coder/dsh-task-control for me: review the repository at https://github.com/p2coder/dsh-task-control first, then run the install command and verify the plugin loads successfully.
Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.
One-Line Description
Adds pause, resume, and cancel control capabilities for conversation tasks in DSH Web. When AI is executing a long task, you can pause it midway (preserving all execution progress), resume later from the pause point, or immediately cancel the current turn.
Core Features
- Pause task: Supports safe pause (waits for inference/tool to complete naturally before landing) and forced pause (immediately interrupts in-flight tools and model outputs)
- Resume task: Continues from the pause point without redoing already completed work
- Cancel task: Immediately terminates the current turn and prompts about the interrupted tool's intended purpose and potential side effects
- Pause granularity settings: Configure default pause mode and inference granularity for safe pause (wait/stop) in Web settings page; takes effect immediately after saving
- State persistence: Each session's pause state is written to a local file, surviving dsh web restarts
- Available for other plugins: Provides programmatic interface via
taskControlservice by session ID - Three entry points: Permanent buttons next to the input box, slash commands (
/pause/resume/cancel), and service calls from other plugins
Technical Implementation
- Language: TypeScript / JavaScript (compiled output)
- Key dependencies:
@deepseek-ai/cordis,@deepseek-ai/dsh-llm,@deepseek-ai/dsh-client-ui-primitives,react - Architecture pattern: Host/Client dual-sided plugin. Host side registers slash commands, session event listeners,
taskControlservice, and two HTTP routes via cordisbundle.patch; Client side injects runtime/locale/ui-settings/conversation services provided by the host viapackage.json#dsh.client.inject, renders buttons in composer toolbar and granularity config panel in settings page - Entry files:
lib/index.js(host) +lib/client.js(browser) +cordis.patch.yml
Use Cases
Suitable for scenarios requiring management of long-running tasks in DSH Web: when AI is running a large migration, batch testing, or multi-step tool calls, you may want to pause to switch context, or immediately cancel a task that has gone off track. After installation, no complex configuration is needed—three permanent buttons appear next to the input box, and slash commands are also directly callable.
Prerequisites & Compatibility
| Dependency | Minimum Version | Description |
|---|---|---|
| DSH Web | >= 0.1.0-rc.6 | Inferred from multiple @deepseek-ai/dsh-* packages in peerDependencies |
| React | ^18.2.0 | Client-side rendering dependency |
| @deepseek-ai/cordis | ^4.0.1 | Host-side framework |
| Node | Not declared | package.json does not declare engines field |
| Platform | Cross-platform | Uses only Node built-in fs / path modules |
Installation
dsh plugin --profile web add github:p2coder/dsh-task-control
After installation, please fully restart dsh web and refresh the browser.
Configuration Options
| Config | Type | Description | Default Value |
|---|---|---|---|
| Default pause mode | Enum: safe / force | /pause without explicit mode and pause button in input box both execute in this mode; safe waits for inference/tool to complete before landing, force immediately interrupts | safe |
| Inference granularity for safe pause | Enum: wait / stop | Effective when default mode is safe; wait pauses after current inference completes, stop immediately terminates current model output | wait |
| Task control state archive directory | Path | Each session's pause snapshot is written to this directory using atomic tmp+rename; can be overridden via environment variable DSH_TASK_CONTROL_STATE_DIR | ~/.dsh/task-control |
Configuration entry is in Web settings page "Settings → Task Control", or can be directly modified via /task-control/settings JSON interface.
FAQ
Q: Do I need to restart after installation?
A: Yes. As described in README and patch, you must fully restart dsh web and refresh the browser for cordis bundle patch and client-side injection to take effect; refreshing only the page will load the old UI.
Q: What's the difference between pause and the official "stop" button?
A: The official "stop" button directly terminates the current turn with state lost; this plugin's "pause" preserves all execution progress and writes to local archive. When resuming, it continues from the pause point without redoing completed work.
Q: Will forced pause break tools being executed?
A: Yes. Any in-flight tools will be immediately interrupted, potentially causing partial side effects. When resuming, the plugin will show a selection menu letting you decide whether to re-execute, skip, or keep paused.
Q: Where is pause state saved? Will it be lost after restart?
A: Saved in ~/.dsh/task-control/ under user directory, one JSON file per session, using atomic tmp+rename write. It will not be lost after dsh web restarts. During testing, you can change the path via environment variable DSH_TASK_CONTROL_STATE_DIR.
Q: Can other plugins call task control?
A: Yes. Host side registers taskControl service. Other plugins can obtain it via ctx.get("taskControl") and call pause / resume / cancel / state four methods by session ID.
Q: Will timed reminders trigger during pause?
A: Yes. When dsh-schedule is due, it will still wake up the current session. Pause only controls the current turn and does not intercept timed events.
Q: Will sub-agents be paused together?
A: No. Already dispatched sub-agents run independently and will not pause with the parent task.
Q: What needs to be done after modifying plugin code?
A: Need to reload the plugin and restart dsh web. Client polls status every 2 seconds; without restart, the browser will still get the old version.
Difficulty Level
Beginner — only one installation command required, no mandatory configuration; buttons next to input box and slash commands work out of the box; advanced users can then tune pause granularity.
Known Issues & Limitations
- Forced pause immediately interrupts in-flight tools; tool side effect state is unknown. When resuming, user must manually choose to re-execute or skip (lib/index.js:303-310, 545-572)
- Pause state is stored as independent JSON files locally rather than in session log: source code explicitly states harness's persistence reader only accepts known event types, writing
task-control/*events to session would cause failure to load after session restart, therefore external storage is used (lib/index.js:42-50) - Pause only controls the current turn; sending new messages during pause starts a new turn (README.md:81)
- In
safe waitmode, pause occurs after inference completes but before tool dispatch, recordingdeferredTools. When resuming, user must confirm whether to re-execute or skip (lib/index.js:484-526, 640-641) - Dispatched sub-agents are not paused by parent task; behavior is independent (README.md:83)
- Browser polls
/task-control/stateevery 2 seconds; state sync has up to 2 seconds delay (lib/client.js:195-198) - Plugin hot-unload must deregister
/task-controlroute viactx.effect, otherwise webserver throws "duplicate prefix route" (lib/index.js:828-834)
English | 中文
为 DSH Web 增加任务暂停、恢复和取消能力。支持安全暂停与强制暂停,恢复时从暂停点继续,不重复已完成的工作。
安装
dsh plugin --profile web add github:p2coder/dsh-task-control
安装后请完整重启 dsh web,然后刷新浏览器页面。
快速使用
任务运行时,输入框旁会显示三个常驻按钮:
| 按钮 | 作用 | 可用状态 |
|---|---|---|
| ⏸ 暂停 | 按默认粒度暂停任务 | 运行中 |
| ▶ 恢复 | 从暂停点继续 | 已暂停 |
| ⏹ 取消 | 立即终止当前回合 | 运行中或已暂停 |
灰色按钮表示当前不可用,黑色按钮表示可点击。

暂停模式
| 模式 | 行为 | 适合场景 |
|---|---|---|
safe wait(默认) | 等待推理和工具自然完成后暂停 | 长任务、迁移、测试 |
safe stop | 工具完成后暂停;可中断当前推理 | 希望更快暂停 |
force | 立即中断推理及在途工具 | 紧急停止 |
在「设置 → 任务控制」中修改默认模式,保存后立即生效:

命令
| 命令 | 说明 |
|---|---|
/pause | 按设置中的默认模式暂停 |
/pause force | 强制暂停 |
/pause safe wait | 安全暂停,不中断推理 |
/pause safe stop | 安全暂停,可中断推理 |
/resume | 恢复任务 |
/resume confirm rerun | 重新执行被中断或未派发的工具后恢复 |
/resume confirm skip | 跳过该工具后恢复 |
/cancel | 取消当前回合 |

供其他插件调用
通过 ctx.get("taskControl") 获取服务:
| API | 作用 |
|---|---|
pause(sessionId, options?) | 暂停任务 |
resume(sessionId, options?) | 恢复任务 |
cancel(sessionId) | 取消任务 |
state(sessionId) | 查询 idle、running 或 offline 状态及暂停信息 |
暂停状态保存在 ~/.dsh/task-control/,重启后不会丢失。测试时可用 DSH_TASK_CONTROL_STATE_DIR 修改存储目录。
注意事项
| 情况 | 说明 |
|---|---|
| 强制暂停 | 工具可能已产生部分副作用;恢复前可选择重新执行、跳过或保持暂停 |
safe wait 的未派发工具 | 恢复时需要选择重新执行或跳过 |
| 暂停期间发送新消息 | 会开启新回合;暂停只控制当前回合 |
| 定时提醒 | dsh-schedule 到期后仍会唤醒 |
| 子代理 | 已派发的子代理不会被父任务暂停 |
| 状态同步 | 浏览器每 2 秒轮询一次,修改插件后需重启 dsh web |
测试
node test/host-smoke.mjs
Read the usage guide →
Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.
Listing badge
[](https://deepseek-plugin.org/plugins/p2coder/dsh-task-control)Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.