dsh-apk-vm 0.3.13 → 0.4.1

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,53 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.1
4
+
5
+ Privacy cleanup for the published proof assets.
6
+
7
+ ### Changed
8
+
9
+ - Cropped `docs/screenshot-sidebar.png` to the plugin panel only (removes the center session
10
+ area and workspace label; the APK paths were already redacted).
11
+ - Removed host account names from `docs/LINUX-E2E.md`; the document now describes the KVM
12
+ group requirement without identifying accounts.
13
+
14
+ ## 0.4.0
15
+
16
+ Substantive feature release: inspection, replay, package bundles, network debugging,
17
+ reproducible demo, and real Linux support.
18
+
19
+ ### Added
20
+
21
+ - **UI Inspector + selector generation.** `GET /apk-vm/debug/inspect` returns parsed
22
+ UIAutomator nodes with bounds, labels and copy-ready `find_ui` / `assert_text` / `tap_text`
23
+ commands; the panel renders a clickable overlay and the `apk_vm` tool gains `inspect_ui`.
24
+ - **Interaction recorder / replay.** `GET|POST /apk-vm/flows` lists, starts, stops, replays
25
+ and deletes JSON flows of tap/swipe/key/text input; the panel has a Flow recorder card and
26
+ Agents get `flow_start`, `flow_stop`, `flow_list`, `flow_replay`.
27
+ - **APKS / XAPK / split APK installation.** Upload and install `adb install-multiple` bundles;
28
+ `.aab` is rejected with a bundletool hint. The APK list tags bundle files.
29
+ - **Network debugging.** Set/clear the guest global HTTP proxy and install a local PEM/DER CA
30
+ with the correct OpenSSL subject hash via `/apk-vm/debug/proxy` and `/apk-vm/debug/ca`
31
+ (plus Agent tool actions `proxy` and `install_ca`).
32
+ - **Reproducible public demo.** `examples/` contains a committed MIT-licensed 12 KB sample
33
+ APK, a deterministic SDK-only build script, and `demo.mjs`, which installs it, taps the
34
+ button, asserts `Hello from dsh-apk-vm`, and saves a screenshot.
35
+ - **Real Linux support.** Headless x86_64 validation on Ubuntu 22.04 with KVM and
36
+ SwiftShader: boot, adb root, APK install, UIAutomator input, H.264/scrcpy, proxy, CA and
37
+ screenshots; documented in `docs/LINUX-E2E.md`.
38
+
39
+ ### Fixed
40
+
41
+ - **Dangerous auto-attach stop behavior.** `AndroidVm.stop()` no longer sends
42
+ `adb emu kill`/`adb disconnect` to a pre-existing device that this process did not spawn;
43
+ it leaves such devices running and reports `stopped`. A regression test covers it.
44
+ - Headless Linux launches now request `-no-metrics` and fall back from host GPU to
45
+ `swiftshader_indirect` when no display is present.
46
+ - `uiDump()` now includes UIAutomator stderr in its error instead of a generic
47
+ "empty hierarchy".
48
+ - `spike/android/smoke.mjs` updated for the richer APK metadata and the current
49
+ package-not-found message.
50
+
3
51
  ## 0.3.13
4
52
 
5
53
  Open-source package identity.
@@ -13,6 +61,7 @@ Open-source package identity.
13
61
  - Removed `private: true` and added `publishConfig` for the public npm package
14
62
  **`dsh-apk-vm`**; the primary install command is now
15
63
  `dsh plugin --profile web add dsh-apk-vm` (source/GitHub install remains a fallback).
64
+ Published: <https://www.npmjs.com/package/dsh-apk-vm> (`0.3.13`).
16
65
  - Wrote the package/plugin descriptions (English + Chinese `meta.description`), expanded
17
66
  keywords, and added a suggested GitHub repository description/topics list to
