deepadb 1.0.0

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.
Files changed (247) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +631 -0
  3. package/build/bridge/adb-bridge.d.ts +65 -0
  4. package/build/bridge/adb-bridge.d.ts.map +1 -0
  5. package/build/bridge/adb-bridge.js +164 -0
  6. package/build/bridge/adb-bridge.js.map +1 -0
  7. package/build/bridge/device-manager.d.ts +41 -0
  8. package/build/bridge/device-manager.d.ts.map +1 -0
  9. package/build/bridge/device-manager.js +109 -0
  10. package/build/bridge/device-manager.js.map +1 -0
  11. package/build/bridge/local-bridge.d.ts +92 -0
  12. package/build/bridge/local-bridge.d.ts.map +1 -0
  13. package/build/bridge/local-bridge.js +345 -0
  14. package/build/bridge/local-bridge.js.map +1 -0
  15. package/build/config/config.d.ts +39 -0
  16. package/build/config/config.d.ts.map +1 -0
  17. package/build/config/config.js +84 -0
  18. package/build/config/config.js.map +1 -0
  19. package/build/graphql-api.d.ts +36 -0
  20. package/build/graphql-api.d.ts.map +1 -0
  21. package/build/graphql-api.js +296 -0
  22. package/build/graphql-api.js.map +1 -0
  23. package/build/http-transport.d.ts +26 -0
  24. package/build/http-transport.d.ts.map +1 -0
  25. package/build/http-transport.js +105 -0
  26. package/build/http-transport.js.map +1 -0
  27. package/build/index.d.ts +14 -0
  28. package/build/index.d.ts.map +1 -0
  29. package/build/index.js +66 -0
  30. package/build/index.js.map +1 -0
  31. package/build/middleware/chipset.d.ts +29 -0
  32. package/build/middleware/chipset.d.ts.map +1 -0
  33. package/build/middleware/chipset.js +123 -0
  34. package/build/middleware/chipset.js.map +1 -0
  35. package/build/middleware/cleanup.d.ts +24 -0
  36. package/build/middleware/cleanup.d.ts.map +1 -0
  37. package/build/middleware/cleanup.js +53 -0
  38. package/build/middleware/cleanup.js.map +1 -0
  39. package/build/middleware/fetch-utils.d.ts +19 -0
  40. package/build/middleware/fetch-utils.d.ts.map +1 -0
  41. package/build/middleware/fetch-utils.js +64 -0
  42. package/build/middleware/fetch-utils.js.map +1 -0
  43. package/build/middleware/logger.d.ts +17 -0
  44. package/build/middleware/logger.d.ts.map +1 -0
  45. package/build/middleware/logger.js +38 -0
  46. package/build/middleware/logger.js.map +1 -0
  47. package/build/middleware/output-processor.d.ts +57 -0
  48. package/build/middleware/output-processor.d.ts.map +1 -0
  49. package/build/middleware/output-processor.js +162 -0
  50. package/build/middleware/output-processor.js.map +1 -0
  51. package/build/middleware/sanitize.d.ts +30 -0
  52. package/build/middleware/sanitize.d.ts.map +1 -0
  53. package/build/middleware/sanitize.js +46 -0
  54. package/build/middleware/sanitize.js.map +1 -0
  55. package/build/middleware/security.d.ts +52 -0
  56. package/build/middleware/security.d.ts.map +1 -0
  57. package/build/middleware/security.js +123 -0
  58. package/build/middleware/security.js.map +1 -0
  59. package/build/middleware/ui-dump.d.ts +23 -0
  60. package/build/middleware/ui-dump.d.ts.map +1 -0
  61. package/build/middleware/ui-dump.js +59 -0
  62. package/build/middleware/ui-dump.js.map +1 -0
  63. package/build/server.d.ts +18 -0
  64. package/build/server.d.ts.map +1 -0
  65. package/build/server.js +133 -0
  66. package/build/server.js.map +1 -0
  67. package/build/tool-context.d.ts +22 -0
  68. package/build/tool-context.d.ts.map +1 -0
  69. package/build/tool-context.js +9 -0
  70. package/build/tool-context.js.map +1 -0
  71. package/build/tools/accessibility.d.ts +10 -0
  72. package/build/tools/accessibility.d.ts.map +1 -0
  73. package/build/tools/accessibility.js +259 -0
  74. package/build/tools/accessibility.js.map +1 -0
  75. package/build/tools/at-commands.d.ts +20 -0
  76. package/build/tools/at-commands.d.ts.map +1 -0
  77. package/build/tools/at-commands.js +378 -0
  78. package/build/tools/at-commands.js.map +1 -0
  79. package/build/tools/baseband.d.ts +15 -0
  80. package/build/tools/baseband.d.ts.map +1 -0
  81. package/build/tools/baseband.js +323 -0
  82. package/build/tools/baseband.js.map +1 -0
  83. package/build/tools/build.d.ts +6 -0
  84. package/build/tools/build.d.ts.map +1 -0
  85. package/build/tools/build.js +80 -0
  86. package/build/tools/build.js.map +1 -0
  87. package/build/tools/ci.d.ts +9 -0
  88. package/build/tools/ci.d.ts.map +1 -0
  89. package/build/tools/ci.js +163 -0
  90. package/build/tools/ci.js.map +1 -0
  91. package/build/tools/control.d.ts +10 -0
  92. package/build/tools/control.d.ts.map +1 -0
  93. package/build/tools/control.js +197 -0
  94. package/build/tools/control.js.map +1 -0
  95. package/build/tools/device-farm.d.ts +10 -0
  96. package/build/tools/device-farm.d.ts.map +1 -0
  97. package/build/tools/device-farm.js +140 -0
  98. package/build/tools/device-farm.js.map +1 -0
  99. package/build/tools/device-profiles.d.ts +16 -0
  100. package/build/tools/device-profiles.d.ts.map +1 -0
  101. package/build/tools/device-profiles.js +272 -0
  102. package/build/tools/device-profiles.js.map +1 -0
  103. package/build/tools/device.d.ts +6 -0
  104. package/build/tools/device.d.ts.map +1 -0
  105. package/build/tools/device.js +72 -0
  106. package/build/tools/device.js.map +1 -0
  107. package/build/tools/diagnostics.d.ts +7 -0
  108. package/build/tools/diagnostics.d.ts.map +1 -0
  109. package/build/tools/diagnostics.js +153 -0
  110. package/build/tools/diagnostics.js.map +1 -0
  111. package/build/tools/emulator.d.ts +9 -0
  112. package/build/tools/emulator.d.ts.map +1 -0
  113. package/build/tools/emulator.js +223 -0
  114. package/build/tools/emulator.js.map +1 -0
  115. package/build/tools/files.d.ts +6 -0
  116. package/build/tools/files.d.ts.map +1 -0
  117. package/build/tools/files.js +78 -0
  118. package/build/tools/files.js.map +1 -0
  119. package/build/tools/firmware-analysis.d.ts +24 -0
  120. package/build/tools/firmware-analysis.d.ts.map +1 -0
  121. package/build/tools/firmware-analysis.js +623 -0
  122. package/build/tools/firmware-analysis.js.map +1 -0
  123. package/build/tools/forwarding.d.ts +7 -0
  124. package/build/tools/forwarding.d.ts.map +1 -0
  125. package/build/tools/forwarding.js +64 -0
  126. package/build/tools/forwarding.js.map +1 -0
  127. package/build/tools/health.d.ts +7 -0
  128. package/build/tools/health.d.ts.map +1 -0
  129. package/build/tools/health.js +112 -0
  130. package/build/tools/health.js.map +1 -0
  131. package/build/tools/logcat-watch.d.ts +11 -0
  132. package/build/tools/logcat-watch.d.ts.map +1 -0
  133. package/build/tools/logcat-watch.js +209 -0
  134. package/build/tools/logcat-watch.js.map +1 -0
  135. package/build/tools/logs.d.ts +6 -0
  136. package/build/tools/logs.d.ts.map +1 -0
  137. package/build/tools/logs.js +83 -0
  138. package/build/tools/logs.js.map +1 -0
  139. package/build/tools/mirroring.d.ts +14 -0
  140. package/build/tools/mirroring.d.ts.map +1 -0
  141. package/build/tools/mirroring.js +243 -0
  142. package/build/tools/mirroring.js.map +1 -0
  143. package/build/tools/multi-device.d.ts +9 -0
  144. package/build/tools/multi-device.d.ts.map +1 -0
  145. package/build/tools/multi-device.js +138 -0
  146. package/build/tools/multi-device.js.map +1 -0
  147. package/build/tools/network-capture.d.ts +10 -0
  148. package/build/tools/network-capture.d.ts.map +1 -0
  149. package/build/tools/network-capture.js +143 -0
  150. package/build/tools/network-capture.js.map +1 -0
  151. package/build/tools/network-discovery.d.ts +21 -0
  152. package/build/tools/network-discovery.d.ts.map +1 -0
  153. package/build/tools/network-discovery.js +284 -0
  154. package/build/tools/network-discovery.js.map +1 -0
  155. package/build/tools/ota-monitor.d.ts +16 -0
  156. package/build/tools/ota-monitor.d.ts.map +1 -0
  157. package/build/tools/ota-monitor.js +211 -0
  158. package/build/tools/ota-monitor.js.map +1 -0
  159. package/build/tools/packages.d.ts +6 -0
  160. package/build/tools/packages.d.ts.map +1 -0
  161. package/build/tools/packages.js +237 -0
  162. package/build/tools/packages.js.map +1 -0
  163. package/build/tools/plugins.d.ts +22 -0
  164. package/build/tools/plugins.d.ts.map +1 -0
  165. package/build/tools/plugins.js +118 -0
  166. package/build/tools/plugins.js.map +1 -0
  167. package/build/tools/prompts.d.ts +9 -0
  168. package/build/tools/prompts.d.ts.map +1 -0
  169. package/build/tools/prompts.js +94 -0
  170. package/build/tools/prompts.js.map +1 -0
  171. package/build/tools/qemu.d.ts +18 -0
  172. package/build/tools/qemu.d.ts.map +1 -0
  173. package/build/tools/qemu.js +791 -0
  174. package/build/tools/qemu.js.map +1 -0
  175. package/build/tools/registry.d.ts +13 -0
  176. package/build/tools/registry.d.ts.map +1 -0
  177. package/build/tools/registry.js +221 -0
  178. package/build/tools/registry.js.map +1 -0
  179. package/build/tools/regression.d.ts +10 -0
  180. package/build/tools/regression.d.ts.map +1 -0
  181. package/build/tools/regression.js +215 -0
  182. package/build/tools/regression.js.map +1 -0
  183. package/build/tools/resources.d.ts +10 -0
  184. package/build/tools/resources.d.ts.map +1 -0
  185. package/build/tools/resources.js +77 -0
  186. package/build/tools/resources.js.map +1 -0
  187. package/build/tools/ril-intercept.d.ts +24 -0
  188. package/build/tools/ril-intercept.d.ts.map +1 -0
  189. package/build/tools/ril-intercept.js +273 -0
  190. package/build/tools/ril-intercept.js.map +1 -0
  191. package/build/tools/screen-record.d.ts +9 -0
  192. package/build/tools/screen-record.d.ts.map +1 -0
  193. package/build/tools/screen-record.js +95 -0
  194. package/build/tools/screen-record.js.map +1 -0
  195. package/build/tools/screenshot-diff.d.ts +13 -0
  196. package/build/tools/screenshot-diff.d.ts.map +1 -0
  197. package/build/tools/screenshot-diff.js +370 -0
  198. package/build/tools/screenshot-diff.js.map +1 -0
  199. package/build/tools/selinux-audit.d.ts +17 -0
  200. package/build/tools/selinux-audit.d.ts.map +1 -0
  201. package/build/tools/selinux-audit.js +301 -0
  202. package/build/tools/selinux-audit.js.map +1 -0
  203. package/build/tools/shell.d.ts +6 -0
  204. package/build/tools/shell.d.ts.map +1 -0
  205. package/build/tools/shell.js +63 -0
  206. package/build/tools/shell.js.map +1 -0
  207. package/build/tools/snapshot.d.ts +9 -0
  208. package/build/tools/snapshot.d.ts.map +1 -0
  209. package/build/tools/snapshot.js +192 -0
  210. package/build/tools/snapshot.js.map +1 -0
  211. package/build/tools/split-apk.d.ts +13 -0
  212. package/build/tools/split-apk.d.ts.map +1 -0
  213. package/build/tools/split-apk.js +229 -0
  214. package/build/tools/split-apk.js.map +1 -0
  215. package/build/tools/test-gen.d.ts +14 -0
  216. package/build/tools/test-gen.d.ts.map +1 -0
  217. package/build/tools/test-gen.js +252 -0
  218. package/build/tools/test-gen.js.map +1 -0
  219. package/build/tools/testing.d.ts +9 -0
  220. package/build/tools/testing.d.ts.map +1 -0
  221. package/build/tools/testing.js +144 -0
  222. package/build/tools/testing.js.map +1 -0
  223. package/build/tools/thermal-power.d.ts +19 -0
  224. package/build/tools/thermal-power.d.ts.map +1 -0
  225. package/build/tools/thermal-power.js +330 -0
  226. package/build/tools/thermal-power.js.map +1 -0
  227. package/build/tools/ui.d.ts +6 -0
  228. package/build/tools/ui.d.ts.map +1 -0
  229. package/build/tools/ui.js +266 -0
  230. package/build/tools/ui.js.map +1 -0
  231. package/build/tools/wireless.d.ts +7 -0
  232. package/build/tools/wireless.d.ts.map +1 -0
  233. package/build/tools/wireless.js +78 -0
  234. package/build/tools/wireless.js.map +1 -0
  235. package/build/tools/workflow-market.d.ts +17 -0
  236. package/build/tools/workflow-market.d.ts.map +1 -0
  237. package/build/tools/workflow-market.js +237 -0
  238. package/build/tools/workflow-market.js.map +1 -0
  239. package/build/tools/workflow.d.ts +32 -0
  240. package/build/tools/workflow.d.ts.map +1 -0
  241. package/build/tools/workflow.js +374 -0
  242. package/build/tools/workflow.js.map +1 -0
  243. package/build/ws-transport.d.ts +30 -0
  244. package/build/ws-transport.d.ts.map +1 -0
  245. package/build/ws-transport.js +133 -0
  246. package/build/ws-transport.js.map +1 -0
  247. package/package.json +37 -0
