DeepSeek Harness plugin

dsh-tool-monitor

Subscribe to already-running background jobs via a lazy output tee: pattern-matched events from an existing bash or pwsh job, without re-running the command.

Jump to install

Source facts

Repository
yoke233/dsh-tool-monitor
Latest update
Aug 13, 2026
Category
Development & Runtime
GitHub stars
1
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and 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 review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/yoke233/dsh-tool-monitor
Plugin: dsh-tool-monitor
Author: yoke233

Check the source files

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

File explorer3 files
README.mdSource · read only

<p align="center"> <img src="./assets/readme/hero.svg" width="100%" alt="dsh-tool-monitor 通过惰性输出 tee 监听现有 DSH 后台 Job,而不重复执行原命令"> </p>

<p align="center"> <strong>让 DeepSeek Harness 在后台服务出错时立即收到事件。</strong><br> 订阅已经运行的 Bash 或 PowerShell Job;保留原始 <code>job_output</code>,不启动第二个业务进程。 </p>

<p align="center"> <a href="#快速开始">快速开始</a> · <a href="#为什么需要它">为什么需要它</a> · <a href="#工作方式">工作方式</a> · <a href="#工具参数">工具参数</a> · <a href="#兼容性与边界">兼容性与边界</a> </p>

快速开始

安装到 DSH profile:

dsh plugin --profile web add github:yoke233/dsh-tool-monitor

启动或重启 profile:

dsh --profile web

先正常启动后台服务:

pwsh(command: "npm run dev", run_in_background: true)
→ pwsh-1

再让 job_monitor 订阅这个 Job:

{
  "job_id": "pwsh-1",
  "description": "监听后端错误",
  "pattern": "error|fatal|exception"
}
→ monitor-1

monitor-1 只订阅 pwsh-1 的输出。出现匹配行时,插件向所属 Agent 投递会话事件;原服务始终只运行一份。

为什么需要它

DSH 的普通后台 Job 会在任务结束时通知 Agent,但长期运行的后端服务可能在退出前就已经出现需要处理的错误。这个插件补充运行中的事件通道:

行为结果
监听现有 job_id不重新执行服务命令
一次读取、多路分发Monitor 不会吃掉 job_output 的内容
惰性启用 tee没有 Monitor 的 Job 保持官方读取路径,不被轮询
Host 本地过滤与批处理没有匹配事件时,不触发模型请求
独立 Monitor 生命周期停止 Monitor 不会终止目标 Job

工作方式

Bash / Pwsh background process
              │
              │ readOutput() once
              ▼
       lazy bounded output tee
          ┌────────────┴────────────┐
          ▼                         ▼
     job_output                 monitor-N
   original output        filtered complete lines
                                  │
                                  ▼
                         followup() / inject()

插件使用兼容的 JobRegistry 实现扩展官方 LocalJobRegistry,继续复用 DSH 的所有权隔离、等待、取消、完成通知、容量限制和清理语义。原来的 job_listjob_outputjob_kill 以及 Bash/Pwsh 工具保持不变。

完整设计和生命周期约束见 [DESIGN.md](./DESIGN.md)。

工具参数

参数必填说明
job_id已有流式后台 Job 的 id,通常来自带 run_in_background: truebashpwsh
description显示在 Monitor 通知中的简短说明
patternJavaScript 正则表达式,逐完整输出行匹配
case_sensitive是否区分大小写,默认 false
timeout_ms订阅时限;默认持续到目标 Job 结束

Monitor 本身也是普通 Job:

  • job_list 同时显示目标 Job 和 Monitor。
  • job_output 分别读取目标 Job 的原始输出和 Monitor 的匹配输出。
  • job_kill monitor-1 只停止订阅。
  • 目标 Job 结束时,关联 Monitor 自动结束并刷新最后一条不完整输出行。

兼容性与边界

  • 支持 Bash 的 LF 与 PowerShell 的 CRLF 输出。
  • 只支持公开流式 readOutput() 的后台 Job;非流式 Job 会被明确拒绝。
  • 所有权校验仍由 DSH Registry 执行,不能跨会话监听其他 Agent 的 Job。
  • Job 和 Monitor 都是 Host 进程内状态,不跨 DSH Host 重启持久化。
  • 插件安装前由另一 Registry 创建的历史 Job 不可补挂监听。
  • 缓冲区按 UTF-8 字节设置上限;发生丢弃时,job_output 会显示明确提示。

本地开发

pnpm install
pnpm run build
pnpm test
dsh plugin --profile web add ./dsh-tool-monitor

测试覆盖 Bash、PowerShell、原 job_* 工具兼容、输出竞态、所有权隔离、目标结束与独立取消。

License

[MIT](./LICENSE)