前言¶
在 DeepSeek Harness(DSH)裏做本地自動化時,常見做法是單獨起一個 MCP 服務,再在配置裏掛工具名。桌面側還要處理 AT-SPI、窗口管理、截圖和 Wayland/X11 輸入,引擎本身往往已經是一套完整的 MCP 實現。若每次都在 DSH 裏重複對接,升級上游修復也會拖慢。
下面介紹社區插件 @brucezhang1993/dsh-computer-use-linux:把上游 computer-use-linux MCP 服務通過 DSH 內置的 @deepseek-ai/dsh-mcp-client 橋接成 mcp__cul__* 原生工具,並附帶 bundled skill。不修改 DSH 本體,也不額外引入運行時依賴。
這是什麼¶
- 維護者:BruceZhang1993(GitHub:BruceZhang1993/dsh-computer-use-linux)
- 分類:客戶端(社區目錄 SkillHub 條目)
- 許可證:MIT(見倉庫 README)
- 定位:Linux 桌面 computer use —— 智能體可觀察本地桌面(AT-SPI 無障礙樹、窗口列表、截圖),並執行聚焦/移動/縮放窗口、點擊、拖拽、滾動、輸入、按鍵、無障礙語義動作等;Wayland 與 X11 共用同一套工具命名,與上游 Claude Code / Codex 插件暴露的能力對齊。
架構上,DSH agent 調用 mcp__cul__* → 內置 MCP 客戶端(stdio、JSON-RPC 2.0)→ 本包 launcher bin/computer-use-linux-mcp.mjs → 固定版本的 Rust 上游二進制(約 9 MB)。插件只負責解析/校驗/啓動二進制,桌面能力由上游維護。
核心功能¶
暴露的工具(18 個默認)¶
工具名統一爲 mcp__cul__<原名>,與上游默認工具一一對應:
| 分組 | 工具 |
|---|---|
| 診斷 | doctor、setup_accessibility、setup_window_targeting |
| 發現 | list_apps、list_windows、focused_window |
| 觀察 | get_app_state、screenshot |
| 輸入 | click、drag、scroll、press_key、type_text |
| 語義 | perform_action、set_value |
| 窗口 | activate_window、move_window、resize_window |
另有 2 個條件工具默認關閉,需環境變量顯式開啓:run_shell(COMPUTER_USE_LINUX_ENABLE_SHELL=1,無沙箱,文檔說明 DSH 已有沙箱 shell)和 complete_interaction(COMPUTER_USE_LINUX_NOTIFY_ON_COMPLETE=1)。
上游能力概覽(經 launcher 轉發)¶
- AT-SPI:無障礙樹與語義動作
- Compositor 後端:窗口列表與聚焦(README 列舉 GNOME、KWin、Hyprland、niri、i3、COSMIC、X11/EWMH 等)
- Portals / Shell:截圖
- ydotool / portal / xdotool:輸入合成
二進制解析順序¶
launcher 按「先命中先用」解析可執行文件:
- 環境變量
COMPUTER_USE_LINUX_BIN(絕對路徑) ~/.cache/computer-use-linux/plugin/v<version>/computer-use-linux(與上游 Claude/Codex 插件同佈局,一臺機器一份緩存)- 已安裝的
@agent-sh/computer-use-linuxnpm 包 PATH上的computer-use-linux- 從 GitHub release 下載並校驗
.sha256
可通過 COMPUTER_USE_LINUX_VERSION、COMPUTER_USE_LINUX_DOWNLOAD_BASE、COMPUTER_USE_LINUX_SKIP_DOWNLOAD 覆蓋版本與鏡像行爲。細節見倉庫 docs/installation.md。
環境與要求¶
- 平臺:Linux(x86_64 或 arm64);非 Linux 平臺插件不啓用
- DSH:需自帶
@deepseek-ai/dsh-mcp-client(官方 README 稱各 shipped profile 已包含) - Node:20+(launcher;DSH Desktop 內通過
ELECTRON_RUN_AS_NODE=1在 Electron 下運行) - 會話:需有圖形桌面;無障礙、窗口與輸入後端因 compositor 而異。安裝後應優先調用
mcp__cul__doctor,並按 skill 內skills/computer-use-linux/references/setup.md排查
安裝與啓用¶
包發佈在 GitHub Packages(scope @brucezhang1993),安裝前需讓 profile 可見 registry 並完成一次認證。
CLI profile(以 web 爲例)¶
先把 scope 寫入 profile 的 .npmrc,再用 legacy 方式登錄(npm 9+ 需 --auth-type=legacy;密碼爲帶 read:packages 的 classic PAT,不是 gh auth login 存的 token):
printf '@brucezhang1993:registry=https://npm.pkg.github.com\n' \
>> "${DSH_HOME:-$HOME/.dsh}/profiles/web/.npmrc"
npm login --scope=@brucezhang1993 --auth-type=legacy \
--registry=https://npm.pkg.github.com
安裝 bundle(dsh plugin 會校驗與當前 DSH 版本兼容性,成功後寫入 profile 的 dsh.profile.bundles 並選中該 bundle):
dsh plugin --profile web add @brucezhang1993/dsh-computer-use-linux # latest
dsh plugin --profile web add @brucezhang1993/dsh-computer-use-linux@0.1.0 # pin a version
安裝完成後 重啓 harness,模型工具列表中會出現 mcp__cul__doctor、mcp__cul__get_app_state、mcp__cul__list_windows、mcp__cul__click 等。
完整步驟(含 token scope、公開包選項)見倉庫 docs/installation.md。
DSH Desktop¶
在插件管理器中從 registry 搜索並安裝 @brucezhang1993/dsh-computer-use-linux。Desktop profile 僅由應用管理,不能使用 dsh plugin --profile desktop add …(設計上會拒絕)。
本地開發目錄¶
在倉庫目錄上直接 link,無需 pack/publish:
dsh plugin --profile web add /absolute/path/to/dsh-computer-use-linux
修改在下次重啓後生效。
典型用法¶
會話內自檢¶
在 DSH 會話中,先讓智能體調用 mcp__cul__doctor。返回平臺、portals、無障礙、窗口與輸入後端及就緒摘要,再決定是否繼續 list_windows、screenshot、click 等操作。
源碼或已安裝包上的命令行驗證¶
在 checkout 根目錄:
node scripts/check-package.mjs # 靜態:patch、exports、skill 一致性
node --test # 單元測試與 launcher 測試
node scripts/doctor.mjs # 桌面就緒報告,無需 DSH
node scripts/selftest.mjs # 經 launcher 的 MCP 握手與 tools/list
已安裝副本也可運行包內 shipped 的 selftest.mjs、doctor.mjs,路徑見 installation.md#verify-the-install。
適用場景與注意¶
適合:在 Linux 工作站上,希望 DSH 智能體以與上游 computer-use-linux 相同語義觀察並操作本機 GUI(含無障礙樹驅動的語義點擊/填表),且願意通過 GitHub Packages 安裝社區 bundle 的開發者。
注意:
- 權限邊界:工具以 當前 DSH 進程的用戶與權限 運行,可聚焦窗口、合成輸入、讀屏幕內容。安裝前應閱讀源碼與 MIT 許可證,並理解
run_shell僅在顯式開啓環境變量時可用且 deliberately unsandboxed。 - 桌面差異:Wayland/X11、各 compositor 對 AT-SPI、截圖 portal、輸入後端支持不一;以
doctor輸出和 setup 文檔爲準,不要假設某一發行版默認可用。 - 生態關係:DSH 社區插件目錄(如 SkillHub)爲獨立站點,與 DeepSeek / 幻方無官方從屬;本插件爲社區維護的橋接層,上游引擎版本由插件 pin 與解析邏輯決定。
- 包版本:
package.json當前版本爲 0.1.1;CLI 示例中 pin 示例爲@0.1.0,按實際需要選擇 latest 或顯式版本號。
結尾¶
dsh-computer-use-linux 的價值在於 橋接而非重寫:上游 MCP 負責桌面引擎,DSH 內置 MCP 客戶端負責命名空間、重連與圖像投影;你在 DSH 裏得到的是統一的 mcp__cul__* 工具面。若你在 Linux 上跑 DSH 並需要 GUI 級 computer use,可按上文完成 GitHub Packages 認證與 dsh plugin add,重啓後用 mcp__cul__doctor 確認環境再繼續自動化。