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
|
@@ -1,1146 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { verificationModeJson, responseModeJson } from '../contracts/execution-controls.js'
|
|
2
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js'
|
|
3
|
+
import { manageTools } from './definitions/manage.js'
|
|
4
|
+
import { observeTools } from './definitions/observe.js'
|
|
5
|
+
import { diagnosticTools } from './definitions/diagnostic.js'
|
|
6
|
+
import { waitTools } from './definitions/wait.js'
|
|
7
|
+
import { assertTools } from './definitions/assert.js'
|
|
8
|
+
import { targetTools } from './definitions/target.js'
|
|
9
|
+
import { inputTools } from './definitions/input.js'
|
|
10
|
+
import { debuggerTools } from './schemas/debugger-schema.js'
|
|
11
|
+
import { systemTraceTools } from './schemas/system-trace-schema.js'
|
|
12
|
+
import { journeyStepsJson } from './schemas/journey-schema.js'
|
|
13
|
+
import { conditionalTools, expectedStateJson } from './schemas/condition-schema.js'
|
|
14
|
+
import { readinessPropertiesJson } from './schemas/readiness-schema.js'
|
|
15
|
+
|
|
16
|
+
const baseTools = new Map([...manageTools, ...observeTools, ...diagnosticTools, ...waitTools, ...assertTools, ...targetTools, ...inputTools].map(tool => [tool.name, tool]))
|
|
17
|
+
const baseOrder = [
|
|
18
|
+
"start_app",
|
|
19
|
+
"terminate_app",
|
|
20
|
+
"restart_app",
|
|
21
|
+
"reset_app_data",
|
|
22
|
+
"install_app",
|
|
23
|
+
"build_app",
|
|
24
|
+
"get_logs",
|
|
25
|
+
"list_devices",
|
|
26
|
+
"get_system_status",
|
|
27
|
+
"capture_screenshot",
|
|
28
|
+
"capture_debug_snapshot",
|
|
29
|
+
"start_log_stream",
|
|
30
|
+
"read_log_stream",
|
|
31
|
+
"stop_log_stream",
|
|
32
|
+
"get_ui_tree",
|
|
33
|
+
"get_current_screen",
|
|
34
|
+
"get_screen_fingerprint",
|
|
35
|
+
"wait_for_screen_change",
|
|
36
|
+
"wait_for_ui_change",
|
|
37
|
+
"expect_screen",
|
|
38
|
+
"expect_element_visible",
|
|
39
|
+
"expect_state",
|
|
40
|
+
"adjust_control",
|
|
41
|
+
"wait_for_ui",
|
|
42
|
+
"find_element",
|
|
43
|
+
"tap",
|
|
44
|
+
"tap_element",
|
|
45
|
+
"swipe",
|
|
46
|
+
"scroll_to_element",
|
|
47
|
+
"type_text",
|
|
48
|
+
"press_back",
|
|
49
|
+
"classify_action_outcome",
|
|
50
|
+
"run_journey",
|
|
51
|
+
"get_network_activity"
|
|
52
|
+
]
|
|
53
|
+
export const toolDefinitions: Tool[] = [
|
|
54
|
+
...debuggerTools,
|
|
55
|
+
...systemTraceTools,
|
|
56
|
+
...['get_app_readiness', 'wait_for_app_ready'].map(name => ({
|
|
7
57
|
name,
|
|
8
|
-
description: `${name === 'get_app_readiness' ? 'Observe readiness with at most two fresh UI-tree samples.' : 'Wait within a single bounded budget for settled UI evidence.'} Reports loading, transitioning, settled or unknown with evidence and limitations.
|
|
9
|
-
inputSchema: { type: 'object', additionalProperties: false, required: ['platform'], properties: {
|
|
58
|
+
description: `${name === 'get_app_readiness' ? 'Observe readiness with at most two fresh UI-tree samples.' : 'Wait within a single bounded budget for settled UI evidence.'} Reports loading, transitioning, settled or unknown with evidence and limitations. Managed Android debugger pauses are reported from debugger evidence; unresponsive detection remains unsupported. Settled normalized foreground UI is not proof of app identity, responsiveness or backend completion.`,
|
|
59
|
+
inputSchema: { type: 'object' as const, additionalProperties: false, required: ['platform'], properties: {
|
|
10
60
|
...readinessPropertiesJson,
|
|
11
61
|
timeoutMs: { ...readinessPropertiesJson.timeoutMs, default: name === 'get_app_readiness' ? 15000 : 30000 },
|
|
12
62
|
...(name === 'wait_for_app_ready' ? { pollIntervalMs: { type: 'integer', minimum: 100, maximum: 1000, default: 500 } } : {})
|
|
13
63
|
} }
|
|
14
64
|
})),
|
|
15
|
-
|
|
16
|
-
name: 'start_app',
|
|
17
|
-
description: `Purpose:
|
|
18
|
-
Launch a mobile app on Android or iOS.
|
|
19
|
-
|
|
20
|
-
Inputs:
|
|
21
|
-
- platform
|
|
22
|
-
- appId
|
|
23
|
-
- deviceId (optional)
|
|
24
|
-
|
|
25
|
-
Output Structure:
|
|
26
|
-
- action_id, timestamp (ISO 8601), action_type
|
|
27
|
-
- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
|
|
28
|
-
- source_module: runtime source of the action envelope
|
|
29
|
-
- target.selector = { appId }
|
|
30
|
-
- success = true when launch was dispatched successfully
|
|
31
|
-
- failure_code/retryable when launch dispatch fails
|
|
32
|
-
- ui_fingerprint_before/ui_fingerprint_after when available
|
|
33
|
-
|
|
34
|
-
Recommended Usage:
|
|
35
|
-
1. Define the expected landing screen when it is known
|
|
36
|
-
2. Call start_app
|
|
37
|
-
3. If needed, wait for transition using wait_for_*
|
|
38
|
-
4. Verify with expect_screen
|
|
39
|
-
5. If verification fails, retry once or capture a snapshot
|
|
40
|
-
|
|
41
|
-
Verification Guidance:
|
|
42
|
-
- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
|
|
43
|
-
- expect_screen is the authoritative verification step when the landing screen is known
|
|
44
|
-
- Do not treat timing or screen change alone as final verification
|
|
45
|
-
|
|
46
|
-
Failure Handling:
|
|
47
|
-
- TIMEOUT → retry once
|
|
48
|
-
- UNKNOWN → inspect snapshot/logs before retrying`,
|
|
49
|
-
inputSchema: {
|
|
50
|
-
type: 'object',
|
|
51
|
-
properties: {
|
|
52
|
-
platform: {
|
|
53
|
-
type: 'string',
|
|
54
|
-
enum: ['android', 'ios']
|
|
55
|
-
},
|
|
56
|
-
appId: {
|
|
57
|
-
type: 'string',
|
|
58
|
-
description: 'Android package name or iOS bundle id'
|
|
59
|
-
},
|
|
60
|
-
deviceId: {
|
|
61
|
-
type: 'string',
|
|
62
|
-
description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.'
|
|
63
|
-
},
|
|
64
|
-
verificationMode: { type: 'string', enum: ['none', 'light', 'full'], default: 'full' },
|
|
65
|
-
responseMode: { type: 'string', enum: ['compact', 'debug'], default: 'debug' },
|
|
66
|
-
actionTimeoutMs: { type: 'number', minimum: 100, maximum: 30000 },
|
|
67
|
-
verificationTimeoutMs: { type: 'number', minimum: 100, maximum: 60000 }
|
|
68
|
-
},
|
|
69
|
-
required: ['platform', 'appId']
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: 'terminate_app',
|
|
74
|
-
description: 'Terminate a mobile app on Android or iOS simulator',
|
|
75
|
-
inputSchema: {
|
|
76
|
-
type: 'object',
|
|
77
|
-
properties: {
|
|
78
|
-
platform: {
|
|
79
|
-
type: 'string',
|
|
80
|
-
enum: ['android', 'ios']
|
|
81
|
-
},
|
|
82
|
-
appId: {
|
|
83
|
-
type: 'string',
|
|
84
|
-
description: 'Android package name or iOS bundle id'
|
|
85
|
-
},
|
|
86
|
-
deviceId: {
|
|
87
|
-
type: 'string',
|
|
88
|
-
description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.'
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
required: ['platform', 'appId']
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: 'restart_app',
|
|
96
|
-
description: `Purpose:
|
|
97
|
-
Restart a mobile app on Android or iOS.
|
|
98
|
-
|
|
99
|
-
Inputs:
|
|
100
|
-
- platform
|
|
101
|
-
- appId
|
|
102
|
-
- deviceId (optional)
|
|
103
|
-
|
|
104
|
-
Output Structure:
|
|
105
|
-
- action_id, timestamp (ISO 8601), action_type
|
|
106
|
-
- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
|
|
107
|
-
- source_module: runtime source of the action envelope
|
|
108
|
-
- target.selector = { appId }
|
|
109
|
-
- success = true when the restart command completed
|
|
110
|
-
- failure_code/retryable when restart dispatch fails
|
|
111
|
-
- ui_fingerprint_before/ui_fingerprint_after when available
|
|
112
|
-
|
|
113
|
-
Recommended Usage:
|
|
114
|
-
1. Define the expected landing screen when it is known
|
|
115
|
-
2. Call restart_app
|
|
116
|
-
3. If needed, wait for transition using wait_for_*
|
|
117
|
-
4. Verify with expect_screen
|
|
118
|
-
5. If verification fails, retry once or capture a snapshot
|
|
119
|
-
|
|
120
|
-
Verification Guidance:
|
|
121
|
-
- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
|
|
122
|
-
- expect_screen is the authoritative verification step when the reopened screen is known
|
|
123
|
-
- Do not treat timing or screen change alone as final verification
|
|
124
|
-
|
|
125
|
-
Failure Handling:
|
|
126
|
-
- TIMEOUT → retry once
|
|
127
|
-
- UNKNOWN → inspect snapshot/logs before retrying`,
|
|
128
|
-
inputSchema: {
|
|
129
|
-
type: 'object',
|
|
130
|
-
properties: {
|
|
131
|
-
platform: {
|
|
132
|
-
type: 'string',
|
|
133
|
-
enum: ['android', 'ios']
|
|
134
|
-
},
|
|
135
|
-
appId: {
|
|
136
|
-
type: 'string',
|
|
137
|
-
description: 'Android package name or iOS bundle id'
|
|
138
|
-
},
|
|
139
|
-
deviceId: {
|
|
140
|
-
type: 'string',
|
|
141
|
-
description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.'
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
required: ['platform', 'appId']
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: 'reset_app_data',
|
|
149
|
-
description: 'Reset app data (clear storage) for a mobile app on Android or iOS simulator',
|
|
150
|
-
inputSchema: {
|
|
151
|
-
type: 'object',
|
|
152
|
-
properties: {
|
|
153
|
-
platform: {
|
|
154
|
-
type: 'string',
|
|
155
|
-
enum: ['android', 'ios']
|
|
156
|
-
},
|
|
157
|
-
appId: {
|
|
158
|
-
type: 'string',
|
|
159
|
-
description: 'Android package name or iOS bundle id'
|
|
160
|
-
},
|
|
161
|
-
deviceId: {
|
|
162
|
-
type: 'string',
|
|
163
|
-
description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.'
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
required: ['platform', 'appId']
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
name: 'install_app',
|
|
171
|
-
description: 'Install an app on Android or iOS. Accepts a built binary (apk/.ipa/.app) or a project directory to build then install. platform and projectType are required.',
|
|
172
|
-
inputSchema: {
|
|
173
|
-
type: 'object',
|
|
174
|
-
properties: {
|
|
175
|
-
platform: { type: 'string', enum: ['android', 'ios'], description: 'Platform to install to (required).' },
|
|
176
|
-
projectType: { type: 'string', enum: ['native', 'kmp', 'react-native', 'flutter'], description: 'Project type to guide build/install tool selection (required).' },
|
|
177
|
-
appPath: { type: 'string', description: 'Path to APK, .app, .ipa, or project directory' },
|
|
178
|
-
deviceId: { type: 'string', description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.' }
|
|
179
|
-
},
|
|
180
|
-
required: ['platform', 'projectType', 'appPath']
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
name: 'build_app',
|
|
185
|
-
description: 'Build a project for Android or iOS and return the built artifact path. Does not install. platform and projectType are required.',
|
|
186
|
-
inputSchema: {
|
|
187
|
-
type: 'object',
|
|
188
|
-
properties: {
|
|
189
|
-
platform: { type: 'string', enum: ['android', 'ios'], description: 'Platform to build for (required).' },
|
|
190
|
-
projectType: { type: 'string', enum: ['native', 'kmp', 'react-native', 'flutter'], description: 'Project type to guide build tool selection (required).' },
|
|
191
|
-
projectPath: { type: 'string', description: 'Path to project directory (contains gradlew or xcodeproj/xcworkspace)' },
|
|
192
|
-
variant: { type: 'string', description: 'Optional build variant (e.g., Debug/Release)' }
|
|
193
|
-
},
|
|
194
|
-
required: ['platform', 'projectType', 'projectPath']
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
name: 'get_logs',
|
|
199
|
-
description: 'Get recent logs from Android or iOS simulator. Returns device metadata and structured logs suitable for AI consumption.',
|
|
200
|
-
inputSchema: {
|
|
201
|
-
type: 'object',
|
|
202
|
-
properties: {
|
|
203
|
-
platform: {
|
|
204
|
-
type: 'string',
|
|
205
|
-
enum: ['android', 'ios']
|
|
206
|
-
},
|
|
207
|
-
appId: {
|
|
208
|
-
type: 'string',
|
|
209
|
-
description: 'Filter by Android package name or iOS bundle id'
|
|
210
|
-
},
|
|
211
|
-
deviceId: {
|
|
212
|
-
type: 'string',
|
|
213
|
-
description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.'
|
|
214
|
-
},
|
|
215
|
-
pid: { type: 'number', description: 'Filter by process id' },
|
|
216
|
-
tag: { type: 'string', description: 'Filter by tag (Android) or subsystem/category (iOS)' },
|
|
217
|
-
level: { type: 'string', description: 'Log level filter (VERBOSE, DEBUG, INFO, WARN, ERROR)' },
|
|
218
|
-
contains: { type: 'string', description: 'Substring to match in log message' },
|
|
219
|
-
since_seconds: { type: 'number', description: 'Only return logs from the last N seconds' },
|
|
220
|
-
limit: { type: 'number', description: 'Override default number of returned lines' },
|
|
221
|
-
lines: {
|
|
222
|
-
type: 'number',
|
|
223
|
-
description: 'Legacy - number of log lines (android only)'
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
required: ['platform']
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
name: 'list_devices',
|
|
231
|
-
description: 'List connected devices and their metadata (android + ios).',
|
|
232
|
-
inputSchema: {
|
|
233
|
-
type: 'object',
|
|
234
|
-
properties: {
|
|
235
|
-
platform: { type: 'string', enum: ['android', 'ios'] }
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
name: 'get_system_status',
|
|
241
|
-
description: 'Quick healthcheck of local mobile debugging environment (adb, devices, logs, env, iOS).',
|
|
242
|
-
inputSchema: { type: 'object', properties: {} }
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
name: 'capture_screenshot',
|
|
246
|
-
description: 'Capture a screenshot from an Android device or iOS simulator. Returns device metadata and the screenshot image.',
|
|
247
|
-
inputSchema: {
|
|
248
|
-
type: 'object',
|
|
249
|
-
properties: {
|
|
250
|
-
platform: {
|
|
251
|
-
type: 'string',
|
|
252
|
-
enum: ['android', 'ios']
|
|
253
|
-
},
|
|
254
|
-
deviceId: {
|
|
255
|
-
type: 'string',
|
|
256
|
-
description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.'
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
required: ['platform']
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
name: 'capture_debug_snapshot',
|
|
264
|
-
description: 'Capture a complete debug snapshot (raw observation layer plus optional derived semantic layer). Returns structured JSON with snapshot_revision, captured_at_ms, snapshot_delta, and loading_state when detectable.',
|
|
265
|
-
inputSchema: {
|
|
266
|
-
type: 'object',
|
|
267
|
-
properties: {
|
|
268
|
-
reason: { type: 'string', description: 'Optional reason for snapshot' },
|
|
269
|
-
includeLogs: { type: 'boolean', description: 'Whether to include logs', default: true },
|
|
270
|
-
includeScreenshot: { type: 'boolean', description: 'Whether to collect screenshot bytes', default: true },
|
|
271
|
-
logLines: { type: 'number', description: 'Maximum number of log lines to include', default: 200 },
|
|
272
|
-
platform: { type: 'string', enum: ['android', 'ios'], description: 'Optional platform override' },
|
|
273
|
-
appId: { type: 'string', description: 'Optional appId to scope logs (package/bundle id)' },
|
|
274
|
-
deviceId: { type: 'string', description: 'Optional device serial/udid' },
|
|
275
|
-
sessionId: { type: 'string', description: 'Optional log stream session id to prefer' }
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
name: 'start_log_stream',
|
|
281
|
-
description: 'Start streaming logs for a target application on Android or iOS. For Android this uses adb logcat --pid=<pid>; for iOS it streams `xcrun simctl spawn <device> log stream` with a predicate.',
|
|
282
|
-
inputSchema: {
|
|
283
|
-
type: 'object',
|
|
284
|
-
properties: {
|
|
285
|
-
platform: { type: 'string', enum: ['android', 'ios'], default: 'android' },
|
|
286
|
-
packageName: { type: 'string', description: 'Android package name or iOS bundle id' },
|
|
287
|
-
level: { type: 'string', enum: ['error', 'warn', 'info', 'debug'], default: 'error' },
|
|
288
|
-
deviceId: { type: 'string', description: 'Device Serial (Android) or UDID (iOS). Defaults to connected/booted device.' },
|
|
289
|
-
sessionId: { type: 'string', description: 'Session identifier for the log stream' }
|
|
290
|
-
},
|
|
291
|
-
required: ['packageName']
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
name: 'read_log_stream',
|
|
296
|
-
description: 'Read accumulated log stream entries for the active session.',
|
|
297
|
-
inputSchema: {
|
|
298
|
-
type: 'object',
|
|
299
|
-
properties: {
|
|
300
|
-
sessionId: { type: 'string' }
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
name: 'stop_log_stream',
|
|
306
|
-
description: 'Stop an active log stream for the session.',
|
|
307
|
-
inputSchema: {
|
|
308
|
-
type: 'object',
|
|
309
|
-
properties: {
|
|
310
|
-
sessionId: { type: 'string' }
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
name: 'get_ui_tree',
|
|
316
|
-
description: 'Get the current UI hierarchy from an Android device or iOS simulator. Returns a structured JSON representation of the screen content with snapshot metadata and incremental delta signals when available.',
|
|
317
|
-
inputSchema: {
|
|
318
|
-
type: 'object',
|
|
319
|
-
properties: {
|
|
320
|
-
platform: {
|
|
321
|
-
type: 'string',
|
|
322
|
-
enum: ['android', 'ios'],
|
|
323
|
-
description: 'Platform to get UI tree for'
|
|
324
|
-
},
|
|
325
|
-
deviceId: {
|
|
326
|
-
type: 'string',
|
|
327
|
-
description: 'Device Serial (Android) or UDID (iOS). Defaults to connected/booted device.'
|
|
328
|
-
},
|
|
329
|
-
responseMode: { type: 'string', enum: ['compact', 'debug'], default: 'debug' },
|
|
330
|
-
sinceSnapshotRevision: { type: 'number', minimum: 1 }
|
|
331
|
-
},
|
|
332
|
-
required: ['platform']
|
|
333
|
-
}
|
|
334
|
-
},
|
|
335
|
-
{
|
|
336
|
-
name: 'get_current_screen',
|
|
337
|
-
description: 'Get the currently visible activity on an Android device. Returns package and activity name.',
|
|
338
|
-
inputSchema: {
|
|
339
|
-
type: 'object',
|
|
340
|
-
properties: {
|
|
341
|
-
deviceId: {
|
|
342
|
-
type: 'string',
|
|
343
|
-
description: 'Device Serial (Android). Defaults to connected/booted device.'
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
name: 'get_screen_fingerprint',
|
|
350
|
-
description: 'Generate a stable fingerprint representing the current visible screen (activity + visible UI elements).',
|
|
351
|
-
inputSchema: {
|
|
352
|
-
type: 'object',
|
|
353
|
-
properties: {
|
|
354
|
-
platform: { type: 'string', enum: ['android', 'ios'], description: 'Optional platform override (android|ios)' },
|
|
355
|
-
deviceId: { type: 'string', description: 'Optional device id/udid to target' }
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
name: 'wait_for_screen_change',
|
|
361
|
-
description: `Purpose:
|
|
362
|
-
Detect that a screen transition has occurred by waiting for the current fingerprint to differ from a previous fingerprint.
|
|
363
|
-
|
|
364
|
-
Capabilities:
|
|
365
|
-
- Synchronization for uncertain navigation timing
|
|
366
|
-
- Detection that something changed on screen
|
|
367
|
-
|
|
368
|
-
Constraints:
|
|
369
|
-
- Does not verify correctness of the resulting state
|
|
370
|
-
- Must not be used alone to confirm action success when an applicable expect_* tool exists
|
|
371
|
-
- For backend/API activity without a visible UI change, pass the runtime action_type into classify_action_outcome and collect network evidence only if the result remains ambiguous
|
|
372
|
-
|
|
373
|
-
Recommended Usage:
|
|
374
|
-
1. Capture or define the expected outcome
|
|
375
|
-
2. Call an action tool
|
|
376
|
-
3. Use wait_for_screen_change when transition timing is uncertain
|
|
377
|
-
4. Follow with expect_screen when the expected destination is known`,
|
|
378
|
-
inputSchema: {
|
|
379
|
-
type: 'object',
|
|
380
|
-
properties: {
|
|
381
|
-
platform: { type: 'string', enum: ['android', 'ios'], description: 'Optional platform override (android|ios)' },
|
|
382
|
-
previousFingerprint: { type: 'string', description: 'The fingerprint to compare against (required)' },
|
|
383
|
-
timeoutMs: { type: 'number', description: 'Timeout in ms to wait for change (default 5000)', default: 5000 },
|
|
384
|
-
pollIntervalMs: { type: 'number', description: 'Polling interval in ms (default 300)', default: 300 },
|
|
385
|
-
deviceId: { type: 'string', description: 'Optional device id/udid to target' }
|
|
386
|
-
},
|
|
387
|
-
required: ['previousFingerprint']
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
name: 'wait_for_ui_change',
|
|
392
|
-
description: `Purpose:
|
|
393
|
-
Wait for a non-navigation UI mutation or in-place update to become stable.
|
|
394
|
-
|
|
395
|
-
Inputs:
|
|
396
|
-
- expected_change (optional): hierarchy_diff, text_change, or state_change
|
|
397
|
-
- timeout_ms (optional)
|
|
398
|
-
- stability_window_ms (optional)
|
|
399
|
-
- scope (optional): screen or subtree
|
|
400
|
-
- target (optional): element_id when scope=subtree
|
|
401
|
-
|
|
402
|
-
Guidance:
|
|
403
|
-
- Prefer wait_for_screen_change for navigation transitions.
|
|
404
|
-
- Prefer wait_for_ui_change for in-place mutations and non-navigation updates.
|
|
405
|
-
- Use the returned snapshot_revision as the observed synchronization point when available.
|
|
406
|
-
- Scoped waits return scope-aware stability metadata and a lightweight change summary.
|
|
407
|
-
|
|
408
|
-
Failure Handling:
|
|
409
|
-
- TIMEOUT means the UI did not change in a stable way within the allotted time.`,
|
|
410
|
-
inputSchema: {
|
|
411
|
-
type: 'object',
|
|
412
|
-
properties: {
|
|
413
|
-
platform: { type: 'string', enum: ['android', 'ios'], description: 'Optional platform override (android|ios)' },
|
|
414
|
-
deviceId: { type: 'string', description: 'Optional device id/udid to target' },
|
|
415
|
-
expected_change: { type: 'string', enum: ['hierarchy_diff', 'text_change', 'state_change'], description: 'Optional type of UI change to wait for' },
|
|
416
|
-
scope: { type: 'string', enum: ['screen', 'subtree'], default: 'screen', description: 'Synchronization scope for the wait' },
|
|
417
|
-
target: { type: 'string', description: 'Target element_id when scope is subtree' },
|
|
418
|
-
timeout_ms: { type: 'number', description: 'Timeout in ms to wait for change (default 60000)', default: 60000 },
|
|
419
|
-
stability_window_ms: { type: 'number', description: 'How long the change must remain stable before success (default 300)', default: 300 }
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
name: 'expect_screen',
|
|
425
|
-
description: `Purpose:
|
|
426
|
-
Deterministically verify that the intended navigation outcome of an action has occurred.
|
|
427
|
-
|
|
428
|
-
Inputs:
|
|
429
|
-
- fingerprint: preferred exact-match screen fingerprint
|
|
430
|
-
- screen: exact semantic screen identifier when a fingerprint is not available
|
|
431
|
-
|
|
432
|
-
Output Structure:
|
|
433
|
-
- success: true when the expected screen matches the observed screen
|
|
434
|
-
- observed_screen: current fingerprint and screen identifier
|
|
435
|
-
- expected_screen: the expected fingerprint and/or screen identifier
|
|
436
|
-
- confidence: 1 for an exact match, otherwise 0
|
|
437
|
-
|
|
438
|
-
Recommended Usage:
|
|
439
|
-
1. Define the expected screen before executing the action
|
|
440
|
-
2. Resolve the target element or screen state
|
|
441
|
-
3. Call an action tool such as tap_element
|
|
442
|
-
4. If needed, wait for transition using wait_for_*
|
|
443
|
-
5. Call expect_screen as the final verification step
|
|
444
|
-
6. If success=false, treat the outcome as unverified and follow the action tool retry guidance
|
|
445
|
-
|
|
446
|
-
Verification Guidance:
|
|
447
|
-
- Primary and authoritative verification tool for navigation outcomes
|
|
448
|
-
- Prefer fingerprint whenever you have one
|
|
449
|
-
- Use screen only as a fallback exact match against known identifiers
|
|
450
|
-
- Works best when the expected screen identifier is known ahead of time
|
|
451
|
-
- If the expected screen is not already known, capture or define it before executing the action
|
|
452
|
-
|
|
453
|
-
Constraints:
|
|
454
|
-
- Returns structured binary success/failure only
|
|
455
|
-
- Must not rely on natural-language interpretation or reasoning
|
|
456
|
-
|
|
457
|
-
Failure Handling:
|
|
458
|
-
- success=false means the expected screen was not reached; retry or recover using the action tool's failure strategy`,
|
|
459
|
-
inputSchema: {
|
|
460
|
-
type: 'object',
|
|
461
|
-
properties: {
|
|
462
|
-
platform: { type: 'string', enum: ['android', 'ios'], description: 'Optional platform override (android|ios)' },
|
|
463
|
-
fingerprint: { type: 'string', description: 'Expected screen fingerprint. Preferred verification mechanism.' },
|
|
464
|
-
screen: { type: 'string', description: 'Expected exact screen identifier when no fingerprint is available.' },
|
|
465
|
-
deviceId: { type: 'string', description: 'Optional device id/udid to target' }
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
name: 'expect_element_visible',
|
|
471
|
-
description: `Purpose:
|
|
472
|
-
Deterministically verify that the intended UI outcome of an action has occurred by confirming a target element is visible.
|
|
473
|
-
|
|
474
|
-
Inputs:
|
|
475
|
-
- selector: required selector used to resolve the target element
|
|
476
|
-
- element_id: optional previously resolved element identifier used only as context
|
|
477
|
-
|
|
478
|
-
Output Structure:
|
|
479
|
-
- success: true when the element is visible
|
|
480
|
-
- selector: selector used for verification
|
|
481
|
-
- element_id: resolved element identifier when available
|
|
482
|
-
- element: minimal resolved element info when visible
|
|
483
|
-
- failure_code: TIMEOUT or UNKNOWN when verification fails
|
|
484
|
-
- retryable: true when failure_code=TIMEOUT
|
|
485
|
-
|
|
486
|
-
Recommended Usage:
|
|
487
|
-
1. Define the expected element state before executing the action
|
|
488
|
-
2. Resolve the target element or triggering control
|
|
489
|
-
3. Call an action tool such as tap_element
|
|
490
|
-
4. If needed, wait for UI availability using wait_for_*
|
|
491
|
-
5. Call expect_element_visible as the final verification step
|
|
492
|
-
6. If success=false, follow the action tool retry guidance
|
|
493
|
-
|
|
494
|
-
Verification Guidance:
|
|
495
|
-
- Primary and authoritative verification tool for expected element appearance or visibility
|
|
496
|
-
- Use this when the screen should stay the same but the UI should reveal or update a specific element
|
|
497
|
-
- selector is the primary input; element_id is an optional optimization only
|
|
498
|
-
- The tool resolves the selector internally when needed
|
|
499
|
-
|
|
500
|
-
Constraints:
|
|
501
|
-
- Returns structured binary success/failure only
|
|
502
|
-
- Must not rely on natural-language interpretation or reasoning
|
|
503
|
-
|
|
504
|
-
Failure Handling:
|
|
505
|
-
- TIMEOUT → retry verification once or retry the action after re-resolving
|
|
506
|
-
- UNKNOWN → capture a snapshot and stop`,
|
|
507
|
-
inputSchema: {
|
|
508
|
-
type: 'object',
|
|
509
|
-
properties: {
|
|
510
|
-
selector: {
|
|
511
|
-
type: 'object',
|
|
512
|
-
properties: {
|
|
513
|
-
text: { type: 'string' },
|
|
514
|
-
resource_id: { type: 'string' },
|
|
515
|
-
accessibility_id: { type: 'string' },
|
|
516
|
-
contains: { type: 'boolean', default: false }
|
|
517
|
-
}
|
|
518
|
-
},
|
|
519
|
-
element_id: { type: 'string', description: 'Optional previously resolved element identifier.' },
|
|
520
|
-
timeout_ms: { type: 'number', default: 5000 },
|
|
521
|
-
poll_interval_ms: { type: 'number', default: 300 },
|
|
522
|
-
platform: { type: 'string', enum: ['android', 'ios'], description: 'Optional platform override' },
|
|
523
|
-
deviceId: { type: 'string', description: 'Optional device serial/udid' }
|
|
524
|
-
},
|
|
525
|
-
required: ['selector']
|
|
526
|
-
}
|
|
527
|
-
},
|
|
528
|
-
{
|
|
529
|
-
name: 'expect_state',
|
|
530
|
-
description: `Purpose:
|
|
531
|
-
Verify a readable UI state property on the currently visible element.
|
|
532
|
-
|
|
533
|
-
Inputs:
|
|
534
|
-
- selector or element_id
|
|
535
|
-
- property
|
|
536
|
-
- expected
|
|
537
|
-
- platform/deviceId (optional)
|
|
538
|
-
|
|
539
|
-
Supported properties:
|
|
540
|
-
- checked, selected, focused, expanded, enabled, text_value, value, raw_value
|
|
541
|
-
|
|
542
|
-
Verification Guidance:
|
|
543
|
-
- Use this when the UI element is visible but its state must also be confirmed
|
|
544
|
-
- Prefer the canonical property names above
|
|
545
|
-
- The tool compares the normalized readable state and returns the observed value when available
|
|
546
|
-
|
|
547
|
-
Constraints:
|
|
548
|
-
- Returns structured success/failure only
|
|
549
|
-
- Does not infer a state when the property is unavailable
|
|
550
|
-
|
|
551
|
-
Failure Handling:
|
|
552
|
-
- ELEMENT_NOT_FOUND → re-resolve the element or wait for UI stabilization
|
|
553
|
-
- UNKNOWN → capture a snapshot and stop`,
|
|
554
|
-
inputSchema: {
|
|
555
|
-
type: 'object',
|
|
556
|
-
properties: {
|
|
557
|
-
selector: {
|
|
558
|
-
type: 'object',
|
|
559
|
-
properties: {
|
|
560
|
-
text: { type: 'string' },
|
|
561
|
-
resource_id: { type: 'string' },
|
|
562
|
-
accessibility_id: { type: 'string' },
|
|
563
|
-
contains: { type: 'boolean', default: false }
|
|
564
|
-
}
|
|
565
|
-
},
|
|
566
|
-
element_id: { type: 'string', description: 'Optional previously resolved element identifier.' },
|
|
567
|
-
property: { type: 'string', description: 'Readable state property to verify.' },
|
|
568
|
-
expected: {
|
|
569
|
-
description: 'Expected normalized state value.',
|
|
570
|
-
oneOf: [
|
|
571
|
-
{ type: 'boolean' },
|
|
572
|
-
{ type: 'number' },
|
|
573
|
-
{ type: 'string' },
|
|
574
|
-
{ type: 'object' }
|
|
575
|
-
]
|
|
576
|
-
},
|
|
577
|
-
platform: { type: 'string', enum: ['android', 'ios'], description: 'Optional platform override' },
|
|
578
|
-
deviceId: { type: 'string', description: 'Optional device serial/udid' }
|
|
579
|
-
},
|
|
580
|
-
required: ['property', 'expected']
|
|
581
|
-
}
|
|
582
|
-
},
|
|
583
|
-
{
|
|
584
|
-
name: 'adjust_control',
|
|
585
|
-
description: `Purpose:
|
|
586
|
-
Adjust a numeric control value with verification.
|
|
587
|
-
|
|
588
|
-
This is the initial adjustable-control surface for slider-like controls and other controls that expose a numeric value or value_range.
|
|
589
|
-
|
|
590
|
-
Inputs:
|
|
591
|
-
- exactly one of selector or element_id
|
|
592
|
-
- property (defaults to "value")
|
|
593
|
-
- targetValue
|
|
594
|
-
- tolerance (optional; discrete default is 0, continuous default is max(step / 2, 1% of range) when omitted)
|
|
595
|
-
- maxAttempts (optional; defaults to 5)
|
|
596
|
-
- platform/deviceId (optional)
|
|
597
|
-
|
|
598
|
-
Output Structure:
|
|
599
|
-
- action_id, timestamp (ISO 8601), action_type
|
|
600
|
-
- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
|
|
601
|
-
- source_module: runtime source of the action envelope
|
|
602
|
-
- target_state / actual_state / within_tolerance / converged / attempts / adjustment_mode
|
|
603
|
-
- target.selector = original selector or element handle
|
|
604
|
-
- success = true when the control converges within tolerance
|
|
605
|
-
|
|
606
|
-
Verification Guidance:
|
|
607
|
-
- Prefer direct platform adjustment when the runtime exposes it; then verified increment/decrement actions; use coordinate fallback only as degraded mode
|
|
608
|
-
- Use expect_state for the control value readback
|
|
609
|
-
- Do not use derived semantic metadata as proof of success
|
|
610
|
-
|
|
611
|
-
Failure Handling:
|
|
612
|
-
- ELEMENT_NOT_FOUND → re-resolve the control
|
|
613
|
-
- ELEMENT_NOT_INTERACTABLE → the control cannot be adjusted through the current runtime
|
|
614
|
-
- CONTROL_CONVERGENCE_FAILED → the control did not converge within bounded retries or the requested value is out of range
|
|
615
|
-
- UNKNOWN → capture a snapshot and stop`,
|
|
616
|
-
inputSchema: {
|
|
617
|
-
type: 'object',
|
|
618
|
-
properties: {
|
|
619
|
-
selector: {
|
|
620
|
-
type: 'object',
|
|
621
|
-
properties: {
|
|
622
|
-
text: { type: 'string' },
|
|
623
|
-
resource_id: { type: 'string' },
|
|
624
|
-
accessibility_id: { type: 'string' },
|
|
625
|
-
contains: { type: 'boolean', default: false }
|
|
626
|
-
}
|
|
627
|
-
},
|
|
628
|
-
element_id: { type: 'string', description: 'Optional previously resolved element identifier.' },
|
|
629
|
-
property: { type: 'string', description: 'Readable numeric state property to adjust.', default: 'value' },
|
|
630
|
-
targetValue: { type: 'number', description: 'Target numeric value.' },
|
|
631
|
-
tolerance: { type: 'number', description: 'Accepted numeric tolerance around the target value. Defaults are derived from the readable control domain.' },
|
|
632
|
-
maxAttempts: { type: 'number', description: 'Maximum adjustment attempts.', default: 5 },
|
|
633
|
-
platform: { type: 'string', enum: ['android', 'ios'], description: 'Optional platform override' },
|
|
634
|
-
deviceId: { type: 'string', description: 'Optional device serial/udid' }
|
|
635
|
-
},
|
|
636
|
-
required: ['targetValue'],
|
|
637
|
-
oneOf: [
|
|
638
|
-
{ required: ['selector'] },
|
|
639
|
-
{ required: ['element_id'] }
|
|
640
|
-
]
|
|
641
|
-
}
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
name: 'wait_for_ui',
|
|
645
|
-
description: `Purpose:
|
|
646
|
-
Resolve elements and/or detect that a UI transition or availability condition has occurred.
|
|
647
|
-
|
|
648
|
-
Capabilities:
|
|
649
|
-
- Deterministic element resolution
|
|
650
|
-
- Synchronization when element timing or availability is uncertain
|
|
651
|
-
|
|
652
|
-
Constraints:
|
|
653
|
-
- Does not verify correctness of the resulting state
|
|
654
|
-
- Must not be used alone to confirm action success when an applicable expect_* tool exists
|
|
655
|
-
|
|
656
|
-
Recommended Usage:
|
|
657
|
-
1. Use wait_for_ui to resolve an element before acting or to wait for UI readiness
|
|
658
|
-
2. Call the action tool
|
|
659
|
-
3. If the expected outcome is known, follow with expect_* as final verification`,
|
|
660
|
-
inputSchema: {
|
|
661
|
-
type: 'object',
|
|
662
|
-
properties: {
|
|
663
|
-
selector: {
|
|
664
|
-
type: 'object',
|
|
665
|
-
properties: {
|
|
666
|
-
text: { type: 'string' },
|
|
667
|
-
resource_id: { type: 'string' },
|
|
668
|
-
accessibility_id: { type: 'string' },
|
|
669
|
-
contains: { type: 'boolean', description: 'When true, perform substring matching', default: false }
|
|
670
|
-
}
|
|
671
|
-
},
|
|
672
|
-
condition: { type: 'string', enum: ['exists', 'not_exists', 'visible', 'clickable'], default: 'exists' },
|
|
673
|
-
timeout_ms: { type: 'number', default: 60000 },
|
|
674
|
-
poll_interval_ms: { type: 'number', default: 300 },
|
|
675
|
-
match: { type: 'object', properties: { index: { type: 'number' } } },
|
|
676
|
-
retry: { type: 'object', properties: { max_attempts: { type: 'number', default: 1 }, backoff_ms: { type: 'number', default: 0 } } },
|
|
677
|
-
platform: { type: 'string', enum: ['android', 'ios'], description: 'Optional platform override' },
|
|
678
|
-
deviceId: { type: 'string', description: 'Optional device serial/udid' }
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
},
|
|
682
|
-
{
|
|
683
|
-
name: 'find_element',
|
|
684
|
-
description: `Find a UI element by semantic query (text, content-desc, resource-id, class).
|
|
685
|
-
|
|
686
|
-
Returns the best match plus resolution metadata when available, including confidence, selection reason, and fallback alternates.`,
|
|
687
|
-
inputSchema: {
|
|
688
|
-
type: 'object',
|
|
689
|
-
properties: {
|
|
690
|
-
query: { type: 'string', description: 'Search query (text or label)' },
|
|
691
|
-
exact: { type: 'boolean', description: 'Require exact match (true/false)', default: false },
|
|
692
|
-
timeoutMs: { type: 'number', description: 'Timeout in ms to keep searching', default: 3000 },
|
|
693
|
-
platform: { type: 'string', enum: ['android', 'ios'], description: 'Optional platform override' },
|
|
694
|
-
deviceId: { type: 'string', description: 'Optional device serial/udid' }
|
|
695
|
-
},
|
|
696
|
-
required: ['query']
|
|
697
|
-
}
|
|
698
|
-
},
|
|
699
|
-
{
|
|
700
|
-
name: 'tap',
|
|
701
|
-
description: `Purpose:
|
|
702
|
-
Dispatch a tap at specific screen coordinates.
|
|
703
|
-
|
|
704
|
-
Inputs:
|
|
705
|
-
- x, y coordinates
|
|
706
|
-
- platform (optional)
|
|
707
|
-
- deviceId (optional)
|
|
708
|
-
|
|
709
|
-
Output Structure:
|
|
710
|
-
- action_id, timestamp (ISO 8601), action_type
|
|
711
|
-
- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
|
|
712
|
-
- source_module: runtime source of the action envelope
|
|
713
|
-
- target.selector = { x, y }
|
|
714
|
-
- success = true when the tap was dispatched
|
|
715
|
-
- failure_code/retryable when dispatch fails
|
|
716
|
-
- ui_fingerprint_before/ui_fingerprint_after when available
|
|
717
|
-
|
|
718
|
-
Recommended Usage:
|
|
719
|
-
1. Resolve coordinates deterministically
|
|
720
|
-
2. Call tap
|
|
721
|
-
3. If needed, wait for transition using wait_for_*
|
|
722
|
-
4. Verify with expect_screen or expect_element_visible depending on the intended outcome
|
|
723
|
-
|
|
724
|
-
Verification Guidance:
|
|
725
|
-
- Prefer tap_element over tap when an element can be resolved
|
|
726
|
-
- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
|
|
727
|
-
- Use expect_screen for navigation and expect_element_visible for local UI changes
|
|
728
|
-
- Do not use wait_for_* alone as final verification when an applicable expect_* tool exists
|
|
729
|
-
|
|
730
|
-
Failure Handling:
|
|
731
|
-
- TIMEOUT → retry once
|
|
732
|
-
- UNKNOWN → capture a snapshot and stop`,
|
|
733
|
-
inputSchema: {
|
|
734
|
-
type: 'object',
|
|
735
|
-
properties: {
|
|
736
|
-
platform: {
|
|
737
|
-
type: 'string',
|
|
738
|
-
enum: ['android', 'ios'],
|
|
739
|
-
description: 'Platform to tap on'
|
|
740
|
-
},
|
|
741
|
-
x: {
|
|
742
|
-
type: 'number',
|
|
743
|
-
description: 'X coordinate'
|
|
744
|
-
},
|
|
745
|
-
y: {
|
|
746
|
-
type: 'number',
|
|
747
|
-
description: 'Y coordinate'
|
|
748
|
-
},
|
|
749
|
-
deviceId: {
|
|
750
|
-
type: 'string',
|
|
751
|
-
description: 'Device Serial/UDID. Defaults to connected/booted device.'
|
|
752
|
-
},
|
|
753
|
-
verificationMode: { type: 'string', enum: ['none', 'light', 'full'], default: 'full' },
|
|
754
|
-
responseMode: { type: 'string', enum: ['compact', 'debug'], default: 'debug' },
|
|
755
|
-
actionTimeoutMs: { type: 'number', minimum: 100, maximum: 30000 },
|
|
756
|
-
verificationTimeoutMs: { type: 'number', minimum: 100, maximum: 60000 }
|
|
757
|
-
},
|
|
758
|
-
required: ['x', 'y']
|
|
759
|
-
}
|
|
760
|
-
},
|
|
761
|
-
{
|
|
762
|
-
name: 'tap_element',
|
|
763
|
-
description: `Purpose:
|
|
764
|
-
Tap a previously resolved UI element using its elementId.
|
|
765
|
-
|
|
766
|
-
Inputs:
|
|
767
|
-
- elementId: a resolved UI element identifier returned by wait_for_ui
|
|
768
|
-
|
|
769
|
-
Output Structure:
|
|
770
|
-
- action_id: unique timestamp-based action identifier
|
|
771
|
-
- timestamp: ISO 8601 timestamp for the action attempt
|
|
772
|
-
- action_type: "tap_element"
|
|
773
|
-
- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
|
|
774
|
-
- source_module: runtime source of the action envelope
|
|
775
|
-
- target.selector: original target handle ({ elementId })
|
|
776
|
-
- target.resolved: minimal resolved element info used for the tap
|
|
777
|
-
- success: true when the tap was dispatched
|
|
778
|
-
- failure_code: present when success=false
|
|
779
|
-
- retryable: present when failure_code exists
|
|
780
|
-
- ui_fingerprint_before/ui_fingerprint_after: optional fingerprints captured around the action
|
|
781
|
-
|
|
782
|
-
Recommended Usage:
|
|
783
|
-
1. Resolve the target with wait_for_ui or another deterministic resolver
|
|
784
|
-
2. Call tap_element
|
|
785
|
-
3. If needed, wait for transition using wait_for_*
|
|
786
|
-
4. Verify outcome using expect_*
|
|
787
|
-
- use expect_screen when navigation is expected
|
|
788
|
-
- use expect_element_visible when the UI change is local
|
|
789
|
-
5. If verification fails, inspect failure_code and follow the retry strategy below
|
|
790
|
-
|
|
791
|
-
Verification Guidance:
|
|
792
|
-
- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
|
|
793
|
-
- Prefer expect_screen for navigation or modal transitions
|
|
794
|
-
- Prefer expect_element_visible when the tap should reveal or update a specific element
|
|
795
|
-
- wait_for_* may be used for resolution and synchronization, but not as the final verification step when an applicable expect_* tool exists
|
|
796
|
-
- Do not treat tap_element.success as outcome success; it only means the tap was executed
|
|
797
|
-
|
|
798
|
-
Failure Handling:
|
|
799
|
-
- STALE_REFERENCE → re-resolve the element, then retry
|
|
800
|
-
- ELEMENT_NOT_INTERACTABLE → wait or refine the target, then retry
|
|
801
|
-
- UNKNOWN → capture a snapshot and stop
|
|
802
|
-
|
|
803
|
-
This tool reports execution success only. Verification must be done with a separate expect_* tool.`,
|
|
804
|
-
inputSchema: {
|
|
805
|
-
type: 'object',
|
|
806
|
-
properties: {
|
|
807
|
-
elementId: {
|
|
808
|
-
type: 'string',
|
|
809
|
-
description: 'A unique element identifier returned by wait_for_ui'
|
|
810
|
-
},
|
|
811
|
-
selector: { type: 'object', properties: { text: { type: 'string' }, resource_id: { type: 'string' }, accessibility_id: { type: 'string' }, contains: { type: 'boolean' } } },
|
|
812
|
-
waitFor: { type: 'object', properties: { condition: { type: 'string', enum: ['exists', 'visible', 'clickable'] }, timeoutMs: { type: 'number', minimum: 100, maximum: 10000 }, pollIntervalMs: { type: 'number', minimum: 50, maximum: 1000 }, match: { type: 'object', properties: { index: { type: 'number' } } } } },
|
|
813
|
-
platform: { type: 'string', enum: ['android', 'ios'] },
|
|
814
|
-
deviceId: { type: 'string' },
|
|
815
|
-
verificationMode: { type: 'string', enum: ['none', 'light', 'full'], default: 'full' },
|
|
816
|
-
responseMode: { type: 'string', enum: ['compact', 'debug'], default: 'debug' }
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
},
|
|
820
|
-
{
|
|
821
|
-
name: 'swipe',
|
|
822
|
-
description: `Purpose:
|
|
823
|
-
Dispatch a swipe gesture on Android or iOS.
|
|
824
|
-
|
|
825
|
-
Inputs:
|
|
826
|
-
- start and end coordinates
|
|
827
|
-
- duration
|
|
828
|
-
- platform/deviceId (optional)
|
|
829
|
-
|
|
830
|
-
Output Structure:
|
|
831
|
-
- action_id, timestamp (ISO 8601), action_type
|
|
832
|
-
- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
|
|
833
|
-
- source_module: runtime source of the action envelope
|
|
834
|
-
- target.selector = { x1, y1, x2, y2, duration }
|
|
835
|
-
- success = true when the swipe was dispatched
|
|
836
|
-
- failure_code/retryable when dispatch fails
|
|
837
|
-
- ui_fingerprint_before/ui_fingerprint_after when available
|
|
838
|
-
|
|
839
|
-
Recommended Usage:
|
|
840
|
-
1. Determine swipe coordinates
|
|
841
|
-
2. Call swipe
|
|
842
|
-
3. If needed, wait for transition using wait_for_*
|
|
843
|
-
4. Verify with expect_screen or expect_element_visible when a deterministic outcome is expected
|
|
844
|
-
|
|
845
|
-
Verification Guidance:
|
|
846
|
-
- Swipe outcomes are less predictable; choose the most specific verifier available for the intended effect
|
|
847
|
-
- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
|
|
848
|
-
- Do not use wait_for_* alone as final verification when an applicable expect_* tool exists
|
|
849
|
-
|
|
850
|
-
Failure Handling:
|
|
851
|
-
- TIMEOUT → retry once
|
|
852
|
-
- UNKNOWN → capture a snapshot and stop`,
|
|
853
|
-
inputSchema: {
|
|
854
|
-
type: 'object',
|
|
855
|
-
properties: {
|
|
856
|
-
platform: {
|
|
857
|
-
type: 'string',
|
|
858
|
-
enum: ['android', 'ios'],
|
|
859
|
-
description: 'Platform to swipe on (android or ios)'
|
|
860
|
-
},
|
|
861
|
-
x1: { type: 'number', description: 'Start X coordinate' },
|
|
862
|
-
y1: { type: 'number', description: 'Start Y coordinate' },
|
|
863
|
-
x2: { type: 'number', description: 'End X coordinate' },
|
|
864
|
-
y2: { type: 'number', description: 'End Y coordinate' },
|
|
865
|
-
duration: { type: 'number', description: 'Duration in ms' },
|
|
866
|
-
deviceId: {
|
|
867
|
-
type: 'string',
|
|
868
|
-
description: 'Device Serial/UDID. Defaults to connected/booted device.'
|
|
869
|
-
}
|
|
870
|
-
},
|
|
871
|
-
required: ['x1', 'y1', 'x2', 'y2', 'duration']
|
|
872
|
-
}
|
|
873
|
-
},
|
|
874
|
-
{
|
|
875
|
-
name: 'scroll_to_element',
|
|
876
|
-
description: `Purpose:
|
|
877
|
-
Scroll until a target element becomes visible.
|
|
878
|
-
|
|
879
|
-
Inputs:
|
|
880
|
-
- platform
|
|
881
|
-
- selector
|
|
882
|
-
- direction, maxScrolls, scrollAmount, deviceId (optional)
|
|
883
|
-
|
|
884
|
-
Output Structure:
|
|
885
|
-
- action_id, timestamp (ISO 8601), action_type
|
|
886
|
-
- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
|
|
887
|
-
- source_module: runtime source of the action envelope
|
|
888
|
-
- target.selector = original selector
|
|
889
|
-
- target.resolved = minimal resolved element info when found
|
|
890
|
-
- success = true when scrolling produced a visible target element
|
|
891
|
-
- failure_code/retryable when the target was not reached
|
|
892
|
-
- ui_fingerprint_before/ui_fingerprint_after when available
|
|
893
|
-
|
|
894
|
-
Recommended Usage:
|
|
895
|
-
1. Resolve the target selector
|
|
896
|
-
2. Call scroll_to_element
|
|
897
|
-
3. If needed, wait for UI stabilization using wait_for_*
|
|
898
|
-
4. Verify with expect_element_visible when the expected element visibility is known
|
|
899
|
-
5. If success=false, follow failure handling before retrying
|
|
900
|
-
|
|
901
|
-
Verification Guidance:
|
|
902
|
-
- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
|
|
903
|
-
- Use expect_element_visible when you need an explicit post-scroll confirmation
|
|
904
|
-
- Do not use wait_for_* alone as final verification when an applicable expect_* tool exists
|
|
905
|
-
|
|
906
|
-
Failure Handling:
|
|
907
|
-
- NAVIGATION_NO_CHANGE → adjust scroll direction or stop
|
|
908
|
-
- TIMEOUT → retry with refined selector or larger scroll budget
|
|
909
|
-
- UNKNOWN → capture a snapshot and stop`,
|
|
910
|
-
inputSchema: {
|
|
911
|
-
type: 'object',
|
|
912
|
-
properties: {
|
|
913
|
-
platform: { type: 'string', enum: ['android', 'ios'], description: 'Platform to operate on (required)' },
|
|
914
|
-
selector: {
|
|
915
|
-
type: 'object',
|
|
916
|
-
properties: {
|
|
917
|
-
text: { type: 'string' },
|
|
918
|
-
resourceId: { type: 'string' },
|
|
919
|
-
contentDesc: { type: 'string' },
|
|
920
|
-
className: { type: 'string' }
|
|
921
|
-
}
|
|
922
|
-
},
|
|
923
|
-
direction: { type: 'string', enum: ['down', 'up'], default: 'down' },
|
|
924
|
-
maxScrolls: { type: 'number', default: 10 },
|
|
925
|
-
scrollAmount: { type: 'number', default: 0.7 },
|
|
926
|
-
deviceId: { type: 'string', description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.' }
|
|
927
|
-
},
|
|
928
|
-
required: ['platform', 'selector']
|
|
929
|
-
}
|
|
930
|
-
},
|
|
931
|
-
{
|
|
932
|
-
name: 'type_text',
|
|
933
|
-
description: `Purpose:
|
|
934
|
-
Type text into the currently focused Android input field.
|
|
935
|
-
|
|
936
|
-
Inputs:
|
|
937
|
-
- text
|
|
938
|
-
- platform/deviceId (optional)
|
|
939
|
-
|
|
940
|
-
Output Structure:
|
|
941
|
-
- action_id, timestamp (ISO 8601), action_type
|
|
942
|
-
- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
|
|
943
|
-
- source_module: runtime source of the action envelope
|
|
944
|
-
- target.selector = { text }
|
|
945
|
-
- success = true when text input was dispatched
|
|
946
|
-
- failure_code/retryable when dispatch fails
|
|
947
|
-
- ui_fingerprint_before/ui_fingerprint_after when available
|
|
948
|
-
|
|
949
|
-
Recommended Usage:
|
|
950
|
-
1. Resolve or focus the target input first
|
|
951
|
-
2. Call type_text
|
|
952
|
-
3. If needed, wait for UI stabilization using wait_for_*
|
|
953
|
-
4. Verify with expect_element_visible or expect_screen, depending on the intended outcome
|
|
954
|
-
|
|
955
|
-
Verification Guidance:
|
|
956
|
-
- Prefer verifying the next expected element or screen state instead of inferring success from the text action alone
|
|
957
|
-
- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
|
|
958
|
-
- Do not use wait_for_* alone as final verification when an applicable expect_* tool exists
|
|
959
|
-
|
|
960
|
-
Failure Handling:
|
|
961
|
-
- TIMEOUT → retry once
|
|
962
|
-
- UNKNOWN → re-focus the input or capture a snapshot`,
|
|
963
|
-
inputSchema: {
|
|
964
|
-
type: 'object',
|
|
965
|
-
properties: {
|
|
966
|
-
platform: {
|
|
967
|
-
type: 'string',
|
|
968
|
-
enum: ['android'],
|
|
969
|
-
description: 'Platform to type on (currently only android supported)'
|
|
970
|
-
},
|
|
971
|
-
text: {
|
|
972
|
-
type: 'string',
|
|
973
|
-
description: 'The text to type'
|
|
974
|
-
},
|
|
975
|
-
deviceId: {
|
|
976
|
-
type: 'string',
|
|
977
|
-
description: 'Device Serial/UDID. Defaults to connected/booted device.'
|
|
978
|
-
}
|
|
979
|
-
},
|
|
980
|
-
required: ['text']
|
|
981
|
-
}
|
|
982
|
-
},
|
|
983
|
-
{
|
|
984
|
-
name: 'press_back',
|
|
985
|
-
description: `Purpose:
|
|
986
|
-
Dispatch the Android Back action.
|
|
987
|
-
|
|
988
|
-
Inputs:
|
|
989
|
-
- platform/deviceId (optional)
|
|
990
|
-
|
|
991
|
-
Output Structure:
|
|
992
|
-
- action_id, timestamp (ISO 8601), action_type
|
|
993
|
-
- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
|
|
994
|
-
- source_module: runtime source of the action envelope
|
|
995
|
-
- target.selector = { key: "back" }
|
|
996
|
-
- success = true when the back action was dispatched
|
|
997
|
-
- failure_code/retryable when dispatch fails
|
|
998
|
-
- ui_fingerprint_before/ui_fingerprint_after when available
|
|
999
|
-
|
|
1000
|
-
Recommended Usage:
|
|
1001
|
-
1. Call press_back
|
|
1002
|
-
2. If needed, wait for transition using wait_for_*
|
|
1003
|
-
3. Verify with expect_screen when a known destination is expected
|
|
1004
|
-
4. If verification fails, retry once or recover explicitly
|
|
1005
|
-
|
|
1006
|
-
Verification Guidance:
|
|
1007
|
-
- Back outcomes can vary by screen, so verify against the intended destination when possible
|
|
1008
|
-
- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
|
|
1009
|
-
- Do not use wait_for_* alone as final verification when an applicable expect_* tool exists
|
|
1010
|
-
|
|
1011
|
-
Failure Handling:
|
|
1012
|
-
- TIMEOUT → retry once
|
|
1013
|
-
- UNKNOWN → capture a snapshot and stop`,
|
|
1014
|
-
inputSchema: {
|
|
1015
|
-
type: 'object',
|
|
1016
|
-
properties: {
|
|
1017
|
-
platform: {
|
|
1018
|
-
type: 'string',
|
|
1019
|
-
enum: ['android'],
|
|
1020
|
-
description: 'Platform (currently only android supported)'
|
|
1021
|
-
},
|
|
1022
|
-
deviceId: {
|
|
1023
|
-
type: 'string',
|
|
1024
|
-
description: 'Device Serial/UDID. Defaults to connected/booted device.'
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
},
|
|
1029
|
-
{
|
|
1030
|
-
name: 'classify_action_outcome',
|
|
1031
|
-
description: `Classify the outcome of the most recent action into exactly one of: success, no_op, backend_failure, ui_failure, unknown.
|
|
1032
|
-
|
|
1033
|
-
Use the runtime action result's \`action_type\` as \`actionType\` so the classifier can distinguish local-state actions from side-effect actions.
|
|
1034
|
-
Use this when the intended outcome is not already fully verified by the UI signal alone.
|
|
1035
|
-
For backend/API activity, compare get_screen_fingerprint before and after the action and call get_network_activity immediately after the action if the outcome is still ambiguous.
|
|
1036
|
-
|
|
1037
|
-
HOW TO GATHER INPUTS before calling:
|
|
1038
|
-
1. Call wait_for_screen_change or compare get_screen_fingerprint before/after — set uiChanged accordingly.
|
|
1039
|
-
2. If you checked for a specific element with wait_for_ui, set expectedElementVisible.
|
|
1040
|
-
3. Pass actionType from the action response when available.
|
|
1041
|
-
4. Only provide networkRequests if you already collected them or want to classify a side-effect action with backend evidence.
|
|
1042
|
-
|
|
1043
|
-
RULES (applied in order — stop at first match):
|
|
1044
|
-
1. If uiChanged=true OR expectedElementVisible=true → outcome=success
|
|
1045
|
-
2. If actionType is missing → outcome=unknown
|
|
1046
|
-
3. If any request has status=failure or retryable → outcome=backend_failure
|
|
1047
|
-
4. If actionType maps to a local-state action → outcome=no_op; prefer state-based verification and avoid default network fallback
|
|
1048
|
-
5. If actionType maps to a side-effect action and no networkRequests were supplied → outcome=unknown
|
|
1049
|
-
6. If no requests returned → outcome=no_op
|
|
1050
|
-
7. If all requests succeeded → outcome=ui_failure
|
|
1051
|
-
8. Otherwise → outcome=unknown
|
|
1052
|
-
|
|
1053
|
-
BEHAVIOUR after outcome:
|
|
1054
|
-
- success → continue
|
|
1055
|
-
- no_op → retry with richer state verification or re-resolve the element
|
|
1056
|
-
- backend_failure → stop and report the failing endpoint
|
|
1057
|
-
- ui_failure → stop and report failure
|
|
1058
|
-
- unknown → take one recovery step (e.g. capture_debug_snapshot), then stop`,
|
|
1059
|
-
inputSchema: {
|
|
1060
|
-
type: 'object',
|
|
1061
|
-
properties: {
|
|
1062
|
-
uiChanged: {
|
|
1063
|
-
type: 'boolean',
|
|
1064
|
-
description: 'true if the screen fingerprint or activity changed after the action. Use wait_for_screen_change or compare get_screen_fingerprint before and after.'
|
|
1065
|
-
},
|
|
1066
|
-
expectedElementVisible: {
|
|
1067
|
-
type: 'boolean',
|
|
1068
|
-
description: 'true if the element you expected to appear is now visible (from wait_for_ui). Omit if you did not check for a specific element.'
|
|
1069
|
-
},
|
|
1070
|
-
actionType: {
|
|
1071
|
-
type: 'string',
|
|
1072
|
-
description: 'The runtime action_type from the action response (for example tap, tap_element, swipe, type_text, press_back, start_app).'
|
|
1073
|
-
},
|
|
1074
|
-
networkRequests: {
|
|
1075
|
-
type: 'array',
|
|
1076
|
-
description: 'Optional network evidence collected after the action. Use it when the expected outcome is backend/API activity or when the UI signal is ambiguous.',
|
|
1077
|
-
items: {
|
|
1078
|
-
type: 'object',
|
|
1079
|
-
properties: {
|
|
1080
|
-
endpoint: { type: 'string', description: 'Request endpoint or full URL' },
|
|
1081
|
-
status: { type: 'string', enum: ['success', 'failure', 'retryable'], description: 'Outcome of the request' }
|
|
1082
|
-
},
|
|
1083
|
-
required: ['endpoint', 'status']
|
|
1084
|
-
}
|
|
1085
|
-
},
|
|
1086
|
-
hasLogErrors: {
|
|
1087
|
-
type: 'boolean',
|
|
1088
|
-
description: 'true if structured log errors were observed (e.g. from read_log_stream). Optional — include if you have already read logs.'
|
|
1089
|
-
}
|
|
1090
|
-
},
|
|
1091
|
-
required: ['uiChanged']
|
|
1092
|
-
}
|
|
1093
|
-
},
|
|
1094
|
-
{
|
|
1095
|
-
name: 'run_journey',
|
|
1096
|
-
description: 'Run an ordered, bounded sequence of start_app, tap, wait, and deterministic assertion steps against one device. Stops after the first failed step.',
|
|
1097
|
-
inputSchema: {
|
|
1098
|
-
type: 'object',
|
|
1099
|
-
properties: {
|
|
1100
|
-
platform: { type: 'string', enum: ['android', 'ios'] },
|
|
1101
|
-
deviceId: { type: 'string' },
|
|
1102
|
-
responseMode: { type: 'string', enum: ['compact', 'debug'], default: 'compact' },
|
|
1103
|
-
steps: { type: 'array', minItems: 1, maxItems: 50, items: { type: 'object', properties: { id: { type: 'string' }, type: { type: 'string', enum: ['start_app', 'tap', 'wait', 'assert'] } }, required: ['id', 'type'] } }
|
|
1104
|
-
},
|
|
1105
|
-
required: ['platform', 'steps']
|
|
1106
|
-
}
|
|
1107
|
-
},
|
|
1108
|
-
{
|
|
1109
|
-
name: 'get_network_activity',
|
|
1110
|
-
description: `Returns structured network events captured from platform logs since the last action.
|
|
1111
|
-
|
|
1112
|
-
Call this immediately after an action when you want backend evidence for a side-effect flow, only if the result is still ambiguous.
|
|
1113
|
-
Do not call more than once per action.
|
|
1114
|
-
|
|
1115
|
-
Events are filtered to significant (non-background) requests only.
|
|
1116
|
-
Each event includes endpoint, method, statusCode, networkError, status, and durationMs.
|
|
1117
|
-
|
|
1118
|
-
status values:
|
|
1119
|
-
- success: HTTP 2xx or request detected with no error signal
|
|
1120
|
-
- failure: HTTP 4xx
|
|
1121
|
-
- retryable: HTTP 5xx, network error (timeout, dns_error, tls_error, etc.)
|
|
1122
|
-
|
|
1123
|
-
Returns { requests: [], count: 0 } when no credible network signals are found.`,
|
|
1124
|
-
inputSchema: {
|
|
1125
|
-
type: 'object',
|
|
1126
|
-
properties: {
|
|
1127
|
-
platform: {
|
|
1128
|
-
type: 'string',
|
|
1129
|
-
enum: ['android', 'ios'],
|
|
1130
|
-
description: 'Platform to read network logs from'
|
|
1131
|
-
},
|
|
1132
|
-
deviceId: {
|
|
1133
|
-
type: 'string',
|
|
1134
|
-
description: 'Device Serial (Android) or UDID (iOS). Defaults to connected/booted device.'
|
|
1135
|
-
}
|
|
1136
|
-
},
|
|
1137
|
-
required: ['platform']
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
65
|
+
...baseOrder.map(name => baseTools.get(name)!)
|
|
1140
66
|
]
|
|
1141
67
|
|
|
1142
68
|
// Keep the additive execution controls consistent across all action tools.
|
|
1143
69
|
for (const tool of toolDefinitions) {
|
|
70
|
+
tool.inputSchema.properties ??= {}
|
|
1144
71
|
if (['wait_for_ui', 'wait_for_ui_change'].includes(tool.name)) {
|
|
1145
72
|
tool.inputSchema.properties.requireReady = { type: 'boolean', default: false }
|
|
1146
73
|
tool.description += '\nSet requireReady=true to require both the existing predicate and settled UI readiness, using the same fresh samples and one timeout budget. The readiness summary explains uncertainty. Default predicate semantics are unchanged.'
|
|
@@ -1150,7 +77,7 @@ for (const tool of toolDefinitions) {
|
|
|
1150
77
|
if (conditionalTools.has(tool.name)) {
|
|
1151
78
|
tool.inputSchema.properties.expectedState = expectedStateJson
|
|
1152
79
|
tool.inputSchema.properties.platform ??= { type: 'string', enum: ['android'] }
|
|
1153
|
-
tool.inputSchema.allOf = [...(tool.inputSchema.allOf
|
|
80
|
+
tool.inputSchema.allOf = [...(Array.isArray(tool.inputSchema.allOf) ? tool.inputSchema.allOf : []), {
|
|
1154
81
|
if: { required: ['expectedState'] },
|
|
1155
82
|
then: { required: ['platform', 'deviceId'], properties: {
|
|
1156
83
|
platform: { enum: ['type_text', 'press_back'].includes(tool.name) ? ['android'] : ['android', 'ios'] },
|
|
@@ -1159,12 +86,12 @@ for (const tool of toolDefinitions) {
|
|
|
1159
86
|
}]
|
|
1160
87
|
tool.description += '\n\nConditional input: optionally supply expectedState { snapshotSessionId, snapshotRevision, timeoutMs? } from a successful get_ui_tree on the same explicit platform/deviceId. A fresh normalized UI-tree check runs immediately before input, even with verification disabled. PRECONDITION_FAILED or PRECONDITION_UNAVAILABLE means no input was dispatched; inspect condition evidence and re-observe before deciding what to do next. Compact failures include the fresh UI tree. This is not atomic with OS input delivery.'
|
|
1161
88
|
} else {
|
|
1162
|
-
tool.inputSchema.allOf = [...(tool.inputSchema.allOf
|
|
89
|
+
tool.inputSchema.allOf = [...(Array.isArray(tool.inputSchema.allOf) ? tool.inputSchema.allOf : []), { not: { required: ['expectedState'] } }]
|
|
1163
90
|
}
|
|
1164
91
|
if (['start_app', 'restart_app', 'tap', 'tap_element', 'swipe', 'scroll_to_element', 'type_text', 'press_back'].includes(tool.name)) {
|
|
1165
92
|
Object.assign(tool.inputSchema.properties, {
|
|
1166
|
-
verificationMode: {
|
|
1167
|
-
responseMode: {
|
|
93
|
+
verificationMode: { ...verificationModeJson, default: 'full' },
|
|
94
|
+
responseMode: { ...responseModeJson, default: 'debug' },
|
|
1168
95
|
actionTimeoutMs: { type: 'integer', description: 'Dispatch budget in milliseconds, clamped to 100–30000.' },
|
|
1169
96
|
verificationTimeoutMs: { type: 'integer', description: 'Light observation budget in milliseconds, clamped to 100–60000.' }
|
|
1170
97
|
})
|
|
@@ -1172,9 +99,10 @@ for (const tool of toolDefinitions) {
|
|
|
1172
99
|
if (tool.name === 'tap_element') Object.assign(tool.inputSchema, { oneOf: [{ required: ['elementId'], not: { required: ['selector'] } }, { required: ['selector'], not: { required: ['elementId'] } }] })
|
|
1173
100
|
if (tool.name === 'run_journey') Object.assign(tool.inputSchema.properties, {
|
|
1174
101
|
steps: journeyStepsJson,
|
|
102
|
+
systemTraceId: { type: 'string', format: 'uuid', description: 'Explicit active same-device system trace. Invalid references prevent all journey input. Capture lifetime is controlled separately.' },
|
|
1175
103
|
captureOnFailure: { type: 'boolean', default: false },
|
|
1176
|
-
defaults: { type: 'object', additionalProperties: false, properties: {
|
|
1177
|
-
verificationMode:
|
|
104
|
+
defaults: { type: 'object' as const, additionalProperties: false, properties: {
|
|
105
|
+
verificationMode: verificationModeJson,
|
|
1178
106
|
actionTimeoutMs: { type: 'integer' }, verificationTimeoutMs: { type: 'integer' }
|
|
1179
107
|
} }
|
|
1180
108
|
})
|
|
@@ -1182,9 +110,10 @@ for (const tool of toolDefinitions) {
|
|
|
1182
110
|
|
|
1183
111
|
// Correlation is explicit; an omitted reference creates an independent observation.
|
|
1184
112
|
for (const tool of toolDefinitions) {
|
|
113
|
+
tool.inputSchema.properties ??= {}
|
|
1185
114
|
if (['capture_screenshot', 'get_ui_tree', 'get_screen_fingerprint', 'capture_debug_snapshot', 'get_logs', 'read_log_stream'].includes(tool.name)) {
|
|
1186
115
|
Object.assign(tool.inputSchema.properties, { actionRef: {
|
|
1187
|
-
type: 'object', additionalProperties: false, required: ['sessionId', 'actionId'], properties: {
|
|
116
|
+
type: 'object' as const, additionalProperties: false, required: ['sessionId', 'actionId'], properties: {
|
|
1188
117
|
sessionId: { type: 'string', minLength: 1, maxLength: 128 },
|
|
1189
118
|
actionId: { type: 'string', minLength: 1, maxLength: 128 }
|
|
1190
119
|
}
|