Computer Use — macOS / Windows / Linux 跨平台实施计划
更新时间:2026-04-03 参考项目:E:\源码\claude-code-source-main\claude-code-source-main
1. 现状
参考项目的 Computer Use 仅支持 macOS——从入口到底层全部写死 darwin。我们的项目在 Phase 1-3 中已经完成了:- ✅
@ant/computer-use-mcpstub 替换为完整实现(12 文件) - ✅
@ant/computer-use-input拆为 dispatcher + backends(darwin + win32) - ✅
@ant/computer-use-swift拆为 dispatcher + backends(darwin + win32) - ✅
CHICAGO_MCP编译开关已开 - ✅
src/层 macOS 硬编码已移除(Phase 2 已完成)
2. 阻塞点全景
2.1 入口层
2.2 加载层
2.3 macOS 特有依赖
2.4 缺失的 Linux 后端
3. 每个平台的能力依赖
3.1 computer-use-input(键鼠)
3.2 computer-use-swift(截图 + 应用管理)
3.3 executor 层
4. 执行步骤
Phase 1:已完成 ✅
-
@ant/computer-use-mcpstub → 完整实现 -
@ant/computer-use-inputdispatcher + darwin/win32 backends -
@ant/computer-use-swiftdispatcher + darwin/win32 backends -
CHICAGO_MCP编译开关
Phase 2:移除 6 处 macOS 硬编码(解锁 macOS + Windows)
改动原则:macOS 代码路径不变,只在每处 darwin 守卫后加 win32/linux 分支。Phase 3:新增 Linux 后端
Phase 4:验证
5. 文件改动总览
不动的文件(14 个)
cleanup.ts、computerUseLock.ts、wrapper.tsx、toolRendering.tsx、mcpServer.ts、setup.ts、appNames.ts、inputLoader.ts、src/services/mcp/client.ts、@ant/computer-use-mcp/src/*(Phase 1 已完成)、backends/darwin.ts(两个包都不动)
改 src/ 的文件(8 个)
新增文件(2 个)
6. Linux 依赖工具
Wayland 环境需要替代工具:
ydotool(替代 xdotool)、grim(替代 scrot)、wl-clipboard(替代 xclip)。初期可先只支持 X11,Wayland 标记为 todo。