18
67
  `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
 
@@ -19,13 +21,12 @@ same-origin, loopback-only debug HTTP API and an `apk_vm` Agent tool.
19
21
  > 点击、滑动、按键、文本输入送回虚拟机。支持拖拽 APK 上传、环境自检卡片、root 调试
20
22
  > API 与 `apk_vm` Agent 工具;多个 Agent 可各自使用独立的隔离虚拟机实例(多开)。
21
23
  > 参考机上冷启动约 29.5 s、快照快速启动约 8.4–10.5 s。
22
- > 当前 **Windows x64 为端到端已验证平台**;SDK/模拟器探测已覆盖 Windows / macOS / Linux。
24
+ > 当前 **Windows x64 与 Linux x86_64(headless)为端到端已验证平台**;macOS 仅做探测/CI
25
+ > 覆盖,详见 `docs/LINUX-E2E.md`。
23
26
 
24
- **Status:** `0.3.13` · Apache-2.0 · no npm runtime dependencies · no build step.
27
+ **Status:** `0.4.1` · Apache-2.0 · no npm runtime dependencies · no build step.
25
28
 
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:
29
+ This is an open-source DSH plugin published on npm as **`dsh-apk-vm`**. Repository:
29
30
  [github.com/yuxiaole-bili/dsh-apk-vm](https://github.com/yuxiaole-bili/dsh-apk-vm).
30
31
  Maintainer: [yuxiaole-bili](https://github.com/yuxiaole-bili/).
31
32
  Please read [CONTRIBUTING.md](CONTRIBUTING.md), [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md),
@@ -41,7 +42,7 @@ the session.
41
42
  ## Install
42
43
 
43
44
  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.
45
+ market):
45
46
 
46
47
  ```bash
47
48
  dsh plugin --profile web add dsh-apk-vm
@@ -90,8 +91,10 @@ and Agent-facing UI automation for development workflows.
90
91
  **Compatibility**
91
92
 
92
93
  - 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.
94
+ - Windows x64 and Linux x86_64 (headless, KVM + SwiftShader) are verified end-to-end
95
+ (boot, H.264, rooted debug, APK install, Agent tool). macOS has SDK discovery + headless CI
96
+ coverage but no live emulator run in this repository.
97
+ See [docs/LINUX-E2E.md](docs/LINUX-E2E.md).
95
98
  - Optional integration with
