dsh-apk-vm 0.0.0-stage → 0.3.13
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 +345 -0
- package/CODE_OF_CONDUCT.md +130 -0
- package/CONTRIBUTING.md +177 -0
- package/DEMO.md +85 -0
- package/DESIGN.md +335 -0
- package/LICENSE +204 -0
- package/NOTICE +74 -0
- package/README.md +920 -2
- package/SECURITY.md +108 -0
- package/client.js +3780 -0
- package/cordis.patch.yml +56 -0
- package/docs/PRIVACY.md +36 -0
- package/docs/README.md +16 -0
- package/docs/RELEASING.md +104 -0
- package/docs/SUBMISSION.md +75 -0
- package/docs/screenshot-panel.png +0 -0
- package/docs/screenshot-sidebar.png +0 -0
- package/icon.svg +8 -0
- package/index.js +2532 -0
- package/lib/android.js +2502 -0
- package/lib/instances.js +559 -0
- package/lib/scrcpy.js +2370 -0
- package/lib/setup.js +1624 -0
- package/lib/vendor/scrcpy-server-v5.0.1.jar +0 -0
- package/lib/video-stream.js +329 -0
- package/lib/ws.js +198 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +79 -4
- package/scripts/privacy-scan.mjs +94 -0
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Bundle patch: the Host half (index.js) mounts the local Android VM bridge and
|
|
2
|
+
# its same-origin HTTP routes; the `dsh.client` manifest entry in package.json
|
|
3
|
+
# loads ./client.js as the Web UI half that renders the sidebar panel.
|
|
4
|
+
- insert:
|
|
5
|
+
- id: dsh-apk-vm
|
|
6
|
+
name: 'dsh-apk-vm'
|
|
7
|
+
config:
|
|
8
|
+
# Open-source AOSP Android Emulator. Paths are auto-detected from
|
|
9
|
+
# ANDROID_HOME / ANDROID_SDK_ROOT / common locations; set sdkRoot or
|
|
10
|
+
# emulatorPath explicitly only for non-standard installs.
|
|
11
|
+
# sdkRoot: 'D:/Android/sdk'
|
|
12
|
+
# emulatorPath: 'D:/Android/sdk/emulator/emulator.exe'
|
|
13
|
+
systemImage: 'system-images;android-34;default;x86_64'
|
|
14
|
+
avdName: dsh_apk
|
|
15
|
+
bootTimeoutMs: 1200000
|
|
16
|
+
gpuMode: host
|
|
17
|
+
accel: auto
|
|
18
|
+
requireAccel: true
|
|
19
|
+
quickBoot: true
|
|
20
|
+
snapshotName: default_boot
|
|
21
|
+
saveSnapshotAfterBoot: true
|
|
22
|
+
# PNG fallback target frame rate (1-10); the H.264 stream below is 60.
|
|
23
|
+
frameFps: 2
|
|
24
|
+
# Warm start after plugin activation (opt-in; consumes CPU while the
|
|
25
|
+
# plugin is loaded). Auto-start on the first panel open is on by default.
|
|
26
|
+
prewarm: false
|
|
27
|
+
prewarmDelayMs: 3000
|
|
28
|
+
autoStart: true
|
|
29
|
+
# Multiple isolated VMs: the first Agent gets the default instance;
|
|
30
|
+
# later Agents get their own AVD/port until maxInstances extra VMs.
|
|
31
|
+
multiInstance: true
|
|
32
|
+
maxInstances: 3
|
|
33
|
+
# Extra instances idle for this long (ms) with no panel frame / stream
|
|
34
|
+
# client / Agent command are stopped automatically; the AVD is kept for
|
|
35
|
+
# quick reuse. start()/the next Agent action boots it again.
|
|
36
|
+
instanceIdleMs: 900000
|
|
37
|
+
instanceReapIntervalMs: 60000
|
|
38
|
+
# H.264 stream: up to 60 fps via the vendored scrcpy server; 960 keeps
|
|
39
|
+
# 540x960 video (plenty for the panel) so software WebCodecs decode can
|
|
40
|
+
# sustain ~60 fps.
|
|
41
|
+
scrcpy: true
|
|
42
|
+
scrcpyMaxSize: 960
|
|
43
|
+
scrcpyMaxFps: 60
|
|
44
|
+
scrcpyBitrate: 6000000
|
|
45
|
+
# System-image downloads (~1 GB) are never automatic; the Environment
|
|
46
|
+
# card shows the exact missing pieces and the create-avd action works
|
|
47
|
+
# once the image is present.
|
|
48
|
+
allowSetupDownloads: false
|
|
49
|
+
# The VM routes accept root shell/debug actions, so they reject
|
|
50
|
+
# non-loopback clients by default even if the DSH web UI is exposed to
|
|
51
|
+
# the LAN. Set true only behind your own authenticated reverse proxy.
|
|
52
|
+
allowRemote: false
|
|
53
|
+
# APK discovery roots. The current workspace is always included; add
|
|
54
|
+
# platform-specific directories here (omit for a portable default).
|
|
55
|
+
# roots:
|
|
56
|
+
# - 'D:/projects'
|
package/docs/PRIVACY.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Privacy
|
|
2
|
+
|
|
3
|
+
This plugin is a local development tool. It does not include analytics, telemetry, crash
|
|
4
|
+
reporting, advertising or a remote backend.
|
|
5
|
+
|
|
6
|
+
## Data the plugin handles
|
|
7
|
+
|
|
8
|
+
- **APKs you select or upload** are copied into the OS temp directory and installed into the
|
|
9
|
+
local Android emulator. They are not uploaded anywhere by the plugin.
|
|
10
|
+
- **VM data** (AVD images, snapshots, installed apps, guest files) stays on the host under the
|
|
11
|
+
Android SDK/AVD locations. The guest is a local emulator; do not put real secrets or personal
|
|
12
|
+
data inside it.
|
|
13
|
+
- **Screenshots, recordings and logcat** are written to the OS temp directory or returned to the
|
|
14
|
+
panel. They are not sent off the machine. The artifact-download route is loopback-only and
|
|
15
|
+
whitelists files created by the plugin.
|
|
16
|
+
- **Client diagnostics** (`POST /apk-vm/client-report`) contain a user agent and WebCodecs
|
|
17
|
+
capability information, stored in the local Host process memory for troubleshooting. They are
|
|
18
|
+
not persisted to disk or transmitted externally.
|
|
19
|
+
- **Configuration** (`cordis.patch.yml`) may contain local paths (`sdkRoot`, `emulatorPath`,
|
|
20
|
+
`roots`). Do not commit a personal configuration to a public repository.
|
|
21
|
+
|
|
22
|
+
## Network activity
|
|
23
|
+
|
|
24
|
+
- The plugin talks to the local DSH Web server and local `adb`/emulator processes.
|
|
25
|
+
- The optional SDK bootstrap / install actions use the user's own `sdkmanager` and the official
|
|
26
|
+
Google Android SDK repository, only when explicitly enabled with
|
|
27
|
+
`allowSetupDownloads: true`. This plugin does not proxy or collect those downloads.
|
|
28
|
+
- No third-party endpoints are contacted by the plugin itself.
|
|
29
|
+
|
|
30
|
+
## Public repository hygiene
|
|
31
|
+
|
|
32
|
+
The repository ships `scripts/privacy-scan.mjs` and CI runs it on every push. It checks the
|
|
33
|
+
tracked tree for personal paths, private-network IPs, agent instance IDs, credential patterns and
|
|
34
|
+
emails. The development history may contain older local paths; publish the clean `open-source`
|
|
35
|
+
branch (single initial commit) instead of the full development history. See
|
|
36
|
+
[RELEASING](docs/RELEASING.md).
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Demo and screenshot assets
|
|
2
|
+
|
|
3
|
+
Real assets captured from the reference host:
|
|
4
|
+
|
|
5
|
+
- `screenshot-panel.png` — the main APK VM panel: Environment card, Android guest (H.264
|
|
6
|
+
11.7 fps in this capture), input controls and debug surface.
|
|
7
|
+
- `screenshot-sidebar.png` — the plugin open in the DSH right sidebar next to a session, with
|
|
8
|
+
the host's APK paths redacted.
|
|
9
|
+
|
|
10
|
+
Still optional:
|
|
11
|
+
|
|
12
|
+
- `demo.gif` — 20–30 s recording: open panel → Environment check → VM boot → upload APK → 60 fps
|
|
13
|
+
interaction. Record on a real host and keep it under ~8 MiB.
|
|
14
|
+
|
|
15
|
+
The assets are not fabricated. Before adding a new screenshot, crop out or redact the DSH
|
|
16
|
+
sidebar conversation names, local paths and any LAN IPs.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Releasing and publishing
|
|
2
|
+
|
|
3
|
+
This project is distributed as a **DSH plugin bundle** and an **npm package** named
|
|
4
|
+
`dsh-apk-vm`, following the DSH plugin naming convention. The primary install command is
|
|
5
|
+
`dsh plugin --profile web add dsh-apk-vm`; the bundle patch installs from the npm package.
|
|
6
|
+
Repository: <https://github.com/yuxiaole-bili/dsh-apk-vm>.
|
|
7
|
+
|
|
8
|
+
## Publish to npm
|
|
9
|
+
|
|
10
|
+
The package is intentionally public and has no build step; publishing the repository directory is
|
|
11
|
+
enough:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm login # once per machine, as the npm account that owns dsh-apk-vm
|
|
15
|
+
npm publish --access public # prepublish uses the packed file list
|
|
16
|
+
npm view dsh-apk-vm version # verify the published version
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The GitHub release tarball and the npm tarball are produced from the same `npm pack` output.
|
|
20
|
+
If the version already exists on npm, bump `version` and `CHANGELOG.md` together before publishing.
|
|
21
|
+
For a manual GitHub Actions path, add an `NPM_TOKEN` repository secret (npm automation token that
|
|
22
|
+
can publish `dsh-apk-vm`) and run the **Publish to npm** workflow
|
|
23
|
+
([.github/workflows/npm-publish.yml](../.github/workflows/npm-publish.yml)).
|
|
24
|
+
|
|
25
|
+
## Suggested GitHub repository description
|
|
26
|
+
|
|
27
|
+
> Preview and debug Android APKs inside DeepSeek Harness: a local rooted AOSP VM with up to 60 fps
|
|
28
|
+
> H.264/WebCodecs streaming, drag-and-drop install, UIAutomator automation, and isolated VMs per
|
|
29
|
+
> Agent.
|
|
30
|
+
|
|
31
|
+
Suggested topics:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
dsh, deepseek-harness, android, android-emulator, apk, scrcpy, webcodecs, ai-agents, ui-automation
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The in-app Plugin Manager title/description comes from `locale/en.json` and `locale/zh.json`
|
|
38
|
+
(`meta.title` / `meta.description`); keep those in sync with this description.
|
|
39
|
+
|
|
40
|
+
## Before the first public push
|
|
41
|
+
|
|
42
|
+
0. **Publish a clean history if the development history contains local paths.** This repository
|
|
43
|
+
may include an `open-source` branch with a single initial commit and no local development
|
|
44
|
+
history; push that branch (or create your own orphan branch) instead of the full dev history:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
git push -u origin open-source:main
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
1. Repository metadata is already configured in `package.json` (`repository`, `homepage`,
|
|
51
|
+
`bugs`) and the README has the matching badges. Update these only if the project moves or is
|
|
52
|
+
forked.
|
|
53
|
+
2. Check the tree for personal paths, screenshots, recordings, emulator logs and AVD dumps:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
git grep -n -I -E 'D:\\\\|C:\\\\Users|/Users/|/home/[^ ]+/.android'
|
|
57
|
+
git status --ignored --short
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Also scan for your own hostname, private-network IPs and usernames. The repository ships a
|
|
61
|
+
tracked-tree scanner: `npm run privacy` (use `node scripts/privacy-scan.mjs --all` only to
|
|
62
|
+
inspect development history locally; the full history is not part of the clean release
|
|
63
|
+
branch).
|
|
64
|
+
|
|
65
|
+
3. Run the full headless suite:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm ci --ignore-scripts # or: npm install --ignore-scripts
|
|
69
|
+
npm run check
|
|
70
|
+
npm test
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
4. Re-test the live paths on a real host and update the verification notes:
|
|
74
|
+
boot/quick boot, H.264 60 fps, input mapping, multi-instance, physical-device attach,
|
|
75
|
+
APK upload/install, APK icon/info, clipboard (optional), pinch.
|
|
76
|
+
|
|
77
|
+
## Versioning
|
|
78
|
+
|
|
79
|
+
- `package.json` and `CHANGELOG.md` move together.
|
|
80
|
+
- Use `0.x.y` while the plugin API/route surface may still change.
|
|
81
|
+
- Keep `SECURITY.md` supported-version table in sync.
|
|
82
|
+
- Tag the release (`git tag -a v0.3.12 -m ...`) and attach the tarball produced by
|
|
83
|
+
`npm pack --pack-destination dist`.
|
|
84
|
+
|
|
85
|
+
## GitHub release checklist
|
|
86
|
+
|
|
87
|
+
- [ ] LICENSE and NOTICE present and accurate (no unbundled upstream sources claimed)
|
|
88
|
+
- [ ] CODE_OF_CONDUCT.md, CONTRIBUTING.md, SECURITY.md present
|
|
89
|
+
- [ ] Issue templates and PR template present
|
|
90
|
+
- [ ] CI green (headless suite; Windows cross-platform job is optional)
|
|
91
|
+
- [ ] No secrets, tokens, personal paths, AVDs, logs, recordings or `dist/` committed
|
|
92
|
+
- [ ] Demo media (if any) recorded on a real host and listed in `docs/README.md`
|
|
93
|
+
- [ ] README install instructions use `<path-to-repo>` / user-chosen paths
|
|
94
|
+
- [ ] Release notes call out known limitations (Windows E2E only, no audio, etc.)
|
|
95
|
+
|
|
96
|
+
## Known limitations to state in the release
|
|
97
|
+
|
|
98
|
+
- Windows x64 is the only platform verified end-to-end for boot/stream/debug; macOS/Linux are
|
|
99
|
+
covered by headless detection/CI but have not been live-verified.
|
|
100
|
+
- No audio forwarding.
|
|
101
|
+
- Physical-device attach is implemented; a real USB phone was not available for validation in
|
|
102
|
+
the reference environment.
|
|
103
|
+
- Clipboard support is optional and uses scrcpy control messages; it requires a running H.264
|
|
104
|
+
stream.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Community market submission
|
|
2
|
+
|
|
3
|
+
Prepared for the [dsh-plugin.org submission checklist](https://dsh-plugin.org/zh/submit) and the
|
|
4
|
+
DSH plugin hub issue template.
|
|
5
|
+
|
|
6
|
+
## Filled issue template
|
|
7
|
+
|
|
8
|
+
### 仓库地址
|
|
9
|
+
|
|
10
|
+
<https://github.com/yuxiaole-bili/dsh-apk-vm>
|
|
11
|
+
|
|
12
|
+
### 一句话价值
|
|
13
|
+
|
|
14
|
+
在 DeepSeek Harness 的侧边栏里直接运行和调试 rooted Android APK 虚拟机,提供最高 60 fps 预览、UIAutomator/Agent 自动化与多 Agent 隔离实例。
|
|
15
|
+
|
|
16
|
+
### 能力分类
|
|
17
|
+
|
|
18
|
+
开发与运维
|
|
19
|
+
|
|
20
|
+
### 安装命令
|
|
21
|
+
|
|
22
|
+
npm 包安装(插件中心/社区市场推荐命令):
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
dsh plugin --profile web add dsh-apk-vm
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
源码 fallback:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
dsh plugin --profile web add github:yuxiaole-bili/dsh-apk-vm
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
DSH Desktop(`desktop` profile)通过 **Plugins → add/install local bundle** 安装同一目录。
|
|
35
|
+
|
|
36
|
+
### 兼容与运行要求
|
|
37
|
+
|
|
38
|
+
- DSH Desktop `0.2.1-rc.3` 已实测;静态 bundle/plugin API。
|
|
39
|
+
- Windows x64 为唯一端到端验证平台(启动、H.264、root 调试、Agent tool);macOS/Linux 有
|
|
40
|
+
headless setup/CI 覆盖,但未做真实模拟器运行验证。
|
|
41
|
+
- 需要 Android SDK/emulator/platform-tools、Android 14 x86_64 system image、AVD,以及
|
|
42
|
+
AEHD/WHPX(Windows)、KVM(Linux)或 HVF(macOS)硬件虚拟化。
|
|
43
|
+
- 每个运行中的 VM 约占 2.5 GB 内存;默认最多 3 个额外实例。
|
|
44
|
+
- 可选兼容 [`dsh-better-sidebar`](https://github.com/omdsh-dev/DSH-better-sidebar)。
|
|
45
|
+
|
|
46
|
+
### 许可证
|
|
47
|
+
|
|
48
|
+
Apache-2.0
|
|
49
|
+
|
|
50
|
+
### 截图 / 演示
|
|
51
|
+
|
|
52
|
+
- 主面板 + H.264 预览:<https://github.com/yuxiaole-bili/dsh-apk-vm/blob/main/docs/screenshot-panel.png>
|
|
53
|
+
- 右侧栏布局:<https://github.com/yuxiaole-bili/dsh-apk-vm/blob/main/docs/screenshot-sidebar.png>
|
|
54
|
+
- 真实 `apk_vm` 输出见 README 的 Demo/Verification 章节。
|
|
55
|
+
|
|
56
|
+
### 补充说明
|
|
57
|
+
|
|
58
|
+
- guest 是刻意 root/debuggable 的 `userdebug` 镜像;不要放真实凭据或隐私数据。
|
|
59
|
+
- `apk_vm` Agent tool 对所有 Agent 开放 guest root shell/安装/UI 自动化,按“给 Agent 一台
|
|
60
|
+
rooted Android 设备”的权限级别对待。
|
|
61
|
+
- `/apk-vm/*` API 与 WebSocket 默认仅 loopback;`allowRemote` 是显式远程代理 opt-in。
|
|
62
|
+
- 无遥测;只有用户显式启用 SDK 下载或配置远程 adb 时才产生网络访问。
|
|
63
|
+
- 更多风险/权限/兼容信息见 README 的 “Risks, permissions and compatibility” 与
|
|
64
|
+
[PRIVACY](PRIVACY.md)、[SECURITY](../SECURITY.md)。
|
|
65
|
+
|
|
66
|
+
### 提交前自查
|
|
67
|
+
|
|
68
|
+
- [x] 仓库已公开
|
|
69
|
+
- [x] 已添加 GitHub topic:`dsh-plugin`
|
|
70
|
+
- [x] README 包含安装命令
|
|
71
|
+
- [x] 插件导出 `apply(ctx)` 模块
|
|
72
|
+
- [x] 仓库根目录包含 `package.json`
|
|
73
|
+
- [x] README 声明 Apache-2.0
|
|
74
|
+
- [x] 截图/真实输出已附
|
|
75
|
+
- [x] 能力分类选定:开发与运维
|
|
Binary file
|
|
Binary file
|
package/icon.svg
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" role="img" aria-label="APK virtual machine">
|
|
2
|
+
<rect x="6.25" y="2.25" width="11.5" height="19.5" rx="2.75"/>
|
|
3
|
+
<path d="M10.25 4.9h3.5"/>
|
|
4
|
+
<circle cx="9.9" cy="9.8" r="0.85" fill="currentColor" stroke="none"/>
|
|
5
|
+
<circle cx="14.1" cy="9.8" r="0.85" fill="currentColor" stroke="none"/>
|
|
6
|
+
<path d="M9.6 13.1c.55.9 1.4 1.35 2.4 1.35s1.85-.45 2.4-1.35"/>
|
|
7
|
+
<path d="M9.4 19.2h5.2"/>
|
|
8
|
+
</svg>
|