@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
package/src/env/types.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// config keys
|
|
2
|
-
export const
|
|
3
|
-
'
|
|
2
|
+
export const MIDSCENE_MODEL_INIT_CONFIG_JSON =
|
|
3
|
+
'MIDSCENE_MODEL_INIT_CONFIG_JSON';
|
|
4
4
|
export const MIDSCENE_MODEL_NAME = 'MIDSCENE_MODEL_NAME';
|
|
5
5
|
export const MIDSCENE_LANGSMITH_DEBUG = 'MIDSCENE_LANGSMITH_DEBUG';
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
6
|
+
export const MIDSCENE_DEBUG_MODEL_PROFILE = 'MIDSCENE_DEBUG_MODEL_PROFILE';
|
|
7
|
+
export const MIDSCENE_DEBUG_MODEL_RESPONSE = 'MIDSCENE_DEBUG_MODEL_RESPONSE';
|
|
8
8
|
export const MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG =
|
|
9
9
|
'MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG';
|
|
10
10
|
export const MIDSCENE_DEBUG_MODE = 'MIDSCENE_DEBUG_MODE';
|
|
@@ -15,9 +15,20 @@ export const MIDSCENE_MCP_ANDROID_MODE = 'MIDSCENE_MCP_ANDROID_MODE';
|
|
|
15
15
|
export const DOCKER_CONTAINER = 'DOCKER_CONTAINER';
|
|
16
16
|
export const MIDSCENE_FORCE_DEEP_THINK = 'MIDSCENE_FORCE_DEEP_THINK';
|
|
17
17
|
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
18
|
+
export const MIDSCENE_MODEL_SOCKS_PROXY = 'MIDSCENE_MODEL_SOCKS_PROXY';
|
|
19
|
+
export const MIDSCENE_MODEL_HTTP_PROXY = 'MIDSCENE_MODEL_HTTP_PROXY';
|
|
20
|
+
|
|
21
|
+
// New primary names for public API
|
|
22
|
+
export const MODEL_API_KEY = 'MODEL_API_KEY';
|
|
23
|
+
export const MODEL_BASE_URL = 'MODEL_BASE_URL';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Use MODEL_API_KEY instead. This is kept for backward compatibility.
|
|
27
|
+
*/
|
|
20
28
|
export const OPENAI_API_KEY = 'OPENAI_API_KEY';
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Use MODEL_BASE_URL instead. This is kept for backward compatibility.
|
|
31
|
+
*/
|
|
21
32
|
export const OPENAI_BASE_URL = 'OPENAI_BASE_URL';
|
|
22
33
|
export const OPENAI_MAX_TOKENS = 'OPENAI_MAX_TOKENS';
|
|
23
34
|
|
|
@@ -50,48 +61,48 @@ export const MIDSCENE_CACHE_MAX_FILENAME_LENGTH =
|
|
|
50
61
|
export const MIDSCENE_RUN_DIR = 'MIDSCENE_RUN_DIR';
|
|
51
62
|
|
|
52
63
|
// default new
|
|
53
|
-
export const
|
|
54
|
-
export const
|
|
55
|
-
export const
|
|
64
|
+
export const MIDSCENE_MODEL_BASE_URL = 'MIDSCENE_MODEL_BASE_URL';
|
|
65
|
+
export const MIDSCENE_MODEL_API_KEY = 'MIDSCENE_MODEL_API_KEY';
|
|
66
|
+
export const MIDSCENE_LOCATOR_MODE = 'MIDSCENE_LOCATOR_MODE';
|
|
56
67
|
|
|
57
68
|
// VQA
|
|
58
69
|
export const MIDSCENE_VQA_MODEL_NAME = 'MIDSCENE_VQA_MODEL_NAME';
|
|
59
|
-
export const
|
|
60
|
-
|
|
61
|
-
export const
|
|
62
|
-
export const
|
|
63
|
-
export const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
export const MIDSCENE_VQA_VL_MODE = 'MIDSCENE_VQA_VL_MODE';
|
|
70
|
+
export const MIDSCENE_VQA_MODEL_SOCKS_PROXY = 'MIDSCENE_VQA_MODEL_SOCKS_PROXY';
|
|
71
|
+
export const MIDSCENE_VQA_MODEL_HTTP_PROXY = 'MIDSCENE_VQA_MODEL_HTTP_PROXY';
|
|
72
|
+
export const MIDSCENE_VQA_MODEL_BASE_URL = 'MIDSCENE_VQA_MODEL_BASE_URL';
|
|
73
|
+
export const MIDSCENE_VQA_MODEL_API_KEY = 'MIDSCENE_VQA_MODEL_API_KEY';
|
|
74
|
+
export const MIDSCENE_VQA_MODEL_INIT_CONFIG_JSON =
|
|
75
|
+
'MIDSCENE_VQA_MODEL_INIT_CONFIG_JSON';
|
|
76
|
+
export const MIDSCENE_VQA_LOCATOR_MODE = 'MIDSCENE_VQA_LOCATOR_MODE';
|
|
67
77
|
|
|
68
78
|
// PLANNING
|
|
69
79
|
export const MIDSCENE_PLANNING_MODEL_NAME = 'MIDSCENE_PLANNING_MODEL_NAME';
|
|
70
|
-
export const
|
|
71
|
-
'
|
|
72
|
-
export const
|
|
73
|
-
'
|
|
74
|
-
export const
|
|
75
|
-
'
|
|
76
|
-
export const
|
|
77
|
-
'
|
|
78
|
-
export const
|
|
79
|
-
'
|
|
80
|
-
export const
|
|
80
|
+
export const MIDSCENE_PLANNING_MODEL_SOCKS_PROXY =
|
|
81
|
+
'MIDSCENE_PLANNING_MODEL_SOCKS_PROXY';
|
|
82
|
+
export const MIDSCENE_PLANNING_MODEL_HTTP_PROXY =
|
|
83
|
+
'MIDSCENE_PLANNING_MODEL_HTTP_PROXY';
|
|
84
|
+
export const MIDSCENE_PLANNING_MODEL_BASE_URL =
|
|
85
|
+
'MIDSCENE_PLANNING_MODEL_BASE_URL';
|
|
86
|
+
export const MIDSCENE_PLANNING_MODEL_API_KEY =
|
|
87
|
+
'MIDSCENE_PLANNING_MODEL_API_KEY';
|
|
88
|
+
export const MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON =
|
|
89
|
+
'MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON';
|
|
90
|
+
export const MIDSCENE_PLANNING_LOCATOR_MODE = 'MIDSCENE_PLANNING_LOCATOR_MODE';
|
|
81
91
|
|
|
82
92
|
// GROUNDING
|
|
83
93
|
export const MIDSCENE_GROUNDING_MODEL_NAME = 'MIDSCENE_GROUNDING_MODEL_NAME';
|
|
84
|
-
export const
|
|
85
|
-
'
|
|
86
|
-
export const
|
|
87
|
-
'
|
|
88
|
-
export const
|
|
89
|
-
'
|
|
90
|
-
export const
|
|
91
|
-
'
|
|
92
|
-
export const
|
|
93
|
-
'
|
|
94
|
-
export const
|
|
94
|
+
export const MIDSCENE_GROUNDING_MODEL_SOCKS_PROXY =
|
|
95
|
+
'MIDSCENE_GROUNDING_MODEL_SOCKS_PROXY';
|
|
96
|
+
export const MIDSCENE_GROUNDING_MODEL_HTTP_PROXY =
|
|
97
|
+
'MIDSCENE_GROUNDING_MODEL_HTTP_PROXY';
|
|
98
|
+
export const MIDSCENE_GROUNDING_MODEL_BASE_URL =
|
|
99
|
+
'MIDSCENE_GROUNDING_MODEL_BASE_URL';
|
|
100
|
+
export const MIDSCENE_GROUNDING_MODEL_API_KEY =
|
|
101
|
+
'MIDSCENE_GROUNDING_MODEL_API_KEY';
|
|
102
|
+
export const MIDSCENE_GROUNDING_MODEL_INIT_CONFIG_JSON =
|
|
103
|
+
'MIDSCENE_GROUNDING_MODEL_INIT_CONFIG_JSON';
|
|
104
|
+
export const MIDSCENE_GROUNDING_LOCATOR_MODE =
|
|
105
|
+
'MIDSCENE_GROUNDING_LOCATOR_MODE';
|
|
95
106
|
|
|
96
107
|
/**
|
|
97
108
|
* env keys declared but unused
|
|
@@ -104,8 +115,8 @@ export const UNUSED_ENV_KEYS = [MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG];
|
|
|
104
115
|
*/
|
|
105
116
|
export const BASIC_ENV_KEYS = [
|
|
106
117
|
MIDSCENE_DEBUG_MODE,
|
|
107
|
-
|
|
108
|
-
|
|
118
|
+
MIDSCENE_DEBUG_MODEL_PROFILE,
|
|
119
|
+
MIDSCENE_DEBUG_MODEL_RESPONSE,
|
|
109
120
|
MIDSCENE_RUN_DIR,
|
|
110
121
|
] as const;
|
|
111
122
|
|
|
@@ -156,45 +167,47 @@ export const GLOBAL_ENV_KEYS = [
|
|
|
156
167
|
export const MODEL_ENV_KEYS = [
|
|
157
168
|
// model default
|
|
158
169
|
MIDSCENE_MODEL_NAME,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
170
|
+
MIDSCENE_MODEL_INIT_CONFIG_JSON,
|
|
171
|
+
MIDSCENE_MODEL_API_KEY,
|
|
172
|
+
MIDSCENE_MODEL_BASE_URL,
|
|
173
|
+
MIDSCENE_MODEL_SOCKS_PROXY,
|
|
174
|
+
MIDSCENE_MODEL_HTTP_PROXY,
|
|
164
175
|
MIDSCENE_USE_VLM_UI_TARS,
|
|
165
176
|
MIDSCENE_USE_QWEN_VL,
|
|
166
177
|
MIDSCENE_USE_QWEN3_VL,
|
|
167
178
|
MIDSCENE_USE_DOUBAO_VISION,
|
|
168
179
|
MIDSCENE_USE_GEMINI,
|
|
169
180
|
MIDSCENE_USE_VL_MODEL,
|
|
170
|
-
|
|
181
|
+
MIDSCENE_LOCATOR_MODE,
|
|
171
182
|
// model default legacy
|
|
172
183
|
OPENAI_API_KEY,
|
|
173
184
|
OPENAI_BASE_URL,
|
|
185
|
+
MODEL_API_KEY,
|
|
186
|
+
MODEL_BASE_URL,
|
|
174
187
|
// VQA
|
|
175
188
|
MIDSCENE_VQA_MODEL_NAME,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
189
|
+
MIDSCENE_VQA_MODEL_SOCKS_PROXY,
|
|
190
|
+
MIDSCENE_VQA_MODEL_HTTP_PROXY,
|
|
191
|
+
MIDSCENE_VQA_MODEL_BASE_URL,
|
|
192
|
+
MIDSCENE_VQA_MODEL_API_KEY,
|
|
193
|
+
MIDSCENE_VQA_MODEL_INIT_CONFIG_JSON,
|
|
194
|
+
MIDSCENE_VQA_LOCATOR_MODE,
|
|
182
195
|
// PLANNING
|
|
183
196
|
MIDSCENE_PLANNING_MODEL_NAME,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
197
|
+
MIDSCENE_PLANNING_MODEL_SOCKS_PROXY,
|
|
198
|
+
MIDSCENE_PLANNING_MODEL_HTTP_PROXY,
|
|
199
|
+
MIDSCENE_PLANNING_MODEL_BASE_URL,
|
|
200
|
+
MIDSCENE_PLANNING_MODEL_API_KEY,
|
|
201
|
+
MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON,
|
|
202
|
+
MIDSCENE_PLANNING_LOCATOR_MODE,
|
|
190
203
|
// GROUNDING
|
|
191
204
|
MIDSCENE_GROUNDING_MODEL_NAME,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
205
|
+
MIDSCENE_GROUNDING_MODEL_SOCKS_PROXY,
|
|
206
|
+
MIDSCENE_GROUNDING_MODEL_HTTP_PROXY,
|
|
207
|
+
MIDSCENE_GROUNDING_MODEL_BASE_URL,
|
|
208
|
+
MIDSCENE_GROUNDING_MODEL_API_KEY,
|
|
209
|
+
MIDSCENE_GROUNDING_MODEL_INIT_CONFIG_JSON,
|
|
210
|
+
MIDSCENE_GROUNDING_LOCATOR_MODE,
|
|
198
211
|
] as const;
|
|
199
212
|
|
|
200
213
|
export const ALL_ENV_KEYS = [
|
|
@@ -227,14 +240,14 @@ export interface IModelConfigForVQA {
|
|
|
227
240
|
// model name
|
|
228
241
|
[MIDSCENE_VQA_MODEL_NAME]: string;
|
|
229
242
|
// proxy
|
|
230
|
-
[
|
|
231
|
-
[
|
|
243
|
+
[MIDSCENE_VQA_MODEL_SOCKS_PROXY]?: string;
|
|
244
|
+
[MIDSCENE_VQA_MODEL_HTTP_PROXY]?: string;
|
|
232
245
|
// OpenAI
|
|
233
|
-
[
|
|
234
|
-
[
|
|
235
|
-
[
|
|
246
|
+
[MIDSCENE_VQA_MODEL_BASE_URL]?: string;
|
|
247
|
+
[MIDSCENE_VQA_MODEL_API_KEY]?: string;
|
|
248
|
+
[MIDSCENE_VQA_MODEL_INIT_CONFIG_JSON]?: string;
|
|
236
249
|
// extra
|
|
237
|
-
[
|
|
250
|
+
[MIDSCENE_VQA_LOCATOR_MODE]?: TVlModeValues;
|
|
238
251
|
}
|
|
239
252
|
|
|
240
253
|
/**
|
|
@@ -243,7 +256,7 @@ export interface IModelConfigForVQA {
|
|
|
243
256
|
* IMPORTANT: Planning MUST use a vision language model (VL mode).
|
|
244
257
|
* DOM-based planning is not supported.
|
|
245
258
|
*
|
|
246
|
-
* Required:
|
|
259
|
+
* Required: MIDSCENE_PLANNING_LOCATOR_MODE must be set to one of:
|
|
247
260
|
* - 'qwen-vl'
|
|
248
261
|
* - 'qwen3-vl'
|
|
249
262
|
* - 'gemini'
|
|
@@ -256,56 +269,56 @@ export interface IModelConfigForPlanning {
|
|
|
256
269
|
// model name
|
|
257
270
|
[MIDSCENE_PLANNING_MODEL_NAME]: string;
|
|
258
271
|
// proxy
|
|
259
|
-
[
|
|
260
|
-
[
|
|
272
|
+
[MIDSCENE_PLANNING_MODEL_SOCKS_PROXY]?: string;
|
|
273
|
+
[MIDSCENE_PLANNING_MODEL_HTTP_PROXY]?: string;
|
|
261
274
|
// OpenAI
|
|
262
|
-
[
|
|
263
|
-
[
|
|
264
|
-
[
|
|
275
|
+
[MIDSCENE_PLANNING_MODEL_BASE_URL]?: string;
|
|
276
|
+
[MIDSCENE_PLANNING_MODEL_API_KEY]?: string;
|
|
277
|
+
[MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON]?: string;
|
|
265
278
|
// extra
|
|
266
|
-
[
|
|
279
|
+
[MIDSCENE_PLANNING_LOCATOR_MODE]?: TVlModeValues;
|
|
267
280
|
}
|
|
268
281
|
|
|
269
282
|
export interface IModeConfigForGrounding {
|
|
270
283
|
// model name
|
|
271
284
|
[MIDSCENE_GROUNDING_MODEL_NAME]: string;
|
|
272
285
|
// proxy
|
|
273
|
-
[
|
|
274
|
-
[
|
|
286
|
+
[MIDSCENE_GROUNDING_MODEL_SOCKS_PROXY]?: string;
|
|
287
|
+
[MIDSCENE_GROUNDING_MODEL_HTTP_PROXY]?: string;
|
|
275
288
|
// OpenAI
|
|
276
|
-
[
|
|
277
|
-
[
|
|
278
|
-
[
|
|
289
|
+
[MIDSCENE_GROUNDING_MODEL_BASE_URL]?: string;
|
|
290
|
+
[MIDSCENE_GROUNDING_MODEL_API_KEY]?: string;
|
|
291
|
+
[MIDSCENE_GROUNDING_MODEL_INIT_CONFIG_JSON]?: string;
|
|
279
292
|
// extra
|
|
280
|
-
[
|
|
293
|
+
[MIDSCENE_GROUNDING_LOCATOR_MODE]?: TVlModeValues;
|
|
281
294
|
}
|
|
282
295
|
|
|
283
296
|
export interface IModelConfigForDefault {
|
|
284
297
|
// model name
|
|
285
298
|
[MIDSCENE_MODEL_NAME]: string;
|
|
286
299
|
// proxy
|
|
287
|
-
[
|
|
288
|
-
[
|
|
300
|
+
[MIDSCENE_MODEL_SOCKS_PROXY]?: string;
|
|
301
|
+
[MIDSCENE_MODEL_HTTP_PROXY]?: string;
|
|
289
302
|
// OpenAI
|
|
290
|
-
[
|
|
291
|
-
[
|
|
292
|
-
[
|
|
303
|
+
[MIDSCENE_MODEL_BASE_URL]?: string;
|
|
304
|
+
[MIDSCENE_MODEL_API_KEY]?: string;
|
|
305
|
+
[MIDSCENE_MODEL_INIT_CONFIG_JSON]?: string;
|
|
293
306
|
// extra
|
|
294
|
-
[
|
|
307
|
+
[MIDSCENE_LOCATOR_MODE]?: TVlModeValues;
|
|
295
308
|
}
|
|
296
309
|
|
|
297
310
|
export interface IModelConfigForDefaultLegacy {
|
|
298
311
|
// model name
|
|
299
312
|
[MIDSCENE_MODEL_NAME]: string;
|
|
300
313
|
// proxy
|
|
301
|
-
[
|
|
302
|
-
[
|
|
314
|
+
[MIDSCENE_MODEL_SOCKS_PROXY]?: string;
|
|
315
|
+
[MIDSCENE_MODEL_HTTP_PROXY]?: string;
|
|
303
316
|
// OpenAI
|
|
304
317
|
[OPENAI_BASE_URL]?: string;
|
|
305
318
|
[OPENAI_API_KEY]?: string;
|
|
306
|
-
[
|
|
319
|
+
[MIDSCENE_MODEL_INIT_CONFIG_JSON]?: string;
|
|
307
320
|
// extra
|
|
308
|
-
[
|
|
321
|
+
[MIDSCENE_LOCATOR_MODE]?: TVlModeValues;
|
|
309
322
|
}
|
|
310
323
|
|
|
311
324
|
/**
|
|
@@ -316,7 +329,11 @@ export interface IModelConfigForDefaultLegacy {
|
|
|
316
329
|
*/
|
|
317
330
|
export type TIntent = 'VQA' | 'planning' | 'grounding' | 'default';
|
|
318
331
|
|
|
319
|
-
|
|
332
|
+
/**
|
|
333
|
+
* Internal type with intent parameter for ModelConfigManager
|
|
334
|
+
* @internal
|
|
335
|
+
*/
|
|
336
|
+
export type TModelConfigFnInternal = (options: {
|
|
320
337
|
intent: TIntent;
|
|
321
338
|
}) =>
|
|
322
339
|
| IModelConfigForVQA
|
|
@@ -324,6 +341,16 @@ export type TModelConfigFn = (options: {
|
|
|
324
341
|
| IModeConfigForGrounding
|
|
325
342
|
| IModelConfigForDefault;
|
|
326
343
|
|
|
344
|
+
/**
|
|
345
|
+
* User-facing model config function type
|
|
346
|
+
* Users return config objects without needing to know about intent parameter
|
|
347
|
+
*/
|
|
348
|
+
export type TModelConfigFn = () =>
|
|
349
|
+
| IModelConfigForVQA
|
|
350
|
+
| IModelConfigForPlanning
|
|
351
|
+
| IModeConfigForGrounding
|
|
352
|
+
| IModelConfigForDefault;
|
|
353
|
+
|
|
327
354
|
export enum UITarsModelVersion {
|
|
328
355
|
V1_0 = '1.0',
|
|
329
356
|
V1_5 = '1.5',
|