Expand description
smix-runner-client — HTTP IPC client to swift-bridge/SmixRunnerCore
(outer crate). v3.1 c8, first outer crate allowing reqwest +
tokio + thiserror + tracing deps per user 2026-05-25 brief.
Ported from now-retired TS source: src/sim/runner-client.ts (1129 lines). Wire-level
1:1 compatibility with the Swift side — any route shape / query param
/ response body shape change must be done in lockstep with
swift-bridge/Sources/SmixRunnerCore.
§Routes (18 endpoints, port progress c8 = MVP set)
GET /health— connectivity probe (memoized viaHttpRunnerClient::ensure_reachable)GET /tree?include=— full a11y tree dump (returnsA11yNode)GET /system-popups?include=— list ofSystemPopupPOST /tap {selector, mode, include?}— selector → element tapPOST /tap-at-norm-coord {nx, ny}— Apple native event chain coord tapPOST /find {selector, include?}— boolean existence check (v1.4 quick-probe)POST /fill {selector, text, include?}— fill text into inputPOST /clear {selector, include?}— clear inputPOST /press-key {key}— press named key (Return/Tab/etc.)POST /scroll {selector, direction, include?}— scroll-until-visiblePOST /swipe-once {direction}— single swipe gesture (no probe loop)POST /foreground {bundleId}— bring app to foregroundPOST /hide-keyboard— swipe-down to dismiss keyboardPOST /back— back gesturePOST /record/start— begin recording AX notificationsGET /record/poll— drain recorded eventsPOST /record/stop— stop recording, drain final events
Per CLAUDE.md §9 #4 — never expose raw URL / sleep / xpath surfaces. All operations go through the typed methods below.
Structs§
- Find
Request POST /findrequest body.- Find
Response POST /findresponse body.- Http
Runner Client - HTTP client to the swift-side SmixRunnerCore. Async (tokio-based).
Constructed once per Cell;
ensure_reachablememoizes a successful/healthprobe so subsequent calls don’t re-probe. - Keyboard
Stages - Per-stage timing returned by
/fill//clear//press-key. - OcrFrame
- v5.19 c1 — normalized OCR bounding box returned by
HttpRunnerClient::find_text_by_ocr. Coordinates are normalized to[0, 1]in UIKit coord space (top-left origin, y-down). Apple Vision’s native bbox is bottom-left origin + y-up — the swift handler converts before returning so all consumers see UIKit coords. - Record
Events Response GET /record/poll/POST /record/stopresponse body.- Recorded
Event - One recorder event captured by
/record/start→/record/pollflow. - Request
Context - v0.2.1 — per-request context carried across the wire via the
App-Bundle-IdandApp-ActivateHTTP headers. Client sets these viaHttpRunnerClient::with_target_bundle_id/with_auto_activate, or per-call by cloning the client with a modified context. The runner side reads them intoSmixRunnerServer.currentContext(task-local) and passes toresolveApp()in every app-touching handler. - Runner
Include Opts includescope query param shared by/tree//tap//fill//clear//find//scroll//system-popups. URL-only.- Runner
Keyboard Result POST /fill/POST /clear/POST /press-keyresponse body.- Runner
Scroll NotMatched POST /scrollreturned200 / matched:false / swipes:N— scroll exhausted N swipes without surfacing the target. Mirrors TSRunnerScrollNotMatched.- Runner
Swipe Once Failure POST /swipe-oncereturned200 / ok:false / vanished_during_swipe. Mirrors TSRunnerSwipeOnceFailure.- Scroll
Response POST /scrollresponse body.- System
Popup - One system-popup discovered on the screen (alert / sheet / banner).
- System
Popup Action Request POST /system-popup-actionrequest body (v4.2 c2 — G9 act side).- System
Popup Action Response POST /system-popup-actionresponse body.- System
Popup Button - One button on a
SystemPopup. - System
Popups Response GET /system-popupsresponse body.- TapAt
Norm Coord Request POST /tap-at-norm-coordrequest body.- TapNot
Found Error POST /tapreturned404 / not_found— element matched no node. Mirrors TSTapNotFoundError.- TapRequest
POST /taprequest body.- TapResult
POST /tapresponse body.- TapStages
POST /tapper-stage timing in milliseconds.
Enums§
- Include
Scope includescope literal — currently onlyall-windows(system popups pierce the app frame).- Runner
Scroll Selector - Reduced selector shape used by
/scroll(text-or-id only; complex selectors are host-side-resolved before reaching the runner). - Runner
Transport Error - Transport-level failure (network, non-2xx, malformed body). Mirrors
TS
RunnerTransportError1:1. - TapMode
POST /tapmode discriminator.