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
@@ -1,8 +1,10 @@
1
1
  # Plan: conditional actions
2
2
 
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Intent](intent.md) · [Specification](spec.md)
4
+
3
5
  Date: 2026-10-29. Status: complete — implementation and required verification passed.
4
6
  Intent: [intent.md](intent.md). Specification: [spec.md](spec.md).
5
- Both approved by the originator's separate “yes” replies in this conversation;
7
+ Both approved by the originator's separate “yes” replies during design review;
6
8
  the latest approval authorises implementation of spec 020.
7
9
 
8
10
  ## Implementation sequence
@@ -98,18 +100,16 @@ minimum is >=18; CI's Node 18 run has not been executed locally).
98
100
  All elements contribute to revision checks beyond the bounded delta history.
99
101
  - `npm run sync:agent-plugin`: PASS; no generated manifest differences.
100
102
  - Final `npm run verify`: PASS (lint, build, 59 unit-test files, plugin consistency).
101
- Log: `/tmp/mobile-debug-conditional-verify-final.log`.
102
103
  - Initial `npm run test:device`: FAIL at iOS UI-tree smoke (`Invalid UI tree resolution`) while the original simulator was booting.
103
104
  Android screenshot/log/tree wrappers passed. iOS screenshot wrapper passed;
104
105
  the iOS log wrapper also reported pass but its underlying log retrieval printed
105
106
  `getpwuid_r` / unavailable log-store errors, so this is not evidence of usable
106
107
  iOS logs. These wrappers use automatic device selection; focused tests below
107
- pin their simulator explicitly. Full log: `/tmp/mobile-debug-conditional-device-suite.log`.
108
+ pin their simulator explicitly.
108
109
 
109
110
  - Final `npm run test:device`: PASS after the replacement iPhone 17 Pro finished
110
111
  booting. All six Android/iOS screenshot, log, and tree smoke wrappers passed,
111
- without the earlier iOS log-store diagnostics. Log:
112
- `/tmp/mobile-debug-conditional-device-suite-final.log`.
112
+ without the earlier iOS log-store diagnostics.
113
113
  - Final documentation relative-link checks and `git diff --check`: PASS.
114
114
  - Final lint after the device helper's selector/start-state correction: PASS.
115
115
 
@@ -138,7 +138,7 @@ Starting state: system Settings root, with Network & internet visible.
138
138
  | Journey stop, compact | Successful wait for Internet, conditional back tap with root expectation, later tap | Earlier wait passed, guarded step failed with fresh tree, later step `not_run`; destination remained | PASS |
139
139
  | Journey stop, debug | Same sequence in debug mode | Same stop and preserved evidence | PASS |
140
140
 
141
- Full structured evidence: `/tmp/mobile-debug-conditional-android.json`.
141
+ The temporary raw output was not retained in the repository; results are summarised here.
142
142
  The five scenarios were rerun successfully against the final built server after
143
143
  the compact-error and metadata-validity fixes and the helper selector correction.
144
144
  The helper is reproducible and requires a deliberately prepared safe system
@@ -175,7 +175,7 @@ Starting state: Settings root with General visible, About absent.
175
175
  | Journey stop, compact | Successful wait for About, stale conditional tap on `resource_id: BackButton`, later back tap | Wait passed; condition failed; later step `not_run`; General remained visible | PASS |
176
176
  | Journey stop, debug | Same sequence in debug mode | Same stop and fresh condition evidence | PASS |
177
177
 
178
- Structured evidence: `/tmp/mobile-debug-conditional-ios.json`.
178
+ The temporary raw output was not retained in the repository; results are summarised here.
179
179
  An initial helper attempt selected the application container sharing the Settings
180
180
  label and correctly stopped with `ELEMENT_NOT_INTERACTABLE` / `not_checked`;
181
181
  this was not counted as a conditional-journey pass. The helper now prefers the
@@ -210,5 +210,4 @@ Limits: live simulator checks cover conditional taps and journey stops; conditio
210
210
  swipes and Android typing/back use production-adapter tests with fake native
211
211
  tools. Physical devices were not used for mutation checks. UI normalization, the observation-to-OS-input race, and concurrent external
