@midscene/android 1.6.2 → 1.6.3-beta-20260403070857.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/bin/yadb CHANGED
Binary file
package/dist/es/cli.mjs CHANGED
@@ -719,7 +719,8 @@ 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
722
+ autoDismissKeyboard,
723
+ overwrite: 'typeOnly' !== param.mode
723
724
  });
724
725
  }
725
726
  }),
@@ -972,10 +973,11 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
972
973
  }
973
974
  return this;
974
975
  }
975
- async execYadb(keyboardContent) {
976
+ async execYadb(keyboardContent, options) {
976
977
  await this.ensureYadb();
977
978
  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}'`);
979
+ const overwriteFlag = options?.overwrite ? ' --overwrite' : '';
980
+ await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'${overwriteFlag}`);
979
981
  }
980
982
  async getElementsInfo() {
981
983
  return [];
@@ -1467,7 +1469,9 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1467
1469
  const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
1468
1470
  const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
1469
1471
  const useYadb = IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text);
1470
- if (useYadb) await this.execYadb(escapeForShell(text));
1472
+ if (useYadb) await this.execYadb(escapeForShell(text), {
1473
+ overwrite: options?.overwrite
1474
+ });
1471
1475
  else {
1472
1476
  const segments = text.split('\n');
1473
1477
  for(let i = 0; i < segments.length; i++){
@@ -1918,7 +1922,7 @@ class AndroidMidsceneTools extends BaseMidsceneTools {
1918
1922
  const tools = new AndroidMidsceneTools();
1919
1923
  runToolsCLI(tools, 'midscene-android', {
1920
1924
  stripPrefix: 'android_',
1921
- version: "1.6.2"
1925
+ version: "1.6.3-beta-20260403070857.0"
1922
1926
  }).catch((e)=>{
1923
1927
  if (!(e instanceof CLIError)) console.error(e);
1924
1928
  process.exit(e instanceof CLIError ? e.exitCode : 1);
package/dist/es/index.mjs CHANGED
@@ -622,7 +622,8 @@ 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
625
+ autoDismissKeyboard,
626
+ overwrite: 'typeOnly' !== param.mode
626
627
  });
627
628
  }
628
629
  }),
@@ -875,10 +876,11 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
875
876
  }
876
877
  return this;
877
878
  }
878
- async execYadb(keyboardContent) {
879
+ async execYadb(keyboardContent, options) {
879
880
  await this.ensureYadb();
880
881
  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}'`);
882
+ const overwriteFlag = options?.overwrite ? ' --overwrite' : '';
883
+ await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'${overwriteFlag}`);
882
884
  }
883
885
  async getElementsInfo() {
884
886
  return [];
@@ -1370,7 +1372,9 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1370
1372
  const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
1371
1373
  const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
1372
1374
  const useYadb = IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text);
1373
- if (useYadb) await this.execYadb(escapeForShell(text));
1375
+ if (useYadb) await this.execYadb(escapeForShell(text), {
1376
+ overwrite: options?.overwrite
1377
+ });
1374
1378
  else {
1375
1379
  const segments = text.split('\n');
1376
1380
  for(let i = 0; i < segments.length; i++){
@@ -718,7 +718,8 @@ 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
721
+ autoDismissKeyboard,
722
+ overwrite: 'typeOnly' !== param.mode
722
723
  });
723
724
  }
724
725
  }),
@@ -971,10 +972,11 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
971
972
  }
972
973
  return this;
973
974
  }
974
- async execYadb(keyboardContent) {
975
+ async execYadb(keyboardContent, options) {
975
976
  await this.ensureYadb();
976
977
  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}'`);
978
+ const overwriteFlag = options?.overwrite ? ' --overwrite' : '';
979
+ await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'${overwriteFlag}`);
978
980
  }
979
981
  async getElementsInfo() {
980
982
  return [];
@@ -1466,7 +1468,9 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1466
1468
  const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
1467
1469
  const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
1468
1470
  const useYadb = IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text);
