@midscene/android 1.6.1 → 1.6.2-beta-20260401091950.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/cli.mjs CHANGED
@@ -975,7 +975,23 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
975
975
  async execYadb(keyboardContent) {
976
976
  await this.ensureYadb();
977
977
  const adb = await this.getAdb();
978
- await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`);
978
+ const adbPath = adb.executable?.path ?? 'adb';
979
+ const shellCmd = `app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`;
980
+ const args = [
981
+ '-s',
982
+ this.deviceId,
983
+ 'shell',
984
+ shellCmd
985
+ ];
986
+ await new Promise((resolve)=>{
987
+ const child = execFile(adbPath, args, {
988
+ timeout: 10000
989
+ }, (err)=>{
990
+ if (err) debugDevice('yadb keyboard command ended: %s', err.message);
991
+ resolve();
992
+ });
993
+ child.unref();
994
+ });
979
995
  }
980
996
  async getElementsInfo() {
981
997
  return [];
@@ -1307,7 +1323,24 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1307
1323
  const adb = await this.getAdb();
1308
1324
  const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
1309
1325
  if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) await adb.clearTextField(100);
1310
- else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard "~CLEAR~"`);
1326
+ else {
1327
+ const adbPath = adb.executable?.path ?? 'adb';
1328
+ const shellCmd = `app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard "~CLEAR~"`;
1329
+ await new Promise((resolve)=>{
1330
+ const child = execFile(adbPath, [
1331
+ '-s',
1332
+ this.deviceId,
1333
+ 'shell',
1334
+ shellCmd
1335
+ ], {
1336
+ timeout: 10000
1337
+ }, (err)=>{
1338
+ if (err) debugDevice('yadb clear command ended: %s', err.message);
1339
+ resolve();
1340
+ });
1341
+ child.unref();
1342
+ });
1343
+ }
1311
1344
  if (await adb.isSoftKeyboardPresent()) return;
1312
1345
  if (element) await this.mouseClick(element.center[0], element.center[1]);
1313
1346
  }
