dsh-apk-vm 0.3.13 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0
4
+
5
+ Substantive feature release: inspection, replay, package bundles, network debugging,
6
+ reproducible demo, and real Linux support.
7
+
8
+ ### Added
9
+
10
+ - **UI Inspector + selector generation.** `GET /apk-vm/debug/inspect` returns parsed
11
+ UIAutomator nodes with bounds, labels and copy-ready `find_ui` / `assert_text` / `tap_text`
12
+ commands; the panel renders a clickable overlay and the `apk_vm` tool gains `inspect_ui`.
13
+ - **Interaction recorder / replay.** `GET|POST /apk-vm/flows` lists, starts, stops, replays
14
+ and deletes JSON flows of tap/swipe/key/text input; the panel has a Flow recorder card and
15
+ Agents get `flow_start`, `flow_stop`, `flow_list`, `flow_replay`.
16
+ - **APKS / XAPK / split APK installation.** Upload and install `adb install-multiple` bundles;
17
+ `.aab` is rejected with a bundletool hint. The APK list tags bundle files.
18
+ - **Network debugging.** Set/clear the guest global HTTP proxy and install a local PEM/DER CA
19
+ with the correct OpenSSL subject hash via `/apk-vm/debug/proxy` and `/apk-vm/debug/ca`
20
+ (plus Agent tool actions `proxy` and `install_ca`).
21
+ - **Reproducible public demo.** `examples/` contains a committed MIT-licensed 12 KB sample
22
+ APK, a deterministic SDK-only build script, and `demo.mjs`, which installs it, taps the
23
+ button, asserts `Hello from dsh-apk-vm`, and saves a screenshot.
24
+ - **Real Linux support.** Headless x86_64 validation on Ubuntu 22.04 with KVM and
25
+ SwiftShader: boot, adb root, APK install, UIAutomator input, H.264/scrcpy, proxy, CA and
26
+ screenshots; documented in `docs/LINUX-E2E.md`.
27
+
28
+ ### Fixed
29
+
30
+ - **Dangerous auto-attach stop behavior.** `AndroidVm.stop()` no longer sends
31
+ `adb emu kill`/`adb disconnect` to a pre-existing device that this process did not spawn;
32
+ it leaves such devices running and reports `stopped`. A regression test covers it.
33
+ - Headless Linux launches now request `-no-metrics` and fall back from host GPU to
34
+ `swiftshader_indirect` when no display is present.
35
+ - `uiDump()` now includes UIAutomator stderr in its error instead of a generic
36
+ "empty hierarchy".
37
+ - `spike/android/smoke.mjs` updated for the richer APK metadata and the current
38
+ package-not-found message.
39
+
3
40
  ## 0.3.13
4
41
 
5
42
  Open-source package identity.
@@ -13,6 +50,7 @@ Open-source package identity.
13
50
  - Removed `private: true` and added `publishConfig` for the public npm package
14
51
  **`dsh-apk-vm`**; the primary install command is now
15
52
  `dsh plugin --profile web add dsh-apk-vm` (source/GitHub install remains a fallback).
53
+ Published: <https://www.npmjs.com/package/dsh-apk-vm> (`0.3.13`).
16
54
  - Wrote the package/plugin descriptions (English + Chinese `meta.description`), expanded
17
55
  keywords, and added a suggested GitHub repository description/topics list to
18
56
  `docs/RELEASING.md`.
package/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # APK Virtual Machine — a DeepSeek Harness plugin
2
2
 
