mobile-debug-mcp 0.34.0 → 0.35.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 (432) hide show
  1. package/.agents/skills/mcp-builder/SKILL.md +44 -64
  2. package/.agents/skills/mcp-builder/references/build-flags.md +44 -43
  3. package/.agents/skills/mcp-builder/references/diagnostics-schema.md +4 -1
  4. package/.agents/skills/mcp-builder/references/toolchain-details.md +49 -62
  5. package/.agents/skills/spec-review/references/spec-review-checklist.md +7 -0
  6. package/.agents/skills/test-authoring/SKILL.md +7 -6
  7. package/.agents/skills/test-authoring/references/repo-test-layout.md +3 -1
  8. package/.agents/skills/test-authoring/references/test-authoring-workflow.md +16 -7
  9. package/.agents/skills/test-authoring/references/test-quality-checklist.md +2 -1
  10. package/.github/copilot-instructions.md +14 -36
  11. package/.github/workflows/ci.yml +4 -4
  12. package/AGENTS.md +12 -3
  13. package/CONTRIBUTING.md +79 -0
  14. package/README.md +156 -129
  15. package/agent-plugin/.claude-plugin/plugin.json +2 -2
  16. package/agent-plugin/.codex-plugin/plugin.json +1 -1
  17. package/agent-plugin/.cursor-plugin/plugin.json +2 -2
  18. package/agent-plugin/.mcp.json +1 -1
  19. package/agent-plugin/README.md +16 -6
  20. package/agent-plugin/mcp.json +1 -1
  21. package/agent-plugin/plugin.json +1 -1
  22. package/agent-plugin/skills/mobile-debug-mcp/SKILL.md +27 -2
  23. package/dist/contracts/execution-controls.js +24 -0
  24. package/dist/contracts/selector.js +8 -0
  25. package/dist/contracts/target.js +15 -0
  26. package/dist/contracts/ui.js +1 -0
  27. package/dist/debugger/android.js +2 -1
  28. package/dist/debugger/diagnostics.js +54 -0
  29. package/dist/debugger/protocol.js +33 -0
  30. package/dist/debugger/sessions.js +104 -62
  31. package/dist/debugger/worker.js +53 -42
  32. package/dist/interact/adjustment/adjustment-context.js +41 -0
  33. package/dist/interact/adjustment/adjustment-gestures.js +55 -0
  34. package/dist/interact/adjustment/adjustment-plan.js +18 -0
  35. package/dist/interact/adjustment/adjustment-resolution.js +127 -0
  36. package/dist/interact/adjustment/adjustment-result.js +19 -0
  37. package/dist/interact/adjustment/adjustment-semantic.js +64 -0
  38. package/dist/interact/adjustment/adjustment-verification.js +35 -0
  39. package/dist/interact/adjustment/adjustment.js +52 -0
  40. package/dist/interact/adjustment/control-geometry.js +87 -0
  41. package/dist/interact/adjustment/control-values.js +136 -0
  42. package/dist/interact/adjustment/slider-labels.js +84 -0
  43. package/dist/interact/assertions/screen-assertion.js +37 -0
  44. package/dist/interact/assertions/state-assertion-context.js +35 -0
  45. package/dist/interact/assertions/state-assertion.js +76 -0
  46. package/dist/interact/assertions/state-comparison.js +141 -0
  47. package/dist/interact/assertions/visibility-assertion.js +34 -0
  48. package/dist/interact/conditional-action.js +12 -7
  49. package/dist/interact/index.js +65 -3090
  50. package/dist/interact/input-service.js +1 -0
  51. package/dist/interact/interaction-trace.js +21 -0
  52. package/dist/interact/model.js +1 -0
  53. package/dist/interact/observation.js +1 -0
  54. package/dist/interact/targeting/candidate-ancestor.js +58 -0
  55. package/dist/interact/targeting/candidate-result.js +23 -0
  56. package/dist/interact/targeting/candidate-scoring.js +50 -0
  57. package/dist/interact/targeting/element-helpers.js +216 -0
  58. package/dist/interact/targeting/find-element.js +65 -0
  59. package/dist/interact/targeting/nearby-control.js +56 -0
  60. package/dist/interact/targeting/resolved-elements.js +21 -0
  61. package/dist/interact/targeting/tap-target.js +17 -0
  62. package/dist/interact/targeting/target-scope.js +104 -0
  63. package/dist/interact/waits/legacy-log-wait.js +38 -0
  64. package/dist/interact/waits/legacy-wait-observations.js +103 -0
  65. package/dist/interact/waits/legacy-wait-state.js +34 -0
  66. package/dist/interact/waits/legacy-wait.js +48 -0
  67. package/dist/interact/waits/screen-wait.js +49 -0
  68. package/dist/interact/waits/ui-change-helpers.js +157 -0
  69. package/dist/interact/waits/ui-change-state.js +18 -0
  70. package/dist/interact/waits/ui-change-wait.js +77 -0
  71. package/dist/interact/waits/ui-wait-condition.js +56 -0
  72. package/dist/interact/waits/ui-wait-state.js +38 -0
  73. package/dist/interact/waits/ui-wait.js +106 -0
  74. package/dist/manage/android.js +55 -51
  75. package/dist/manage/index.js +38 -75
  76. package/dist/manage/ios/build-types.js +1 -0
  77. package/dist/manage/ios/build.js +210 -0
  78. package/dist/manage/ios/project-discovery.js +29 -0
  79. package/dist/manage/ios/scheme.js +18 -0
  80. package/dist/manage/ios.js +42 -256
  81. package/dist/observe/android/context.js +1 -0
  82. package/dist/observe/android/current-screen.js +55 -0
  83. package/dist/observe/android/fingerprint.js +13 -0
  84. package/dist/observe/android/log-stream.js +132 -0
  85. package/dist/observe/android/logs.js +107 -0
  86. package/dist/observe/android/screenshot.js +70 -0
  87. package/dist/observe/android/ui-tree.js +107 -0
  88. package/dist/observe/android.js +16 -520
  89. package/dist/observe/evidence.js +114 -75
  90. package/dist/observe/index.js +16 -263
  91. package/dist/observe/ios/context.js +16 -0
  92. package/dist/observe/ios/fingerprint.js +12 -0
  93. package/dist/observe/ios/log-stream.js +105 -0
  94. package/dist/observe/ios/logs.js +168 -0
  95. package/dist/observe/ios/screenshot.js +22 -0
  96. package/dist/observe/ios/ui-elements.js +241 -0
  97. package/dist/observe/ios/ui-tree.js +137 -0
  98. package/dist/observe/ios.js +17 -715
  99. package/dist/observe/logs/model.js +1 -0
  100. package/dist/{network → observe/network}/index.js +2 -2
  101. package/dist/observe/readiness-service.js +4 -2
  102. package/dist/observe/readiness.js +29 -10
  103. package/dist/observe/screenshot-encoding.js +41 -0
  104. package/dist/observe/snapshot-collection.js +79 -0
  105. package/dist/observe/snapshot-logs.js +30 -0
  106. package/dist/observe/snapshot-metadata.js +43 -31
  107. package/dist/observe/snapshot-semantic.js +115 -0
  108. package/dist/observe/system-trace.js +22 -13
  109. package/dist/runtime/action-results.js +270 -0
  110. package/dist/runtime/clock.js +4 -0
  111. package/dist/server/common.js +1 -256
  112. package/dist/server/definitions/assert.js +162 -0
  113. package/dist/server/definitions/diagnostic.js +118 -0
  114. package/dist/server/definitions/input.js +274 -0
  115. package/dist/server/definitions/manage.js +194 -0
  116. package/dist/server/definitions/observe.js +149 -0
  117. package/dist/server/definitions/target.js +138 -0
  118. package/dist/server/definitions/wait.js +105 -0
  119. package/dist/server/handlers/action-execution.js +163 -0
  120. package/dist/server/handlers/correlation.js +23 -0
  121. package/dist/server/{debugger-handlers.js → handlers/debugger-handlers.js} +22 -12
  122. package/dist/server/handlers/debugger-response.js +9 -0
  123. package/dist/server/handlers/diagnostic.js +69 -0
  124. package/dist/server/handlers/handler-types.js +1 -0
  125. package/dist/server/handlers/input.js +154 -0
  126. package/dist/server/handlers/interact.js +113 -0
  127. package/dist/server/handlers/journey-assertions.js +35 -0
  128. package/dist/server/handlers/journey.js +147 -0
  129. package/dist/server/handlers/manage.js +119 -0
  130. package/dist/server/handlers/observe.js +95 -0
  131. package/dist/server/handlers/payload.js +4 -0
  132. package/dist/server/handlers/tool-handlers.js +160 -0
  133. package/dist/server/schemas/condition-schema.js +2 -0
  134. package/dist/server/{debugger-schema.js → schemas/debugger-schema.js} +11 -6
  135. package/dist/server/{journey-schema.js → schemas/journey-schema.js} +7 -22
  136. package/dist/server/tool-definitions.js +58 -1135
  137. package/dist/server-core.js +2 -2
  138. package/dist/system/android-status.js +101 -0
  139. package/dist/system/android.js +37 -27
  140. package/dist/system/index.js +13 -439
  141. package/dist/system/ios-status.js +132 -0
  142. package/dist/system/ios.js +11 -8
  143. package/dist/system/model.js +1 -0
  144. package/dist/system/probes.js +105 -0
  145. package/dist/system/status-summary.js +43 -0
  146. package/dist/system/unsupported-status.js +52 -0
  147. package/dist/utils/android/commands.js +89 -0
  148. package/dist/utils/android/gradle.js +139 -0
  149. package/dist/utils/android/logs.js +103 -0
  150. package/dist/utils/android/ui-tree.js +233 -0
  151. package/dist/utils/android/utils.js +6 -564
  152. package/dist/utils/cli/idb/idb-helper.js +4 -6
  153. package/dist/utils/cli/idb/install-idb.js +13 -9
  154. package/dist/utils/cli/ios/preflight-ios.js +42 -38
  155. package/dist/utils/ios/utils.js +45 -46
  156. package/dist/utils/java.js +65 -49
  157. package/dist/utils/resolve-device.js +4 -2
  158. package/dist/utils/ui/index.js +26 -26
  159. package/docs/CHANGELOG.md +44 -0
  160. package/docs/README.md +38 -0
  161. package/docs/benchmarks/README.md +18 -0
  162. package/docs/benchmarks/interaction-latency/README.md +14 -0
  163. package/docs/benchmarks/interaction-latency/final.md +4 -1
  164. package/docs/benchmarks/interaction-latency/ios-validation.md +2 -0
  165. package/docs/benchmarks/ui-tree-performance/README.md +24 -16
  166. package/docs/benchmarks/ui-tree-performance/comparison.md +11 -10
  167. package/docs/code-structure.md +118 -0
  168. package/docs/specs/001-state-verification/spec.md +16 -14
  169. package/docs/specs/002-richer-element-identity/spec.md +12 -10
  170. package/docs/specs/003-wait-and-synchronization-reliability/spec.md +12 -10
  171. package/docs/specs/004-action-verification-routing/spec.md +3 -3
  172. package/docs/specs/005-unified-action-execution-and-verification-model/spec.md +2 -0
  173. package/docs/specs/006-runtime-action-instrumentation-and-binding-layer/spec.md +2 -0
  174. package/docs/specs/007-actionability-resolution-and-executable-target-selection/spec.md +3 -1
  175. package/docs/specs/008-adjustable-control-support-and-semantic-value-manipulation/spec.md +3 -4
  176. package/docs/specs/009-semantic-control-modeling-for-custom-and-composite-controls/spec.md +2 -0
  177. package/docs/specs/010-verification-stabilization-and-temporal-convergence/spec.md +2 -2
  178. package/docs/specs/011-recovery-and-replanning-for-failed-or-ambiguous-interaction-flows/spec.md +2 -2
  179. package/docs/specs/011.1-recovery-contract-types-and-runtime-wiring-spec/spec.md +2 -0
  180. package/docs/specs/012-action-trace-and-xecution-observability/spec.md +2 -3
  181. package/docs/specs/013-wait-and-synchronization-reliability/spec.md +19 -19
  182. package/docs/specs/014-actionability-resolution/spec.md +20 -18
  183. package/docs/specs/015-adjustable-control-support/spec.md +17 -15
  184. package/docs/specs/016-environment-tools/spec.md +20 -20
  185. package/docs/specs/018-interaction-latency-and-batched-journeys/spec.md +2 -0
  186. package/docs/specs/019-ui-tree-observation-performance/spec.md +3 -1
  187. package/docs/specs/020-conditional-actions/intent.md +5 -3
  188. package/docs/specs/020-conditional-actions/plan.md +8 -9
  189. package/docs/specs/020-conditional-actions/spec.md +4 -2
  190. package/docs/specs/021-app-readiness-signals/intent.md +4 -2
  191. package/docs/specs/021-app-readiness-signals/plan.md +7 -6
  192. package/docs/specs/021-app-readiness-signals/spec.md +3 -1
  193. package/docs/specs/022-correlated-evidence/intent.md +4 -4
  194. package/docs/specs/022-correlated-evidence/plan.md +10 -11
  195. package/docs/specs/022-correlated-evidence/spec.md +3 -1
  196. package/docs/specs/023-android-system-traces/intent.md +3 -2
  197. package/docs/specs/023-android-system-traces/plan.md +5 -7
  198. package/docs/specs/023-android-system-traces/spec.md +3 -1
  199. package/docs/specs/024-android-heap-dump-capture/intent.md +3 -1
  200. package/docs/specs/025-android-runtime-debugger/intent.md +4 -3
  201. package/docs/specs/025-android-runtime-debugger/plan.md +3 -1
  202. package/docs/specs/025-android-runtime-debugger/spec.md +4 -3
  203. package/docs/specs/026-code-structure-and-quality-gates/health-plan.md +88 -0
  204. package/docs/specs/026-code-structure-and-quality-gates/intent.md +47 -0
  205. package/docs/specs/026-code-structure-and-quality-gates/plan.md +191 -0
  206. package/docs/specs/026-code-structure-and-quality-gates/spec.md +138 -0
  207. package/docs/specs/026-code-structure-and-quality-gates/verification-final.json +200 -0
  208. package/docs/specs/026-code-structure-and-quality-gates/verification-thin-facade.json +154 -0
  209. package/docs/specs/026-code-structure-and-quality-gates/verification.json +136 -0
  210. package/docs/specs/027-debugger-failure-diagnostics/intent.md +43 -0
  211. package/docs/specs/027-debugger-failure-diagnostics/plan.md +86 -0
  212. package/docs/specs/027-debugger-failure-diagnostics/spec.md +133 -0
  213. package/docs/specs/028-compact-debugger-responses/intent.md +41 -0
  214. package/docs/specs/028-compact-debugger-responses/plan.md +112 -0
  215. package/docs/specs/028-compact-debugger-responses/spec.md +108 -0
  216. package/docs/specs/029-kotlin-locals-validation/report.md +119 -0
  217. package/docs/specs/030-android-coroutine-validation/evidence.json +475 -0
  218. package/docs/specs/030-android-coroutine-validation/intent.md +47 -0
  219. package/docs/specs/030-android-coroutine-validation/plan.md +147 -0
  220. package/docs/specs/030-android-coroutine-validation/report.md +240 -0
  221. package/docs/specs/030-android-coroutine-validation/spec.md +107 -0
  222. package/docs/tools/TOOLS.md +31 -18
  223. package/docs/tools/{evidence.md → correlated-evidence.md} +9 -1
  224. package/docs/tools/debugger.md +76 -0
  225. package/docs/tools/interact.md +42 -20
  226. package/docs/tools/manage.md +25 -44
  227. package/docs/tools/observe.md +55 -23
  228. package/docs/tools/system-traces.md +9 -1
  229. package/docs/tools/system.md +12 -5
  230. package/package.json +11 -8
  231. package/scripts/architecture-graph.mjs +69 -0
  232. package/scripts/check-architecture.mjs +47 -0
  233. package/scripts/code-quality-baseline.json +1 -0
  234. package/scripts/code-quality.mjs +161 -0
  235. package/src/contracts/execution-controls.ts +26 -0
  236. package/src/contracts/selector.ts +17 -0
  237. package/src/contracts/target.ts +19 -0
  238. package/src/contracts/ui.ts +94 -0
  239. package/src/debugger/android.ts +2 -1
  240. package/src/debugger/diagnostics.ts +43 -0
  241. package/src/debugger/guard.ts +6 -1
  242. package/{worker → src/debugger/java}/DebuggerWorker.java +9 -3
  243. package/src/debugger/protocol.ts +37 -0
  244. package/src/debugger/sessions.ts +314 -155
  245. package/src/debugger/worker.ts +51 -38
  246. package/src/interact/adjustment/adjustment-context.ts +83 -0
  247. package/src/interact/adjustment/adjustment-gestures.ts +48 -0
  248. package/src/interact/adjustment/adjustment-plan.ts +23 -0
  249. package/src/interact/adjustment/adjustment-resolution.ts +104 -0
  250. package/src/interact/adjustment/adjustment-result.ts +34 -0
  251. package/src/interact/adjustment/adjustment-semantic.ts +53 -0
  252. package/src/interact/adjustment/adjustment-verification.ts +60 -0
  253. package/src/interact/adjustment/adjustment.ts +49 -0
  254. package/src/interact/adjustment/control-geometry.ts +120 -0
  255. package/src/interact/adjustment/control-values.ts +141 -0
  256. package/src/interact/adjustment/slider-labels.ts +84 -0
  257. package/src/interact/assertions/screen-assertion.ts +39 -0
  258. package/src/interact/assertions/state-assertion-context.ts +48 -0
  259. package/src/interact/assertions/state-assertion.ts +64 -0
  260. package/src/interact/assertions/state-comparison.ts +168 -0
  261. package/src/interact/assertions/visibility-assertion.ts +41 -0
  262. package/src/interact/conditional-action.ts +18 -12
  263. package/src/interact/index.ts +76 -3492
  264. package/src/interact/input-service.ts +11 -0
  265. package/src/interact/interaction-trace.ts +36 -0
  266. package/src/interact/model.ts +109 -0
  267. package/src/interact/observation.ts +7 -0
  268. package/src/interact/targeting/candidate-ancestor.ts +49 -0
  269. package/src/interact/targeting/candidate-result.ts +24 -0
  270. package/src/interact/targeting/candidate-scoring.ts +42 -0
  271. package/src/interact/targeting/element-helpers.ts +243 -0
  272. package/src/interact/targeting/find-element.ts +47 -0
  273. package/src/interact/targeting/nearby-control.ts +46 -0
  274. package/src/interact/targeting/resolved-elements.ts +20 -0
  275. package/src/interact/targeting/tap-target.ts +22 -0
  276. package/src/interact/targeting/target-scope.ts +121 -0
  277. package/src/interact/waits/legacy-log-wait.ts +30 -0
  278. package/src/interact/waits/legacy-wait-observations.ts +55 -0
  279. package/src/interact/waits/legacy-wait-state.ts +48 -0
  280. package/src/interact/waits/legacy-wait.ts +34 -0
  281. package/src/interact/waits/screen-wait.ts +37 -0
  282. package/src/interact/waits/ui-change-helpers.ts +184 -0
  283. package/src/interact/waits/ui-change-state.ts +26 -0
  284. package/src/interact/waits/ui-change-wait.ts +59 -0
  285. package/src/interact/waits/ui-wait-condition.ts +52 -0
  286. package/src/interact/waits/ui-wait-state.ts +55 -0
  287. package/src/interact/waits/ui-wait.ts +84 -0
  288. package/src/manage/android.ts +56 -50
  289. package/src/manage/index.ts +63 -93
  290. package/src/manage/ios/build-types.ts +14 -0
  291. package/src/manage/ios/build.ts +230 -0
  292. package/src/manage/ios/project-discovery.ts +26 -0
  293. package/src/manage/ios/scheme.ts +16 -0
  294. package/src/manage/ios.ts +65 -298
  295. package/src/observe/android/context.ts +1 -0
  296. package/src/observe/android/current-screen.ts +63 -0
  297. package/src/observe/android/fingerprint.ts +13 -0
  298. package/src/observe/android/log-stream.ts +127 -0
  299. package/src/observe/android/logs.ts +110 -0
  300. package/src/observe/android/screenshot.ts +79 -0
  301. package/src/observe/android/ui-tree.ts +113 -0
  302. package/src/observe/android.ts +17 -531
  303. package/src/observe/evidence.ts +122 -70
  304. package/src/observe/index.ts +24 -286
  305. package/src/observe/ios/context.ts +22 -0
  306. package/src/observe/ios/fingerprint.ts +12 -0
  307. package/src/observe/ios/log-stream.ts +103 -0
  308. package/src/observe/ios/logs.ts +179 -0
  309. package/src/observe/ios/screenshot.ts +26 -0
  310. package/src/observe/ios/ui-elements.ts +266 -0
  311. package/src/observe/ios/ui-tree.ts +143 -0
  312. package/src/observe/ios.ts +18 -749
  313. package/src/observe/logs/model.ts +11 -0
  314. package/src/{network → observe/network}/index.ts +2 -2
  315. package/src/observe/readiness-service.ts +5 -3
  316. package/src/observe/readiness.ts +39 -18
  317. package/src/observe/screenshot-encoding.ts +32 -0
  318. package/src/observe/snapshot-collection.ts +69 -0
  319. package/src/observe/snapshot-logs.ts +26 -0
  320. package/src/observe/snapshot-metadata.ts +51 -31
  321. package/src/observe/snapshot-semantic.ts +153 -0
  322. package/src/observe/system-trace.ts +24 -15
  323. package/src/runtime/action-results.ts +376 -0
  324. package/src/runtime/clock.ts +9 -0
  325. package/src/server/common.ts +9 -359
  326. package/src/server/definitions/assert.ts +164 -0
  327. package/src/server/definitions/diagnostic.ts +120 -0
  328. package/src/server/definitions/input.ts +276 -0
  329. package/src/server/definitions/manage.ts +196 -0
  330. package/src/server/definitions/observe.ts +151 -0
  331. package/src/server/definitions/target.ts +140 -0
  332. package/src/server/definitions/wait.ts +107 -0
  333. package/src/server/handlers/action-execution.ts +164 -0
  334. package/src/server/handlers/correlation.ts +20 -0
  335. package/src/server/handlers/debugger-handlers.ts +39 -0
  336. package/src/server/handlers/debugger-response.ts +7 -0
  337. package/src/server/handlers/diagnostic.ts +79 -0
  338. package/src/server/handlers/handler-types.ts +7 -0
  339. package/src/server/handlers/input.ts +173 -0
  340. package/src/server/handlers/interact.ts +135 -0
  341. package/src/server/handlers/journey-assertions.ts +39 -0
  342. package/src/server/handlers/journey.ts +132 -0
  343. package/src/server/handlers/manage.ts +141 -0
  344. package/src/server/handlers/observe.ts +116 -0
  345. package/src/server/handlers/payload.ts +36 -0
  346. package/src/server/handlers/tool-handlers.ts +159 -0
  347. package/src/server/schemas/condition-schema.ts +2 -0
  348. package/src/server/{debugger-schema.ts → schemas/debugger-schema.ts} +13 -7
  349. package/src/server/{journey-schema.ts → schemas/journey-schema.ts} +7 -22
  350. package/src/server/{system-trace-schema.ts → schemas/system-trace-schema.ts} +3 -3
  351. package/src/server/tool-definitions.ts +67 -1143
  352. package/src/server-core.ts +2 -2
  353. package/src/server.ts +1 -1
  354. package/src/system/android-status.ts +124 -0
  355. package/src/system/android.ts +33 -21
  356. package/src/system/index.ts +21 -525
  357. package/src/system/ios-status.ts +147 -0
  358. package/src/system/ios.ts +14 -10
  359. package/src/system/model.ts +41 -0
  360. package/src/system/probes.ts +114 -0
  361. package/src/system/status-summary.ts +47 -0
  362. package/src/system/unsupported-status.ts +55 -0
  363. package/src/types.ts +16 -106
  364. package/src/utils/android/commands.ts +81 -0
  365. package/src/utils/android/gradle.ts +132 -0
  366. package/src/utils/android/logs.ts +103 -0
  367. package/src/utils/android/ui-tree.ts +239 -0
  368. package/src/utils/android/utils.ts +16 -556
  369. package/src/utils/cli/idb/check-idb.ts +4 -4
  370. package/src/utils/cli/idb/idb-helper.ts +6 -8
  371. package/src/utils/cli/idb/install-idb.ts +15 -9
  372. package/src/utils/cli/ios/preflight-ios.ts +39 -31
  373. package/src/utils/cli/ios/run-ios-ui-tree-tap.ts +4 -4
  374. package/src/utils/ios/utils.ts +57 -61
  375. package/src/utils/java.ts +62 -43
  376. package/src/utils/resolve-device.ts +9 -6
  377. package/src/utils/ui/index.ts +28 -28
  378. package/test/device/automated/debugger/coroutine-lifecycle.ts +27 -0
  379. package/test/device/automated/debugger/coroutine-support.ts +140 -0
  380. package/test/device/automated/debugger/coroutine.android.test.ts +169 -0
  381. package/test/device/automated/debugger/kotlin.android.test.ts +127 -0
  382. package/test/device/automated/debugger/runtime.android.test.ts +19 -3
  383. package/test/device/automated/interact/interaction.android.test.ts +56 -0
  384. package/test/device/automated/observe/system-trace.smoke.ts +1 -1
  385. package/test/device/manual/interact/modul8_selector_tap.manual.ts +1 -1
  386. package/test/fixtures/contracts/tool-definitions.json +3536 -0
  387. package/test/fixtures/coroutine-app/MainActivity.kt +100 -0
  388. package/test/fixtures/coroutine-app/README.md +48 -0
  389. package/test/fixtures/coroutine-app/build.ts +35 -0
  390. package/test/fixtures/debugger-app/MainActivity.java +21 -0
  391. package/test/fixtures/debugger-app/MainActivity.kt +32 -0
  392. package/test/fixtures/debugger-app/README.md +52 -0
  393. package/test/fixtures/debugger-app/build.ts +25 -15
  394. package/test/fixtures/latency-journey-app/README.md +2 -0
  395. package/test/fixtures/readiness-app/README.md +2 -0
  396. package/test/unit/debugger/coroutine-lifecycle.test.ts +43 -0
  397. package/test/unit/debugger/diagnostic-sessions.test.ts +67 -0
  398. package/test/unit/debugger/diagnostics.test.ts +80 -0
  399. package/test/unit/debugger/guards.test.ts +4 -0
  400. package/test/unit/debugger/preparation.test.ts +32 -0
  401. package/test/unit/debugger/protocol.test.ts +15 -0
  402. package/test/unit/debugger/sessions.test.ts +1 -1
  403. package/test/unit/interact/adjustment_service.test.ts +42 -0
  404. package/test/unit/interact/adjustment_verification.test.ts +35 -0
  405. package/test/unit/interact/clock_dependencies.test.ts +63 -0
  406. package/test/unit/interact/element_helpers.test.ts +19 -0
  407. package/test/unit/interact/legacy_wait_service.test.ts +17 -0
  408. package/test/unit/interact/state_comparison.test.ts +20 -0
  409. package/test/unit/interact/target_scope.test.ts +35 -0
  410. package/test/unit/network/get_network_activity.test.ts +1 -1
  411. package/test/unit/observe/screenshot-encoding.test.ts +30 -0
  412. package/test/unit/observe/snapshot-logs.test.ts +14 -0
  413. package/test/unit/quality/architecture.test.ts +60 -0
  414. package/test/unit/quality/code-quality.test.ts +58 -0
  415. package/test/unit/quality/interaction_boundaries.test.ts +24 -0
  416. package/test/unit/server/conditional_actions.test.ts +1 -1
  417. package/test/unit/server/conditional_schema.test.ts +2 -2
  418. package/test/unit/server/debugger-response.test.ts +63 -0
  419. package/test/unit/server/tool_definitions_parity.test.ts +8 -0
  420. package/dist/server/tool-handlers.js +0 -1000
  421. package/docs/ROADMAP.md +0 -646
  422. package/docs/benchmarks/ui-tree-performance/bridge-probe.json +0 -29
  423. package/docs/benchmarks/ui-tree-performance/initial-baseline.json +0 -59560
  424. package/docs/specs/baseline-spec-v0.md +0 -312
  425. package/docs/specs/mcp-tooling-spec-v1.md +0 -446
  426. package/src/server/debugger-handlers.ts +0 -29
  427. package/src/server/tool-handlers.ts +0 -1008
  428. /package/dist/{server/condition-schema.js → contracts/condition.js} +0 -0
  429. /package/dist/server/{readiness-schema.js → schemas/readiness-schema.js} +0 -0
  430. /package/dist/server/{system-trace-schema.js → schemas/system-trace-schema.js} +0 -0
  431. /package/src/{server/condition-schema.ts → contracts/condition.ts} +0 -0
  432. /package/src/server/{readiness-schema.ts → schemas/readiness-schema.ts} +0 -0
