noracu 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,136 +1,116 @@
1
1
  # noracu
2
2
 
3
- **一个跑在本机的 MCP server:让 MCP 客户端(Claude Desktop、Claude Code、Cursor 等)按 `element_index`
4
- 操作 macOS 应用和浏览器,并且说清楚每个动作做成了没有。不需要 API key,没有遥测。**
3
+ **运行在本机的 MCP server,让 Claude Desktop、Claude Code、Cursor 或任意 stdio MCP 客户端操作 macOS 应用和浏览器。你在用键盘或鼠标时它不发送 Mac 输入,并报告每次输入是否送达。**
5
4
 
6
- English: [README.md](../README.md)。下面链接到的文档目前是英文的。
5
+ 无需 API key,无遥测。iPhone 层为实验性,默认关闭。
6
+ 需要 Node.js 20+;Mac 层需要 macOS 15+,浏览器层在 Playwright 能运行的系统上都能用。
7
+ 在一台 macOS 27.2 的 Apple 芯片 Mac 上测试,另在 macOS 26.7.1 上做过安装和读取测试([详情](known-issues.md#where-it-was-tested))。
7
8
 
8
- ![noracu 演示](https://github.com/sgInnora/noracu/releases/download/v0.3.0/noracu-demo.gif)
9
+ [English](../README.md) · 简体中文。除本页外,链接到的文档目前为英文。
9
10
 
10
- *在你自己的 Chrome 里,noracu 打开一个标签页,从页面上读一个数字,再把它打进"备忘录"的一条新笔记。
11
- 用你自己的 Chrome 要手动开启:`NORACU_ALLOW_CHROME=1`,加上 Chrome 的远程调试开关(见 [usage.md](usage.md) 第 5b2 节);
12
- 不开的话,浏览器层用它自己的配置目录。*
11
+ [![npm](https://img.shields.io/npm/v/noracu.svg)](https://www.npmjs.com/package/noracu)
12
+ [![node](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org)
13
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](../LICENSE)
14
+ [![sgInnora/noracu MCP server](https://glama.ai/mcp/servers/sgInnora/noracu/badges/score.svg)](https://glama.ai/mcp/servers/sgInnora/noracu)
13
15
 
14
- ## 它做什么
16
+ ![noracu 演示](https://github.com/sgInnora/noracu/releases/download/v0.3.3/noracu-demo.gif)
15
17
 
16
- | 层 | 工具 | 靠什么 | 状态 |
17
- |---|---|---|---|
18
- | **Mac** | 20 个(`mac_*`) | macOS 辅助功能 API、cliclick、screencapture | 稳定 |
19
- | **浏览器** | 13 个(`browser_*`) | Playwright:它自己的配置目录,或你的 Chrome(要手动开启:`NORACU_ALLOW_CHROME=1` 加 Chrome 的远程调试开关) | 稳定 |
20
- | **iPhone**(镜像) | 14 个(`phone_*`) | Apple 的"iPhone 镜像",在 Mac 上做 OCR | 实验性,默认关 |
21
- | **iPhone**(XCUITest) | 9 个(`ios_*`) | 手机上的一个 UI 测试 runner,用 Xcode 构建 | 实验性,默认关 |
18
+ *在 noracu 独立的浏览器配置目录里,代理从本地演示页读出一个数字,输入到一个新的「文本编辑」文档;你移动鼠标时,Mac 输入返回 `user_active`,在你停下之前什么也不输入。*
22
19
 
23
- 代理先取一份快照(Mac 上是辅助功能树,浏览器里是 ARIA 树),拿到带编号的元素列表,再按 `element_index`
24
- 操作。树不够用时可以截图。
20
+ ## 它做什么
25
21
 
26
- ## 快速开始
22
+ - **Mac:** 20 个 `mac_*` 工具通过 Accessibility API 读取和操作应用;需要真实指针或键盘的点击、拖拽和按键用 `cliclick` 发送。
23
+ - **浏览器:** 13 个 `browser_*` 工具用独立的浏览器配置目录驱动 Playwright;手动开启后也可以在你自己的 Chrome 里工作。
24
+ - **iPhone(实验性,默认关闭):** 通过「iPhone 镜像」(`phone_*`),或手机上的 Xcode UI 测试 runner(`ios_*`),见 [iphone.md](iphone.md)。
27
25
 
28
- **1. 安装**(Node ≥ 20;没有 postinstall 脚本),装在一个你会留着的文件夹里:
26
+ 先观察一个应用或页面,再按这次观察给出的 `element_index`(快照元素编号)操作元素。编号有效期 30 秒,操作前会再核对一次。
27
+ 每次输入都报告 `delivered_verified`、`delivered_unverified`、`not_delivered` 或 `unknown`,以及 `retry=safe` 或 `retry=unsafe`。
29
28
 
30
- ```bash
31
- npm install noracu # server 在 node_modules/noracu/src/server.mjs
32
- brew install cliclick # Mac 上的物理输入要用(按键、拖拽、需要动指针的点击)
33
- npx noracu --doctor # 检查这台机器,并打印出给客户端用的配置
34
- ```
29
+ ## 快速开始
35
30
 
36
- **2. 加到你的 MCP 客户端。** `--doctor` 会打印出要粘贴的内容,路径都是这台机器上的绝对路径:Claude Code 是一条命令,
37
- Claude Desktop 和 Cursor 是一段 JSON。手写的话是下面这样。
31
+ ### 1. 安装
38
32
 
39
- Claude Code(从终端启动,`PATH` 里有 Node):
33
+ 装在一个你会保留的目录里(noracu 不运行任何安装脚本):
40
34
 
41
35
  ```bash
42
- claude mcp add noracu -- npx -y noracu
36
+ npm install noracu
37
+ brew install cliclick # 需要真实指针或键盘的点击、拖拽和按键要用
38
+ npx noracu doctor # 检查这台 Mac,并打印你的客户端配置
43
39
  ```
44
40
 
45
- Claude Desktop(`~/Library/Application Support/Claude/claude_desktop_config.json`)和 Cursor
46
- (`~/.cursor/mcp.json`)是从程序坞启动的,读不到 shell 的 `PATH`,要写绝对路径(`which node` 给出 node 的路径):
47
-
48
- ```json
49
- {
50
- "mcpServers": {
51
- "noracu": {
52
- "command": "/opt/homebrew/bin/node",
53
- "args": ["/绝对路径/node_modules/noracu/src/server.mjs"]
54
- }
55
- }
56
- }
57
- ```
41
+ ### 2. 配置 MCP 客户端
58
42
 
59
- 然后把客户端完全退出(包括菜单栏图标)再打开。
43
+ 粘贴 `noracu doctor` 打印出的内容:Claude Code 用的是一条 `claude mcp add` 命令,Claude Desktop 或 Cursor 用的是一段 JSON,里面是这台 Mac 上的绝对路径。完全退出客户端(菜单栏图标也要退出)再重新打开。手写配置见 [troubleshooting.md](troubleshooting.md#configure-a-client-by-hand)。
60
44
 
61
- **3. 把权限给客户端应用,不是给 `node`。** 系统设置 → 隐私与安全性 → **辅助功能** 和 **录屏与系统录音**
62
- (较早的 macOS 上叫「屏幕录制」)→ 打开 Claude Desktop、Cursor 或你的终端。授权后再完全退出、重开一次客户端。
45
+ ### 3. 授予 macOS 权限
63
46
 
64
- **4. 检查。** 调用 `mac_status`:它会说客户端有没有这两项权限、找没找到 cliclick。再让访达在最前面,调用
65
- `mac_ax_state`,能返回一棵带编号的树就说明通了,点击是之后的事。浏览器:`browser_launch` →
66
- `browser_navigate` → `browser_snapshot` → 带 `element_index` 的 `browser_click`。
47
+ 在「系统设置 → 隐私与安全」里打开 **辅助功能** 和 **录屏与系统录音**(macOS 27 上是 **Device Control and Data Access**),给实际运行 noracu 的程序:用 Claude Desktop 时是你配置里的 `node`(Claude Desktop 把每个 server 作为单独的进程启动);用 Cursor 时是 Cursor;用 Claude Code 时是终端。然后退出并重新打开客户端。`mac_status` 会报告这两项权限,缺哪项时说明该给谁打开,也报告有没有找到 `cliclick`。
67
48
 
68
- **5. 试一下。** 可以对客户端说这三句,都只读不改:
49
+ ### 4. 试一下
69
50
 
70
- - "调用 noracu 的 `mac_status`,告诉我还缺什么。"
71
- - "用 noracu 读最前面的访达窗口,列出里面有什么。"
72
- - "用 noracu 在浏览器里打开 example.com,告诉我页面的标题。"
51
+ 试试这三句:
73
52
 
74
- 不通的话看 [troubleshooting.md](troubleshooting.md)。还是不行,或者某个应用 noracu 读不好、操作不好:
75
- [报告问题](https://github.com/sgInnora/noracu/issues/new?template=bug.yml) 或 [报告一个应用](https://github.com/sgInnora/noracu/issues/new?template=app-report.yml),都不需要 clone 仓库。
53
+ - 「调用 noracu 的 mac_status,告诉我还缺什么。」
54
+ - 「用 noracu 读取最前面的访达窗口,列出里面有什么。」
55
+ - 「用 noracu 在浏览器里打开 example.com,告诉我页面上写了什么。」第一次启动会下载 Chromium,可能返回 `browser_installing`;过一分钟再问。
76
56
 
77
- ## 它怎么做事
57
+ ## 它怎么做
78
58
 
79
- - **按元素操作,不按像素。** `element_index` 指的是上一份快照里的某个元素,30 秒内有效。动手之前会重新确认这个
80
- 元素;不在了或变了,就回 `element_no_longer_valid`。
81
- - **说清发生了什么。** 每个输入结果都带 `delivered_verified`(看到了变化)、`delivered_unverified`、
82
- `not_delivered` 或 `unknown`,以及重试是否安全。
83
- - **坐在 Mac 前的人优先。** 最近 2 秒里用过键盘或鼠标,Mac 和 iPhone 的输入先把这 2 秒等满一次;那时人还在用,
84
- 就回 `user_active`,什么都不发。
85
- `NORACU_USER_IDLE_S=0` 可以关掉。
86
- - **关着的开关就是关着。** `NORACU_READ_ONLY=1` 只许观察;`NORACU_STOP_FILE` 指的文件存在时不发任何输入;
87
- `NORACU_DENY_APPS` 和 `NORACU_APPROVAL_FILE` 决定哪些应用可以收输入(终端和 IDE 默认拒绝);
88
- 在页面里跑脚本和打开 `file://` 默认关。
89
- - **留在这台机器上。** 用的是你已经登录的浏览器配置和 Mac 应用。除了 Playwright 第一次下载 Chromium,
90
- noracu 自己不发任何网络请求。工具返回的内容(文字、截图)仍会由你的客户端发给它用的模型。
59
+ - **过期的目标和被挡住的物理点击什么也不发。** 过期或变了的 `element_index` 返回 `element_no_longer_valid`;Mac 上对被挡住的目标做物理点击或拖拽返回 `occluded`。两种情况都什么也没发送。
60
+ - **重复调用前先看 `retry`。** `retry=safe` 表示重复这次调用是安全的;`retry=unsafe` 时,输入可能已经部分或全部发出,先重新观察。
61
+ - **Mac 前的人优先。** 如果最近 2 秒内用过键盘或鼠标,`mac_*` 输入(以及实验性、默认关闭的「iPhone 镜像」`phone_*` 输入)会再等这 2 秒一次;如果你还在用,就返回 `user_active`,什么也不发送。`browser_*` 和 `ios_*` 输入不等待。`NORACU_USER_IDLE_S=0` 关闭等待。
62
+ - **只读模式。** `NORACU_READ_ONLY=1` 拒绝所有输入、`browser_tabs`,以及剪贴板和通知的读取;独立浏览器的 `browser_launch` 和 `browser_navigate` 仍然可用,所以页面照样会加载。
63
+ - **停止文件。** 只要 `NORACU_STOP_FILE` 指定的文件存在,每个输入工具(包括浏览器的)都返回 `user_stopped`,什么也不发送;删掉这个文件即可恢复。
64
+ - **默认拒绝常见的终端和 IDE。** 发给它们(终端,以及内置终端的 IDE)的输入返回 `input_denied`;`NORACU_DENY_APPS` 改这个拒绝名单,`NORACU_APPROVAL_FILE` 增加 allow / ask / deny 规则(`approval_required`)。
65
+ - **页面脚本和 `file://` 默认关闭。** 没有 `NORACU_ENABLE_EVAL=1` 时,`browser_evaluate` 返回 `eval_disabled`;`file://` 页面需要 `NORACU_ALLOW_FILE_URL=1`。
66
+ - **一次读取可能设置一个标志。** `mac_ax_state` 和 `mac_find` 会尝试在 Electron 和 Chromium 应用上设置 `AXManualAccessibility`,让它们的页面出现在树里(Google Chrome 不接受);`web_accessibility: false` 或只读模式下不设置。
67
+ - **本地运行,无遥测。** 运行时,noracu 自己不发起任何网络连接,只有 Playwright 一次性下载 Chromium 例外(`NORACU_DISABLE_AUTO_INSTALL=1` 关闭)。页面会发起它们自己的连接;你的 MCP 客户端会把工具结果(包括文字和截图)发给它的模型。
91
68
 
92
- ![坐在 Mac 前的人优先](https://github.com/sgInnora/noracu/releases/download/v0.3.0/noracu-person-goes-first.gif)
69
+ ## 它防不住什么
93
70
 
94
- *鼠标在用的时候,每次调用都回 `user_active`、不打字;停下 2 秒后继续。*
71
+ - **欺骗性的内容。** 屏幕文字、辅助功能标签、OCR 和网页内容原样交给你的模型;noracu 不识别提示注入或伪造的对话框。先用 `NORACU_READ_ONLY=1`,并保持客户端的确认提示打开。
72
+ - **没有沙箱,不遮挡屏幕内容。** noracu 以你的 MCP 客户端的权限,在已登录的应用里操作;屏幕上可见的密码、验证码和通知横幅都会交给模型;macOS 的隐私授权和管理员对话框不会被识别;noracu 不限制宿主应用自己的 shell 或文件工具。
73
+ - **你可能看不到的操作。** Accessibility 动作和后台点击不移动指针(`NORACU_NO_BGPOST=1` 关闭后台点击);Electron 和 Chromium 应用里的物理点击会移动真实指针,除非通过 `cdp_port` 驱动([usage.md](usage.md#electron-over-devtools))。
74
+ - **应用规则只管输入。** 拒绝名单和审批文件不阻止 `mac_app` 启动、激活或退出应用(`cdp_port` 启动除外),也不阻止 `mac_window` 移动窗口。
75
+ - **iPhone 层(实验性,默认关闭)。** 手机上显示的内容(通知、消息、验证码)会交给模型;有些 iOS 应用会把「iPhone 镜像」的每次截取当作截屏;XCUITest 需要手机处于解锁状态。见 [iphone.md](iphone.md)。
95
76
 
96
- ## 它不防什么
77
+ 每个默认值和开关、[威胁模型](../SECURITY.md#threat-model)和私下报告漏洞的方式见 [SECURITY.md](../SECURITY.md);已知限制见 [known-issues.md](known-issues.md)。
97
78
 
98
- - **骗人的内容。** 屏幕上的文字、辅助功能名称、网页内容会原样交给模型。noracu 不识别假弹窗,也不识别提示注入;
99
- 模型拿它们怎么办由客户端决定。先用 `NORACU_READ_ONLY=1`,并保留客户端对输入类工具的确认。
100
- - **没有沙箱。** noracu 以 MCP 客户端的权限,在你已登录的应用里操作。
101
- - **按应用的规则只管输入。** 拒绝名单和审批文件拦不住 `mac_app` 启动、切到前台或退出名单里的应用,
102
- 也拦不住 `mac_window` 移动它的窗口。
103
- - **Electron 和 Chromium 应用**不接受后台点击,在那里的物理点击会移动指针。它们的页面可以改走 DevTools 端口
104
- (`cdp_port`,见 [usage.md](usage.md))。
105
- - **两个 iPhone 层都是实验性的**,各有限制,见 [iphone.md](iphone.md)。
79
+ ## 不做什么
106
80
 
107
- 默认值、开关和已知缺口的完整清单在 [SECURITY.md](../SECURITY.md)。已知做不到的事(比如应用的窗口在别的桌面上时读不到),
108
- 以及改过但还没在真机上重新跑过的地方,写在 [known-issues.md](known-issues.md)。
81
+ - 不内置模型:noracu 观察和操作,决定由你的 MCP 客户端做。
82
+ - 没有 Windows 或 Linux 桌面层。
83
+ - 没有托管服务,不需要账号。
84
+ - 没有 shell 工具。
109
85
 
110
- ## 不做的事
86
+ ## 文档
111
87
 
112
- - 不内置模型:noracu 负责观察和操作,做决定的是你的 MCP 客户端。
113
- - Mac 层只面向 macOS,没有 Windows 或 Linux 的桌面层。
114
- - 不做托管服务;没有测量过的比较不写。
115
- - 不执行任意代码,除非你自己打开(`NORACU_ENABLE_EVAL=1`)。
88
+ - [usage.md](usage.md):操作示例、环境变量、错误参考
89
+ - [tools.md](tools.md):每个工具和参数,由 server 生成
90
+ - [troubleshooting.md](troubleshooting.md):手写配置、升级、权限问题
91
+ - [iphone.md](iphone.md):实验性、默认关闭的 iPhone 后端的设置与限制
92
+ - [known-issues.md](known-issues.md):已知限制,以及尚未在真机上复测的改动
93
+ - [apps.md](apps.md):noracu 跑过的应用,以及如何报告新的应用
94
+ - [architecture.md](architecture.md):server、Mac 引擎和驱动如何组合
95
+ - [SECURITY.md](../SECURITY.md):默认值、开关、威胁模型、私下报告漏洞
116
96
 
117
- ## 文档
97
+ ## 路线图
98
+
99
+ 正在考虑的方向,不是承诺:
118
100
 
119
- - [usage.md](usage.md):各层的用法示例、环境变量、错误说明
120
- - [tools.md](tools.md):全部工具和参数(由运行中的 server 生成)
121
- - [troubleshooting.md](troubleshooting.md):安装和授权问题
122
- - [iphone.md](iphone.md):两个 iPhone 后端的安装、要求和限制
123
- - [known-issues.md](known-issues.md):做不到的事,和还没在真机上重新测过的改动
124
- - [apps.md](apps.md):noracu 实际跑过的应用,以及怎么再报告一个
125
- - [architecture.md](architecture.md):server、Mac 引擎和各驱动怎么配合
126
- - [SECURITY.md](../SECURITY.md):noracu 能碰到什么、默认值和开关、威胁模型、怎么报告问题
101
+ - 浏览器动作:`hover`、`set_value`、`wait_for`。
102
+ - 更小的 Mac 观察结果:按需返回元素位置,更短的动作列表。
103
+ - 不切换桌面就读取另一个桌面空间里的窗口。
104
+ - 当菜单栏时钟不对辅助功能开放时,也能打开通知中心的历史。
105
+ - 「iPhone 镜像」(实验性,默认关闭):在 OCR 区域上提供 `element_index`,点击前再核对文字。
127
106
 
128
107
  ## 维护
129
108
 
130
- 一个人维护,没有 SLA。Mac 层需要 macOS 15 以上;iPhone 镜像层还需要 Apple 芯片或 T2 的 Mac、iOS 18 以上和
131
- "iPhone 镜像"(欧盟不提供);浏览器层在 Playwright 能跑的地方都能用。只在 Apple 芯片、macOS 27 的 Mac 上做过真机测试(没测到的范围见 [known-issues.md](known-issues.md))。
132
- 带上工具名和复现步骤的问题报告最有用,[问题表单](https://github.com/sgInnora/noracu/issues/new/choose)问的就是这些。
109
+ 一人维护,没有响应时限保证。有用的报告包含 `npx noracu doctor` 的摘要行、工具名和确切步骤:
110
+ [报告问题](https://github.com/sgInnora/noracu/issues/new?template=bug.yml) 或
111
+ [报告应用或网站](https://github.com/sgInnora/noracu/issues/new?template=app-report.yml),不需要克隆仓库。
112
+ 安全问题请私下报告([方法](../SECURITY.md#reporting-a-vulnerability))。
133
113
 
134
- ## 许可
114
+ ## 许可证
135
115
 
136
116
  MIT,见 [LICENSE](../LICENSE)。
package/docs/apps.md CHANGED
@@ -21,7 +21,7 @@ as useful as reports of apps that do not.
21
21
  | iTerm2 | snapshots only — terminals are on the default deny list, so no input is sent to them | a read-only run on 2026-11-17 |
22
22
  | Notification Center | waiting for a notification to arrive (`mac_wait`) | `test/e2e.mjs` |
23
23
 
24
- ## iPhone
24
+ ## iPhone (experimental, off by default)
25
25
 
26
26
  | App | Backend | What was exercised | Record |
27
27
  |---|---|---|---|
@@ -31,8 +31,6 @@ as useful as reports of apps that do not.
31
31
 
32
32
  ## Known not to work well
33
33
 
34
- - Any app whose windows are all on another Space: they cannot be read ([known-issues.md](known-issues.md)).
35
- - Google Chrome through the Mac layer: it refuses web accessibility, so `mac_ax_state` shows its window
36
- chrome but not the page — use the browser layer.
37
- - On the iPhone, a temporary input box that an app shows over its page (a comment box): see the limits in
38
- [iphone.md](iphone.md).
34
+ Apps and states known not to work — windows on another Space, Google Chrome's pages through the Mac layer
35
+ (Chrome refuses web accessibility: use the browser layer), a temporary input box an app shows over its page on
36
+ the experimental iPhone backends — are in [known-issues.md](known-issues.md) and [iphone.md](iphone.md).
@@ -1,6 +1,6 @@
1
1
  # noracu Architecture
2
2
 
3
- > A unified three-layer computer-use control plane — Mac / Browser / iPhone — behind a single MCP server (stdio JSON-RPC 2.0).
3
+ > A local MCP server (stdio JSON-RPC 2.0) with Mac and browser layers enabled by default, and an experimental iPhone layer that is off by default.
4
4
 
5
5
  ## Design principles
6
6
 
@@ -8,21 +8,21 @@
8
8
  - Observe: `ax_state` (Accessibility/ARIA tree) or `screenshot` (visual), chosen per step
9
9
  - Act: click / drag / scroll / key / type / paste / evaluate, by element reference (or coordinates where supported; `mac_drag` takes `from_index` / `to_index` only)
10
10
  2. **Local-first**: no cloud, no API key — every capability comes from local tools
11
- 3. **Layer autonomy**: each layer is largely independent; a missing dependency (e.g. imctl) disables only that layer. The one deliberate cross-layer path is the iPhone layer's Home / App Switcher, which prefer the iPhone Mirroring menu (driven through the Mac layer) and fall back to imctl gestures.
11
+ 3. **Layer autonomy**: each layer is largely independent; a missing dependency (e.g. imctl) disables only that layer. The deliberate cross-layer paths are `mac_app` launch with `cdp_port`, which `browser_launch` with `cdp_port` attaches to, and the iPhone layer's Home / App Switcher, which prefer the iPhone Mirroring menu (driven through the Mac layer) and fall back to imctl gestures.
12
12
 
13
- The observe/act vocabulary follows the action/observation split popularized by ChatGPT's computer-use, re-implemented on open local tooling.
13
+ Observation and action are separate steps; each layer implements them with local tools.
14
14
 
15
15
  ## Layer implementations
16
16
 
17
17
  ### Mac layer (20 tools)
18
18
 
19
- Accessibility goes through `src/mac-ax.js`, a static JXA script run as `osascript -l JavaScript src/mac-ax.js` with one JSON request on stdin and one JSON reply on stdout. It calls the Accessibility C API (`AXUIElementCopyMultipleAttributeValues`, `AXUIElementPerformAction`, `AXUIElementSetAttributeValue`, `AXUIElementCopyElementAtPosition`, …) through the Objective-C bridge instead of System Events: a Finder window of about 500 elements reads in about 0.15 s on our test Mac. Each call is a short-lived process run asynchronously under a timer, like the iPhone driver, so a hung app cannot freeze the server.
19
+ Accessibility goes through `src/mac-ax.js`, a static JXA script run as `osascript -l JavaScript src/mac-ax.js` with one JSON request on stdin and one JSON reply on stdout. It calls the Accessibility C API (`AXUIElementCopyMultipleAttributeValues`, `AXUIElementPerformAction`, `AXUIElementSetAttributeValue`, `AXUIElementCopyElementAtPosition`, …) through the Objective-C bridge instead of System Events: a Finder window of about 500 elements reads in about 0.15 s on the test Mac. Each call is a short-lived process (roughly 0.1–0.2 s for a read, 0.3–0.8 s for an action with its before/after check) run asynchronously under a timer, like the iPhone driver, so a hung app cannot freeze the server.
20
20
 
21
21
  | Tool | Implementation |
22
22
  |---|---|
23
23
  | `mac_ax_state` | engine `snapshot`: walks a window (or `surface`: menu bar, open menu, sheet, alert, dialog, popover, focused element, whole app) to a logical depth (layout wrappers without content do not count and are hidden by `compact`); `interactive` keeps actionable elements; `skeleton` maps 3 levels with `children_count`, `root` drills into one element and extends the same snapshot. Chromium/Electron apps get `AXManualAccessibility` switched on when read unless `web_accessibility: false` or `NORACU_READ_ONLY=1` (never `AXEnhancedUserInterface`, which alters window behaviour). When the app refuses it (Google Chrome: -25205), a window is searched for an `AXWebArea` (≤1.5 s): found → `exposed` (pages are in the tree anyway, e.g. Chrome started with `--force-renderer-accessibility`), else `unsupported`, and the server adds `web_accessibility_hint` |
24
24
  | `mac_find` / `mac_get` | engine `find` (role / title / value / text / AXIdentifier, substring or exact; honours `web_accessibility` like `mac_ax_state`) / `get` (one element, live: full value, states, actions, settable attributes) |
25
- | `mac_click` | element_index: the element's own action (`AXPress` / `AXConfirm` / `AXPick` / `AXOpen`, `AXShowMenu` for right-click, or selecting a row) when it has one; otherwise `cliclick` at its center after a system-wide hit test — or, when inconclusive, confirming the topmost on-screen window there is that same window by CGWindowID (`occluded` otherwise; refused when the element's window has no CGWindowID, except Finder's desktop). Right before `cliclick`, engine `frontmost` with `at` re-checks that the element's window is still on top; after the click, `observe_after` with `physical` reports `delivered_verified` only when the element is still there, changed, and `cgTopAt` still finds its window at the point. `NORACU_TEST_PHYSICAL_GAP_MS` (test hook) waits between that re-check and the click. Raw x,y: `cliclick` only when engine `frontmost` with `at` reports the topmost on-screen window there belongs to `app` (default: the frontmost app; the Window Server menu bar strip, layer 24, counts as the frontmost app's) — `occluded` otherwise, `force: true` skips the check |
25
+ | `mac_click` | element_index: the element's own action (`AXPress` / `AXConfirm` / `AXPick` / `AXOpen`, `AXShowMenu` for right-click, or selecting a row) when it has one; otherwise `cliclick` at its center after a system-wide hit test — or, when inconclusive, confirming the topmost on-screen window there is that same window by CGWindowID (`occluded` otherwise; refused when the element's window has no CGWindowID, except Finder's desktop). Right before `cliclick`, engine `frontmost` with `at` re-checks that the element's window is still on top; after the click, `observe_after` with `physical` reports `delivered_verified` only when the element is still there, changed, and `cgTopAt` still finds its window at the point. Raw x,y: `cliclick` only when engine `frontmost` with `at` reports the topmost on-screen window there belongs to `app` (default: the frontmost app; the Window Server menu bar strip, layer 24, counts as the frontmost app's) — `occluded` otherwise, `force: true` skips the check |
26
26
  | `mac_type` | `AXSelectedText` (insert at the caret) or `AXValue` (`replace`) on element_index or the focused element (the result names its app); keystrokes (`cliclick t:`) only into a text view accessibility cannot write, or — when `app` names it — into an app that reports no focused element (`no_focus` without `app`, nothing sent) |
27
27
  | `mac_set_value` | by role: `AXValue` for text (never read back or echoed on `AXSecureTextField`), sliders, combo boxes; `AXPress` for toggles (only when the state differs); `AXExpanded` / `AXDisclosing`; `AXSelected`; pop-up and menu buttons open their menu, press the one matching option, or close it again |
28
28
  | `mac_scroll` | no index: wheel event at the frontmost window; scroll area: wheel event at its center (hit-tested); other element: `AXScrollToVisible` |
@@ -38,7 +38,7 @@ Accessibility goes through `src/mac-ax.js`, a static JXA script run as `osascrip
38
38
  | `mac_clipboard_read` | `NSPasteboard`: file URLs, PNG/TIFF image, or text; `org.nspasteboard.ConcealedType` items are withheld |
39
39
  | `mac_notifications` | the Notification Center process's `AXNotificationCenter*` groups: id (`AXIdentifier`), app, title, subtitle, body, named actions, `center_opened` / `center_was_open` (`open_center: true` skips clicking the clock when positive panel evidence shows it is already open; absent or invalidated `-25202` targets return `notification_not_found`) |
40
40
 
41
- **Element identity.** An AXUIElement cannot outlive the engine process, so each `element_index` stores evidence: pid, the container (a window by its CGWindowID from `_AXUIElementGetWindow`, an open menu by its frame, the menu bar, or the app), the child-index path, a fingerprint (role, subrole, AXIdentifier, stable name — a label, never the value), the frame relative to the container, the labels of its ancestors (window-level titles such as a web page's are left out because they change with content; digits are ignored), the child count at every level of its path (shape), and an item key — the first texts under the element itself or its nearest ancestor that has any, never the container nor a web area, toolbar, scroll area or split group (static text, link labels, and a text field's value only when a cell or row lies between that ancestor and the field, i.e. table content such as Finder's name column — a form field's value is what gets typed, not identity; never button titles). An item key that two look-alikes would share (rows that only climb to the same section heading) is not recorded: it tells nothing apart. Uniqueness is counted over every element the walk visited, also those a filtered or interactive-only snapshot does not show; a walk that stopped early or was drilled into part of the container cannot know it, so its elements count as duplicated. An action follows the path and checks all of it; the shape may differ only when the element's own item (itself or its parent) vouches for it, and in a unique element's item only a number that reads as a clock time or a duration (`12:30`), a percentage, a time span with its unit (`5 min ago`), an explicit count (`3 unread`, `12 items`) or a count against a fixed total (`12/280`) may change; any other number is part of the item's name. A labelled element whose path no longer leads to it may be found by search: a unique one only near where it was (64 px), under the same ancestors and in the same item; a duplicated one only by its item key (so a re-sorted list resolves to the same item, and a look-alike that arrived after the snapshot is not taken for it); an unlabelled element is never searched for. Path steps fetch one child by index instead of whole child lists. No container, no match or several matches is `element_no_longer_valid` — never a look-alike. A search never enters the menu bar unless the element was seen there (a closed menu's items can still be pressed). Indexes are unique for the life of the server (one counter across snapshots) and last 30 s; `snapshot_id` is optional and must match the index. Known limits: in an open context menu, an identical menu opened at the same place for another row cannot be told apart; a status word that changes inside an element's item ("Saving…" → "Saved", a validation message) makes the index stale — take a new snapshot; a number in none of those forms that changes in place inside a unique element's item ("Inbox 3" → "Inbox 4") makes the index stale as well — take a new snapshot.
41
+ **Element identity.** An AXUIElement cannot outlive the engine process, so each `element_index` stores evidence: pid, the container (a window by its CGWindowID from `_AXUIElementGetWindow`, an open menu by its frame, the menu bar, or the app), the child-index path, a fingerprint (role, subrole, AXIdentifier, stable name — a label, never the value), the frame relative to the container, the labels of its ancestors (window-level titles such as a web page's are left out because they change with content; digits are ignored), the child count at every level of its path (shape), and an item key — the first texts under the element itself or its nearest ancestor that has any, never the container nor a web area, toolbar, scroll area or split group (static text, link labels, and a text field's value only when a cell or row lies between that ancestor and the field, i.e. table content such as Finder's name column — a form field's value is what gets typed, not identity; never button titles). An item key that two look-alikes would share (rows that only climb to the same section heading) is not recorded: it tells nothing apart. Uniqueness is counted over every element the walk visited, also those a filtered or interactive-only snapshot does not show; a walk that stopped early or was drilled into part of the container cannot know it, so its elements count as duplicated. An action follows the path and checks all of it; the shape may differ only when the element's own item (itself or its parent) vouches for it, and in a unique element's item only a number that reads as a clock time or a duration (`12:30`), a percentage, a time span with its unit (`5 min ago`), an explicit count (`3 unread`, `12 items`) or a count against a fixed total (`12/280`) may change; any other number is part of the item's name. A labelled element whose path no longer leads to it may be found by search: a unique one only near where it was (64 px), under the same ancestors and in the same item; a duplicated one only by its item key (so a re-sorted list resolves to the same item, and a look-alike that arrived after the snapshot is not taken for it); an unlabelled element is never searched for. Path steps fetch one child by index instead of whole child lists. No container, no match or several matches is `element_no_longer_valid` — never a look-alike. A search never enters the menu bar unless the element was seen there (a closed menu's items can still be pressed). Indexes are unique for the life of the server (one counter across snapshots) and last 30 s; `snapshot_id` is optional and must match the index. Its known limits (look-alike context menus, status words and plain numbers that change inside an item) are in [known-issues.md](known-issues.md).
42
42
 
43
43
  **Delivery.** Accessibility return codes do not prove an effect (Finder returns success for an action that does not exist), so actions read the element and its app before and after: value, selection, state, focus, windows, sheets, open menus, frontmost app. A change is `delivered_verified`; none is `delivered_unverified`; refusals before anything was sent are `not_delivered` with `retry=safe`; an app that did not answer is `unknown` with `retry=unsafe`.
44
44
 
@@ -54,73 +54,37 @@ A single persistent Playwright session (one browser, one context), held in a `Ma
54
54
  - Act: `browser_click` (element_index / selector / xy; element_index clicks run a tag/name/href/position TOCTOU check first), `browser_fill`, `browser_press_key`, `browser_type`, `browser_scroll`, `browser_evaluate`
55
55
  - Read: `browser_read` (page text, optional selector)
56
56
 
57
- ### iPhone layer (14 tools)
57
+ ### iPhone Mirroring layer (14 tools; experimental and off by default)
58
58
 
59
- The bundled imctl driver (`imctl/`, Python) runs as a subprocess (`<python3> -m imctl.cli`, PYTHONPATH = `imctl/src`, no bytecode written). The interpreter is `NORACU_PYTHON` or the first of `/opt/homebrew/bin/python3`, `/usr/local/bin/python3`, `python3`, `/usr/bin/python3` that imports pyobjc (Quartz, Vision, AppKit); probed once, lazily, on the first `phone_*` call. imctl remembers where the phone screen sits inside the mirror window (one entry per window size and macOS version) in `~/Library/Caches/noracu/phone-screen-rect.json`, so that taps and swipes need no capture of the window to stay off its margin. **Experimental**: when no such python exists, tools return a structured one-line `imctl unavailable` error with the install command rather than crashing the server (`phone_home`/`phone_app_switcher` still work via the iPhone Mirroring menu on English macOS while the mirror is live; non-English macOS falls back to `imctl`).
59
+ Enable this layer explicitly with `NORACU_LAYERS=mac,browser,iphone`. The bundled imctl driver (`imctl/`, Python) runs as a subprocess (`<python3> -m imctl.cli`, PYTHONPATH = `imctl/src`, no bytecode written). The interpreter is `NORACU_PYTHON` or the first of `/opt/homebrew/bin/python3`, `/usr/local/bin/python3`, `python3`, `/usr/bin/python3` that imports pyobjc (Quartz, Vision, AppKit); probed once, lazily, on the first `phone_*` call. imctl remembers where the phone screen sits inside the mirror window (one entry per window size and macOS version) in `~/Library/Caches/noracu/phone-screen-rect.json`, so that taps and swipes need no capture of the window to stay off its margin. **Experimental**: when no such python exists, tools return a one-line `imctl_unavailable` error naming the install command rather than crashing the server (`phone_home`/`phone_app_switcher` still work via the iPhone Mirroring menu on English macOS while the mirror is live; non-English macOS falls back to `imctl`).
60
60
 
61
61
  - Observe: `phone_ocr` (coordinates + text), `phone_screenshot` (captures the Mirroring window by CGWindow id, so a covered window still yields its own pixels; never a screen-region capture — `capture_failed` instead), `phone_find` (locates text; text passed on stdin)
62
62
  - Act: `phone_tap/longpress/swipe` (normalized 0-1 coordinates), `phone_home` / `phone_app_switcher` (iPhone Mirroring menu by bundle id first, imctl gesture fallback when the English menu item is absent), `phone_scroll`, `phone_type` (clipboard-based via stdin, IME-safe, never echoes typed text), `phone_key`
63
63
  - Session: `phone_status` (running, window, window_id, onscreen, frontmost, live, overlay, paused, setup — read from the window's AX structure and shape: a live mirror is one empty AXHostingView group; an overlay such as "Connection Paused" or "iPhone in Use" adds static text and a button; a setup screen sits in a nearly square window), `phone_launch` (ensure running + frontmost, clicks the single Resume button of a paused overlay, refuses setup screens with `mirror_setup_required`), `phone_open` (Spotlight via the iPhone Mirroring shortcut, paste the name via stdin, tap only an exact OCR label inside Spotlight's "Top Hit" card, reading `NORACU_TOPHIT_LABELS`; otherwise back to the Home Screen)
64
64
  - Safety: while the mirror is not live or its state cannot be confirmed, every phone input tool (`phone_tap`, `phone_longpress`, `phone_swipe`, `phone_scroll`, `phone_type`, `phone_key`, `phone_open`, `phone_home`, `phone_app_switcher`, plus CLI `imctl page`) fails closed with `mirror_not_live` or `mirror_state_unknown` without stealing focus when paused or closed; `phone_ocr` / `phone_find` prefix a warning. The phone layer has no `element_index`: OCR coordinates are normalized to the window, and nothing re-verifies the target before a tap (optional `expect` checks pre-action OCR text).
65
65
 
66
- ### iPhone layer, XCUITest backend (9 tools, opt-in)
66
+ ### XCUITest backend (9 tools; experimental and off by default)
67
67
 
68
- `NORACU_PHONE_BACKEND=xcuitest` lists the `ios_*` tools instead of `phone_*` (both groups are defined in one table; only the chosen one is offered). Three files:
68
+ With the iPhone layer explicitly enabled, `NORACU_PHONE_BACKEND=xcuitest` lists the `ios_*` tools instead of `phone_*` (both groups are defined in one table; only the chosen one is offered). It drives a connected iPhone or a booted simulator. Three files:
69
69
 
70
70
  - `ios-runner/` — the runner: one UI-test bundle (Swift, no host app) whose single test, `testServe`, listens on the address it is given and executes one JSON command per line on the main thread ([protocol](ios-runner-protocol.md)). It never launches apps, never touches the clipboard, and makes no outbound connection.
71
- - `src/ios-xcuitest.js` — the Mac-side client: `devicectl` (read through `--json-output` files) for the device list, the lock state and app launches, `simctl` for launches on a simulator, `xcodebuild test-without-building` to start the runner, and one TCP connection with a hard time limit per call. A call that timed out is never re-sent.
71
+ - `src/ios-xcuitest.js` — the Mac-side client: `devicectl` (read through `--json-output` files) for the iPhone list, the lock state and app launches, `simctl` for the simulator list (not every Xcode's `devicectl` lists simulators) and launches on a simulator, `xcodebuild test-without-building` to start the runner, and one TCP connection with a hard time limit per call. A call that timed out is never re-sent.
72
72
  - `src/ios-session.js` — the tools: device choice, starting the runner on the first call that needs it, `element_index` (30 s, ended by `ios_home` / `ios_launch`, re-read before use), the gates before every input (app rule on the bundle id, a running runner, the lock), and the read-back that decides whether `ios_type` is verified.
73
73
 
74
- `src/ios-setup.js` is the `noracu ios-setup` command (`xcodebuild build-for-testing` into `~/.noracu/ios-runner/<udid>`). `ios_*` calls share the input queue with the Mac and Mirroring tools (the runner takes one command at a time); their input checks the stop file but does not wait for the person at the Mac. Tests replace Apple's tools through `NORACU_IOS_XCRUN` and `NORACU_IOS_XCODEBUILD` (`test/fixtures/`: a fake `xcrun`, and a fake `xcodebuild` that serves a model phone); `test/ios-live.mjs` runs the tools against a real iPhone or simulator.
74
+ `src/ios-setup.js` is the `noracu ios-setup` command (`xcodebuild build-for-testing` into `~/.noracu/ios-runner/<udid>`). `ios_*` calls share the input queue with the Mac and Mirroring tools (the runner takes one command at a time); their input checks the stop file but does not wait for the person at the Mac.
75
75
 
76
76
  ## Concurrency and lifecycle
77
77
 
78
78
  - **Child processes.** Every subprocess (the accessibility engine, imctl, cliclick, screencapture, `open`, `ps`, the Chromium installer) runs asynchronously under its own timer and in its own process group; on expiry the group gets SIGTERM, then SIGKILL after 1.5 s. Nothing blocks the event loop, so `ping` and `tools/list` are answered while a call runs.
79
79
  - **Input queue.** `phone_*` and Mac input tools go through one FIFO queue (they share the real mouse, keyboard, clipboard and windows). A queued call that the client cancelled, or that waited longer than 60 s (or `NORACU_PHONE_TIMEOUT_MS` + 15 s), is dropped without acting (`input_busy`). A call the client cancels while it runs is not answered either: `mac_wait` and `phone_type` stop at once — their accessibility engine or `imctl` process is ended as on a timeout, and `phone_type` puts the clipboard back only if the paste had not gone out yet — and `browser_type` stops typing. When a call leaves the queue, an input tool is refused first if `NORACU_STOP_FILE` exists (`user_stopped`), then if the person at the Mac used the keyboard or mouse in the last `NORACU_USER_IDLE_S` seconds (`user_active`); the deny list and approval file are checked inside each tool, on the app that receives the input. `mac_clipboard_read`, `mac_notifications` and every `phone_*` tool (reads included: they capture the mirroring window) stay in the queue.
80
80
  - **Observations.** `mac_ax_state`, `mac_find`, `mac_get`, `mac_windows`, `mac_apps`, `mac_screenshot`, `mac_status` and `mac_wait` do not join the queue: each waits for the inputs queued before it to finish (or returns `input_busy` past the queue limit), then runs, so it sees their effect and later inputs are not held up behind it.
81
+ - **Call tracing.** When `NORACU_TRACE` names a file, each finished or cancelled call appends `{ts, tool, args, ms, error, code}` — argument names and sizes and the error's code only, never argument text, result text or error messages — to a file opened `0600` with `O_NOFOLLOW` (symlinks refused); a call the client cancelled is logged as `cancelled`, or `cancelled_queued` if it was still waiting in the input queue.
81
82
  - **Shutdown.** When the client closes stdin, or on SIGTERM / SIGINT / SIGHUP: no new calls, queued calls are dropped, no new child process starts, children get SIGTERM then SIGKILL, browsers (also one still starting) are closed (a CDP attachment only disconnects), and the process exits within 3 s.
82
83
 
83
84
  ## Configuration
84
85
 
85
- | Environment variable | Default | Description |
86
- |---|---|---|
87
- | `NORACU_PYTHON` | auto-probe (see iPhone layer) | python3 that runs the bundled driver; must import pyobjc |
88
- | `NORACU_IMCTL_DIR` | bundled `imctl/` (`src/../imctl`) | override the driver location (development only) |
89
- | `NORACU_CLICLICK` | `/opt/homebrew/bin/cliclick` | path to cliclick |
90
- | `NORACU_READ_ONLY` | unset (full control) | `=1` observation-only mode: a default-deny allowlist of 21 tools — the observe tools (`mac_screenshot`, `mac_ax_state`, `mac_find`, `mac_get`, `mac_status`, `mac_apps`, `mac_windows`, `mac_wait` except `condition: "notification"`, `browser_snapshot`, `browser_screenshot`, `browser_read`, `phone_status`, `phone_screenshot`, `phone_ocr`, `phone_find`, `ios_status`, `ios_snapshot`, `ios_screenshot`) plus standalone browser session lifecycle (`browser_launch`, `browser_navigate`, `browser_close`; `mac_ax_state` / `mac_find` skip `web_accessibility`). `browser_navigate` still issues a page-load request. All input-synthesis tools (click/drag/type/key/paste/tap/swipe/evaluate/…) plus `mac_clipboard_read` and `mac_notifications` are rejected |
91
- | `NORACU_ENABLE_EVAL` | unset (off) | `=1` turns `browser_evaluate` on (arbitrary JS execution is opt-in; unset, it returns `eval_disabled` and stays listed) |
92
- | `NORACU_DISABLE_EVAL` | unset | `=1` keeps `browser_evaluate` off even when `NORACU_ENABLE_EVAL=1` (kill switch) |
93
- | `NORACU_DISABLE_AUTO_INSTALL` | unset (auto-install) | `=1` stops `browser_launch` from auto-running `playwright install chromium` on a clean machine; returns an error prompting a manual install instead |
94
- | `NORACU_ALLOW_FILE_URL` | unset (blocked) | `=1` permits `browser_navigate` to open `file://` URLs (blocked by default to avoid local-file exfiltration via the browser layer) |
95
- | `NORACU_ALLOW_CHROME` | unset (blocked) | `=1` permits `browser_launch` with `chrome: true`: reads `DevToolsActivePort` from `NORACU_CHROME_DIR` (default the Chrome profile folder), `connectOverCDP` to `ws://127.0.0.1:<port><path>` (Chrome asks the person), opens a window with `Target.createTarget` (`newWindow`, `background`); `openTabs`/`tabAllowed` then count only pages noracu opened or whose opener it opened (with `NORACU_CHROME_TABS=all` also your other http(s) tabs, which can be selected, read and acted on but are never closed, and where `browser_evaluate` never runs); new tabs come from `window.open(…, "noopener")` run in an isolated world of one of its tabs; `browser_close` closes those pages and disconnects; refused under `NORACU_READ_ONLY=1` |
96
- | `NORACU_ALLOW_CDP` | unset (blocked) | `=1` permits `mac_app` launch with `cdp_port` and `browser_launch` with `cdp_port` for a port this process opened (live PID, matching `webSocketDebuggerUrl`; Playwright `connectOverCDP` to 127.0.0.1); `=any` also lets `browser_launch` attach to any loopback DevTools port; refused under `NORACU_READ_ONLY=1`; `browser_close` then only disconnects |
97
- | `NORACU_PHONE_TIMEOUT_MS` | 30000 (45000 for `phone_open` / `phone_type`) | time limit for each iPhone-layer step, 1000–600000 ms (`imctl_timeout` on expiry) |
98
- | `NORACU_OCR_LANGUAGES` | `zh-Hans,en-US` | comma-separated Vision OCR language codes for the iPhone screen, in priority order |
99
- | `NORACU_TOPHIT_LABELS` | `Top Hit` | comma-separated Spotlight Top Hit section label(s) that `phone_open` looks for |
100
- | `NORACU_OCR_MIN_CONFIDENCE` | unset (off) | opt-in, experimental: a number above 0 and at most 1. With it, `phone_open` does not tap a Spotlight label the recognizer read with a lower confidence and answers `open_not_confirmed` with nothing tapped; a value that is set and is not such a number makes `phone_open` refuse (`invalid_args`, nothing sent). Set or not, `phone_open`'s result line names the confidence of the label it tapped |
101
- | `NORACU_TRACE` | unset | file path for a JSON-lines call log (`{ts, tool, args, ms, error, code}` — argument names/sizes and error code prefix only, never argument text, result text, or error messages; opened `0600` with `O_NOFOLLOW`, refusing symlinks; a call the client cancelled is logged with code `cancelled`, or `cancelled_queued` if it was still waiting in the input queue) |
102
- | `NORACU_USER_IDLE_S` | `2` | seconds without the person's keyboard or mouse input before a Mac or iPhone Mirroring (`phone_*`) input tool acts (the `ios_*` tools do not wait: they do not use this Mac's keyboard or mouse); a call that comes sooner waits out the rest once and answers `user_active` if they are still using it; also puts the pointer back after pointer actions; `0` turns both off |
103
- | `NORACU_NO_BGPOST` | unset | `=1` turns off background input (physical clicks and named keys use the real pointer and the HID key path) |
104
- | `NORACU_STOP_FILE` | unset | file path: while it exists, every input tool — Mac, iPhone and the browser's input tools (navigate, click, type, fill, press_key, scroll, evaluate, `browser_tabs` new/close) — returns `user_stopped` and sends nothing; set but blank, it refuses all input |
105
- | `NORACU_DENY_APPS` | the common terminal apps and IDEs with a built-in terminal | comma-separated bundle ids / app names (`*`, `?`) that never get input; a list of your own adds to the default, blank keeps the default, a list starting with `none` drops it |
106
- | `NORACU_APPROVAL_FILE` | unset | `0600` JSON `{allow, ask, deny}` of bundle-id / app-name patterns, judged on the app that receives the input; `ask` or unlisted → `approval_required`; a broken file refuses all Mac and iPhone input (app rules do not judge the browser layer) |
107
-
108
- ## Known limitations (v0.2)
109
-
110
- - Every Mac-layer call starts a short-lived `osascript` (and `cliclick` for physical input); reads take roughly 0.1–0.2 s on our test Mac, an action with its before/after check 0.3–0.8 s. A resident engine process could keep elements alive between calls and cut this further
111
- - Notification Center's history is listed only while it is open; opening it needs the menu-bar clock, which accessibility does not expose on every macOS version
112
- - No snapshot diffing; `skeleton` + `root` drill-down and `interactive` keep observations small instead
113
- - Single browser session with one active tab: a tab the page opens itself (`window.open`, `target=_blank`) is listed by `browser_tabs` but not followed — `browser_tabs` with `select` makes it the active one; without that, another tab becomes active only after the active one closes
114
- - The iPhone layer requires iPhone Mirroring to be online, with the iPhone locked and near the Mac (unlocking ends mirroring; Apple: unavailable in the EU); OCR accuracy depends on screen content; `phone_open` reads Spotlight's English "Top Hit" label unless `NORACU_TOPHIT_LABELS` is set
115
- - macOS-only (Mac/iPhone layers); the Browser layer is cross-platform
116
-
117
- ## Roadmap (v2 candidates)
118
-
119
- - ~~element_index coordinate system~~ (v0.1.0) and ~~one index counter across snapshots~~ (v0.2.0); next: snapshot diffing
120
- - Physical clicks performed inside the engine process right after the hit test (closes the short gap between the check and the click)
121
- - A simpler identity model to compare against the current one on the same tests (no digit folding in item keys)
122
- - axState diffing (incremental observation, saves tokens)
123
- - Browser tool gaps (select_text/set_value/hover/wait_for…)
124
- - A resident accessibility engine (one long-lived process instead of one per call; true element handles between calls)
125
- - Multi-session architecture (browser_id + tab_id)
126
- - Security hardening: sensitive-app foreground detection, action audit log
86
+ User-facing variables, their defaults and examples are in [usage.md](usage.md#environment-variables); this document says only how they act inside each layer. Security defaults and switches are in [SECURITY.md](../SECURITY.md). Current limits, unfixed issues and what was tested are in [known-issues.md](known-issues.md); plans are in the [README](../README.md#roadmap).
87
+
88
+ ## Testing note
89
+
90
+ Tests replace Apple's tools through `NORACU_IOS_XCRUN` and `NORACU_IOS_XCODEBUILD` (`test/fixtures/`: a fake `xcrun`, and a fake `xcodebuild` that serves a model phone), and `NORACU_TEST_PHYSICAL_GAP_MS` waits between a physical click's last re-check and the click; `test/ios-live.mjs` runs the tools against a real iPhone or simulator. `NORACU_CI=1` keeps the browser headless and the desktop untouched, and `NORACU_IMCTL_DIR` points the server at another copy of the iPhone driver (development only).