diff --git a/CHANGELOG.md b/CHANGELOG.md index 7937fd0..621b87b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ What changed in each release, one line per change. Versions follow [Semantic Ver - Native control (iOS 27): the floating search bar at the bottom of Settings counts as covering the rows under it, as it does through WDA. Tapping a row under it by text taps its visible part instead of opening the search. - Launching a system app for the first time no longer hangs for 60 seconds behind its privacy notice and restarts WDA; it returns at once and says the notice is in the way. +- `iphone_tap_element` that found nothing to tap no longer says, with `then`, that "the action may not have taken effect"; it also returns the screen without waiting for it to settle. - A WDA probe that answers, even with an error, resets the timeout count instead of accumulating unrelated slow requests into a stall. Recovery logs state the reason, and timeout logs include the endpoint and elapsed time. ## [0.2.7] - 2026-11-15 diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 3d64e69..a3d1368 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -23,6 +23,7 @@ - 原生控制(iOS 27):设置首页底部悬浮的搜索栏算作挡住它下面的行,和经 WDA 时一样。按名字点被压在栏下的行,改点露出来的部分,不会再打开搜索。 - 第一次启动系统 App 时,不再被隐私说明页卡住 60 秒、还把 WDA 判成卡死重启;马上返回,并说明被说明页挡着。 +- `iphone_tap_element` 没找到可点的元素时,带 `then` 不再说「操作可能没生效」,也不再等界面稳定,直接返回界面。 - WDA 的短探测正常应答或返回远端错误时清零超时计数,不再把多个独立慢请求累计成卡死;恢复日志写明判定依据,请求超时日志包含端点和耗时。 ## [0.2.7] - 2026-11-15 diff --git a/crates/ictl-daemon/src/core.rs b/crates/ictl-daemon/src/core.rs index f880ebc..e895742 100644 --- a/crates/ictl-daemon/src/core.rs +++ b/crates/ictl-daemon/src/core.rs @@ -1220,8 +1220,14 @@ impl Daemon { Request::Tap { x, y, count } => self.tap(g, x, y, count, view).await, Request::TapSequence { points } => self.tap_sequence(g, &points).await, Request::TapElement { text, index, max_age_ms, scroll } => { - self.tap_element(g, &text, index, Duration::from_millis(max_age_ms), scroll).await.map(|(t, missed)| { + let r = self.tap_element(g, &text, index, Duration::from_millis(max_age_ms), scroll).await; + r.map(|(t, missed)| { outcome.tapped_nothing = missed; + // nothing was tapped: there is no "before the action" to compare the screen with, or the next + // settle would say the tap may not have taken effect + if missed { + g.dev.before_action = None; + } t }) } diff --git a/crates/ictl-mcp/src/lib.rs b/crates/ictl-mcp/src/lib.rs index 9a5c09a..8ef0e3f 100644 --- a/crates/ictl-mcp/src/lib.rs +++ b/crates/ictl-mcp/src/lib.rs @@ -1096,7 +1096,9 @@ impl McpServer { Response::Text { text, outcome, .. } if req.is_device_action() => { // 结果里已经说了有弹窗(启动 App 被挡)就不再查 let check = wants_alert_check(&req) && !protocol::alert_reported(&text, outcome); - self.finish(text, false, then, check).await + // 按名字没点到东西:界面没动过,不用等它稳定,直接给界面(按名字点击刚读过的树) + let settle = !tap_missed(&text, outcome); + self.finish(text, false, then, check, settle).await } resp => to_result(resp), } @@ -1124,8 +1126,15 @@ impl McpServer { } /// 操作完成后:按 then 等界面稳定,再附上元素列表或截图(等稳定时顺带提醒弹窗)。 - /// 不带 then 时,`alert_check` 为真就查一下有没有系统弹窗挡着 - async fn finish(&self, mut text: String, failed: bool, opts: ThenOpts, alert_check: bool) -> CallToolResult { + /// 不带 then 时,`alert_check` 为真就查一下有没有系统弹窗挡着。`settle` 为假(什么都没点)时不等稳定 + async fn finish( + &self, + mut text: String, + failed: bool, + opts: ThenOpts, + alert_check: bool, + settle: bool, + ) -> CallToolResult { let done = |blocks: Vec| { if failed { CallToolResult::error(blocks) } else { CallToolResult::success(blocks) } }; @@ -1136,15 +1145,17 @@ impl McpServer { } return done(vec![ContentBlock::text(text)]); } - match self.call(&Request::Settle { max_ms: opts.settle_ms }).await { - Response::Text { text: t, .. } => text += &format!("\n{t}"), - Response::Error { message, .. } => { - text += &ictl_l10n::trf!( - "\n(等界面稳定失败:{message})", - "\n(waiting for the screen to settle failed: {message})" - ) + if settle { + match self.call(&Request::Settle { max_ms: opts.settle_ms }).await { + Response::Text { text: t, .. } => text += &format!("\n{t}"), + Response::Error { message, .. } => { + text += &ictl_l10n::trf!( + "\n(等界面稳定失败:{message})", + "\n(waiting for the screen to settle failed: {message})" + ) + } + Response::Image { .. } => {} } - Response::Image { .. } => {} } match then { Then::Elements(filter) => { @@ -1224,7 +1235,7 @@ impl McpServer { total - n )); } - return self.finish(lines.join("\n"), true, then, false).await; + return self.finish(lines.join("\n"), true, then, false, true).await; } Response::Text { text, outcome, .. } => { check = wants_alert_check(&req) && !protocol::alert_reported(&text, outcome); @@ -1240,12 +1251,12 @@ impl McpServer { total - n )); } - return self.finish(lines.join("\n"), true, then, true).await; + return self.finish(lines.join("\n"), true, then, true, true).await; } }, } } - self.finish(lines.join("\n"), false, then, check).await + self.finish(lines.join("\n"), false, then, check, true).await } } diff --git a/docs/dev/regression-cases.md b/docs/dev/regression-cases.md index 65e4a1f..ce81e1e 100644 --- a/docs/dev/regression-cases.md +++ b/docs/dev/regression-cases.md @@ -157,3 +157,4 @@ | 151 | 要点的项在长列表屏幕外(设置首页的「隐私与安全性」):`iphone_tap_element` 只看当前屏幕,Agent 只能自己滑一下、读一次元素地来回;普通 0.3 秒快滑带惯性,手指移 300 点内容滚 618 点,会把要找的甩过去;找到的那一行可能正停在底部工具栏下面,整个被盖住 | `scroll`(`down` / `up`):每次在屏幕正中慢滑 35% 屏高(1 秒,几乎不带惯性,前后两屏有重叠),等列表停下再读树;要点的匹配存在且没被整个盖住才算找到;元素树不再变化算到了尽头,停下并在结果里说滑了几次 | 单测 `tap_element_scroll_search_is_optional_and_checked`、`a_search_scroll_is_a_short_vertical_stroke_in_the_middle`、`requests_round_trip_as_tagged_json` + 真机(iPhone 12 mini,iOS 26.4.1:设置首页往下找「隐私与安全性」滑 4 次点中;滑到底后往上找「通用」滑 3 次点中;找不存在的项滑到底 6 次停下)| | 152 | 原生控制(iOS 27):设置首页底部悬浮的搜索栏在扁平的元素树里只是一个直接挂在 Application 下的 `SearchField`,没有 WDA 树里那层 Toolbar,不算遮挡;被压在栏下的行(如「隐私与安全」在 y≈866)按名字点会点它的中心,打开的是搜索;`iphone_tap_element` 带 `scroll` 时也会停在这样的位置 | 直接挂在 Application 下、在屏幕下部 40% 的 `SearchField` 按底部悬浮栏处理:盖得住下面的行;范围按真机量的算:输入框(顶 866)往上 58 点内的点击都被栏吞掉(806 还能进下面那一行,812、820、826 都不行),左右和往下多 34 点;一半压在这片范围里的改点上面露出来的部分,整个在里面的报被挡住 | 单测 `a_native_floating_search_field_covers_the_rows_under_it`(真机导出的树 `settings-floating-search-native-ios27.xml`)+ 真机(设置首页把行滑到搜索栏下,按名字点、带 scroll 找) | | 153 | 第一次启动系统 App(备忘录、提醒事项)时,系统先在另一个进程(`com.apple.PDUIApp`)里显示隐私说明页盖在上面;`/wda/apps/launch` 要等 XCTest 看到 App 到前台,一直等到 60 秒超时,接着 WDA 被判卡死重启,`iphone_launch_app` 报超时(65 秒) | 先用 `/wda/apps/launchUnattached`(不经 XCTest,发出就返回),再照旧轮询前台:前台是隐私说明页就马上报「被挡住」,结果和权限弹窗一样提示先点它的按钮;它回「failed to launch」时说明页已经出来,照样往下查;旧版 WDA 没有这个接口时退回 `/wda/apps/launch` | 单测 `a_first_launch_privacy_notice_is_reported_at_once`、`an_older_wda_without_unattached_launch_launches_as_before`、`other_launch_errors_are_errors` + 真机(iPhone 12 mini,iOS 26.4.1:没打开过的「备忘录」0.7 秒返回、WDA 不重启,0.2.7 是 65 秒并重启 WDA;冷启动「时钟」后马上点标签页照常点中)| +| 154 | `iphone_tap_element` 没找到(或序号超出、整个被盖住)时什么都没点,带 `then` 却先等界面稳定 0.7~0.8 秒,再拿它点之前读的树比较,说「界面和操作前一样:操作可能没生效(点在了空白处…),不要原样再做一遍」,好像点过了 | 没点就清掉「操作前的界面」,不做比较;MCP 端看到没点到东西时不等稳定,直接用按名字点击刚读的树列元素或截图 | 真机(iPhone 12 mini,iOS 26.4.1:设置里按不存在的文字点,带 `then=elements` 和 `then=screenshot`,0.2.7 是 1.3~1.45 秒带那句提示,本分支 0.6~0.9 秒不带;只换守护进程(旧 MCP)时仍等稳定但也不带;按存在的文字点照常等稳定、说界面变了)|