Repository navigation
fix(emulator): iOS ax via plain-JSON serve-sim helper (supersedes #10007) - #10029
Conversation
serve-sim's helper /ax reports element frames in absolute pixels, but tap/gesture take normalized 0..1 coords. Normalize the raw AX node tree into a compact nested shape whose frames are 0..1 over the device screen (first root's frame), mirroring serve-sim's own normalizeAxTree, so agents can feed ax output straight back into input commands. Also heal sessions that were registered without an axUrl: #9924 only derived /ax at parse time, so already-active sessions had no endpoint. The bridge now derives it from the session's mjpeg stream URL, guarded to the /stream.mjpeg suffix so a non-mjpeg URL never fabricates a bogus /ax.
Both skill guides and the CLI summary described iOS ax as unsupported (or, via the reverted #10007, as a normalized "screen + elements" shape that never matched the endpoint). ax works on both backends: Android via uiautomator, iOS via the serve-sim helper. Document the real iOS output — a raw AX node tree (labels, roles, nested children) with frames normalized to 0..1 — and regenerate the bundled skill guides.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughThe emulator accessibility flow now fetches raw serve-sim AX JSON directly, validates and normalizes nodes and frames, and maps request failures to emulator errors. Session parsing derives 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
CI verify failed because generated skill artifacts were stale after version/skill revision bumps.
Fall back to udid-keyed session lookup when a worktree has no active emulator, allowing `--device` targeting to work the same way for ax as it does for tap/type. Also clarify in docs that AX frames are normalized 0..1 with top-left origin, and show how to tap an element at its frame center (x+width/2, y+height/2).
Unbounded accessibility trees can flood agent output. Enforce a 500-node limit (matching serve-sim's snapshot cap) and mark truncated parents so consumers know the tree was cut.
…blyai#10007) (stablyai#10029) * Revert "Enable accessibility tree (`ax`) command on iOS emulator sessions (stablyai#10007)" This reverts commit 43ae014. * fix(emulator): expose iOS accessibility tree * fix(emulator): support device-only iOS AX * fix(emulator): normalize iOS ax to 0..1 and heal missing axUrl serve-sim's helper /ax reports element frames in absolute pixels, but tap/gesture take normalized 0..1 coords. Normalize the raw AX node tree into a compact nested shape whose frames are 0..1 over the device screen (first root's frame), mirroring serve-sim's own normalizeAxTree, so agents can feed ax output straight back into input commands. Also heal sessions that were registered without an axUrl: stablyai#9924 only derived /ax at parse time, so already-active sessions had no endpoint. The bridge now derives it from the session's mjpeg stream URL, guarded to the /stream.mjpeg suffix so a non-mjpeg URL never fabricates a bogus /ax. * docs(emulator): mark ax working on iOS with correct raw-AX-tree shape Both skill guides and the CLI summary described iOS ax as unsupported (or, via the reverted stablyai#10007, as a normalized "screen + elements" shape that never matched the endpoint). ax works on both backends: Android via uiautomator, iOS via the serve-sim helper. Document the real iOS output — a raw AX node tree (labels, roles, nested children) with frames normalized to 0..1 — and regenerate the bundled skill guides. * chore(skills): regenerate skill bundle manifests CI verify failed because generated skill artifacts were stale after version/skill revision bumps. * fix(emulator): read ax from explicit device without active session Fall back to udid-keyed session lookup when a worktree has no active emulator, allowing `--device` targeting to work the same way for ax as it does for tap/type. Also clarify in docs that AX frames are normalized 0..1 with top-left origin, and show how to tap an element at its frame center (x+width/2, y+height/2). * fix(emulator): cap iOS AX tree at 500 nodes Unbounded accessibility trees can flood agent output. Enforce a 500-node limit (matching serve-sim's snapshot cap) and mark truncated parents so consumers know the tree was cut. --------- Co-authored-by: 5Hyeons <[email protected]>
…blyai#10007) (stablyai#10029) * Revert "Enable accessibility tree (`ax`) command on iOS emulator sessions (stablyai#10007)" This reverts commit 9011129. * fix(emulator): expose iOS accessibility tree * fix(emulator): support device-only iOS AX * fix(emulator): normalize iOS ax to 0..1 and heal missing axUrl serve-sim's helper /ax reports element frames in absolute pixels, but tap/gesture take normalized 0..1 coords. Normalize the raw AX node tree into a compact nested shape whose frames are 0..1 over the device screen (first root's frame), mirroring serve-sim's own normalizeAxTree, so agents can feed ax output straight back into input commands. Also heal sessions that were registered without an axUrl: stablyai#9924 only derived /ax at parse time, so already-active sessions had no endpoint. The bridge now derives it from the session's mjpeg stream URL, guarded to the /stream.mjpeg suffix so a non-mjpeg URL never fabricates a bogus /ax. * docs(emulator): mark ax working on iOS with correct raw-AX-tree shape Both skill guides and the CLI summary described iOS ax as unsupported (or, via the reverted stablyai#10007, as a normalized "screen + elements" shape that never matched the endpoint). ax works on both backends: Android via uiautomator, iOS via the serve-sim helper. Document the real iOS output — a raw AX node tree (labels, roles, nested children) with frames normalized to 0..1 — and regenerate the bundled skill guides. * chore(skills): regenerate skill bundle manifests CI verify failed because generated skill artifacts were stale after version/skill revision bumps. * fix(emulator): read ax from explicit device without active session Fall back to udid-keyed session lookup when a worktree has no active emulator, allowing `--device` targeting to work the same way for ax as it does for tap/type. Also clarify in docs that AX frames are normalized 0..1 with top-left origin, and show how to tap an element at its frame center (x+width/2, y+height/2). * fix(emulator): cap iOS AX tree at 500 nodes Unbounded accessibility trees can flood agent output. Enforce a 500-node limit (matching serve-sim's snapshot cap) and mark truncated parents so consumers know the tree was cut. --------- Co-authored-by: 5Hyeons <[email protected]>
Summary
Makes
orca emulator axactually work on iOS, and fixes the accompanyingdocs/CLI so they describe the real output shape.
Two implementations of iOS
axexisted. #10007 (merged) modeled theserve-sim helper
/axendpoint as a Server-Sent Events stream and readit with a streaming parser — but the helper Orca runs (
serve-sim --detach)serves
/axas a plain one-shot HTTP GET returning a JSON array of rawAX nodes. So #10007 reads nothing and fails with
stream ended without an accessibility tree event. #9924 (@5Hyeons) usedthe correct plain-JSON
net.fetchmodel. This PR supersedes #10007 byreverting it and landing #9924, then adds the missing pieces.
Verified against
[email protected]+ a live iPhone simulator: the helper/axreturnsContent-Type: application/json, a finiteContent-Length,one shot (not a stream), a JSON array of raw AX nodes (
AXLabel,AXValue,AXUniqueId,enabled,type,role_description, absolute-pixelframe,nested
children), and HTTP 503 while accessibility is momentarilyunavailable. The SSE
/axonly exists in serve-sim internal middleware Orcadoes not run.
What's in this PR
ax) command on iOS emulator sessions #10007 (wrong SSE model). Removesserve-sim-ax-tree.ts, itstest, and the
fetchAccessibilityTreeDI seam.net.fetchof the helper/ax(serve-sim-accessibility-tree.ts), with503 → retry hint and clean
EmulatorErrormapping. Original commits arepreserved with 5Hyeons' authorship.
pixels, but
tap/gesturetake normalized0..1. Newserve-sim-ax-normalization.tsnormalizes the raw node tree to0..1overthe device screen (first root's frame, mirroring serve-sim's own
normalizeAxTree), keeping label/role/type/enabled/value + nestedchildren — so agents can feed
axoutput straight back into input commands.axUrl(new). fix(emulator): expose iOS accessibility tree #9924 only derived/axat parse time, sosessions already registered without an
axUrlhad no endpoint. The bridgenow derives it from the session's mjpeg stream URL, guarded to the
/stream.mjpegsuffix so a non-mjpeg URL never fabricates a bogus/ax.axworks on both backends (Androiduiautomator, iOS serve-sim), anddescribe the real iOS output — a raw AX node tree with frames
normalized to
0..1— not the "screen + elements" shape Enable accessibility tree (ax) command on iOS emulator sessions #10007 wronglydescribed. Bundled skill guides regenerated.
Credit
Base implementation by @5Hyeons in #9924 (
fix/ios-emulator-ax);their commits are preserved here. This PR builds on that with normalization,
the heal-fallback, docs, and tests.
Verification
npx vitest run src/main/emulator→ 221 passednpx tsc --noEmit -p config/tsconfig.node.json→ cleannpx oxlint+npx oxfmt -c .oxfmtrc.jsonon changed files → cleangenerate-bundled-skill-guides.mjs --check→ cleanNew/updated tests cover plain-JSON fetch + normalization, 503 retry hint,
non-array/unparseable/network-failure paths, the guarded
axUrlderivation,and the bridge heal-fallback.
STA-2338.
Made with Orca 🐋