👾 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
Add cross-platform npm distribution
Leodcd2d39ad2b6
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex ff5457e..4c8f97e 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -35,9 +35,15 @@ jobs:with:node-version: "24"+ - name: Set up Go+ uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c+ with:+ go-version: "1.22.x"+- name: Check npm trusted publishing CLIrun: |node --version+ go versionnpm_version="$(npm --version)"echo "npm ${npm_version}"node -e 'const [major, minor] = process.argv[1].split(".").map(Number); if (major < 11 || (major === 11 && minor < 5)) { console.error(`npm ${process.argv[1]} is too old for trusted publishing; need 11.5.1+`); process.exit(1); }' "${npm_version}"diff --git a/README.md b/README.mdindex a1ac7f9..973d637 100644--- a/README.md+++ b/README.md@@ -8,7 +8,7 @@ https://github.com/user-attachments/assets/eacb3b15-f939-46c7-b3b3-6f876977a58d<sub><em>Gemini CLI connected to `open-computer-use` through MCP, driving real Computer Use actions end to end.</em></sub>-`open-computer-use` is an open-source `Computer Use` service exposed over `MCP`, so any AI agent or MCP client can call it directly and use computer interaction capabilities on macOS. Experimental Windows and Linux runtimes now live in this repo too, each exposing the same 9-tool surface through standalone Go-built binaries.+`open-computer-use` is an open-source `Computer Use` service exposed over `MCP`, so any AI agent or MCP client can call it directly and use computer interaction capabilities on macOS, Linux, and Windows. The macOS runtime ships as an app bundle, while the Windows and Linux runtimes expose the same 9-tool surface through standalone Go-built binaries.This project was inspired by OpenAI's recently released [Codex Computer Use](https://openai.com/index/codex-for-almost-everything/). It showed that non-intrusive CUA can be built on top of macOS Accessibility, which is why I decided to build an open-source version.@@ -16,16 +16,18 @@ I bootstrapped this repo with my earlier [harness template](https://github.com/i## Quick Start-The npm package currently ships the macOS app bundle. Install it globally first:+The npm package installs a root launcher plus the native package that matches your current `os-arch`:```bashnpm i -g open-computer-use```-Before first use, grant macOS `Accessibility` and `Screen Recording` permission to the `Open Computer Use.app` you actually plan to keep installed. The CI-built release package remains the stable identity for distribution. Local debug/dev builds are intentionally packaged as `Open Computer Use (Dev).app`, so System Settings shows them as a separate development app instead of another indistinguishable `Open Computer Use`. If you are not sure about the current state, run:+On macOS, grant `Accessibility` and `Screen Recording` permission to the `Open Computer Use.app` you actually plan to keep installed. The CI-built release package remains the stable identity for distribution. Local debug/dev builds are intentionally packaged as `Open Computer Use (Dev).app`, so System Settings shows them as a separate development app instead of another indistinguishable `Open Computer Use`.++On Linux and Windows, run it in the signed-in desktop session so AT-SPI2 or UI Automation can see GUI apps. To confirm the installed native package is wired correctly, run:```bash-open-computer-use+open-computer-use --version```Then add it to your MCP client:diff --git a/README.zh-CN.md b/README.zh-CN.mdindex 0185349..fa69b6c 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -8,7 +8,7 @@ https://github.com/user-attachments/assets/eacb3b15-f939-46c7-b3b3-6f876977a58d<sub><em>Gemini CLI 作为 host 接入 `open-computer-use` MCP,并完整触发真实的 Computer Use 操作。</em></sub>-`open-computer-use` 是一个开源的 `Computer Use` 服务,已经包装成 `MCP` 协议,支持所有的 AI Agent 或 MCP Client 快速调用,实现 macOS 上的 `Computer Use` 能力。仓库里也已经新增实验性的 Windows 和 Linux runtime,用 Go 生成独立二进制,暴露同样的 9 个 tool。+`open-computer-use` 是一个开源的 `Computer Use` 服务,已经包装成 `MCP` 协议,支持所有的 AI Agent 或 MCP Client 快速调用,实现 macOS、Linux 和 Windows 上的 `Computer Use` 能力。macOS 侧以 app bundle 分发,Windows 和 Linux runtime 用 Go 生成独立二进制,暴露同样的 9 个 tool。项目的背后是 OpenAI 刚发布的 [Codex Computer Use](https://openai.com/index/codex-for-almost-everything/),让我看到了基于 Accessibility 可以实现非抢占式 CUA 能力,因此决定复刻一个开源版本@@ -16,16 +16,18 @@ https://github.com/user-attachments/assets/eacb3b15-f939-46c7-b3b3-6f876977a58d## Quick Start-当前 npm 包发布的是 macOS app bundle,先全局安装:+当前 npm 包会安装 root launcher,并按当前 `os-arch` 拉起对应 native package:```bashnpm i -g open-computer-use```-第一次使用前,给你实际准备长期保留的那个 `Open Computer Use.app` 授予 macOS 的 `Accessibility` 和 `Screen Recording` 权限。CI 产出的 release 包继续作为正式分发身份;本地 debug/dev 构建会故意打成 `Open Computer Use (Dev).app`,这样系统设置里会明确显示成一个开发版 app,而不是再出现两个同名的 `Open Computer Use`。+macOS 第一次使用前,给你实际准备长期保留的那个 `Open Computer Use.app` 授予 `Accessibility` 和 `Screen Recording` 权限。CI 产出的 release 包继续作为正式分发身份;本地 debug/dev 构建会故意打成 `Open Computer Use (Dev).app`,这样系统设置里会明确显示成一个开发版 app,而不是再出现两个同名的 `Open Computer Use`。++Linux 和 Windows 需要跑在已登录桌面 session 里,这样 AT-SPI2 或 UI Automation 才能看到 GUI app。先用下面的命令确认 native package 已经接好:```bash-open-computer-use+open-computer-use --version```接着把它配到你的 MCP client 里:diff --git a/apps/OpenComputerUseLinux/main.go b/apps/OpenComputerUseLinux/main.goindex 0aaa53d..d4cccc1 100644--- a/apps/OpenComputerUseLinux/main.go+++ b/apps/OpenComputerUseLinux/main.go@@ -17,7 +17,7 @@ import ("time")-var version = "0.1.28"+var version = "0.1.34"//go:embed runtime.pyvar linuxRuntimeScript stringdiff --git a/apps/OpenComputerUseSmokeSuite/Sources/OpenComputerUseSmokeSuite/main.swift b/apps/OpenComputerUseSmokeSuite/Sources/OpenComputerUseSmokeSuite/main.swiftindex 2d22c22..55c9688 100644--- a/apps/OpenComputerUseSmokeSuite/Sources/OpenComputerUseSmokeSuite/main.swift+++ b/apps/OpenComputerUseSmokeSuite/Sources/OpenComputerUseSmokeSuite/main.swift@@ -35,7 +35,7 @@ final class MCPClient {_ = try request(method: "initialize", params: ["clientInfo": ["name": "OpenComputerUseSmokeSuite",- "version": "0.1.33",+ "version": "0.1.34",],"capabilities": [:],"protocolVersion": "2025-03-26",diff --git a/apps/OpenComputerUseWindows/main.go b/apps/OpenComputerUseWindows/main.goindex ec70522..7e2eafb 100644--- a/apps/OpenComputerUseWindows/main.go+++ b/apps/OpenComputerUseWindows/main.go@@ -16,7 +16,7 @@ import ("time")-var version = "0.1.28"+var version = "0.1.34"//go:embed runtime.ps1var windowsRuntimeScript stringdiff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex 8fef15f..6118200 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -11,9 +11,9 @@- `apps/OpenComputerUseSmokeSuite`端到端 smoke runner,会拉起 fixture 和 MCP server,并通过 JSON-RPC 真实调用 9 个 tools;同时也支持单独的 visual cursor idle smoke,用跨进程 observation file 断言等待下一次 move 时是 anchored tip + tiny rotate wobble,而不是横向漂移。- `apps/OpenComputerUseWindows`- 实验性 Windows runtime。它不依赖 Swift 或 `.app` bundle,Go CLI/MCP 入口会嵌入 PowerShell UI Automation bridge,构建产物是 `open-computer-use.exe`。+ 实验性 Windows runtime。它不依赖 Swift 或 `.app` bundle,Go CLI/MCP 入口会嵌入 PowerShell UI Automation bridge,构建产物是 `open-computer-use.exe`,并通过 `open-computer-use-win32-arm64` / `open-computer-use-win32-x64` npm platform packages 分发。- `apps/OpenComputerUseLinux`- 实验性 Linux runtime。它不依赖 Swift 或 `.app` bundle,Go CLI/MCP 入口会嵌入 Python AT-SPI bridge,构建产物是 `open-computer-use`。+ 实验性 Linux runtime。它不依赖 Swift 或 `.app` bundle,Go CLI/MCP 入口会嵌入 Python AT-SPI bridge,构建产物是 `open-computer-use`,并通过 `open-computer-use-linux-arm64` / `open-computer-use-linux-x64` npm platform packages 分发。- `packages/OpenComputerUseKit`核心库,包含:- MCP stdio transport 与 tool registry@@ -101,7 +101,7 @@### 6. Windows Runtime- Windows runtime 位于 `apps/OpenComputerUseWindows`,以 Go 维护 CLI、`call --calls` sequence、MCP JSON-RPC、tool schema 和进程内 snapshot cache。-- 构建入口是 `scripts/build-open-computer-use-windows.sh --arch arm64|amd64`,默认输出到 `dist/windows/<arch>/open-computer-use.exe`;当前 npm 包仍只发布 macOS app bundle,Windows 分发还没有接入 release package。+- 构建入口是 `scripts/build-open-computer-use-windows.sh --arch arm64|amd64`,默认输出到 `dist/windows/<arch>/open-computer-use.exe`;npm release package 会把它们分别封装为 `open-computer-use-win32-arm64` 和 `open-computer-use-win32-x64`,由 root `open-computer-use` package 的 `optionalDependencies` 按 `process.platform/process.arch` 自动选择。- Go runtime 通过 `go:embed` 带上 `runtime.ps1`,执行 tool call 时临时落盘并调用 Windows PowerShell。PowerShell bridge 使用 `System.Windows.Automation` 做 app/window/element discovery、tree rendering、UIA pattern action、ValuePattern set value 和 ScrollPattern scroll;当目标 app 不暴露对应 pattern 时,fallback 到 `PostMessage` / `SendMessage` 形式的 Win32 window message。- Windows runtime 默认只连接已经运行的 app,不会在 `get_app_state` 找不到进程时自动 `Start-Process`,也不会默认允许 `SetFocus` secondary action;这两条前台抢占路径分别需要 `OPEN_COMPUTER_USE_WINDOWS_ALLOW_APP_LAUNCH=1` 和 `OPEN_COMPUTER_USE_WINDOWS_ALLOW_FOCUS_ACTIONS=1` 显式打开。`type_text` 默认优先对可写文本控件的 child HWND 发送 `EM_SETSEL` / `EM_REPLACESEL`,不再默认走可能触发前台激活的 UIA `ValuePattern.SetValue` fallback;需要旧行为时必须设置 `OPEN_COMPUTER_USE_WINDOWS_ALLOW_UIA_TEXT_FALLBACK=1`。UIA pattern 和 Win32 message fallback 本身仍是 best-effort:很多控件可以在后台响应,但 Windows 没有一套对所有 GUI toolkit 都等价于 macOS AX 的后台键鼠输入模型。- 这 9 个 tool 的协议面与 macOS 主线保持一致:`list_apps`、`get_app_state`、`click`、`perform_secondary_action`、`scroll`、`drag`、`type_text`、`press_key`、`set_value`。其中 element-targeted action 会优先复用上一轮 `get_app_state` 的 runtime id / automation metadata,coordinate action 使用 screenshot/window-relative 坐标。@@ -111,13 +111,13 @@### 7. Linux Runtime- Linux runtime 位于 `apps/OpenComputerUseLinux`,以 Go 维护 CLI、`call --calls` sequence、MCP JSON-RPC、tool schema 和进程内 snapshot cache。-- 构建入口是 `scripts/build-open-computer-use-linux.sh --arch arm64|amd64`,默认输出到 `dist/linux/<arch>/open-computer-use`;当前 npm 包仍只发布 macOS app bundle,Linux 分发还没有接入 release package。+- 构建入口是 `scripts/build-open-computer-use-linux.sh --arch arm64|amd64`,默认输出到 `dist/linux/<arch>/open-computer-use`;npm release package 会把它们分别封装为 `open-computer-use-linux-arm64` 和 `open-computer-use-linux-x64`,由 root `open-computer-use` package 的 `optionalDependencies` 按 `process.platform/process.arch` 自动选择。- Go runtime 通过 `go:embed` 带上 `runtime.py`,执行 tool call 时临时落盘并调用 `python3`。Python bridge 使用 GNOME/GObject Introspection 暴露的 AT-SPI2 接口做 app/window discovery、accessibility tree rendering、semantic action、editable text、value set,以及 best-effort 的 key/mouse fallback。- Linux 上最接近 macOS AX 的是 AT-SPI2/D-Bus accessibility,而不是一套统一的后台键鼠输入模型。第一版优先使用元素暴露的 AT-SPI action、EditableText 和 Value 接口;coordinate `click` / `drag` 与 `press_key` 使用 AT-SPI event synthesis fallback,在 Wayland 下只能按 best-effort 处理。- Linux runtime 需要运行在已登录桌面用户 session 里,并带有 `XDG_RUNTIME_DIR`、`DBUS_SESSION_BUS_ADDRESS` 和 display 环境。纯 SSH tty 可以启动二进制,但不能直接 inspect 或操作 GUI session;实机验证时通过 `runuser -u <desktop-user>` 挂到 `/run/user/<uid>/bus`。- `get_app_state` 的 accessibility tree 在 GTK/GNOME app 上可能很深,Linux bridge 当前把 traversal depth 放宽到 64。截图通过 GDK root window best-effort capture;GNOME Wayland 可能返回黑图,bridge 会检测全黑采样并省略 image block。- 这 9 个 tool 的协议面与 macOS / Windows 保持一致:`list_apps`、`get_app_state`、`click`、`perform_secondary_action`、`scroll`、`drag`、`type_text`、`press_key`、`set_value`。其中 element-targeted action 会优先复用上一轮 `get_app_state` 的 runtime path metadata,coordinate action 使用 screenshot/window-relative 坐标。-- 当前 Linux 侧仍是功能性第一版:没有 visual cursor overlay、没有 installer/desktop entry、没有 release artifact,也没有独立 Linux fixture。后续 TODO 记录在 `docs/exec-plans/active/20260422-linux-computer-use-runtime.md`。+- 当前 Linux 侧仍是功能性第一版:没有 visual cursor overlay、没有 installer/desktop entry,也没有独立 Linux fixture。后续 TODO 记录在 `docs/exec-plans/active/20260422-linux-computer-use-runtime.md`。## 关键边界diff --git a/docs/CICD.md b/docs/CICD.mdindex bef3c4e..e84f9b0 100644--- a/docs/CICD.md+++ b/docs/CICD.md@@ -4,9 +4,10 @@## 当前 release 入口-- `scripts/release-package.sh`:构建 universal `Open Computer Use.app`,stage 三个 npm 包目录,并产出 `dist/release/npm/*.tgz` 与 `dist/release/release-manifest.json`。当前 CI 继续显式使用 ad-hoc signing,保持和此前发布链路一致;本地 debug/dev 构建则允许使用开发机自己的签名身份。+- `scripts/release-package.sh`:构建 universal `Open Computer Use.app`,cross-compile Linux / Windows runtime,stage 三个 root npm 包和六个 `open-computer-use-<os>-<arch>` platform packages,并产出 `dist/release/npm/*.tgz` 与 `dist/release/release-manifest.json`。当前 CI 继续显式使用 ad-hoc signing,保持和此前发布链路一致;本地 debug/dev 构建则允许使用开发机自己的签名身份。- `scripts/build-cursor-motion-dmg.sh`:本地构建 `Cursor Motion.app` 并封装 `dist/release/cursor-motion/CursorMotion-<version>.dmg`,支持 `native` / `arm64` / `x86_64` / `universal`。-- `scripts/build-open-computer-use-linux.sh`:本地构建实验性 Linux `open-computer-use` binary,支持 `arm64` / `amd64`;当前还没有接入正式 release package。+- `scripts/build-open-computer-use-linux.sh`:本地构建实验性 Linux `open-computer-use` binary,支持 `arm64` / `amd64`;release package 会把这两个产物封装进对应 npm platform packages。+- `scripts/build-open-computer-use-windows.sh`:本地构建实验性 Windows `open-computer-use.exe`,支持 `arm64` / `amd64`;release package 会把这两个产物封装进对应 npm platform packages。- `.github/workflows/release.yml`:支持 push semver tag 自动发布,也支持手动触发;tag push 时会同时跑 npm release 打包逻辑与 `Cursor Motion` 的 DMG 打包,并把 `.dmg` 上传到对应的 GitHub Releases 页面。`Open Computer Use` 的 npm 产物默认走 ad-hoc signing;如果配置了 `OPEN_COMPUTER_USE_CODESIGN_*` secrets,则会先导入 `Developer ID Application` 证书,再按同一 identity 对 release `.app` 统一签名。`Cursor Motion` 的 DMG 也会复用同一张 `Developer ID Application` 证书签 app;若同时配置 `APPLE_NOTARY_*` secrets,则会在上传前对 `.dmg` 做 notarization 和 staple。## 设计原则@@ -33,6 +34,12 @@- `dist/release/npm/open-computer-use-<version>.tgz`- `dist/release/npm/open-computer-use-mcp-<version>.tgz`- `dist/release/npm/open-codex-computer-use-mcp-<version>.tgz`+- `dist/release/npm/open-computer-use-darwin-arm64-<version>.tgz`+- `dist/release/npm/open-computer-use-darwin-x64-<version>.tgz`+- `dist/release/npm/open-computer-use-linux-arm64-<version>.tgz`+- `dist/release/npm/open-computer-use-linux-x64-<version>.tgz`+- `dist/release/npm/open-computer-use-win32-arm64-<version>.tgz`+- `dist/release/npm/open-computer-use-win32-x64-<version>.tgz`- `dist/release/cursor-motion/CursorMotion-<version>.dmg`- GitHub Actions 中上传的 npm release artifact- GitHub Releases 中和 tag 对齐的 `CursorMotion-<version>.dmg`diff --git a/docs/QUALITY_SCORE.md b/docs/QUALITY_SCORE.mdindex a711120..6d20e11 100644--- a/docs/QUALITY_SCORE.md+++ b/docs/QUALITY_SCORE.md@@ -12,8 +12,8 @@| 区域 | 评分 | 原因 | 下一步 || --- | --- | --- | --- || 产品面 | B | 已经有 Swift 本地 `computer-use` MCP server、默认 app 模式权限引导,以及一轮按官方 surface / result 行为收敛过的 9 个 tools。 | 继续收敛复杂 AX 场景下的 state rendering 细节、权限 UI 和更清晰的用户错误提示。 |-| Windows runtime | C | 已新增独立 Go `.exe`,通过 Windows UI Automation + Win32 window message 暴露同样 9 个 tools、MCP server 和 `call --calls`;默认不再自动启动 app、执行 `SetFocus`,或让 `type_text` 走可能抢前台的 UIA text fallback,但仍是功能性第一版。 | 补交互式桌面 smoke、Windows fixture、installer/signing/release 分发,以及更原生的 Go UIA 实现或更稳定的 bridge。 |-| Linux runtime | C | 已新增独立 Go binary,通过 Python GI / AT-SPI2 暴露同样 9 个 tools、MCP server 和 `call --calls`;Ubuntu GNOME VM 已跑通 `list_apps`、MCP tools list 和 Text Editor 8-tool sequence,但截图在 GNOME Wayland 下仍只能 best-effort,coordinate input 也不是通用后台模型。 | 补 Linux fixture、可重复 smoke runner、release artifact、portal/compositor screenshot 路径,以及更原生的 Go D-Bus/libatspi bridge。 |+| Windows runtime | C | 已新增独立 Go `.exe`,通过 Windows UI Automation + Win32 window message 暴露同样 9 个 tools、MCP server 和 `call --calls`;默认不再自动启动 app、执行 `SetFocus`,或让 `type_text` 走可能抢前台的 UIA text fallback,并已接入 npm platform package 分发,但仍是功能性第一版。 | 补交互式桌面 smoke、Windows fixture、installer/signing,以及更原生的 Go UIA 实现或更稳定的 bridge。 |+| Linux runtime | C | 已新增独立 Go binary,通过 Python GI / AT-SPI2 暴露同样 9 个 tools、MCP server 和 `call --calls`;Ubuntu GNOME VM 已跑通 `list_apps`、MCP tools list 和 Text Editor 8-tool sequence,并已接入 npm platform package 分发,但截图在 GNOME Wayland 下仍只能 best-effort,coordinate input 也不是通用后台模型。 | 补 Linux fixture、可重复 smoke runner、portal/compositor screenshot 路径,以及更原生的 Go D-Bus/libatspi bridge。 || 架构文档 | B | 顶层结构、fixture bridge、app 模式和验证路径已经落文档。 | 后续补 release artifact、code signing / notarization 和 host 集成方式。 || 测试 | B | `swift test` + smoke suite 已覆盖 9 个 tools 的回归,并新增了针对“前台焦点是否被抢占”的手工对比样本沉淀。 | 增加更多普通 app 的录制回归,减少只依赖 fixture 和一次性手工检查。 || 可观测性 | C | 已有 `doctor`、`snapshot`、smoke 输出,以及一组仓库内留档的官方 `computer-use` / 本仓库实现对比样本。 | 补统一日志级别、失败上下文和 release artifact 里的诊断信息,把一次性样本收敛成可重复采集流程。 |diff --git a/docs/exec-plans/active/20260422-linux-computer-use-runtime.md b/docs/exec-plans/active/20260422-linux-computer-use-runtime.mdindex ece7d1c..2b3bca3 100644--- a/docs/exec-plans/active/20260422-linux-computer-use-runtime.md+++ b/docs/exec-plans/active/20260422-linux-computer-use-runtime.md@@ -15,7 +15,7 @@- 架构文档、README、质量说明和 history。- 不包含:- 替换 macOS Swift 主线。- - Linux installer、desktop entry、system package、code signing 或 npm release artifact。+ - Linux installer、desktop entry、system package 或 code signing。- visual cursor overlay。- 完整 Linux fixture / 可重复 smoke runner。@@ -51,7 +51,7 @@1. 确认 Linux 可用接口和边界。2. 完成 Linux Go runtime、Python AT-SPI bridge 和 9-tool 功能性实现。3. 完成本地单测、交叉编译和 Ubuntu GNOME VM 9-tool smoke。-4. 后续补 Linux fixture、可重复 smoke runner、release artifact 和更稳定截图方案。+4. 后续补 Linux fixture、可重复 smoke runner、system package 和更稳定截图方案。## 验证方式@@ -84,7 +84,7 @@- [x] 在 Ubuntu VM 中验证 8-tool sequence:`get_app_state`、`set_value`、`type_text`、`press_key`、`perform_secondary_action`、`click`、`scroll`、`drag` 均 `isError=false`。- [ ] 增加 Linux fixture 和可重复 smoke runner。- [ ] 评估 xdg-desktop-portal / compositor-specific screenshot 路径,补非黑图 capture。-- [ ] 将 Linux artifact 接入 release packaging。+- [x] 将 Linux artifact 接入 npm release packaging,通过 `open-computer-use-linux-arm64` / `open-computer-use-linux-x64` platform packages 分发。- [ ] 评估用原生 Go D-Bus/libatspi 替换 Python GI bridge 的收益和风险。## 决策记录@@ -94,3 +94,4 @@- 2026-04-22:Linux 默认使用 AT-SPI semantic action / editable text / value;coordinate mouse、drag、keyboard synthesis 作为 best-effort fallback,并在 MCP instructions 中明确不是通用 Wayland background input。- 2026-04-22:GNOME Text Editor 的 AT-SPI tree 深度超过 Windows runtime 沿用的 16 层,Linux bridge 单独把 traversal depth 放宽到 64。- 2026-04-22:GNOME Wayland 下 GDK root capture 在 VM 上返回黑图;Linux bridge 检测全黑采样后省略 image block,后续再评估 portal/compositor-specific capture。+- 2026-04-23:Linux release artifact 接入 npm platform package,不新增系统 installer;root `open-computer-use` package 通过 optional dependency 按 `linux-arm64` / `linux-x64` 自动选择 binary。diff --git a/docs/exec-plans/active/20260422-windows-computer-use-runtime.md b/docs/exec-plans/active/20260422-windows-computer-use-runtime.mdindex c3a4916..7eebd43 100644--- a/docs/exec-plans/active/20260422-windows-computer-use-runtime.md+++ b/docs/exec-plans/active/20260422-windows-computer-use-runtime.md@@ -14,7 +14,7 @@- 架构文档、README 和 history。- 不包含:- 替换 macOS Swift 主线。- - Windows installer、code signing、npm release artifact。+ - Windows installer、code signing。- visual cursor overlay。- 完整 Windows fixture / smoke suite。@@ -48,7 +48,7 @@1. 完成 Windows Go runtime 骨架和 9-tool 功能性实现。2. 完成 `.exe` 构建脚本、Go 单测、MCP/tools list 和 SSH 基础验证。-3. 补交互式桌面 smoke、Windows fixture、release packaging 和更原生 UIA 实现。+3. 补交互式桌面 smoke、Windows fixture、installer/signing 和更原生 UIA 实现。## 验证方式@@ -81,7 +81,8 @@- [ ] 增加 Windows fixture 和可重复 smoke runner。- [ ] 评估用 `PrintWindow` / Windows Graphics Capture 补一条不依赖窗口可见性的 background screenshot 路径。- [ ] 为必须依赖前台输入的 app/toolkit 场景补更明确的 capability/error,避免静默退到抢焦点行为。-- [ ] 将 Windows artifact 接入 release packaging,并补 signing / installer 方案。+- [x] 将 Windows artifact 接入 npm release packaging,通过 `open-computer-use-win32-arm64` / `open-computer-use-win32-x64` platform packages 分发。+- [ ] 补 Windows signing / installer 方案。- [ ] 评估把 PowerShell bridge 替换为原生 Go COM/UIA 的收益和风险。## 决策记录@@ -95,3 +96,4 @@- 2026-04-22:为避免 Windows tools 主动抢占用户焦点,`Resolve-App` 默认不再 `Start-Process` 目标 app,`SetFocus` secondary action 默认返回错误;需要前台行为时分别设置 `OPEN_COMPUTER_USE_WINDOWS_ALLOW_APP_LAUNCH=1` 或 `OPEN_COMPUTER_USE_WINDOWS_ALLOW_FOCUS_ACTIONS=1`。- 2026-04-22:Notepad 实测反馈 `type_text` 的 UIA `ValuePattern.SetValue` 会把窗口带到前台;默认改为 child HWND `EM_REPLACESEL` 后台消息路径,旧 UIA fallback 需要 `OPEN_COMPUTER_USE_WINDOWS_ALLOW_UIA_TEXT_FALLBACK=1`。- 2026-04-22:Windows 交互式 scheduled task 验证显示新 `type_text` 能写入 Notepad 且不会把前台从 Codex 切到 Notepad;Notepad 文本控件 UIA class 为 `RichEditD2DPT`,有 child native handle,可接收 `EM_REPLACESEL`。+- 2026-04-23:Windows release artifact 接入 npm platform package,不新增系统 installer/signing;root `open-computer-use` package 通过 optional dependency 按 `win32-arm64` / `win32-x64` 自动选择 `.exe`。diff --git a/docs/exec-plans/active/20260423-cross-platform-npm-distribution.md b/docs/exec-plans/active/20260423-cross-platform-npm-distribution.mdnew file mode 100644index 0000000..613685d--- /dev/null+++ b/docs/exec-plans/active/20260423-cross-platform-npm-distribution.md@@ -0,0 +1,88 @@+# Cross-platform npm distribution++## 目标++让 `npm i -g open-computer-use` 在 macOS、Linux 和 Windows 上都能安装同一个 root package,并由 root launcher 根据当前 `os-arch` 调用对应的 native app 或 binary。++## 范围++- 包含:+ - 把 npm staging 从单一 macOS app 包改成 root/meta package + platform packages。+ - 为 `darwin-arm64`、`darwin-x64`、`linux-arm64`、`linux-x64`、`win32-arm64`、`win32-x64` 生成可发布 npm 包。+ - 调整 release/publish 顺序,先发布平台包,再发布 root/alias 包。+ - 更新 release workflow、README、架构文档、发版指南和 history。+ - bump patch version、tag release,并用 Linux VM 实测 npm 全局安装后的 MCP `tools/list`。+- 不包含:+ - 新增 Linux/Windows 图形 fixture。+ - 完成 Windows 交互式桌面 smoke。+ - 改变 9 个 tools 的协议面。++## 背景++- 相关文档:+ - `docs/ARCHITECTURE.md`+ - `docs/CICD.md`+ - `docs/releases/RELEASE_GUIDE.md`+- 相关代码路径:+ - `scripts/npm/build-packages.mjs`+ - `scripts/npm/publish-packages.mjs`+ - `scripts/release-package.sh`+ - `.github/workflows/release.yml`+ - `scripts/build-open-computer-use-linux.sh`+ - `scripts/build-open-computer-use-windows.sh`+- 已知约束:+ - 当前 npm registry 上的 `[email protected]` 仍声明 `os=["darwin"]`,Linux/Windows 不会正常安装。+ - Linux/Windows runtime 是实验性 first version,但已经暴露同一组 9 个 MCP tools。+ - root package 需要保持 `open-computer-use`、`open-computer-use-mcp`、`open-codex-computer-use-mcp` 三个历史入口。++## 风险++- 风险:root package 发布早于 platform packages,用户立刻安装时缺少 optional dependency。+ - 缓解方式:publish script 按 package 类型排序,platform packages 优先。+- 风险:用户用 `--omit=optional` 或 npm 跳过 optional dependency 后,root launcher 找不到 native runtime。+ - 缓解方式:launcher 输出明确的缺失平台包和重装命令。+- 风险:CI macOS runner 没有 Go toolchain,导致 Linux/Windows cross compile 失败。+ - 缓解方式:release workflow 显式 setup Go。+- 风险:Linux runtime 需要桌面 session,纯 SSH 不能验证 GUI 操作。+ - 缓解方式:本次 Linux 发布后验证目标限定为 npm install、版本、MCP initialize 和 `tools/list`。++## 里程碑++1. 设计并实现 npm 包结构。+2. 同步文档、history 和版本源。+3. 本地 staging / pack / MCP tools list 验证。+4. 提交、tag、推送并跟踪 release workflow。+5. Linux VM 全局 npm 安装最新版并验证 MCP tools list。++## 验证方式++- 命令:+ - `node ./scripts/npm/build-packages.mjs --out-dir dist/release/npm-staging-check`+ - `./scripts/release-package.sh`+ - `swift test`+ - `(cd apps/OpenComputerUseLinux && go test ./...)`+ - `(cd apps/OpenComputerUseWindows && go test ./...)`+ - `node ./scripts/npm/publish-packages.mjs --skip-build --out-dir dist/release/npm-staging --dry-run`+- 手工检查:+ - root packages 包含 `optionalDependencies`。+ - platform packages 包含正确的 `os` / `cpu`。+ - npm tarball 数量和 release manifest 对齐。+- 观测检查:+ - GitHub Actions release workflow 成功。+ - npm registry 最新版可见。+ - Linux VM `npm i -g open-computer-use@<version>` 后 raw MCP `tools/list` 返回 9 个 tools。++## 进度记录++- [x] 确认当前 npm 包仍是 macOS-only。+- [x] 完成 root/meta package 与 platform package staging。+- [x] 完成 publish 顺序与 CI Go toolchain 调整。+- [x] 完成版本、文档、history 同步。+- [x] 完成本地验证:staging / release tarballs / dry-run publish / Swift tests / Linux Go tests / Windows Go tests / macOS npm prefix install / MCP tools list。+- [ ] 完成 tag release、CI 跟踪、npm registry 验证。+- [ ] 完成 Linux VM npm install 与 MCP tools/list 验证。++## 决策记录++- 2026-04-23:采用 npm `optionalDependencies` + 每平台 `os`/`cpu` package,而不是 postinstall 下载制品。这样安装路径更可复现,也避免 install script 依赖额外网络下载逻辑。+- 2026-04-23:macOS 仍构建 universal `.app`,但发布为 `darwin-arm64` 和 `darwin-x64` 两个 npm platform package。这样 root launcher 统一按 `process.platform-process.arch` 做映射。diff --git a/docs/histories/2026-04/20260423-1151-add-cross-platform-npm-packages.md b/docs/histories/2026-04/20260423-1151-add-cross-platform-npm-packages.mdnew file mode 100644index 0000000..def12f0--- /dev/null+++ b/docs/histories/2026-04/20260423-1151-add-cross-platform-npm-packages.md@@ -0,0 +1,45 @@+## [2026-04-23 11:51] | Task: 三端 npm 安装按 os-arch 选择 native runtime++## 用户诉求++希望 `npm i -g open-computer-use` 在 macOS、Linux、Windows 上都能安装成功,并根据当前 `os-arch` 调用对应的 `.app`、Linux binary 或 Windows `.exe`。本轮还需要 bump patch version、tag 推送触发 release,并在 Linux VM 上实测 npm 全局安装后的 MCP tools list。++## 主要改动++- **[NPM Packaging]**: 将 npm staging 从单一 macOS package 改为三个 root/alias packages 加六个 platform packages:`darwin-arm64`、`darwin-x64`、`linux-arm64`、`linux-x64`、`win32-arm64`、`win32-x64`。+- **[Runtime Launcher]**: root package 的 `bin/open-computer-use` 改为跨平台 Node launcher,通过 `process.platform` / `process.arch` 解析并执行对应 native package;缺少 optional dependency 时给出明确重装提示。+- **[Release Flow]**: release package 构建现在会同时构建 macOS app、Linux binaries、Windows exes;publish script 会先发布 platform packages,再发布 root/alias packages。+- **[Plugin Path]**: Codex plugin launcher 和 installer 增加 Linux / Windows native payload fallback,保留 macOS app bundle 路径。+- **[Version Bump]**: 将插件 manifest、Swift 版本常量、Linux/Windows Go runtime、smoke/test 输入和 CLI helper 文档统一 bump 到 `0.1.34`。+- **[Docs]**: 同步 README、中文 README、架构文档、CI/CD、质量说明、release guide、feature release notes 和相关 execution plans。++## 设计动机++使用 npm 原生的 `optionalDependencies`、`os`、`cpu` 机制,而不是 postinstall 下载制品。这样 root package 可以保持一个用户入口,平台包由 npm 根据当前环境选择,安装路径也更容易复现和审计。macOS 继续构建 universal `.app`,但拆成 `darwin-arm64` / `darwin-x64` 两个 npm platform packages,让 launcher 的映射规则在三端保持一致。++## 受影响文件++- `.github/workflows/release.yml`+- `scripts/npm/build-packages.mjs`+- `scripts/npm/publish-packages.mjs`+- `scripts/install-codex-plugin.sh`+- `plugins/open-computer-use/scripts/launch-open-computer-use.sh`+- `plugins/open-computer-use/.codex-plugin/plugin.json`+- `apps/OpenComputerUseLinux/main.go`+- `apps/OpenComputerUseWindows/main.go`+- `packages/OpenComputerUseKit/Sources/OpenComputerUseKit/OpenComputerUseVersion.swift`+- `docs/`++## 验证++- 通过:`node ./scripts/npm/build-packages.mjs --out-dir dist/release/npm-staging-check`+- 通过:`./scripts/release-package.sh`+- 通过:本地 npm prefix 安装 `open-computer-use-0.1.34.tgz` + `open-computer-use-darwin-arm64-0.1.34.tgz` 后,`open-computer-use --version` 输出 `0.1.34`。+- 通过:本地 npm prefix 安装后的 `open-computer-use mcp` raw JSON-RPC `tools/list` 返回 9 个 tools。+- 通过:`swift test`+- 通过:`(cd apps/OpenComputerUseLinux && go test ./...)`+- 通过:`(cd apps/OpenComputerUseWindows && go test ./...)`+- 通过:`node ./scripts/npm/publish-packages.mjs --skip-build --out-dir dist/release/npm-staging --dry-run`,发布顺序为六个 platform packages 先于三个 root/alias packages。+- 通过:`git diff --check`+- 待补:GitHub Actions release workflow。+- 待补:Linux VM npm 全局安装和 MCP `tools/list`。diff --git a/docs/releases/RELEASE_GUIDE.md b/docs/releases/RELEASE_GUIDE.mdindex a8c8a3d..d1cd7e0 100644--- a/docs/releases/RELEASE_GUIDE.md+++ b/docs/releases/RELEASE_GUIDE.md@@ -31,7 +31,7 @@也就是说:- 只改 git tag,不改这个 manifest,不会得到新 npm 版本。-- `scripts/npm/build-packages.mjs` 会从这个 manifest 读取版本,再生成三个 staging 包。+- `scripts/npm/build-packages.mjs` 会从这个 manifest 读取版本,再生成三个 root/alias staging 包和六个 `open-computer-use-<os>-<arch>` platform staging 包。- 所以 release 前必须先把这份 manifest bump 到目标版本。- 如果要让 `CursorMotion` 的 DMG 文件名和 release 页面资产名正确落到目标版本,也必须使用目标 tag 推送,或本地显式传入同样的 `--version`。@@ -45,6 +45,8 @@- `packages/OpenComputerUseKit/Sources/OpenComputerUseKit/OpenComputerUseVersion.swift`- `apps/OpenComputerUseSmokeSuite/Sources/OpenComputerUseSmokeSuite/main.swift`- `packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/OpenComputerUseKitTests.swift`+- `apps/OpenComputerUseLinux/main.go`+- `apps/OpenComputerUseWindows/main.go`- `scripts/computer-use-cli/main.go`- `scripts/computer-use-cli/README.md`- `docs/releases/feature-release-notes.md`@@ -65,7 +67,9 @@ node ./scripts/npm/build-packages.mjs --out-dir dist/release/npm-staging-check然后直接检查 staging 包版本和 DMG 文件名:```bash-node -p "require('./dist/release/npm-staging-check/open-codex-computer-use-mcp/package.json').version"+node -p "require('./dist/release/npm-staging-check/open-computer-use/package.json').version"+node -p "require('./dist/release/npm-staging-check/open-computer-use-linux-arm64/package.json').version"+node -p "require('./dist/release/npm-staging-check/open-computer-use/package.json').optionalDependencies['open-computer-use-linux-arm64']"ls dist/release/cursor-motion/CursorMotion-0.1.14.dmg```@@ -142,6 +146,7 @@ gh run view -R iFurySt/open-codex-computer-use <run-id> --log-failed- `Open Computer Use` 的 npm release 产物在没有配置 `OPEN_COMPUTER_USE_CODESIGN_P12_BASE64` / `OPEN_COMPUTER_USE_CODESIGN_P12_PASSWORD` 等 secrets 时,仍会退回 ad-hoc signing;配置后会先导入 `Developer ID Application` 证书,再按该 identity 统一签名。- `Cursor Motion` 当前 release 资产会优先复用 `OPEN_COMPUTER_USE_CODESIGN_*` 对 app 做 `Developer ID Application` 签名;如果同时配置 `APPLE_NOTARY_API_KEY_P8_BASE64`、`APPLE_NOTARY_KEY_ID`、`APPLE_NOTARY_ISSUER_ID`、`APPLE_DEVELOPER_TEAM_ID`,workflow 会继续对 `.dmg` 执行 notarization 和 staple。- 如果上述 secrets 缺失,workflow 会分别退回 ad-hoc signing 或跳过 notarization,而不是阻塞整条 release。+- `open-computer-use` npm root 包通过 `optionalDependencies` 拉取 platform packages。如果用户安装时使用 `--omit=optional`,root launcher 会缺少 native runtime 并给出重装提示;release 前要确认 platform packages 先于 root/alias packages 发布。## 如果 tag 已经打错了diff --git a/docs/releases/feature-release-notes.md b/docs/releases/feature-release-notes.mdindex daef138..71d650e 100644--- a/docs/releases/feature-release-notes.md+++ b/docs/releases/feature-release-notes.md@@ -4,6 +4,7 @@| 日期 | 功能域 | 用户价值 | 变更摘要 || --- | --- | --- | --- |+| 2026-04-23 | 三端 npm 安装 | `npm i -g open-computer-use` 现在会根据当前 `os-arch` 安装并调用对应的 macOS `.app`、Linux binary 或 Windows `.exe`,不再把 npm 分发锁死在 macOS。 | 发布 `0.1.34`,把 npm 包改成 root/meta package + `open-computer-use-<os>-<arch>` platform packages,通过 `optionalDependencies` 和跨平台 Node launcher 选择 native runtime,并让 release workflow 同时构建 macOS、Linux、Windows 制品。 || 2026-04-22 | Gemini / opencode MCP 安装 | Gemini CLI 和 opencode 用户现在也能像 Claude Code / Codex 一样用仓库内置命令完成 `open-computer-use` 的 MCP 接入,不需要再手动查各自配置格式。 | 发布 `0.1.33`,新增 `install-gemini-mcp` 和 `install-opencode-mcp`,将 npm launcher、README 与共享配置 helper 一并补齐,并让 Gemini 默认 project-scope 配置不会污染仓库 git 状态。 || 2026-04-22 | 发布版本重新对齐 | GitHub Release tag、插件 manifest 和仓库内版本常量重新回到同一个版本线;后续本地安装、staging 和诊断不会再出现 “release 已是新版本,但产物仍显示旧值” 的混乱状态。 | 发布 `0.1.32`,在远端 `v0.1.31` 已存在的前提下,将 `plugin.json`、Swift 版本常量、smoke/test 初始化请求和 CLI helper 文档统一 bump 到 `0.1.32`,为下一次 release 保持单一版本源。 || 2026-04-22 | 视觉光标落点与空闲态收口 | Retina 窗口里的坐标点击更准确,visual cursor 在等待下一次动作时也更稳定、更接近官方观感。 | 发布 `0.1.31`,修复 screenshot pixel 到 window point 的映射,避免 `click({x,y})` 在高分屏上点偏;同时把 idle cursor 收敛为 30 秒停驻、保持压在目标窗口之上,并将等待态改成 anchored tip + tiny rotate wobble。 |diff --git a/packages/OpenComputerUseKit/Sources/OpenComputerUseKit/OpenComputerUseVersion.swift b/packages/OpenComputerUseKit/Sources/OpenComputerUseKit/OpenComputerUseVersion.swiftindex 1cb19ef..291e9a7 100644--- a/packages/OpenComputerUseKit/Sources/OpenComputerUseKit/OpenComputerUseVersion.swift+++ b/packages/OpenComputerUseKit/Sources/OpenComputerUseKit/OpenComputerUseVersion.swift@@ -1,6 +1,6 @@import Foundation-public let openComputerUseVersion = "0.1.33"+public let openComputerUseVersion = "0.1.34"public func resolvedOpenComputerUseVersion(bundle: Bundle = .main) -> String {if let version = bundle.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String,diff --git a/packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/OpenComputerUseKitTests.swift b/packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/OpenComputerUseKitTests.swiftindex ef58dd0..b73e4e7 100644--- a/packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/OpenComputerUseKitTests.swift+++ b/packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/OpenComputerUseKitTests.swift@@ -325,7 +325,7 @@ final class OpenComputerUseKitTests: XCTestCase {func testInitializeResponseContainsToolsCapability() throws {let server = StdioMCPServer(service: ComputerUseService())- let response = server.handle(line: #"{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","clientInfo":{"name":"test","version":"0.1.33"},"capabilities":{}}}"#)+ let response = server.handle(line: #"{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","clientInfo":{"name":"test","version":"0.1.34"},"capabilities":{}}}"#)XCTAssertNotNil(response)XCTAssertTrue(response!.contains(#""name":"open-computer-use""#))XCTAssertTrue(response!.contains(#""tools":{"listChanged":false}"#))@@ -334,7 +334,7 @@ final class OpenComputerUseKitTests: XCTestCase {func testInitializeResponseContainsComputerUseInstructions() throws {let server = StdioMCPServer(service: ComputerUseService())let response = try XCTUnwrap(- server.handle(line: #"{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","clientInfo":{"name":"test","version":"0.1.33"},"capabilities":{}}}"#)+ server.handle(line: #"{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","clientInfo":{"name":"test","version":"0.1.34"},"capabilities":{}}}"#))let data = try XCTUnwrap(response.data(using: .utf8))let json = try XCTUnwrap(JSONSerialization.jsonObject(with: data) as? [String: Any])diff --git a/plugins/open-computer-use/.codex-plugin/plugin.json b/plugins/open-computer-use/.codex-plugin/plugin.jsonindex 0d9d156..8089cd3 100644--- a/plugins/open-computer-use/.codex-plugin/plugin.json+++ b/plugins/open-computer-use/.codex-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "open-computer-use",- "version": "0.1.33",- "description": "Open-source macOS Computer Use MCP server packaged as a Codex plugin.",+ "version": "0.1.34",+ "description": "Open-source cross-platform Computer Use MCP server packaged as a Codex plugin.","author": {"name": "Leo","url": "https://github.com/iFurySt"@@ -19,8 +19,8 @@"mcpServers": "./.mcp.json","interface": {"displayName": "Open Computer Use",- "shortDescription": "Control macOS apps from Codex with the open local server",- "longDescription": "Open Computer Use packages this repository's open-source macOS automation server as a Codex plugin. It exposes the same nine desktop-control MCP tools through the locally built OpenComputerUse app bundle, with an AX-first and keyboard-first strategy that tries to avoid stealing focus until global pointer input is truly required.",+ "shortDescription": "Control desktop apps from Codex with the open local server",+ "longDescription": "Open Computer Use packages this repository's open-source desktop automation server as a Codex plugin. It exposes the same nine desktop-control MCP tools through a local macOS app bundle or Linux / Windows native binary, with semantic accessibility paths preferred before fallback input.","developerName": "Leo","category": "Productivity","capabilities": [@@ -32,7 +32,7 @@"privacyPolicyURL": "https://github.com/iFurySt/open-codex-computer-use/blob/main/SECURITY.md","termsOfServiceURL": "https://github.com/iFurySt/open-codex-computer-use/blob/main/LICENSE","defaultPrompt": [- "Inspect the current UI state of this Mac app without stealing focus when possible",+ "Inspect the current UI state of this desktop app without stealing focus when possible","Open a new local document with keyboard shortcuts first, then type content without moving my real pointer unless required","Drive the fixture app and verify the nine computer-use tools still behave correctly"],diff --git a/plugins/open-computer-use/scripts/launch-open-computer-use.sh b/plugins/open-computer-use/scripts/launch-open-computer-use.shindex 686c2dd..6c0404b 100755--- a/plugins/open-computer-use/scripts/launch-open-computer-use.sh+++ b/plugins/open-computer-use/scripts/launch-open-computer-use.sh@@ -8,9 +8,15 @@ candidate_binaries=("${plugin_root}/Open Computer Use.app/Contents/MacOS/OpenComputerUse""${plugin_root}/Open Computer Use (Dev).app/Contents/MacOS/OpenComputerUse""${plugin_root}/OpenComputerUse.app/Contents/MacOS/OpenComputerUse"+ "${plugin_root}/open-computer-use"+ "${plugin_root}/open-computer-use.exe""${repo_root}/dist/Open Computer Use (Dev).app/Contents/MacOS/OpenComputerUse""${repo_root}/dist/Open Computer Use.app/Contents/MacOS/OpenComputerUse""${repo_root}/dist/OpenComputerUse.app/Contents/MacOS/OpenComputerUse"+ "${repo_root}/dist/linux/arm64/open-computer-use"+ "${repo_root}/dist/linux/amd64/open-computer-use"+ "${repo_root}/dist/windows/arm64/open-computer-use.exe"+ "${repo_root}/dist/windows/amd64/open-computer-use.exe")for app_binary in "${candidate_binaries[@]}"; do@@ -24,10 +30,15 @@ for app_binary in "${candidate_binaries[@]}"; dofidone-echo "open-computer-use could not find a runnable app bundle." >&2+if command -v open-computer-use >/dev/null 2>&1; then+ exec open-computer-use mcp+fi++echo "open-computer-use could not find a runnable native runtime." >&2echo "Checked:" >&2for app_binary in "${candidate_binaries[@]}"; doecho " - ${app_binary}" >&2done+echo " - open-computer-use on PATH" >&2echo "Run ./scripts/install-codex-plugin.sh to populate the Codex plugin cache." >&2exit 1diff --git a/scripts/computer-use-cli/README.md b/scripts/computer-use-cli/README.mdindex 199379c..a34d7b8 100644--- a/scripts/computer-use-cli/README.md+++ b/scripts/computer-use-cli/README.md@@ -131,7 +131,7 @@ Example working invocation against `open-computer-use`:```bashgo run . list-tools \--transport direct \- --server-bin ~/.codex/plugins/cache/open-computer-use-local/open-computer-use/0.1.33/scripts/launch-open-computer-use.sh+ --server-bin ~/.codex/plugins/cache/open-computer-use-local/open-computer-use/0.1.34/scripts/launch-open-computer-use.sh```Example working comparison flow against a local repo build:diff --git a/scripts/computer-use-cli/main.go b/scripts/computer-use-cli/main.goindex ebede16..983497d 100644--- a/scripts/computer-use-cli/main.go+++ b/scripts/computer-use-cli/main.go@@ -21,7 +21,7 @@ import (const (cliName = "computer-use-cli"- cliVersion = "0.1.33"+ cliVersion = "0.1.34"defaultTimeout = 60 * time.SecondpluginRootEnvVar = "COMPUTER_USE_PLUGIN_ROOT"pluginVersionEnvVar = "COMPUTER_USE_PLUGIN_VERSION"diff --git a/scripts/install-codex-plugin.sh b/scripts/install-codex-plugin.shindex 8bb0d4e..1f995b2 100755--- a/scripts/install-codex-plugin.sh+++ b/scripts/install-codex-plugin.sh@@ -10,10 +10,24 @@ marketplace_name="open-computer-use-local"plugin_name="open-computer-use"plugin_source_root="${repo_root}/plugins/${plugin_name}"plugin_manifest="${plugin_source_root}/.codex-plugin/plugin.json"-build_script="${repo_root}/scripts/build-open-computer-use-app.sh"+macos_build_script="${repo_root}/scripts/build-open-computer-use-app.sh"+linux_build_script="${repo_root}/scripts/build-open-computer-use-linux.sh"+windows_build_script="${repo_root}/scripts/build-open-computer-use-windows.sh"configuration="debug"rebuild="false"+node_arch() {+ node -p "process.arch" 2>/dev/null || true+}++go_arch_for_node_arch() {+ case "$1" in+ arm64) printf '%s\n' "arm64" ;;+ x64) printf '%s\n' "amd64" ;;+ *) return 1 ;;+ esac+}+resolve_app_bundle() {local -a candidates@@ -24,8 +38,50 @@ resolve_app_bundle() {fifor bundle_name in "${candidates[@]}"; do- local candidate="${repo_root}/dist/${bundle_name}"- if [[ -d "${candidate}" ]]; then+ for candidate in \+ "${repo_root}/dist/${bundle_name}" \+ "${repo_root}/node_modules/open-computer-use-darwin-$(node_arch)/dist/${bundle_name}" \+ "${repo_root}/../open-computer-use-darwin-$(node_arch)/dist/${bundle_name}"; do+ if [[ -d "${candidate}" ]]; then+ printf '%s\n' "${candidate}"+ return 0+ fi+ done+ done++ return 1+}++resolve_native_binary() {+ local platform="$1"+ local arch="$2"+ local go_arch+ go_arch="$(go_arch_for_node_arch "${arch}" || true)"+ local -a candidates=()++ case "${platform}" in+ linux)+ candidates+=(+ "${repo_root}/node_modules/open-computer-use-linux-${arch}/bin/open-computer-use"+ "${repo_root}/../open-computer-use-linux-${arch}/bin/open-computer-use"+ )+ if [[ -n "${go_arch}" ]]; then+ candidates+=("${repo_root}/dist/linux/${go_arch}/open-computer-use")+ fi+ ;;+ win32)+ candidates+=(+ "${repo_root}/node_modules/open-computer-use-win32-${arch}/bin/open-computer-use.exe"+ "${repo_root}/../open-computer-use-win32-${arch}/bin/open-computer-use.exe"+ )+ if [[ -n "${go_arch}" ]]; then+ candidates+=("${repo_root}/dist/windows/${go_arch}/open-computer-use.exe")+ fi+ ;;+ esac++ for candidate in "${candidates[@]}"; do+ if [[ -x "${candidate}" ]]; thenprintf '%s\n' "${candidate}"return 0fi@@ -56,16 +112,81 @@ while [[ $# -gt 0 ]]; doesacdone-app_bundle="$(resolve_app_bundle || true)"-app_binary="${app_bundle:+${app_bundle}/Contents/MacOS/OpenComputerUse}"+platform="$(node -p "process.platform")"+arch="$(node_arch)"+payload_path=""++case "${platform}" in+ darwin)+ payload_path="$(resolve_app_bundle || true)"+ app_binary="${payload_path:+${payload_path}/Contents/MacOS/OpenComputerUse}"+ if [[ "${rebuild}" == "true" || -z "${app_binary}" || ! -x "${app_binary}" ]]; then+ if [[ -x "${macos_build_script}" ]]; then+ "${macos_build_script}" "${configuration}"+ payload_path="$(resolve_app_bundle || true)"+ app_binary="${payload_path:+${payload_path}/Contents/MacOS/OpenComputerUse}"+ else+ echo "Missing runnable app bundle at ${app_binary} and no local build script is available." >&2+ exit 1+ fi+ fi+ if [[ -z "${payload_path}" || ! -x "${app_binary}" ]]; then+ echo "Missing runnable app binary at ${app_binary}" >&2+ exit 1+ fi+ ;;+ linux)+ payload_path="$(resolve_native_binary linux "${arch}" || true)"+ if [[ "${rebuild}" == "true" || -z "${payload_path}" || ! -x "${payload_path}" ]]; then+ go_arch="$(go_arch_for_node_arch "${arch}" || true)"+ if [[ -n "${go_arch}" && -x "${linux_build_script}" ]]; then+ "${linux_build_script}" --configuration "${configuration}" --arch "${go_arch}"+ payload_path="$(resolve_native_binary linux "${arch}" || true)"+ fi+ fi+ if [[ -z "${payload_path}" || ! -x "${payload_path}" ]]; then+ echo "Missing runnable Linux binary for ${platform}-${arch}." >&2+ exit 1+ fi+ ;;+ win32)+ payload_path="$(resolve_native_binary win32 "${arch}" || true)"+ if [[ "${rebuild}" == "true" || -z "${payload_path}" || ! -x "${payload_path}" ]]; then+ go_arch="$(go_arch_for_node_arch "${arch}" || true)"+ if [[ -n "${go_arch}" && -x "${windows_build_script}" ]]; then+ "${windows_build_script}" --configuration "${configuration}" --arch "${go_arch}"+ payload_path="$(resolve_native_binary win32 "${arch}" || true)"+ fi+ fi+ if [[ -z "${payload_path}" || ! -x "${payload_path}" ]]; then+ echo "Missing runnable Windows binary for ${platform}-${arch}." >&2+ exit 1+ fi+ ;;+ *)+ echo "Unsupported Codex plugin install platform: ${platform}-${arch}" >&2+ exit 1+ ;;+esac-if [[ "${rebuild}" == "true" || -z "${app_binary}" || ! -x "${app_binary}" ]]; then- if [[ -x "${build_script}" ]]; then- "${build_script}" "${configuration}"- app_bundle="$(resolve_app_bundle || true)"- app_binary="${app_bundle:+${app_bundle}/Contents/MacOS/OpenComputerUse}"- else- echo "Missing runnable app bundle at ${app_binary} and no local build script is available." >&2+if [[ -z "${payload_path}" ]]; then+ echo "Failed to resolve native runtime payload for ${platform}-${arch}" >&2+ exit 1+fi++if [[ ! -e "${payload_path}" ]]; then+ echo "Missing native runtime payload at ${payload_path}" >&2+ exit 1+fi++if [[ ! -d "${payload_path}" && ! -x "${payload_path}" ]]; then+ echo "Native runtime payload is not executable: ${payload_path}" >&2+ exit 1+fi++if [[ "${platform}" != "darwin" ]]; then+ if [[ ! -x "${payload_path}" ]]; then+ echo "Native runtime payload is not executable: ${payload_path}" >&2exit 1fifi@@ -80,11 +201,6 @@ if [[ ! -f "${plugin_manifest}" ]]; thenexit 1fi-if [[ -z "${app_bundle}" || ! -x "${app_binary}" ]]; then- echo "Missing runnable app binary at ${app_binary}" >&2- exit 1-fi-plugin_version="$(node "${config_helper}" codex-plugin-version "${plugin_manifest}")"if [[ -z "${plugin_version}" ]]; then@@ -99,7 +215,7 @@ mkdir -p "${codex_home}" "${plugin_cache_root}"rm -rf "${plugin_install_root}"mkdir -p "${plugin_install_root}"-node "${config_helper}" copy-into-dir "${plugin_install_root}" "${plugin_source_root}" "${app_bundle}"+node "${config_helper}" copy-into-dir "${plugin_install_root}" "${plugin_source_root}" "${payload_path}"node "${config_helper}" codex-plugin-config "${config_path}" "${repo_root}" "${marketplace_name}" "${plugin_name}"diff --git a/scripts/npm/build-packages.mjs b/scripts/npm/build-packages.mjsindex 4efeb28..25dd18a 100644--- a/scripts/npm/build-packages.mjs+++ b/scripts/npm/build-packages.mjs@@ -21,11 +21,67 @@ const repoRoot = path.resolve(__dirname, "..", "..");const defaultOutDir = path.join(repoRoot, "dist", "npm");const appBundleName = "Open Computer Use.app";const appExecutableName = "OpenComputerUse";-const packageNames = [+const metaPackageNames = ["open-computer-use","open-computer-use-mcp","open-codex-computer-use-mcp",];+const platformPackages = [+ {+ name: "open-computer-use-darwin-arm64",+ os: "darwin",+ cpu: "arm64",+ kind: "macos-app",+ executablePath: ["dist", appBundleName, "Contents", "MacOS", appExecutableName],+ },+ {+ name: "open-computer-use-darwin-x64",+ os: "darwin",+ cpu: "x64",+ kind: "macos-app",+ executablePath: ["dist", appBundleName, "Contents", "MacOS", appExecutableName],+ },+ {+ name: "open-computer-use-linux-arm64",+ os: "linux",+ cpu: "arm64",+ kind: "binary",+ buildArch: "arm64",+ sourcePath: ["dist", "linux", "arm64", "open-computer-use"],+ executablePath: ["bin", "open-computer-use"],+ },+ {+ name: "open-computer-use-linux-x64",+ os: "linux",+ cpu: "x64",+ kind: "binary",+ buildArch: "amd64",+ sourcePath: ["dist", "linux", "amd64", "open-computer-use"],+ executablePath: ["bin", "open-computer-use"],+ },+ {+ name: "open-computer-use-win32-arm64",+ os: "win32",+ cpu: "arm64",+ kind: "binary",+ buildArch: "arm64",+ sourcePath: ["dist", "windows", "arm64", "open-computer-use.exe"],+ executablePath: ["bin", "open-computer-use.exe"],+ },+ {+ name: "open-computer-use-win32-x64",+ os: "win32",+ cpu: "x64",+ kind: "binary",+ buildArch: "amd64",+ sourcePath: ["dist", "windows", "amd64", "open-computer-use.exe"],+ executablePath: ["bin", "open-computer-use.exe"],+ },+];+const packageNames = [+ ...metaPackageNames,+ ...platformPackages.map((platformPackage) => platformPackage.name),+];function parseArgs(argv) {const options = {@@ -82,10 +138,13 @@ function printHelp() {Options:--configuration debug|release- --arch native|arm64|x86_64|universal+ --arch native|arm64|x86_64|universal macOS app build arch. Defaults to universal.--out-dir <dir>--package <package-name>--skip-build++Packages:+${packageNames.map((name) => ` - ${name}`).join("\n")}`);}@@ -130,6 +189,21 @@ function ensureBuilt(configuration, arch) {"--arch",arch,]);++ for (const buildArch of ["arm64", "amd64"]) {+ run(path.join(repoRoot, "scripts", "build-open-computer-use-linux.sh"), [+ "--configuration",+ configuration,+ "--arch",+ buildArch,+ ]);+ run(path.join(repoRoot, "scripts", "build-open-computer-use-windows.sh"), [+ "--configuration",+ configuration,+ "--arch",+ buildArch,+ ]);+ }}function writeExecutable(filePath, content) {@@ -137,13 +211,39 @@ function writeExecutable(filePath, content) {chmodSync(filePath, 0o755);}-function renderLauncher() {- return `#!/usr/bin/env bash-set -euo pipefail+function platformLaunchTable() {+ return Object.fromEntries(+ platformPackages.map((platformPackage) => [+ `${platformPackage.os}-${platformPackage.cpu}`,+ {+ packageName: platformPackage.name,+ executablePath: platformPackage.executablePath,+ },+ ]),+ );+}-print_launcher_help() {- cat <<'EOF'-Open Computer Use+function renderLauncher() {+ return `#!/usr/bin/env node+const { spawn } = require("node:child_process");+const fs = require("node:fs");+const path = require("node:path");++const platformPackages = ${JSON.stringify(platformLaunchTable(), null, 2)};+const packageRoot = path.resolve(__dirname, "..");+const args = process.argv.slice(2);+const command = args[0] || "";+const installCommands = new Map([+ ["install-claude-mcp", "install-claude-mcp.sh"],+ ["install-clauce-mcp", "install-claude-mcp.sh"],+ ["install-gemini-mcp", "install-gemini-mcp.sh"],+ ["install-codex-mcp", "install-codex-mcp.sh"],+ ["install-opencode-mcp", "install-opencode-mcp.sh"],+ ["install-codex-plugin", "install-codex-plugin.sh"],+]);++function printLauncherHelp() {+ console.log(\`Open Computer UseUsage:open-computer-use [command] [options]@@ -151,10 +251,10 @@ Usage:Commands:mcp Start the stdio MCP server.- doctor Print permission status and launch onboarding if needed.+ doctor Print permission status and launch onboarding if needed on macOS.list-apps Print running or recently used apps.snapshot <app> Print the current accessibility snapshot for an app.- call <tool> Call one tool, or run a JSON array of tool calls.+ call <tool> Call one tool, or run a JSON array of tool calls.turn-ended Notify the running MCP process that the host turn ended.install-claude-mcp Install the MCP server into ~/.claude.json for this project.install-gemini-mcp Install the MCP server into Gemini CLI config.@@ -169,119 +269,128 @@ Global options:-v, --version Show version.Notes:- Running without a command launches the permission onboarding app.- Use \`open-computer-use help <command>\` for command-specific help.-EOF-}--script_path="\${BASH_SOURCE[0]}"-while [[ -L "\${script_path}" ]]; do- script_dir="$(cd "$(dirname "\${script_path}")" && pwd)"- script_path="$(readlink "\${script_path}")"- if [[ "\${script_path}" != /* ]]; then- script_path="\${script_dir}/\${script_path}"- fi-done-package_root="$(cd "$(dirname "\${script_path}")/.." && pwd)"-app_binary="\${package_root}/dist/${appBundleName}/Contents/MacOS/${appExecutableName}"-install_claude_mcp_script="\${package_root}/scripts/install-claude-mcp.sh"-install_gemini_mcp_script="\${package_root}/scripts/install-gemini-mcp.sh"-install_mcp_script="\${package_root}/scripts/install-codex-mcp.sh"-install_opencode_mcp_script="\${package_root}/scripts/install-opencode-mcp.sh"-install_script="\${package_root}/scripts/install-codex-plugin.sh"--if [[ "\${1:-}" == "install-claude-mcp" || "\${1:-}" == "install-clauce-mcp" ]]; then- shift- exec "\${install_claude_mcp_script}" "$@"-fi--if [[ "\${1:-}" == "install-gemini-mcp" ]]; then- shift- exec "\${install_gemini_mcp_script}" "$@"-fi--if [[ "\${1:-}" == "install-codex-mcp" ]]; then- shift- exec "\${install_mcp_script}" "$@"-fi--if [[ "\${1:-}" == "install-opencode-mcp" ]]; then- shift- exec "\${install_opencode_mcp_script}" "$@"-fi--if [[ "\${1:-}" == "install-codex-plugin" ]]; then- shift- exec "\${install_script}" "$@"-fi--if [[ "\${1:-}" == "-h" || "\${1:-}" == "--help" ]]; then- print_launcher_help- exit 0-fi--if [[ "\${1:-}" == "help" && $# -le 1 ]]; then- print_launcher_help- exit 0-fi--if [[ "\${1:-}" == "help" && "\${2:-}" == "install-codex-plugin" ]]; then- cat <<'EOF'-Usage:- open-computer-use install-codex-plugin+ This npm package installs a small launcher plus one platform package selected by npm.+ Use 'open-computer-use help <command>' for command-specific help.\`);+}-Install this npm package into the local Codex plugin cache.-EOF- exit 0-fi+function printInstallHelp(scriptName, usage) {+ console.log(\`Usage:+ \${usage}-if [[ "\${1:-}" == "help" && "\${2:-}" == "install-codex-mcp" ]]; then- cat <<'EOF'-Usage:- open-computer-use install-codex-mcp+This helper updates a local MCP or plugin config to run:+ open-computer-use mcp-Install the open-computer-use MCP server into ~/.codex/config.toml.-EOF- exit 0-fi+Script:+ \${scriptName}\`);+}-if [[ "\${1:-}" == "help" && "\${2:-}" == "install-gemini-mcp" ]]; then- cat <<'EOF'-Usage:- open-computer-use install-gemini-mcp [--scope project|user]+function fail(message) {+ console.error(message);+ process.exit(1);+}-Install the open-computer-use MCP server into Gemini CLI config.-EOF- exit 0-fi+function spawnAndExit(executable, executableArgs) {+ const child = spawn(executable, executableArgs, {+ stdio: "inherit",+ windowsHide: false,+ });-if [[ "\${1:-}" == "help" && "\${2:-}" == "install-opencode-mcp" ]]; then- cat <<'EOF'-Usage:- open-computer-use install-opencode-mcp+ child.on("error", (error) => {+ fail(\`Failed to start \${executable}: \${error.message}\`);+ });-Install the open-computer-use MCP server into ~/.config/opencode.-EOF- exit 0-fi+ for (const signal of ["SIGINT", "SIGTERM"]) {+ process.on(signal, () => {+ child.kill(signal);+ });+ }-if [[ "\${1:-}" == "help" && ( "\${2:-}" == "install-claude-mcp" || "\${2:-}" == "install-clauce-mcp" ) ]]; then- cat <<'EOF'-Usage:- open-computer-use install-claude-mcp- open-computer-use install-clauce-mcp+ child.on("exit", (code, signal) => {+ if (signal) {+ process.exit(1);+ }+ process.exit(code ?? 0);+ });+}-Install the open-computer-use MCP server into ~/.claude.json for the current project.-EOF- exit 0-fi+function runInstallCommand(scriptName, scriptArgs) {+ if (process.platform === "win32") {+ fail(\`\${command} currently requires a POSIX shell. Configure your MCP client with command "open-computer-use" and args ["mcp"] on Windows.\`);+ }-if [[ ! -x "\${app_binary}" ]]; then- echo "open-computer-use could not find a runnable app bundle at \${app_binary}." >&2- exit 1-fi+ const scriptPath = path.join(packageRoot, "scripts", scriptName);+ if (!fs.existsSync(scriptPath)) {+ fail(\`Missing installer helper at \${scriptPath}.\`);+ }++ spawnAndExit(scriptPath, scriptArgs);+}++function resolveNativeExecutable() {+ const platformKey = \`\${process.platform}-\${process.arch}\`;+ const target = platformPackages[platformKey];+ if (!target) {+ const supported = Object.keys(platformPackages).sort().join(", ");+ fail(\`Unsupported platform \${platformKey}. Supported platforms: \${supported}.\`);+ }-exec "\${app_binary}" "$@"+ let manifestPath;+ try {+ manifestPath = require.resolve(\`\${target.packageName}/package.json\`, { paths: [packageRoot] });+ } catch (error) {+ fail(\`Missing platform package \${target.packageName}.++This usually means npm optional dependencies were omitted or pruned. Reinstall with:+ npm install -g open-computer-use++If you intentionally use --omit=optional, install the matching platform package too.\`);+ }++ const platformRoot = path.dirname(manifestPath);+ const executablePath = path.join(platformRoot, ...target.executablePath);+ if (!fs.existsSync(executablePath)) {+ fail(\`Platform package \${target.packageName} is installed, but its executable is missing at \${executablePath}.\`);+ }++ return executablePath;+}++if (command === "-h" || command === "--help" || (command === "help" && args.length <= 1)) {+ printLauncherHelp();+ process.exit(0);+}++if (command === "help" && args[1] === "install-codex-plugin") {+ printInstallHelp("install-codex-plugin.sh", "open-computer-use install-codex-plugin");+ process.exit(0);+}++if (command === "help" && args[1] === "install-codex-mcp") {+ printInstallHelp("install-codex-mcp.sh", "open-computer-use install-codex-mcp");+ process.exit(0);+}++if (command === "help" && args[1] === "install-gemini-mcp") {+ printInstallHelp("install-gemini-mcp.sh", "open-computer-use install-gemini-mcp [--scope project|user]");+ process.exit(0);+}++if (command === "help" && args[1] === "install-opencode-mcp") {+ printInstallHelp("install-opencode-mcp.sh", "open-computer-use install-opencode-mcp");+ process.exit(0);+}++if (command === "help" && (args[1] === "install-claude-mcp" || args[1] === "install-clauce-mcp")) {+ printInstallHelp("install-claude-mcp.sh", "open-computer-use install-claude-mcp");+ process.exit(0);+}++if (installCommands.has(command)) {+ const scriptName = installCommands.get(command);+ runInstallCommand(scriptName, args.slice(1));+} else {+ spawnAndExit(resolveNativeExecutable(), args);+}`;}@@ -300,13 +409,14 @@ const lines = ["Installed ${packageName}@${version}.","Package: https://www.npmjs.com/package/${packageName}","Commands: open-computer-use, open-computer-use-mcp, open-codex-computer-use-mcp",+ "Native package is selected by npm optionalDependencies for " + process.platform + "-" + process.arch + ".","","Next:",- "1. Run open-computer-use doctor",- "2. In macOS System Settings, grant Accessibility and Screen Recording to your host terminal or MCP client",- "3. Run open-computer-use install-claude-mcp, install-gemini-mcp, install-codex-mcp, or install-opencode-mcp for your host CLI, or install-codex-plugin for the local Codex plugin cache",+ "1. Run open-computer-use --version",+ "2. Add the MCP config below to your host client",+ "3. On macOS, run open-computer-use doctor and grant Accessibility / Screen Recording if prompted","",- "You can add this to any MCP-capable client:",+ "MCP config:",JSON.stringify(mcpConfig, null, 2),"",];@@ -319,9 +429,13 @@ for (const line of lines) {function renderReadme(packageName, version) {return `# ${packageName}-Prebuilt macOS npm distribution for the open-source **Open Computer Use** MCP server.+Cross-platform npm distribution for the open-source **Open Computer Use** MCP server.++This package installs a small Node launcher and lets npm choose one native package through \`optionalDependencies\`:-This package bundles a ready-to-run \`${appBundleName}\`, the Codex plugin metadata, and three global command aliases:+${platformPackages.map((platformPackage) => `- \`${platformPackage.name}\` for \`${platformPackage.os}-${platformPackage.cpu}\``).join("\n")}++Global command aliases:- \`open-computer-use\`- \`open-computer-use-mcp\`@@ -333,7 +447,7 @@ This package bundles a ready-to-run \`${appBundleName}\`, the Codex plugin metadnpm install -g ${packageName}\`\`\`-After install, run \`open-computer-use doctor\` first. If macOS \`Accessibility\` or \`Screen Recording\` permission is missing, it will open the permission onboarding window and tell you what still needs to be granted. If everything is already granted, it just prints the status and exits.+The root launcher resolves the current \`process.platform\` / \`process.arch\` pair and runs the matching native runtime. Do not install with \`--omit=optional\` unless you also install the matching platform package yourself.## MCP config@@ -350,81 +464,91 @@ If your MCP client accepts a stdio-style \`mcpServers\` JSON config, this is the}\`\`\`-In practice, using this package as MCP is: global install, add the JSON config, then grant macOS \`Accessibility\` and \`Screen Recording\` permission to the bundled npm-installed \`Open Computer Use.app\` on first use.-Package page: https://www.npmjs.com/package/${packageName}## Use\`\`\`bash-# Show global help, command help, and version-open-computer-use --help-open-computer-use help snapshotopen-computer-use --version+open-computer-use --help+open-computer-use mcp+open-computer-use call list_apps-# Install into Claude Code for the current project-open-computer-use install-claude-mcp+# macOS permission check and onboarding+open-computer-use doctor-# Install into Gemini CLI for the current project or user config+# Installer helpers for MCP-capable CLIs+open-computer-use install-claude-mcpopen-computer-use install-gemini-mcpopen-computer-use install-gemini-mcp --scope user--# Install into Codex as a plain MCP entry in ~/.codex/config.tomlopen-computer-use install-codex-mcp--# Install into opencode in ~/.config/opencodeopen-computer-use install-opencode-mcp--# Check permissions first; if Accessibility / Screen Recording is missing, open the permission onboarding window-# If both are already granted, this just prints the status and exits-open-computer-use doctor--# Start the stdio MCP server for Claude Desktop, Cursor, Cline, or another MCP client-open-computer-use mcp--# Call tools directly; the JSON-array form keeps state in one process for follow-up actions-open-computer-use call list_apps-open-computer-use call get_app_state --args '{"app":"TextEdit"}'-open-computer-use call --calls '[{"tool":"get_app_state","args":{"app":"TextEdit"}},{"tool":"press_key","args":{"app":"TextEdit","key":"Return"}}]'--# Install this package into the local Codex plugin marketplace/cacheopen-computer-use install-codex-plugin\`\`\`## Notes- Version: \`${version}\`-- Platform: macOS 14+-- Architectures: \`arm64\` and \`x64\` via a universal app bundle-- The host terminal or app still needs macOS \`Accessibility\` and \`Screen Recording\` permissions+- Supported npm platforms: \`darwin-arm64\`, \`darwin-x64\`, \`linux-arm64\`, \`linux-x64\`, \`win32-arm64\`, \`win32-x64\`+- macOS still requires \`Accessibility\` and \`Screen Recording\` permissions.+- Linux requires a signed-in desktop session with AT-SPI2 / D-Bus accessibility available for real app control.+- Windows requires a signed-in desktop session for UI Automation access.Source repository: https://github.com/iFurySt/open-codex-computer-use`;}-function renderPackageJson(packageName, version) {+function renderPlatformReadme(platformPackage, version) {+ const platformKey = `${platformPackage.os}-${platformPackage.cpu}`;+ return `# ${platformPackage.name}++Native Open Computer Use runtime package for \`${platformKey}\`.++This package is installed automatically as an optional dependency of \`open-computer-use@${version}\` when npm runs on \`${platformKey}\`. Most users should install the root package instead:++\`\`\`bash+npm install -g open-computer-use+\`\`\`++Source repository: https://github.com/iFurySt/open-codex-computer-use+`;+}++function packageKeywords(extraKeywords = []) {+ return [+ "computer-use",+ "codex",+ "mcp",+ "macos",+ "linux",+ "windows",+ "automation",+ ...extraKeywords,+ ];+}++function platformOptionalDependencies(version) {+ return Object.fromEntries(+ platformPackages.map((platformPackage) => [platformPackage.name, version]),+ );+}++function renderMetaPackageJson(packageName, version) {return {name: packageName,version,- description: "Prebuilt macOS Computer Use MCP server. After install, run open-computer-use doctor.",+ description: "Cross-platform Computer Use MCP server launcher. After install, configure open-computer-use mcp.",license: "MIT",homepage: "https://github.com/iFurySt/open-codex-computer-use",repository: {type: "git",- url: "https://github.com/iFurySt/open-codex-computer-use",+ url: "git+https://github.com/iFurySt/open-codex-computer-use.git",},bugs: {url: "https://github.com/iFurySt/open-codex-computer-use/issues",},- keywords: [- "computer-use",- "codex",- "mcp",- "macos",- "automation",- ],- os: ["darwin"],- cpu: ["arm64", "x64"],+ keywords: packageKeywords(),+ optionalDependencies: platformOptionalDependencies(version),preferGlobal: true,publishConfig: {access: "public",@@ -440,7 +564,6 @@ function renderPackageJson(packageName, version) {files: [".agents/plugins/marketplace.json","bin/",- `dist/${appBundleName}/`,"plugins/open-computer-use/.codex-plugin/","plugins/open-computer-use/.mcp.json","plugins/open-computer-use/assets/",@@ -458,46 +581,126 @@ function renderPackageJson(packageName, version) {};}-function stagePackage(packageName, version, outDir) {+function renderPlatformPackageJson(platformPackage, version) {+ const platformKey = `${platformPackage.os}-${platformPackage.cpu}`;+ const files = platformPackage.kind === "macos-app"+ ? [`dist/${appBundleName}/`, "README.md", "LICENSE"]+ : ["bin/", "README.md", "LICENSE"];+ return {+ name: platformPackage.name,+ version,+ description: `Native Open Computer Use runtime for ${platformKey}.`,+ license: "MIT",+ homepage: "https://github.com/iFurySt/open-codex-computer-use",+ repository: {+ type: "git",+ url: "git+https://github.com/iFurySt/open-codex-computer-use.git",+ },+ bugs: {+ url: "https://github.com/iFurySt/open-codex-computer-use/issues",+ },+ keywords: packageKeywords([platformPackage.os, platformPackage.cpu]),+ os: [platformPackage.os],+ cpu: [platformPackage.cpu],+ publishConfig: {+ access: "public",+ },+ files,+ };+}++function copyInstallerScripts(packageRoot) {+ cpSync(path.join(repoRoot, "scripts", "install-claude-mcp.sh"), path.join(packageRoot, "scripts", "install-claude-mcp.sh"));+ cpSync(path.join(repoRoot, "scripts", "install-gemini-mcp.sh"), path.join(packageRoot, "scripts", "install-gemini-mcp.sh"));+ cpSync(path.join(repoRoot, "scripts", "install-config-helper.mjs"), path.join(packageRoot, "scripts", "install-config-helper.mjs"));+ cpSync(path.join(repoRoot, "scripts", "install-codex-mcp.sh"), path.join(packageRoot, "scripts", "install-codex-mcp.sh"));+ cpSync(path.join(repoRoot, "scripts", "install-opencode-mcp.sh"), path.join(packageRoot, "scripts", "install-opencode-mcp.sh"));+ cpSync(path.join(repoRoot, "scripts", "install-codex-plugin.sh"), path.join(packageRoot, "scripts", "install-codex-plugin.sh"));++ for (const scriptName of [+ "install-claude-mcp.sh",+ "install-gemini-mcp.sh",+ "install-codex-mcp.sh",+ "install-opencode-mcp.sh",+ "install-codex-plugin.sh",+ ]) {+ chmodSync(path.join(packageRoot, "scripts", scriptName), 0o755);+ }+}++function stageMetaPackage(packageName, version, outDir) {const packageRoot = path.join(outDir, packageName);rmSync(packageRoot, { recursive: true, force: true });mkdirSync(path.join(packageRoot, ".agents", "plugins"), { recursive: true });mkdirSync(path.join(packageRoot, "bin"), { recursive: true });- mkdirSync(path.join(packageRoot, "dist"), { recursive: true });mkdirSync(path.join(packageRoot, "plugins"), { recursive: true });mkdirSync(path.join(packageRoot, "scripts"), { recursive: true });cpSync(path.join(repoRoot, ".agents", "plugins", "marketplace.json"), path.join(packageRoot, ".agents", "plugins", "marketplace.json"));- cpSync(path.join(repoRoot, "dist", appBundleName), path.join(packageRoot, "dist", appBundleName), {- recursive: true,- });cpSync(path.join(repoRoot, "plugins", "open-computer-use"), path.join(packageRoot, "plugins", "open-computer-use"), {recursive: true,});- cpSync(path.join(repoRoot, "scripts", "install-claude-mcp.sh"), path.join(packageRoot, "scripts", "install-claude-mcp.sh"));- cpSync(path.join(repoRoot, "scripts", "install-gemini-mcp.sh"), path.join(packageRoot, "scripts", "install-gemini-mcp.sh"));- cpSync(path.join(repoRoot, "scripts", "install-config-helper.mjs"), path.join(packageRoot, "scripts", "install-config-helper.mjs"));- cpSync(path.join(repoRoot, "scripts", "install-codex-mcp.sh"), path.join(packageRoot, "scripts", "install-codex-mcp.sh"));- cpSync(path.join(repoRoot, "scripts", "install-opencode-mcp.sh"), path.join(packageRoot, "scripts", "install-opencode-mcp.sh"));- cpSync(path.join(repoRoot, "scripts", "install-codex-plugin.sh"), path.join(packageRoot, "scripts", "install-codex-plugin.sh"));cpSync(path.join(repoRoot, "LICENSE"), path.join(packageRoot, "LICENSE"));+ copyInstallerScripts(packageRoot);- writeExecutable(path.join(packageRoot, "bin", "open-computer-use"), renderLauncher());- writeExecutable(path.join(packageRoot, "bin", "open-computer-use-mcp"), renderLauncher());- writeExecutable(path.join(packageRoot, "bin", "open-codex-computer-use-mcp"), renderLauncher());+ const launcher = renderLauncher();+ writeExecutable(path.join(packageRoot, "bin", "open-computer-use"), launcher);+ writeExecutable(path.join(packageRoot, "bin", "open-computer-use-mcp"), launcher);+ writeExecutable(path.join(packageRoot, "bin", "open-codex-computer-use-mcp"), launcher);writeFileSync(path.join(packageRoot, "scripts", "postinstall.mjs"), renderPostinstall(packageName, version), "utf-8");writeFileSync(path.join(packageRoot, "README.md"), renderReadme(packageName, version), "utf-8");- writeFileSync(path.join(packageRoot, "package.json"), `${JSON.stringify(renderPackageJson(packageName, version), null, 2)}\n`, "utf-8");+ writeFileSync(path.join(packageRoot, "package.json"), `${JSON.stringify(renderMetaPackageJson(packageName, version), null, 2)}\n`, "utf-8");- chmodSync(path.join(packageRoot, "scripts", "install-claude-mcp.sh"), 0o755);- chmodSync(path.join(packageRoot, "scripts", "install-gemini-mcp.sh"), 0o755);- chmodSync(path.join(packageRoot, "scripts", "install-codex-mcp.sh"), 0o755);- chmodSync(path.join(packageRoot, "scripts", "install-opencode-mcp.sh"), 0o755);- chmodSync(path.join(packageRoot, "scripts", "install-codex-plugin.sh"), 0o755);removeJunkFiles(packageRoot);}+function assertFileExists(filePath, packageName) {+ if (!existsSync(filePath)) {+ throw new Error(`Missing artifact for ${packageName}: ${filePath}. Run without --skip-build first.`);+ }+}++function stagePlatformPackage(platformPackage, version, outDir) {+ const packageRoot = path.join(outDir, platformPackage.name);+ rmSync(packageRoot, { recursive: true, force: true });++ mkdirSync(path.join(packageRoot, "bin"), { recursive: true });+ mkdirSync(path.join(packageRoot, "dist"), { recursive: true });++ if (platformPackage.kind === "macos-app") {+ const sourcePath = path.join(repoRoot, "dist", appBundleName);+ assertFileExists(sourcePath, platformPackage.name);+ cpSync(sourcePath, path.join(packageRoot, "dist", appBundleName), {+ recursive: true,+ });+ } else {+ const sourcePath = path.join(repoRoot, ...platformPackage.sourcePath);+ const destinationPath = path.join(packageRoot, ...platformPackage.executablePath);+ assertFileExists(sourcePath, platformPackage.name);+ cpSync(sourcePath, destinationPath);+ chmodSync(destinationPath, 0o755);+ }++ cpSync(path.join(repoRoot, "LICENSE"), path.join(packageRoot, "LICENSE"));+ writeFileSync(path.join(packageRoot, "README.md"), renderPlatformReadme(platformPackage, version), "utf-8");+ writeFileSync(path.join(packageRoot, "package.json"), `${JSON.stringify(renderPlatformPackageJson(platformPackage, version), null, 2)}\n`, "utf-8");+ removeJunkFiles(packageRoot);+}++function stagePackage(packageName, version, outDir) {+ if (metaPackageNames.includes(packageName)) {+ stageMetaPackage(packageName, version, outDir);+ return;+ }++ const platformPackage = platformPackages.find((candidate) => candidate.name === packageName);+ if (!platformPackage) {+ throw new Error(`Unsupported package name: ${packageName}`);+ }+ stagePlatformPackage(platformPackage, version, outDir);+}+function main() {const options = parseArgs(process.argv.slice(2));const pluginManifestPath = path.join(repoRoot, "plugins", "open-computer-use", ".codex-plugin", "plugin.json");diff --git a/scripts/npm/publish-packages.mjs b/scripts/npm/publish-packages.mjsindex 2cbe078..0b80c61 100644--- a/scripts/npm/publish-packages.mjs+++ b/scripts/npm/publish-packages.mjs@@ -95,6 +95,13 @@ function readPackageMetadata(packageDir) {};}+function publishPriority(packageName) {+ if (/^open-computer-use-(darwin|linux|win32)-/.test(packageName)) {+ return 0;+ }+ return 1;+}+function npmPackageVersionExists(packageName, version, env) {const result = spawnSync("npm", ["view", `${packageName}@${version}`, "version", "--json"], {cwd: repoRoot,@@ -229,7 +236,11 @@ function main() {.split("\n").map((line) => line.trim()).filter(Boolean)- .sort();+ .sort((left, right) => {+ const leftName = JSON.parse(readFileSync(path.join(left, "package.json"), "utf-8")).name;+ const rightName = JSON.parse(readFileSync(path.join(right, "package.json"), "utf-8")).name;+ return publishPriority(leftName) - publishPriority(rightName) || leftName.localeCompare(rightName);+ });for (const packageDir of packageDirs) {const { name: packageName, version } = readPackageMetadata(packageDir);