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.
package/docs/iphone.md CHANGED
@@ -1,59 +1,247 @@
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).
1
+ # noracu on an iPhone (experimental, off by default)
2
+
3
+ Both iPhone backends are experimental and off by default. No iPhone tools are listed until `NORACU_LAYERS` includes
4
+ `iphone`; restart the MCP client after changing the server entry.
5
+
6
+ - **iPhone Mirroring (`phone_*`)** operates a real iPhone through Apple's iPhone Mirroring window. It needs macOS 15 or
7
+ later on Apple silicon or a T2 Mac, an iPhone on iOS 18 or later with a passcode, **locked** and near the Mac, both on
8
+ the same Apple Account with two-factor authentication (not available in the EU), and a python3 with pyobjc. It
9
+ observes with OCR and acts at normalized 0–1 coordinates, not `element_index`.
10
+ - **XCUITest (`ios_*`)** uses a UI-test runner on the device instead of the Mirroring window. Select it with
11
+ `NORACU_PHONE_BACKEND=xcuitest`. It needs Xcode, an Apple developer team and `npx noracu ios-setup`, and a paired
12
+ iPhone with Developer Mode on — **unlocked** — or a booted simulator. It reads accessibility elements and acts by
13
+ `element_index` or screen points.
14
+
15
+ **Know these limits before switching either backend on:**
16
+
17
+ - Mirroring uses the Mac's real pointer and keyboard and brings its window forward; Mac input is refused while the
18
+ person is using them. The XCUITest backend does not use the Mac's pointer or keyboard.
19
+ - OCR can misread text or hit the wrong one of two equal labels. One tested Mirroring setup cut off the phone's right
20
+ column and bottom row, so they could not be reached.
21
+ - Every Mirroring screen read captures the window, `expect` checks and input pre-checks included; some iOS apps react to
22
+ each capture as to a screenshot.
23
+ - The first XCUITest call may start the runner and bring its own app forward; an input call that had to start it sends
24
+ nothing. System prompts and overlays refuse input, and a locked phone allows neither input nor screen reads.
25
+ - Either backend returns messages, notifications and one-time codes on the phone's screen to the MCP client and its
26
+ model.
27
+ - Under `NORACU_READ_ONLY=1`, Mirroring keeps `phone_status`, `phone_screenshot`, `phone_ocr` and `phone_find`; XCUITest
28
+ answers `ios_status` only.
29
+
30
+ ## Enable the iPhone layer
31
+
32
+ Add `iphone` to `NORACU_LAYERS` on the server entry — `"env": { "NORACU_LAYERS": "mac,browser,iphone" }`, or in Claude
33
+ Code `-e NORACU_LAYERS=mac,browser,iphone` right after the server name in `claude mcp add` (`iphone` alone gives an
34
+ entry that carries only the iPhone tools) — then quit the MCP client completely and reopen it. That lists the
35
+ Mirroring tools (`phone_*`); add `NORACU_PHONE_BACKEND=xcuitest` to list the nine `ios_*` tools in their place. The
36
+ start-up line on stderr names the layers and the backend. Begin with `NORACU_READ_ONLY=1`: what each backend still
37
+ does under it is above.
4
38
 
5
39
  ## iPhone Mirroring backend (`phone_*`)
