noracu 0.2.6 → 0.3.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/README.md CHANGED
@@ -11,9 +11,9 @@
11
11
 
12
12
  One stdio MCP server. The agent snapshots a tree, gets an indexed element list, then clicks or types by `element_index` instead of raw pixels — the same observe/act split on the Mac and in the browser. The experimental iPhone layer runs the same observe → act loop over OCR text and normalized coordinates.
13
13
 
14
- ![browser element_index demo](https://raw.githubusercontent.com/sgInnora/noracu/v0.1.0/docs/demo-browser.gif)
14
+ ![noracu 0.3.0 demo](https://github.com/sgInnora/noracu/releases/download/v0.3.0/noracu-demo.gif)
15
15
 
16
- *`browser_snapshot` returns an indexed ARIA tree; `browser_click` acts by `element_index`. The Mac layer runs the same loop (`mac_ax_state` → `mac_click`). Highlight boxes are overlays from `demo/record-browser.mjs`, not a product feature. The iPhone layer is not in this demo.*
16
+ *noracu 0.3.0 in the person's own Chrome (`browser_launch` with `chrome: true`): it opens a tab of its own on the project's GitHub page, reads the star count from the page, and types it into a new note in Notes. The browser `element_index` loop is in the [v0.1.0 demo](https://raw.githubusercontent.com/sgInnora/noracu/v0.1.0/docs/demo-browser.gif).*
17
17
 
18
18
  ## What it does
19
19
 
@@ -22,10 +22,13 @@ One MCP server, three control surfaces:
22
22
  | Layer | Tools | Drives | Status |
23
23
  |---|---|---|---|
24
24
  | **Mac** | 20 (`mac_*`) | macOS Accessibility API (`src/mac-ax.js`, JXA), cliclick, screencapture | stable |
25
- | **Browser** | 12 (`browser_*`) | Playwright (persistent profile) | stable |
25
+ | **Browser** | 13 (`browser_*`) | Playwright (its own persistent profile, or your own Chrome with `chrome: true`, experimental) | stable |
26
26
  | **iPhone** | 14 (`phone_*`) | iPhone Mirroring via the bundled imctl driver (Python + pyobjc) | experimental |
27
+ | **iPhone**, XCUITest backend | 9 (`ios_*`, listed instead of `phone_*`) | a UI-test runner on the phone (`ios-runner/`), Xcode's `devicectl` | experimental, opt-in |
27
28
 
28
- The iPhone layer is experimental and ships with its driver (imctl, in `imctl/`). It needs Apple's iPhone Mirroring with the iPhone **locked and near the Mac**, and a python3 with pyobjc; it observes with OCR and acts on normalized coordinates rather than `element_index`. Without pyobjc, `phone_*` tools return a one-line `imctl unavailable` error with the install command, and the Mac and browser layers are unaffected. The observe/act vocabulary follows the action/observation split popularized by ChatGPT's computer-use, re-implemented on open local tooling.
29
+ The iPhone layer is experimental, off by default (`NORACU_LAYERS=mac,browser,iphone` turns it on) and ships with its driver (imctl, in `imctl/`). It needs Apple's iPhone Mirroring with the iPhone **locked and near the Mac**, and a python3 with pyobjc; it observes with OCR and acts on normalized coordinates rather than `element_index`. Without pyobjc, `phone_*` tools return a one-line `imctl unavailable` error with the install command, and the Mac and browser layers are unaffected. (With the default `NORACU_LAYERS` the iPhone layer is off entirely: `phone_*` is not listed, and a call answers `unknown tool … the iphone layer is off`.) The observe/act vocabulary follows the action/observation split popularized by ChatGPT's computer-use, re-implemented on open local tooling.
30
+
31
+ A second iPhone backend is opt-in: with `NORACU_PHONE_BACKEND=xcuitest` the `phone_*` tools give way to nine `ios_*` tools that read the phone's own accessibility elements and act by `element_index`, through a small UI-test runner built with Xcode — see [XCUITest backend](#xcuitest-backend-experimental-opt-in).
29
32
 
30
33
  ## Why noracu
31
34
 
@@ -34,15 +37,22 @@ noracu is the local hands, not the model. Your MCP client (Claude Desktop, Claud
34
37
  - **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
38
  - **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
39
  - **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.
40
+ - **Shares the Mac with you.** Mac and iPhone input goes second to the person at the Mac: if the keyboard or mouse was used in the last 2 s (not by noracu), an input tool returns `user_active` and sends nothing, and after a physical click, drag, scroll or phone gesture the pointer goes back where it was, unless someone moved it in the meantime. Read-only tools and the browser layer are not held up. `NORACU_USER_IDLE_S=0` turns this off on a Mac dedicated to the agent.
37
41
  - **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.
38
42
  - **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.
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).
43
+ - **Off switches that are actually off.** `NORACU_READ_ONLY=1` (observation-only, default-deny) and `NORACU_DISABLE_EVAL=1`; `browser_evaluate` (arbitrary JS) and `file://` are off by default. See [Security](#security).
40
44
  - **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`.
41
45
 
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.
46
+ ![The person at the Mac goes first](https://github.com/sgInnora/noracu/releases/download/v0.3.0/noracu-person-goes-first.gif)
47
+
48
+ *noracu types `#n` into a note once a second. While the mouse is in use, each call returns `user_active` and nothing is typed (the gaps in the numbers); once the mouse has been still for 2 s, typing carries on.*
49
+
50
+ **Not a good fit if** you need more than one browser session at a time (there is one session; `browser_tabs` lists, opens, selects and closes its tabs), 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 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.
43
51
 
44
52
  ## Quickstart
45
53
 
54
+ **One line, for Claude Code started from a terminal with Node ≥ 20 on its `PATH`:** `claude mcp add noracu -- npx -y noracu` — then grant the permissions in step 3. Claude Desktop and Cursor need the absolute paths of step 2.
55
+
46
56
  First success is `mac_ax_state` (or a browser snapshot) — not a click, and not a `phone_*` tool. The biggest day-one failure is granting macOS permissions to `node` instead of to the host app; grants apply only after a full quit and reopen.
47
57
 
48
58
  **1. Install** (Node ≥ 20; no postinstall script):
@@ -93,7 +103,8 @@ Then **quit the host app completely (including any menu-bar icon) and reopen it.
93
103
  | `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 |
94
104
  | `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 |
95
105
  | `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 |
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. A one- or two-letter name such as `X` is often unreadable to OCR, so `phone_open` reports `open_not_confirmed` without tapping — open that app from its Home Screen icon (`phone_screenshot`, then `phone_tap`). `phone_open` leaves the app name on the clipboard |
106
+ | `user_active: …` | someone used this Mac's keyboard or mouse in the last 2 s — nothing was sent; retry after a pause. On a Mac nobody else uses, `NORACU_USER_IDLE_S=0` turns the check off |
107
+ | `phone_open` returns app not found for an installed app | it only taps the app's label in Spotlight's Top Hit card, or — where Spotlight shows its search field at the top and no Top Hit card — the label just under the field when the field completes the name as "<name> — Open" — 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 (it covers the Top Hit label only; the "— Open" completion is read in English only). `open_not_confirmed: … never showed up on the phone` means the name did not show up in Spotlight after ⌘V: the paste may not have arrived (it can take several seconds) or the phone may have pasted its own older clipboard into the search field — retry; `phone_open` clears the field first. A one- or two-letter name such as `X` is often unreadable to OCR, so `phone_open` reports `open_not_confirmed` without tapping — open that app from its Home Screen icon (`phone_screenshot`, then `phone_tap`). `phone_open` leaves the app name on the clipboard |
97
108
  | 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
109
  | `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
110
  | `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 |
@@ -106,7 +117,9 @@ Full worked examples: [docs/usage.md](docs/usage.md).
106
117
 
107
118
  ## iPhone layer (experimental)
108
119
 
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/`.
120
+ 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/`.
121
+
122
+ **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.
110
123
 
111
124
  **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.
112
125
 
@@ -116,20 +129,40 @@ noracu can operate a real iPhone through Apple's **iPhone Mirroring**. The agent
116
129
 
117
130
  **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.
118
131
 
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.
132
+ **Privacy:** whatever the phone shows — notifications, messages, mail, one-time codes — becomes tool output that your MCP client sends to its model. Turn on a Focus, open a neutral app before you start, and begin with `NORACU_READ_ONLY=1` (`phone_status`, `phone_screenshot`, `phone_ocr` and `phone_find` stay allowed; all phone input is refused). iPhone notifications also reach the Mac once Mirroring is set up. Looking is not invisible to the phone either: in a device run (iPhone 17 Pro Max on iOS 27, Mac on macOS 27.2) LinkedIn and rednote each showed their after-screenshot share sheet one to four seconds after every capture of the mirror window, one more sheet per capture. Every tool that reads the screen captures it — `phone_screenshot`, `phone_ocr`, `phone_find`, any `expect` check, and the checks inside `phone_type`, `phone_open` and `phone_scroll` — and so does a phone input that first has to bring iPhone Mirroring to the front. Assume an app that logs screenshots, or tells the other person in a chat about them, does so on every capture (not tested).
120
133
 
121
134
  **First success:** `phone_status` → `phone_launch` if `live` is not `true` → `phone_screenshot` → `phone_ocr` → `phone_find` + `phone_tap`.
122
135
 
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, started from the empty strip just above the Dock: a swipe that starts on an app icon picks the icon up and moves it); 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`); `phone_type` needs a Mac keyboard layout that keeps A and V where U.S. QWERTY has them (U.S., ABC and Pinyin do; French AZERTY and Dvorak do not) — otherwise it returns `keyboard_layout` and sends nothing.
136
+ **Known limits:** a tap goes where OCR saw the text, so repeated or misread labels can be hit wrong (`phone_open` cannot tell an app from a contact or website that Spotlight's Top Hit shows under the same name); `phone_scroll` moves lists with trackpad-style scroll events (a vertical `phone_swipe` drag does not scroll a list — use it for gestures such as Home Screen paging, started from the empty strip just above the Dock: a swipe that starts on an app icon picks the icon up and moves it; both points of a swipe are kept inside the phone screen, because iOS cancels a drag that starts or ends on the transparent window margin around it, and the result names any point that was moved; a tap or long press aimed at that margin — the strip above the screen holds the window's own controls — is refused with `out_of_screen`; the screen's edges are measured from one capture of the window and remembered per window size and macOS version in `~/Library/Caches/noracu/phone-screen-rect.json`, and a measurement taken while the pointer rests on that strip is not trusted, so until a clean one is made a point near the top of the window or along its other sides, where the margin may be, is refused for a tap or long press and moved inward for a swipe, and the result says so); on one tested setup (iPhone 17 Pro Max on iOS 27.0.1, Mac on macOS 26.6.2) iPhone Mirroring draws the phone about 17% larger than its window at every View size, so the right column and bottom row are cut off and cannot be reached; moving the window between displays, changing the main display and relaunching made no difference, and the iOS 27 / macOS 26 version mismatch is the main suspect — check `phone_screenshot` if taps near the edges miss; `phone_open` types the app name into Spotlight and taps it only when Spotlight's Top Hit card shows exactly that name — or, where Spotlight puts its search field at the top with no Top Hit card (seen on iOS 27), only when the field completes exactly that name as "<name> — Open" (web suggestions, websites and Settings rows of the same name are never tapped), otherwise returns to the Home Screen — it reads Spotlight's English "Top Hit" label, so on an iPhone set to another language it finds nothing until `NORACU_TOPHIT_LABELS` names that label (the top-field layout's "Open" completion is English only, and `NORACU_TOPHIT_LABELS` does not change it); `phone_home` / `phone_app_switcher` use the iPhone Mirroring menu when live (working without python on English macOS, falling back to an `imctl` gesture only when those menu items are absent, and returning `menu_unknown` without a second gesture on timeout) and report only that the command was sent (`screen not verified`); `phone_type` needs a Mac keyboard layout that keeps A and V where U.S. QWERTY has them (U.S., ABC and Pinyin do; French AZERTY and Dvorak do not) — otherwise it returns `keyboard_layout` and sends nothing; the phone reads the Mac clipboard through Universal Clipboard, which tells it about new content with a delay, so `phone_type` waits at least 1.5 s between writing the clipboard and ⌘V (and returns `focus_lost` without ⌘V if another app comes to the front meanwhile) — in a device run, a ⌘V sent about 0.5 s after the write once pasted the phone's own older clipboard (the previous paste) instead, and a paste can also stop after the phone's "Pasting from …" box; after `type_not_confirmed`, read the field before typing again.
137
+
138
+ ### XCUITest backend (experimental, opt-in)
139
+
140
+ With the iPhone layer on (`NORACU_LAYERS` names `iphone`), set `NORACU_PHONE_BACKEND=xcuitest` and noracu lists nine `ios_*` tools in place of `phone_*`. They do not go through the iPhone Mirroring window: a small UI-test bundle (the "runner" — Swift, MIT, source in `ios-runner/`) runs on the iPhone and executes one command at a time. The agent reads the app's own accessibility elements (`ios_snapshot`) and acts on them by `element_index` (`ios_tap`, `ios_type`), in screen points instead of OCR positions. Apps are opened by bundle id (`ios_launch`); text is typed as keyboard input with no clipboard involved, and `ios_type` reports `delivered_verified` only when the field that took the text afterwards holds what it held before with the text added in one place (four characters or more).
141
+
142
+ **Requirements:** Xcode (the full app); an Apple developer team to sign the runner; an iPhone paired with this Mac with Developer Mode on — over a cable or the local network — or a booted simulator. **The iPhone must be unlocked** while these tools are used (the opposite of iPhone Mirroring, which needs it locked): a locked phone gets `device_locked`: no input, and no snapshot or screenshot either.
143
+
144
+ **Set-up, once per device:** `npx noracu ios-setup --team <TeamID>` builds the runner into `~/.noracu/ios-runner/<udid>` (add `--udid` when several iPhones are connected; a simulator needs only `--udid`). It is an explicit command — nothing is built on install — and the one step of this backend that goes online: Xcode signs the runner for your team and may create a development provisioning profile for it; an iPhone is registered in the team only with `--register-device`. Then start the server with `NORACU_PHONE_BACKEND=xcuitest`. After an upgrade of noracu, run the set-up again when a call answers `runner_version_mismatch`: a runner built from another version's sources is not used.
145
+
146
+ **First success:** `ios_status` → `ios_launch` (`com.apple.Preferences`) → `ios_snapshot` → `ios_tap` or `ios_type` by `element_index` → `ios_snapshot` again. The first call that needs the phone starts the runner (about 9 s on an iPhone 16 Pro; on a simulator about 2 s once it is warm, and close to half a minute right after it booted); an input call that had to start it sends nothing, because the runner's own app comes to the front — look with `ios_snapshot` first. The server stops the runner when it exits.
147
+
148
+ **How it differs from the Mirroring backend:** elements with an `element_index` instead of OCR text; an index is re-checked before it is used (`element_no_longer_valid` when the element moved, changed, or its app left the front) and ended by `ios_home` and `ios_launch`; apps are named by bundle id, and noracu knows which app is in front only for the app a call names. `NORACU_STOP_FILE`, `NORACU_DENY_APPS` and `NORACU_APPROVAL_FILE` apply — matched on the iOS bundle id; the default deny list names Mac apps only — terminal apps and IDEs with a built-in terminal — so no iOS app matches it by default — and when app rules (`NORACU_APPROVAL_FILE` or a custom `NORACU_DENY_APPS`) are active, input targeting the Home Screen (`com.apple.springboard`) is always refused, even if listed in `allow` (use `ios_launch` to open approved apps) — and `NORACU_USER_IDLE_S` does not, as these tools do not use the Mac's keyboard or mouse. While a system prompt (a permission alert) is up on the iPhone, input named for an app is not sent (`system_alert`); the person answers it on the phone.
149
+
150
+ **Privacy:** `ios_snapshot` and `ios_screenshot` return what the app shows — messages, notifications, one-time codes — to your MCP client and its model, as with the Mirroring backend. Under `NORACU_READ_ONLY=1` this backend answers `ios_status` only: all iPhone input is refused, and `ios_snapshot` / `ios_screenshot` return `runner_not_started`, because reading the screen needs the runner and starting it puts the runner's own app in front of whatever the iPhone shows.
151
+
152
+ **Tested with:** an iPhone 16 Pro on iOS 27.2 and an iPhone 17 Pro simulator on iOS 26.5, Xcode 27.2, in the Settings app and on the Home Screen. On the iPhone the lock check adds about 0.8 s to every input, and to a snapshot or screenshot taken more than a second after the last check. What was not tested is in the CHANGELOG's known issues; the risks of this backend are in [SECURITY.md](SECURITY.md).
124
153
 
125
154
  ## Environment variables
126
155
 
127
156
  | Variable | Default | Purpose |
128
157
  |---|---|---|
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`) |
130
- | `NORACU_DISABLE_EVAL` | unset | `=1` makes `browser_evaluate` (arbitrary JS) return an error when called (it stays listed) |
158
+ | `NORACU_READ_ONLY` | unset | `=1` observation-only: a default-deny allowlist of observe + browser-lifecycle tools — 8 `mac_*`, 6 `browser_*` and, with the iPhone layer on, the 4 observing `phone_*` ones (under the XCUITest backend `ios_status`, `ios_snapshot` and `ios_screenshot` instead; `ios_snapshot` and `ios_screenshot` are refused with `runner_not_started`, since observation-only mode does not start the runner); 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`) |
159
+ | `NORACU_ENABLE_EVAL` | unset | `=1` turns `browser_evaluate` (arbitrary JS in the page) on; unset, it returns `eval_disabled` when called (it stays listed) |
160
+ | `NORACU_DISABLE_EVAL` | unset | `=1` keeps `browser_evaluate` off even when `NORACU_ENABLE_EVAL=1` (kill switch) |
131
161
  | `NORACU_ALLOW_FILE_URL` | unset | `=1` lets `browser_navigate` open `file://` URLs (blocked by default) |
132
162
  | `NORACU_DISABLE_AUTO_INSTALL` | unset | `=1` skips the Chromium auto-install on first `browser_launch` |
163
+ | `NORACU_ALLOW_CHROME` | unset | `=1` lets `browser_launch` with `chrome: true` work in your own Chrome, with its sign-ins, through Chrome's remote-debugging switch (`chrome://inspect/#remote-debugging`, Chrome 144+; Chrome asks you to allow each connection). noracu opens a window of its own there and works only in the tabs it opens; refused under `NORACU_READ_ONLY=1` |
164
+ | `NORACU_CHROME_TABS` | unset (noracu's own tabs) | `all`: with `chrome: true`, your other Chrome tabs are listed too and can be selected, read and acted on (http(s) pages only); only noracu's own tabs are ever closed |
165
+ | `NORACU_CHROME_DIR` | `~/Library/Application Support/Google/Chrome` | the profile folder whose `DevToolsActivePort` file `chrome: true` reads (Chrome Beta, Canary or another Chromium-based browser) |
133
166
  | `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
167
  | `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) |
135
168
  | `NORACU_CLICLICK` | `/opt/homebrew/bin/cliclick` | cliclick binary path |
@@ -138,6 +171,16 @@ noracu can operate a real iPhone through Apple's **iPhone Mirroring**. The agent
138
171
  | `NORACU_PHONE_TIMEOUT_MS` | 30000 (45000 for `phone_open` / `phone_type`) | time limit for each iPhone-layer step, 1000–600000 ms; on expiry the step is stopped and returns `imctl_timeout` |
139
172
  | `NORACU_OCR_LANGUAGES` | `zh-Hans,en-US` | OCR languages for the iPhone screen, in priority order (comma-separated Vision language codes, e.g. `zh-Hant,en-US` or `en-US`; codes Vision does not list are skipped with a warning) |
140
173
  | `NORACU_TOPHIT_LABELS` | `Top Hit` | the label of Spotlight's Top Hit section that `phone_open` looks for, comma-separated — set it to the label your iPhone shows when it is not set to English |
174
+ | `NORACU_OCR_MIN_CONFIDENCE` | unset (off) | opt-in, experimental: a number above 0 and at most 1. With it, `phone_open` does not tap a Spotlight label the recognizer read with a lower confidence and answers `open_not_confirmed` with nothing tapped; a value that is set and is not such a number makes `phone_open` refuse (`invalid_args`, nothing sent). Set or not, `phone_open`'s result line names the confidence of the label it read, including when it then taps nothing |
175
+ | `NORACU_USER_IDLE_S` | `2` | seconds without keyboard or mouse input (other than noracu's own) before a Mac or iPhone input tool acts; sooner, it returns `user_active` and sends nothing. While it is not 0, the pointer also goes back where it was after physical clicks, drags, scrolls and phone gestures, unless someone moved it in the meantime. 0–60; `0` turns both off (a Mac dedicated to the agent); any other value falls back to 2. The `ios_*` tools do not wait: they do not use this Mac's keyboard or mouse |
176
+ | `NORACU_NO_BGPOST` | unset | `=1` turns off background input: physical clicks and named keys use the real pointer and the HID key path, as in 0.2.7 |
177
+ | `NORACU_PHONE_BACKEND` | `mirror` | `xcuitest` lists the `ios_*` tools (XCUITest backend, experimental) instead of `phone_*`; any other value falls back to `mirror` with a warning on stderr |
178
+ | `NORACU_IOS_UDID` | unset | the iPhone or simulator the XCUITest backend uses; needed when several iPhones are connected, and always for a simulator |
179
+ | `NORACU_IOS_RUNNER_DIR` | `~/.noracu/ios-runner` | where `noracu ios-setup` puts the runner build and the server looks for it |
180
+ | `NORACU_LAYERS` | unset (`mac,browser`) | comma-separated list of `mac`, `browser`, `iphone`: only those layers' tools are listed and callable — the experimental iPhone layer only when `iphone` is named (`NORACU_LAYERS=mac,browser,iphone`), and the `initialize` instructions name only them (e.g. `NORACU_LAYERS=iphone` for a client entry that carries the iPhone tools only); a name that is not one of the three stops the server at start |
181
+ | `NORACU_STOP_FILE` | unset | a file path: while that file exists, every input tool — 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) — returns `user_stopped` and sends nothing; observation tools are not stopped |
182
+ | `NORACU_DENY_APPS` | the common terminal apps and IDEs with a built-in terminal | comma-separated bundle ids or app names (`*` and `?` wildcards) that never get input; the list adds to the default — blank keeps the default list, a list starting with `none` drops it (`none` alone: no deny list; `none,com.example.app`: only that app) |
183
+ | `NORACU_APPROVAL_FILE` | unset | a JSON file `{allow, ask, deny}` of bundle-id / app-name patterns, mode `0600`, owned by you; an app under `ask` or not listed gets `approval_required`; once it is set, a missing, malformed, symlinked, group-readable or foreign-owned file, or an unknown key, refuses all Mac and iPhone input (app rules do not apply to the browser layer) — as does setting it to a blank value, until removed or given a path; a blank `NORACU_STOP_FILE` refuses all input, browser input included |
141
184
 
142
185
  ## Security
143
186
 
@@ -149,18 +192,35 @@ noracu runs with the privileges of your MCP client. It clicks, types, pastes, an
149
192
 
150
193
  - **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 speaking the 2024-11-05 protocol noracu answers with 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.
151
194
  - **`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.
152
- - **`NORACU_DISABLE_EVAL=1`** makes `browser_evaluate` return an error when called (it stays listed in `tools/list`). Snapshot, click, and type still work.
153
- - **`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.)
195
+ - **`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.
196
+ - **`file://` is refused** unless `NORACU_ALLOW_FILE_URL=1`, so a browser agent can't read `~/Documents` by navigating to it. (The browser itself may follow a redirect during navigation, but every subsequent tool call and in-flight read/snapshot re-checks the active page's URL and refuses non-passing URLs — see SECURITY.md.)
154
197
  - **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 falls back to keystrokes only into a text view accessibility cannot write (a terminal), never when the focus is a button, list or sheet, and into an app that reports no focused element only when `app` names it (otherwise `no_focus`, nothing sent).
155
198
  - **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. An element read with `surface: "app"` is bound to its window's ID too, and a window without an ID (other than Finder's desktop) is refused with `policy_denied`, so a window closed and reopened with the same content never inherits old indexes. A browser click re-checks tag/name/href/position. Otherwise `element_no_longer_valid`.
