@midscene/android 1.10.8-beta-20260723115348.0 → 1.10.8
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 +50 -50
- package/dist/es/index.mjs +10 -10
- package/dist/lib/cli.js +50 -50
- package/dist/lib/index.js +10 -10
- package/package.json +4 -4
package/dist/es/cli.mjs
CHANGED
|
@@ -540,45 +540,6 @@ function __webpack_require__(moduleId) {
|
|
|
540
540
|
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
541
541
|
})();
|
|
542
542
|
var logger_ = __webpack_require__("@midscene/shared/logger");
|
|
543
|
-
const EMPTY_ADB_SHELL_STDOUT = '<empty>';
|
|
544
|
-
const MAX_RUN_ADB_SHELL_STDOUT = 200;
|
|
545
|
-
function normalizeShellStream(value) {
|
|
546
|
-
if (null == value) return '';
|
|
547
|
-
return String(value);
|
|
548
|
-
}
|
|
549
|
-
function truncateAdbShellStream(output, streamName) {
|
|
550
|
-
if (output.length <= MAX_RUN_ADB_SHELL_STDOUT) return output;
|
|
551
|
-
return `${output.slice(0, MAX_RUN_ADB_SHELL_STDOUT)}
|
|
552
|
-
...[${streamName} truncated, ${output.length - MAX_RUN_ADB_SHELL_STDOUT} more characters]`;
|
|
553
|
-
}
|
|
554
|
-
function buildRunAdbShellPlanningFeedback({ command, stdout }) {
|
|
555
|
-
if ('' === stdout) return;
|
|
556
|
-
const commandText = 'string' == typeof command && command.length > 0 ? `Command: ${command}\n` : '';
|
|
557
|
-
return `${commandText}Stdout:
|
|
558
|
-
${stdout}`;
|
|
559
|
-
}
|
|
560
|
-
function buildAdbShellStderrErrorMessage(command, stdout, stderr) {
|
|
561
|
-
return `RunAdbShell command returned stderr.
|
|
562
|
-
Command: ${command}
|
|
563
|
-
Stderr:
|
|
564
|
-
${truncateAdbShellStream(stderr, 'stderr')}
|
|
565
|
-
Stdout:
|
|
566
|
-
${stdout ? truncateAdbShellStream(stdout, 'stdout') : EMPTY_ADB_SHELL_STDOUT}`;
|
|
567
|
-
}
|
|
568
|
-
function getAdbShellStdoutOrThrow(command, output) {
|
|
569
|
-
if ('string' == typeof output) return output;
|
|
570
|
-
const stdout = normalizeShellStream(output.stdout);
|
|
571
|
-
const stderr = normalizeShellStream(output.stderr);
|
|
572
|
-
if (stderr) throw new Error(buildAdbShellStderrErrorMessage(command, stdout, stderr));
|
|
573
|
-
return stdout;
|
|
574
|
-
}
|
|
575
|
-
async function runAdbShellStdoutOrThrow(adb, command, options = {}) {
|
|
576
|
-
const output = await adb.shell(command, {
|
|
577
|
-
...options,
|
|
578
|
-
outputFormat: adb.EXEC_OUTPUT_FORMAT.FULL
|
|
579
|
-
});
|
|
580
|
-
return getAdbShellStdoutOrThrow(command, output);
|
|
581
|
-
}
|
|
582
543
|
const defaultAppNameMapping = {
|
|
583
544
|
微信: 'com.tencent.mm',
|
|
584
545
|
QQ: 'com.tencent.mobileqq',
|
|
@@ -707,6 +668,45 @@ async function adb_createAndroidAdb({ adbExecTimeout, deviceId, deviceOptions })
|
|
|
707
668
|
}
|
|
708
669
|
return new ADB(adbOptions);
|
|
709
670
|
}
|
|
671
|
+
const EMPTY_ADB_SHELL_STDOUT = '<empty>';
|
|
672
|
+
const MAX_RUN_ADB_SHELL_STDOUT = 200;
|
|
673
|
+
function normalizeShellStream(value) {
|
|
674
|
+
if (null == value) return '';
|
|
675
|
+
return String(value);
|
|
676
|
+
}
|
|
677
|
+
function truncateAdbShellStream(output, streamName) {
|
|
678
|
+
if (output.length <= MAX_RUN_ADB_SHELL_STDOUT) return output;
|
|
679
|
+
return `${output.slice(0, MAX_RUN_ADB_SHELL_STDOUT)}
|
|
680
|
+
...[${streamName} truncated, ${output.length - MAX_RUN_ADB_SHELL_STDOUT} more characters]`;
|
|
681
|
+
}
|
|
682
|
+
function buildRunAdbShellPlanningFeedback({ command, stdout }) {
|
|
683
|
+
if ('' === stdout) return;
|
|
684
|
+
const commandText = 'string' == typeof command && command.length > 0 ? `Command: ${command}\n` : '';
|
|
685
|
+
return `${commandText}Stdout:
|
|
686
|
+
${stdout}`;
|
|
687
|
+
}
|
|
688
|
+
function buildAdbShellStderrErrorMessage(command, stdout, stderr) {
|
|
689
|
+
return `RunAdbShell command returned stderr.
|
|
690
|
+
Command: ${command}
|
|
691
|
+
Stderr:
|
|
692
|
+
${truncateAdbShellStream(stderr, 'stderr')}
|
|
693
|
+
Stdout:
|
|
694
|
+
${stdout ? truncateAdbShellStream(stdout, 'stdout') : EMPTY_ADB_SHELL_STDOUT}`;
|
|
695
|
+
}
|
|
696
|
+
function getAdbShellStdoutOrThrow(command, output) {
|
|
697
|
+
if ('string' == typeof output) return output;
|
|
698
|
+
const stdout = normalizeShellStream(output.stdout);
|
|
699
|
+
const stderr = normalizeShellStream(output.stderr);
|
|
700
|
+
if (stderr) throw new Error(buildAdbShellStderrErrorMessage(command, stdout, stderr));
|
|
701
|
+
return stdout;
|
|
702
|
+
}
|
|
703
|
+
async function runAdbShellStdoutOrThrow(adb, command, options = {}) {
|
|
704
|
+
const output = await adb.shell(command, {
|
|
705
|
+
...options,
|
|
706
|
+
outputFormat: adb.EXEC_OUTPUT_FORMAT.FULL
|
|
707
|
+
});
|
|
708
|
+
return getAdbShellStdoutOrThrow(command, output);
|
|
709
|
+
}
|
|
710
710
|
var scrcpy_manager = __webpack_require__("./src/scrcpy-manager.ts");
|
|
711
711
|
function _define_property(obj, key, value) {
|
|
712
712
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -963,7 +963,9 @@ class AndroidDevice {
|
|
|
963
963
|
}
|
|
964
964
|
})
|
|
965
965
|
];
|
|
966
|
-
const
|
|
966
|
+
const platformActions = createPlatformActions(this);
|
|
967
|
+
let platformSpecificActions = Object.values(platformActions);
|
|
968
|
+
if (this.options?.exposeRunAdbShellAction === false) platformSpecificActions = platformSpecificActions.filter((action)=>action !== platformActions.RunAdbShell);
|
|
967
969
|
const customActions = this.customActions || [];
|
|
968
970
|
return [
|
|
969
971
|
...defaultActions,
|
|
@@ -2059,7 +2061,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
2059
2061
|
device_define_property(AndroidDevice, "TAKE_SCREENSHOT_FAIL_THRESHOLD", 3);
|
|
2060
2062
|
device_define_property(AndroidDevice, "DEFAULT_MIN_SCREENSHOT_BUFFER_SIZE", 1024);
|
|
2061
2063
|
const runAdbShellParamSchema = z.object({
|
|
2062
|
-
command: z.string().describe('ADB shell command to execute')
|
|
2064
|
+
command: z.string().describe('ADB shell command to execute'),
|
|
2065
|
+
timeout: z.number().optional().describe('ADB shell command execution timeout in milliseconds. Only include this parameter when the user explicitly requests a timeout; otherwise, omit it.')
|
|
2063
2066
|
});
|
|
2064
2067
|
const launchParamSchema = z.object({
|
|
2065
2068
|
uri: z.string().describe('App name, package name, or URL to launch. Prioritize using the exact package name or URL the user has provided. If none provided, use the accurate app name.')
|
|
@@ -2079,7 +2082,9 @@ const createPlatformActions = (device)=>({
|
|
|
2079
2082
|
call: async (param, context)=>{
|
|
2080
2083
|
if (!param.command || '' === param.command.trim()) throw new Error('RunAdbShell requires a non-empty command parameter');
|
|
2081
2084
|
const adb = await device.getAdb();
|
|
2082
|
-
const stdout = await runAdbShellStdoutOrThrow(adb, param.command
|
|
2085
|
+
const stdout = await runAdbShellStdoutOrThrow(adb, param.command, void 0 === param.timeout ? void 0 : {
|
|
2086
|
+
timeout: param.timeout
|
|
2087
|
+
});
|
|
2083
2088
|
const planningFeedback = buildRunAdbShellPlanningFeedback({
|
|
2084
2089
|
command: param.command,
|
|
2085
2090
|
stdout
|
|
@@ -2157,15 +2162,10 @@ class AndroidAgent extends Agent {
|
|
|
2157
2162
|
});
|
|
2158
2163
|
}
|
|
2159
2164
|
async runAdbShell(command, opt) {
|
|
2160
|
-
if (opt?.timeout !== void 0) {
|
|
2161
|
-
const adb = await this.interface.getAdb();
|
|
2162
|
-
return await runAdbShellStdoutOrThrow(adb, command, {
|
|
2163
|
-
timeout: opt.timeout
|
|
2164
|
-
});
|
|
2165
|
-
}
|
|
2166
2165
|
const action = this.wrapActionInActionSpace('RunAdbShell');
|
|
2167
2166
|
return action({
|
|
2168
|
-
command
|
|
2167
|
+
command,
|
|
2168
|
+
...opt
|
|
2169
2169
|
});
|
|
2170
2170
|
}
|
|
2171
2171
|
createActionWrapper(name) {
|
|
@@ -2312,7 +2312,7 @@ class AndroidMidsceneTools extends BaseMidsceneTools {
|
|
|
2312
2312
|
const tools = new AndroidMidsceneTools();
|
|
2313
2313
|
runToolsCLI(tools, 'midscene-android', {
|
|
2314
2314
|
stripPrefix: 'android_',
|
|
2315
|
-
version: "1.10.8
|
|
2315
|
+
version: "1.10.8",
|
|
2316
2316
|
extraCommands: createReportCliCommands()
|
|
2317
2317
|
}).catch((e)=>{
|
|
2318
2318
|
process.exit(reportCLIError(e));
|
package/dist/es/index.mjs
CHANGED
|
@@ -866,7 +866,9 @@ class AndroidDevice {
|
|
|
866
866
|
}
|
|
867
867
|
})
|
|
868
868
|
];
|
|
869
|
-
const
|
|
869
|
+
const platformActions = createPlatformActions(this);
|
|
870
|
+
let platformSpecificActions = Object.values(platformActions);
|
|
871
|
+
if (this.options?.exposeRunAdbShellAction === false) platformSpecificActions = platformSpecificActions.filter((action)=>action !== platformActions.RunAdbShell);
|
|
870
872
|
const customActions = this.customActions || [];
|
|
871
873
|
return [
|
|
872
874
|
...defaultActions,
|
|
@@ -1962,7 +1964,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1962
1964
|
device_define_property(AndroidDevice, "TAKE_SCREENSHOT_FAIL_THRESHOLD", 3);
|
|
1963
1965
|
device_define_property(AndroidDevice, "DEFAULT_MIN_SCREENSHOT_BUFFER_SIZE", 1024);
|
|
1964
1966
|
const runAdbShellParamSchema = z.object({
|
|
1965
|
-
command: z.string().describe('ADB shell command to execute')
|
|
1967
|
+
command: z.string().describe('ADB shell command to execute'),
|
|
1968
|
+
timeout: z.number().optional().describe('ADB shell command execution timeout in milliseconds. Only include this parameter when the user explicitly requests a timeout; otherwise, omit it.')
|
|
1966
1969
|
});
|
|
1967
1970
|
const launchParamSchema = z.object({
|
|
1968
1971
|
uri: z.string().describe('App name, package name, or URL to launch. Prioritize using the exact package name or URL the user has provided. If none provided, use the accurate app name.')
|
|
@@ -1982,7 +1985,9 @@ const createPlatformActions = (device)=>({
|
|
|
1982
1985
|
call: async (param, context)=>{
|
|
1983
1986
|
if (!param.command || '' === param.command.trim()) throw new Error('RunAdbShell requires a non-empty command parameter');
|
|
1984
1987
|
const adb = await device.getAdb();
|
|
1985
|
-
const stdout = await runAdbShellStdoutOrThrow(adb, param.command
|
|
1988
|
+
const stdout = await runAdbShellStdoutOrThrow(adb, param.command, void 0 === param.timeout ? void 0 : {
|
|
1989
|
+
timeout: param.timeout
|
|
1990
|
+
});
|
|
1986
1991
|
const planningFeedback = buildRunAdbShellPlanningFeedback({
|
|
1987
1992
|
command: param.command,
|
|
1988
1993
|
stdout
|
|
@@ -2224,15 +2229,10 @@ class AndroidAgent extends Agent {
|
|
|
2224
2229
|
});
|
|
2225
2230
|
}
|
|
2226
2231
|
async runAdbShell(command, opt) {
|
|
2227
|
-
if (opt?.timeout !== void 0) {
|
|
2228
|
-
const adb = await this.interface.getAdb();
|
|
2229
|
-
return await runAdbShellStdoutOrThrow(adb, command, {
|
|
2230
|
-
timeout: opt.timeout
|
|
2231
|
-
});
|
|
2232
|
-
}
|
|
2233
2232
|
const action = this.wrapActionInActionSpace('RunAdbShell');
|
|
2234
2233
|
return action({
|
|
2235
|
-
command
|
|
2234
|
+
command,
|
|
2235
|
+
...opt
|
|
2236
2236
|
});
|
|
2237
2237
|
}
|
|
2238
2238
|
createActionWrapper(name) {
|
package/dist/lib/cli.js
CHANGED
|
@@ -545,45 +545,6 @@ var __webpack_exports__ = {};
|
|
|
545
545
|
var logger_ = __webpack_require__("@midscene/shared/logger");
|
|
546
546
|
const agent_namespaceObject = require("@midscene/core/agent");
|
|
547
547
|
const utils_namespaceObject = require("@midscene/shared/utils");
|
|
548
|
-
const EMPTY_ADB_SHELL_STDOUT = '<empty>';
|
|
549
|
-
const MAX_RUN_ADB_SHELL_STDOUT = 200;
|
|
550
|
-
function normalizeShellStream(value) {
|
|
551
|
-
if (null == value) return '';
|
|
552
|
-
return String(value);
|
|
553
|
-
}
|
|
554
|
-
function truncateAdbShellStream(output, streamName) {
|
|
555
|
-
if (output.length <= MAX_RUN_ADB_SHELL_STDOUT) return output;
|
|
556
|
-
return `${output.slice(0, MAX_RUN_ADB_SHELL_STDOUT)}
|
|
557
|
-
...[${streamName} truncated, ${output.length - MAX_RUN_ADB_SHELL_STDOUT} more characters]`;
|
|
558
|
-
}
|
|
559
|
-
function buildRunAdbShellPlanningFeedback({ command, stdout }) {
|
|
560
|
-
if ('' === stdout) return;
|
|
561
|
-
const commandText = 'string' == typeof command && command.length > 0 ? `Command: ${command}\n` : '';
|
|
562
|
-
return `${commandText}Stdout:
|
|
563
|
-
${stdout}`;
|
|
564
|
-
}
|
|
565
|
-
function buildAdbShellStderrErrorMessage(command, stdout, stderr) {
|
|
566
|
-
return `RunAdbShell command returned stderr.
|
|
567
|
-
Command: ${command}
|
|
568
|
-
Stderr:
|
|
569
|
-
${truncateAdbShellStream(stderr, 'stderr')}
|
|
570
|
-
Stdout:
|
|
571
|
-
${stdout ? truncateAdbShellStream(stdout, 'stdout') : EMPTY_ADB_SHELL_STDOUT}`;
|
|
572
|
-
}
|
|
573
|
-
function getAdbShellStdoutOrThrow(command, output) {
|
|
574
|
-
if ('string' == typeof output) return output;
|
|
575
|
-
const stdout = normalizeShellStream(output.stdout);
|
|
576
|
-
const stderr = normalizeShellStream(output.stderr);
|
|
577
|
-
if (stderr) throw new Error(buildAdbShellStderrErrorMessage(command, stdout, stderr));
|
|
578
|
-
return stdout;
|
|
579
|
-
}
|
|
580
|
-
async function runAdbShellStdoutOrThrow(adb, command, options = {}) {
|
|
581
|
-
const output = await adb.shell(command, {
|
|
582
|
-
...options,
|
|
583
|
-
outputFormat: adb.EXEC_OUTPUT_FORMAT.FULL
|
|
584
|
-
});
|
|
585
|
-
return getAdbShellStdoutOrThrow(command, output);
|
|
586
|
-
}
|
|
587
548
|
const defaultAppNameMapping = {
|
|
588
549
|
微信: 'com.tencent.mm',
|
|
589
550
|
QQ: 'com.tencent.mobileqq',
|
|
@@ -722,6 +683,45 @@ ${stdout ? truncateAdbShellStream(stdout, 'stdout') : EMPTY_ADB_SHELL_STDOUT}`;
|
|
|
722
683
|
}
|
|
723
684
|
return new external_appium_adb_namespaceObject.ADB(adbOptions);
|
|
724
685
|
}
|
|
686
|
+
const EMPTY_ADB_SHELL_STDOUT = '<empty>';
|
|
687
|
+
const MAX_RUN_ADB_SHELL_STDOUT = 200;
|
|
688
|
+
function normalizeShellStream(value) {
|
|
689
|
+
if (null == value) return '';
|
|
690
|
+
return String(value);
|
|
691
|
+
}
|
|
692
|
+
function truncateAdbShellStream(output, streamName) {
|
|
693
|
+
if (output.length <= MAX_RUN_ADB_SHELL_STDOUT) return output;
|
|
694
|
+
return `${output.slice(0, MAX_RUN_ADB_SHELL_STDOUT)}
|
|
695
|
+
...[${streamName} truncated, ${output.length - MAX_RUN_ADB_SHELL_STDOUT} more characters]`;
|
|
696
|
+
}
|
|
697
|
+
function buildRunAdbShellPlanningFeedback({ command, stdout }) {
|
|
698
|
+
if ('' === stdout) return;
|
|
699
|
+
const commandText = 'string' == typeof command && command.length > 0 ? `Command: ${command}\n` : '';
|
|
700
|
+
return `${commandText}Stdout:
|
|
701
|
+
${stdout}`;
|
|
702
|
+
}
|
|
703
|
+
function buildAdbShellStderrErrorMessage(command, stdout, stderr) {
|
|
704
|
+
return `RunAdbShell command returned stderr.
|
|
705
|
+
Command: ${command}
|
|
706
|
+
Stderr:
|
|
707
|
+
${truncateAdbShellStream(stderr, 'stderr')}
|
|
708
|
+
Stdout:
|
|
709
|
+
${stdout ? truncateAdbShellStream(stdout, 'stdout') : EMPTY_ADB_SHELL_STDOUT}`;
|
|
710
|
+
}
|
|
711
|
+
function getAdbShellStdoutOrThrow(command, output) {
|
|
712
|
+
if ('string' == typeof output) return output;
|
|
713
|
+
const stdout = normalizeShellStream(output.stdout);
|
|
714
|
+
const stderr = normalizeShellStream(output.stderr);
|
|
715
|
+
if (stderr) throw new Error(buildAdbShellStderrErrorMessage(command, stdout, stderr));
|
|
716
|
+
return stdout;
|
|
717
|
+
}
|
|
718
|
+
async function runAdbShellStdoutOrThrow(adb, command, options = {}) {
|
|
719
|
+
const output = await adb.shell(command, {
|
|
720
|
+
...options,
|
|
721
|
+
outputFormat: adb.EXEC_OUTPUT_FORMAT.FULL
|
|
722
|
+
});
|
|
723
|
+
return getAdbShellStdoutOrThrow(command, output);
|
|
724
|
+
}
|
|
725
725
|
var scrcpy_manager = __webpack_require__("./src/scrcpy-manager.ts");
|
|
726
726
|
function _define_property(obj, key, value) {
|
|
727
727
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -978,7 +978,9 @@ ${stdout ? truncateAdbShellStream(stdout, 'stdout') : EMPTY_ADB_SHELL_STDOUT}`;
|
|
|
978
978
|
}
|
|
979
979
|
})
|
|
980
980
|
];
|
|
981
|
-
const
|
|
981
|
+
const platformActions = createPlatformActions(this);
|
|
982
|
+
let platformSpecificActions = Object.values(platformActions);
|
|
983
|
+
if (this.options?.exposeRunAdbShellAction === false) platformSpecificActions = platformSpecificActions.filter((action)=>action !== platformActions.RunAdbShell);
|
|
982
984
|
const customActions = this.customActions || [];
|
|
983
985
|
return [
|
|
984
986
|
...defaultActions,
|
|
@@ -2074,7 +2076,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
2074
2076
|
device_define_property(AndroidDevice, "TAKE_SCREENSHOT_FAIL_THRESHOLD", 3);
|
|
2075
2077
|
device_define_property(AndroidDevice, "DEFAULT_MIN_SCREENSHOT_BUFFER_SIZE", 1024);
|
|
2076
2078
|
const runAdbShellParamSchema = core_namespaceObject.z.object({
|
|
2077
|
-
command: core_namespaceObject.z.string().describe('ADB shell command to execute')
|
|
2079
|
+
command: core_namespaceObject.z.string().describe('ADB shell command to execute'),
|
|
2080
|
+
timeout: core_namespaceObject.z.number().optional().describe('ADB shell command execution timeout in milliseconds. Only include this parameter when the user explicitly requests a timeout; otherwise, omit it.')
|
|
2078
2081
|
});
|
|
2079
2082
|
const launchParamSchema = core_namespaceObject.z.object({
|
|
2080
2083
|
uri: core_namespaceObject.z.string().describe('App name, package name, or URL to launch. Prioritize using the exact package name or URL the user has provided. If none provided, use the accurate app name.')
|
|
@@ -2094,7 +2097,9 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
2094
2097
|
call: async (param, context)=>{
|
|
2095
2098
|
if (!param.command || '' === param.command.trim()) throw new Error('RunAdbShell requires a non-empty command parameter');
|
|
2096
2099
|
const adb = await device.getAdb();
|
|
2097
|
-
const stdout = await runAdbShellStdoutOrThrow(adb, param.command
|
|
2100
|
+
const stdout = await runAdbShellStdoutOrThrow(adb, param.command, void 0 === param.timeout ? void 0 : {
|
|
2101
|
+
timeout: param.timeout
|
|
2102
|
+
});
|
|
2098
2103
|
const planningFeedback = buildRunAdbShellPlanningFeedback({
|
|
2099
2104
|
command: param.command,
|
|
2100
2105
|
stdout
|
|
@@ -2172,15 +2177,10 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
2172
2177
|
});
|
|
2173
2178
|
}
|
|
2174
2179
|
async runAdbShell(command, opt) {
|
|
2175
|
-
if (opt?.timeout !== void 0) {
|
|
2176
|
-
const adb = await this.interface.getAdb();
|
|
2177
|
-
return await runAdbShellStdoutOrThrow(adb, command, {
|
|
2178
|
-
timeout: opt.timeout
|
|
2179
|
-
});
|
|
2180
|
-
}
|
|
2181
2180
|
const action = this.wrapActionInActionSpace('RunAdbShell');
|
|
2182
2181
|
return action({
|
|
2183
|
-
command
|
|
2182
|
+
command,
|
|
2183
|
+
...opt
|
|
2184
2184
|
});
|
|
2185
2185
|
}
|
|
2186
2186
|
createActionWrapper(name) {
|
|
@@ -2327,7 +2327,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
2327
2327
|
const tools = new AndroidMidsceneTools();
|
|
2328
2328
|
(0, cli_namespaceObject.runToolsCLI)(tools, 'midscene-android', {
|
|
2329
2329
|
stripPrefix: 'android_',
|
|
2330
|
-
version: "1.10.8
|
|
2330
|
+
version: "1.10.8",
|
|
2331
2331
|
extraCommands: (0, core_namespaceObject.createReportCliCommands)()
|
|
2332
2332
|
}).catch((e)=>{
|
|
2333
2333
|
process.exit((0, cli_namespaceObject.reportCLIError)(e));
|
package/dist/lib/index.js
CHANGED
|
@@ -899,7 +899,9 @@ ${stdout ? truncateAdbShellStream(stdout, 'stdout') : EMPTY_ADB_SHELL_STDOUT}`;
|
|
|
899
899
|
}
|
|
900
900
|
})
|
|
901
901
|
];
|
|
902
|
-
const
|
|
902
|
+
const platformActions = createPlatformActions(this);
|
|
903
|
+
let platformSpecificActions = Object.values(platformActions);
|
|
904
|
+
if (this.options?.exposeRunAdbShellAction === false) platformSpecificActions = platformSpecificActions.filter((action)=>action !== platformActions.RunAdbShell);
|
|
903
905
|
const customActions = this.customActions || [];
|
|
904
906
|
return [
|
|
905
907
|
...defaultActions,
|
|
@@ -1995,7 +1997,8 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1995
1997
|
device_define_property(AndroidDevice, "TAKE_SCREENSHOT_FAIL_THRESHOLD", 3);
|
|
1996
1998
|
device_define_property(AndroidDevice, "DEFAULT_MIN_SCREENSHOT_BUFFER_SIZE", 1024);
|
|
1997
1999
|
const runAdbShellParamSchema = core_namespaceObject.z.object({
|
|
1998
|
-
command: core_namespaceObject.z.string().describe('ADB shell command to execute')
|
|
2000
|
+
command: core_namespaceObject.z.string().describe('ADB shell command to execute'),
|
|
2001
|
+
timeout: core_namespaceObject.z.number().optional().describe('ADB shell command execution timeout in milliseconds. Only include this parameter when the user explicitly requests a timeout; otherwise, omit it.')
|
|
1999
2002
|
});
|
|
2000
2003
|
const launchParamSchema = core_namespaceObject.z.object({
|
|
2001
2004
|
uri: core_namespaceObject.z.string().describe('App name, package name, or URL to launch. Prioritize using the exact package name or URL the user has provided. If none provided, use the accurate app name.')
|
|
@@ -2015,7 +2018,9 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
2015
2018
|
call: async (param, context)=>{
|
|
2016
2019
|
if (!param.command || '' === param.command.trim()) throw new Error('RunAdbShell requires a non-empty command parameter');
|
|
2017
2020
|
const adb = await device.getAdb();
|
|
2018
|
-
const stdout = await runAdbShellStdoutOrThrow(adb, param.command
|
|
2021
|
+
const stdout = await runAdbShellStdoutOrThrow(adb, param.command, void 0 === param.timeout ? void 0 : {
|
|
2022
|
+
timeout: param.timeout
|
|
2023
|
+
});
|
|
2019
2024
|
const planningFeedback = buildRunAdbShellPlanningFeedback({
|
|
2020
2025
|
command: param.command,
|
|
2021
2026
|
stdout
|
|
@@ -2258,15 +2263,10 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
2258
2263
|
});
|
|
2259
2264
|
}
|
|
2260
2265
|
async runAdbShell(command, opt) {
|
|
2261
|
-
if (opt?.timeout !== void 0) {
|
|
2262
|
-
const adb = await this.interface.getAdb();
|
|
2263
|
-
return await runAdbShellStdoutOrThrow(adb, command, {
|
|
2264
|
-
timeout: opt.timeout
|
|
2265
|
-
});
|
|
2266
|
-
}
|
|
2267
2266
|
const action = this.wrapActionInActionSpace('RunAdbShell');
|
|
2268
2267
|
return action({
|
|
2269
|
-
command
|
|
2268
|
+
command,
|
|
2269
|
+
...opt
|
|
2270
2270
|
});
|
|
2271
2271
|
}
|
|
2272
2272
|
createActionWrapper(name) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/android",
|
|
3
|
-
"version": "1.10.8
|
|
3
|
+
"version": "1.10.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/midscene.git",
|
|
@@ -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/
|
|
45
|
-
"@midscene/
|
|
44
|
+
"@midscene/shared": "1.10.8",
|
|
45
|
+
"@midscene/core": "1.10.8"
|
|
46
46
|
},
|
|
47
47
|
"optionalDependencies": {
|
|
48
48
|
"@ffmpeg-installer/ffmpeg": "^1.1.0"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"undici": "^6.0.0",
|
|
57
57
|
"vitest": "3.0.5",
|
|
58
58
|
"zod": "^3.25.1",
|
|
59
|
-
"@midscene/playground": "1.10.8
|
|
59
|
+
"@midscene/playground": "1.10.8"
|
|
60
60
|
},
|
|
61
61
|
"license": "MIT",
|
|
62
62
|
"scripts": {
|