mobile-debug-mcp 0.34.0 → 0.36.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 (500) 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/.cursor-plugin/marketplace.json +1 -1
  11. package/.github/copilot-instructions.md +14 -36
  12. package/.github/workflows/ci.yml +4 -4
  13. package/AGENTS.md +12 -3
  14. package/CONTRIBUTING.md +79 -0
  15. package/README.md +218 -129
  16. package/agent-plugin/.antigravity-plugin/README.md +48 -0
  17. package/agent-plugin/.antigravity-plugin/plugin.json +18 -0
  18. package/agent-plugin/.claude-plugin/plugin.json +2 -2
  19. package/agent-plugin/.codex-plugin/plugin.json +1 -1
  20. package/agent-plugin/.cursor-plugin/plugin.json +2 -2
  21. package/agent-plugin/.mcp.json +1 -1
  22. package/agent-plugin/README.md +50 -11
  23. package/agent-plugin/cursor/.cursor-plugin/plugin.json +23 -0
  24. package/agent-plugin/cursor/LICENSE +201 -0
  25. package/agent-plugin/cursor/README.md +9 -0
  26. package/agent-plugin/cursor/skills/mobile-debug-mcp/SKILL.md +253 -0
  27. package/agent-plugin/mcp.json +1 -1
  28. package/agent-plugin/mcp_config.json +13 -0
  29. package/agent-plugin/plugin.json +1 -1
  30. package/agent-plugin/skills/mobile-debug-mcp/SKILL.md +62 -17
  31. package/dist/contracts/execution-controls.js +24 -0
  32. package/dist/contracts/selector.js +8 -0
  33. package/dist/contracts/target.js +15 -0
  34. package/dist/contracts/ui.js +1 -0
  35. package/dist/debugger/android.js +2 -1
  36. package/dist/debugger/diagnostics.js +54 -0
  37. package/dist/debugger/guard.js +4 -4
  38. package/dist/debugger/ios-worker.js +62 -0
  39. package/dist/debugger/ios.js +57 -0
  40. package/dist/debugger/protocol.js +33 -0
  41. package/dist/debugger/sessions.js +133 -74
  42. package/dist/debugger/worker.js +59 -46
  43. package/dist/interact/adjustment/adjustment-context.js +41 -0
  44. package/dist/interact/adjustment/adjustment-gestures.js +55 -0
  45. package/dist/interact/adjustment/adjustment-plan.js +18 -0
  46. package/dist/interact/adjustment/adjustment-resolution.js +127 -0
  47. package/dist/interact/adjustment/adjustment-result.js +19 -0
  48. package/dist/interact/adjustment/adjustment-semantic.js +64 -0
  49. package/dist/interact/adjustment/adjustment-verification.js +35 -0
  50. package/dist/interact/adjustment/adjustment.js +52 -0
  51. package/dist/interact/adjustment/control-geometry.js +87 -0
  52. package/dist/interact/adjustment/control-values.js +136 -0
  53. package/dist/interact/adjustment/slider-labels.js +84 -0
  54. package/dist/interact/assertions/screen-assertion.js +37 -0
  55. package/dist/interact/assertions/state-assertion-context.js +35 -0
  56. package/dist/interact/assertions/state-assertion.js +76 -0
  57. package/dist/interact/assertions/state-comparison.js +141 -0
  58. package/dist/interact/assertions/visibility-assertion.js +34 -0
  59. package/dist/interact/conditional-action.js +12 -7
  60. package/dist/interact/index.js +77 -3092
  61. package/dist/interact/input-service.js +1 -0
  62. package/dist/interact/interaction-trace.js +21 -0
  63. package/dist/interact/model.js +1 -0
  64. package/dist/interact/observation.js +1 -0
  65. package/dist/interact/targeting/candidate-ancestor.js +58 -0
  66. package/dist/interact/targeting/candidate-result.js +23 -0
  67. package/dist/interact/targeting/candidate-scoring.js +50 -0
  68. package/dist/interact/targeting/element-helpers.js +216 -0
  69. package/dist/interact/targeting/find-element.js +65 -0
  70. package/dist/interact/targeting/nearby-control.js +56 -0
  71. package/dist/interact/targeting/resolved-elements.js +21 -0
  72. package/dist/interact/targeting/tap-target.js +17 -0
  73. package/dist/interact/targeting/target-scope.js +104 -0
  74. package/dist/interact/waits/legacy-log-wait.js +38 -0
  75. package/dist/interact/waits/legacy-wait-observations.js +103 -0
  76. package/dist/interact/waits/legacy-wait-state.js +34 -0
  77. package/dist/interact/waits/legacy-wait.js +48 -0
  78. package/dist/interact/waits/screen-wait.js +49 -0
  79. package/dist/interact/waits/ui-change-helpers.js +157 -0
  80. package/dist/interact/waits/ui-change-state.js +18 -0
  81. package/dist/interact/waits/ui-change-wait.js +77 -0
  82. package/dist/interact/waits/ui-wait-condition.js +56 -0
  83. package/dist/interact/waits/ui-wait-state.js +38 -0
  84. package/dist/interact/waits/ui-wait.js +106 -0
  85. package/dist/manage/android.js +55 -51
  86. package/dist/manage/index.js +38 -75
  87. package/dist/manage/ios/build-types.js +1 -0
  88. package/dist/manage/ios/build.js +210 -0
  89. package/dist/manage/ios/project-discovery.js +29 -0
  90. package/dist/manage/ios/scheme.js +18 -0
  91. package/dist/manage/ios.js +44 -256
  92. package/dist/observe/android/context.js +1 -0
  93. package/dist/observe/android/current-screen.js +55 -0
  94. package/dist/observe/android/fingerprint.js +13 -0
  95. package/dist/observe/android/log-stream.js +132 -0
  96. package/dist/observe/android/logs.js +107 -0
  97. package/dist/observe/android/screenshot.js +70 -0
  98. package/dist/observe/android/ui-tree.js +107 -0
  99. package/dist/observe/android.js +16 -520
  100. package/dist/observe/evidence.js +114 -75
  101. package/dist/observe/index.js +16 -263
  102. package/dist/observe/ios/context.js +16 -0
  103. package/dist/observe/ios/fingerprint.js +12 -0
  104. package/dist/observe/ios/log-stream.js +105 -0
  105. package/dist/observe/ios/logs.js +168 -0
  106. package/dist/observe/ios/screenshot.js +22 -0
  107. package/dist/observe/ios/ui-elements.js +241 -0
  108. package/dist/observe/ios/ui-tree.js +137 -0
  109. package/dist/observe/ios-trace/artifact.js +63 -0
  110. package/dist/observe/ios-trace/capabilities.js +86 -0
  111. package/dist/observe/ios-trace/native.js +93 -0
  112. package/dist/observe/ios-trace/notification.js +35 -0
  113. package/dist/observe/ios-trace/process.js +98 -0
  114. package/dist/observe/ios-trace/sessions.js +244 -0
  115. package/dist/observe/ios.js +17 -715
  116. package/dist/observe/logs/model.js +1 -0
  117. package/dist/{network → observe/network}/index.js +2 -2
  118. package/dist/observe/readiness-service.js +5 -3
  119. package/dist/observe/readiness.js +33 -14
  120. package/dist/observe/screenshot-encoding.js +41 -0
  121. package/dist/observe/snapshot-collection.js +79 -0
  122. package/dist/observe/snapshot-logs.js +30 -0
  123. package/dist/observe/snapshot-metadata.js +43 -31
  124. package/dist/observe/snapshot-semantic.js +115 -0
  125. package/dist/observe/system-trace-error.js +7 -0
  126. package/dist/observe/system-trace-router.js +81 -0
  127. package/dist/observe/system-trace.js +26 -21
  128. package/dist/runtime/action-results.js +270 -0
  129. package/dist/runtime/clock.js +4 -0
  130. package/dist/server/common.js +1 -256
  131. package/dist/server/definitions/assert.js +162 -0
  132. package/dist/server/definitions/diagnostic.js +118 -0
  133. package/dist/server/definitions/input.js +274 -0
  134. package/dist/server/definitions/manage.js +194 -0
  135. package/dist/server/definitions/observe.js +149 -0
  136. package/dist/server/definitions/target.js +138 -0
  137. package/dist/server/definitions/wait.js +105 -0
  138. package/dist/server/handlers/action-execution.js +163 -0
  139. package/dist/server/handlers/correlation.js +23 -0
  140. package/dist/server/handlers/debugger-handlers.js +67 -0
  141. package/dist/server/handlers/debugger-response.js +9 -0
  142. package/dist/server/handlers/diagnostic.js +77 -0
  143. package/dist/server/handlers/handler-types.js +1 -0
  144. package/dist/server/handlers/input.js +154 -0
  145. package/dist/server/handlers/interact.js +113 -0
  146. package/dist/server/handlers/journey-assertions.js +35 -0
  147. package/dist/server/handlers/journey.js +147 -0
  148. package/dist/server/handlers/manage.js +119 -0
  149. package/dist/server/handlers/observe.js +95 -0
  150. package/dist/server/handlers/payload.js +4 -0
  151. package/dist/server/handlers/tool-handlers.js +170 -0
  152. package/dist/server/schemas/condition-schema.js +2 -0
  153. package/dist/server/{debugger-schema.js → schemas/debugger-schema.js} +20 -12
  154. package/dist/server/{journey-schema.js → schemas/journey-schema.js} +7 -22
  155. package/dist/server/schemas/system-trace-schema.js +22 -0
  156. package/dist/server/tool-definitions.js +58 -1135
  157. package/dist/server-core.js +2 -2
  158. package/dist/server.js +4 -4
  159. package/dist/system/android-status.js +101 -0
  160. package/dist/system/android.js +37 -27
  161. package/dist/system/index.js +13 -439
  162. package/dist/system/ios-status.js +132 -0
  163. package/dist/system/ios.js +11 -8
  164. package/dist/system/model.js +1 -0
  165. package/dist/system/probes.js +105 -0
  166. package/dist/system/status-summary.js +43 -0
  167. package/dist/system/unsupported-status.js +52 -0
  168. package/dist/utils/android/commands.js +89 -0
  169. package/dist/utils/android/gradle.js +139 -0
  170. package/dist/utils/android/logs.js +103 -0
  171. package/dist/utils/android/ui-tree.js +233 -0
  172. package/dist/utils/android/utils.js +6 -564
  173. package/dist/utils/cli/idb/idb-helper.js +4 -6
  174. package/dist/utils/cli/idb/install-idb.js +13 -9
  175. package/dist/utils/cli/ios/preflight-ios.js +42 -38
  176. package/dist/utils/ios/utils.js +48 -46
  177. package/dist/utils/java.js +65 -49
  178. package/dist/utils/resolve-device.js +4 -2
  179. package/dist/utils/ui/index.js +26 -26
  180. package/docs/CHANGELOG.md +67 -1
  181. package/docs/README.md +38 -0
  182. package/docs/agent-plugin-installation-verification.md +39 -0
  183. package/docs/benchmarks/README.md +18 -0
  184. package/docs/benchmarks/interaction-latency/README.md +14 -0
  185. package/docs/benchmarks/interaction-latency/final.md +4 -1
  186. package/docs/benchmarks/interaction-latency/ios-validation.md +2 -0
  187. package/docs/benchmarks/ui-tree-performance/README.md +24 -16
  188. package/docs/benchmarks/ui-tree-performance/comparison.md +11 -10
  189. package/docs/code-structure.md +120 -0
  190. package/docs/specs/001-state-verification/spec.md +16 -14
  191. package/docs/specs/002-richer-element-identity/spec.md +12 -10
  192. package/docs/specs/003-wait-and-synchronization-reliability/spec.md +12 -10
  193. package/docs/specs/004-action-verification-routing/spec.md +3 -3
  194. package/docs/specs/005-unified-action-execution-and-verification-model/spec.md +2 -0
  195. package/docs/specs/006-runtime-action-instrumentation-and-binding-layer/spec.md +2 -0
  196. package/docs/specs/007-actionability-resolution-and-executable-target-selection/spec.md +3 -1
  197. package/docs/specs/008-adjustable-control-support-and-semantic-value-manipulation/spec.md +3 -4
  198. package/docs/specs/009-semantic-control-modeling-for-custom-and-composite-controls/spec.md +2 -0
  199. package/docs/specs/010-verification-stabilization-and-temporal-convergence/spec.md +2 -2
  200. package/docs/specs/011-recovery-and-replanning-for-failed-or-ambiguous-interaction-flows/spec.md +2 -2
  201. package/docs/specs/011.1-recovery-contract-types-and-runtime-wiring-spec/spec.md +2 -0
  202. package/docs/specs/012-action-trace-and-xecution-observability/spec.md +2 -3
  203. package/docs/specs/013-wait-and-synchronization-reliability/spec.md +19 -19
  204. package/docs/specs/014-actionability-resolution/spec.md +20 -18
  205. package/docs/specs/015-adjustable-control-support/spec.md +17 -15
  206. package/docs/specs/016-environment-tools/spec.md +20 -20
  207. package/docs/specs/018-interaction-latency-and-batched-journeys/spec.md +2 -0
  208. package/docs/specs/019-ui-tree-observation-performance/spec.md +3 -1
  209. package/docs/specs/020-conditional-actions/intent.md +5 -3
  210. package/docs/specs/020-conditional-actions/plan.md +8 -9
  211. package/docs/specs/020-conditional-actions/spec.md +4 -2
  212. package/docs/specs/021-app-readiness-signals/intent.md +4 -2
  213. package/docs/specs/021-app-readiness-signals/plan.md +7 -6
  214. package/docs/specs/021-app-readiness-signals/spec.md +3 -1
  215. package/docs/specs/022-correlated-evidence/intent.md +4 -4
  216. package/docs/specs/022-correlated-evidence/plan.md +10 -11
  217. package/docs/specs/022-correlated-evidence/spec.md +3 -1
  218. package/docs/specs/023-android-system-traces/intent.md +3 -2
  219. package/docs/specs/023-android-system-traces/plan.md +5 -7
  220. package/docs/specs/023-android-system-traces/spec.md +3 -1
  221. package/docs/specs/024-android-heap-dump-capture/intent.md +3 -1
  222. package/docs/specs/025-android-runtime-debugger/intent.md +4 -3
  223. package/docs/specs/025-android-runtime-debugger/plan.md +3 -1
  224. package/docs/specs/025-android-runtime-debugger/spec.md +4 -3
  225. package/docs/specs/026-code-structure-and-quality-gates/health-plan.md +88 -0
  226. package/docs/specs/026-code-structure-and-quality-gates/intent.md +47 -0
  227. package/docs/specs/026-code-structure-and-quality-gates/plan.md +191 -0
  228. package/docs/specs/026-code-structure-and-quality-gates/spec.md +138 -0
  229. package/docs/specs/026-code-structure-and-quality-gates/verification-final.json +200 -0
  230. package/docs/specs/026-code-structure-and-quality-gates/verification-thin-facade.json +154 -0
  231. package/docs/specs/026-code-structure-and-quality-gates/verification.json +136 -0
  232. package/docs/specs/027-debugger-failure-diagnostics/intent.md +43 -0
  233. package/docs/specs/027-debugger-failure-diagnostics/plan.md +86 -0
  234. package/docs/specs/027-debugger-failure-diagnostics/spec.md +133 -0
  235. package/docs/specs/028-compact-debugger-responses/intent.md +41 -0
  236. package/docs/specs/028-compact-debugger-responses/plan.md +112 -0
  237. package/docs/specs/028-compact-debugger-responses/spec.md +108 -0
  238. package/docs/specs/029-kotlin-locals-validation/report.md +119 -0
  239. package/docs/specs/030-android-coroutine-validation/evidence.json +475 -0
  240. package/docs/specs/030-android-coroutine-validation/intent.md +47 -0
  241. package/docs/specs/030-android-coroutine-validation/plan.md +147 -0
  242. package/docs/specs/030-android-coroutine-validation/report.md +240 -0
  243. package/docs/specs/030-android-coroutine-validation/spec.md +107 -0
  244. package/docs/specs/031-ios-system-traces/intent.md +38 -0
  245. package/docs/specs/031-ios-system-traces/investigation.md +92 -0
  246. package/docs/specs/031-ios-system-traces/late-run-failure-evidence.json +32 -0
  247. package/docs/specs/031-ios-system-traces/plan.md +138 -0
  248. package/docs/specs/031-ios-system-traces/pr102-monitor-evidence.json +22 -0
  249. package/docs/specs/031-ios-system-traces/simulator-evidence.json +47 -0
  250. package/docs/specs/031-ios-system-traces/spec.md +135 -0
  251. package/docs/specs/032-ios-runtime-debugger/evidence.json +176 -0
  252. package/docs/specs/032-ios-runtime-debugger/intent.md +38 -0
  253. package/docs/specs/032-ios-runtime-debugger/plan.md +95 -0
  254. package/docs/specs/032-ios-runtime-debugger/report.md +205 -0
  255. package/docs/specs/032-ios-runtime-debugger/spec.md +153 -0
  256. package/docs/tools/TOOLS.md +31 -18
  257. package/docs/tools/{evidence.md → correlated-evidence.md} +9 -1
  258. package/docs/tools/debugger.md +120 -4
  259. package/docs/tools/interact.md +42 -20
  260. package/docs/tools/manage.md +25 -44
  261. package/docs/tools/observe.md +55 -23
  262. package/docs/tools/system-traces.md +89 -14
  263. package/docs/tools/system.md +12 -5
  264. package/package.json +12 -8
  265. package/scripts/agent-plugin.mjs +55 -5
  266. package/scripts/architecture-graph.mjs +69 -0
  267. package/scripts/check-architecture.mjs +47 -0
  268. package/scripts/code-quality-baseline.json +1 -0
  269. package/scripts/code-quality.mjs +161 -0
  270. package/src/contracts/execution-controls.ts +26 -0
  271. package/src/contracts/selector.ts +17 -0
  272. package/src/contracts/target.ts +19 -0
  273. package/src/contracts/ui.ts +94 -0
  274. package/src/debugger/android.ts +3 -2
  275. package/src/debugger/diagnostics.ts +43 -0
  276. package/src/debugger/guard.ts +10 -5
  277. package/src/debugger/ios-worker.ts +49 -0
  278. package/src/debugger/ios.ts +45 -0
  279. package/{worker → src/debugger/java}/DebuggerWorker.java +9 -3
  280. package/src/debugger/lldb/breakpoints.py +51 -0
  281. package/src/debugger/lldb/inspection.py +109 -0
  282. package/src/debugger/lldb/worker.py +203 -0
  283. package/src/debugger/protocol.ts +37 -0
  284. package/src/debugger/sessions.ts +326 -155
  285. package/src/debugger/worker.ts +57 -41
  286. package/src/interact/adjustment/adjustment-context.ts +83 -0
  287. package/src/interact/adjustment/adjustment-gestures.ts +48 -0
  288. package/src/interact/adjustment/adjustment-plan.ts +23 -0
  289. package/src/interact/adjustment/adjustment-resolution.ts +104 -0
  290. package/src/interact/adjustment/adjustment-result.ts +34 -0
  291. package/src/interact/adjustment/adjustment-semantic.ts +53 -0
  292. package/src/interact/adjustment/adjustment-verification.ts +60 -0
  293. package/src/interact/adjustment/adjustment.ts +49 -0
  294. package/src/interact/adjustment/control-geometry.ts +120 -0
  295. package/src/interact/adjustment/control-values.ts +141 -0
  296. package/src/interact/adjustment/slider-labels.ts +84 -0
  297. package/src/interact/assertions/screen-assertion.ts +39 -0
  298. package/src/interact/assertions/state-assertion-context.ts +48 -0
  299. package/src/interact/assertions/state-assertion.ts +64 -0
  300. package/src/interact/assertions/state-comparison.ts +168 -0
  301. package/src/interact/assertions/visibility-assertion.ts +41 -0
  302. package/src/interact/conditional-action.ts +18 -12
  303. package/src/interact/index.ts +89 -3494
  304. package/src/interact/input-service.ts +11 -0
  305. package/src/interact/interaction-trace.ts +36 -0
  306. package/src/interact/model.ts +109 -0
  307. package/src/interact/observation.ts +7 -0
  308. package/src/interact/targeting/candidate-ancestor.ts +49 -0
  309. package/src/interact/targeting/candidate-result.ts +24 -0
  310. package/src/interact/targeting/candidate-scoring.ts +42 -0
  311. package/src/interact/targeting/element-helpers.ts +243 -0
  312. package/src/interact/targeting/find-element.ts +47 -0
  313. package/src/interact/targeting/nearby-control.ts +46 -0
  314. package/src/interact/targeting/resolved-elements.ts +20 -0
  315. package/src/interact/targeting/tap-target.ts +22 -0
  316. package/src/interact/targeting/target-scope.ts +121 -0
  317. package/src/interact/waits/legacy-log-wait.ts +30 -0
  318. package/src/interact/waits/legacy-wait-observations.ts +55 -0
  319. package/src/interact/waits/legacy-wait-state.ts +48 -0
  320. package/src/interact/waits/legacy-wait.ts +34 -0
  321. package/src/interact/waits/screen-wait.ts +37 -0
  322. package/src/interact/waits/ui-change-helpers.ts +184 -0
  323. package/src/interact/waits/ui-change-state.ts +26 -0
  324. package/src/interact/waits/ui-change-wait.ts +59 -0
  325. package/src/interact/waits/ui-wait-condition.ts +52 -0
  326. package/src/interact/waits/ui-wait-state.ts +55 -0
  327. package/src/interact/waits/ui-wait.ts +84 -0
  328. package/src/manage/android.ts +56 -50
  329. package/src/manage/index.ts +63 -93
  330. package/src/manage/ios/build-types.ts +14 -0
  331. package/src/manage/ios/build.ts +230 -0
  332. package/src/manage/ios/project-discovery.ts +26 -0
  333. package/src/manage/ios/scheme.ts +16 -0
  334. package/src/manage/ios.ts +67 -298
  335. package/src/observe/android/context.ts +1 -0
  336. package/src/observe/android/current-screen.ts +63 -0
  337. package/src/observe/android/fingerprint.ts +13 -0
  338. package/src/observe/android/log-stream.ts +127 -0
  339. package/src/observe/android/logs.ts +110 -0
  340. package/src/observe/android/screenshot.ts +79 -0
  341. package/src/observe/android/ui-tree.ts +113 -0
  342. package/src/observe/android.ts +17 -531
  343. package/src/observe/evidence.ts +122 -70
  344. package/src/observe/index.ts +24 -286
  345. package/src/observe/ios/context.ts +22 -0
  346. package/src/observe/ios/fingerprint.ts +12 -0
  347. package/src/observe/ios/log-stream.ts +103 -0
  348. package/src/observe/ios/logs.ts +179 -0
  349. package/src/observe/ios/screenshot.ts +26 -0
  350. package/src/observe/ios/ui-elements.ts +266 -0
  351. package/src/observe/ios/ui-tree.ts +143 -0
  352. package/src/observe/ios-trace/artifact.ts +55 -0
  353. package/src/observe/ios-trace/capabilities.ts +74 -0
  354. package/src/observe/ios-trace/native.ts +72 -0
  355. package/src/observe/ios-trace/notification.ts +30 -0
  356. package/src/observe/ios-trace/process.ts +82 -0
  357. package/src/observe/ios-trace/sessions.ts +204 -0
  358. package/src/observe/ios.ts +18 -749
  359. package/src/observe/logs/model.ts +11 -0
  360. package/src/{network → observe/network}/index.ts +2 -2
  361. package/src/observe/readiness-service.ts +6 -4
  362. package/src/observe/readiness.ts +42 -21
  363. package/src/observe/screenshot-encoding.ts +32 -0
  364. package/src/observe/snapshot-collection.ts +69 -0
  365. package/src/observe/snapshot-logs.ts +26 -0
  366. package/src/observe/snapshot-metadata.ts +51 -31
  367. package/src/observe/snapshot-semantic.ts +153 -0
  368. package/src/observe/system-trace-error.ts +3 -0
  369. package/src/observe/system-trace-router.ts +61 -0
  370. package/src/observe/system-trace.ts +28 -19
  371. package/src/runtime/action-results.ts +376 -0
  372. package/src/runtime/clock.ts +9 -0
  373. package/src/server/common.ts +9 -359
  374. package/src/server/definitions/assert.ts +164 -0
  375. package/src/server/definitions/diagnostic.ts +120 -0
  376. package/src/server/definitions/input.ts +276 -0
  377. package/src/server/definitions/manage.ts +196 -0
  378. package/src/server/definitions/observe.ts +151 -0
  379. package/src/server/definitions/target.ts +140 -0
  380. package/src/server/definitions/wait.ts +107 -0
  381. package/src/server/handlers/action-execution.ts +164 -0
  382. package/src/server/handlers/correlation.ts +20 -0
  383. package/src/server/handlers/debugger-handlers.ts +58 -0
  384. package/src/server/handlers/debugger-response.ts +7 -0
  385. package/src/server/handlers/diagnostic.ts +86 -0
  386. package/src/server/handlers/handler-types.ts +7 -0
  387. package/src/server/handlers/input.ts +173 -0
  388. package/src/server/handlers/interact.ts +135 -0
  389. package/src/server/handlers/journey-assertions.ts +39 -0
  390. package/src/server/handlers/journey.ts +132 -0
  391. package/src/server/handlers/manage.ts +141 -0
  392. package/src/server/handlers/observe.ts +116 -0
  393. package/src/server/handlers/payload.ts +36 -0
  394. package/src/server/handlers/tool-handlers.ts +170 -0
  395. package/src/server/schemas/condition-schema.ts +2 -0
  396. package/src/server/schemas/debugger-schema.ts +46 -0
  397. package/src/server/{journey-schema.ts → schemas/journey-schema.ts} +7 -22
  398. package/src/server/schemas/system-trace-schema.ts +23 -0
  399. package/src/server/tool-definitions.ts +67 -1143
  400. package/src/server-core.ts +2 -2
  401. package/src/server.ts +4 -4
  402. package/src/system/android-status.ts +124 -0
  403. package/src/system/android.ts +33 -21
  404. package/src/system/index.ts +21 -525
  405. package/src/system/ios-status.ts +147 -0
  406. package/src/system/ios.ts +14 -10
  407. package/src/system/model.ts +41 -0
  408. package/src/system/probes.ts +114 -0
  409. package/src/system/status-summary.ts +47 -0
  410. package/src/system/unsupported-status.ts +55 -0
  411. package/src/types.ts +16 -106
  412. package/src/utils/android/commands.ts +81 -0
  413. package/src/utils/android/gradle.ts +132 -0
  414. package/src/utils/android/logs.ts +103 -0
  415. package/src/utils/android/ui-tree.ts +239 -0
  416. package/src/utils/android/utils.ts +16 -556
  417. package/src/utils/cli/idb/check-idb.ts +4 -4
  418. package/src/utils/cli/idb/idb-helper.ts +6 -8
  419. package/src/utils/cli/idb/install-idb.ts +15 -9
  420. package/src/utils/cli/ios/preflight-ios.ts +39 -31
  421. package/src/utils/cli/ios/run-ios-ui-tree-tap.ts +4 -4
  422. package/src/utils/ios/utils.ts +60 -61
  423. package/src/utils/java.ts +62 -43
  424. package/src/utils/resolve-device.ts +9 -6
  425. package/src/utils/ui/index.ts +28 -28
  426. package/test/device/automated/debugger/coroutine-lifecycle.ts +27 -0
  427. package/test/device/automated/debugger/coroutine-support.ts +140 -0
  428. package/test/device/automated/debugger/coroutine.android.test.ts +169 -0
  429. package/test/device/automated/debugger/kotlin.android.test.ts +127 -0
  430. package/test/device/automated/debugger/runtime.android.test.ts +19 -3
  431. package/test/device/automated/debugger/runtime.ios.test.ts +221 -0
  432. package/test/device/automated/interact/interaction.android.test.ts +56 -0
  433. package/test/device/automated/observe/ios-system-trace.smoke.ts +119 -0
  434. package/test/device/automated/observe/system-trace.smoke.ts +1 -1
  435. package/test/device/manual/interact/modul8_selector_tap.manual.ts +1 -1
  436. package/test/fixtures/contracts/tool-definitions.json +3696 -0
  437. package/test/fixtures/coroutine-app/MainActivity.kt +100 -0
  438. package/test/fixtures/coroutine-app/README.md +48 -0
  439. package/test/fixtures/coroutine-app/build.ts +35 -0
  440. package/test/fixtures/debugger-app/MainActivity.java +21 -0
  441. package/test/fixtures/debugger-app/MainActivity.kt +32 -0
  442. package/test/fixtures/debugger-app/README.md +52 -0
  443. package/test/fixtures/debugger-app/build.ts +25 -15
  444. package/test/fixtures/ios-debugger-app/Main.swift +95 -0
  445. package/test/fixtures/ios-debugger-app/README.md +27 -0
  446. package/test/fixtures/ios-debugger-app/build.ts +21 -0
  447. package/test/fixtures/latency-journey-app/README.md +2 -0
  448. package/test/fixtures/readiness-app/README.md +2 -0
  449. package/test/helpers/ios-trace-shutdown.ts +29 -0
  450. package/test/unit/debugger/coroutine-lifecycle.test.ts +43 -0
  451. package/test/unit/debugger/diagnostic-sessions.test.ts +67 -0
  452. package/test/unit/debugger/diagnostics.test.ts +80 -0
  453. package/test/unit/debugger/guards.test.ts +4 -0
  454. package/test/unit/debugger/handle-guards.test.ts +88 -0
  455. package/test/unit/debugger/ios-preparation.test.ts +57 -0
  456. package/test/unit/debugger/ios.test.ts +104 -0
  457. package/test/unit/debugger/lldb-worker.py +166 -0
  458. package/test/unit/debugger/lldb-worker.test.ts +10 -0
  459. package/test/unit/debugger/preparation.test.ts +32 -0
  460. package/test/unit/debugger/protocol.test.ts +15 -0
  461. package/test/unit/debugger/sessions.test.ts +1 -1
  462. package/test/unit/interact/adjustment_service.test.ts +42 -0
  463. package/test/unit/interact/adjustment_verification.test.ts +35 -0
  464. package/test/unit/interact/clock_dependencies.test.ts +63 -0
  465. package/test/unit/interact/element_helpers.test.ts +19 -0
  466. package/test/unit/interact/legacy_wait_service.test.ts +17 -0
  467. package/test/unit/interact/state_comparison.test.ts +20 -0
  468. package/test/unit/interact/target_scope.test.ts +35 -0
  469. package/test/unit/network/get_network_activity.test.ts +1 -1
  470. package/test/unit/observe/ios-trace-native.test.ts +90 -0
  471. package/test/unit/observe/ios-trace-sessions.test.ts +131 -0
  472. package/test/unit/observe/readiness.test.ts +1 -1
  473. package/test/unit/observe/screenshot-encoding.test.ts +30 -0
  474. package/test/unit/observe/snapshot-logs.test.ts +14 -0
  475. package/test/unit/observe/system-trace-router.test.ts +49 -0
  476. package/test/unit/quality/agent-plugin-export.test.ts +38 -0
  477. package/test/unit/quality/architecture.test.ts +60 -0
  478. package/test/unit/quality/code-quality.test.ts +58 -0
  479. package/test/unit/quality/interaction_boundaries.test.ts +24 -0
  480. package/test/unit/server/conditional_actions.test.ts +1 -1
  481. package/test/unit/server/conditional_schema.test.ts +2 -2
  482. package/test/unit/server/debugger-response.test.ts +63 -0
  483. package/test/unit/server/system-trace.test.ts +12 -3
  484. package/test/unit/server/tool_definitions_parity.test.ts +8 -0
  485. package/dist/server/debugger-handlers.js +0 -38
  486. package/dist/server/system-trace-schema.js +0 -17
  487. package/dist/server/tool-handlers.js +0 -1000
  488. package/docs/ROADMAP.md +0 -646
  489. package/docs/benchmarks/ui-tree-performance/bridge-probe.json +0 -29
  490. package/docs/benchmarks/ui-tree-performance/initial-baseline.json +0 -59560
  491. package/docs/specs/baseline-spec-v0.md +0 -312
  492. package/docs/specs/mcp-tooling-spec-v1.md +0 -446
  493. package/src/server/debugger-handlers.ts +0 -29
  494. package/src/server/debugger-schema.ts +0 -37
  495. package/src/server/system-trace-schema.ts +0 -17
  496. package/src/server/tool-handlers.ts +0 -1008
  497. /package/dist/{server/condition-schema.js → contracts/condition.js} +0 -0
  498. /package/dist/server/{readiness-schema.js → schemas/readiness-schema.js} +0 -0
  499. /package/src/{server/condition-schema.ts → contracts/condition.ts} +0 -0
  500. /package/src/server/{readiness-schema.ts → schemas/readiness-schema.ts} +0 -0