212
212
  input remain explicit spec limits. No mutation testing was performed. No tests
213
- or validation rules were weakened. Existing uncommitted process/skill relocation
214
- work was preserved. No package was published and nothing was committed/pushed.
213
+ or validation rules were weakened. No published-package verification was performed.
@@ -1,8 +1,10 @@
1
1
  # Spec 020: conditional actions
2
2
 
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Intent](intent.md) · [Plan and verification](plan.md)
4
+
3
5
  Date: 2026-10-29.
4
6
  Status: approved — implementation authorised.
5
- Intent: [intent.md](intent.md), approved in the current conversation by the
7
+ Intent: [intent.md](intent.md), approved during design review by the
6
8
  originator's “yes” in response to the captured intent.
7
9
 
8
10
  ## Outcome
@@ -296,6 +298,6 @@ separately. Record exact test routes and cleanup in the implementation plan.
296
298
 
297
299
  ## Approval
298
300
 
299
- Approved by the originator on 2026-10-29 in the current conversation: “yes”,
301
+ Approved by the originator on 2026-10-29 during design review: “yes”,
300
302
  in direct response to the linked complete spec and the listed first-version
301
303
  scope. Implementation is authorised within that scope.
@@ -1,6 +1,8 @@
1
1
  # Intent: app readiness signals
2
2
 
3
- Originator: repository maintainer (current conversation).
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Specification](spec.md) · [Plan and verification](plan.md)
4
+
5
+ Originator: repository maintainer (design review).
4
6
  Date: 2026-10-29. Status: approved.
5
7
  Source: [GitHub issue #65: App readiness signals](https://github.com/clivejefferies/mobile-debug-tools/issues/65), roadmap priority 2 of 9.
6
8
 
@@ -37,4 +39,4 @@ unsupported signals, API placement, and how long observations remain current.
37
39
  ## Approval
38
40
 
39
41
  Approved on 2026-10-29 by the originator’s “yes” in direct response to the
40
- complete intent summary and linked artifact in this conversation.
42
+ complete intent summary and linked artifact during design review.
@@ -1,8 +1,10 @@
1
1
  # Plan: app readiness signals
2
2
 
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Intent](intent.md) · [Specification](spec.md)
4
+
3
5
  Date: 2026-10-29. Status: complete — implementation and required verification passed.
4
- [Intent](intent.md) and [spec](spec.md) separately approved in this conversation;
5
- “yep” authorises implementation of spec 021. Preserve existing uncommitted work.
6
+ [Intent](intent.md) and [spec](spec.md) separately approved during design review;
7
+ “yep” authorises implementation of spec 021.
6
8
 
7
9
  ## Implementation
8
10
 
@@ -47,8 +49,8 @@ Node v23.11.0. This is local evidence, not a published package or Node 18 CI run
47
49
  | --- | --- |
48
50
  | Classifier, schemas, opt-in waits | PASS: state precedence, monotonic stability, invalid/error continuity, no extra predicate reads, explicit unsupported states, timeout uncertainty |
49
51
  | Production Android/iOS observation adapters with fake binaries | PASS: two-sample stability, native loaders, timeout child closure, and killing a hung iOS metadata probe; simulated error evidence |
50
- | Maintainer checks | PASS: final `npm run verify` (lint, build, 62 unit-test files, plugin consistency); `/tmp/mobile-readiness-verify-complete.log` |
51
- | Existing `npm run test:device` | PASS: all six Android/iOS screenshot, log, and tree smoke wrappers; `/tmp/mobile-readiness-device-suite.log` |
52
+ | Maintainer checks | PASS: final `npm run verify` (lint, build, 62 unit-test files, plugin consistency) |
53
+ | Existing `npm run test:device` | PASS: all six Android/iOS screenshot, log, and tree smoke wrappers |
52
54
  | Native fixture journeys through built MCP stdio | PASS: six on each simulator; evidence linked below |
53
55
 
