S
dsh-i18n
semidia/dsh-i18n
Chinese localization for tool results: intercepts tool execution output and translates English markers (`[exit code]`, `[timed out]`, `[sandbox: ...]`, etc.) into Chinese, with a settings toggle.
Установка
dsh plugin --profile web add github:semidia/dsh-i18nREADME
dsh-i18n
DeepSeek Harness 汉化插件:拦截工具执行结果和工具执行错误,把可安全替换的英文标记自动替换为中文,带设置开关。
功能
- 工具结果标记(
tools/execute结果):[exit code: N]→[退出码:N][timed out after Nms]→[超时:N毫秒后][killed by signal: ...]→[被信号终止:...][stderr]→[标准错误](no output)→(无输出)[sandbox: file access denied under ...]→[沙箱:文件访问被拒绝,模式 ...]- 等 20+ 条规则
- 工具执行错误(
tools/execute抛错,catch 后翻译):invalid arguments: missing required property "X"→无效参数:缺少必填属性 "X"unknown tool "X"→未知工具 "X"code run failed (...)→代码运行失败(...)tool arguments must be lossless JSON→工具参数必须是可无损序列化的 JSON
- 子代理错误:
subagent "X" is unavailable→子代理 "X" 不可用no subagent provider registered for "X"→没有为子代理提供商 "X" 注册
- 会话恢复错误:
resume failed for session "X"→恢复会话 "X" 失败 - 设置开关:设置 → 通用 →「工具结果汉化」,可随时打开/关闭。
agent/request-error 的 failure 与 agent/error 的 error 是 Harness 核心按原样派发的不可变事实。插件不修改它们,因此这两类核心错误保留原始文本,避免在错误处理路径中再次抛错并中断对话。
安装
方式一:本地插件(junction)
# 1. 建 junction
New-Item -ItemType Junction -Path "$env:USERPROFILE\.dsh\profiles\web\node_modules\dsh-i18n" -Target "本插件源码路径"
# 2. 在 cordis.patch.yml 加 insert 条目
# - insert:
# - id: dsh-i18n
# name: 'dsh-i18n'
# 3. 重启 dsh web
方式二:npm 包(待发布)
dsh plugin --profile web add dsh-i18n
架构
- Host 半区(
lib/index.js):ctx.on('tools/execute')拦截结果,按规则表替换文本;installSettingsSection注册{enabled: boolean}设置。 - Client 半区(
lib/client.js):window.__ModuleLoader__.load包裹,注册settings.general.item开关,用connection.api.settings读写。 - 双面插件声明:
package.json的dsh.client字段 +exports["./client"]。
开发
# 语法检查
node --check lib/index.js
node --check lib/client.js
# 规则测试
node test-localize.cjs
许可
MIT