dsh-adb
提供ADB设备连接与调试的基准操作插件 适合需要进行Android设备日志抓取、应用安装和崩溃监控的开发者。
安裝
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:SamXiaBing/dsh-adb說明文件
閱讀完整 README ↗Usage: adb_watch_crash (Crash Watchdog)
Watch the device's crash buffer for new real crashes. On start, it reads the current buffer and remembers every existing crash signature (seed), so only crashes that appear after the watch begins are reported. Boot markers (mtk-brm-*) are not crashes and are ignored.
Foreground mode (default) — blocks until a new crash appears or the budget expires:
// Agent calls:
{ "name": "adb_watch_crash", "args": { "timeoutMs": 60000 } }
// New crash detected:
{ "matched": true, "waitedMs": 3200, "crashes": [{ "time": "08-26 06:22:56.714", "pid": "2947", "tag": "AndroidRuntime", "message": "FATAL EXCEPTION: WM.task-1", "stack": ["AndroidRuntime: Process: com.miui.weather2, PID: 2947", "..."] }] }
// No new crash within budget (not an error):
{ "matched": false, "waitedMs": 60000, "crashes": [], "reason": "no new crash within 60000ms" }
Background mode (run_in_background) — returns a job id immediately, keeps polling:
// Start watching in the background:
{ "name": "adb_watch_crash", "args": { "run_in_background": true, "timeoutMs": 300000 } }
// → { "kind": "background", "jobId": "adb-watch-crash-1" }
// Read latest detections with job_output:
// [adb_watch_crash] detected 1 new crash(es) after 5400ms
// - 08-26 06:22:56.714 pid=2947 AndroidRuntime: FATAL EXCEPTION: WM.task-1
// AndroidRuntime: Process: com.miui.weather2, PID: 2947
// ...
Chain with crash capture — when a crash is detected, pair with adb_crash_report and adb_screenshot to capture the scene:
1. adb_watch_crash (watch for new crash)
2. → crash detected → adb_crash_report (full crash scene: buffer + dropbox + process + memory)
3. → adb_screenshot (screen state at crash time)
| Parameter | Type | Default | Description |
|---|---|---|---|
serial | string | defaultSerial | Target device serial |
timeoutMs | integer | 60000 | Watch budget (max 600000 = 10 min) |
intervalMs | integer | 1000 | Poll interval (min 250) |
withStacks | boolean | true | Include same-pid stack lines per crash |
run_in_background | boolean | false | Run as a background job; read via job_output |
Configuration
Set the config block in cordis.patch.yml (or a profile patch):
- id: dsh-adb
name: dsh-adb
config:
adbPath: C:\Users\me\AppData\Local\Android\Sdk\platform-tools\adb.exe
defaultSerial: emulator-5554
timeoutMs: 30000
| Key | Description | Default |
|---|---|---|
adbPath | Absolute path to the adb executable | Auto-detect PATH / ANDROID_HOME / ANDROID_SDK_ROOT/platform-tools |
defaultSerial | Default target device serial | none |
timeoutMs | Per-command timeout | 30000 |
baselineDir | Directory for adb_perf_baseline storage | ~/.dsh/storages/dsh-adb |
reportDir | Directory for adb_device_report storage | /reports |
screenshotDir | Directory for adb_screenshot storage | /screenshots |