@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
羽毛球分组比赛记分
小程序二维码

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

小夜