dsh-apk-vm
Local AOSP Android VM for DeepSeek Harness: preview rooted APKs at up to 60 fps, automate UIAutomator flows, and give each Agent an isolated VM. 适合需要进行安卓APK预览、UI自动化测试及沙箱运行的开发者。
インストール
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:yuxiaole-bili/dsh-apk-vmドキュメント
README 全文を読む ↗Configuration
All keys are optional; defaults are shown in the Default column.
| Key | Default | Purpose |
|---|---|---|
emulatorPath | auto-detected | Path to the Android emulator executable. Auto-discovered from the SDK / PATH. |
avdName | — | AVD name to spawn. Required to spawn an AVD. |
serial | — | Attach this adb serial instead of spawning an emulator. |
port | 5558 | Emulator console port used when spawning. |
sdkRoot | ANDROID_HOME / ANDROID_SDK_ROOT | Android SDK root for adb, aapt2, emulator-check, sdkmanager/avdmanager. |
adbPath | /platform-tools/adb | Explicit adb executable. |
systemImage | system-images;android-34;default;x86_64 | System image required by the Environment card and used for AVD creation. |
spawnEmulator | true | Set false to only attach (never spawn). |
emulatorArgs | [] | Extra argv appended to the emulator command line. |
roots | [] | Extra APK discovery roots. The DSH working directory, process.cwd() and the home directory are added automatically. |
bootTimeoutMs | 1200000 | Max wait for the guest to report sys.boot_completed=1. |
gpuMode | host | host uses the real GPU; swiftshader_indirect is the software fallback for headless hosts. |
accel | auto | auto detects AEHD/WHPX/KVM/HAXM/HVF; on/off force the decision. |
requireAccel | true | Fail fast with an explicit error when no hypervisor is found, instead of booting forever under TCG. |
quickBoot | true | Restore the saved AVD snapshot when present; false adds -no-snapshot. |
snapshotName | default_boot | Snapshot name to load/save. |
saveSnapshotAfterBoot | true | Save a snapshot after the first successful cold boot. |
prewarm | false | Boot the VM in the background shortly after plugin activation. |
prewarmDelayMs | 3000 | Delay before the prewarm start. |
autoStart | true | Start the VM on the first /apk-vm/state or /apk-vm/frame request. |
multiInstance | true | Allow isolated extra VMs for concurrent Agents. |
maxInstances | 3 | Maximum number of extra instances (in addition to the default VM). Each running instance costs guest RAM/CPU. |
instanceIdleMs | 900000 | Stop an extra instance after this long without panel frames, a video client, or an Agent command (AVD is kept). |
instanceReapIntervalMs | 60000 | How often the idle reaper checks extra instances. |
allowRemote | false | Allow non-loopback clients to reach /apk-vm/* and /apk-vm/ws (only behind your own authenticated proxy). |
allowSetupDownloads | false | Allow the Environment card's install-image action to run sdkmanager --install (large download). |
frameFps | 2 | PNG fallback target frame rate, 1–10 (the H.264 path is not affected). |
scrcpy | true | Enable the H.264/WebCodecs transport. |
scrcpyMaxSize | 960 | Encoder max size; 960 yields 540×960 video. |
scrcpyMaxFps | 60 | Encoder frame-rate cap, 1–60. |
scrcpyBitrate | 6000000 | Video bitrate in bits/s. |
scrcpyPort | 27183 | Local adb-forward port for the scrcpy server tunnel. |
scrcpyJarPath | vendored JAR | Override the scrcpy server JAR path. |
The Environment report (GET /apk-vm/setup) returns ok, platform, sdkRoot, adbPath,
emulatorPath, avdmanagerPath, sdkmanagerPath, emulatorVersion, systemImage +
systemImagePresent, avdName + avdPresent + avdPath, accel { available, backend, detail }, hypervisorNotes, missing[] and actions[] with per-action availability.
Quick boot fails: "different AVD configuration", black screen, or no snapshot
- The snapshot is only valid for the AVD configuration that created it. After changing the AVD
(API level, ABI, resolution, GPU mode,
-writable-system, …) delete the old snapshot and let the plugin create a new one: remove~/.android/avd/.avd/snapshots/(on Windows,%USERPROFILE%\.android\avd\.avd\snapshots\), then start cold again. - A snapshot directory with
ram.imgbut nosnapshot.pbis not a valid snapshot; the plugin ignores it. Delete it or setquickBoot: falseonce to force a clean cold boot. - If a stale offline adb emulator is attached,
adb kill-server(or kill the leftoveremulator/qemu-system-*process) and retry.