156
199
  - **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.
157
200
  - **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.
201
+ - **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.
202
+ - **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) 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.
158
203
  - **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.
159
- - **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).
204
+ - **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`.
205
+ - **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).
160
206
  - **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.
161
207
  - **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`).
162
208
  - **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.
163
209
 
210
+ **What it refuses by default** — a refused input sends nothing, and its error says so (`delivery=not_delivered, retry=safe`):
211
+
212
+ | Refused by default | Answer | To change it |
213
+ |---|---|---|
214
+ | Input into terminals and IDEs with a built-in terminal | `input_denied` | `NORACU_DENY_APPS` (a list starting with `none` drops the default) |
215
+ | `browser_evaluate` (any script in the page) | `eval_disabled` | `NORACU_ENABLE_EVAL=1` |
216
+ | `file://` pages in the browser | refused at the URL | `NORACU_ALLOW_FILE_URL=1` |
217
+ | DevTools ports (`cdp_port`) | refused | `NORACU_ALLOW_CDP=1` |
218
+ | Working in your own Chrome (`browser_launch` with `chrome: true`) | `policy_denied` | `NORACU_ALLOW_CHROME=1`, and Chrome's switch at `chrome://inspect/#remote-debugging` |
219
+ | The iPhone tools | not listed; a call answers `unknown tool … the iphone layer is off` | `NORACU_LAYERS=mac,browser,iphone` |
220
+ | Mac input and iPhone Mirroring input while you use the keyboard or mouse | `user_active` | `NORACU_USER_IDLE_S=0` |
221
+ | Quit, log-out, lock, force-quit, delete-immediately and empty-Trash chords; Apple-menu items | refused | `force: true` |
222
+ | Every input while the stop file exists — once you name one with `NORACU_STOP_FILE` | `user_stopped` | delete the file |
223
+
164
224
  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).
