noracu 0.1.3 → 0.1.4
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 +74 -0
- package/README.md +9 -2
- package/README.zh-CN.md +9 -2
- package/docs/tools.md +5 -5
- package/docs/usage.md +21 -8
- package/imctl/README.md +4 -4
- package/imctl/src/imctl/cli.py +177 -11
- package/imctl/src/imctl/gestures.py +292 -71
- package/imctl/src/imctl/input.py +113 -10
- package/imctl/src/imctl/verify.py +39 -0
- package/imctl/src/imctl/vision.py +55 -4
- package/imctl/src/imctl/window.py +51 -6
- package/package.json +1 -1
- package/src/server.mjs +279 -64
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,79 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.4] — 2026-11-05
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- `phone_open` only taps an exact label inside Spotlight's Top Hit card. A web
|
|
7
|
+
suggestion, website or Settings row with the same name could be tapped
|
|
8
|
+
before: in testing, opening "Pinduoduo" opened a Chrome search and reported
|
|
9
|
+
success. A name the Top Hit card does not show now returns app not found —
|
|
10
|
+
use the label the phone shows under the icon (e.g. `拼多多`). The error says
|
|
11
|
+
whether a Top Hit was seen at all. `phone_open` reads Spotlight's English
|
|
12
|
+
"Top Hit" label; for an iPhone set to another language, set
|
|
13
|
+
`NORACU_TOPHIT_LABELS` to the label it shows. When tapping the label
|
|
14
|
+
does nothing, the icon is tapped only above where the label is now, not where
|
|
15
|
+
it was a moment earlier. `phone_open` also keeps its own time budget and goes
|
|
16
|
+
back to the Home Screen when it runs out, or when it is stopped or hits its
|
|
17
|
+
time limit, instead of leaving Spotlight open, and says so when it could not
|
|
18
|
+
get back.
|
|
19
|
+
- OCR reads Chinese. Vision ran English-first and returned almost no Chinese
|
|
20
|
+
text, so Chinese app names, `phone_find` and `expect` checks failed; Chinese
|
|
21
|
+
and English are now both read. `NORACU_OCR_LANGUAGES` sets other languages
|
|
22
|
+
(unsupported codes are skipped).
|
|
23
|
+
- `phone_launch` never clicks through a setup or welcome screen. After a
|
|
24
|
+
macOS 27 upgrade, iPhone Mirroring's welcome screen was reported as a paused
|
|
25
|
+
session, `phone_launch` said to lock the iPhone, and a lone button there
|
|
26
|
+
would have been clicked as if it were Resume. noracu now reports
|
|
27
|
+
`mirror_setup_required` and leaves the screen to you, and `phone_status` adds
|
|
28
|
+
a `setup` field. A paused mirror is still resumed in portrait or landscape.
|
|
29
|
+
- A stuck iPhone-layer subprocess can no longer freeze the server. iPhone
|
|
30
|
+
commands, including the menu commands behind `phone_home` and
|
|
31
|
+
`phone_app_switcher`, now run asynchronously under a time limit: on expiry
|
|
32
|
+
the command and everything it started are stopped, the call returns
|
|
33
|
+
`imctl_timeout` at once, and other requests — including `ping` — keep being
|
|
34
|
+
answered. `phone_open` and `phone_type` get 45 seconds (was 30);
|
|
35
|
+
`NORACU_PHONE_TIMEOUT_MS` sets another limit. A slow first check for the
|
|
36
|
+
iPhone driver's Python no longer disables the iPhone layer until restart.
|
|
37
|
+
- Phone and Mac actions run one at a time, in the order they arrive, even when
|
|
38
|
+
an MCP client sends tool calls in parallel, so taps, typing and the clipboard
|
|
39
|
+
of two calls never interleave. A queued action the client cancels, or one that
|
|
40
|
+
waited more than 60 seconds (`input_busy`), is dropped without acting, and the
|
|
41
|
+
server stops its iPhone-layer processes when it exits.
|
|
42
|
+
- `phone_type` keeps watching up to 15 more seconds for a paste that lands late
|
|
43
|
+
before reporting `type_not_confirmed`, and then says to read the screen before
|
|
44
|
+
retrying: retrying after a late paste typed the text twice. The text must be
|
|
45
|
+
seen in two consecutive screen reads.
|
|
46
|
+
- `phone_type` no longer reports `typed` while the iPhone is still fetching a
|
|
47
|
+
slow paste: the "Pasting from …" box the phone shows meanwhile was taken for
|
|
48
|
+
the text arriving. While that box shows, the paste does not count; the
|
|
49
|
+
15-second check above then confirms it from the text itself, or the result is
|
|
50
|
+
`type_not_confirmed`. The box is recognized on an iPhone set to English.
|
|
51
|
+
- A paste can reach the iPhone seconds after it was sent (from 1.5 s to more
|
|
52
|
+
than 10 s on the test device). When `phone_open` does not see the name arrive,
|
|
53
|
+
it keeps reading Spotlight for up to 15 seconds, and if the name never shows up
|
|
54
|
+
it reports `open_not_confirmed` (retry) instead of app not found.
|
|
55
|
+
- `phone_open` right after another successful `phone_open` no longer fails. On
|
|
56
|
+
iOS 27, going Home from an app that was opened from Spotlight lands back in
|
|
57
|
+
Spotlight, and the Spotlight command then closed it, so the name was pasted
|
|
58
|
+
onto the Home Screen.
|
|
59
|
+
- `phone_screenshot` deletes its temporary image on every path, including
|
|
60
|
+
timeouts.
|
|
61
|
+
|
|
62
|
+
### Security
|
|
63
|
+
- `phone_type` no longer gives your clipboard back just because the typed text
|
|
64
|
+
was already somewhere on the screen (for example a search-history entry with
|
|
65
|
+
the same words). It now counts the text before pasting and restores your
|
|
66
|
+
clipboard only when two screen reads afterwards both show it more often; until
|
|
67
|
+
then the clipboard keeps the typed text. Before, a paste that the phone read
|
|
68
|
+
late could have pasted your original clipboard contents instead.
|
|
69
|
+
- `phone_open` no longer gives your clipboard back after pasting the app name:
|
|
70
|
+
the name can reach the iPhone seconds after it was sent, and a restore before
|
|
71
|
+
then could paste your previous clipboard into Spotlight. The clipboard keeps
|
|
72
|
+
the app name.
|
|
73
|
+
- `phone_type` never gives your clipboard back while the iPhone still shows its
|
|
74
|
+
"Pasting from …" box: a paste is still on its way then and could fetch your
|
|
75
|
+
restored clipboard. The words in that box never count as the typed text.
|
|
76
|
+
|
|
3
77
|
## [0.1.3] — 2026-11-04
|
|
4
78
|
|
|
5
79
|
### Fixed
|
package/README.md
CHANGED
|
@@ -89,6 +89,10 @@ Then **quit the host app completely (including any menu-bar icon) and reopen it.
|
|
|
89
89
|
| `browser_launch` hangs on first use | one-time Chromium download; or auto-install disabled (`NORACU_DISABLE_AUTO_INSTALL=1`) → run `npx playwright install chromium` |
|
|
90
90
|
| `phone_*` says `imctl unavailable: no python3 with pyobjc found` | install pyobjc for a python3 (`python3 -m pip install pyobjc-framework-Quartz pyobjc-framework-Vision pyobjc-framework-AppKit`; Homebrew python3 is the usual choice) or set `NORACU_PYTHON` — see [iPhone layer](#iphone-layer-experimental) |
|
|
91
91
|
| `phone_*` refused with `mirror_not_live: …` ("Connection Paused", "iPhone in Use") | the mirror is paused or the iPhone is unlocked — lock the iPhone, keep it near the Mac, then call `phone_launch` (it clicks Resume) |
|
|
92
|
+
| `phone_launch` says `mirror_setup_required` | iPhone Mirroring shows a setup or welcome screen (e.g. the first launch after a macOS upgrade) — finish it yourself in the iPhone Mirroring window; noracu never clicks through it |
|
|
93
|
+
| `imctl_timeout: phone … did not finish within …s` | the Mac is under heavy load or the system is stuck — the action may have partly run, so check `phone_status` / `phone_screenshot` before retrying (after `phone_open`, noracu goes back to the Home Screen); the server keeps answering other calls meanwhile |
|
|
94
|
+
| `input_busy: …` | an earlier phone or Mac action held the input queue for over 60 s; the call did nothing — retry |
|
|
95
|
+
| `phone_open` returns app not found for an installed app | it only taps the label in Spotlight's Top Hit card — use the name exactly as the phone shows it under the icon (e.g. `拼多多`, not `Pinduoduo`). "Spotlight showed no Top Hit" on an installed app usually means the iPhone's language is not English: `phone_open` reads Spotlight's "Top Hit" label — set `NORACU_TOPHIT_LABELS` to the label your iPhone shows. `open_not_confirmed: … never showed up on the phone` means the pasted name did not arrive (a paste can take several seconds to reach the iPhone) — retry. `phone_open` leaves the app name on the clipboard |
|
|
92
96
|
| Typed text comes out re-spaced (e.g. "no ra cu") | a CJK input method is active — use `mac_paste` instead of `mac_type` |
|
|
93
97
|
| `element_no_longer_valid` | the snapshot is older than 30 s or the UI changed — re-run `mac_ax_state` / `browser_snapshot` and use a fresh index |
|
|
94
98
|
|
|
@@ -106,13 +110,13 @@ noracu can operate a real iPhone through Apple's **iPhone Mirroring**. The agent
|
|
|
106
110
|
|
|
107
111
|
**Python:** the driver needs a python3 that imports pyobjc (Quartz, Vision, AppKit). Set `NORACU_PYTHON`, or noracu probes `/opt/homebrew/bin/python3`, `/usr/local/bin/python3`, `python3`, `/usr/bin/python3` once, on the first `phone_*` call. Apple's `/usr/bin/python3` usually lacks pyobjc; Homebrew's python3 plus `python3 -m pip install pyobjc-framework-Quartz pyobjc-framework-Vision pyobjc-framework-AppKit` is the common working setup.
|
|
108
112
|
|
|
109
|
-
**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")
|
|
113
|
+
**Mirror state:** `phone_status` reports `live` (the phone's screen is being streamed), `overlay` (the text iPhone Mirroring shows instead, e.g. "Connection Paused" or "iPhone in Use"), `paused` (that overlay offers a Resume button) and `setup` (a setup or welcome screen the user must finish — noracu never clicks it). Detection reads the window's structure and shape (the mirror is a tall or wide phone-shaped window; a setup screen is nearly square), not its text. While the mirror is not live, `phone_tap`, `phone_longpress`, `phone_swipe`, `phone_scroll`, `phone_type`, `phone_key` and `phone_open` refuse with `mirror_not_live` instead of tapping the overlay, and `phone_ocr` / `phone_find` start their output with a warning. The mirror pauses after inactivity; `phone_launch` brings it forward and clicks Resume.
|
|
110
114
|
|
|
111
115
|
**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.
|
|
112
116
|
|
|
113
117
|
**First success:** `phone_status` → `phone_launch` if `live` is not `true` → `phone_screenshot` → `phone_ocr` → `phone_find` + `phone_tap`.
|
|
114
118
|
|
|
115
|
-
**Known limits:** a tap goes where OCR saw the text, so repeated or misread labels can be hit wrong; `phone_scroll` moves lists with trackpad-style scroll events (a vertical `phone_swipe` drag does not scroll a list — use it for gestures such as Home Screen paging); on one tested setup (iPhone 17 Pro Max on iOS 27.0.1, Mac on macOS 26.6.2) iPhone Mirroring draws the phone about 17% larger than its window at every View size, so the right column and bottom row are cut off and cannot be reached; moving the window between displays, changing the main display and relaunching made no difference, and the iOS 27 / macOS 26 version mismatch is the main suspect — check `phone_screenshot` if taps near the edges miss; `phone_open` types the app name into Spotlight and taps
|
|
119
|
+
**Known limits:** a tap goes where OCR saw the text, so repeated or misread labels can be hit wrong (`phone_open` cannot tell an app from a contact or website that Spotlight's Top Hit shows under the same name); `phone_scroll` moves lists with trackpad-style scroll events (a vertical `phone_swipe` drag does not scroll a list — use it for gestures such as Home Screen paging); on one tested setup (iPhone 17 Pro Max on iOS 27.0.1, Mac on macOS 26.6.2) iPhone Mirroring draws the phone about 17% larger than its window at every View size, so the right column and bottom row are cut off and cannot be reached; moving the window between displays, changing the main display and relaunching made no difference, and the iOS 27 / macOS 26 version mismatch is the main suspect — check `phone_screenshot` if taps near the edges miss; `phone_open` types the app name into Spotlight and taps it only when Spotlight's Top Hit card shows exactly that name (web suggestions, websites and Settings rows of the same name are never tapped), otherwise returns to the Home Screen — it reads Spotlight's English "Top Hit" label, so on an iPhone set to another language it finds nothing until `NORACU_TOPHIT_LABELS` names that label; `phone_home` / `phone_app_switcher` use the iPhone Mirroring menu (English macOS) and work without python while connected.
|
|
116
120
|
|
|
117
121
|
## Environment variables
|
|
118
122
|
|
|
@@ -125,6 +129,9 @@ noracu can operate a real iPhone through Apple's **iPhone Mirroring**. The agent
|
|
|
125
129
|
| `NORACU_CLICLICK` | `/opt/homebrew/bin/cliclick` | cliclick binary path |
|
|
126
130
|
| `NORACU_PYTHON` | auto-probe | python3 used for the bundled iPhone driver; must import pyobjc (Quartz, Vision, AppKit). Unset → first working of `/opt/homebrew/bin/python3`, `/usr/local/bin/python3`, `python3`, `/usr/bin/python3` |
|
|
127
131
|
| `NORACU_IMCTL_DIR` | bundled `imctl/` | override the driver location (development only) |
|
|
132
|
+
| `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` |
|
|
133
|
+
| `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) |
|
|
134
|
+
| `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 |
|
|
128
135
|
|
|
129
136
|
## Security
|
|
130
137
|
|
package/README.zh-CN.md
CHANGED
|
@@ -89,6 +89,10 @@ Claude Code:`claude mcp add noracu -- /绝对路径/TO/node /绝对路径/nora
|
|
|
89
89
|
| 首次 `browser_launch` 卡住 | 一次性 Chromium 下载;或自动安装被关闭(`NORACU_DISABLE_AUTO_INSTALL=1`)→ 执行 `npx playwright install chromium` |
|
|
90
90
|
| `phone_*` 报 `imctl unavailable: no python3 with pyobjc found` | 给某个 python3 装 pyobjc(`python3 -m pip install pyobjc-framework-Quartz pyobjc-framework-Vision pyobjc-framework-AppKit`,通常选 Homebrew 的 python3)或设 `NORACU_PYTHON`——见[iPhone 层](#iphone-层实验性) |
|
|
91
91
|
| `phone_*` 被拒并报 `mirror_not_live: …`("Connection Paused"、"iPhone in Use") | 镜像已暂停或 iPhone 被解锁——锁上 iPhone、放在 Mac 旁,然后调用 `phone_launch`(会点击 Resume) |
|
|
92
|
+
| `phone_launch` 报 `mirror_setup_required` | iPhone Mirroring 正显示设置或欢迎页(例如升级 macOS 后首次启动)——请在 iPhone Mirroring 窗口里自己完成;noracu 从不替你点击这类页面 |
|
|
93
|
+
| `imctl_timeout: phone … did not finish within …s` | Mac 负载过高或系统卡住——操作可能已部分执行,重试前先看 `phone_status` / `phone_screenshot`(`phone_open` 超时后 noracu 会回到主屏幕);在此期间 server 仍会响应其他调用 |
|
|
94
|
+
| `input_busy: …` | 前一个手机或 Mac 操作占用输入队列超过 60 秒;本次调用什么都没做——重试即可 |
|
|
95
|
+
| 已安装的 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 可能要好几秒)——重试即可。`phone_open` 之后剪贴板里是 App 名字 |
|
|
92
96
|
| 输入的文本被重新空格化(如 "no ra cu") | 有 CJK 输入法在激活——用 `mac_paste` 代替 `mac_type` |
|
|
93
97
|
| `element_no_longer_valid` | 快照超过 30 秒或界面变了——重跑 `mac_ax_state` / `browser_snapshot` 并用新索引 |
|
|
94
98
|
|
|
@@ -106,13 +110,13 @@ noracu 可以经 Apple 的 **iPhone Mirroring** 操作真实 iPhone。agent 在
|
|
|
106
110
|
|
|
107
111
|
**Python:** 驱动需要一个能导入 pyobjc(Quartz、Vision、AppKit)的 python3。设置 `NORACU_PYTHON`,或由 noracu 在首次调用 `phone_*` 时依次探测一次 `/opt/homebrew/bin/python3`、`/usr/local/bin/python3`、`python3`、`/usr/bin/python3`。Apple 自带的 `/usr/bin/python3` 通常没有 pyobjc;常见可用配置是 Homebrew 的 python3 加 `python3 -m pip install pyobjc-framework-Quartz pyobjc-framework-Vision pyobjc-framework-AppKit`。
|
|
108
112
|
|
|
109
|
-
**镜像状态:** `phone_status` 返回 `live`(手机画面正在推流)、`overlay`(iPhone Mirroring 显示的替代文字,如 "Connection Paused"、"iPhone in Use"
|
|
113
|
+
**镜像状态:** `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` 会以 `mirror_not_live` 拒绝,而不是点到覆盖层上;`phone_ocr` / `phone_find` 的输出首行会给出警告。镜像闲置一段时间后会暂停;`phone_launch` 会把它置前并点击 Resume。
|
|
110
114
|
|
|
111
115
|
**隐私:** 手机上显示的一切——通知、短信、邮件、一次性验证码——都会变成工具输出,由你的 MCP client 发给它所用的模型。开始前打开专注模式、打开一个无关紧要的 App,并先用 `NORACU_READ_ONLY=1`(`phone_status`、`phone_screenshot`、`phone_ocr`、`phone_find` 仍可用;所有手机输入都会被拒绝)。iPhone Mirroring 设置好后,iPhone 的通知也会出现在 Mac 上。
|
|
112
116
|
|
|
113
117
|
**首次成功路径:** `phone_status` → 若 `live` 不是 `true` 先 `phone_launch` → `phone_screenshot` → `phone_ocr` → `phone_find` + `phone_tap`。
|
|
114
118
|
|
|
115
|
-
**已知限制:** 点击落在 OCR
|
|
119
|
+
**已知限制:** 点击落在 OCR 识别到文字的位置,重复或识别错的标签可能点错(若 Spotlight 的「Top Hit」里是同名的联系人或网站,`phone_open` 分辨不出它不是 App);`phone_scroll` 用触控板式的滚动事件移动列表(竖向的 `phone_swipe` 拖拽不会滚动列表——它用于主屏翻页这类手势);在一套实测环境(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。
|
|
116
120
|
|
|
117
121
|
## 环境变量
|
|
118
122
|
|
|
@@ -125,6 +129,9 @@ noracu 可以经 Apple 的 **iPhone Mirroring** 操作真实 iPhone。agent 在
|
|
|
125
129
|
| `NORACU_CLICLICK` | `/opt/homebrew/bin/cliclick` | cliclick 二进制路径 |
|
|
126
130
|
| `NORACU_PYTHON` | 自动探测 | 运行随包 iPhone 驱动的 python3;须能导入 pyobjc(Quartz、Vision、AppKit)。未设置时依次尝试 `/opt/homebrew/bin/python3`、`/usr/local/bin/python3`、`python3`、`/usr/bin/python3` |
|
|
127
131
|
| `NORACU_IMCTL_DIR` | 包内 `imctl/` | 覆盖驱动位置(仅开发用) |
|
|
132
|
+
| `NORACU_PHONE_TIMEOUT_MS` | 30000(`phone_open` / `phone_type` 为 45000) | iPhone 层每一步的时限,1000–600000 毫秒;到时该步被终止并返回 `imctl_timeout` |
|
|
133
|
+
| `NORACU_OCR_LANGUAGES` | `zh-Hans,en-US` | 识别 iPhone 画面的 OCR 语言及优先顺序(逗号分隔的 Vision 语言代码,如 `zh-Hant,en-US` 或 `en-US`;Vision 不支持的代码会被跳过并给出警告) |
|
|
134
|
+
| `NORACU_TOPHIT_LABELS` | `Top Hit` | `phone_open` 要找的 Spotlight「Top Hit」分区标签,逗号分隔——iPhone 不是英文时,设成手机上实际显示的那个标签 |
|
|
128
135
|
|
|
129
136
|
## 安全
|
|
130
137
|
|
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.
|
|
4
|
-
> noracu v0.1.
|
|
4
|
+
> noracu v0.1.4 · 35 tools
|
|
5
5
|
|
|
6
6
|
## Mac layer (computer-use)
|
|
7
7
|
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
|
|
45
45
|
| Tool | Arguments | Description |
|
|
46
46
|
|---|---|---|
|
|
47
|
-
| `phone_status` | — | EXPERIMENTAL. Needs iPhone Mirroring and a python3 with pyobjc. Return the iPhone Mirroring session status as JSON (running, window, onscreen, frontmost, live, overlay, paused). |
|
|
48
|
-
| `phone_launch` | — | EXPERIMENTAL. Needs iPhone Mirroring and a python3 with pyobjc. Ensure iPhone Mirroring is running, brought to the front, and clicks Resume when the connection is paused. |
|
|
47
|
+
| `phone_status` | — | EXPERIMENTAL. Needs iPhone Mirroring and a python3 with pyobjc. Return the iPhone Mirroring session status as JSON (running, window, onscreen, frontmost, live, overlay, paused, setup — true when a setup or welcome screen is showing that the user must finish). |
|
|
48
|
+
| `phone_launch` | — | EXPERIMENTAL. Needs iPhone Mirroring and a python3 with pyobjc. Ensure iPhone Mirroring is running, brought to the front, and clicks Resume when the connection is paused. Never clicks through a setup or welcome screen: reports mirror_setup_required instead. |
|
|
49
49
|
| `phone_screenshot` | — | EXPERIMENTAL. Needs iPhone Mirroring and a python3 with pyobjc. Screenshot the iPhone screen (the Mirroring window, captured by window id so it works even when covered). Fails with capture_failed instead of returning another window's pixels. |
|
|
50
50
|
| `phone_ocr` | — | EXPERIMENTAL. Needs iPhone Mirroring and a python3 with pyobjc. OCR the iPhone screen into text with coordinates. Fails with capture_failed instead of returning another window's pixels. |
|
|
51
51
|
| `phone_find` | text:string? | EXPERIMENTAL. Needs iPhone Mirroring and a python3 with pyobjc. Locate text on the iPhone screen. Fails with capture_failed instead of returning another window's pixels. |
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
| `phone_home` | — | EXPERIMENTAL. Go to the iPhone Home Screen via the iPhone Mirroring menu (works without python/pyobjc when the mirror is connected); falls back to an imctl swipe. |
|
|
56
56
|
| `phone_app_switcher` | — | EXPERIMENTAL. Open the iPhone App Switcher via the iPhone Mirroring menu (works without python/pyobjc when the mirror is connected); falls back to an imctl gesture. |
|
|
57
57
|
| `phone_scroll` | direction:string?, distance:number?, expect:string? | EXPERIMENTAL. Needs iPhone Mirroring and a python3 with pyobjc. Scroll up or down by `distance` window heights (0 < distance <= 3, default 0.5) using trackpad-style scroll events. Reports scroll_no_effect when the screen did not change (list end, or the view does not scroll). Optional expect: text that must be on screen (OCR) first, else nothing is sent. |
|
|
58
|
-
| `phone_type` | text:string?, replace:boolean?, expect:string? | EXPERIMENTAL. Needs iPhone Mirroring and a python3 with pyobjc. Type text via the clipboard (IME-safe). Restores the clipboard only after OCR sees the text
|
|
58
|
+
| `phone_type` | text:string?, replace:boolean?, expect:string? | EXPERIMENTAL. Needs iPhone Mirroring and a python3 with pyobjc. Type text via the clipboard (IME-safe). Restores the clipboard only after OCR sees the text appear (more often than before the paste) within its 2.5 s check; a paste that shows up a few seconds later is still reported as typed (do not type it again) but the clipboard keeps the typed text; otherwise type_not_confirmed, and the clipboard keeps the text. replace=true selects all and overwrites the field (over the same text nothing visibly changes, so that may report type_not_confirmed). Optional expect: on-screen text (OCR), else nothing is sent. |
|
|
59
59
|
| `phone_key` | key:string?, expect:string? | EXPERIMENTAL. Needs iPhone Mirroring and a python3 with pyobjc. Press a key: return, delete, up, down, left, or right. Optional expect: text that must be on screen (OCR) first, else nothing is sent. |
|
|
60
|
-
| `phone_open` | app:string? | EXPERIMENTAL. Needs iPhone Mirroring and a python3 with pyobjc. Open an app: Home Screen, Spotlight via the menu, clear, type the name,
|
|
60
|
+
| `phone_open` | app:string? | EXPERIMENTAL. Needs iPhone Mirroring and a python3 with pyobjc. Open an app: Home Screen, Spotlight via the menu, clear, type the name (the clipboard keeps it), then tap only an exact label inside the Spotlight Top Hit card (suggestion, website and Settings rows of the same name are ignored, so a name the Top Hit card does not show is app not found; reads the English "Top Hit" label unless NORACU_TOPHIT_LABELS names the phone's own; a pasted name that never shows up in Spotlight, even after up to 15 s, is open_not_confirmed — retry); confirms the app opened (frame diff + OCR), taps the Top Hit icon when the label tap does nothing, else open_not_confirmed, back on the Home Screen. |
|
|
61
61
|
|
package/docs/usage.md
CHANGED
|
@@ -176,6 +176,8 @@ model — don't let it override the task.
|
|
|
176
176
|
| `… blocked by NORACU_READ_ONLY=1` | you're in observation-only mode — unset it to act |
|
|
177
177
|
| `browser_evaluate disabled by NORACU_DISABLE_EVAL=1` | eval kill-switch is on |
|
|
178
178
|
| `mirror_not_live: …` | iPhone Mirroring shows an overlay (paused, "iPhone in Use") — lock the iPhone, keep it near the Mac, call `phone_launch` |
|
|
179
|
+
| `mirror_setup_required: …` | iPhone Mirroring shows a setup or welcome screen — finish it yourself in its window, then call `phone_launch` |
|
|
180
|
+
| `imctl_timeout: …` | a phone step ran past its time limit and was stopped — check `phone_status` / `phone_screenshot` before retrying (after `phone_open`, noracu goes back to the Home Screen); raise `NORACU_PHONE_TIMEOUT_MS` on a slow Mac |
|
|
179
181
|
| `imctl unavailable: no python3 with pyobjc found …` | install pyobjc for a python3 (`python3 -m pip install pyobjc-framework-Quartz pyobjc-framework-Vision pyobjc-framework-AppKit`) or set `NORACU_PYTHON` |
|
|
180
182
|
|
|
181
183
|
## 9. iPhone layer
|
|
@@ -213,9 +215,11 @@ phone_tap {"x": 0.50, "y": 0.06}
|
|
|
213
215
|
→ tapped (0.5, 0.06)
|
|
214
216
|
```
|
|
215
217
|
|
|
216
|
-
`live` / `overlay` / `paused` come from the window's structure
|
|
217
|
-
language: a live mirror is a single empty hosting view;
|
|
218
|
-
"iPhone in Use" and similar states add text and a button
|
|
218
|
+
`live` / `overlay` / `paused` / `setup` come from the window's structure and
|
|
219
|
+
shape, not its language: a live mirror is a single empty hosting view;
|
|
220
|
+
"Connection Paused", "iPhone in Use" and similar states add text and a button;
|
|
221
|
+
a setup or welcome screen (`setup: true`) sits in a window that is not
|
|
222
|
+
phone-shaped, and `phone_launch` never clicks it. While the mirror is
|
|
219
223
|
not live, `phone_tap`, `phone_longpress`, `phone_swipe`, `phone_scroll`,
|
|
220
224
|
`phone_type`, `phone_key` and `phone_open` refuse with `mirror_not_live`, and
|
|
221
225
|
`phone_ocr` / `phone_find` start with a `warning: mirror not live …` line.
|
|
@@ -225,11 +229,20 @@ mirror by about half a window, with trackpad-style scroll events; a vertical
|
|
|
225
229
|
`phone_swipe` drag does not scroll lists in iPhone Mirroring, so keep swipes
|
|
226
230
|
for gestures such as Home Screen paging.
|
|
227
231
|
|
|
228
|
-
`phone_type` pastes through the clipboard with a real Command-V chord
|
|
229
|
-
previous text clipboard
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
232
|
+
`phone_type` pastes through the clipboard with a real Command-V chord and
|
|
233
|
+
restores the previous text clipboard once OCR sees the pasted text appear on
|
|
234
|
+
the phone (more often than before the paste — text already on screen does not
|
|
235
|
+
count). If the paste only shows up a few seconds late, it is still reported as
|
|
236
|
+
typed — do not type it again — but the clipboard then keeps the typed text.
|
|
237
|
+
`phone_open {"app": "Calculator"}` opens Spotlight through iPhone Mirroring's
|
|
238
|
+
own shortcut, pastes the name, and taps it only when Spotlight's Top Hit card
|
|
239
|
+
shows exactly that name (a web suggestion or Settings row with the same name
|
|
240
|
+
is never tapped); otherwise it returns to the Home Screen and reports
|
|
241
|
+
`app not found`. A paste can take several seconds to reach the iPhone: when the
|
|
242
|
+
name never shows up, `phone_open` waits up to 15 s and then reports
|
|
243
|
+
`open_not_confirmed` (retry) rather than `app not found`. Use the name the phone shows under the icon (`拼多多`, not
|
|
244
|
+
`Pinduoduo`); it reads Spotlight's English "Top Hit" label, so on an iPhone
|
|
245
|
+
set to another language set `NORACU_TOPHIT_LABELS` to the label the phone shows.
|
|
233
246
|
|
|
234
247
|
Privacy: everything the phone shows — notifications, messages, one-time
|
|
235
248
|
codes — becomes tool output that your MCP client sends to its model. Use a
|
package/imctl/README.md
CHANGED
|
@@ -77,10 +77,10 @@ imctl status
|
|
|
77
77
|
|
|
78
78
|
| Command | Description |
|
|
79
79
|
|---------|-------------|
|
|
80
|
-
| `status` | session + window info (JSON: running, window, window_id, onscreen, frontmost, live, overlay, paused) |
|
|
80
|
+
| `status` | session + window info (JSON: running, window, window_id, onscreen, frontmost, live, overlay, paused, setup) |
|
|
81
81
|
| `screenshot [PATH]` | capture the mirroring window to PNG by window id (works when covered) |
|
|
82
|
-
| `resume` | click Resume when the window shows Connection Paused |
|
|
83
|
-
| `launch` | ensure mirroring is running and frontmost |
|
|
82
|
+
| `resume` | click Resume when the window shows Connection Paused (never on a setup or welcome screen) |
|
|
83
|
+
| `launch` | ensure mirroring is running and frontmost; resumes a paused session, never clicks a setup screen (`mirror_setup_required`) |
|
|
84
84
|
| `tap X Y` | tap at normalized coords (0-1) |
|
|
85
85
|
| `longpress X Y [D]` | long-press (default 0.8s) |
|
|
86
86
|
| `swipe FX FY TX TY [--ms]` | eased swipe between two points |
|
|
@@ -92,7 +92,7 @@ imctl status
|
|
|
92
92
|
| `key K` | return / delete / up / down / left / right |
|
|
93
93
|
| `ocr` | OCR the screen with coordinates |
|
|
94
94
|
| `find TEXT` | locate text on screen |
|
|
95
|
-
| `open APP` | open an app via Spotlight + OCR + tap |
|
|
95
|
+
| `open APP` | open an app via Spotlight + OCR + tap (only an exact label inside the Top Hit card) |
|
|
96
96
|
| `verify ACTION` | run a gesture and verify the screen changed |
|
|
97
97
|
|
|
98
98
|
## Python API
|
package/imctl/src/imctl/cli.py
CHANGED
|
@@ -21,10 +21,12 @@ from __future__ import annotations
|
|
|
21
21
|
|
|
22
22
|
import argparse
|
|
23
23
|
import json
|
|
24
|
+
import math
|
|
24
25
|
import os
|
|
25
26
|
import signal
|
|
26
27
|
import sys
|
|
27
28
|
import tempfile
|
|
29
|
+
import time
|
|
28
30
|
|
|
29
31
|
from . import gestures, input, verify, vision
|
|
30
32
|
from .vision import CaptureError
|
|
@@ -225,18 +227,110 @@ def _cmd_type(args) -> int:
|
|
|
225
227
|
guard = _require_expect(args)
|
|
226
228
|
if guard is not None:
|
|
227
229
|
return guard
|
|
228
|
-
|
|
230
|
+
report = {}
|
|
231
|
+
if input.type_text(args.text, replace=args.replace, report=report):
|
|
229
232
|
print(f"typed {args.text!r}")
|
|
230
233
|
return 0
|
|
234
|
+
count_before = report.get("count_before")
|
|
235
|
+
late = _watch_late_paste(args.text, baseline=count_before)
|
|
236
|
+
if late is not None:
|
|
237
|
+
# F38: the paste did land, just late — report it so the caller does not
|
|
238
|
+
# retype it. The clipboard is deliberately NOT restored here: type_text()
|
|
239
|
+
# restores only under its own checks (a rise seen inside its window, the
|
|
240
|
+
# minimum hold, an untouched changeCount); after the fact, leaving the
|
|
241
|
+
# typed text on the clipboard is the choice that can never hand the phone
|
|
242
|
+
# the user's original clipboard (possibly a password).
|
|
243
|
+
print(f"typed {args.text!r} (the paste showed up late, during an extra "
|
|
244
|
+
f"{late:.0f}s check after the 2.5s confirmation window; the clipboard "
|
|
245
|
+
"still holds the typed text)")
|
|
246
|
+
return 0
|
|
247
|
+
watched = (f" or a further {LATE_PASTE_WATCH_S:.0f}s check"
|
|
248
|
+
if _late_paste_probe(args.text) else
|
|
249
|
+
" (one-character text cannot be confirmed by OCR afterwards)")
|
|
250
|
+
if args.replace and count_before:
|
|
251
|
+
# F41: the text was on screen before the paste, and a field replaced with
|
|
252
|
+
# the same text shows no change at all
|
|
253
|
+
advice = ("the text was already on screen before this paste, and replacing a "
|
|
254
|
+
"field with the same text shows no change — read the screen "
|
|
255
|
+
"(phone_ocr / phone_screenshot): if the field shows the text, it "
|
|
256
|
+
"holds it")
|
|
257
|
+
else:
|
|
258
|
+
advice = ("it may still land: read the screen (phone_ocr / phone_screenshot) "
|
|
259
|
+
"before typing again, or retype with replace=true")
|
|
231
260
|
print(
|
|
232
|
-
"type_not_confirmed: the paste did not show on screen within 2.5s
|
|
233
|
-
"the clipboard still holds the
|
|
234
|
-
"was not restored",
|
|
261
|
+
"type_not_confirmed: the paste did not show on screen within the 2.5s "
|
|
262
|
+
f"confirmation window{watched} — {advice}; the clipboard still holds the "
|
|
263
|
+
"typed text and your previous clipboard was not restored",
|
|
235
264
|
file=sys.stderr,
|
|
236
265
|
)
|
|
237
266
|
return 4
|
|
238
267
|
|
|
239
268
|
|
|
269
|
+
# F38 (2026-11-05 real-device): a paste reported unconfirmed after 2.5 s showed up a
|
|
270
|
+
# few seconds later, and the caller's retry typed the text twice ("… case … case").
|
|
271
|
+
# Before type_not_confirmed, keep watching — read-only, no second Cmd+V — for up to
|
|
272
|
+
# this long.
|
|
273
|
+
# F42: on the device a paste reached the phone up to more than 10 s after Cmd+V.
|
|
274
|
+
LATE_PASTE_WATCH_S = 15.0 # needs two consecutive sightings ~1 s apart
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def _late_paste_probe(text):
|
|
278
|
+
"""The OCR probe for ``text``, or None when OCR cannot confirm it (< 2 chars)."""
|
|
279
|
+
return verify.text_probe(text)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def _watch_late_paste(text, *, baseline=None, read_screen=None, sleep=time.sleep,
|
|
283
|
+
clock=time.monotonic, watch_s=LATE_PASTE_WATCH_S):
|
|
284
|
+
"""Seconds into the watch until ``text`` showed up on screen, or None.
|
|
285
|
+
|
|
286
|
+
Read-only: it never pastes again. ``baseline`` is type_text()'s pre-paste
|
|
287
|
+
count of the text's probe (F41); the paste counts as arrived once the count
|
|
288
|
+
is above it in TWO consecutive readable frames (one OCR misread is not
|
|
289
|
+
enough). Without a baseline (type_text() could not read the screen before
|
|
290
|
+
the paste) the watch's own first two readable frames set it — the higher
|
|
291
|
+
count, as in type_text(): text already on screen elsewhere is then never
|
|
292
|
+
taken for the paste, at the price of missing a paste that landed before
|
|
293
|
+
those frames (reported unconfirmed — the caller is told to read the
|
|
294
|
+
screen before typing again). Text too short for a probe is
|
|
295
|
+
not watched at all (None at once). A capture failure breaks the run of
|
|
296
|
+
sightings (F25), never counts as one. ``read_screen``, ``sleep`` and
|
|
297
|
+
``clock`` are injectable for tests.
|
|
298
|
+
"""
|
|
299
|
+
if _late_paste_probe(text) is None:
|
|
300
|
+
return None
|
|
301
|
+
if read_screen is None:
|
|
302
|
+
read_screen = vision.read_screen
|
|
303
|
+
floor = baseline
|
|
304
|
+
floor_reads = [] # without a baseline: the counts of the first two readable frames
|
|
305
|
+
t0 = clock()
|
|
306
|
+
run = 0
|
|
307
|
+
# a first sighting always gets its confirming read, even past the window,
|
|
308
|
+
# and that read follows after a short pause rather than the usual second
|
|
309
|
+
while clock() - t0 < watch_s or run == 1:
|
|
310
|
+
try:
|
|
311
|
+
hits = read_screen()
|
|
312
|
+
except Exception as exc:
|
|
313
|
+
if not verify.is_capture_error(exc):
|
|
314
|
+
raise
|
|
315
|
+
hits = None
|
|
316
|
+
if hits is None:
|
|
317
|
+
run = 0
|
|
318
|
+
else:
|
|
319
|
+
seen = verify.probe_count(text, hits)
|
|
320
|
+
if floor is None:
|
|
321
|
+
floor_reads.append(seen) # no pre-paste count: these frames set the floor
|
|
322
|
+
if len(floor_reads) == 2:
|
|
323
|
+
floor = max(floor_reads)
|
|
324
|
+
elif seen > floor:
|
|
325
|
+
run += 1
|
|
326
|
+
if run >= 2:
|
|
327
|
+
return clock() - t0
|
|
328
|
+
else:
|
|
329
|
+
run = 0
|
|
330
|
+
sleep(0.4 if run == 1 else 1.0)
|
|
331
|
+
return None
|
|
332
|
+
|
|
333
|
+
|
|
240
334
|
def _cmd_key(args) -> int:
|
|
241
335
|
guard = _require_live()
|
|
242
336
|
if guard is not None:
|
|
@@ -274,21 +368,53 @@ def _cmd_find(args) -> int:
|
|
|
274
368
|
return 0
|
|
275
369
|
|
|
276
370
|
|
|
371
|
+
def _open_deadline_kwargs(now=time.time) -> dict:
|
|
372
|
+
"""open_app's time budget from NORACU_OPEN_DEADLINE_EPOCH, an absolute time the
|
|
373
|
+
server sets well before its own timeout (counted from the spawn, so start-up
|
|
374
|
+
and opening Spotlight are inside it). {} → open_app's default."""
|
|
375
|
+
try:
|
|
376
|
+
epoch = float(os.environ.get("NORACU_OPEN_DEADLINE_EPOCH", ""))
|
|
377
|
+
except ValueError:
|
|
378
|
+
return {}
|
|
379
|
+
if not math.isfinite(epoch) or epoch <= 0: # NaN, inf or nonsense
|
|
380
|
+
return {}
|
|
381
|
+
# already past → 0: open_app goes back to the Home Screen without clearing or typing
|
|
382
|
+
return {"deadline_s": max(0.0, epoch - now())}
|
|
383
|
+
|
|
384
|
+
|
|
277
385
|
def _cmd_open(args) -> int:
|
|
278
386
|
guard = _require_live()
|
|
279
387
|
if guard is not None:
|
|
280
388
|
return guard
|
|
281
389
|
# Open Spotlight here (not inside open_app) so a failure can be
|
|
282
390
|
# reported as its own condition instead of a bogus "app not found".
|
|
391
|
+
try:
|
|
392
|
+
return _open_and_report(args)
|
|
393
|
+
except SystemExit:
|
|
394
|
+
# Stopped from outside (the server's timeout sends SIGTERM, imctl turns it
|
|
395
|
+
# into SystemExit) — anywhere in open, not only inside open_app: leave the
|
|
396
|
+
# phone on the Home Screen rather than in Spotlight with text typed in.
|
|
397
|
+
# Best effort: the server sends SIGKILL 1.5 s after the SIGTERM.
|
|
398
|
+
try:
|
|
399
|
+
gestures.home_via_menu()
|
|
400
|
+
except BaseException:
|
|
401
|
+
pass
|
|
402
|
+
raise
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
def _open_and_report(args) -> int:
|
|
406
|
+
tidy = {} # open_app records whether its trip back to the Home Screen worked
|
|
283
407
|
try:
|
|
284
408
|
# F34: one retry — on the device the Spotlight command was once
|
|
285
|
-
# ignored right after an app closed. Each try
|
|
286
|
-
#
|
|
409
|
+
# ignored right after an app closed. Each try goes Home first; when Home
|
|
410
|
+
# lands back in Spotlight (iOS 27, F43) the gate reports it open instead
|
|
411
|
+
# of toggling it shut.
|
|
287
412
|
if not (gestures.open_spotlight_checked()
|
|
288
413
|
or gestures.open_spotlight_checked()):
|
|
289
414
|
result = "spotlight_unavailable"
|
|
290
415
|
else:
|
|
291
|
-
result = gestures.open_app(args.app, spotlight_open=True
|
|
416
|
+
result = gestures.open_app(args.app, spotlight_open=True, report=tidy,
|
|
417
|
+
**_open_deadline_kwargs())
|
|
292
418
|
except (WindowError, CaptureError):
|
|
293
419
|
# F25: the Spotlight gate and the result matching both read the
|
|
294
420
|
# mirroring window's pixels; without them nothing about the
|
|
@@ -297,16 +423,43 @@ def _cmd_open(args) -> int:
|
|
|
297
423
|
if result == "opened":
|
|
298
424
|
print(f"opened {args.app!r}")
|
|
299
425
|
return 0
|
|
426
|
+
# every unsuccessful path ends with a trip back to the Home Screen; say so only
|
|
427
|
+
# when it worked
|
|
428
|
+
home_note = ("back on the Home Screen" if tidy.get("home") else
|
|
429
|
+
"could not go back to the Home Screen — Spotlight may still be open")
|
|
430
|
+
# the app-not-found lines mention the Home Screen only when the trip back failed
|
|
431
|
+
stuck = "" if tidy.get("home") else f"; {home_note}"
|
|
300
432
|
if result == "not_found":
|
|
301
|
-
print(f"app not found: {args.app!r}"
|
|
433
|
+
print(f"app not found: {args.app!r} (Spotlight's Top Hit did not show exactly "
|
|
434
|
+
f"this name — use the name the phone shows under the app icon){stuck}")
|
|
435
|
+
return 1
|
|
436
|
+
if result == "no_top_hit":
|
|
437
|
+
if os.environ.get("NORACU_TOPHIT_LABELS", "").strip():
|
|
438
|
+
print(f"app not found: {args.app!r} (Spotlight showed no Top Hit labelled "
|
|
439
|
+
f"{', '.join(repr(x) for x in gestures.TOP_HIT_LABELS)} — no app by that "
|
|
440
|
+
f"name, or NORACU_TOPHIT_LABELS does not match your iPhone's label){stuck}")
|
|
441
|
+
else:
|
|
442
|
+
print(f"app not found: {args.app!r} (Spotlight showed no Top Hit — no app by that "
|
|
443
|
+
"name, or the iPhone is not set to English: phone_open reads Spotlight's "
|
|
444
|
+
f"\"Top Hit\" label; set NORACU_TOPHIT_LABELS to the label your iPhone shows){stuck}")
|
|
302
445
|
return 1
|
|
446
|
+
if result == "deadline":
|
|
447
|
+
print(f"open_not_confirmed: ran out of time opening {args.app!r} (the Mac may be "
|
|
448
|
+
f"under heavy load); {home_note}", file=sys.stderr)
|
|
449
|
+
return 4
|
|
450
|
+
if result == "not_typed":
|
|
451
|
+
print(f"open_not_confirmed: the name {args.app!r} was pasted into Spotlight but never "
|
|
452
|
+
"showed up on the phone (a paste can take several seconds to reach the iPhone, "
|
|
453
|
+
"or be lost; an iPhone not set to English also needs NORACU_TOPHIT_LABELS) — "
|
|
454
|
+
f"nothing was tapped; {home_note}; retry phone_open", file=sys.stderr)
|
|
455
|
+
return 4
|
|
303
456
|
if result == "spotlight_unavailable":
|
|
304
457
|
print("spotlight unavailable (could not reach the Home Screen, the menu command failed, or the screen did not change)")
|
|
305
458
|
return 1
|
|
306
459
|
# "not_confirmed" (F24): the row — and possibly the Top Hit icon —
|
|
307
460
|
# was tapped but the app never verifiably opened; the phone is
|
|
308
461
|
# back on the Home Screen.
|
|
309
|
-
print(f"open_not_confirmed: tapped {args.app!r} in Spotlight but the app did not open;
|
|
462
|
+
print(f"open_not_confirmed: tapped {args.app!r} in Spotlight but the app did not open; {home_note}", file=sys.stderr)
|
|
310
463
|
return 4
|
|
311
464
|
|
|
312
465
|
|
|
@@ -329,9 +482,22 @@ def _cmd_launch(_args) -> int:
|
|
|
329
482
|
live = gestures.launch()
|
|
330
483
|
if live is False:
|
|
331
484
|
# F29: never report "ready" while the overlay is still up.
|
|
485
|
+
from .window import is_setup_screen
|
|
486
|
+
|
|
487
|
+
if is_setup_screen():
|
|
488
|
+
# F37: a welcome / setup screen is the user's to finish; nothing was clicked.
|
|
489
|
+
print(
|
|
490
|
+
"mirror_setup_required: iPhone Mirroring is showing a setup or welcome "
|
|
491
|
+
"screen (its window is not phone-shaped) — finish it in the iPhone "
|
|
492
|
+
"Mirroring window yourself (noracu never clicks through setup screens), "
|
|
493
|
+
"then call phone_launch again",
|
|
494
|
+
file=sys.stderr,
|
|
495
|
+
)
|
|
496
|
+
return 3
|
|
332
497
|
print(
|
|
333
|
-
"mirror_not_live: iPhone Mirroring is
|
|
334
|
-
"near the Mac
|
|
498
|
+
"mirror_not_live: iPhone Mirroring is not live yet — if it shows a paused "
|
|
499
|
+
"notice, lock the iPhone and keep it near the Mac; if it is reconnecting, wait "
|
|
500
|
+
"a few seconds and check phone_status; then call phone_launch again",
|
|
335
501
|
file=sys.stderr,
|
|
336
502
|
)
|
|
337
503
|
return 3
|