zuoguyoupan2023/openharness-rule-for-dsh-plugin ↗★ 0
openharness-rule-for-dsh-plugin
DSH plugin that injects a system-prompt rule block for assisting with DeepSeek Harness plugin development: what you CAN / SHOULD / MUST NOT / SHOULD NOT do.
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:zuoguyoupan2023/openharness-rule-for-dsh-plugin说明文档
阅读完整 README ↗openharness-rule-for-dsh-plugin
一个 DeepSeek Harness(dsh)插件:往系统提示词注入「DSH 插件开发规范」——四类规则: 能做什么(CAN)/ 应该做什么(SHOULD)/ 不能做什么(MUST NOT)/ 不应该做什么(SHOULD NOT)。 并在 dsh 设置页侧边栏显示「插件开发规范」一项。
- 纯 dsh plugin(bundle),装在 web profile 即可生效;
- host 半:
ctx.systemPrompt.section({ name, order: 46, text })注入规范(真实逻辑); - client 半:注册
settings.section槽,显示侧边栏项(与openharness-reply-in-cn/adhdgofly-dsh-ext完全同构)。
注入逻辑(host half,src/host/index.ts)
export const inject = ['systemPrompt'] // 申报依赖,否则 boot 崩
export const name = 'openharness-rule-for-dsh-plugin'
export function apply(ctx, config) {
if (config?.enabled === false) return // 可通过 patch 关闭
const disposer = ctx.systemPrompt.section({
name: 'openharness:rule-for-dsh-plugin',
order: 46, // persona(0) 之后、工具引导(100+)之前
text: (context) => (context.agent === undefined ? '' : ),
})
return () => disposer?.() // apply 返回 disposer,卸载时清理
}
- 只
order:46,比「中文回复」的 45 略低(46 排在 45 之后),不影响对方。 - 规则正文本体是一个字符串数组
ruleText,含 CAN / SHOULD / MUST NOT / SHOULD NOT 四段。 - 只有真实 agent 装配(
context.agent存在)才渲染,不污染非 agent 的 assemble 调用。
遵循程度:这是软约束。注入一定发生(官方装配按 order 拼接、当前 profile 无 complete 段覆盖),但「模型是否严格遵守」无法 100% 保证——靠 order 靠前 + 措辞「最高优先级」尽量稳住。
验证注入是否生效:在对话框直接问「系统提示里有没有『DSH 插件开发规范:能做什么/不能做什么』这条」——模型能复述即注入成功。
侧边栏项(client half,src/client/index.ts)
slots.inject('settings.section', () => slots.register(
{ name: 'settings.section', id: 'openharness-rule-for-dsh-plugin', order: 20, label: () => '插件开发规范' },
Section,
))
settings.section是 list 槽:多个插件同时注册不冲突、都会显示(与 中文回复/ADHDGoFly/OpenHarness Reader 并列)。- 与
openharness-reply-in-cn的 client 结构完全一致,只是id/label不同。