@windypro-rourou/dsh-logcat 0.6.0 → 0.6.2
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/README.en.md +89 -0
- package/README.md +6 -5
- package/lib/client.js +2 -2
- package/package.json +3 -2
package/README.en.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# dsh-logcat
|
|
2
|
+
|
|
3
|
+
An Android real-device debugging workbench for the DSH Web GUI (an Android Studio-style Logcat view).
|
|
4
|
+
|
|
5
|
+
[中文](README.md) | **English**
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Auto-connect**: probes adb on this machine (`ANDROID_HOME` / `ANDROID_SDK_ROOT` / default `%LOCALAPPDATA%\Android\Sdk` / PATH /
|
|
10
|
+
`~/.dsh/adb`), polls `adb devices -l` every 2s; devices in debug mode get a logcat stream **attached automatically** (`-v threadtime`) — no need to open the panel first.
|
|
11
|
+
- **One-click adb install**: when adb is missing, the panel's status bar shows a "One-click install adb" button — it downloads platform-tools from the USTC mirror (Google official fallback), unpacks them to `~/.dsh/adb` and connects automatically (~10MB).
|
|
12
|
+
- **Live logs**: WebSocket push, 2000-line ring buffer per device; automatic reconnect with exponential backoff.
|
|
13
|
+
- **Logcat panel** (sidebar "Logcat" entry, right-side drawer, **draggable width that is remembered**):
|
|
14
|
+
- Device dropdown (model / serial / state, remembers the last selection)
|
|
15
|
+
- Severity filter (V/D/I/W/E/F single-select, Android Studio colors)
|
|
16
|
+
- Keyword filter (**space-separated keywords = any-match**) and a **test package input** (Enter to set; synced with the agent's `logcat_set_package`; shown live in the status bar)
|
|
17
|
+
- **Screenshot button**: one-click device screen capture and PNG download (`exec-out screencap`)
|
|
18
|
+
- **Crash highlighting**: FATAL EXCEPTION / ANR lines highlighted in red
|
|
19
|
+
- **History button**: loads on-disk persisted logs (survives GUI restarts; merged with the live buffer and deduped by timestamp)
|
|
20
|
+
- **Crash auto-snapshots**: on a FATAL EXCEPTION / ANR in the stream, a screenshot + log context are saved to `~/.dsh/logcat/crashes`; the panel shows a banner and you can inspect the screenshot/log in the "Crash" dialog
|
|
21
|
+
- **Events view**: one-click live `logcat -b events` stream (app start/crash/lifecycle events)
|
|
22
|
+
- **WiFi wireless debugging wizard**: IP/port/pairing-code in, `adb pair` + `adb connect` out — ditch the cable (Android 11+)
|
|
23
|
+
- **Install APK button**: local file picker installs an APK to the current device (streamed upload, 1GB cap)
|
|
24
|
+
- **Quick device keys**: Home / Back / Recents / Wake / Power / Volume ± with one click
|
|
25
|
+
- **Performance sparklines**: CPU / memory / battery sampled every 2s with trend charts in the status bar
|
|
26
|
+
- **Live screen casting + remote control**: the "Screen" tab streams the device display (~1fps over WS binary frames); **click = tap, drag = swipe**, a text input sends keystrokes straight to the phone, quick keys included, one-click download of the current frame — no need to pick up the phone
|
|
27
|
+
- **Reverse-engineering workbench** (Log / Screen / RE tabs): process list → memory hex/string search → match addresses → click to dump 256B
|
|
28
|
+
- Pause/resume (pause buffers new lines, resume replays them), clear, copy, export .txt
|
|
29
|
+
- Windowed rendering + auto-scroll (pauses while you scroll up manually)
|
|
30
|
+
- Unauthorized-device hint ("allow USB debugging on the phone")
|
|
31
|
+
- **Agent tools** (30 in total, all exposed to the agent and announced in its system prompt):
|
|
32
|
+
- Device: `logcat_devices` (list devices), `device_info` (model/version/SDK/resolution/memory/battery), `device_stats` (CPU/memory/battery samples), `app_info` (installed version name / versionCode / APK path)
|
|
33
|
+
- Screen / multimodal: `screen_capture` (screenshot saved locally + embedded as an image block so a multimodal model can see it and fix bugs with `input_*`)
|
|
34
|
+
- Execution: `adb_exec` (shell), `adb_install` (install a local APK), `adb_pull` (pull files), `app_launch` (start an app / specific Activity), `app_stop` (force-stop; destructive — confirm first)
|
|
35
|
+
- Input: `input_tap` / `input_swipe` / `input_text` / `input_keyevent` (real-device UI automation), `ui_dump` (UI hierarchy XML), `activity_current` (current foreground Activity)
|
|
36
|
+
- Logs: `logcat_recent` (filter by package/severity/keyword), `logcat_history` (disk history backfill), `logcat_crash` (crash/ANR blocks with context), `logcat_events` (events buffer), `crash_sessions` (crash snapshot history), `logcat_set_package` (lock the package under test)
|
|
37
|
+
- Reverse engineering / memory: `proc_list` (process list), `proc_maps` (memory maps + module bases), `proc_status` (process state / memory summary), `proc_smaps` (top Pss regions), `mem_dump` (read memory at an address as hex), `mem_search` (search memory for hex/string patterns), `frida_server` (deploy/start/stop frida-server), `frida_script` (generate hook/trace/scan/bypass/dump script templates)
|
|
38
|
+
- **Real-device debugging workflow**: while building an Android app, the agent's announcement dynamically lists connected devices (serial + model) and the current test package. After confirming with the user: `adb_install` to deploy → `adb_exec`/`app_launch` to start → `logcat_set_package` to lock → `logcat_recent` / `logcat_crash` for crashes → `ui_dump` + `input_*` for UI automation → `adb_pull` for artifacts. A closed loop on real hardware.
|
|
39
|
+
- **Reverse-engineering workflow**: `proc_list` to find the process → `proc_maps` for module bases → `mem_dump` at a target address / `mem_search` for signatures → `proc_smaps` for memory detail → `frida_script` + `frida_server` for dynamic instrumentation. Reading another app's memory/maps needs root or a debuggable app (run-as); tools return clear errors otherwise.
|
|
40
|
+
- **Extra routes**: `POST /api/dsh-logcat/exec` (shell), `POST /api/dsh-logcat/package` (set package), `GET /api/dsh-logcat/screenshot`, `POST /api/dsh-logcat/install-adb`, `GET /api/dsh-logcat/history`, `GET /api/dsh-logcat/crashes` + `GET /api/dsh-logcat/crash-file`, `POST /api/dsh-logcat/install-apk`, `POST /api/dsh-logcat/keyevent`, `POST /api/dsh-logcat/wifi-connect` / `wifi-disconnect`, `GET /api/dsh-logcat/processes`, `POST /api/dsh-logcat/mem-search`, `GET /api/dsh-logcat/mem-dump`.
|
|
41
|
+
- **On-disk data**: logs are written per device per day to `~/.dsh/logcat/logs/<serial>/logcat-MM-DD.log` (raw threadtime lines); crash snapshots live in `~/.dsh/logcat/crashes/<serial>/<timestamp>-<FATAL|ANR>/` (`screenshot.png` + `crash.log` + `meta.json`).
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Recommended (npm install):
|
|
47
|
+
dsh plugin --profile web add @windypro-rourou/dsh-logcat
|
|
48
|
+
|
|
49
|
+
# Update to the latest (no auto-update; older installs show a version hint in the panel/agent prompt):
|
|
50
|
+
dsh plugin --profile web update # latest within the current major
|
|
51
|
+
# or force: dsh plugin --profile web add @windypro-rourou/dsh-logcat@latest
|
|
52
|
+
# restart the GUI (dsh web) afterwards
|
|
53
|
+
|
|
54
|
+
# Optional preview channel (frequent small iterations, may be unstable):
|
|
55
|
+
dsh plugin --profile web add @windypro-rourou/dsh-logcat@preview
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Release policy (main / latest first)
|
|
59
|
+
|
|
60
|
+
- **`main` branch + npm `latest` tag**: stable releases — the main update channel. Features ship to main/latest as soon as a batch is ready.
|
|
61
|
+
- **`preview` branch + npm `preview` tag**: optional early-access channel (frequent small iterations). If there are no experimental features since the last stable release, the preview tag simply stays at an older preview version — ignore it.
|
|
62
|
+
- The version self-check notifies per channel only (stable users see `latest`, preview users see `preview`; no cross-talk).
|
|
63
|
+
|
|
64
|
+
For development you can also link the source directly into the web profile and append the patch row in `~/.dsh/profiles/web/cordis.patch.yml`:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pnpm --dir "%USERPROFILE%\.dsh\profiles\web" add link:<this-directory>
|
|
68
|
+
# then add to ~/.dsh/profiles/web/cordis.patch.yml:
|
|
69
|
+
# - insert:
|
|
70
|
+
# - id: logcat
|
|
71
|
+
# name: '@windypro-rourou/dsh-logcat'
|
|
72
|
+
# The patch file is hot-watched by a running GUI; restart it if it does not take effect.
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
> Note: every method inserts the same `logcat` row into the profile tree — never use two of them at once, or the next boot fails on a duplicate plugin id.
|
|
76
|
+
|
|
77
|
+
Dependency resolution: `ws` / `react` / `react-dom` / `@deepseek-ai/*` resolve through junctions in this directory's `node_modules` pointing at the host's actually-loaded packages (single instance). Re-point the junctions when the host upgrades its dependencies.
|
|
78
|
+
|
|
79
|
+
## Limitations
|
|
80
|
+
|
|
81
|
+
- The device must have USB debugging enabled and be authorized on this machine (`unauthorized` state is surfaced).
|
|
82
|
+
- logcat output may contain sensitive information; `/api/dsh-logcat/*` routes are loopback-only.
|
|
83
|
+
- `adb shell` commands consume real device resources — confirm before running destructive ones.
|
|
84
|
+
|
|
85
|
+
## Files
|
|
86
|
+
|
|
87
|
+
- `lib/index.js` — host half: adb engine, polling, logcat child processes, routes, WebSocket, agent tools.
|
|
88
|
+
- `lib/client.js` — browser half: sidebar entry + Logcat panel (React, no build step).
|
|
89
|
+
- `cordis.patch.yml` — profile bundle patch (applied automatically).
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
DSH Web GUI 的安卓实机调试面板(类似 Android Studio 的 Logcat 视图)。
|
|
4
4
|
|
|
5
|
+
[中文](README.md) | [English](README.en.md)
|
|
6
|
+
|
|
5
7
|
## 功能
|
|
6
8
|
|
|
7
9
|
- **自动连接**:探测本机 adb(`ANDROID_HOME` / `ANDROID_SDK_ROOT` / 默认 `%LOCALAPPDATA%\Android\Sdk` / PATH /
|
|
@@ -74,12 +76,11 @@ dsh plugin --profile web update # 升到当前 major 内最新
|
|
|
74
76
|
dsh plugin --profile web add @windypro-rourou/dsh-logcat@preview
|
|
75
77
|
```
|
|
76
78
|
|
|
77
|
-
## 发布策略(main /
|
|
79
|
+
## 发布策略(main / latest 为主)
|
|
78
80
|
|
|
79
|
-
- **`main` 分支 + npm `latest`
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
凑够足够功能后合并回 `main` 批量发布正式版。
|
|
81
|
+
- **`main` 分支 + npm `latest` 标签**:正式版,更新的主要通道 —— 功能攒够一批就发,直接推 main/latest。
|
|
82
|
+
- **`preview` 分支 + npm `preview` 标签**:可选尝鲜通道(高频小步迭代)。正式版发布后如无新的试验特性,
|
|
83
|
+
preview 标签可能停留在上一个预览版本,不必理会。
|
|
83
84
|
- 版本自检会按安装通道提示(正式版用户只看 `latest`,preview 用户只看 `preview`,互不打扰)。
|
|
84
85
|
|
|
85
86
|
```bash
|
package/lib/client.js
CHANGED
|
@@ -90,7 +90,7 @@ window.__ModuleLoader__.load({
|
|
|
90
90
|
.lc-line.crash .tag { color: #ef5350; font-weight: 700; }
|
|
91
91
|
.lc-line.crash .msg { color: #ef5350; }
|
|
92
92
|
.lc-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: light-dark(#9aa0a8, #7c838d); font-size: 13px; }
|
|
93
|
-
.lc-status { display: flex; align-items: center; gap: 14px; padding: 5px 14px; border-top: 1px solid light-dark(rgba(0,0,0,.1), rgba(255,255,255,.12)); flex: none; font-size: 11px; color: light-dark(#6b7078, #9aa0a8); }
|
|
93
|
+
.lc-status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 5px 14px; border-top: 1px solid light-dark(rgba(0,0,0,.1), rgba(255,255,255,.12)); flex: none; font-size: 11px; color: light-dark(#6b7078, #9aa0a8); }
|
|
94
94
|
.lc-status b { font-weight: 600; color: inherit; }
|
|
95
95
|
.lc-tabs { display: flex; gap: 4px; padding: 6px 12px 0; border-bottom: 1px solid light-dark(rgba(0,0,0,.08), rgba(255,255,255,.1)); flex: none; }
|
|
96
96
|
.lc-tab { border: 0; background: transparent; color: inherit; font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 7px 7px 0 0; cursor: pointer; opacity: .75; }
|
|
@@ -1127,7 +1127,7 @@ window.__ModuleLoader__.load({
|
|
|
1127
1127
|
h("div", { className: "lc-status" },
|
|
1128
1128
|
h("span", null,
|
|
1129
1129
|
h("b", null, adbReady ? "adb 就绪" : "未找到 adb"),
|
|
1130
|
-
" · " + (adbPath || "—"),
|
|
1130
|
+
h("span", { title: adbPath || undefined }, " · " + (adbPath !== "" ? (adbPath || "—").split(/[\\/]/).pop() : "—")),
|
|
1131
1131
|
!adbReady
|
|
1132
1132
|
? h("button", {
|
|
1133
1133
|
type: "button",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@windypro-rourou/dsh-logcat",
|
|
3
3
|
"description": "Android Logcat viewer for the dsh web GUI: auto-connects to any adb device in debug mode, live logcat stream with level/keyword filters, pause/clear/export, plus agent tools (logcat_recent). Hot-pluggable — mounted via ~/.dsh/cordis.patch.yml + a profile node_modules copy, no dsh source changes.",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@11.22.0",
|
|
7
7
|
"engines": {
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"files": [
|
|
39
39
|
"lib/**/*.js",
|
|
40
40
|
"cordis.patch.yml",
|
|
41
|
-
"README.md"
|
|
41
|
+
"README.md",
|
|
42
|
+
"README.en.md"
|
|
42
43
|
],
|
|
43
44
|
"license": "Apache-2.0",
|
|
44
45
|
"repository": {
|