96
99
  [`dsh-better-sidebar`](https://github.com/omdsh-dev/DSH-better-sidebar); the plugin falls back
97
100
  cleanly when that service is absent.
@@ -155,6 +158,22 @@ key {"text":"HOME"} -> returned to launcher
155
158
  (raw APK bytes, ≤ 500 MiB, `.apk`/ZIP magic checked), installed into the running VM and
156
159
  launched. Uploaded files live in the OS temp dir and are cleaned up when the plugin is
157
160
  disposed. Installing by absolute local path is still available (`/apk-vm/install`).
161
+ - **APK bundles: APKS / XAPK / split APKs.** The Upload APK flow accepts `.apk`, `.apks`
162
+ (bundletool output) and `.xapk` files; split APKs are extracted to a temp directory and
163
+ installed with `adb install-multiple`. Plain `.apk` still uses `adb install -r`.
164
+ `.aab` is rejected with a clear "build APKs with bundletool first" message.
165
+ - **UI Inspector + selector generation.** Toggle **Inspect UI** in the panel to overlay
166
+ clickable UIAutomator nodes on the live screen. Selecting a node shows its text, resource id,
167
+ class and bounds and gives copy-ready `tap_text` / `assert_text` commands for the `apk_vm`
168
+ tool. Also available to Agents as the `inspect_ui` action.
169
+ - **Interaction recorder / replay.** Start a recording, use the panel or Agent tool normally,
170
+ then save the tap / swipe / key / text sequence as a JSON flow under the OS temp directory.
171
+ Flows can be listed, replayed with their original relative timing, downloaded or deleted.
172
+ Agents get `flow_start`, `flow_stop`, `flow_list` and `flow_replay`.
173
+ - **Network debugging: proxy + CA.** The Network card sets/clears the guest global HTTP proxy
174
+ (`settings put global http_proxy`) and installs a local `.pem`/`.crt` CA into the rooted
175
+ Android user CA store with the correct OpenSSL subject-hash filename; the system CA store is
176
+ updated when the guest allows a remount.
158
177
  - **Installed-app management.** The panel's **Installed apps** card lists third-party packages
159
178
  for the active instance and offers force-stop, clear-data and uninstall; it uses the same
160
179
  rooted `debug/packages` + `debug/action` API as the Agent tool.
@@ -194,8 +213,8 @@ key {"text":"HOME"} -> returned to launcher
194
213
  8.4–10.5 s** on the reference host ([details](#fast-start-four-layers)).
195
214
  - **Cross-platform SDK discovery.** `lib/setup.js` and `lib/android.js` discover Android SDK,
196
215
  `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.
216
+ suffixes and per-OS fallback locations). Windows x64 and **Linux x86_64 headless** are
217
+ verified end-to-end; see [docs/LINUX-E2E.md](docs/LINUX-E2E.md).
199
218
  - **Same-origin only.** Every `/apk-vm/*` HTTP route and the `/apk-vm/ws` upgrade rejects
200
219
  cross-origin requests; request bodies and command output are bounded, and host processes are
201
220
  spawned with argv arrays (never a shell string).
@@ -206,6 +225,33 @@ key {"text":"HOME"} -> returned to launcher
206
225
 
207
226
  ---
208
227
 
228
+ ## UI Inspector and flow recorder
229
+
230
+ - `GET /apk-vm/debug/inspect` (and `/apk-vm/instances/<id>/debug/inspect`) returns the parsed
231
+ UIAutomator nodes with bounds, labels, and generated `find_ui` / `assert_text` / `tap_text`
232
+ commands. The panel's **Inspect UI** button renders the same data as an overlay.
233
+ - `GET|POST /apk-vm/flows` (and `/apk-vm/instances/<id>/flows`) lists, starts, stops, replays
234
+ and deletes recorded flows. The panel has a **Flow recorder** card with the same actions.
235
+ - `apk_vm` actions: `inspect_ui`, `flow_start`, `flow_stop`, `flow_list`, `flow_replay`.
236
+ - `POST /apk-vm/debug/proxy` sets the guest HTTP proxy; `DELETE` clears it.
237
+ - `POST /apk-vm/debug/ca` accepts a host `.pem`/`.crt` path and installs it under the guest's
238
+ user CA directory with the correct subject hash.
239
+
240
+ ## Reproducible demo
241
+
242
+ A public, dependency-free demo lives in [examples](examples/README.md):
243
+
244
+ ```bash
245
+ node examples/demo.mjs
246
+ ```
247
+
248
+ It installs the committed MIT-licensed 12 KB sample APK (`dev.dsh.sample`), reads the
249
+ UIAutomator tree, taps **Say hello**, asserts that the screen now says
250
+ `Hello from dsh-apk-vm`, and saves a 720×1280 screenshot to `examples/demo-out/`. No personal
251
+ APK, private key or host-specific path is required.
252
+
253
+ ---
254
+
209
255
  ## Quickstart
210
256
 
211
257
  ### 1. Prerequisites
@@ -804,9 +850,12 @@ before pointing the DSH Web UI at an untrusted network.
804
850
 
805
851
  - **The plugin manages processes on your machine.** It spawns the Android emulator, `adb`,
806
852
  `sdkmanager` and `avdmanager` with `child_process.spawn(exe, argv)` — never through a shell —
807
- so user-supplied strings are not shell-interpreted. Paths are validated (APK paths must exist
808
- and end in `.apk`; push/pull paths are restricted to `/data/local/tmp`, `/sdcard`,
809
- `/storage/emulated/0` and allowed local roots).
853
+ so user-supplied strings are not shell-interpreted. Paths are validated (APK/bundle paths must
854
+ exist and end in `.apk`/`.apks`/`.xapk`; push/pull paths are restricted to `/data/local/tmp`,
855
+ `/sdcard`, `/storage/emulated/0` and allowed local roots).
856
+ - **Only emulators spawned by this plugin are stopped.** `stop()` sends `adb emu kill` only when
857
+ this process owns the emulator; a pre-existing/attached device (physical, remote adb or a
858
+ manually started emulator) is detached and left running.
810
859
  - **The guest is deliberately rooted and debuggable.** `adb root`, `ro.debuggable=1` and
811
860
  `ro.adb.secure=0` mean anything you install inside the VM is not sandboxed from root. Do not
812
861
  put real secrets or personal data in the AVD.
@@ -858,9 +907,9 @@ customization remain research notes in [DESIGN.md](DESIGN.md) §8.
858
907
 
859
908
  ## Known limitations
860
909
 
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.
910
+ - **Windows x64 and Linux x86_64 are the end-to-end verified platforms.** macOS SDK/adb/
911
+ emulator/AVD discovery and headless checks are implemented, but emulator + H.264 behavior on
912
+ macOS (and `arm64-v8a` images on Apple Silicon) is unverified.
864
913
  - **Hardware virtualization is mandatory** for the x86_64 AOSP image; pure TCG fails by design.
865
914
  - **Quick boot is snapshot-based.** Changing AVD configuration invalidates the snapshot; recreate
866
915
  it as described in [Troubleshooting](#quick-boot-fails-different-avd-configuration-black-screen-or-no-snapshot).