From aaa845c32ecb196087f38ad6e69debd68a6bb8e1 Mon Sep 17 00:00:00 2001 From: cryptotavares Date: Fri, 20 Nov 2026 12:02:06 +0000 Subject: [PATCH 1/3] chore: bump @metamask/device-mcp to ^0.9.0 Type the persistent Hermes client against device-mcp's HermesClient and test the 0.9.0 Android error shapes (TargetObscuredError with keyboard, the verified dismissKeyboard failure) and snapshot warnings. --- README.md | 4 +- SKILL.md | 6 +- package.json | 2 +- .../mobile-platform-driver.hermes.test.ts | 2 +- src/platform/mobile-platform-driver.test.ts | 71 +++++++++++++++++++ src/platform/mobile-platform-driver.ts | 67 +++++------------ src/tools/device.test.ts | 18 +++++ src/tools/error-classification.test.ts | 33 +++++++++ yarn.lock | 10 +-- 9 files changed, 150 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 4011f4d0..2ebc6132 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,7 @@ type ISessionManager = { Core captures `sessionManager.getPlatformDriver?.()` before calling the consumer's `cleanup()`, then calls the driver's optional `dispose()` hook. Disposal runs even when consumer cleanup fails. This applies to `mm cleanup`, forced relaunch, failed launch, daemon shutdown, and server startup rollback. A failed disposal fails that cleanup call and is retained for a later attempt. The daemon owns that retention (one per `createServer` instance), so a later `mm cleanup`, forced relaunch, or daemon stop retries it, whatever wrapper of the session manager a tool receives. Only the current session's cleanup and disposal can fail a call. Drivers retained from earlier sessions are retried best-effort and in parallel. When they fail again, the daemon writes a `[WARN]` line to its log, and the current cleanup or launch continues. Tools reach this retention through `ToolContext.cleanupSession()`; without it (a context built outside the daemon), the tools fall back to retention per session-manager object. -`MobilePlatformDriver.dispose()` delegates to its backend's optional `dispose()` hook. Core requires `@metamask/device-mcp` 0.8.0 or later. On iOS, the device-mcp `IdbBackend` uses a private IDB companion per backend, and disposal stops only that backend's companion and recording. The ADB backend has no disposal hook, so disposal does nothing on Android. The consumer must create its backend from device-mcp 0.8.0 or later to get companion teardown. +`MobilePlatformDriver.dispose()` delegates to its backend's optional `dispose()` hook. Core depends on `@metamask/device-mcp` ^0.9.0 and requires a backend from 0.8.0 or later. On iOS, the device-mcp `IdbBackend` uses a private IDB companion per backend, and disposal stops only that backend's companion and recording. The ADB backend has no disposal hook, so disposal does nothing on Android. The consumer must create its backend from device-mcp 0.8.0 or later to get companion teardown. Consumers must expose a session-owned driver through `getPlatformDriver()` and create a fresh driver/backend for each launch. If launch fails before the driver is exposed, the consumer must dispose that locally held driver in its own failure path. Direct calls to a consumer's `cleanup()` also remain the consumer's responsibility. @@ -710,7 +710,7 @@ The `params-json` argument must be a valid JSON object. The `--timeout` flag set | Prerequisite | An active browser session | An active mobile session with a DEBUG build and Metro running | | Errors | `MM_CDP_BLOCKED` / `MM_CDP_FAILED`; `MM_INVALID_INPUT` for a mobile-only target | `MM_CDP_BLOCKED` / `MM_CDP_FAILED` (the underlying `HERMES_*` code is preserved in the message, with the Metro port used); `MM_INVALID_INPUT` for a browser-only target | -On mobile, `Runtime.evaluate` nests its value at `result.result.value`. `cdp` and `hermes-targets` use the Metro port the session was launched with (`mm launch --metro-port`), then the `HERMES_METRO_PORT` env var, then `8081`; `--metro-port` / `--app-id` on a call only override it for that call, and such a call opens a one-shot connection. The app id defaults to `HERMES_APP_ID`, else the platform default. When device-mcp exports `HermesClient` (needs a device-mcp release with MetaMask/device-mcp P2-02), the session keeps one Hermes connection for its Metro port and app id and reuses it across calls; otherwise each call opens its own connection. +On mobile, `Runtime.evaluate` nests its value at `result.result.value`. `cdp` and `hermes-targets` use the Metro port the session was launched with (`mm launch --metro-port`), then the `HERMES_METRO_PORT` env var, then `8081`; `--metro-port` / `--app-id` on a call only override it for that call, and such a call opens a one-shot connection. The app id defaults to `HERMES_APP_ID`, else the platform default. When the loaded device-mcp exports `HermesClient` (0.9.0 and later), the session keeps one Hermes connection for its Metro port and app id and reuses it across calls; otherwise each call opens its own connection. ```bash # Mobile (Hermes) — the session keeps the launch Metro port diff --git a/SKILL.md b/SKILL.md index c9005976..ca4e67b0 100644 --- a/SKILL.md +++ b/SKILL.md @@ -337,7 +337,7 @@ If the page closes after clicking (e.g., confirmation popup), the response inclu **Browser hidden checkbox or radio:** toggles often keep the real `` (and its test id) at 1×1 pixel under decorative elements, for example `mm click --testid basic-functionality-toggle`. When the target is such an input and it has one label (a wrapping `