前言¶
DSH 的理念之一是「一切皆插件」,可以通过插件扩展某个 profile 的工具和呈现。下面介绍的 @opentritium/dsh-codex-shim 面向 DeepSeek Harness 中 GPT-family 和其他 Codex-adapted models 的工具调用问题:它为选定的模型路由模拟 Codex 风格的 prompts、tool vocabulary、tool results 和 WebUI presentation,让这类模型在 DSH 中更稳定地使用工具。
这是什么¶
@opentritium/dsh-codex-shim 由 OpenTritium 维护,许可证为 MIT。它的定位是 Route-aware Codex environment simulation for DeepSeek Harness。
它是一个 shim,不是 Codex runtime:不启动 Codex app-server,不处理 Codex OAuth,不提供模型或 credentials,不自行 execute commands,也不提供 web-search backend。它只通过 public service definitions、consumers 和 UI slots 消费既有 DSH 能力;当模型不匹配或移除 bundle 后,DSH 会继续使用正常工具和行为。
核心功能¶
- 为 selected model routes 模拟 Codex-style prompts、tool vocabulary、tool results 和 WebUI presentation。
- 支持在 profile settings 中配置
codex-shim,包括enabled、modelPatterns和modelOverrides。 - 注册 shim tools:
exec_command、write_stdin、apply_patch、view_image、update_plan、web_run。 - 当 replacement tool 存在时,隐藏与它重叠的 host tools,避免 active prompt advertisement 中混用相近工具。
- 可选 patch DSH WebUI,使其暴露一个 settings client namespace,配置项为
expose: 'client'。
安装到 web profile¶
下面以 WebUI 的 web profile 为例安装 release tarball。
gh release download --repo OpenTritium/dsh-codex-shim --pattern 'opentritium-dsh-codex-shim-*.tgz'
pnpm dsh plugin --profile web add ./opentritium-dsh-codex-shim-*.tgz
pnpm dsh --profile web --dump-config
第一条命令下载匹配模式的 release tarball;第二条命令把 bundle 加入 web profile;第三条命令导出当前 profile 配置,便于确认安装结果。
配置模型路由¶
如果内置的 gpt-5.6-* 规则已经够用,可以跳过本节。
可以从 profile settings 的 $DSH_HOME/settings.yaml 中增加或修改 codex-shim: 段:
codex-shim:
enabled: true
modelPatterns:
- gpt-5.6-*
- deepseek-v4-*
modelOverrides:
- provider: openai
model: gpt-5.6-luna
enabled: true
- provider: example-provider
model: experimental-model
enabled: false
enabled 控制 shim 是否启用。modelPatterns 会替换 automatic-rule list,用于控制哪些模型路由进入 Codex surface。modelOverrides 的每一行必须精确匹配 provider/model,并且优先级高于 modelPatterns。
可选:为 WebUI 暴露 settings client¶
如果只通过 settings 文件配置,可以跳过本节。若需要 WebUI 暴露 settings client namespace,需要先将补丁应用到指定的干净 DSH commit,再重新构建 DSH,最后安装 release tarball。
gh release download --repo OpenTritium/dsh-codex-shim --pattern 'opentritium-dsh-codex-shim-*.tgz' --pattern 'deepseek-harness-settings-client-exposure-47f9438.patch'
git clone https://github.com/deepseek-ai/deepseek-harness.git deepseek-harness
cd deepseek-harness
git checkout 47f943859bef60e4160492346772ded9b24f765a
git apply --check ../deepseek-harness-settings-client-exposure-47f9438.patch
git apply ../deepseek-harness-settings-client-exposure-47f9438.patch
pnpm install && pnpm run build
pnpm dsh plugin --profile web add ../opentritium-dsh-codex-shim-*.tgz
pnpm dsh --profile web --dump-config
这个补丁只针对 47f943859bef60e4160492346772ded9b24f765a 这个 clean checkout。不要应用到 dirty checkout 或不同 commit。
卸载¶
删除 bundle 后,DSH 会继续使用正常工具和行为。
pnpm dsh plugin --profile web remove @opentritium/dsh-codex-shim
pnpm dsh --profile web --dump-config
如果要清除保存的 shim preferences,还需要删除 $DSH_HOME/settings.yaml 中完整的 codex-shim: 段。
如果之前应用了可选 WebUI patch,必须先移除 bundle,再反向应用补丁;并且只有在没有其他 local external bundle 使用 expose: 'client' 时,才执行反向操作:
pnpm dsh plugin --profile web remove @opentritium/dsh-codex-shim
git apply --reverse --check ../deepseek-harness-settings-client-exposure-47f9438.patch
git apply --reverse ../deepseek-harness-settings-client-exposure-47f9438.patch
pnpm run build
pnpm dsh --profile web --dump-config
适用场景与注意¶
适合以下情况:
- 你已经在 DSH 中使用 GPT-family 或其他 Codex-adapted models,希望它们按 Codex 风格的工具词汇和结果呈现进行调用。
- 你只需要在特定模型路由上启用 Codex surface,而不想改变 DSH 的默认行为。
- 你希望在
webprofile 中通过 release tarball 安装和卸载该插件。
需要注意:
- 它是 shim,不是 Codex runtime;不会提供 Codex app-server、OAuth、模型、credentials、命令执行或 web-search backend。
write_stdin是降级能力:非空 stdin 会被拒绝,因为当前 DSH shell definition 没有 stdin-write operation。view_image是条件能力:要求 profile 提供 filesystem 和 image-attachment capabilities。web_run是 search-only,不实现open、click、find、screenshots 或 arbitrary fetch。modelOverrides行必须精确匹配provider/model,并优先于modelPatterns。- 由于插件会在当前 dsh 进程内运行,安装前应检查源码与许可证;本插件许可证为 MIT。
结尾¶
@opentritium/dsh-codex-shim 的价值在于:通过路由控制,把 Codex 风格的 prompts、tools、results 和 WebUI presentation 叠加到 DSH 上,同时保留 DSH 的原有行为。它适合需要提升 Codex-adapted models 工具调用稳定性的 DSH 用户。
GitHub 仓库:https://github.com/OpenTritium/dsh-codex-shim。
插件目录线索:https://www.skillhub.cn/plugins/OpenTritium/dsh-codex-shim(该链接在本次核实资料中未确认,本文只作为线索列出)。