54
56
  Focused device commands (each builds, installs, and uninstalls its own offline
@@ -78,8 +80,7 @@ starts a 12-second loader while Ready stays visible; completion displays Done.
78
80
  All twelve device scenarios passed. Both fixture apps were uninstalled, build
79
81
  folders removed, Android’s original foreground app restored, and iOS returned
80
82
  to Home. No settings, permissions, accounts, or production app data were changed.
81
- Structured evidence: `/tmp/mobile-readiness-android.json` and
82
- `/tmp/mobile-readiness-ios.json`.
83
+ Temporary raw outputs were not retained in the repository; results are summarised here.
83
84
 
84
85
  Review covered classification/normalization, schema parity, serialization,
85
86
  request-local state, ancestor budgets, native acquisition and cleanup, existing
@@ -1,8 +1,10 @@
1
1
  # Spec 021: app readiness signals
2
2
 
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Intent](intent.md) · [Plan and verification](plan.md)
4
+
3
5
  Date: 2026-10-29. Status: approved — implementation authorised.
4
6
  Source: [issue #65](https://github.com/clivejefferies/mobile-debug-tools/issues/65).
5
- [Intent](intent.md) approved by the originator’s “yes” in this conversation.
7
+ [Intent](intent.md) approved by the originator’s “yes” during design review.
6
8
 
7
9
  ## Behaviour and scope
8
10
 
@@ -1,6 +1,8 @@
1
1
  # Intent: correlated evidence
2
2
 
3
- Originator: repository maintainer (current conversation).
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Specification](spec.md) · [Plan and verification](plan.md)
4
+
5
+ Originator: repository maintainer (design review).
4
6
  Date: 2026-10-29. Status: approved.
5
7
  Source: [issue #66](https://github.com/clivejefferies/mobile-debug-tools/issues/66), roadmap priority 3 of 9.
6
8
 
@@ -32,6 +34,4 @@ handling, building on existing helpers.
32
34
 
33
35
  ## Approval
34
36
 
35
- The maintainer’s “yes” on 2026-10-29 approved the complete linked intent in this
36
- conversation. This shorter version preserves that scope; specification approval
37
- remains pending.
37
+ The maintainer’s “yes” on 2026-10-29 approved the complete linked intent during design review. See the linked specification for its separate approval record.
@@ -1,7 +1,9 @@
1
1
  # Plan: correlated evidence
2
2
 
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Intent](intent.md) · [Specification](spec.md)
4
+
3
5
  Authorisation: [intent](intent.md), then [spec](spec.md), explicitly approved by
4
- “yes” and “approve” respectively in this conversation on 2026-10-29.
6
+ “yes” and “approve” respectively during design review on 2026-10-29.
5
7
 
6
8
  ## Implementation
7
9
 
@@ -42,8 +44,8 @@ Use fresh device discovery. Exercise disabled/partial snapshot and invalid
42
44
  reference without changing app data. Record pass/fail/blocked/unrun plus metadata
43
45
  in this directory; avoid saving screenshot/log contents. Restore changed settings,
44
46
  stop only owned streams, and remove temporary test data. No settings change is
45
- needed. Android log healthcheck was degraded: targeted read is the next check;
46
- if unavailable, record its concrete error and verify metadata failure behaviour.
47
+ needed. The initial Android log healthcheck was degraded; the targeted read
48
+ subsequently passed, as recorded below.
47
49
  iOS physical-device coverage is outside existing simulator support.
48
50
 
49
51
  ## Results
@@ -77,10 +79,8 @@ contains no capture content; later Modul8 testing below records selector limits.
77
79
  - Physical-device correlation, installed/published-package verification: **unrun**.
78
80
  No release or deployment was requested.
79
81
 
80
- Validation logs for this local run: `/tmp/mobile-debug-correlated-verify.log` and
81
- `/tmp/mobile-debug-correlated-device.log`. The `tsx` CLI requires local IPC blocked
82
- by the sandbox; required npm checks ran with approved escalation. Focused checks
83
- also passed via `node --import tsx` without that socket.
82
+ Required npm checks passed with local IPC enabled. Focused checks also passed
83
+ via `node --import tsx`.
84
84
 
85
85
  ## Modul8 follow-up verification — 2026-10-30
86
86
 
@@ -146,8 +146,7 @@ conditional dispatch guards intact. Preserve unrelated correlated-evidence work.
146
146
  Modul8 and semantically confirmed the original Subscription screen. No app data
147
147
  or device settings changed; temporary cleanup client removed.
