dsh-tool-monitor
Manifest validMonitor existing DeepSeek Harness background jobs without running commands twice
让 DeepSeek Harness 在后台服务出错时立即收到事件。
订阅已经运行的 Bash 或 PowerShell Job;保留原始 job_output,不启动第二个业务进程。
快速开始 · 为什么需要它 · 工作方式 · 工具参数 · 兼容性与边界
快速开始
安装到 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 的内容 |
| 官方输出事件 | 订阅 DSH Job 输出环,不额外轮询或读取生产者 |
| Host 本地过滤与批处理 | 没有匹配事件时,不触发模型请求 |
| 独立 Monitor 生命周期 | 停止 Monitor 不会终止目标 Job |
工作方式
Bash / Pwsh background process
│
│ Job output source
▼
DSH bounded output ring
┌────────────┴────────────┐
▼ ▼
job_output monitor-N
consuming cursor independent readAt cursor
│
▼
followup() / inject()
插件直接使用当前 ctx.jobs 提供的 DSH 0.1.7-rc.2 公共输出事件和非消费式 readAt() 游标,不替换或限制 Registry 实现。所有权隔离、等待、取消、完成通知、容量限制和清理语义仍由当前 Registry 负责;原来的 job_list、job_output、job_kill 以及 Bash/Pwsh 工具保持不变。
完整设计和生命周期约束见 DESIGN.md。
工具参数
| 参数 | 必填 | 说明 |
|---|---|---|
job_id | 是 | 已有后台 Job 的 id,通常来自带 run_in_background: true 的 bash 或 pwsh |
description | 是 | 显示在 Monitor 通知中的简短说明 |
pattern | 否 | JavaScript 正则表达式,逐完整输出行匹配 |
case_sensitive | 否 | 是否区分大小写,默认 false |
timeout_ms | 否 | 订阅时限;默认持续到目标 Job 结束 |
Monitor 本身也是普通 Job:
job_list同时显示目标 Job 和 Monitor。job_output分别读取目标 Job 的原始输出和 Monitor 的匹配输出。job_kill monitor-1只停止订阅。- 目标 Job 结束时,关联 Monitor 自动结束并刷新最后一条不完整输出行。
兼容性与边界
- 兼容 DeepSeek Harness 0.1.7-rc.2。
- 支持 Bash 的 LF 与 PowerShell 的 CRLF 输出。
- 支持 DSH 输出环中的拉取源和生产者主动追加输出。
- 输出发生保留截断或生产者丢失时,Monitor 会丢弃边界后的首个不完整行段,并写入明确的丢失提示,避免拼接出虚假匹配。
- 所有权校验仍由 DSH Registry 执行,不能跨会话监听其他 Agent 的 Job。
- Job 和 Monitor 都是 Host 进程内状态,不跨 DSH Host 重启持久化。
Monitor 的匹配输出与其他 Job 共用当前 Registry 的保留策略。使用官方 LocalJobRegistry 时,在现有 jobs 条目上设置统一的 UTF-8 字节保留量:
- id: jobs
config:
retainBytes: 64000
该值同时适用于目标 Job 和 Monitor;插件不覆盖宿主的 Registry 或其配置。
本地开发
pnpm install
pnpm run build
pnpm test
dsh plugin --profile web add ./dsh-tool-monitor
测试覆盖 Bash、PowerShell、拉取与主动追加输出、保留截断与生产者丢失边界、原 job_* 工具兼容、输出游标隔离、所有权隔离、目标结束与独立取消。
License
Comments
Loading…
From the same category
by awesome-dsh-plugin
A curated list of plugins for DeepSeek Harness (dsh) · DeepSeek Harness 插件精选列表
★ 18.3k
CC0-1.0
Python
Oct 10, 2026
by 0xsline
DeepSeek Harness (DSH) ecosystem: curated plugins, tools, and infrastructure from dsh-external/hub and the public dsh-plugin topic.
★ 1.2k
CC0-1.0
Python
Oct 10, 2026
by pax-beehive
Open-source CLI, schemas, resolver, and DSH agent tools for DSH Plugin Hub
★ 450
MIT
TypeScript
Oct 6, 2026
by xiajiajun516
DeepSeek Harness (DSH) backup & restore plugin — export, import, migrate and sync your complete DSH configuration, plugins, MCP servers, skills and workspace. One-click migration to another machine.
★ 176
MIT
TypeScript
Oct 8, 2026
dsh plugin --profile web add dsh-config-managerby yjh051108
推荐组件(非必须):DeepSeek Harness 运行时注入器;已随 dsh-routing-suite 单仓库化保留,本仓库继续维护/发布。
★ 164
TypeScript
Sep 18, 2026
dsh plugin --profile web add @dsh-external/dsh-super-injectorby jigjoy-ai
A CLI that turns a goal into a pull request - and a sandbox for testing concurrent AI coding agents on the Mozaik runtime.
★ 124
MIT
TypeScript
Oct 2, 2026