@midscene/shared 1.0.1-beta-20251022061922.0 → 1.0.1-beta-20251024063839.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/env/constants.mjs +28 -28
- package/dist/es/env/decide-model-config.mjs +5 -2
- package/dist/es/env/init-debug.mjs +6 -6
- package/dist/es/env/model-config-manager.mjs +2 -1
- package/dist/es/env/types.mjs +57 -53
- package/dist/lib/env/constants.js +27 -27
- package/dist/lib/env/decide-model-config.js +5 -2
- package/dist/lib/env/init-debug.js +5 -5
- package/dist/lib/env/model-config-manager.js +2 -1
- package/dist/lib/env/types.js +140 -130
- package/dist/types/env/model-config-manager.d.ts +2 -2
- package/dist/types/env/types.d.ts +76 -59
- package/package.json +1 -1
- package/src/env/constants.ts +54 -52
- package/src/env/decide-model-config.ts +20 -2
- package/src/env/init-debug.ts +11 -6
- package/src/env/model-config-manager.ts +9 -3
- package/src/env/types.ts +122 -95
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MIDSCENE_GROUNDING_LOCATOR_MODE, MIDSCENE_GROUNDING_MODEL_API_KEY, MIDSCENE_GROUNDING_MODEL_BASE_URL, MIDSCENE_GROUNDING_MODEL_HTTP_PROXY, MIDSCENE_GROUNDING_MODEL_INIT_CONFIG_JSON, MIDSCENE_GROUNDING_MODEL_NAME, MIDSCENE_GROUNDING_MODEL_SOCKS_PROXY, MIDSCENE_LOCATOR_MODE, MIDSCENE_MODEL_API_KEY, MIDSCENE_MODEL_BASE_URL, MIDSCENE_MODEL_HTTP_PROXY, MIDSCENE_MODEL_INIT_CONFIG_JSON, MIDSCENE_MODEL_NAME, MIDSCENE_MODEL_SOCKS_PROXY, MIDSCENE_PLANNING_LOCATOR_MODE, MIDSCENE_PLANNING_MODEL_API_KEY, MIDSCENE_PLANNING_MODEL_BASE_URL, MIDSCENE_PLANNING_MODEL_HTTP_PROXY, MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON, MIDSCENE_PLANNING_MODEL_NAME, MIDSCENE_PLANNING_MODEL_SOCKS_PROXY, MIDSCENE_VQA_LOCATOR_MODE, MIDSCENE_VQA_MODEL_API_KEY, MIDSCENE_VQA_MODEL_BASE_URL, MIDSCENE_VQA_MODEL_HTTP_PROXY, MIDSCENE_VQA_MODEL_INIT_CONFIG_JSON, MIDSCENE_VQA_MODEL_NAME, MIDSCENE_VQA_MODEL_SOCKS_PROXY, OPENAI_API_KEY, OPENAI_BASE_URL } from "./types.mjs";
|
|
2
2
|
const VQA_MODEL_CONFIG_KEYS = {
|
|
3
3
|
modelName: MIDSCENE_VQA_MODEL_NAME,
|
|
4
|
-
socksProxy:
|
|
5
|
-
httpProxy:
|
|
6
|
-
openaiBaseURL:
|
|
7
|
-
openaiApiKey:
|
|
8
|
-
openaiExtraConfig:
|
|
9
|
-
vlMode:
|
|
4
|
+
socksProxy: MIDSCENE_VQA_MODEL_SOCKS_PROXY,
|
|
5
|
+
httpProxy: MIDSCENE_VQA_MODEL_HTTP_PROXY,
|
|
6
|
+
openaiBaseURL: MIDSCENE_VQA_MODEL_BASE_URL,
|
|
7
|
+
openaiApiKey: MIDSCENE_VQA_MODEL_API_KEY,
|
|
8
|
+
openaiExtraConfig: MIDSCENE_VQA_MODEL_INIT_CONFIG_JSON,
|
|
9
|
+
vlMode: MIDSCENE_VQA_LOCATOR_MODE
|
|
10
10
|
};
|
|
11
11
|
const GROUNDING_MODEL_CONFIG_KEYS = {
|
|
12
12
|
modelName: MIDSCENE_GROUNDING_MODEL_NAME,
|
|
13
|
-
socksProxy:
|
|
14
|
-
httpProxy:
|
|
15
|
-
openaiBaseURL:
|
|
16
|
-
openaiApiKey:
|
|
17
|
-
openaiExtraConfig:
|
|
18
|
-
vlMode:
|
|
13
|
+
socksProxy: MIDSCENE_GROUNDING_MODEL_SOCKS_PROXY,
|
|
14
|
+
httpProxy: MIDSCENE_GROUNDING_MODEL_HTTP_PROXY,
|
|
15
|
+
openaiBaseURL: MIDSCENE_GROUNDING_MODEL_BASE_URL,
|
|
16
|
+
openaiApiKey: MIDSCENE_GROUNDING_MODEL_API_KEY,
|
|
17
|
+
openaiExtraConfig: MIDSCENE_GROUNDING_MODEL_INIT_CONFIG_JSON,
|
|
18
|
+
vlMode: MIDSCENE_GROUNDING_LOCATOR_MODE
|
|
19
19
|
};
|
|
20
20
|
const PLANNING_MODEL_CONFIG_KEYS = {
|
|
21
21
|
modelName: MIDSCENE_PLANNING_MODEL_NAME,
|
|
22
|
-
socksProxy:
|
|
23
|
-
httpProxy:
|
|
24
|
-
openaiBaseURL:
|
|
25
|
-
openaiApiKey:
|
|
26
|
-
openaiExtraConfig:
|
|
27
|
-
vlMode:
|
|
22
|
+
socksProxy: MIDSCENE_PLANNING_MODEL_SOCKS_PROXY,
|
|
23
|
+
httpProxy: MIDSCENE_PLANNING_MODEL_HTTP_PROXY,
|
|
24
|
+
openaiBaseURL: MIDSCENE_PLANNING_MODEL_BASE_URL,
|
|
25
|
+
openaiApiKey: MIDSCENE_PLANNING_MODEL_API_KEY,
|
|
26
|
+
openaiExtraConfig: MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON,
|
|
27
|
+
vlMode: MIDSCENE_PLANNING_LOCATOR_MODE
|
|
28
28
|
};
|
|
29
29
|
const DEFAULT_MODEL_CONFIG_KEYS = {
|
|
30
30
|
modelName: MIDSCENE_MODEL_NAME,
|
|
31
|
-
socksProxy:
|
|
32
|
-
httpProxy:
|
|
33
|
-
openaiBaseURL:
|
|
34
|
-
openaiApiKey:
|
|
35
|
-
openaiExtraConfig:
|
|
36
|
-
vlMode:
|
|
31
|
+
socksProxy: MIDSCENE_MODEL_SOCKS_PROXY,
|
|
32
|
+
httpProxy: MIDSCENE_MODEL_HTTP_PROXY,
|
|
33
|
+
openaiBaseURL: MIDSCENE_MODEL_BASE_URL,
|
|
34
|
+
openaiApiKey: MIDSCENE_MODEL_API_KEY,
|
|
35
|
+
openaiExtraConfig: MIDSCENE_MODEL_INIT_CONFIG_JSON,
|
|
36
|
+
vlMode: MIDSCENE_LOCATOR_MODE
|
|
37
37
|
};
|
|
38
38
|
const DEFAULT_MODEL_CONFIG_KEYS_LEGACY = {
|
|
39
39
|
modelName: MIDSCENE_MODEL_NAME,
|
|
40
|
-
socksProxy:
|
|
41
|
-
httpProxy:
|
|
40
|
+
socksProxy: MIDSCENE_MODEL_SOCKS_PROXY,
|
|
41
|
+
httpProxy: MIDSCENE_MODEL_HTTP_PROXY,
|
|
42
42
|
openaiBaseURL: OPENAI_BASE_URL,
|
|
43
43
|
openaiApiKey: OPENAI_API_KEY,
|
|
44
|
-
openaiExtraConfig:
|
|
44
|
+
openaiExtraConfig: MIDSCENE_MODEL_INIT_CONFIG_JSON,
|
|
45
45
|
vlMode: 'DEFAULT_MODEL_CONFIG_KEYS has no vlMode key'
|
|
46
46
|
};
|
|
47
47
|
export { DEFAULT_MODEL_CONFIG_KEYS, DEFAULT_MODEL_CONFIG_KEYS_LEGACY, GROUNDING_MODEL_CONFIG_KEYS, PLANNING_MODEL_CONFIG_KEYS, VQA_MODEL_CONFIG_KEYS };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_MODEL_CONFIG_KEYS, DEFAULT_MODEL_CONFIG_KEYS_LEGACY, GROUNDING_MODEL_CONFIG_KEYS, PLANNING_MODEL_CONFIG_KEYS, VQA_MODEL_CONFIG_KEYS } from "./constants.mjs";
|
|
2
|
+
import { MODEL_API_KEY, MODEL_BASE_URL } from "./types.mjs";
|
|
2
3
|
import { getDebug } from "../logger.mjs";
|
|
3
4
|
import { assert } from "../utils.mjs";
|
|
4
5
|
import { createAssert, maskConfig, parseJson } from "./helper.mjs";
|
|
@@ -17,8 +18,10 @@ const decideOpenaiSdkConfig = ({ keys, provider, valueAssert })=>{
|
|
|
17
18
|
const httpProxy = provider[keys.httpProxy];
|
|
18
19
|
const vlMode = provider[keys.vlMode];
|
|
19
20
|
debugLog('enter decideOpenaiSdkConfig with keys:', keys);
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
let openaiBaseURL;
|
|
22
|
+
let openaiApiKey;
|
|
23
|
+
openaiBaseURL = 'OPENAI_BASE_URL' === keys.openaiBaseURL ? provider[MODEL_BASE_URL] || provider[keys.openaiBaseURL] : provider[keys.openaiBaseURL];
|
|
24
|
+
openaiApiKey = 'OPENAI_API_KEY' === keys.openaiApiKey ? provider[MODEL_API_KEY] || provider[keys.openaiApiKey] : provider[keys.openaiApiKey];
|
|
22
25
|
const openaiExtraConfig = parseJson(keys.openaiExtraConfig, provider[keys.openaiExtraConfig]);
|
|
23
26
|
valueAssert(openaiApiKey, keys.openaiApiKey);
|
|
24
27
|
return {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { enableDebug } from "../logger.mjs";
|
|
2
2
|
import { getBasicEnvValue } from "./basic.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { MIDSCENE_DEBUG_MODEL_PROFILE, MIDSCENE_DEBUG_MODEL_RESPONSE } from "./types.mjs";
|
|
4
4
|
const initDebugConfig = ()=>{
|
|
5
|
-
const shouldPrintTiming = getBasicEnvValue(
|
|
5
|
+
const shouldPrintTiming = getBasicEnvValue(MIDSCENE_DEBUG_MODEL_PROFILE);
|
|
6
6
|
let debugConfig = '';
|
|
7
7
|
if (shouldPrintTiming) {
|
|
8
|
-
console.warn('
|
|
8
|
+
console.warn('MIDSCENE_DEBUG_MODEL_PROFILE is deprecated, use DEBUG=midscene:ai:profile instead');
|
|
9
9
|
debugConfig = 'ai:profile';
|
|
10
10
|
}
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
console.warn('
|
|
11
|
+
const shouldPrintModelResponse = getBasicEnvValue(MIDSCENE_DEBUG_MODEL_RESPONSE);
|
|
12
|
+
if (shouldPrintModelResponse) {
|
|
13
|
+
console.warn('MIDSCENE_DEBUG_MODEL_RESPONSE is deprecated, use DEBUG=midscene:ai:response instead');
|
|
14
14
|
debugConfig = debugConfig ? 'ai:*' : 'ai:call';
|
|
15
15
|
}
|
|
16
16
|
if (debugConfig) enableDebug(debugConfig);
|
|
@@ -113,7 +113,8 @@ Learn more: https://midscenejs.com/choose-a-model`);
|
|
|
113
113
|
this.createOpenAIClientFn = createOpenAIClientFn;
|
|
114
114
|
if (modelConfigFn) {
|
|
115
115
|
this.isolatedMode = true;
|
|
116
|
-
const
|
|
116
|
+
const internalFn = modelConfigFn;
|
|
117
|
+
const intentConfigMap = this.calcIntentConfigMap(internalFn);
|
|
117
118
|
this.modelConfigMap = this.calcModelConfigMapBaseOnIntent(intentConfigMap);
|
|
118
119
|
}
|
|
119
120
|
}
|
package/dist/es/env/types.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const MIDSCENE_MODEL_INIT_CONFIG_JSON = 'MIDSCENE_MODEL_INIT_CONFIG_JSON';
|
|
2
2
|
const MIDSCENE_MODEL_NAME = 'MIDSCENE_MODEL_NAME';
|
|
3
3
|
const MIDSCENE_LANGSMITH_DEBUG = 'MIDSCENE_LANGSMITH_DEBUG';
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const MIDSCENE_DEBUG_MODEL_PROFILE = 'MIDSCENE_DEBUG_MODEL_PROFILE';
|
|
5
|
+
const MIDSCENE_DEBUG_MODEL_RESPONSE = 'MIDSCENE_DEBUG_MODEL_RESPONSE';
|
|
6
6
|
const MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG = 'MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG';
|
|
7
7
|
const MIDSCENE_DEBUG_MODE = 'MIDSCENE_DEBUG_MODE';
|
|
8
8
|
const MIDSCENE_MCP_USE_PUPPETEER_MODE = 'MIDSCENE_MCP_USE_PUPPETEER_MODE';
|
|
@@ -10,8 +10,10 @@ const MIDSCENE_MCP_CHROME_PATH = 'MIDSCENE_MCP_CHROME_PATH';
|
|
|
10
10
|
const MIDSCENE_MCP_ANDROID_MODE = 'MIDSCENE_MCP_ANDROID_MODE';
|
|
11
11
|
const DOCKER_CONTAINER = 'DOCKER_CONTAINER';
|
|
12
12
|
const MIDSCENE_FORCE_DEEP_THINK = 'MIDSCENE_FORCE_DEEP_THINK';
|
|
13
|
-
const
|
|
14
|
-
const
|
|
13
|
+
const MIDSCENE_MODEL_SOCKS_PROXY = 'MIDSCENE_MODEL_SOCKS_PROXY';
|
|
14
|
+
const MIDSCENE_MODEL_HTTP_PROXY = 'MIDSCENE_MODEL_HTTP_PROXY';
|
|
15
|
+
const MODEL_API_KEY = 'MODEL_API_KEY';
|
|
16
|
+
const MODEL_BASE_URL = 'MODEL_BASE_URL';
|
|
15
17
|
const OPENAI_API_KEY = 'OPENAI_API_KEY';
|
|
16
18
|
const OPENAI_BASE_URL = 'OPENAI_BASE_URL';
|
|
17
19
|
const OPENAI_MAX_TOKENS = 'OPENAI_MAX_TOKENS';
|
|
@@ -34,37 +36,37 @@ const MIDSCENE_REPLANNING_CYCLE_LIMIT = 'MIDSCENE_REPLANNING_CYCLE_LIMIT';
|
|
|
34
36
|
const MIDSCENE_PREFERRED_LANGUAGE = 'MIDSCENE_PREFERRED_LANGUAGE';
|
|
35
37
|
const MIDSCENE_CACHE_MAX_FILENAME_LENGTH = 'MIDSCENE_CACHE_MAX_FILENAME_LENGTH';
|
|
36
38
|
const MIDSCENE_RUN_DIR = 'MIDSCENE_RUN_DIR';
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
39
|
+
const MIDSCENE_MODEL_BASE_URL = 'MIDSCENE_MODEL_BASE_URL';
|
|
40
|
+
const MIDSCENE_MODEL_API_KEY = 'MIDSCENE_MODEL_API_KEY';
|
|
41
|
+
const MIDSCENE_LOCATOR_MODE = 'MIDSCENE_LOCATOR_MODE';
|
|
40
42
|
const MIDSCENE_VQA_MODEL_NAME = 'MIDSCENE_VQA_MODEL_NAME';
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
43
|
+
const MIDSCENE_VQA_MODEL_SOCKS_PROXY = 'MIDSCENE_VQA_MODEL_SOCKS_PROXY';
|
|
44
|
+
const MIDSCENE_VQA_MODEL_HTTP_PROXY = 'MIDSCENE_VQA_MODEL_HTTP_PROXY';
|
|
45
|
+
const MIDSCENE_VQA_MODEL_BASE_URL = 'MIDSCENE_VQA_MODEL_BASE_URL';
|
|
46
|
+
const MIDSCENE_VQA_MODEL_API_KEY = 'MIDSCENE_VQA_MODEL_API_KEY';
|
|
47
|
+
const MIDSCENE_VQA_MODEL_INIT_CONFIG_JSON = 'MIDSCENE_VQA_MODEL_INIT_CONFIG_JSON';
|
|
48
|
+
const MIDSCENE_VQA_LOCATOR_MODE = 'MIDSCENE_VQA_LOCATOR_MODE';
|
|
47
49
|
const MIDSCENE_PLANNING_MODEL_NAME = 'MIDSCENE_PLANNING_MODEL_NAME';
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const
|
|
50
|
+
const MIDSCENE_PLANNING_MODEL_SOCKS_PROXY = 'MIDSCENE_PLANNING_MODEL_SOCKS_PROXY';
|
|
51
|
+
const MIDSCENE_PLANNING_MODEL_HTTP_PROXY = 'MIDSCENE_PLANNING_MODEL_HTTP_PROXY';
|
|
52
|
+
const MIDSCENE_PLANNING_MODEL_BASE_URL = 'MIDSCENE_PLANNING_MODEL_BASE_URL';
|
|
53
|
+
const MIDSCENE_PLANNING_MODEL_API_KEY = 'MIDSCENE_PLANNING_MODEL_API_KEY';
|
|
54
|
+
const MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON = 'MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON';
|
|
55
|
+
const MIDSCENE_PLANNING_LOCATOR_MODE = 'MIDSCENE_PLANNING_LOCATOR_MODE';
|
|
54
56
|
const MIDSCENE_GROUNDING_MODEL_NAME = 'MIDSCENE_GROUNDING_MODEL_NAME';
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
57
|
+
const MIDSCENE_GROUNDING_MODEL_SOCKS_PROXY = 'MIDSCENE_GROUNDING_MODEL_SOCKS_PROXY';
|
|
58
|
+
const MIDSCENE_GROUNDING_MODEL_HTTP_PROXY = 'MIDSCENE_GROUNDING_MODEL_HTTP_PROXY';
|
|
59
|
+
const MIDSCENE_GROUNDING_MODEL_BASE_URL = 'MIDSCENE_GROUNDING_MODEL_BASE_URL';
|
|
60
|
+
const MIDSCENE_GROUNDING_MODEL_API_KEY = 'MIDSCENE_GROUNDING_MODEL_API_KEY';
|
|
61
|
+
const MIDSCENE_GROUNDING_MODEL_INIT_CONFIG_JSON = 'MIDSCENE_GROUNDING_MODEL_INIT_CONFIG_JSON';
|
|
62
|
+
const MIDSCENE_GROUNDING_LOCATOR_MODE = 'MIDSCENE_GROUNDING_LOCATOR_MODE';
|
|
61
63
|
const UNUSED_ENV_KEYS = [
|
|
62
64
|
MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG
|
|
63
65
|
];
|
|
64
66
|
const BASIC_ENV_KEYS = [
|
|
65
67
|
MIDSCENE_DEBUG_MODE,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
MIDSCENE_DEBUG_MODEL_PROFILE,
|
|
69
|
+
MIDSCENE_DEBUG_MODEL_RESPONSE,
|
|
68
70
|
MIDSCENE_RUN_DIR
|
|
69
71
|
];
|
|
70
72
|
const BOOLEAN_ENV_KEYS = [
|
|
@@ -99,41 +101,43 @@ const GLOBAL_ENV_KEYS = [
|
|
|
99
101
|
];
|
|
100
102
|
const MODEL_ENV_KEYS = [
|
|
101
103
|
MIDSCENE_MODEL_NAME,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
MIDSCENE_MODEL_INIT_CONFIG_JSON,
|
|
105
|
+
MIDSCENE_MODEL_API_KEY,
|
|
106
|
+
MIDSCENE_MODEL_BASE_URL,
|
|
107
|
+
MIDSCENE_MODEL_SOCKS_PROXY,
|
|
108
|
+
MIDSCENE_MODEL_HTTP_PROXY,
|
|
107
109
|
MIDSCENE_USE_VLM_UI_TARS,
|
|
108
110
|
MIDSCENE_USE_QWEN_VL,
|
|
109
111
|
MIDSCENE_USE_QWEN3_VL,
|
|
110
112
|
MIDSCENE_USE_DOUBAO_VISION,
|
|
111
113
|
MIDSCENE_USE_GEMINI,
|
|
112
114
|
MIDSCENE_USE_VL_MODEL,
|
|
113
|
-
|
|
115
|
+
MIDSCENE_LOCATOR_MODE,
|
|
114
116
|
OPENAI_API_KEY,
|
|
115
117
|
OPENAI_BASE_URL,
|
|
118
|
+
MODEL_API_KEY,
|
|
119
|
+
MODEL_BASE_URL,
|
|
116
120
|
MIDSCENE_VQA_MODEL_NAME,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
MIDSCENE_VQA_MODEL_SOCKS_PROXY,
|
|
122
|
+
MIDSCENE_VQA_MODEL_HTTP_PROXY,
|
|
123
|
+
MIDSCENE_VQA_MODEL_BASE_URL,
|
|
124
|
+
MIDSCENE_VQA_MODEL_API_KEY,
|
|
125
|
+
MIDSCENE_VQA_MODEL_INIT_CONFIG_JSON,
|
|
126
|
+
MIDSCENE_VQA_LOCATOR_MODE,
|
|
123
127
|
MIDSCENE_PLANNING_MODEL_NAME,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
MIDSCENE_PLANNING_MODEL_SOCKS_PROXY,
|
|
129
|
+
MIDSCENE_PLANNING_MODEL_HTTP_PROXY,
|
|
130
|
+
MIDSCENE_PLANNING_MODEL_BASE_URL,
|
|
131
|
+
MIDSCENE_PLANNING_MODEL_API_KEY,
|
|
132
|
+
MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON,
|
|
133
|
+
MIDSCENE_PLANNING_LOCATOR_MODE,
|
|
130
134
|
MIDSCENE_GROUNDING_MODEL_NAME,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
MIDSCENE_GROUNDING_MODEL_SOCKS_PROXY,
|
|
136
|
+
MIDSCENE_GROUNDING_MODEL_HTTP_PROXY,
|
|
137
|
+
MIDSCENE_GROUNDING_MODEL_BASE_URL,
|
|
138
|
+
MIDSCENE_GROUNDING_MODEL_API_KEY,
|
|
139
|
+
MIDSCENE_GROUNDING_MODEL_INIT_CONFIG_JSON,
|
|
140
|
+
MIDSCENE_GROUNDING_LOCATOR_MODE
|
|
137
141
|
];
|
|
138
142
|
const ALL_ENV_KEYS = [
|
|
139
143
|
...UNUSED_ENV_KEYS,
|
|
@@ -157,4 +161,4 @@ const VL_MODE_RAW_VALID_VALUES = [
|
|
|
157
161
|
'vlm-ui-tars-doubao',
|
|
158
162
|
'vlm-ui-tars-doubao-1.5'
|
|
159
163
|
];
|
|
160
|
-
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_CACHE, MIDSCENE_CACHE_MAX_FILENAME_LENGTH, MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG,
|
|
164
|
+
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_CACHE, MIDSCENE_CACHE_MAX_FILENAME_LENGTH, MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG, MIDSCENE_DEBUG_MODE, MIDSCENE_DEBUG_MODEL_PROFILE, MIDSCENE_DEBUG_MODEL_RESPONSE, MIDSCENE_FORCE_DEEP_THINK, MIDSCENE_GROUNDING_LOCATOR_MODE, MIDSCENE_GROUNDING_MODEL_API_KEY, MIDSCENE_GROUNDING_MODEL_BASE_URL, MIDSCENE_GROUNDING_MODEL_HTTP_PROXY, MIDSCENE_GROUNDING_MODEL_INIT_CONFIG_JSON, MIDSCENE_GROUNDING_MODEL_NAME, MIDSCENE_GROUNDING_MODEL_SOCKS_PROXY, MIDSCENE_IOS_DEVICE_UDID, MIDSCENE_IOS_SIMULATOR_UDID, MIDSCENE_LANGSMITH_DEBUG, MIDSCENE_LOCATOR_MODE, MIDSCENE_MCP_ANDROID_MODE, MIDSCENE_MCP_CHROME_PATH, MIDSCENE_MCP_USE_PUPPETEER_MODE, MIDSCENE_MODEL_API_KEY, MIDSCENE_MODEL_BASE_URL, MIDSCENE_MODEL_HTTP_PROXY, MIDSCENE_MODEL_INIT_CONFIG_JSON, MIDSCENE_MODEL_NAME, MIDSCENE_MODEL_SOCKS_PROXY, MIDSCENE_PLANNING_LOCATOR_MODE, MIDSCENE_PLANNING_MODEL_API_KEY, MIDSCENE_PLANNING_MODEL_BASE_URL, MIDSCENE_PLANNING_MODEL_HTTP_PROXY, MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON, MIDSCENE_PLANNING_MODEL_NAME, MIDSCENE_PLANNING_MODEL_SOCKS_PROXY, MIDSCENE_PREFERRED_LANGUAGE, MIDSCENE_REPLANNING_CYCLE_LIMIT, 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, MIDSCENE_VQA_LOCATOR_MODE, MIDSCENE_VQA_MODEL_API_KEY, MIDSCENE_VQA_MODEL_BASE_URL, MIDSCENE_VQA_MODEL_HTTP_PROXY, MIDSCENE_VQA_MODEL_INIT_CONFIG_JSON, MIDSCENE_VQA_MODEL_NAME, MIDSCENE_VQA_MODEL_SOCKS_PROXY, MODEL_API_KEY, MODEL_BASE_URL, MODEL_ENV_KEYS, NUMBER_ENV_KEYS, OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_MAX_TOKENS, STRING_ENV_KEYS, types_UITarsModelVersion as UITarsModelVersion, UNUSED_ENV_KEYS, VL_MODE_RAW_VALID_VALUES };
|
|
@@ -33,47 +33,47 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
33
33
|
const external_types_js_namespaceObject = require("./types.js");
|
|
34
34
|
const VQA_MODEL_CONFIG_KEYS = {
|
|
35
35
|
modelName: external_types_js_namespaceObject.MIDSCENE_VQA_MODEL_NAME,
|
|
36
|
-
socksProxy: external_types_js_namespaceObject.
|
|
37
|
-
httpProxy: external_types_js_namespaceObject.
|
|
38
|
-
openaiBaseURL: external_types_js_namespaceObject.
|
|
39
|
-
openaiApiKey: external_types_js_namespaceObject.
|
|
40
|
-
openaiExtraConfig: external_types_js_namespaceObject.
|
|
41
|
-
vlMode: external_types_js_namespaceObject.
|
|
36
|
+
socksProxy: external_types_js_namespaceObject.MIDSCENE_VQA_MODEL_SOCKS_PROXY,
|
|
37
|
+
httpProxy: external_types_js_namespaceObject.MIDSCENE_VQA_MODEL_HTTP_PROXY,
|
|
38
|
+
openaiBaseURL: external_types_js_namespaceObject.MIDSCENE_VQA_MODEL_BASE_URL,
|
|
39
|
+
openaiApiKey: external_types_js_namespaceObject.MIDSCENE_VQA_MODEL_API_KEY,
|
|
40
|
+
openaiExtraConfig: external_types_js_namespaceObject.MIDSCENE_VQA_MODEL_INIT_CONFIG_JSON,
|
|
41
|
+
vlMode: external_types_js_namespaceObject.MIDSCENE_VQA_LOCATOR_MODE
|
|
42
42
|
};
|
|
43
43
|
const GROUNDING_MODEL_CONFIG_KEYS = {
|
|
44
44
|
modelName: external_types_js_namespaceObject.MIDSCENE_GROUNDING_MODEL_NAME,
|
|
45
|
-
socksProxy: external_types_js_namespaceObject.
|
|
46
|
-
httpProxy: external_types_js_namespaceObject.
|
|
47
|
-
openaiBaseURL: external_types_js_namespaceObject.
|
|
48
|
-
openaiApiKey: external_types_js_namespaceObject.
|
|
49
|
-
openaiExtraConfig: external_types_js_namespaceObject.
|
|
50
|
-
vlMode: external_types_js_namespaceObject.
|
|
45
|
+
socksProxy: external_types_js_namespaceObject.MIDSCENE_GROUNDING_MODEL_SOCKS_PROXY,
|
|
46
|
+
httpProxy: external_types_js_namespaceObject.MIDSCENE_GROUNDING_MODEL_HTTP_PROXY,
|
|
47
|
+
openaiBaseURL: external_types_js_namespaceObject.MIDSCENE_GROUNDING_MODEL_BASE_URL,
|
|
48
|
+
openaiApiKey: external_types_js_namespaceObject.MIDSCENE_GROUNDING_MODEL_API_KEY,
|
|
49
|
+
openaiExtraConfig: external_types_js_namespaceObject.MIDSCENE_GROUNDING_MODEL_INIT_CONFIG_JSON,
|
|
50
|
+
vlMode: external_types_js_namespaceObject.MIDSCENE_GROUNDING_LOCATOR_MODE
|
|
51
51
|
};
|
|
52
52
|
const PLANNING_MODEL_CONFIG_KEYS = {
|
|
53
53
|
modelName: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_NAME,
|
|
54
|
-
socksProxy: external_types_js_namespaceObject.
|
|
55
|
-
httpProxy: external_types_js_namespaceObject.
|
|
56
|
-
openaiBaseURL: external_types_js_namespaceObject.
|
|
57
|
-
openaiApiKey: external_types_js_namespaceObject.
|
|
58
|
-
openaiExtraConfig: external_types_js_namespaceObject.
|
|
59
|
-
vlMode: external_types_js_namespaceObject.
|
|
54
|
+
socksProxy: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_SOCKS_PROXY,
|
|
55
|
+
httpProxy: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_HTTP_PROXY,
|
|
56
|
+
openaiBaseURL: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_BASE_URL,
|
|
57
|
+
openaiApiKey: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_API_KEY,
|
|
58
|
+
openaiExtraConfig: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON,
|
|
59
|
+
vlMode: external_types_js_namespaceObject.MIDSCENE_PLANNING_LOCATOR_MODE
|
|
60
60
|
};
|
|
61
61
|
const DEFAULT_MODEL_CONFIG_KEYS = {
|
|
62
62
|
modelName: external_types_js_namespaceObject.MIDSCENE_MODEL_NAME,
|
|
63
|
-
socksProxy: external_types_js_namespaceObject.
|
|
64
|
-
httpProxy: external_types_js_namespaceObject.
|
|
65
|
-
openaiBaseURL: external_types_js_namespaceObject.
|
|
66
|
-
openaiApiKey: external_types_js_namespaceObject.
|
|
67
|
-
openaiExtraConfig: external_types_js_namespaceObject.
|
|
68
|
-
vlMode: external_types_js_namespaceObject.
|
|
63
|
+
socksProxy: external_types_js_namespaceObject.MIDSCENE_MODEL_SOCKS_PROXY,
|
|
64
|
+
httpProxy: external_types_js_namespaceObject.MIDSCENE_MODEL_HTTP_PROXY,
|
|
65
|
+
openaiBaseURL: external_types_js_namespaceObject.MIDSCENE_MODEL_BASE_URL,
|
|
66
|
+
openaiApiKey: external_types_js_namespaceObject.MIDSCENE_MODEL_API_KEY,
|
|
67
|
+
openaiExtraConfig: external_types_js_namespaceObject.MIDSCENE_MODEL_INIT_CONFIG_JSON,
|
|
68
|
+
vlMode: external_types_js_namespaceObject.MIDSCENE_LOCATOR_MODE
|
|
69
69
|
};
|
|
70
70
|
const DEFAULT_MODEL_CONFIG_KEYS_LEGACY = {
|
|
71
71
|
modelName: external_types_js_namespaceObject.MIDSCENE_MODEL_NAME,
|
|
72
|
-
socksProxy: external_types_js_namespaceObject.
|
|
73
|
-
httpProxy: external_types_js_namespaceObject.
|
|
72
|
+
socksProxy: external_types_js_namespaceObject.MIDSCENE_MODEL_SOCKS_PROXY,
|
|
73
|
+
httpProxy: external_types_js_namespaceObject.MIDSCENE_MODEL_HTTP_PROXY,
|
|
74
74
|
openaiBaseURL: external_types_js_namespaceObject.OPENAI_BASE_URL,
|
|
75
75
|
openaiApiKey: external_types_js_namespaceObject.OPENAI_API_KEY,
|
|
76
|
-
openaiExtraConfig: external_types_js_namespaceObject.
|
|
76
|
+
openaiExtraConfig: external_types_js_namespaceObject.MIDSCENE_MODEL_INIT_CONFIG_JSON,
|
|
77
77
|
vlMode: 'DEFAULT_MODEL_CONFIG_KEYS has no vlMode key'
|
|
78
78
|
};
|
|
79
79
|
exports.DEFAULT_MODEL_CONFIG_KEYS = __webpack_exports__.DEFAULT_MODEL_CONFIG_KEYS;
|
|
@@ -29,6 +29,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
decideOpenaiSdkConfig: ()=>decideOpenaiSdkConfig
|
|
30
30
|
});
|
|
31
31
|
const external_constants_js_namespaceObject = require("./constants.js");
|
|
32
|
+
const external_types_js_namespaceObject = require("./types.js");
|
|
32
33
|
const external_logger_js_namespaceObject = require("../logger.js");
|
|
33
34
|
const external_utils_js_namespaceObject = require("../utils.js");
|
|
34
35
|
const external_helper_js_namespaceObject = require("./helper.js");
|
|
@@ -47,8 +48,10 @@ const decideOpenaiSdkConfig = ({ keys, provider, valueAssert })=>{
|
|
|
47
48
|
const httpProxy = provider[keys.httpProxy];
|
|
48
49
|
const vlMode = provider[keys.vlMode];
|
|
49
50
|
debugLog('enter decideOpenaiSdkConfig with keys:', keys);
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
let openaiBaseURL;
|
|
52
|
+
let openaiApiKey;
|
|
53
|
+
openaiBaseURL = 'OPENAI_BASE_URL' === keys.openaiBaseURL ? provider[external_types_js_namespaceObject.MODEL_BASE_URL] || provider[keys.openaiBaseURL] : provider[keys.openaiBaseURL];
|
|
54
|
+
openaiApiKey = 'OPENAI_API_KEY' === keys.openaiApiKey ? provider[external_types_js_namespaceObject.MODEL_API_KEY] || provider[keys.openaiApiKey] : provider[keys.openaiApiKey];
|
|
52
55
|
const openaiExtraConfig = (0, external_helper_js_namespaceObject.parseJson)(keys.openaiExtraConfig, provider[keys.openaiExtraConfig]);
|
|
53
56
|
valueAssert(openaiApiKey, keys.openaiApiKey);
|
|
54
57
|
return {
|
|
@@ -30,15 +30,15 @@ const external_logger_js_namespaceObject = require("../logger.js");
|
|
|
30
30
|
const external_basic_js_namespaceObject = require("./basic.js");
|
|
31
31
|
const external_types_js_namespaceObject = require("./types.js");
|
|
32
32
|
const initDebugConfig = ()=>{
|
|
33
|
-
const shouldPrintTiming = (0, external_basic_js_namespaceObject.getBasicEnvValue)(external_types_js_namespaceObject.
|
|
33
|
+
const shouldPrintTiming = (0, external_basic_js_namespaceObject.getBasicEnvValue)(external_types_js_namespaceObject.MIDSCENE_DEBUG_MODEL_PROFILE);
|
|
34
34
|
let debugConfig = '';
|
|
35
35
|
if (shouldPrintTiming) {
|
|
36
|
-
console.warn('
|
|
36
|
+
console.warn('MIDSCENE_DEBUG_MODEL_PROFILE is deprecated, use DEBUG=midscene:ai:profile instead');
|
|
37
37
|
debugConfig = 'ai:profile';
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
console.warn('
|
|
39
|
+
const shouldPrintModelResponse = (0, external_basic_js_namespaceObject.getBasicEnvValue)(external_types_js_namespaceObject.MIDSCENE_DEBUG_MODEL_RESPONSE);
|
|
40
|
+
if (shouldPrintModelResponse) {
|
|
41
|
+
console.warn('MIDSCENE_DEBUG_MODEL_RESPONSE is deprecated, use DEBUG=midscene:ai:response instead');
|
|
42
42
|
debugConfig = debugConfig ? 'ai:*' : 'ai:call';
|
|
43
43
|
}
|
|
44
44
|
if (debugConfig) (0, external_logger_js_namespaceObject.enableDebug)(debugConfig);
|
|
@@ -141,7 +141,8 @@ Learn more: https://midscenejs.com/choose-a-model`);
|
|
|
141
141
|
this.createOpenAIClientFn = createOpenAIClientFn;
|
|
142
142
|
if (modelConfigFn) {
|
|
143
143
|
this.isolatedMode = true;
|
|
144
|
-
const
|
|
144
|
+
const internalFn = modelConfigFn;
|
|
145
|
+
const intentConfigMap = this.calcIntentConfigMap(internalFn);
|
|
145
146
|
this.modelConfigMap = this.calcModelConfigMapBaseOnIntent(intentConfigMap);
|
|
146
147
|
}
|
|
147
148
|
}
|