148
148
  - Historical failures in `modul8-evidence.json` are retained as before-fix evidence;
149
- this repair supersedes their unresolved-selector status. Validation logs:
150
- `/tmp/mobile-debug-selector-fix-verify.log`, `/tmp/mobile-debug-selector-fix-device.log`.
149
+ this repair supersedes their unresolved-selector status.
151
150
 
152
151
  ## Remaining readiness test flake — 2026-10-30
153
152
 
@@ -166,6 +165,6 @@ restored in `finally`. No production timing or readiness behaviour changed.
166
165
  - Focused check: Node 23 pass; 25 separate Node 18.20.8 test-process runs pass.
167
166
  - Full Node 18 maintainer verification with unavailable native defaults: **pass**
168
167
  (65 unit files, lint, build, agent-plugin consistency). Changed whitespace and
169
- local document links also pass; log: `/tmp/mobile-debug-readiness-clock-verify.log`.
168
+ local document links also pass.
170
169
  - Native device suite not repeated for this test-only change; prior runtime
171
- device results remain applicable. GitHub CI requires pushing this local repair.
170
+ device results remain applicable. Hosted CI was not rerun for this repair at the time of this record.
@@ -1,9 +1,11 @@
1
1
  # Specification: correlated evidence
2
2
 
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Intent](intent.md) · [Plan and verification](plan.md)
4
+
3
5
  Date: 2026-10-29. Status: approved.
4
6
  Source: [issue #66](https://github.com/clivejefferies/mobile-debug-tools/issues/66).
5
7
  [Intent](intent.md) approved by “yes”; this specification approved by the
6
- maintainer’s “approve” on 2026-10-29 in this conversation.
8
+ maintainer’s “approve” on 2026-10-29 during design review.
7
9
 
8
10
  ## Scope and association
9
11
 
@@ -1,5 +1,7 @@
1
1
  # Intent: Android system traces
2
2
 
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Specification](spec.md) · [Plan and verification](plan.md)
4
+
3
5
  Originator: repository maintainer, through GitHub roadmap issue #67.
4
6
  Date: 2026-10-30. Status: approved.
5
7
  Source: [issue #67](https://github.com/clivejefferies/mobile-debug-tools/issues/67), roadmap priority 4 of 9.
@@ -36,5 +38,4 @@ Android CLI integration is provisional and requires investigation.
36
38
 
37
39
  ## Approval
38
40
 
39
- The maintainer approved the complete captured intent with “yes” in this
40
- conversation on 2026-10-30. Specification approval remains pending.
41
+ The maintainer approved the complete captured intent with “yes” during design review on 2026-10-30. See the linked specification for its separate approval record.
@@ -1,7 +1,9 @@
1
1
  # Plan: Android system traces
2
2
 
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Intent](intent.md) · [Specification](spec.md)
4
+
3
5
  Authorised by [intent](intent.md) (“yes”) and [specification](spec.md)
4
- (“looks good”, followed by “great”), 2026-10-30 in this conversation.
6
+ (“looks good”, followed by “great”), 2026-10-30 during design review.
5
7
 
6
8
  ## Implementation
7
9
 
@@ -43,9 +45,8 @@ installed/published package remain separate from emulator evidence.
43
45
 
44
46
  ## Results
45
47
 
46
- Implementation and focused review completed on 2026-10-30 on
47
- `codex/android-system-traces`, based on `a74238b`. Changes remain uncommitted;
48
- no push, publication or installed-package update was requested.
48
+ Implementation and focused review completed on 2026-10-30, based on
49
+ `a74238b`. The results below cover the local build, not a published package.
49
50
 
50
51
  - Local runtime: Node 23.11.0 / npm 10.9.2. CI's Node 18 runtime remains **unrun**
51
52
  locally; the final CI workflow was not invoked. Existing CI uses Node 18 and
@@ -97,9 +98,6 @@ no push, publication or installed-package update was requested.
97
98
  explicitly unsupported, with rejection tested. Installed/published-package and
98
99
  full trace-analysis verification remain **unrun**.
99
100
 
