Skip to content

About

run.cloud provider plugin for agent-device (iOS simulators and Android emulators)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Note

This repository mirrors the plugin's folder in run.cloud's monorepo; each commit is a snapshot of one monorepo commit. Issues are welcome here. Pull requests are welcome too: the run.cloud team reviews them and ports them into the monorepo, and the next sync brings the change back here.

@run-cloud/agent-device

run.cloud's cloud iOS Simulators and Android emulators as an agent-device provider. Connect once with agent-device connect runcloud, and install, open, snapshot, click, fill, screenshot and the other device commands run on a run.cloud device, from any machine: Linux, Windows, CI or a cloud agent. run.cloud bills sessions per minute.

Install

You need agent-device, npm, and a run.cloud account. Each line of this plugin goes with one agent-device plugin API:

agent-device Plugin API @run-cloud/agent-device npm dist-tag
0.21.42 or later 0.21 version 2 0.1.x latest
0.22 (nightlies until it is released) version 3 0.2.x next

agent-device 0.22 refuses a version 2 plugin (incompatible-plugin-api), and 0.21 cannot load a version 3 one.

On agent-device 0.21:

agent-device plugins add @run-cloud/agent-device

On agent-device 0.22, until 0.2.x is published as latest, name the dist-tag or the version; plugins add passes either to npm:

npm install -g [email protected]         # a 0.22 nightly, such as 0.22.0-nightly-0-22.20261127.255
agent-device plugins add @run-cloud/agent-device@next     # or @run-cloud/[email protected]

plugins update keeps the tag or version plugins add was given, so a plugin added as @next stays on next. When 0.2.x is published as latest, run agent-device plugins add @run-cloud/agent-device@latest once to follow latest again.

plugins add also installs a local build: give it the tarball's path, absolute or starting with ./ (agent-device reports its compatibility as unchecked):

agent-device plugins add ./run-cloud-agent-device-0.2.0-next.2.tgz

After you add or update the plugin, close open sessions and run agent-device daemon stop; the next device command loads it.

Connect

export RUN_CLOUD_API_KEY=rc_live_...      # an API key from https://run.cloud/dashboard/keys
export AGENT_DEVICE_SESSION=my-agent      # agent-device needs a named session for a provider
agent-device connect runcloud --platform ios        # or --platform android

connect checks the key against run.cloud without starting a device. The session starts on the first device command, such as install or open, and is released when the agent-device session closes. A session that gets no commands for 10 minutes is closed by run.cloud (change it with the inactivityTimeout option).

The plugin reads the key the way @run-cloud/sdk does: RUN_CLOUD_API_KEY, then RUN_CLOUD_API_TOKEN, then RUN_CLOUD_CI_ENVIRONMENT_TOKEN. RUN_CLOUD_API_URL points it at another run.cloud API than https://api.run.cloud. The daemon reads these when it starts, so after you change them, run agent-device daemon stop.

Pick the device with --device:

Device Flags
iPhone 17e, iOS 26.5 (default) --platform ios, or --device iphone
iPad (A16), iOS 26.5 --platform ios --device ipad
Android emulator, Pixel family (default) --platform android, or --device pixel

On iOS, --device also takes the Simulator's name, and --provider-os-version takes 26 or 26.5. run.cloud picks the Android version, so --provider-os-version is refused on Android. Every other provider flag, such as --provider-app, is refused with the flag's name.

Install and run an app

agent-device connect runcloud --platform ios
agent-device install com.example.app ./build/Build/Products/Debug-iphonesimulator/MyApp.app
agent-device open com.example.app
agent-device snapshot -i
agent-device fill 'id="email"' '[email protected]'
agent-device click 'label="Sign In"'
agent-device screenshot screen.png
agent-device close com.example.app
agent-device disconnect

iOS devices are Simulators, so they take an app built for the Simulator: a .app from xcodebuild -sdk iphonesimulator (the plugin packs it), or a .zip or .tar.gz of one. An .ipa built for a physical iPhone is refused. Android emulators take an .apk; build a universal .apk from an .aab first.

What works on each platform

agent-device command iOS Simulator Android emulator
snapshot yes yes
screenshot yes, one pixel per point unless --pixel-density asks otherwise yes, in device pixels
click, press, longpress, focus yes yes
fill yes: focuses the field, selects all, deletes, types yes, the same
type printable ASCII, tabs and line feeds the same
scroll, swipe, gesture (pan, fling, drag, pinch, rotate) yes, with at most two fingers yes, the same
back no: iOS has no system back button yes
home, app-switcher yes yes
orientation portrait, landscape-left, landscape-right all four
clipboard read and write yes yes
open <bundle id>, close <bundle id> yes, with --launch-args yes, without launch arguments
open <url>, trigger-app-event yes yes
install Simulator .app, .zip, .tar.gz .apk

open and close of an app by its id need a run.cloud API that serves app launch; where it does not yet, the commands say so, and open <url> opens a deep link.

App logs, record, network capture, perf, the alert commands, settings, apps, uninstall, push notifications, keyboard status, port reverse and custom snapshot actions are unavailable, each with a hint that says why and where to go instead. @run-cloud/sdk sets appearance, location and permissions, records the screen and reads logs directly.

Options

A JavaScript host that loads the plugin itself, or plugins["@run-cloud/agent-device"].options in agent-device's config.json, can pass:

Option Meaning
apiKey Used instead of RUN_CLOUD_API_KEY
baseUrl Used instead of RUN_CLOUD_API_URL
inactivityTimeout Idle time before run.cloud closes a session: 10m by default, none to turn it off
hardTimeout The longest a session runs, such as 30m; run.cloud's default when left out

How it is built

agent-device's provider plugins bundle parts of agent-device that are not published on their own. This package is built the same way Callstack builds @agent-device/revyl and @agent-device/limrun: inside agent-device's repository, at the published agent-device version in AGENT_DEVICE_VERSION. A release such as 0.21.42 is built from its tag v0.21.42. While 0.22 is unreleased, the file names a 0.22 nightly, such as 0.22.0-nightly-0-22.20261127.255, and the build clones its tag nightly-0.22/v0.22.0-nightly-0-22.20261127.255, which agent-device's release workflow puts on the exact commit of the 0.22 branch the nightly was built from (3340ed0bd for that nightly). To move to a newer nightly or to the 0.22.0 release, change the file and run the build. It also bundles @run-cloud/sdk, so the published package has no dependencies to install.

scripts/build.sh                                  # bundles @run-cloud/sdk from npm, in the range its devDependency names
RUN_CLOUD_SDK_PATH=../sdk scripts/build.sh        # bundles a local SDK checkout, built first

It clones that release, runs the unit tests and the type check, builds, checks that the bundle imports nothing but Node built-ins, and runs Callstack's package check against the published agent-device of the same release: an isolated plugins add-style install, then connect to a stand-in run.cloud API. It needs git, Node 22.12 or later and npm, and works in a plain clone of the source repository.

Source and issues

The source is at github.com/newly-app/run-cloud-agent-device, a mirror of the plugin's folder in run.cloud's monorepo. Report plugin problems in its issues. Pull requests are welcome there too: the run.cloud team reviews them and ports them into the monorepo, and the next sync brings them back. The repository's CI runs scripts/build.sh on every push and pull request.

Maintained by run.cloud; we keep it current with agent-device's plugin contract.

License

MIT. The published package bundles parts of agent-device, which is MIT-licensed by Callstack, and @run-cloud/sdk with the packages it depends on; the notices are in LICENSE.

About

run.cloud provider plugin for agent-device (iOS simulators and Android emulators)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages