@midscene/shared 1.12.4-beta-20260904041024.0 → 1.12.4-beta-20260920043323.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/agent-tools/tool-defaults.mjs +0 -9
- package/dist/es/agent-tools/tool-generator.mjs +1 -3
- package/dist/es/cli/cli-runner.mjs +1 -0
- package/dist/es/constants/example-code.mjs +1 -1
- package/dist/es/env/parse-model-config.mjs +1 -1
- package/dist/es/env/types.mjs +4 -2
- package/dist/lib/agent-tools/tool-defaults.js +0 -9
- package/dist/lib/agent-tools/tool-generator.js +1 -3
- package/dist/lib/cli/cli-runner.js +1 -0
- package/dist/lib/constants/example-code.js +1 -1
- package/dist/lib/env/parse-model-config.js +1 -1
- package/dist/lib/env/types.js +6 -1
- package/dist/types/agent-tools/tool-defaults.d.ts +1 -1
- package/dist/types/constants/example-code.d.ts +1 -1
- package/dist/types/env/types.d.ts +4 -2
- package/package.json +1 -1
- package/src/agent-tools/tool-defaults.ts +1 -7
- package/src/agent-tools/tool-generator.ts +6 -12
- package/src/cli/cli-runner.ts +7 -1
- package/src/constants/example-code.ts +1 -1
- package/src/env/types.ts +4 -0
|
@@ -10,15 +10,6 @@ const TOOL_BEHAVIOR_FLAGS = [
|
|
|
10
10
|
deepLocate: true
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
cli: 'deep-think',
|
|
16
|
-
description: 'Plan the act tool with deep thinking (richer context and sub-goal decomposition, a bit slower).',
|
|
17
|
-
defaults: {
|
|
18
|
-
act: {
|
|
19
|
-
deepThink: true
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
13
|
}
|
|
23
14
|
];
|
|
24
15
|
function mergeToolDefaults(a, b) {
|
|
@@ -420,7 +420,6 @@ function generateCommonTools(getAgent, initArgSchema = {}, initArgCliMetadata, t
|
|
|
420
420
|
schema: {
|
|
421
421
|
prompt: z.string().describe('Natural language description of the action to perform, e.g. "press Command+Space, type Safari, press Enter"'),
|
|
422
422
|
deepLocate: z.boolean().optional().describe('Use deep locate for every element this action targets. Improves precision for small or ambiguous targets at the cost of speed. Defaults to the server --deep-locate setting.'),
|
|
423
|
-
deepThink: z.boolean().optional().describe('Plan this action with deep thinking (richer context and sub-goal decomposition). Helps with complex multi-step instructions at the cost of speed. Defaults to the server --deep-think setting.'),
|
|
424
423
|
fileChooserAllowedDir: z.string().optional().describe('Directory that model-planned file uploads may access. Required when the prompt asks the model to upload files.'),
|
|
425
424
|
...promptInputExtraSchema,
|
|
426
425
|
...initArgSchema
|
|
@@ -429,6 +428,7 @@ function generateCommonTools(getAgent, initArgSchema = {}, initArgCliMetadata, t
|
|
|
429
428
|
handler: async (args = {})=>{
|
|
430
429
|
const prompt = args.prompt;
|
|
431
430
|
try {
|
|
431
|
+
if ('deepThink' in args || 'deep-think' in args || 'effort' in args) throw new Error('deepThink and effort have been removed. Configure Planning components with MIDSCENE_PLANNING_DISABLE_PARTS instead.');
|
|
432
432
|
const agent = await getAgent(args);
|
|
433
433
|
emitCliVerboseEvent({
|
|
434
434
|
event: 'agent_ready',
|
|
@@ -440,11 +440,9 @@ function generateCommonTools(getAgent, initArgSchema = {}, initArgCliMetadata, t
|
|
|
440
440
|
});
|
|
441
441
|
try {
|
|
442
442
|
const actOptions = {
|
|
443
|
-
deepThink: false,
|
|
444
443
|
...toolDefaults.act
|
|
445
444
|
};
|
|
446
445
|
if (void 0 !== args.deepLocate) actOptions.deepLocate = args.deepLocate;
|
|
447
|
-
if (void 0 !== args.deepThink) actOptions.deepThink = args.deepThink;
|
|
448
446
|
if (void 0 !== args.fileChooserAllowedDir) actOptions.fileChooserAllowedDir = args.fileChooserAllowedDir;
|
|
449
447
|
const userPrompt = composeUserPrompt({
|
|
450
448
|
prompt,
|
|
@@ -100,6 +100,7 @@ async function runToolsCLI(tools, scriptName, options) {
|
|
|
100
100
|
const inputArgs = options?.argv ?? process.argv.slice(2);
|
|
101
101
|
debug('CLI invoked: %s %s', scriptName, inputArgs.join(' '));
|
|
102
102
|
const { rawArgs: argsWithoutVerbose, verbose, format: verboseFormat } = stripVerboseFlag(inputArgs);
|
|
103
|
+
if (inputArgs.some((arg)=>/^--deep-?think(?:=|$)/i.test(arg))) throw new CLIError('--deep-think has been removed. Configure Planning components with MIDSCENE_PLANNING_DISABLE_PARTS instead.');
|
|
103
104
|
const { rawArgs, toolDefaults } = stripBehaviorFlags(argsWithoutVerbose);
|
|
104
105
|
if (Object.keys(toolDefaults).length > 0) tools.setToolDefaults?.(toolDefaults);
|
|
105
106
|
const envFile = join(process.cwd(), '.env');
|
|
@@ -5,7 +5,7 @@ const PLAYWRIGHT_EXAMPLE_CODE = `
|
|
|
5
5
|
IMPORTANT: Follow these exact type signatures for AI functions:
|
|
6
6
|
|
|
7
7
|
// Type signatures for AI functions:
|
|
8
|
-
aiAct(prompt: string, options?: { cacheable?: boolean
|
|
8
|
+
aiAct(prompt: string, options?: { cacheable?: boolean }): Promise<string | undefined>
|
|
9
9
|
aiInput(text: string, locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>
|
|
10
10
|
aiTap(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>
|
|
11
11
|
aiHover(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>
|
|
@@ -5,7 +5,7 @@ import { assert } from "../utils.mjs";
|
|
|
5
5
|
import { maskConfig, parseJson } from "./helper.mjs";
|
|
6
6
|
import { initDebugConfig } from "./init-debug.mjs";
|
|
7
7
|
const MODEL_CONFIG_DOC_URL = 'https://midscenejs.com/model-common-config.html';
|
|
8
|
-
const getCurrentVersion = ()=>"1.12.4-beta-
|
|
8
|
+
const getCurrentVersion = ()=>"1.12.4-beta-20260920043323.0";
|
|
9
9
|
const getInvalidModelFamilyMessage = (modelFamily)=>`Invalid MIDSCENE_MODEL_FAMILY value: ${modelFamily}. Current version v${getCurrentVersion()} accepts the following model families: ${MODEL_FAMILY_VALUES.join(', ')}. You can also visit ${MODEL_CONFIG_DOC_URL} for the latest configuration information.`;
|
|
10
10
|
const KEYS_MAP = {
|
|
11
11
|
insight: INSIGHT_MODEL_CONFIG_KEYS,
|
package/dist/es/env/types.mjs
CHANGED
|
@@ -50,6 +50,7 @@ const MIDSCENE_CACHE_MAX_FILENAME_LENGTH = 'MIDSCENE_CACHE_MAX_FILENAME_LENGTH';
|
|
|
50
50
|
const MIDSCENE_REPLANNING_CYCLE_LIMIT = 'MIDSCENE_REPLANNING_CYCLE_LIMIT';
|
|
51
51
|
const MIDSCENE_RUN_DIR = 'MIDSCENE_RUN_DIR';
|
|
52
52
|
const MIDSCENE_RECORD_MODEL_CALL = 'MIDSCENE_RECORD_MODEL_CALL';
|
|
53
|
+
const MIDSCENE_PLANNING_DISABLE_PARTS = 'MIDSCENE_PLANNING_DISABLE_PARTS';
|
|
53
54
|
const MIDSCENE_INSIGHT_MODEL_NAME = 'MIDSCENE_INSIGHT_MODEL_NAME';
|
|
54
55
|
const MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY = 'MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY';
|
|
55
56
|
const MIDSCENE_INSIGHT_MODEL_HTTP_PROXY = 'MIDSCENE_INSIGHT_MODEL_HTTP_PROXY';
|
|
@@ -91,7 +92,8 @@ const BASIC_ENV_KEYS = [
|
|
|
91
92
|
MIDSCENE_DEBUG_MODEL_PROFILE,
|
|
92
93
|
MIDSCENE_DEBUG_MODEL_RESPONSE,
|
|
93
94
|
MIDSCENE_RUN_DIR,
|
|
94
|
-
MIDSCENE_RECORD_MODEL_CALL
|
|
95
|
+
MIDSCENE_RECORD_MODEL_CALL,
|
|
96
|
+
MIDSCENE_PLANNING_DISABLE_PARTS
|
|
95
97
|
];
|
|
96
98
|
const BOOLEAN_ENV_KEYS = [
|
|
97
99
|
MIDSCENE_CACHE,
|
|
@@ -218,4 +220,4 @@ var types_UITarsModelVersion = /*#__PURE__*/ function(UITarsModelVersion) {
|
|
|
218
220
|
UITarsModelVersion["DOUBAO_1_5_20B"] = "doubao-1.5-20B";
|
|
219
221
|
return UITarsModelVersion;
|
|
220
222
|
}({});
|
|
221
|
-
export { ALL_ENV_KEYS, BASIC_ENV_KEYS, BOOLEAN_ENV_KEYS, DOCKER_CONTAINER, GLOBAL_ENV_KEYS, MATCH_BY_POSITION, MIDSCENE_ADB_PATH, MIDSCENE_ADB_REMOTE_HOST, MIDSCENE_ADB_REMOTE_PORT, MIDSCENE_ANDROID_IME_STRATEGY, MIDSCENE_ANDROID_SCREENSHOT_STRATEGY, MIDSCENE_CACHE, MIDSCENE_CACHE_MAX_FILENAME_LENGTH, MIDSCENE_CHROME_PATH, MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG, MIDSCENE_DEBUG_MODE, MIDSCENE_DEBUG_MODEL_PROFILE, MIDSCENE_DEBUG_MODEL_RESPONSE, MIDSCENE_INSIGHT_MODEL_API_KEY, MIDSCENE_INSIGHT_MODEL_BASE_URL, MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON, MIDSCENE_INSIGHT_MODEL_FAMILY, MIDSCENE_INSIGHT_MODEL_HTTP_PROXY, MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON, MIDSCENE_INSIGHT_MODEL_NAME, MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET, MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT, MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED, MIDSCENE_INSIGHT_MODEL_RESPONSE_FORMAT, MIDSCENE_INSIGHT_MODEL_RETRY_COUNT, MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL, MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY, MIDSCENE_INSIGHT_MODEL_TEMPERATURE, MIDSCENE_INSIGHT_MODEL_TIMEOUT, MIDSCENE_IOS_DEVICE_CLASS_OVERRIDE, MIDSCENE_IOS_DEVICE_UDID, MIDSCENE_IOS_SIMULATOR_UDID, MIDSCENE_LANGFUSE_DEBUG, MIDSCENE_LANGSMITH_DEBUG, MIDSCENE_MCP_CHROME_PATH, MIDSCENE_MODEL_API_KEY, MIDSCENE_MODEL_BASE_URL, MIDSCENE_MODEL_EXTRA_BODY_JSON, MIDSCENE_MODEL_FAMILY, MIDSCENE_MODEL_HTTP_PROXY, MIDSCENE_MODEL_INIT_CONFIG_JSON, MIDSCENE_MODEL_NAME, MIDSCENE_MODEL_REASONING_BUDGET, MIDSCENE_MODEL_REASONING_EFFORT, MIDSCENE_MODEL_REASONING_ENABLED, MIDSCENE_MODEL_RESPONSE_FORMAT, MIDSCENE_MODEL_RETRY_COUNT, MIDSCENE_MODEL_RETRY_INTERVAL, MIDSCENE_MODEL_SOCKS_PROXY, MIDSCENE_MODEL_TEMPERATURE, MIDSCENE_MODEL_TIMEOUT, MIDSCENE_OPENAI_HTTP_PROXY, MIDSCENE_OPENAI_INIT_CONFIG_JSON, MIDSCENE_OPENAI_SOCKS_PROXY, MIDSCENE_PLANNING_MODEL_API_KEY, MIDSCENE_PLANNING_MODEL_BASE_URL, MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON, MIDSCENE_PLANNING_MODEL_FAMILY, MIDSCENE_PLANNING_MODEL_HTTP_PROXY, MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON, MIDSCENE_PLANNING_MODEL_NAME, MIDSCENE_PLANNING_MODEL_REASONING_BUDGET, MIDSCENE_PLANNING_MODEL_REASONING_EFFORT, MIDSCENE_PLANNING_MODEL_REASONING_ENABLED, MIDSCENE_PLANNING_MODEL_RESPONSE_FORMAT, MIDSCENE_PLANNING_MODEL_RETRY_COUNT, MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL, MIDSCENE_PLANNING_MODEL_SOCKS_PROXY, MIDSCENE_PLANNING_MODEL_TEMPERATURE, MIDSCENE_PLANNING_MODEL_TIMEOUT, MIDSCENE_PREFERRED_LANGUAGE, MIDSCENE_RECORD_MODEL_CALL, MIDSCENE_REPLANNING_CYCLE_LIMIT, MIDSCENE_REPORT_QUIET, MIDSCENE_REPORT_TAG_NAME, MIDSCENE_RUN_DIR, MIDSCENE_USE_DOUBAO_VISION, MIDSCENE_USE_GEMINI, MIDSCENE_USE_QWEN3_VL, MIDSCENE_USE_QWEN_VL, MIDSCENE_USE_VLM_UI_TARS, MIDSCENE_USE_VL_MODEL, MODEL_ENV_KEYS, MODEL_FAMILY_VALUES, NUMBER_ENV_KEYS, OPENAI_API_KEY, OPENAI_BASE_URL, STRING_ENV_KEYS, types_UITarsModelVersion as UITarsModelVersion, UNUSED_ENV_KEYS };
|
|
223
|
+
export { ALL_ENV_KEYS, BASIC_ENV_KEYS, BOOLEAN_ENV_KEYS, DOCKER_CONTAINER, GLOBAL_ENV_KEYS, MATCH_BY_POSITION, MIDSCENE_ADB_PATH, MIDSCENE_ADB_REMOTE_HOST, MIDSCENE_ADB_REMOTE_PORT, MIDSCENE_ANDROID_IME_STRATEGY, MIDSCENE_ANDROID_SCREENSHOT_STRATEGY, MIDSCENE_CACHE, MIDSCENE_CACHE_MAX_FILENAME_LENGTH, MIDSCENE_CHROME_PATH, MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG, MIDSCENE_DEBUG_MODE, MIDSCENE_DEBUG_MODEL_PROFILE, MIDSCENE_DEBUG_MODEL_RESPONSE, MIDSCENE_INSIGHT_MODEL_API_KEY, MIDSCENE_INSIGHT_MODEL_BASE_URL, MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON, MIDSCENE_INSIGHT_MODEL_FAMILY, MIDSCENE_INSIGHT_MODEL_HTTP_PROXY, MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON, MIDSCENE_INSIGHT_MODEL_NAME, MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET, MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT, MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED, MIDSCENE_INSIGHT_MODEL_RESPONSE_FORMAT, MIDSCENE_INSIGHT_MODEL_RETRY_COUNT, MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL, MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY, MIDSCENE_INSIGHT_MODEL_TEMPERATURE, MIDSCENE_INSIGHT_MODEL_TIMEOUT, MIDSCENE_IOS_DEVICE_CLASS_OVERRIDE, MIDSCENE_IOS_DEVICE_UDID, MIDSCENE_IOS_SIMULATOR_UDID, MIDSCENE_LANGFUSE_DEBUG, MIDSCENE_LANGSMITH_DEBUG, MIDSCENE_MCP_CHROME_PATH, MIDSCENE_MODEL_API_KEY, MIDSCENE_MODEL_BASE_URL, MIDSCENE_MODEL_EXTRA_BODY_JSON, MIDSCENE_MODEL_FAMILY, MIDSCENE_MODEL_HTTP_PROXY, MIDSCENE_MODEL_INIT_CONFIG_JSON, MIDSCENE_MODEL_NAME, MIDSCENE_MODEL_REASONING_BUDGET, MIDSCENE_MODEL_REASONING_EFFORT, MIDSCENE_MODEL_REASONING_ENABLED, MIDSCENE_MODEL_RESPONSE_FORMAT, MIDSCENE_MODEL_RETRY_COUNT, MIDSCENE_MODEL_RETRY_INTERVAL, MIDSCENE_MODEL_SOCKS_PROXY, MIDSCENE_MODEL_TEMPERATURE, MIDSCENE_MODEL_TIMEOUT, MIDSCENE_OPENAI_HTTP_PROXY, MIDSCENE_OPENAI_INIT_CONFIG_JSON, MIDSCENE_OPENAI_SOCKS_PROXY, MIDSCENE_PLANNING_DISABLE_PARTS, MIDSCENE_PLANNING_MODEL_API_KEY, MIDSCENE_PLANNING_MODEL_BASE_URL, MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON, MIDSCENE_PLANNING_MODEL_FAMILY, MIDSCENE_PLANNING_MODEL_HTTP_PROXY, MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON, MIDSCENE_PLANNING_MODEL_NAME, MIDSCENE_PLANNING_MODEL_REASONING_BUDGET, MIDSCENE_PLANNING_MODEL_REASONING_EFFORT, MIDSCENE_PLANNING_MODEL_REASONING_ENABLED, MIDSCENE_PLANNING_MODEL_RESPONSE_FORMAT, MIDSCENE_PLANNING_MODEL_RETRY_COUNT, MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL, MIDSCENE_PLANNING_MODEL_SOCKS_PROXY, MIDSCENE_PLANNING_MODEL_TEMPERATURE, MIDSCENE_PLANNING_MODEL_TIMEOUT, MIDSCENE_PREFERRED_LANGUAGE, MIDSCENE_RECORD_MODEL_CALL, MIDSCENE_REPLANNING_CYCLE_LIMIT, MIDSCENE_REPORT_QUIET, MIDSCENE_REPORT_TAG_NAME, MIDSCENE_RUN_DIR, MIDSCENE_USE_DOUBAO_VISION, MIDSCENE_USE_GEMINI, MIDSCENE_USE_QWEN3_VL, MIDSCENE_USE_QWEN_VL, MIDSCENE_USE_VLM_UI_TARS, MIDSCENE_USE_VL_MODEL, MODEL_ENV_KEYS, MODEL_FAMILY_VALUES, NUMBER_ENV_KEYS, OPENAI_API_KEY, OPENAI_BASE_URL, STRING_ENV_KEYS, types_UITarsModelVersion as UITarsModelVersion, UNUSED_ENV_KEYS };
|
|
@@ -41,15 +41,6 @@ const TOOL_BEHAVIOR_FLAGS = [
|
|
|
41
41
|
deepLocate: true
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
cli: 'deep-think',
|
|
47
|
-
description: 'Plan the act tool with deep thinking (richer context and sub-goal decomposition, a bit slower).',
|
|
48
|
-
defaults: {
|
|
49
|
-
act: {
|
|
50
|
-
deepThink: true
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
44
|
}
|
|
54
45
|
];
|
|
55
46
|
function mergeToolDefaults(a, b) {
|
|
@@ -450,7 +450,6 @@ function generateCommonTools(getAgent, initArgSchema = {}, initArgCliMetadata, t
|
|
|
450
450
|
schema: {
|
|
451
451
|
prompt: external_zod_namespaceObject.z.string().describe('Natural language description of the action to perform, e.g. "press Command+Space, type Safari, press Enter"'),
|
|
452
452
|
deepLocate: external_zod_namespaceObject.z.boolean().optional().describe('Use deep locate for every element this action targets. Improves precision for small or ambiguous targets at the cost of speed. Defaults to the server --deep-locate setting.'),
|
|
453
|
-
deepThink: external_zod_namespaceObject.z.boolean().optional().describe('Plan this action with deep thinking (richer context and sub-goal decomposition). Helps with complex multi-step instructions at the cost of speed. Defaults to the server --deep-think setting.'),
|
|
454
453
|
fileChooserAllowedDir: external_zod_namespaceObject.z.string().optional().describe('Directory that model-planned file uploads may access. Required when the prompt asks the model to upload files.'),
|
|
455
454
|
...external_user_prompt_js_namespaceObject.promptInputExtraSchema,
|
|
456
455
|
...initArgSchema
|
|
@@ -459,6 +458,7 @@ function generateCommonTools(getAgent, initArgSchema = {}, initArgCliMetadata, t
|
|
|
459
458
|
handler: async (args = {})=>{
|
|
460
459
|
const prompt = args.prompt;
|
|
461
460
|
try {
|
|
461
|
+
if ('deepThink' in args || 'deep-think' in args || 'effort' in args) throw new Error('deepThink and effort have been removed. Configure Planning components with MIDSCENE_PLANNING_DISABLE_PARTS instead.');
|
|
462
462
|
const agent = await getAgent(args);
|
|
463
463
|
(0, verbose_js_namespaceObject.emitCliVerboseEvent)({
|
|
464
464
|
event: 'agent_ready',
|
|
@@ -470,11 +470,9 @@ function generateCommonTools(getAgent, initArgSchema = {}, initArgCliMetadata, t
|
|
|
470
470
|
});
|
|
471
471
|
try {
|
|
472
472
|
const actOptions = {
|
|
473
|
-
deepThink: false,
|
|
474
473
|
...toolDefaults.act
|
|
475
474
|
};
|
|
476
475
|
if (void 0 !== args.deepLocate) actOptions.deepLocate = args.deepLocate;
|
|
477
|
-
if (void 0 !== args.deepThink) actOptions.deepThink = args.deepThink;
|
|
478
476
|
if (void 0 !== args.fileChooserAllowedDir) actOptions.fileChooserAllowedDir = args.fileChooserAllowedDir;
|
|
479
477
|
const userPrompt = (0, external_user_prompt_js_namespaceObject.composeUserPrompt)({
|
|
480
478
|
prompt,
|
|
@@ -143,6 +143,7 @@ async function runToolsCLI(tools, scriptName, options) {
|
|
|
143
143
|
const inputArgs = options?.argv ?? process.argv.slice(2);
|
|
144
144
|
debug('CLI invoked: %s %s', scriptName, inputArgs.join(' '));
|
|
145
145
|
const { rawArgs: argsWithoutVerbose, verbose, format: verboseFormat } = (0, external_verbose_js_namespaceObject.stripVerboseFlag)(inputArgs);
|
|
146
|
+
if (inputArgs.some((arg)=>/^--deep-?think(?:=|$)/i.test(arg))) throw new external_cli_error_js_namespaceObject.CLIError('--deep-think has been removed. Configure Planning components with MIDSCENE_PLANNING_DISABLE_PARTS instead.');
|
|
146
147
|
const { rawArgs, toolDefaults } = (0, tool_defaults_js_namespaceObject.stripBehaviorFlags)(argsWithoutVerbose);
|
|
147
148
|
if (Object.keys(toolDefaults).length > 0) tools.setToolDefaults?.(toolDefaults);
|
|
148
149
|
const envFile = (0, external_node_path_namespaceObject.join)(process.cwd(), '.env');
|
|
@@ -34,7 +34,7 @@ const PLAYWRIGHT_EXAMPLE_CODE = `
|
|
|
34
34
|
IMPORTANT: Follow these exact type signatures for AI functions:
|
|
35
35
|
|
|
36
36
|
// Type signatures for AI functions:
|
|
37
|
-
aiAct(prompt: string, options?: { cacheable?: boolean
|
|
37
|
+
aiAct(prompt: string, options?: { cacheable?: boolean }): Promise<string | undefined>
|
|
38
38
|
aiInput(text: string, locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>
|
|
39
39
|
aiTap(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>
|
|
40
40
|
aiHover(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>
|
|
@@ -37,7 +37,7 @@ const external_utils_js_namespaceObject = require("../utils.js");
|
|
|
37
37
|
const external_helper_js_namespaceObject = require("./helper.js");
|
|
38
38
|
const external_init_debug_js_namespaceObject = require("./init-debug.js");
|
|
39
39
|
const MODEL_CONFIG_DOC_URL = 'https://midscenejs.com/model-common-config.html';
|
|
40
|
-
const getCurrentVersion = ()=>"1.12.4-beta-
|
|
40
|
+
const getCurrentVersion = ()=>"1.12.4-beta-20260920043323.0";
|
|
41
41
|
const getInvalidModelFamilyMessage = (modelFamily)=>`Invalid MIDSCENE_MODEL_FAMILY value: ${modelFamily}. Current version v${getCurrentVersion()} accepts the following model families: ${external_types_js_namespaceObject.MODEL_FAMILY_VALUES.join(', ')}. You can also visit ${MODEL_CONFIG_DOC_URL} for the latest configuration information.`;
|
|
42
42
|
const KEYS_MAP = {
|
|
43
43
|
insight: external_constants_js_namespaceObject.INSIGHT_MODEL_CONFIG_KEYS,
|
package/dist/lib/env/types.js
CHANGED
|
@@ -83,6 +83,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
83
83
|
MIDSCENE_OPENAI_HTTP_PROXY: ()=>MIDSCENE_OPENAI_HTTP_PROXY,
|
|
84
84
|
MIDSCENE_OPENAI_INIT_CONFIG_JSON: ()=>MIDSCENE_OPENAI_INIT_CONFIG_JSON,
|
|
85
85
|
MIDSCENE_OPENAI_SOCKS_PROXY: ()=>MIDSCENE_OPENAI_SOCKS_PROXY,
|
|
86
|
+
MIDSCENE_PLANNING_DISABLE_PARTS: ()=>MIDSCENE_PLANNING_DISABLE_PARTS,
|
|
86
87
|
MIDSCENE_PLANNING_MODEL_API_KEY: ()=>MIDSCENE_PLANNING_MODEL_API_KEY,
|
|
87
88
|
MIDSCENE_PLANNING_MODEL_BASE_URL: ()=>MIDSCENE_PLANNING_MODEL_BASE_URL,
|
|
88
89
|
MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON: ()=>MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON,
|
|
@@ -172,6 +173,7 @@ const MIDSCENE_CACHE_MAX_FILENAME_LENGTH = 'MIDSCENE_CACHE_MAX_FILENAME_LENGTH';
|
|
|
172
173
|
const MIDSCENE_REPLANNING_CYCLE_LIMIT = 'MIDSCENE_REPLANNING_CYCLE_LIMIT';
|
|
173
174
|
const MIDSCENE_RUN_DIR = 'MIDSCENE_RUN_DIR';
|
|
174
175
|
const MIDSCENE_RECORD_MODEL_CALL = 'MIDSCENE_RECORD_MODEL_CALL';
|
|
176
|
+
const MIDSCENE_PLANNING_DISABLE_PARTS = 'MIDSCENE_PLANNING_DISABLE_PARTS';
|
|
175
177
|
const MIDSCENE_INSIGHT_MODEL_NAME = 'MIDSCENE_INSIGHT_MODEL_NAME';
|
|
176
178
|
const MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY = 'MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY';
|
|
177
179
|
const MIDSCENE_INSIGHT_MODEL_HTTP_PROXY = 'MIDSCENE_INSIGHT_MODEL_HTTP_PROXY';
|
|
@@ -213,7 +215,8 @@ const BASIC_ENV_KEYS = [
|
|
|
213
215
|
MIDSCENE_DEBUG_MODEL_PROFILE,
|
|
214
216
|
MIDSCENE_DEBUG_MODEL_RESPONSE,
|
|
215
217
|
MIDSCENE_RUN_DIR,
|
|
216
|
-
MIDSCENE_RECORD_MODEL_CALL
|
|
218
|
+
MIDSCENE_RECORD_MODEL_CALL,
|
|
219
|
+
MIDSCENE_PLANNING_DISABLE_PARTS
|
|
217
220
|
];
|
|
218
221
|
const BOOLEAN_ENV_KEYS = [
|
|
219
222
|
MIDSCENE_CACHE,
|
|
@@ -399,6 +402,7 @@ exports.MIDSCENE_MODEL_TIMEOUT = __webpack_exports__.MIDSCENE_MODEL_TIMEOUT;
|
|
|
399
402
|
exports.MIDSCENE_OPENAI_HTTP_PROXY = __webpack_exports__.MIDSCENE_OPENAI_HTTP_PROXY;
|
|
400
403
|
exports.MIDSCENE_OPENAI_INIT_CONFIG_JSON = __webpack_exports__.MIDSCENE_OPENAI_INIT_CONFIG_JSON;
|
|
401
404
|
exports.MIDSCENE_OPENAI_SOCKS_PROXY = __webpack_exports__.MIDSCENE_OPENAI_SOCKS_PROXY;
|
|
405
|
+
exports.MIDSCENE_PLANNING_DISABLE_PARTS = __webpack_exports__.MIDSCENE_PLANNING_DISABLE_PARTS;
|
|
402
406
|
exports.MIDSCENE_PLANNING_MODEL_API_KEY = __webpack_exports__.MIDSCENE_PLANNING_MODEL_API_KEY;
|
|
403
407
|
exports.MIDSCENE_PLANNING_MODEL_BASE_URL = __webpack_exports__.MIDSCENE_PLANNING_MODEL_BASE_URL;
|
|
404
408
|
exports.MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON = __webpack_exports__.MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON;
|
|
@@ -495,6 +499,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
495
499
|
"MIDSCENE_OPENAI_HTTP_PROXY",
|
|
496
500
|
"MIDSCENE_OPENAI_INIT_CONFIG_JSON",
|
|
497
501
|
"MIDSCENE_OPENAI_SOCKS_PROXY",
|
|
502
|
+
"MIDSCENE_PLANNING_DISABLE_PARTS",
|
|
498
503
|
"MIDSCENE_PLANNING_MODEL_API_KEY",
|
|
499
504
|
"MIDSCENE_PLANNING_MODEL_BASE_URL",
|
|
500
505
|
"MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON",
|
|
@@ -21,7 +21,7 @@ export interface ToolDefaults {
|
|
|
21
21
|
locate?: Record<string, unknown>;
|
|
22
22
|
/**
|
|
23
23
|
* Merged into the `aiAction` options used by the `act` tool.
|
|
24
|
-
* e.g. `{ deepLocate: true
|
|
24
|
+
* e.g. `{ deepLocate: true }`.
|
|
25
25
|
*/
|
|
26
26
|
act?: Record<string, unknown>;
|
|
27
27
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PLAYWRIGHT_EXAMPLE_CODE = "\n// Reference the following code to generate Midscene test cases\n// The following is test code for Midscene AI, for reference\n// The following is Playwright syntax, you can use Playwright to assist in test generation\nIMPORTANT: Follow these exact type signatures for AI functions:\n\n// Type signatures for AI functions:\naiAct(prompt: string, options?: { cacheable?: boolean
|
|
1
|
+
export declare const PLAYWRIGHT_EXAMPLE_CODE = "\n// Reference the following code to generate Midscene test cases\n// The following is test code for Midscene AI, for reference\n// The following is Playwright syntax, you can use Playwright to assist in test generation\nIMPORTANT: Follow these exact type signatures for AI functions:\n\n// Type signatures for AI functions:\naiAct(prompt: string, options?: { cacheable?: boolean }): Promise<string | undefined>\naiInput(text: string, locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiTap(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiHover(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiDoubleClick(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiKeyboardPress(key: string, locate?: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiScroll(locate: string | undefined, options: {\n direction?: 'up' | 'down' | 'left' | 'right',\n scrollType?: 'singleAction' | 'scrollToBottom' | 'scrollToTop' | 'scrollToRight' | 'scrollToLeft',\n distance?: number | null,\n deepLocate?: boolean,\n xpath?: string,\n cacheable?: boolean\n}): Promise<void>\naiAssert(assertion: string, options?: { errorMessage?: string }): Promise<void>\naiWaitFor(prompt: string, options?: { timeout?: number }): Promise<void>\naiQuery<T>(queryObject: Record<string, string>): Promise<T> // Extracts data from page based on descriptions\n\n// examples:\n// Reference the following code to generate Midscene test cases\n// The following is test code for Midscene AI, for reference\n// The following is Playwright syntax, you can use Playwright to assist in test generation\nimport { test as base } from '@playwright/test';\nimport type { PlayWrightAiFixtureType } from '@midscene/web/playwright';\nimport { PlaywrightAiFixture } from '@midscene/web/playwright';\n\nconst test = base.extend<PlayWrightAiFixtureType>(PlaywrightAiFixture({\n waitForNetworkIdleTimeout: 2000, // optional, the timeout for waiting for network idle between each action, default is 2000ms\n}));\n\n\ntest.beforeEach(async ({ page }) => {\n await page.goto('https://www.xxx.com/');\n await page.setViewportSize({ width: 1920, height: 1080 });\n});\n\ntest('ai shop', async ({\n aiAct,\n aiInput,\n aiAssert,\n aiQuery,\n aiKeyboardPress,\n aiHover,\n aiTap,\n aiWaitFor,\n agentForPage,\n page,\n}) => {\n // login\n await aiAssert('The page shows the login interface');\n await aiInput('user_name', 'in user name input');\n await aiInput('password', 'in password input');\n await aiKeyboardPress('Enter', 'Login Button');\n\n // check the login success\n await aiWaitFor('The page shows that the loading is complete');\n await aiAssert('The current page shows the product detail page');\n\n // check the product info\n const dataA = await aiQuery({\n userInfo: 'User information in the format {name: string}',\n theFirstProductInfo: 'The first product info in the format {name: string, price: number}',\n });\n expect(dataA.theFirstProductInfo.name).toBe('xxx');\n expect(dataA.theFirstProductInfo.price).toBe(100);\n\n\n // add to cart\n await aiTap('click add to cart button');\n \n await aiTap('click right top cart icon');\n await aiAssert('The cart icon shows the number 1');\n});\n";
|
|
2
2
|
export declare const YAML_EXAMPLE_CODE = "\nCRITICAL - YAML Indentation Rules:\nFor actions with additional parameters (aiScroll, aiInput, aiKeyboardPress), the parameters must be SIBLING keys at the SAME indentation level as the action key, NOT nested children indented further.\nCORRECT (parameters align with the action key):\n - aiScroll:\n direction: 'down'\n scrollType: 'singleAction'\n distance: 500\n locate: \"main content area\"\n - aiInput: 'text value'\n locate: 'input field description'\nWRONG (parameters are indented further than the action key, DO NOT do this):\n - aiScroll:\n direction: 'down'\n scrollType: 'singleAction'\n - aiInput: 'text value'\n locate: 'input field description'\n\n1. Format:\n\nweb:\n url: \"starting_url\"\n viewportWidth: 1280\n viewportHeight: 960\n\ntasks:\n - name: \"descriptive task name\"\n flow:\n - aiTap: \"element description\"\n xpath: '/html/body/div[1]/button[1]'\n - aiInput: 'text value'\n locate: 'input field description'\n xpath: '/html/body/div[1]/input[1]'\n - aiScroll:\n direction: 'down'\n scrollType: 'singleAction'\n distance: 500\n locate: \"scrollable area description\"\n xpath: '/html/body/div[1]/main[1]'\n - aiAssert: \"expected state\"\n - sleep: 1000\n\n2. Action Types:\n- aiTap: for clicks (natural language targeting)\n- aiInput: for text input with 'locate' field\n- aiScroll: with direction and scrollType\n- aiAssert: for validations\n- sleep: for delays (milliseconds)\n\n\n\nYAML type\ntasks:\n - name: <name>\n continueOnError: <boolean> # Optional, whether to continue to the next task on error, defaults to false.\n flow:\n # Auto Planning (.ai)\n # ----------------\n\n # Perform an interaction. `ai` is a shorthand for `aiAct`.\n - ai: <prompt>\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # This usage is the same as `ai`.\n - aiAct: <prompt>\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # Instant Action (.aiTap, .aiDoubleClick, .aiHover, .aiInput, .aiKeyboardPress, .aiScroll)\n # ----------------\n\n # Tap an element described by a prompt.\n - aiTap: <prompt>\n deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.\n xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # Double click an element described by a prompt.\n - aiDoubleClick: <prompt>\n deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.\n xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # Hover over an element described by a prompt.\n - aiHover: <prompt>\n deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.\n xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # Input text into an element described by a prompt.\n - aiInput: <final text content of the input>\n locate: <prompt>\n deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.\n xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # Press a key (e.g., Enter, Tab, Escape) on an element described by a prompt.\n - aiKeyboardPress: <key>\n locate: <prompt>\n deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.\n xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # Scroll globally or on an element described by a prompt.\n - aiScroll:\n direction: 'up' # or 'down' | 'left' | 'right'\n scrollType: 'singleAction' # or 'scrollToTop' | 'scrollToBottom' | 'scrollToLeft' | 'scrollToRight'\n distance: <number> # Optional, the scroll distance in pixels.\n locate: <prompt> # Optional, the element to scroll on.\n deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.\n xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # Record the current screenshot with a description in the report file.\n - recordToReport: <title> # Optional, the title of the screenshot. If not provided, the title will be 'untitled'.\n content: <content> # Optional, the description of the screenshot.\n\n # Data Extraction\n # ----------------\n\n # Perform a query that returns a JSON object.\n - aiQuery: <prompt> # Remember to describe the format of the result in the prompt.\n name: <name> # The key for the query result in the JSON output.\n\n # More APIs\n # ----------------\n\n # Wait for a condition to be met, with a timeout (in ms, optional, defaults to 30000).\n - aiWaitFor: <prompt>\n timeout: <ms>\n\n # Perform an assertion.\n - aiAssert: <prompt>\n errorMessage: <error-message> # Optional, the error message to print if the assertion fails.\n\n # Wait for a specified amount of time.\n - sleep: <ms>\n\n # Execute a piece of JavaScript code in the web page context.\n - javascript: <javascript>\n name: <name> # Optional, assign a name to the return value, which will be used as a key in the JSON output.\n\n - name: <name>\n flow:\n # ...\n";
|
|
@@ -70,6 +70,8 @@ export declare const MIDSCENE_CACHE_MAX_FILENAME_LENGTH = "MIDSCENE_CACHE_MAX_FI
|
|
|
70
70
|
export declare const MIDSCENE_REPLANNING_CYCLE_LIMIT = "MIDSCENE_REPLANNING_CYCLE_LIMIT";
|
|
71
71
|
export declare const MIDSCENE_RUN_DIR = "MIDSCENE_RUN_DIR";
|
|
72
72
|
export declare const MIDSCENE_RECORD_MODEL_CALL = "MIDSCENE_RECORD_MODEL_CALL";
|
|
73
|
+
/** Comma-separated standard Planning components to disable for ablation. */
|
|
74
|
+
export declare const MIDSCENE_PLANNING_DISABLE_PARTS = "MIDSCENE_PLANNING_DISABLE_PARTS";
|
|
73
75
|
export declare const MIDSCENE_INSIGHT_MODEL_NAME = "MIDSCENE_INSIGHT_MODEL_NAME";
|
|
74
76
|
export declare const MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY = "MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY";
|
|
75
77
|
export declare const MIDSCENE_INSIGHT_MODEL_HTTP_PROXY = "MIDSCENE_INSIGHT_MODEL_HTTP_PROXY";
|
|
@@ -111,7 +113,7 @@ export declare const UNUSED_ENV_KEYS: string[];
|
|
|
111
113
|
* env keys for debug or basic run
|
|
112
114
|
* can not be override by overrideAIConfig
|
|
113
115
|
*/
|
|
114
|
-
export declare const BASIC_ENV_KEYS: readonly ["MIDSCENE_DEBUG_MODE", "MIDSCENE_DEBUG_MODEL_PROFILE", "MIDSCENE_DEBUG_MODEL_RESPONSE", "MIDSCENE_RUN_DIR", "MIDSCENE_RECORD_MODEL_CALL"];
|
|
116
|
+
export declare const BASIC_ENV_KEYS: readonly ["MIDSCENE_DEBUG_MODE", "MIDSCENE_DEBUG_MODEL_PROFILE", "MIDSCENE_DEBUG_MODEL_RESPONSE", "MIDSCENE_RUN_DIR", "MIDSCENE_RECORD_MODEL_CALL", "MIDSCENE_PLANNING_DISABLE_PARTS"];
|
|
115
117
|
export declare const BOOLEAN_ENV_KEYS: readonly ["MIDSCENE_CACHE", "MIDSCENE_LANGSMITH_DEBUG", "MIDSCENE_LANGFUSE_DEBUG", "MIDSCENE_REPORT_QUIET"];
|
|
116
118
|
export declare const NUMBER_ENV_KEYS: readonly ["MIDSCENE_CACHE_MAX_FILENAME_LENGTH", "MIDSCENE_REPLANNING_CYCLE_LIMIT"];
|
|
117
119
|
export declare const STRING_ENV_KEYS: readonly ["MIDSCENE_ADB_PATH", "MIDSCENE_ADB_REMOTE_HOST", "MIDSCENE_ADB_REMOTE_PORT", "MIDSCENE_ANDROID_IME_STRATEGY", "MIDSCENE_ANDROID_SCREENSHOT_STRATEGY", "MIDSCENE_IOS_DEVICE_UDID", "MIDSCENE_IOS_SIMULATOR_UDID", "MIDSCENE_REPORT_TAG_NAME", "MIDSCENE_PREFERRED_LANGUAGE", "MATCH_BY_POSITION", "MIDSCENE_CHROME_PATH", "MIDSCENE_MCP_CHROME_PATH", "DOCKER_CONTAINER"];
|
|
@@ -127,7 +129,7 @@ export declare const GLOBAL_ENV_KEYS: readonly ["MIDSCENE_CACHE", "MIDSCENE_LANG
|
|
|
127
129
|
* Can only be access after agent.constructor
|
|
128
130
|
*/
|
|
129
131
|
export declare const MODEL_ENV_KEYS: readonly ["MIDSCENE_MODEL_NAME", "MIDSCENE_MODEL_INIT_CONFIG_JSON", "MIDSCENE_MODEL_EXTRA_BODY_JSON", "MIDSCENE_MODEL_API_KEY", "MIDSCENE_MODEL_BASE_URL", "MIDSCENE_MODEL_SOCKS_PROXY", "MIDSCENE_MODEL_HTTP_PROXY", "MIDSCENE_MODEL_TIMEOUT", "MIDSCENE_MODEL_TEMPERATURE", "MIDSCENE_MODEL_RETRY_COUNT", "MIDSCENE_MODEL_RETRY_INTERVAL", "MIDSCENE_MODEL_REASONING_EFFORT", "MIDSCENE_MODEL_REASONING_ENABLED", "MIDSCENE_MODEL_REASONING_BUDGET", "MIDSCENE_MODEL_RESPONSE_FORMAT", "MIDSCENE_USE_VLM_UI_TARS", "MIDSCENE_USE_QWEN_VL", "MIDSCENE_USE_QWEN3_VL", "MIDSCENE_USE_DOUBAO_VISION", "MIDSCENE_USE_GEMINI", "MIDSCENE_USE_VL_MODEL", "OPENAI_API_KEY", "OPENAI_BASE_URL", "MIDSCENE_OPENAI_INIT_CONFIG_JSON", "MIDSCENE_OPENAI_HTTP_PROXY", "MIDSCENE_OPENAI_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_NAME", "MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_HTTP_PROXY", "MIDSCENE_INSIGHT_MODEL_BASE_URL", "MIDSCENE_INSIGHT_MODEL_API_KEY", "MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON", "MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON", "MIDSCENE_INSIGHT_MODEL_TIMEOUT", "MIDSCENE_INSIGHT_MODEL_TEMPERATURE", "MIDSCENE_INSIGHT_MODEL_RETRY_COUNT", "MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL", "MIDSCENE_INSIGHT_MODEL_FAMILY", "MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT", "MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED", "MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET", "MIDSCENE_INSIGHT_MODEL_RESPONSE_FORMAT", "MIDSCENE_PLANNING_MODEL_NAME", "MIDSCENE_PLANNING_MODEL_SOCKS_PROXY", "MIDSCENE_PLANNING_MODEL_HTTP_PROXY", "MIDSCENE_PLANNING_MODEL_BASE_URL", "MIDSCENE_PLANNING_MODEL_API_KEY", "MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON", "MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON", "MIDSCENE_PLANNING_MODEL_TIMEOUT", "MIDSCENE_PLANNING_MODEL_TEMPERATURE", "MIDSCENE_PLANNING_MODEL_RETRY_COUNT", "MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL", "MIDSCENE_PLANNING_MODEL_FAMILY", "MIDSCENE_PLANNING_MODEL_REASONING_EFFORT", "MIDSCENE_PLANNING_MODEL_REASONING_ENABLED", "MIDSCENE_PLANNING_MODEL_REASONING_BUDGET", "MIDSCENE_PLANNING_MODEL_RESPONSE_FORMAT", "MIDSCENE_MODEL_FAMILY"];
|
|
130
|
-
export declare const ALL_ENV_KEYS: readonly [...string[], "MIDSCENE_DEBUG_MODE", "MIDSCENE_DEBUG_MODEL_PROFILE", "MIDSCENE_DEBUG_MODEL_RESPONSE", "MIDSCENE_RUN_DIR", "MIDSCENE_RECORD_MODEL_CALL", "MIDSCENE_CACHE", "MIDSCENE_LANGSMITH_DEBUG", "MIDSCENE_LANGFUSE_DEBUG", "MIDSCENE_REPORT_QUIET", "MIDSCENE_CACHE_MAX_FILENAME_LENGTH", "MIDSCENE_REPLANNING_CYCLE_LIMIT", "MIDSCENE_ADB_PATH", "MIDSCENE_ADB_REMOTE_HOST", "MIDSCENE_ADB_REMOTE_PORT", "MIDSCENE_ANDROID_IME_STRATEGY", "MIDSCENE_ANDROID_SCREENSHOT_STRATEGY", "MIDSCENE_IOS_DEVICE_UDID", "MIDSCENE_IOS_SIMULATOR_UDID", "MIDSCENE_REPORT_TAG_NAME", "MIDSCENE_PREFERRED_LANGUAGE", "MATCH_BY_POSITION", "MIDSCENE_CHROME_PATH", "MIDSCENE_MCP_CHROME_PATH", "DOCKER_CONTAINER", "MIDSCENE_MODEL_NAME", "MIDSCENE_MODEL_INIT_CONFIG_JSON", "MIDSCENE_MODEL_EXTRA_BODY_JSON", "MIDSCENE_MODEL_API_KEY", "MIDSCENE_MODEL_BASE_URL", "MIDSCENE_MODEL_SOCKS_PROXY", "MIDSCENE_MODEL_HTTP_PROXY", "MIDSCENE_MODEL_TIMEOUT", "MIDSCENE_MODEL_TEMPERATURE", "MIDSCENE_MODEL_RETRY_COUNT", "MIDSCENE_MODEL_RETRY_INTERVAL", "MIDSCENE_MODEL_REASONING_EFFORT", "MIDSCENE_MODEL_REASONING_ENABLED", "MIDSCENE_MODEL_REASONING_BUDGET", "MIDSCENE_MODEL_RESPONSE_FORMAT", "MIDSCENE_USE_VLM_UI_TARS", "MIDSCENE_USE_QWEN_VL", "MIDSCENE_USE_QWEN3_VL", "MIDSCENE_USE_DOUBAO_VISION", "MIDSCENE_USE_GEMINI", "MIDSCENE_USE_VL_MODEL", "OPENAI_API_KEY", "OPENAI_BASE_URL", "MIDSCENE_OPENAI_INIT_CONFIG_JSON", "MIDSCENE_OPENAI_HTTP_PROXY", "MIDSCENE_OPENAI_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_NAME", "MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_HTTP_PROXY", "MIDSCENE_INSIGHT_MODEL_BASE_URL", "MIDSCENE_INSIGHT_MODEL_API_KEY", "MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON", "MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON", "MIDSCENE_INSIGHT_MODEL_TIMEOUT", "MIDSCENE_INSIGHT_MODEL_TEMPERATURE", "MIDSCENE_INSIGHT_MODEL_RETRY_COUNT", "MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL", "MIDSCENE_INSIGHT_MODEL_FAMILY", "MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT", "MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED", "MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET", "MIDSCENE_INSIGHT_MODEL_RESPONSE_FORMAT", "MIDSCENE_PLANNING_MODEL_NAME", "MIDSCENE_PLANNING_MODEL_SOCKS_PROXY", "MIDSCENE_PLANNING_MODEL_HTTP_PROXY", "MIDSCENE_PLANNING_MODEL_BASE_URL", "MIDSCENE_PLANNING_MODEL_API_KEY", "MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON", "MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON", "MIDSCENE_PLANNING_MODEL_TIMEOUT", "MIDSCENE_PLANNING_MODEL_TEMPERATURE", "MIDSCENE_PLANNING_MODEL_RETRY_COUNT", "MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL", "MIDSCENE_PLANNING_MODEL_FAMILY", "MIDSCENE_PLANNING_MODEL_REASONING_EFFORT", "MIDSCENE_PLANNING_MODEL_REASONING_ENABLED", "MIDSCENE_PLANNING_MODEL_REASONING_BUDGET", "MIDSCENE_PLANNING_MODEL_RESPONSE_FORMAT", "MIDSCENE_MODEL_FAMILY"];
|
|
132
|
+
export declare const ALL_ENV_KEYS: readonly [...string[], "MIDSCENE_DEBUG_MODE", "MIDSCENE_DEBUG_MODEL_PROFILE", "MIDSCENE_DEBUG_MODEL_RESPONSE", "MIDSCENE_RUN_DIR", "MIDSCENE_RECORD_MODEL_CALL", "MIDSCENE_PLANNING_DISABLE_PARTS", "MIDSCENE_CACHE", "MIDSCENE_LANGSMITH_DEBUG", "MIDSCENE_LANGFUSE_DEBUG", "MIDSCENE_REPORT_QUIET", "MIDSCENE_CACHE_MAX_FILENAME_LENGTH", "MIDSCENE_REPLANNING_CYCLE_LIMIT", "MIDSCENE_ADB_PATH", "MIDSCENE_ADB_REMOTE_HOST", "MIDSCENE_ADB_REMOTE_PORT", "MIDSCENE_ANDROID_IME_STRATEGY", "MIDSCENE_ANDROID_SCREENSHOT_STRATEGY", "MIDSCENE_IOS_DEVICE_UDID", "MIDSCENE_IOS_SIMULATOR_UDID", "MIDSCENE_REPORT_TAG_NAME", "MIDSCENE_PREFERRED_LANGUAGE", "MATCH_BY_POSITION", "MIDSCENE_CHROME_PATH", "MIDSCENE_MCP_CHROME_PATH", "DOCKER_CONTAINER", "MIDSCENE_MODEL_NAME", "MIDSCENE_MODEL_INIT_CONFIG_JSON", "MIDSCENE_MODEL_EXTRA_BODY_JSON", "MIDSCENE_MODEL_API_KEY", "MIDSCENE_MODEL_BASE_URL", "MIDSCENE_MODEL_SOCKS_PROXY", "MIDSCENE_MODEL_HTTP_PROXY", "MIDSCENE_MODEL_TIMEOUT", "MIDSCENE_MODEL_TEMPERATURE", "MIDSCENE_MODEL_RETRY_COUNT", "MIDSCENE_MODEL_RETRY_INTERVAL", "MIDSCENE_MODEL_REASONING_EFFORT", "MIDSCENE_MODEL_REASONING_ENABLED", "MIDSCENE_MODEL_REASONING_BUDGET", "MIDSCENE_MODEL_RESPONSE_FORMAT", "MIDSCENE_USE_VLM_UI_TARS", "MIDSCENE_USE_QWEN_VL", "MIDSCENE_USE_QWEN3_VL", "MIDSCENE_USE_DOUBAO_VISION", "MIDSCENE_USE_GEMINI", "MIDSCENE_USE_VL_MODEL", "OPENAI_API_KEY", "OPENAI_BASE_URL", "MIDSCENE_OPENAI_INIT_CONFIG_JSON", "MIDSCENE_OPENAI_HTTP_PROXY", "MIDSCENE_OPENAI_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_NAME", "MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_HTTP_PROXY", "MIDSCENE_INSIGHT_MODEL_BASE_URL", "MIDSCENE_INSIGHT_MODEL_API_KEY", "MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON", "MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON", "MIDSCENE_INSIGHT_MODEL_TIMEOUT", "MIDSCENE_INSIGHT_MODEL_TEMPERATURE", "MIDSCENE_INSIGHT_MODEL_RETRY_COUNT", "MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL", "MIDSCENE_INSIGHT_MODEL_FAMILY", "MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT", "MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED", "MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET", "MIDSCENE_INSIGHT_MODEL_RESPONSE_FORMAT", "MIDSCENE_PLANNING_MODEL_NAME", "MIDSCENE_PLANNING_MODEL_SOCKS_PROXY", "MIDSCENE_PLANNING_MODEL_HTTP_PROXY", "MIDSCENE_PLANNING_MODEL_BASE_URL", "MIDSCENE_PLANNING_MODEL_API_KEY", "MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON", "MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON", "MIDSCENE_PLANNING_MODEL_TIMEOUT", "MIDSCENE_PLANNING_MODEL_TEMPERATURE", "MIDSCENE_PLANNING_MODEL_RETRY_COUNT", "MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL", "MIDSCENE_PLANNING_MODEL_FAMILY", "MIDSCENE_PLANNING_MODEL_REASONING_EFFORT", "MIDSCENE_PLANNING_MODEL_REASONING_ENABLED", "MIDSCENE_PLANNING_MODEL_REASONING_BUDGET", "MIDSCENE_PLANNING_MODEL_RESPONSE_FORMAT", "MIDSCENE_MODEL_FAMILY"];
|
|
131
133
|
export type TEnvKeys = (typeof ALL_ENV_KEYS)[number];
|
|
132
134
|
export type TGlobalConfig = Record<TEnvKeys, string | undefined>;
|
|
133
135
|
/**
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@ export interface ToolDefaults {
|
|
|
22
22
|
locate?: Record<string, unknown>;
|
|
23
23
|
/**
|
|
24
24
|
* Merged into the `aiAction` options used by the `act` tool.
|
|
25
|
-
* e.g. `{ deepLocate: true
|
|
25
|
+
* e.g. `{ deepLocate: true }`.
|
|
26
26
|
*/
|
|
27
27
|
act?: Record<string, unknown>;
|
|
28
28
|
}
|
|
@@ -47,12 +47,6 @@ export const TOOL_BEHAVIOR_FLAGS: readonly ToolBehaviorFlag[] = [
|
|
|
47
47
|
'Force deep locate for every locating operation (better precision for small/ambiguous targets, a bit slower).',
|
|
48
48
|
defaults: { locate: { deepLocate: true }, act: { deepLocate: true } },
|
|
49
49
|
},
|
|
50
|
-
{
|
|
51
|
-
cli: 'deep-think',
|
|
52
|
-
description:
|
|
53
|
-
'Plan the act tool with deep thinking (richer context and sub-goal decomposition, a bit slower).',
|
|
54
|
-
defaults: { act: { deepThink: true } },
|
|
55
|
-
},
|
|
56
50
|
];
|
|
57
51
|
|
|
58
52
|
/** Merge two {@link ToolDefaults}, with `b` taking precedence over `a`. */
|
|
@@ -711,12 +711,6 @@ export function generateCommonTools(
|
|
|
711
711
|
.describe(
|
|
712
712
|
'Use deep locate for every element this action targets. Improves precision for small or ambiguous targets at the cost of speed. Defaults to the server --deep-locate setting.',
|
|
713
713
|
),
|
|
714
|
-
deepThink: z
|
|
715
|
-
.boolean()
|
|
716
|
-
.optional()
|
|
717
|
-
.describe(
|
|
718
|
-
'Plan this action with deep thinking (richer context and sub-goal decomposition). Helps with complex multi-step instructions at the cost of speed. Defaults to the server --deep-think setting.',
|
|
719
|
-
),
|
|
720
714
|
fileChooserAllowedDir: z
|
|
721
715
|
.string()
|
|
722
716
|
.optional()
|
|
@@ -732,6 +726,11 @@ export function generateCommonTools(
|
|
|
732
726
|
): Promise<ToolResult> => {
|
|
733
727
|
const prompt = args.prompt as string;
|
|
734
728
|
try {
|
|
729
|
+
if ('deepThink' in args || 'deep-think' in args || 'effort' in args) {
|
|
730
|
+
throw new Error(
|
|
731
|
+
'deepThink and effort have been removed. Configure Planning components with MIDSCENE_PLANNING_DISABLE_PARTS instead.',
|
|
732
|
+
);
|
|
733
|
+
}
|
|
735
734
|
const agent = await getAgent(args);
|
|
736
735
|
emitCliVerboseEvent({
|
|
737
736
|
event: 'agent_ready',
|
|
@@ -744,18 +743,13 @@ export function generateCommonTools(
|
|
|
744
743
|
toolName: 'act',
|
|
745
744
|
});
|
|
746
745
|
try {
|
|
747
|
-
//
|
|
748
|
-
// tool defaults, then let explicit per-call args win.
|
|
746
|
+
// Per-call options override server tool defaults.
|
|
749
747
|
const actOptions: Record<string, unknown> = {
|
|
750
|
-
deepThink: false,
|
|
751
748
|
...toolDefaults.act,
|
|
752
749
|
};
|
|
753
750
|
if (args.deepLocate !== undefined) {
|
|
754
751
|
actOptions.deepLocate = args.deepLocate;
|
|
755
752
|
}
|
|
756
|
-
if (args.deepThink !== undefined) {
|
|
757
|
-
actOptions.deepThink = args.deepThink;
|
|
758
|
-
}
|
|
759
753
|
if (args.fileChooserAllowedDir !== undefined) {
|
|
760
754
|
actOptions.fileChooserAllowedDir = args.fileChooserAllowedDir;
|
|
761
755
|
}
|
package/src/cli/cli-runner.ts
CHANGED
|
@@ -207,7 +207,13 @@ export async function runToolsCLI(
|
|
|
207
207
|
format: verboseFormat,
|
|
208
208
|
} = stripVerboseFlag(inputArgs);
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
if (inputArgs.some((arg) => /^--deep-?think(?:=|$)/i.test(arg))) {
|
|
211
|
+
throw new CLIError(
|
|
212
|
+
'--deep-think has been removed. Configure Planning components with MIDSCENE_PLANNING_DISABLE_PARTS instead.',
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Global behavior flags (e.g. `--deep-locate`) apply
|
|
211
217
|
// regardless of which command runs. `stripBehaviorFlags` is the single place
|
|
212
218
|
// that knows how they look on the command line: it resolves their defaults
|
|
213
219
|
// and returns the remaining args so the per-command parser never sees them.
|
|
@@ -5,7 +5,7 @@ export const PLAYWRIGHT_EXAMPLE_CODE = `
|
|
|
5
5
|
IMPORTANT: Follow these exact type signatures for AI functions:
|
|
6
6
|
|
|
7
7
|
// Type signatures for AI functions:
|
|
8
|
-
aiAct(prompt: string, options?: { cacheable?: boolean
|
|
8
|
+
aiAct(prompt: string, options?: { cacheable?: boolean }): Promise<string | undefined>
|
|
9
9
|
aiInput(text: string, locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>
|
|
10
10
|
aiTap(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>
|
|
11
11
|
aiHover(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>
|
package/src/env/types.ts
CHANGED
|
@@ -94,6 +94,9 @@ export const MIDSCENE_REPLANNING_CYCLE_LIMIT =
|
|
|
94
94
|
|
|
95
95
|
export const MIDSCENE_RUN_DIR = 'MIDSCENE_RUN_DIR';
|
|
96
96
|
export const MIDSCENE_RECORD_MODEL_CALL = 'MIDSCENE_RECORD_MODEL_CALL';
|
|
97
|
+
/** Comma-separated standard Planning components to disable for ablation. */
|
|
98
|
+
export const MIDSCENE_PLANNING_DISABLE_PARTS =
|
|
99
|
+
'MIDSCENE_PLANNING_DISABLE_PARTS';
|
|
97
100
|
|
|
98
101
|
// INSIGHT (unified VQA and Grounding)
|
|
99
102
|
export const MIDSCENE_INSIGHT_MODEL_NAME = 'MIDSCENE_INSIGHT_MODEL_NAME';
|
|
@@ -173,6 +176,7 @@ export const BASIC_ENV_KEYS = [
|
|
|
173
176
|
MIDSCENE_DEBUG_MODEL_RESPONSE,
|
|
174
177
|
MIDSCENE_RUN_DIR,
|
|
175
178
|
MIDSCENE_RECORD_MODEL_CALL,
|
|
179
|
+
MIDSCENE_PLANNING_DISABLE_PARTS,
|
|
176
180
|
] as const;
|
|
177
181
|
|
|
178
182
|
export const BOOLEAN_ENV_KEYS = [
|