Docs Operation reference runtime operations
runtime operations#
11 operations. Generated from assets/operations.json; all areas.
On this page (11)
runtime.start#
Connect native runtime
Start or reuse the single native display session for this device. Repeated calls return its existing session ID. Supports Android, physical iPhone from Linux, and Apple Simulator on an optional SSH Mac. With TOMACCO_FIXTURE_RUNTIME set, device fixture:NAME connects the offline scripted fixture of that name (transport fixture, evidence fixture), for tests and the benchmark runner only.
Annotations: writes, idempotent, open world.
| Argument | Type | Required | Default | Details |
|---|---|---|---|---|
platform | string | yes | one of android, ios | |
device | string | yes | non-empty, up to 200 characters | |
remote | string | Optional configured Mac workspace for an Apple Simulator; omit for a physical iPhone on Linux. | ||
server | string | Optional scrcpy 4.1 server JAR override. | ||
fps | integer | 60 | 1 to 60 | |
bit_rate | integer | 12000000 | 100000 to 50000000 | |
runner_bundle_id | string | "" | Installed WebDriverAgent runner identifier for a physical iPhone. | |
runner_mode | string | "xctest" | one of xctest, external; xctest: start the signed WDA runner through go-ios; external: WDA is already running on the selected USB device. | |
audio | boolean | true | Forward Android output audio to this computer using a session-owned scrcpy playback job. Does not capture a microphone. Unsupported audio leaves video connected and reports audio failure. |
tomaccoctl call runtime.start '{"platform":"android","device":"<device>"}'
runtime.list#
Native sessions
List native display sessions and connection status.
Annotations: read-only, idempotent, open world.
Takes no arguments.
tomaccoctl call runtime.list
runtime.audio#
Stream device audio
Start, stop or inspect Android output audio playback on this computer without restarting the app or display session. Repeated starts reuse one playback job. Stops restore the device audio route; they do not mute the device itself. Requires Android 11+ and scrcpy.
Annotations: writes, idempotent, open world.
| Argument | Type | Required | Default | Details |
|---|---|---|---|---|
session | string | yes | Connected Android runtime session ID. | |
action | string | "status" | one of start, stop, status |
tomaccoctl call runtime.audio '{"session":"<session>"}'
runtime.state#
Runtime status
Read actual runtime dimensions, video counters, transport errors and input_capabilities: whether touch streams live or is sent as an atomic trace, how many contacts, pinch, fill, rotate, capture and hierarchy.
Annotations: read-only, idempotent, open world.
| Argument | Type | Required | Default | Details |
|---|---|---|---|---|
session | string | yes | matching ^[a-f0-9]{32}$; ID returned by runtime.start; separate from desktop preview sessions. |
tomaccoctl call runtime.state '{"session":"<session>"}'
runtime.stop#
Disconnect runtime
Stop this display session and its private transport. The device and application remain running.
Annotations: writes, idempotent, open world.
| Argument | Type | Required | Default | Details |
|---|---|---|---|---|
session | string | yes | matching ^[a-f0-9]{32}$; ID returned by runtime.start; separate from desktop preview sessions. |
tomaccoctl call runtime.stop '{"session":"<session>"}'
runtime.input#
Native input
Deliver native input using normalized 0..1 coordinates. Android supports touch/tap/swipe/key/text/rotate; text pastes UTF-8. Physical iPhone uses WDA for Unicode text/fill, tap/swipe/rotate, a two-finger pinch (x, y, scale, duration) and gestures committed as one atomic request on touch-up; shake/hinge are unsupported there. Android also takes pinch, as two scrcpy pointers. Apple Simulator supports ASCII HID text and Unicode accessible fill; extra gestures depend on the companion. Pass decoded width/height after Simulator rotation. An AirPlay session (device airplay) drives the iPhone as a Bluetooth pointer and US-layout keyboard once it is paired with Tomacco and AssistiveTouch is on: touch moves the pointer, cut into steps the phone can follow, hover moves it without a button, cancel lifts a held button where the pointer is; t on touch (the caller's clock in ms) lets a release after a rest stop instead of fling; swipe takes hold and rest (seconds still before the move and before the lift); tap, swipe, text and the keys home, back (a swipe in from the left edge), volume_up, volume_down, enter, escape, backspace, delete, tab and the arrows work; app_switcher, control_center, notifications and spotlight send the consumer keys iOS was found to act on, not yet tried from this receiver; scancode types a Linux evdev key code with HID modifiers through the phone's own keyboard layout. fill with verify_value checks the focused editor and reads its exact value back before answering verified (USB iPhone over WebDriverAgent and scripted fixtures; others answer fill_verification_unsupported). runtime.state answers input_capabilities per transport; runtime.gesture sends timestamped traces. With reservation_token it acts under a device reservation (device.reservation.acquire); with request_id it is recorded once in the request ledger, so a repeat after a lost answer is not sent again.
Annotations: writes, not idempotent, open world.
| Argument | Type | Required | Default | Details |
|---|---|---|---|---|
session | string | yes | matching ^[a-f0-9]{32}$; ID returned by runtime.start; separate from desktop preview sessions. | |
action | string | yes | one of touch, tap, swipe, key, text, fill, rotate, shake, pinch, hinge, scancode | |
phase | string | one of down, move, up, cancel, hover | ||
x | number | 0 to 1 | ||
y | number | 0 to 1 | ||
t | number | at least 0; For touch on AirPlay: the caller's clock in milliseconds when the pointer did this. A release that follows a rest waits as long (up to 120 ms) so the phone stops instead of flinging | ||
x2 | number | 0 to 1 | ||
y2 | number | 0 to 1 | ||
duration | number | 0.3 | 0.01 to 5 | |
hold | number | 0 to 1; For swipe on AirPlay: seconds the finger stays still after the press, as a long press before a drag | ||
rest | number | 0 to 1; For swipe on AirPlay: seconds the finger stays still before it lifts; 0.12 or more stops without a fling | ||
key | string | one of home, back, escape, enter, backspace, delete, tab, up, down, left, right, power, volume_up, volume_down, apps, app_switcher, control_center, notifications, spotlight | ||
code | integer | 0 to 1023; For scancode: the Linux evdev key code (linux/input-event-codes.h) of the physical key | ||
modifiers | integer | 0 to 255; For scancode: the HID modifier byte, bit 0 left Ctrl to bit 7 right GUI (0x02 Shift, 0x04 Alt, 0x40 AltGr) | ||
text | string | up to 16000 characters | ||
orientation | string | one of portrait, portrait_upside_down, landscape_left, landscape_right | ||
scale | number | 0.05 to 20 | ||
angle | number | 0 to 180 | ||
width | integer | 1 to 16384 | ||
height | integer | 1 to 16384 | ||
verify_value | boolean | For fill: verify it (off when left out). The editor that takes the focus after the tap must cover the tapped point (or be named by field_name) and be a supported text field; its value is read before writing (an already matching value is not typed again; a value equal to the placeholder never counts as entered text) and read back afterwards on the same session and element. Answers verified, or an error: nothing typed (field_not_focused, field_wrong_target, field_unsupported, field_stale, field_unobservable, field_tap_failed), or field_uncertain when text was sent and its effect is unknown; nothing is ever retyped. Secure fields are refused unread. Transports that cannot read an editor back answer fill_verification_unsupported and send nothing (input_capabilities.fill_verification) | ||
field_name | string | non-empty, up to 256 characters; For a verified fill: the editor must have this accessibility identifier or label (for a field that moves as it takes the focus); otherwise it must cover the tapped point | ||
focus_timeout_ms | integer | 0 to 10000; For a verified fill: how long to wait for the editor to take the focus after the tap (2000 when left out) | ||
submit | boolean | For a verified fill: send one Return to the field once its value is verified (or already matched) and it still has the focus; never on any other outcome. Check where it led with an expect postcondition or a fresh observation | ||
reservation_token | string | up to 200 characters; Act under this device reservation (device.reservation.acquire). A reserved device takes input only with its token; a token whose reservation expired, was released or was taken over is refused before anything is sent. | ||
request_id | string | non-empty, up to 128 characters; matching ^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$; Your identity for this action, unique per intent (order-42-submit). It is recorded with a digest of the arguments before anything is sent; repeating it with the same arguments answers the recorded outcome (retained: true) or request_outcome_unknown instead of sending again, with other arguments request_conflict. A refusal that sent nothing may be repeated under it. device.request.get shows the record. |
tomaccoctl call runtime.input '{"session":"<session>","action":"touch"}'
runtime.capture#
Native capture
Capture a full-resolution PNG from the actual runtime to a local path.
Annotations: writes, not idempotent, open world.
| Argument | Type | Required | Default | Details |
|---|---|---|---|---|
session | string | yes | matching ^[a-f0-9]{32}$; ID returned by runtime.start; separate from desktop preview sessions. | |
path | string | yes | non-empty |
tomaccoctl call runtime.capture '{"session":"<session>","path":"<path>"}'
runtime.hierarchy#
Native accessibility tree
Read Android UI XML, the physical iPhone WDA XML hierarchy or the iOS Simulator accessibility tree for agent inspection.
Annotations: read-only, idempotent, open world.
| Argument | Type | Required | Default | Details |
|---|---|---|---|---|
session | string | yes | matching ^[a-f0-9]{32}$; ID returned by runtime.start; separate from desktop preview sessions. |
tomaccoctl call runtime.hierarchy '{"session":"<session>"}'
runtime.observe#
Observe a session
One fresh look at a connected session, for an agent about to act: a full-resolution PNG frame with its id (the first 16 hex digits of its SHA-256), captured_at, capture_ms and age_ms (0 at capture; add the time since captured_at before acting), the geometry the frame was taken in (width, height, orientation, rotation, and for an iPhone the point size and scale) with the coordinate spaces inputs and screen.* use, the foreground app with home_screen, the keyboard, the input focus, the transport's input_capabilities and a one-line context. Every part names its source. What the transport cannot observe is {available:false, reason}, never a guess: Android reads dumpsys window and dumpsys input_method, a USB iPhone asks WebDriverAgent for the active app, a keyboard element and the active element, the Simulator and AirPlay report no app or keyboard, and AirPlay captures no frame. Over MCP the PNG is embedded. A fixture session answers evidence fixture.
Annotations: writes, not idempotent, open world.
| Argument | Type | Required | Default | Details |
|---|---|---|---|---|
session | string | yes | matching ^[a-f0-9]{32}$; ID returned by runtime.start; separate from desktop preview sessions. | |
path | string | non-empty; Absolute PNG path for the frame; by default observe.png in the session's directory, replaced each time | ||
context | boolean | true | Also read the foreground app, keyboard and focus (one or two transport calls); false answers the frame and geometry only |
tomaccoctl call runtime.observe '{"session":"<session>"}'
runtime.gesture#
Timestamped gesture trace
Deliver one or more contacts as timestamped traces in 0..1 of the frame: each contact's points with t_ms from its touch-down. The answer's mode says what the transport did: atomic_trace (a USB iPhone submits the whole trace as one WebDriverAgent actions request, deterministic but not live) or live (Android, the Simulator and the fixture replay the events with host timing, one contact after another by time). Multi-contact traces need a transport whose input_capabilities (runtime.state) allow it; AirPlay answers an error. Use runtime.input touch for an interactive drag that follows a pointer. With reservation_token it acts under a device reservation (device.reservation.acquire); with request_id it is recorded once in the request ledger, so a repeat after a lost answer is not sent again.
Annotations: writes, not idempotent, open world.
| Argument | Type | Required | Default | Details |
|---|---|---|---|---|
session | string | yes | matching ^[a-f0-9]{32}$; ID returned by runtime.start; separate from desktop preview sessions. | |
contacts | array of object | yes | 1 to 5 items; The fingers, each a trace of 2 to 240 points | |
contacts[].points | array of object | yes | 2 to 240 items | |
contacts[].points[].x | number | yes | 0 to 1 | |
contacts[].points[].y | number | yes | 0 to 1 | |
contacts[].points[].t_ms | integer | yes | 0 to 10000; Milliseconds since this contact touched down; non-decreasing | |
reservation_token | string | up to 200 characters; Act under this device reservation (device.reservation.acquire). A reserved device takes input only with its token; a token whose reservation expired, was released or was taken over is refused before anything is sent. | ||
request_id | string | non-empty, up to 128 characters; matching ^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$; Your identity for this action, unique per intent (order-42-submit). It is recorded with a digest of the arguments before anything is sent; repeating it with the same arguments answers the recorded outcome (retained: true) or request_outcome_unknown instead of sending again, with other arguments request_conflict. A refusal that sent nothing may be repeated under it. device.request.get shows the record. |
tomaccoctl call runtime.gesture '{"session":"<session>","contacts":[{"points":[{"x":0,"y":0,"t_ms":0},{"x":0,"y":0,"t_ms":0}]}]}'
runtime.actions#
Ordered input batch
Run up to 50 input and wait steps in order on one session, in one call, with a result per step. A text step waits until a field has the focus (polling the session's focus and keyboard) before it types, so the first characters are not lost, and answers focus_timeout with nothing typed when no field takes it; where the transport cannot report focus it says so and settles briefly instead. A tap can name a mark from the last screen.marks of this session and is verified like screen.tap. A step may carry expect, a text that must appear or go afterwards: met makes the step verified, otherwise postcondition_failed stops the batch with the step still counted as applied. A fill step with verify_value is verified only when the field's exact value was read back; text sent with an unknown effect makes it uncertain (field_uncertain) and it is never sent again. The first failure stops the rest: the error's details list every step so far (steps), the indexes that reached the device (applied_steps), those whose effect is unknown (uncertain_steps) and those not run (skipped), so an agent never resends an applied step. The whole batch is bounded by timeout and by the client's cancellation. With frame (width, height, orientation from runtime.observe) the batch is refused with frame_stale and nothing sent when the screen's geometry changed since. observe_after appends a fresh runtime.observe. The answer's evidence is fixture on the offline fixture runtime. With reservation_token it acts under a device reservation (device.reservation.acquire); with request_id it is recorded once in the request ledger, so a repeat after a lost answer is not sent again.
Annotations: writes, not idempotent, open world.
| Argument | Type | Required | Default | Details |
|---|---|---|---|---|
session | string | yes | matching ^[a-f0-9]{32}$; ID returned by runtime.start; separate from desktop preview sessions. | |
steps | array of object | yes | 1 to 50 items | |
steps[].action | string | yes | one of tap, swipe, key, text, fill, pinch, rotate, gesture, wait, wait_text, wait_text_gone, wait_stable, observe; tap (x, y or mark), swipe, key, text (after the field has the focus), fill (verify_value reads the value back), pinch, rotate and gesture change the device; wait, wait_text, wait_text_gone, wait_stable and observe only look | |
steps[].x | number | 0 to 1; 0..1 of the frame's width | ||
steps[].y | number | 0 to 1; 0..1 of the frame's height | ||
steps[].x2 | number | 0 to 1; Swipe end | ||
steps[].y2 | number | 0 to 1; Swipe end | ||
steps[].mark | integer | 1 to 200; For tap: a mark number from the last screen.marks of this session, verified like screen.tap | ||
steps[].verify | boolean | true | For tap by mark: check the mark still matches first | |
steps[].hold_ms | integer | 100 to 5000; For tap: hold this long (a long press) | ||
steps[].duration | number | 0.01 to 5; Seconds for swipe and pinch | ||
steps[].key | string | one of home, back, escape, enter, backspace, delete, tab, up, down, left, right, power, volume_up, volume_down, apps | ||
steps[].text | string | up to 16000 characters; For text and fill: what to type; for wait_text and wait_text_gone: what to wait for | ||
steps[].focus | string | "wait" | one of wait, require, none; For text: wait polls the session until a field has the focus (or the keyboard shows where focus is not reported) before typing, and answers focus_timeout with nothing typed when none does; require also fails when the transport cannot report focus; none types at once | |
steps[].focus_timeout_ms | integer | 2000 | 0 to 60000; For text: how long to wait for a focused field. For a verified fill: how long to wait for the editor after the tap, at most 10000 | |
steps[].settle_ms | integer | 300 | 0 to 5000; For text when focus cannot be observed: how long to wait before typing | |
steps[].orientation | string | one of portrait, portrait_upside_down, landscape_left, landscape_right | ||
steps[].scale | number | 0.05 to 20 | ||
steps[].contacts | array of object | 1 to 5 items | ||
steps[].contacts[].points | array of object | yes | 2 to 240 items | |
steps[].contacts[].points[].x | number | yes | 0 to 1 | |
steps[].contacts[].points[].y | number | yes | 0 to 1 | |
steps[].contacts[].points[].t_ms | integer | yes | 0 to 10000 | |
steps[].ms | integer | 0 to 10000; For wait | ||
steps[].timeout_ms | integer | 5000 | 0 to 300000; For wait_text, wait_text_gone and wait_stable | |
steps[].interval_ms | integer | 200 | 50 to 10000 | |
steps[].stable_ms | integer | 500 | 100 to 60000 | |
steps[].threshold | number | 0.001 | 0 to 1 | |
steps[].tolerance | integer | 24 | 0 to 255 | |
steps[].ignore | array of object | up to 100 items | ||
steps[].ignore[].x | integer | yes | at least 0 | |
steps[].ignore[].y | integer | yes | at least 0 | |
steps[].ignore[].width | integer | yes | at least 1 | |
steps[].ignore[].height | integer | yes | at least 1 | |
steps[].source | string | "auto" | one of auto, hierarchy, ocr | |
steps[].fuzzy | boolean | false | ||
steps[].min_confidence | number | 40 | 0 to 100 | |
steps[].language | string | "eng" | matching ^[A-Za-z0-9_+]+$ | |
steps[].region | object | |||
steps[].region.x | integer | yes | at least 0 | |
steps[].region.y | integer | yes | at least 0 | |
steps[].region.width | integer | yes | at least 1 | |
steps[].region.height | integer | yes | at least 1 | |
steps[].context | boolean | true | For observe: also read app, keyboard and focus | |
steps[].expect | object | A postcondition checked after the step: text that must appear (text) or go (text_gone) within timeout_ms; met makes the step verified, otherwise postcondition_failed stops the batch with the step still counted as applied | ||
steps[].expect.text | string | non-empty | ||
steps[].expect.text_gone | string | non-empty | ||
steps[].expect.timeout_ms | integer | 3000 | 0 to 300000 | |
steps[].expect.interval_ms | integer | 200 | 50 to 10000 | |
steps[].expect.source | string | "auto" | one of auto, hierarchy, ocr | |
steps[].expect.fuzzy | boolean | false | ||
steps[].expect.min_confidence | number | 40 | 0 to 100 | |
steps[].expect.language | string | "eng" | matching ^[A-Za-z0-9_+]+$ | |
steps[].expect.region | object | |||
steps[].expect.region.x | integer | yes | at least 0 | |
steps[].expect.region.y | integer | yes | at least 0 | |
steps[].expect.region.width | integer | yes | at least 1 | |
steps[].expect.region.height | integer | yes | at least 1 | |
steps[].verify_value | boolean | For fill: verify the editor and read its exact value back, as runtime.input does; verified makes the step verified, field_uncertain makes it uncertain (listed in uncertain_steps, never resent) | ||
steps[].field_name | string | non-empty, up to 256 characters; For a verified fill: the editor must have this accessibility identifier or label (for a field that moves as it takes the focus); otherwise it must cover the tapped point | ||
steps[].submit | boolean | For a verified fill: send one Return to the field once its value is verified (or already matched) and it still has the focus; never on any other outcome. Check where it led with an expect postcondition or a fresh observation | ||
timeout | integer | 30 | 1 to 300; Seconds for the whole batch, waits included | |
frame | object | The frame the steps were planned on, from runtime.observe: refused with frame_stale when the screen's size or orientation differs now | ||
frame.id | string | up to 64 characters | ||
frame.width | integer | 1 to 16384 | ||
frame.height | integer | 1 to 16384 | ||
frame.orientation | string | one of portrait, landscape | ||
observe_after | boolean | false | Append a fresh observation of the session to the answer | |
reservation_token | string | up to 200 characters; Act under this device reservation (device.reservation.acquire). A reserved device takes input only with its token; a token whose reservation expired, was released or was taken over is refused before anything is sent. | ||
request_id | string | non-empty, up to 128 characters; matching ^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$; Your identity for this action, unique per intent (order-42-submit). It is recorded with a digest of the arguments before anything is sent; repeating it with the same arguments answers the recorded outcome (retained: true) or request_outcome_unknown instead of sending again, with other arguments request_conflict. A refusal that sent nothing may be repeated under it. device.request.get shows the record. |
tomaccoctl call runtime.actions '{"session":"<session>","steps":[{"action":"tap"}]}'