DSH Hub

zjl1989-li/dsh-harness-zh-cn

dsh-harness-zh-cn

UIWeb UI3 GitHub stars· updated 2026-08-16

dsh-harness-zh-cn is a community DeepSeek Harness plugin. Read the repository README before installing.

Install

npx @deepseek-ai/dsh plugin --profile web add github:zjl1989-li/dsh-harness-zh-cn

Restart `dsh web` after install. Bundle APIs can change during the developer preview.

README badge

dsh-harness-zh-cn DSH Hub badge
[![DSH Hub](https://dshhub.dev/badge/dsh-harness-zh-cn.svg)](https://dshhub.dev/plugins/dsh-harness-zh-cn)

Paste this into your README. The star count updates with every catalog sync.

From the README

Excerpt from zjl1989-li/dsh-harness-zh-cn, cleaned of badges and images.

dsh-harness-zh-cn

DeepSeek Harness 中文汉化插件 —— 在运行时把 DSH 的全部系统提示词、工具描述与运行时上下文翻译成中文。

这是一个纯运行时插件:它通过 DSH 的 system-prompt/assemble 瀑布钩子,在每次组装提示词后把模型可见的英文文本替换为中文,不修改任何 DSH 源码。卸载插件即完全还原英文。

当前内置 1788 条翻译,覆盖系统提示 sections、运行时上下文、全部工具描述与参数描述,以及 cordis 完整 API 目录(55 服务 + 56 事件)。

特性

  • 零源码修改:不碰 node_modules,升级 DSH 后依然有效
  • 覆盖面广:系统提示 sections、运行时上下文 contexts、工具描述与参数描述、cordis API 目录全部汉化
  • 协议安全[exit code: N][killed by signal: X][sandbox: ...][stderr] 等被 DSH 或前端解析的机器协议标记保留原样,不破坏下游解析
  • 可开关sections / contexts / tools 三类翻译可分别关闭
  • 插件市场描述翻译:安装 dsh-plugin-marketplace 后,插件市场里各插件的英文描述会自动翻译成中文——先即时显示(词表兜底,不卡加载),后台用 LLM 批量翻译后自动刷新一次显示流畅中文,结果缓存(同一描述只翻一次,不重复消耗 token)
  • 即插即用:作为普通 DSH 插件加载,卸载即还原

安装

方式一:npm 包(推荐)

npm install dsh-harness-zh-cn
# 或
pnpm add dsh-harness-zh-cn

方式二:从 GitHub 安装

npm install git+https://github.com/zjl1989-li/dsh-harness-zh-cn.git

方式三:本地开发(直接引用本仓库)

npm install <本仓库路径>

启用

方式一:UI 插件管理(推荐)

在 DSH Web GUI 的 设置 → 插件管理 中添加 dsh-harness-zh-cn,重启后生效。UI 会正确登记 bundle 并持久化配置。

方式二:profile bundle 列表

在 profile 的 package.jsondsh.profile.bundles 列表中加入(cordis.yml 是自动生成文件,请勿直接编辑):

{
  "dsh": {
    "profile": {
      "bundles": [
        "@deepseek-ai/dsh-base",
        "@deepseek-ai/dsh-web-app",
        "dsh-harness-zh-cn"
      ]
    }
  }
}

方式三:cordis.patch.yml

在 DSH profile 的 cordis.patch.yml 中追加插件条目:

- $plugin: dsh-harness-zh-cn
  config:
    includeSections: true
    includeContexts: true
    includeTools: true

重启 DSH 后生效。无需改动任何 DSH 源码。

配置

配置项类型默认值说明
includeSectionsbooleantrue翻译系统提示词 sections(身份、工具指导等)
includeContextsbooleantrue翻译运行时上下文 contexts(沙箱策略、审批策略、委托声明等)
includeToolsbooleantrue翻译工具描述与参数描述
verbosebooleanfalse调试日志

工作原理

DSH 在每次模型请求前通过 ctx.systemPrompt.assemble() 组装提示词,组装过程会触发 system-prompt/assemble 瀑布事件。本插件在该瀑布的 next() 之后:

  1. 遍历 assembly.sections,将每个 section 的 texttranslate() 汉化;
  2. 遍历 assembly.contexts,汉化每个动态上下文文本;
  3. 遍历 assembly.tools,汉化工具 description 并递归汉化 parameters 中的 description 字段。

translate() 使用 dict/ 目录下的 JSON 字典,匹配顺序:

  1. 精确匹配:整句文本与字典 en 完全一致时直接替换;
  2. 空白折叠匹配:将连续空白折叠为单个空格后比较,容忍源码拼接处的空格差异(如 base + background 的边界);
  3. 模板正则:对含路径、数字、模式名等动态部分的文本,用 template: true 条目做整体正则替换($1$2 引用捕获组)。

机器协议标记与代码标识符一律保留。

插件市场描述翻译(额外能力)

本插件还带一个 client 半(浏览器端),配合 dsh-plugin-marketplace 使用:

  1. 拦截 window.fetch/api/market/list 的响应;
  2. 即时显示:英文描述先用内置词表就地翻译(不阻塞列表渲染);
  3. LLM 批量翻译:后台调用本插件注册的 POST /api/harness-zh/translate 端点(用部署默认模型,一次调用翻译一批),结果写入 localStorage 缓存并自动刷新一次显示流畅中文;
  4. 缓存复用:同一描述只翻译一次,之后打开直接命中缓存,不重复消耗 token。

该翻译端点为插件自注册(/api/harness-zh/translate),不修改 dsh-plugin-marketplace 源码;LLM 不可用时自动回退到词表翻译。

翻译字典

所有译文集中存放在 dict/ 目录,当前 5 个字典共 1788 条

字典条目数覆盖内容
core.json23身份行、沙箱/审批策略、委托声明、工作区指令
tools-fs-bash.json39read/write/edit/bash 工具与参数
tools-fs-core.json221pwsh/fs/cordis 工具、plan-mode、sandbox 等
tools-web-jobs-goal.json264web/jobs/goal/ralph/workflow/subagent 等
cordis-api.json1241cordis 完整 API 目录(55 服务 + 56 事件 + 方法/参数/返回值)

字典格式:

Related plugins