@@ -0,0 +1,22 @@
1
+ {
2
+ "source": "built dist iOS sessions/native adapter; injected monitor failures, real Instruments capture",
3
+ "device": "F9243BAF-62A8-4990-8A99-17F527F56FDA",
4
+ "runtime": "v23.11.0",
5
+ "transient_recovery": {
6
+ "status": "PASS",
7
+ "injected_command_failures": 2,
8
+ "trace_id": "a979b090-3ebb-4a95-92d0-9060c8105d45",
9
+ "pid": 90191,
10
+ "sample_rows": 7,
11
+ "artifact_bytes": 10898587
12
+ },
13
+ "repeated_timeout": {
14
+ "status": "PASS",
15
+ "reason": "ACTION_TIMEOUT",
16
+ "cleanup": "complete"
17
+ },
18
+ "status": "PASS",
19
+ "build_sha256": "e735ac25c9b0065797b748934efa5f3fc977a538fffef50e464b31ca4603c64a",
20
+ "cleanup": "Owned captures stopped; fixture and host artifacts removed; simulator shutdown restored separately",
21
+ "simulator_restored_to_shutdown": true
22
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "linked_baseline": "PASS; Ready asserted via built-server journey",
3
+ "journey": {
4
+ "status": "PASS",
5
+ "trace_id": "742664b0-c676-4fe8-9231-26cca3c41009",
6
+ "correlation_id": "5affcc93-6944-4b58-a4a9-0d6cd0a55954",
7
+ "ready_at_ms": 1793796042115,
8
+ "journey_submitted_at_ms": 1793796046237,
9
+ "outcome": "Done visible via journey UI-tree assertion",
10
+ "sample_rows": 70,
11
+ "artifact_bytes": 11961327,
12
+ "warnings": [
13
+ "INSTRUMENTS_RUN_WARNING: one or more Instruments warnings; coverage may be incomplete."
14
+ ]
15
+ },
16
+ "stale_id": "PASS; rejected tap left prior fixture label visible",
17
+ "cancel": "PASS",
18
+ "expiry": "PASS",
19
+ "failed_journey": "PASS; failure retained capture for explicit stop",
20
+ "shutdown": "PASS; owned recording and partial directory removed",
21
+ "app_survived_cleanup": "PASS",
22
+ "status": "PASS",
23
+ "build_sha256": "48eee7b1f71403645ab301def8d83dd14585eec099b221f8ac4f6aaba0941282",
24
+ "runtime": "v23.11.0",
25
+ "device": "F9243BAF-62A8-4990-8A99-17F527F56FDA",
26
+ "server": {
27
+ "name": "mobile-debug-mcp",
28
+ "version": "0.35.0"
29
+ },
30
+ "physical_device": "UNRUN; unsupported initial matrix",
31
+ "native_failure_injection": "UNRUN on real target; deterministic unit tests separate",
32
+ "input_toolchain": "Explicit test companion via IDB_COMPANION; see investigation.md",
33
+ "cleanup": {
34
+ "trace_errors": [],
35
+ "fixture_removed": true,
36
+ "simulator_shutdown": false,
37
+ "host_artifacts_removed": true
38
+ },
39
+ "task_cleanup": {
40
+ "original_simulator_state": "Shutdown",
41
+ "restored_simulator_state": "Shutdown",
42
+ "fixture_absent": true,
43
+ "temporary_companion_stopped": true,
44
+ "temporary_framework_alias_removed": true,
45
+ "named_probe_artifacts_removed": true
46
+ }
47
+ }
@@ -0,0 +1,135 @@
1
+ # iOS system traces — proposed specification
2
+
3
+ 2026-11-04. **Approved** by the user's second “ok” in this chat, responding to
4
+ the complete specification and implementation approval request.
5
+ [Intent](intent.md) approved by the user's “ok” in this chat.
6
+ Source: [issue #78](https://github.com/clivejefferies/mobile-debug-tools/issues/78).
7
+ [Native investigation and limits](investigation.md).
8
+
9
+ ## Supported scope
10
+
11
+ Extend the existing five system-trace tools with an Instruments backend on macOS
12
+ with full Xcode. Initial supported combination: booted iOS simulator and Time
13
+ Profiler, attached to an already running development app. Baseline is Xcode 27.2
14
+ and iOS 26.4.1. Other versions require successful prerequisite checks and artifact
15
+ validation; installed templates alone do not establish support.
16
+
17
+ System Trace is discoverable but not enabled initially: the simulator probe did
18
+ not establish scheduling data. Animation Hitches is unsupported on the tested
19
+ simulator. Hangs is an instrument within Time Profiler here, not a selectable
20
+ standalone template; do not promise detected hangs. Physical-device capture is
21
+ explicitly unsupported in this initial release, with verification unrun because
22
+ no device is available. Report pairing, Developer Mode, signing/profiling and
23
+ symbol prerequisites as applicable setup guidance, never as completed checks.
24
+ Expanding this matrix requires evidence and a specification revision.
25
+
26
+ No host recording, all-processes mode, custom templates, app launching, automatic
27
+ diagnosis, summaries, arbitrary queries, or public export API. Android retains
28
+ its existing preset, inputs, results and verification requirements.
29
+
30
+ ## Tools and contracts
31
+
32
+ Keep existing names and strict schemas. Extend capabilities and start inputs with
33
+ optional `appId` (nonblank bundle identifier) and `template` enum
34
+ `System Trace | Time Profiler | Animation Hitches | Hangs`. These fields are
35
+ iOS-only; reject them on Android. iOS start requires explicit `deviceId` and
36
+ `appId`; omitted template defaults to Time Profiler. Capabilities require explicit
37
+ `deviceId` on iOS; `appId` optionally probes running-app readiness. Duration stays
38
+ 1,000–120,000 ms, default 30,000. Controls still accept only `traceId`.
39
+
40
+ iOS capabilities return `backend:xctrace`, resolved simulator/device metadata,
41
+ Xcode version, discovered templates, per-template support/reasons/coverage,
42
+ prerequisite states (`available`, `missing`, `unknown`), and actionable recovery.
43
+ Discovery starts no recording and grants no permissions. Distinguish unavailable
44
+ tooling/target, unsupported matrix, app not running, permission failure and checks
45
+ that only a recording can establish. Do not label unknown permissions as granted.
46
+
47
+ Reuse session state, completion reasons, IDs, host bounds, cleanup and correlation
48
+ fields. Extend result unions to iOS, `backend:xctrace`, and artifact
49
+ `format:instruments` with absolute `.trace` path, recursive `size_bytes`, and
50
+ `kind:directory|file`. Include pinned `app_id`, PID, executable identity,
51
+ selected template, target type, warnings and validation result. Never return raw
52
+ trace data. Unreached fields are null. Errors use existing MCP `isError` and
53
+ TRACE_* codes; bounded reason/recovery values distinguish setup, permission,
54
+ target disconnect, readiness, export and storage failures without raw stderr.
55
+
56
+ Resolve bundle identity to one current executable/PID on the pinned simulator;
57
+ ambiguous/missing identity fails. Always pass `--device <UDID>` and revalidate
58
+ identity before starting. Do not retry against a different process/name, template,
59
+ device or host. Exported target UUID, PID and template must match the session.
60
+
61
+ ## Lifecycle, limits and privacy
62
+
63
+ Use uniquely owned mode-0700 temporary directories and fixed argument arrays.
64
+ Spawn the recorder with `--time-limit`, unique output and unique
65
+ `--notify-tracing-started` notification. Register an owned Darwin-notification
66
+ listener before spawning; return recording only after that notification while
67
+ the recorder remains live. Console “Starting recording” alone is insufficient.
68
+ Notification helper availability is a prerequisite, never a silent fallback.
69
+
70
+ Allow 35 seconds for readiness, 30 seconds for graceful stop/finalisation and
71
+ 30 seconds for validation. Bound every child process and cap captured diagnostic
72
+ output. At requested duration, reconcile and finalise automatically. SIGINT only
73
+ the session-owned recorder; after its grace deadline terminate that owned child
74
+ and report failure/partial output. Never signal the app, by process name, or an
75
+ unrelated Instruments recording. On server shutdown cancel owned sessions under
76
+ one 10-second overall deadline; forced cleanup may leave an unreadable artifact
77
+ and must report that. Crashes provide no cleanup guarantee; no restart-wide sweep.
78
+
79
+ Share the existing one-session-per-device, four-active-session server limit across
80
+ backends. Serialise controls; retain 100 terminal metadata records for ten minutes.
81
+ Stale/other-server IDs fail. Completed controls are idempotent. Disconnect,
82
+ premature recorder exit and journey failure have explicit outcomes; journey failure
83
+ does not cancel capture. Retry validation only on an existing finalised owned
84
+ bundle, never restart recording. Cancel removes owned partial output; completed
85
+ artifacts remain user-managed.
86
+
87
+ Poll recursive output size every second; stop/discard on exceeding 256 MiB per
88
+ iOS session, reject starts with less than 1 GiB free in its output filesystem.
89
+ Finalisation can temporarily overshoot the polling threshold: report this as a
90
+ soft bound, reject oversized final output and remove it. No symlink traversal.
91
+ Apply restrictive permissions recursively before returning validated output.
92
+ Instruments may contain system-wide metadata, paths, symbols, logs and signposts
93
+ despite app attachment. Disclose this in tool/skill documentation. No upload,
94
+ telemetry or permission bypass, including `--no-prompt`. User handles any required
95
+ OS permissions outside the tool.
96
+
97
+ ## Artifact and journey evidence
98
+
99
+ Require successful recorder exit, nonempty bounded output, parseable
100
+ `xctrace export --toc`, matching target/app/template metadata, expected
101
+ `time-sample` schema and successful table export. Record row count, including zero;
102
+ zero samples means no CPU sample evidence, not diagnosed inactivity. Do not call
103
+ a failed recording valid merely because a readable partial bundle exists.
104
+ Expose warnings and unavailable instruments; do not claim symbolication unless
105
+ verified. Validation exports are private temporary data removed after validation.
106
+
107
+ Keep `run_journey.systemTraceId` explicit. Validate active same-server,
108
+ same-platform/same-UDID session before any journey input. Link journey and step
109
+ evidence through existing trace context and correlation IDs. The trace pins the
110
+ profiled app; journey actions retain their existing targeting semantics and may
111
+ leave that app. Report that limitation. Duration expiry or stop during the journey
112
+ means partial coverage. Host capture bounds and unknown device-clock alignment
113
+ establish association only; no device markers or causal inference.
114
+
115
+ ## Acceptance and verification
116
+
117
+ 1. Capability matrix and rejected inputs are side-effect-free, with exact target
118
+ and actionable prerequisite reasons; unknown permissions stay unknown.
119
+ 2. Updated-server simulator Time Profiler start → existing fixture journey tapping
120
+ Show loader and asserting Done → stop yields matching IDs, target/app metadata,
121
+ notification-before-input evidence, readable bundle and exported sample rows.
122
+ 3. Deterministic checks cover stale/mismatched IDs preventing all input, ownership,
123
+ concurrency, expiry, cancellation, partial coverage, disconnect, identity races,
124
+ notification/start/stop/export/storage failures, retries and shutdown cleanup.
125
+ 4. Real simulator checks cover explicit stop, expiry, cancellation and failed
126
+ journey; unavailable physical/failure-injection evidence is separate from mocks.
127
+ 5. Existing Android traces and untraced journeys pass regression checks. Run
128
+ `npm run verify`, applicable `npm run test:device`, and focused updated-server
129
+ calls; report actual suite coverage and unrun platforms.
130
+
131
+ Affected: trace sessions/adapters/types, schemas/registration/handlers, journey and
132
+ evidence integration, shutdown, tests/goldens, tool docs, README, changelog and
133
+ packaged usage skill. Main implementation risks remain notification readiness,
134
+ reliable app identity resolution and finalisation deadlines; feasibility probes
135
+ do not establish these acceptance criteria.
@@ -0,0 +1,176 @@
1
+ {
2
+ "date": "2026-11-04",
3
+ "status": "PASS",
4
+ "transport": "MCP stdio",
5
+ "runtime": "v23.11.0",
6
+ "deviceId": "F9243BAF-62A8-4990-8A99-17F527F56FDA",
7
+ "server_sha256": "6a00a33d994a449ecbb54d5dbf894780f48a1c0e5a89fc871b91dd7048f4ecdc",
8
+ "source_sha256": "295ff0f30f5670530f9cdd7073b958917c1c574ccca9c7b921e295d0d902b699",
9
+ "xcode": "Xcode 27.2\nBuild version 27B52",
10
+ "lldb": "lldb-2103.0.34.407\nApple Swift version 6.4.2 (swiftlang-6.4.2.1.9 clang-2100.4.1.1)",
11
+ "fixture": "test/fixtures/ios-debugger-app/Main.swift",
12
+ "fixture_triggers": "Atomic command file; installed idb HID backend unavailable; not proof of successful MCP tap injection",
13
+ "extended_pause_expiry": true,
14
+ "process_exit": true,
15
+ "server_shutdown_recovery": true,
16
+ "tests_sha256": "37fbda265b5735b1b826aa448aa937359c45db0e55f8f1998a169b1aa3073acc",
17
+ "observations": [
18
+ {
19
+ "reason": "breakpoint",
20
+ "line": 49,
21
+ "method": "DebuggerFixture.Controller.calculate() -> ()"
22
+ },
23
+ {
24
+ "reason": "step",
25
+ "line": 8,
26
+ "method": "DebuggerFixture.helper(Swift.Int) -> Swift.Int"
27
+ },
28
+ {
29
+ "reason": "step",
30
+ "line": 9,
31
+ "method": "DebuggerFixture.helper(Swift.Int) -> Swift.Int"
32
+ },
33
+ {
34
+ "reason": "step",
35
+ "line": 49,
36
+ "method": "DebuggerFixture.Controller.calculate() -> ()"
37
+ },
38
+ {
39
+ "reason": "breakpoint",
40
+ "line": 20,
41
+ "method": "(1) suspend resume partial function for DebuggerFixture.AsyncWork.calculate(Swift.Int) async -> Swift.Int"
42
+ },
43
+ {
44
+ "reason": "breakpoint",
45
+ "line": 21,
46
+ "method": "(3) suspend resume partial function for DebuggerFixture.AsyncWork.calculate(Swift.Int) async -> Swift.Int"
47
+ },
48
+ {
49
+ "reason": "breakpoint",
50
+ "line": 20,
51
+ "method": "(1) suspend resume partial function for DebuggerFixture.AsyncWork.calculate(Swift.Int) async -> Swift.Int"
52
+ },
53
+ {
54
+ "reason": "step",
55
+ "line": 21,
56
+ "method": "(3) suspend resume partial function for DebuggerFixture.AsyncWork.calculate(Swift.Int) async -> Swift.Int"
57
+ },
58
+ {
59
+ "reason": "breakpoint",
60
+ "line": 66,
61
+ "method": "(3) suspend resume partial function for closure #1 () async -> () in DebuggerFixture.Controller.startCancellation() -> ()"
62
+ },
63
+ {
64
+ "reason": "breakpoint",
65
+ "line": 49,
66
+ "method": "DebuggerFixture.Controller.calculate() -> ()"
67
+ },
68
+ {
69
+ "reason": "breakpoint",
70
+ "line": 49,
71
+ "method": "DebuggerFixture.Controller.calculate() -> ()"
72
+ }
73
+ ],
74
+ "locals": [
75
+ [
76
+ {
77
+ "name": "known",
78
+ "type": "Swift.Int",
79
+ "value": "41"
80
+ }
81
+ ],
82
+ [
83
+ {
84
+ "name": "seed",
85
+ "type": "Swift.Int",
86
+ "value": "42"
87
+ },
88
+ {
89
+ "name": "known",
90
+ "type": "Swift.Int",
91
+ "value": "42"
92
+ }
93
+ ],
94
+ [
95
+ {
96
+ "name": "seed",
97
+ "type": "Swift.Int",
98
+ "value": "42"
99
+ },
100
+ {
101
+ "name": "known",
102
+ "type": "Swift.Int",
103
+ "value": "42"
104
+ },
105
+ {
106
+ "name": "after",
107
+ "type": "Swift.Int",
108
+ "value": "43"
109
+ }
110
+ ],
111
+ [
112
+ {
113
+ "name": "cancelled",
114
+ "type": "Swift.Bool",
115
+ "value": "true"
116
+ }
117
+ ]
118
+ ],
119
+ "async_boundary_step": {
120
+ "expected_line": 21,
121
+ "observed": {
122
+ "source_file": "test/fixtures/ios-debugger-app/Main.swift",
123
+ "line": 21,
124
+ "method_name": "(3) suspend resume partial function for DebuggerFixture.AsyncWork.calculate(Swift.Int) async -> Swift.Int",
125
+ "class_name": null
126
+ }
127
+ },
128
+ "assertions": [
129
+ "Exact source binding and pending source creation",
130
+ "Known primitive locals",
131
+ "Into/over/out",
132
+ "Stop/frame stale rejection",
133
+ "Paused tap rejected before dispatch",
134
+ "Paused readiness without UI acquisition",
135
+ "Cancelled event wait preserves session",
136
+ "Before/after await values and nested async child",
137
+ "Step over await reaches after-await source line",
138
+ "Task cancellation and fresh Task cancelled UI",
139
+ "Real 60-second pause expiry and fresh result UI",
140
+ "Target self-exit, disconnected state and complete cleanup",
141
+ "Idempotent detach with no remaining resources",
142
+ "Server shutdown while paused then independent UI recovery"
143
+ ],
144
+ "unrun": [
145
+ "physical iOS devices",
146
+ "other Xcode/Swift versions",
147
+ "optimized apps",
148
+ "installed/published package",
149
+ "forced host termination",
150
+ "real device disconnect",
151
+ "live idle/absolute expiry",
152
+ "late-loaded-image binding"
153
+ ],
154
+ "scope": "Focused real MCP iOS simulator debugger journey, including extended pause expiry",
155
+ "repository_verification": {
156
+ "status": "PASS",
157
+ "unit_files": 96,
158
+ "command": "npm run verify"
159
+ },
160
+ "broader_device_suite": {
161
+ "status": "FAIL",
162
+ "observations": [
163
+ "Initial Android interaction SDK timeout; isolated unchanged retry passed",
164
+ "Retry failed Android Perfetto shutdown-artifact assertion; isolated baseline and current checks passed"
165
+ ],
166
+ "root_cause": "unestablished",
167
+ "full_suite_pass_claimed": false
168
+ },
169
+ "cleanup": {
170
+ "ios_simulator": "restored to initial shutdown state",
171
+ "swift_fixture_build_directories_remaining": 0,
172
+ "owned_adb_forwards_remaining": 0,
173
+ "owned_perfetto_artifacts_remaining": 0,
174
+ "unrelated_installed_fixtures": "preserved"
175
+ }
176
+ }
@@ -0,0 +1,38 @@
1
+ # iOS runtime debugger — intent
2
+
3
+ - Source: [issue #70](https://github.com/clivejefferies/mobile-debug-tools/issues/70), and the user's 2026-11-04 request to take the next Ready ticket with Android-equivalent functionality, including async debugging.
4
+ - Originator: user in this chat.
5
+ - Captured: 2026-11-04.
6
+ - Status: intent approved by the user's “ok” on 2026-11-04 in response to the scope and approval request in this chat. Specification also approved in this chat on 2026-11-04; see spec.md. Issue #70 matches the roadmap and current branch; Ready-column membership could not be checked because GitHub authentication lacks `read:project`.
7
+
8
+ ## Problem and outcome
9
+
10
+ MCP clients can debug Android development apps but lack equivalent iOS runtime
11
+ inspection. Add an LLDB-backed debugger for iOS simulator development apps,
12
+ reusing the existing debugger tools and session/evidence conventions where
13
+ appropriate. Support attach, source breakpoints and events, bounded stacks and
14
+ shallow locals, stepping, resume and detach, with explicit capabilities and
15
+ actionable setup failures.
16
+
17
+ ## Async parity and success
18
+
19
+ Verify a deterministic Swift concurrency fixture with source stops and useful
20
+ locals before and after `await`, resumed execution, nested task work, task
21
+ cancellation and application recovery. Assess stepping across suspension and
22
+ report its observed limits. Android's existing coroutine assessment establishes
23
+ execution inspection, not reconstruction of suspended tasks or logical async
24
+ stacks; distinguish those capabilities explicitly on iOS too.
25
+
26
+ Preserve stale-reference rejection, pause-aware interaction guards, bounded
27
+ waits/cancellation, session isolation, expiry and owned cleanup. Prove the journey
28
+ through actual MCP calls and independent fixture outcomes, and retain Android
29
+ regression coverage. Report unavailable environments honestly.
30
+
31
+ ## Constraints and questions
32
+
33
+ Physical-device support follows separately. Evaluation, mutation, arbitrary LLDB
34
+ commands and generic suspended-task reconstruction are excluded from this initial
35
+ scope. Inspect LLDB/Xcode support for async frames and stepping before proposing
36
+ the exact capability contract. Debug values remain bounded and sensitive; avoid
37
+ persisting app data in public evidence. Specification approval follows intent
38
+ acceptance under the repository process.
@@ -0,0 +1,95 @@
1
+ # iOS runtime debugger — implementation and verification
2
+
3
+ Scope: [intent](intent.md) and [specification](spec.md), both approved by the user
4
+ on 2026-11-04. Use the repository MCP Builder and Test Authoring skills.
5
+
6
+ ## Implementation
7
+
8
+ - [x] Establish LLDB Python loading and explicit simulator/process attribution.
9
+ - [x] Add structured LLDB worker, safe inspection, exact breakpoints and watchdogs.
10
+ - [x] Reuse session lifecycle with platform-specific native/worker configuration;
11
+ update schemas, dispatch, diagnostics, guards and readiness.
12
+ - [x] Add deterministic Swift simulator fixture and MCP runtime/async journeys.
13
+ - [x] Add contract, identity, lifecycle and guard regression tests; update tool
14
+ compatibility golden only for approved schema changes.
15
+ - [x] Align debugger guide, tool reference, README, changelog and packaging.
16
+ - [x] Review diff, execute required verification and record actual results below.
17
+ Full-suite success remains unestablished; see the failed checks below.
18
+
19
+ ## Verification matrix
20
+
21
+ | Spec criterion | Check |
22
+ | --- | --- |
23
+ | Core runtime flow | `MCP_IOS_DEBUGGER_DEVICE=<UDID> node --import tsx test/device/automated/debugger/runtime.ios.test.ts` through built stdio server |
24
+ | Async/cancellation | Same journey with controlled before/after-await values, nested work, cancellation and fresh UI assertions; separate step-boundary result |
25
+ | Identity, failure, references and guards | Focused `test/unit/debugger/*.test.ts`, simulator invalid PID/foreign target, stale frame/stop, guarded input/readiness, event cancellation and detach |
26
+ | Expiry and shutdown | Worker watchdog unit checks plus real pause expiry and server EOF cleanup in fixture journey |
27
+ | Contract/Android regression | `npm run verify`; existing runtime, Kotlin and coroutine Android MCP checks on explicit emulator |
28
+ | Broader device compatibility | `npm run test:device` with selected targets; report the actual covered platforms and skipped prerequisites |
29
+
30
+ Required: Node 22+, installed Xcode 27.2/Swift 6.4.2/LLDB 2103.0.34.407,
31
+ simulator runtime, development fixture compiled with debug metadata and no
32
+ optimisation. Android regressions require existing JDK/SDK/Kotlin dependencies.
33
+ No physical-device iOS support is claimed. Hosted CI is separate from local checks.
34
+
35
+ Select existing simulator F9243BAF-62A8-4990-8A99-17F527F56FDA (iPhone 17 Pro,
36
+ iOS 26.4), initially shut down. Boot it for the fixture; preserve existing apps
37
+ and settings, install/remove only fixture-owned app/build files, detach owned
38
+ debuggers, and restore the initial shutdown state. Record exact server/fixture
39
+ hashes, observed stops/locals, independent UI state and cleanup. Simulator access
40
+ requires outside-sandbox native commands; the authorised inventory read succeeded.
41
+ If a prerequisite is unavailable, retain the acceptance criterion and record a
42
+ concrete blocker. Do not treat mock/native readiness checks as live verification.
43
+
44
+ ## Results
45
+
46
+ - **PASS** `npm run verify`: lint/quality/architecture, build, all 96 unit files,
47
+ plugin consistency, Node 23.11.0. Log `/tmp/ios-debugger-final-verify.log`.
48
+ - **PASS** `MCP_IOS_DEBUGGER_DEVICE=F9243BAF-62A8-4990-8A99-17F527F56FDA MCP_IOS_DEBUGGER_EXTENDED=1 node --import tsx test/device/automated/debugger/runtime.ios.test.ts`.
49
+ Exact stable-build hash, stops, locals and asserted cleanup/recovery are in
50
+ [evidence.json](evidence.json). No HID success is inferred from fixture control.
51
+ - **PASS** focused Android runtime, Kotlin locals and coroutine MCP regressions
52
+ using the existing fixture/compiler dependencies. The broader suite also reran
53
+ the final Android runtime debugger successfully.
54
+ - **PASS** unchanged standalone iOS screenshot, log and UI-tree smoke checks.
55
+ - **PASS** package dry-run contents, plugin generation/consistency and diff/link
56
+ checks. No publication or installed-package verification occurred.
57
+ - **FAIL** broader `ADB_PATH=/Users/clivejefferies/Library/Android/sdk/platform-tools/adb MCP_DEBUGGER_DEVICE=emulator-5554 npm run test:device`: initial Android
58
+ interaction request timeout; focused unchanged retry passed. The full-suite
59
+ retry passed that branch and both-platform observations/correlated evidence,
60
+ then failed Android Perfetto active-shutdown artifact removal. The isolated
61
+ Perfetto check passed on both unchanged HEAD and current build. These failures
62
+ remain unreproduced and unexplained; no full-suite pass is claimed.
63
+ - Full-suite opt-in Kotlin/coroutine/iOS debugger checks were **UNRUN** in that
64
+ invocation; each passed its separate focused run above. iOS system tracing was
65
+ **UNRUN** (no `IOS_SYSTEM_TRACE_DEVICE` supplied); it is outside this feature.
66
+ - **PASS** owned cleanup: no MCP device trace files or ADB forwards remained;
67
+ debugger/coroutine packages and Swift build directories removed. Unrelated
68
+ fixtures preserved; iOS simulator restored to shutdown; Android emulator left
69
+ running. Temporary baseline source/build copy removed.
70
+
71
+ See [verification report](report.md) for evidence boundaries, resolved findings,
72
+ unrun variants and original failed observations.
73
+
74
+
75
+ ## PR #103 review repair
76
+
77
+ - [x] Cache shared iOS preparation and reset rejected preparation for retry.
78
+ - [x] Add fake-toolchain coverage for concurrent reuse, retry and worker creation.
79
+ - [x] Check real Xcode cached preparation and rerun the focused iOS MCP journey.
80
+ - [x] Complete quiet repository verification (97 unit files); publish the repair to PR #103.
81
+
82
+ See the [report follow-up](report.md#pr-103-preparation-cache-follow-up--2026-11-04)
83
+ for exact evidence and retained broader-suite limitations.
84
+
85
+
86
+ ## PR #103 stored-handle pause guard repair
87
+
88
+ - [x] Validate guard targets through the stored-handle execution lookup.
89
+ - [x] Cover omitted/partial hints, known/racing pauses, platform/device isolation,
90
+ and explicit mismatches; prove regression detects the original route.
91
+ - [x] Run `npm run verify` (98 unit files) and the updated real iOS MCP journey.
92
+ - [x] Restore fixture/device state and prepare the narrow repair for PR publication.
93
+
94
+ The finding is in an outside-diff review summary, with no new inline thread to
95
+ resolve. See the [report](report.md) for exact evidence and retained limitations.