@midscene/shared 0.30.10 → 1.0.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/build/rspack-config.mjs +4 -0
- package/dist/es/constants/example-code.mjs +4 -4
- package/dist/es/env/constants.mjs +27 -82
- package/dist/es/env/global-config-manager.mjs +2 -3
- package/dist/es/env/helper.mjs +12 -17
- package/dist/es/env/init-debug.mjs +6 -6
- package/dist/es/env/model-config-manager.mjs +45 -65
- package/dist/es/env/parse-model-config.mjs +112 -0
- package/dist/es/env/types.mjs +70 -162
- package/dist/es/extractor/dom-util.mjs +10 -18
- package/dist/es/extractor/index.mjs +2 -3
- package/dist/es/extractor/locator.mjs +8 -15
- package/dist/es/extractor/tree.mjs +2 -5
- package/dist/es/extractor/util.mjs +4 -28
- package/dist/es/extractor/web-extractor.mjs +7 -14
- package/dist/es/index.mjs +2 -1
- package/dist/es/mcp/base-server.mjs +250 -0
- package/dist/es/mcp/base-tools.mjs +84 -0
- package/dist/es/mcp/index.mjs +5 -0
- package/dist/es/mcp/inject-report-html-plugin.mjs +53 -0
- package/dist/es/mcp/tool-generator.mjs +207 -0
- package/dist/es/mcp/types.mjs +3 -0
- package/dist/es/node/fs.mjs +2 -2
- package/dist/es/utils.mjs +2 -3
- package/dist/es/zod-schema-utils.mjs +54 -0
- package/dist/lib/baseDB.js +2 -2
- package/dist/lib/build/copy-static.js +4 -4
- package/dist/lib/build/rspack-config.js +38 -0
- package/dist/lib/common.js +4 -4
- package/dist/lib/constants/example-code.js +6 -6
- package/dist/lib/constants/index.js +13 -13
- package/dist/lib/env/basic.js +2 -2
- package/dist/lib/env/constants.js +32 -90
- package/dist/lib/env/global-config-manager.js +4 -5
- package/dist/lib/env/helper.js +13 -22
- package/dist/lib/env/index.js +24 -28
- package/dist/lib/env/init-debug.js +7 -7
- package/dist/lib/env/model-config-manager.js +47 -67
- package/dist/lib/env/parse-model-config.js +155 -0
- package/dist/lib/env/types.js +146 -379
- package/dist/lib/env/utils.js +4 -4
- package/dist/lib/extractor/constants.js +4 -4
- package/dist/lib/extractor/debug.js +1 -1
- package/dist/lib/extractor/dom-util.js +18 -26
- package/dist/lib/extractor/index.js +11 -21
- package/dist/lib/extractor/locator.js +10 -20
- package/dist/lib/extractor/tree.js +4 -7
- package/dist/lib/extractor/util.js +17 -50
- package/dist/lib/extractor/web-extractor.js +12 -19
- package/dist/lib/img/box-select.js +4 -4
- package/dist/lib/img/draw-box.js +2 -2
- package/dist/lib/img/get-jimp.js +16 -34
- package/dist/lib/img/get-photon.js +24 -47
- package/dist/lib/img/get-sharp.js +16 -34
- package/dist/lib/img/index.js +18 -18
- package/dist/lib/img/info.js +4 -4
- package/dist/lib/img/transform.js +10 -10
- package/dist/lib/index.js +8 -4
- package/dist/lib/logger.js +4 -4
- package/dist/lib/mcp/base-server.js +300 -0
- package/dist/lib/mcp/base-tools.js +118 -0
- package/dist/lib/mcp/index.js +86 -0
- package/dist/lib/mcp/inject-report-html-plugin.js +98 -0
- package/dist/lib/mcp/tool-generator.js +244 -0
- package/dist/lib/mcp/types.js +40 -0
- package/dist/lib/node/fs.js +6 -6
- package/dist/lib/node/index.js +6 -8
- package/dist/lib/polyfills/async-hooks.js +2 -2
- package/dist/lib/polyfills/index.js +6 -8
- package/dist/lib/types/index.js +2 -2
- package/dist/lib/us-keyboard-layout.js +2 -2
- package/dist/lib/utils.js +13 -14
- package/dist/lib/zod-schema-utils.js +97 -0
- package/dist/types/build/rspack-config.d.ts +8 -0
- package/dist/types/constants/example-code.d.ts +1 -1
- package/dist/types/env/constants.d.ts +5 -18
- package/dist/types/env/global-config-manager.d.ts +1 -2
- package/dist/types/env/helper.d.ts +2 -4
- package/dist/types/env/model-config-manager.d.ts +8 -7
- package/dist/types/env/parse-model-config.d.ts +28 -0
- package/dist/types/env/types.d.ts +152 -191
- package/dist/types/extractor/dom-util.d.ts +2 -15
- package/dist/types/extractor/index.d.ts +1 -2
- package/dist/types/extractor/locator.d.ts +0 -1
- package/dist/types/extractor/tree.d.ts +1 -4
- package/dist/types/extractor/util.d.ts +0 -3
- package/dist/types/index.d.ts +1 -0
- package/dist/types/mcp/base-server.d.ts +77 -0
- package/dist/types/mcp/base-tools.d.ts +55 -0
- package/dist/types/mcp/index.d.ts +5 -0
- package/dist/types/mcp/inject-report-html-plugin.d.ts +18 -0
- package/dist/types/mcp/tool-generator.d.ts +11 -0
- package/dist/types/mcp/types.d.ts +100 -0
- package/dist/types/types/index.d.ts +5 -2
- package/dist/types/zod-schema-utils.d.ts +23 -0
- package/package.json +19 -4
- package/src/build/rspack-config.ts +12 -0
- package/src/constants/example-code.ts +4 -4
- package/src/env/constants.ts +58 -203
- package/src/env/global-config-manager.ts +7 -7
- package/src/env/helper.ts +10 -31
- package/src/env/init-debug.ts +11 -6
- package/src/env/model-config-manager.ts +91 -87
- package/src/env/parse-model-config.ts +265 -0
- package/src/env/types.ts +212 -344
- package/src/extractor/dom-util.ts +15 -12
- package/src/extractor/index.ts +0 -3
- package/src/extractor/locator.ts +3 -12
- package/src/extractor/tree.ts +4 -4
- package/src/extractor/util.ts +0 -32
- package/src/index.ts +2 -0
- package/src/mcp/base-server.ts +435 -0
- package/src/mcp/base-tools.ts +196 -0
- package/src/mcp/index.ts +5 -0
- package/src/mcp/inject-report-html-plugin.ts +119 -0
- package/src/mcp/tool-generator.ts +330 -0
- package/src/mcp/types.ts +108 -0
- package/src/node/fs.ts +1 -1
- package/src/types/index.ts +8 -2
- package/src/utils.ts +1 -1
- package/src/zod-schema-utils.ts +133 -0
- package/dist/es/env/decide-model-config.mjs +0 -172
- package/dist/es/env/parse.mjs +0 -69
- package/dist/lib/env/decide-model-config.js +0 -212
- package/dist/lib/env/parse.js +0 -106
- package/dist/types/env/decide-model-config.d.ts +0 -14
- package/dist/types/env/parse.d.ts +0 -12
- package/src/env/decide-model-config.ts +0 -319
- package/src/env/parse.ts +0 -131
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const MIDSCENE_MODEL_INIT_CONFIG_JSON = "MIDSCENE_MODEL_INIT_CONFIG_JSON";
|
|
2
2
|
export declare const MIDSCENE_MODEL_NAME = "MIDSCENE_MODEL_NAME";
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const MIDSCENE_DEBUG_AI_RESPONSE = "MIDSCENE_DEBUG_AI_RESPONSE";
|
|
3
|
+
export declare const MIDSCENE_DEBUG_MODEL_PROFILE = "MIDSCENE_DEBUG_MODEL_PROFILE";
|
|
4
|
+
export declare const MIDSCENE_DEBUG_MODEL_RESPONSE = "MIDSCENE_DEBUG_MODEL_RESPONSE";
|
|
6
5
|
export declare const MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG = "MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG";
|
|
7
6
|
export declare const MIDSCENE_DEBUG_MODE = "MIDSCENE_DEBUG_MODE";
|
|
8
7
|
export declare const MIDSCENE_MCP_USE_PUPPETEER_MODE = "MIDSCENE_MCP_USE_PUPPETEER_MODE";
|
|
@@ -10,10 +9,37 @@ export declare const MIDSCENE_MCP_CHROME_PATH = "MIDSCENE_MCP_CHROME_PATH";
|
|
|
10
9
|
export declare const MIDSCENE_MCP_ANDROID_MODE = "MIDSCENE_MCP_ANDROID_MODE";
|
|
11
10
|
export declare const DOCKER_CONTAINER = "DOCKER_CONTAINER";
|
|
12
11
|
export declare const MIDSCENE_FORCE_DEEP_THINK = "MIDSCENE_FORCE_DEEP_THINK";
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
12
|
+
export declare const MIDSCENE_LANGSMITH_DEBUG = "MIDSCENE_LANGSMITH_DEBUG";
|
|
13
|
+
export declare const MIDSCENE_LANGFUSE_DEBUG = "MIDSCENE_LANGFUSE_DEBUG";
|
|
14
|
+
export declare const MIDSCENE_MODEL_SOCKS_PROXY = "MIDSCENE_MODEL_SOCKS_PROXY";
|
|
15
|
+
export declare const MIDSCENE_MODEL_HTTP_PROXY = "MIDSCENE_MODEL_HTTP_PROXY";
|
|
16
|
+
export declare const MIDSCENE_MODEL_API_KEY = "MIDSCENE_MODEL_API_KEY";
|
|
17
|
+
export declare const MIDSCENE_MODEL_BASE_URL = "MIDSCENE_MODEL_BASE_URL";
|
|
18
|
+
export declare const MIDSCENE_MODEL_MAX_TOKENS = "MIDSCENE_MODEL_MAX_TOKENS";
|
|
19
|
+
export declare const MIDSCENE_MODEL_TIMEOUT = "MIDSCENE_MODEL_TIMEOUT";
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use MIDSCENE_MODEL_API_KEY instead. This is kept for backward compatibility.
|
|
22
|
+
*/
|
|
15
23
|
export declare const OPENAI_API_KEY = "OPENAI_API_KEY";
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Use MIDSCENE_MODEL_BASE_URL instead. This is kept for backward compatibility.
|
|
26
|
+
*/
|
|
16
27
|
export declare const OPENAI_BASE_URL = "OPENAI_BASE_URL";
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use MIDSCENE_MODEL_INIT_CONFIG_JSON instead. This is kept for backward compatibility.
|
|
30
|
+
*/
|
|
31
|
+
export declare const MIDSCENE_OPENAI_INIT_CONFIG_JSON = "MIDSCENE_OPENAI_INIT_CONFIG_JSON";
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use MIDSCENE_MODEL_HTTP_PROXY instead. This is kept for backward compatibility.
|
|
34
|
+
*/
|
|
35
|
+
export declare const MIDSCENE_OPENAI_HTTP_PROXY = "MIDSCENE_OPENAI_HTTP_PROXY";
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Use MIDSCENE_MODEL_SOCKS_PROXY instead. This is kept for backward compatibility.
|
|
38
|
+
*/
|
|
39
|
+
export declare const MIDSCENE_OPENAI_SOCKS_PROXY = "MIDSCENE_OPENAI_SOCKS_PROXY";
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Use MIDSCENE_MODEL_MAX_TOKENS instead. This is kept for backward compatibility.
|
|
42
|
+
*/
|
|
17
43
|
export declare const OPENAI_MAX_TOKENS = "OPENAI_MAX_TOKENS";
|
|
18
44
|
export declare const MIDSCENE_ADB_PATH = "MIDSCENE_ADB_PATH";
|
|
19
45
|
export declare const MIDSCENE_ADB_REMOTE_HOST = "MIDSCENE_ADB_REMOTE_HOST";
|
|
@@ -29,82 +55,26 @@ export declare const MIDSCENE_USE_DOUBAO_VISION = "MIDSCENE_USE_DOUBAO_VISION";
|
|
|
29
55
|
export declare const MIDSCENE_USE_GEMINI = "MIDSCENE_USE_GEMINI";
|
|
30
56
|
export declare const MIDSCENE_USE_VL_MODEL = "MIDSCENE_USE_VL_MODEL";
|
|
31
57
|
export declare const MATCH_BY_POSITION = "MATCH_BY_POSITION";
|
|
32
|
-
export declare const MIDSCENE_API_TYPE = "MIDSCENE-API-TYPE";
|
|
33
58
|
export declare const MIDSCENE_REPORT_TAG_NAME = "MIDSCENE_REPORT_TAG_NAME";
|
|
34
|
-
export declare const MIDSCENE_REPLANNING_CYCLE_LIMIT = "MIDSCENE_REPLANNING_CYCLE_LIMIT";
|
|
35
59
|
export declare const MIDSCENE_PREFERRED_LANGUAGE = "MIDSCENE_PREFERRED_LANGUAGE";
|
|
36
|
-
export declare const MIDSCENE_USE_AZURE_OPENAI = "MIDSCENE_USE_AZURE_OPENAI";
|
|
37
|
-
export declare const MIDSCENE_AZURE_OPENAI_SCOPE = "MIDSCENE_AZURE_OPENAI_SCOPE";
|
|
38
|
-
export declare const MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON = "MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON";
|
|
39
60
|
export declare const MIDSCENE_CACHE_MAX_FILENAME_LENGTH = "MIDSCENE_CACHE_MAX_FILENAME_LENGTH";
|
|
40
|
-
export declare const
|
|
41
|
-
export declare const AZURE_OPENAI_KEY = "AZURE_OPENAI_KEY";
|
|
42
|
-
export declare const AZURE_OPENAI_API_VERSION = "AZURE_OPENAI_API_VERSION";
|
|
43
|
-
export declare const AZURE_OPENAI_DEPLOYMENT = "AZURE_OPENAI_DEPLOYMENT";
|
|
44
|
-
export declare const MIDSCENE_USE_ANTHROPIC_SDK = "MIDSCENE_USE_ANTHROPIC_SDK";
|
|
45
|
-
export declare const ANTHROPIC_API_KEY = "ANTHROPIC_API_KEY";
|
|
61
|
+
export declare const MIDSCENE_REPLANNING_CYCLE_LIMIT = "MIDSCENE_REPLANNING_CYCLE_LIMIT";
|
|
46
62
|
export declare const MIDSCENE_RUN_DIR = "MIDSCENE_RUN_DIR";
|
|
47
|
-
export declare const
|
|
48
|
-
export declare const
|
|
49
|
-
export declare const
|
|
50
|
-
export declare const
|
|
51
|
-
export declare const
|
|
52
|
-
export declare const
|
|
53
|
-
export declare const
|
|
54
|
-
export declare const MIDSCENE_ANTHROPIC_API_KEY = "MIDSCENE_ANTHROPIC_API_KEY";
|
|
55
|
-
export declare const MIDSCENE_VL_MODE = "MIDSCENE_VL_MODE";
|
|
56
|
-
export declare const MIDSCENE_VQA_MODEL_NAME = "MIDSCENE_VQA_MODEL_NAME";
|
|
57
|
-
export declare const MIDSCENE_VQA_OPENAI_SOCKS_PROXY = "MIDSCENE_VQA_OPENAI_SOCKS_PROXY";
|
|
58
|
-
export declare const MIDSCENE_VQA_OPENAI_HTTP_PROXY = "MIDSCENE_VQA_OPENAI_HTTP_PROXY";
|
|
59
|
-
export declare const MIDSCENE_VQA_OPENAI_BASE_URL = "MIDSCENE_VQA_OPENAI_BASE_URL";
|
|
60
|
-
export declare const MIDSCENE_VQA_OPENAI_API_KEY = "MIDSCENE_VQA_OPENAI_API_KEY";
|
|
61
|
-
export declare const MIDSCENE_VQA_OPENAI_INIT_CONFIG_JSON = "MIDSCENE_VQA_OPENAI_INIT_CONFIG_JSON";
|
|
62
|
-
export declare const MIDSCENE_VQA_OPENAI_USE_AZURE = "MIDSCENE_VQA_OPENAI_USE_AZURE";
|
|
63
|
-
export declare const MIDSCENE_VQA_USE_AZURE_OPENAI = "MIDSCENE_VQA_USE_AZURE_OPENAI";
|
|
64
|
-
export declare const MIDSCENE_VQA_AZURE_OPENAI_SCOPE = "MIDSCENE_VQA_AZURE_OPENAI_SCOPE";
|
|
65
|
-
export declare const MIDSCENE_VQA_AZURE_OPENAI_KEY = "MIDSCENE_VQA_AZURE_OPENAI_KEY";
|
|
66
|
-
export declare const MIDSCENE_VQA_AZURE_OPENAI_ENDPOINT = "MIDSCENE_VQA_AZURE_OPENAI_ENDPOINT";
|
|
67
|
-
export declare const MIDSCENE_VQA_AZURE_OPENAI_API_VERSION = "MIDSCENE_VQA_AZURE_OPENAI_API_VERSION";
|
|
68
|
-
export declare const MIDSCENE_VQA_AZURE_OPENAI_DEPLOYMENT = "MIDSCENE_VQA_AZURE_OPENAI_DEPLOYMENT";
|
|
69
|
-
export declare const MIDSCENE_VQA_AZURE_OPENAI_INIT_CONFIG_JSON = "MIDSCENE_VQA_AZURE_OPENAI_INIT_CONFIG_JSON";
|
|
70
|
-
export declare const MIDSCENE_VQA_USE_ANTHROPIC_SDK = "MIDSCENE_VQA_USE_ANTHROPIC_SDK";
|
|
71
|
-
export declare const MIDSCENE_VQA_ANTHROPIC_API_KEY = "MIDSCENE_VQA_ANTHROPIC_API_KEY";
|
|
72
|
-
export declare const MIDSCENE_VQA_VL_MODE = "MIDSCENE_VQA_VL_MODE";
|
|
63
|
+
export declare const MIDSCENE_INSIGHT_MODEL_NAME = "MIDSCENE_INSIGHT_MODEL_NAME";
|
|
64
|
+
export declare const MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY = "MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY";
|
|
65
|
+
export declare const MIDSCENE_INSIGHT_MODEL_HTTP_PROXY = "MIDSCENE_INSIGHT_MODEL_HTTP_PROXY";
|
|
66
|
+
export declare const MIDSCENE_INSIGHT_MODEL_BASE_URL = "MIDSCENE_INSIGHT_MODEL_BASE_URL";
|
|
67
|
+
export declare const MIDSCENE_INSIGHT_MODEL_API_KEY = "MIDSCENE_INSIGHT_MODEL_API_KEY";
|
|
68
|
+
export declare const MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON = "MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON";
|
|
69
|
+
export declare const MIDSCENE_INSIGHT_MODEL_TIMEOUT = "MIDSCENE_INSIGHT_MODEL_TIMEOUT";
|
|
73
70
|
export declare const MIDSCENE_PLANNING_MODEL_NAME = "MIDSCENE_PLANNING_MODEL_NAME";
|
|
74
|
-
export declare const
|
|
75
|
-
export declare const
|
|
76
|
-
export declare const
|
|
77
|
-
export declare const
|
|
78
|
-
export declare const
|
|
79
|
-
export declare const
|
|
80
|
-
export declare const
|
|
81
|
-
export declare const MIDSCENE_PLANNING_AZURE_OPENAI_SCOPE = "MIDSCENE_PLANNING_AZURE_OPENAI_SCOPE";
|
|
82
|
-
export declare const MIDSCENE_PLANNING_AZURE_OPENAI_KEY = "MIDSCENE_PLANNING_AZURE_OPENAI_KEY";
|
|
83
|
-
export declare const MIDSCENE_PLANNING_AZURE_OPENAI_ENDPOINT = "MIDSCENE_PLANNING_AZURE_OPENAI_ENDPOINT";
|
|
84
|
-
export declare const MIDSCENE_PLANNING_AZURE_OPENAI_API_VERSION = "MIDSCENE_PLANNING_AZURE_OPENAI_API_VERSION";
|
|
85
|
-
export declare const MIDSCENE_PLANNING_AZURE_OPENAI_DEPLOYMENT = "MIDSCENE_PLANNING_AZURE_OPENAI_DEPLOYMENT";
|
|
86
|
-
export declare const MIDSCENE_PLANNING_AZURE_OPENAI_INIT_CONFIG_JSON = "MIDSCENE_PLANNING_AZURE_OPENAI_INIT_CONFIG_JSON";
|
|
87
|
-
export declare const MIDSCENE_PLANNING_USE_ANTHROPIC_SDK = "MIDSCENE_PLANNING_USE_ANTHROPIC_SDK";
|
|
88
|
-
export declare const MIDSCENE_PLANNING_ANTHROPIC_API_KEY = "MIDSCENE_PLANNING_ANTHROPIC_API_KEY";
|
|
89
|
-
export declare const MIDSCENE_PLANNING_VL_MODE = "MIDSCENE_PLANNING_VL_MODE";
|
|
90
|
-
export declare const MIDSCENE_GROUNDING_MODEL_NAME = "MIDSCENE_GROUNDING_MODEL_NAME";
|
|
91
|
-
export declare const MIDSCENE_GROUNDING_OPENAI_SOCKS_PROXY = "MIDSCENE_GROUNDING_OPENAI_SOCKS_PROXY";
|
|
92
|
-
export declare const MIDSCENE_GROUNDING_OPENAI_HTTP_PROXY = "MIDSCENE_GROUNDING_OPENAI_HTTP_PROXY";
|
|
93
|
-
export declare const MIDSCENE_GROUNDING_OPENAI_BASE_URL = "MIDSCENE_GROUNDING_OPENAI_BASE_URL";
|
|
94
|
-
export declare const MIDSCENE_GROUNDING_OPENAI_API_KEY = "MIDSCENE_GROUNDING_OPENAI_API_KEY";
|
|
95
|
-
export declare const MIDSCENE_GROUNDING_OPENAI_INIT_CONFIG_JSON = "MIDSCENE_GROUNDING_OPENAI_INIT_CONFIG_JSON";
|
|
96
|
-
export declare const MIDSCENE_GROUNDING_OPENAI_USE_AZURE = "MIDSCENE_GROUNDING_OPENAI_USE_AZURE";
|
|
97
|
-
export declare const MIDSCENE_GROUNDING_USE_AZURE_OPENAI = "MIDSCENE_GROUNDING_USE_AZURE_OPENAI";
|
|
98
|
-
export declare const MIDSCENE_GROUNDING_AZURE_OPENAI_SCOPE = "MIDSCENE_GROUNDING_AZURE_OPENAI_SCOPE";
|
|
99
|
-
export declare const MIDSCENE_GROUNDING_AZURE_OPENAI_KEY = "MIDSCENE_GROUNDING_AZURE_OPENAI_KEY";
|
|
100
|
-
export declare const MIDSCENE_GROUNDING_AZURE_OPENAI_ENDPOINT = "MIDSCENE_GROUNDING_AZURE_OPENAI_ENDPOINT";
|
|
101
|
-
export declare const MIDSCENE_GROUNDING_AZURE_OPENAI_API_VERSION = "MIDSCENE_GROUNDING_AZURE_OPENAI_API_VERSION";
|
|
102
|
-
export declare const MIDSCENE_GROUNDING_AZURE_OPENAI_DEPLOYMENT = "MIDSCENE_GROUNDING_AZURE_OPENAI_DEPLOYMENT";
|
|
103
|
-
export declare const MIDSCENE_GROUNDING_AZURE_OPENAI_INIT_CONFIG_JSON = "MIDSCENE_GROUNDING_AZURE_OPENAI_INIT_CONFIG_JSON";
|
|
104
|
-
export declare const MIDSCENE_GROUNDING_USE_ANTHROPIC_SDK = "MIDSCENE_GROUNDING_USE_ANTHROPIC_SDK";
|
|
105
|
-
export declare const MIDSCENE_GROUNDING_ANTHROPIC_API_KEY = "MIDSCENE_GROUNDING_ANTHROPIC_API_KEY";
|
|
106
|
-
export declare const MIDSCENE_GROUNDING_VL_MODE = "MIDSCENE_GROUNDING_VL_MODE";
|
|
107
|
-
export declare const OPENAI_USE_AZURE = "OPENAI_USE_AZURE";
|
|
71
|
+
export declare const MIDSCENE_PLANNING_MODEL_SOCKS_PROXY = "MIDSCENE_PLANNING_MODEL_SOCKS_PROXY";
|
|
72
|
+
export declare const MIDSCENE_PLANNING_MODEL_HTTP_PROXY = "MIDSCENE_PLANNING_MODEL_HTTP_PROXY";
|
|
73
|
+
export declare const MIDSCENE_PLANNING_MODEL_BASE_URL = "MIDSCENE_PLANNING_MODEL_BASE_URL";
|
|
74
|
+
export declare const MIDSCENE_PLANNING_MODEL_API_KEY = "MIDSCENE_PLANNING_MODEL_API_KEY";
|
|
75
|
+
export declare const MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON = "MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON";
|
|
76
|
+
export declare const MIDSCENE_PLANNING_MODEL_TIMEOUT = "MIDSCENE_PLANNING_MODEL_TIMEOUT";
|
|
77
|
+
export declare const MIDSCENE_MODEL_FAMILY = "MIDSCENE_MODEL_FAMILY";
|
|
108
78
|
/**
|
|
109
79
|
* env keys declared but unused
|
|
110
80
|
*/
|
|
@@ -113,102 +83,79 @@ export declare const UNUSED_ENV_KEYS: string[];
|
|
|
113
83
|
* env keys for debug or basic run
|
|
114
84
|
* can not be override by overrideAIConfig
|
|
115
85
|
*/
|
|
116
|
-
export declare const BASIC_ENV_KEYS: readonly ["MIDSCENE_DEBUG_MODE", "
|
|
117
|
-
export declare const BOOLEAN_ENV_KEYS: readonly ["MIDSCENE_CACHE", "
|
|
86
|
+
export declare const BASIC_ENV_KEYS: readonly ["MIDSCENE_DEBUG_MODE", "MIDSCENE_DEBUG_MODEL_PROFILE", "MIDSCENE_DEBUG_MODEL_RESPONSE", "MIDSCENE_RUN_DIR"];
|
|
87
|
+
export declare const BOOLEAN_ENV_KEYS: readonly ["MIDSCENE_CACHE", "MIDSCENE_FORCE_DEEP_THINK", "MIDSCENE_MCP_USE_PUPPETEER_MODE", "MIDSCENE_MCP_ANDROID_MODE", "MIDSCENE_LANGSMITH_DEBUG", "MIDSCENE_LANGFUSE_DEBUG"];
|
|
118
88
|
export declare const NUMBER_ENV_KEYS: readonly ["MIDSCENE_CACHE_MAX_FILENAME_LENGTH", "MIDSCENE_REPLANNING_CYCLE_LIMIT"];
|
|
119
|
-
export declare const STRING_ENV_KEYS: readonly ["OPENAI_MAX_TOKENS", "MIDSCENE_ADB_PATH", "MIDSCENE_ADB_REMOTE_HOST", "MIDSCENE_ADB_REMOTE_PORT", "MIDSCENE_ANDROID_IME_STRATEGY", "MIDSCENE_IOS_DEVICE_UDID", "MIDSCENE_IOS_SIMULATOR_UDID", "MIDSCENE_REPORT_TAG_NAME", "MIDSCENE_PREFERRED_LANGUAGE", "MATCH_BY_POSITION", "MIDSCENE_MCP_CHROME_PATH", "DOCKER_CONTAINER"];
|
|
89
|
+
export declare const STRING_ENV_KEYS: readonly ["MIDSCENE_MODEL_MAX_TOKENS", "OPENAI_MAX_TOKENS", "MIDSCENE_ADB_PATH", "MIDSCENE_ADB_REMOTE_HOST", "MIDSCENE_ADB_REMOTE_PORT", "MIDSCENE_ANDROID_IME_STRATEGY", "MIDSCENE_IOS_DEVICE_UDID", "MIDSCENE_IOS_SIMULATOR_UDID", "MIDSCENE_REPORT_TAG_NAME", "MIDSCENE_PREFERRED_LANGUAGE", "MATCH_BY_POSITION", "MIDSCENE_MCP_CHROME_PATH", "DOCKER_CONTAINER"];
|
|
120
90
|
/**
|
|
121
91
|
* Non model related env keys, used for globally controlling the behavior of midscene
|
|
122
92
|
* Can not be override by agent.modelConfig but can be override by overrideAIConfig
|
|
123
93
|
* Can be access at any time
|
|
124
94
|
*/
|
|
125
|
-
export declare const GLOBAL_ENV_KEYS: readonly ["MIDSCENE_CACHE", "
|
|
95
|
+
export declare const GLOBAL_ENV_KEYS: readonly ["MIDSCENE_CACHE", "MIDSCENE_FORCE_DEEP_THINK", "MIDSCENE_MCP_USE_PUPPETEER_MODE", "MIDSCENE_MCP_ANDROID_MODE", "MIDSCENE_LANGSMITH_DEBUG", "MIDSCENE_LANGFUSE_DEBUG", "MIDSCENE_CACHE_MAX_FILENAME_LENGTH", "MIDSCENE_REPLANNING_CYCLE_LIMIT", "MIDSCENE_MODEL_MAX_TOKENS", "OPENAI_MAX_TOKENS", "MIDSCENE_ADB_PATH", "MIDSCENE_ADB_REMOTE_HOST", "MIDSCENE_ADB_REMOTE_PORT", "MIDSCENE_ANDROID_IME_STRATEGY", "MIDSCENE_IOS_DEVICE_UDID", "MIDSCENE_IOS_SIMULATOR_UDID", "MIDSCENE_REPORT_TAG_NAME", "MIDSCENE_PREFERRED_LANGUAGE", "MATCH_BY_POSITION", "MIDSCENE_MCP_CHROME_PATH", "DOCKER_CONTAINER"];
|
|
126
96
|
/**
|
|
127
97
|
* Model related eve keys, used for declare which model to use.
|
|
128
98
|
* Can be override by both agent.modelConfig and overrideAIConfig
|
|
129
99
|
* Can only be access after agent.constructor
|
|
130
100
|
*/
|
|
131
|
-
export declare const MODEL_ENV_KEYS: readonly ["MIDSCENE_MODEL_NAME", "
|
|
132
|
-
export declare const ALL_ENV_KEYS: readonly [...string[], "MIDSCENE_DEBUG_MODE", "
|
|
101
|
+
export declare const MODEL_ENV_KEYS: readonly ["MIDSCENE_MODEL_NAME", "MIDSCENE_MODEL_INIT_CONFIG_JSON", "MIDSCENE_MODEL_API_KEY", "MIDSCENE_MODEL_BASE_URL", "MIDSCENE_MODEL_SOCKS_PROXY", "MIDSCENE_MODEL_HTTP_PROXY", "MIDSCENE_MODEL_TIMEOUT", "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_TIMEOUT", "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_TIMEOUT", "MIDSCENE_MODEL_FAMILY"];
|
|
102
|
+
export declare const ALL_ENV_KEYS: readonly [...string[], "MIDSCENE_DEBUG_MODE", "MIDSCENE_DEBUG_MODEL_PROFILE", "MIDSCENE_DEBUG_MODEL_RESPONSE", "MIDSCENE_RUN_DIR", "MIDSCENE_CACHE", "MIDSCENE_FORCE_DEEP_THINK", "MIDSCENE_MCP_USE_PUPPETEER_MODE", "MIDSCENE_MCP_ANDROID_MODE", "MIDSCENE_LANGSMITH_DEBUG", "MIDSCENE_LANGFUSE_DEBUG", "MIDSCENE_CACHE_MAX_FILENAME_LENGTH", "MIDSCENE_REPLANNING_CYCLE_LIMIT", "MIDSCENE_MODEL_MAX_TOKENS", "OPENAI_MAX_TOKENS", "MIDSCENE_ADB_PATH", "MIDSCENE_ADB_REMOTE_HOST", "MIDSCENE_ADB_REMOTE_PORT", "MIDSCENE_ANDROID_IME_STRATEGY", "MIDSCENE_IOS_DEVICE_UDID", "MIDSCENE_IOS_SIMULATOR_UDID", "MIDSCENE_REPORT_TAG_NAME", "MIDSCENE_PREFERRED_LANGUAGE", "MATCH_BY_POSITION", "MIDSCENE_MCP_CHROME_PATH", "DOCKER_CONTAINER", "MIDSCENE_MODEL_NAME", "MIDSCENE_MODEL_INIT_CONFIG_JSON", "MIDSCENE_MODEL_API_KEY", "MIDSCENE_MODEL_BASE_URL", "MIDSCENE_MODEL_SOCKS_PROXY", "MIDSCENE_MODEL_HTTP_PROXY", "MIDSCENE_MODEL_TIMEOUT", "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_TIMEOUT", "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_TIMEOUT", "MIDSCENE_MODEL_FAMILY"];
|
|
133
103
|
export type TEnvKeys = (typeof ALL_ENV_KEYS)[number];
|
|
134
104
|
export type TGlobalConfig = Record<TEnvKeys, string | undefined>;
|
|
135
|
-
export type TVlModeValues = '
|
|
136
|
-
export type TVlModeTypes = '
|
|
137
|
-
export
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
[
|
|
150
|
-
[
|
|
151
|
-
[
|
|
152
|
-
[
|
|
153
|
-
[
|
|
154
|
-
[
|
|
105
|
+
export type TVlModeValues = 'qwen2.5-vl' | 'qwen3-vl' | 'doubao-vision' | 'gemini' | 'vlm-ui-tars' | 'vlm-ui-tars-doubao' | 'vlm-ui-tars-doubao-1.5';
|
|
106
|
+
export type TVlModeTypes = 'qwen2.5-vl' | 'qwen3-vl' | 'doubao-vision' | 'gemini' | 'vlm-ui-tars';
|
|
107
|
+
export declare const VL_MODE_RAW_VALID_VALUES: TVlModeValues[];
|
|
108
|
+
/**
|
|
109
|
+
* Model family values - unified model configuration approach
|
|
110
|
+
* Replaces the old MIDSCENE_USE_* environment variables
|
|
111
|
+
*
|
|
112
|
+
* Note: These values directly correspond to VL_MODE_RAW_VALID_VALUES
|
|
113
|
+
* - 'qwen2.5-vl' is Qwen 2.5
|
|
114
|
+
* - 'qwen3-vl' is Qwen 3
|
|
115
|
+
*/
|
|
116
|
+
export type TModelFamily = TVlModeValues;
|
|
117
|
+
export declare const MODEL_FAMILY_VALUES: TVlModeValues[];
|
|
118
|
+
export interface IModelConfigForInsight {
|
|
119
|
+
[MIDSCENE_INSIGHT_MODEL_NAME]: string;
|
|
120
|
+
[MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY]?: string;
|
|
121
|
+
[MIDSCENE_INSIGHT_MODEL_HTTP_PROXY]?: string;
|
|
122
|
+
[MIDSCENE_INSIGHT_MODEL_BASE_URL]?: string;
|
|
123
|
+
[MIDSCENE_INSIGHT_MODEL_API_KEY]?: string;
|
|
124
|
+
[MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON]?: string;
|
|
125
|
+
[MIDSCENE_INSIGHT_MODEL_TIMEOUT]?: string;
|
|
155
126
|
}
|
|
156
127
|
export interface IModelConfigForPlanning {
|
|
157
128
|
[MIDSCENE_PLANNING_MODEL_NAME]: string;
|
|
158
|
-
[
|
|
159
|
-
[
|
|
160
|
-
[
|
|
161
|
-
[
|
|
162
|
-
[
|
|
163
|
-
[
|
|
164
|
-
[MIDSCENE_PLANNING_USE_AZURE_OPENAI]?: string;
|
|
165
|
-
[MIDSCENE_PLANNING_AZURE_OPENAI_SCOPE]?: string;
|
|
166
|
-
[MIDSCENE_PLANNING_AZURE_OPENAI_KEY]?: string;
|
|
167
|
-
[MIDSCENE_PLANNING_AZURE_OPENAI_ENDPOINT]?: string;
|
|
168
|
-
[MIDSCENE_PLANNING_AZURE_OPENAI_API_VERSION]?: string;
|
|
169
|
-
[MIDSCENE_PLANNING_AZURE_OPENAI_DEPLOYMENT]?: string;
|
|
170
|
-
[MIDSCENE_PLANNING_AZURE_OPENAI_INIT_CONFIG_JSON]?: string;
|
|
171
|
-
[MIDSCENE_PLANNING_USE_ANTHROPIC_SDK]?: string;
|
|
172
|
-
[MIDSCENE_PLANNING_ANTHROPIC_API_KEY]?: string;
|
|
173
|
-
[MIDSCENE_PLANNING_VL_MODE]?: TVlModeValues;
|
|
174
|
-
}
|
|
175
|
-
export interface IModeConfigForGrounding {
|
|
176
|
-
[MIDSCENE_GROUNDING_MODEL_NAME]: string;
|
|
177
|
-
[MIDSCENE_GROUNDING_OPENAI_SOCKS_PROXY]?: string;
|
|
178
|
-
[MIDSCENE_GROUNDING_OPENAI_HTTP_PROXY]?: string;
|
|
179
|
-
[MIDSCENE_GROUNDING_OPENAI_BASE_URL]?: string;
|
|
180
|
-
[MIDSCENE_GROUNDING_OPENAI_API_KEY]?: string;
|
|
181
|
-
[MIDSCENE_GROUNDING_OPENAI_INIT_CONFIG_JSON]?: string;
|
|
182
|
-
[MIDSCENE_GROUNDING_OPENAI_USE_AZURE]?: string;
|
|
183
|
-
[MIDSCENE_GROUNDING_USE_AZURE_OPENAI]?: string;
|
|
184
|
-
[MIDSCENE_GROUNDING_AZURE_OPENAI_SCOPE]?: string;
|
|
185
|
-
[MIDSCENE_GROUNDING_AZURE_OPENAI_KEY]?: string;
|
|
186
|
-
[MIDSCENE_GROUNDING_AZURE_OPENAI_ENDPOINT]?: string;
|
|
187
|
-
[MIDSCENE_GROUNDING_AZURE_OPENAI_API_VERSION]?: string;
|
|
188
|
-
[MIDSCENE_GROUNDING_AZURE_OPENAI_DEPLOYMENT]?: string;
|
|
189
|
-
[MIDSCENE_GROUNDING_AZURE_OPENAI_INIT_CONFIG_JSON]?: string;
|
|
190
|
-
[MIDSCENE_GROUNDING_USE_ANTHROPIC_SDK]?: string;
|
|
191
|
-
[MIDSCENE_GROUNDING_ANTHROPIC_API_KEY]?: string;
|
|
192
|
-
[MIDSCENE_GROUNDING_VL_MODE]?: TVlModeValues;
|
|
129
|
+
[MIDSCENE_PLANNING_MODEL_SOCKS_PROXY]?: string;
|
|
130
|
+
[MIDSCENE_PLANNING_MODEL_HTTP_PROXY]?: string;
|
|
131
|
+
[MIDSCENE_PLANNING_MODEL_BASE_URL]?: string;
|
|
132
|
+
[MIDSCENE_PLANNING_MODEL_API_KEY]?: string;
|
|
133
|
+
[MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON]?: string;
|
|
134
|
+
[MIDSCENE_PLANNING_MODEL_TIMEOUT]?: string;
|
|
193
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Model configuration for Planning intent.
|
|
138
|
+
*
|
|
139
|
+
* IMPORTANT: Planning MUST use a vision language model (VL mode).
|
|
140
|
+
* DOM-based planning is not supported.
|
|
141
|
+
*
|
|
142
|
+
* Required: MIDSCENE_MODEL_FAMILY must be set to one of:
|
|
143
|
+
* - 'qwen2.5-vl'
|
|
144
|
+
* - 'qwen3-vl'
|
|
145
|
+
* - 'gemini'
|
|
146
|
+
* - 'doubao-vision'
|
|
147
|
+
* - 'vlm-ui-tars'
|
|
148
|
+
* - 'vlm-ui-tars-doubao'
|
|
149
|
+
* - 'vlm-ui-tars-doubao-1.5'
|
|
150
|
+
*/
|
|
194
151
|
export interface IModelConfigForDefault {
|
|
195
152
|
[MIDSCENE_MODEL_NAME]: string;
|
|
196
|
-
[
|
|
197
|
-
[
|
|
198
|
-
[
|
|
199
|
-
[
|
|
200
|
-
[
|
|
201
|
-
[
|
|
202
|
-
[MIDSCENE_USE_AZURE_OPENAI]?: string;
|
|
203
|
-
[MIDSCENE_AZURE_OPENAI_SCOPE]?: string;
|
|
204
|
-
[MIDSCENE_AZURE_OPENAI_KEY]?: string;
|
|
205
|
-
[MIDSCENE_AZURE_OPENAI_ENDPOINT]?: string;
|
|
206
|
-
[MIDSCENE_AZURE_OPENAI_API_VERSION]?: string;
|
|
207
|
-
[MIDSCENE_AZURE_OPENAI_DEPLOYMENT]?: string;
|
|
208
|
-
[MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON]?: string;
|
|
209
|
-
[MIDSCENE_USE_ANTHROPIC_SDK]?: string;
|
|
210
|
-
[MIDSCENE_ANTHROPIC_API_KEY]?: string;
|
|
211
|
-
[MIDSCENE_VL_MODE]?: TVlModeValues;
|
|
153
|
+
[MIDSCENE_MODEL_SOCKS_PROXY]?: string;
|
|
154
|
+
[MIDSCENE_MODEL_HTTP_PROXY]?: string;
|
|
155
|
+
[MIDSCENE_MODEL_BASE_URL]?: string;
|
|
156
|
+
[MIDSCENE_MODEL_API_KEY]?: string;
|
|
157
|
+
[MIDSCENE_MODEL_INIT_CONFIG_JSON]?: string;
|
|
158
|
+
[MIDSCENE_MODEL_FAMILY]?: TVlModeValues;
|
|
212
159
|
}
|
|
213
160
|
export interface IModelConfigForDefaultLegacy {
|
|
214
161
|
[MIDSCENE_MODEL_NAME]: string;
|
|
@@ -217,35 +164,51 @@ export interface IModelConfigForDefaultLegacy {
|
|
|
217
164
|
[OPENAI_BASE_URL]?: string;
|
|
218
165
|
[OPENAI_API_KEY]?: string;
|
|
219
166
|
[MIDSCENE_OPENAI_INIT_CONFIG_JSON]?: string;
|
|
220
|
-
[OPENAI_USE_AZURE]?: string;
|
|
221
|
-
[MIDSCENE_USE_AZURE_OPENAI]?: string;
|
|
222
|
-
[MIDSCENE_AZURE_OPENAI_SCOPE]?: string;
|
|
223
|
-
[AZURE_OPENAI_KEY]?: string;
|
|
224
|
-
[AZURE_OPENAI_ENDPOINT]?: string;
|
|
225
|
-
[AZURE_OPENAI_API_VERSION]?: string;
|
|
226
|
-
[AZURE_OPENAI_DEPLOYMENT]?: string;
|
|
227
|
-
[MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON]?: string;
|
|
228
|
-
[MIDSCENE_USE_ANTHROPIC_SDK]?: string;
|
|
229
|
-
[ANTHROPIC_API_KEY]?: string;
|
|
230
|
-
[MIDSCENE_VL_MODE]?: TVlModeValues;
|
|
231
167
|
}
|
|
232
168
|
/**
|
|
233
|
-
* -
|
|
234
|
-
* - grounding:short for Visual Grounding
|
|
169
|
+
* - insight: Visual Question Answering and Visual Grounding (unified)
|
|
235
170
|
* - planning: planning
|
|
236
|
-
* - default: all except
|
|
171
|
+
* - default: all except insight、planning
|
|
237
172
|
*/
|
|
238
|
-
export type TIntent = '
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
173
|
+
export type TIntent = 'insight' | 'planning' | 'default';
|
|
174
|
+
/**
|
|
175
|
+
* Env-style model configuration map supplied directly to the agent.
|
|
176
|
+
* Numbers are allowed so callers can pass numeric env values (e.g. limits) without casting.
|
|
177
|
+
*/
|
|
178
|
+
export type TModelConfig = Record<string, string | number>;
|
|
242
179
|
export declare enum UITarsModelVersion {
|
|
243
180
|
V1_0 = "1.0",
|
|
244
181
|
V1_5 = "1.5",
|
|
245
182
|
DOUBAO_1_5_15B = "doubao-1.5-15B",
|
|
246
183
|
DOUBAO_1_5_20B = "doubao-1.5-20B"
|
|
247
184
|
}
|
|
248
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Callback to create custom OpenAI client instance
|
|
187
|
+
* @param config - Resolved model configuration including apiKey, baseURL, modelName, intent, etc.
|
|
188
|
+
* @returns OpenAI client instance (can be wrapped with langsmith, langfuse, etc.)
|
|
189
|
+
*
|
|
190
|
+
* Note: Wrapper functions like langsmith's wrapOpenAI() return the same OpenAI instance
|
|
191
|
+
* with enhanced behavior, so the return type remains compatible with OpenAI.
|
|
192
|
+
*
|
|
193
|
+
* Note: The return type is `any` in the shared package to avoid requiring openai as a dependency.
|
|
194
|
+
* The actual implementation should return an OpenAI instance.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* import OpenAI from 'openai';
|
|
199
|
+
* import { wrapOpenAI } from 'langsmith/wrappers';
|
|
200
|
+
*
|
|
201
|
+
* createOpenAIClient: async (openai, opts) => {
|
|
202
|
+
* // Wrap with langsmith for planning tasks
|
|
203
|
+
* if (opts.baseURL?.includes('planning')) {
|
|
204
|
+
* return wrapOpenAI(openai, { metadata: { task: 'planning' } });
|
|
205
|
+
* }
|
|
206
|
+
*
|
|
207
|
+
* return openai;
|
|
208
|
+
* }
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
export type CreateOpenAIClientFn = (openAIInstance: any, options: Record<string, unknown>) => Promise<any>;
|
|
249
212
|
export interface IModelConfig {
|
|
250
213
|
/**
|
|
251
214
|
* proxy
|
|
@@ -263,32 +226,30 @@ export interface IModelConfig {
|
|
|
263
226
|
openaiApiKey?: string;
|
|
264
227
|
openaiExtraConfig?: Record<string, unknown>;
|
|
265
228
|
/**
|
|
266
|
-
*
|
|
267
|
-
|
|
268
|
-
openaiUseAzureDeprecated?: boolean;
|
|
269
|
-
useAzureOpenai?: boolean;
|
|
270
|
-
azureOpenaiScope?: string;
|
|
271
|
-
azureOpenaiKey?: string;
|
|
272
|
-
azureOpenaiEndpoint?: string;
|
|
273
|
-
azureOpenaiApiVersion?: string;
|
|
274
|
-
azureOpenaiDeployment?: string;
|
|
275
|
-
azureExtraConfig?: Record<string, unknown>;
|
|
276
|
-
/**
|
|
277
|
-
* Anthropic
|
|
229
|
+
* Timeout for API calls in milliseconds.
|
|
230
|
+
* If not set, uses OpenAI SDK default (10 minutes).
|
|
278
231
|
*/
|
|
279
|
-
|
|
280
|
-
anthropicApiKey?: string;
|
|
232
|
+
timeout?: number;
|
|
281
233
|
/**
|
|
282
|
-
* - vlModeRaw: exists only in non-legacy logic. value can be 'doubao-vision', 'gemini', '
|
|
283
|
-
* - vlMode: based on the results of the vlModoRaw classification,value can be 'doubao-vision', 'gemini', '
|
|
234
|
+
* - vlModeRaw: exists only in non-legacy logic. value can be 'doubao-vision', 'gemini', 'qwen2.5-vl', 'vlm-ui-tars', 'vlm-ui-tars-doubao', 'vlm-ui-tars-doubao-1.5'
|
|
235
|
+
* - vlMode: based on the results of the vlModoRaw classification,value can be 'doubao-vision', 'gemini', 'qwen2.5-vl', 'vlm-ui-tars'
|
|
284
236
|
*/
|
|
285
237
|
vlModeRaw?: string;
|
|
286
238
|
vlMode?: TVlModeTypes;
|
|
287
239
|
uiTarsModelVersion?: UITarsModelVersion;
|
|
288
240
|
modelDescription: string;
|
|
289
241
|
/**
|
|
290
|
-
*
|
|
242
|
+
* original intent from the config
|
|
291
243
|
*/
|
|
292
244
|
intent: TIntent;
|
|
293
|
-
|
|
245
|
+
/**
|
|
246
|
+
* Custom OpenAI client factory function
|
|
247
|
+
*
|
|
248
|
+
* If provided, this function will be called to create OpenAI client instances
|
|
249
|
+
* for each AI call, allowing you to:
|
|
250
|
+
* - Wrap clients with observability tools (langsmith, langfuse)
|
|
251
|
+
* - Use custom OpenAI-compatible clients
|
|
252
|
+
* - Apply different configurations based on intent
|
|
253
|
+
*/
|
|
254
|
+
createOpenAIClient?: CreateOpenAIClientFn;
|
|
294
255
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { LocateResultElement } from '../types';
|
|
2
2
|
export declare function isFormElement(node: globalThis.Node): boolean;
|
|
3
3
|
export declare function isButtonElement(node: globalThis.Node): node is globalThis.HTMLButtonElement;
|
|
4
4
|
export declare function isAElement(node: globalThis.Node): node is globalThis.HTMLButtonElement;
|
|
@@ -10,17 +10,4 @@ export declare function isContainerElement(node: globalThis.Node): node is globa
|
|
|
10
10
|
export declare function generateElementByPosition(position: {
|
|
11
11
|
x: number;
|
|
12
12
|
y: number;
|
|
13
|
-
}):
|
|
14
|
-
id: string;
|
|
15
|
-
attributes: {
|
|
16
|
-
nodeType: NodeType;
|
|
17
|
-
};
|
|
18
|
-
rect: {
|
|
19
|
-
left: number;
|
|
20
|
-
top: number;
|
|
21
|
-
width: number;
|
|
22
|
-
height: number;
|
|
23
|
-
};
|
|
24
|
-
content: string;
|
|
25
|
-
center: number[];
|
|
26
|
-
};
|
|
13
|
+
}, description: string): LocateResultElement;
|
|
@@ -27,7 +27,6 @@ export { descriptionOfTree, traverseTree, treeToList, truncateText, trimAttribut
|
|
|
27
27
|
export { extractTextWithPosition as webExtractTextWithPosition } from './web-extractor';
|
|
28
28
|
export { extractTreeNode as webExtractNodeTree } from './web-extractor';
|
|
29
29
|
export { extractTreeNodeAsString as webExtractNodeTreeAsString } from './web-extractor';
|
|
30
|
-
export {
|
|
31
|
-
export { getXpathsById, getXpathsByPoint, getNodeInfoByXpath, getElementInfoByXpath, getElementXpath, } from './locator';
|
|
30
|
+
export { getXpathsByPoint, getNodeInfoByXpath, getElementInfoByXpath, getElementXpath, } from './locator';
|
|
32
31
|
export { generateElementByPosition } from './dom-util';
|
|
33
32
|
export { isNotContainerElement } from './dom-util';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ElementInfo } from '.';
|
|
2
2
|
import type { Point } from '../types';
|
|
3
3
|
export declare const getElementXpath: (element: Node, isOrderSensitive?: boolean, isLeafElement?: boolean) => string;
|
|
4
|
-
export declare function getXpathsById(id: string): string[] | null;
|
|
5
4
|
export declare function getXpathsByPoint(point: Point, isOrderSensitive: boolean): string[] | null;
|
|
6
5
|
export declare function getNodeInfoByXpath(xpath: string): Node | null;
|
|
7
6
|
export declare function getElementInfoByXpath(xpath: string): ElementInfo | null;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { BaseElement, ElementTreeNode } from '../types';
|
|
2
2
|
export declare function truncateText(text: string | number | object | undefined, maxLength?: number): string;
|
|
3
|
-
export declare function trimAttributes(attributes: Record<string, any>, truncateTextLength?: number):
|
|
4
|
-
[key: string]: string;
|
|
5
|
-
nodeType: import("./constants").NodeType;
|
|
6
|
-
};
|
|
3
|
+
export declare function trimAttributes(attributes: Record<string, any>, truncateTextLength?: number): Record<string, string>;
|
|
7
4
|
export declare function descriptionOfTree<ElementType extends BaseElement = BaseElement>(tree: ElementTreeNode<ElementType>, truncateTextLength?: number, filterNonTextContent?: boolean, visibleOnly?: boolean): string;
|
|
8
5
|
export declare function treeToList<T extends BaseElement>(tree: ElementTreeNode<T>): T[];
|
|
9
6
|
export declare function traverseTree<T extends BaseElement, ReturnNodeType extends BaseElement>(tree: ElementTreeNode<T>, onNode: (node: T) => ReturnNodeType): ElementTreeNode<ReturnNodeType>;
|
|
@@ -33,9 +33,6 @@ export declare function elementRect(el: globalThis.HTMLElement | globalThis.Node
|
|
|
33
33
|
export declare function validTextNodeContent(node: globalThis.Node): string | false;
|
|
34
34
|
export declare function getNodeAttributes(node: globalThis.HTMLElement | globalThis.Node, currentWindow: typeof globalThis.window): Record<string, string>;
|
|
35
35
|
export declare function midsceneGenerateHash(node: globalThis.Node | null, content: string, rect: Rect): string;
|
|
36
|
-
export declare function setNodeHashCacheListOnWindow(): void;
|
|
37
|
-
export declare function setNodeToCacheList(node: globalThis.Node, id: string): void;
|
|
38
|
-
export declare function getNodeFromCacheList(id: string): any;
|
|
39
36
|
export declare function generateId(numberId: number): string;
|
|
40
37
|
export declare function setGenerateHashOnWindow(): void;
|
|
41
38
|
export declare function setMidsceneVisibleRectOnWindow(): void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ParseArgsConfig } from 'node:util';
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import type { IMidsceneTools } from './types';
|
|
4
|
+
export interface BaseMCPServerConfig {
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
description: string;
|
|
8
|
+
}
|
|
9
|
+
export interface HttpLaunchOptions {
|
|
10
|
+
port: number;
|
|
11
|
+
host?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* CLI argument configuration for MCP servers
|
|
15
|
+
*/
|
|
16
|
+
export declare const CLI_ARGS_CONFIG: ParseArgsConfig['options'];
|
|
17
|
+
export interface CLIArgs {
|
|
18
|
+
mode?: string;
|
|
19
|
+
port?: string;
|
|
20
|
+
host?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Launch an MCP server based on CLI arguments
|
|
24
|
+
* Shared helper to reduce duplication across platform CLI entry points
|
|
25
|
+
*/
|
|
26
|
+
export declare function launchMCPServer(server: BaseMCPServer, args: CLIArgs): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Base MCP Server class with programmatic launch() API
|
|
29
|
+
* Each platform extends this to provide their own tools manager
|
|
30
|
+
*/
|
|
31
|
+
export declare abstract class BaseMCPServer {
|
|
32
|
+
protected mcpServer: McpServer;
|
|
33
|
+
protected toolsManager?: IMidsceneTools;
|
|
34
|
+
protected config: BaseMCPServerConfig;
|
|
35
|
+
constructor(config: BaseMCPServerConfig);
|
|
36
|
+
/**
|
|
37
|
+
* Platform-specific: create tools manager instance
|
|
38
|
+
*/
|
|
39
|
+
protected abstract createToolsManager(): IMidsceneTools;
|
|
40
|
+
/**
|
|
41
|
+
* Initialize tools manager and attach to MCP server
|
|
42
|
+
*/
|
|
43
|
+
private initializeToolsManager;
|
|
44
|
+
/**
|
|
45
|
+
* Perform cleanup on shutdown
|
|
46
|
+
*/
|
|
47
|
+
private performCleanup;
|
|
48
|
+
/**
|
|
49
|
+
* Initialize and launch the MCP server with stdio transport
|
|
50
|
+
*/
|
|
51
|
+
launch(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Launch MCP server with HTTP transport
|
|
54
|
+
* Supports stateful sessions for web applications and service integration
|
|
55
|
+
*/
|
|
56
|
+
launchHttp(options: HttpLaunchOptions): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Create a new HTTP session with transport
|
|
59
|
+
*/
|
|
60
|
+
private createHttpSession;
|
|
61
|
+
/**
|
|
62
|
+
* Start periodic session cleanup for inactive sessions
|
|
63
|
+
*/
|
|
64
|
+
private startSessionCleanup;
|
|
65
|
+
/**
|
|
66
|
+
* Setup shutdown handlers for HTTP server
|
|
67
|
+
*/
|
|
68
|
+
private setupHttpShutdownHandlers;
|
|
69
|
+
/**
|
|
70
|
+
* Get the underlying MCP server instance
|
|
71
|
+
*/
|
|
72
|
+
getServer(): McpServer;
|
|
73
|
+
/**
|
|
74
|
+
* Get the tools manager instance
|
|
75
|
+
*/
|
|
76
|
+
getToolsManager(): IMidsceneTools | undefined;
|
|
77
|
+
}
|