@@ -1918,7 +1951,7 @@ class AndroidMidsceneTools extends BaseMidsceneTools {
1918
1951
  const tools = new AndroidMidsceneTools();
1919
1952
  runToolsCLI(tools, 'midscene-android', {
1920
1953
  stripPrefix: 'android_',
1921
- version: "1.6.1"
1954
+ version: "1.6.2-beta-20260401091950.0"
1922
1955
  }).catch((e)=>{
1923
1956
  if (!(e instanceof CLIError)) console.error(e);
1924
1957
  process.exit(e instanceof CLIError ? e.exitCode : 1);
package/dist/es/index.mjs CHANGED
@@ -878,7 +878,23 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
878
878
  async execYadb(keyboardContent) {
879
879
  await this.ensureYadb();
880
880
  const adb = await this.getAdb();
881
- await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`);
881
+ const adbPath = adb.executable?.path ?? 'adb';
882
+ const shellCmd = `app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`;
883
+ const args = [
884
+ '-s',
885
+ this.deviceId,
886
+ 'shell',
887
+ shellCmd
888
+ ];
889
+ await new Promise((resolve)=>{
890
+ const child = execFile(adbPath, args, {
891
+ timeout: 10000
892
+ }, (err)=>{
893
+ if (err) debugDevice('yadb keyboard command ended: %s', err.message);
894
+ resolve();
895
+ });
896
+ child.unref();
897
+ });
882
898
  }
883
899
  async getElementsInfo() {
884
900
  return [];
@@ -1210,7 +1226,24 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1210
1226
  const adb = await this.getAdb();
1211
1227
  const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
1212
1228
  if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) await adb.clearTextField(100);
1213
- else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard "~CLEAR~"`);
1229
+ else {
1230
+ const adbPath = adb.executable?.path ?? 'adb';
1231
+ const shellCmd = `app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard "~CLEAR~"`;
1232
+ await new Promise((resolve)=>{
1233
+ const child = execFile(adbPath, [
1234
+ '-s',
1235
+ this.deviceId,
1236
+ 'shell',
1237
+ shellCmd
1238
+ ], {
1239
+ timeout: 10000
1240
+ }, (err)=>{
1241
+ if (err) debugDevice('yadb clear command ended: %s', err.message);
1242
+ resolve();
1243
+ });
1244
+ child.unref();
1245
+ });
1246
+ }
1214
1247
  if (await adb.isSoftKeyboardPresent()) return;
1215
1248
  if (element) await this.mouseClick(element.center[0], element.center[1]);
1216
1249
  }
@@ -974,7 +974,23 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
974
974
  async execYadb(keyboardContent) {
975
975
  await this.ensureYadb();
976
976
  const adb = await this.getAdb();
977
- await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`);
977
+ const adbPath = adb.executable?.path ?? 'adb';
978
+ const shellCmd = `app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`;
979
+ const args = [
980
+ '-s',
981
+ this.deviceId,
982
+ 'shell',
983
+ shellCmd
984
+ ];
985
+ await new Promise((resolve)=>{
986
+ const child = execFile(adbPath, args, {
987
+ timeout: 10000
988
+ }, (err)=>{
989
+ if (err) debugDevice('yadb keyboard command ended: %s', err.message);
990
+ resolve();
991
+ });
992
+ child.unref();
993
+ });
978
994
  }
979
995
  async getElementsInfo() {
980
996
  return [];
@@ -1306,7 +1322,24 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1306
1322
  const adb = await this.getAdb();
1307
1323
  const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
1308
1324
  if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) await adb.clearTextField(100);
1309
- else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard "~CLEAR~"`);
1325
+ else {
1326
+ const adbPath = adb.executable?.path ?? 'adb';
1327
+ const shellCmd = `app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard "~CLEAR~"`;
1328
+ await new Promise((resolve)=>{
1329
+ const child = execFile(adbPath, [
1330
+ '-s',
1331
+ this.deviceId,
1332
+ 'shell',
1333
+ shellCmd
1334
+ ], {
1335
+ timeout: 10000
1336
+ }, (err)=>{
1337
+ if (err) debugDevice('yadb clear command ended: %s', err.message);
1338
+ resolve();
1339
+ });
1340
+ child.unref();
1341
+ });
1342
+ }
1310
1343
  if (await adb.isSoftKeyboardPresent()) return;
1311
1344
  if (element) await this.mouseClick(element.center[0], element.center[1]);
1312
1345
  }
@@ -1921,7 +1954,7 @@ class AndroidMCPServer extends BaseMCPServer {
1921
1954
  constructor(toolsManager){
1922
1955
  super({
1923
1956
  name: '@midscene/android-mcp',
1924
- version: "1.6.1",
1957
+ version: "1.6.2-beta-20260401091950.0",
1925
1958
  description: 'Control the Android device using natural language commands'
1926
1959
  }, toolsManager);
1927
1960
  }
package/dist/lib/cli.js CHANGED
@@ -990,7 +990,23 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
990
990
  async execYadb(keyboardContent) {
991
991
  await this.ensureYadb();
992
992
  const adb = await this.getAdb();
993
- await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`);
993
+ const adbPath = adb.executable?.path ?? 'adb';
994
+ const shellCmd = `app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`;
995
+ const args = [
996
+ '-s',
997
+ this.deviceId,
998
+ 'shell',
999
+ shellCmd
1000
+ ];
1001
+ await new Promise((resolve)=>{
1002
+ const child = (0, external_node_child_process_namespaceObject.execFile)(adbPath, args, {
1003
+ timeout: 10000
1004
+ }, (err)=>{
1005
+ if (err) debugDevice('yadb keyboard command ended: %s', err.message);
1006
+ resolve();
1007
+ });
1008
+ child.unref();
1009
+ });
994
1010
  }
995
1011
  async getElementsInfo() {
996
1012
  return [];
@@ -1322,7 +1338,24 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1322
1338
  const adb = await this.getAdb();
1323
1339
  const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
1324
1340
  if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) await adb.clearTextField(100);
1325
- else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard "~CLEAR~"`);
1341
+ else {
1342
+ const adbPath = adb.executable?.path ?? 'adb';
1343
+ const shellCmd = `app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard "~CLEAR~"`;
1344
+ await new Promise((resolve)=>{
1345
+ const child = (0, external_node_child_process_namespaceObject.execFile)(adbPath, [
1346
+ '-s',
1347
+ this.deviceId,
1348
+ 'shell',
1349
+ shellCmd
1350
+ ], {
1351
+ timeout: 10000
1352
+ }, (err)=>{
1353
+ if (err) debugDevice('yadb clear command ended: %s', err.message);
1354
+ resolve();
1355
+ });
1356
+ child.unref();
1357
+ });
1358
+ }
1326
1359
  if (await adb.isSoftKeyboardPresent()) return;
1327
1360
  if (element) await this.mouseClick(element.center[0], element.center[1]);
1328
1361
  }
@@ -1933,7 +1966,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1933
1966
  const tools = new AndroidMidsceneTools();
1934
1967
  (0, cli_namespaceObject.runToolsCLI)(tools, 'midscene-android', {
1935
1968
  stripPrefix: 'android_',
1936
- version: "1.6.1"
1969
+ version: "1.6.2-beta-20260401091950.0"
1937
1970
  }).catch((e)=>{
1938
1971
  if (!(e instanceof cli_namespaceObject.CLIError)) console.error(e);
1939
1972
  process.exit(e instanceof cli_namespaceObject.CLIError ? e.exitCode : 1);
package/dist/lib/index.js CHANGED
@@ -912,7 +912,23 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
912
912
  async execYadb(keyboardContent) {
913
913
  await this.ensureYadb();
914
914
  const adb = await this.getAdb();
915
- await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`);
915
+ const adbPath = adb.executable?.path ?? 'adb';
916
+ const shellCmd = `app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`;
917
+ const args = [
918
+ '-s',
919
+ this.deviceId,
920
+ 'shell',
921
+ shellCmd
922
+ ];
923
+ await new Promise((resolve)=>{
924
+ const child = (0, external_node_child_process_namespaceObject.execFile)(adbPath, args, {
925
+ timeout: 10000
926
+ }, (err)=>{
927
+ if (err) debugDevice('yadb keyboard command ended: %s', err.message);
928
+ resolve();
929
+ });
930
+ child.unref();
931
+ });
916
932
  }
917
933
  async getElementsInfo() {
918
934
  return [];
@@ -1244,7 +1260,24 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1244
1260
  const adb = await this.getAdb();
1245
1261
  const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
1246
1262
  if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) await adb.clearTextField(100);
1247
- else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard "~CLEAR~"`);
1263
+ else {
1264
+ const adbPath = adb.executable?.path ?? 'adb';
1265
+ const shellCmd = `app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard "~CLEAR~"`;
1266
+ await new Promise((resolve)=>{
1267
+ const child = (0, external_node_child_process_namespaceObject.execFile)(adbPath, [
1268
+ '-s',
1269
+ this.deviceId,
1270
+ 'shell',
1271
+ shellCmd
1272
+ ], {
1273
+ timeout: 10000
1274
+ }, (err)=>{
1275
+ if (err) debugDevice('yadb clear command ended: %s', err.message);
1276
+ resolve();
1277
+ });
1278
+ child.unref();
1279
+ });
1280
+ }
1248
1281
  if (await adb.isSoftKeyboardPresent()) return;
1249
1282
  if (element) await this.mouseClick(element.center[0], element.center[1]);
1250
1283
  }
@@ -1005,7 +1005,23 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1005
1005
  async execYadb(keyboardContent) {
1006
1006
  await this.ensureYadb();
1007
1007
  const adb = await this.getAdb();
1008
- await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`);
1008
+ const adbPath = adb.executable?.path ?? 'adb';
1009
+ const shellCmd = `app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'`;
1010
+ const args = [
1011
+ '-s',
1012
+ this.deviceId,
1013
+ 'shell',
1014
+ shellCmd
1015
+ ];
1016
+ await new Promise((resolve)=>{
1017
+ const child = (0, external_node_child_process_namespaceObject.execFile)(adbPath, args, {
1018
+ timeout: 10000
1019
+ }, (err)=>{
1020
+ if (err) debugDevice('yadb keyboard command ended: %s', err.message);
1021
+ resolve();
1022
+ });
1023
+ child.unref();
1024
+ });
1009
1025
  }
1010
1026
  async getElementsInfo() {
1011
1027
  return [];
@@ -1337,7 +1353,24 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1337
1353
  const adb = await this.getAdb();
1338
1354
  const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
1339
1355
  if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) await adb.clearTextField(100);
1340
- else await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard "~CLEAR~"`);
1356
+ else {
1357
+ const adbPath = adb.executable?.path ?? 'adb';
1358
+ const shellCmd = `app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard "~CLEAR~"`;
1359
+ await new Promise((resolve)=>{
1360
+ const child = (0, external_node_child_process_namespaceObject.execFile)(adbPath, [
1361
+ '-s',
1362
+ this.deviceId,
1363
+ 'shell',
1364
+ shellCmd
1365
+ ], {
1366
+ timeout: 10000
1367
+ }, (err)=>{
1368
+ if (err) debugDevice('yadb clear command ended: %s', err.message);
1369
+ resolve();
1370
+ });
1371
+ child.unref();
1372
+ });
1373
+ }
1341
1374
  if (await adb.isSoftKeyboardPresent()) return;
1342
1375
  if (element) await this.mouseClick(element.center[0], element.center[1]);
1343
1376
  }
@@ -1952,7 +1985,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1952
1985
  constructor(toolsManager){
1953
1986
  super({
1954
1987
  name: '@midscene/android-mcp',
1955
- version: "1.6.1",
1988
+ version: "1.6.2-beta-20260401091950.0",
1956
1989
  description: 'Control the Android device using natural language commands'
1957
1990
  }, toolsManager);
1958
1991
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/android",
3
- "version": "1.6.1",
3
+ "version": "1.6.2-beta-20260401091950.0",
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/shared": "1.6.1",
45
- "@midscene/core": "1.6.1"
44
+ "@midscene/core": "1.6.2-beta-20260401091950.0",
45
+ "@midscene/shared": "1.6.2-beta-20260401091950.0"
46
46
  },
47
47
  "optionalDependencies": {
48
48
  "@ffmpeg-installer/ffmpeg": "^1.1.0"
@@ -56,7 +56,7 @@
56
56
  "tsx": "^4.19.2",
57
57
  "vitest": "3.0.5",
58
58
  "zod": "3.24.3",
59
- "@midscene/playground": "1.6.1"
59
+ "@midscene/playground": "1.6.2-beta-20260401091950.0"
60
60
  },
61
61
  "license": "MIT",
62
62
  "scripts": {