👾 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
fix: rename app bundle and add icon resources
Leo597ce3ace4c6
diff --git a/docs/histories/2026-04/20260417-2215-fix-bundle-display-name-and-icon.md b/docs/histories/2026-04/20260417-2215-fix-bundle-display-name-and-icon.mdnew file mode 100644index 0000000..9ab7bec--- /dev/null+++ b/docs/histories/2026-04/20260417-2215-fix-bundle-display-name-and-icon.md@@ -0,0 +1,31 @@+## [2026-04-17 22:15] | Task: 修复 app bundle 显示名和图标++### 🤖 Execution Context+* **Agent ID**: `codex`+* **Base Model**: `gpt-5.4`+* **Runtime**: `Codex CLI on macOS`++### 📥 User Query+> 系统设置的 `Accessibility` 和 `Screen *` 列表里当前显示的是 `OpenComputerUse`,并且没有 logo;需要改成 `Open Computer Use`,而且要有 logo。++### 🛠 Changes Overview+**Scope:** `scripts/`, `plugins/open-computer-use`, `docs/`++**Key Actions:**+- **[Bundle Identity]**: 把打包产物从 `OpenComputerUse.app` 切到 `Open Computer Use.app`,让 macOS System Settings 读取到带空格的 bundle 显示名。+- **[Bundle Icon]**: 新增构建期 icon 渲染脚本,生成 `icns` 并写入 app bundle,再通过 `CFBundleIconFile` 暴露给系统权限面板。+- **[Packaging and Docs]**: 同步更新插件 launcher、Codex 安装脚本、npm staging 和文档里的 bundle 路径,避免打包链路继续引用旧名字。++### 🧠 Design Intent (Why)+System Settings 对这两类 TCC 权限列表显示的名字更接近 app bundle 文件名,而不是单独看 `CFBundleDisplayName`。因此只改 `Info.plist` 不够,必须把实际 `.app` 名字改成带空格版本,并且补上真正的 bundle icon 资源,才能同时解决无空格名和空白图标。++### 📁 Files Modified+- `scripts/build-open-computer-use-app.sh`+- `scripts/render-open-computer-use-icon.swift`+- `scripts/install-codex-plugin.sh`+- `scripts/npm/build-packages.mjs`+- `plugins/open-computer-use/scripts/launch-open-computer-use.sh`+- `README.md`+- `docs/CICD.md`+- `docs/exec-plans/active/20260417-permission-onboarding-app.md`+- `docs/histories/2026-04/20260417-2215-fix-bundle-display-name-and-icon.md`diff --git a/plugins/open-computer-use/scripts/launch-open-computer-use.sh b/plugins/open-computer-use/scripts/launch-open-computer-use.shindex f17cd9f..178a4e5 100755--- a/plugins/open-computer-use/scripts/launch-open-computer-use.sh+++ b/plugins/open-computer-use/scripts/launch-open-computer-use.sh@@ -3,23 +3,29 @@set -euo pipefailplugin_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"-bundled_app_binary="${plugin_root}/OpenComputerUse.app/Contents/MacOS/OpenComputerUse"repo_root="$(cd "${plugin_root}/../.." && pwd)"-repo_app_binary="${repo_root}/dist/OpenComputerUse.app/Contents/MacOS/OpenComputerUse"+candidate_binaries=(+ "${plugin_root}/Open Computer Use.app/Contents/MacOS/OpenComputerUse"+ "${plugin_root}/OpenComputerUse.app/Contents/MacOS/OpenComputerUse"+ "${repo_root}/dist/Open Computer Use.app/Contents/MacOS/OpenComputerUse"+ "${repo_root}/dist/OpenComputerUse.app/Contents/MacOS/OpenComputerUse"+)-if [[ -x "${bundled_app_binary}" ]]; then- cd "${plugin_root}"- exec "${bundled_app_binary}" mcp-fi--if [[ -x "${repo_app_binary}" ]]; then- cd "${repo_root}"- exec "${repo_app_binary}" mcp-fi+for app_binary in "${candidate_binaries[@]}"; do+ if [[ -x "${app_binary}" ]]; then+ if [[ "${app_binary}" == "${plugin_root}"/* ]]; then+ cd "${plugin_root}"+ else+ cd "${repo_root}"+ fi+ exec "${app_binary}" mcp+ fi+doneecho "open-computer-use could not find a runnable app bundle." >&2echo "Checked:" >&2-echo " - ${bundled_app_binary}" >&2-echo " - ${repo_app_binary}" >&2+for app_binary in "${candidate_binaries[@]}"; do+ echo " - ${app_binary}" >&2+doneecho "Run ./scripts/install-codex-plugin.sh to populate the Codex plugin cache." >&2exit 1diff --git a/scripts/build-open-computer-use-app.sh b/scripts/build-open-computer-use-app.shindex c3ad5e7..bb1dcfa 100755--- a/scripts/build-open-computer-use-app.sh+++ b/scripts/build-open-computer-use-app.sh@@ -3,25 +3,144 @@set -euo pipefailrepo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"-configuration="${1:-debug}"+configuration="debug"+arch_mode="native"++usage() {+ cat <<'EOF'+Usage: ./scripts/build-open-computer-use-app.sh [debug|release] [--configuration debug|release] [--arch native|arm64|x86_64|universal]++Examples:+ ./scripts/build-open-computer-use-app.sh debug+ ./scripts/build-open-computer-use-app.sh --configuration release --arch universal+EOF+}++while [[ $# -gt 0 ]]; do+ case "$1" in+ debug|release)+ configuration="$1"+ shift+ ;;+ --configuration)+ configuration="${2:-}"+ if [[ -z "${configuration}" ]]; then+ echo "--configuration requires a value" >&2+ exit 1+ fi+ shift 2+ ;;+ --arch)+ arch_mode="${2:-}"+ if [[ -z "${arch_mode}" ]]; then+ echo "--arch requires a value" >&2+ exit 1+ fi+ shift 2+ ;;+ -h|--help)+ usage+ exit 0+ ;;+ *)+ echo "Unknown argument: $1" >&2+ usage >&2+ exit 1+ ;;+ esac+done++if [[ "${configuration}" != "debug" && "${configuration}" != "release" ]]; then+ echo "Unsupported configuration: ${configuration}" >&2+ exit 1+fi++if [[ "${arch_mode}" != "native" && "${arch_mode}" != "arm64" && "${arch_mode}" != "x86_64" && "${arch_mode}" != "universal" ]]; then+ echo "Unsupported arch mode: ${arch_mode}" >&2+ exit 1+fi++read_package_version() {+ python3 - "${repo_root}/plugins/open-computer-use/.codex-plugin/plugin.json" <<'PY'+import json+import sys++with open(sys.argv[1], "r", encoding="utf-8") as fh:+ manifest = json.load(fh)++print(manifest["version"])+PY+}++build_binary() {+ local triple="${1:-}"+ local scratch_path="${2:-}"+ local -a args=(-c "${configuration}")++ if [[ -n "${triple}" ]]; then+ args+=(--triple "${triple}")+ fi++ if [[ -n "${scratch_path}" ]]; then+ args+=(--scratch-path "${scratch_path}")+ fi++ local binary_dir+ binary_dir="$(swift build "${args[@]}" --show-bin-path)"+ swift build "${args[@]}" --product OpenComputerUse >&2+ printf '%s/OpenComputerUse\n' "${binary_dir}"+}cd "${repo_root}"-binary_dir="$(swift build -c "${configuration}" --show-bin-path)"-swift build -c "${configuration}" --product OpenComputerUse+package_version="$(read_package_version)"+bundle_version="${OPEN_COMPUTER_USE_BUNDLE_VERSION:-$(git -C "${repo_root}" rev-list --count HEAD 2>/dev/null || echo 1)}"+app_bundle_name="Open Computer Use.app"+legacy_app_bundle_name="OpenComputerUse.app"+bundle_icon_name="OpenComputerUse.icns"+icon_render_script="${repo_root}/scripts/render-open-computer-use-icon.swift"-app_root="${repo_root}/dist/OpenComputerUse.app"+app_root="${repo_root}/dist/${app_bundle_name}"+legacy_app_root="${repo_root}/dist/${legacy_app_bundle_name}"contents_dir="${app_root}/Contents"macos_dir="${contents_dir}/MacOS"resources_dir="${contents_dir}/Resources"-rm -rf "${app_root}"+rm -rf "${app_root}" "${legacy_app_root}"mkdir -p "${macos_dir}" "${resources_dir}"-cp "${binary_dir}/OpenComputerUse" "${macos_dir}/OpenComputerUse"+case "${arch_mode}" in+ native)+ cp "$(build_binary "" "")" "${macos_dir}/OpenComputerUse"+ ;;+ arm64)+ cp "$(build_binary "arm64-apple-macosx14.0" ".build/arm64-${configuration}")" "${macos_dir}/OpenComputerUse"+ ;;+ x86_64)+ cp "$(build_binary "x86_64-apple-macosx14.0" ".build/x86_64-${configuration}")" "${macos_dir}/OpenComputerUse"+ ;;+ universal)+ arm_binary="$(build_binary "arm64-apple-macosx14.0" ".build/arm64-${configuration}")"+ x86_binary="$(build_binary "x86_64-apple-macosx14.0" ".build/x86_64-${configuration}")"+ lipo -create -output "${macos_dir}/OpenComputerUse" "${arm_binary}" "${x86_binary}"+ ;;+esac+chmod +x "${macos_dir}/OpenComputerUse"-cat > "${contents_dir}/Info.plist" <<'PLIST'+icon_work_dir="$(mktemp -d "${TMPDIR:-/tmp}/open-computer-use-icon.XXXXXX")"+cleanup() {+ if [[ -n "${icon_work_dir:-}" ]]; then+ rm -rf "${icon_work_dir}"+ fi+}+trap cleanup EXIT+iconset_dir="${icon_work_dir}/OpenComputerUse.iconset"+mkdir -p "${iconset_dir}"+swift "${icon_render_script}" "${iconset_dir}"+iconutil -c icns "${iconset_dir}" -o "${resources_dir}/${bundle_icon_name}"++cat > "${contents_dir}/Info.plist" <<PLIST<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0">@@ -30,6 +149,8 @@ cat > "${contents_dir}/Info.plist" <<'PLIST'<string>en</string><key>CFBundleExecutable</key><string>OpenComputerUse</string>+ <key>CFBundleIconFile</key>+ <string>${bundle_icon_name}</string><key>CFBundleIdentifier</key><string>dev.opencodex.OpenComputerUse</string><key>CFBundleInfoDictionaryVersion</key>@@ -41,9 +162,9 @@ cat > "${contents_dir}/Info.plist" <<'PLIST'<key>CFBundlePackageType</key><string>APPL</string><key>CFBundleShortVersionString</key>- <string>0.1.2</string>+ <string>${package_version}</string><key>CFBundleVersion</key>- <string>3</string>+ <string>${bundle_version}</string><key>LSMinimumSystemVersion</key><string>14.0</string><key>LSUIElement</key>@@ -56,4 +177,4 @@ PLISTplutil -lint "${contents_dir}/Info.plist" >/dev/null-echo "Built ${app_root}"+echo "Built ${app_root} (${arch_mode}, ${configuration})"diff --git a/scripts/install-codex-plugin.sh b/scripts/install-codex-plugin.shindex e173ff0..a8b4e1d 100755--- a/scripts/install-codex-plugin.sh+++ b/scripts/install-codex-plugin.sh@@ -9,6 +9,7 @@ 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"configuration="debug"rebuild="false"@@ -34,10 +35,16 @@ while [[ $# -gt 0 ]]; doesacdone-app_binary="${repo_root}/dist/OpenComputerUse.app/Contents/MacOS/OpenComputerUse"+app_bundle="${repo_root}/dist/Open Computer Use.app"+app_binary="${app_bundle}/Contents/MacOS/OpenComputerUse"if [[ "${rebuild}" == "true" || ! -x "${app_binary}" ]]; then- "${repo_root}/scripts/build-open-computer-use-app.sh" "${configuration}"+ if [[ -x "${build_script}" ]]; then+ "${build_script}" "${configuration}"+ else+ echo "Missing runnable app bundle at ${app_binary} and no local build script is available." >&2+ exit 1+ fifiif [[ ! -f "${repo_root}/.agents/plugins/marketplace.json" ]]; then@@ -80,7 +87,7 @@ rm -rf "${plugin_install_root}"mkdir -p "${plugin_install_root}"rsync -a "${plugin_source_root}/" "${plugin_install_root}/"-rsync -a "${repo_root}/dist/OpenComputerUse.app" "${plugin_install_root}/"+rsync -a "${app_bundle}" "${plugin_install_root}/"python3 - "${config_path}" "${repo_root}" "${marketplace_name}" "${plugin_name}" <<'PY'import jsondiff --git a/scripts/render-open-computer-use-icon.swift b/scripts/render-open-computer-use-icon.swiftnew file mode 100644index 0000000..887fb15--- /dev/null+++ b/scripts/render-open-computer-use-icon.swift@@ -0,0 +1,137 @@+#!/usr/bin/env swift++import AppKit+import Foundation++enum IconRenderError: Error {+ case invalidArguments+ case contextUnavailable(Int)+ case pngEncodingFailed(String)+}++let outputDirectoryURL = try {+ let arguments = CommandLine.arguments.dropFirst()+ guard arguments.count == 1 else {+ throw IconRenderError.invalidArguments+ }++ return URL(fileURLWithPath: String(arguments[arguments.startIndex]), isDirectory: true)+}()++try FileManager.default.createDirectory(at: outputDirectoryURL, withIntermediateDirectories: true, attributes: nil)++let iconFiles: [(String, Int)] = [+ ("icon_16x16.png", 16),+ ("[email protected]", 32),+ ("icon_32x32.png", 32),+ ("[email protected]", 64),+ ("icon_128x128.png", 128),+ ("[email protected]", 256),+ ("icon_256x256.png", 256),+ ("[email protected]", 512),+ ("icon_512x512.png", 512),+ ("[email protected]", 1024),+]++for (fileName, pixelSize) in iconFiles {+ try writeIconPNG(named: fileName, pixelSize: pixelSize, to: outputDirectoryURL)+}++func writeIconPNG(named fileName: String, pixelSize: Int, to directoryURL: URL) throws {+ guard let bitmap = NSBitmapImageRep(+ bitmapDataPlanes: nil,+ pixelsWide: pixelSize,+ pixelsHigh: pixelSize,+ bitsPerSample: 8,+ samplesPerPixel: 4,+ hasAlpha: true,+ isPlanar: false,+ colorSpaceName: .deviceRGB,+ bytesPerRow: 0,+ bitsPerPixel: 0+ ) else {+ throw IconRenderError.contextUnavailable(pixelSize)+ }++ bitmap.size = NSSize(width: CGFloat(pixelSize), height: CGFloat(pixelSize))++ guard let context = NSGraphicsContext(bitmapImageRep: bitmap) else {+ throw IconRenderError.contextUnavailable(pixelSize)+ }++ NSGraphicsContext.saveGraphicsState()+ NSGraphicsContext.current = context+ context.shouldAntialias = true+ NSColor.clear.setFill()+ NSBezierPath(rect: NSRect(x: 0, y: 0, width: pixelSize, height: pixelSize)).fill()+ drawAppIcon(size: CGFloat(pixelSize))+ context.flushGraphics()+ NSGraphicsContext.restoreGraphicsState()++ guard let pngData = bitmap.representation(using: .png, properties: [:]) else {+ throw IconRenderError.pngEncodingFailed(fileName)+ }++ try pngData.write(to: directoryURL.appendingPathComponent(fileName))+}++func drawAppIcon(size: CGFloat) {+ // Keep this geometry aligned with Branding.makeAppIconImage in the app target.+ let rect = CGRect(origin: .zero, size: CGSize(width: size, height: size))+ let tile = NSBezierPath(roundedRect: rect, xRadius: size * 0.22, yRadius: size * 0.22)++ let gradient = NSGradient(colors: [+ NSColor(calibratedRed: 0.12, green: 0.67, blue: 0.99, alpha: 1),+ NSColor(calibratedRed: 0.94, green: 0.74, blue: 0.93, alpha: 1),+ ])!+ gradient.draw(in: tile, angle: 20)++ func point(_ x: CGFloat, _ y: CGFloat) -> CGPoint {+ CGPoint(x: size * x / 256, y: size * (1 - y / 256))+ }++ func scale(_ value: CGFloat) -> CGFloat {+ size * value / 256+ }++ let arc = NSBezierPath()+ arc.move(to: point(74, 156))+ arc.curve(+ to: point(182, 88),+ controlPoint1: point(78, 112),+ controlPoint2: point(136, 72)+ )+ arc.lineWidth = scale(12)+ arc.lineCapStyle = .round+ NSColor.white.withAlphaComponent(0.72).setStroke()+ arc.stroke()++ let pointerShadow = NSBezierPath()+ pointerShadow.move(to: point(129, 102))+ pointerShadow.line(to: point(129, 181))+ pointerShadow.line(to: point(149, 162))+ pointerShadow.line(to: point(161, 193))+ pointerShadow.line(to: point(176, 186))+ pointerShadow.line(to: point(164, 157))+ pointerShadow.line(to: point(192, 152))+ pointerShadow.close()+ NSColor.white.withAlphaComponent(0.14).setFill()+ pointerShadow.fill()++ let pointer = NSBezierPath()+ pointer.move(to: point(126, 98))+ pointer.line(to: point(126, 177))+ pointer.line(to: point(146, 158))+ pointer.line(to: point(158, 189))+ pointer.line(to: point(173, 182))+ pointer.line(to: point(161, 153))+ pointer.line(to: point(189, 148))+ pointer.close()+ pointer.lineWidth = scale(6)+ pointer.lineJoinStyle = .round+ pointer.lineCapStyle = .round+ NSColor.white.withAlphaComponent(0.94).setFill()+ pointer.fill()+ NSColor.white.setStroke()+ pointer.stroke()+}