noracu 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.2] — 2026-11-19
4
+
5
+ - **Orca gets no input by default.** Orca, an agent IDE whose terminals run a
6
+ shell, is on the default deny list — by its bundle id `com.stablyai.orca`
7
+ and by name — and a client running in one of its terminals is recognised as
8
+ hosted by it.
9
+ - **Docs from a first install on another Mac.** The Quickstart says to paste
10
+ what `--doctor` prints, and how to replace an entry left by an earlier
11
+ install; Finder can be read with `app: "Finder"` without bringing it
12
+ forward; Claude Code's way to set a variable (`-e` after the server name) is
13
+ shown next to the JSON form, with the error the other order gives; the
14
+ README says that reading an Electron or Chromium app tries to turn on its
15
+ web accessibility (Google Chrome refuses it); macOS 26.7.1 is in the list of
16
+ where it was tested.
17
+ - **XCUITest backend: a simulator is found with Xcode 26 too.** `noracu
18
+ ios-setup --udid` and the `ios_*` tools now look a simulator up with
19
+ `simctl`. `devicectl`, which with Xcode 26.6 listed no simulators or gave no
20
+ answer for 30 s, is asked about iPhones only.
21
+ - **`browser_scroll` reads the page once it has had the wheel.** It used to
22
+ read the position 80 ms after sending the wheel; on a busy machine, or with
23
+ the server running at background priority (a launchd job, a CI runner), the
24
+ page could take half a second to get it, and the result then said that a
25
+ scroll that went through did not move, took the late end of the scroll
26
+ before for its own (`delivered_verified`), or missed a navigation the wheel
27
+ started. Now it waits until the page reports the wheel and the position
28
+ stops changing (up to 3 s). It verifies a movement only when the one wheel
29
+ the page had was this call's and every earlier wheel that may have reached
30
+ that page was verified (a page loaded again starts afresh, unless it came in
31
+ while a wheel may still have been on its way), and never when the wheel was
32
+ over a frame; two calls on one page take turns; the result says which of
33
+ these kept it from verifying.
34
+ - **XCUITest backend: build the runner again once.** Its sources changed in
35
+ comments only, but the runner's build check counts every byte of them:
36
+ `ios_*` answers `runner_version_mismatch` until `npx noracu ios-setup` (the
37
+ same flags as the first time) builds it again.
38
+
3
39
  ## [0.3.1] — 2026-11-19
4
40
 
5
41
  Fixes and stricter checks on top of 0.3.0; no tool was added or removed. The
package/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  **A local MCP server that lets an MCP client (Claude Desktop, Claude Code, Cursor, …) operate macOS apps
4
4
  and a browser by `element_index`, and says what each action did. No API key, no telemetry.**
5
5
 
