noracu 0.3.0 → 0.3.2

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.
@@ -0,0 +1,143 @@
1
+ # noracu
2
+
3
+ **一个跑在本机的 MCP server:让 MCP 客户端(Claude Desktop、Claude Code、Cursor 等)按 `element_index`
4
+ 操作 macOS 应用和浏览器,并且说清楚每个动作做成了没有。不需要 API key,没有遥测。**
5
+
6
+ English: [README.md](../README.md)。下面链接到的文档目前是英文的。
7
+
8
+ ![noracu 演示](https://github.com/sgInnora/noracu/releases/download/v0.3.0/noracu-demo.gif)
9
+
10
+ *在你自己的 Chrome 里,noracu 打开一个标签页,从页面上读一个数字,再把它打进"备忘录"的一条新笔记。
11
+ 用你自己的 Chrome 要手动开启:`NORACU_ALLOW_CHROME=1`,加上 Chrome 的远程调试开关(见 [usage.md](usage.md) 第 5b2 节);
12
+ 不开的话,浏览器层用它自己的配置目录。*
13
+
14
+ ## 它做什么
15
+
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 构建 | 实验性,默认关 |
22
+
23
+ 代理先取一份快照(Mac 上是辅助功能树,浏览器里是 ARIA 树),拿到带编号的元素列表,再按 `element_index`
24
+ 操作。树不够用时可以截图。
25
+
26
+ ## 快速开始
27
+
28
+ **1. 安装**(Node ≥ 20;没有 postinstall 脚本),装在一个你会留着的文件夹里:
29
+
30
+ ```bash
31
+ npm install noracu # server 在 node_modules/noracu/src/server.mjs
32
+ brew install cliclick # Mac 上的物理输入要用(按键、拖拽、需要动指针的点击)
33
+ npx noracu --doctor # 检查这台机器,并打印出给客户端用的配置
34
+ ```
35
+
36
+ **2. 加到你的 MCP 客户端。** 粘贴 `--doctor` 打印出的内容,别用下面手写的:它用的是这台机器上的绝对路径,指向你刚装的
37
+ 那一份——Claude Code 是一条命令(`-s user` 表示对你所有项目生效),Claude Desktop 和 Cursor 是一段 JSON。
38
+ 手写的话是下面这样。
39
+
40
+ Claude Code(从终端启动,`PATH` 里有 Node):
41
+
42
+ ```bash
43
+ claude mcp add noracu -- npx -y noracu
44
+ ```
45
+
46
+ Claude Desktop(`~/Library/Application Support/Claude/claude_desktop_config.json`)和 Cursor
47
+ (`~/.cursor/mcp.json`)是从程序坞启动的,读不到 shell 的 `PATH`,要写绝对路径(`which node` 给出 node 的路径):
48
+
49
+ ```json
50
+ {
51
+ "mcpServers": {
52
+ "noracu": {
53
+ "command": "/opt/homebrew/bin/node",
54
+ "args": ["/绝对路径/node_modules/noracu/src/server.mjs"]
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ 然后把客户端完全退出(包括菜单栏图标)再打开。
61
+
62
+ 以前装过?`claude mcp add` 不接受已经被占用的名字:先运行 `claude mcp remove noracu`(当初是对所有项目加的,就加上
63
+ `-s user`)。JSON 配置里把 `args` 的路径改成新的。
64
+
65
+ **3. 把权限给客户端应用,不是给 `node`。** 系统设置 → 隐私与安全性 → **辅助功能** 和 **录屏与系统录音**
66
+ (较早的 macOS 上叫「屏幕录制」)→ 打开 Claude Desktop、Cursor 或你的终端。授权后再完全退出、重开一次客户端。
67
+
68
+ **4. 检查。** 调用 `mac_status`:它会说客户端有没有这两项权限、找没找到 cliclick。再让访达在最前面,调用
69
+ `mac_ax_state`(或者传 `app: "Finder"`,不用切到前台),能返回一棵带编号的树就说明通了,点击是之后的事。浏览器:`browser_launch` →
70
+ `browser_navigate` → `browser_snapshot` → 带 `element_index` 的 `browser_click`。
71
+
72
+ **5. 试一下。** 可以对客户端说这三句,都只读不改:
73
+
74
+ - "调用 noracu 的 `mac_status`,告诉我还缺什么。"
75
+ - "用 noracu 读最前面的访达窗口,列出里面有什么。"
76
+ - "用 noracu 在浏览器里打开 example.com,告诉我页面的标题。"
77
+
78
+ 不通的话看 [troubleshooting.md](troubleshooting.md)。还是不行,或者某个应用 noracu 读不好、操作不好:
79
+ [报告问题](https://github.com/sgInnora/noracu/issues/new?template=bug.yml) 或 [报告一个应用](https://github.com/sgInnora/noracu/issues/new?template=app-report.yml),都不需要 clone 仓库。
80
+
81
+ ## 它怎么做事
82
+
83
+ - **按元素操作,不按像素。** `element_index` 指的是上一份快照里的某个元素,30 秒内有效。动手之前会重新确认这个
84
+ 元素;不在了或变了,就回 `element_no_longer_valid`。
85
+ - **说清发生了什么。** 每个输入结果都带 `delivered_verified`(看到了变化)、`delivered_unverified`、
86
+ `not_delivered` 或 `unknown`,以及重试是否安全。
87
+ - **坐在 Mac 前的人优先。** 最近 2 秒里用过键盘或鼠标,Mac 和 iPhone 的输入先把这 2 秒等满一次;那时人还在用,
88
+ 就回 `user_active`,什么都不发。
89
+ `NORACU_USER_IDLE_S=0` 可以关掉。
90
+ - **关着的开关就是关着。** `NORACU_READ_ONLY=1` 只许观察;`NORACU_STOP_FILE` 指的文件存在时不发任何输入;
91
+ `NORACU_DENY_APPS` 和 `NORACU_APPROVAL_FILE` 决定哪些应用可以收输入(终端和 IDE 默认拒绝);
92
+ 在页面里跑脚本和打开 `file://` 默认关。
93
+ - **有一处读会写一个开关。** 读 Electron 或 Chromium 应用(`mac_ax_state`、`mac_find`)时,会试着打开它的网页无障碍
94
+ (`AXManualAccessibility`),让页面出现在树里——Electron 应用接受,Google Chrome 不接受;传 `web_accessibility: false`
95
+ 或设 `NORACU_READ_ONLY=1` 就不打开。
96
+ - **留在这台机器上。** 用的是你已经登录的浏览器配置和 Mac 应用。除了 Playwright 第一次下载 Chromium,
97
+ noracu 自己不发任何网络请求。工具返回的内容(文字、截图)仍会由你的客户端发给它用的模型。
98
+
99
+ ![坐在 Mac 前的人优先](https://github.com/sgInnora/noracu/releases/download/v0.3.0/noracu-person-goes-first.gif)
100
+
101
+ *鼠标在用的时候,每次调用都回 `user_active`、不打字;停下 2 秒后继续。*
102
+
103
+ ## 它不防什么
104
+
105
+ - **骗人的内容。** 屏幕上的文字、辅助功能名称、网页内容会原样交给模型。noracu 不识别假弹窗,也不识别提示注入;
106
+ 模型拿它们怎么办由客户端决定。先用 `NORACU_READ_ONLY=1`,并保留客户端对输入类工具的确认。
107
+ - **没有沙箱。** noracu 以 MCP 客户端的权限,在你已登录的应用里操作。
108
+ - **按应用的规则只管输入。** 拒绝名单和审批文件拦不住 `mac_app` 启动、切到前台或退出名单里的应用,
109
+ 也拦不住 `mac_window` 移动它的窗口。
110
+ - **Electron 和 Chromium 应用**不接受后台点击,在那里的物理点击会移动指针。它们的页面可以改走 DevTools 端口
111
+ (`cdp_port`,见 [usage.md](usage.md))。
112
+ - **两个 iPhone 层都是实验性的**,各有限制,见 [iphone.md](iphone.md)。
113
+
114
+ 默认值、开关和已知缺口的完整清单在 [SECURITY.md](../SECURITY.md)。已知做不到的事(比如应用的窗口在别的桌面上时读不到),
115
+ 以及改过但还没在真机上重新跑过的地方,写在 [known-issues.md](known-issues.md)。
116
+
117
+ ## 不做的事
118
+
119
+ - 不内置模型:noracu 负责观察和操作,做决定的是你的 MCP 客户端。
120
+ - Mac 层只面向 macOS,没有 Windows 或 Linux 的桌面层。
121
+ - 不做托管服务;没有测量过的比较不写。
122
+ - 不执行任意代码,除非你自己打开(`NORACU_ENABLE_EVAL=1`)。
123
+
124
+ ## 文档
125
+
126
+ - [usage.md](usage.md):各层的用法示例、环境变量、错误说明
127
+ - [tools.md](tools.md):全部工具和参数(由运行中的 server 生成)
128
+ - [troubleshooting.md](troubleshooting.md):安装和授权问题
129
+ - [iphone.md](iphone.md):两个 iPhone 后端的安装、要求和限制
130
+ - [known-issues.md](known-issues.md):做不到的事,和还没在真机上重新测过的改动
131
+ - [apps.md](apps.md):noracu 实际跑过的应用,以及怎么再报告一个
132
+ - [architecture.md](architecture.md):server、Mac 引擎和各驱动怎么配合
133
+ - [SECURITY.md](../SECURITY.md):noracu 能碰到什么、默认值和开关、威胁模型、怎么报告问题
134
+
135
+ ## 维护
136
+
137
+ 一个人维护,没有 SLA。Mac 层需要 macOS 15 以上;iPhone 镜像层还需要 Apple 芯片或 T2 的 Mac、iOS 18 以上和
138
+ "iPhone 镜像"(欧盟不提供);浏览器层在 Playwright 能跑的地方都能用。只在 Apple 芯片、macOS 27 的 Mac 上做过真机测试(没测到的范围见 [known-issues.md](known-issues.md))。
139
+ 带上工具名和复现步骤的问题报告最有用,[问题表单](https://github.com/sgInnora/noracu/issues/new/choose)问的就是这些。
140
+
141
+ ## 许可
142
+
143
+ MIT,见 [LICENSE](../LICENSE)。
package/docs/apps.md ADDED
@@ -0,0 +1,38 @@
1
+ # Apps noracu was run against
2
+
3
+ Only what there is a record of: a test in this repository that drives the real app, or a run on the test
4
+ machines whose result was written down. "Run against" means the listed things worked there on that date; it
5
+ does not mean every control of the app works. An app that is not listed has not been tried, which says
6
+ nothing about whether it works.
7
+
8
+ Tried one yourself? [Report an app or site](https://github.com/sgInnora/noracu/issues/new?template=app-report.yml)
9
+ — the form asks which app, which tool and what you saw, and it needs no clone. Reports of apps that work are
10
+ as useful as reports of apps that do not.
11
+
12
+ ## Mac (Apple silicon, macOS 27.2)
13
+
14
+ | App | What was exercised | Record |
15
+ |---|---|---|
16
+ | TextEdit | snapshots (`mac_ax_state`, `mac_find`) and the `element_index` actions the suite runs on them, `mac_paste`, menu commands, `mac_wait`, window operations (`mac_window`, `mac_windows`) | `test/e2e.mjs` (the part that needs a desktop), run before each release — last on 2026-11-17 |
17
+ | Finder | `mac_find`, `mac_app`; a snapshot of 189 elements | `test/e2e.mjs`; a read-only run on 2026-11-17 |
18
+ | Notes | typing a number read from a web page into a new note | the demo recording of 2026-11-13 |
19
+ | Google Chrome 157 | as your own Chrome (`chrome: true`): opening a tab, reading the page, `browser_tabs`. Through the Mac layer Chrome refuses web accessibility, so its pages are read through the browser layer | the demo recording of 2026-11-13; device runs of 2026-11-13 and 2026-11-14 |
20
+ | Claude (an Electron app) | a physical click on a menu-bar item | device run of 2026-11-16 |
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
+ | Notification Center | waiting for a notification to arrive (`mac_wait`) | `test/e2e.mjs` |
23
+
24
+ ## iPhone
25
+
26
+ | App | Backend | What was exercised | Record |
27
+ |---|---|---|---|
28
+ | Settings | XCUITest (iPhone 16 Pro, iOS 27.2 and 27.2.1) | launching, snapshots, input by `element_index`, going Home; that everything is refused while the phone is locked | `test/ios-live.mjs` (19 checks), last on 2026-11-15; the locked phone on 2026-11-14 |
29
+ | Notes, Reminders, Files | XCUITest (iPhone 16 Pro) | finding and tapping across apps, long Chinese text | a trial of ten runs on 2026-11-13 |
30
+ | Settings | Mirroring (iPhone 17 Pro Max) | `phone_open` through Spotlight, taps, `phone_type`, scrolling | device runs for 0.2.4 to 0.2.7 |
31
+
32
+ ## Known not to work well
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).
@@ -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 digits in a unique element's item are ignored (counters, relative times). 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 unique element whose whole item is replaced in place by one that differs only in digits ("Invoice 12" → "Invoice 13") is not told apart.
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.
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
 
@@ -46,9 +46,9 @@ Accessibility goes through `src/mac-ax.js`, a static JXA script run as `osascrip
46
46
 
47
47
  ### Browser layer (13 tools)
48
48
 
49
- A single persistent Playwright 1.58 session (one browser, one context), held in a `Map` keyed by `browser_id` that carries one active entry at a time:
49
+ A single persistent Playwright session (one browser, one context), held in a `Map` keyed by `browser_id` that carries one active entry at a time:
50
50
 
51
- - Session: `browser_launch` (headless optional) → `browser_navigate` → `browser_close`; `browser_snapshot` accepts an optional `browser_id`, but only one session is live at a time (true multi-session `browser_id` + `tab_id` is a roadmap item)
51
+ - Session: `browser_launch` (headless optional) → `browser_navigate` → `browser_close`; `browser_snapshot` accepts an optional `browser_id`, but only one session is live at a time; `browser_tabs` lists, opens, selects and closes that session's tabs (true multi-session `browser_id` + `tab_id` is a roadmap item)
52
52
  - Tabs: `browser_tabs` lists the session's tabs and opens, selects or closes one by `tab_id`. The active page changes only when asked — a tab the page itself opens is listed, never followed — and only a tab `browser_tabs` opened can be closed with it, never the last one. A tab becomes the active page — through `select`, or by taking over when the active tab closes — only when it shows an http(s) page, or is still on the blank page that `browser_launch` or `browser_tabs` opened it on (`file://` with `NORACU_ALLOW_FILE_URL=1`); with no such tab open the page tools return `no_active_page`. The active page is held to the same rule each time a page tool is called: once it shows anything else (a blob the page made, a load that failed, a blank page after another page), the tools return `active_page_not_allowed` (those that return page content look again before handing it over, and `browser_snapshot` — and `browser_read` without a selector — return `page_changed` when the page navigated while they worked), the tab stays the active page, and `browser_navigate` or `browser_tabs` moves on from there. A session attached with `cdp_port` uses the app's own pages, whatever they show.
53
53
  - Observe: `browser_snapshot` (`page.ariaSnapshot()` ARIA tree YAML + list of interactive element indices), `browser_screenshot` (fullPage / format png|jpeg / quality / clip; returns DPR + viewport metadata)
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`
@@ -68,7 +68,7 @@ The bundled imctl driver (`imctl/`, Python) runs as a subprocess (`<python3> -m
68
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:
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
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.
@@ -76,7 +76,7 @@ The bundled imctl driver (`imctl/`, Python) runs as a subprocess (`<python3> -m
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
- - **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`). 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.
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
81
  - **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
82
 
@@ -87,7 +87,7 @@ The bundled imctl driver (`imctl/`, Python) runs as a subprocess (`<python3> -m
87
87
  | `NORACU_PYTHON` | auto-probe (see iPhone layer) | python3 that runs the bundled driver; must import pyobjc |
88
88
  | `NORACU_IMCTL_DIR` | bundled `imctl/` (`src/../imctl`) | override the driver location (development only) |
89
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 18 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`) 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 |
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
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
92
  | `NORACU_DISABLE_EVAL` | unset | `=1` keeps `browser_evaluate` off even when `NORACU_ENABLE_EVAL=1` (kill switch) |
93
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 |
@@ -98,8 +98,8 @@ The bundled imctl driver (`imctl/`, Python) runs as a subprocess (`<python3> -m
98
98
  | `NORACU_OCR_LANGUAGES` | `zh-Hans,en-US` | comma-separated Vision OCR language codes for the iPhone screen, in priority order |
99
99
  | `NORACU_TOPHIT_LABELS` | `Top Hit` | comma-separated Spotlight Top Hit section label(s) that `phone_open` looks for |
100
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) |
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) (`user_active` sooner); also puts the pointer back after pointer actions; `0` turns both off |
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
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
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
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 |
@@ -110,7 +110,7 @@ The bundled imctl driver (`imctl/`, Python) runs as a subprocess (`<python3> -m
110
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
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
112
  - No snapshot diffing; `skeleton` + `root` drill-down and `interactive` keep observations small instead
113
- - Single browser session with one active tab and no tab switching: a tab the page opens itself (`window.open`, `target=_blank`) is not followed; another tab becomes active only after the active one closes
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
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
115
  - macOS-only (Mac/iPhone layers); the Browser layer is cross-platform
116
116
 
@@ -45,7 +45,8 @@ the previous build once (simulator, 2026-11-11) — so the client starts such a
45
45
  reports `runner_version_mismatch`.
46
46
 
47
47
  If it cannot start it prints `NORACU_RUNNER error <code>` (`bad_token`, `bad_bind`, `bad_port`,
48
- `bind_failed`) and ends the test.
48
+ `bind_failed`) and ends the test. A listener that is still waiting for the network is waited for up to 10 s.
49
+ If the listener goes away after the ready line, the runner prints `NORACU_RUNNER error listener_failed` and ends.
49
50
 
50
51
  The runner ends when it receives `quit`, when the client's `xcodebuild` process is stopped, or after
51
52
  12 hours.
@@ -93,9 +94,24 @@ All points and frames are in screen points, origin at the top-left of the screen
93
94
  `drag`, `type` and `keys` are refused — text goes wherever the keyboard focus is, which the public API does
94
95
  not show, and a second Return would land on whatever the alert was covering. See Refusals. noracu's own Mac
95
96
  side refuses those, and a `tap` with a `count` above 1, before it starts a runner — a starting runner puts its
96
- app in front of what the iPhone was showing — so the runner's refusal is what any other client gets. Since
97
- 2026-11-12 noracu no longer sends `springboard_only`: while app rules are in force it refuses every input that
98
- names `com.apple.springboard` on the Mac side, a single tap on an alert's button included.
97
+ app in front of what the iPhone was showing — so the runner's refusal is what any other client gets. While
98
+ app rules are in force noracu refuses every input that names `com.apple.springboard` on the Mac side, a single
99
+ tap on an alert's button included. Without them it sends `springboard_only` in one case:
100
+ `com.apple.springboard` always reads `runningForeground`, also while an app or Spotlight is what the iPhone
101
+ shows, so before an input named for it noracu looks first. When the app the session last launched, acted on or read in front still reads
102
+ `runningForeground` (a call that names the Home Screen in between does not change which app that is), or when `front` shows no Home Screen icon — asked again up to four times over 1.6 s while
103
+ no alert shows either, as icons can be on their way in right after `home` — the input goes out with
104
+ `springboard_only: true`: one tap on an alert's button is sent, anything else is refused. When either read
105
+ fails, nothing is sent.
106
+
107
+ SpringBoard's alerts are not the only thing of its own that can cover an app: with Control Center pulled down
108
+ over it the app still reads `runningForeground`, and a tap lands on Control Center. The runner does not look
109
+ for that. Before an input that names an app, noracu's Mac side asks `front`: when SpringBoard shows icons while
110
+ the app reports that it is in front, the input is refused there with `system_overlay` and nothing is sent. An
111
+ icon can still be showing for a moment right after an app comes to the front, so while icons show `front` is
112
+ asked again, up to four times over 1.6 s, before the refusal. A `front` or `app_state` read that fails here is
113
+ answered under its own error, with nothing sent. Another client that talks to the runner directly gets no such
114
+ check.
99
115
 
100
116
  An optional field must have the right type when it is present: a `count` of `"2"` is `invalid_args`, not the
101
117
  default. `args` itself must be an object (`invalid_args` otherwise), and `id` a whole number: a missing `id`, or any
package/docs/iphone.md ADDED
@@ -0,0 +1,59 @@
1
+ # noracu on an iPhone (experimental)
2
+
3
+ Both iPhone backends are experimental and off by default. Walkthroughs: [usage.md §9](usage.md#9-iphone-layer) and [§10](usage.md#10-iphone-the-xcuitest-backend).
4
+
5
+ ## iPhone Mirroring backend (`phone_*`)
6
+
7
+ noracu can operate a real iPhone through Apple's **iPhone Mirroring**. The layer is off by default: add `"env": { "NORACU_LAYERS": "mac,browser,iphone" }` to the server entry, or in Claude Code `-e NORACU_LAYERS=mac,browser,iphone` right after the server name in `claude mcp add` (`iphone` alone gives an entry that carries only the iPhone tools), then quit the host completely and reopen it. The agent observes with OCR on the Mac (`phone_screenshot`, `phone_ocr`, `phone_find`), acts at normalized 0–1 coordinates (`phone_tap`, `phone_swipe`, `phone_scroll`), types by pasting (`phone_type`) and opens apps by name (`phone_open`). This is not `element_index`: the phone exposes no accessibility tree to the Mac, so a tap lands where OCR placed the text. The driver (imctl, Python, MIT, about 3,500 lines) ships in `imctl/`.
8
+
9
+ **It takes the Mac's pointer and keyboard.** iPhone Mirroring is a Mac window, so every phone input goes through the Mac: iPhone Mirroring comes to the front, taps and swipes move the real pointer, and `phone_type` pastes with ⌘V. Do not use the Mac while a phone step runs — noracu refuses while the keyboard or mouse has been used within the last 2 s (`user_active`, nothing sent; stop using the Mac and retry) and puts the pointer back afterwards, but the window in front changes. The XCUITest backend below does not use the Mac's pointer or keyboard.
10
+
11
+ **Apple's requirements** ([support.apple.com/120421](https://support.apple.com/120421)): a Mac with Apple silicon or a T2 chip on macOS 15 or later; an iPhone on iOS 18 or later with a passcode; both signed in to the same Apple Account with two-factor authentication; Bluetooth and Wi-Fi on; the Mac not sharing its internet connection or using AirPlay or Sidecar. **The iPhone must be locked and near the Mac** — unlocking it, or quitting iPhone Mirroring, ends the session. iPhone Mirroring is currently unavailable in the EU. One Mac and one iPhone at a time; camera and microphone are not mirrored.
12
+
13
+ **Unattended sessions:** in iPhone Mirroring → Settings, "Authenticate automatically" lets a session start without a password prompt. Trade-off: anyone who can use your unlocked Mac can then open your phone.
14
+
15
+ **Python:** the driver needs a python3 that imports pyobjc (Quartz, Vision, AppKit). Set `NORACU_PYTHON`, or noracu probes `/opt/homebrew/bin/python3`, `/usr/local/bin/python3`, `python3`, `/usr/bin/python3` once, on the first `phone_*` call. Apple's `/usr/bin/python3` usually lacks pyobjc; Homebrew's python3 plus `python3 -m pip install pyobjc-framework-Quartz pyobjc-framework-Vision pyobjc-framework-Cocoa` is the common working setup.
16
+
17
+ **Mirror state:** `phone_status` reports `live` (the phone's screen is being streamed), `overlay` (the text iPhone Mirroring shows instead, e.g. "Connection Paused" or "iPhone in Use"), `paused` (that overlay offers a Resume button) and `setup` (a setup or welcome screen the user must finish — noracu never clicks it). Detection reads the window's structure and shape (the mirror is a tall or wide phone-shaped window; a setup screen is nearly square), not its text. While the mirror is not live, every phone input tool (`phone_tap`, `phone_longpress`, `phone_swipe`, `phone_scroll`, `phone_type`, `phone_key`, `phone_open`, `phone_home` and `phone_app_switcher`) refuses with `mirror_not_live` — without stealing focus when the mirror is paused or closed — instead of acting on the overlay, and refuses with `mirror_state_unknown` if the mirror state still cannot be determined (`phone_ocr` / `phone_find` start their output with a warning). The mirror pauses after inactivity; `phone_launch` brings it forward and clicks Resume.
18
+
19
+ **Privacy:** whatever the phone shows — notifications, messages, mail, one-time codes — becomes tool output that your MCP client sends to its model. Turn on a Focus, open a neutral app before you start, and begin with `NORACU_READ_ONLY=1` (`phone_status`, `phone_screenshot`, `phone_ocr` and `phone_find` stay allowed; all phone input is refused). iPhone notifications also reach the Mac once Mirroring is set up. Looking is not invisible to the phone either: in a device run (iPhone 17 Pro Max on iOS 27, Mac on macOS 27.2) LinkedIn and rednote each showed their after-screenshot share sheet one to four seconds after every capture of the mirror window, one more sheet per capture. Every tool that reads the screen captures it — `phone_screenshot`, `phone_ocr`, `phone_find`, any `expect` check, and the checks inside `phone_type`, `phone_open` and `phone_scroll` — and so does a phone input that first has to bring iPhone Mirroring to the front. Assume an app that logs screenshots, or tells the other person in a chat about them, does so on every capture (not tested).
20
+
21
+ **First success:** `phone_status` → `phone_launch` if `live` is not `true` → `phone_screenshot` → `phone_ocr` → `phone_find` + `phone_tap`.
22
+
23
+ **Known limits:** a tap goes where OCR saw the text, so repeated or misread labels can be hit wrong (`phone_open` cannot tell an app from a contact or website that Spotlight's Top Hit shows under the same name); `phone_scroll` moves lists with trackpad-style scroll events (a vertical `phone_swipe` drag does not scroll a list — use it for gestures such as Home Screen paging, started from the empty strip just above the Dock: a swipe that starts on an app icon picks the icon up and moves it; both points of a swipe are kept inside the phone screen, because iOS cancels a drag that starts or ends on the transparent window margin around it, and the result names any point that was moved; a tap or long press aimed at that margin — the strip above the screen holds the window's own controls — is refused with `out_of_screen`; the screen's edges are measured from one capture of the window and remembered per window size and macOS version in `~/Library/Caches/noracu/phone-screen-rect.json`, and a measurement taken while the pointer rests on that strip is not trusted, so until a clean one is made a point near the top of the window or along its other sides, where the margin may be, is refused for a tap or long press and moved inward for a swipe, and the result says so); on one tested setup (iPhone 17 Pro Max on iOS 27.0.1, Mac on macOS 26.6.2) iPhone Mirroring draws the phone about 17% larger than its window at every View size, so the right column and bottom row are cut off and cannot be reached; moving the window between displays, changing the main display and relaunching made no difference, and the iOS 27 / macOS 26 version mismatch is the main suspect — check `phone_screenshot` if taps near the edges miss; `phone_open` types the app name into Spotlight and taps it only when Spotlight's Top Hit card shows exactly that name — or, where Spotlight puts its search field at the top with no Top Hit card (seen on iOS 27), only when the field completes exactly that name as "<name> — Open" (web suggestions, websites and Settings rows of the same name are never tapped), otherwise returns to the Home Screen — it reads Spotlight's English "Top Hit" label, so on an iPhone set to another language it finds nothing until `NORACU_TOPHIT_LABELS` names that label (the top-field layout's "Open" completion is English only, and `NORACU_TOPHIT_LABELS` does not change it); `phone_home` / `phone_app_switcher` use the iPhone Mirroring menu when live (working without python on English macOS, falling back to an `imctl` gesture only when those menu items are absent, and returning `menu_unknown` without a second gesture on timeout) and report only that the command was sent (`screen not verified`); `phone_type` needs a Mac keyboard layout that keeps A and V where U.S. QWERTY has them (U.S., ABC and Pinyin do; French AZERTY and Dvorak do not) — otherwise it returns `keyboard_layout` and sends nothing; the phone reads the Mac clipboard through Universal Clipboard, which tells it about new content with a delay, so `phone_type` waits at least 1.5 s between writing the clipboard and ⌘V (and returns `focus_lost` without ⌘V if another app comes to the front meanwhile) — in a device run, a ⌘V sent about 0.5 s after the write once pasted the phone's own older clipboard (the previous paste) instead, and a paste can also stop after the phone's "Pasting from …" box; after `type_not_confirmed`, read the field before typing again.
24
+
25
+
26
+ ## XCUITest backend (`ios_*`, opt-in)
27
+
28
+ With the iPhone layer on (`NORACU_LAYERS` names `iphone`), set `NORACU_PHONE_BACKEND=xcuitest` and noracu lists nine `ios_*` tools in place of `phone_*`. They do not go through the iPhone Mirroring window: a small UI-test bundle (the "runner" — Swift, MIT, source in `ios-runner/`) runs on the iPhone and executes one command at a time. The agent reads the app's own accessibility elements (`ios_snapshot`) and acts on them by `element_index` (`ios_tap`, `ios_type`), in screen points instead of OCR positions. Apps are opened by bundle id (`ios_launch`); text is typed as keyboard input with no clipboard involved, and `ios_type` reports `delivered_verified` only when the field that took the text afterwards holds what it held before with the text added in one place (four characters or more).
29
+
30
+ **Requirements:** Xcode (the full app); an Apple developer team to sign the runner; an iPhone paired with this Mac with Developer Mode on — over a cable or the local network — or a booted simulator. **The iPhone must be unlocked** while these tools are used (the opposite of iPhone Mirroring, which needs it locked): a locked phone gets `device_locked`: no input, and no snapshot or screenshot either.
31
+
32
+ **Set-up, once per device:** `npx noracu ios-setup --team <TeamID>` builds the runner into `~/.noracu/ios-runner/<udid>` (add `--udid` when several iPhones are connected; a simulator needs only `--udid`). It is an explicit command — nothing is built on install — and the one step of this backend that goes online: Xcode signs the runner for your team and may create a development provisioning profile for it; an iPhone is registered in the team only with `--register-device`. Then start the server with `NORACU_PHONE_BACKEND=xcuitest`. After an upgrade of noracu, run the set-up again when a call answers `runner_version_mismatch`: a runner built from another version's sources is not used.
33
+
34
+ **First success:** `ios_status` → `ios_launch` (`com.apple.Preferences`) → `ios_snapshot` → `ios_tap` or `ios_type` by `element_index` → `ios_snapshot` again. The first call that needs the phone starts the runner (about 9 s on an iPhone 16 Pro; on a simulator about 2 s once it is warm, and close to half a minute right after it booted); an input call that had to start it sends nothing, because the runner's own app comes to the front — look with `ios_snapshot` first. The server stops the runner when it exits.
35
+
36
+ **How it differs from the Mirroring backend:** elements with an `element_index` instead of OCR text; an index is re-checked before it is used (`element_no_longer_valid` when the element moved, changed, or its app left the front) and ended by `ios_home` and `ios_launch`; apps are named by bundle id, and noracu knows which app is in front only for the app a call names. `NORACU_STOP_FILE`, `NORACU_DENY_APPS` and `NORACU_APPROVAL_FILE` apply — matched on the iOS bundle id; the default deny list names Mac apps only — terminal apps and IDEs with a built-in terminal — so no iOS app matches it by default — and when app rules (`NORACU_APPROVAL_FILE` or a custom `NORACU_DENY_APPS`) are active, input targeting the Home Screen (`com.apple.springboard`) is always refused, even if listed in `allow` (use `ios_launch` to open approved apps) — and `NORACU_USER_IDLE_S` does not, as these tools do not use the Mac's keyboard or mouse. While a system prompt (a permission alert) is up on the iPhone, input named for an app is not sent (`system_alert`); the person answers it on the phone.
37
+
38
+ **Privacy:** `ios_snapshot` and `ios_screenshot` return what the app shows — messages, notifications, one-time codes — to your MCP client and its model, as with the Mirroring backend. Under `NORACU_READ_ONLY=1` this backend answers `ios_status` only: all iPhone input is refused, and `ios_snapshot` / `ios_screenshot` return `runner_not_started`, because reading the screen needs the runner and starting it puts the runner's own app in front of whatever the iPhone shows.
39
+
40
+ **Tested with:** an iPhone 16 Pro on iOS 27.2 and an iPhone 17 Pro simulator on iOS 26.5, Xcode 27.2, in the Settings app and on the Home Screen. On the iPhone the lock check adds about 0.8 s to every input, and to a snapshot or screenshot taken more than a second after the last check. What was not tested is in the CHANGELOG's known issues; the risks of this backend are in [SECURITY.md](../SECURITY.md).
41
+
42
+ ## Known limits (seen on a device)
43
+
44
+ - **Control Center over an app** (XCUITest backend): the app still reports that it is in front, and a tap would land
45
+ on Control Center. noracu refuses the input with `system_overlay` and sends nothing; `ios_home` closes it.
46
+ - **Notification Center over an app**: input is refused as `app_not_foreground`; reading the app can take 30 s and
47
+ end in `ios_timeout`.
48
+ - **A locked iPhone asks for its passcode.** After the phone has been idle and locked, the XCUITest backend answers
49
+ `device_locked`. noracu never enters a passcode: unlock the phone yourself.
50
+ - **Text into a temporary input box** (a comment box that an app shows over its page): in one app, `ios_type` with
51
+ an `element_index` closed the box before the text arrived. Tap the field with `ios_tap`, check with `ios_snapshot`
52
+ that the keyboard is up, then call `ios_type` without an index.
53
+ - **The clipboard**: iOS does not let an app that is not in front write the clipboard. The XCUITest backend has
54
+ no paste tool; `ios_type` types with the keyboard.
55
+ - **A paste prompt**: when an app comes to the front and reads the clipboard, iOS asks whether to allow the
56
+ paste. While that prompt is up, every `ios_*` input answers `system_alert` and nothing is sent;
57
+ `ios_screenshot` shows what it asks, and the person answers it on the phone (seen on an iPhone 16 Pro, 2026-11-15).
58
+ - **Checked**: a Live Activity in the Dynamic Island (a running timer) while an app is in front does not get input
59
+ refused (iPhone 16 Pro, iOS 27.2.1, 2026-11-17).
@@ -0,0 +1,84 @@
1
+ # Known issues
2
+
3
+ What noracu is known not to do, what is known to be wrong and not fixed in this version, and what it was and
4
+ was not tested on. Security limits and defaults are in [SECURITY.md](../SECURITY.md); the limits of the two
5
+ iPhone backends are in [iphone.md](iphone.md).
6
+
7
+ ## Where it was tested
8
+
9
+ | Layer | Tested on | Not tested |
10
+ |---|---|---|
11
+ | Mac | one Apple silicon Mac on macOS 27.2 — the whole test suite, with real apps and windows, before each release; on macOS 26.7.1 (Apple M2 Max), an install and the read tools `mac_status` and `mac_ax_state` (2026-11-19) | Intel Macs; macOS 15; the rest of the suite on macOS 26. Only the part of the suite that needs no desktop runs elsewhere (GitHub's macOS runner) |
12
+ | Browser | Playwright's Chromium, and Google Chrome 157 as your own Chrome (`chrome: true`), on that Mac | other Chromium browsers; other Chrome versions |
13
+ | iPhone (XCUITest) | an iPhone 16 Pro on iOS 27.2 and 27.2.1; an iPhone 17 Pro simulator on iOS 26.5; Xcode 27.2 | other iPhones and iOS versions |
14
+ | iPhone (Mirroring) | an iPhone 17 Pro Max mirrored to that Mac | other pairs of Mac and iPhone |
15
+
16
+ A change is covered by a test that fails on the code before it. Where that test uses no real window and no
17
+ real phone, and no run on a real machine has covered the change since, the change is listed below under
18
+ "Changed, not re-tested on a real machine" until such a run has been made.
19
+
20
+ ## Limits
21
+
22
+ - **Windows on another Space cannot be read.** Accessibility lists none of an app's windows that are on
23
+ another desktop. `mac_ax_state` and the tools that pick a window answer `ax_empty` and say how many of the
24
+ app's windows are off screen; `mac_windows` with `include_offscreen: true` lists them, without telling a
25
+ window on another Space from a minimized one. `mac_app` with `activate` brings the app forward, and macOS
26
+ may then move the person's desktop to it — on a Mac shared with a person, ask first. Seen on macOS 27.2.
27
+ - **A large window with a number that keeps changing.** When a snapshot did not read the whole window — more
28
+ elements than `max_nodes` (400 by default), a `skeleton`, a `root` drill-down, or `mac_find` — an element
29
+ is found again only if the texts around it are exactly what they were. A control next to a running clock
30
+ or a counter then answers `element_no_longer_valid` every time. Raise `max_nodes` until the snapshot says
31
+ `complete: true`: in a complete snapshot an ordinary change of a number does not make an element stale.
32
+ An element of a row whose texts such a snapshot did not reach at all is refused for actions
33
+ (`element_no_longer_valid`, `row_unread`): drill into the row with `root`, then act.
34
+ - **A page that changes its own address.** In the browser an `element_index` is refused
35
+ (`element_no_longer_valid`) after any navigation of the page, including one the page makes itself by
36
+ changing its query or fragment. On a page that does this while you work, take the snapshot again right
37
+ before the action.
38
+ - **Results are large.** A default snapshot of a Finder window is about 24 KB, and `interactive` and
39
+ `skeleton` do not make it smaller there (a flat window whose every row takes an action). `mac_apps` lists
40
+ menu-bar and background apps too — about 15 KB on a Mac that runs a hundred of them; `filter` narrows it.
41
+ Measured 2026-11-17 on macOS 27.2.
42
+ - **Electron and Chromium apps** take no background click, so a physical click there moves the pointer; see
43
+ the README.
44
+
45
+ ## Known and not fixed in this version
46
+
47
+ Mac and browser:
48
+
49
+ - `browser_navigate` that ends on a page the tools do not read — a `blob:` page the site made itself —
50
+ still returns its address and title, and reports the navigation as verified.
51
+ - Your own Chrome (`chrome: true`): when the connection ends and the end could not be confirmed, a tab that
52
+ noracu opens afterwards can be reported as already closed when the connection drops again, although it
53
+ may still be open. The condition has not been produced in a test.
54
+ - Your own Chrome: when attaching fails after noracu's window was opened, that window is reported closed
55
+ unless Chrome says that closing failed. Chrome has always said so in tests.
56
+
57
+ iPhone, Mirroring backend:
58
+
59
+ - `phone_open` clears Spotlight's search field with a fixed short wait. When the field is not cleared in
60
+ time the name is typed after the old query, no result matches and the call fails; it does not tap a wrong
61
+ result.
62
+ - `phone_open` where Spotlight shows its field at the top: if text recognition reads the magnifier as a
63
+ letter, the app name does not match and the call fails; it does not tap a wrong result. Not seen on the
64
+ test phone.
65
+ - `phone_type` of a single character: text that newly appears elsewhere on the screen at that moment (a
66
+ notification banner) can be read as the typed character. Such a result is never reported as verified.
67
+
68
+ ## Changed, not re-tested on a real machine
69
+
70
+ - Intel Macs: without `NORACU_CLICLICK` the server now also looks for cliclick under `/usr/local/bin`, where
71
+ Homebrew puts it on an Intel Mac. No Intel Mac has run it.
72
+ - iPhone, XCUITest backend: right before an input goes out, the lock is read again when its last answer is older
73
+ than a second and the stop file is looked at again, last; `ios_launch` looks at the stop file again right
74
+ before the launch. Run against a simulated runner only.
75
+ - iPhone, Mirroring backend: `phone_open` taps nothing when the app's row in Spotlight moved between two reads
76
+ and the read after that no longer shows the name. Run against scripted screen reads only.
77
+ - `noracu doctor` on a system other than macOS, with `NORACU_LAYERS=browser`: macOS and cliclick are no longer
78
+ listed as missing. Run with a stand-in for the system only.
79
+
80
+ ## Reporting one more
81
+
82
+ [Report a bug](https://github.com/sgInnora/noracu/issues/new?template=bug.yml) with the tool name and the
83
+ steps, or [report an app or site](https://github.com/sgInnora/noracu/issues/new?template=app-report.yml)
84
+ that noracu reads or operates badly. Neither needs a clone.
package/docs/tools.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Tool reference
2
2
 
3
3
  > Auto-generated from the running server (`node scripts/gen-tools.mjs`) — always in sync with the implementation. Hints are the four MCP tool annotations each tool reports — R read-only, D destructive, I idempotent, O open-world, – false — hints for the client, not permissions.
4
- > noracu v0.3.0 · 33 tools listed by default (the Mac and browser layers; NORACU_LAYERS unset), 47 with NORACU_LAYERS=mac,browser,iphone (iPhone Mirroring backend), 42 with NORACU_PHONE_BACKEND=xcuitest as well (the ios_* group replaces phone_*)
4
+ > noracu v0.3.2 · 33 tools listed by default (the Mac and browser layers; NORACU_LAYERS unset), 47 with NORACU_LAYERS=mac,browser,iphone (iPhone Mirroring backend), 42 with NORACU_PHONE_BACKEND=xcuitest as well (the ios_* group replaces phone_*)
5
5
 
6
6
  ## Mac layer (computer-use)
7
7
 
@@ -10,8 +10,8 @@
10
10
  | Tool | Arguments | Hints | Description |
11
11
  |---|---|---|---|
12
12
  | `mac_screenshot` | region:object?, window_id:integer?, display:integer? | R – I O | Capture the Mac screen as PNG base64: the main display, display (index from mac_windows), or one window by window_id (CGWindowID from mac_windows; works when covered). A display capture can be cropped to region {x,y,w,h} in screen points as mac_windows reports them (the main display's top-left is 0,0; a display to its left has negative x), not relative to the display; with display given, a region not inside that display is refused. Returns {scale, logical_size, screen, screenshot_id}; click coordinates are in points (pixels / scale). screenshot_id (valid 30 s) lets mac_click take x,y in screenshot pixels: the window's geometry is re-checked first and a window that moved, resized or was rebuilt since the capture is refused as stale. |
13
- | `mac_ax_state` | app:string?, interactive:boolean?, compact:boolean?, skeleton:boolean?, root:integer?, snapshot_id:string?, surface:string?, window:string?, window_id:integer?, depth:number?, max_nodes:integer?, web_accessibility:boolean? | R – I O | Read an app's accessibility tree through the macOS Accessibility API (default: the frontmost app's focused window). Returns {app, snapshot_id, window, complete, elements:[{i, d, role, title, value, states, actions, frame}]}; i is the element_index for mac_click, mac_get, mac_set_value, mac_type, mac_scroll and mac_drag — unique across snapshots (an index never names an element of a later snapshot) and valid 30 s; an action first re-identifies the element and returns element_no_longer_valid if it is gone, moved or replaced. Options: interactive (only actionable elements), compact (default true: skip empty layout wrappers), skeleton (shallow map with children_count) then root (an element_index to drill into; adds new indexes to the same snapshot), surface (window\|menubar\|menu\|sheet\|alert\|dialog\|popover\|focused\|app), window (index or title) or window_id (from mac_windows), depth (logical depth, default 12, 1-40), max_nodes (default 400), web_accessibility (default true, false under NORACU_READ_ONLY=1: sets AXManualAccessibility on Electron/Chromium apps to expose web content, never AXEnhancedUserInterface which alters window behaviour; the result's web_accessibility is enabled / already_on, exposed when the app refused but its pages are in the tree anyway, or unsupported with a web_accessibility_hint — Google Chrome refuses it). window_identity unverifiable marks a window without a window ID: element_index actions in it are refused. ax_empty when the app has no readable window. |
14
- | `mac_click` | element_index:integer?, snapshot_id:string?, x:number?, y:number?, screenshot_id:string?, app:string?, force:boolean?, button:string?, count:number?, mechanism:string?, timeout_ms:integer? | – – – O | Click a UI element by element_index (from mac_ax_state / mac_find; valid 30 s) or at raw {x,y}. With element_index the element is re-identified first (element_no_longer_valid if gone or changed). mechanism auto (default): its own accessibility action (press / show menu / select — no pointer, no focus change, works in background windows) when it has one, else a physical click that is sent only if a hit test shows the point reaches the element (occluded otherwise); semantic / physical force one path. count 2-3 and button middle are physical. A physical click is re-checked right before it is sent, and is delivered_verified only if the element is still there, changed, and its window is still on top at the point. A raw {x,y} click is sent only when the window on top at that point belongs to app (default: the frontmost app; the menu bar counts as the frontmost app's) — otherwise occluded names what covers it and nothing is sent; force:true skips that check. Results state delivery (delivered_verified / delivered_unverified / not_delivered / unknown) and whether a retry is safe, plus newly opened sheets, dialogs or menus. Under mechanism auto, a physical click on a native app is posted straight to the app's pid (route: bgpost — no pointer move, no frontmost needed); web-engine apps (Chromium/Electron) use the real pointer (route: cliclick). A bgpost click is never re-sent another way: no visible change is reported as delivered_unverified with a note, a timeout as delivery=unknown. mechanism physical always uses the real pointer. screenshot_id + x,y names pixels of a mac_screenshot window capture (relative to the window's top-left corner; the window's position and size are re-checked first and a window that moved, resized or was rebuilt is refused as stale; the screenshot's window's app is the target). |
13
+ | `mac_ax_state` | app:string?, interactive:boolean?, compact:boolean?, skeleton:boolean?, root:integer?, snapshot_id:string?, surface:string?, window:string?, window_id:integer?, depth:integer?, max_nodes:integer?, web_accessibility:boolean? | R – I O | Read an app's accessibility tree (default: the frontmost app's focused window). app: a name, a bundle id, a .app path or pid:<n> — ambiguous_app when several running apps match; pick one by pid:<n> from its list. Returns {app, snapshot_id, window, complete, elements:[{i, d, role, title, value, states, actions, frame}]}; i is the element_index for mac_click, mac_get, mac_set_value, mac_type, mac_scroll and mac_drag — unique across snapshots, valid 30 s; an action re-identifies the element first (element_no_longer_valid if gone, moved or replaced). Options: interactive (actionable elements only), compact (default true: skip empty layout wrappers), skeleton (a shallow map with children_count), then root (an element_index to drill into, given alone: not with app, window, window_id or surface; adds indexes to the same snapshot), surface (window\|menubar\|menu\|sheet\|alert\|dialog\|popover\|focused\|app), window (index or title) or window_id (from mac_windows), depth (default 12, 1-40), max_nodes (default 400), web_accessibility (default true; false under NORACU_READ_ONLY=1): sets AXManualAccessibility on Electron/Chromium apps, never AXEnhancedUserInterface; the result says enabled, already_on, exposed (refused, but the pages are in the tree) or unsupported with a web_accessibility_hint (Google Chrome refuses it) — unknown, with the hint, when the window was too large to look through. window_identity unverifiable marks a window without a window ID: element_index actions in it are refused. ax_empty when the app has no readable window. |
14
+ | `mac_click` | element_index:integer?, snapshot_id:string?, x:number?, y:number?, screenshot_id:string?, app:string?, force:boolean?, button:string?, count:number?, mechanism:string?, timeout_ms:integer? | – – – O | Click a UI element by element_index (from mac_ax_state / mac_find; valid 30 s; snapshot_id only with it: the snapshot the index came from) or at raw {x,y}. The element is re-identified first (element_no_longer_valid if gone or changed). mechanism auto (default): the element's own accessibility action (press / show menu / select — no pointer, works in background windows) when it has one, else a physical click, sent only if a hit test shows the point reaches the element (occluded otherwise); semantic / physical force one path. count 2-3 and button middle are physical. Under auto a physical click on a native app is posted to its pid (route bgpost: no pointer move; never re-sent another way — no visible change is delivered_unverified with a note, a timeout delivery=unknown); web-engine apps (Chromium/Electron) and mechanism physical use the real pointer (route cliclick), re-checked right before it is sent. A physical click is delivered_verified only if the element is still there, changed, and its window is still on top at the point. A raw {x,y} click is sent only when the window on top at that point belongs to app (default: the frontmost app; the menu bar counts as its) — otherwise occluded names what covers it; force:true skips that check. screenshot_id + x,y: pixels of a mac_screenshot window capture, relative to its top-left corner; a window that moved, resized or was rebuilt since is refused as stale. Results state delivery (delivered_verified / delivered_unverified / not_delivered / unknown) and whether a retry is safe, plus newly opened sheets, dialogs or menus. |
15
15
  | `mac_drag` | **from_index**:integer, **to_index**:integer, snapshot_id:string?, hold_ms:integer?, step_ms:integer? | – – – O | Drag from one UI element to another (sliders, selections, list items) with the physical pointer; from_index/to_index come from mac_ax_state or mac_find (valid 30 s). Both ends are re-identified and hit-tested first (either one gone or covered: nothing sent). hold_ms (0-2000) presses and holds after mouse-down before the move starts (timeline editors use it to tell clip-move from marquee selection); step_ms (1-500) moves in steps of about 20 points with that many ms between them. A drag whose holds and steps add up to more than 10 s is refused; a drag that fails midway gets a mouse-up so the button is not left held. Check the drop target afterwards. |
16
16
  | `mac_scroll` | direction:string?, pages:number?, element_index:integer?, snapshot_id:string? | – – – O | Scroll up/down/left/right by a number of pages (default 1). Without element_index: the center of the frontmost app's front window (the pointer moves there), only when that app's window is on top at that point (else occluded, nothing scrolled). With element_index: a scroll area is scrolled at its own center (hit-tested; reports when the position did not change), any other element is scrolled into view (AXScrollToVisible). |
17
17
  | `mac_key` | **key**:string, app:string?, force:boolean? | – D – O | Press a key or modifier chord, e.g. 'return', 'esc', 'cmd-c', 'cmd-shift-v', 'arrow-up'. Named keys (return, esc, tab, space, delete, arrows, home/end, page keys, F1-F16), with or without modifiers, go out as HID key events with each modifier pressed and released around the key; a chord with cmd or ctrl on a character key (cmd-c, cmd-shift-v) goes out the same way on the key that types that character in the current keyboard layout (no such key: not_delivered, keyboard_layout); a plain character or a shift/alt-only chord is typed through cliclick. Pass app to refuse input unless that app is frontmost (focus guard). A named key for a native frontmost app is posted straight to its pid (route: bgpost — no focus theft); web-engine apps and layout-dependent chords use the engine HID path. Chords that quit, log out, lock, force-quit, delete immediately or empty the Trash (cmd-q, alt-cmd-q, cmd-shift-q, cmd-alt-esc, ctrl-cmd-q, cmd-alt-delete, cmd-shift-delete…) are refused unless force:true. |
@@ -40,14 +40,14 @@
40
40
  | `browser_navigate` | **url**:string | – – – O | Navigate the active page to an http(s) URL (file:// is disabled unless NORACU_ALLOW_FILE_URL=1). Reports the final URL, HTTP status (or "no response" for same-document navigations), title, and delivery/retry. |
41
41
  | `browser_snapshot` | browser_id:string? | R – I O | Return the active page's ARIA accessibility snapshot (about 14000 characters with the list; a longer snapshot is cut and marked) plus up to 100 indexed interactive elements (reporting truncation and omitted count beyond 100, or that the list could not be read); indexes feed browser_click. When the page navigates while the snapshot is being taken it returns page_changed and nothing else (ask again); an element_index is not used after the page navigated. The active page stays the tab noracu is driving: a tab the page opens itself (window.open, target=_blank) is never switched to; another tab becomes active only after the active one closes. |
42
42
  | `browser_screenshot` | fullPage:boolean?, format:string?, quality:number?, clip:object? | R – I O | Screenshot the active page with optional fullPage, format png\|jpeg, quality (1-100, jpeg) and clip {x,y,width,height} (uses scale:"css" when attached over CDP); returns the image plus DPR/viewport metadata (with a navigated note when the page navigated while the picture was taken). |
43
- | `browser_click` | element_index:integer?, selector:string?, xy:array?, button:string? | – – – O | Click an element on the active page, preferring element_index from the latest browser_snapshot of that page (valid 30 s; re-checks page, URL, tag, name, href and position, returning element_no_longer_valid when stale). Uses real Playwright pointer input with actionability checks (returns occluded or not_actionable when covered or disabled — never falls back to synthetic JS .click()). selector is a fallback; xy pixel coordinates are not recommended. Reports delivery and retry. |
44
- | `browser_fill` | **selector**:string, value:string? | – – – O | Fill an input field matched by selector; fill replaces the whole value (browser_type appends keystrokes). Reports delivery and retry. |
43
+ | `browser_click` | element_index:integer?, selector:string?, xy:array?, button:string? | – – – O | Click an element on the active page. Give exactly one of element_index (from the latest browser_snapshot of that page; valid 30 s; page, URL, tag, name, href and position are re-checked, element_no_longer_valid when stale), selector (a fallback) or xy (pixel coordinates; not recommended). Real Playwright pointer input with actionability checks: occluded or not_actionable when covered or disabled — never a synthetic JS .click(). Reports delivery and retry. |
44
+ | `browser_fill` | **selector**:string, **value**:string | – – – O | Fill an input field matched by selector with value; fill replaces the whole value — pass "" to clear the field (browser_type appends keystrokes). Reports delivery and retry. |
45
45
  | `browser_press_key` | **key**:string | – – – O | Press a key or chord, e.g. 'Enter' or 'Control+A'. Reports delivery and retry. |
46
46
  | `browser_type` | **text**:string | – – – O | Type up to 2000 characters via the keyboard into the focused element; type appends keystrokes (browser_fill replaces the whole value and suits longer text). Reports delivery and retry. |
47
47
  | `browser_scroll` | direction:string?, pages:number? | – – – O | Scroll the active page up, down, left, or right by a number of pages (default: down, 1 page) via mouse wheel at the viewport center; reports the scrollX/scrollY change (or "did not move") plus delivery and retry. |
48
48
  | `browser_read` | selector:string? | R – I O | Read the active page's visible text (up to 12000 characters; 8000 with a selector; longer text is cut and marked), optionally scoped to a selector. When the page navigated while it was read: without a selector it returns page_changed (ask again); with one — a read that waits for a selector goes on across the page's own move to the next page — the first line of the result says so and gives both addresses. |
49
49
  | `browser_evaluate` | **js**:string | – D – O | Evaluate JavaScript in the active page and return the result plus delivery and retry. Off by default: runs only when the server was started with NORACU_ENABLE_EVAL=1 (eval_disabled otherwise), and never when NORACU_DISABLE_EVAL=1 or in your own Chrome (browser_launch chrome:true). When the page navigated while the script ran, a line after the result says so. |
50
- | `browser_tabs` | action:string?, tab_id:string?, url:string?, browser_id:string? | – D – O | List, open, select or close the tabs of the browser session. action list (the default) returns each tab's tab_id, url, title (null when the page did not answer in 3 s), whether it is the active page, and whether browser_tabs opened it. new opens a tab — with url (http(s); file:// needs NORACU_ALLOW_FILE_URL=1) it goes there — and makes it the active page. select makes tab_id the active page — only a tab on an http(s) page, or one still on the blank page that browser_launch or browser_tabs opened it on (file:// with NORACU_ALLOW_FILE_URL=1; tab_not_selectable otherwise): the other browser_* tools act on the active page only, and a tab the page itself opens (a link with target=_blank, window.open) is listed but never followed on its own. close closes tab_id only when browser_tabs opened it (tab_not_owned otherwise, nothing closed) and never the last open tab. After new, select, or a close of the active tab, element_index values from an earlier snapshot no longer apply; when the active tab goes, the first open tab that select would take is the active page, and when there is none the other browser_* tools return no_active_page until browser_tabs opens or selects one. When the active tab itself comes to show a page select would refuse (a blob the page made, a load that failed, a blank page after it has loaded something), it stays the active page and the other browser_* tools return active_page_not_allowed — except browser_navigate, which can take it to an http(s) page. new, select and close report delivery and retry. |
50
+ | `browser_tabs` | action:string?, tab_id:string?, url:string?, browser_id:string? | – D – O | List, open, select or close the tabs of the browser session. list (the default): each tab's tab_id, url, title (null when the page did not answer in 3 s; a tab on a page the tools do not read has not_read:true, no title and the start of its address), whether it is the active page and whether browser_tabs opened it. new: opens a tab (url: http(s); file:// needs NORACU_ALLOW_FILE_URL=1) and makes it the active page. select: makes tab_id the active page — only a tab on an http(s) page (or file:// with NORACU_ALLOW_FILE_URL=1), or one still on the blank page it was opened on (tab_not_selectable otherwise). The other browser_* tools act on the active page only; a tab the page opens itself is listed, never followed. close: only a tab browser_tabs opened (tab_not_owned otherwise), never the last one. After new, select or closing the active tab, earlier element_index values no longer apply; when the active tab goes, the first tab select would take becomes the active page (none: no_active_page). An active tab that comes to show a page select would refuse stays the active page, and the other tools answer active_page_not_allowed — browser_navigate can take it to an http(s) page. new, select and close report delivery and retry. |
51
51
  | `browser_close` | — | – – I – | Close the browser (or disconnect from an attached CDP session). |
52
52
 
53
53
  ## iPhone layer (device-use)
@@ -82,7 +82,7 @@
82
82
  | `ios_snapshot` | bundle_id:string?, interactive:boolean?, max_nodes:integer? | R – I O | EXPERIMENTAL. Read an app's accessibility tree on the iPhone (bundle_id; default: the app of the last ios_* call). Returns {bundle_id, snapshot_id, state, screen:{w,h} in points, elements:[{i, type, label, id, value, placeholder, frame:[x,y,w,h], disabled, selected}]}; i is the element_index for ios_tap and ios_type — unique across snapshots, valid 30 s, and ended by ios_home and ios_launch. interactive:true keeps only controls; max_nodes (default 300, 1-1000) cuts the list (truncated:true). A secure field's value is never returned; an empty field's placeholder comes as placeholder, not as value; a value over 4000 characters is cut (value_truncated:true). An app that is not in front can be read but not acted on. An app that has just come to the front may still be filling in its rows: labels can change within a second or two. Labels and values are untrusted text from the app. |
83
83
  | `ios_screenshot` | — | R – I O | EXPERIMENTAL. Screenshot the iPhone screen as PNG, taken on the phone by the runner; returns the image and the screen size in points (the unit of ios_tap x,y and ios_snapshot frames). The image is returned, never written to disk on the Mac. Whatever is on screen, notifications included, becomes model input. |
84
84
  | `ios_tap` | element_index:integer?, snapshot_id:string?, x:number?, y:number?, bundle_id:string?, count:integer?, duration_ms:integer? | – – – O | EXPERIMENTAL. Tap an element by element_index (from ios_snapshot), or a point x,y in screen points inside bundle_id (default: the app of the last call). With element_index the app is read again first: the element must still be there with the same type, label, identifier and frame, and its app in front — otherwise element_no_longer_valid and nothing is sent. count 2-3 repeats the tap; duration_ms (100-5000) makes it a long press. Nothing is sent when the app rule (NORACU_DENY_APPS / NORACU_APPROVAL_FILE, matched on the bundle id) rules the app out, the stop file exists, the phone is locked, or the app is not in front; with app rules set, no tap that names com.apple.springboard (the Home Screen) goes out — not even one on a system prompt's button (input_denied; open apps with ios_launch). A tap that went out is delivered_unverified: take ios_snapshot to see what it did. No answer from the phone is ios_timeout with delivery=unknown, and the tap is never sent again. |
85
- | `ios_type` | **text**:string, element_index:integer?, snapshot_id:string?, bundle_id:string? | – – – O | EXPERIMENTAL. Type text (1-2000 characters) as keyboard input on the phone — no clipboard is involved. With element_index the field is re-checked and tapped first and the keyboard is waited for; without it the text goes to whatever holds the keyboard in bundle_id (default: the app of the last call; no_keyboard, nothing sent, when none is up). delivered_verified only when the field that took the text — the one tapped, or the only one whose value changed — afterwards holds its old value with the text put in at one place; type_not_confirmed when it does not (autocorrection or completion changed it, the field hides its value, part of the text was lost, or the text went elsewhere) — read the field before typing again. With app rules set, text that names com.apple.springboard is not sent (input_denied). Text shorter than 4 characters, a secure field, text that contains a return, and text typed while the app's fields could not be read, are not read back (delivered_unverified). The result never repeats the text. |
85
+ | `ios_type` | **text**:string, element_index:integer?, snapshot_id:string?, bundle_id:string? | – – – O | EXPERIMENTAL. Type text (1-2000 characters) as keyboard input on the phone — no clipboard is involved. With element_index — of a text field, a secure field, a search field or a text view; anything else is refused (not_a_text_field) and nothing is tapped — the field is re-checked and tapped first and the keyboard is waited for; without it the text goes to whatever holds the keyboard in bundle_id (default: the app of the last call; no_keyboard, nothing sent, when none is up). delivered_verified only when the field that took the text — the one tapped, or the only one whose value changed — afterwards holds its old value with the text put in at one place; type_not_confirmed when it does not (autocorrection or completion changed it, the field hides its value, part of the text was lost, or the text went elsewhere) — read the field before typing again. With app rules set, text that names com.apple.springboard is not sent (input_denied). Text shorter than 4 characters, a secure field, text that contains a return, and text typed while the app's fields could not be read, are not read back (delivered_unverified). The result never repeats the text. |
86
86
  | `ios_key` | **key**:string, count:integer?, bundle_id:string? | – – – O | EXPERIMENTAL. Press return or delete (count 1-50) on the phone's keyboard in bundle_id (default: the app of the last call); no_keyboard, nothing sent, when no keyboard is up. With app rules set, keys that name com.apple.springboard are not sent (input_denied). Reports delivery and retry. |
87
87
  | `ios_swipe` | **from**:array, **to**:array, bundle_id:string?, hold_ms:integer?, end_hold_ms:integer?, velocity:string? | – – – O | EXPERIMENTAL. Drag from [x,y] to [x,y] in screen points inside bundle_id (default: the app of the last call), to scroll a list or move something: hold_ms (0-2000, default 50) is the press before the move — a long hold picks an item up; end_hold_ms (0-2000, default 300) is the pause before lifting; velocity slow (default), default or fast. A list usually moves a little less than the finger. With app rules set, a swipe that names com.apple.springboard is not sent (input_denied). Reports delivery and retry; take ios_snapshot to see the result. |
88
88
  | `ios_home` | — | – – – O | EXPERIMENTAL. Press the Home button (go to the Home Screen). Ends every earlier element_index; the Home Screen (com.apple.springboard) becomes the default app of later calls. delivered_verified when the app that was in front is seen to leave it. The app rule judges it as com.apple.springboard. Reports delivery and retry. |