6
40
 
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 `iphone` alone for 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
41
+ The agent observes with OCR on the Mac (`phone_screenshot`, `phone_ocr`, `phone_find`), acts at normalized 0–1
42
+ coordinates (`phone_tap`, `phone_longpress`, `phone_swipe`, `phone_scroll`), types by pasting (`phone_type`) and opens
43
+ apps by name (`phone_open`). The phone exposes no accessibility tree to the Mac, so a tap lands where OCR placed the
44
+ text. The driver (imctl, Python, MIT) ships in `imctl/`.
45
+
46
+ ### Requirements and Python setup
47
+
48
+ - **Apple's requirements** ([support.apple.com/120421](https://support.apple.com/120421)): a Mac with Apple silicon or a
49
+ 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
50
+ with two-factor authentication; Bluetooth and Wi-Fi on; the Mac not sharing its internet connection or using AirPlay
51
+ or Sidecar. **The iPhone must be locked and near the Mac** — unlocking it, or quitting iPhone Mirroring, ends the
52
+ session. iPhone Mirroring is currently unavailable in the EU. One Mac and one iPhone at a time; camera and microphone
53
+ are not mirrored.
54
+ - **It takes the Mac's pointer and keyboard.** iPhone Mirroring is a Mac window, so every phone input goes through the
55
+ Mac: iPhone Mirroring comes to the front, taps and swipes move the real pointer, and `phone_type` pastes with ⌘V. Do
56
+ not use the Mac while a phone step runs — noracu refuses while the keyboard or mouse was used within the last 2 s
57
+ (`user_active`, nothing sent) and puts the pointer back afterwards, but the window in front changes.
58
+ - **Python:** the driver needs a python3 that imports pyobjc (Quartz, Vision, AppKit). Set `NORACU_PYTHON`, or noracu
59
+ probes `/opt/homebrew/bin/python3`, `/usr/local/bin/python3`, `python3`, `/usr/bin/python3` once, on the first
60
+ `phone_*` call. Apple's `/usr/bin/python3` usually lacks pyobjc; Homebrew's python3 plus
61
+ `python3 -m pip install pyobjc-framework-Quartz pyobjc-framework-Vision pyobjc-framework-Cocoa` is the common setup.
62
+ - **Unattended sessions:** in iPhone Mirroring → Settings, "Authenticate automatically" lets a session start without a
63
+ password prompt. Trade-off: anyone who can use your unlocked Mac can then open your phone.
64
+
65
+ ### Walkthrough
66
+
67
+ ```
68
+ phone_status
69
+ → {"running": true, "window": {...}, "window_id": 278508, "onscreen": true,
70
+ "frontmost": false, "live": false, "overlay": "Connection Paused", "paused": true, "setup": false}
71
+
72
+ phone_tap {"x": 0.5, "y": 0.5} # refused while the mirror is not live
73
+ → ERROR: mirror_not_live: Connection Paused — call phone_launch first (delivery=not_delivered, retry=safe)
74
+
75
+ phone_launch # brings the mirror to the front and clicks Resume
76
+ → iPhone Mirroring ready (delivery=delivered_unverified, retry=safe)
77
+
78
+ phone_ocr # OCR of the Mirroring window (captured by window id)
79
+ → (0.50,0.06) 'Settings' [1.00]
80
+ (0.18,0.31) 'FaceTime' [1.00]
81
+ -- 2 hits
82
+
83
+ phone_find {"text": "Settings"}
84
+ → (0.50,0.06) 'Settings' [1.00]
85
+
86
+ phone_tap {"x": 0.50, "y": 0.06}
87
+ → tapped (0.5, 0.06) (delivery=delivered_unverified, retry=unsafe)
88
+ ```
89
+
90
+ - **Mirror state.** `phone_status` reports `live` (the phone's screen is being streamed), `overlay` (the text iPhone
91
+ Mirroring shows instead, such as "Connection Paused" or "iPhone in Use"), `paused` (that overlay offers a Resume
92
+ button) and `setup` (a setup or welcome screen the person must finish — noracu never clicks it). Detection reads the
93
+ window's structure and shape, not its language. While the mirror is not live, every phone input tool refuses with
94
+ `mirror_not_live` (or `mirror_state_unknown` when the state cannot be read) without stealing focus, and `phone_ocr` /
95
+ `phone_find` start with a warning line. The mirror pauses after inactivity; `phone_launch` brings it forward and
96
+ clicks Resume.
97
+ - **Scrolling and swiping.** `phone_scroll {"direction": "down", "distance": 0.5}` moves the list by about half a
98
+ window with trackpad-style scroll events; a vertical `phone_swipe` does not scroll lists in iPhone Mirroring, so keep
99
+ swipes for gestures such as Home Screen paging. Start a page swipe in the empty strip just above the Dock (y about
100
+ 0.80): a drag that starts on an app icon picks the icon up — it can rearrange the Home Screen or make a folder.
101
+ - **Typing.** `phone_type` pastes through the clipboard with ⌘V (never echoing the text), saving every clipboard item
102
+ first and restoring the clipboard once OCR sees the pasted text appear where it was not before, below the status bar;
103
+ only that sighting makes the result `delivered_verified`. A text under four characters, a late paste, or
104
+ `type_not_confirmed` leaves the typed text on the clipboard. The phone reads the Mac clipboard through Universal
105
+ Clipboard, which learns about new content with a delay, so `phone_type` waits at least 1.5 s between writing the
106
+ clipboard and ⌘V; it needs a Mac keyboard layout that keeps A and V where U.S. QWERTY has them (U.S., ABC and Pinyin
107
+ do; French AZERTY and Dvorak do not — otherwise `keyboard_layout`, nothing sent). After `type_not_confirmed`, read the
108
+ field before typing again.
109
+ - **Opening an app.** `phone_open {"app": "Calculator"}` opens Spotlight through iPhone Mirroring's own shortcut, pastes
110
+ the name, and taps it only when Spotlight's Top Hit card shows exactly that name — or, where Spotlight shows its
111
+ search field at the top and no Top Hit card (seen on iOS 27), only when the field completes the name as
112
+ "<name> — Open". Web suggestions, websites and Settings rows of the same name are never tapped; otherwise it returns
113
+ to the Home Screen and reports `app not found`. A paste can take seconds to reach the phone: when the name never shows
114
+ up, it waits up to 15 s and reports `open_not_confirmed` (retry). OCR rarely reads a one- or two-letter name such as
115
+ `X`, so for those it reports `open_not_confirmed` at once and taps nothing — open such an app from its Home Screen icon
116
+ (`phone_screenshot`, then `phone_tap`). Use the name the phone shows under the icon (`拼多多`, not `Pinduoduo`); on an
117
+ iPhone set to another language, set `NORACU_TOPHIT_LABELS` to the label the phone shows (the "— Open" completion is
118
+ English only). The app name can stay on the Mac clipboard.
119
+ - **Home and App Switcher.** `phone_home` / `phone_app_switcher` use the iPhone Mirroring menu while the mirror is live
120
+ (without python on English macOS; elsewhere through an imctl gesture) and report only that the command was sent.
121
+
122
+ ### Known limits
123
+
124
+ - A tap goes where OCR saw the text, so repeated or misread labels can be hit wrong; `phone_open` cannot tell an app
125
+ from a contact or website that Spotlight's Top Hit shows under the same name.
126
+ - The window has a transparent margin around the phone screen (a strip above it holds the window's own controls, and a
127
+ thin edge runs around the rest), and iOS cancels a drag that starts or ends there. A tap or long press aimed at it is
128
+ refused with `out_of_screen`; a swipe's points are moved just inside the screen and the result names them. The
129
+ screen's edges are measured from one capture and remembered per window size and macOS version in
130
+ `~/Library/Caches/noracu/phone-screen-rect.json`; a measurement taken while the pointer rests on the strip is not
131
+ trusted, and until a clean one exists, points near the top or the sides are refused (taps) or moved inward (swipes).
132
+ - On one tested setup (iPhone 17 Pro Max on iOS 27.0.1, Mac on macOS 26.6.2) iPhone Mirroring drew the phone about 17%
133
+ larger than its window at every View size, so the right column and bottom row were cut off and could not be reached;
134
+ moving the window between displays, changing the main display and relaunching made no difference, and the iOS 27 /
135
+ macOS 26 mismatch is the main suspect. Check `phone_screenshot` if taps near the edges miss.
136
+ - `phone_home` / `phone_app_switcher` return `menu_unknown` without a second gesture when the menu does not answer.
137
+ - A paste can stop after the phone's "Pasting from …" box; in a device run, a ⌘V sent about 0.5 s after the clipboard
138
+ write once pasted the phone's own older clipboard instead (hence the 1.5 s wait).
139
+
140
+ ## XCUITest backend (`ios_*`)
141
+
142
+ With the iPhone layer on, `NORACU_PHONE_BACKEND=xcuitest` lists nine `ios_*` tools in place of `phone_*`. They do not go
143
+ through iPhone Mirroring: a small UI-test bundle (the "runner" — Swift, MIT, source in `ios-runner/`) runs on the iPhone
144
+ and executes one command at a time. The agent reads the app's own accessibility elements (`ios_snapshot`) and acts on
145
+ them by `element_index` (`ios_tap`, `ios_type`), in screen points. Apps are opened by bundle id (`ios_launch`); text is
146
+ typed as keyboard input, with no clipboard.
147
+
148
+ ### Requirements and one-time `noracu ios-setup`
149
+
150
+ - Xcode (the full app); an Apple developer team to sign the runner; an iPhone paired with this Mac with Developer Mode
151
+ on — over a cable or the local network — or a booted simulator. **The iPhone must be unlocked** while these tools are
152
+ used (the opposite of iPhone Mirroring): a locked phone gets `device_locked` — no input, and no snapshot or screenshot
153
+ either.
154
+ - **Set-up, once per device:** `npx noracu ios-setup --team <TeamID>` builds the runner into
155
+ `~/.noracu/ios-runner/<udid>` (add `--udid` when several iPhones are connected; a simulator needs only `--udid`). It
156
+ is an explicit command — nothing is built on install — and the one step of this backend that goes online: Xcode signs
157
+ the runner for your team and may create a development provisioning profile; an iPhone is registered in the team only
158
+ with `--register-device`. After upgrading noracu, run it again when a call answers `runner_version_mismatch`.
159
+
160
+ ### Walkthrough
161
+
162
+ ```
163
+ ios_status → device, locked?, runner built?, runner running?
164
+ ios_launch { bundle_id: "com.apple.Preferences" } → in front (delivered_verified)
165
+ ios_snapshot { interactive: true } → elements: [{ i, type, label, value, frame }]
166
+ ios_type { element_index: 12, text: "wifi" } → verified when a field shows the text
167
+ ios_tap { element_index: 31 } → sent; look again
168
+ ios_snapshot → the new screen, new indexes
169
+ ios_home → Home Screen; earlier indexes end
170
+ ```
171
+
172
+ - 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
173
+ it is warm, close to half a minute right after it booted). An input call that had to start it sends nothing, because
174
+ the runner's own app comes to the front — look with `ios_snapshot` first. The server stops the runner when it exits.
175
+ - Indexes last 30 s. Before one is used the app is read again; `element_no_longer_valid` means the element moved,
176
+ changed, or its app left the front — take a new `ios_snapshot`. `ios_home` and `ios_launch` end earlier indexes. An
177
+ app that has just come to the front may still be filling in its rows: snapshot again after a moment.
178
+ - `bundle_id` defaults to the app of the last call (`ios_launch` sets it; `ios_home` sets it to
179
+ `com.apple.springboard`). Coordinates (`ios_tap` x,y, `ios_swipe` from/to, element frames, the size `ios_screenshot`
180
+ reports) are screen points.
181
+ - Scroll with `ios_swipe` (a list moves a little less than the finger); press return or delete with `ios_key`; a long
182
+ press is `ios_tap` with `duration_ms`. `ios_type` reports `delivered_verified` only when the field that took the text
183
+ afterwards holds what it held before with the text added in one place (four characters or more).
184
+ - `NORACU_STOP_FILE`, `NORACU_DENY_APPS` and `NORACU_APPROVAL_FILE` apply, matched on the iOS bundle id (the default deny
185
+ list names Mac apps only, so no iOS app matches it by default). While app rules are active, input that names the
186
+ Home Screen (`com.apple.springboard`) is refused, even if listed in `allow` — open approved apps with `ios_launch`.
187
+ `NORACU_USER_IDLE_S` does not apply: these tools do not use the Mac's keyboard or mouse. While a system prompt is up
188
+ on the iPhone, input named for an app is not sent (`system_alert`); the person answers it on the phone.
189
+
190
+ ### Known limits
191
+
192
+ - **Control Center over an app:** the app still reports that it is in front, and a tap would land on Control Center.
193
+ noracu refuses the input with `system_overlay` and sends nothing; `ios_home` closes it.
194
+ - **Notification Center over an app:** input is refused as `app_not_foreground`; reading the app can take 30 s and end
195
+ in `ios_timeout`.
196
+ - **A locked iPhone asks for its passcode.** After the phone has been idle and locked, the backend answers
49
197
  `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
198
+ - **Text into a temporary input box** (a comment box an app shows over its page): in one app, `ios_type` with an
199
+ `element_index` closed the box before the text arrived. Tap the field with `ios_tap`, check with `ios_snapshot` that
200
+ the keyboard is up, then call `ios_type` without an index.
201
+ - **The clipboard:** iOS does not let an app that is not in front write the clipboard. This backend has no paste tool;
202
+ `ios_type` types with the keyboard.
203
+ - **A paste prompt:** when an app comes to the front and reads the clipboard, iOS asks whether to allow the paste.
204
+ While that prompt is up, every `ios_*` input answers `system_alert` and nothing is sent; `ios_screenshot` shows what
205
+ it asks, and the person answers it on the phone (seen on an iPhone 16 Pro, 2026-11-15).
206
+ - **Checked:** a Live Activity in the Dynamic Island (a running timer) while an app is in front does not get input
59
207
  refused (iPhone 16 Pro, iOS 27.2.1, 2026-11-17).
208
+ - **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
209
+ 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
210
+ screenshot taken more than a second after the last check.
211
+
212
+ ## Privacy and screen captures
213
+
214
+ - Whatever the phone shows — notifications, messages, mail, one-time codes — becomes tool output that your MCP client
215
+ sends to its model, with either backend. Turn on a Focus, open a neutral app before you start, and begin with
216
+ `NORACU_READ_ONLY=1`. iPhone notifications also reach the Mac once Mirroring is set up.
217
+ - With Mirroring, looking is not invisible to the phone: in a device run (iPhone 17 Pro Max on iOS 27, Mac on macOS
218
+ 27.2) LinkedIn and rednote each showed their after-screenshot share sheet one to four seconds after every capture of
219
+ the mirror window, one more sheet per capture. Every tool that reads the screen captures it — `phone_screenshot`,
220
+ `phone_ocr`, `phone_find`, any `expect` check, and the checks inside `phone_type`, `phone_open` and `phone_scroll` —
221
+ and so does a phone input that first has to bring iPhone Mirroring to the front. Assume an app that logs screenshots,
222
+ or tells the other person in a chat about them, does so on every capture (not tested).
223
+ - Under `NORACU_READ_ONLY=1` the XCUITest backend answers `ios_status` only: `ios_snapshot` / `ios_screenshot` return
224
+ `runner_not_started`, because reading the screen needs the runner and starting it puts the runner's own app in front
225
+ of whatever the iPhone shows.
226
+
227
+ ## Errors and recovery
228
+
229
+ What each code means is in the [error reference in usage.md](usage.md#error-reference). The usual ways back:
230
+
231
+ - `mirror_not_live` / `mirror_state_unknown`: call `phone_status`, then `phone_launch` (it starts iPhone Mirroring and
232
+ clicks Resume); lock the iPhone and keep it near the Mac. `mirror_setup_required`: the person finishes the setup or
233
+ welcome screen in the iPhone Mirroring window — noracu never clicks through it.
234
+ - `imctl_unavailable`: install pyobjc for a python3 or set `NORACU_PYTHON` (above). `imctl_timeout`: the step may have
235
+ partly run — look with `phone_status` / `phone_screenshot` before retrying.
236
+ - `device_locked` / `lock_unknown`: unlock the iPhone. `ios_setup_required` or `runner_version_mismatch`: run the
237
+ `npx noracu ios-setup …` command the error names. `system_alert`: the person answers the prompt on the phone.
238
+ - After `type_not_confirmed` (either backend), read the field before typing again.
239
+
240
+ ## Related references
241
+
242
+ - [usage.md](usage.md#environment-variables): the iPhone environment variables (`NORACU_PHONE_BACKEND`,
243
+ `NORACU_PYTHON`, `NORACU_PHONE_TIMEOUT_MS`, `NORACU_OCR_LANGUAGES`, `NORACU_TOPHIT_LABELS`, `NORACU_OCR_MIN_CONFIDENCE`,
244
+ `NORACU_IOS_UDID`, `NORACU_IOS_RUNNER_DIR`).
245
+ - [SECURITY.md](../SECURITY.md): the iPhone threats (6, 12, 18, 21–27).
246
+ - [known-issues.md](known-issues.md): what was tested and what is known and not fixed.
247
+ - [ios-runner-protocol.md](ios-runner-protocol.md): the runner's wire protocol.
@@ -1,17 +1,17 @@
1
1
  # Known issues
2
2
 
3
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).
4
+ was not tested on. Security limits and defaults are in [SECURITY.md](../SECURITY.md); the operational limits of
5
+ the two experimental, off-by-default iPhone backends are in [iphone.md](iphone.md).
6
6
 
7
7
  ## Where it was tested
8
8
 
9
9
  | Layer | Tested on | Not tested |
10
10
  |---|---|---|
11
- | Mac | one Apple silicon Mac on macOS 27.2 — the whole test suite, with real apps and windows, before each release | Intel Macs; macOS 15 and 26. Only the part of the suite that needs no desktop runs elsewhere (GitHub's macOS runner) |
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
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 |
13
+ | iPhone — XCUITest (experimental, off by default) | 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 (experimental, off by default) | an iPhone 17 Pro Max mirrored to that Mac | other pairs of Mac and iPhone |
15
15
 
16
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
17
  real phone, and no run on a real machine has covered the change since, the change is listed below under
@@ -39,8 +39,20 @@ real phone, and no run on a real machine has covered the change since, the chang
39
39
  `skeleton` do not make it smaller there (a flat window whose every row takes an action). `mac_apps` lists
40
40
  menu-bar and background apps too — about 15 KB on a Mac that runs a hundred of them; `filter` narrows it.
41
41
  Measured 2026-11-17 on macOS 27.2.
42
+ - **Changing status text or unformatted counters inside a row.** A word that changes inside an element's
43
+ item (`"Saving…"` → `"Saved"`, a validation message), or a number that is not a time, a percentage, a time
44
+ span or a count (`"Inbox 3"` → `"Inbox 4"`), makes its `element_index` stale (`element_no_longer_valid`);
45
+ so does opening an identical context menu at the same spot for another row. Take a fresh snapshot before
46
+ acting.
47
+ - **Notification Center history** is listed only while the panel is open; `open_center: true` clicks the
48
+ menu-bar clock, which accessibility does not expose on every macOS version.
49
+ - **Text put in through accessibility takes the field's default style.** `mac_type` inserts text through
50
+ accessibility by default; in TextEdit it came out in the default 12 pt even where a larger size had been
51
+ picked for the caret in the toolbar (macOS 27.2). `mechanism: "physical"` sends keystrokes instead.
42
52
  - **Electron and Chromium apps** take no background click, so a physical click there moves the pointer; see
43
- the README.
53
+ [How it behaves](../README.md#how-it-behaves).
54
+ - **macOS only for the Mac and iPhone layers.** The browser layer alone (`NORACU_LAYERS=browser`) also starts
55
+ on other systems; it was tested on macOS only.
44
56
 
45
57
  ## Known and not fixed in this version
46
58
 
@@ -54,11 +66,12 @@ Mac and browser:
54
66
  - Your own Chrome: when attaching fails after noracu's window was opened, that window is reported closed
55
67
  unless Chrome says that closing failed. Chrome has always said so in tests.
56
68
 
57
- iPhone, Mirroring backend:
69
+ iPhone, Mirroring backend (experimental, off by default):
58
70
 
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.
71
+ - `phone_open` reads Spotlight's search field after clearing it, by text recognition (see below). Where Spotlight
72
+ puts the field at the bottom of the screen, text left in it may not be recognised, and the word "Search" read
73
+ near the bottom counts as an empty field wherever the field is. The name is then typed after the old text, no
74
+ result matches and the call fails; it does not tap a wrong result.
62
75
  - `phone_open` where Spotlight shows its field at the top: if text recognition reads the magnifier as a
63
76
  letter, the app name does not match and the call fails; it does not tap a wrong result. Not seen on the
64
77
  test phone.
@@ -69,11 +82,14 @@ iPhone, Mirroring backend:
69
82
 
70
83
  - Intel Macs: without `NORACU_CLICLICK` the server now also looks for cliclick under `/usr/local/bin`, where
71
84
  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
85
+ - iPhone, XCUITest backend (experimental, off by default): right before an input goes out, the lock is read again when its last answer is older
73
86
  than a second and the stop file is looked at again, last; `ios_launch` looks at the stop file again right
74
87
  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
88
+ - iPhone, Mirroring backend (experimental, off by default): `phone_open` taps nothing when the app's row in Spotlight moved between two reads
76
89
  and the read after that no longer shows the name. Run against scripted screen reads only.
90
+ - iPhone, Mirroring backend (experimental, off by default): `phone_open` reads Spotlight's search field after clearing
91
+ it, clears it once more if text is left, and stops with `open_not_confirmed` before typing if text is still there.
92
+ Run against scripted screen reads only.
77
93
  - `noracu doctor` on a system other than macOS, with `NORACU_LAYERS=browser`: macOS and cliclick are no longer
78
94
  listed as missing. Run with a stand-in for the system only.
79
95