Introduction¶
The design philosophy of DSH is “everything is a plugin.” When running DSH Go on a phone, local plugins can extend AI capabilities. If you need the AI to directly operate an Android virtual machine running inside AndVM, then dshgo-vmbridge is the plugin specifically designed for that purpose.
It does not provide the virtual machine itself; rather, it connects to AndVM via ADB and registers the VM’s screen, tap, input, root shell, APK installation, and screenshot capabilities as tools that the AI can invoke directly.
What Is a Plugin¶
dshgo-vmbridge is a local client plugin for DSH Go. It runs inside DSH’s proot environment and drives the Android 12 virtual machine inside AndVM via ADB (the VM has already been granted root privileges through Magisk). The plugin provides 22 vm_* tools, enabling the AI to interact with the VM just as it would with a physical device.
Prerequisites¶
Two prerequisites must be met before using the plugin.
- AndVM Virtual Machine
Install AndVM (package name com.lerist.andvm), and create and start a VM inside it. In the VM’s Settings → Debug, enable ADB. The debug page will display “Local Address 127.0.0.1:NNNNN” — note this port. The port changes every time the VM restarts.
- Shot.apk (required inside the VM)
Inside the AndVM virtual machine, gralloc mapper is not registered, so screencap will throw an error and produce a 0-byte file in this environment. The plugin uses AccessibilityService.takeScreenshot() to work around this limitation, so Shot.apk must be installed inside the VM. A copy of Shot.apk is included in the plugin directory. Install it as follows:
vm_shot_setup(reinstall=true)
This command will: push Shot.apk → run pm install -r -g → enable the accessibility service → perform a self-test screenshot. After installation, go to Settings → Accessibility → Shot in the VM and confirm the status is “Enabled.”
Installing the Plugin¶
Copy the plugin directory to DSH Go’s plugins directory:
cp -r dshgo-vmbridge "$DSH_HOME/dsh-go/plugins/local-vmbridge"
Register it in your DSH profile:
dsh plugin --profile web add "$DSH_HOME/dsh-go/plugins/local-vmbridge"
Restart the engine (App → Settings → Engine → Restart).
Alternatively, you can symlink this directory to $DSH_HOME/dsh-go/plugins/local-vmbridge and then proceed to step 2.
Once installation is successful, a “VM Bridge” panel will appear in the session, and it can also be found on the Features page.
First-Time Usage¶
On first use, call the tools in the following order:
1. vm_connect_adb(port=40777) # Enter the port from the AndVM debug page; just the number is fine
2. vm_status() # Confirm state=device, root=true
3. vm_shot_setup() # Install/fix the screenshot app; self-test with one screenshot
4. vm_screen() # View the current VM screen (numbered element list)
vm_connect_adb supports three parameter forms:
| Parameter | Example | Description |
|---|---|---|
port |
40777 |
Automatically prepends 127.0.0.1: |
addr |
127.0.0.1:40777 |
Full address |
scan |
true |
Auto-scans ports 32768–60999 for a listening ADB (takes ~60–90 seconds) |
When the port changes after an AndVM restart, simply use scan=true to avoid manually copying the port.
Tool Reference¶
The plugin provides the following tools, grouped by function: Connection, Observation, Interaction, App Management, Shell/Files, and Screenshot App.
Connection¶
| Tool | Description |
|---|---|
vm_status |
Current port, device/offline/unauthorized, guest OS version, su root status |
vm_connect_adb |
Connect to ADB (addr / host+port / scan) |
Observation¶
| Tool | Description |
|---|---|
vm_screen |
Primary observation tool. Returns a numbered element list, e.g. [3] Settings tappable @494,334; numbers are only valid for the current screen |
vm_ui |
Raw UI nodes, for when you need structured data |
vm_screenshot |
Capture one screenshot, save it locally, return dimensions and byte size |
vm_shots |
Capture a burst of screenshots, useful for observing animations or loading processes |
vm_current |
Current foreground app / activity |
vm_activity |
Top of the activity stack |
Interaction¶
| Tool | Description |
|---|---|
vm_tap |
Tap. Supports id (number from vm_screen) or x/y |
vm_click |
Tap by text; locates the tappable parent node |
vm_swipe |
Straight or polyline swipe, points=[[x,y],…] |
vm_key |
System keys: back / home / recents / notifications / enter |
vm_text |
Type text into the focused input field |
vm_tap/vm_click/vm_swipe/vm_key/vm_textautomatically re-read the screen after execution and return a newscreenobject — no need to callvm_screenagain.
App Management¶
| Tool | Description |
|---|---|
vm_apps |
List installed apps, filterable by keyword |
vm_start |
Launch an app |
vm_install_apk |
Install a local APK (chunked push → pm install -r -g -d → reverse-lookup package name from diff) |
vm_uninstall_apk |
Uninstall an app (supports --user 0) |
vm_apk_info |
Query APK path, size, version, and install time |
Shell / Files¶
| Tool | Description |
|---|---|
vm_shell |
Run a command. Uses su -c by default; automatically falls back to a regular shell if su is unavailable |
vm_file_push |
Push a file to the VM (auto-chunks files >1 MB) |
vm_file_pull |
Pull a file from the VM |
Screenshot App¶
| Tool | Description |
|---|---|
vm_shot_setup |
Install/repair Shot: install APK, enable accessibility, run a self-test screenshot |
Typical Usage¶
Example: Check the VM’s current screen, then open Settings and turn off WLAN.
You: What does the VM screen look like right now?
AI: vm_screen() → Screen 720x1600 com.android.launcher3/.QuickstepLauncher (via accessibility)
You: Open Settings and turn off WLAN.
AI: vm_tap(id=2) → Settings opens, with an updated screen
vm_click(text="Network & Internet")
vm_screen() → The WLAN row is [5]
vm_tap(id=5)
vm_click(text="Off")
Troubleshooting¶
| Symptom | Cause / Fix |
|---|---|
Cannot connect to 127.0.0.1:NNNNN |
Port changed after AndVM restart. Get the new port from the debug page, or use vm_connect_adb(scan=true) |
unauthorized |
Tap “Allow USB debugging” on the VM screen and check “Always allow” |
offline |
In AndVM, disable and re-enable “Enable ADB”; the port may have changed |
root: false |
In the VM: Magisk → Superuser → grant access to “Shell” |
Screenshot failed: accessibility service not connected |
Run vm_shot_setup(reinstall=true); if it still fails, go to Settings → Accessibility and manually enable Shot |
Screenshot timed out |
Accessibility was reclaimed by the system (am force-stop kills it). Run vm_shot_setup() to restart it |
No vm_* tools in the list |
Plugin not loaded. Run dsh plugin --profile web list to confirm local-vmbridge exists, then restart the engine |
Known Trade-offs¶
- Screenshot is slow: accessibility
takeScreenshottakes 3–6 seconds per capture, slower thanscreencap, butscreencapdoes not work in this VM environment. - Screenshot includes the status bar:
takeScreenshotcaptures the full screen. - Accessibility and
am force-stopare mutually exclusive: after runningam force-stoponcom.dsh.shot, the accessibility service must be re-enabled. - AndVM only:
127.0.0.1:PORTis the address format provided by AndVM’s ADB debug page. Other emulators may require a modifiedaddr, but this is unverified.
Use Cases and Notes¶
This plugin is suited for developers who need the AI to directly operate an Android virtual machine on a phone, especially when using AndVM as a no-root environment.
The plugin runs with the current DSH process’s privileges. It is recommended to review the source code and license (MIT) before use.
Conclusion¶
dshgo-vmbridge maps AndVM’s capabilities to AI-invocable tools via ADB, enabling DSH to control a virtual machine directly from a phone. If you need the AI to directly operate the Android system inside AndVM, you can install this plugin following the steps above after setting up AndVM.
Plugin directory: https://www.skillhub.cn/plugins/xqe-bkflda/dshgo-vmbridge
GitHub: https://github.com/xqe-bkflda/dshgo-vmbridge