jiesou/dsh-stream-rules
模式匹配时自动注入规则,仅在需要时注入,不浪费上下文。类似oh-my-pi的“时间旅行流规则”,但代码实现极为简洁紧凑。
Project Overview项目介绍
dsh-stream-rules is a native DSH plugin that injects custom steering rules only when a matching tool call pattern is detected, so it doesn’t waste precious context window space on pre-loaded rules. It was ported from the opencode-stream-rules repository specifically for DSH, and offers two types of rule behavior. The default behavior injects a system steering notice and has the agent retry from the current point, while the reject mode blocks the first matching tool call but allows subsequent retries for flexible steering. Installation can be done via three different methods: prebuilt npm package, direct install from GitHub, or manual entry in your profile’s cordis.patch.yml.
After you install the plugin, it will not work out of the box because you need to add your own custom rules. First, you have to navigate to the plugin’s installation directory in your DSH profile, which by default lives under ~/.dsh/profiles/<your-profile-name>/node_modules/@jiesou/dsh-stream-rules. Then you can rename the example rules file from rules.js.example to rules.local.js, and edit it to add your own custom rules following the existing template. If you want to store your rules in a different directory, you can update the plugin config to point to your custom rules path.
This plugin requires DSH version between >=0.1.0-rc.6 and <0.2.0, and Node.js version ^22.19.0 or >=24.0.0, and works with both web and headless DSH profiles. Each rule is configured to fire at most once per agent session, to avoid duplicate notifications and redundant steering. The entire plugin is only around 60 lines of code in a single source file, and uses DSH’s official native extension points without any core patching. It is released under the open-source MIT license, so you can modify and redistribute it freely.
这是一款专为 DeepSeek Harness (DSH) 开发的原生插件,核心功能是在工具调用匹配自定义规则模式后,注入对应提示引导代理调整行为,不会提前占用对话上下文空间。它支持两种规则模式:默认注入引导提示让代理从当前点重试,或是拒绝首次违规工具调用,后续尝试则放行,在限制行为的同时保留操作灵活性。用户可通过 npm 预编译包、GitHub 源码或直接修改配置文件三种方式完成安装。
插件默认不会生效,安装完成后用户需要自行编写自定义规则文件。典型流程是先找到插件在 DSH 配置目录下的安装路径,复制示例规则文件并重命名为规则配置文件,再按照给定的 JS 格式编写自己的匹配规则与提示内容。如果你需要将规则存放在其他自定义目录,也可以通过插件配置项指定规则路径。这款插件适合想要规范 DSH 代理行为、避免不必要上下文浪费的开发者使用。
该插件要求 DSH 版本在 0.1.0-rc.6 到 0.2.0 之间,Node.js 版本需为 22.19.0 或更高,兼容 web 与 headless 两种配置文件。每条规则在每个会话中最多触发一次,避免重复提示。插件代码精简,仅约 60 行,使用 DSH 官方提供的扩展接口实现,无需修改核心代码,采用 MIT 许可开源免费使用。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-stream-rules(jiesou/dsh-stream-rules)
仓库:https://github.com/jiesou/dsh-stream-rules
本站详情页:https://www.yhbd.top/plugins/jiesou-dsh-stream-rules/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 4 · 最近提交 2026-10-03 · 主语言 TypeScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- Only 4 stars - very few users, little community feedback星标只有 4,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项
Compatibility兼容性
- DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
- External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
- Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册
Security安全性
- Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
- Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
- curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
- Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
- Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
- Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式
Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add @jiesou/dsh-stream-rules
把 jiesou/dsh-stream-rules 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-stream-rules
Inject rules when needed, without wasting context.
You can write custom streaming rules for the agent.
These rules are injected only as a steering notice after a pattern match, then agent retry from the same point. This allows you to control the boundaries of agent behavior, without wasting context.
Port of my jiesou/opencode-stream-rules to DSH. Similar to oh-my-pi's "Time-traveling stream rules", but with a very simple and compact code implementation.
How it works
A rule fires when its match returns true, against:
- the tool call — tool name + flattened arguments (numbers included, e.g.
timeoutMs), before dispatch. - the settled result — after dispatch, the tool's content, status markers (
[timed out after 600000ms],[exit code: 1], …) and error text join the match string, so rules describing outcomes (a crash, a full disk, a timeout) can match there too. Matching after dispatch can only steer, never deny.
On a match:
- default — injects a
SYSTEM NOTICEsteering message into the agent (pre-dispatch viaagent.inject(), post-dispatch asadditionalContextson the tool result — DSH's non-waking "queue model-facing context for the next pre-step"). The agent retries from the same point, now knowing the rule. reject: true— denies the FIRST tool call ({ kind: 'deny' }); later attempts are allowed. Steering without over-restricting, e.g. lettingpip installthrough when it's already in a container.
Each rule fires at most once per session (per agent), mirroring the original's notified dedup.
Install
From npm (prebuilt, recommended):
dsh plugin --profile <name> add @jiesou/dsh-stream-rules
Or from GitHub (runs prepare to build on install):
dsh plugin --profile <name> add github:jiesou/dsh-stream-rules
Or add the row to your profile's cordis.patch.yml:
- id: stream-rules
name: '@jiesou/dsh-stream-rules'
After installing
You need to write the rules in your own .js file. This plugin won't work by default until you edit the rules.
Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →
Jungod1121/dsh-anchored-standard
lilyblessing/dsh-mcp-skill-panel
SaiSenBox/dsh-prompt-manager