1469
- if (useYadb) await this.execYadb(escapeForShell(text));
1471
+ if (useYadb) await this.execYadb(escapeForShell(text), {
1472
+ overwrite: options?.overwrite
1473
+ });
1470
1474
  else {
1471
1475
  const segments = text.split('\n');
1472
1476
  for(let i = 0; i < segments.length; i++){
@@ -1921,7 +1925,7 @@ class AndroidMCPServer extends BaseMCPServer {
1921
1925
  constructor(toolsManager){
1922
1926
  super({
1923
1927
  name: '@midscene/android-mcp',
1924
- version: "1.6.2",
1928
+ version: "1.6.3-beta-20260403070857.0",
1925
1929
  description: 'Control the Android device using natural language commands'
1926
1930
  }, toolsManager);
1927
1931
  }
package/dist/lib/cli.js CHANGED
@@ -734,7 +734,8 @@ 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
737
+ autoDismissKeyboard,
738
+ overwrite: 'typeOnly' !== param.mode
738
739
  });
739
740
  }
740
741
  }),
@@ -987,10 +988,11 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
987
988
  }
988
989
  return this;
989
990
  }
990
- async execYadb(keyboardContent) {
991
+ async execYadb(keyboardContent, options) {
991
992
  await this.ensureYadb();
992
993
  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}'`);
994
+ const overwriteFlag = options?.overwrite ? ' --overwrite' : '';
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}`);
994
996
  }
995
997
  async getElementsInfo() {
996
998
  return [];
@@ -1482,7 +1484,9 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1482
1484
  const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
1483
1485
  const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
1484
1486
  const useYadb = IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text);
1485
- if (useYadb) await this.execYadb(escapeForShell(text));
1487
+ if (useYadb) await this.execYadb(escapeForShell(text), {
1488
+ overwrite: options?.overwrite
1489
+ });
1486
1490
  else {
1487
1491
  const segments = text.split('\n');
1488
1492
  for(let i = 0; i < segments.length; i++){
@@ -1933,7 +1937,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1933
1937
  const tools = new AndroidMidsceneTools();
1934
1938
  (0, cli_namespaceObject.runToolsCLI)(tools, 'midscene-android', {
1935
1939
  stripPrefix: 'android_',
1936
- version: "1.6.2"
1940
+ version: "1.6.3-beta-20260403070857.0"
1937
1941
  }).catch((e)=>{
1938
1942
  if (!(e instanceof cli_namespaceObject.CLIError)) console.error(e);
1939
1943
  process.exit(e instanceof cli_namespaceObject.CLIError ? e.exitCode : 1);
package/dist/lib/index.js CHANGED
@@ -656,7 +656,8 @@ 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
659
+ autoDismissKeyboard,
660
+ overwrite: 'typeOnly' !== param.mode
660
661
  });
661
662
  }
662
663
  }),
@@ -909,10 +910,11 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
909
910
  }
910
911
  return this;
911
912
  }
912
- async execYadb(keyboardContent) {
913
+ async execYadb(keyboardContent, options) {
913
914
  await this.ensureYadb();
914
915
  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}'`);
916
+ const overwriteFlag = options?.overwrite ? ' --overwrite' : '';
917
+ await adb.shell(`app_process${this.getDisplayArg()} -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '${keyboardContent}'${overwriteFlag}`);
916
918
  }
917
919
  async getElementsInfo() {
918
920
  return [];
@@ -1404,7 +1406,9 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1404
1406
  const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
1405
1407
  const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
1406
1408
  const useYadb = IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text);
1407
- if (useYadb) await this.execYadb(escapeForShell(text));
1409
+ if (useYadb) await this.execYadb(escapeForShell(text), {
1410
+ overwrite: options?.overwrite
1411
+ });
1408
1412
  else {
1409
1413
  const segments = text.split('\n');
1410
1414
  for(let i = 0; i < segments.length; i++){
@@ -749,7 +749,8 @@ 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
752
+ autoDismissKeyboard,
753
+ overwrite: 'typeOnly' !== param.mode
753
754
  });
754
755
  }
755
756
  }),
@@ -1002,10 +1003,11 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1002
1003
  }
1003
1004
  return this;
1004
1005
  }
