Mobile MCP: let AI agents drive your iOS and Android apps. MCP server for simulators, emulators and real devices. Works with Claude Code, Codex, Cursor and any MCP client.
TypeScript agentandroidandroid-automationappium-alternativeclaude-codecodexcursoremulatoriosios-automationmcpmcp-servermobilemobile-automationmobile-testingreal-devicesimulatorskills
feat: new ios simulator support
Gil Megidish0ccd276f368d
diff --git a/.gitignore b/.gitignoreindex 491fc35..fe816b2 100644--- a/.gitignore+++ b/.gitignore@@ -1,2 +1,3 @@+**/.DS_Storenode_moduleslibdiff --git a/.husky/pre-commit b/.husky/pre-commitnew file mode 100755index 0000000..3867a0f--- /dev/null+++ b/.husky/pre-commit@@ -0,0 +1 @@+npm run lintdiff --git a/package-lock.json b/package-lock.jsonindex 1bd0585..0422921 100644--- a/package-lock.json+++ b/package-lock.json@@ -21,6 +21,7 @@"@eslint/eslintrc": "^3.2.0","@eslint/js": "^9.19.0","@stylistic/eslint-plugin": "^3.0.1",+ "@types/mocha": "^10.0.10","@types/node": "^22.13.10","@typescript-eslint/eslint-plugin": "^8.28.0","@typescript-eslint/parser": "^8.26.1",@@ -29,12 +30,28 @@"eslint-plugin": "^1.0.1","eslint-plugin-import": "^2.31.0","eslint-plugin-notice": "^1.0.0",+ "husky": "^9.1.7",+ "mocha": "^11.1.0",+ "ts-node": "^10.9.2","typescript": "^5.8.2"},"engines": {"node": ">=18"}},+ "node_modules/@cspotcode/source-map-support": {+ "version": "0.8.1",+ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",+ "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/trace-mapping": "0.3.9"+ },+ "engines": {+ "node": ">=12"+ }+ },"node_modules/@emnapi/runtime": {"version": "1.4.0","resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.4.0.tgz",@@ -610,6 +627,52 @@"url": "https://opencollective.com/libvips"}},+ "node_modules/@isaacs/cliui": {+ "version": "8.0.2",+ "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",+ "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "string-width": "^5.1.2",+ "string-width-cjs": "npm:string-width@^4.2.0",+ "strip-ansi": "^7.0.1",+ "strip-ansi-cjs": "npm:strip-ansi@^6.0.1",+ "wrap-ansi": "^8.1.0",+ "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@jridgewell/resolve-uri": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/@jridgewell/sourcemap-codec": {+ "version": "1.5.0",+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",+ "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@jridgewell/trace-mapping": {+ "version": "0.3.9",+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",+ "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/resolve-uri": "^3.0.3",+ "@jridgewell/sourcemap-codec": "^1.4.10"+ }+ },"node_modules/@modelcontextprotocol/sdk": {"version": "1.8.0","resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.8.0.tgz",@@ -669,6 +732,17 @@"node": ">= 8"}},+ "node_modules/@pkgjs/parseargs": {+ "version": "0.11.0",+ "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",+ "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "engines": {+ "node": ">=14"+ }+ },"node_modules/@rtsao/scc": {"version": "1.1.0","resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz",@@ -696,6 +770,34 @@"eslint": ">=8.40.0"}},+ "node_modules/@tsconfig/node10": {+ "version": "1.0.11",+ "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz",+ "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@tsconfig/node12": {+ "version": "1.0.11",+ "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",+ "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@tsconfig/node14": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",+ "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@tsconfig/node16": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",+ "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",+ "dev": true,+ "license": "MIT"+ },"node_modules/@types/estree": {"version": "1.0.7","resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz",@@ -717,6 +819,13 @@"dev": true,"license": "MIT"},+ "node_modules/@types/mocha": {+ "version": "10.0.10",+ "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz",+ "integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==",+ "dev": true,+ "license": "MIT"+ },"node_modules/@types/node": {"version": "22.13.14","resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.14.tgz",@@ -969,6 +1078,19 @@"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"}},+ "node_modules/acorn-walk": {+ "version": "8.3.4",+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",+ "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "acorn": "^8.11.0"+ },+ "engines": {+ "node": ">=0.4.0"+ }+ },"node_modules/ajv": {"version": "6.12.6","resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",@@ -986,6 +1108,29 @@"url": "https://github.com/sponsors/epoberezkin"}},+ "node_modules/ansi-colors": {+ "version": "4.1.3",+ "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz",+ "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/ansi-regex": {+ "version": "6.1.0",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz",+ "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"+ }+ },"node_modules/ansi-styles": {"version": "4.3.0","resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",@@ -1002,6 +1147,40 @@"url": "https://github.com/chalk/ansi-styles?sponsor=1"}},+ "node_modules/anymatch": {+ "version": "3.1.3",+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "normalize-path": "^3.0.0",+ "picomatch": "^2.0.4"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/anymatch/node_modules/picomatch": {+ "version": "2.3.1",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8.6"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },+ "node_modules/arg": {+ "version": "4.1.3",+ "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",+ "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",+ "dev": true,+ "license": "MIT"+ },"node_modules/argparse": {"version": "2.0.1","resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",@@ -1162,6 +1341,19 @@"dev": true,"license": "MIT"},+ "node_modules/binary-extensions": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",+ "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },"node_modules/body-parser": {"version": "2.2.0","resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz",@@ -1221,6 +1413,13 @@"node": ">=8"}},+ "node_modules/browser-stdout": {+ "version": "1.3.1",+ "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",+ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",+ "dev": true,+ "license": "ISC"+ },"node_modules/bytes": {"version": "3.1.2","resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",@@ -1305,6 +1504,122 @@"url": "https://github.com/chalk/chalk?sponsor=1"}},+ "node_modules/chokidar": {+ "version": "3.6.0",+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",+ "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "anymatch": "~3.1.2",+ "braces": "~3.0.2",+ "glob-parent": "~5.1.2",+ "is-binary-path": "~2.1.0",+ "is-glob": "~4.0.1",+ "normalize-path": "~3.0.0",+ "readdirp": "~3.6.0"+ },+ "engines": {+ "node": ">= 8.10.0"+ },+ "funding": {+ "url": "https://paulmillr.com/funding/"+ },+ "optionalDependencies": {+ "fsevents": "~2.3.2"+ }+ },+ "node_modules/chokidar/node_modules/glob-parent": {+ "version": "5.1.2",+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "is-glob": "^4.0.1"+ },+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/cliui": {+ "version": "8.0.1",+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",+ "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "string-width": "^4.2.0",+ "strip-ansi": "^6.0.1",+ "wrap-ansi": "^7.0.0"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/cliui/node_modules/ansi-regex": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/cliui/node_modules/emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/cliui/node_modules/string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/cliui/node_modules/strip-ansi": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-regex": "^5.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/cliui/node_modules/wrap-ansi": {+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-styles": "^4.0.0",+ "string-width": "^4.1.0",+ "strip-ansi": "^6.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"+ }+ },"node_modules/color": {"version": "4.2.3","resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz",@@ -1405,6 +1720,13 @@"node": ">= 0.10"}},+ "node_modules/create-require": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",+ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",+ "dev": true,+ "license": "MIT"+ },"node_modules/cross-spawn": {"version": "7.0.6","resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",@@ -1551,6 +1873,16 @@"node": ">=8"}},+ "node_modules/diff": {+ "version": "5.2.0",+ "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz",+ "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==",+ "dev": true,+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=0.3.1"+ }+ },"node_modules/doctrine": {"version": "2.1.0","resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",@@ -1578,12 +1910,26 @@"node": ">= 0.4"}},+ "node_modules/eastasianwidth": {+ "version": "0.2.0",+ "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",+ "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",+ "dev": true,+ "license": "MIT"+ },"node_modules/ee-first": {"version": "1.1.1","resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz","integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==","license": "MIT"},+ "node_modules/emoji-regex": {+ "version": "9.2.2",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",+ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",+ "dev": true,+ "license": "MIT"+ },"node_modules/encodeurl": {"version": "2.0.0","resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",@@ -1736,6 +2082,16 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/escalade": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },"node_modules/escape-html": {"version": "1.0.3","resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",@@ -2299,6 +2655,16 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/flat": {+ "version": "5.0.2",+ "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",+ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==",+ "dev": true,+ "license": "BSD-3-Clause",+ "bin": {+ "flat": "cli.js"+ }+ },"node_modules/flat-cache": {"version": "4.0.1","resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz",@@ -2336,6 +2702,23 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/foreground-child": {+ "version": "3.3.1",+ "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",+ "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "cross-spawn": "^7.0.6",+ "signal-exit": "^4.0.1"+ },+ "engines": {+ "node": ">=14"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },"node_modules/forwarded": {"version": "0.2.0","resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",@@ -2354,6 +2737,21 @@"node": ">= 0.8"}},+ "node_modules/fsevents": {+ "version": "2.3.3",+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"+ }+ },"node_modules/function-bind": {"version": "1.1.2","resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",@@ -2394,6 +2792,16 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/get-caller-file": {+ "version": "2.0.5",+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": "6.* || 8.* || >= 10.*"+ }+ },"node_modules/get-intrinsic": {"version": "1.3.0","resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",@@ -2449,6 +2857,27 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/glob": {+ "version": "10.4.5",+ "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",+ "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "foreground-child": "^3.1.0",+ "jackspeak": "^3.1.2",+ "minimatch": "^9.0.4",+ "minipass": "^7.1.2",+ "package-json-from-dist": "^1.0.0",+ "path-scurry": "^1.11.1"+ },+ "bin": {+ "glob": "dist/esm/bin.mjs"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },"node_modules/glob-parent": {"version": "6.0.2","resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",@@ -2462,13 +2891,39 @@"node": ">=10.13.0"}},- "node_modules/globals": {- "version": "14.0.0",- "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",- "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",+ "node_modules/glob/node_modules/brace-expansion": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",+ "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==","dev": true,"license": "MIT",- "engines": {+ "dependencies": {+ "balanced-match": "^1.0.0"+ }+ },+ "node_modules/glob/node_modules/minimatch": {+ "version": "9.0.5",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",+ "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "brace-expansion": "^2.0.1"+ },+ "engines": {+ "node": ">=16 || 14 >=14.17"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/globals": {+ "version": "14.0.0",+ "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",+ "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",+ "dev": true,+ "license": "MIT",+ "engines": {"node": ">=18"},"funding": {@@ -2603,6 +3058,16 @@"node": ">= 0.4"}},+ "node_modules/he": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",+ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",+ "dev": true,+ "license": "MIT",+ "bin": {+ "he": "bin/he"+ }+ },"node_modules/http-errors": {"version": "2.0.0","resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",@@ -2619,6 +3084,22 @@"node": ">= 0.8"}},+ "node_modules/husky": {+ "version": "9.1.7",+ "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz",+ "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==",+ "dev": true,+ "license": "MIT",+ "bin": {+ "husky": "bin.js"+ },+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "url": "https://github.com/sponsors/typicode"+ }+ },"node_modules/iconv-lite": {"version": "0.6.3","resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",@@ -2758,6 +3239,19 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/is-binary-path": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "binary-extensions": "^2.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },"node_modules/is-boolean-object": {"version": "1.2.2","resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz",@@ -2865,6 +3359,16 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/is-fullwidth-code-point": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },"node_modules/is-generator-function": {"version": "1.1.0","resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.0.tgz",@@ -2937,6 +3441,16 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/is-plain-obj": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",+ "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },"node_modules/is-promise": {"version": "4.0.0","resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",@@ -3042,6 +3556,19 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/is-unicode-supported": {+ "version": "0.1.0",+ "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",+ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },"node_modules/is-weakmap": {"version": "2.0.2","resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz",@@ -3101,6 +3628,22 @@"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==","license": "ISC"},+ "node_modules/jackspeak": {+ "version": "3.4.3",+ "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",+ "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",+ "dev": true,+ "license": "BlueOak-1.0.0",+ "dependencies": {+ "@isaacs/cliui": "^8.0.2"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ },+ "optionalDependencies": {+ "@pkgjs/parseargs": "^0.11.0"+ }+ },"node_modules/js-yaml": {"version": "4.1.0","resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",@@ -3202,6 +3745,30 @@"dev": true,"license": "MIT"},+ "node_modules/log-symbols": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",+ "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "chalk": "^4.1.0",+ "is-unicode-supported": "^0.1.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/make-error": {+ "version": "1.3.6",+ "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",+ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",+ "dev": true,+ "license": "ISC"+ },"node_modules/math-intrinsics": {"version": "1.1.0","resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",@@ -3329,6 +3896,91 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/minipass": {+ "version": "7.1.2",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",+ "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": ">=16 || 14 >=14.17"+ }+ },+ "node_modules/mocha": {+ "version": "11.1.0",+ "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.1.0.tgz",+ "integrity": "sha512-8uJR5RTC2NgpY3GrYcgpZrsEd9zKbPDpob1RezyR2upGHRQtHWofmzTMzTMSV6dru3tj5Ukt0+Vnq1qhFEEwAg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-colors": "^4.1.3",+ "browser-stdout": "^1.3.1",+ "chokidar": "^3.5.3",+ "debug": "^4.3.5",+ "diff": "^5.2.0",+ "escape-string-regexp": "^4.0.0",+ "find-up": "^5.0.0",+ "glob": "^10.4.5",+ "he": "^1.2.0",+ "js-yaml": "^4.1.0",+ "log-symbols": "^4.1.0",+ "minimatch": "^5.1.6",+ "ms": "^2.1.3",+ "serialize-javascript": "^6.0.2",+ "strip-json-comments": "^3.1.1",+ "supports-color": "^8.1.1",+ "workerpool": "^6.5.1",+ "yargs": "^17.7.2",+ "yargs-parser": "^21.1.1",+ "yargs-unparser": "^2.0.0"+ },+ "bin": {+ "_mocha": "bin/_mocha",+ "mocha": "bin/mocha.js"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ }+ },+ "node_modules/mocha/node_modules/brace-expansion": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",+ "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "balanced-match": "^1.0.0"+ }+ },+ "node_modules/mocha/node_modules/minimatch": {+ "version": "5.1.6",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",+ "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "brace-expansion": "^2.0.1"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/mocha/node_modules/supports-color": {+ "version": "8.1.1",+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",+ "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "has-flag": "^4.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/chalk/supports-color?sponsor=1"+ }+ },"node_modules/ms": {"version": "2.1.3","resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",@@ -3351,6 +4003,16 @@"node": ">= 0.6"}},+ "node_modules/normalize-path": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },"node_modules/object-assign": {"version": "4.1.1","resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",@@ -3545,6 +4207,13 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/package-json-from-dist": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",+ "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",+ "dev": true,+ "license": "BlueOak-1.0.0"+ },"node_modules/parent-module": {"version": "1.0.1","resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",@@ -3593,6 +4262,30 @@"dev": true,"license": "MIT"},+ "node_modules/path-scurry": {+ "version": "1.11.1",+ "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",+ "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",+ "dev": true,+ "license": "BlueOak-1.0.0",+ "dependencies": {+ "lru-cache": "^10.2.0",+ "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"+ },+ "engines": {+ "node": ">=16 || 14 >=14.18"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/path-scurry/node_modules/lru-cache": {+ "version": "10.4.3",+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",+ "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",+ "dev": true,+ "license": "ISC"+ },"node_modules/path-to-regexp": {"version": "8.2.0","resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz",@@ -3703,6 +4396,16 @@],"license": "MIT"},+ "node_modules/randombytes": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",+ "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "safe-buffer": "^5.1.0"+ }+ },"node_modules/range-parser": {"version": "1.2.1","resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",@@ -3727,6 +4430,32 @@"node": ">= 0.8"}},+ "node_modules/readdirp": {+ "version": "3.6.0",+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "picomatch": "^2.2.1"+ },+ "engines": {+ "node": ">=8.10.0"+ }+ },+ "node_modules/readdirp/node_modules/picomatch": {+ "version": "2.3.1",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8.6"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },"node_modules/reflect.getprototypeof": {"version": "1.0.10","resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz",@@ -3771,6 +4500,16 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/require-directory": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },"node_modules/requireindex": {"version": "1.1.0","resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.1.0.tgz",@@ -3978,6 +4717,16 @@"node": ">= 18"}},+ "node_modules/serialize-javascript": {+ "version": "6.0.2",+ "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz",+ "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==",+ "dev": true,+ "license": "BSD-3-Clause",+ "dependencies": {+ "randombytes": "^2.1.0"+ }+ },"node_modules/serve-static": {"version": "2.2.0","resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz",@@ -4180,6 +4929,19 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/signal-exit": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",+ "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": ">=14"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },"node_modules/simple-swizzle": {"version": "0.2.2","resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",@@ -4198,6 +4960,70 @@"node": ">= 0.8"}},+ "node_modules/string-width": {+ "version": "5.1.2",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",+ "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "eastasianwidth": "^0.2.0",+ "emoji-regex": "^9.2.2",+ "strip-ansi": "^7.0.1"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/string-width-cjs": {+ "name": "string-width",+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/string-width-cjs/node_modules/ansi-regex": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/string-width-cjs/node_modules/emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/string-width-cjs/node_modules/strip-ansi": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-regex": "^5.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },"node_modules/string.prototype.trim": {"version": "1.2.10","resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz",@@ -4257,6 +5083,46 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/strip-ansi": {+ "version": "7.1.0",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",+ "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-regex": "^6.0.1"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"+ }+ },+ "node_modules/strip-ansi-cjs": {+ "name": "strip-ansi",+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-regex": "^5.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/strip-ansi-cjs/node_modules/ansi-regex": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },"node_modules/strip-bom": {"version": "3.0.0","resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",@@ -4353,6 +5219,60 @@"typescript": ">=4.8.4"}},+ "node_modules/ts-node": {+ "version": "10.9.2",+ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",+ "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@cspotcode/source-map-support": "^0.8.0",+ "@tsconfig/node10": "^1.0.7",+ "@tsconfig/node12": "^1.0.7",+ "@tsconfig/node14": "^1.0.0",+ "@tsconfig/node16": "^1.0.2",+ "acorn": "^8.4.1",+ "acorn-walk": "^8.1.1",+ "arg": "^4.1.0",+ "create-require": "^1.1.0",+ "diff": "^4.0.1",+ "make-error": "^1.1.1",+ "v8-compile-cache-lib": "^3.0.1",+ "yn": "3.1.1"+ },+ "bin": {+ "ts-node": "dist/bin.js",+ "ts-node-cwd": "dist/bin-cwd.js",+ "ts-node-esm": "dist/bin-esm.js",+ "ts-node-script": "dist/bin-script.js",+ "ts-node-transpile-only": "dist/bin-transpile.js",+ "ts-script": "dist/bin-script-deprecated.js"+ },+ "peerDependencies": {+ "@swc/core": ">=1.2.50",+ "@swc/wasm": ">=1.2.50",+ "@types/node": "*",+ "typescript": ">=2.7"+ },+ "peerDependenciesMeta": {+ "@swc/core": {+ "optional": true+ },+ "@swc/wasm": {+ "optional": true+ }+ }+ },+ "node_modules/ts-node/node_modules/diff": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",+ "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",+ "dev": true,+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=0.3.1"+ }+ },"node_modules/tsconfig-paths": {"version": "3.15.0","resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz",@@ -4546,6 +5466,13 @@"node": ">= 0.4.0"}},+ "node_modules/v8-compile-cache-lib": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",+ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",+ "dev": true,+ "license": "MIT"+ },"node_modules/vary": {"version": "1.1.2","resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",@@ -4669,12 +5596,250 @@"node": ">=0.10.0"}},+ "node_modules/workerpool": {+ "version": "6.5.1",+ "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz",+ "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==",+ "dev": true,+ "license": "Apache-2.0"+ },+ "node_modules/wrap-ansi": {+ "version": "8.1.0",+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",+ "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-styles": "^6.1.0",+ "string-width": "^5.0.1",+ "strip-ansi": "^7.0.1"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"+ }+ },+ "node_modules/wrap-ansi-cjs": {+ "name": "wrap-ansi",+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-styles": "^4.0.0",+ "string-width": "^4.1.0",+ "strip-ansi": "^6.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"+ }+ },+ "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/wrap-ansi-cjs/node_modules/string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-regex": "^5.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/wrap-ansi/node_modules/ansi-styles": {+ "version": "6.2.1",+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz",+ "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"+ }+ },"node_modules/wrappy": {"version": "1.0.2","resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz","integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==","license": "ISC"},+ "node_modules/y18n": {+ "version": "5.0.8",+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/yargs": {+ "version": "17.7.2",+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",+ "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "cliui": "^8.0.1",+ "escalade": "^3.1.1",+ "get-caller-file": "^2.0.5",+ "require-directory": "^2.1.1",+ "string-width": "^4.2.3",+ "y18n": "^5.0.5",+ "yargs-parser": "^21.1.1"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/yargs-parser": {+ "version": "21.1.1",+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",+ "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/yargs-unparser": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz",+ "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "camelcase": "^6.0.0",+ "decamelize": "^4.0.0",+ "flat": "^5.0.2",+ "is-plain-obj": "^2.1.0"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/yargs-unparser/node_modules/camelcase": {+ "version": "6.3.0",+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",+ "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/yargs-unparser/node_modules/decamelize": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",+ "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/yargs/node_modules/ansi-regex": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/yargs/node_modules/emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/yargs/node_modules/string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/yargs/node_modules/strip-ansi": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-regex": "^5.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/yn": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",+ "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },"node_modules/yocto-queue": {"version": "0.1.0","resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",diff --git a/package.json b/package.jsonindex 34c1923..ddb43d2 100644--- a/package.json+++ b/package.json@@ -13,16 +13,14 @@"scripts": {"build": "tsc && chmod +x lib/index.js","lint": "eslint .",+ "test": "mocha --require ts-node/register test/*.ts","watch": "tsc --watch",- "clean": "rm -rf lib"- },- "exports": {- "./package.json": "./package.json",- ".": {- "types": "./index.d.ts",- "default": "./index.js"- }+ "clean": "rm -rf lib",+ "prepare": "husky"},+ "files": [+ "lib"+ ],"dependencies": {"@modelcontextprotocol/sdk": "^1.6.1","fast-xml-parser": "^5.0.9",@@ -33,6 +31,7 @@"@eslint/eslintrc": "^3.2.0","@eslint/js": "^9.19.0","@stylistic/eslint-plugin": "^3.0.1",+ "@types/mocha": "^10.0.10","@types/node": "^22.13.10","@typescript-eslint/eslint-plugin": "^8.28.0","@typescript-eslint/parser": "^8.26.1",@@ -41,6 +40,9 @@"eslint-plugin": "^1.0.1","eslint-plugin-import": "^2.31.0","eslint-plugin-notice": "^1.0.0",+ "husky": "^9.1.7",+ "mocha": "^11.1.0",+ "ts-node": "^10.9.2","typescript": "^5.8.2"},"main": "index.js",diff --git a/src/android.ts b/src/android.tsindex 83ab6d2..e5f55fa 100644--- a/src/android.ts+++ b/src/android.ts@@ -1,168 +1,195 @@-import { execSync } from "child_process";+import { execFileSync, execSync } from "child_process";import * as xml from "fast-xml-parser";-import { readFileSync, unlinkSync } from "fs";+import { Bounds, Button, Dimensions, ElementCoordinates, Robot, SwipeDirection } from "./robot";-interface Bounds {- left: number;- top: number;- right: number;- bottom: number;+interface UiAutomatorXmlNode {+ node: UiAutomatorXmlNode[];+ text?: string;+ bounds?: string;+ "content-desc"?: string;}-interface ElementCoordinates {- x: number,- y: number;+interface UiAutomatorXml {+ hierarchy: {+ node: UiAutomatorXmlNode;+ };}-export const getConnectedDevices = (): string[] => {- return execSync(`adb devices`)- .toString()- .split("\n")- .filter(line => !line.startsWith("List of devices attached"))- .filter(line => line.trim() !== "");-};+export class AndroidRobot implements Robot {-export const resolveLaunchableActivities = (packageName: string): string[] => {- return execSync(`adb shell cmd package resolve-activity ${packageName}`)- .toString()- .split("\n")- .map(line => line.trim())- .filter(line => line.startsWith("name="))- .map(line => line.substring("name=".length));-};+ public async getScreenSize(): Promise<Dimensions> {+ const screenSize = execSync("adb shell wm size")+ .toString()+ .split(" ")+ .pop();-export const getScreenSize = (): [number, number] => {- const screenSize = execSync("adb shell wm size")- .toString()- .split(" ")- .pop();+ if (!screenSize) {+ throw new Error("Failed to get screen size");+ }- if (!screenSize) {- throw new Error("Failed to get screen size");+ const [width, height] = screenSize.split("x").map(Number);+ return { width, height };}- const [width, height] = screenSize.split("x").map(Number);- return [width, height];-};+ public adb(args: string[]): Buffer {+ return execFileSync("adb", args, {+ maxBuffer: 1024 * 1024 * 4,+ timeout: 30000,+ });+ }-const collectElements = (node: any, screenSize: [number, number]): any[] => {- const elements: any[] = [];+ public async listApps(): Promise<string[]> {+ const result = this.adb(["shell", "cmd", "package", "query-activities", "-a", "android.intent.action.MAIN", "-c", "android.intent.category.LAUNCHER"])+ .toString()+ .split("\n")+ .map(line => line.trim())+ .filter(line => line.startsWith("packageName="))+ .map(line => line.substring("packageName=".length))+ .filter((value, index, self) => self.indexOf(value) === index);- const getCoordinates = (element: any): Bounds => {- const bounds = String(element.bounds);+ return result;+ }- const [, left, top, right, bottom] = bounds.match(/^\[(\d+),(\d+)\]\[(\d+),(\d+)\]$/)?.map(Number) || [];- return { left, top, right, bottom };- };+ public async launchApp(packageName: string): Promise<void> {+ this.adb(["shell", "monkey", "-p", packageName, "-c", "android.intent.category.LAUNCHER", "1"]);+ }- const getCenter = (coordinates: Bounds): ElementCoordinates => {- return {- x: Math.floor((coordinates.left + coordinates.right) / 2),- y: Math.floor((coordinates.top + coordinates.bottom) / 2),+ public async swipe(direction: SwipeDirection): Promise<void> {+ const screenSize = await this.getScreenSize();+ const centerX = screenSize.width >> 1;+ // const centerY = screenSize[1] >> 1;++ let x0: number, y0: number, x1: number, y1: number;++ switch (direction) {+ case "up":+ x0 = x1 = centerX;+ y0 = Math.floor(screenSize.height * 0.80);+ y1 = Math.floor(screenSize.height * 0.20);+ break;+ case "down":+ x0 = x1 = centerX;+ y0 = Math.floor(screenSize.height * 0.20);+ y1 = Math.floor(screenSize.height * 0.80);+ break;+ default:+ throw new Error(`Swipe direction "${direction}" is not supported`);+ }++ this.adb(["shell", "input", "swipe", `${x0}`, `${y0}`, `${x1}`, `${y1}`, "1000"]);+ }++ public async getScreenshot(): Promise<Buffer> {+ return this.adb(["shell", "screencap", "-p"]);+ }++ private collectElements(node: UiAutomatorXmlNode, screenSize: Dimensions): any[] {+ const elements: any[] = [];++ const getCoordinates = (element: UiAutomatorXmlNode): Bounds => {+ const bounds = String(element.bounds);++ const [, left, top, right, bottom] = bounds.match(/^\[(\d+),(\d+)\]\[(\d+),(\d+)\]$/)?.map(Number) || [];+ return { left, top, right, bottom };};- };- const normalizeCoordinates = (coordinates: ElementCoordinates, screenSize: [number, number]): ElementCoordinates => {- return {- x: Number((coordinates.x / screenSize[0]).toFixed(3)),- y: Number((coordinates.y / screenSize[1]).toFixed(3)),+ const getCenter = (coordinates: Bounds): ElementCoordinates => {+ return {+ x: Math.floor((coordinates.left + coordinates.right) / 2),+ y: Math.floor((coordinates.top + coordinates.bottom) / 2),+ };+ };++ const normalizeCoordinates = (coordinates: ElementCoordinates, screenSize: Dimensions): ElementCoordinates => {+ return {+ x: Number((coordinates.x / screenSize.width).toFixed(3)),+ y: Number((coordinates.y / screenSize.height).toFixed(3)),+ };};- };- if (node.node) {- if (Array.isArray(node.node)) {- for (const childNode of node.node) {- elements.push(...collectElements(childNode, screenSize));+ if (node.node) {+ if (Array.isArray(node.node)) {+ for (const childNode of node.node) {+ elements.push(...this.collectElements(childNode, screenSize));+ }+ } else {+ elements.push(...this.collectElements(node.node, screenSize));}- } else {- elements.push(...collectElements(node.node, screenSize));}- }- if (node.text) {- elements.push({- "text": node.text,- "coordinates": normalizeCoordinates(getCenter(getCoordinates(node)), screenSize),- });- }+ if (node.text) {+ elements.push({+ "text": node.text,+ "coordinates": normalizeCoordinates(getCenter(getCoordinates(node)), screenSize),+ });+ }- if (node["content-desc"]) {- elements.push({- "text": node["content-desc"],- "coordinates": normalizeCoordinates(getCenter(getCoordinates(node)), screenSize),- });+ if (node["content-desc"]) {+ elements.push({+ "text": node["content-desc"],+ "coordinates": normalizeCoordinates(getCenter(getCoordinates(node)), screenSize),+ });+ }++ return elements;}- return elements;-};+ public async getElementsOnScreen(): Promise<any[]> {+ const dump = this.adb(["exec-out", "uiautomator", "dump", "/dev/tty"]);-export const getElementsOnScreen = (): any[] => {- const dump = execSync(`adb exec-out uiautomator dump /dev/tty`);+ const parser = new xml.XMLParser({+ ignoreAttributes: false,+ attributeNamePrefix: ""+ });- const parser = new xml.XMLParser({- ignoreAttributes: false,- attributeNamePrefix: ""- });+ const parsedXml = parser.parse(dump) as UiAutomatorXml;+ const hierarchy = parsedXml.hierarchy;- const parsedXml = parser.parse(dump);- const hierarchy = parsedXml.hierarchy;+ const screenSize = await this.getScreenSize();+ const elements = this.collectElements(hierarchy.node, screenSize);+ return elements;+ }- const screenSize = getScreenSize();- const elements = collectElements(hierarchy, screenSize);- return elements;-};+ public async terminateApp(packageName: string): Promise<void> {+ this.adb(["shell", "am", "force-stop", packageName]);+ }-export const swipe = (direction: "up" | "down" | "left" | "right") => {-- const screenSize = getScreenSize();- const centerX = screenSize[0] >> 1;- // const centerY = screenSize[1] >> 1;-- let x0, y0, x1, y1: number;-- switch (direction) {- case "up":- x0 = x1 = centerX;- y0 = Math.floor(screenSize[1] * 0.80);- y1 = Math.floor(screenSize[1] * 0.20);- break;- case "down":- x0 = x1 = centerX;- y0 = Math.floor(screenSize[1] * 0.20);- y1 = Math.floor(screenSize[1] * 0.80);- break;- default:- throw new Error(`Swipe direction "${direction}" is not supported`);+ public async openUrl(url: string): Promise<void> {+ this.adb(["shell", "am", "start", "-a", "android.intent.action.VIEW", "-d", url]);}- execSync(`adb shell input swipe ${x0} ${y0} ${x1} ${y1} 1000`);-};+ public async sendKeys(text: string): Promise<void> {+ // adb shell requires some escaping+ const _text = text.replace(/ /g, "\\ ");+ this.adb(["shell", "input", "text", _text]);+ }-export const takeScreenshot = async (): Promise<Buffer> => {- const randomFilename = `screenshot-${Date.now()}.png`;+ public async pressButton(button: Button) {+ const _map = {+ "BACK": "KEYCODE_BACK",+ "HOME": "KEYCODE_HOME",+ "VOLUME_UP": "KEYCODE_VOLUME_UP",+ "VOLUME_DOWN": "KEYCODE_VOLUME_DOWN",+ "ENTER": "KEYCODE_ENTER",+ };- // take screenshot and save on device- const remoteFilename = `/sdcard/Download/${randomFilename}`;- execSync(`adb shell screencap -p ${remoteFilename}`);+ if (!_map[button]) {+ throw new Error(`Button "${button}" is not supported`);+ }- // pull the file locally- const localFilename = `/tmp/${randomFilename}`;- execSync(`adb pull ${remoteFilename} ${localFilename}`);- execSync(`adb shell rm ${remoteFilename}`);+ this.adb(["shell", "input", "keyevent", _map[button]]);+ }- const screenshot = readFileSync(localFilename);- unlinkSync(localFilename);- return screenshot;-};+ public async tap(x: number, y: number): Promise<void> {+ this.adb(["shell", "input", "tap", `${x}`, `${y}`]);+ }+}-export const listApps = (): string[] => {- const result = execSync(`adb shell cmd package query-activities -a android.intent.action.MAIN -c android.intent.category.LAUNCHER`)+export const getConnectedDevices = (): string[] => {+ return execSync(`adb devices`).toString().split("\n")- .map(line => line.trim())- .filter(line => line.startsWith("packageName="))- .map(line => line.substring("packageName=".length))- .filter((value, index, self) => self.indexOf(value) === index);-- return result;+ .filter(line => !line.startsWith("List of devices attached"))+ .filter(line => line.trim() !== "")+ .map(line => line.split("\t")[0]);};diff --git a/src/iphone-simulator.ts b/src/iphone-simulator.tsindex 70b1f45..6f64738 100644--- a/src/iphone-simulator.ts+++ b/src/iphone-simulator.ts@@ -1,43 +1,380 @@-import { execSync } from "child_process";+import { execFileSync, execSync } from "child_process";+import { Button, Dimensions, Robot, SwipeDirection } from "./robot";export interface Simulator {- name: string;- uuid: string;+ name: string;+ uuid: string;+ state: string;}-export const getConnectedDevices = (): Simulator[] => {- return execSync(`xcrun simctl list devices`)- .toString()- .split("\n")- .map(line => {- // extract device name and UUID from the line- const match = line.match(/(.*?)\s+\(([\w-]+)\)\s+\(Booted\)/);- if (!match) {- return null;+interface SourceTreeElement {+ type: string;+ label?: string;+ name?: string;+ rawIdentifier?: string;+ rect: {+ x: number;+ y: number;+ width: number;+ height: number;+ };++ children?: Array<SourceTreeElement>;+}++interface SourceTree {+ value: SourceTreeElement;+}+++interface AppInfo {+ ApplicationType: string;+ Bundle: string;+ CFBundleDisplayName: string;+ CFBundleExecutable: string;+ CFBundleIdentifier: string;+ CFBundleName: string;+ CFBundleVersion: string;+ DataContainer: string;+ GroupContainers: Record<string, string>;+ Path: string;+ SBAppTags: string[];+}+++export class Simctl implements Robot {+ constructor(private readonly simulatorUuid: string) {+ }++ private simctl(...args: string[]): Buffer {+ return execFileSync(+ "xcrun",+ ["simctl", ...args],+ { maxBuffer: 1024 * 1024 * 4 });+ }++ public async getScreenshot(): Promise<Buffer> {+ return this.simctl("io", this.simulatorUuid, "screenshot", "-");+ }++ public async openUrl(url: string) {+ this.simctl("openurl", this.simulatorUuid, url);+ }++ public async launchApp(packageName: string) {+ this.simctl("launch", this.simulatorUuid, packageName);+ }++ public async terminateApp(packageName: string) {+ this.simctl("terminate", this.simulatorUuid, packageName);+ }++ private parseIOSAppData(inputText: string): Array<AppInfo> {+ const result: Array<AppInfo> = [];++ // Remove leading and trailing characters if needed+ const cleanText = inputText.trim();++ // Extract each app section+ const appRegex = /"([^"]+)"\s+=\s+\{([^}]+)\};/g;+ let appMatch;++ while ((appMatch = appRegex.exec(cleanText)) !== null) {+ // const bundleId = appMatch[1];+ const appContent = appMatch[2];++ const appInfo: Partial<AppInfo> = {+ GroupContainers: {},+ SBAppTags: []+ };++ // parse simple key-value pairs+ const keyValueRegex = /\s+(\w+)\s+=\s+([^;]+);/g;+ let keyValueMatch;++ while ((keyValueMatch = keyValueRegex.exec(appContent)) !== null) {+ const key = keyValueMatch[1];+ let value = keyValueMatch[2].trim();++ // Handle quoted string values+ if (value.startsWith('"') && value.endsWith('"')) {+ value = value.substring(1, value.length - 1);+ }++ if (key !== "GroupContainers" && key !== "SBAppTags") {+ (appInfo as any)[key] = value;+ }}- const deviceName = match[1].trim();- const deviceUuid = match[2];+ // parse GroupContainers+ const groupContainersMatch = appContent.match(/GroupContainers\s+=\s+\{([^}]+)\};/);+ if (groupContainersMatch) {+ const groupContainersContent = groupContainersMatch[1];+ const groupRegex = /"([^"]+)"\s+=\s+"([^"]+)"/g;+ let groupMatch;++ while ((groupMatch = groupRegex.exec(groupContainersContent)) !== null) {+ const groupId = groupMatch[1];+ const groupPath = groupMatch[2];+ appInfo.GroupContainers![groupId] = groupPath;+ }+ }++ // parse SBAppTags+ const sbAppTagsMatch = appContent.match(/SBAppTags\s+=\s+\(\s*(.*?)\s*\);/);+ if (sbAppTagsMatch) {+ const tagsContent = sbAppTagsMatch[1].trim();+ if (tagsContent) {+ const tagRegex = /"([^"]+)"/g;+ let tagMatch;++ while ((tagMatch = tagRegex.exec(tagsContent)) !== null) {+ appInfo.SBAppTags!.push(tagMatch[1]);+ }+ }+ }++ result.push(appInfo as AppInfo);+ }++ return result;+ }++ public async listApps(): Promise<string[]> {+ const text = this.simctl("listapps", this.simulatorUuid).toString();+ const apps = this.parseIOSAppData(text);+ return apps.map(app => app.CFBundleIdentifier);+ }++ public async getScreenSize(): Promise<Dimensions> {+ return this.withinSession(async (port, sessionId) => {+ const url = `http://localhost:${port}/session/${sessionId}/window/size`;+ const response = await fetch(url);+ const json = await response.json();return {- name: deviceName,- uuid: deviceUuid,+ width: json.value.width,+ height: json.value.height};- })- .filter(line => line !== null);-};+ });+ }++ public async sendKeys(keys: string) {+ await this.withinSession(async (port, sessionId) => {+ const url = `http://localhost:${port}/session/${sessionId}/wda/keys`;+ await fetch(url, {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({ value: [keys] }),+ });+ });+ }++ public async swipe(direction: SwipeDirection) {+ await this.withinSession(async (port, sessionId) => {++ const x0 = 200;+ let y0 = 600;+ const x1 = 200;+ let y1 = 200;++ if (direction === "up") {+ const tmp = y0;+ y0 = y1;+ y1 = tmp;+ }++ const url = `http://localhost:${port}/session/${sessionId}/actions`;+ await fetch(url, {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ actions: [+ {+ type: "pointer",+ id: "finger1",+ parameters: { pointerType: "touch" },+ actions: [+ { type: "pointerMove", duration: 0, x: x0, y: y0 },+ { type: "pointerDown", button: 0 },+ { type: "pointerMove", duration: 0, x: x1, y: y1 },+ { type: "pause", duration: 1000 },+ { type: "pointerUp", button: 0 }+ ]+ }+ ]+ }),+ });+ });+ }++ public async tap(x: number, y: number) {+ await this.withinSession(async (port, sessionId) => {+ const url = `http://localhost:${port}/session/${sessionId}/actions`;+ await fetch(url, {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ actions: [+ {+ type: "pointer",+ id: "finger1",+ parameters: { pointerType: "touch" },+ actions: [+ { type: "pointerMove", duration: 0, x, y },+ { type: "pointerDown", button: 0 },+ { type: "pause", duration: 100 },+ { type: "pointerUp", button: 0 }+ ]+ }+ ]+ }),+ });+ });+ }++ public async pressButton(button: Button) {+ const _map = {+ "HOME": "home",+ "VOLUME_UP": "volumeup",+ "VOLUME_DOWN": "volumedown",+ };++ if (button === "ENTER") {+ await this.sendKeys("\n");+ return;+ }++ // Type assertion to check if button is a key of _map+ if (!(button in _map)) {+ throw new Error(`Button "${button}" is not supported`);+ }++ await this.withinSession(async (port, sessionId) => {+ const url = `http://localhost:${port}/session/${sessionId}/wda/pressButton`;+ const response = await fetch(url, {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ name: button,+ }),+ });++ return response.json();+ });+ }++ private async createSession(port: number) {+ const url = `http://localhost:${port}/session`;+ const response = await fetch(url, {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({ capabilities: { alwaysMatch: { platformName: "iOS" } } }),+ });++ const json = await response.json();+ return json.value.sessionId;+ }-export const getScreenshot = (simulatorUuid: string): Buffer => {- return execSync(`xcrun simctl io "${simulatorUuid}" screenshot -`);-};+ private async deleteSession(port: number, sessionId: string) {+ const url = `http://localhost:${port}/session/${sessionId}`;+ const response = await fetch(url, { method: "DELETE" });+ return response.json();+ }-export const openUrl = (simulatorUuid: string, url: string) => {- return execSync(`xcrun simctl openurl "${simulatorUuid}" "${url}"`);-};+ private async withinSession(fn: (port: number, sessionId: string) => Promise<any>) {+ const port = 8100;+ const sessionId = await this.createSession(port);+ const result = await fn(port, sessionId);+ await this.deleteSession(port, sessionId);+ return result;+ }-export const launchApp = (simulatorUuid: string, packageName: string) => {- return execSync(`xcrun simctl launch "${simulatorUuid}" "${packageName}"`);-};+ private filterSourceElements(source: SourceTreeElement): Array<any> {-export const listApps = (simulatorUuid: string) => {- return execSync(`xcrun simctl list apps "${simulatorUuid}"`);-};+ const output: any[] = [];++ console.error("gilm " + JSON.stringify(source));+ if (["TextField", "Button", "Switch"].includes(source.type)) {+ output.push({+ type: source.type,+ label: source.label,+ name: source.name,+ rect: {+ x0: source.rect.x,+ y0: source.rect.y,+ x1: source.rect.x + source.rect.width,+ y1: source.rect.y + source.rect.height,+ },+ });+ }++ if (source.children) {+ for (const child of source.children) {+ output.push(...this.filterSourceElements(child));+ }+ }++ return output;+ }++ public async getPageSource(): Promise<SourceTree> {+ const port = 8100;+ const url = `http://localhost:${port}/source/?format=json`;+ const response = await fetch(url);+ const json = await response.json();+ return json as SourceTree;+ }++ public async getElementsOnScreen(): Promise<any[]> {+ const source = await this.getPageSource();+ return this.filterSourceElements(source.value);+ }+}++export class SimctlManager {++ private parseSimulator(line: string): Simulator | null {+ // extract device name and UUID from the line+ const match = line.match(/(.*?)\s+\(([\w-]+)\)\s+\((\w+)\)/);+ if (!match) {+ return null;+ }++ const deviceName = match[1].trim();+ const deviceUuid = match[2];+ const deviceState = match[3];++ return {+ name: deviceName,+ uuid: deviceUuid,+ state: deviceState,+ };+ }++ public listSimulators(): Simulator[] {+ return execSync(`xcrun simctl list devices`)+ .toString()+ .split("\n")+ .map(line => this.parseSimulator(line))+ .filter(simulator => simulator !== null);+ }++ public listBootedSimulators(): Simulator[] {+ return this.listSimulators()+ .filter(simulator => simulator.state === "Booted");+ }++ public getSimulator(uuid: string): Simctl {+ return new Simctl(uuid);+ }+}diff --git a/src/robot.ts b/src/robot.tsnew file mode 100644index 0000000..1301ba1--- /dev/null+++ b/src/robot.ts@@ -0,0 +1,82 @@+export interface Bounds {+ left: number;+ top: number;+ right: number;+ bottom: number;+}++export interface ElementCoordinates {+ x: number,+ y: number;+}++export interface Dimensions {+ width: number;+ height: number;+}++export type SwipeDirection = "up" | "down" | "left" | "right";++export type Button = "HOME" | "BACK" | "VOLUME_UP" | "VOLUME_DOWN" | "ENTER";++export interface Robot {+ /**+ * Get the screen size of the device in pixels.+ */+ getScreenSize(): Promise<Dimensions>;++ /**+ * Swipe in a direction.+ */+ swipe(direction: SwipeDirection): Promise<void>;++ /**+ * Get a screenshot of the screen. Returns a Buffer that contains+ * a PNG image of the screen. Will be same dimensions as getScreenSize().+ */+ getScreenshot(): Promise<Buffer>;++ /**+ * List all installed apps on the device. Returns an array of package names (or+ * bundle identifiers in iOS) for all installed apps.+ */+ listApps(): Promise<string[]>;++ /**+ * Launch an app.+ */+ launchApp(packageName: string): Promise<void>;++ /**+ * Terminate an app. If app was already terminated (or non existent) then this+ * is a no-op.+ */+ terminateApp(packageName: string): Promise<void>;++ /**+ * Open a URL in the device's web browser. Can be an https:// url, or a+ * custom scheme (e.g. "myapp://").+ */+ openUrl(url: string): Promise<void>;++ /**+ * Send keys to the device, simulating keyboard input.+ */+ sendKeys(text: string): Promise<void>;++ /**+ * Press a button on the device, simulating a physical button press.+ */+ pressButton(button: Button): Promise<void>;++ /**+ * Tap on a specific coordinate on the screen.+ */+ tap(x: number, y: number): Promise<void>;++ /**+ * Get all elements on the screen. Works only on native apps (not webviews). Will+ * return a filtered list of elements that make sense to interact with.+ */+ getElementsOnScreen(): Promise<any[]>;+}diff --git a/src/server.ts b/src/server.tsindex 1e4559c..95ffa85 100644--- a/src/server.ts+++ b/src/server.ts@@ -1,13 +1,12 @@import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";import { CallToolResult } from "@modelcontextprotocol/sdk/types";--import { execSync } from "child_process";-import { error, trace } from "./logger";import { z, ZodRawShape, ZodTypeAny } from "zod";-import { getElementsOnScreen, getScreenSize, listApps, swipe, takeScreenshot } from "./android";-import sharp from "sharp";+import { error, trace } from "./logger";+import { AndroidRobot } from "./android";+import { Robot } from "./robot";+const getAgentVersion = (): string => {const json = require("../package.json");return json.version;@@ -45,24 +44,34 @@ export const createMcpServer = (): McpServer => {server.tool(name, description, paramsSchema, args => wrappedCb(args));};+ const robot: Robot = new AndroidRobot();+tool("mobile_list_apps","List all the installed apps on the device",{},async ({}) => {- const result = listApps();+ if (!robot) {+ throw new Error("No device selected");+ }++ const result = await robot.listApps();return `Found these packages on device: ${result.join(",")}`;});tool("mobile_launch_app",- "Launch an app on mobile device",+ "Launch an app on mobile device. Use this to open a specific app. You can find the package name of the app by calling list_apps_on_device.",{packageName: z.string().describe("The package name of the app to launch"),},async ({ packageName }) => {- execSync(`adb shell monkey -p "${packageName}" -c android.intent.category.LAUNCHER 1`);+ if (!robot) {+ throw new Error("No device selected");+ }++ await robot.launchApp(packageName);return `Launched app ${packageName}`;});@@ -74,7 +83,11 @@ export const createMcpServer = (): McpServer => {packageName: z.string().describe("The package name of the app to terminate"),},async ({ packageName }) => {- execSync(`adb shell am force-stop "${packageName}"`);+ if (!robot) {+ throw new Error("No device selected");+ }++ await robot.terminateApp(packageName);return `Terminated app ${packageName}`;});@@ -84,8 +97,12 @@ export const createMcpServer = (): McpServer => {"Get the screen size of the mobile device in pixels",{},async ({}) => {- const screenSize = getScreenSize();- return `Screen size is ${screenSize[0]}x${screenSize[1]} pixels`;+ if (!robot) {+ throw new Error("No device selected");+ }++ const screenSize = await robot.getScreenSize();+ return `Screen size is ${screenSize.width}x${screenSize.height} pixels`;});@@ -97,10 +114,14 @@ export const createMcpServer = (): McpServer => {y: z.number().describe("The y coordinate to click between 0 and 1"),},async ({ x, y }) => {- const screenSize = getScreenSize();- const x0 = Math.floor(screenSize[0] * x);- const y0 = Math.floor(screenSize[1] * y);- execSync(`adb shell input tap ${x0} ${y0}`);+ if (!robot) {+ throw new Error("No device selected");+ }++ const screenSize = await robot.getScreenSize();+ const x0 = Math.floor(screenSize.width * x);+ const y0 = Math.floor(screenSize.height * y);+ await robot.tap(x0, y0);return `Clicked on screen at coordinates: ${x}, ${y}`;});@@ -111,8 +132,29 @@ export const createMcpServer = (): McpServer => {{},async ({}) => {- const elements = getElementsOnScreen();- return `Found these elements on screen: ${JSON.stringify(elements)}`;+ if (!robot) {+ throw new Error("No device selected");+ }++ const screenSize = await robot.getScreenSize();+ const elements = await robot.getElementsOnScreen();++ const result = [];+ for (let i = 0; i < elements.length; i++) {+ elements[i].rect.x0 = elements[i].rect.x0 / screenSize.width;+ elements[i].rect.y0 = elements[i].rect.y0 / screenSize.height;+ elements[i].rect.x1 = elements[i].rect.x1 / screenSize.width;+ elements[i].rect.y1 = elements[i].rect.y1 / screenSize.height;+ result.push({+ text: elements[i].label,+ coordinates: {+ x: (elements[i].rect.x0 + elements[i].rect.x1) / 2,+ y: (elements[i].rect.y0 + elements[i].rect.y1) / 2,+ }+ });+ }++ return `Found these elements on screen: ${JSON.stringify(result)}`;});@@ -120,10 +162,14 @@ export const createMcpServer = (): McpServer => {"mobile_press_button","Press a button on device",{- button: z.string().describe("The button to press. Supported buttons: KEYCODE_BACK, KEYCODE_HOME, KEYCODE_MENU, KEYCODE_VOLUME_UP, KEYCODE_VOLUME_DOWN, KEYCODE_ENTER"),+ button: z.string().describe("The button to press. Supported buttons: BACK, HOME, VOLUME_UP, VOLUME_DOWN, ENTER"),},async ({ button }) => {- execSync(`adb shell input keyevent ${button}`);+ if (!robot) {+ throw new Error("No device selected");+ }++ robot.pressButton(button);return `Pressed the button: ${button}`;});@@ -135,7 +181,11 @@ export const createMcpServer = (): McpServer => {url: z.string().describe("The URL to open"),},async ({ url }) => {- execSync(`adb shell am start -a android.intent.action.VIEW -d "${url}"`);+ if (!robot) {+ throw new Error("No device selected");+ }++ robot.openUrl(url);return `Opened URL: ${url}`;});@@ -147,7 +197,11 @@ export const createMcpServer = (): McpServer => {direction: z.enum(["up", "down"]).describe("The direction to swipe"),},async ({ direction }) => {- swipe(direction);+ if (!robot) {+ throw new Error("No device selected");+ }++ robot.swipe(direction);return `Swiped ${direction} on screen`;});@@ -159,8 +213,11 @@ export const createMcpServer = (): McpServer => {text: z.string().describe("The text to type"),},async ({ text }) => {- const _text = text.replace(/ /g, "\\ ");- execSync(`adb shell input text "${_text}"`);+ if (!robot) {+ throw new Error("No device selected");+ }++ robot.sendKeys(text);return `Typed text: ${text}`;});@@ -170,8 +227,12 @@ export const createMcpServer = (): McpServer => {"Take a screenshot of the mobile device. Use this to understand what's on screen, if you need to press an element that is available through view hierarchy then you must list elements on screen instead. Do not cache this result.",{},async ({}) => {+ if (!robot) {+ throw new Error("No device selected");+ }+try {- const screenshot = await takeScreenshot();+ const screenshot = await robot.getScreenshot();// Scale down the screenshot by 50%const image = sharp(screenshot);diff --git a/test/android.ts b/test/android.tsnew file mode 100644index 0000000..e0c5ec4--- /dev/null+++ b/test/android.ts@@ -0,0 +1,56 @@++import assert from "assert";+import { AndroidRobot } from "../src/android";+import sharp from "sharp";++describe("android", () => {+ const android = new AndroidRobot();++ it("should be able to get the screen size", async () => {+ const screenSize = await android.getScreenSize();+ assert.ok(screenSize.width > 1024);+ assert.ok(screenSize.height > 1024);+ assert.equal(Object.keys(screenSize).length, 2, "screenSize should have exactly 2 properties");+ });++ it("should be able to take screenshot", async () => {+ const screenSize = await android.getScreenSize();++ const screenshot = await android.getScreenshot();+ assert.ok(screenshot.length > 64 * 1024);++ // must be a valid png image that matches the screen size+ const image = sharp(screenshot);+ const metadata = await image.metadata();+ assert.equal(metadata.width, screenSize.width);+ assert.equal(metadata.height, screenSize.height);+ });++ it("should be able to list apps", async () => {+ const apps = await android.listApps();+ assert.ok(apps.includes("com.android.settings"));+ });++ it("should be able to open a url", async () => {+ await android.adb(["shell", "input", "keyevent", "KEYCODE_HOME"]);+ await android.openUrl("https://www.example.com");+ });++ it("should be able to list elements on screen", async () => {+ await android.adb(["shell", "input", "keyevent", "KEYCODE_HOME"]);+ await android.openUrl("https://www.example.com");+ const elements = await android.getElementsOnScreen();++ const foundTitle = elements.find(element => element.text.includes("This domain is for use in illustrative examples in documents"));+ assert.ok(foundTitle);++ // make sure navbar is present+ const foundNavbar = elements.find(element => element.text === "example.com");+ assert.ok(foundNavbar);++ // this is an icon, but has accessibility text+ const foundSecureIcon = elements.find(element => element.text === "Connection is secure");+ assert.ok(foundSecureIcon);+ }).timeout(5000);++});diff --git a/test/iphone-simulator.ts b/test/iphone-simulator.tsnew file mode 100644index 0000000..6a1ea4e--- /dev/null+++ b/test/iphone-simulator.ts@@ -0,0 +1,29 @@+import assert from "assert";+import { SimctlManager } from "../src/iphone-simulator";++describe("ios", () => {++ const manager = new SimctlManager();+ const bootedSimulators = manager.listBootedSimulators();+ assert.ok(bootedSimulators.length === 1, "should have exactly one booted simulator");+ const simctl = manager.getSimulator(bootedSimulators[0].uuid);++ it("should be able to get the screen size", async () => {+ const screenSize = await simctl.getScreenSize();+ assert.ok(screenSize.width > 256);+ assert.ok(screenSize.height > 256);+ assert.equal(Object.keys(screenSize).length, 2, "screenSize should have exactly 2 properties");+ });++ it("should be able to list apps", async () => {+ const apps = await simctl.listApps();+ assert.ok(apps.includes("com.apple.mobilesafari"));+ assert.ok(apps.includes("com.apple.reminders"));+ assert.ok(apps.includes("com.apple.Preferences"));+ });++ it("should be able to get elements on screen", async () => {+ const elements = await simctl.getElementsOnScreen();+ assert.ok(elements.length > 0);+ }).timeout(10000);+});