Expand description
smix-runner-client — HTTP IPC client to swift-bridge/SmixRunnerCore.
Allows reqwest + tokio + thiserror + tracing deps.
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
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 checkPOST /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
Design invariant: no raw URL / sleep / xpath surface is ever exposed. All operations go through the typed methods below.
Structs§
- Diagnostic
Dump Response POST /diagnostic/dumpresponse body.- Find
Request POST /findrequest body.- Find
Response POST /findresponse body.- Health
Process Info - Pid + alive flag for a watched process. Additive to
HealthResponse. - Health
Response - Consumers that ignore the body get identical behavior; consumers that parse the JSON gain liveness observability.
- Health
Test Host Info - xcodebuild test-host health with restart accounting.
- Http
Runner Client - Keyboard
Stages - Per-stage timing returned by
/fill//clear//press-key. - OcrFrame
- 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. - Press
Result POST /long-pressresponse body.- Record
Events Response GET /record/poll/POST /record/stopresponse body.- Recorded
Event - One recorder event captured by
/record/start→/record/pollflow. - Request
Context - 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.- Session
AppLifecycle Request - Request body shared by
POST /session/terminate-appandPOST /session/launch-app. - Session
AppLifecycle Response - Response for
POST /session/terminate-appandPOST /session/launch-app. - Session
Close AllResponse POST /session/close-all— backssmix runner cycle. Runner-side clears every open session and returns the count that was cleared.- Session
Close Request POST /session/closerequest body.- Session
Close Response POST /session/closeresponse body.- Session
List Response POST /session/listresponse body.- Session
Open Request POST /session/openrequest body.- Session
Open Response POST /session/openresponse body.- Session
Relaunch AppRequest POST /session/relaunch-apprequest body.- Session
Relaunch AppResponse POST /session/relaunch-appresponse body.- Session
Renew Activation Request POST /session/renew-activationrequest body.- Session
Renew Activation Response POST /session/renew-activationresponse body.- Session
Summary - One entry in
POST /session/listresponse. - System
Popup - One system-popup discovered on the screen (alert / sheet / banner).
- System
Popup Action Request POST /system-popup-actionrequest body.- 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
Coord Result POST /tap-at-norm-coordresponse.- 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.- Wire
Subprocess Record - One entry in the subprocess ring buffer.
Enums§
- Cycle
Plan - The action
smix runner cycletakes given aSoftCycleProbe. - Include
Scope includescope literal — currently onlyall-windows(system popups pierce the app frame).- Input
Dispatch Mode - Input dispatch mode for the
Input-Dispatch-Modeheader. Runner-side interpretation lives inSmixRunnerCore/FillRoute.swift. - 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. - SimHealth
Wire State - Session state exposed to SDK consumers via the
X-Sim-Healthresponse header on every runner response. - Soft
Cycle Probe - Outcome of probing a live runner for the in-process soft-cycle
(
POST /soft-cycle+ aGET /healthre-confirmation after the FlyingFox bounce). - TapMode
POST /tapmode discriminator.
Constants§
- DEFAULT_
WEBVIEW_ BRIDGE_ PORT - Port the iOS in-app webview bridge listens on when nothing says otherwise.
Functions§
- soft_
cycle_ plan - Map a soft-cycle probe to the cycle action. Pure — the network work happens in the probe; this only chooses the branch, so the recoverable / unrecoverable split is checkable device-free.
- webview_
bridge_ port_ from - Resolve the bridge port from a raw string, falling back to the default when absent or unparseable.
- webview_
bridge_ url - The bridge endpoint for a given port.