1005
- async execYadb(keyboardContent) {
1006
+ async execYadb(keyboardContent, options) {
1006
1007
  await this.ensureYadb();
1007
1008
  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}'`);
1009
+ const overwriteFlag = options?.overwrite ? ' --overwrite' : '';
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}`);
1009
1011
  }
1010
1012
  async getElementsInfo() {
1011
1013
  return [];
@@ -1497,7 +1499,9 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1497
1499
  const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
1498
1500
  const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
1499
1501
  const useYadb = IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text);
1500
- if (useYadb) await this.execYadb(escapeForShell(text));
1502
+ if (useYadb) await this.execYadb(escapeForShell(text), {
1503
+ overwrite: options?.overwrite
1504
+ });
1501
1505
  else {
1502
1506
  const segments = text.split('\n');
1503
1507
  for(let i = 0; i < segments.length; i++){
@@ -1952,7 +1956,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
1952
1956
  constructor(toolsManager){
1953
1957
  super({
1954
1958
  name: '@midscene/android-mcp',
1955
- version: "1.6.2",
1959
+ version: "1.6.3-beta-20260403070857.0",
1956
1960
  description: 'Control the Android device using natural language commands'
1957
1961
  }, toolsManager);
1958
1962
  }
@@ -114,7 +114,9 @@ export declare class AndroidDevice implements AbstractInterface {
114
114
  */
115
115
  private resolvePackageName;
116
116
  launch(uri: string): Promise<AndroidDevice>;
117
- execYadb(keyboardContent: string): Promise<void>;
117
+ execYadb(keyboardContent: string, options?: {
118
+ overwrite?: boolean;
119
+ }): Promise<void>;
118
120
  getElementsInfo(): Promise<ElementInfo[]>;
119
121
  getElementsNodeTree(): Promise<any>;
120
122
  getScreenSize(): Promise<{
@@ -182,7 +184,9 @@ export declare class AndroidDevice implements AbstractInterface {
182
184
  * via escapeForShell + double-quoted shell context.
183
185
  */
184
186
  private shouldUseYadbForText;
185
- keyboardType(text: string, options?: AndroidDeviceInputOpt): Promise<void>;
187
+ keyboardType(text: string, options?: AndroidDeviceInputOpt & {
188
+ overwrite?: boolean;
189
+ }): Promise<void>;
186
190
  private normalizeKeyName;
187
191
  keyboardPress(key: string): Promise<void>;
188
192
  mouseClick(x: number, y: number): Promise<void>;
@@ -106,7 +106,9 @@ declare class AndroidDevice implements AbstractInterface {
106
106
  */
107
107
  private resolvePackageName;
108
108
  launch(uri: string): Promise<AndroidDevice>;
109
- execYadb(keyboardContent: string): Promise<void>;
109
+ execYadb(keyboardContent: string, options?: {
110
+ overwrite?: boolean;
111
+ }): Promise<void>;
110
112
  getElementsInfo(): Promise<ElementInfo[]>;
111
113
  getElementsNodeTree(): Promise<any>;
112
114
  getScreenSize(): Promise<{
@@ -174,7 +176,9 @@ declare class AndroidDevice implements AbstractInterface {
174
176
  * via escapeForShell + double-quoted shell context.
175
177
  */
176
178
  private shouldUseYadbForText;
177
- keyboardType(text: string, options?: AndroidDeviceInputOpt): Promise<void>;
179
+ keyboardType(text: string, options?: AndroidDeviceInputOpt & {
180
+ overwrite?: boolean;
181
+ }): Promise<void>;
178
182
  private normalizeKeyName;
179
183
  keyboardPress(key: string): Promise<void>;
180
184
  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.6.2",
3
+ "version": "1.6.3-beta-20260403070857.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/core": "1.6.2",
45
- "@midscene/shared": "1.6.2"
44
+ "@midscene/core": "1.6.3-beta-20260403070857.0",
45
+ "@midscene/shared": "1.6.3-beta-20260403070857.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.2"
59
+ "@midscene/playground": "1.6.3-beta-20260403070857.0"
60
60
  },
61
61
  "license": "MIT",
62
62
  "scripts": {
package/bin/.yadb-version DELETED
@@ -1 +0,0 @@
1
- v1.1.0