mobile-debug-mcp 0.33.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.
- package/.agents/skills/mcp-builder/SKILL.md +44 -64
- package/.agents/skills/mcp-builder/references/build-flags.md +44 -43
- package/.agents/skills/mcp-builder/references/diagnostics-schema.md +4 -1
- package/.agents/skills/mcp-builder/references/toolchain-details.md +49 -62
- package/.agents/skills/spec-review/references/spec-review-checklist.md +7 -0
- package/.agents/skills/test-authoring/SKILL.md +7 -6
- package/.agents/skills/test-authoring/references/repo-test-layout.md +3 -1
- package/.agents/skills/test-authoring/references/test-authoring-workflow.md +16 -7
- package/.agents/skills/test-authoring/references/test-quality-checklist.md +2 -1
- package/.github/copilot-instructions.md +14 -36
- package/.github/workflows/ci.yml +23 -2
- package/AGENTS.md +12 -3
- package/CONTRIBUTING.md +79 -0
- package/README.md +158 -124
- package/agent-plugin/.claude-plugin/plugin.json +2 -2
- package/agent-plugin/.codex-plugin/plugin.json +1 -1
- package/agent-plugin/.cursor-plugin/plugin.json +2 -2
- package/agent-plugin/.mcp.json +1 -1
- package/agent-plugin/README.md +20 -6
- package/agent-plugin/mcp.json +1 -1
- package/agent-plugin/plugin.json +1 -1
- package/agent-plugin/skills/mobile-debug-mcp/SKILL.md +113 -4
- package/dist/contracts/execution-controls.js +24 -0
- package/dist/contracts/selector.js +8 -0
- package/dist/contracts/target.js +15 -0
- package/dist/contracts/ui.js +1 -0
- package/dist/debugger/android.js +79 -0
- package/dist/debugger/diagnostics.js +54 -0
- package/dist/debugger/guard.js +30 -0
- package/dist/debugger/protocol.js +33 -0
- package/dist/debugger/sessions.js +304 -0
- package/dist/debugger/worker.js +176 -0
- package/dist/interact/adjustment/adjustment-context.js +41 -0
- package/dist/interact/adjustment/adjustment-gestures.js +55 -0
- package/dist/interact/adjustment/adjustment-plan.js +18 -0
- package/dist/interact/adjustment/adjustment-resolution.js +127 -0
- package/dist/interact/adjustment/adjustment-result.js +19 -0
- package/dist/interact/adjustment/adjustment-semantic.js +64 -0
- package/dist/interact/adjustment/adjustment-verification.js +35 -0
- package/dist/interact/adjustment/adjustment.js +52 -0
- package/dist/interact/adjustment/control-geometry.js +87 -0
- package/dist/interact/adjustment/control-values.js +136 -0
- package/dist/interact/adjustment/slider-labels.js +84 -0
- package/dist/interact/assertions/screen-assertion.js +37 -0
- package/dist/interact/assertions/state-assertion-context.js +35 -0
- package/dist/interact/assertions/state-assertion.js +76 -0
- package/dist/interact/assertions/state-comparison.js +141 -0
- package/dist/interact/assertions/visibility-assertion.js +34 -0
- package/dist/interact/conditional-action.js +12 -7
- package/dist/interact/index.js +65 -3074
- package/dist/interact/input-service.js +1 -0
- package/dist/interact/interaction-trace.js +21 -0
- package/dist/interact/model.js +1 -0
- package/dist/interact/observation.js +1 -0
- package/dist/interact/targeting/candidate-ancestor.js +58 -0
- package/dist/interact/targeting/candidate-result.js +23 -0
- package/dist/interact/targeting/candidate-scoring.js +50 -0
- package/dist/interact/targeting/element-helpers.js +216 -0
- package/dist/interact/targeting/find-element.js +65 -0
- package/dist/interact/targeting/nearby-control.js +56 -0
- package/dist/interact/targeting/resolved-elements.js +21 -0
- package/dist/interact/targeting/tap-target.js +17 -0
- package/dist/interact/targeting/target-scope.js +104 -0
- package/dist/interact/waits/legacy-log-wait.js +38 -0
- package/dist/interact/waits/legacy-wait-observations.js +103 -0
- package/dist/interact/waits/legacy-wait-state.js +34 -0
- package/dist/interact/waits/legacy-wait.js +48 -0
- package/dist/interact/waits/screen-wait.js +49 -0
- package/dist/interact/waits/ui-change-helpers.js +157 -0
- package/dist/interact/waits/ui-change-state.js +18 -0
- package/dist/interact/waits/ui-change-wait.js +77 -0
- package/dist/interact/waits/ui-wait-condition.js +56 -0
- package/dist/interact/waits/ui-wait-state.js +38 -0
- package/dist/interact/waits/ui-wait.js +106 -0
- package/dist/manage/android.js +55 -51
- package/dist/manage/index.js +38 -75
- package/dist/manage/ios/build-types.js +1 -0
- package/dist/manage/ios/build.js +210 -0
- package/dist/manage/ios/project-discovery.js +29 -0
- package/dist/manage/ios/scheme.js +18 -0
- package/dist/manage/ios.js +42 -256
- package/dist/observe/android/context.js +1 -0
- package/dist/observe/android/current-screen.js +55 -0
- package/dist/observe/android/fingerprint.js +13 -0
- package/dist/observe/android/log-stream.js +132 -0
- package/dist/observe/android/logs.js +107 -0
- package/dist/observe/android/screenshot.js +70 -0
- package/dist/observe/android/ui-tree.js +107 -0
- package/dist/observe/android.js +16 -520
- package/dist/observe/evidence.js +122 -76
- package/dist/observe/index.js +16 -263
- package/dist/observe/ios/context.js +16 -0
- package/dist/observe/ios/fingerprint.js +12 -0
- package/dist/observe/ios/log-stream.js +105 -0
- package/dist/observe/ios/logs.js +168 -0
- package/dist/observe/ios/screenshot.js +22 -0
- package/dist/observe/ios/ui-elements.js +241 -0
- package/dist/observe/ios/ui-tree.js +137 -0
- package/dist/observe/ios.js +17 -715
- package/dist/observe/logs/model.js +1 -0
- package/dist/{network → observe/network}/index.js +2 -2
- package/dist/observe/readiness-service.js +13 -2
- package/dist/observe/readiness.js +44 -18
- package/dist/observe/screenshot-encoding.js +41 -0
- package/dist/observe/snapshot-collection.js +79 -0
- package/dist/observe/snapshot-logs.js +30 -0
- package/dist/observe/snapshot-metadata.js +43 -31
- package/dist/observe/snapshot-semantic.js +115 -0
- package/dist/observe/system-trace-android.js +135 -0
- package/dist/observe/system-trace.js +294 -0
- package/dist/runtime/action-results.js +270 -0
- package/dist/runtime/clock.js +4 -0
- package/dist/server/common.js +1 -256
- package/dist/server/definitions/assert.js +162 -0
- package/dist/server/definitions/diagnostic.js +118 -0
- package/dist/server/definitions/input.js +274 -0
- package/dist/server/definitions/manage.js +194 -0
- package/dist/server/definitions/observe.js +149 -0
- package/dist/server/definitions/target.js +138 -0
- package/dist/server/definitions/wait.js +105 -0
- package/dist/server/handlers/action-execution.js +163 -0
- package/dist/server/handlers/correlation.js +23 -0
- package/dist/server/handlers/debugger-handlers.js +48 -0
- package/dist/server/handlers/debugger-response.js +9 -0
- package/dist/server/handlers/diagnostic.js +69 -0
- package/dist/server/handlers/handler-types.js +1 -0
- package/dist/server/handlers/input.js +154 -0
- package/dist/server/handlers/interact.js +113 -0
- package/dist/server/handlers/journey-assertions.js +35 -0
- package/dist/server/handlers/journey.js +147 -0
- package/dist/server/handlers/manage.js +119 -0
- package/dist/server/handlers/observe.js +95 -0
- package/dist/server/handlers/payload.js +4 -0
- package/dist/server/handlers/tool-handlers.js +160 -0
- package/dist/server/schemas/condition-schema.js +2 -0
- package/dist/server/schemas/debugger-schema.js +47 -0
- package/dist/server/{journey-schema.js → schemas/journey-schema.js} +8 -22
- package/dist/server/schemas/system-trace-schema.js +17 -0
- package/dist/server/tool-definitions.js +62 -1134
- package/dist/server-core.js +4 -4
- package/dist/server.js +34 -0
- package/dist/system/android-status.js +101 -0
- package/dist/system/android.js +37 -27
- package/dist/system/index.js +13 -438
- package/dist/system/ios-status.js +132 -0
- package/dist/system/ios.js +11 -8
- package/dist/system/model.js +1 -0
- package/dist/system/probes.js +105 -0
- package/dist/system/status-summary.js +43 -0
- package/dist/system/unsupported-status.js +52 -0
- package/dist/utils/android/commands.js +89 -0
- package/dist/utils/android/gradle.js +139 -0
- package/dist/utils/android/logs.js +103 -0
- package/dist/utils/android/ui-tree.js +233 -0
- package/dist/utils/android/utils.js +6 -564
- package/dist/utils/cli/idb/idb-helper.js +4 -6
- package/dist/utils/cli/idb/install-idb.js +13 -9
- package/dist/utils/cli/ios/preflight-ios.js +42 -38
- package/dist/utils/exec.js +2 -0
- package/dist/utils/ios/utils.js +45 -46
- package/dist/utils/java.js +75 -57
- package/dist/utils/operation-budget.js +2 -0
- package/dist/utils/resolve-device.js +6 -2
- package/dist/utils/ui/index.js +26 -26
- package/docs/CHANGELOG.md +48 -0
- package/docs/README.md +38 -0
- package/docs/benchmarks/README.md +18 -0
- package/docs/benchmarks/interaction-latency/README.md +14 -0
- package/docs/benchmarks/interaction-latency/final.md +4 -1
- package/docs/benchmarks/interaction-latency/ios-validation.md +2 -0
- package/docs/benchmarks/ui-tree-performance/README.md +24 -16
- package/docs/benchmarks/ui-tree-performance/comparison.md +11 -10
- package/docs/code-structure.md +118 -0
- package/docs/specs/001-state-verification/spec.md +16 -14
- package/docs/specs/002-richer-element-identity/spec.md +12 -10
- package/docs/specs/003-wait-and-synchronization-reliability/spec.md +12 -10
- package/docs/specs/004-action-verification-routing/spec.md +3 -3
- package/docs/specs/005-unified-action-execution-and-verification-model/spec.md +2 -0
- package/docs/specs/006-runtime-action-instrumentation-and-binding-layer/spec.md +2 -0
- package/docs/specs/007-actionability-resolution-and-executable-target-selection/spec.md +3 -1
- package/docs/specs/008-adjustable-control-support-and-semantic-value-manipulation/spec.md +3 -4
- package/docs/specs/009-semantic-control-modeling-for-custom-and-composite-controls/spec.md +2 -0
- package/docs/specs/010-verification-stabilization-and-temporal-convergence/spec.md +2 -2
- package/docs/specs/011-recovery-and-replanning-for-failed-or-ambiguous-interaction-flows/spec.md +2 -2
- package/docs/specs/011.1-recovery-contract-types-and-runtime-wiring-spec/spec.md +2 -0
- package/docs/specs/012-action-trace-and-xecution-observability/spec.md +2 -3
- package/docs/specs/013-wait-and-synchronization-reliability/spec.md +19 -19
- package/docs/specs/014-actionability-resolution/spec.md +20 -18
- package/docs/specs/015-adjustable-control-support/spec.md +17 -15
- package/docs/specs/016-environment-tools/spec.md +20 -20
- package/docs/specs/018-interaction-latency-and-batched-journeys/spec.md +2 -0
- package/docs/specs/019-ui-tree-observation-performance/spec.md +3 -1
- package/docs/specs/020-conditional-actions/intent.md +5 -3
- package/docs/specs/020-conditional-actions/plan.md +8 -9
- package/docs/specs/020-conditional-actions/spec.md +4 -2
- package/docs/specs/021-app-readiness-signals/intent.md +4 -2
- package/docs/specs/021-app-readiness-signals/plan.md +7 -6
- package/docs/specs/021-app-readiness-signals/spec.md +3 -1
- package/docs/specs/022-correlated-evidence/intent.md +4 -4
- package/docs/specs/022-correlated-evidence/plan.md +10 -11
- package/docs/specs/022-correlated-evidence/spec.md +3 -1
- package/docs/specs/023-android-system-traces/device-evidence.json +38 -0
- package/docs/specs/023-android-system-traces/emulator-recheck.json +38 -0
- package/docs/specs/023-android-system-traces/intent.md +41 -0
- package/docs/specs/023-android-system-traces/plan.md +115 -0
- package/docs/specs/023-android-system-traces/spec.md +122 -0
- package/docs/specs/024-android-heap-dump-capture/intent.md +41 -0
- package/docs/specs/025-android-runtime-debugger/intent.md +41 -0
- package/docs/specs/025-android-runtime-debugger/plan.md +106 -0
- package/docs/specs/025-android-runtime-debugger/spec.md +183 -0
- package/docs/specs/026-code-structure-and-quality-gates/health-plan.md +88 -0
- package/docs/specs/026-code-structure-and-quality-gates/intent.md +47 -0
- package/docs/specs/026-code-structure-and-quality-gates/plan.md +191 -0
- package/docs/specs/026-code-structure-and-quality-gates/spec.md +138 -0
- package/docs/specs/026-code-structure-and-quality-gates/verification-final.json +200 -0
- package/docs/specs/026-code-structure-and-quality-gates/verification-thin-facade.json +154 -0
- package/docs/specs/026-code-structure-and-quality-gates/verification.json +136 -0
- package/docs/specs/027-debugger-failure-diagnostics/intent.md +43 -0
- package/docs/specs/027-debugger-failure-diagnostics/plan.md +86 -0
- package/docs/specs/027-debugger-failure-diagnostics/spec.md +133 -0
- package/docs/specs/028-compact-debugger-responses/intent.md +41 -0
- package/docs/specs/028-compact-debugger-responses/plan.md +112 -0
- package/docs/specs/028-compact-debugger-responses/spec.md +108 -0
- package/docs/specs/029-kotlin-locals-validation/report.md +119 -0
- package/docs/specs/030-android-coroutine-validation/evidence.json +475 -0
- package/docs/specs/030-android-coroutine-validation/intent.md +47 -0
- package/docs/specs/030-android-coroutine-validation/plan.md +147 -0
- package/docs/specs/030-android-coroutine-validation/report.md +240 -0
- package/docs/specs/030-android-coroutine-validation/spec.md +107 -0
- package/docs/tools/TOOLS.md +31 -16
- package/docs/tools/{evidence.md → correlated-evidence.md} +14 -3
- package/docs/tools/debugger.md +180 -0
- package/docs/tools/interact.md +42 -20
- package/docs/tools/manage.md +25 -44
- package/docs/tools/observe.md +64 -25
- package/docs/tools/system-traces.md +134 -0
- package/docs/tools/system.md +12 -5
- package/package.json +11 -8
- package/scripts/architecture-graph.mjs +69 -0
- package/scripts/check-architecture.mjs +47 -0
- package/scripts/code-quality-baseline.json +1 -0
- package/scripts/code-quality.mjs +161 -0
- package/src/contracts/execution-controls.ts +26 -0
- package/src/contracts/selector.ts +17 -0
- package/src/contracts/target.ts +19 -0
- package/src/contracts/ui.ts +94 -0
- package/src/debugger/android.ts +66 -0
- package/src/debugger/diagnostics.ts +43 -0
- package/src/debugger/guard.ts +31 -0
- package/src/debugger/java/DebuggerWorker.java +166 -0
- package/src/debugger/protocol.ts +37 -0
- package/src/debugger/sessions.ts +327 -0
- package/src/debugger/worker.ts +135 -0
- package/src/interact/adjustment/adjustment-context.ts +83 -0
- package/src/interact/adjustment/adjustment-gestures.ts +48 -0
- package/src/interact/adjustment/adjustment-plan.ts +23 -0
- package/src/interact/adjustment/adjustment-resolution.ts +104 -0
- package/src/interact/adjustment/adjustment-result.ts +34 -0
- package/src/interact/adjustment/adjustment-semantic.ts +53 -0
- package/src/interact/adjustment/adjustment-verification.ts +60 -0
- package/src/interact/adjustment/adjustment.ts +49 -0
- package/src/interact/adjustment/control-geometry.ts +120 -0
- package/src/interact/adjustment/control-values.ts +141 -0
- package/src/interact/adjustment/slider-labels.ts +84 -0
- package/src/interact/assertions/screen-assertion.ts +39 -0
- package/src/interact/assertions/state-assertion-context.ts +48 -0
- package/src/interact/assertions/state-assertion.ts +64 -0
- package/src/interact/assertions/state-comparison.ts +168 -0
- package/src/interact/assertions/visibility-assertion.ts +41 -0
- package/src/interact/conditional-action.ts +18 -12
- package/src/interact/index.ts +76 -3491
- package/src/interact/input-service.ts +11 -0
- package/src/interact/interaction-trace.ts +36 -0
- package/src/interact/model.ts +109 -0
- package/src/interact/observation.ts +7 -0
- package/src/interact/targeting/candidate-ancestor.ts +49 -0
- package/src/interact/targeting/candidate-result.ts +24 -0
- package/src/interact/targeting/candidate-scoring.ts +42 -0
- package/src/interact/targeting/element-helpers.ts +243 -0
- package/src/interact/targeting/find-element.ts +47 -0
- package/src/interact/targeting/nearby-control.ts +46 -0
- package/src/interact/targeting/resolved-elements.ts +20 -0
- package/src/interact/targeting/tap-target.ts +22 -0
- package/src/interact/targeting/target-scope.ts +121 -0
- package/src/interact/waits/legacy-log-wait.ts +30 -0
- package/src/interact/waits/legacy-wait-observations.ts +55 -0
- package/src/interact/waits/legacy-wait-state.ts +48 -0
- package/src/interact/waits/legacy-wait.ts +34 -0
- package/src/interact/waits/screen-wait.ts +37 -0
- package/src/interact/waits/ui-change-helpers.ts +184 -0
- package/src/interact/waits/ui-change-state.ts +26 -0
- package/src/interact/waits/ui-change-wait.ts +59 -0
- package/src/interact/waits/ui-wait-condition.ts +52 -0
- package/src/interact/waits/ui-wait-state.ts +55 -0
- package/src/interact/waits/ui-wait.ts +84 -0
- package/src/manage/android.ts +56 -50
- package/src/manage/index.ts +63 -93
- package/src/manage/ios/build-types.ts +14 -0
- package/src/manage/ios/build.ts +230 -0
- package/src/manage/ios/project-discovery.ts +26 -0
- package/src/manage/ios/scheme.ts +16 -0
- package/src/manage/ios.ts +65 -298
- package/src/observe/android/context.ts +1 -0
- package/src/observe/android/current-screen.ts +63 -0
- package/src/observe/android/fingerprint.ts +13 -0
- package/src/observe/android/log-stream.ts +127 -0
- package/src/observe/android/logs.ts +110 -0
- package/src/observe/android/screenshot.ts +79 -0
- package/src/observe/android/ui-tree.ts +113 -0
- package/src/observe/android.ts +17 -531
- package/src/observe/evidence.ts +130 -71
- package/src/observe/index.ts +24 -286
- package/src/observe/ios/context.ts +22 -0
- package/src/observe/ios/fingerprint.ts +12 -0
- package/src/observe/ios/log-stream.ts +103 -0
- package/src/observe/ios/logs.ts +179 -0
- package/src/observe/ios/screenshot.ts +26 -0
- package/src/observe/ios/ui-elements.ts +266 -0
- package/src/observe/ios/ui-tree.ts +143 -0
- package/src/observe/ios.ts +18 -749
- package/src/observe/logs/model.ts +11 -0
- package/src/{network → observe/network}/index.ts +2 -2
- package/src/observe/readiness-service.ts +10 -3
- package/src/observe/readiness.ts +49 -22
- package/src/observe/screenshot-encoding.ts +32 -0
- package/src/observe/snapshot-collection.ts +69 -0
- package/src/observe/snapshot-logs.ts +26 -0
- package/src/observe/snapshot-metadata.ts +51 -31
- package/src/observe/snapshot-semantic.ts +153 -0
- package/src/observe/system-trace-android.ts +133 -0
- package/src/observe/system-trace.ts +227 -0
- package/src/runtime/action-results.ts +376 -0
- package/src/runtime/clock.ts +9 -0
- package/src/server/common.ts +9 -359
- package/src/server/definitions/assert.ts +164 -0
- package/src/server/definitions/diagnostic.ts +120 -0
- package/src/server/definitions/input.ts +276 -0
- package/src/server/definitions/manage.ts +196 -0
- package/src/server/definitions/observe.ts +151 -0
- package/src/server/definitions/target.ts +140 -0
- package/src/server/definitions/wait.ts +107 -0
- package/src/server/handlers/action-execution.ts +164 -0
- package/src/server/handlers/correlation.ts +20 -0
- package/src/server/handlers/debugger-handlers.ts +39 -0
- package/src/server/handlers/debugger-response.ts +7 -0
- package/src/server/handlers/diagnostic.ts +79 -0
- package/src/server/handlers/handler-types.ts +7 -0
- package/src/server/handlers/input.ts +173 -0
- package/src/server/handlers/interact.ts +135 -0
- package/src/server/handlers/journey-assertions.ts +39 -0
- package/src/server/handlers/journey.ts +132 -0
- package/src/server/handlers/manage.ts +141 -0
- package/src/server/handlers/observe.ts +116 -0
- package/src/server/handlers/payload.ts +36 -0
- package/src/server/handlers/tool-handlers.ts +159 -0
- package/src/server/schemas/condition-schema.ts +2 -0
- package/src/server/schemas/debugger-schema.ts +43 -0
- package/src/server/{journey-schema.ts → schemas/journey-schema.ts} +8 -22
- package/src/server/schemas/system-trace-schema.ts +17 -0
- package/src/server/tool-definitions.ts +69 -1140
- package/src/server-core.ts +4 -4
- package/src/server.ts +25 -1
- package/src/system/android-status.ts +124 -0
- package/src/system/android.ts +33 -21
- package/src/system/index.ts +21 -523
- package/src/system/ios-status.ts +147 -0
- package/src/system/ios.ts +14 -10
- package/src/system/model.ts +41 -0
- package/src/system/probes.ts +114 -0
- package/src/system/status-summary.ts +47 -0
- package/src/system/unsupported-status.ts +55 -0
- package/src/types.ts +16 -106
- package/src/utils/android/commands.ts +81 -0
- package/src/utils/android/gradle.ts +132 -0
- package/src/utils/android/logs.ts +103 -0
- package/src/utils/android/ui-tree.ts +239 -0
- package/src/utils/android/utils.ts +16 -556
- package/src/utils/cli/idb/check-idb.ts +4 -4
- package/src/utils/cli/idb/idb-helper.ts +6 -8
- package/src/utils/cli/idb/install-idb.ts +15 -9
- package/src/utils/cli/ios/preflight-ios.ts +39 -31
- package/src/utils/cli/ios/run-ios-ui-tree-tap.ts +4 -4
- package/src/utils/exec.ts +2 -0
- package/src/utils/ios/utils.ts +57 -61
- package/src/utils/java.ts +71 -51
- package/src/utils/operation-budget.ts +2 -0
- package/src/utils/resolve-device.ts +11 -6
- package/src/utils/ui/index.ts +28 -28
- package/test/device/automated/debugger/coroutine-lifecycle.ts +27 -0
- package/test/device/automated/debugger/coroutine-support.ts +140 -0
- package/test/device/automated/debugger/coroutine.android.test.ts +169 -0
- package/test/device/automated/debugger/kotlin.android.test.ts +127 -0
- package/test/device/automated/debugger/runtime.android.test.ts +219 -0
- package/test/device/automated/interact/interaction.android.test.ts +56 -0
- package/test/device/automated/observe/system-trace.smoke.ts +104 -0
- package/test/device/manual/interact/modul8_selector_tap.manual.ts +1 -1
- package/test/fixtures/contracts/tool-definitions.json +3536 -0
- package/test/fixtures/coroutine-app/MainActivity.kt +100 -0
- package/test/fixtures/coroutine-app/README.md +48 -0
- package/test/fixtures/coroutine-app/build.ts +35 -0
- package/test/fixtures/debugger-app/MainActivity.java +67 -0
- package/test/fixtures/debugger-app/MainActivity.kt +32 -0
- package/test/fixtures/debugger-app/NoLocals.java +7 -0
- package/test/fixtures/debugger-app/README.md +65 -0
- package/test/fixtures/debugger-app/build.ts +39 -0
- package/test/fixtures/latency-journey-app/README.md +2 -0
- package/test/fixtures/readiness-app/README.md +2 -0
- package/test/helpers/perfetto.ts +59 -0
- package/test/unit/debugger/coroutine-lifecycle.test.ts +43 -0
- package/test/unit/debugger/diagnostic-sessions.test.ts +67 -0
- package/test/unit/debugger/diagnostics.test.ts +80 -0
- package/test/unit/debugger/guards.test.ts +50 -0
- package/test/unit/debugger/native.test.ts +33 -0
- package/test/unit/debugger/preparation.test.ts +32 -0
- package/test/unit/debugger/protocol.test.ts +15 -0
- package/test/unit/debugger/sessions.test.ts +83 -0
- package/test/unit/interact/adjustment_service.test.ts +42 -0
- package/test/unit/interact/adjustment_verification.test.ts +35 -0
- package/test/unit/interact/clock_dependencies.test.ts +63 -0
- package/test/unit/interact/element_helpers.test.ts +19 -0
- package/test/unit/interact/legacy_wait_service.test.ts +17 -0
- package/test/unit/interact/state_comparison.test.ts +20 -0
- package/test/unit/interact/target_scope.test.ts +35 -0
- package/test/unit/network/get_network_activity.test.ts +1 -1
- package/test/unit/observe/readiness.test.ts +3 -1
- package/test/unit/observe/screenshot-encoding.test.ts +30 -0
- package/test/unit/observe/snapshot-logs.test.ts +14 -0
- package/test/unit/observe/system-trace-android.test.ts +52 -0
- package/test/unit/observe/system-trace.test.ts +166 -0
- package/test/unit/quality/architecture.test.ts +60 -0
- package/test/unit/quality/code-quality.test.ts +58 -0
- package/test/unit/quality/interaction_boundaries.test.ts +24 -0
- package/test/unit/server/conditional_actions.test.ts +1 -1
- package/test/unit/server/conditional_schema.test.ts +2 -2
- package/test/unit/server/debugger-response.test.ts +63 -0
- package/test/unit/server/system-trace.test.ts +64 -0
- package/test/unit/server/tool_definitions_parity.test.ts +8 -0
- package/dist/server/tool-handlers.js +0 -893
- package/docs/ROADMAP.md +0 -646
- package/docs/benchmarks/ui-tree-performance/bridge-probe.json +0 -29
- package/docs/benchmarks/ui-tree-performance/initial-baseline.json +0 -59560
- package/docs/specs/baseline-spec-v0.md +0 -312
- package/docs/specs/mcp-tooling-spec-v1.md +0 -446
- package/src/server/tool-handlers.ts +0 -923
- /package/dist/{server/condition-schema.js → contracts/condition.js} +0 -0
- /package/dist/server/{readiness-schema.js → schemas/readiness-schema.js} +0 -0
- /package/src/{server/condition-schema.ts → contracts/condition.ts} +0 -0
- /package/src/server/{readiness-schema.ts → schemas/readiness-schema.ts} +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Intent: Android runtime debugger
|
|
2
|
+
|
|
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.
|
|
6
|
+
Date: 2026-10-30. Status: approved.
|
|
7
|
+
Source: [issue #68](https://github.com/clivejefferies/mobile-debug-tools/issues/68), roadmap priority 5 of 9.
|
|
8
|
+
|
|
9
|
+
## Problem and outcome
|
|
10
|
+
|
|
11
|
+
MCP clients investigating incorrect Android app behaviour need runtime evidence
|
|
12
|
+
to test hypotheses: where execution stopped, how it got there, and the values
|
|
13
|
+
available at that point. Enable a bounded debugging session against an explicitly
|
|
14
|
+
selected debuggable app process on a specific Android device.
|
|
15
|
+
|
|
16
|
+
## Scope and success criteria
|
|
17
|
+
|
|
18
|
+
- Attach and detach, set source breakpoints, and report stop events.
|
|
19
|
+
- Inspect stacks and locals while paused; step and resume execution.
|
|
20
|
+
- Bind sessions to device/process identity and invalidate inspection references
|
|
21
|
+
when execution resumes or the session ends.
|
|
22
|
+
- Coordinate UI actions and verification with known debugger pauses.
|
|
23
|
+
- Report unsupported configurations and setup/runtime failures explicitly.
|
|
24
|
+
- On detach or failure, clean up only session-owned resources and handle
|
|
25
|
+
debugger-owned suspension explicitly.
|
|
26
|
+
- Verify the complete journey on a debuggable Android fixture.
|
|
27
|
+
|
|
28
|
+
## Exclusions and open decisions
|
|
29
|
+
|
|
30
|
+
Defer arbitrary expression evaluation, value mutation, coroutine reconstruction,
|
|
31
|
+
native debugging, iOS debugging, heap capture, and production-app enablement.
|
|
32
|
+
|
|
33
|
+
The ticket proposes an independently developed JDI worker. Specification must
|
|
34
|
+
validate that backend and establish prerequisites, MCP contracts, source/line
|
|
35
|
+
mapping limits, suspension policy, event delivery, timeouts, cancellation,
|
|
36
|
+
concurrency, crash recovery, privacy, and runnable fixture coverage.
|
|
37
|
+
|
|
38
|
+
## Approval
|
|
39
|
+
|
|
40
|
+
The user selected Android runtime debugger work with “ok, lets pick that up” and
|
|
41
|
+
approved the complete captured intent with “yes” on 2026-10-30 during design review. See the linked specification for its separate approval record.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Plan: Android runtime debugger
|
|
2
|
+
|
|
3
|
+
[Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Intent](intent.md) · [Specification](spec.md)
|
|
4
|
+
|
|
5
|
+
2026-10-30. [Intent](intent.md) and [spec](spec.md) explicitly approved by the
|
|
6
|
+
user's successive “yes” responses during design review. Implementation authorized.
|
|
7
|
+
|
|
8
|
+
## Implementation
|
|
9
|
+
|
|
10
|
+
- [x] Build optional JDK 17+ worker compilation/cache and bounded JSON-lines client.
|
|
11
|
+
- [x] Implement JDI attach, breakpoint events, bounded inspection, step/resume,
|
|
12
|
+
reference epochs, expiry and owned cleanup.
|
|
13
|
+
- [x] Implement explicit Android process identity/JDWP targeting and owned forwarding.
|
|
14
|
+
- [x] Register strict MCP contracts and serialize session transitions.
|
|
15
|
+
- [x] Integrate pause evidence, dispatch/wait/lifecycle guards and shutdown.
|
|
16
|
+
- [x] Add isolated debuggable fixture, regression tests and native journeys.
|
|
17
|
+
- [x] Align capabilities, packaging, tools, README and changelog; review consistency.
|
|
18
|
+
|
|
19
|
+
## Verification
|
|
20
|
+
|
|
21
|
+
| Criteria | Checks |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| Explicit targeting/unsupported/ambiguity | Native adapter tests; emulator fixture attach and capability calls |
|
|
24
|
+
| Breakpoints/stacks/locals/steps | Real Android fixture through built MCP stdio; no separate JVM debuggee required |
|
|
25
|
+
| Stale references/bounds/metadata | Unit contract checks plus Android stale inspection, bounded locals and source metadata checks |
|
|
26
|
+
| UI pause and races | Guard/readiness unit checks; paused fixture action, wait and journey; resumed UI assertion |
|
|
27
|
+
| Detach/failure/expiry/ownership | Unit worker/session tests, native disconnect and forward comparison |
|
|
28
|
+
| Packaging/compatibility | npm pack --dry-run; npm run verify; worker compile --release 17 |
|
|
29
|
+
| Existing runtime | npm run test:device; inspect actual platform coverage |
|
|
30
|
+
|
|
31
|
+
Prerequisites: Node >=18, JDK >=17 with javac/jdk.jdi; Android SDK platform/build-tools
|
|
32
|
+
36 for fixture, platform-tools. Host currently Java 23/ADB 37.0.1; emulator-5554
|
|
33
|
+
API 36 arm64 online outside sandbox. Existing CI: Node 18, manual Android JDK17/API30.
|
|
34
|
+
Use separate dev.mobiledebugmcp.debugfixture app with javac -g. Capture source-line
|
|
35
|
+
and known-local evidence; remove fixture, temporary outputs and owned forwards.
|
|
36
|
+
Physical device and iOS debugger verification are not required by this Android
|
|
37
|
+
scope; report them unrun/unsupported. Never treat readiness probes as debug proof.
|
|
38
|
+
|
|
39
|
+
## Results
|
|
40
|
+
|
|
41
|
+
Implemented and reviewed locally. No commit, push, release or hosted CI run performed.
|
|
42
|
+
|
|
43
|
+
- **PASS** `npm run verify`: lint, TypeScript build, all self-running unit tests,
|
|
44
|
+
agent-plugin consistency. Focused debugger tests cover schema strictness,
|
|
45
|
+
identity/PID reuse, exact-forward ownership, event wait concurrency/overflow,
|
|
46
|
+
stale stops, inspection versus mutation timeout policy, worker failure,
|
|
47
|
+
cleanup retry, no-read paused readiness and mid-journey preservation.
|
|
48
|
+
- **PASS** `npm run test:device`: existing Android/iOS screenshot, log, hierarchy
|
|
49
|
+
and correlated-evidence smoke checks; Android Perfetto journeys. The debugger
|
|
50
|
+
case reports **UNRUN** without its explicit device environment variable and is
|
|
51
|
+
independently verified below. Generic observations do not prove iOS debugging.
|
|
52
|
+
- **PASS** `MCP_DEBUGGER_DEVICE=emulator-5554 npx tsx test/device/automated/debugger/runtime.android.test.ts`:
|
|
53
|
+
built server 0.33.0 over actual MCP stdio; Node 23.11.0, worker JBR 25.0.3,
|
|
54
|
+
API 36/Android 16 arm64 emulator. Final full dist/worker fingerprint:
|
|
55
|
+
`5281d7127822e83355f6be1fcf81555827a078839364fb5115d4644d63d6048d`.
|
|
56
|
+
Isolated fixture starts at Ready; explicit attach, correct source breakpoint,
|
|
57
|
+
known local 42, 256-character string truncation and shallow object identity pass.
|
|
58
|
+
A separately compiled fixture with no local-variable tables establishes explicit
|
|
59
|
+
ART metadata uncertainty rather than an inferred empty scope. Removed pending
|
|
60
|
+
breakpoints remain removed when another request prepares the same class.
|
|
61
|
+
Into/over/out, stale frame rejection and resume pass; a fresh UI tree establishes
|
|
62
|
+
Result 43. Pending class resolves and stops; invalid line is rejected. Capability
|
|
63
|
+
deadline and missing app outcomes are explicit. Paused input/wait/lifecycle/journey
|
|
64
|
+
calls block; MCP event-wait cancellation leaves the stop intact. Reattach after
|
|
65
|
+
detach and process-exit cleanup pass. Closing MCP while actively paused removes
|
|
66
|
+
the owned forward; an independent fresh server observes Result 43 afterward.
|
|
67
|
+
Fixture package, temporary outputs and owned forwards are removed; pre-existing
|
|
68
|
+
forwards and device display settings are preserved.
|
|
69
|
+
- **PASS** extended stdio journey with `MCP_DEBUGGER_EXTENDED=1`: real 60-second
|
|
70
|
+
continuous-pause expiry despite repeated client polling, with complete owned
|
|
71
|
+
cleanup. Core-build fingerprint at that earlier checkpoint:
|
|
72
|
+
`76c0937b01aa296839783651bd9f445b0a1855f3e5416a4f3d41cf8a04a4757d`.
|
|
73
|
+
Later bounded-memory/heartbeat changes are covered by the final native journey;
|
|
74
|
+
pause-limit logic was unchanged. This earlier hash covers the named debugger
|
|
75
|
+
modules/worker, unlike the final complete dist/worker fingerprint.
|
|
76
|
+
- **PASS** standalone `javac --release 17 --add-modules jdk.jdi` compilation;
|
|
77
|
+
`npm pack --dry-run --json` includes worker source and built debugger/schema modules.
|
|
78
|
+
CI YAML parses; unit CI now compiles the worker on JDK 17 and checks packaging;
|
|
79
|
+
manual Android CI installs fixture SDK prerequisites and selects its emulator.
|
|
80
|
+
Hosted CI and JDK 17 runtime execution remain **UNRUN** locally.
|
|
81
|
+
|
|
82
|
+
Focused review corrected bounded JDWP subscription discovery, integer IPC,
|
|
83
|
+
terminal-state/cleanup races, import-order coupling, MCP stdout diagnostic leakage,
|
|
84
|
+
mutation cancellation/deadlines, device-specific guards, and event-poll activity
|
|
85
|
+
accounting, removed pending-breakpoint rebinding, per-location code-index identity,
|
|
86
|
+
and ART empty-table uncertainty. Test fixture content was moved below Android edge-to-edge system bars.
|
|
87
|
+
|
|
88
|
+
Remaining limits: physical-device debugging, API 30 CI execution, Windows/Linux
|
|
89
|
+
native runtime, Kotlin-specific metadata, and concurrent class-loader breakpoint
|
|
90
|
+
variants are **UNRUN**. ART empty/absent-variable metadata ambiguity is native-verified; the distinct JDI
|
|
91
|
+
AbsentInformationException path is code-inspected.
|
|
92
|
+
String truncation is native-verified; multi-device/race paths have unit coverage,
|
|
93
|
+
not exhaustive native coverage. Real
|
|
94
|
+
five-minute idle and 30-minute total expiry have not been wall-clock exercised;
|
|
95
|
+
all host expiry boundaries have deterministic unit checks;
|
|
96
|
+
the real pause expiry has. iOS/native/evaluation/mutation/coroutine debugging are
|
|
97
|
+
excluded. Abrupt host loss cannot guarantee confirmed device resumption.
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
Verification note: one late full run failed the unchanged conditional-action
|
|
101
|
+
150 ms action-budget assertion (`condition read does not consume the action
|
|
102
|
+
budget`). The focused test passed unchanged on both the current implementation
|
|
103
|
+
and an isolated HEAD archive; this does not prove the intermittent failure
|
|
104
|
+
predates this change. The final full `npm run verify` run passed in isolation, including the unchanged
|
|
105
|
+
conditional-action test. No timeout,
|
|
106
|
+
assertion, validation rule or test selection was weakened.
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Specification: Android runtime debugger
|
|
2
|
+
|
|
3
|
+
[Design and evidence](../../README.md#design-and-evidence) · [Tool reference](../../tools/TOOLS.md) · [Intent](intent.md) · [Plan and verification](plan.md)
|
|
4
|
+
|
|
5
|
+
Date: 2026-10-30. Status: approved.
|
|
6
|
+
Intent: [approved intent](intent.md), approved by the user's “yes” during design review.
|
|
7
|
+
Source: [issue #68](https://github.com/clivejefferies/mobile-debug-tools/issues/68).
|
|
8
|
+
|
|
9
|
+
## Behaviour and supported environment
|
|
10
|
+
|
|
11
|
+
Provide managed Java/Kotlin bytecode debugging of running, debuggable Android
|
|
12
|
+
apps using an independently developed Java JDI worker over ADB-forwarded JDWP.
|
|
13
|
+
No Debroid implementation or artifacts are reused. Require host JDK 17+ with
|
|
14
|
+
`jdk.jdi` and `javac`, Android platform-tools, an authorized Android device, and
|
|
15
|
+
a JDWP-visible app process. Package worker sources with the npm distribution;
|
|
16
|
+
compile into a private, version-keyed host cache on first use. Missing tooling
|
|
17
|
+
must not prevent ordinary MCP tools or server startup.
|
|
18
|
+
|
|
19
|
+
Initial verification target: API 36 arm64 emulator; other Android versions and
|
|
20
|
+
physical devices require separate evidence. iOS, native frames, expression
|
|
21
|
+
evaluation, method invocation, mutation, coroutine reconstruction, heap capture,
|
|
22
|
+
launch-under-debugger, and changing app debuggability are excluded. Kotlin
|
|
23
|
+
inspection follows emitted JVM/DEX debug metadata; do not promise source-level
|
|
24
|
+
coroutine or inline-function reconstruction.
|
|
25
|
+
|
|
26
|
+
## MCP contracts
|
|
27
|
+
|
|
28
|
+
All new inputs reject unknown fields. Strings are nonempty and bounded to 512
|
|
29
|
+
characters unless otherwise stated; IDs are opaque server-issued strings.
|
|
30
|
+
Every tool accepts `timeoutMs` (integer 100–30000, default 10000); event waits
|
|
31
|
+
default to 1000. Tables list other inputs; `?` means optional.
|
|
32
|
+
|
|
33
|
+
| Tool | Inputs | Result payload |
|
|
34
|
+
| --- | --- | --- |
|
|
35
|
+
| `get_debugger_capabilities` | `platform: android`, `deviceId`, `appId`, `processId?` | Prerequisites, candidate processes, supported operations and limitations; no attach |
|
|
36
|
+
| `attach_debugger` | `platform: android`, `deviceId`, `appId`, `processId?` | Session and resolved target |
|
|
37
|
+
| `get_debugger_state` | `debugSessionId` | Current state, stop summary, breakpoint statuses, cleanup |
|
|
38
|
+
| `set_debugger_breakpoint` | `debugSessionId`, `className`, `line` | Breakpoint ID, requested/resolved locations, `pending`/`verified`/`rejected` |
|
|
39
|
+
| `remove_debugger_breakpoint` | `debugSessionId`, `breakpointId` | Removal outcome; repeated removal of an owned ID succeeds |
|
|
40
|
+
| `wait_for_debugger_event` | `debugSessionId`, `afterSequence?` | Ordered events, next cursor and explicit overflow indication |
|
|
41
|
+
| `get_debugger_stack` | `debugSessionId`, `stopId`, `threadId`, `offset?`, `limit?` | Frames, opaque frame IDs and pagination |
|
|
42
|
+
| `get_debugger_locals` | `debugSessionId`, `stopId`, `frameId` | Bounded shallow local values and availability |
|
|
43
|
+
| `step_debugger` | `debugSessionId`, `stopId`, `threadId`, `kind: into/over/out` | Acknowledged transition to running; await a later event separately |
|
|
44
|
+
| `resume_debugger` | `debugSessionId`, `stopId` | Acknowledged resume |
|
|
45
|
+
| `detach_debugger` | `debugSessionId` | Terminal state and cleanup; idempotent and usable for cleanup retry |
|
|
46
|
+
|
|
47
|
+
`processId` and `line` are positive safe integers. Omitted process ID is allowed
|
|
48
|
+
only when exactly one matching app process is JDWP-visible. Resolve package UID,
|
|
49
|
+
process name, PID and process-start identity before and after attach; reject
|
|
50
|
+
ambiguity, mismatch or PID reuse. Never select the first connected device.
|
|
51
|
+
|
|
52
|
+
Responses use existing MCP text JSON serialization:
|
|
53
|
+
`{success, debug_session_id, device, target, state, captured_at_ms, capabilities,
|
|
54
|
+
limitations, cleanup, ...payload}`; pre-session fields may be null. Target includes
|
|
55
|
+
app ID, PID, process name and process-start identity. Failures add
|
|
56
|
+
`error: {code, message, retryable}`. Codes cover `INVALID_ARGUMENT`,
|
|
57
|
+
`DEBUGGER_UNSUPPORTED`, `DEVICE_UNAVAILABLE`, `PROCESS_NOT_FOUND`,
|
|
58
|
+
`PROCESS_AMBIGUOUS`, `PROCESS_CHANGED`, `DEBUGGER_BUSY`, `DEBUGGER_ATTACH_FAILED`,
|
|
59
|
+
`DEBUGGER_NOT_FOUND`, `DEBUGGER_NOT_PAUSED`, `DEBUGGER_STALE_REFERENCE`,
|
|
60
|
+
`DEBUGGER_LOCATION_UNAVAILABLE`, `DEBUGGER_DISCONNECTED`, `DEBUGGER_TIMEOUT`,
|
|
61
|
+
`DEBUGGER_CANCELLED`, `DEBUGGER_WORKER_FAILED`, and `DEBUGGER_CLEANUP_FAILED`.
|
|
62
|
+
No automatic retry of attach, step or resume. Do not claim command delivery
|
|
63
|
+
establishes a later stop or UI outcome.
|
|
64
|
+
|
|
65
|
+
## Stops, inspection and events
|
|
66
|
+
|
|
67
|
+
States: `attaching`, `running`, `paused`, `detaching`, `detached`, `disconnected`,
|
|
68
|
+
`failed`. Serialize state-changing commands per session; event polling must not
|
|
69
|
+
block resume/detach. One active session per device, at most four per server.
|
|
70
|
+
Reject an existing debugger attachment without replacing it.
|
|
71
|
+
|
|
72
|
+
Breakpoints use exact binary class names and 1-based lines, without arbitrary
|
|
73
|
+
source paths. Bind all matching executable locations in loaded class loaders;
|
|
74
|
+
report class-loader identity and resolved source/line. Unloaded classes remain
|
|
75
|
+
pending via class-prepare requests. Missing executable lines/debug metadata are
|
|
76
|
+
explicitly unavailable; never silently move the breakpoint. Limit 100 breakpoints.
|
|
77
|
+
|
|
78
|
+
Breakpoint and step events suspend all app threads. Retain owned EventSets and
|
|
79
|
+
resume through their matching ownership; do not decrement unrelated suspension
|
|
80
|
+
counts. Non-stop events are promptly released. Each new stop has a unique
|
|
81
|
+
`stopId`, triggering thread ID, reason, locations and matching breakpoint IDs.
|
|
82
|
+
Simultaneous events share a stop summary. Step uses one-shot line stepping on
|
|
83
|
+
the chosen suspended thread; a competing breakpoint also completes that step
|
|
84
|
+
attempt and removes its request. A step acknowledgement does not wait for a stop.
|
|
85
|
+
|
|
86
|
+
Thread/frame IDs are stop-scoped. Resume, step, disconnect and detach invalidate
|
|
87
|
+
all inspection references before further commands can use them. Stack pagination
|
|
88
|
+
defaults to 20, maximum 100 per call and 1000 frames per stop. Locals return at
|
|
89
|
+
most 100 entries: primitives, null, strings truncated to 256 characters, and
|
|
90
|
+
object type/opaque identity summaries, without field traversal or `toString()`.
|
|
91
|
+
Expose truncation and missing debug metadata; unavailable locals are distinct
|
|
92
|
+
from a proven empty scope. Investigation found ART may return an empty variable
|
|
93
|
+
table without distinguishing absent metadata from no variables; report availability
|
|
94
|
+
as unknown with `EMPTY_OR_UNAVAILABLE_VARIABLE_METADATA`, rather than inferring an
|
|
95
|
+
empty scope. No retained object pinning.
|
|
96
|
+
|
|
97
|
+
Maintain a 256-event ring per session with increasing sequence, host receipt time,
|
|
98
|
+
kind and optional stop summary. Default cursor is zero; return at most 100 events
|
|
99
|
+
and a continuation cursor. Cursor overrun is explicit. Reject future cursors;
|
|
100
|
+
an empty wait returns success with `timed_out: true`, without changing the session.
|
|
101
|
+
|
|
102
|
+
## UI coordination and resource safety
|
|
103
|
+
|
|
104
|
+
While a session is paused, conservatively block action dispatch, lifecycle/data
|
|
105
|
+
management, and UI waits/assertions on that device with `DEBUGGER_PAUSED` before
|
|
106
|
+
native work. Journeys stop with completed steps preserved and no automatic retry.
|
|
107
|
+
Check at dispatch and within polling; a pause racing an already dispatched action
|
|
108
|
+
must preserve delivery evidence and mark verification blocked. Do not queue inputs
|
|
109
|
+
for resume. Use a device dispatch gate to serialize pause transitions with input
|
|
110
|
+
submission; inputs already submitted cannot be retracted.
|
|
111
|
+
|
|
112
|
+
Readiness tools return evidence-backed `debugger_paused` with debug session/target
|
|
113
|
+
identity and host timestamp without acquiring a UI tree. This is device-scoped
|
|
114
|
+
blocking evidence, not proof the paused app is foreground. Screenshots, raw trees
|
|
115
|
+
and logs remain available within their existing bounds and carry the known pause
|
|
116
|
+
annotation; their success does not establish readiness. Other devices and iOS
|
|
117
|
+
retain existing behaviour. Unknown/disconnected debugger state cannot imply pause.
|
|
118
|
+
|
|
119
|
+
Detach automatically after 60 seconds continuously paused, five minutes without
|
|
120
|
+
client activity, or 30 minutes total session lifetime; polling cannot extend the
|
|
121
|
+
pause/total limit. Emit the expiry reason. Timeouts/cancellation of inspection
|
|
122
|
+
leave a known session intact; uncertain state-changing commands trigger teardown
|
|
123
|
+
and invalidate references. Cancelling an event wait only cancels that wait.
|
|
124
|
+
|
|
125
|
+
Cleanup has its own ten-second deadline: remove owned requests, release owned
|
|
126
|
+
suspensions/dispose the JDI connection, stop the owned worker, and remove only
|
|
127
|
+
the session's exact ADB forward. Never kill/restart the app, ADB server or another
|
|
128
|
+
debugger. On worker failure, disconnect its transport and verify obtainable
|
|
129
|
+
cleanup facts; never claim the app resumed without evidence. Report cleanup as
|
|
130
|
+
`pending`/`complete`/`failed`, remaining resources and execution state as unknown
|
|
131
|
+
when necessary. Block new sessions on that device until owned cleanup completes.
|
|
132
|
+
The worker watches parent-pipe EOF; server shutdown also requests cleanup. Abrupt
|
|
133
|
+
host/device loss may prevent confirmed cleanup and must be documented explicitly.
|
|
134
|
+
|
|
135
|
+
Use argv-based subprocesses and a dedicated worker with bounded JSON-lines IPC
|
|
136
|
+
(1 MiB/message), request IDs and stderr-only diagnostics. JDI runs through an
|
|
137
|
+
owned loopback forward, never a public listener. Whitelist commands; do not log
|
|
138
|
+
locals or protocol values. Locals may contain sensitive data and are returned
|
|
139
|
+
only on request; no persistent inspection dump or upload. Retain up to 100 terminal
|
|
140
|
+
session summaries for ten minutes, clearing locals, frames and events at teardown.
|
|
141
|
+
|
|
142
|
+
## Acceptance and verification
|
|
143
|
+
|
|
144
|
+
1. A dedicated debuggable Java fixture attaches on the selected device/process;
|
|
145
|
+
ambiguous, non-debuggable, replaced and already-debugged targets fail safely.
|
|
146
|
+
2. Pending/loaded breakpoints stop at the expected line; stack and known local
|
|
147
|
+
values are correct; each step mode and resume produce observed execution.
|
|
148
|
+
3. Old stop/frame/thread references fail after resume; missing metadata and
|
|
149
|
+
truncation are explicit.
|
|
150
|
+
4. UI action/wait/readiness tools recognise pauses, including mid-journey stops;
|
|
151
|
+
another device is unaffected and resumed UI changes are independently verified.
|
|
152
|
+
5. Explicit detach, expiry, cancellation, disconnect and worker failure invalidate
|
|
153
|
+
references and clean up owned resources without altering unrelated forwards.
|
|
154
|
+
|
|
155
|
+
Use focused self-running unit tests plus a new isolated fixture with debug line
|
|
156
|
+
and local-variable tables. Run `npm run verify`, `npm run test:device`, and focused
|
|
157
|
+
end-to-end calls through the updated server. Record exact build/device and each
|
|
158
|
+
journey as pass/fail/blocked/unrun. Current CI uses Node 18; manual Android CI uses
|
|
159
|
+
JDK 17/API 30. Existing smoke tests do not prove debugger behaviour; add worker
|
|
160
|
+
compilation/packaging checks and explicit debugger coverage.
|
|
161
|
+
|
|
162
|
+
Affected areas: new debugger/worker modules, tool definitions/handlers, readiness,
|
|
163
|
+
interaction dispatch/polling, lifecycle guards, shutdown, native-tool status,
|
|
164
|
+
packaging, fixtures/tests and tool/README/changelog documentation. Correct existing
|
|
165
|
+
JDWP capability reporting: ADB/device presence alone is not debugger readiness.
|
|
166
|
+
|
|
167
|
+
## Investigation and approval
|
|
168
|
+
|
|
169
|
+
Checkout 0.33.0 contains no debugger implementation. Host Java 23 and ADB 37.0.1
|
|
170
|
+
are available; outside sandbox, `emulator-5554` is online (API 36 arm64). Existing
|
|
171
|
+
latency fixture lacks `android:debuggable`; a dedicated fixture is required.
|
|
172
|
+
No debugger session was attached and no debugging journey is verified yet.
|
|
173
|
+
|
|
174
|
+
Primary references: [JDI VM lifecycle](https://docs.oracle.com/en/java/javase/17/docs/api/jdk.jdi/com/sun/jdi/VirtualMachine.html),
|
|
175
|
+
[EventSet suspension ownership](https://docs.oracle.com/en/java/javase/21/docs/api/jdk.jdi/com/sun/jdi/event/EventSet.html),
|
|
176
|
+
[frame lifetime](https://docs.oracle.com/en/java/javase/17/docs/api/jdk.jdi/com/sun/jdi/StackFrame.html),
|
|
177
|
+
[step requests](https://docs.oracle.com/en/java/javase/17/docs/api/jdk.jdi/com/sun/jdi/request/StepRequest.html),
|
|
178
|
+
and [ADB](https://developer.android.com/tools/adb). ART/JDI interoperability must
|
|
179
|
+
be established by fixture evidence; API documentation alone does not prove it.
|
|
180
|
+
|
|
181
|
+
The user approved this complete specification with “yes” on 2026-10-30 during design review, including all-thread
|
|
182
|
+
suspension, conservative device-wide UI blocking, shallow locals, JDK dependency,
|
|
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.
|