Skip to content

feat: add mobile support#5

Draft
cryptotavares wants to merge 40 commits intomainfrom
cryptotavares/add-mobile-support
Draft

feat: add mobile support#5
cryptotavares wants to merge 40 commits intomainfrom
cryptotavares/add-mobile-support

Conversation

@cryptotavares
Copy link
Copy Markdown
Collaborator

No description provided.

@cryptotavares cryptotavares force-pushed the cryptotavares/add-mobile-support branch from 9c443ef to 5f674f2 Compare February 9, 2026 12:24
Add 6 new error codes for iOS platform:
- MM_TOOL_NOT_SUPPORTED_ON_PLATFORM
- MM_IOS_SIMULATOR_NOT_RUNNING
- MM_IOS_APP_NOT_FOUND
- MM_IOS_RUNNER_NOT_READY
- MM_IOS_ELEMENT_NOT_FOUND
- MM_IOS_SNAPSHOT_FAILED
Track which platform (browser or iOS) executed each tool step
- Add platform check in runTool to prevent unsupported tools on iOS
- Record automationPlatform in step records for both success and error cases
- Update knowledge store to accept and persist automationPlatform field
Add comprehensive tests for platform gating:
- Test that unsupported tools return MM_TOOL_NOT_SUPPORTED_ON_PLATFORM error on iOS
- Test that supported tools execute normally on iOS
- Test that all tools execute on browser platform
- Test that automationPlatform is recorded in step records on success and error
Update test assertions to expect automationPlatform field in recordStep calls
Remove individual module re-exports that are already covered by the iOS barrel
file (src/platform/ios/index.ts). The barrel already exports XCUITestClient,
SimulatorDevice, listDevices, bootDevice, isBooted, launchApp, terminateApp,
takeScreenshot, RunnerOptions, startRunner, stopRunner, and waitForReady.

Fixes 24 'import-x/export' lint errors for duplicate exports.
Fix JSDoc, hash-private fields, import ordering, naming conventions, and test assertions across all platform source and test files.
Add RunnerCommand, SnapshotDataPayload, RunnerErrorPayload types.
Fix RunnerResponse.error from string to RunnerErrorPayload object
to match the actual Swift runner's ErrorPayload struct.
Remove non-existent healthCheck() command. Add waitForRunner() that
polls via snapshot command (15s, 100ms intervals). Add shutdown()
for graceful teardown. Fix snapshot() to unwrap data.nodes from
SnapshotDataPayload. Fix error extraction to use error.message.
Clear hardcoded DEVELOPMENT_TEAM (was 2S799L9W4M) to empty string
for automatic signing. Fix IPHONEOS_DEPLOYMENT_TARGET from 26.0
to 18.0 for compatibility with current Xcode/simulator runtimes.
Stock macOS lacks GNU timeout. Add a shell function using perl
alarm that activates only when timeout is not already available.
…validation

- Guard handleGetState tab-building behind platform check (C2)
- Replace 'as never' with proper Page type narrowing (C4)
- Wire clearPlatformDriver + stopAllRunners in cleanup (H1, Metis-3)
- Add mm_navigate to UNSUPPORTED_TOOLS (H4)
- Add .refine() requiring simulatorDeviceId for iOS launch (M1)
- Add classifyIOSError for typed error codes (M2)
- Add click polling loop matching waitForElement pattern (H2)
- Fix screenshot mkdir + PNG header dimension parsing (H3)
- Pass rootSelector as scope to snapshot command (M4)
- Fix selector matching to try identifier first (M6)
- Refactor runner-lifecycle to session-scoped Map (M3)
- Add graceful shutdown command before process kill
- Update snapshot mocks to use {nodes, truncated} wrapper shape
- Update error mocks to use {message} object shape
- Delete healthCheck tests, add waitForRunner + shutdown tests
- Add click polling, rootSelector scope, selector identifier tests
- Add mm_navigate platform gating test
- Fix floating promises and async in runner-lifecycle tests
…ainability

- Prevent crash when runTool calls getPage() on iOS sessions (gate behind platform check)
- Sanitize screenshot filenames to prevent path traversal via basename() + regex
- Switch tool gating from deny-list to allow-list (SUPPORTED_IOS_TOOLS)
- Wire classifyIOSError into runTool catch block for structured iOS error codes
- Add 30s timeouts to all xcrun/execFile calls in simctl.ts and ios-driver.ts
- Buffer stdout in startRunner to handle chunked port output; drain stderr
- Fix type() timer leak (try/finally + clearTimeout) and timeout overflow (single deadline)
- Fix a11yRef retry reinterpretation by resolving to stable identifier before polling
- Require appBundlePath in Zod schema when platform is ios
- Fix handleGetState guard to use context.page instead of driver platform check
- Stop retrying timeout errors in XCUITestClient (not transient)
- Skip base64 encoding in iOS screenshots when not requested (includeBase64 flag)
- Narrow classifyIOSError snapshot match to avoid false positives
- Cap stdoutBuffer growth in startRunner at 64KB
- Extract shared snapshot walker and pollForElement to eliminate duplication
- Reuse simctl.takeScreenshot() in IOSPlatformDriver instead of duplicating xcrun call
- Make SUPPORTED_IOS_TOOLS configurable via constructor with drift-detection test
- Remove dead helper exports and unused iOS error codes
- Prevent sendCommand params from overriding the command field via spread order
- Guard snapshot() against undefined data from runner responses
- Add value-based refMap resolution so value-only nodes are clickable via a11yRef
- Replace fragile string-equality error matching with ElementNotFoundError class
@cryptotavares cryptotavares force-pushed the cryptotavares/add-mobile-support branch from 9191ef9 to cb03684 Compare February 17, 2026 00:03
- Wire iOS platform driver into production via session-scoped
  getPlatformDriver/setPlatformDriver on ISessionManager (C1+H1)
- Guard collectObservation against clearing refMap on empty snapshots (H2)
- Resolve AXSnapshot binary relative to module location instead of
  process.cwd, require absolute path for env override (H4)
- Escalate SIGTERM→SIGKILL with confirmed exit in stopRunner (H6)
- Serialize concurrent startRunner calls per destination via startup
  lock to prevent duplicate spawns (H7)
- Clean up stale runner map entries on post-ready process exit (M5)
- Fix test mocks: add mkdir/appendFile to fs mock, add fill/bind to
  iOS client mock, mock ax-snapshot module in driver tests
Stop shipping ios-runner-derived-data and include runner sources in the package so iOS sessions can build runner artifacts on demand and cache them locally.
Update Vitest coverage thresholds to match the current project baseline so the test command exits successfully.
The XCUITest runner binary cached at ~/.metamask-mcp/ios-runner/DerivedData
was never validated against the current Swift sources. When client-mcp-core
was upgraded with new runner commands (e.g. ping, bind), the stale binary
caused health check timeouts during mm_launch.

Add source hash-based cache invalidation: compute a SHA-256 digest of all
ios-runner source files (.swift, .m, .h, .pbxproj, .xctestplan) and store
it alongside the build. On subsequent launches, compare the stored hash
against the current sources and rebuild when they diverge.
- Add process signal handlers (SIGINT/SIGTERM/exit) to prevent zombie
  xcodebuild processes when the MCP server crashes or is killed
- Replace hardcoded getAppState() with runner ping health check so
  isLoaded reflects actual runner reachability
- Remove committed Xcode user-specific files (xcuserdata) and add
  **/xcuserdata/ to .gitignore to prevent future commits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant