前言¶
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(該鏈接在本次覈實資料中未確認,本文只作爲線索列出)。