@@ -0,0 +1,323 @@
1
+ /**
2
+ * Baseband/Modem Integration Tools — Deep cellular radio state inspection.
3
+ *
4
+ * Provides detailed modem and radio diagnostics for advanced Android
5
+ * development and cellular network research. Extracts modem identification,
6
+ * cell identity, signal measurements, neighboring cells, carrier config,
7
+ * and baseband logs.
8
+ *
9
+ * Supports Shannon/Exynos, Qualcomm, MediaTek, and Unisoc chipset families
10
+ * via standard Android telephony APIs. Root access enables additional
11
+ * kernel-level modem logging.
12
+ */
13
+ import { z } from "zod";
14
+ import { OutputProcessor } from "../middleware/output-processor.js";
15
+ import { validateShellArg } from "../middleware/sanitize.js";
16
+ import { detectSimConfig } from "../middleware/chipset.js";
17
+ export function registerBasebandTools(ctx) {
18
+ ctx.server.tool("adb_baseband_info", "Get comprehensive modem/baseband identification: firmware version, RIL implementation, chipset, IMEI, SIM state, and radio capabilities.", {
19
+ device: z.string().optional().describe("Device serial"),
20
+ includeImei: z.boolean().optional().default(false).describe("Include IMEI in output (sensitive permanent device identifier — opt-in only)"),
21
+ }, async ({ device, includeImei }) => {
22
+ try {
23
+ const resolved = await ctx.deviceManager.resolveDevice(device);
24
+ const serial = resolved.serial;
25
+ const propKeys = [
26
+ "gsm.version.baseband",
27
+ "gsm.version.ril-impl",
28
+ "gsm.nitz.time",
29
+ "gsm.sim.state",
30
+ "gsm.sim.operator.alpha",
31
+ "gsm.sim.operator.numeric",
32
+ "gsm.operator.alpha",
33
+ "gsm.operator.numeric",
34
+ "gsm.operator.iso-country",
35
+ "gsm.network.type",
36
+ "persist.sys.radio.apm_sim_not_pwdn",
37
+ "ro.telephony.default_network",
38
+ "ro.baseband",
39
+ "ro.hardware.chipname",
40
+ // Dual SIM detection
41
+ "telephony.active_modems.max_count",
42
+ "persist.radio.multisim.config",
43
+ ];
44
+ const propResults = await Promise.allSettled(propKeys.map((key) => ctx.bridge.shell(`getprop ${key}`, { device: serial })
45
+ .then((r) => ({ key, value: r.stdout.trim() }))));
46
+ const props = {};
47
+ for (const r of propResults) {
48
+ if (r.status === "fulfilled" && r.value.value) {
49
+ props[r.value.key] = r.value.value;
50
+ }
51
+ }
52
+ // Detect dual SIM configuration (shared logic in chipset.ts)
53
+ const { dualSim: isDualSim, simSlots, multisimMode: multisimConfig } = detectSimConfig(props);
54
+ const sections = [];
55
+ sections.push("=== Baseband/Modem ===");
56
+ sections.push(`Baseband version: ${props["gsm.version.baseband"] ?? "unknown"}`);
57
+ sections.push(`RIL implementation: ${props["gsm.version.ril-impl"] ?? "unknown"}`);
58
+ sections.push(`Hardware chipset: ${props["ro.hardware.chipname"] ?? props["ro.baseband"] ?? "unknown"}`);
59
+ sections.push(`Default network mode: ${props["ro.telephony.default_network"] ?? "unknown"}`);
60
+ // SIM Configuration section
61
+ sections.push("\n=== SIM Configuration ===");
62
+ if (isDualSim) {
63
+ const configLabel = multisimConfig === "dsda" ? "Dual SIM Dual Active (DSDA)"
64
+ : multisimConfig === "dsds" ? "Dual SIM Dual Standby (DSDS)"
65
+ : multisimConfig === "tsts" ? "Triple SIM Triple Standby (TSTS)"
66
+ : `Dual SIM (${simSlots} slots)`;
67
+ sections.push(`Mode: ${configLabel}`);
68
+ // Query per-slot properties
69
+ // Android uses varying suffix conventions: .0/.1, 2 suffix, or no suffix for slot 0
70
+ const slotPropKeys = [
71
+ "gsm.sim.state",
72
+ "gsm.sim.operator.alpha",
73
+ "gsm.sim.operator.numeric",
74
+ "gsm.operator.alpha",
75
+ "gsm.operator.numeric",
76
+ "gsm.operator.iso-country",
77
+ "gsm.network.type",
78
+ "gsm.nitz.time",
79
+ "gsm.version.baseband",
80
+ ];
81
+ // Build per-slot queries: try .0/.1 indexed and legacy 2-suffix
82
+ const slotQueries = [];
83
+ for (let slot = 0; slot < simSlots; slot++) {
84
+ for (const key of slotPropKeys) {
85
+ // Try indexed suffix (.0, .1)
86
+ slotQueries.push({ slot, key, prop: `${key}.${slot}` });
87
+ // Try legacy suffix (key2 for slot 1)
88
+ if (slot === 1) {
89
+ const base = key.endsWith(".baseband") ? key.replace(".baseband", ".baseband1")
90
+ : key + "2";
91
+ slotQueries.push({ slot, key, prop: base });
92
+ }
93
+ }
94
+ }
95
+ const slotResults = await Promise.allSettled(slotQueries.map((q) => ctx.bridge.shell(`getprop ${q.prop}`, { device: serial })
96
+ .then((r) => ({ ...q, value: r.stdout.trim() }))));
97
+ // Organize per-slot data: first non-empty value wins for each slot+key
98
+ const slotData = Array.from({ length: simSlots }, () => ({}));
99
+ for (const r of slotResults) {
100
+ if (r.status === "fulfilled" && r.value.value) {
101
+ const { slot, key, value } = r.value;
102
+ if (!slotData[slot][key]) {
103
+ slotData[slot][key] = value;
104
+ }
105
+ }
106
+ }
107
+ // Fall back to unsuffixed props for slot 0 (primary slot)
108
+ for (const key of slotPropKeys) {
109
+ if (!slotData[0][key] && props[key]) {
110
+ slotData[0][key] = props[key];
111
+ }
112
+ }
113
+ // Display per-slot info
114
+ for (let slot = 0; slot < simSlots; slot++) {
115
+ const sd = slotData[slot];
116
+ const simState = sd["gsm.sim.state"] ?? "unknown";
117
+ const simOp = sd["gsm.sim.operator.alpha"] ?? "";
118
+ const simPlmn = sd["gsm.sim.operator.numeric"] ?? "";
119
+ const netOp = sd["gsm.operator.alpha"] ?? "";
120
+ const netPlmn = sd["gsm.operator.numeric"] ?? "";
121
+ const netType = sd["gsm.network.type"] ?? "";
122
+ const country = sd["gsm.operator.iso-country"] ?? "";
123
+ const baseband = sd["gsm.version.baseband"] ?? "";
124
+ sections.push(`\n --- Slot ${slot} ---`);
125
+ sections.push(` SIM state: ${simState}`);
126
+ if (simOp || simPlmn) {
127
+ sections.push(` SIM operator: ${simOp || "unknown"} (${simPlmn || "?"})`);
128
+ }
129
+ if (netOp || netPlmn || netType) {
130
+ sections.push(` Network: ${netOp || "unknown"} (${netPlmn || "?"}) — ${netType || "unknown"}`);
131
+ }
132
+ if (country)
133
+ sections.push(` Country: ${country}`);
134
+ if (baseband && baseband !== (props["gsm.version.baseband"] ?? "")) {
135
+ sections.push(` Baseband: ${baseband}`);
136
+ }
137
+ }
138
+ }
139
+ else {
140
+ sections.push("Mode: Single SIM");
141
+ sections.push(`SIM state: ${props["gsm.sim.state"] ?? "unknown"}`);
142
+ sections.push(`SIM operator: ${props["gsm.sim.operator.alpha"] ?? "unknown"} (${props["gsm.sim.operator.numeric"] ?? "?"})`);
143
+ }
144
+ sections.push("\n=== Network Registration ===");
145
+ sections.push(`Network operator: ${props["gsm.operator.alpha"] ?? "unknown"} (${props["gsm.operator.numeric"] ?? "?"})`);
146
+ sections.push(`Country: ${props["gsm.operator.iso-country"] ?? "unknown"}`);
147
+ sections.push(`Network type: ${props["gsm.network.type"] ?? "unknown"}`);
148
+ sections.push(`NITZ time: ${props["gsm.nitz.time"] ?? "not received"}`);
149
+ // Try to get IMEI only if explicitly requested (sensitive permanent device identifier)
150
+ if (includeImei) {
151
+ const imeiResult = await ctx.bridge.shell("service call iphonesubinfo 1 | grep -oP \"[0-9a-f]{8}\" | while read hex; do printf \"\\\\x$(echo $hex | sed 's/../\\\\x&/g')\"; done 2>/dev/null || echo UNAVAILABLE", { device: serial, ignoreExitCode: true, timeout: 5000 });
152
+ const imei = imeiResult.stdout.trim();
153
+ if (imei && !imei.includes("UNAVAILABLE")) {
154
+ sections.push(`\nIMEI: ${imei} (⚠ permanent device identifier)`);
155
+ }
156
+ else {
157
+ sections.push("\nIMEI: unavailable (requires phone permission or root)");
158
+ }
159
+ }
160
+ else {
161
+ sections.push("\nIMEI: (omitted — set includeImei=true to retrieve)");
162
+ }
163
+ return { content: [{ type: "text", text: sections.join("\n") }] };
164
+ }
165
+ catch (error) {
166
+ return { content: [{ type: "text", text: OutputProcessor.formatError(error) }], isError: true };
167
+ }
168
+ });
169
+ ctx.server.tool("adb_cell_identity", "Extract detailed cell identity information: Cell ID (CID), TAC/LAC, EARFCN/ARFCN, Physical Cell ID (PCI), PLMN, and network type. Parses structured data from dumpsys for cellular network analysis.", {
170
+ device: z.string().optional().describe("Device serial"),
171
+ }, async ({ device }) => {
172
+ try {
173
+ const resolved = await ctx.deviceManager.resolveDevice(device);
174
+ const serial = resolved.serial;
175
+ const [phoneService, cellInfoList, serviceState] = await Promise.allSettled([
176
+ ctx.bridge.shell("dumpsys phone | grep -A 50 'mCellIdentity'", { device: serial, timeout: 10000, ignoreExitCode: true }),
177
+ ctx.bridge.shell("dumpsys phone | grep -A 80 'mCellInfo'", { device: serial, timeout: 10000, ignoreExitCode: true }),
178
+ ctx.bridge.shell("dumpsys phone | grep -A 30 'mServiceState'", { device: serial, timeout: 10000, ignoreExitCode: true }),
179
+ ]);
180
+ let output = "=== Serving Cell Identity ===\n";
181
+ output += OutputProcessor.settledValue(phoneService, undefined, "Could not retrieve cell identity");
182
+ output += "\n\n=== Cell Info List ===\n";
183
+ output += OutputProcessor.settledValue(cellInfoList, undefined, "Could not retrieve cell info list");
184
+ output += "\n\n=== Service State ===\n";
185
+ output += OutputProcessor.settledValue(serviceState, undefined, "Could not retrieve service state");
186
+ // Key getprop values for quick reference
187
+ const [mcc, mnc, netType, identifiers] = await Promise.allSettled([
188
+ ctx.bridge.shell("getprop gsm.operator.numeric", { device: serial }),
189
+ ctx.bridge.shell("getprop gsm.sim.operator.numeric", { device: serial }),
190
+ ctx.bridge.shell("getprop gsm.network.type", { device: serial }),
191
+ ctx.bridge.shell("dumpsys phone | grep -i 'lac\\|tac\\|cid\\|earfcn\\|pci' | head -20", { device: serial, ignoreExitCode: true }),
192
+ ]);
193
+ output += "\n\n=== Quick Reference ===\n";
194
+ output += `Network PLMN: ${OutputProcessor.settledValue(mcc)}\n`;
195
+ output += `SIM PLMN: ${OutputProcessor.settledValue(mnc)}\n`;
196
+ output += `Network type: ${OutputProcessor.settledValue(netType)}\n`;
197
+ output += `Key identifiers:\n${OutputProcessor.settledValue(identifiers)}`;
198
+ return { content: [{ type: "text", text: OutputProcessor.process(output) }] };
199
+ }
200
+ catch (error) {
201
+ return { content: [{ type: "text", text: OutputProcessor.formatError(error) }], isError: true };
202
+ }
203
+ });
204
+ ctx.server.tool("adb_signal_detail", "Get detailed signal strength measurements: RSRP, RSRQ, SINR, RSSI, timing advance, and signal bars. Provides raw radio measurements for signal analysis and anomaly detection.", {
205
+ device: z.string().optional().describe("Device serial"),
206
+ }, async ({ device }) => {
207
+ try {
208
+ const resolved = await ctx.deviceManager.resolveDevice(device);
209
+ const serial = resolved.serial;
210
+ const [signalStrength, cellSignal, rilSignal] = await Promise.allSettled([
211
+ ctx.bridge.shell("dumpsys phone | grep -A 15 'mSignalStrength'", { device: serial, timeout: 10000, ignoreExitCode: true }),
212
+ ctx.bridge.shell("dumpsys phone | grep -A 10 'CellSignalStrength'", { device: serial, timeout: 10000, ignoreExitCode: true }),
213
+ ctx.bridge.shell("dumpsys phone | grep -iE 'rsrp|rsrq|rssi|sinr|snr|ber|ecno|rscp|level|timingAdvance' | head -30", { device: serial, timeout: 10000, ignoreExitCode: true }),
214
+ ]);
215
+ let output = "=== Signal Strength ===\n";
216
+ output += OutputProcessor.settledValue(signalStrength, undefined, "Could not retrieve signal strength");
217
+ output += "\n\n=== Cell Signal Strength Detail ===\n";
218
+ output += OutputProcessor.settledValue(cellSignal, undefined, "Could not retrieve cell signal");
219
+ output += "\n\n=== Radio Measurements ===\n";
220
+ output += OutputProcessor.settledValue(rilSignal, undefined, "Could not retrieve radio measurements");
221
+ return { content: [{ type: "text", text: OutputProcessor.process(output) }] };
222
+ }
223
+ catch (error) {
224
+ return { content: [{ type: "text", text: OutputProcessor.formatError(error) }], isError: true };
225
+ }
226
+ });
227
+ ctx.server.tool("adb_neighboring_cells", "List all visible cells beyond the serving cell: neighboring LTE/5G/WCDMA/GSM cells with their identities and signal strengths. Useful for cellular network surveys, coverage analysis, and radio environment characterization.", {
228
+ device: z.string().optional().describe("Device serial"),
229
+ }, async ({ device }) => {
230
+ try {
231
+ const resolved = await ctx.deviceManager.resolveDevice(device);
232
+ const serial = resolved.serial;
233
+ const [cellInfoFull, neighborDump, registrationInfo] = await Promise.allSettled([
234
+ ctx.bridge.shell("dumpsys phone | sed -n '/mCellInfo/,/^[^ ]/p' | head -200", { device: serial, timeout: 15000, ignoreExitCode: true }),
235
+ ctx.bridge.shell("dumpsys phone | grep -A 5 'NeighboringCellInfo\\|CellInfoLte\\|CellInfoNr\\|CellInfoWcdma\\|CellInfoGsm' | head -100", { device: serial, timeout: 10000, ignoreExitCode: true }),
236
+ ctx.bridge.shell("dumpsys phone | grep -A 10 'NetworkRegistrationInfo' | head -60", { device: serial, timeout: 10000, ignoreExitCode: true }),
237
+ ]);
238
+ let output = "=== All Visible Cells ===\n";
239
+ output += OutputProcessor.settledValue(cellInfoFull, 15000, "Could not retrieve cell info list");
240
+ output += "\n\n=== Neighboring Cell Detail ===\n";
241
+ output += OutputProcessor.settledValue(neighborDump, undefined, "Could not retrieve neighbor info");
242
+ output += "\n\n=== Network Registration ===\n";
243
+ output += OutputProcessor.settledValue(registrationInfo, undefined, "Could not retrieve registration info");
244
+ return { content: [{ type: "text", text: OutputProcessor.process(output) }] };
245
+ }
246
+ catch (error) {
247
+ return { content: [{ type: "text", text: OutputProcessor.formatError(error) }], isError: true };
248
+ }
249
+ });
250
+ ctx.server.tool("adb_carrier_config", "Dump carrier configuration values. Useful for verifying carrier settings, detecting configuration anomalies, and inspecting APN configurations.", {
251
+ device: z.string().optional().describe("Device serial"),
252
+ }, async ({ device }) => {
253
+ try {
254
+ const resolved = await ctx.deviceManager.resolveDevice(device);
255
+ const serial = resolved.serial;
256
+ const [carrierConfig, carrierIdInfo, apnSettings] = await Promise.allSettled([
257
+ ctx.bridge.shell("dumpsys carrier_config", { device: serial, timeout: 15000 }),
258
+ ctx.bridge.shell("dumpsys phone | grep -A 10 'mCarrierId\\|carrierId\\|mSpecificCarrierId'", { device: serial, timeout: 10000, ignoreExitCode: true }),
259
+ ctx.bridge.shell("content query --uri content://telephony/carriers/preferapn 2>/dev/null || echo APN_QUERY_UNAVAILABLE", { device: serial, timeout: 10000, ignoreExitCode: true }),
260
+ ]);
261
+ let output = "=== Carrier Configuration ===\n";
262
+ output += OutputProcessor.settledValue(carrierConfig, 20000, "Could not retrieve carrier config");
263
+ output += "\n\n=== Carrier ID ===\n";
264
+ output += OutputProcessor.settledValue(carrierIdInfo, undefined, "Could not retrieve carrier ID");
265
+ output += "\n\n=== Preferred APN ===\n";
266
+ output += OutputProcessor.settledValue(apnSettings, undefined, "Could not retrieve APN settings");
267
+ return { content: [{ type: "text", text: OutputProcessor.process(output) }] };
268
+ }
269
+ catch (error) {
270
+ return { content: [{ type: "text", text: OutputProcessor.formatError(error) }], isError: true };
271
+ }
272
+ });
273
+ ctx.server.tool("adb_modem_logs", "Capture modem/baseband-related logs from multiple sources: RIL (Radio Interface Layer) logcat, telephony framework logs, and kernel modem messages via dmesg (root required for dmesg). Useful for radio diagnostics and tracing baseband-framework communication.", {
274
+ lines: z.number().min(1).max(5000).optional().default(200).describe("Max lines per log source (1-5000, default 200)"),
275
+ grep: z.string().optional().describe("Additional grep filter applied to all sources"),
276
+ device: z.string().optional().describe("Device serial"),
277
+ }, async ({ lines, grep, device }) => {
278
+ try {
279
+ const resolved = await ctx.deviceManager.resolveDevice(device);
280
+ const serial = resolved.serial;
281
+ const maxLines = Math.min(lines, ctx.config.maxLogcatLines);
282
+ if (grep) {
283
+ const grepErr = validateShellArg(grep, "grep");
284
+ if (grepErr)
285
+ return { content: [{ type: "text", text: grepErr }], isError: true };
286
+ }
287
+ const grepSuffix = grep ? ` | grep -iF '${grep}'` : "";
288
+ // Double-quotes intentional: this goes through rootShell (su -c '...'), so inner single quotes would break
289
+ const dmesgGrepSuffix = grep ? ` | grep -iF "${grep}"` : "";
290
+ const [rilLog, telephonyLog, radioLog, dmesgModem] = await Promise.allSettled([
291
+ // RIL daemon logs from the radio buffer
292
+ ctx.bridge.shell(`logcat -d -b radio -t ${maxLines}${grepSuffix}`, {
293
+ device: serial, timeout: 10000, ignoreExitCode: true,
294
+ }),
295
+ // Telephony framework logs
296
+ ctx.bridge.shell(`logcat -d -s Telephony:V TelephonyManager:V ServiceState:V GsmCdmaPhone:V -t ${maxLines}${grepSuffix}`, {
297
+ device: serial, timeout: 10000, ignoreExitCode: true,
298
+ }),
299
+ // RILJ/RILC specific tags
300
+ ctx.bridge.shell(`logcat -d -s RILJ:V RILC:V RIL:V -t ${maxLines}${grepSuffix}`, {
301
+ device: serial, timeout: 10000, ignoreExitCode: true,
302
+ }),
303
+ // Kernel modem messages (requires root)
304
+ ctx.bridge.rootShell(`dmesg | grep -iE "modem|baseband|shannon|ril|cellular|radio" | tail -${maxLines}${dmesgGrepSuffix}`, {
305
+ device: serial, timeout: 10000, ignoreExitCode: true,
306
+ }),
307
+ ]);
308
+ let output = "=== Radio Buffer (RIL) ===\n";
309
+ output += OutputProcessor.settledValue(rilLog, 15000, "Could not retrieve radio log");
310
+ output += "\n\n=== Telephony Framework ===\n";
311
+ output += OutputProcessor.settledValue(telephonyLog, 10000, "Could not retrieve telephony log");
312
+ output += "\n\n=== RIL Interface (RILJ/RILC) ===\n";
313
+ output += OutputProcessor.settledValue(radioLog, 10000, "Could not retrieve RIL log");
314
+ output += "\n\n=== Kernel Modem (dmesg, requires root) ===\n";
315
+ output += OutputProcessor.settledValue(dmesgModem, 10000, "Could not retrieve dmesg (root required)");
316
+ return { content: [{ type: "text", text: OutputProcessor.process(output) }] };
317
+ }
318
+ catch (error) {
319
+ return { content: [{ type: "text", text: OutputProcessor.formatError(error) }], isError: true };
320
+ }
321
+ });
322
+ }
323
+ //# sourceMappingURL=baseband.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseband.js","sourceRoot":"","sources":["../../src/tools/baseband.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,UAAU,qBAAqB,CAAC,GAAgB;IAEpD,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,mBAAmB,EACnB,0IAA0I,EAC1I;QACE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;QAC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EAAE,cAAc,EAAE,IAAI;iBACrD,CAAC;aACH,CAAC,CAAC;YAEH,IAAI,MAAM,GAAG,8BAA8B,CAAC;YAC5C,MAAM,IAAI,eAAe,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,8BAA8B,CAAC,CAAC;YACtF,MAAM,IAAI,mCAAmC,CAAC;YAC9C,MAAM,IAAI,eAAe,CAAC,YAAY,CAAC,YAAY,EAAE,KAAK,EAAE,kCAAkC,CAAC,CAAC;YAChG,MAAM,IAAI,yCAAyC,CAAC;YACpD,MAAM,IAAI,eAAe,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,4BAA4B,CAAC,CAAC;YACtF,MAAM,IAAI,mDAAmD,CAAC;YAC9D,MAAM,IAAI,eAAe,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,EAAE,0CAA0C,CAAC,CAAC;YAEtG,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;QAChF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAClG,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Build Tools — Gradle build, install, and run integration.
3
+ */
4
+ import { ToolContext } from "../tool-context.js";
5
+ export declare function registerBuildTools(ctx: ToolContext): void;
6
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/tools/build.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAUjD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAoEzD"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Build Tools — Gradle build, install, and run integration.
3
+ */
4
+ import { z } from "zod";
5
+ import { execFile } from "child_process";
6
+ import { existsSync } from "fs";
7
+ import { join } from "path";
8
+ import { platform } from "os";
9
+ import { OutputProcessor } from "../middleware/output-processor.js";
10
+ function getGradleWrapper(projectPath) {
11
+ const isWindows = platform() === "win32";
12
+ const wrapper = isWindows ? "gradlew.bat" : "gradlew";
13
+ const fullPath = join(projectPath, wrapper);
14
+ return existsSync(fullPath) ? fullPath : wrapper;
15
+ }
16
+ export function registerBuildTools(ctx) {
17
+ ctx.server.tool("adb_gradle", "Run a Gradle task in an Android project directory", {
18
+ projectPath: z.string().describe("Path to the Android project root (containing gradlew)"),
19
+ task: z.string().describe("Gradle task (e.g., 'assembleDebug', 'installDebug', 'clean')"),
20
+ args: z.string().optional().describe("Additional Gradle arguments"),
21
+ }, async ({ projectPath, task, args }) => {
22
+ try {
23
+ const gradle = getGradleWrapper(projectPath);
24
+ const gradleArgs = [task];
25
+ if (args)
26
+ gradleArgs.push(...args.split(" "));
27
+ return new Promise((resolve) => {
28
+ execFile(gradle, gradleArgs, {
29
+ cwd: projectPath,
30
+ timeout: 300000,
31
+ maxBuffer: 1024 * 1024 * 10,
32
+ windowsHide: true,
33
+ }, (error, stdout, stderr) => {
34
+ let output = stdout?.toString() ?? "";
35
+ if (stderr)
36
+ output += `\n--- STDERR ---\n${stderr.toString()}`;
37
+ if (error && error.killed)
38
+ output += "\n--- BUILD TIMED OUT (5 min limit) ---";
39
+ resolve({ content: [{ type: "text", text: OutputProcessor.process(output) }] });
40
+ });
41
+ });
42
+ }
43
+ catch (error) {
44
+ return { content: [{ type: "text", text: OutputProcessor.formatError(error) }], isError: true };
45
+ }
46
+ });
47
+ ctx.server.tool("adb_build_and_install", "Build a debug APK and install it on the connected device (convenience wrapper)", {
48
+ projectPath: z.string().describe("Path to the Android project root"),
49
+ device: z.string().optional().describe("Device serial"),
50
+ }, async ({ projectPath, device }) => {
51
+ try {
52
+ const resolved = await ctx.deviceManager.resolveDevice(device);
53
+ const gradle = getGradleWrapper(projectPath);
54
+ return new Promise((resolve) => {
55
+ execFile(gradle, ["installDebug"], {
56
+ cwd: projectPath,
57
+ timeout: 300000,
58
+ maxBuffer: 1024 * 1024 * 10,
59
+ windowsHide: true,
60
+ env: { ...process.env, ANDROID_SERIAL: resolved.serial },
61
+ }, (error, stdout, stderr) => {
62
+ let output = stdout?.toString() ?? "";
63
+ if (stderr)
64
+ output += `\n--- STDERR ---\n${stderr.toString()}`;
65
+ if (error && !error.killed) {
66
+ output += `\n--- BUILD FAILED ---`;
67
+ }
68
+ else if (!error) {
69
+ output += `\n--- BUILD AND INSTALL SUCCESSFUL (device: ${resolved.serial}) ---`;
70
+ }
71
+ resolve({ content: [{ type: "text", text: OutputProcessor.process(output) }] });
72
+ });
73
+ });
74
+ }
75
+ catch (error) {
76
+ return { content: [{ type: "text", text: OutputProcessor.formatError(error) }], isError: true };
77
+ }
78
+ });
79
+ }
80
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/tools/build.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,SAAS,gBAAgB,CAAC,WAAmB;IAC3C,MAAM,SAAS,GAAG,QAAQ,EAAE,KAAK,OAAO,CAAC;IACzC,MAAM,O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B,OAAO,EAAE,MAAM;oBACf,SAAS,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE;oBAC3B,WAAW,EAAE,IAAI;oBACjB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,CAAC,MAAM,EAAE;iBACzD,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;oBAC3B,IAAI,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;oBACtC,IAAI,MAAM;wBAAE,MAAM,IAAI,qBAAqB,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;oBAC/D,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;wBAC3B,MAAM,IAAI,wBAAwB,CAAC;oBACrC,CAAC;yBAAM,IAAI,CAAC,KAAK,EAAE,CAAC;wBAClB,MAAM,IAAI,+CAA+C,QAAQ,CAAC,MAAM,OAAO,CAAC;oBAClF,CAAC;oBACD,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;gBAClF,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAClG,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * CI/CD Integration Tools — Headless test execution and device readiness.
3
+ *
4
+ * Designed for automated pipelines: wait for device boot, verify readiness,
5
+ * run instrumented tests, and capture structured results.
6
+ */
7
+ import { ToolContext } from "../tool-context.js";
8
+ export declare function registerCiTools(ctx: ToolContext): void;
9
+ //# sourceMappingURL=ci.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci.d.ts","sourceRoot":"","sources":["../../src/tools/ci.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAIjD,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CA+KtD"}
@@ -0,0 +1,163 @@
1
+ /**
2
+ * CI/CD Integration Tools — Headless test execution and device readiness.
3
+ *
4
+ * Designed for automated pipelines: wait for device boot, verify readiness,
5
+ * run instrumented tests, and capture structured results.
6
+ */
7
+ import { z } from "zod";
8
+ import { OutputProcessor } from "../middleware/output-processor.js";
9
+ import { validateShellArg } from "../middleware/sanitize.js";
10
+ export function registerCiTools(ctx) {
11
+ ctx.server.tool("adb_ci_wait_boot", "Wait for a device or emulator to fully boot. Polls sys.boot_completed and waits for the launcher to be ready. Essential for CI pipelines.", {
12
+ timeoutSeconds: z.number().min(10).max(300).optional().default(120)
13
+ .describe("Maximum time to wait for boot in seconds (default 120)"),
14
+ device: z.string().optional().describe("Device serial"),
15
+ }, async ({ timeoutSeconds, device }) => {
16
+ try {
17
+ const startTime = Date.now();
18
+ const deadline = startTime + timeoutSeconds * 1000;
19
+ // First wait for any device to appear
20
+ let resolved;
21
+ while (Date.now() < deadline) {
22
+ try {
23
+ ctx.deviceManager.invalidateCache();
24
+ resolved = await ctx.deviceManager.resolveDevice(device);
25
+ break;
26
+ }
27
+ catch {
28
+ await new Promise((r) => setTimeout(r, 2000));
29
+ }
30
+ }
31
+ if (!resolved) {
32
+ return { content: [{ type: "text", text: `Timed out waiting for device after ${timeoutSeconds}s.` }], isError: true };
33
+ }
34
+ // Now wait for boot_completed
35
+ const serial = resolved.serial;
36
+ while (Date.now() < deadline) {
37
+ const bootResult = await ctx.bridge.shell("getprop sys.boot_completed", {
38
+ device: serial, ignoreExitCode: true,
39
+ });
40
+ if (bootResult.stdout.trim() === "1") {
41
+ // Also check that the package manager is ready
42
+ const pmResult = await ctx.bridge.shell("pm path android", {
43
+ device: serial, ignoreExitCode: true,
44
+ });
45
+ if (pmResult.stdout.includes("package:")) {
46
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
47
+ return { content: [{ type: "text", text: `Device ${serial} booted and ready (${elapsed}s).` }] };
48
+ }
49
+ }
50
+ await new Promise((r) => setTimeout(r, 3000));
51
+ }
52
+ return { content: [{ type: "text", text: `Device appeared but boot did not complete within ${timeoutSeconds}s.` }], isError: true };
53
+ }
54
+ catch (error) {
55
+ return { content: [{ type: "text", text: OutputProcessor.formatError(error) }], isError: true };
56
+ }
57
+ });
58
+ ctx.server.tool("adb_ci_device_ready", "Comprehensive CI readiness check. Verifies: device online, booted, package manager ready, screen unlocked, network available. Returns structured pass/fail results.", {
59
+ device: z.string().optional().describe("Device serial"),
60
+ }, async ({ device }) => {
61
+ try {
62
+ const resolved = await ctx.deviceManager.resolveDevice(device);
63
+ const serial = resolved.serial;
64
+ const checks = [];
65
+ // Boot completed
66
+ const bootResult = await ctx.bridge.shell("getprop sys.boot_completed", { device: serial, ignoreExitCode: true });
67
+ checks.push({ name: "Boot completed", passed: bootResult.stdout.trim() === "1", detail: bootResult.stdout.trim() || "not set" });
68
+ // Package manager
69
+ const pmResult = await ctx.bridge.shell("pm path android", { device: serial, ignoreExitCode: true });
70
+ checks.push({ name: "Package manager", passed: pmResult.stdout.includes("package:"), detail: pmResult.stdout.includes("package:") ? "ready" : "not ready" });
71
+ // Screen state
72
+ const screenResult = await ctx.bridge.shell("dumpsys power | grep 'mWakefulness'", { device: serial, ignoreExitCode: true });
73
+ const awake = screenResult.stdout.includes("Awake");
74
+ checks.push({ name: "Screen awake", passed: awake, detail: awake ? "Awake" : screenResult.stdout.trim() || "unknown" });
75
+ // Network connectivity
76
+ const netResult = await ctx.bridge.shell("ping -c 1 -W 2 8.8.8.8", { device: serial, ignoreExitCode: true, timeout: 5000 });
77
+ const netOk = netResult.exitCode === 0;
78
+ checks.push({ name: "Network (internet)", passed: netOk, detail: netOk ? "reachable" : "unreachable" });
79
+ // Disk space
80
+ const dfResult = await ctx.bridge.shell("df /data | tail -1", { device: serial, ignoreExitCode: true });
81
+ const dfMatch = dfResult.stdout.match(/(\d+)%/);
82
+ const usage = dfMatch ? parseInt(dfMatch[1], 10) : 0;
83
+ checks.push({ name: "Disk space", passed: usage < 95, detail: `${usage}% used` });
84
+ const allPassed = checks.every((c) => c.passed);
85
+ const output = checks.map((c) => `${c.passed ? "✓" : "✗"} ${c.name}: ${c.detail}`).join("\n");
86
+ return {
87
+ content: [{
88
+ type: "text",
89
+ text: `CI Readiness: ${allPassed ? "ALL PASSED" : "ISSUES FOUND"}\n\n${output}`,
90
+ }],
91
+ };
92
+ }
93
+ catch (error) {
94
+ return { content: [{ type: "text", text: OutputProcessor.formatError(error) }], isError: true };
95
+ }
96
+ });
97
+ ctx.server.tool("adb_ci_run_tests", "Run Android instrumented tests (androidTest) via `am instrument` and capture results. Returns structured pass/fail output.", {
98
+ testPackage: z.string().describe("Test package (e.g., 'com.example.app.test')"),
99
+ runner: z.string().optional().default("androidx.test.runner.AndroidJUnitRunner")
100
+ .describe("Test runner class (default: AndroidX JUnit runner)"),
101
+ testClass: z.string().optional().describe("Specific test class to run (optional)"),
102
+ testMethod: z.string().optional().describe("Specific test method (requires testClass)"),
103
+ device: z.string().optional().describe("Device serial"),
104
+ timeout: z.number().min(10000).max(600000).optional().default(300000).describe("Timeout in ms (10s-10min, default 5 min)"),
105
+ }, async ({ testPackage, runner, testClass, testMethod, device, timeout }) => {
106
+ try {
107
+ const resolved = await ctx.deviceManager.resolveDevice(device);
108
+ const serial = resolved.serial;
109
+ // Validate all user-supplied identifiers that get interpolated into shell
110
+ const argsToCheck = [[testPackage, "testPackage"], [runner, "runner"]];
111
+ if (testClass)
112
+ argsToCheck.push([testClass, "testClass"]);
113
+ if (testMethod)
114
+ argsToCheck.push([testMethod, "testMethod"]);
115
+ for (const [val, name] of argsToCheck) {
116
+ const err = validateShellArg(val, name);
117
+ if (err)
118
+ return { content: [{ type: "text", text: err }], isError: true };
119
+ }
120
+ let cmd = `am instrument -w -r`;
121
+ if (testClass) {
122
+ cmd += ` -e class ${testClass}`;
123
+ if (testMethod)
124
+ cmd += `#${testMethod}`;
125
+ }
126
+ cmd += ` ${testPackage}/${runner}`;
127
+ const result = await ctx.bridge.shell(cmd, {
128
+ device: serial, timeout, ignoreExitCode: true,
129
+ });
130
+ const output = result.stdout;
131
+ // Parse basic test results
132
+ const okMatch = output.match(/OK \((\d+) tests?\)/);
133
+ const failMatch = output.match(/FAILURES!!!\s*Tests run:\s*(\d+),\s*Failures:\s*(\d+)/);
134
+ const errorMatch = output.match(/INSTRUMENTATION_STATUS: Error=(.*)/);
135
+ let summary;
136
+ if (okMatch) {
137
+ summary = `PASSED: ${okMatch[1]} test(s)`;
138
+ }
139
+ else if (failMatch) {
140
+ summary = `FAILED: ${failMatch[2]} failure(s) out of ${failMatch[1]} test(s)`;
141
+ }
142
+ else if (errorMatch) {
143
+ summary = `ERROR: ${errorMatch[1]}`;
144
+ }
145
+ else if (output.includes("INSTRUMENTATION_RESULT")) {
146
+ summary = "Completed (see output for details)";
147
+ }
148
+ else {
149
+ summary = "Unknown result — check raw output";
150
+ }
151
+ return {
152
+ content: [{
153
+ type: "text",
154
+ text: `${summary}\n\n${OutputProcessor.process(output, 30000)}`,
155
+ }],
156
+ };
157
+ }
158
+ catch (error) {
159
+ return { content: [{ type: "text", text: OutputProcessor.formatError(error) }], isError: true };
160
+ }
161
+ });
162
+ }
163
+ //# sourceMappingURL=ci.js.map