dsh-adb 1.6.0 → 1.6.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/README.md CHANGED
@@ -20,7 +20,7 @@ A "设备" tab in the conversation view ring (next to chat / trajectory / automa
20
20
 
21
21
  ## Ecosystem
22
22
 
23
- - ✅ [npm](https://www.npmjs.com/package/dsh-adb) — `dsh-adb` published (latest: 1.1.0)
23
+ - ✅ [npm](https://www.npmjs.com/package/dsh-adb) — `dsh-adb` published (latest: 1.6.0)
24
24
  - ✅ [awesome-deepseek-harness#87](https://github.com/0xsline/awesome-deepseek-harness/pull/87) — **merged**
25
25
  - ✅ [awesome-dsh-plugin#85](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/85) — **merged**
26
26
  - ✅ [awesome-DSH-plugin#29](https://github.com/Alex-Yanggg/awesome-DSH-plugin/pull/29) — **merged**
@@ -47,6 +47,53 @@ Topics: `dsh-plugin` `dsh` `adb` `android` `automotive` `bench`
47
47
 
48
48
  Errors are structured `AdbError` with stable codes: `ADB_NOT_FOUND`, `ADB_UNAVAILABLE`, `DEVICE_NOT_FOUND`, `NO_DEVICES`, `CONNECT_FAILED`, `INSTALL_FAILED`, `ADB_EXIT_<code>`, etc.
49
49
 
50
+ ## Usage: adb_watch_crash (Crash Watchdog)
51
+
52
+ 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.
53
+
54
+ **Foreground mode** (default) — blocks until a new crash appears or the budget expires:
55
+
56
+ ```json
57
+ // Agent calls:
58
+ { "name": "adb_watch_crash", "args": { "timeoutMs": 60000 } }
59
+
60
+ // New crash detected:
61
+ { "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", "..."] }] }
62
+
63
+ // No new crash within budget (not an error):
64
+ { "matched": false, "waitedMs": 60000, "crashes": [], "reason": "no new crash within 60000ms" }
65
+ ```
66
+
67
+ **Background mode** (`run_in_background`) — returns a job id immediately, keeps polling:
68
+
69
+ ```json
70
+ // Start watching in the background:
71
+ { "name": "adb_watch_crash", "args": { "run_in_background": true, "timeoutMs": 300000 } }
72
+ // → { "kind": "background", "jobId": "adb-watch-crash-1" }
73
+
74
+ // Read latest detections with job_output:
75
+ // [adb_watch_crash] detected 1 new crash(es) after 5400ms
76
+ // - 08-26 06:22:56.714 pid=2947 AndroidRuntime: FATAL EXCEPTION: WM.task-1
77
+ // AndroidRuntime: Process: com.miui.weather2, PID: 2947
78
+ // ...
79
+ ```
80
+
81
+ **Chain with crash capture** — when a crash is detected, pair with `adb_crash_report` and `adb_screenshot` to capture the scene:
82
+
83
+ ```
84
+ 1. adb_watch_crash (watch for new crash)
85
+ 2. → crash detected → adb_crash_report (full crash scene: buffer + dropbox + process + memory)
86
+ 3. → adb_screenshot (screen state at crash time)
87
+ ```
88
+
89
+ | Parameter | Type | Default | Description |
90
+ | --- | --- | --- | --- |
91
+ | `serial` | string | defaultSerial | Target device serial |
92
+ | `timeoutMs` | integer | 60000 | Watch budget (max 600000 = 10 min) |
93
+ | `intervalMs` | integer | 1000 | Poll interval (min 250) |
94
+ | `withStacks` | boolean | true | Include same-pid stack lines per crash |
95
+ | `run_in_background` | boolean | false | Run as a background job; read via `job_output` |
96
+
50
97
  ## Configuration
51
98
 
52
99
  Set the `config` block in `cordis.patch.yml` (or a profile patch):
@@ -81,7 +128,7 @@ npm pack --dry-run # verify publish contents (lib/ + cordis.patch.yml)
81
128
  ## Testing & Verification
82
129
 
83
130
  - Principle: **ship only what is tested** — every committed feature has unit and/or end-to-end coverage.
84
- - Verified on: Android 13 automotive bench + Android 13 phone.
131
+ - Verified on: Android 13 automotive bench + Android 14 phone (Redmi K50 Pro) + emulator.
85
132
  - Per-version changes and verification: [CHANGELOG.md](CHANGELOG.md); test methodology and coverage: [docs/TESTING.md](docs/TESTING.md) (Chinese).
86
133
 
87
134
  ## Project Docs (bilingual; for AI agents & contributors)
package/README.zh-CN.md CHANGED
@@ -20,7 +20,7 @@ dsh plugin --profile web add dsh-adb
20
20
 
21
21
  ## 生态收录
22
22
 
23
- - ✅ [npm](https://www.npmjs.com/package/dsh-adb) — `dsh-adb` 已发布(latest: 1.1.0)
23
+ - ✅ [npm](https://www.npmjs.com/package/dsh-adb) — `dsh-adb` 已发布(latest: 1.6.0)
24
24
  - ✅ [awesome-deepseek-harness#87](https://github.com/0xsline/awesome-deepseek-harness/pull/87) — **已合并**
25
25
  - ✅ [awesome-dsh-plugin#85](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/85) — **已合并**
26
26
  - ✅ [awesome-DSH-plugin#29](https://github.com/Alex-Yanggg/awesome-DSH-plugin/pull/29) — **已合并**
@@ -47,6 +47,53 @@ Topics:`dsh-plugin` `dsh` `adb` `android` `automotive` `bench`
47
47
 
48
48
  错误码:`ADB_NOT_FOUND`、`ADB_UNAVAILABLE`、`DEVICE_NOT_FOUND`、`NO_DEVICES`、`CONNECT_FAILED`、`INSTALL_FAILED`、`ADB_EXIT_<code>` 等,均为结构化 `AdbError`。
49
49
 
50
+ ## 用法:adb_watch_crash(崩溃看门狗)
51
+
52
+ 监控设备 crash buffer 里的**新**真实崩溃。启动时先读一遍当前 buffer,记住所有已有崩溃签名(seed),所以只报 watch 开始**之后**新出现的崩溃。启动标记(`mtk-brm-*`)不算崩溃,自动忽略。
53
+
54
+ **前台模式**(默认)——阻塞到新崩溃出现或预算耗尽:
55
+
56
+ ```json
57
+ // Agent 调用:
58
+ { "name": "adb_watch_crash", "args": { "timeoutMs": 60000 } }
59
+
60
+ // 检测到新崩溃:
61
+ { "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", "..."] }] }
62
+
63
+ // 预算内无新崩溃(不是错误):
64
+ { "matched": false, "waitedMs": 60000, "crashes": [], "reason": "no new crash within 60000ms" }
65
+ ```
66
+
67
+ **后台模式**(`run_in_background`)——立即返回 job id,持续轮询:
68
+
69
+ ```json
70
+ // 启动后台监控:
71
+ { "name": "adb_watch_crash", "args": { "run_in_background": true, "timeoutMs": 300000 } }
72
+ // → { "kind": "background", "jobId": "adb-watch-crash-1" }
73
+
74
+ // 用 job_output 读最新检测结果:
75
+ // [adb_watch_crash] detected 1 new crash(es) after 5400ms
76
+ // - 08-26 06:22:56.714 pid=2947 AndroidRuntime: FATAL EXCEPTION: WM.task-1
77
+ // AndroidRuntime: Process: com.miui.weather2, PID: 2947
78
+ // ...
79
+ ```
80
+
81
+ **与现场采集衔接**——检测到崩溃后,配 `adb_crash_report` 和 `adb_screenshot` 抓现场:
82
+
83
+ ```
84
+ 1. adb_watch_crash(盯新崩溃)
85
+ 2. → 崩溃出现 → adb_crash_report(采集完整现场:buffer + dropbox + 进程 + 内存)
86
+ 3. → adb_screenshot(截取崩溃时的屏幕状态)
87
+ ```
88
+
89
+ | 参数 | 类型 | 默认 | 说明 |
90
+ | --- | --- | --- | --- |
91
+ | `serial` | string | defaultSerial | 目标设备 serial |
92
+ | `timeoutMs` | integer | 60000 | 监控预算(上限 600000 = 10 分钟) |
93
+ | `intervalMs` | integer | 1000 | 轮询间隔(最小 250) |
94
+ | `withStacks` | boolean | true | 是否包含同 pid 堆栈行 |
95
+ | `run_in_background` | boolean | false | 后台 job 模式,用 `job_output` 读结果 |
96
+
50
97
  ## 配置
51
98
 
52
99
  `cordis.patch.yml` 的 `config` 块(或 profile patch):
@@ -83,7 +130,7 @@ npm pack --dry-run # 校验发布包内容(lib/ + cordis.patch.yml)
83
130
  ## 测试与验证
84
131
 
85
132
  - 原则:**提交即测** —— 全部已提交功能均有实测覆盖(单元 + headless 端到端 + 车机台架/真机)。
86
- - 验证设备:Android 13 车机台架 + Android 13 真机。
133
+ - 验证设备:Android 13 车机台架 + Android 14 真机(Redmi K50 Pro)+ 模拟器。
87
134
  - 版本化变更与每版验证记录见 [CHANGELOG.md](CHANGELOG.md);测试方法与覆盖现状见 [docs/TESTING.md](docs/TESTING.md)。
88
135
 
89
136
  ## 项目文档(双语,供 AI 对话/协作者参考)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-adb",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "ADB device & bench operations for DeepSeek Harness: device discovery, structured logcat, apk install, file pull/push, performance snapshots, perf baselines, crash reports, one-click device health reports, condition waits, operation ledger w/ rollback, screenshots, crash watchdog, web device panel (autocomplete, live logcat, profiler)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",