macos-harness README

项目的 README,来自 github.com/browser-use/macos-harness。合并为一个 markdown 文件:README.md。

macOS Harness

macOS Harness ⌘

Give any coding agent the apps on your Mac. One shell command per step. It works in the background: your pointer does not move and your front app stays in front.

● agent: needs something only an app's UI can do
│
● macos-harness get_app_state --app "TextEdit"       the window as numbered text
│
● macos-harness click --app "TextEdit" --element_index 12
│
● macos-harness get_app_state --app "TextEdit"       only what changed
│
✓ task complete                                      you kept working the whole time

Your agent now has a Mac.

Give it to your agent

Paste this into Claude Code, Codex, Pi or OpenCode:

Install or upgrade macOS Harness from https://github.com/browser-use/macos-harness with uv using Python 3.12. Then run `macos-harness install --agent NAME`, where NAME is the agent CLI you are (claude, codex, pi or opencode), and `macos-harness doctor`. Explain any missing macOS permission and ask before requesting it. Finally read one app that is already running, without bringing it to the front: `macos-harness get_app_state --app Finder`.

That is it. The agent installs the package, gets the skill, checks permissions and reads its first app. Manual setup is available too. To go back to an older release, run macos-harness uninstall --agent all first.

Eleven tools. Any app.

macos-harness get_app_state --app "TextEdit"
macos-harness click --app "TextEdit" --element_index 12
macos-harness type_text --app "TextEdit" --text "hello world"
macos-harness press_key --app "TextEdit" --key "super+s"
macos-harness set_value --app "TextEdit" --element_index 7 --value "report.txt"
macos-harness scroll --app "TextEdit" --element_index 3 --direction down --pages 1
macos-harness get_app_state --app "TextEdit"

Read, act, read again. get_app_state prints one line per thing on screen, each with a number, and the path of a screenshot. Every other tool takes that number, or a pixel of that screenshot. The rest of the eleven: list_apps, drag, paste, select_text and perform_secondary_action.

There are no Spotify tools, Slack tools or Final Cut tools. The model gets the same eleven commands for every app. The skill is one page, and it is all an agent needs to read.

How it works

   agent's shell                      helper (starts on the first call)
        │                                         │
  macos-harness click ...  ── local socket ──▶  numbers, last state, sessions
        │                                         │
   text on stdout          ◀──────────────  accessibility tree + window screenshot
                                                  │
                                    accessibility actions first, else events
                                    sent to the app's own process

Permissions and privacy

macos-harness doctor reports the macOS permissions: Accessibility and Screen Recording, which every call needs, and two optional ones, for the app that starts the harness.

While paste runs, what was on your clipboard is kept in a file only you can read (in the state folder) for about four seconds, so that it can be put back, also after a crash.

Anonymous telemetry is enabled by default. It records only the CLI command category, success, duration, package version, OS/architecture, and detected agent client. It never records prompts, app names, screenshots, UI text, scripts, paths, or window titles.

macos-harness telemetry disable

Experimental. macOS only. MIT licensed.

macos-harness (browser-use/macos-harness)

正在搜索数据库…

这是什么?macos-harness 是一个轻量的 Python harness,它通过少数几个原始原语(而不是预构建的应用专用工具)让 LLM 代理直接控制一台 Mac。
这是一个内置各种现成方案的框架,还是更简单的东西?它刻意不做框架:没有 Spotify、Slack 或 Final Cut 工具,也没有预定义的工作流。它只是在单个 Python 进程中暴露六个原语(see、key、type、click、ax、script),其余都交给模型来写。
怎么让它跑起来?你把一段简短的提示词粘贴到 Codex 或 Claude Code 中,代理会自行安装软件包、学习工作流、检查权限并验证连接。也提供手动安装的途径。
它支持哪些编程代理?它设计为交给 Codex 或 Claude Code 使用,由它们自行安装并引导启动;harness 本身作为 Python 进程与你的真实浏览器并行运行。
它适合日常生产使用了吗?不适合。README 将该项目标注为实验性且仅限 macOS,因此应把它视为早期工具,而不是为日常使用打磨成熟的东西。
它也能在其他操作系统上工作吗?不能。它专门围绕 macOS 的辅助功能和 Apple Events API 构建,因此只能在 Mac 上运行。
它会上报哪些数据?匿名遥测默认开启,但只记录 CLI 命令类别、成功与否、耗时、软件包版本、操作系统/架构以及检测到的代理客户端;它绝不会记录提示词、应用名称、截图、UI 文本、脚本、路径或窗口标题。
代理工作时它会移动我真实的鼠标指针吗?不会。它会绘制一个可点击穿透的动画指针覆盖层,并把输入直接发送到目标应用的进程,因此你真实的指针和窗口的层叠顺序都保持不变。
它能看见后台运行的应用并与之交互吗?可以。它可以在不把后台应用窗口带到前台的情况下捕获它们,并将键盘和坐标输入直接发送到应用的 PID。
它如何处理真实已登录的浏览器?它通过 CDP 使用 Browser Harness 来控制你真实已登录的浏览器会话,而不是另起一个单独的自动化浏览器。
代理获得的六个原语是什么?see、key、type、click、ax(辅助功能/Apple Events)和 script,另外还有普通的 Python 环境,browser、Path 和 subprocess 在同一进程中可用。
大小
6 MB
星标
1K
时长
3个月
提交 · 90 天