6
- [![CI](https://github.com/sgInnora/noracu/actions/workflows/ci.yml/badge.svg)](https://github.com/sgInnora/noracu/actions/workflows/ci.yml)
7
6
  [![npm](https://img.shields.io/npm/v/noracu.svg)](https://www.npmjs.com/package/noracu)
8
7
  [![node](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org)
9
8
  [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
@@ -38,8 +37,9 @@ brew install cliclick # for physical Mac input (keys, drags, clicks that n
38
37
  npx noracu --doctor # checks this machine and prints the configuration for your client
39
38
  ```
40
39
 
41
- **2. Add it to your MCP client.** `--doctor` prints what to paste, with this machine's absolute paths: one
42
- command for Claude Code, one JSON block for Claude Desktop and Cursor. Written by hand, it is the following.
40
+ **2. Add it to your MCP client.** Paste what `--doctor` printed, rather than the lines below: it has this machine's
41
+ absolute paths and points at the copy you just installed — one command for Claude Code (`-s user`: for all your
42
+ projects), one JSON block for Claude Desktop and Cursor. Written by hand, it is the following.
43
43
 
44
44
  Claude Code, started from a terminal with Node on its `PATH`:
45
45
 
@@ -64,12 +64,15 @@ Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json
64
64
 
65
65
  Quit the client completely (menu-bar icon included) and open it again.
66
66
 
67
+ Upgrading from an earlier install? `claude mcp add` refuses a name that is taken: run `claude mcp remove noracu`
68
+ first (with `-s user` if it was added for all your projects). In a JSON config, change the path in `args`.
69
+
67
70
  **3. Grant permissions to the client app, not to `node`.** System Settings → Privacy & Security →
68
71
  **Accessibility** and **Screen Recording** (on macOS 15 and later: **Screen & System Audio Recording**) → turn
69
72
  on Claude Desktop, Cursor or your terminal. Quit and reopen the client once more.
70
73
 
71
74
  **4. Check.** Call `mac_status`: it says whether the client has both permissions and whether cliclick was
72
- found. Then call `mac_ax_state` with Finder in front — an indexed tree comes back. That is the sign that it works;
75
+ found. Then call `mac_ax_state` with Finder in front (or with `app: "Finder"`) — an indexed tree comes back. That is the sign that it works;
73
76
  a click comes after it. In the browser: `browser_launch` → `browser_navigate` → `browser_snapshot` →
74
77
  `browser_click` with an `element_index`.
75
78
 
@@ -95,6 +98,9 @@ reads or operates badly? [Report a bug](https://github.com/sgInnora/noracu/issue
95
98
  by `NORACU_STOP_FILE` exists no input is sent; `NORACU_DENY_APPS` and `NORACU_APPROVAL_FILE` say which apps
96
99
  may receive input (terminals and IDEs are refused by default); running scripts in a page and `file://`
97
100
  pages are off by default.
101
+ - **One read sets a flag.** Reading an Electron or Chromium app (`mac_ax_state`, `mac_find`) tries to turn on its
102
+ web accessibility (`AXManualAccessibility`) so that its pages appear in the tree — Electron apps take it, Google
103
+ Chrome refuses it; `web_accessibility: false` or `NORACU_READ_ONLY=1` leaves it alone.
98
104
  - **Stays on this machine.** It uses the browser profile and the Mac apps you are signed in to. noracu makes
99
105
  no network calls of its own apart from Playwright's one-time Chromium download. Your client still sends
100
106
  what the tools return — text, screenshots — to the model it uses.
package/SECURITY.md CHANGED
@@ -52,6 +52,8 @@ noracu runs with the privileges of your MCP client. It clicks, types, pastes, an
52
52
  "env": { "NORACU_READ_ONLY": "1", "NORACU_DISABLE_EVAL": "1" }
53
53
  ```
54
54
 
55
+ In Claude Code the same is `claude mcp add -s user noracu -e NORACU_READ_ONLY=1 -e NORACU_DISABLE_EVAL=1 -- <node> <server.mjs>` (the two paths `npx noracu --doctor` prints). The `-e` options go after the name: before it, `-e` takes the name as one more variable.
56
+
55
57
  - **Tool annotations are hints, not permissions.** Every tool reports the four MCP tool annotations (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`), set by what the tool does — see [docs/tools.md](docs/tools.md). A client may use them to decide what to confirm with you; they restrict nothing, and a client that asks for the 2024-11-05 protocol revision (which has no annotations) may ignore them. They also do not mirror `NORACU_READ_ONLY=1`: `mac_clipboard_read` is read-only by behaviour yet refused there, and `browser_navigate` is allowed there yet not read-only.
56
58
  - **`NORACU_READ_ONLY=1`** is the safe first-run mode. It refuses every tool not on a 21-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.
57
59
  - **`browser_evaluate` is off by default.** It runs any script in the page, so it returns `eval_disabled` unless the server was started with `NORACU_ENABLE_EVAL=1`; `NORACU_DISABLE_EVAL=1` keeps it off even then. It stays listed in `tools/list`. Snapshot, click, and type still work.
@@ -61,7 +63,7 @@ noracu runs with the privileges of your MCP client. It clicks, types, pastes, an
61
63
  - **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. Right before the click is sent, the window on top at the point is checked again; afterwards the result is `delivered_verified` only if the element is still there, changed, and its own window is still on top at the point. A click at raw x,y goes out only when the topmost on-screen window at that point belongs to `app` (default: the frontmost app; the menu bar counts as the frontmost app's); `force: true` skips that check. Keystrokes typed after such a click go out only if the element's app is then frontmost.
62
64
  - **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.
63
65
  - **Background clicks and keys (bgpost):** under `mechanism: "auto"`, a physical click on a native app, and a named key for a native frontmost app, are posted straight to the app's process — the pointer does not move, and you may not see it happen. Web-engine apps (Chromium/Electron) and `mechanism: "physical"` use the real pointer; the result's `route` says which. A posted click is never re-sent another way: no visible change is reported as `delivered_unverified`, a timeout as `delivery=unknown`. `NORACU_NO_BGPOST=1` turns this off.
64
- - **Stop, deny, approve:** while the file named by `NORACU_STOP_FILE` exists, every input tool returns `user_stopped` and sends nothing — Mac (`mac_*`), iPhone (`phone_*`, `ios_*`) and browser input (`browser_navigate`, `browser_click`, `browser_type`, `browser_fill`, `browser_press_key`, `browser_scroll`, `browser_evaluate`, `browser_tabs` new/close); observation tools are not stopped (`touch` it to stop, delete it to resume). `NORACU_DENY_APPS` lists apps that never get input — by default the common terminal apps (Terminal, iTerm2, WezTerm, Ghostty, Warp, Alacritty, kitty, Hyper, Tabby, Rio, Wave) and the IDEs with a built-in terminal (VS Code, Cursor, Windsurf, Zed, JetBrains IDEs, Android Studio — their preview and nightly editions too; the name `Code` and `com.jetbrains.*` also catch any app named exactly Code and JetBrains Toolbox), so an agent cannot type into those shells (other apps that host a shell are not on it); a list of your own adds to it, and a list starting with `none` drops it. `NORACU_APPROVAL_FILE` (opt-in) names a `0600` JSON file `{ "allow": [...], "ask": [...], "deny": [...] }` of bundle-id or app-name patterns: an app under `ask` or not listed gets `approval_required`, and noracu never writes the file; once the variable is set, a missing or broken file refuses all Mac and iPhone input (the browser layer is not judged by app rules; the stop file stops it). An app whose bundle id cannot be read gets nothing while either rule is in force. Each check judges the app that receives the input — the element's app, the named app, or the app on top at an x,y point — and an app that cannot be identified gets nothing. These files stop the model, not other software running as you: see SECURITY.md.
66
+ - **Stop, deny, approve:** while the file named by `NORACU_STOP_FILE` exists, every input tool returns `user_stopped` and sends nothing — Mac (`mac_*`), iPhone (`phone_*`, `ios_*`) and browser input (`browser_navigate`, `browser_click`, `browser_type`, `browser_fill`, `browser_press_key`, `browser_scroll`, `browser_evaluate`, `browser_tabs` new/close); observation tools are not stopped (`touch` it to stop, delete it to resume). `NORACU_DENY_APPS` lists apps that never get input — by default the common terminal apps (Terminal, iTerm2, WezTerm, Ghostty, Warp, Alacritty, kitty, Hyper, Tabby, Rio, Wave) and the IDEs with a built-in terminal (VS Code, Cursor, Windsurf, Zed, JetBrains IDEs, Android Studio — their preview and nightly editions too; the name `Code` and `com.jetbrains.*` also catch any app named exactly Code and JetBrains Toolbox) and Orca, so an agent cannot type into those shells (other apps that host a shell are not on it); a list of your own adds to it, and a list starting with `none` drops it. `NORACU_APPROVAL_FILE` (opt-in) names a `0600` JSON file `{ "allow": [...], "ask": [...], "deny": [...] }` of bundle-id or app-name patterns: an app under `ask` or not listed gets `approval_required`, and noracu never writes the file; once the variable is set, a missing or broken file refuses all Mac and iPhone input (the browser layer is not judged by app rules; the stop file stops it). An app whose bundle id cannot be read gets nothing while either rule is in force. Each check judges the app that receives the input — the element's app, the named app, or the app on top at an x,y point — and an app that cannot be identified gets nothing. These files stop the model, not other software running as you: see SECURITY.md.
65
67
  - **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.
66
68
  - **Your own Chrome is opt-in:** `browser_launch` with `chrome: true` needs `NORACU_ALLOW_CHROME=1` and Chrome's own remote-debugging switch (`chrome://inspect/#remote-debugging`); Chrome asks you to allow each connection and shows a banner while it is open. noracu then opens a window of its own in your Chrome and lists, reads and acts only on the tabs it opened there (and tabs those open); noracu never lists, reads or acts on your other tabs unless you also set `NORACU_CHROME_TABS=all` (then your tabs on http(s) pages — never `file://` or browser pages, whatever `NORACU_ALLOW_FILE_URL` says — are listed and can be selected, read and acted on, but never closed or sent to a non-http(s) address; one becomes the active page only when selected and stops being it when it leaves http(s)); in noracu's own tabs the address rules (http(s) only; `file://` needs `NORACU_ALLOW_FILE_URL=1`) apply. Those tabs carry your sign-ins, so an agent working there acts as you on those sites; `browser_evaluate` never runs there. `browser_close` closes noracu's tabs and disconnects; noracu never quits Chrome. Refused under `NORACU_READ_ONLY=1`.
67
69
  - **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 or that the app rules (deny list, approval file) rule out, 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).
@@ -33,8 +33,9 @@ brew install cliclick # Mac 上的物理输入要用(按键、拖拽、
33
33
  npx noracu --doctor # 检查这台机器,并打印出给客户端用的配置
34
34
  ```
35
35
 
36
- **2. 加到你的 MCP 客户端。** `--doctor` 会打印出要粘贴的内容,路径都是这台机器上的绝对路径:Claude Code 是一条命令,
37
- Claude Desktop 和 Cursor 是一段 JSON。手写的话是下面这样。
36
+ **2. 加到你的 MCP 客户端。** 粘贴 `--doctor` 打印出的内容,别用下面手写的:它用的是这台机器上的绝对路径,指向你刚装的
37
+ 那一份——Claude Code 是一条命令(`-s user` 表示对你所有项目生效),Claude Desktop 和 Cursor 是一段 JSON。
38
+ 手写的话是下面这样。
38
39
 
39
40
  Claude Code(从终端启动,`PATH` 里有 Node):
40
41
 
@@ -58,11 +59,14 @@ Claude Desktop(`~/Library/Application Support/Claude/claude_desktop_config.jso
58
59
 
59
60
  然后把客户端完全退出(包括菜单栏图标)再打开。
60
61
 
62
+ 以前装过?`claude mcp add` 不接受已经被占用的名字:先运行 `claude mcp remove noracu`(当初是对所有项目加的,就加上
63
+ `-s user`)。JSON 配置里把 `args` 的路径改成新的。
64
+
61
65
  **3. 把权限给客户端应用,不是给 `node`。** 系统设置 → 隐私与安全性 → **辅助功能** 和 **录屏与系统录音**
62
66
  (较早的 macOS 上叫「屏幕录制」)→ 打开 Claude Desktop、Cursor 或你的终端。授权后再完全退出、重开一次客户端。
63
67
 
64
68
  **4. 检查。** 调用 `mac_status`:它会说客户端有没有这两项权限、找没找到 cliclick。再让访达在最前面,调用
65
- `mac_ax_state`,能返回一棵带编号的树就说明通了,点击是之后的事。浏览器:`browser_launch` →
69
+ `mac_ax_state`(或者传 `app: "Finder"`,不用切到前台),能返回一棵带编号的树就说明通了,点击是之后的事。浏览器:`browser_launch` →
66
70
  `browser_navigate` → `browser_snapshot` → 带 `element_index` 的 `browser_click`。
67
71
 
68
72
  **5. 试一下。** 可以对客户端说这三句,都只读不改:
@@ -86,6 +90,9 @@ Claude Desktop(`~/Library/Application Support/Claude/claude_desktop_config.jso
86
90
  - **关着的开关就是关着。** `NORACU_READ_ONLY=1` 只许观察;`NORACU_STOP_FILE` 指的文件存在时不发任何输入;
87
91
  `NORACU_DENY_APPS` 和 `NORACU_APPROVAL_FILE` 决定哪些应用可以收输入(终端和 IDE 默认拒绝);
88
92
  在页面里跑脚本和打开 `file://` 默认关。
93
+ - **有一处读会写一个开关。** 读 Electron 或 Chromium 应用(`mac_ax_state`、`mac_find`)时,会试着打开它的网页无障碍
94
+ (`AXManualAccessibility`),让页面出现在树里——Electron 应用接受,Google Chrome 不接受;传 `web_accessibility: false`
95
+ 或设 `NORACU_READ_ONLY=1` 就不打开。
89
96
  - **留在这台机器上。** 用的是你已经登录的浏览器配置和 Mac 应用。除了 Playwright 第一次下载 Chromium,
90
97
  noracu 自己不发任何网络请求。工具返回的内容(文字、截图)仍会由你的客户端发给它用的模型。
91
98
 
@@ -68,7 +68,7 @@ The bundled imctl driver (`imctl/`, Python) runs as a subprocess (`<python3> -m
68
68
  `NORACU_PHONE_BACKEND=xcuitest` lists the `ios_*` tools instead of `phone_*` (both groups are defined in one table; only the chosen one is offered). Three files:
69
69
 
70
70
  - `ios-runner/` — the runner: one UI-test bundle (Swift, no host app) whose single test, `testServe`, listens on the address it is given and executes one JSON command per line on the main thread ([protocol](ios-runner-protocol.md)). It never launches apps, never touches the clipboard, and makes no outbound connection.
71
- - `src/ios-xcuitest.js` — the Mac-side client: `devicectl` (read through `--json-output` files) for the device list, the lock state and app launches, `simctl` for launches on a simulator, `xcodebuild test-without-building` to start the runner, and one TCP connection with a hard time limit per call. A call that timed out is never re-sent.
71
+ - `src/ios-xcuitest.js` — the Mac-side client: `devicectl` (read through `--json-output` files) for the iPhone list, the lock state and app launches, `simctl` for the simulator list (not every Xcode's `devicectl` lists simulators) and launches on a simulator, `xcodebuild test-without-building` to start the runner, and one TCP connection with a hard time limit per call. A call that timed out is never re-sent.
72
72
  - `src/ios-session.js` — the tools: device choice, starting the runner on the first call that needs it, `element_index` (30 s, ended by `ios_home` / `ios_launch`, re-read before use), the gates before every input (app rule on the bundle id, a running runner, the lock), and the read-back that decides whether `ios_type` is verified.
73
73
 
74
74
  `src/ios-setup.js` is the `noracu ios-setup` command (`xcodebuild build-for-testing` into `~/.noracu/ios-runner/<udid>`). `ios_*` calls share the input queue with the Mac and Mirroring tools (the runner takes one command at a time); their input checks the stop file but does not wait for the person at the Mac. Tests replace Apple's tools through `NORACU_IOS_XCRUN` and `NORACU_IOS_XCODEBUILD` (`test/fixtures/`: a fake `xcrun`, and a fake `xcodebuild` that serves a model phone); `test/ios-live.mjs` runs the tools against a real iPhone or simulator.
package/docs/iphone.md CHANGED
@@ -4,7 +4,7 @@ Both iPhone backends are experimental and off by default. Walkthroughs: [usage.m
4
4
 
5
5
  ## iPhone Mirroring backend (`phone_*`)
6
6
 
7
- noracu can operate a real iPhone through Apple's **iPhone Mirroring**. The layer is off by default: add `"env": { "NORACU_LAYERS": "mac,browser,iphone" }` to the server entry (or `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/`.
7
+ noracu can operate a real iPhone through Apple's **iPhone Mirroring**. The layer is off by default: add `"env": { "NORACU_LAYERS": "mac,browser,iphone" }` to the server entry, or in Claude Code `-e NORACU_LAYERS=mac,browser,iphone` right after the server name in `claude mcp add` (`iphone` alone gives an entry that carries only the iPhone tools), then quit the host completely and reopen it. The agent observes with OCR on the Mac (`phone_screenshot`, `phone_ocr`, `phone_find`), acts at normalized 0–1 coordinates (`phone_tap`, `phone_swipe`, `phone_scroll`), types by pasting (`phone_type`) and opens apps by name (`phone_open`). This is not `element_index`: the phone exposes no accessibility tree to the Mac, so a tap lands where OCR placed the text. The driver (imctl, Python, MIT, about 3,500 lines) ships in `imctl/`.
8
8
 
9
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
10
 
@@ -8,7 +8,7 @@ iPhone backends are in [iphone.md](iphone.md).
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
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
14
  | iPhone (Mirroring) | an iPhone 17 Pro Max mirrored to that Mac | other pairs of Mac and iPhone |
package/docs/tools.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Tool reference
2
2
 
3
3
  > Auto-generated from the running server (`node scripts/gen-tools.mjs`) — always in sync with the implementation. Hints are the four MCP tool annotations each tool reports — R read-only, D destructive, I idempotent, O open-world, – false — hints for the client, not permissions.
4
- > noracu v0.3.1 · 33 tools listed by default (the Mac and browser layers; NORACU_LAYERS unset), 47 with NORACU_LAYERS=mac,browser,iphone (iPhone Mirroring backend), 42 with NORACU_PHONE_BACKEND=xcuitest as well (the ios_* group replaces phone_*)
4
+ > noracu v0.3.2 · 33 tools listed by default (the Mac and browser layers; NORACU_LAYERS unset), 47 with NORACU_LAYERS=mac,browser,iphone (iPhone Mirroring backend), 42 with NORACU_PHONE_BACKEND=xcuitest as well (the ios_* group replaces phone_*)
5
5
 
6
6
  ## Mac layer (computer-use)
7
7
 
@@ -8,6 +8,8 @@ Install, permission and first-run problems. For what each error means, see the e
8
8
  | Screenshots show only the desktop picture (no other app's windows), or come back black | Screen Recording (Screen & System Audio Recording on macOS 15 and later) not granted to the host — grant it, then quit + reopen |
9
9
  | `ENOENT` mentioning cliclick | `brew install cliclick` (or set `NORACU_CLICLICK`) |
10
10
  | `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` |
11
+ | `claude mcp add` fails with `Invalid environment variable format: noracu, …` | `-e` came before the server name and took the name as one more variable — put the `-e` options after it: `claude mcp add -s user noracu -e NAME=value -- …` |
12
+ | `claude mcp add` refuses because a server named `noracu` already exists | an earlier install left its entry — remove it first with `claude mcp remove noracu` (add `-s user` if it was added for all your projects), then add the new one; in Claude Desktop's or Cursor's JSON, change the path in `args` |
11
13
  | `browser_launch` answers `browser_installing` on first use | the one-time Chromium download is under way — call it again in a minute; with auto-install disabled (`NORACU_DISABLE_AUTO_INSTALL=1`) run `npx playwright install chromium` |
12
14
  | `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-Cocoa`; Homebrew python3 is the usual choice) or set `NORACU_PYTHON` — see [iPhone layer](iphone.md) |
13
15
  | `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) |
package/docs/usage.md CHANGED
@@ -83,7 +83,10 @@ mac_click { "element_index": 1 } # a sheet now covers the text area
83
83
  ```
84
84
 
85
85
  **Read `delivery` and `retry`.** Every input action (Mac, browser and iPhone)
86
- states both. `delivered_verified`: a change was observed.
86
+ states both. `delivered_verified`: a change was observed (for `browser_scroll`:
87
+ the page reported that call's wheel, every earlier wheel that may have reached
88
+ the page was verified, and the page then moved the way asked — a page whose own
89
+ script moves it at that moment cannot be told apart from the wheel).
87
90
  `delivered_unverified`: the call succeeded but nothing observable changed — read
88
91
  the state (`mac_get`, `mac_ax_state`) before acting again. `not_delivered` with
89
92
  `retry=safe`: nothing was sent. `unknown` with `retry=unsafe`: the call timed
@@ -295,6 +298,11 @@ model — don't let it override the task.
295
298
 
296
299
  ## 7. Environment variables
297
300
 
301
+ Set them on the server entry: `"env": { "NAME": "value" }` in Claude Desktop's or Cursor's JSON; in Claude Code,
302
+ `-e NAME=value` right after the server name — `claude mcp add -s user noracu -e NORACU_READ_ONLY=1 -- <node> <server.mjs>`
303
+ (before the name, `-e` takes the name as one more variable and the command fails with "Invalid environment variable
304
+ format"). Then restart the client.
305
+
298
306
  | Variable | Default | Effect |
299
307
  |---|---|---|
300
308
  | `NORACU_READ_ONLY` | unset | `=1` observation-only (an allowlist of observe + browser-lifecycle tools); all input-synthesis tools plus `mac_clipboard_read`, `mac_notifications`, and `mac_wait` on `condition: "notification"` are refused (`mac_ax_state` / `mac_find` also skip `web_accessibility`) |
@@ -8,7 +8,7 @@ import Network
8
8
  // What this runner was built from: a hash of its own sources, kept up to date by scripts/gen-runner-build.mjs
9
9
  // (a test fails when it is not). It goes out on the ready line; the Mac side does not use a runner whose build
10
10
  // is not the one its own copy of these sources names.
11
- let noracuRunnerBuild = "b4383f0898e5"
11
+ let noracuRunnerBuild = "043fbc1f2a62"
12
12
 
13
13
  // MARK: - pure rules (no XCTest: test/ios-runner-rules.mjs compiles this block on its own and runs it)
14
14
 
@@ -331,7 +331,7 @@ enum RunnerCommands {
331
331
  }
332
332
  func walk(_ s: XCUIElementSnapshot) {
333
333
  if shown(s) && s.elementType == .icon { icons += 1 }
334
- // an alert only: a sheet's frame can cover the whole screen (pre-review P3)
334
+ // an alert only: a sheet's frame can cover the whole screen
335
335
  if shown(s) && s.elementType == .alert {
336
336
  var b: [CGRect] = []
337
337
  buttons(s, &b)
@@ -345,7 +345,7 @@ enum RunnerCommands {
345
345
 
346
346
  enum SBInput { case tap, press, drag, text }
347
347
 
348
- // review S4A-s8-g-1: a system alert (a permission prompt, say) sits over the app in front while the app still reads
348
+ // A system alert (a permission prompt, say) sits over the app in front while the app still reads
349
349
  // "in front", and the app's own snapshot does not show it. Input named for an app is not sent while one is up: a tap
350
350
  // at the app's point would press the alert's button, and text would go to the alert's field. SpringBoard that
351
351
  // cannot be read fails closed. Returns the refusal, or nil.
@@ -362,7 +362,7 @@ enum RunnerCommands {
362
362
  // tap whose point lies on a button of one of SpringBoard's alerts (a system prompt). A sheet does not count
363
363
  // (its frame can cover the screen), and nothing else is sent: no long press, no drag, no text and no key —
364
364
  // text goes wherever the keyboard focus is, which the public API does not show, and a second Return would
365
- // land on whatever the alert was covering (pre-review P3). Returns the refusal, or nil.
365
+ // land on whatever the alert was covering. Returns the refusal, or nil.
366
366
  @MainActor
367
367
  static func springboardRefusal(_ args: [String: Any], _ kind: SBInput, at point: CGPoint? = nil) -> [String: Any]? {
368
368
  guard let raw = args["springboard_only"] else { return nil }
@@ -452,7 +452,7 @@ enum RunnerCommands {
452
452
  case .tabBar: return "tabBar"
453
453
  case .table: return "table"
454
454
  case .textField: return "textField"
455
- case .secureTextField: return "secureTextField" // review S4A-s8-reviewer-1: it fell to "other"
455
+ case .secureTextField: return "secureTextField" // it used to fall to "other"
456
456
  case .textView: return "textView"
457
457
  case .toggle: return "toggle"
458
458
  case .toolbar: return "toolbar"
@@ -100,8 +100,7 @@ final class RunnerServer: @unchecked Sendable {
100
100
  return false
101
101
  }
102
102
  guard let rawId = obj["id"], !RunnerCommands.isBool(rawId), rawId is Int else {
103
- // a missing id, or one that is not a whole number, cannot be matched to its request: the command is not
104
- // run (pre-review P3 and P4)
103
+ // a missing id, or one that is not a whole number, cannot be matched to its request: the command is not run
105
104
  var no = RunnerCommands.fail(0, "invalid_args", "id must be a whole number", sent: RunnerCommands.inputOps.contains(obj["op"] as? String ?? "") ? false : nil)
106
105
  no["id"] = 0
107
106
  send(conn, no)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noracu",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "mcpName": "io.github.sgInnora/noracu",
5
5
  "description": "Local MCP server: macOS apps and a browser by element index, plus iPhone Mirroring (experimental).",
6
6
  "type": "module",
@@ -10,10 +10,10 @@
10
10
  },
11
11
  "scripts": {
12
12
  "start": "node src/server.mjs",
13
- "test": "node test/engine-unit.mjs && node test/bg-inject-unit.mjs && node test/release-gate-unit.mjs && node test/gen-tools-unit.mjs && node test/cli-unit.mjs && node test/check-pack-unit.mjs && node test/docs-codes-unit.mjs && node test/ios-xcuitest-unit.mjs && node test/ios-session-unit.mjs && node test/ios-setup-unit.mjs && node test/ios-runner-rules.mjs && node test/ios-e2e.mjs && node test/e2e.mjs",
14
- "test:ci": "node test/engine-unit.mjs && node test/bg-inject-unit.mjs && node test/release-gate-unit.mjs && node test/gen-tools-unit.mjs && node test/cli-unit.mjs && node test/check-pack-unit.mjs && node test/docs-codes-unit.mjs && node test/ios-xcuitest-unit.mjs && node test/ios-session-unit.mjs && node test/ios-setup-unit.mjs && node test/ios-runner-rules.mjs && node test/ios-e2e.mjs && NORACU_CI=1 node test/e2e.mjs",
13
+ "test": "node test/engine-unit.mjs && node test/bg-inject-unit.mjs && node test/release-gate-unit.mjs && node test/gen-tools-unit.mjs && node test/cli-unit.mjs && node test/cli-no-cliclick.mjs && node test/check-pack-unit.mjs && node test/docs-codes-unit.mjs && node test/ios-xcuitest-unit.mjs && node test/ios-session-unit.mjs && node test/ios-setup-unit.mjs && node test/ios-runner-rules.mjs && node test/ios-e2e.mjs && node test/e2e.mjs && node test/browser-scroll-slow.mjs",
14
+ "test:ci": "node test/engine-unit.mjs && node test/bg-inject-unit.mjs && node test/release-gate-unit.mjs && node test/gen-tools-unit.mjs && node test/cli-unit.mjs && node test/cli-no-cliclick.mjs && node test/check-pack-unit.mjs && node test/docs-codes-unit.mjs && node test/ios-xcuitest-unit.mjs && node test/ios-session-unit.mjs && node test/ios-setup-unit.mjs && node test/ios-runner-rules.mjs && node test/ios-e2e.mjs && NORACU_CI=1 node test/e2e.mjs && node test/browser-scroll-slow.mjs",
15
15
  "test:imctl": "cd imctl && ${NORACU_PYTHON:-python3} tests/test_smoke.py",
16
- "check": "node --check src/server.mjs && node --check src/mac-ax.js && node --check src/approval.js && node --check src/bg-inject.js && node --check src/ios-xcuitest.js && node --check src/ios-session.js && node --check src/ios-setup.js && node --check src/doctor.js && node --check scripts/gen-tools.mjs && node --check scripts/release-gate.mjs && node --check scripts/check-pack.mjs && node --check scripts/pack-rules.mjs && python3 -c \"import ast,sys; [ast.parse(open(f).read(), f) for f in sys.argv[1:]]\" imctl/src/imctl/*.py",
16
+ "check": "node --check src/server.mjs && node --check src/mac-ax.js && node --check src/approval.js && node --check src/bg-inject.js && node --check src/ios-xcuitest.js && node --check src/ios-session.js && node --check src/ios-setup.js && node --check src/doctor.js && node --check scripts/gen-tools.mjs && node --check scripts/release-gate.mjs && node --check scripts/check-pack.mjs && node --check scripts/pack-rules.mjs && node --check scripts/check-public.mjs && node scripts/check-public.mjs && python3 -c \"import ast,sys; [ast.parse(open(f).read(), f) for f in sys.argv[1:]]\" imctl/src/imctl/*.py",
17
17
  "prepublishOnly": "npm run check && node scripts/release-gate.mjs && node scripts/check-pack.mjs && node scripts/gen-tools.mjs && git diff --exit-code docs/tools.md"
18
18
  },
19
19
  "engines": {
package/src/approval.js CHANGED
@@ -42,20 +42,31 @@ const TERMINALS = [
42
42
  { bundle: "org.tabby", path: /\/Tabby\.app\//i },
43
43
  { bundle: "com.raphaelamorim.rio", path: /\/Rio\.app\/|\/rio$/i },
44
44
  { bundle: "dev.commandline.waveterm", path: /\/Wave\.app\//i },
45
+ // Orca, an agent IDE whose terminals run a shell (appId and productName from its electron-builder config, and its
46
+ // Homebrew cask, 2026-11-19). On this list rather than with the IDEs so that a client running in one of its
47
+ // terminals is recognised as hosted by it too: its helper processes live inside Orca.app
48
+ { bundle: "com.stablyai.orca", path: /\/Orca\.app\//i },
45
49
  ];
46
50
 
47
51
  // --- host terminal (resolved once): the first ancestor that is a terminal app; tmux / screen are walked
48
52
  // through. Returns { bundle } for a listed terminal, { name } for another app bundle named like a terminal,
49
53
  // or null (chain broken, no terminal found).
54
+ // What one ancestor's executable path says: { bundle } for a listed terminal (a helper inside its .app counts),
55
+ // { name } for another app bundle named like a terminal, null for anything else. Exported for the tests.
56
+ export function terminalFromPath(comm) {
57
+ const t = TERMINALS.find((x) => x.path.test(comm));
58
+ if (t) return { bundle: t.bundle };
59
+ const app = /\/([^/]+)\.app\/Contents\/MacOS\/[^/]+$/.exec(comm);
60
+ if (app && /term|shell|console/i.test(app[1])) return { name: app[1] };
61
+ return null;
62
+ }
50
63
  function hostTerminal() {
51
64
  try {
52
65
  let pid = process.ppid;
53
66
  for (let i = 0; i < 12 && pid > 1; i++) {
54
67
  const comm = execFileSync("/bin/ps", ["-o", "comm=", "-p", String(pid)], { encoding: "utf8", timeout: 2000 }).trim();
55
- const t = TERMINALS.find((x) => x.path.test(comm));
56
- if (t) return { bundle: t.bundle };
57
- const app = /\/([^/]+)\.app\/Contents\/MacOS\/[^/]+$/.exec(comm);
58
- if (app && /term|shell|console/i.test(app[1])) return { name: app[1] };
68
+ const t = terminalFromPath(comm);
69
+ if (t) return t;
59
70
  // anything else — a shell, node, npm, tmux, screen — is walked through to its parent
60
71
  const ppidLine = execFileSync("/bin/ps", ["-o", "ppid=", "-p", String(pid)], { encoding: "utf8", timeout: 2000 }).trim();
61
72
  pid = Number(ppidLine);
@@ -67,7 +78,7 @@ function hostTerminal() {
67
78
  const HOST_TERMINAL = hostTerminal();
68
79
 
69
80
  // the same apps by name too, for an app whose bundle id cannot be read (Warp Preview was missed)
70
- const TERMINAL_NAMES = ["Terminal", "iTerm2", "iTerm", "WezTerm", "Ghostty", "Warp*", "Alacritty", "kitty", "Hyper", "Tabby", "Rio", "Wave"];
81
+ const TERMINAL_NAMES = ["Terminal", "iTerm2", "iTerm", "WezTerm", "Ghostty", "Warp*", "Alacritty", "kitty", "Hyper", "Tabby", "Rio", "Wave", "Orca"];
71
82
  // IDEs with a built-in terminal (2026-11-12): keys typed into one can reach its shell, so
72
83
  // they get no input by default either. Bundle ids (VS Code and Cursor read from installed apps), and names,
73
84
  // which also match when the bundle id is read but differs (a fork, an edition)
@@ -128,7 +128,8 @@ export function createIosSession({
128
128
  async function resolveDevice() {
129
129
  const want = String(env.NORACU_IOS_UDID || "").trim();
130
130
  if (want && !api.validUdid(want)) return { ok: false, error: "ios_config", message: "NORACU_IOS_UDID is not a device identifier" };
131
- const list = await api.listDevices();
131
+ // a simulator named in NORACU_IOS_UDID is looked up with simctl alone; devicectl answers for iPhones
132
+ const list = await (want && api.isSimulatorUdid(want) ? api.listSimulators() : api.listDevices());
132
133
  if (!list.ok) return list;
133
134
  let d;
134
135
  if (want) {
package/src/ios-setup.js CHANGED
@@ -1,7 +1,8 @@
1
1
  // ios-setup — `noracu ios-setup`: build the on-device runner for one iPhone or simulator (0.3.0, EXPERIMENTAL).
2
2
  //
3
3
  // An explicit command; nothing runs on install. It uses Apple's own tools on this Mac:
4
- // xcrun devicectl list devices which device
4
+ // xcrun devicectl list devices which iPhone
5
+ // xcrun simctl list --json which simulator (a simulator's udid is looked up here, not with devicectl)
5
6
  // xcodebuild build-for-testing the runner in ios-runner/, into ~/.noracu/ios-runner/<udid>
6
7
  // For an iPhone the build is signed for the developer team given with --team, and Xcode may create or
7
8
  // update a development provisioning profile in that team (-allowProvisioningUpdates talks to Apple's
@@ -104,12 +105,14 @@ export async function main(argv, { log = (s) => process.stdout.write(s + "\n"),
104
105
  const o = parseArgs(argv);
105
106
  if (o.error) { log(`noracu ios-setup: ${o.error}\n\n${USAGE}`); return 2; }
106
107
  if (o.help) { log(USAGE); return 0; }
107
- const list = await api.listDevices();
108
- if (!list.ok) { log(`noracu ios-setup: could not list devices (${list.message}) — is Xcode installed?`); return 1; }
108
+ // a simulator's udid is looked up with simctl alone, an iPhone's with devicectl (src/ios-xcuitest.js, listSimulators)
109
+ const sim = o.udid !== null && api.isSimulatorUdid(o.udid);
110
+ const list = await (sim ? api.listSimulators() : api.listDevices());
111
+ if (!list.ok) { log(`noracu ios-setup: could not list ${sim ? "simulators" : "devices"} (${list.message}) — is Xcode installed?`); return 1; }
109
112
  let device;
110
113
  if (o.udid) {
111
114
  device = list.devices.find((d) => d.udid.toLowerCase() === o.udid.toLowerCase());
112
- if (!device) { log("noracu ios-setup: this Mac does not list the device named with --udid"); return 1; }
115
+ if (!device) { log(`noracu ios-setup: this Mac does not list the ${sim ? "simulator" : "device"} named with --udid${sim ? " (xcrun simctl list devices shows the simulators it has)" : ""}`); return 1; }
113
116
  } else {
114
117
  const phones = list.devices.filter((d) => !d.simulated && d.paired && d.tunnel);
115
118
  if (phones.length !== 1) { log(`noracu ios-setup: ${phones.length ? "several iPhones are connected" : "no connected iPhone found"} — name the device with --udid${phones.length ? ": " + phones.map((d) => `${d.udid} (${d.name})`).join(", ") : ""}`); return 1; }
@@ -6,11 +6,14 @@
6
6
  // This module finds the device, starts the runner through xcodebuild, and talks to it.
7
7
  //
8
8
  // What it keeps to:
9
- // • No internet. xcodebuild and devicectl are local tools; the socket goes to a paired device over
9
+ // • No internet. xcodebuild, devicectl and simctl are local tools; the socket goes to a paired device over
10
10
  // Apple's tunnel, or to 127.0.0.1 for a simulator.
11
11
  // • Every subprocess gets its arguments as an argv array — nothing is put into a shell line.
12
12
  // • devicectl answers are read from --json-output files, never from terminal text (Apple documents
13
- // the JSON as the stable interface and the terminal output as free to change).
13
+ // the JSON as the stable interface and the terminal output as free to change); the simulator list is
14
+ // simctl's --json output.
15
+ // • iPhones are found with devicectl, simulators with simctl: devicectl does not list simulators with
16
+ // every Xcode (see listSimulators).
14
17
  // • Every runner call has a hard time limit. A call that timed out, or whose connection broke after
15
18
  // the request left, is reported as such — "delivery unknown" for input commands — and never
16
19
  // re-sent. The connection is dropped so a late answer cannot be taken for the next call's.
@@ -121,6 +124,38 @@ export async function listDevices(opts = {}) {
121
124
  return { ok: true, devices };
122
125
  }
123
126
 
127
+ // The iOS simulators `simctl list --json` reports (its devices, runtimes and device types), with the fields
128
+ // parseDevice gives — set as devicectl reports a simulator: paired, on this same Mac, its tunnel up while it is
129
+ // booted, no Developer Mode. One that simctl marks unavailable (its runtime is gone) is left out.
130
+ export function parseSimulators(doc) {
131
+ const runtimes = new Map((Array.isArray(doc?.runtimes) ? doc.runtimes : []).map((r) => [r?.identifier, r]));
132
+ const types = new Map((Array.isArray(doc?.devicetypes) ? doc.devicetypes : []).map((t) => [t?.identifier, t]));
133
+ const out = [];
134
+ for (const [key, list] of Object.entries(doc?.devices && typeof doc.devices === "object" ? doc.devices : {})) {
135
+ const rt = runtimes.get(key), m = /SimRuntime\.iOS-(\d+)-(\d+)(?:-(\d+))?$/.exec(key);
136
+ if ((rt?.platform ?? (m ? "iOS" : null)) !== "iOS" || !Array.isArray(list)) continue;
137
+ const os = typeof rt?.version === "string" ? rt.version : m ? [m[1], m[2], m[3]].filter((x) => x !== undefined).join(".") : null;
138
+ for (const d of list) {
139
+ if (typeof d?.udid !== "string" || d.isAvailable === false) continue;
140
+ const booted = d.state === "Booted";
141
+ out.push({ udid: d.udid, name: typeof d.name === "string" ? d.name : null, model: types.get(d.deviceTypeIdentifier)?.name ?? null, os, platform: "iOS",
142
+ simulated: true, transport: "sameMachine", paired: true, tunnel: booted, tunnelIP: null, developerMode: false, booted });
143
+ }
144
+ }
145
+ return out;
146
+ }
147
+
148
+ // Simulators are looked up with simctl, never with devicectl: devicectl does not list them with every Xcode. With
149
+ // Xcode 26.6 (a macOS 26 CI runner, 2026-11) it listed none, or gave no answer in 30 s; Xcode 27.2 lists them.
150
+ export async function listSimulators({ run = defaultRun, timeoutMs = 30000 } = {}) {
151
+ const r = await run(XCRUN, ["simctl", "list", "--json"], { timeoutMs });
152
+ if (r.timedOut) return { ok: false, error: "simctl_timeout", message: `simctl list gave no answer in ${timeoutMs} ms` };
153
+ let doc = null;
154
+ try { doc = JSON.parse(r.stdout); } catch { /* reported below */ }
155
+ if (r.code !== 0 || !doc || typeof doc !== "object") return { ok: false, error: "simctl_failed", message: oneLine(r.stderr || (r.code === 0 ? "simctl list did not answer in JSON" : `exit ${r.code}`)) };
156
+ return { ok: true, devices: parseSimulators(doc) };
157
+ }
158
+
124
159
  export async function deviceDetails(udid, opts = {}) {
125
160
  if (!validUdid(udid)) return { ok: false, error: "invalid_args", message: "udid is not a device identifier" };
126
161
  const r = await devicectl(["device", "info", "details", "--device", udid], opts);
package/src/server.mjs CHANGED
@@ -2887,50 +2887,300 @@ async function browserType(args, live) {
2887
2887
  return { text: `typed ${chars.length} chars — delivery=delivered_unverified, retry=unsafe` };
2888
2888
  }
2889
2889
 
2890
- async function browserScroll(args = {}) {
2890
+ // browser_scroll judges the wheel by what the page did with it, read once the page has had it — not at a fixed time
2891
+ // after mouse.wheel returns. Measured 2026-11-19 (headless, a 125-button page): the page got the wheel and moved
2892
+ // 36–58 ms after mouse.wheel returned in a normal process, 200–660 ms when the server (and with it Chromium) ran at
2893
+ // background priority, as a launchd job without ProcessType does — there it moved up to 224 ms after it reported
2894
+ // the wheel; a navigation the wheel started committed after 36–60 ms and 236–455 ms. A fixed 80 ms then said "did
2895
+ // not move" for a scroll that went through, took the late scroll of the call before for its own, and missed the
2896
+ // navigation. So: the position is to be still before the wheel; listeners under a name of this call's own count the
2897
+ // trusted wheel events that reach the page (one mouse.wheel makes one, with this call's deltas) and say that a
2898
+ // navigation began (the Navigation API's navigate event, or pagehide where there is none); after the wheel the
2899
+ // position is read until it has moved and stopped, until SCROLL_STILL_MS have passed since the page had the wheel
2900
+ // without it moving, or until SCROLL_SEEN_MS have passed. A movement is verified only when exactly one wheel reached
2901
+ // the page and it was this one. A wheel over a frame goes to the frame's document, which these listeners do not
2902
+ // hear: there the page around it is watched for SCROLL_FRAME_MS after the wheel is sent, and nothing is verified
2903
+ // (also when the page reports a wheel then: it can tell neither that it was this one nor that the frame was not
2904
+ // there). Calls on one page take turns, so one call's wheel is not read as another's. A wheel whose effect a call
2905
+ // did not verify may still have one, at any time and either way — a page can act on a wheel later, or make room to
2906
+ // scroll first — so in a document a movement is verified only while every wheel that may have reached it was
2907
+ // verified. That doubt is kept here, out of the page's reach, by the identity Chromium gives a document (scrollDocId):
2908
+ // a document is in doubt from right before a wheel goes out to it until a call verifies. A wheel can also reach a
2909
+ // document that comes later — a navigation that commits before the page has handled it — so while a wheel may still
2910
+ // be on its way (pending), every document the tab commits is in doubt as well. A wheel is on its way from right
2911
+ // before it goes out until the page reports it, or until the page, in one and the same document, has drawn twice
2912
+ // since Chromium acknowledged it (mouse.wheel returns once the page's renderer has the wheel): Chromium hands queued
2913
+ // wheel events to the page at the start of a frame, before its requestAnimationFrame callbacks (scrollFlushed). A
2914
+ // document the server cannot name gets no wheel, and a tab whose documents the server lost sight of no longer
2915
+ // verifies (blind).
2916
+ const SCROLL_POLL_MS = 25, SCROLL_STABLE_MS = 75, SCROLL_STILL_MS = 1000, SCROLL_FRAME_MS = 1500, SCROLL_SEEN_MS = 3000, SCROLL_SETTLE_MS = 1000, SCROLL_FLUSH_MS = 1000;
2917
+ const scrollTurns = new WeakMap(); // page → the end of the last browser_scroll queued on it
2918
+ // the gap between a float32 and the next one above it, at |x| (Chromium carries a wheel's distance as a float32)
2919
+ const f32Cell = new Float32Array(1), f32Bits = new Int32Array(f32Cell.buffer);
2920
+ const ulp32 = (x) => { f32Cell[0] = Math.abs(x); const a = f32Cell[0]; f32Bits[0] += 1; return f32Cell[0] - a; };
2921
+ const scrollPages = new WeakMap(); // page → { cdp: the server's own CDP session, doubted: Set of documents, pending, blind, world, tag }
2922
+ const scrollPage = (page) => {
2923
+ let st = scrollPages.get(page);
2924
+ if (!st) scrollPages.set(page, (st = { cdp: null, doubted: new Set(), pending: false, blind: false, world: null, tag: 0 }));
2925
+ return st;
2926
+ };
2927
+ // The document the page shows, as Chromium names it: the main frame's id and the id of the loader of its document,
2928
+ // read through a CDP session of the server's own. history.pushState and fragments keep it; a document loaded again
2929
+ // has a new one; a document brought back from the back-forward cache keeps its own (with its doubt). null when it
2930
+ // cannot be read — the call then does not verify.
2931
+ async function scrollDocId(page) {
2932
+ const st = scrollPage(page);
2933
+ try {
2934
+ if (!st.cdp) {
2935
+ const making = page.context().newCDPSession(page);
2936
+ let cdp;
2937
+ try {
2938
+ cdp = await withTimeout(making, 5000, "scroll document");
2939
+ } catch (e) {
2940
+ making.then((late) => late.detach().catch(() => {}), () => {});
2941
+ throw e;
2942
+ }
2943
+ cdp.on("Page.frameNavigated", (e) => {
2944
+ // the tab shows another document while a wheel may still be on its way: it may go there
2945
+ if (st.pending && e?.frame && !e.frame.parentId) st.doubted.add(`${e.frame.id}:${e.frame.loaderId}`);
2946
+ });
2947
+ try {
2948
+ await withTimeout(cdp.send("Page.enable"), 5000, "scroll document");
2949
+ } catch (e) {
2950
+ cdp.detach().catch(() => {});
2951
+ throw e;
2952
+ }
2953
+ st.cdp = cdp;
2954
+ }
2955
+ const { frameTree } = await withTimeout(st.cdp.send("Page.getFrameTree"), 5000, "scroll document");
2956
+ return frameTree?.frame?.id && frameTree.frame.loaderId ? `${frameTree.frame.id}:${frameTree.frame.loaderId}` : null;
2957
+ } catch (e) {
2958
+ // the server's view of the tab ended (not a slow answer): documents committed from then on went unseen, so the
2959
+ // tab no longer verifies; the next call opens a new view, to name documents again
2960
+ if (st.cdp && /closed|detached|not attached|No target|not found/i.test(String(e?.message ?? e))) {
2961
+ st.blind = true;
2962
+ st.cdp.detach().catch(() => {});
2963
+ st.cdp = null;
2964
+ }
2965
+ return null;
2966
+ }
2967
+ }
2968
+ // evaluated in a world of the server's own in that document (made once per document), out of the page scripts' reach
2969
+ async function scrollWorldEval(page, docId, expression, ms) {
2970
+ const st = scrollPage(page);
2971
+ if (docId === null || !st.cdp) throw new Error("no document");
2972
+ if (st.world?.doc !== docId) {
2973
+ const w = await withTimeout(st.cdp.send("Page.createIsolatedWorld", { frameId: docId.split(":")[0], worldName: "noracu-scroll" }), 5000, "scroll world");
2974
+ st.world = { doc: docId, ctx: w.executionContextId };
2975
+ }
2976
+ const r = await withTimeout(st.cdp.send("Runtime.evaluate", { expression, contextId: st.world.ctx, awaitPromise: true, returnByValue: true }), ms, "scroll world");
2977
+ if (r?.exceptionDetails) throw new Error(`scroll world: ${r.exceptionDetails.text || "exception"}`);
2978
+ return r?.result?.value;
2979
+ }
2980
+ // true once the page, in one and the same document, has drawn twice: every wheel Chromium acknowledged before was
2981
+ // handed to that document's renderer by then
2982
+ async function scrollFlushed(page) {
2983
+ const docId = await scrollDocId(page);
2984
+ try {
2985
+ const v = await scrollWorldEval(page, docId, "new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r(1))))", SCROLL_FLUSH_MS);
2986
+ return v === 1 && (await scrollDocId(page)) === docId;
2987
+ } catch {
2988
+ return false;
2989
+ }
2990
+ }
2991
+ async function browserScroll(args = {}, live) {
2992
+ const first = getActiveSession(args.browser_id);
2993
+ if (!first) return { error: "no browser — call browser_launch first (delivery=not_delivered, retry=safe)" };
2994
+ const turn = (scrollTurns.get(first.page) || Promise.resolve()).then(() => scrollOnce(args, live, first.page));
2995
+ scrollTurns.set(first.page, turn.then(() => {}, () => {}));
2996
+ return turn;
2997
+ }
2998
+ async function scrollOnce(args, live, page0) {
2999
+ // the call may have waited for the one before it: what was checked when it came in is checked again
3000
+ if (live?.cancelled) return { error: "cancelled: the client cancelled the call while it waited for its turn; nothing was sent (delivery=not_delivered, retry=safe)" };
3001
+ const stop = stopFileBlocked();
3002
+ if (stop) return { error: stop };
2891
3003
  const s = getActiveSession(args.browser_id);
2892
3004
  if (!s) return { error: "no browser — call browser_launch first (delivery=not_delivered, retry=safe)" };
3005
+ if (s.page !== page0) return { error: "not_actionable: the active page changed while this call waited for the browser_scroll before it; nothing was sent (delivery=not_delivered, retry=safe)" };
2893
3006
  const { page } = s;
2894
3007
  const direction = args.direction || "down";
2895
3008
  const pages = args.pages !== undefined ? Number(args.pages) : 1;
2896
- let before, cx, cy;
3009
+ const key = `__noracu_wheel_${randomUUID().replace(/-/g, "")}`;
3010
+ const read = (k) => withTimeout(page.evaluate((k2) => {
3011
+ const f = k2 ? window[k2] : null;
3012
+ return { x: Math.round(window.scrollX), y: Math.round(window.scrollY), ours: !k2 || Boolean(f), n: f ? f.n : 0, wx: f ? f.dx : 0, wy: f ? f.dy : 0, leaving: f?.leaving === true };
3013
+ }, k), 5000, "scroll read");
3014
+ // the listeners go when the call is done (nothing waits for that; on another page there is nothing to remove)
3015
+ const unhook = () => page.evaluate((k) => {
3016
+ const f = window[k];
3017
+ if (!f) return;
3018
+ try { f.off(); } catch {}
3019
+ try { delete window[k]; } catch {}
3020
+ }, key).catch(() => {});
3021
+ let before, cx, cy, still = true, framed = false, doubt = false, docId = null, dpr = null;
2897
3022
  try {
2898
- const info = await withTimeout(
2899
- page.evaluate(() => ({ x: Math.round(window.scrollX), y: Math.round(window.scrollY), w: window.innerWidth, h: window.innerHeight })),
2900
- 5000,
2901
- "scroll read"
2902
- );
2903
- const vp = page.viewportSize() || { width: info.w, height: info.h };
2904
- cx = Math.round((vp.width || 800) / 2);
2905
- cy = Math.round((vp.height || 600) / 2);
3023
+ // still before the wheel: a page that is still moving (a scroll of its own, or one that has not landed yet)
3024
+ // would have that movement counted as this wheel's
3025
+ let a = await read(null);
3026
+ for (const t0 = Date.now(); ;) {
3027
+ await sleep(2 * SCROLL_POLL_MS);
3028
+ const b = await read(null);
3029
+ if (b.x === a.x && b.y === a.y) break;
3030
+ a = b;
3031
+ if (Date.now() - t0 > SCROLL_SETTLE_MS) { still = false; break; }
3032
+ }
3033
+ const vp = page.viewportSize();
3034
+ // a document the server cannot name gets no wheel
3035
+ docId = await scrollDocId(page);
3036
+ if (docId === null) {
3037
+ unhook();
3038
+ return { error: "not_actionable: noracu could not tell which document the page shows (its DevTools view of the tab did not answer); no wheel was sent (delivery=not_delivered, retry=safe)" };
3039
+ }
3040
+ // an earlier wheel that may have reached this document was not verified, or may still be on its way
3041
+ doubt = scrollPage(page).blind || scrollPage(page).pending || scrollPage(page).doubted.has(docId);
3042
+ // the ratio the page reports wheel distances by, read where the page cannot change it; not known → not verified
3043
+ dpr = await scrollWorldEval(page, docId, "devicePixelRatio", 5000).then((v) => (typeof v === "number" && v > 0 ? v : null), () => null);
3044
+ const info = await withTimeout(page.evaluate(([k, vw, vh]) => {
3045
+ const f = { n: 0, dx: 0, dy: 0, leaving: false };
3046
+ const ac = new AbortController();
3047
+ f.off = () => ac.abort();
3048
+ Object.defineProperty(window, k, { value: f, configurable: true, enumerable: false, writable: false });
3049
+ // trusted only: a wheel event the page makes itself is no sign of this one
3050
+ addEventListener("wheel", (e) => { if (!e.isTrusted) return; if (++f.n === 1) { f.dx = e.deltaX; f.dy = e.deltaY; } }, { capture: true, passive: true, signal: ac.signal });
3051
+ const nav = globalThis.navigation;
3052
+ if (nav && typeof nav.addEventListener === "function") nav.addEventListener("navigate", () => { f.leaving = true; }, { once: true, signal: ac.signal });
3053
+ else addEventListener("pagehide", () => { f.leaving = true; }, { once: true, signal: ac.signal });
3054
+ // the point the wheel is sent at, and whether a frame is there (inside a shadow root too)
3055
+ const px = Math.round((vw || window.innerWidth || 800) / 2), py = Math.round((vh || window.innerHeight || 600) / 2);
3056
+ let el = document.elementFromPoint(px, py);
3057
+ for (let i = 0; el && el.shadowRoot && i < 32; i++) {
3058
+ const inner = el.shadowRoot.elementFromPoint(px, py);
3059
+ if (!inner || inner === el) break;
3060
+ el = inner;
3061
+ }
3062
+ return { x: Math.round(window.scrollX), y: Math.round(window.scrollY), px, py, framed: Boolean(el) && /^(IFRAME|FRAME|OBJECT|EMBED)$/.test(el.tagName) };
3063
+ }, [key, vp?.width || 0, vp?.height || 0]), 5000, "scroll read");
3064
+ cx = info.px;
3065
+ cy = info.py;
2906
3066
  before = { x: info.x, y: info.y };
3067
+ framed = info.framed;
2907
3068
  } catch (e) {
3069
+ unhook();
2908
3070
  return { error: `not_actionable: could not read scroll position: ${shortErr(e)} (delivery=not_delivered, retry=safe)` };
2909
3071
  }
2910
- const dist = Math.round(pages * 600);
2911
- const dx = direction === "left" ? -dist : direction === "right" ? dist : 0;
2912
- const dy = direction === "up" ? -dist : direction === "down" ? dist : 0;
2913
- let after;
3072
+ const st = scrollPage(page);
3073
+ // the wheel carries a tag in its distance: 1 to 15 units of 16 float32 steps of that distance (a 1024th of a pixel
3074
+ // for one page; for a request under a 1200th of a page, which rounds to no pixel, the steps of 1 px), another one
3075
+ // on each call on the page; it moves the page by under a quarter pixel more, which the positions, in whole pixels,
3076
+ // do not show
3077
+ st.tag = (st.tag % 15) + 1;
3078
+ const base = Math.round(pages * 600);
3079
+ const unit = 16 * ulp32(Math.max(1, base));
3080
+ const amount = base + st.tag * unit;
3081
+ const dx = direction === "left" ? -amount : direction === "right" ? amount : 0;
3082
+ const dy = direction === "up" ? -amount : direction === "down" ? amount : 0;
3083
+ let after, seenAt = null, sent = false;
3084
+ // the one wheel the page had was this call's: one mouse.wheel is one trusted event, and the page reports its
3085
+ // distance divided by the device pixel ratio, tag included (measured at ratios 1 to 3: as sent divided by the ratio;
3086
+ // were it rounded to a float32 on the way, it would still be within 2 float32 steps of that). So: within 2 such
3087
+ // steps, and a tag's step, as reported, over 4 of them — else this wheel cannot be told from the next tag's, and is
3088
+ // not taken for this call's. A wheel of another size, or another call's, is not this one.
3089
+ const near = (w, d) => {
3090
+ if (d === 0) return w === 0;
3091
+ if (dpr === null) return false;
3092
+ const want = d / dpr, step = ulp32(want);
3093
+ return unit / dpr > 4 * step && Math.abs(w - want) <= 2 * step;
3094
+ };
3095
+ const isMine = (a) => a.n === 1 && near(a.wx, dx) && near(a.wy, dy);
3096
+ let pendingBefore = st.pending;
3097
+ // the stop file and a cancellation, again before the input (the still-wait above can take a second or more), and
3098
+ // once more right before the wheel (moving the pointer waits for the page)
3099
+ const halted = () => (live?.cancelled ? "cancelled: the client cancelled the call; nothing was sent (delivery=not_delivered, retry=safe)" : stopFileBlocked());
3100
+ let halt = halted();
3101
+ if (halt) {
3102
+ unhook();
3103
+ return { error: halt };
3104
+ }
2914
3105
  try {
2915
3106
  await withTimeout(page.mouse.move(cx, cy), 5000, "mouse.move");
3107
+ // the document the wheel goes to: the one the call read the page in, or no wheel
3108
+ const wheelDoc = await scrollDocId(page);
3109
+ if (wheelDoc !== docId) {
3110
+ unhook();
3111
+ if (wheelDoc === null) return { error: `not_actionable: noracu could not tell which document the page showed by the time the pointer had moved to (${cx},${cy}) (its DevTools view of the tab did not answer); no wheel was sent (delivery=not_delivered, retry=safe)` };
3112
+ return { error: `not_actionable: the page showed another document by the time the pointer had moved to (${cx},${cy}) (it shows ${showsNow(s)} now); no wheel was sent (delivery=not_delivered, retry=safe)` };
3113
+ }
3114
+ // the stop file and a cancellation, last thing before the wheel: from this check to the wheel nothing waits
3115
+ halt = halted();
3116
+ if (halt) {
3117
+ unhook();
3118
+ // the reason as it is given, without its "nothing was sent": the pointer did move
3119
+ const why = halt.split(/\s*[;—]?\s*nothing was sent/)[0].trim();
3120
+ return { error: `${why} — this came up after the pointer had moved to (${cx},${cy}) in the page; no wheel was sent (delivery=not_delivered, retry=safe)${/^user_stopped/.test(halt) ? "; remove the file to resume" : ""}` };
3121
+ }
3122
+ // from here on a wheel may reach the document, or one that comes later: in doubt until a call verifies
3123
+ pendingBefore = st.pending;
3124
+ st.doubted.add(docId);
3125
+ st.pending = true;
2916
3126
  await withTimeout(page.mouse.wheel(dx, dy), 5000, "mouse.wheel");
2917
- await sleep(80);
2918
- after = await withTimeout(
2919
- page.evaluate(() => ({ x: Math.round(window.scrollX), y: Math.round(window.scrollY) })),
2920
- 5000,
2921
- "scroll read"
2922
- );
3127
+ sent = true;
3128
+ const t0 = Date.now();
3129
+ let last = null, lastAt = t0;
3130
+ for (;;) {
3131
+ await sleep(SCROLL_POLL_MS);
3132
+ after = await read(key);
3133
+ const now = Date.now();
3134
+ // the page has had this call's wheel, and none was on its way before: none can reach another document now
3135
+ if (after.ours && isMine(after) && !pendingBefore) st.pending = false;
3136
+ if (navigated(s) || !after.ours || after.leaving) break;
3137
+ if (after.n > 0 && seenAt === null) seenAt = now;
3138
+ const at = `${after.x},${after.y}`;
3139
+ if (at !== last) { last = at; lastAt = now; }
3140
+ const moved = after.x !== before.x || after.y !== before.y;
3141
+ if (moved && now - lastAt >= SCROLL_STABLE_MS) break;
3142
+ // still since the page had the wheel; over a frame, which does not say so, since the wheel was sent
3143
+ const from = framed ? t0 : seenAt;
3144
+ if (!moved && from !== null && now - from >= (framed ? SCROLL_FRAME_MS : SCROLL_STILL_MS)) break;
3145
+ if (now - t0 >= SCROLL_SEEN_MS) break;
3146
+ }
2923
3147
  } catch (e) {
3148
+ unhook();
3149
+ // whatever the call ends with: a wheel the page has drawn twice since is no longer on its way
3150
+ if (sent && (await scrollFlushed(page))) st.pending = false;
3151
+ const shows = navigated(s) ? ` (it shows ${showsNow(s)} now)` : "";
3152
+ // the wheel went out and the page navigated before it was read: as when a read below shows that
3153
+ if (sent && (navigated(s) || ctxGone(e))) return { text: `scrolled ${direction} ${pages} page(s) at (${cx},${cy}): scrollX ${before.x}, scrollY ${before.y} before the wheel — the page navigated meanwhile${shows}, so where the wheel left it was not read — delivery=delivered_unverified, retry=unsafe` };
2924
3154
  return { error: `action_failed: scroll ${direction} failed: ${shortErr(e)}${navigated(s) || ctxGone(e) ? " — the page navigated meanwhile" : ""} (delivery=unknown, retry=unsafe)` };
2925
3155
  }
3156
+ unhook();
3157
+ if (await scrollFlushed(page)) st.pending = false;
2926
3158
  const where = `scrolled ${direction} ${pages} page(s) at (${cx},${cy}): scrollX ${before.x} → ${after.x}, scrollY ${before.y} → ${after.y}`;
2927
3159
  // the two positions are of two pages: a new page starts at the top, which says nothing about the wheel
2928
- if (navigated(s)) return { text: `${where} — the page navigated meanwhile (it shows ${showsNow(s)} now), so the positions are of two pages — delivery=delivered_unverified, retry=unsafe` };
3160
+ if (navigated(s) || !after.ours) return { text: `${where} — the page navigated meanwhile${navigated(s) ? ` (it shows ${showsNow(s)} now)` : ""}, so the positions are of two pages — delivery=delivered_unverified, retry=unsafe` };
3161
+ const unverified = (text) => ({ text });
3162
+ // a navigation that began may not finish (a download, a 204): the page stays, and the wheel's effect is not known
3163
+ if (after.leaving) return unverified(`${where} — the page navigated meanwhile (a navigation started while this call ran), so the position is not taken as the wheel's — delivery=delivered_unverified, retry=unsafe`);
2929
3164
  const moved = after.x !== before.x || after.y !== before.y;
2930
- if (!moved) return { text: `${where} (did not move) — delivery=delivered_unverified, retry=unsafe` };
3165
+ const mine = isMine(after);
3166
+ const overFrame = framed;
3167
+ if (after.n > 0 && !mine) return unverified(`${where}${moved ? "" : " (did not move)"} — ${after.n > 1 ? `${after.n} wheel events` : "a wheel event that was not this one"} reached the page meanwhile, so what it did is not known to be this wheel's — delivery=unknown, retry=unsafe`);
3168
+ if (!moved) {
3169
+ if (overFrame) return unverified(`${where} (did not move in the ${SCROLL_FRAME_MS / 1000} s after the wheel was sent; the wheel was over a frame, whose own scrolling is not read) — delivery=delivered_unverified, retry=unsafe`);
3170
+ // no sign that the page had the wheel: it may still arrive
3171
+ if (!mine) return unverified(`${where} (did not move) — the page did not report the wheel within ${SCROLL_SEEN_MS / 1000} s; it may still arrive — delivery=unknown, retry=unsafe`);
3172
+ return unverified(`${where} (did not move in the ${SCROLL_STILL_MS / 1000} s after the page had the wheel) — delivery=delivered_unverified, retry=unsafe`);
3173
+ }
3174
+ if (!still) return unverified(`${where} — the page was still moving before the wheel, so this movement is not known to be the wheel's — delivery=delivered_unverified, retry=unsafe`);
3175
+ if (overFrame) return unverified(`${where} — the page moved, but the wheel was over a frame, so the movement is not known to be the wheel's — delivery=delivered_unverified, retry=unsafe`);
3176
+ if (!mine) return unverified(`${where} — the page moved but did not report the wheel, so the movement is not known to be the wheel's — delivery=delivered_unverified, retry=unsafe`);
2931
3177
  // verified only when the page went the way that was asked: a page can move itself, also the other way
2932
3178
  const went = dy > 0 ? after.y > before.y : dy < 0 ? after.y < before.y : dx > 0 ? after.x > before.x : dx < 0 ? after.x < before.x : false;
2933
- if (!went) return { text: `${where} (the page moved, but not ${direction}) — delivery=delivered_unverified, retry=unsafe` };
3179
+ if (!went) return unverified(`${where} (the page moved, but not ${direction}) — delivery=delivered_unverified, retry=unsafe`);
3180
+ if (st.blind) return unverified(`${where} — noracu lost sight of this tab's documents earlier (its DevTools view ended), so no movement in it is taken as the wheel's — delivery=delivered_unverified, retry=unsafe`);
3181
+ if (doubt) return unverified(`${where} — an earlier wheel that may have reached this page was not verified, so this movement may be that wheel's — delivery=delivered_unverified, retry=unsafe`);
3182
+ // every wheel that may have reached this document was verified: the doubt comes off
3183
+ st.doubted.delete(docId);
2934
3184
  return { text: `${where} — delivery=delivered_verified, retry=unsafe` };
2935
3185
  }
2936
3186
 
@@ -4157,7 +4407,7 @@ rl.on("line", async (line) => {
4157
4407
  if (id !== undefined) liveCalls.set(id, live);
4158
4408
  const run = () => tool.fn(params?.arguments || {}, live);
4159
4409
  const t0 = Date.now();
4160
- // ios_* calls share the queue (the runner takes one command at a time); ios_status asks devicectl only
4410
+ // ios_* calls share the queue (the runner takes one command at a time); ios_status asks devicectl / simctl only
4161
4411
  const queued = /^(phone|mac|ios)_/.test(name) && !OBSERVE_TOOLS.has(name) && name !== "ios_status";
4162
4412
  // every queued tool that is not read-only waits for the person at the Mac (0.2.7); ios_* input checks
4163
4413
  // the stop file but does not wait: it does not use this Mac's keyboard or mouse