前言¶
在 DeepSeek Harness(DSH)裏做智能體開發時,一個具體需求是:讓 DSH 會話調用本機已經登錄的 Codex,同時不希望在 DSH 中額外配置 OpenAI API Key,還要保留 DSH 自己的會話、插件和工具管理。下面介紹 codex-plugin-dsh,它是 Codex App Server model provider plugin for DeepSeek Harness。
這是什麼¶
codex-plugin-dsh 由 wingoo 維護,許可證爲 MIT,package.json 中 version 爲 0.1.0。它把本機已登錄的 Codex 作爲本地模型 provider 接入 DSH。
安裝並重啓後,DSH 的現有模型選擇器中會出現 Codex App Server (local)。會話和工具調用仍由 DSH 管理,現有 DSH 插件與工具可繼續使用。插件支持圖片輸入,也支持將 Codex 原生圖片生成結果回寫到 DSH 對話。插件不讀取或保存 API Key,無需在 DSH 中配置 OpenAI API Key。
核心功能¶
- 在 DSH 中使用本機已登錄的 Codex 作爲本地模型 provider。
- 安裝並重啓後,在現有模型選擇器中出現
Codex App Server (local)。 - 會話和工具調用仍由 DSH 管理,現有 DSH 插件與工具可繼續使用。
- 支持圖片輸入。
- 支持將 Codex 原生圖片生成結果回寫到 DSH 對話。
- 插件不讀取或保存 API Key。
- 無需在 DSH 中配置 OpenAI API Key。
運行邊界¶
使用這個插件前,先確認它的安全邊界:
- App Server 固定使用只讀 sandbox 和
neverapproval。 - Codex 自帶 shell、文件修改、Web、MCP、Apps、Plugins、view-image 和 multi-agent 能力會被關閉或拒絕。
- 這些動作只能走 DSH 工具生態。
- Codex 原生 imagegen 爲例外,由 App Server 直接完成,不進入 DSH 工具循環。
還有以下已知限制:
- 尚未實現 DSH 交互問題橋接,App Server 的
item/tool/requestUserInput會明確失敗。 - 其他 provider 產生的 reasoning block 或 assistant 圖片無法導入 App Server。
- 工具目錄變化重建 thread 時,已有 Codex reasoning 或 assistant 圖片也無法無損導入。
- App Server 無法兌現的配置字段
temperature、maxTokens、stop會被拒絕。
環境要求¶
先確認本機滿足以下條件:
Node.js ^22.19.0 或 >=24
DeepSeek Harness >=0.1.0-rc.5 <0.2.0
本地 Codex CLI >=0.147.0
已通過 codex login 登錄的 Codex 賬戶
如果本機還沒有可用的 Codex CLI,先安裝並登錄:
npm install -g @openai/codex
codex login
再確認 Codex CLI 和 App Server 可用:
codex --version
codex app-server --help
安裝¶
下面使用 DSH 的 web profile。
安裝 GitHub 倉庫:
dsh plugin --profile web add github:wingoo/codex-plugin-dsh
也可以使用 pnpm 執行安裝:
pnpm dsh plugin --profile web add github:wingoo/codex-plugin-dsh
如果需要鎖定 commit,可以指定 <commit-sha>:
dsh plugin --profile web add github:wingoo/codex-plugin-dsh#<commit-sha>
如果需要安裝本地 checkout:
dsh plugin --profile web add /absolute/path/to/codex-plugin-dsh
本地 checkout 也可以用 pnpm 安裝:
pnpm dsh plugin --profile web add /absolute/path/to/codex-plugin-dsh
安裝會修改 DSH profile,並在宿主機上運行插件代碼。插件會作爲 DSH 插件在當前 DSH 運行環境中加載並執行,因此安裝前應檢查倉庫來源、源碼和 MIT 許可證。
安裝後啓用¶
安裝完成後,按下面步驟啓用:
1、沿用原啓動方式重啓 DSH Web 服務。
2、重啓後刷新瀏覽器。
3、在現有模型選擇器中選擇 Codex App Server (local)。
4、發送第一條消息前,可先切換到 Codex。
更新插件¶
已安裝後,可以更新當前 web profile 中的插件:
dsh plugin --profile web update codex-plugin-dsh
也可以通過 npx 更新:
npx --yes @deepseek-ai/dsh plugin --profile web update codex-plugin-dsh
也可以使用 pnpm 更新:
pnpm dsh plugin --profile web update codex-plugin-dsh
更新完成後必須重啓原有 DSH Web 服務;正在運行的進程不會自動加載磁盤上的新插件代碼。
配置¶
profile 可以在自己的 cordis.patch.yml 中覆蓋 id 爲 codex-app-server-provider 的插件配置:
- id: codex-app-server-provider
如果覆蓋 env,注意它是顯式子進程環境覆蓋。不要把憑證寫進已提交的 profile。
當前驗證與平臺說明¶
當前已在 macOS 上使用 DeepSeek Harness 0.1.0-rc.5 源碼包、0.1.0-rc.6 發佈包和 Codex CLI 0.147.0 完成驗證。
Windows 批處理 shim 啓動已有單元測試,但首個版本發佈前仍需在真實 Windows 主機上運行一次。
結尾¶
codex-plugin-dsh 的價值在於把本機已登錄 Codex 以本地 provider 的方式接入 DSH,同時保留 DSH 的會話、插件和工具管理。使用前重點確認倉庫來源、許可證、環境版本,以及 App Server 的 sandbox 和 approval 邊界。
倉庫地址:
https://github.com/wingoo/codex-plugin-dsh