@@ -0,0 +1,154 @@
1
+ {
2
+ "date": "2026-10-30",
3
+ "scope": "ToolsInteract thin-facade continuation",
4
+ "status": "pass",
5
+ "class_budget": {
6
+ "class": "ToolsInteract",
7
+ "counted_lines": 189,
8
+ "maximum": 300,
9
+ "physical_file_lines": 267,
10
+ "legacy_exceptions": 0,
11
+ "refactored_interaction_modules_without_exceptions": 41
12
+ },
13
+ "maintainer": {
14
+ "command": "npm run verify",
15
+ "status": "pass",
16
+ "unit_files": 81,
17
+ "node": "v23.11.0"
18
+ },
19
+ "device": {
20
+ "command": "MCP_DEBUGGER_DEVICE=emulator-5554 npm run test:device",
21
+ "status": "pass",
22
+ "device_files": 10,
23
+ "records": [
24
+ {
25
+ "status": "PASS",
26
+ "build_sha256": "3a6b4e2f1e806c2d98968e63595dba9f5f23a1fe32a86943f208143c75fb8924",
27
+ "device": "emulator-5554",
28
+ "api": "36",
29
+ "runtime": "v23.11.0",
30
+ "transport": "MCP stdio",
31
+ "extended": false
32
+ },
33
+ {
34
+ "status": "PASS",
35
+ "server": {
36
+ "name": "mobile-debug-mcp",
37
+ "version": "0.34.0"
38
+ },
39
+ "device": "emulator-5554",
40
+ "api": "36",
41
+ "runtime": "v23.11.0",
42
+ "journey": "clickable wait, resolved-handle tap, visible assertion, selector journey and stable enabled-state assertion",
43
+ "evidence": "Result 43 and enabled=true established by fresh hierarchy assertions",
44
+ "cleanup": "Owned fixture removed in finally; no other app data or device settings changed"
45
+ },
46
+ {
47
+ "status": "PASS",
48
+ "server": {
49
+ "name": "mobile-debug-mcp",
50
+ "version": "0.34.0"
51
+ },
52
+ "platform": "android",
53
+ "device": "emulator-5554",
54
+ "osVersion": "16",
55
+ "startingApp": "com.android.settings",
56
+ "actionId": "11ac289e-7cad-4703-9244-a857de31999d",
57
+ "phases": {
58
+ "dispatchStarted": 1793385281935,
59
+ "dispatchCompleted": 1793385282207,
60
+ "screenshotStarted": 1793385282799,
61
+ "screenshotCompleted": 1793385283084
62
+ },
63
+ "screenshot": "captured",
64
+ "logs": "captured",
65
+ "uiTree": "captured",
66
+ "disabledComponents": "omitted",
67
+ "foreignReference": "unavailable",
68
+ "cleanup": "No settings, app data or streams changed; Settings remains foreground. No content artifacts saved."
69
+ },
70
+ {
71
+ "status": "PASS",
72
+ "server": {
73
+ "name": "mobile-debug-mcp",
74
+ "version": "0.34.0"
75
+ },
76
+ "platform": "ios",
77
+ "device": "F9243BAF-62A8-4990-8A99-17F527F56FDA",
78
+ "osVersion": "iOS 26.4",
79
+ "startingApp": "com.apple.Preferences",
80
+ "actionId": "d4c7ae0a-dda5-4606-a9bf-46356b9f378a",
81
+ "phases": {
82
+ "dispatchStarted": 1793385290788,
83
+ "dispatchCompleted": 1793385291152,
84
+ "screenshotStarted": 1793385291585,
85
+ "screenshotCompleted": 1793385292091
86
+ },
87
+ "screenshot": "captured",
88
+ "logs": "captured",
89
+ "uiTree": "captured",
90
+ "disabledComponents": "omitted",
91
+ "foreignReference": "unavailable",
92
+ "cleanup": "No settings, app data or streams changed; Settings remains foreground. No content artifacts saved."
93
+ },
94
+ {
95
+ "status": "PASS",
96
+ "build_sha256": "370254feb4bc933c650c00625e0ca2a1ec32567ea35190098710a16c50e9c4c5",
97
+ "runtime": "v23.11.0",
98
+ "server": {
99
+ "name": "mobile-debug-mcp",
100
+ "version": "0.34.0"
101
+ },
102
+ "device": "emulator-5554",
103
+ "osVersion": "16",
104
+ "starting_state": "System Settings fixture",
105
+ "journey": "start Settings, assert baseline Settings-owned resource visible in UI tree; explicit trace association",
106
+ "trace_id": "92d9e705-4655-4797-97c2-dbbbe0a89ab0",
107
+ "correlation_id": "f762ca72-67b8-4314-8af0-7a3f5c59c3fe",
108
+ "phases": {
109
+ "capture_started_at_ms": 1793385324309,
110
+ "capture_completed_at_ms": 1793385331115
111
+ },
112
+ "artifact_bytes": 1102735,
113
+ "content": {
114
+ "packets": 252,
115
+ "ftrace_bundles": 234,
116
+ "events": 24912,
117
+ "compact_sched_bundles": 234,
118
+ "validation": "local protobuf structure, trace config duration and timestamped ftrace/compact scheduler content; not full Perfetto analysis"
119
+ },
120
+ "durationContent": {
121
+ "packets": 47,
122
+ "ftrace_bundles": 31,
123
+ "events": 2790,
124
+ "compact_sched_bundles": 31,
125
+ "validation": "local protobuf structure, trace config duration and timestamped ftrace/compact scheduler content; not full Perfetto analysis"
126
+ },
127
+ "cancel": "PASS",
128
+ "expired_journey": "PASS",
129
+ "active_shutdown": "PASS",
130
+ "cleanup": "Device capture files removed; test host artifacts removed in finally. No settings or app data changed. Settings remains foreground."
131
+ }
132
+ ]
133
+ },
134
+ "contract": {
135
+ "status": "pass",
136
+ "tool_definitions": 52,
137
+ "comparison": "Complete pre-refactoring definition fixture, including schemas/defaults/descriptions/order"
138
+ },
139
+ "quality": {
140
+ "status": "pass",
141
+ "legacy_exceptions_remaining_elsewhere": 162,
142
+ "regression": "Refactored interaction modules must meet defaults even if a legacy allowance is added"
143
+ },
144
+ "package": {
145
+ "command": "npm pack --dry-run --json",
146
+ "status": "pass"
147
+ },
148
+ "unrun": [
149
+ "Hosted CI and local Node 18 runtime",
150
+ "Physical-device interaction journey",
151
+ "Interactive iOS navigation/state journey (iOS observation and correlation suite passed)",
152
+ "Native adjustable-control convergence fixture (unit and injected-strategy coverage passed)"
153
+ ]
154
+ }
@@ -0,0 +1,136 @@
1
+ {
2
+ "date": "2026-10-30",
3
+ "status": "verified checkpoint; full refactoring scope remains in progress",
4
+ "node": "v23.11.0",
5
+ "maintainer": {
6
+ "command": "npm run verify",
7
+ "status": "pass",
8
+ "unit_files": 78
9
+ },
10
+ "device_suite": {
11
+ "command": "MCP_DEBUGGER_DEVICE=emulator-5554 npm run test:device",
12
+ "status": "pass",
13
+ "records": [
14
+ {
15
+ "status": "PASS",
16
+ "build_sha256": "b43dc571fa4ad37bfa5a77af61425286d47cd4f0b738c3cb7e013d2c4cf01d9a",
17
+ "device": "emulator-5554",
18
+ "api": "36",
19
+ "runtime": "v23.11.0",
20
+ "transport": "MCP stdio",
21
+ "extended": false
22
+ },
23
+ {
24
+ "status": "PASS",
25
+ "server": {
26
+ "name": "mobile-debug-mcp",
27
+ "version": "0.34.0"
28
+ },
29
+ "platform": "android",
30
+ "device": "emulator-5554",
31
+ "osVersion": "16",
32
+ "startingApp": "com.android.settings",
33
+ "actionId": "77b18501-7594-4ff7-ab67-53c8a91b75e4",
34
+ "phases": {
35
+ "dispatchStarted": 1793379545096,
36
+ "dispatchCompleted": 1793379545495,
37
+ "screenshotStarted": 1793379545858,
38
+ "screenshotCompleted": 1793379546511
39
+ },
40
+ "screenshot": "captured",
41
+ "logs": "captured",
42
+ "uiTree": "captured",
43
+ "disabledComponents": "omitted",
44
+ "foreignReference": "unavailable",
45
+ "cleanup": "No settings, app data or streams changed; Settings remains foreground. No content artifacts saved."
46
+ },
47
+ {
48
+ "status": "PASS",
49
+ "server": {
50
+ "name": "mobile-debug-mcp",
51
+ "version": "0.34.0"
52
+ },
53
+ "platform": "ios",
54
+ "device": "F9243BAF-62A8-4990-8A99-17F527F56FDA",
55
+ "osVersion": "iOS 26.4",
56
+ "startingApp": "com.apple.Preferences",
57
+ "actionId": "75efedc5-eb5c-45e3-8b4e-5c1e5dcb6d6d",
58
+ "phases": {
59
+ "dispatchStarted": 1793379554471,
60
+ "dispatchCompleted": 1793379554924,
61
+ "screenshotStarted": 1793379555463,
62
+ "screenshotCompleted": 1793379555970
63
+ },
64
+ "screenshot": "captured",
65
+ "logs": "captured",
66
+ "uiTree": "captured",
67
+ "disabledComponents": "omitted",
68
+ "foreignReference": "unavailable",
69
+ "cleanup": "No settings, app data or streams changed; Settings remains foreground. No content artifacts saved."
70
+ },
71
+ {
72
+ "status": "PASS",
73
+ "build_sha256": "370254feb4bc933c650c00625e0ca2a1ec32567ea35190098710a16c50e9c4c5",
74
+ "runtime": "v23.11.0",
75
+ "server": {
76
+ "name": "mobile-debug-mcp",
77
+ "version": "0.34.0"
78
+ },
79
+ "device": "emulator-5554",
80
+ "osVersion": "16",
81
+ "starting_state": "System Settings fixture",
82
+ "journey": "start Settings, assert baseline Settings-owned resource visible in UI tree; explicit trace association",
83
+ "trace_id": "69cec918-2d8c-4241-8192-1e15d937300d",
84
+ "correlation_id": "e096888b-fd9d-4385-bcbc-acefc56f717a",
85
+ "phases": {
86
+ "capture_started_at_ms": 1793379585269,
87
+ "capture_completed_at_ms": 1793379591151
88
+ },
89
+ "artifact_bytes": 1103332,
90
+ "content": {
91
+ "packets": 240,
92
+ "ftrace_bundles": 223,
93
+ "events": 25402,
94
+ "compact_sched_bundles": 223,
95
+ "validation": "local protobuf structure, trace config duration and timestamped ftrace/compact scheduler content; not full Perfetto analysis"
96
+ },
97
+ "durationContent": {
98
+ "packets": 55,
99
+ "ftrace_bundles": 39,
100
+ "events": 2884,
101
+ "compact_sched_bundles": 39,
102
+ "validation": "local protobuf structure, trace config duration and timestamped ftrace/compact scheduler content; not full Perfetto analysis"
103
+ },
104
+ "cancel": "PASS",
105
+ "expired_journey": "PASS",
106
+ "active_shutdown": "PASS",
107
+ "cleanup": "Device capture files removed; test host artifacts removed in finally. No settings or app data changed. Settings remains foreground."
108
+ }
109
+ ]
110
+ },
111
+ "java_compile": {
112
+ "status": "pass",
113
+ "command": "javac --release 17 --add-modules jdk.jdi",
114
+ "host_java_major": 23
115
+ },
116
+ "package": {
117
+ "status": "pass",
118
+ "command": "npm pack --dry-run --json",
119
+ "required_files": [
120
+ "src/debugger/java/DebuggerWorker.java",
121
+ "dist/debugger/worker.js",
122
+ "dist/debugger/protocol.js",
123
+ "dist/runtime/action-results.js",
124
+ "dist/server/definitions/input.js",
125
+ "dist/server/debugger-schema.js"
126
+ ]
127
+ },
128
+ "unrun": [
129
+ "Node 18 locally; existing CI job retains Node 18",
130
+ "Hosted CI",
131
+ "Android physical-device debugger journey",
132
+ "Real-device adjustable-control journey (no adjustable-control fixture in the current device suite)",
133
+ "Extended 60-second debugger expiry run",
134
+ "JDK 17 runtime execution (Java 17 release compilation passed)"
135
+ ]
136
+ }
@@ -0,0 +1,43 @@
1
+ # Intent: debugger failure diagnostics
2
+
3
+ [Documentation](../../README.md) · [Development process](../process.md)
4
+
5
+ Originator: repository maintainer through GitHub issue #81.
6
+ Date: 2026-11-02. Status: approved.
7
+ Source: [issue #81](https://github.com/clivejefferies/mobile-debug-tools/issues/81),
8
+ current roadmap priority 1 of 13; maintainer request to pick up the next ticket.
9
+
10
+ ## Problem and outcome
11
+
12
+ Intermittent `DEBUGGER_WORKER_FAILED` responses do not give MCP clients enough
13
+ evidence to distinguish worker startup, compilation, IPC/protocol, JDI attach,
14
+ and transport failures. Issue #80 did not reproduce on retest; this work improves
15
+ diagnosis without claiming to fix its unknown cause.
16
+
17
+ Give Android debugger clients bounded, sanitized failure classification and
18
+ actionable recovery guidance. Identify the stage and safe reason only where
19
+ evidence supports them, retaining explicit uncertainty otherwise.
20
+
21
+ ## Scope and success criteria
22
+
23
+ Preserve existing error codes, successful operations, session ownership and
24
+ cleanup. Specify compatible additive diagnostics before implementation. Never
25
+ expose raw stderr, environment secrets, app locals or unbounded exception text
26
+ in MCP responses or logs.
27
+
28
+ Verify startup/process failure, malformed IPC, attach failure and
29
+ timeout/cancellation with deterministic regression checks and cleanup assertions.
30
+ Retain a verified Android attach/inspect/detach journey and document diagnostic
31
+ fields and limitations. Report unavailable device coverage explicitly.
32
+
33
+ ## Boundaries and open decisions
34
+
35
+ No compact-response redesign, arbitrary evaluation, new debugging capability,
36
+ or implementation of iOS debugging. Keep the design reusable for later iOS work
37
+ without promising platform parity. The specification will settle diagnostic
38
+ fields, classification evidence, bounded output and recovery guidance.
39
+
40
+ ## Approval
41
+
42
+ The maintainer approved the captured intent and scope with “looks good” in this
43
+ chat on 2026-11-02. Specification acceptance remains a separate gate.
@@ -0,0 +1,86 @@
1
+ # Plan: debugger failure diagnostics
2
+
3
+ [Intent](intent.md) · [Accepted specification](spec.md)
4
+
5
+ Intent approved with “looks good”; specification accepted with “ok” in this chat
6
+ on 2026-11-02. No publication, commit or push requested.
7
+
8
+ ## Implementation
9
+
10
+ - [x] Add a bounded static diagnostic catalog and typed error propagation.
11
+ - [x] Classify preparation, subprocess, IPC and Java attach/transport failures.
12
+ - [x] Preserve diagnostics through sessions, cleanup, capabilities and MCP wrapping.
13
+ - [x] Add isolated worker/protocol/privacy and lifecycle regression coverage.
14
+ - [x] Align tool docs, changelog and packaged usage skill.
15
+
16
+ ## Verification
17
+
18
+ Node >=22, JDK >=17; Android fixture additionally needs SDK/build-tools 36.
19
+
20
+ | Criteria | Check |
21
+ | --- | --- |
22
+ | 1, 2, 4 | Focused self-running diagnostic, protocol and MCP tests with hostile input and fake workers |
23
+ | 3 | Session tests: timeout/cancellation, event race, cleanup retry, isolation, shutdown |
24
+ | 1–4 | `npm run verify` (lint/quality/architecture, build, all units, plugin consistency) |
25
+ | 5 | `npm run test:device`; then `MCP_DEBUGGER_DEVICE=<serial> npx tsx test/device/automated/debugger/runtime.android.test.ts` |
26
+ | 6 | Docs diff, local links and `npm run check:agent-plugin` |
27
+
28
+ Device journey: explicitly selected authorized Android target; install the isolated
29
+ fixture, attach, set/trigger breakpoint, inspect known stack/locals, step/resume,
30
+ assert Result 43 in a fresh UI tree, detach and compare forwards. Existing runner
31
+ records server fingerprint/device/API and removes its package/temp data in finally.
32
+ Do not use a user app as a failure fixture. Physical Android and iOS evidence remain
33
+ separate. Fault injection uses isolated fake workers, never a production app.
34
+
35
+ Initial ADB discovery was blocked by sandbox binding restrictions. Retry discovery
36
+ with execution access; if no authorized target is available, record the concrete
37
+ blocker and leave live verification incomplete. Hosted CI is separate from local
38
+ checks. No dependency or release version changes are planned.
39
+
40
+ ## Results
41
+
42
+ Implemented and locally verified on 2026-11-02. All checks below passed unless
43
+ explicitly marked unrun.
44
+
45
+ | Check | Outcome and evidence |
46
+ | --- | --- |
47
+ | `npm run verify` with Node 22.23.4 | **Pass**: ESLint, structural gates (no exceptions), architecture, TypeScript build, all 88 unit files, plugin consistency. Log: `/tmp/mobile-debug-81-verified.log`. |
48
+ | Three new debugger unit files | **Pass**: isolated real fake-worker spawn/exit/write errors, malformed/oversized IPC, attach refusal, timeout/cancellation, static catalog bounds, hostile error/diagnostic fields, fake-JDK prerequisite/compile failures, MCP wrapping, terminal retention, event/rejection race, device isolation, cleanup retry and shutdown. |
49
+ | `MCP_DEBUGGER_DEVICE=emulator-5554 npm run test:device` with Node 22.23.4 | **Pass**, 10 files. Includes Android debugger/interaction, Android+iOS screenshots/logs/UI trees/correlated evidence, and Android system traces. Log: `/tmp/mobile-debug-81-final-device.log`. |
50
+ | Final focused debugger fixture, Node 22.23.4 | **Pass**, MCP stdio, emulator-5554, Android 16/API 36. Exact final build SHA-256: `9528d796df4e01ca9d7668c32715a7ceff945a06a2f097fe4d57f16705f52eb3`. Log: `/tmp/mobile-debug-81-fixture-final.log`. |
51
+ | Actual Java JDI refusal check | **Pass**, Android Studio JBR OpenJDK 25.0.3; compiled worker contacted an explicitly closed temporary loopback port. Existing `DEBUGGER_WORKER_FAILED` retained, diagnostic `attach/connection_refused`; worker closed in finally. No app or device targeted. |
52
+ | Documentation | **Pass**: diff whitespace, relative links/paths, schema/recovery limits and packaged usage skill consistency. |
53
+
54
+ The final focused fixture started by installing/launching only the isolated debug
55
+ app. It verified a source breakpoint and stop, stack method, known local `42`,
56
+ bounded string/object summaries, pause guards, into/over/out stepping, stale
57
+ references, resume established by fresh UI-tree `Result 43`, missing variable
58
+ metadata, pending/removed breakpoints, event cancellation, repeated detach,
59
+ process loss and active paused-server shutdown. Exact owned forwards were removed;
60
+ unrelated forwards were preserved. Fresh UI evidence established execution after
61
+ shutdown, and the fixture package/temp data were removed in finally. The broader
62
+ suite leaves system Settings foreground and removes its own trace artifacts.
63
+
64
+ The broad device run preceded the last host-only pipe-failure consolidation and
65
+ terminal-command/cancellation diagnostic refinements; the full maintainer command
66
+ and focused Android fixture were rerun against the final code. Broader unaffected
67
+ observation/trace checks were not repeated. Preliminary Node 23 checks also passed;
68
+ final maintainer and focused debugger results above use Node 22.
69
+
70
+ ## Focused review and limitations
71
+
72
+ Reviewed worker/Java protocol, error serialization, budget/cancellation paths,
73
+ capability probe compatibility, per-device ownership and cleanup races. Retained
74
+ legacy error codes (including generic prerequisite startup failures), fixed
75
+ phase attribution across attach deadlines, routed synchronous/asynchronous pipe
76
+ failures through one pending-request settlement path, and retained terminal
77
+ failure diagnostics on later rejected commands. No raw worker/compiler output
78
+ enters the new diagnostic fields. Public tool-definition parity passed.
79
+
80
+ Physical-device debugger coverage, real 60-second pause expiry in this run,
81
+ JDK 17 compilation/runtime and hosted CI are **unrun**. iOS observation smoke
82
+ coverage does not establish iOS debugger support. The earlier sandbox ADB/tsx
83
+ socket blockers were resolved with execution access. This implementation does
84
+ not establish the unknown cause of issue #80. Changes remain local, uncommitted,
85
+ unpushed and unpublished; the GitHub ticket has not been closed.
86
+
@@ -0,0 +1,133 @@
1
+ # Specification: debugger failure diagnostics
2
+
3
+ [Intent](intent.md) · [Development process](../process.md)
4
+
5
+ Date: 2026-11-02. Status: accepted by the maintainer with “ok” in this chat on 2026-11-02.
6
+ Intent approved by the maintainer with “looks good” in this chat on 2026-11-02.
7
+ Source: [issue #81](https://github.com/clivejefferies/mobile-debug-tools/issues/81).
8
+
9
+ ## Outcome and scope
10
+
11
+ Existing Android debugger tools will explain failed operations using bounded,
12
+ sanitized evidence. Diagnostics distinguish the operation stage from its known
13
+ failure reason; they do not claim to determine the cause of issue #80.
14
+
15
+ All eleven debugger tool names, input schemas, defaults, deadlines, error codes,
16
+ `error.message`, `error.retryable`, MCP `isError` behavior, and successful debug
17
+ payloads remain compatible. No opt-in argument is needed. iOS remains unsupported;
18
+ these diagnostic concepts may be reused by a future backend. Compact responses,
19
+ new debugging capabilities and automatic retries are excluded.
20
+
21
+ ## Additive response contract
22
+
23
+ A debugger failure carries `error.diagnostic` with exactly these fields:
24
+
25
+ | Field | Values and meaning |
26
+ | --- | --- |
27
+ | `stage` | `prerequisite`, `compilation`, `worker_start`, `ipc`, `target_resolution`, `forwarding`, `attach`, `command`, `transport`, `cleanup`, `unknown` |
28
+ | `reason` | `unavailable`, `unsupported`, `spawn_failed`, `process_exited`, `invalid_message`, `message_limit`, `write_failed`, `connection_refused`, `transport_lost`, `timeout`, `cancelled`, `operation_failed`, `unknown` |
29
+ | `recovery` | Fixed guidance from the stage/reason catalog, at most 240 ASCII characters |
30
+
31
+ No additional free-text details, paths, command arguments, identifiers, exception
32
+ classes, stderr excerpts or numeric process metadata enter this object. Its
33
+ serialized UTF-8 size must not exceed 512 bytes. Existing targeting fields remain
34
+ the source of device/process identity. Unknown evidence produces `unknown`, not
35
+ a guessed cause. Ordinary argument, stale-reference and pause/state validation
36
+ errors need not gain diagnostics.
37
+
38
+ `get_debugger_capabilities` retains its successful probe envelope, `supported`
39
+ and `reasons`. When probes fail, an optional top-level `diagnostics` array contains
40
+ at most two diagnostic objects in JDK-then-target probe order. It is absent when
41
+ both probes succeed. It does not turn an unsupported probe into an MCP error.
42
+
43
+ Failed attach and command responses, thrown errors handled by the MCP wrapper,
44
+ and terminal `get_debugger_state` failures preserve the applicable diagnostic.
45
+ Asynchronous worker failure/disconnection retains one diagnostic in the owning
46
+ session until normal terminal-summary pruning. Diagnostic state is separate from
47
+ inspection data, which cleanup continues to clear. Event polling retains existing
48
+ cursor, overflow and event semantics; no new event type is introduced.
49
+
50
+ ## Classification and uncertainty
51
+
52
+ Classification uses host operation context, structured child-process error codes,
53
+ validated worker fields and known Java exception types. Raw message matching is
54
+ not a diagnostic source. The Java bridge supplies only allowlisted diagnostic
55
+ values; the TypeScript boundary validates and reconstructs them, dropping unknown
56
+ fields. Malformed diagnostic values are a protocol failure, without echoing input.
57
+
58
+ JDK discovery/version checks use `prerequisite`; source/cache preparation and
59
+ `javac` use `compilation`; spawn errors use `worker_start/spawn_failed`.
60
+ Unexpected child exit uses `worker_start/process_exited` before the first valid
61
+ worker reply, otherwise `ipc/process_exited`; this is a phase convention, not
62
+ proof that startup succeeded or failed. Malformed/oversized IPC and stdin write
63
+ errors use `ipc` with the corresponding fixed reason. JDI attach refusal uses
64
+ `attach/connection_refused` only with an explicit connection-refused exception;
65
+ other attach exceptions use `attach/operation_failed`. Structured transport loss
66
+ uses `transport/transport_lost`; unclassified exceptions use the known stage and
67
+ `unknown`. Target discovery and ADB forwarding retain distinct stages.
68
+
69
+ Timeout/cancellation keeps the stage active when observed and uses `timeout` or
70
+ `cancelled`; it does not imply that the command was never dispatched. An operation
71
+ that never started may use `unknown`. Preserve the first causal failure across
72
+ the worker-event/rejected-request race. Cleanup must not replace it with a
73
+ secondary EOF or exit failure. If the existing error code reports cleanup failure,
74
+ its diagnostic is `cleanup/operation_failed`; original session reason and
75
+ `cleanup.remaining_resources` remain available under their existing contracts.
76
+
77
+ ## Recovery, ownership and privacy
78
+
79
+ Guidance is a static catalog: check JDK 17+/javac for prerequisites; check the
80
+ compiler/toolchain for compilation; check worker launch availability for startup;
81
+ inspect session state and detach before a fresh attach for IPC/transport failure;
82
+ check the explicit running debuggable target and debugger contention for attach.
83
+ Timeout/cancellation guidance states that execution may be uncertain and requires
84
+ state/cleanup inspection before another state-changing command. Cleanup guidance
85
+ requests retrying `detach_debugger` and checking remaining resources. Unknown
86
+ failures direct clients to session state and cleanup without claiming a cause.
87
+
88
+ Existing per-device ownership, four-session limit, serialization, pause guards,
89
+ reference invalidation, independent cleanup budget, expiry and shutdown rules
90
+ remain unchanged. Never kill the target app/ADB server, remove unrelated forwards,
91
+ retry attach/step/resume automatically, or claim resumed execution after loss.
92
+ Retain bounded subprocess/IPC handling and drain stderr without retaining it.
93
+ No new logging, persistence, telemetry, UI capture or collection of app values.
94
+
95
+ ## Acceptance and verification
96
+
97
+ 1. Deterministic checks distinguish prerequisite/compile/startup, malformed and
98
+ oversized IPC, write/exit, attach and transport failures without changing codes.
99
+ 2. Unknown exceptions and hostile protocol/error text cannot expose secrets,
100
+ locals, paths or raw output in diagnostics, responses or new logging.
101
+ 3. Timeout/cancellation preserve deadlines and session policy; races, concurrent
102
+ sessions, cleanup failure/retry and shutdown preserve owned resources and the
103
+ appropriate diagnostic. Terminal summaries retain sanitized failure evidence.
104
+ 4. MCP serialization and capability probes satisfy the additive contract and
105
+ bounds; successful payloads and validation/reference errors remain compatible.
106
+ 5. Run `npm run verify`, `npm run test:device`, and the explicitly selected Android
107
+ fixture journey against the updated server: attach, breakpoint, stop, stack,
108
+ known locals, step/resume, detach and forward-ownership checks. Record server
109
+ fingerprint and target; distinguish emulator from physical-device evidence.
110
+ 6. Update tool documentation, changelog and usage skill with fields, recovery,
111
+ uncertainty and platform limits; keep packaged skill copies consistent.
112
+
113
+ Current investigation inspected worker, Java bridge, protocol, sessions, MCP
114
+ handler, tool docs and existing unit/device fixtures at checkout
115
+ `803409a7a784669b68844e8af5b21cd822ffd599`. ADB 37.0.1 is installed, but the
116
+ sandbox prevented its daemon from binding port 5037 (`Operation not permitted`).
117
+ No live device baseline or new behavior is verified. Implementation verification
118
+ must retry device discovery with appropriate execution access; unavailable device
119
+ coverage must be reported as blocked, with the fixture command documented.
120
+
121
+ ## Affected areas, risks and approval
122
+
123
+ Changes are expected in `src/debugger/{worker,protocol,sessions,android}.ts`,
124
+ `src/debugger/java/DebuggerWorker.java`, the debugger MCP handler, focused tests,
125
+ tool documentation and usage skill. Reuse existing typed error/budget machinery;
126
+ extract cohesive diagnostic helpers where structural limits require it. Main
127
+ risks are losing diagnostics during wrapping, race-dependent attribution and
128
+ accidental private-data propagation. Boundary and lifecycle checks address them.
129
+
130
+ Accepted decisions: always-additive failure diagnostics,
131
+ the fixed schema/catalog above, capability-probe diagnostics, and sanitized
132
+ terminal-session retention. The maintainer accepted this complete specification with “ok” on 2026-11-02;
133
+ implementation is authorized within this scope.
@@ -0,0 +1,41 @@
1
+ # Intent: compact debugger responses
2
+
3
+ [Documentation](../../README.md) · [Development process](../process.md)
4
+
5
+ Originator: repository maintainer through GitHub issue #82.
6
+ Date: 2026-11-02. Status: approved.
7
+ Source: [issue #82](https://github.com/clivejefferies/mobile-debug-tools/issues/82),
8
+ priority 2 of 13, and the maintainer's request to pick up the next ticket.
9
+ GitHub Projects status could not be verified: the available token lacks
10
+ `read:project`. Selection follows the issue's published priority order.
11
+
12
+ ## Problem and outcome
13
+
14
+ Debugger responses repeat target, capability and session metadata during long
15
+ investigations. Provide an opt-in compact mode for existing debugger tools so
16
+ MCP clients receive less repeated data while retaining everything required to
17
+ understand the result and safely continue debugging.
18
+
19
+ ## Scope and success criteria
20
+
21
+ Preserve existing default responses and client compatibility. Compact responses
22
+ must retain operation results, continuation identifiers, execution state, errors,
23
+ uncertainty, truncation and unresolved cleanup. Keep actionable diagnostics from
24
+ issue #81 available in either mode; retain full responses on request.
25
+
26
+ Compare serialized output for the same attach → breakpoint → stop → stack →
27
+ locals → step → resume → detach journey, reporting measured savings without
28
+ inventing a reduction target. Verify success, failure, stale references and
29
+ incomplete cleanup, and document when clients need full responses.
30
+
31
+ ## Boundaries and open decisions
32
+
33
+ Scope is response presentation for current debugger tools. Other tools, new
34
+ debugging capabilities, session lifecycle changes and iOS debugger implementation
35
+ are excluded. The specification will settle mode naming in line with existing
36
+ `compact`/`debug` conventions, tool coverage and exact field retention.
37
+
38
+ ## Approval
39
+
40
+ The maintainer approved this intent with “yes” in this chat on 2026-11-02.
41
+ Specification acceptance remains a separate gate.