165
225
 
166
226
  ## Tools & docs
@@ -171,7 +231,6 @@ These switches do not make observed content trustworthy. Screenshot text, access
171
231
 
172
232
  ## Roadmap
173
233
 
174
- - Browser: tab management (list / select / close)
175
234
  - Act vocabulary (browser): `hover`, `set_value`, `wait_for`
176
235
  - Measure the token cost of `skeleton` + `root` drill-down against full snapshots
177
236
  - Open Notification Center's history when the menu-bar clock is not exposed to accessibility
package/README.zh-CN.md CHANGED
@@ -11,9 +11,9 @@ For English, see [README.md](README.md).
11
11
 
12
12
  一个 stdio MCP server。agent 对界面做一次快照、拿到带索引的元素列表,然后按 `element_index` 点击或输入,而不是用原始像素坐标——Mac 层和 Browser 层是同一套 observe/act 协议。实验性的 iPhone 层在 OCR 文本和归一化坐标上跑同一个 observe → act 循环。
13
13
 
14
- ![browser element_index demo](https://raw.githubusercontent.com/sgInnora/noracu/v0.1.0/docs/demo-browser.gif)
14
+ ![noracu 0.3.0 演示](https://github.com/sgInnora/noracu/releases/download/v0.3.0/noracu-demo.gif)
15
15
 
16
- *`browser_snapshot` 返回带索引的 ARIA 树;`browser_click` 按 `element_index` 动作。Mac 层跑同一个循环(`mac_ax_state` → `mac_click`)。高亮框是 `demo/record-browser.mjs` 录制时的叠加层,不是产品功能。iPhone 层不在此 demo 中。*
16
+ *noracu 0.3.0 在人自己的 Chrome 里(`browser_launch` 带 `chrome: true`):它在项目的 GitHub 页面上开一个自己的标签,从页面读出 star 数,再把它打进备忘录里新建的一条。Browser 层的 `element_index` 循环见 [v0.1.0 演示](https://raw.githubusercontent.com/sgInnora/noracu/v0.1.0/docs/demo-browser.gif)。*
17
17
 
18
18
  ## 它做什么
19
19
 
@@ -22,10 +22,13 @@ For English, see [README.md](README.md).
22
22
  | 层 | 工具 | 底层 | 状态 |
23
23
  |---|---|---|---|
24
24
  | **Mac** | 20 个(`mac_*`) | macOS 辅助功能 API(`src/mac-ax.js`,JXA)、cliclick、screencapture | stable |
25
- | **Browser** | 12 个(`browser_*`) | Playwright(持久化 profile) | stable |
25
+ | **Browser** | 13 个(`browser_*`) | Playwright(自己的持久化 profile,或带 `chrome: true` 用你自己的 Chrome,实验性) | stable |
26
26
  | **iPhone** | 14 个(`phone_*`) | 经随包附带的 imctl 驱动 iPhone Mirroring(Python + pyobjc) | experimental |
27
+ | **iPhone**,XCUITest 后端 | 9 个(`ios_*`,取代 `phone_*` 列出) | 跑在手机上的 UI 测试 runner(`ios-runner/`)、Xcode 的 `devicectl` | experimental,需显式开启 |
27
28
 
28
- iPhone 层是实验性的,驱动 imctl 随包附带(在 `imctl/`)。它需要 Apple 的 iPhone Mirroring,且 iPhone **锁定并靠近 Mac**,以及一个带 pyobjc 的 python3;它用 OCR 观察、按归一化坐标动作,而不是 `element_index`。没有 pyobjc 时,`phone_*` 工具返回一行带安装命令的 `imctl unavailable` 错误,Mac 层和 Browser 层不受影响。observe/act 词汇表沿用 ChatGPT computer-use 推广的 action/observation 拆分思路,在开放的本地工具上重新实现。
29
+ iPhone 层是实验性的,默认关闭(`NORACU_LAYERS=mac,browser,iphone` 打开),驱动 imctl 随包附带(在 `imctl/`)。它需要 Apple 的 iPhone Mirroring,且 iPhone **锁定并靠近 Mac**,以及一个带 pyobjc 的 python3;它用 OCR 观察、按归一化坐标动作,而不是 `element_index`。没有 pyobjc 时,`phone_*` 工具返回一行带安装命令的 `imctl unavailable` 错误,Mac 层和 Browser 层不受影响。observe/act 词汇表沿用 ChatGPT computer-use 推广的 action/observation 拆分思路,在开放的本地工具上重新实现。
30
+
31
+ 第二套 iPhone 后端需要显式开启:设置 `NORACU_PHONE_BACKEND=xcuitest` 后,`phone_*` 换成 9 个 `ios_*` 工具,它们读取手机自己的辅助功能元素、按 `element_index` 动作,靠的是一个用 Xcode 构建的小 UI 测试 runner——见 [XCUITest 后端](#xcuitest-后端实验性需显式开启)。
29
32
 
30
33
  ## 为什么用 noracu
31
34
 
@@ -34,15 +37,22 @@ noracu 是本地的"手",不是"脑"。决策由你的 MCP client(Claude Des
34
37
  - **server 完全在本机运行。** 无云服务、无 API key、无遥测、无 postinstall 脚本。唯一运行期依赖是 Playwright。noracu 自身不发任何网络请求;唯一的自动网络行为是首次 `browser_launch` 时一次性下载 Chromium(`NORACU_DISABLE_AUTO_INSTALL=1` 可关闭)。设置 `NORACU_ALLOW_CDP=1` 后,它还会访问自己在 127.0.0.1 上打开的 DevTools 端口(连接其他本地回环端口需 `NORACU_ALLOW_CDP=any`)。你让浏览器打开的页面当然会被抓取,你的 MCP client 也仍会把工具结果(截图、OCR 文本)发给它所用的模型。
35
38
  - **按语义动作,而非像素。** 观察返回 accessibility 树(Mac 直接经 macOS 辅助功能 API 读取——在我们的测试机上,500 个元素的窗口约 0.15 秒)或 ARIA 树(browser)的带索引列表——是文本,不是截图。动作引用 `element_index`;索引 30 秒后过期。Mac 上每个索引背后都有身份证据(窗口 ID、子节点路径、角色、标识符、名称),每次动作前先重新识别元素;browser 则重校验 tag/name/href/位置。元素已消失或已变化时返回 `element_no_longer_valid`,而不是点错位置。树不够用时才用截图。
36
39
  - **如实报告结果。** Mac 动作优先用元素自己的辅助功能动作(按下、选中、设值、插入文本——不移动指针、不抢焦点,文字输入不受输入法影响);只有命中检测确认该点确实落在元素上,才会发送物理点击。每个输入动作(Mac、浏览器和 iPhone)的结果都写明是否送达(观察到变化为 `delivered_verified`,另有 `delivered_unverified`、`not_delivered`,以及超时或中途失败时的 `unknown`)以及能否安全重试;Mac 动作还会列出它打开的 sheet、对话框或菜单。
40
+ - **和你共用这台 Mac。** Mac 与 iPhone 的输入让电脑前的人先来:最近 2 秒内键盘或鼠标被用过(不是 noracu 自己),输入工具就返回 `user_active`、什么都不发;物理点击、拖动、滚动和手机手势之后,指针回到原处,除非这期间有人动过它。只读工具和浏览器层不受影响。专给 agent 用的 Mac 上设 `NORACU_USER_IDLE_S=0` 关闭。
37
41
  - **一个循环,三个面。** Mac 原生应用和持久化 profile 的浏览器共用 `element_index` 协议(观察一棵树、按索引动作)。实验性的 iPhone 层在 Apple 的 iPhone Mirroring 上跑同一个 observe → act 循环,用的是 OCR 文本和归一化坐标——因为手机不向 Mac 暴露 accessibility 树。
38
42
  - **用你真实的会话。** 你已登录的浏览器 profile、你的 Mac 应用——不是托管的 VM。与云端 computer-use 相比:两者没有谁普遍更可靠,只是失败方式不同。noracu 把屏幕留在你本机。
39
- - **真正能关掉的开关。** `NORACU_READ_ONLY=1`(只观察,默认拒绝)、`NORACU_DISABLE_EVAL=1`、以及默认封禁 `file://`。见 [安全](#安全)。
43
+ - **真正能关掉的开关。** `NORACU_READ_ONLY=1`(只观察,默认拒绝)和 `NORACU_DISABLE_EVAL=1`;`browser_evaluate`(任意 JS)和 `file://` 默认关闭。见 [安全](#安全)。
40
44
  - **可验证。** 端到端测试(`npm test`;不依赖硬件的部分在 macos-latest 上跑 CI)、MIT 许可;server 由 `src/server.mjs` 和 Mac 辅助功能引擎 `src/mac-ax.js` 组成。
41
45
 
42
- **不适合的场景:** 你需要多个浏览器标签页或会话(当前仅单会话)、你不在 macOS 上(Mac 与 iPhone 层仅限 macOS;Browser 层跨平台)、或你现在就需要一个成品级的 iPhone 层(它已随包附带,但仍是实验性——而且 Apple 在欧盟不提供 iPhone Mirroring)。如果你只需要浏览器自动化,playwright-mcp 有 noracu 还没有的 tab 管理和 selector API。如果你要在 Windows 或 Linux 上操作桌面应用,agent-desktop(Vercel Labs)经各系统的辅助功能 API 覆盖 macOS、Windows 和 Linux;noracu 的桌面层只支持 macOS。noracu 的价值在于:一个 agent 通过同一个 server 操作 Mac 应用、浏览器和 iPhone。
46
+ ![人优先](https://github.com/sgInnora/noracu/releases/download/v0.3.0/noracu-person-goes-first.gif)
47
+
48
+ *noracu 每秒往一条备忘录里打一个 `#n`。鼠标在动的时候,每次调用都返回 `user_active`,什么都不打(编号里断开的那几个);鼠标停下 2 秒后,接着打。*
49
+
50
+ **不适合的场景:** 你需要同时开多个浏览器会话(只有一个会话;`browser_tabs` 可以列出、打开、切换、关闭其中的标签页)、你不在 macOS 上(Mac 与 iPhone 层仅限 macOS;Browser 层跨平台)、或你现在就需要一个成品级的 iPhone 层(它已随包附带,但仍是实验性——而且 Apple 在欧盟不提供 iPhone Mirroring)。如果你只需要浏览器自动化,playwright-mcp 有 noracu 还没有的 selector API。如果你要在 Windows 或 Linux 上操作桌面应用,agent-desktop(Vercel Labs)经各系统的辅助功能 API 覆盖 macOS、Windows 和 Linux;noracu 的桌面层只支持 macOS。noracu 的价值在于:一个 agent 通过同一个 server 操作 Mac 应用、浏览器和 iPhone。
43
51
 
44
52
  ## 快速开始
45
53
 
54
+ **一行安装(从终端启动的 Claude Code,`PATH` 里有 Node ≥ 20):** `claude mcp add noracu -- npx -y noracu`——然后按第 3 步授权。Claude Desktop 和 Cursor 要用第 2 步的绝对路径。
55
+
46
56
  第一个该成功的调用是 `mac_ax_state`(或一次 browser 快照)——不是点击,也不是 `phone_*`。上手第一天最常见的失败是:把 macOS 权限授给了 `node` 而不是宿主应用;权限要在**完全退出并重开**宿主后才生效。
47
57
 
48
58
  **1. 安装**(Node ≥ 20;无 postinstall 脚本):
@@ -93,7 +103,8 @@ Claude Code:`claude mcp add noracu -- /绝对路径/TO/node /绝对路径/TO/n
93
103
  | `phone_launch` 报 `mirror_setup_required` | iPhone Mirroring 正显示设置或欢迎页(例如升级 macOS 后首次启动)——请在 iPhone Mirroring 窗口里自己完成;noracu 从不替你点击这类页面 |
94
104
  | `imctl_timeout: phone … did not finish within …s` | Mac 负载过高或系统卡住——操作可能已部分执行,重试前先看 `phone_status` / `phone_screenshot`(`phone_open` 超时后 noracu 会回到主屏幕);在此期间 server 仍会响应其他调用 |
95
105
  | `input_busy: …` | 前一个手机或 Mac 操作占用输入队列超过 60 秒(或 `NORACU_PHONE_TIMEOUT_MS` + 15 秒);本次调用什么都没做——重试即可 |
96
- | 已安装的 App,`phone_open` 却报 app not found | 它只点 Spotlight「Top Hit」卡片里的标签——名字要和手机图标下显示的一致(例如 `拼多多`,而不是 `Pinduoduo`)。已安装却报 "Spotlight showed no Top Hit",通常说明 iPhone 系统语言不是英文:`phone_open` 读的是 Spotlight 的 "Top Hit" 标签——把 `NORACU_TOPHIT_LABELS` 设成手机上显示的标签。报 `open_not_confirmed: … never showed up on the phone` 则是粘贴的名字没有到达手机(粘贴到 iPhone 可能要好几秒)——重试即可。只有一两个字母的名字(如 `X`)OCR 常常读不出来,`phone_open` 会报 `open_not_confirmed` 且不点任何东西——这类 App 请从主屏图标打开(先 `phone_screenshot`,再 `phone_tap`)。`phone_open` 之后剪贴板里是 App 名字 |
106
+ | `user_active: …` | 最近 2 秒内有人用过这台 Mac 的键盘或鼠标——什么都没发;停一下再重试。没有别人用的 Mac 上,`NORACU_USER_IDLE_S=0` 关闭这项检查 |
107
+ | 已安装的 App,`phone_open` 却报 app not found | 它只点 Spotlight「Top Hit」卡片里的 App 标签;若 Spotlight 把搜索框放在顶部、没有「Top Hit」卡片,则只在搜索框把名字补全成「<名字> — Open」时点搜索框正下方的标签——名字要和手机图标下显示的一致(例如 `拼多多`,而不是 `Pinduoduo`)。已安装却报 "Spotlight showed no Top Hit",通常说明 iPhone 系统语言不是英文:`phone_open` 读的是 Spotlight 的 "Top Hit" 标签——把 `NORACU_TOPHIT_LABELS` 设成手机上显示的标签(它只管「Top Hit」标签;「— Open」补全只认英文)。报 `open_not_confirmed: … never showed up on the phone` 是说 ⌘V 之后 Spotlight 里一直没出现这个名字:可能粘贴还没到(可能要好几秒),也可能手机把自己的旧剪贴板贴进了搜索框——重试即可,`phone_open` 会先清空搜索框。只有一两个字母的名字(如 `X`)OCR 常常读不出来,`phone_open` 会报 `open_not_confirmed` 且不点任何东西——这类 App 请从主屏图标打开(先 `phone_screenshot`,再 `phone_tap`)。`phone_open` 之后剪贴板里是 App 名字 |
97
108
  | 输入的文本被重新空格化(如 "no ra cu") | 文字是以按键方式送出的(`mac_type` 用了 `mechanism: "physical"`,或焦点元素不接受辅助功能写入),同时 CJK 输入法在激活——用 `mac_type` 的默认方式,或用 `mac_paste` |
98
109
  | `element_no_longer_valid` | 快照超过 30 秒,或元素已消失、已变化、所在窗口已关闭——重跑 `mac_ax_state` / `browser_snapshot` 并用新索引 |
99
110
  | `occluded: … — on top: {…}` | 物理点击会落在别的东西上(另一个窗口、一个 sheet)——把目标窗口置前或关掉遮挡物;本次什么都没发送 |
@@ -106,7 +117,9 @@ Claude Code:`claude mcp add noracu -- /绝对路径/TO/node /绝对路径/TO/n
106
117
 
107
118
  ## iPhone 层(实验性)
108
119
 
109
- noracu 可以经 Apple 的 **iPhone Mirroring** 操作真实 iPhone。agent 在 Mac 上用 OCR 观察(`phone_screenshot`、`phone_ocr`、`phone_find`),按 0–1 归一化坐标动作(`phone_tap`、`phone_swipe`、`phone_scroll`),用粘贴输入文字(`phone_type`),按名字打开 App(`phone_open`)。这不是 `element_index`:手机不向 Mac 暴露 accessibility 树,所以点击落在 OCR 识别出文字的位置。驱动(imctl,Python,MIT,约 3,500 行)随包附带在 `imctl/`。
120
+ noracu 可以经 Apple 的 **iPhone Mirroring** 操作真实 iPhone。这一层默认关闭:在 server 条目里加上 `"env": { "NORACU_LAYERS": "mac,browser,iphone" }`(只带 iPhone 工具的条目写 `iphone` 即可),然后完全退出宿主并重开。agent 在 Mac 上用 OCR 观察(`phone_screenshot`、`phone_ocr`、`phone_find`),按 0–1 归一化坐标动作(`phone_tap`、`phone_swipe`、`phone_scroll`),用粘贴输入文字(`phone_type`),按名字打开 App(`phone_open`)。这不是 `element_index`:手机不向 Mac 暴露 accessibility 树,所以点击落在 OCR 识别出文字的位置。驱动(imctl,Python,MIT,约 3,500 行)随包附带在 `imctl/`。
121
+
122
+ **它会占用 Mac 的鼠标和键盘。** iPhone Mirroring 是 Mac 上的一个窗口,所以每个手机输入都经过 Mac:iPhone Mirroring 被调到最前,点按和滑动用的是真实指针,`phone_type` 用 ⌘V 粘贴。手机步骤进行时别用这台 Mac——最近 2 秒内用过键盘或鼠标时 noracu 会拒绝(`user_active`,什么都不发;停手后重试),事后把指针放回原处,但最前面的窗口会变。下面的 XCUITest 后端不用 Mac 的指针和键盘。
110
123
 
111
124
  **Apple 的要求**([support.apple.com/120421](https://support.apple.com/120421)):搭载 Apple 芯片或 T2 芯片、运行 macOS 15 或更高版本的 Mac;运行 iOS 18 或更高版本并设置了密码的 iPhone;两台设备登录同一个开启双重认证的 Apple 账户;蓝牙和 Wi-Fi 打开;Mac 没有共享互联网连接、没有使用 AirPlay 或随航(Sidecar)。**iPhone 必须锁定并靠近 Mac**——解锁 iPhone 或退出 iPhone Mirroring 都会结束会话。iPhone Mirroring 目前在欧盟不可用。一次只能一台 Mac 和一台 iPhone;摄像头和麦克风不会被镜像。
112
125
 
@@ -116,20 +129,40 @@ noracu 可以经 Apple 的 **iPhone Mirroring** 操作真实 iPhone。agent 在
116
129
 
117
130
  **镜像状态:** `phone_status` 返回 `live`(手机画面正在推流)、`overlay`(iPhone Mirroring 显示的替代文字,如 "Connection Paused"、"iPhone in Use")、`paused`(该覆盖层带 Resume 按钮)和 `setup`(需要用户自己完成的设置或欢迎页——noracu 从不点击)。判定依据是窗口结构和形状(镜像窗口是竖长或横长的手机形状,设置页接近正方形),不是文字。镜像不在线时,所有手机输入工具(`phone_tap`、`phone_longpress`、`phone_swipe`、`phone_scroll`、`phone_type`、`phone_key`、`phone_open`、`phone_home` 和 `phone_app_switcher`)都会以 `mirror_not_live` 拒绝——在镜像已暂停或未开启时不会先抢焦点——而不是点到覆盖层上;状态仍无法判定时以 `mirror_state_unknown` 拒绝(`phone_ocr` / `phone_find` 的输出首行会给出警告)。镜像闲置一段时间后会暂停;`phone_launch` 会把它置前并点击 Resume。
118
131
 
119
- **隐私:** 手机上显示的一切——通知、短信、邮件、一次性验证码——都会变成工具输出,由你的 MCP client 发给它所用的模型。开始前打开专注模式、打开一个无关紧要的 App,并先用 `NORACU_READ_ONLY=1`(`phone_status`、`phone_screenshot`、`phone_ocr`、`phone_find` 仍可用;所有手机输入都会被拒绝)。iPhone Mirroring 设置好后,iPhone 的通知也会出现在 Mac 上。
132
+ **隐私:** 手机上显示的一切——通知、短信、邮件、一次性验证码——都会变成工具输出,由你的 MCP client 发给它所用的模型。开始前打开专注模式、打开一个无关紧要的 App,并先用 `NORACU_READ_ONLY=1`(`phone_status`、`phone_screenshot`、`phone_ocr`、`phone_find` 仍可用;所有手机输入都会被拒绝)。iPhone Mirroring 设置好后,iPhone 的通知也会出现在 Mac 上。「看」这个动作对手机也不是隐形的:一次真机测试中(iPhone 17 Pro Max 运行 iOS 27,Mac 运行 macOS 27.2),每次截取镜像窗口后一到四秒,LinkedIn 和小红书都弹出了各自的「截屏后分享」面板,截一次多一层。凡是读屏幕的工具都会截取——`phone_screenshot`、`phone_ocr`、`phone_find`、任何 `expect` 检查,以及 `phone_type`、`phone_open`、`phone_scroll` 内部的检查;手机输入若要先把 iPhone Mirroring 切到前台,也会截一次。会记录截屏、或把截屏告诉聊天对方的 App,应当假定每次截取都会触发(未测试)。
120
133
 
121
134
  **首次成功路径:** `phone_status` → 若 `live` 不是 `true` 先 `phone_launch` → `phone_screenshot` → `phone_ocr` → `phone_find` + `phone_tap`。
122
135
 
123
- **已知限制:** 点击落在 OCR 识别到文字的位置,重复或识别错的标签可能点错(若 Spotlight 的「Top Hit」里是同名的联系人或网站,`phone_open` 分辨不出它不是 App);`phone_scroll` 用触控板式的滚动事件移动列表(竖向的 `phone_swipe` 拖拽不会滚动列表——它用于主屏翻页这类手势,起点放在 Dock 上方的空白带:起点落在 App 图标上的拖动会把图标拿起来挪走);在一套实测环境(iPhone 17 Pro Max 运行 iOS 27.0.1,Mac 运行 macOS 26.6.2)上,iPhone Mirroring 在所有 View 尺寸下都把手机画面画得比窗口大约 17%,右列和最底行被裁掉、无法点到;在显示器之间移动窗口、切换主屏、重开 App 都无效,主要怀疑是 iOS 27 与 macOS 26 版本错位——边缘附近点不中时先看 `phone_screenshot`;`phone_open` 把 App 名输入 Spotlight,只有当 Spotlight 的「Top Hit」卡片显示的正是这个名字时才点击(同名的网页建议、网站和设置行一律不点),否则回到主屏——它读的是 Spotlight 的英文 "Top Hit" 标签,iPhone 设为其他语言时找不到任何 App,除非用 `NORACU_TOPHIT_LABELS` 指定那个标签;`phone_home` / `phone_app_switcher` 在镜像在线时走 iPhone Mirroring 菜单(英文 macOS 下无需 python,仅在菜单项不存在时回退 `imctl` 手势,菜单超时返回 `menu_unknown` 而不补发第二次手势),且只报告指令已发送(`screen not verified`);`phone_type` 要求 Mac 键盘布局里 A 和 V 的位置与美式 QWERTY 相同(美式、ABC、拼音都满足;法式 AZERTY、Dvorak 不满足),否则返回 `keyboard_layout`,什么都不发。
136
+ **已知限制:** 点击落在 OCR 识别到文字的位置,重复或识别错的标签可能点错(若 Spotlight 的「Top Hit」里是同名的联系人或网站,`phone_open` 分辨不出它不是 App);`phone_scroll` 用触控板式的滚动事件移动列表(竖向的 `phone_swipe` 拖拽不会滚动列表——它用于主屏翻页这类手势,起点放在 Dock 上方的空白带:起点落在 App 图标上的拖动会把图标拿起来挪走;划动的两个点都会被限制在手机屏幕内,因为起点或终点落在屏幕外围透明窗口边框上的拖动会被 iOS 取消,被挪动的点会在结果里写明;点按或长按若落在这圈边框上——屏幕上方那一条放的是窗口自己的控件——会被拒绝并返回 `out_of_screen`;屏幕边界只截取窗口一次来测量,按窗口尺寸和 macOS 版本记在 `~/Library/Caches/noracu/phone-screen-rect.json` 里,指针停在那一条上时测到的结果不可信、不会采用,在测到干净结果之前,凡是落在窗口顶部或四周一圈(可能是边框的地方)的点:点按和长按会被拒绝,划动的点会被往里挪,结果里都会写明);在一套实测环境(iPhone 17 Pro Max 运行 iOS 27.0.1,Mac 运行 macOS 26.6.2)上,iPhone Mirroring 在所有 View 尺寸下都把手机画面画得比窗口大约 17%,右列和最底行被裁掉、无法点到;在显示器之间移动窗口、切换主屏、重开 App 都无效,主要怀疑是 iOS 27 与 macOS 26 版本错位——边缘附近点不中时先看 `phone_screenshot`;`phone_open` 把 App 名输入 Spotlight,只有当 Spotlight 的「Top Hit」卡片显示的正是这个名字时才点击——若 Spotlight 把搜索框放在顶部、没有「Top Hit」卡片(iOS 27 上见过),则只在搜索框把这个名字补全成「<名字> — Open」时才点(同名的网页建议、网站和设置行一律不点),否则回到主屏——它读的是 Spotlight 的英文 "Top Hit" 标签,iPhone 设为其他语言时找不到任何 App,除非用 `NORACU_TOPHIT_LABELS` 指定那个标签(顶部搜索框布局里的「Open」补全只认英文,`NORACU_TOPHIT_LABELS` 管不到它);`phone_home` / `phone_app_switcher` 在镜像在线时走 iPhone Mirroring 菜单(英文 macOS 下无需 python,仅在菜单项不存在时回退 `imctl` 手势,菜单超时返回 `menu_unknown` 而不补发第二次手势),且只报告指令已发送(`screen not verified`);`phone_type` 要求 Mac 键盘布局里 A 和 V 的位置与美式 QWERTY 相同(美式、ABC、拼音都满足;法式 AZERTY、Dvorak 不满足),否则返回 `keyboard_layout`,什么都不发;手机经「通用剪贴板」读取 Mac 的剪贴板,新内容要过一会儿才通知到手机,所以 `phone_type` 在写入剪贴板后至少等 1.5 秒再发 ⌘V(这期间若有别的 App 切到前台,就返回 `focus_lost`,不发 ⌘V)——一次真机测试中,写入后约 0.5 秒就发出的 ⌘V 贴出了手机自己的旧剪贴板(上一次粘贴的内容),粘贴也可能在手机显示「Pasting from …」后中断;收到 `type_not_confirmed` 后,先读输入框再重打。
137
+
138
+ ### XCUITest 后端(实验性,需显式开启)
139
+
140
+ 在 iPhone 层打开(`NORACU_LAYERS` 写了 `iphone`)的前提下,设置 `NORACU_PHONE_BACKEND=xcuitest` 后,noracu 列出 9 个 `ios_*` 工具,取代 `phone_*`。它们不经过 iPhone Mirroring 窗口:一个很小的 UI 测试包("runner"——Swift,MIT,源码在 `ios-runner/`)跑在 iPhone 上,一次执行一条指令。agent 读取 App 自己的辅助功能元素(`ios_snapshot`),按 `element_index` 动作(`ios_tap`、`ios_type`),坐标是屏幕点而不是 OCR 位置。App 按 bundle id 打开(`ios_launch`);文字以键盘输入的方式打进去,不经过剪贴板,只有事后读到接收文字的那个文本框的内容正好是原来的内容加上这段文字、且加在一处(至少 4 个字符),`ios_type` 才报 `delivered_verified`。
141
+
142
+ **要求:** Xcode(完整版);一个用来给 runner 签名的 Apple 开发者 team;一台已与本机配对、开了开发者模式的 iPhone——用数据线或同一局域网均可——或者一台已启动的模拟器。使用这些工具时 **iPhone 必须是解锁状态**(与 iPhone Mirroring 相反,后者要求锁屏):锁着的手机返回 `device_locked`:不发任何输入,也不读快照或截图。
143
+
144
+ **每台设备做一次的准备:** `npx noracu ios-setup --team <TeamID>` 把 runner 构建到 `~/.noracu/ios-runner/<udid>`(连着多台 iPhone 时加 `--udid`;模拟器只需要 `--udid`)。这是一条要你自己运行的命令——安装时什么都不会构建——也是这个后端唯一会联网的一步:Xcode 用你的 team 给 runner 签名,可能为它创建一份开发用描述文件;只有加了 `--register-device` 才会把 iPhone 登记到 team 里。之后用 `NORACU_PHONE_BACKEND=xcuitest` 启动 server。升级 noracu 之后,如果调用返回 `runner_version_mismatch`,就重新运行一次这条命令:用别的版本的源码构建的 runner 不会被使用。
145
+
146
+ **首次成功路径:** `ios_status` → `ios_launch`(`com.apple.Preferences`)→ `ios_snapshot` → 按 `element_index` 调 `ios_tap` 或 `ios_type` → 再 `ios_snapshot`。第一个需要用到手机的调用会启动 runner(iPhone 16 Pro 上约 9 秒;模拟器热了之后约 2 秒,刚启动时接近半分钟);需要先启动 runner 的输入调用什么都不发,因为 runner 自己的 App 会切到前台——先用 `ios_snapshot` 看。server 退出时会把 runner 停掉。
147
+
148
+ **与 Mirroring 后端的区别:** 给的是带 `element_index` 的元素,而不是 OCR 文字;索引在使用前会复核(元素移动了、变了,或它的 App 不在前台了,就返回 `element_no_longer_valid`),`ios_home` 和 `ios_launch` 会让之前的索引全部失效;App 用 bundle id 指名,noracu 只知道调用里指名的那个 App 是否在前台。`NORACU_STOP_FILE`、`NORACU_DENY_APPS`、`NORACU_APPROVAL_FILE` 照常生效——按 iOS 的 bundle id 匹配;默认的禁用名单只列了 Mac 上的应用(终端应用和自带终端的 IDE),所以默认不会挡住任何 iOS App;有 App 规则生效时(`NORACU_APPROVAL_FILE` 或你自己的 `NORACU_DENY_APPS`),指向主屏幕(`com.apple.springboard`)的输入一律拒绝,即使它列在 `allow` 里(打开已批准的 App 请用 `ios_launch`)——`NORACU_USER_IDLE_S` 不生效,因为这些工具不使用 Mac 的键盘和鼠标。iPhone 上弹着系统提示(权限弹窗)时,指向 App 的输入一律不发(`system_alert`),由人在手机上处理。
149
+
150
+ **隐私:** `ios_snapshot` 和 `ios_screenshot` 会把 App 上显示的内容——消息、通知、一次性验证码——交给你的 MCP client 和它所用的模型,和 Mirroring 后端一样。在 `NORACU_READ_ONLY=1` 下,这个后端只回答 `ios_status`:所有手机输入都会被拒绝,`ios_snapshot` / `ios_screenshot` 返回 `runner_not_started`——读屏幕需要 runner,而启动 runner 会把它自己的 App 切到前台,盖住手机上原来的画面。
151
+
152
+ **测试环境:** iPhone 16 Pro(iOS 27.2)与 iPhone 17 Pro 模拟器(iOS 26.5),Xcode 27.2,在「设置」和主屏幕上测过。真机上每次输入因为要查锁屏状态会多花约 0.8 秒;距上次检查超过 1 秒的快照或截图也一样。没测过的情况写在 CHANGELOG 的 Known issues 里;这个后端的风险见 [SECURITY.md](SECURITY.md)。
124
153
 
125
154
  ## 环境变量
126
155
 
127
156
  | 变量 | 默认 | 作用 |
128
157
  |---|---|---|
129
- | `NORACU_READ_ONLY` | 未设 | `=1` 只观察模式:默认拒绝的白名单仅 18 个观察 + 浏览器生命周期工具;所有 click/type/paste/key/eval 类工具被拒(`mac_clipboard_read`、`mac_notifications` 以及 `condition: "notification"` 的 `mac_wait` 也被拒;`mac_ax_state` / `mac_find` 也不开启 `web_accessibility`) |
130
- | `NORACU_DISABLE_EVAL` | 未设 | `=1` 让 `browser_evaluate`(任意 JS)被调用时报错(仍在列表中) |
158
+ | `NORACU_READ_ONLY` | 未设 | `=1` 只观察模式:默认拒绝的白名单只含观察 + 浏览器生命周期工具——8 个 `mac_*`、6 个 `browser_*`,开了 iPhone 层时再加 4 个观察类 `phone_*`(XCUITest 后端下换成 `ios_status`、`ios_snapshot`、`ios_screenshot`;`ios_snapshot`、`ios_screenshot` 会以 `runner_not_started` 被拒,因为只观察模式不启动 runner);所有 click/type/paste/key/eval 类工具被拒(`mac_clipboard_read`、`mac_notifications` 以及 `condition: "notification"` 的 `mac_wait` 也被拒;`mac_ax_state` / `mac_find` 也不开启 `web_accessibility`) |
159
+ | `NORACU_ENABLE_EVAL` | 未设 | `=1` 开启 `browser_evaluate`(在页面里跑任意 JS);未设时调用返回 `eval_disabled`(仍在列表中) |
160
+ | `NORACU_DISABLE_EVAL` | 未设 | `=1` 即使设了 `NORACU_ENABLE_EVAL=1` 也让 `browser_evaluate` 保持关闭(熔断开关) |
131
161
  | `NORACU_ALLOW_FILE_URL` | 未设 | `=1` 允许 `browser_navigate` 打开 `file://` URL(默认封禁) |
132
162
  | `NORACU_DISABLE_AUTO_INSTALL` | 未设 | `=1` 跳过首次 `browser_launch` 的 Chromium 自动安装 |
163
+ | `NORACU_ALLOW_CHROME` | 未设 | `=1` 允许 `browser_launch` 带 `chrome: true` 在你自己的 Chrome 里干活、用它的登录态:走 Chrome 自带的远程调试开关(`chrome://inspect/#remote-debugging`,Chrome 144 起;每次连接 Chrome 都会弹窗问你)。noracu 在里面开一个自己的窗口,只在它自己开的标签里干活;`NORACU_READ_ONLY=1` 下拒绝 |
164
+ | `NORACU_CHROME_TABS` | 未设(只碰 noracu 自己的标签) | `all`:带 `chrome: true` 时,你自己的其他标签也会列出来,可以选中、读取和操作(只限 http(s) 页面);只关 noracu 自己开的标签 |
165
+ | `NORACU_CHROME_DIR` | `~/Library/Application Support/Google/Chrome` | `chrome: true` 读取 `DevToolsActivePort` 文件的资料目录(Chrome Beta、Canary 或其他 Chromium 系浏览器) |
133
166
  | `NORACU_ALLOW_CDP` | 未设 | `=1` 允许 `mac_app` 带 `cdp_port` 启动,并允许 `browser_launch` 连接由本 `noracu` 进程打开的 `cdp_port`(需对应 PID 存活且 `webSocketDebuggerUrl` 一致);`=any` 还允许 `browser_launch` 连接 127.0.0.1 上的任意外部 DevTools 端口(在 `NORACU_READ_ONLY=1` 下始终拒绝) |
134
167
  | `NORACU_TRACE` | 未设 | 一个文件路径:每次工具调用写一行 JSON(`{ts, tool, args, ms, error, code}`——仅记录参数名与长度及错误码前缀,从不记录参数文本、结果文本或错误详情;以 `0600` 和 `O_NOFOLLOW` 打开,拒绝符号链接) |
135
168
  | `NORACU_CLICLICK` | `/opt/homebrew/bin/cliclick` | cliclick 二进制路径 |
@@ -138,6 +171,16 @@ noracu 可以经 Apple 的 **iPhone Mirroring** 操作真实 iPhone。agent 在
138
171
  | `NORACU_PHONE_TIMEOUT_MS` | 30000(`phone_open` / `phone_type` 为 45000) | iPhone 层每一步的时限,1000–600000 毫秒;到时该步被终止并返回 `imctl_timeout` |
139
172
  | `NORACU_OCR_LANGUAGES` | `zh-Hans,en-US` | 识别 iPhone 画面的 OCR 语言及优先顺序(逗号分隔的 Vision 语言代码,如 `zh-Hant,en-US` 或 `en-US`;Vision 不支持的代码会被跳过并给出警告) |
140
173
  | `NORACU_TOPHIT_LABELS` | `Top Hit` | `phone_open` 要找的 Spotlight「Top Hit」分区标签,逗号分隔——iPhone 不是英文时,设成手机上实际显示的那个标签 |
174
+ | `NORACU_OCR_MIN_CONFIDENCE` | 未设(关闭) | 可选、实验性:大于 0 且不超过 1 的数。设了以后,`phone_open` 不点识别置信度低于它的 Spotlight 标签,返回 `open_not_confirmed`、什么都不点;设了但不是这样的数,`phone_open` 会直接拒绝(`invalid_args`,什么都不发)。不管设没设,`phone_open` 的结果行都会写出所点标签的识别置信度 |
175
+ | `NORACU_USER_IDLE_S` | `2` | Mac 或 iPhone 输入工具动作前,键盘和鼠标须已空闲的秒数(noracu 自己的输入不算);不到就返回 `user_active`、什么都不发。不为 0 时,物理点击、拖动、滚动和手机手势之后指针还会回到原处,除非这期间有人动过它。取值 0–60;`0` 两项都关(专给 agent 用的 Mac);其他值按 2 处理。`ios_*` 工具不等待:它们不使用这台 Mac 的键盘和鼠标 |
176
+ | `NORACU_NO_BGPOST` | 未设 | `=1` 关闭后台输入:物理点击和具名按键像 0.2.7 一样走真实指针和 HID 按键路径 |
177
+ | `NORACU_PHONE_BACKEND` | `mirror` | 设为 `xcuitest` 时列出 `ios_*` 工具(XCUITest 后端,实验性)而不是 `phone_*`;其他值按 `mirror` 处理,并在 stderr 上给出警告 |
178
+ | `NORACU_IOS_UDID` | 未设 | XCUITest 后端使用的 iPhone 或模拟器;连着多台 iPhone 时必须设置,模拟器始终需要 |
179
+ | `NORACU_IOS_RUNNER_DIR` | `~/.noracu/ios-runner` | `noracu ios-setup` 放置 runner 构建产物、server 查找它的目录 |
180
+ | `NORACU_LAYERS` | 未设(`mac,browser`) | 逗号分隔的 `mac`、`browser`、`iphone`:只列出这些层的工具,也只有它们能被调用——实验性的 iPhone 层只在写了 `iphone` 时才有(`NORACU_LAYERS=mac,browser,iphone`),`initialize` 的使用说明也只提它们(例如给只带 iPhone 工具的客户端入口设 `NORACU_LAYERS=iphone`);写了这三个以外的名字,server 启动即退出 |
181
+ | `NORACU_STOP_FILE` | 未设 | 一个文件路径:该文件存在期间,所有输入工具——Mac(`mac_*`)、iPhone(`phone_*`、`ios_*`)和浏览器输入(`browser_navigate`、`browser_click`、`browser_type`、`browser_fill`、`browser_press_key`、`browser_scroll`、`browser_evaluate`、`browser_tabs` 的 new/close)——都返回 `user_stopped`,什么都不发;观察类工具不受影响 |
182
+ | `NORACU_DENY_APPS` | 常见终端应用和自带终端的 IDE | 逗号分隔的 bundle id 或应用名(可用 `*` 和 `?` 通配),这些应用永不接收输入;列表是加在默认列表上的——留空保持默认列表,以 `none` 开头则去掉默认列表(只写 `none`:没有禁用名单;`none,com.example.app`:只禁这一个) |
183
+ | `NORACU_APPROVAL_FILE` | 未设 | 一个 JSON 文件 `{allow, ask, deny}`,内容是 bundle id / 应用名的匹配模式,权限须为 `0600` 且属于你本人;列在 `ask` 下或未列出的应用返回 `approval_required`;一旦设置,文件不存在、格式错误、是符号链接、有未知字段、组可读或属主不对时,拒绝一切 Mac 与 iPhone 输入(应用规则不管浏览器层);把它设成空值也一样,直到删掉或填上路径;`NORACU_STOP_FILE` 设成空值则拒绝一切输入,浏览器输入也在内 |
141
184
 
142
185
  ## 安全
143
186
 
@@ -149,18 +192,35 @@ noracu 以你 MCP client 的权限运行。它会在本机点击、输入、粘
149
192
 
150
193
  - **工具注解只是提示,不是权限。** 每个工具都报告四个 MCP 工具注解(`readOnlyHint`、`destructiveHint`、`idempotentHint`、`openWorldHint`),按工具实际行为标注——见 [docs/tools.md](docs/tools.md)。客户端可以据此决定哪些操作先问你;它们不限制任何事,而且按 noracu 应答的 2024-11-05 协议工作的客户端可能直接忽略。它们也不等同于 `NORACU_READ_ONLY=1`:`mac_clipboard_read` 按行为是只读,但在该模式下被拒;`browser_navigate` 在该模式下允许,却不是只读。
151
194
  - **`NORACU_READ_ONLY=1`** 是安全的首次运行模式。它拒绝不在 18 项白名单内的一切工具(观察类 + 独立的 `browser_launch`/`browser_navigate`/`browser_close`;即使设了 `NORACU_ALLOW_CDP`,带 `cdp_port` 的 `browser_launch` 也会被拒);所有 click/type/paste/eval 被拒,`mac_clipboard_read`、`mac_notifications` 和 `condition: "notification"` 的 `mac_wait` 也被拒,且 `mac_ax_state` 与 `mac_find` 不会在目标应用上开启 `web_accessibility`。`browser_navigate` 在白名单内,仍会加载 URL。
152
- - **`NORACU_DISABLE_EVAL=1`** 让 `browser_evaluate` 被调用时报错(仍列在 `tools/list` 中)。snapshot、click、type 保留。
153
- - **`file://` 被拒**,除非 `NORACU_ALLOW_FILE_URL=1`,这样浏览器 agent 无法通过导航到 `~/Documents` 来读本地文件。(仅校验初始导航 URL;重定向不校验——见 SECURITY.md。)
195
+ - **`browser_evaluate` 默认关闭。** 它能在页面里跑任意脚本,所以除非 server 启动时设了 `NORACU_ENABLE_EVAL=1`,否则返回 `eval_disabled`;设了 `NORACU_DISABLE_EVAL=1` 时即使开启也照样关闭。它仍列在 `tools/list` 中。snapshot、click、type 保留。
196
+ - **`file://` 被拒**,除非 `NORACU_ALLOW_FILE_URL=1`,这样浏览器 agent 无法通过导航到 `~/Documents` 来读本地文件。(导航中浏览器自己可能跟随重定向,但之后的每次工具调用、以及进行中的读取和快照,都会重新检查当前页的地址,不合规则就拒绝——见 SECURITY.md。)
154
197
  - **焦点守卫:** 给 `mac_paste` / `mac_key`(以及以按键方式输入时的 `mac_type`)传 `app`,当该应用不在最前时输入被拒。不传 `app` 则守卫关闭。`mac_type` 默认走辅助功能写入指定元素或该应用的焦点元素,根本不发按键;只有焦点是辅助功能写不进的文本视图(如终端)时才退回到发按键,焦点是按钮、列表或 sheet 时不会;应用报告没有焦点元素时,只有 `app` 指明该应用才发按键(否则返回 `no_focus`,什么都不发)。
155
198
  - **失效元素保护:** `element_index` 不是坐标。它 30 秒后过期;Mac 上的索引不会被之后的快照复用。Mac 元素只在它被看到的那个窗口或打开的菜单里重新识别(按窗口 ID),并且要在窗口里的同一位置、同样的有名祖先之下、同一表格行中;没有名称也没有标识符的元素必须仍在原处。用 `surface: "app"` 读到的元素同样绑定所在窗口的 ID;没有窗口 ID 的窗口(Finder 桌面除外)一律以 `policy_denied` 拒绝,所以关掉再重开的同内容窗口不会继承旧索引。browser 点击重校验 tag/name/href/位置。否则返回 `element_no_longer_valid`。
156
199
  - **物理点击前做命中检测:** 必须用指针的 Mac 点击或拖动,只有该点上的元素就是目标时才发送——辅助功能无法判断时,要求该点最上层的屏幕窗口正是元素所在的同一个窗口(按窗口 ID,未被同一应用的另一个窗口遮挡);否则返回 `occluded` 并说明上面是什么。点击发出前会再查一次该点最上层的窗口;发出后,只有元素仍在、状态有变化、且该点最上层仍是元素自己的窗口,结果才是 `delivered_verified`。按原始坐标 x,y 点击时,只有该点最上层的屏幕窗口属于 `app`(默认为前台应用;菜单栏算前台应用的)才发送;`force: true` 跳过这项检查。这样的点击之后再敲的键,只在元素所在应用确实位于前台时才发送。
157
200
  - **后台窗口:** 语义 Mac 动作对你没在看的窗口同样有效。这正是目的(不抢焦点),但也意味着 agent 可能在你看不到的地方动作——留意结果里的 `delivery`,高风险应用请先关掉。
201
+ - **后台点击与按键(bgpost):** 在 `mechanism: "auto"` 下,对原生应用的物理点击、以及发给位于前台的原生应用的具名按键,会直接投递到该应用的进程——指针不动,你可能看不到它发生。网页引擎应用(Chromium/Electron)和 `mechanism: "physical"` 用真实指针;结果里的 `route` 写明走了哪条路。投递出去的点击绝不会换一条路再发一次:看不到变化报 `delivered_unverified`,超时报 `delivery=unknown`。`NORACU_NO_BGPOST=1` 可关闭此功能。
202
+ - **停止、拒绝、审批:** `NORACU_STOP_FILE` 指定的文件存在期间,所有输入工具都返回 `user_stopped`,什么都不发——Mac(`mac_*`)、iPhone(`phone_*`、`ios_*`)和浏览器输入(`browser_navigate`、`browser_click`、`browser_type`、`browser_fill`、`browser_press_key`、`browser_scroll`、`browser_evaluate`、`browser_tabs` 的 new/close);观察类工具不受影响(`touch` 该文件即停,删掉即恢复)。`NORACU_DENY_APPS` 列出永不接收输入的应用——默认是常见终端应用(Terminal、iTerm2、WezTerm、Ghostty、Warp、Alacritty、kitty、Hyper)和自带终端的 IDE(VS Code、Cursor、Windsurf、Zed、JetBrains 系 IDE、Android Studio,含预览版和每夜版;名字 `Code` 和 `com.jetbrains.*` 也会拦下恰好叫 Code 的应用和 JetBrains Toolbox),防止 agent 往这些 shell 里打字(其他能跑 shell 的应用不在列表里);你自己的列表会加在它上面,以 `none` 开头则去掉它。`NORACU_APPROVAL_FILE`(需显式开启)指向一个权限为 `0600` 的 JSON 文件 `{ "allow": [...], "ask": [...], "deny": [...] }`,内容是 bundle id 或应用名的匹配模式:列在 `ask` 下或未列出的应用返回 `approval_required`,noracu 从不写这个文件;一旦设置了该变量,文件不存在或损坏时拒绝一切 Mac 与 iPhone 输入(浏览器层不按应用规则判断,停止文件能停住它)。只要其中一条规则生效,读不到 bundle id 的应用什么都收不到。每项检查都按接收输入的那个应用判断——元素所属的应用、指定的应用,或 x,y 点上最上层的应用——无法识别是哪个应用时什么都不发。这些文件挡的是模型,挡不住以你的身份运行的其他软件:见 SECURITY.md。
158
203
  - **危险按键、菜单与退出受保护:** `mac_key` 拒绝退出 / 注销 / 锁屏 / 强制退出 / 立即删除 / 清空废纸篓类组合键,除非 `force: true`;`mac_menu_command` 对菜单快捷键应用同一列表,且拒绝苹果菜单项,除非 `force: true`。`mac_app` 和 `mac_menu_command` 都从不退出 Finder、Dock、loginwindow 等会话进程和 MCP 宿主本身;`mac_app` 强制退出需要 `force: true`。
159
- - **DevTools 端口需显式开启:** `mac_app` / `browser_launch` 带 `cdp_port` 需要 `NORACU_ALLOW_CDP=1`(连接非 `noracu` 自己打开的端口需 `NORACU_ALLOW_CDP=any`;`NORACU_READ_ONLY=1` 下始终拒绝),只绑定 127.0.0.1,规范化 `.app` 路径并拒绝已在运行的应用,且在 `~/.noracu/cdp-profiles` 下给 Chrome 系浏览器单独的 `0700` profile。端口打开期间,任何本地进程都能控制该应用(127.0.0.1 没有按用户隔离)。
204
+ - **用你自己的 Chrome 需显式开启:** `browser_launch` 带 `chrome: true` 需要 `NORACU_ALLOW_CHROME=1`,以及 Chrome 自带的远程调试开关(`chrome://inspect/#remote-debugging`);每次连接 Chrome 都会弹窗问你,连着时页面顶部有横幅。noracu 会在你的 Chrome 里开一个自己的窗口,只列出、读取和操作它自己开的标签(以及这些标签再打开的标签);noracu 不列出、不读取、不操作你的其他标签(除非另设 `NORACU_CHROME_TABS=all`:那时你停在 http(s) 页面上的标签也会列出来,可以选中、读取和操作——`file://` 和浏览器自带页面不算,不管 `NORACU_ALLOW_FILE_URL` 怎么设;它们不会被关闭,也不会被导航到非 http(s) 地址;只有选中后才成为当前页,离开 http(s) 就不再是当前页);noracu 自己的标签照旧按网址规则(只认 http(s);`file://` 要 `NORACU_ALLOW_FILE_URL=1`)。这些标签带着你的登录态,agent 在里面操作就等于以你的身份在这些网站上操作;`browser_evaluate` 在这里一律不跑。`browser_close` 关掉 noracu 的标签并断开;noracu 从不退出 Chrome。`NORACU_READ_ONLY=1` 下拒绝。
205
+ - **DevTools 端口需显式开启:** `mac_app` / `browser_launch` 带 `cdp_port` 需要 `NORACU_ALLOW_CDP=1`(连接非 `noracu` 自己打开的端口需 `NORACU_ALLOW_CDP=any`;`NORACU_READ_ONLY=1` 下始终拒绝),只绑定 127.0.0.1,规范化 `.app` 路径,拒绝已在运行的应用和应用规则(拒绝名单、审批文件)不允许的应用,且在 `~/.noracu/cdp-profiles` 下给 Chrome 系浏览器单独的 `0700` profile。端口打开期间,任何本地进程都能控制该应用(127.0.0.1 没有按用户隔离)。
160
206
  - **剪贴板、密码框和通知属于隐私:** `mac_paste` 会把用户原来的剪贴板(所有条目和类型)放回去,且从不复制密码管理器标记为隐藏的内容——粘贴后改为清空剪贴板;`mac_clipboard_read` 从不返回隐藏内容;`mac_set_value` 作用于安全密码框(`AXSecureTextField`)时从不回显值;`mac_notifications` 原样返回通知文字。`mac_clipboard_read`、`mac_notifications` 以及等待通知的 `mac_wait` 在只读模式下均被拒绝。
161
207
  - **iPhone 画面就是模型输入:** `phone_screenshot` / `phone_ocr` / `phone_find` 会返回手机上显示的一切——通知、短信、一次性验证码。请用专注模式和无关紧要的 App,并先用 `NORACU_READ_ONLY=1`(允许观察手机、拒绝手机输入)。镜像不在线(`mirror_not_live`)或状态无法读取(`mirror_state_unknown`)时,手机输入同样会被拒绝。
162
208
  - **防注入 JXA 与 stdin 传参:** 辅助功能引擎(`src/mac-ax.js`)是静态脚本,整条请求以 JSON 从 stdin 传入——参数只是数据,从不成为脚本源码——且 `mac_type`(默认路径)、`mac_set_value`、`mac_paste` 以及 `phone_type` / `phone_find` / `phone_open` 都经 stdin 传入文字,不会出现在进程列表里(`imctl type` 也不回显文字)。有回归测试覆盖。
163
209
 
210
+ **默认拒绝的事**——被拒的输入什么都不发,报错里会写明(`delivery=not_delivered, retry=safe`):
211
+
212
+ | 默认拒绝 | 返回 | 怎么改 |
213
+ |---|---|---|
214
+ | 往终端和自带终端的 IDE 里输入 | `input_denied` | `NORACU_DENY_APPS`(以 `none` 开头去掉默认列表) |
215
+ | `browser_evaluate`(在页面里跑任意脚本) | `eval_disabled` | `NORACU_ENABLE_EVAL=1` |
216
+ | 浏览器打开 `file://` 页面 | 在 URL 上拒绝 | `NORACU_ALLOW_FILE_URL=1` |
217
+ | DevTools 端口(`cdp_port`) | 拒绝 | `NORACU_ALLOW_CDP=1` |
218
+ | 在你自己的 Chrome 里干活(`browser_launch` 带 `chrome: true`) | `policy_denied` | `NORACU_ALLOW_CHROME=1`,并在 `chrome://inspect/#remote-debugging` 打开 Chrome 的开关 |
219
+ | iPhone 工具 | 不列出;调用时返回 `unknown tool … the iphone layer is off` | `NORACU_LAYERS=mac,browser,iphone` |
220
+ | 你在用键盘或鼠标时的 Mac 输入和 iPhone Mirroring 输入 | `user_active` | `NORACU_USER_IDLE_S=0` |
221
+ | 退出、注销、锁屏、强制退出、立即删除、清倒废纸篓的快捷键;苹果菜单里的项 | 拒绝 | `force: true` |
222
+ | 停止文件存在期间的所有输入——前提是你用 `NORACU_STOP_FILE` 指定了一个 | `user_stopped` | 删掉该文件 |
223
+
164
224
  这些开关不会让被观察的内容变得可信。截图文字、accessibility 名称、页面内容都是喂给你模型的**不可信输入**——别让它们覆盖任务指令。完整威胁模型与逐条状态见 [SECURITY.md](SECURITY.md)(英文)。
165
225
 
166
226
  ## 工具与文档
@@ -171,7 +231,6 @@ noracu 以你 MCP client 的权限运行。它会在本机点击、输入、粘
171
231
 
172
232
  ## 路线图
173
233
 
174
- - Browser:tab 管理(list / select / close)
175
234
  - 动作词汇(browser):`hover`、`set_value`、`wait_for`
176
235
  - 测量 `skeleton` + `root` 下钻相对完整快照的 token 消耗
177
236
  - 菜单栏时钟不对辅助功能可见时,也能打开通知中心的历史列表