@midscene/android 0.16.8 → 0.16.9-beta-20250507095704.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/index.js +5 -1
- package/dist/lib/index.js +9 -5
- package/package.json +4 -4
package/dist/es/index.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import assert from "assert";
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import path from "path";
|
|
5
|
+
import { getAIConfig } from "@midscene/core";
|
|
5
6
|
import { getTmpFile } from "@midscene/core/utils";
|
|
7
|
+
import { MIDSCENE_ADB_PATH } from "@midscene/shared/env";
|
|
6
8
|
import { isValidPNGImageBuffer, resizeImg } from "@midscene/shared/img";
|
|
7
9
|
import { getDebug } from "@midscene/shared/logger";
|
|
8
10
|
import { ADB } from "appium-adb";
|
|
@@ -33,9 +35,11 @@ var AndroidDevice = class {
|
|
|
33
35
|
let error = null;
|
|
34
36
|
debugPage(`Initializing ADB with device ID: ${this.deviceId}`);
|
|
35
37
|
try {
|
|
38
|
+
const androidAdbPath = getAIConfig(MIDSCENE_ADB_PATH);
|
|
36
39
|
this.adb = await ADB.createADB({
|
|
37
40
|
udid: this.deviceId,
|
|
38
|
-
adbExecTimeout: 6e4
|
|
41
|
+
adbExecTimeout: 6e4,
|
|
42
|
+
executable: androidAdbPath ? { path: androidAdbPath, defaultArgs: [] } : void 0
|
|
39
43
|
});
|
|
40
44
|
const size = await this.getScreenSize();
|
|
41
45
|
console.log(`
|
package/dist/lib/index.js
CHANGED
|
@@ -34,7 +34,7 @@ __export(src_exports, {
|
|
|
34
34
|
AndroidDevice: () => AndroidDevice,
|
|
35
35
|
agentFromAdbDevice: () => agentFromAdbDevice,
|
|
36
36
|
getConnectedDevices: () => getConnectedDevices,
|
|
37
|
-
overrideAIConfig: () =>
|
|
37
|
+
overrideAIConfig: () => import_env3.overrideAIConfig
|
|
38
38
|
});
|
|
39
39
|
module.exports = __toCommonJS(src_exports);
|
|
40
40
|
|
|
@@ -42,7 +42,9 @@ module.exports = __toCommonJS(src_exports);
|
|
|
42
42
|
var import_node_assert = __toESM(require("assert"));
|
|
43
43
|
var import_node_fs = __toESM(require("fs"));
|
|
44
44
|
var import_node_path = __toESM(require("path"));
|
|
45
|
+
var import_core = require("@midscene/core");
|
|
45
46
|
var import_utils = require("@midscene/core/utils");
|
|
47
|
+
var import_env = require("@midscene/shared/env");
|
|
46
48
|
var import_img = require("@midscene/shared/img");
|
|
47
49
|
var import_logger = require("@midscene/shared/logger");
|
|
48
50
|
var import_appium_adb = require("appium-adb");
|
|
@@ -73,9 +75,11 @@ var AndroidDevice = class {
|
|
|
73
75
|
let error = null;
|
|
74
76
|
debugPage(`Initializing ADB with device ID: ${this.deviceId}`);
|
|
75
77
|
try {
|
|
78
|
+
const androidAdbPath = (0, import_core.getAIConfig)(import_env.MIDSCENE_ADB_PATH);
|
|
76
79
|
this.adb = await import_appium_adb.ADB.createADB({
|
|
77
80
|
udid: this.deviceId,
|
|
78
|
-
adbExecTimeout: 6e4
|
|
81
|
+
adbExecTimeout: 6e4,
|
|
82
|
+
executable: androidAdbPath ? { path: androidAdbPath, defaultArgs: [] } : void 0
|
|
79
83
|
});
|
|
80
84
|
const size = await this.getScreenSize();
|
|
81
85
|
console.log(`
|
|
@@ -515,7 +519,7 @@ ${Object.keys(size).filter((key) => size[key]).map(
|
|
|
515
519
|
|
|
516
520
|
// src/agent/index.ts
|
|
517
521
|
var import_agent = require("@midscene/web/agent");
|
|
518
|
-
var
|
|
522
|
+
var import_env2 = require("@midscene/shared/env");
|
|
519
523
|
|
|
520
524
|
// src/utils/index.ts
|
|
521
525
|
var import_appium_adb2 = require("appium-adb");
|
|
@@ -542,7 +546,7 @@ async function getConnectedDevices() {
|
|
|
542
546
|
var AndroidAgent = class extends import_agent.PageAgent {
|
|
543
547
|
constructor(page, opts) {
|
|
544
548
|
super(page, opts);
|
|
545
|
-
if (!(0,
|
|
549
|
+
if (!(0, import_env2.vlLocateMode)()) {
|
|
546
550
|
throw new Error(
|
|
547
551
|
"Android Agent only supports vl-model. https://midscenejs.com/choose-a-model.html"
|
|
548
552
|
);
|
|
@@ -568,7 +572,7 @@ async function agentFromAdbDevice(deviceId, opts) {
|
|
|
568
572
|
}
|
|
569
573
|
|
|
570
574
|
// src/index.ts
|
|
571
|
-
var
|
|
575
|
+
var import_env3 = require("@midscene/shared/env");
|
|
572
576
|
// Annotate the CommonJS export names for ESM import in node:
|
|
573
577
|
0 && (module.exports = {
|
|
574
578
|
AndroidAgent,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/android",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.9-beta-20250507095704.0",
|
|
4
4
|
"description": "Android automation library for Midscene",
|
|
5
5
|
"main": "./dist/lib/index.js",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"appium-adb": "12.12.1",
|
|
20
|
-
"@midscene/
|
|
21
|
-
"@midscene/
|
|
22
|
-
"@midscene/
|
|
20
|
+
"@midscene/shared": "0.16.9-beta-20250507095704.0",
|
|
21
|
+
"@midscene/web": "0.16.9-beta-20250507095704.0",
|
|
22
|
+
"@midscene/core": "0.16.9-beta-20250507095704.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@modern-js/module-tools": "2.60.6",
|