@midscene/android 1.7.2 → 1.7.3
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/bin/.yadb-version +1 -0
- package/bin/yadb +0 -0
- package/dist/es/cli.mjs +6 -10
- package/dist/es/index.mjs +5 -9
- package/dist/es/mcp-server.mjs +6 -10
- package/dist/lib/cli.js +6 -10
- package/dist/lib/index.js +5 -9
- package/dist/lib/mcp-server.js +6 -10
- package/dist/types/index.d.ts +2 -6
- package/dist/types/mcp-server.d.ts +2 -6
- package/package.json +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v1.1.1
|
package/bin/yadb
CHANGED
|
Binary file
|
package/dist/es/cli.mjs
CHANGED
|
@@ -719,8 +719,7 @@ class AndroidDevice {
|
|
|
719
719
|
if (!param || !param.value) return;
|
|
720
720
|
const autoDismissKeyboard = param.autoDismissKeyboard ?? this.options?.autoDismissKeyboard;
|
|
721
721
|
await this.keyboardType(param.value, {
|
|
722
|
-
autoDismissKeyboard
|
|
723
|
-
overwrite: 'typeOnly' !== param.mode
|
|
722
|
+
autoDismissKeyboard
|
|
724
723
|
});
|
|
725
724
|
}
|
|
726
725
|
}),
|
|
@@ -988,11 +987,10 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
988
987
|
});
|
|
989
988
|
}
|
|
990
989
|
}
|
|
991
|
-
async execYadb(keyboardContent
|
|
990
|
+
async execYadb(keyboardContent) {
|
|
992
991
|
await this.ensureYadb();
|
|
993
992
|
const adb = await this.getAdb();
|
|
994
|
-
|
|
995
|
-
await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'${overwriteFlag}`);
|
|
993
|
+
await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`);
|
|
996
994
|
}
|
|
997
995
|
async getElementsInfo() {
|
|
998
996
|
return [];
|
|
@@ -1324,7 +1322,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1324
1322
|
const adb = await this.getAdb();
|
|
1325
1323
|
const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1326
1324
|
if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) await adb.clearTextField(100);
|
|
1327
|
-
else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -
|
|
1325
|
+
else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboardClear`);
|
|
1328
1326
|
if (await adb.isSoftKeyboardPresent()) return;
|
|
1329
1327
|
if (element) await this.mouseClick(element.center[0], element.center[1]);
|
|
1330
1328
|
}
|
|
@@ -1484,9 +1482,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1484
1482
|
const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1485
1483
|
const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
|
|
1486
1484
|
const useYadb = IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text);
|
|
1487
|
-
if (useYadb) await this.execYadb(escapeForShell(text)
|
|
1488
|
-
overwrite: options?.overwrite
|
|
1489
|
-
});
|
|
1485
|
+
if (useYadb) await this.execYadb(escapeForShell(text));
|
|
1490
1486
|
else {
|
|
1491
1487
|
const segments = text.split('\n');
|
|
1492
1488
|
for(let i = 0; i < segments.length; i++){
|
|
@@ -1956,7 +1952,7 @@ class AndroidMidsceneTools extends BaseMidsceneTools {
|
|
|
1956
1952
|
const tools = new AndroidMidsceneTools();
|
|
1957
1953
|
runToolsCLI(tools, 'midscene-android', {
|
|
1958
1954
|
stripPrefix: 'android_',
|
|
1959
|
-
version: "1.7.
|
|
1955
|
+
version: "1.7.3",
|
|
1960
1956
|
extraCommands: createReportCliCommands()
|
|
1961
1957
|
}).catch((e)=>{
|
|
1962
1958
|
if (!(e instanceof CLIError)) console.error(e);
|
package/dist/es/index.mjs
CHANGED
|
@@ -622,8 +622,7 @@ class AndroidDevice {
|
|
|
622
622
|
if (!param || !param.value) return;
|
|
623
623
|
const autoDismissKeyboard = param.autoDismissKeyboard ?? this.options?.autoDismissKeyboard;
|
|
624
624
|
await this.keyboardType(param.value, {
|
|
625
|
-
autoDismissKeyboard
|
|
626
|
-
overwrite: 'typeOnly' !== param.mode
|
|
625
|
+
autoDismissKeyboard
|
|
627
626
|
});
|
|
628
627
|
}
|
|
629
628
|
}),
|
|
@@ -891,11 +890,10 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
891
890
|
});
|
|
892
891
|
}
|
|
893
892
|
}
|
|
894
|
-
async execYadb(keyboardContent
|
|
893
|
+
async execYadb(keyboardContent) {
|
|
895
894
|
await this.ensureYadb();
|
|
896
895
|
const adb = await this.getAdb();
|
|
897
|
-
|
|
898
|
-
await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'${overwriteFlag}`);
|
|
896
|
+
await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`);
|
|
899
897
|
}
|
|
900
898
|
async getElementsInfo() {
|
|
901
899
|
return [];
|
|
@@ -1227,7 +1225,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1227
1225
|
const adb = await this.getAdb();
|
|
1228
1226
|
const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1229
1227
|
if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) await adb.clearTextField(100);
|
|
1230
|
-
else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -
|
|
1228
|
+
else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboardClear`);
|
|
1231
1229
|
if (await adb.isSoftKeyboardPresent()) return;
|
|
1232
1230
|
if (element) await this.mouseClick(element.center[0], element.center[1]);
|
|
1233
1231
|
}
|
|
@@ -1387,9 +1385,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1387
1385
|
const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1388
1386
|
const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
|
|
1389
1387
|
const useYadb = IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text);
|
|
1390
|
-
if (useYadb) await this.execYadb(escapeForShell(text)
|
|
1391
|
-
overwrite: options?.overwrite
|
|
1392
|
-
});
|
|
1388
|
+
if (useYadb) await this.execYadb(escapeForShell(text));
|
|
1393
1389
|
else {
|
|
1394
1390
|
const segments = text.split('\n');
|
|
1395
1391
|
for(let i = 0; i < segments.length; i++){
|
package/dist/es/mcp-server.mjs
CHANGED
|
@@ -718,8 +718,7 @@ class AndroidDevice {
|
|
|
718
718
|
if (!param || !param.value) return;
|
|
719
719
|
const autoDismissKeyboard = param.autoDismissKeyboard ?? this.options?.autoDismissKeyboard;
|
|
720
720
|
await this.keyboardType(param.value, {
|
|
721
|
-
autoDismissKeyboard
|
|
722
|
-
overwrite: 'typeOnly' !== param.mode
|
|
721
|
+
autoDismissKeyboard
|
|
723
722
|
});
|
|
724
723
|
}
|
|
725
724
|
}),
|
|
@@ -987,11 +986,10 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
987
986
|
});
|
|
988
987
|
}
|
|
989
988
|
}
|
|
990
|
-
async execYadb(keyboardContent
|
|
989
|
+
async execYadb(keyboardContent) {
|
|
991
990
|
await this.ensureYadb();
|
|
992
991
|
const adb = await this.getAdb();
|
|
993
|
-
|
|
994
|
-
await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'${overwriteFlag}`);
|
|
992
|
+
await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`);
|
|
995
993
|
}
|
|
996
994
|
async getElementsInfo() {
|
|
997
995
|
return [];
|
|
@@ -1323,7 +1321,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1323
1321
|
const adb = await this.getAdb();
|
|
1324
1322
|
const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1325
1323
|
if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) await adb.clearTextField(100);
|
|
1326
|
-
else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -
|
|
1324
|
+
else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboardClear`);
|
|
1327
1325
|
if (await adb.isSoftKeyboardPresent()) return;
|
|
1328
1326
|
if (element) await this.mouseClick(element.center[0], element.center[1]);
|
|
1329
1327
|
}
|
|
@@ -1483,9 +1481,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1483
1481
|
const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1484
1482
|
const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
|
|
1485
1483
|
const useYadb = IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text);
|
|
1486
|
-
if (useYadb) await this.execYadb(escapeForShell(text)
|
|
1487
|
-
overwrite: options?.overwrite
|
|
1488
|
-
});
|
|
1484
|
+
if (useYadb) await this.execYadb(escapeForShell(text));
|
|
1489
1485
|
else {
|
|
1490
1486
|
const segments = text.split('\n');
|
|
1491
1487
|
for(let i = 0; i < segments.length; i++){
|
|
@@ -1959,7 +1955,7 @@ class AndroidMCPServer extends BaseMCPServer {
|
|
|
1959
1955
|
constructor(toolsManager){
|
|
1960
1956
|
super({
|
|
1961
1957
|
name: '@midscene/android-mcp',
|
|
1962
|
-
version: "1.7.
|
|
1958
|
+
version: "1.7.3",
|
|
1963
1959
|
description: 'Control the Android device using natural language commands'
|
|
1964
1960
|
}, toolsManager);
|
|
1965
1961
|
}
|
package/dist/lib/cli.js
CHANGED
|
@@ -734,8 +734,7 @@ var __webpack_exports__ = {};
|
|
|
734
734
|
if (!param || !param.value) return;
|
|
735
735
|
const autoDismissKeyboard = param.autoDismissKeyboard ?? this.options?.autoDismissKeyboard;
|
|
736
736
|
await this.keyboardType(param.value, {
|
|
737
|
-
autoDismissKeyboard
|
|
738
|
-
overwrite: 'typeOnly' !== param.mode
|
|
737
|
+
autoDismissKeyboard
|
|
739
738
|
});
|
|
740
739
|
}
|
|
741
740
|
}),
|
|
@@ -1003,11 +1002,10 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1003
1002
|
});
|
|
1004
1003
|
}
|
|
1005
1004
|
}
|
|
1006
|
-
async execYadb(keyboardContent
|
|
1005
|
+
async execYadb(keyboardContent) {
|
|
1007
1006
|
await this.ensureYadb();
|
|
1008
1007
|
const adb = await this.getAdb();
|
|
1009
|
-
|
|
1010
|
-
await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'${overwriteFlag}`);
|
|
1008
|
+
await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`);
|
|
1011
1009
|
}
|
|
1012
1010
|
async getElementsInfo() {
|
|
1013
1011
|
return [];
|
|
@@ -1339,7 +1337,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1339
1337
|
const adb = await this.getAdb();
|
|
1340
1338
|
const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1341
1339
|
if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) await adb.clearTextField(100);
|
|
1342
|
-
else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -
|
|
1340
|
+
else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboardClear`);
|
|
1343
1341
|
if (await adb.isSoftKeyboardPresent()) return;
|
|
1344
1342
|
if (element) await this.mouseClick(element.center[0], element.center[1]);
|
|
1345
1343
|
}
|
|
@@ -1499,9 +1497,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1499
1497
|
const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1500
1498
|
const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
|
|
1501
1499
|
const useYadb = IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text);
|
|
1502
|
-
if (useYadb) await this.execYadb(escapeForShell(text)
|
|
1503
|
-
overwrite: options?.overwrite
|
|
1504
|
-
});
|
|
1500
|
+
if (useYadb) await this.execYadb(escapeForShell(text));
|
|
1505
1501
|
else {
|
|
1506
1502
|
const segments = text.split('\n');
|
|
1507
1503
|
for(let i = 0; i < segments.length; i++){
|
|
@@ -1971,7 +1967,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1971
1967
|
const tools = new AndroidMidsceneTools();
|
|
1972
1968
|
(0, cli_namespaceObject.runToolsCLI)(tools, 'midscene-android', {
|
|
1973
1969
|
stripPrefix: 'android_',
|
|
1974
|
-
version: "1.7.
|
|
1970
|
+
version: "1.7.3",
|
|
1975
1971
|
extraCommands: (0, core_namespaceObject.createReportCliCommands)()
|
|
1976
1972
|
}).catch((e)=>{
|
|
1977
1973
|
if (!(e instanceof cli_namespaceObject.CLIError)) console.error(e);
|
package/dist/lib/index.js
CHANGED
|
@@ -656,8 +656,7 @@ var __webpack_exports__ = {};
|
|
|
656
656
|
if (!param || !param.value) return;
|
|
657
657
|
const autoDismissKeyboard = param.autoDismissKeyboard ?? this.options?.autoDismissKeyboard;
|
|
658
658
|
await this.keyboardType(param.value, {
|
|
659
|
-
autoDismissKeyboard
|
|
660
|
-
overwrite: 'typeOnly' !== param.mode
|
|
659
|
+
autoDismissKeyboard
|
|
661
660
|
});
|
|
662
661
|
}
|
|
663
662
|
}),
|
|
@@ -925,11 +924,10 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
925
924
|
});
|
|
926
925
|
}
|
|
927
926
|
}
|
|
928
|
-
async execYadb(keyboardContent
|
|
927
|
+
async execYadb(keyboardContent) {
|
|
929
928
|
await this.ensureYadb();
|
|
930
929
|
const adb = await this.getAdb();
|
|
931
|
-
|
|
932
|
-
await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'${overwriteFlag}`);
|
|
930
|
+
await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`);
|
|
933
931
|
}
|
|
934
932
|
async getElementsInfo() {
|
|
935
933
|
return [];
|
|
@@ -1261,7 +1259,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1261
1259
|
const adb = await this.getAdb();
|
|
1262
1260
|
const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1263
1261
|
if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) await adb.clearTextField(100);
|
|
1264
|
-
else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -
|
|
1262
|
+
else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboardClear`);
|
|
1265
1263
|
if (await adb.isSoftKeyboardPresent()) return;
|
|
1266
1264
|
if (element) await this.mouseClick(element.center[0], element.center[1]);
|
|
1267
1265
|
}
|
|
@@ -1421,9 +1419,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1421
1419
|
const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1422
1420
|
const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
|
|
1423
1421
|
const useYadb = IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text);
|
|
1424
|
-
if (useYadb) await this.execYadb(escapeForShell(text)
|
|
1425
|
-
overwrite: options?.overwrite
|
|
1426
|
-
});
|
|
1422
|
+
if (useYadb) await this.execYadb(escapeForShell(text));
|
|
1427
1423
|
else {
|
|
1428
1424
|
const segments = text.split('\n');
|
|
1429
1425
|
for(let i = 0; i < segments.length; i++){
|
package/dist/lib/mcp-server.js
CHANGED
|
@@ -749,8 +749,7 @@ var __webpack_exports__ = {};
|
|
|
749
749
|
if (!param || !param.value) return;
|
|
750
750
|
const autoDismissKeyboard = param.autoDismissKeyboard ?? this.options?.autoDismissKeyboard;
|
|
751
751
|
await this.keyboardType(param.value, {
|
|
752
|
-
autoDismissKeyboard
|
|
753
|
-
overwrite: 'typeOnly' !== param.mode
|
|
752
|
+
autoDismissKeyboard
|
|
754
753
|
});
|
|
755
754
|
}
|
|
756
755
|
}),
|
|
@@ -1018,11 +1017,10 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1018
1017
|
});
|
|
1019
1018
|
}
|
|
1020
1019
|
}
|
|
1021
|
-
async execYadb(keyboardContent
|
|
1020
|
+
async execYadb(keyboardContent) {
|
|
1022
1021
|
await this.ensureYadb();
|
|
1023
1022
|
const adb = await this.getAdb();
|
|
1024
|
-
|
|
1025
|
-
await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'${overwriteFlag}`);
|
|
1023
|
+
await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`);
|
|
1026
1024
|
}
|
|
1027
1025
|
async getElementsInfo() {
|
|
1028
1026
|
return [];
|
|
@@ -1354,7 +1352,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1354
1352
|
const adb = await this.getAdb();
|
|
1355
1353
|
const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1356
1354
|
if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) await adb.clearTextField(100);
|
|
1357
|
-
else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -
|
|
1355
|
+
else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboardClear`);
|
|
1358
1356
|
if (await adb.isSoftKeyboardPresent()) return;
|
|
1359
1357
|
if (element) await this.mouseClick(element.center[0], element.center[1]);
|
|
1360
1358
|
}
|
|
@@ -1514,9 +1512,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1514
1512
|
const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1515
1513
|
const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
|
|
1516
1514
|
const useYadb = IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text);
|
|
1517
|
-
if (useYadb) await this.execYadb(escapeForShell(text)
|
|
1518
|
-
overwrite: options?.overwrite
|
|
1519
|
-
});
|
|
1515
|
+
if (useYadb) await this.execYadb(escapeForShell(text));
|
|
1520
1516
|
else {
|
|
1521
1517
|
const segments = text.split('\n');
|
|
1522
1518
|
for(let i = 0; i < segments.length; i++){
|
|
@@ -1990,7 +1986,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1990
1986
|
constructor(toolsManager){
|
|
1991
1987
|
super({
|
|
1992
1988
|
name: '@midscene/android-mcp',
|
|
1993
|
-
version: "1.7.
|
|
1989
|
+
version: "1.7.3",
|
|
1994
1990
|
description: 'Control the Android device using natural language commands'
|
|
1995
1991
|
}, toolsManager);
|
|
1996
1992
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -125,9 +125,7 @@ export declare class AndroidDevice implements AbstractInterface {
|
|
|
125
125
|
* If uri contains "/" (e.g. com.example.app/.MainActivity), only the package part is used.
|
|
126
126
|
*/
|
|
127
127
|
terminate(uri: string): Promise<void>;
|
|
128
|
-
execYadb(keyboardContent: string
|
|
129
|
-
overwrite?: boolean;
|
|
130
|
-
}): Promise<void>;
|
|
128
|
+
execYadb(keyboardContent: string): Promise<void>;
|
|
131
129
|
getElementsInfo(): Promise<ElementInfo[]>;
|
|
132
130
|
getElementsNodeTree(): Promise<any>;
|
|
133
131
|
getScreenSize(): Promise<{
|
|
@@ -195,9 +193,7 @@ export declare class AndroidDevice implements AbstractInterface {
|
|
|
195
193
|
* via escapeForShell + double-quoted shell context.
|
|
196
194
|
*/
|
|
197
195
|
private shouldUseYadbForText;
|
|
198
|
-
keyboardType(text: string, options?: AndroidDeviceInputOpt
|
|
199
|
-
overwrite?: boolean;
|
|
200
|
-
}): Promise<void>;
|
|
196
|
+
keyboardType(text: string, options?: AndroidDeviceInputOpt): Promise<void>;
|
|
201
197
|
private normalizeKeyName;
|
|
202
198
|
keyboardPress(key: string): Promise<void>;
|
|
203
199
|
mouseClick(x: number, y: number): Promise<void>;
|
|
@@ -117,9 +117,7 @@ declare class AndroidDevice implements AbstractInterface {
|
|
|
117
117
|
* If uri contains "/" (e.g. com.example.app/.MainActivity), only the package part is used.
|
|
118
118
|
*/
|
|
119
119
|
terminate(uri: string): Promise<void>;
|
|
120
|
-
execYadb(keyboardContent: string
|
|
121
|
-
overwrite?: boolean;
|
|
122
|
-
}): Promise<void>;
|
|
120
|
+
execYadb(keyboardContent: string): Promise<void>;
|
|
123
121
|
getElementsInfo(): Promise<ElementInfo[]>;
|
|
124
122
|
getElementsNodeTree(): Promise<any>;
|
|
125
123
|
getScreenSize(): Promise<{
|
|
@@ -187,9 +185,7 @@ declare class AndroidDevice implements AbstractInterface {
|
|
|
187
185
|
* via escapeForShell + double-quoted shell context.
|
|
188
186
|
*/
|
|
189
187
|
private shouldUseYadbForText;
|
|
190
|
-
keyboardType(text: string, options?: AndroidDeviceInputOpt
|
|
191
|
-
overwrite?: boolean;
|
|
192
|
-
}): Promise<void>;
|
|
188
|
+
keyboardType(text: string, options?: AndroidDeviceInputOpt): Promise<void>;
|
|
193
189
|
private normalizeKeyName;
|
|
194
190
|
keyboardPress(key: string): Promise<void>;
|
|
195
191
|
mouseClick(x: number, y: number): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/android",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"description": "Android automation library for Midscene",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Android UI automation",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@yume-chan/stream-extra": "2.1.0",
|
|
42
42
|
"appium-adb": "12.12.1",
|
|
43
43
|
"sharp": "^0.34.3",
|
|
44
|
-
"@midscene/core": "1.7.
|
|
45
|
-
"@midscene/shared": "1.7.
|
|
44
|
+
"@midscene/core": "1.7.3",
|
|
45
|
+
"@midscene/shared": "1.7.3"
|
|
46
46
|
},
|
|
47
47
|
"optionalDependencies": {
|
|
48
48
|
"@ffmpeg-installer/ffmpeg": "^1.1.0"
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"typescript": "^5.8.3",
|
|
56
56
|
"tsx": "^4.19.2",
|
|
57
57
|
"vitest": "3.0.5",
|
|
58
|
-
"zod": "3.
|
|
59
|
-
"@midscene/playground": "1.7.
|
|
58
|
+
"zod": "^3.25.1",
|
|
59
|
+
"@midscene/playground": "1.7.3"
|
|
60
60
|
},
|
|
61
61
|
"license": "MIT",
|
|
62
62
|
"scripts": {
|