👾 Open Computer Use – Open-Source Alternative to Codex Computer Use
Swift accessibilityai-agentai-agentsclaude-codecodexcodex-computer-usecomputer-usecomputer-use-agentcross-platformcuadesktop-automationgemini-cligui-automationmacosmcpmodel-context-protocolopen-computer-useopen-computer-use-mcpopenai-codexopencode
JS REPL Computer Use 支持
目标
把 Open Computer Use 从“只暴露离散的 9 个 MCP tools”扩展为可由持久 Node.js REPL 编排的 Computer Use runtime:模型通过 js / js_reset 编写异步 JavaScript,使用 app-bound API,在一次 tool round trip 内完成多步动作、条件、循环和最终状态读取。
范围
- 包含:
- 调研官方 bundled
computer-use、hostnode_repl与@oai/sky的启动与调用链。 - 审阅社区 PR #65、#72、#73、#74、#75,重点复用 #75 的意图并修正协议偏差。
- 新增跨平台 Node REPL adapter,把现有 native MCP server 的离散 tools 转成异步
cuaapp-bound API。 - 让 Codex plugin 默认通过 Node REPL adapter 暴露
js/js_reset,保留原生mcp入口兼容其他 host。 - 覆盖持久 binding、reset、错误传播、截图输出、同一次调用内多步工具编排和 child lifecycle。
- 同步架构、安全、可靠性、usage、plugin metadata、release note 与 history。
- 调研官方 bundled
- 不包含:
- 直接复制或依赖官方 proprietary
@oai/*packages。 - 在 Swift 中嵌入 JavaScriptCore 作为主 REPL;该方案缺少官方 Node REPL 的 async/top-level await/module/output 语义。
- 本轮合并 #65、#72、#73、#74;它们独立评审和交付。
- 本轮移除现有 9-tool MCP surface;
open-computer-use mcp保持兼容。
- 直接复制或依赖官方 proprietary
背景
- 相关文档:
docs/ARCHITECTURE.mddocs/SECURITY.mddocs/RELIABILITY.mdskills/open-computer-use/references/usage.md
- 相关代码路径:
packages/OpenComputerUseKit/Sources/OpenComputerUseKit/MCPServer.swiftpackages/OpenComputerUseKit/Sources/OpenComputerUseKit/ComputerUseToolDispatcher.swiftplugins/open-computer-use/scripts/npm/build-packages.mjs
- 已知约束:
- 官方 plugin 1.0.1001068 仍是
@oai/skyskill + native 9-tool MCP client;本机检查到的 host bundle 提供 Node 22node_repl与@oai/sky0.6.11。 - 已检查的官方 bundle 使用 host 提供的通用
node_repl,由 plugin 指引模型导入异步@oai/skyAPI;REPL 不是 native MCP 自身新增的两个 tools。 - Node REPL 必须有持久顶层 binding、top-level await、显式输出、超时和 reset。
- 不得在 commit 或 PR 中加入禁止的 Co-authored-by trailer。
- 官方 plugin 1.0.1001068 仍是
风险
- 风险:子进程 MCP 与 Node REPL 双层生命周期处理不当会泄漏 native runtime 或挂死。
- 缓解方式:adapter 统一接管 SIGINT/SIGTERM/SIGHUP、stdin EOF、pending JSON-RPC、默认 timeout,并在测试中验证关闭路径。
- 风险:任意 JavaScript 比离散 tool surface 权限更宽。
- 缓解方式:明确这是本地 Node execution surface;plugin 默认入口只用于 Codex 场景,原生 MCP 保持可选;文档说明文件/网络能力与信任边界。
- 风险:官方 API 仍在快速变化。
- 缓解方式:实现稳定的最小 app-bound API,独立 adapter 与 native dispatcher,通过 contract tests 固定协议,避免耦合 proprietary package。
- 风险:截图二进制在 nested MCP/Node bridge 中膨胀。
- 缓解方式:只在
getScreenshot/getAXStateAndScreenshot时解码并 emit,普通动作不透传 action-result screenshot。
- 缓解方式:只在
里程碑
- 调研官方机制并审阅社区 PR。
- 落跨平台 Node REPL adapter、plugin route 与 contract tests。
- 文档、history、release note 和完整 CI 验证。
验证方式
- 命令:
node --test scripts/node-repl/*.test.mjsswift test(cd apps/OpenComputerUseLinux && go test ./...)(cd apps/OpenComputerUseWindows && go test ./...)make check-docs./scripts/run-tool-smoke-tests.sh./scripts/ci.sh
- 手工检查:
- MCP
tools/list只有js/js_reset。 - 连续
js调用保留顶层 binding,js_reset清空。 await cua.getApp(...)返回 app binding,动作与 snapshot 在一次js内按序执行。
- MCP
- 观测检查:
- native child 退出或超时给出结构化错误;adapter 退出时 child 不残留。
进度记录
- 读取仓库规则与架构文档。
- 逆向当前与上一代官方 plugin/runtime。
- 审阅 #65、#72、#73、#74、#75 的范围、冲突和设计。
- 完成 Node REPL adapter 与 plugin 集成。
- 完成 contract tests 和跨平台验证。
- 完成文档、history、release note 与 plan 归档。
决策记录
- 2026-09-21:不直接合并 #75 的 JavaScriptCore 同步 runtime。保留其“代码编排减少 round trip”的产品判断,但采用 Node.js、top-level await、persistent lexical bindings、
nodeRepl.write/emitImage和 app-bound asynccuaAPI;这是适配任意 MCP host 的开源实现,不声称官方 plugin 本身也暴露这两个 MCP tools。 - 2026-09-21:本轮采取 additive migration。Codex plugin 默认走
js/js_resetadapter;原生open-computer-use mcp继续暴露离散 tools,避免一次性破坏所有 MCP host。 - 2026-09-21:#73 的 targeted AX query 与 #74 的 App Intent 不作为 model-facing standalone tools 并入本轮;未来若采用,应优先成为 app-bound
cuaAPI 的能力,而非继续扩大顶层 MCP tool surface。 - 2026-09-22:完整验证通过:Node contract 12/12、Swift 167 tests(1 个 opt-in live test skipped)、Linux/Windows Go tests、Linux Python tests、9-tool 与 cursor smoke、npm dry-run/staged launcher、隔离的 Codex plugin cache install 和 macOS 真实 native bridge。Linux devbox 安装缺失的
gir1.2-atspi-2.0后,另外验证了 Node 22 下的 contract、两工具 surface、结构化空 app 列表、持久 binding、CPU timeout/reset 和 native Linux bridge;该 SSH 环境没有可见的登录桌面窗口,所以 app 数量为 0。仓库级scripts/ci.sh仅在已有 repository-hygiene gate 失败:当前 checkout 的main本身缺少.editorconfig、.markdownlint.json及多份.github模板/workflow;本轮相关的其余 CI 子步骤已单独通过。