Skip to content

👾 Open Computer Use – Open-Source Alternative to Codex Computer Use

3.0 KB
Raw Blame

[2026-07-22 19:05] | Task: 添加 macOS SkyLight 后台点击

🤖 Execution Context

  • Agent ID: /root
  • Base Model: GPT-5
  • Runtime: Codex desktop / macOS arm64

📥 User Query

阅读 Cua 的 macOS Window Internals 文章及相关开源库,为 OCU 实现 sky_click 后台点击方式。

🛠 Changes Overview

Scope: macOS click runtime、三平台工具协议、测试、skill 文档与第三方归属。

Key Actions:

  • SkyLight route: 新增运行时 dlopen / dlsym 桥接,使用 SLPSPostEventRecordTo focus-without-raise、SLEventPostToPid、window-local event fields、off-window Chromium primer 和恢复阶段。
  • Safety boundary: sky_click 保持显式 macOS-only,不进入 auto、不 fallback;只接受当前 on-screen 同 PID 窗口上的左键单击/双击,并串行化 AppKit-active 状态切换。
  • Cross-platform contract: macOS、Windows、Linux 同步 sky_click 枚举;Windows / Linux 在 snapshot lookup 前返回稳定 unsupported。
  • Verification: 增加事件 recipe、activation record、符号/ABI、窗口身份和平台 parser 测试,并加入默认跳过的隔离 Chrome 完全遮挡实机回归。
  • Attribution: 固定 Cua / yabai 参考 commit,补充 MIT third-party notices 和私有 SPI 兼容性文档。

🧠 Design Intent (Why)

Chrome 在被其他窗口遮挡时会丢弃普通 CGEvent.postToPid mouse event。完整后台路径需要先只切 AppKit event-routing active state、保持 WindowServer frontmost 与 z-order 不变,再通过带 Chromium telemetry 和 primer 的 SkyLight 事件投递;结束后恢复当前实际前台进程的 AppKit 状态。该能力风险高且依赖私有 ABI,因此保持显式 opt-in、fail closed,并用受控 Chrome 页面验证不重复触发和无前台副作用。

✅ Verification

  • swift test:147 tests,0 failures;默认跳过 1 个显式 live test。
  • OPEN_COMPUTER_USE_RUN_SKY_CLICK_LIVE_TEST=1 swift test --filter SkyClickLiveTests:隔离 Chrome 被 Fixture 完全覆盖时触发恰好一次,前台 PID、真实 cursor 与 z-order 不变;最终实现连续通过。
  • Windows / Linux:go test ./... 通过。
  • npm run package:skill 通过。
  • ./scripts/run-tool-smoke-tests.sh 通过完整 tool smoke 与 cursor idle smoke。

📁 Files Modified

  • packages/OpenComputerUseKit/Sources/OpenComputerUseKit/SkyLightSPI.swift
  • packages/OpenComputerUseKit/Sources/OpenComputerUseKit/SkyClickSimulation.swift
  • packages/OpenComputerUseKit/Sources/OpenComputerUseKit/ComputerUseService.swift
  • packages/OpenComputerUseKit/Sources/OpenComputerUseKit/InputSimulation.swift
  • packages/OpenComputerUseKit/Sources/OpenComputerUseKit/ToolDefinitions.swift
  • packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/
  • apps/OpenComputerUseWindows/
  • apps/OpenComputerUseLinux/
  • skills/open-computer-use/references/usage.md
  • docs/ARCHITECTURE.md
  • docs/SECURITY.md
  • docs/RELIABILITY.md
  • docs/references/macos-skylight-background-click.md
  • THIRD_PARTY_NOTICES.md