3
3
  [![CI](https://github.com/yuxiaole-bili/dsh-apk-vm/actions/workflows/ci.yml/badge.svg)](https://github.com/yuxiaole-bili/dsh-apk-vm/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/dsh-apk-vm.svg)](https://www.npmjs.com/package/dsh-apk-vm)
4
5
  [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
5
6
  [![GitHub](https://img.shields.io/badge/github-yuxiaole--bili%2Fdsh--apk--vm-181717)](https://github.com/yuxiaole-bili/dsh-apk-vm)
7
+ [![Listed on dsh-plugin.org](https://dsh-plugin.org/badges/listed.svg)](https://dsh-plugin.org/plugins/yuxiaole-bili/dsh-apk-vm)
6
8
 
7
9
  **Run a real Android APK inside a local, rooted, open-source Android VM and preview it in the DeepSeek Harness sidebar — streamed as H.264/WebCodecs video at up to 60 fps.**
8
10
 
@@ -21,11 +23,9 @@ same-origin, loopback-only debug HTTP API and an `apk_vm` Agent tool.
21
23
  > 参考机上冷启动约 29.5 s、快照快速启动约 8.4–10.5 s。
22
24
  > 当前 **Windows x64 为端到端已验证平台**;SDK/模拟器探测已覆盖 Windows / macOS / Linux。
23
25
 
24
- **Status:** `0.3.13` · Apache-2.0 · no npm runtime dependencies · no build step.
26
+ **Status:** `0.4.0` · Apache-2.0 · no npm runtime dependencies · no build step.
25
27
 
26
- This is an open-source DSH plugin. The package is prepared for npm as **`dsh-apk-vm`**; the
27
- install command below uses that package name. If npm does not have the package yet, use the
28
- source fallback below. Repository:
28
+ This is an open-source DSH plugin published on npm as **`dsh-apk-vm`**. Repository:
29
29
  [github.com/yuxiaole-bili/dsh-apk-vm](https://github.com/yuxiaole-bili/dsh-apk-vm).
30
30
  Maintainer: [yuxiaole-bili](https://github.com/yuxiaole-bili/).
31
31
  Please read [CONTRIBUTING.md](CONTRIBUTING.md), [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md),
@@ -41,7 +41,7 @@ the session.
41
41
  ## Install
42
42
 
43
43
  Install the published npm package (the command used by the DSH plugin center and the community
44
- market). If the package is not yet visible in your registry, use the source fallback below.
44
+ market):
45
45
 
46
46
  ```bash
47
47
  dsh plugin --profile web add dsh-apk-vm
@@ -90,8 +90,10 @@ and Agent-facing UI automation for development workflows.
90
90
  **Compatibility**
91
91
 
92
92
  - Tested with DSH Desktop `0.2.1-rc.3` (static bundle/plugin APIs).
93
- - Windows x64 is the only platform verified end-to-end (boot, H.264, rooted debug, Agent tool).
94
- macOS/Linux have headless setup/CI coverage but not a live emulator run in this repository.
93
+ - Windows x64 and Linux x86_64 (headless, KVM + SwiftShader) are verified end-to-end
94
+ (boot, H.264, rooted debug, APK install, Agent tool). macOS has SDK discovery + headless CI
95
+ coverage but no live emulator run in this repository.
96
+ See [docs/LINUX-E2E.md](docs/LINUX-E2E.md).
95
97
  - Optional integration with
96
98
  [`dsh-better-sidebar`](https://github.com/omdsh-dev/DSH-better-sidebar); the plugin falls back
97
99
  cleanly when that service is absent.
@@ -155,6 +157,22 @@ key {"text":"HOME"} -> returned to launcher
155
157
  (raw APK bytes, ≤ 500 MiB, `.apk`/ZIP magic checked), installed into the running VM and
156
158
  launched. Uploaded files live in the OS temp dir and are cleaned up when the plugin is
157
159
  disposed. Installing by absolute local path is still available (`/apk-vm/install`).
160
+ - **APK bundles: APKS / XAPK / split APKs.** The Upload APK flow accepts `.apk`, `.apks`
161
+ (bundletool output) and `.xapk` files; split APKs are extracted to a temp directory and
162
+ installed with `adb install-multiple`. Plain `.apk` still uses `adb install -r`.
163
+ `.aab` is rejected with a clear "build APKs with bundletool first" message.
164
+ - **UI Inspector + selector generation.** Toggle **Inspect UI** in the panel to overlay
165
+ clickable UIAutomator nodes on the live screen. Selecting a node shows its text, resource id,
166
+ class and bounds and gives copy-ready `tap_text` / `assert_text` commands for the `apk_vm`
167
+ tool. Also available to Agents as the `inspect_ui` action.
168
+ - **Interaction recorder / replay.** Start a recording, use the panel or Agent tool normally,
169
+ then save the tap / swipe / key / text sequence as a JSON flow under the OS temp directory.
170
+ Flows can be listed, replayed with their original relative timing, downloaded or deleted.
171
+ Agents get `flow_start`, `flow_stop`, `flow_list` and `flow_replay`.
172
+ - **Network debugging: proxy + CA.** The Network card sets/clears the guest global HTTP proxy
173
+ (`settings put global http_proxy`) and installs a local `.pem`/`.crt` CA into the rooted
174
+ Android user CA store with the correct OpenSSL subject-hash filename; the system CA store is
175
+ updated when the guest allows a remount.
158
176
  - **Installed-app management.** The panel's **Installed apps** card lists third-party packages
159
177
  for the active instance and offers force-stop, clear-data and uninstall; it uses the same
160
178
  rooted `debug/packages` + `debug/action` API as the Agent tool.
@@ -194,8 +212,8 @@ key {"text":"HOME"} -> returned to launcher
194
212
  8.4–10.5 s** on the reference host ([details](#fast-start-four-layers)).
195
213
  - **Cross-platform SDK discovery.** `lib/setup.js` and `lib/android.js` discover Android SDK,
196
214
  `adb`, the emulator and AVDs across Windows, macOS and Linux layouts (including `.exe`
197
- suffixes and per-OS fallback locations). Windows x64 is the only platform verified end-to-end
198
- so far.
215
+ suffixes and per-OS fallback locations). Windows x64 and **Linux x86_64 headless** are
216
+ verified end-to-end; see [docs/LINUX-E2E.md](docs/LINUX-E2E.md).
199
217
  - **Same-origin only.** Every `/apk-vm/*` HTTP route and the `/apk-vm/ws` upgrade rejects
200
218
  cross-origin requests; request bodies and command output are bounded, and host processes are
201
219
  spawned with argv arrays (never a shell string).
@@ -206,6 +224,33 @@ key {"text":"HOME"} -> returned to launcher
206
224
 
207
225
  ---
208
226
 
227
+ ## UI Inspector and flow recorder
228
+
229
+ - `GET /apk-vm/debug/inspect` (and `/apk-vm/instances/<id>/debug/inspect`) returns the parsed
230
+ UIAutomator nodes with bounds, labels, and generated `find_ui` / `assert_text` / `tap_text`
231
+ commands. The panel's **Inspect UI** button renders the same data as an overlay.
232
+ - `GET|POST /apk-vm/flows` (and `/apk-vm/instances/<id>/flows`) lists, starts, stops, replays
233
+ and deletes recorded flows. The panel has a **Flow recorder** card with the same actions.
234
+ - `apk_vm` actions: `inspect_ui`, `flow_start`, `flow_stop`, `flow_list`, `flow_replay`.
235
+ - `POST /apk-vm/debug/proxy` sets the guest HTTP proxy; `DELETE` clears it.
236
+ - `POST /apk-vm/debug/ca` accepts a host `.pem`/`.crt` path and installs it under the guest's
237
+ user CA directory with the correct subject hash.
238
+
239
+ ## Reproducible demo
240
+
241
+ A public, dependency-free demo lives in [examples](examples/README.md):
242
+
243
+ ```bash
244
+ node examples/demo.mjs
245
+ ```
246
+
247
+ It installs the committed MIT-licensed 12 KB sample APK (`dev.dsh.sample`), reads the
248
+ UIAutomator tree, taps **Say hello**, asserts that the screen now says
249
+ `Hello from dsh-apk-vm`, and saves a 720×1280 screenshot to `examples/demo-out/`. No personal
250
+ APK, private key or host-specific path is required.
251
+
252
+ ---
253
+
209
254
  ## Quickstart
210
255
 
211
256
  ### 1. Prerequisites
@@ -858,9 +903,9 @@ customization remain research notes in [DESIGN.md](DESIGN.md) §8.
858
903
 
859
904
  ## Known limitations
860
905
 
861
- - **Windows x64 is the only end-to-end verified platform.** SDK/adb/emulator/AVD discovery is
862
- implemented for Windows, macOS and Linux, but emulator + H.264 behavior on macOS/Linux (and
863
- `arm64-v8a` images on Apple Silicon) is unverified.
906
+ - **Windows x64 and Linux x86_64 are the end-to-end verified platforms.** macOS SDK/adb/
907
+ emulator/AVD discovery and headless checks are implemented, but emulator + H.264 behavior on
908
+ macOS (and `arm64-v8a` images on Apple Silicon) is unverified.
864
909
  - **Hardware virtualization is mandatory** for the x86_64 AOSP image; pure TCG fails by design.
865
910
  - **Quick boot is snapshot-based.** Changing AVD configuration invalidates the snapshot; recreate
866
911
  it as described in [Troubleshooting](#quick-boot-fails-different-avd-configuration-black-screen-or-no-snapshot).