👾 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
[2026-09-24 17:40] | Task: 收敛 PR 65 的后台操作 session 边界
🤖 Execution Context
- Agent ID: TraeCode
- Base Model: GPT-5
- Runtime: TraeCode CLI / local macOS repository workspace
📥 User Query
评估 PR 65 后,直接在贡献者的 PR 上迭代并补充 maintainer commits。
🛠 Changes Overview
Scope: PR 与最新 main 集成、macOS 后台状态生命周期、agent display 恢复、JS REPL 参数、私有 API 防护、测试与文档。
Key Actions:
- 用 merge commit 同步最新
main,保留贡献者历史以及 derived implementation 对应的第三方许可声明。 - MCP turn-ended、stdio shutdown 与 app-agent connection close 统一清理 visual cursor、occlusion keep-alive 和 agent display;app runtime 的 distributed turn-ended 通知也执行同一 session cleanup。
window_placement=restore改为按 app PID 恢复该 runtime 停放的全部窗口,不再误用 snapshot 当前选中的 window ID。- macOS
get_app_state不再声明readOnlyHint,因为默认 snapshot 会维护 WindowServer occlusion 状态,显式 placement 还会移动窗口。 - JS app binding 将
windowPlacement转发给 snapshot,将keyMethod转发给typeText/pressKey,并补参数映射测试和同一 session 的用法。 CGVirtualDisplayshim 捕获私有 KVC / selector 抛出的 Objective-C exception,系统 API 漂移时返回不可用结果而不是终止 host 进程。
🧠 Design Intent (Why)
后台能力会暂时改变进程级 WindowServer 状态,所以它的安全边界必须跟 MCP/REPL session 一致;正常 turn 或 connection 结束不能把窗口遗留在 virtual display。显式 restore 应按调用者指定的 app 恢复真实 parked set,而不是依赖移动后可能变化的 preferred-window 选择。默认 Codex 入口是 JS REPL,因此 native 新参数也必须在 code-first API 中可达。
📁 Files Modified
packages/OpenComputerUseKit/Sources/OpenComputerUseKit/MCPServer.swiftpackages/OpenComputerUseKit/Sources/OpenComputerUseKit/AgentDisplay.swiftpackages/OpenComputerUseKit/Sources/OpenComputerUseKit/ComputerUseService.swiftpackages/OpenComputerUseKit/Sources/OpenComputerUseKit/ToolDefinitions.swiftapps/OpenComputerUse/Sources/OpenComputerUse/MCPAppRuntime.swiftapps/OpenComputerUse/Sources/OpenComputerUse/MacOSAppAgentProxy.swiftpackages/OpenComputerUseVirtualDisplayShim/OpenComputerUseVirtualDisplayShim.mscripts/node-repl/open-computer-use-repl.mjspackages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/scripts/node-repl/open-computer-use-repl.test.mjsdocs/ARCHITECTURE.md、docs/SECURITY.md、docs/RELIABILITY.md、docs/references/js-repl.mdskills/open-computer-use/references/usage.md、docs/releases/feature-release-notes.md
✅ Verification
swift test:186 tests,7 个 opt-in live tests 跳过,0 failures。swift build -c release:通过。- 新增 JS background-option 映射测试通过;Node 全套只剩最新
main已可复现的 Worker late-error timing failure。 - Linux / Windows:
go test ./...均通过。 ./scripts/run-tool-smoke-tests.sh:native tool 与 cursor idle smoke 均通过。./scripts/check-docs.sh、./scripts/check-action-pinning.sh与git diff --check:通过。- 按仓库约束未运行会切换窗口 / Space 或注入真实输入的 opt-in live tests;agent-display live test 已改为覆盖按 PID 恢复入口,留待空闲桌面窗口执行。
🔄 2026-10-10 main 同步补充
- 再次把最新
main合入贡献者分支,保留主线新增的 Windows 退化截图 fail-closed 防护,以及 PR 的key_method/window_placement跨平台参数兼容。 - Windows runtime 同时支持无效 PNG / 过小窗口过滤、无可用截图时拒绝 coordinate action,并继续对 macOS-only 的
sky_key和 agent-display placement 返回明确的 unsupported 结果。 docs/RELIABILITY.md同时保留 macOS 后台输入、agent display、session cleanup 排障说明和 Windows screenshot-only failure 排障说明。- 合并结果通过
swift test(186 tests,7 个 opt-in live tests 跳过)、Node 22 tests、Windows / Linuxgo test ./...、release build、Windows / Linux 制品构建、headless tool/cursor smoke、文档骨架与 action pinning 检查。 - 未运行会切换窗口、Space 或向真实应用注入输入的 opt-in macOS live tests。
- 首次推送后
main又前进到 Linuxpress_keykeysym 修复;再次同步该提交,合并树无内容冲突,并重新验证最终 head,避免 GitHub mergeability 计算与快速变化的 base 产生竞态。