100
- Validation logs: `/tmp/mobile-debug-system-traces-verify.log`,
101
- `/tmp/mobile-debug-system-traces-device.log`, and
102
- `/tmp/mobile-debug-system-traces-focused-device.log`.
103
101
  Changed documentation links, evidence JSON and whitespace checks pass.
104
102
 
105
103
  ## Emulator recheck — 2026-10-30
@@ -1,8 +1,10 @@
1
1
  # Specification: Android system traces
2
2
 
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Intent](intent.md) · [Plan and verification](plan.md)
4
+
3
5
  Date: 2026-10-30. Status: approved.
4
6
  Source: [issue #67](https://github.com/clivejefferies/mobile-debug-tools/issues/67).
5
- [Intent](intent.md) approved by the maintainer’s “yes” in this conversation.
7
+ [Intent](intent.md) approved by the maintainer’s “yes” during design review.
6
8
  Specification approved by “looks good” followed by “great” on 2026-10-30.
7
9
 
8
10
  ## Backend and boundaries
@@ -1,6 +1,8 @@
1
1
  # Intent: Android heap dump capture
2
2
 
3
- Originator: clivejefferies, through GitHub roadmap issue #69 and the current conversation.
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md)
4
+
5
+ Originator: clivejefferies, through GitHub roadmap issue #69 and maintainer design review.
4
6
  Date: 2026-10-30. Status: parked; intent not approved.
5
7
  Source: [issue #69](https://github.com/clivejefferies/mobile-debug-tools/issues/69), roadmap priority 6 of 9.
6
8
 
@@ -1,6 +1,8 @@
1
1
  # Intent: Android runtime debugger
2
2
 
3
- Originator: clivejefferies, through GitHub roadmap issue #68 and the current conversation.
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Specification](spec.md) · [Plan and verification](plan.md)
4
+
5
+ Originator: clivejefferies, through GitHub roadmap issue #68 and maintainer design review.
4
6
  Date: 2026-10-30. Status: approved.
5
7
  Source: [issue #68](https://github.com/clivejefferies/mobile-debug-tools/issues/68), roadmap priority 5 of 9.
6
8
 
@@ -36,5 +38,4 @@ concurrency, crash recovery, privacy, and runnable fixture coverage.
36
38
  ## Approval
37
39
 
38
40
  The user selected Android runtime debugger work with “ok, lets pick that up” and
39
- approved the complete captured intent with “yes” on 2026-10-30 in this
40
- conversation. Specification approval remains pending.
41
+ approved the complete captured intent with “yes” on 2026-10-30 during design review. See the linked specification for its separate approval record.
@@ -1,7 +1,9 @@
1
1
  # Plan: Android runtime debugger
2
2
 
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Intent](intent.md) · [Specification](spec.md)
4
+
3
5
  2026-10-30. [Intent](intent.md) and [spec](spec.md) explicitly approved by the
4
- user's successive “yes” responses in this conversation. Implementation authorized.
6
+ user's successive “yes” responses during design review. Implementation authorized.
5
7
 
6
8
  ## Implementation
7
9
 
@@ -1,7 +1,9 @@
1
1
  # Specification: Android runtime debugger
2
2
 
3
+ [Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Intent](intent.md) · [Plan and verification](plan.md)
4
+
3
5
  Date: 2026-10-30. Status: approved.
