noracu 0.1.4 → 0.2.0
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/CHANGELOG.md +409 -0
- package/README.md +34 -22
- package/README.zh-CN.md +36 -24
- package/SECURITY.md +15 -8
- package/docs/architecture.md +58 -27
- package/docs/tools.md +45 -34
- package/docs/usage.md +180 -64
- package/imctl/README.md +16 -13
- package/imctl/pyproject.toml +1 -1
- package/imctl/src/imctl/__init__.py +1 -1
- package/imctl/src/imctl/cli.py +152 -38
- package/imctl/src/imctl/gestures.py +21 -25
- package/imctl/src/imctl/input.py +187 -50
- package/imctl/src/imctl/window.py +10 -3
- package/package.json +5 -4
- package/src/mac-ax.js +2397 -0
- package/src/server.mjs +1645 -483
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,414 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.0] — 2026-11-06
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- The Mac layer reads and acts through a new accessibility engine,
|
|
7
|
+
`src/mac-ax.js`: a static JXA script that calls the macOS Accessibility API
|
|
8
|
+
(`AXUIElement*`) directly instead of going through System Events. Reading a
|
|
9
|
+
Finder window of about 500 elements took about 0.15 s on the test Mac
|
|
10
|
+
(macOS 27.2), so the default depth is now 12 instead of 3. Requests reach it
|
|
11
|
+
as JSON on stdin, never in argv.
|
|
12
|
+
- `mac_ax_state` takes `interactive` (only actionable elements), `compact`
|
|
13
|
+
(default true: skips empty layout wrappers), `skeleton` plus `root` (map a
|
|
14
|
+
dense app shallowly, then drill into one element; the drill extends the same
|
|
15
|
+
snapshot), `surface` (`window`, `menubar`, `menu`, `sheet`, `alert`,
|
|
16
|
+
`dialog`, `popover`, `focused`, `app`), `window` (index or title) and
|
|
17
|
+
`max_nodes`. Each element carries `d` (depth), `states` and `actions`; the
|
|
18
|
+
result carries `snapshot_id` and `complete`. Several windows and none focused
|
|
19
|
+
is `ambiguous_window` with the list, instead of reading an arbitrary one.
|
|
20
|
+
- Electron and Chromium apps get their web accessibility tree switched on
|
|
21
|
+
(`AXManualAccessibility` only — never `AXEnhancedUserInterface`, which alters
|
|
22
|
+
window behaviour) when read unless `web_accessibility: false` or
|
|
23
|
+
`NORACU_READ_ONLY=1`; `mac_ax_state` and `mac_find` take `web_accessibility`
|
|
24
|
+
and report the outcome.
|
|
25
|
+
- New tools: `mac_find` (search by role, title, value, text or AXIdentifier),
|
|
26
|
+
`mac_get` (read one element live: full value, states, actions, settable
|
|
27
|
+
attributes), `mac_status` (Accessibility and Screen Recording permission,
|
|
28
|
+
cliclick, displays), `mac_apps` (running apps) and `mac_windows` (windows
|
|
29
|
+
with CGWindowID and bounds, plus displays). All five are observation tools
|
|
30
|
+
and are allowed under `NORACU_READ_ONLY=1`.
|
|
31
|
+
|
|
32
|
+
- `mac_click` with an `element_index` uses the element's own accessibility
|
|
33
|
+
action when it has one (press, show menu, select): no pointer movement, no
|
|
34
|
+
focus change, and it works on windows in the background. Without one it
|
|
35
|
+
clicks physically, but only after a hit test shows that the point reaches the
|
|
36
|
+
element; otherwise it returns `occluded` with what is on top and sends
|
|
37
|
+
nothing. `mechanism` (`auto`, `semantic`, `physical`) forces one path; a
|
|
38
|
+
semantic attempt that fails is reported, not retried physically.
|
|
39
|
+
- Every Mac action result says whether it was delivered
|
|
40
|
+
(`delivered_verified` when a change was observed, `delivered_unverified`,
|
|
41
|
+
`not_delivered`, `unknown`) and whether a retry is safe, and names sheets,
|
|
42
|
+
dialogs or menus it opened. The engine reads the element and its app again
|
|
43
|
+
after acting, because accessibility return codes alone do not prove an
|
|
44
|
+
effect (Finder reports success for an action that does not exist).
|
|
45
|
+
- `mac_type` inserts text through accessibility (`AXSelectedText` at the
|
|
46
|
+
caret, or the whole value with `replace: true`) into an `element_index` or
|
|
47
|
+
the focused element: IME-safe, the clipboard is untouched, it works in a
|
|
48
|
+
background app, and the value is read back. It falls back to keystrokes only
|
|
49
|
+
when accessibility reports no focused element or the focus is a text view it
|
|
50
|
+
cannot write (such as a terminal); a focused button, list or sheet gets no
|
|
51
|
+
keystrokes.
|
|
52
|
+
- New tool `mac_set_value`: text fields, checkboxes, switches and radio
|
|
53
|
+
buttons (idempotent: nothing is sent when the state already matches),
|
|
54
|
+
disclosure triangles and expandable rows, selectable rows, cells and tabs,
|
|
55
|
+
pop-up and menu buttons and combo boxes (picks exactly one matching option,
|
|
56
|
+
else closes the menu again and lists the options), sliders and steppers.
|
|
57
|
+
- `mac_scroll` takes an `element_index`: a scroll area is scrolled at its own
|
|
58
|
+
center (and the result says when the position did not change); any other
|
|
59
|
+
element is scrolled into view.
|
|
60
|
+
- `mac_key` refuses chords that quit, log out, lock, force-quit, delete
|
|
61
|
+
immediately or empty the Trash (`cmd-q`, `alt-cmd-q`, `cmd-shift-q`,
|
|
62
|
+
`cmd-alt-esc`, `ctrl-cmd-q`, `alt-cmd-delete`, `cmd-shift-delete`, …) unless
|
|
63
|
+
`force: true`.
|
|
64
|
+
|
|
65
|
+
- New tool `mac_wait`: waits for a window, text, an element state, a menu, a
|
|
66
|
+
sheet or dialog, an app starting or ending, or a new notification, polling
|
|
67
|
+
accessibility inside one process instead of sleeping; on timeout it returns
|
|
68
|
+
what it last saw.
|
|
69
|
+
- New tool `mac_app`: launch (attaches to a running instance; starts in the
|
|
70
|
+
background unless `activate`; waits for a window), activate, hide, unhide,
|
|
71
|
+
quit. Quit is verified by the process ending; a save dialog that keeps the app
|
|
72
|
+
running is reported, and `force: true` force-quits. Finder, the Dock,
|
|
73
|
+
loginwindow and other session processes, and the MCP host itself, are never
|
|
74
|
+
quit.
|
|
75
|
+
- `mac_app` launch with `cdp_port` (needs `NORACU_ALLOW_CDP=1`) starts a
|
|
76
|
+
Chromium or Electron app fresh with a DevTools port on 127.0.0.1, and
|
|
77
|
+
`browser_launch` with `cdp_port` attaches Playwright to it, so `browser_*`
|
|
78
|
+
drive its web contents while menus, dialogs and windows stay on `mac_*`.
|
|
79
|
+
`browser_close` then only disconnects. Chrome-family browsers get a profile
|
|
80
|
+
of their own under `~/.noracu/cdp-profiles/` (Chrome refuses remote debugging
|
|
81
|
+
on the default profile); an Electron app keeps its own data. An app that is
|
|
82
|
+
already running is refused rather than quit.
|
|
83
|
+
- New tool `mac_window`: focus, raise, minimize, restore, move, resize,
|
|
84
|
+
maximize (the display's visible area), fullscreen, exit fullscreen — by
|
|
85
|
+
CGWindowID from `mac_windows` or by app + window; verified by reading the
|
|
86
|
+
window again.
|
|
87
|
+
- `mac_screenshot` captures one window (`window_id`, also when covered) or a
|
|
88
|
+
given display (`display`).
|
|
89
|
+
- New tool `mac_clipboard_read`: file paths, an image, or text (capped).
|
|
90
|
+
An item marked concealed by a password manager
|
|
91
|
+
(`org.nspasteboard.ConcealedType`) is never returned.
|
|
92
|
+
- New tool `mac_notifications`: lists banners, alerts and an open Notification
|
|
93
|
+
Center (id, app, title, subtitle, body, actions, plus `center_opened` and
|
|
94
|
+
`center_was_open` when `open_center: true`), and dismisses or acts on one by
|
|
95
|
+
its non-empty id (`notification_not_found` when gone), or by index plus a
|
|
96
|
+
non-empty expected app or title that is re-checked.
|
|
97
|
+
- `mac_ax_state` and `mac_find` take `window_id`.
|
|
98
|
+
|
|
99
|
+
- `mac_menu_command` presses the item through the accessibility engine, by
|
|
100
|
+
title or by a `Menu > Item` path, without the app being frontmost, and
|
|
101
|
+
reports delivery; an unknown item is now an error. `phone_home` and
|
|
102
|
+
`phone_app_switcher` use the same path for the iPhone Mirroring menu.
|
|
103
|
+
- `initialize` returns `instructions`: the observe → act → verify loop and the
|
|
104
|
+
delivery / retry rules, for clients that show them to the model.
|
|
105
|
+
- `NORACU_TRACE=<file>` writes one JSON line per tool call (`{ts, tool, args,
|
|
106
|
+
ms, error, code}`): tool, argument names and sizes (never their text),
|
|
107
|
+
duration, error flag and error code prefix — never result text or error
|
|
108
|
+
messages — opening the file `0600` with `O_NOFOLLOW` so a symlink is refused.
|
|
109
|
+
|
|
110
|
+
### Changed
|
|
111
|
+
- An element is re-identified only inside the window it was seen in, by that
|
|
112
|
+
window's CGWindowID: an index from a window that has since closed is
|
|
113
|
+
`element_no_longer_valid`, even when another window of the app looks the
|
|
114
|
+
same.
|
|
115
|
+
- `mac_click` / `mac_drag` with an index no longer require the snapshot's app
|
|
116
|
+
to be frontmost; the element is re-identified and, for a physical click,
|
|
117
|
+
hit-tested instead.
|
|
118
|
+
- An `element_index` is backed by identity evidence instead of a stored point:
|
|
119
|
+
process, container (window by CGWindowID, open menu, menu bar or app), child
|
|
120
|
+
path, role, subrole, AXIdentifier, label (never the value), frame relative to
|
|
121
|
+
the container, the labels of its ancestors, the child count along its path,
|
|
122
|
+
and the texts of its item (static text and link labels under it or its
|
|
123
|
+
nearest ancestor below the page, toolbar or pane level; a text field's value
|
|
124
|
+
only when it is table content such as a file name; an item that two
|
|
125
|
+
look-alikes share is not used). An element found at its path must agree on
|
|
126
|
+
all of it (the child counts may differ only when its own item vouches for
|
|
127
|
+
it); a labelled element may be found by search only near where it was and in
|
|
128
|
+
the same item (a re-sorted list resolves to the same item; a look-alike that
|
|
129
|
+
arrived since is not taken for it), an unlabelled one never. Digits in a
|
|
130
|
+
unique element's item are ignored, so a character counter next to Send does
|
|
131
|
+
not invalidate it. A drilled (`root`) snapshot or a filtered `mac_find` cannot know
|
|
132
|
+
whether an element is unique, so its elements are checked as look-alikes. So
|
|
133
|
+
a row inserted above, a closed panel or a closed pop-up menu gives
|
|
134
|
+
`element_no_longer_valid`, never a look-alike (a search no longer enters the
|
|
135
|
+
menu bar, whose closed items can still be pressed).
|
|
136
|
+
- Mac `element_index` values are unique for the life of the server: every
|
|
137
|
+
snapshot continues one counter, so an index from an earlier snapshot keeps
|
|
138
|
+
naming its own element after a later `mac_find` or `mac_ax_state`.
|
|
139
|
+
`snapshot_id` is optional and must match the index. A drill (`root`) numbers
|
|
140
|
+
the children from where the root is now.
|
|
141
|
+
- `mac_ax_state` / `mac_find` with `window_id` alone read that window's app;
|
|
142
|
+
`mac_find` `text` with `exact:true` matches the label or the value as a whole
|
|
143
|
+
string, and `id` is a substring match unless
|
|
144
|
+
`exact:true`, as documented.
|
|
145
|
+
- A window or root that does not answer accessibility is `app_unresponsive`, not
|
|
146
|
+
an empty tree reported as complete.
|
|
147
|
+
- Physical clicks fail closed: when the accessibility hit test is inconclusive (an
|
|
148
|
+
error, nothing there, or only a container of the element), the click is sent
|
|
149
|
+
only if the topmost on-screen window at the point belongs to the element's
|
|
150
|
+
app; otherwise `occluded` / `not_actionable`, nothing sent.
|
|
151
|
+
- `mac_drag` with indexes re-identifies and hit-tests the drop target as well as
|
|
152
|
+
the start point.
|
|
153
|
+
- The focus guard (`app` on `mac_key`, `mac_paste`, `mac_type`) compares
|
|
154
|
+
processes, so a bundle id or `.app` path works; it reads the frontmost app
|
|
155
|
+
through the accessibility engine instead of System Events (no Automation
|
|
156
|
+
prompt, no blocking call). `mac_type` with `mechanism: "physical"` and an
|
|
157
|
+
`element_index` types only if the click left the element's app in front.
|
|
158
|
+
- cliclick runs asynchronously under a timer; a cliclick that fails after it
|
|
159
|
+
started is reported `action_failed` with `delivery=unknown, retry=unsafe`
|
|
160
|
+
(only a cliclick that never started is `not_delivered`).
|
|
161
|
+
- The stale-server note also fires when `src/mac-ax.js` changed on disk.
|
|
162
|
+
- `NORACU_READ_ONLY=1` allows 18 tools (the six new Mac observation tools,
|
|
163
|
+
`mac_wait` included, except `mac_wait` with `condition: "notification"` is
|
|
164
|
+
refused and `mac_ax_state` / `mac_find` do not enable `web_accessibility` on
|
|
165
|
+
apps); `mac_clipboard_read` and `mac_notifications` stay outside it.
|
|
166
|
+
- `tools/list` emits a `required` array derived from non-optional arguments on
|
|
167
|
+
every tool that has any, and every tool checks its arguments (types, ranges,
|
|
168
|
+
allowed values, string lengths) before anything runs.
|
|
169
|
+
- Accessibility failures read `permission_denied: …` instead of the raw
|
|
170
|
+
AppleScript error -1719.
|
|
171
|
+
|
|
172
|
+
### Fixed
|
|
173
|
+
- The server never blocks on a child process any more: screenshots, scroll
|
|
174
|
+
wheel events, `open`, `ps` and the Chromium download run asynchronously under
|
|
175
|
+
a timer, so `ping`, `tools/list` and other calls keep being answered while
|
|
176
|
+
one runs. Two `browser_launch` calls during a first-run Chromium download
|
|
177
|
+
share one download.
|
|
178
|
+
- Observation tools (`mac_ax_state`, `mac_find`, `mac_get`, `mac_windows`,
|
|
179
|
+
`mac_apps`, `mac_screenshot`, `mac_status`) and `mac_wait` no longer join
|
|
180
|
+
the input queue: they wait only for the inputs queued before them, so they
|
|
181
|
+
see the state after those inputs, and later inputs are not held up behind
|
|
182
|
+
them; if those inputs keep the queue busy past the queue limit they return
|
|
183
|
+
`input_busy` instead of reading too early. `mac_wait`'s timeout starts after
|
|
184
|
+
that wait.
|
|
185
|
+
- The server stops when the client closes its stdin instead of lingering, and
|
|
186
|
+
on SIGTERM / SIGINT / SIGHUP shuts down in order: queued calls are dropped
|
|
187
|
+
without acting, no new child process starts (a fallback step cannot act),
|
|
188
|
+
child processes get SIGTERM then SIGKILL after 1.5 s, browsers — also one
|
|
189
|
+
still starting — are closed, and it exits within 3 s. Two `browser_launch`
|
|
190
|
+
calls at once share one launch.
|
|
191
|
+
- A line that is not JSON gets a JSON-RPC parse error (-32700) and a batch
|
|
192
|
+
gets -32600 ("batch is not supported") instead of no answer.
|
|
193
|
+
- With `NORACU_PHONE_TIMEOUT_MS` above 45 s, a queued call waits as long as
|
|
194
|
+
the longest phone call ahead of it before giving up with `input_busy`.
|
|
195
|
+
- An accessibility call to an app that does not answer gives up after 3 s for
|
|
196
|
+
every element, not only for the app element.
|
|
197
|
+
- Accessibility engine timeouts report `delivery=unknown, retry=unsafe` on
|
|
198
|
+
every mutating operation (`mac_click`, `mac_set_value`, `mac_type`,
|
|
199
|
+
`mac_menu_command`, `mac_window`, `mac_app`, `mac_scroll` into view, and
|
|
200
|
+
mutating `mac_notifications` actions), while observation timeouts omit
|
|
201
|
+
delivery fields because nothing was sent.
|
|
202
|
+
- Outer accessibility engine process timeouts include a 12 s margin above
|
|
203
|
+
`timeout_ms` so the engine is not killed while waiting for an element to
|
|
204
|
+
become actionable and settle.
|
|
205
|
+
- Action verification ignores environment-only shifts (`frontmost`,
|
|
206
|
+
`focusedWindow`, `focus`) unless an element or surface property also changed,
|
|
207
|
+
reporting `delivered_unverified` instead of `delivered_verified`.
|
|
208
|
+
- Post-action observation after a physical click or wheel scroll counts an
|
|
209
|
+
element as `gone` only when the element, window or app is actually absent;
|
|
210
|
+
unresponsive or failed reads report `delivered_unverified` with a note
|
|
211
|
+
instead.
|
|
212
|
+
- Wheel scrolling on an element verifies delivery solely from `vscroll` /
|
|
213
|
+
`hscroll` changes, and notes an unchanged scroll position only when that
|
|
214
|
+
scroll check is unverified.
|
|
215
|
+
- Accessibility writes and steps that already executed never report
|
|
216
|
+
`not_delivered` / `retry=safe`: `mac_type` and `mac_set_value` look for the
|
|
217
|
+
value to change for about 0.4 s before returning `not_confirmed`
|
|
218
|
+
(`delivery=delivered_unverified, retry=unsafe`); a caret that moved while the
|
|
219
|
+
value reads the same is `delivered_unverified`, never verified; partial slider/stepper loops
|
|
220
|
+
report `delivered_unverified` with the step count completed, and `mac_window`
|
|
221
|
+
`maximize` reports `delivered_unverified` if moving succeeded before resizing
|
|
222
|
+
failed.
|
|
223
|
+
- `mac_window` `focus` reports `delivered_verified` only when the app is
|
|
224
|
+
frontmost and the target window itself reads focused or main.
|
|
225
|
+
- `mac_set_value` treats mixed-state checkboxes as neither on nor off, pressing
|
|
226
|
+
up to twice until the requested state is reached instead of answering
|
|
227
|
+
"already off".
|
|
228
|
+
- Pop-up and menu-button option matching in `mac_set_value` drops substring
|
|
229
|
+
matching (so `"One"` never picks `"None"`), matching exact, case-insensitive,
|
|
230
|
+
then normalized titles (collapsed whitespace and trailing ellipsis stripped).
|
|
231
|
+
- `mac_wait` fails immediately with `app_not_found` on `window_gone`,
|
|
232
|
+
`text_gone`, `menu_closed` and `sheet_gone` when the app is not running at the
|
|
233
|
+
first check, keeps polling on `text_gone` when window selection is ambiguous,
|
|
234
|
+
and counts `element` `gone` as met only on absent-target errors rather than a
|
|
235
|
+
hung app.
|
|
236
|
+
- `mac_key` states `delivery=delivered_unverified, retry=unsafe` in its result
|
|
237
|
+
text, and `mac_menu_command` documents that items reading disabled in closed
|
|
238
|
+
menus are still pressed and judged by before/after observation.
|
|
239
|
+
- `phone_home` and `phone_app_switcher` require the iPhone Mirroring menu item
|
|
240
|
+
to be enabled (`require_enabled`), refuse with `mirror_not_live` when the
|
|
241
|
+
mirror is paused or not running, return `menu_unknown`
|
|
242
|
+
(`delivery=unknown, retry=unsafe`) without falling back to a swipe when the
|
|
243
|
+
menu call times out, and fall back to the `imctl` gesture only when the
|
|
244
|
+
English menu item is absent. Success output states only that the command or
|
|
245
|
+
gesture was `sent` (`screen not verified`), never that the phone is on the
|
|
246
|
+
Home Screen.
|
|
247
|
+
- Non-import Python tracebacks from `imctl` are reported as
|
|
248
|
+
`imctl_error: <last line>` instead of `imctl unavailable` (kept for missing
|
|
249
|
+
Python or `pyobjc`), and `phone_longpress` passes `--duration` cleanly while
|
|
250
|
+
`imctl longpress` accepts both optional positional and `--duration` syntax.
|
|
251
|
+
- Every `imctl` press/release pair (`tap`, `long_press`, `swipe`,
|
|
252
|
+
`app_switcher`, `scroll_trackpad` phase end, `press_key`, `clear_text`, and
|
|
253
|
+
Command chords) posts its release event in `finally:` so an exception or
|
|
254
|
+
`SIGTERM` never leaves a mouse button, key, `⌘` or trackpad scroll phase held
|
|
255
|
+
down.
|
|
256
|
+
|
|
257
|
+
- Physical clicks and drags on a display left of or above the main one go to
|
|
258
|
+
the right place: cliclick reads a bare negative coordinate as relative to
|
|
259
|
+
the pointer, so negative coordinates are now written absolute (`=-N`).
|
|
260
|
+
- When the accessibility hit test is inconclusive, a physical click is also
|
|
261
|
+
refused when another window of the same app (a floating panel, another
|
|
262
|
+
document) is on top at the point; the Dock's own platter counts as covering,
|
|
263
|
+
only its full-display overlay lets clicks through.
|
|
264
|
+
- `mac_drag` takes `from_index` / `to_index` only (an undocumented coordinate
|
|
265
|
+
form skipped both hit tests); `mac_type` with `element_index` and `app`
|
|
266
|
+
refuses when the element belongs to another app.
|
|
267
|
+
- Results state delivery where they did not: refusals before anything is sent
|
|
268
|
+
(validation, focus guard, unknown or expired index, read-only mode,
|
|
269
|
+
`input_busy`, stopping) say `delivery=not_delivered, retry=safe`; an engine
|
|
270
|
+
that crashed or answered garbage during an action says `delivery=unknown`;
|
|
271
|
+
a failed scroll wheel says `unknown` unless the script never started;
|
|
272
|
+
`mac_window` is verified only by the state asked for (minimized, position,
|
|
273
|
+
size, full screen…), and a pop-up option only when the control shows it;
|
|
274
|
+
`mac_app` launch of a running app with `activate: true` reports the
|
|
275
|
+
activation; `phone_*` input results state delivery and retry too (a refusal
|
|
276
|
+
such as `mirror_not_live` or `expect_not_found` sent nothing; a timeout,
|
|
277
|
+
`type_not_confirmed`, `open_not_confirmed`, `capture_failed` or `focus_lost`
|
|
278
|
+
may have acted).
|
|
279
|
+
- `phone_home` / `phone_app_switcher` find iPhone Mirroring by bundle id, so a
|
|
280
|
+
non-English macOS (where the app's name is localized) still gets the menu
|
|
281
|
+
command or the gesture fallback instead of `mirror_not_live`.
|
|
282
|
+
- Phone input refuses when the mirror stops being live while it is brought
|
|
283
|
+
forward from another Space, and reports `mirror_state_unknown` instead of a
|
|
284
|
+
Python traceback when bringing it forward times out. A long swipe and the app
|
|
285
|
+
switcher's hold stop (and release the button) when the mirror loses focus;
|
|
286
|
+
an invalid long-press or swipe duration sends nothing.
|
|
287
|
+
- A `phone_open` stopped by SIGTERM no longer runs its own trip to the Home
|
|
288
|
+
Screen (it brought the mirror forward and sent a Cmd chord while the server
|
|
289
|
+
may be stopping); after a timeout the server goes Home through the menu.
|
|
290
|
+
- `phone_launch` results state delivery; a call refused because the server is
|
|
291
|
+
stopping, or `phone_type` refused because the clipboard changed before
|
|
292
|
+
anything was typed, says `delivery=not_delivered`.
|
|
293
|
+
- `browser_click` by `element_index` no longer falls back to a synthetic
|
|
294
|
+
JavaScript `click()` when Playwright's actionability checks fail: a covered,
|
|
295
|
+
disabled or detached element returns `occluded`, `not_actionable` or
|
|
296
|
+
`element_no_longer_valid` (`delivery=not_delivered, retry=safe`).
|
|
297
|
+
- Each browser session keeps the tab it is driving as the active page instead
|
|
298
|
+
of taking the last tab: a tab the page opens itself (`window.open`,
|
|
299
|
+
`target=_blank`) is never switched to (another tab becomes active only after
|
|
300
|
+
the active one closes), and an `element_index` used on a different tab, even
|
|
301
|
+
one at the same URL, returns `element_no_longer_valid`. When attaching over
|
|
302
|
+
CDP the session picks a context with non-`devtools://` pages; a standalone
|
|
303
|
+
`browser_launch` is refused while a CDP session is open instead of reusing
|
|
304
|
+
the attached app; a browser or app that closes or disconnects on its own is
|
|
305
|
+
forgotten.
|
|
306
|
+
- `browser_snapshot` names `<input>`, `<textarea>` and `<select>` fields from
|
|
307
|
+
ARIA labels, `<label>`, `placeholder`, the value of button-type inputs, the
|
|
308
|
+
selected option, `name` and `type` (text a user or agent typed is never part
|
|
309
|
+
of a name), and reports truncation — with how many interactive elements were
|
|
310
|
+
left out — past 100; `browser_scroll` accepts `up|down|left|right`, wheels at
|
|
311
|
+
the viewport center and reports the `scrollX`/`scrollY` change (or
|
|
312
|
+
`"did not move"`); `browser_navigate` includes the HTTP status (or
|
|
313
|
+
`"no response"` for same-document navigations); `browser_screenshot` over CDP
|
|
314
|
+
uses CSS pixels; every browser call runs under a time limit; `browser_type`
|
|
315
|
+
takes at most 2000 characters (use `browser_fill` for longer values), so its
|
|
316
|
+
time limit always covers the typing; every `browser_*` input tool (`click`,
|
|
317
|
+
`fill`, `type`, `press_key`, `scroll`, `navigate`, `evaluate`) states
|
|
318
|
+
`delivery=…, retry=…` in its success and error text.
|
|
319
|
+
- `phone_open` that ends in "app not found" says
|
|
320
|
+
`delivery=delivered_unverified` (it had already gone Home and searched
|
|
321
|
+
Spotlight); a screen capture that fails while checking `expect` says nothing
|
|
322
|
+
was sent; an `expect` value that starts with `-` reaches the iPhone driver as
|
|
323
|
+
one `--expect=…` argument and is never read as an option; an invalid
|
|
324
|
+
long-press or swipe duration is refused before iPhone Mirroring is brought
|
|
325
|
+
forward.
|
|
326
|
+
- `mac_window` `focus` / `raise`: when `AXRaise` fails after the window was
|
|
327
|
+
already unminimized or made main, the result follows the state asked for
|
|
328
|
+
instead of reporting `not_delivered`; a physical Mac click whose element does
|
|
329
|
+
not report its window id is checked against its window's (or the snapshot
|
|
330
|
+
window's) id, so another window of the same app on top is still `occluded`.
|
|
331
|
+
- A physical Mac click on an element that reports no window of its own is
|
|
332
|
+
checked against the window found through its parents, also when it came
|
|
333
|
+
from an app-wide snapshot; `mac_app` launch resolves `~/…` and symlinked
|
|
334
|
+
`.app` paths for every launch, not only with `cdp_port`; `browser_launch`
|
|
335
|
+
refusals before anything starts (profile in use, Chromium missing) say
|
|
336
|
+
`delivery=not_delivered, retry=safe`.
|
|
337
|
+
- `phone_type` no longer reports `typed` when only the picture changed after
|
|
338
|
+
the paste (a selection highlight or a results list redraw) and OCR never
|
|
339
|
+
saw the text: it keeps watching for the text and otherwise reports
|
|
340
|
+
`type_not_confirmed`; a one-character paste that OCR cannot read back says
|
|
341
|
+
`delivery=delivered_unverified` (device run 2026-11-06, macOS 27.2,
|
|
342
|
+
iOS 27).
|
|
343
|
+
- `mac_notifications` with `open_center: true` checks positive evidence that
|
|
344
|
+
Notification Center's panel is already open (the menu-bar clock reads selected
|
|
345
|
+
or a Notification Center panel element is present; desktop widgets do not
|
|
346
|
+
count) before clicking the clock, reporting `center_was_open` when
|
|
347
|
+
already open and `center_opened` when opened by the call; empty `id`,
|
|
348
|
+
`expected_app` or `expected_title` strings fail validation; a notification
|
|
349
|
+
that is no longer there returns `notification_not_found`
|
|
350
|
+
(`delivery=not_delivered, retry=safe`), while other accessibility errors keep
|
|
351
|
+
their delivery state and note when the notification is no longer on screen.
|
|
352
|
+
|
|
353
|
+
### Security
|
|
354
|
+
- `mac_set_value` on an `AXSecureTextField` never reads back or echoes the
|
|
355
|
+
value (`(secure field — value not shown)`), `imctl type` reports character
|
|
356
|
+
count instead of echoing typed text, and `NORACU_TRACE` omits result previews
|
|
357
|
+
and error messages (recording only `code`) and opens the trace file `0600`
|
|
358
|
+
with `O_NOFOLLOW`.
|
|
359
|
+
- `phone_type`, `phone_find` and `phone_open` pass their text to imctl on
|
|
360
|
+
stdin instead of in the process arguments, where every local user could read
|
|
361
|
+
it while the call ran.
|
|
362
|
+
- `imctl` `_require_live` (now also guarding `imctl home`, `imctl app-switcher`,
|
|
363
|
+
and `imctl verify`) probes the mirror overlay before activating iPhone
|
|
364
|
+
Mirroring so a paused or closed mirror refuses (`mirror_not_live`) without
|
|
365
|
+
stealing focus, retries once after bringing the window forward when the state
|
|
366
|
+
is unknown, and fails closed with `mirror_state_unknown` instead of sending
|
|
367
|
+
blind input; `gestures.app_switcher` also verifies that iPhone Mirroring is
|
|
368
|
+
frontmost before mouse-down.
|
|
369
|
+
- `phone_*` argument validation and `imctl` argv hygiene: `phone_key` validates
|
|
370
|
+
allowed key names, `phone_swipe` validates normalized `[0, 1]` coordinates and
|
|
371
|
+
`ms` (`50–5000`), `phone_longpress` validates `duration`, `phone_find`
|
|
372
|
+
(`≤ 200`) and `phone_type` (`≤ 2000`) enforce per-tool text limits, and
|
|
373
|
+
`phone_find`, `phone_open` and `phone_key` pass `--` before positional values
|
|
374
|
+
so leading `-` strings are never parsed as `imctl` options.
|
|
375
|
+
- `mac_paste` no longer loses non-text clipboard contents or re-publishes a
|
|
376
|
+
password manager's concealed item: the whole paste runs in one engine call
|
|
377
|
+
that copies every clipboard item and type aside, writes the text marked
|
|
378
|
+
transient, sends ⌘V only if the clipboard and the frontmost app (by process)
|
|
379
|
+
are unchanged, and puts the items back once the paste shows in the same
|
|
380
|
+
focused element (held at least 0.3 s; else after a 1 s hold) and only if
|
|
381
|
+
nothing else wrote to the clipboard meanwhile; a concealed item (on any of
|
|
382
|
+
the clipboard's items) is not copied and the clipboard is cleared instead.
|
|
383
|
+
When the ⌘V keystroke may not have completed, the clipboard is not put back
|
|
384
|
+
(a late paste can only repeat the text) and ⌘ is released. Universal Clipboard content or more than 64 MB is refused
|
|
385
|
+
unless `force: true`. The result reports what happened to the clipboard
|
|
386
|
+
(`restored: true`, `cleared (previous_concealed)`, `false (changed_externally)`, …).
|
|
387
|
+
- `mac_clipboard_read` withholds the whole clipboard when any of its items is
|
|
388
|
+
marked concealed (not only the first).
|
|
389
|
+
- `mac_key` treats an uppercase ASCII letter in a chord as adding `shift`
|
|
390
|
+
(matching how `cliclick` types it, so `alt-cmd-Q` is recognized as
|
|
391
|
+
`alt-cmd-shift-q` log-out) and ignores an `fn-` prefix when checking refused
|
|
392
|
+
chords; `alt-cmd-q` (Quit and Close All Windows) and `alt-cmd-delete` (Finder
|
|
393
|
+
Delete Immediately) are now refused unless `force: true`.
|
|
394
|
+
- `mac_menu_command` applies the same refused-chord list to menu shortcuts and
|
|
395
|
+
refuses items under the Apple menu (Sleep, Lock Screen, Log Out, Restart,
|
|
396
|
+
Shut Down, Force Quit) unless `force: true`; quitting the MCP host process or
|
|
397
|
+
a macOS session process (Finder, Dock, loginwindow, …) is always refused.
|
|
398
|
+
- `mac_app` force-quit re-checks the target PID's start time before its
|
|
399
|
+
`SIGKILL` fallback so a reused PID is never signalled, and walks up to 32
|
|
400
|
+
ancestor processes when identifying the MCP host.
|
|
401
|
+
- CDP isolation and directory permissions: `browser_launch` with `cdp_port` is
|
|
402
|
+
refused under `NORACU_READ_ONLY=1` even when `NORACU_ALLOW_CDP=1` is set
|
|
403
|
+
(before any network access); `mac_app` launch with `cdp_port` canonicalizes
|
|
404
|
+
`.app` paths (`realpath`, trailing slash stripped) before checking whether the
|
|
405
|
+
app is running, creates `~/.noracu` and `~/.noracu/cdp-profiles` (plus
|
|
406
|
+
`browser-profile`) with mode `0700`, and records `{ pid, wsUrl }` in memory so
|
|
407
|
+
`browser_launch` with `NORACU_ALLOW_CDP=1` attaches only when the port was
|
|
408
|
+
opened by this `noracu` process, its PID is still alive and `/json/version`'s
|
|
409
|
+
`webSocketDebuggerUrl` matches (attaching to any other loopback port requires
|
|
410
|
+
`NORACU_ALLOW_CDP=any`).
|
|
411
|
+
|
|
3
412
|
## [0.1.4] — 2026-11-05
|
|
4
413
|
|
|
5
414
|
### Fixed
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ One MCP server, three control surfaces:
|
|
|
21
21
|
|
|
22
22
|
| Layer | Tools | Drives | Status |
|
|
23
23
|
|---|---|---|---|
|
|
24
|
-
| **Mac** |
|
|
24
|
+
| **Mac** | 20 (`mac_*`) | macOS Accessibility API (`src/mac-ax.js`, JXA), cliclick, screencapture | stable |
|
|
25
25
|
| **Browser** | 12 (`browser_*`) | Playwright (persistent profile) | stable |
|
|
26
26
|
| **iPhone** | 14 (`phone_*`) | iPhone Mirroring via the bundled imctl driver (Python + pyobjc) | experimental |
|
|
27
27
|
|
|
@@ -31,14 +31,15 @@ The iPhone layer is experimental and ships with its driver (imctl, in `imctl/`).
|
|
|
31
31
|
|
|
32
32
|
noracu is the local hands, not the model. Your MCP client (Claude Desktop, Claude Code, Cursor) decides what to do; this server only observes and acts on this machine.
|
|
33
33
|
|
|
34
|
-
- **The server runs entirely on your machine.** No cloud service, no API key, no telemetry, no postinstall scripts. Sole runtime dependency: Playwright. noracu makes no network calls of its own; the only automatic one is the one-time Chromium download on the first `browser_launch` (`NORACU_DISABLE_AUTO_INSTALL=1` turns that off). The browser still fetches the pages you point it at, and your MCP client still sends tool results — screenshots, OCR text — to whatever model it uses.
|
|
35
|
-
- **Acts on semantics, not pixels.** Observation returns the accessibility tree (Mac) or ARIA tree (browser) as an indexed list — text, not screenshots. Actions reference `element_index`; indices expire after 30 s
|
|
34
|
+
- **The server runs entirely on your machine.** No cloud service, no API key, no telemetry, no postinstall scripts. Sole runtime dependency: Playwright. noracu makes no network calls of its own; the only automatic one is the one-time Chromium download on the first `browser_launch` (`NORACU_DISABLE_AUTO_INSTALL=1` turns that off). With `NORACU_ALLOW_CDP=1` it also talks to a DevTools port on 127.0.0.1 that it opened itself (`NORACU_ALLOW_CDP=any` for other loopback ports). The browser still fetches the pages you point it at, and your MCP client still sends tool results — screenshots, OCR text — to whatever model it uses.
|
|
35
|
+
- **Acts on semantics, not pixels.** Observation returns the accessibility tree (Mac, read directly through the macOS Accessibility API — about 0.15 s for a 500-element window on our test Mac) or ARIA tree (browser) as an indexed list — text, not screenshots. Actions reference `element_index`; indices expire after 30 s. On the Mac an index is backed by identity evidence (the window's ID, the child path, role, identifier, name) and the element is re-identified before every action; in the browser, tag/name/href/position are re-checked. A gone or changed element returns `element_no_longer_valid` instead of clicking the wrong thing. Screenshots are there when the tree is not enough.
|
|
36
|
+
- **Says what happened.** A Mac action uses the element's own accessibility action when it has one (press, select, set value, insert text — no pointer, no focus change, IME-safe text); a physical click is sent only after a hit test shows that the point reaches the element. Every input action result (Mac, browser and iPhone) states whether it was delivered (`delivered_verified` when a change was observed, `delivered_unverified`, `not_delivered`, or `unknown` when a step timed out or failed mid-action) and whether a retry is safe; Mac actions also name any sheet, dialog or menu they opened.
|
|
36
37
|
- **One loop, three surfaces.** Native Mac apps and a persistent-profile browser share the `element_index` protocol (observe a tree, act by index). The experimental iPhone layer runs the same observe → act loop on Apple's iPhone Mirroring, with OCR text and normalized coordinates, because the phone exposes no accessibility tree to the Mac.
|
|
37
38
|
- **Uses your real sessions.** Your logged-in browser profile, your Mac apps — not a hosted VM. Compared with cloud computer-use: neither is universally more reliable; they fail differently. noracu keeps the screen on your machine.
|
|
38
39
|
- **Off switches that are actually off.** `NORACU_READ_ONLY=1` (observation-only, default-deny), `NORACU_DISABLE_EVAL=1`, and `file://` blocked by default. See [Security](#security).
|
|
39
|
-
- **Verifiable.**
|
|
40
|
+
- **Verifiable.** End-to-end tests (`npm test`; the hardware-free ones run in CI on macos-latest), MIT; the server is `src/server.mjs` plus the Mac accessibility engine `src/mac-ax.js`.
|
|
40
41
|
|
|
41
|
-
**Not a good fit if** you need multiple browser tabs or sessions (single session for now), you're not on macOS (the Mac and iPhone layers are macOS-only; the browser layer is cross-platform), or you need a finished iPhone layer today (it ships, but experimental — and Apple does not offer iPhone Mirroring in the EU). If you only need browser automation, playwright-mcp has tab management and selector APIs that noracu
|
|
42
|
+
**Not a good fit if** you need multiple browser tabs or sessions (single session for now), you're not on macOS (the Mac and iPhone layers are macOS-only; the browser layer is cross-platform), or you need a finished iPhone layer today (it ships, but experimental — and Apple does not offer iPhone Mirroring in the EU). If you only need browser automation, playwright-mcp has tab management and selector APIs that noracu lacks. If you need desktop apps on Windows or Linux, agent-desktop (Vercel Labs) covers macOS, Windows and Linux through each OS's accessibility API; noracu's desktop layer is macOS-only. noracu is for when one agent drives Mac apps, a browser and an iPhone from one server.
|
|
42
43
|
|
|
43
44
|
## Quickstart
|
|
44
45
|
|
|
@@ -48,7 +49,7 @@ First success is `mac_ax_state` (or a browser snapshot) — not a click, and not
|
|
|
48
49
|
|
|
49
50
|
```bash
|
|
50
51
|
npm install noracu # server at node_modules/noracu/src/server.mjs
|
|
51
|
-
brew install cliclick #
|
|
52
|
+
brew install cliclick # needed for physical Mac input (mac_key, mac_paste, mac_drag, and physical mac_click/mac_type)
|
|
52
53
|
```
|
|
53
54
|
|
|
54
55
|
Or from source: `git clone https://github.com/sgInnora/noracu.git && cd noracu && npm install && npm test` (add `NORACU_CI=1` to skip hardware-gated checks).
|
|
@@ -76,25 +77,28 @@ Then **quit the host app completely (including any menu-bar icon) and reopen it.
|
|
|
76
77
|
|
|
77
78
|
**3. Grant macOS permissions to the host app, not to `node`.** System Settings → Privacy & Security → **Accessibility** and **Screen Recording** (macOS 15: "Screen & System Audio Recording") → enable the host (Claude Desktop / Cursor / your terminal). noracu never appears here. Quit and reopen the host after granting.
|
|
78
79
|
|
|
79
|
-
**4. Verify.**
|
|
80
|
+
**4. Verify.** Call `mac_status` — it reports whether the host has Accessibility and Screen Recording, and whether cliclick is found. Then, with Finder in front, call `mac_ax_state` (no args) — it returns an indexed accessibility tree; indices last 30 s. Browser smoke test (no Accessibility needed): `browser_launch` (first run downloads Chromium unless `NORACU_DISABLE_AUTO_INSTALL=1`) → `browser_navigate` → `browser_snapshot` → `browser_click` by index.
|
|
80
81
|
|
|
81
82
|
### Troubleshooting
|
|
82
83
|
|
|
83
84
|
| Symptom | Cause / fix |
|
|
84
85
|
|---|---|
|
|
85
|
-
| `mac_*` fails with error **-1719** | Accessibility not granted to the **host** app — grant it, then quit + reopen the host |
|
|
86
|
+
| `mac_*` fails with `permission_denied: Accessibility permission is missing…` (before 0.2: error **-1719**) | Accessibility not granted to the **host** app — grant it, then quit + reopen the host; `mac_status` shows the state |
|
|
86
87
|
| Screenshots come back all black | Screen Recording not granted to the host — grant it, then quit + reopen |
|
|
87
88
|
| `ENOENT` mentioning cliclick | `brew install cliclick` (or set `NORACU_CLICLICK`) |
|
|
88
89
|
| `spawn node` / `npx` `ENOENT` from a GUI host | use an absolute `node` path in the config — nvm/volta/homebrew shims are not on the GUI `PATH` |
|
|
89
90
|
| `browser_launch` hangs on first use | one-time Chromium download; or auto-install disabled (`NORACU_DISABLE_AUTO_INSTALL=1`) → run `npx playwright install chromium` |
|
|
90
91
|
| `phone_*` says `imctl unavailable: no python3 with pyobjc found` | install pyobjc for a python3 (`python3 -m pip install pyobjc-framework-Quartz pyobjc-framework-Vision pyobjc-framework-AppKit`; Homebrew python3 is the usual choice) or set `NORACU_PYTHON` — see [iPhone layer](#iphone-layer-experimental) |
|
|
91
|
-
| `phone_*` refused with `mirror_not_live: …` ("Connection Paused", "iPhone in Use") | the mirror is paused or
|
|
92
|
+
| `phone_*` refused with `mirror_not_live: …` ("Connection Paused", "iPhone in Use", "not running") or `mirror_state_unknown: …` | the mirror is not running, paused, or its state could not be read — lock the iPhone, keep it near the Mac, check `phone_status`, and call `phone_launch` (it starts Mirroring and clicks Resume) |
|
|
92
93
|
| `phone_launch` says `mirror_setup_required` | iPhone Mirroring shows a setup or welcome screen (e.g. the first launch after a macOS upgrade) — finish it yourself in the iPhone Mirroring window; noracu never clicks through it |
|
|
93
94
|
| `imctl_timeout: phone … did not finish within …s` | the Mac is under heavy load or the system is stuck — the action may have partly run, so check `phone_status` / `phone_screenshot` before retrying (after `phone_open`, noracu goes back to the Home Screen); the server keeps answering other calls meanwhile |
|
|
94
|
-
| `input_busy: …` | an earlier phone or Mac action held the input queue for over 60 s; the call did nothing — retry |
|
|
95
|
+
| `input_busy: …` | an earlier phone or Mac action held the input queue for over 60 s (or `NORACU_PHONE_TIMEOUT_MS` + 15 s); the call did nothing — retry |
|
|
95
96
|
| `phone_open` returns app not found for an installed app | it only taps the label in Spotlight's Top Hit card — use the name exactly as the phone shows it under the icon (e.g. `拼多多`, not `Pinduoduo`). "Spotlight showed no Top Hit" on an installed app usually means the iPhone's language is not English: `phone_open` reads Spotlight's "Top Hit" label — set `NORACU_TOPHIT_LABELS` to the label your iPhone shows. `open_not_confirmed: … never showed up on the phone` means the pasted name did not arrive (a paste can take several seconds to reach the iPhone) — retry. `phone_open` leaves the app name on the clipboard |
|
|
96
|
-
| Typed text comes out re-spaced (e.g. "no ra cu") | a CJK input method
|
|
97
|
-
| `element_no_longer_valid` | the snapshot is older than 30 s or the
|
|
97
|
+
| Typed text comes out re-spaced (e.g. "no ra cu") | it went in as keystrokes (`mac_type` with `mechanism: "physical"`, or a focused element that takes no accessibility text) while a CJK input method was active — use the default `mac_type` mechanism, or `mac_paste` |
|
|
98
|
+
| `element_no_longer_valid` | the snapshot is older than 30 s, or the element is gone, changed or in a window that closed — re-run `mac_ax_state` / `browser_snapshot` and use a fresh index |
|
|
99
|
+
| `occluded: … — on top: {…}` | a physical click would land on something else (another window, a sheet) — bring the target forward or close what covers it; nothing was sent |
|
|
100
|
+
| `ambiguous_window: … windows: […]` | the app has several windows and none is focused — pass `window` (index or title) or `window_id` from `mac_windows` |
|
|
101
|
+
| `policy_denied: "cmd-q" …` | `mac_key` refuses quit / log-out / lock / force-quit / delete-immediately / empty-Trash chords unless `force: true`; to quit an app use `mac_app` |
|
|
98
102
|
|
|
99
103
|
Node 18 is rejected at startup — use Node ≥ 20. Claude Desktop may start one noracu process per surface (e.g. chat and a second surface); they share the browser profile, so launch the browser from only one at a time.
|
|
100
104
|
|
|
@@ -102,7 +106,7 @@ Full worked examples: [docs/usage.md](docs/usage.md).
|
|
|
102
106
|
|
|
103
107
|
## iPhone layer (experimental)
|
|
104
108
|
|
|
105
|
-
noracu can operate a real iPhone through Apple's **iPhone Mirroring**. 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
|
|
109
|
+
noracu can operate a real iPhone through Apple's **iPhone Mirroring**. 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/`.
|
|
106
110
|
|
|
107
111
|
**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.
|
|
108
112
|
|
|
@@ -110,22 +114,24 @@ noracu can operate a real iPhone through Apple's **iPhone Mirroring**. The agent
|
|
|
110
114
|
|
|
111
115
|
**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-AppKit` is the common working setup.
|
|
112
116
|
|
|
113
|
-
**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, `phone_tap`, `phone_longpress`, `phone_swipe`, `phone_scroll`, `phone_type`, `phone_key` and `
|
|
117
|
+
**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.
|
|
114
118
|
|
|
115
119
|
**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.
|
|
116
120
|
|
|
117
121
|
**First success:** `phone_status` → `phone_launch` if `live` is not `true` → `phone_screenshot` → `phone_ocr` → `phone_find` + `phone_tap`.
|
|
118
122
|
|
|
119
|
-
**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); 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 (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; `phone_home` / `phone_app_switcher` use the iPhone Mirroring menu (English macOS
|
|
123
|
+
**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); 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 (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; `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`).
|
|
120
124
|
|
|
121
125
|
## Environment variables
|
|
122
126
|
|
|
123
127
|
| Variable | Default | Purpose |
|
|
124
128
|
|---|---|---|
|
|
125
|
-
| `NORACU_READ_ONLY` | unset | `=1` observation-only: a default-deny allowlist of
|
|
129
|
+
| `NORACU_READ_ONLY` | unset | `=1` observation-only: a default-deny allowlist of 18 observe + browser-lifecycle tools; every click/type/paste/key/eval tool is refused (`mac_clipboard_read`, `mac_notifications`, and `mac_wait` with `condition: "notification"` too; `mac_ax_state` / `mac_find` also skip `web_accessibility`) |
|
|
126
130
|
| `NORACU_DISABLE_EVAL` | unset | `=1` makes `browser_evaluate` (arbitrary JS) return an error when called (it stays listed) |
|
|
127
131
|
| `NORACU_ALLOW_FILE_URL` | unset | `=1` lets `browser_navigate` open `file://` URLs (blocked by default) |
|
|
128
132
|
| `NORACU_DISABLE_AUTO_INSTALL` | unset | `=1` skips the Chromium auto-install on first `browser_launch` |
|
|
133
|
+
| `NORACU_ALLOW_CDP` | unset | `=1` allows `mac_app` launch with `cdp_port` and `browser_launch` with `cdp_port` for ports opened by this `noracu` process (live PID and matching `webSocketDebuggerUrl`); `=any` also allows `browser_launch` to attach to any loopback DevTools port on 127.0.0.1 (always refused under `NORACU_READ_ONLY=1`) |
|
|
134
|
+
| `NORACU_TRACE` | unset | a file path: one JSON line per tool call (`{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) |
|
|
129
135
|
| `NORACU_CLICLICK` | `/opt/homebrew/bin/cliclick` | cliclick binary path |
|
|
130
136
|
| `NORACU_PYTHON` | auto-probe | python3 used for the bundled iPhone driver; must import pyobjc (Quartz, Vision, AppKit). Unset → first working of `/opt/homebrew/bin/python3`, `/usr/local/bin/python3`, `python3`, `/usr/bin/python3` |
|
|
131
137
|
| `NORACU_IMCTL_DIR` | bundled `imctl/` | override the driver location (development only) |
|
|
@@ -141,13 +147,18 @@ noracu runs with the privileges of your MCP client. It clicks, types, pastes, an
|
|
|
141
147
|
"env": { "NORACU_READ_ONLY": "1", "NORACU_DISABLE_EVAL": "1" }
|
|
142
148
|
```
|
|
143
149
|
|
|
144
|
-
- **`NORACU_READ_ONLY=1`** is the safe first-run mode. It refuses every tool not on
|
|
150
|
+
- **`NORACU_READ_ONLY=1`** is the safe first-run mode. It refuses every tool not on an 18-name allowlist (the observe tools plus standalone `browser_launch`/`browser_navigate`/`browser_close`; `browser_launch` with `cdp_port` is refused even when `NORACU_ALLOW_CDP` is set); every click, type, paste, and eval tool is denied, and so are `mac_clipboard_read`, `mac_notifications`, and `mac_wait` with `condition: "notification"`, while `mac_ax_state` and `mac_find` do not toggle `web_accessibility` on apps. `browser_navigate` is on the allowlist, so it can still load a URL.
|
|
145
151
|
- **`NORACU_DISABLE_EVAL=1`** makes `browser_evaluate` return an error when called (it stays listed in `tools/list`). Snapshot, click, and type still work.
|
|
146
152
|
- **`file://` is refused** unless `NORACU_ALLOW_FILE_URL=1`, so a browser agent can't read `~/Documents` by navigating to it. (The initial navigation URL is scheme-checked; redirects are not — see SECURITY.md.)
|
|
147
|
-
- **Focus guard:** pass `app` to `
|
|
148
|
-
- **Stale-element protection:** an `element_index` is not a coordinate. It expires after 30 s
|
|
149
|
-
- **
|
|
150
|
-
- **
|
|
153
|
+
- **Focus guard:** pass `app` to `mac_paste` / `mac_key` (and `mac_type` when it sends keystrokes) and input is refused unless that app is frontmost. Omit `app` and the guard is off. `mac_type`'s default accessibility path writes into a named element or the app's focused element and sends no keystrokes at all; it never falls back to keystrokes when the focus is a button, list or sheet.
|
|
154
|
+
- **Stale-element protection:** an `element_index` is not a coordinate. It expires after 30 s, and on the Mac it is never reused by a later snapshot. A Mac element is re-identified inside the very window or open menu it was seen in (by window ID), at the same place in that window, under the same labelled ancestors and in the same table row; an element without a label or identifier must still be exactly where it was. A browser click re-checks tag/name/href/position. Otherwise `element_no_longer_valid`.
|
|
155
|
+
- **Hit test before physical clicks:** a Mac click or drag that has to use the pointer is sent only when the element at that point is the target — or, when accessibility cannot tell, when the topmost on-screen window there is that same window (by window ID, not covered by another window of the same app); otherwise `occluded`, with what is on top. Keystrokes typed after such a click go out only if the element's app is then frontmost.
|
|
156
|
+
- **Background windows:** semantic Mac actions also work on windows you are not looking at. That is the point (no stolen focus), but it means an agent can act where you do not see it — watch the results' `delivery` and keep high-stakes apps closed.
|
|
157
|
+
- **Guarded keys, menus and quits:** `mac_key` refuses quit / log-out / lock / force-quit / delete-immediately / empty-Trash chords unless `force: true`; `mac_menu_command` applies the same chord list to menu shortcuts and refuses Apple-menu items unless `force: true`. Neither `mac_app` nor `mac_menu_command` ever quits Finder, the Dock, loginwindow, other session processes or the MCP host itself; `force: true` is needed on `mac_app` to force-quit.
|
|
158
|
+
- **DevTools ports are opt-in:** `mac_app` / `browser_launch` with `cdp_port` need `NORACU_ALLOW_CDP=1` (`NORACU_ALLOW_CDP=any` to attach to a port `noracu` did not open itself; always refused under `NORACU_READ_ONLY=1`), bind to 127.0.0.1 only, canonicalize `.app` paths and refuse an app that is already running, and give Chrome-family browsers a separate `0700` profile under `~/.noracu/cdp-profiles`. While the port is open, any local process can control that app (127.0.0.1 has no per-user isolation).
|
|
159
|
+
- **Clipboard, password fields and notifications are private:** `mac_paste` puts the user's clipboard back (every item and type) and never copies an item a password manager marked concealed — it clears the clipboard after the paste instead; `mac_clipboard_read` never returns a concealed item; `mac_set_value` on a secure password field (`AXSecureTextField`) never echoes the value; `mac_notifications` returns notification text verbatim. `mac_clipboard_read`, `mac_notifications`, and `mac_wait` on notifications are outside read-only mode.
|
|
160
|
+
- **iPhone screen is model input:** `phone_screenshot` / `phone_ocr` / `phone_find` return whatever the phone shows — notifications, messages, one-time codes. Use a Focus and a neutral app, and start with `NORACU_READ_ONLY=1` (phone observation allowed, phone input refused). Phone input is also refused when the mirror is not live (`mirror_not_live`) or its state cannot be read (`mirror_state_unknown`).
|
|
161
|
+
- **Injection-safe JXA and stdin text:** the accessibility engine (`src/mac-ax.js`) is a static script that takes its whole request as JSON on stdin — parameters are data, never script source — and `mac_type` (default path), `mac_set_value`, `mac_paste`, and `phone_type` / `phone_find` / `phone_open` pass text on stdin so it does not appear in a process list (`imctl type` never echoes it either). Regression-tested.
|
|
151
162
|
|
|
152
163
|
These switches do not make observed content trustworthy. Screenshot text, accessibility names, and page content are untrusted input to your model — do not let them override the task. Full threat model and per-threat status: [SECURITY.md](SECURITY.md).
|
|
153
164
|
|
|
@@ -161,7 +172,8 @@ These switches do not make observed content trustworthy. Screenshot text, access
|
|
|
161
172
|
|
|
162
173
|
- Browser: tab management (list / select / close)
|
|
163
174
|
- Act vocabulary (browser): `hover`, `set_value`, `wait_for`
|
|
164
|
-
-
|
|
175
|
+
- Measure the token cost of `skeleton` + `root` drill-down against full snapshots
|
|
176
|
+
- Open Notification Center's history when the menu-bar clock is not exposed to accessibility
|
|
165
177
|
- iPhone: `element_index` over OCR regions, re-checking the text before a tap
|
|
166
178
|
|
|
167
179
|
## Maintenance
|