@zibokapi/dsh-codex-computer-use:爲 DSH 安裝 macOS 桌面操作插件

前言

在 DSH 裏做桌面自動化時,模型需要的不只是“看到屏幕”,還要能讀取窗口結構、執行輸入,並且儘量減少對用戶前臺的干擾。@zibokapi/dsh-codex-computer-use 是一個面向 macOS 的 DSH 插件包,提供應用列表、關鍵窗口截圖、模型可讀 accessibility tree、合成鼠標鍵盤輸入、審批策略,以及一個獨立 MCP server。

這是什麼

這個包由 geohotstan 維護,採用 MIT 許可證,package.json 中版本爲 0.1.2,要求 Node >=22.19.0。它的定位是 desktop computer use for DeepSeek Harness(DSH):一個可安裝插件包內包含 seam、本地 Swift-daemon provider、computer_use_* tools、approval policy,以及 standalone MCP server,並且無需 OpenAI components。

核心能力

  • macOS 應用列表:提供 app listing 能力。
  • 關鍵窗口捕獲:同時返回截圖和模型可讀 accessibility tree。
  • accessibility-tree-firstcomputer_use_get_app_state 返回編號、tab 縮進元素樹;模型可以基於元素索引操作,窗口相對座標作爲回退;同應用後續捕獲返回 diff。
  • 合成輸入:支持鼠標和鍵盤輸入;後臺優先輸入投遞,語義 AX 動作無需焦點;raw events 使用 private SkyLight path,並有 CGEvent.postToPid fallback。
  • 本地 daemon:提供本地 Swift-daemon provider,支持 AX tree、screenshots、CGEvent input。
  • 工具與 skill:提供 computer_use_* tools 和 computer-use skill。
  • 審批策略:提供按應用審批門、Codex-style tier guidance,以及 computer_use_list_granted_applications
  • MCP server:提供 standalone MCP stdio server,暴露官方十個 Codex Computer Use window tools、request_access 和三個 event_stream_* recording tools。

安裝與啓用

先安裝到目標 profile:

dsh plugin --profile <name> add @zibokapi/dsh-codex-computer-use

然後構建 macOS daemon,並請求所需權限。這一步通常每臺機器做一次:

npx @zibokapi/dsh-codex-computer-use

構建 daemon 需要 Xcode Command Line Tools。如果本機缺少,可以先執行:

xcode-select --install

完成後重啓 profile,使 computer_use_* tools 生效:

dsh --profile <name> web

安裝狀態可以用下面命令查詢:

dsh-codex-computer-use status

macOS 權限

daemon 需要兩個 macOS TCC 權限:

  • Accessibility:用於讀取 accessibility tree 和輸入目標。
  • Screen Recording:用於窗口截圖。

缺失或撤銷權限時,插件會拒絕激活,computer use 不加載。每次插件加載都會重新檢查授權;如果 macOS 已經記住 denial,會打開對應的 System Settings pane。

daemon 安裝位置使用穩定路徑:

~/.dsh/computer-use/dsh-computer-daemon.app

這樣做的目的是避免 node_modules 路徑變化影響 macOS TCC。

典型用法

從插件線索安裝

如果從插件線索出發,可以先安裝插件包:

Install this plugin package: https://github.com/geohotstan/dsh-computer-use

然後運行:

npx @zibokapi/dsh-codex-computer-use

最後重啓 profile:

dsh --profile <name> web

從 Git 倉庫手動安裝

也可以從 checkout 手動安裝:

git clone https://github.com/geohotstan/dsh-computer-use
cd dsh-computer-use
pnpm install
pnpm exec dsh-codex-computer-use
dsh plugin --profile <name> add ../dsh-computer-use

手動 compose

手動編寫 composition 時,可以使用相同的 subpath entries:

plugins:
  computer-engine:
    plugin: '@zibokapi/dsh-codex-computer-use/computer-local'
  computer-tools:
    plugin: '@zibokapi/dsh-codex-computer-use/computer-tools'
  computer-policy:
    plugin: '@zibokapi/dsh-codex-computer-use/computer-policy'

其中 computer-policy 需要掛載 approval service,例如:

@deepseek-ai/dsh-user-approval

運行 MCP server

完成 daemon 安裝後,可以直接運行:

node lib/mcp.js

如果需要顯式指定 daemon 路徑,可以將路徑作爲第一個參數:

node lib/mcp.js /absolute/path/to/dsh-computer-daemon.app/Contents/MacOS/dsh-computer-daemon

也可以通過環境變量指定:

DSH_COMPUTER_HELPER_PATH=/absolute/path/to/dsh-computer-daemon.app/Contents/MacOS/dsh-computer-daemon dsh-computer-mcp

這個 MCP server 使用 newline-delimited JSON-RPC 2.0,通過 stdin/stdout 通信,支持:

initialize
ping
tools/list
tools/call

其 action tools 會回答 post-action state;捕獲到時包含 text 和 JPEG image block。

helperPath 解析順序

helperPath 是可選配置。engine 的解析順序爲:

helperPath config
DSH_COMPUTER_HELPER_PATH 環境變量
setup CLI 安裝位置

默認安裝位置爲:

~/.dsh/computer-use/dsh-computer-daemon.app/Contents/MacOS/dsh-computer-daemon

適用場景與注意

適合在 DSH 中做 macOS 桌面操作,並且希望把應用列表、窗口狀態讀取、輸入執行、審批策略和 MCP 接入放在同一個插件包內維護。

使用前需要注意:

  • 需要 macOS Accessibility 和 Screen Recording 權限。
  • 構建 daemon 需要 Xcode Command Line Tools。
  • Node 版本要求 >=22.19.0
  • 插件會請求桌面相關權限,並以當前 dsh 進程權限運行;安裝前應檢查源碼與許可證。
  • 許可證爲 MIT。

參考鏈接

GitHub 倉庫:

https://github.com/geohotstan/dsh-computer-use

插件目錄頁(來自插件線索,未在本次已抓取資料中直接確認):

https://www.skillhub.cn/plugins/geohotstan/dsh-computer-use
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