4
- Intent: [approved intent](intent.md), approved by the user's “yes” in this conversation.
6
+ Intent: [approved intent](intent.md), approved by the user's “yes” during design review.
5
7
  Source: [issue #68](https://github.com/clivejefferies/mobile-debug-tools/issues/68).
6
8
 
7
9
  ## Behaviour and supported environment
@@ -176,7 +178,6 @@ Primary references: [JDI VM lifecycle](https://docs.oracle.com/en/java/javase/17
176
178
  and [ADB](https://developer.android.com/tools/adb). ART/JDI interoperability must
177
179
  be established by fixture evidence; API documentation alone does not prove it.
178
180
 
179
- The user approved this complete specification with “yes” on 2026-10-30 in this
180
- conversation, including all-thread
181
+ The user approved this complete specification with “yes” on 2026-10-30 during design review, including all-thread
181
182
  suspension, conservative device-wide UI blocking, shallow locals, JDK dependency,
182
183
  and automatic detach limits. Implementation is authorized within this scope.
@@ -0,0 +1,88 @@
1
+ # Follow-on codebase health cleanup
2
+
3
+ [Completed structural refactor](plan.md) · [Quality and ownership](../../code-structure.md)
4
+
5
+ Status: complete. Source: the maintainer requested fixing the remaining code
6
+ and dependency debt identified in the health review, excluding additional
7
+ verification-environment coverage (point 4). This is behaviour-preserving
8
+ maintenance under the shared process. On 2026-10-30 the maintainer explicitly
9
+ approved raising the minimum runtime to Node 22 to permit patched dependencies.
10
+
11
+ ## Scope
12
+
13
+ - [x] Triage the 20 dependency audit findings and update compatible dependencies.
14
+ - [x] Upgrade Sharp and Zod, preserve complete public tool-definition parity,
15
+ and clear the remaining tsx/esbuild advisory.
16
+ - [x] Update the declared runtime and CI configuration to Node 22.
17
+ - [x] Replace the oversized Android/iOS observation classes with cohesive services.
18
+ - [x] Decompose snapshot collection, normalization and semantic summary generation.
19
+ - [x] Decompose iOS build discovery, command preparation, execution and diagnostics.
20
+ - [x] Reduce environment diagnostics complexity and remaining unsafe boundaries.
21
+ - [x] Remove resolved legacy exceptions without moving or enlarging allowances.
22
+ - [x] Run focused regressions, complete verification on Node 22, and relevant
23
+ existing device checks; record results and cleanup.
24
+
25
+ The initial baseline contained 136 exceptions; it is now empty. Existing exported entrypoints,
26
+ response shapes, schema strictness, retry order, deadlines, resource ownership and
27
+ error behaviour must remain compatible. In particular, retain platform-specific
28
+ screenshot alpha/fallback policy and concurrent snapshot acquisition behaviour.
29
+
30
+ Additional hosted CI, physical-device journeys and new interactive iOS coverage
31
+ remain outside this request. Existing runnable regression checks still apply to
32
+ changed code. No commit, push, package publication or plugin pin change is implied.
33
+
34
+ ## Verification
35
+
36
+ Local runtime: Node v22.23.4. Verification took place on 2026-10-30.
37
+
38
+ | Check | Result |
39
+ | --- | --- |
40
+ | `npm run verify` under Node 22 | **Pass**: lint, quality, four architecture rules, build, 85 unit files and plugin consistency |
41
+ | Complete public tool-definition fixture | **Pass**: all 52 definitions retain their existing shapes and defaults |
42
+ | Screenshot encoding regressions | **Pass**: Android/iOS transparency policy, fallback formats and conversion failure |
43
+ | Snapshot log regressions | **Pass**: numeric/string timestamps, stream precedence and severity normalization |
44
+ | `npm audit --json` | **Pass**: 20 findings reduced to zero, including development dependencies |
45
+ | `npm pack --dry-run --json` | **Pass**: extracted runtime services and Java worker included; nothing published |
46
+ | Documentation and whitespace checks | **Pass**: relative links, anchors, skill metadata and changed-file whitespace |
47
+ | `npm run test:device` under Node 22 | **Pass**: all 10 files on the final uninterrupted run |
48
+
49
+ The first device run passed the debugger, interaction, screenshots and correlated
50
+ observations, then exposed an undeclared `minimist` import in the existing log
51
+ helper. The dependency is now declared explicitly in development dependencies;
52
+ the dependency audit remains clear. The final device run is recorded below.
53
+
54
+ Review confirmed that retry order, watchdog cleanup, platform screenshot policy,
55
+ evidence freshness ordering and snapshot parallelism remain in their existing
56
+ owners or explicit extracted services. One type-only compatibility export was
57
+ corrected after the Node 22 ESM unit run exposed it. No replacement quality
58
+ allowances or rule suppressions were added.
59
+
60
+ ## Device results and limits
61
+
62
+ The final suite used Android emulator `emulator-5554` (API 36 / Android 16)
63
+ and booted iOS simulator `F9243BAF-62A8-4990-8A99-17F527F56FDA` (iOS 26.4).
64
+ Both ran against the local 0.34.0 build under Node v22.23.4.
65
+
66
+ - **Pass, Android:** isolated fixture debugger attach, breakpoints, stack/locals,
67
+ pause guards, stepping, stale references, resume and owned detach; clickable
68
+ waits, handle taps, visible/state assertions and labelled SeekBar convergence.
69
+ - **Pass, Android and iOS:** screenshots, logs, UI trees and correlated observation
70
+ evidence, including omitted components and foreign-session rejection.
71
+ - **Pass, Android Perfetto:** Settings visibility assertion, explicit correlation,
72
+ trace content structure, stop, cancellation, duration expiry and active shutdown.
73
+ - **Cleanup:** owned fixture apps/build directories, debugger forwards, device
74
+ captures and host trace artifacts removed. Settings remains foreground without
75
+ settings changes. No observation content was retained by the correlation tests.
76
+
77
+ The full compiled TypeScript plus Java-source fingerprint reported by the debugger
78
+ journey is `f035f362ed32b10ef247f918df8523974e06fb153389de3e6b50ca51cdacf8ae`.
79
+ The trace-specific subset fingerprint is
80
+ `e90ed0831de4059f1e2b213ed0c050298cf2e55c0cc0aef9ff4ea2a38b6062a0`.
81
+ Raw local command output is in `/tmp/health-verify.log`,
82
+ `/tmp/health-device-final.log` and `/tmp/health-final-audit.json`; these temporary
83
+ files are not repository artifacts.
84
+
85
+ Hosted CI, physical-device journeys, new interactive iOS coverage and the extended
86
+ Android debugger expiry journey remain **unrun**, as excluded in point 4. The
87
+ existing simulator observation checks above do not establish those outcomes.
88
+ No commit, push or publication was performed.
@@ -0,0 +1,47 @@
1
+ # Intent: code structure and quality gates
2
+
3
+ [Documentation](../../README.md) · [Development process](../process.md)
4
+
5
+ Originator: repository maintainer. Date: 2026-10-30.
6
+ Status: approved on 2026-10-30.
7
+ Source: maintainer request to address oversized classes, weak type boundaries,
8
+ tight coupling, duplicated contracts, and dense lifecycle code, and add tooling
9
+ that prevents recurrence.
10
+
11
+ ## Problem and outcome
12
+
13
+ The current lint configuration checks unused imports and variables, but has no
14
+ size, complexity, or type-safety gates. `ToolsInteract` combines target resolution,
15
+ control adjustment, waits, assertions, and shared state in about 3,700 lines.
16
+ Separately maintained schemas, handler types, and validation can drift. Static
17
+ method replacement makes tests depend on implementation details.
18
+
19
+ Make responsibilities easier to locate, change, and verify while preserving MCP
20
+ contracts, defaults, platform behaviour, cancellation, timing, and cleanup.
21
+
22
+ ## Scope and success criteria
23
+
24
+ - Extract cohesive interaction services behind compatible public entrypoints.
25
+ - Replace unsafe types at extracted boundaries and introduce narrow dependency
26
+ injection where it improves isolation.
27
+ - Reduce schema/type/validation duplication without changing accepted inputs.
28
+ - Make debugger lifecycle transitions and cleanup readable and explicitly typed.
29
+ - Enforce source file, class, function, complexity, nesting, and type-safety limits
30
+ in local verification and CI. Define reviewed, narrow legacy exceptions that
31
+ cannot grow silently; do not disable existing checks or hide new violations.
32
+ - Cover extracted behaviour and guardrail failures with deterministic tests;
33
+ supplement with relevant device checks and record unavailable coverage.
34
+
35
+ ## Boundaries and specification decisions
36
+
37
+ No new MCP capabilities, framework migration, public API redesign, or incidental
38
+ product fixes. Preserve current unrelated documentation edits and removals.
39
+ Specify thresholds, legacy-debt handling, module dependencies, extraction order,
40
+ contract parity checks, and verification before implementation. Do not treat code
41
+ size alone as proof of good design or split methods merely to satisfy metrics.
42
+
43
+ ## Approval
44
+
45
+ The maintainer approved this captured problem and scope with “looks good” on
46
+ 2026-10-30. Implementation requires a separately accepted
47
+ [specification](spec.md) under the development process.