@midscene/core 0.14.3 → 0.14.4-beta-20250415065130.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.
Files changed (45) hide show
  1. package/dist/es/ai-model.d.ts +3 -3
  2. package/dist/es/ai-model.js +2 -2
  3. package/dist/es/{chunk-SAXMKI7Z.js → chunk-6MPYG6WR.js} +3 -3
  4. package/dist/es/{chunk-UBGEKXK7.js → chunk-6SYVFZ6C.js} +4 -1
  5. package/dist/es/chunk-6SYVFZ6C.js.map +1 -0
  6. package/dist/es/{chunk-5EO33FHK.js → chunk-QX6K65KH.js} +2 -2
  7. package/dist/es/env.d.ts +1 -1
  8. package/dist/es/env.js +1 -1
  9. package/dist/es/index.d.ts +4 -4
  10. package/dist/es/index.js +3 -3
  11. package/dist/es/{llm-planning-bd80e99e.d.ts → llm-planning-d084250f.d.ts} +1 -1
  12. package/dist/es/tree.d.ts +1 -1
  13. package/dist/{lib/types-e2a418c3.d.ts → es/types-d2831105.d.ts} +12 -3
  14. package/dist/es/utils.d.ts +1 -1
  15. package/dist/es/utils.js +2 -2
  16. package/dist/lib/ai-model.d.ts +3 -3
  17. package/dist/lib/ai-model.js +3 -3
  18. package/dist/lib/{chunk-SAXMKI7Z.js → chunk-6MPYG6WR.js} +5 -5
  19. package/dist/lib/{chunk-UBGEKXK7.js → chunk-6SYVFZ6C.js} +4 -1
  20. package/dist/lib/chunk-6SYVFZ6C.js.map +1 -0
  21. package/dist/lib/{chunk-5EO33FHK.js → chunk-QX6K65KH.js} +48 -48
  22. package/dist/lib/env.d.ts +1 -1
  23. package/dist/lib/env.js +2 -2
  24. package/dist/lib/index.d.ts +4 -4
  25. package/dist/lib/index.js +20 -20
  26. package/dist/lib/{llm-planning-bd80e99e.d.ts → llm-planning-d084250f.d.ts} +1 -1
  27. package/dist/lib/tree.d.ts +1 -1
  28. package/dist/{es/types-e2a418c3.d.ts → lib/types-d2831105.d.ts} +12 -3
  29. package/dist/lib/utils.d.ts +1 -1
  30. package/dist/lib/utils.js +3 -3
  31. package/dist/types/ai-model.d.ts +3 -3
  32. package/dist/types/env.d.ts +1 -1
  33. package/dist/types/index.d.ts +4 -4
  34. package/dist/types/{llm-planning-bd80e99e.d.ts → llm-planning-d084250f.d.ts} +1 -1
  35. package/dist/types/tree.d.ts +1 -1
  36. package/dist/types/{types-e2a418c3.d.ts → types-d2831105.d.ts} +12 -3
  37. package/dist/types/utils.d.ts +1 -1
  38. package/package.json +2 -2
  39. package/report/index.html +19 -19
  40. package/dist/es/chunk-UBGEKXK7.js.map +0 -1
  41. package/dist/lib/chunk-UBGEKXK7.js.map +0 -1
  42. /package/dist/es/{chunk-SAXMKI7Z.js.map → chunk-6MPYG6WR.js.map} +0 -0
  43. /package/dist/es/{chunk-5EO33FHK.js.map → chunk-QX6K65KH.js.map} +0 -0
  44. /package/dist/lib/{chunk-SAXMKI7Z.js.map → chunk-6MPYG6WR.js.map} +0 -0
  45. /package/dist/lib/{chunk-5EO33FHK.js.map → chunk-QX6K65KH.js.map} +0 -0
@@ -1,8 +1,8 @@
1
- import { k as AIUsageInfo, Q as PlanningAction } from './types-e2a418c3.js';
1
+ import { k as AIUsageInfo, Q as PlanningAction } from './types-d2831105.js';
2
2
  import { ChatCompletionMessageParam } from 'openai/resources';
3
3
  export { ChatCompletionMessageParam } from 'openai/resources';
4
- import { b as AIActionType } from './llm-planning-bd80e99e.js';
5
- export { a as AiAssert, e as AiExtractElementInfo, A as AiLocateElement, f as AiLocateSection, g as adaptBboxToRect, c as callAiFn, d as describeUserPage, p as plan } from './llm-planning-bd80e99e.js';
4
+ import { b as AIActionType } from './llm-planning-d084250f.js';
5
+ export { a as AiAssert, e as AiExtractElementInfo, A as AiLocateElement, f as AiLocateSection, g as adaptBboxToRect, c as callAiFn, d as describeUserPage, p as plan } from './llm-planning-d084250f.js';
6
6
  import { actionParser } from '@ui-tars/action-parser';
7
7
  import '@midscene/shared/constants';
8
8
 
@@ -10,8 +10,8 @@ import {
10
10
  plan,
11
11
  systemPromptToLocateElement,
12
12
  vlmPlanning
13
- } from "./chunk-5EO33FHK.js";
14
- import "./chunk-UBGEKXK7.js";
13
+ } from "./chunk-QX6K65KH.js";
14
+ import "./chunk-6SYVFZ6C.js";
15
15
  export {
16
16
  AiAssert,
17
17
  AiExtractElementInfo,
@@ -3,7 +3,7 @@ import {
3
3
  MIDSCENE_OPENAI_INIT_CONFIG_JSON,
4
4
  getAIConfig,
5
5
  getAIConfigInJson
6
- } from "./chunk-UBGEKXK7.js";
6
+ } from "./chunk-6SYVFZ6C.js";
7
7
 
8
8
  // src/utils.ts
9
9
  import { execSync } from "child_process";
@@ -201,7 +201,7 @@ function stringifyDumpData(data, indents) {
201
201
  return JSON.stringify(data, replacerForPageObject, indents);
202
202
  }
203
203
  function getVersion() {
204
- return "0.14.3";
204
+ return "0.14.4-beta-20250415065130.0";
205
205
  }
206
206
  function debugLog(...message) {
207
207
  const debugMode = getAIConfig(MIDSCENE_DEBUG_MODE);
@@ -267,4 +267,4 @@ export {
267
267
  uploadTestInfoToServer
268
268
  };
269
269
 
270
- //# sourceMappingURL=chunk-SAXMKI7Z.js.map
270
+ //# sourceMappingURL=chunk-6MPYG6WR.js.map
@@ -78,6 +78,9 @@ var vlLocateMode = () => {
78
78
  if (getAIConfigInBoolean(MIDSCENE_USE_VL_MODEL)) {
79
79
  return "vl-model";
80
80
  }
81
+ if (getAIConfigInBoolean(MIDSCENE_USE_VLM_UI_TARS)) {
82
+ return "vlm-ui-tars";
83
+ }
81
84
  return false;
82
85
  };
83
86
  var getAIConfig = (configKey) => {
@@ -167,4 +170,4 @@ export {
167
170
  overrideAIConfig
168
171
  };
169
172
 
170
- //# sourceMappingURL=chunk-UBGEKXK7.js.map
173
+ //# sourceMappingURL=chunk-6SYVFZ6C.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"mappings":";AACO,IAAM,mCACX;AACK,IAAM,sBAAsB;AAC5B,IAAM,2BAA2B;AACjC,IAAM,4BA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;AACA,QAAI,OAAO,UAAU,GAA6B,MAAM,UAAU;AAChE,YAAM,IAAI;AAAA,QACR,wDAAwD,GAAG,YAAY,UAAU,GAA6B,CAAC;AAAA,MACjH;AAAA,IACF;AAAA,EACF;AAEA,eAAa,aAAa,EAAE,GAAG,YAAY,GAAG,UAAU,IAAI,EAAE,GAAG,UAAU;AAC7E","names":[],"ignoreList":[],"sources":["../../src/env.ts"],"sourcesContent":["// config keys\nexport const MIDSCENE_OPENAI_INIT_CONFIG_JSON =\n 'MIDSCENE_OPENAI_INIT_CONFIG_JSON';\nexport const MIDSCENE_MODEL_NAME = 'MIDSCENE_MODEL_NAME';\nexport const MIDSCENE_LANGSMITH_DEBUG = 'MIDSCENE_LANGSMITH_DEBUG';\nexport const MIDSCENE_DEBUG_AI_PROFILE = 'MIDSCENE_DEBUG_AI_PROFILE';\nexport const MIDSCENE_DEBUG_AI_RESPONSE = 'MIDSCENE_DEBUG_AI_RESPONSE';\nexport const MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG =\n 'MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG';\nexport const MIDSCENE_DEBUG_MODE = 'MIDSCENE_DEBUG_MODE';\n\nexport const MIDSCENE_FORCE_DEEP_THINK = 'MIDSCENE_FORCE_DEEP_THINK';\n\nexport const MIDSCENE_OPENAI_SOCKS_PROXY = 'MIDSCENE_OPENAI_SOCKS_PROXY';\nexport const OPENAI_API_KEY = 'OPENAI_API_KEY';\nexport const OPENAI_BASE_URL = 'OPENAI_BASE_URL';\nexport const OPENAI_MAX_TOKENS = 'OPENAI_MAX_TOKENS';\n\nexport const MIDSCENE_CACHE = 'MIDSCENE_CACHE';\nexport const MIDSCENE_USE_VLM_UI_TARS = 'MIDSCENE_USE_VLM_UI_TARS';\nexport const MIDSCENE_USE_QWEN_VL = 'MIDSCENE_USE_QWEN_VL';\nexport const MIDSCENE_USE_DOUBAO_VISION = 'MIDSCENE_USE_DOUBAO_VISION';\nexport const MIDSCENE_USE_VL_MODEL = 'MIDSCENE_USE_VL_MODEL';\nexport const MATCH_BY_POSITION = 'MATCH_BY_POSITION';\nexport const MIDSCENE_API_TYPE = 'MIDSCENE-API-TYPE';\nexport const MIDSCENE_REPORT_TAG_NAME = 'MIDSCENE_REPORT_TAG_NAME';\n\nexport const MIDSCENE_USE_AZURE_OPENAI = 'MIDSCENE_USE_AZURE_OPENAI';\nexport const MIDSCENE_AZURE_OPENAI_SCOPE = 'MIDSCENE_AZURE_OPENAI_SCOPE';\nexport const MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON =\n 'MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON';\n\nexport const AZURE_OPENAI_ENDPOINT = 'AZURE_OPENAI_ENDPOINT';\nexport const AZURE_OPENAI_KEY = 'AZURE_OPENAI_KEY';\nexport const AZURE_OPENAI_API_VERSION = 'AZURE_OPENAI_API_VERSION';\nexport const AZURE_OPENAI_DEPLOYMENT = 'AZURE_OPENAI_DEPLOYMENT';\n\nexport const MIDSCENE_USE_ANTHROPIC_SDK = 'MIDSCENE_USE_ANTHROPIC_SDK';\nexport const ANTHROPIC_API_KEY = 'ANTHROPIC_API_KEY';\n\n// @deprecated\nexport const OPENAI_USE_AZURE = 'OPENAI_USE_AZURE';\n\nconst allConfigFromEnv = () => {\n return {\n [MIDSCENE_OPENAI_INIT_CONFIG_JSON]:\n process.env[MIDSCENE_OPENAI_INIT_CONFIG_JSON] || undefined,\n [MIDSCENE_MODEL_NAME]: process.env[MIDSCENE_MODEL_NAME] || undefined,\n [MIDSCENE_DEBUG_MODE]: process.env[MIDSCENE_DEBUG_MODE] || undefined,\n [MIDSCENE_FORCE_DEEP_THINK]:\n process.env[MIDSCENE_FORCE_DEEP_THINK] || undefined,\n [MIDSCENE_LANGSMITH_DEBUG]:\n process.env[MIDSCENE_LANGSMITH_DEBUG] || undefined,\n [MIDSCENE_DEBUG_AI_PROFILE]:\n process.env[MIDSCENE_DEBUG_AI_PROFILE] || undefined,\n [MIDSCENE_DEBUG_AI_RESPONSE]:\n process.env[MIDSCENE_DEBUG_AI_RESPONSE] || undefined,\n [MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG]:\n process.env[MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG] || undefined,\n [OPENAI_API_KEY]: process.env[OPENAI_API_KEY] || undefined,\n [OPENAI_BASE_URL]: process.env[OPENAI_BASE_URL] || undefined,\n [OPENAI_MAX_TOKENS]: process.env[OPENAI_MAX_TOKENS] || undefined,\n [OPENAI_USE_AZURE]: process.env[OPENAI_USE_AZURE] || undefined,\n [MIDSCENE_CACHE]: process.env[MIDSCENE_CACHE] || undefined,\n [MATCH_BY_POSITION]: process.env[MATCH_BY_POSITION] || undefined,\n [MIDSCENE_REPORT_TAG_NAME]:\n process.env[MIDSCENE_REPORT_TAG_NAME] || undefined,\n [MIDSCENE_OPENAI_SOCKS_PROXY]:\n process.env[MIDSCENE_OPENAI_SOCKS_PROXY] || undefined,\n [MIDSCENE_USE_AZURE_OPENAI]:\n process.env[MIDSCENE_USE_AZURE_OPENAI] || undefined,\n [MIDSCENE_AZURE_OPENAI_SCOPE]:\n process.env[MIDSCENE_AZURE_OPENAI_SCOPE] || undefined,\n [MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON]:\n process.env[MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON] || undefined,\n [MIDSCENE_USE_ANTHROPIC_SDK]:\n process.env[MIDSCENE_USE_ANTHROPIC_SDK] || undefined,\n [MIDSCENE_USE_VLM_UI_TARS]:\n process.env[MIDSCENE_USE_VLM_UI_TARS] || undefined,\n [MIDSCENE_USE_QWEN_VL]: process.env[MIDSCENE_USE_QWEN_VL] || undefined,\n [MIDSCENE_USE_DOUBAO_VISION]:\n process.env[MIDSCENE_USE_DOUBAO_VISION] || undefined,\n [MIDSCENE_USE_VL_MODEL]: process.env[MIDSCENE_USE_VL_MODEL] || undefined,\n [ANTHROPIC_API_KEY]: process.env[ANTHROPIC_API_KEY] || undefined,\n [AZURE_OPENAI_ENDPOINT]: process.env[AZURE_OPENAI_ENDPOINT] || undefined,\n [AZURE_OPENAI_KEY]: process.env[AZURE_OPENAI_KEY] || undefined,\n [AZURE_OPENAI_API_VERSION]:\n process.env[AZURE_OPENAI_API_VERSION] || undefined,\n [AZURE_OPENAI_DEPLOYMENT]:\n process.env[AZURE_OPENAI_DEPLOYMENT] || undefined,\n };\n};\n\nlet userConfig: Partial<ReturnType<typeof allConfigFromEnv>> = {};\n\nexport const vlLocateMode = ():\n | 'qwen-vl'\n | 'doubao-vision'\n | 'vl-model'\n | 'vlm-ui-tars'\n | false => {\n if (\n getAIConfigInBoolean(MIDSCENE_USE_DOUBAO_VISION) &&\n getAIConfigInBoolean(MIDSCENE_USE_QWEN_VL)\n ) {\n throw new Error(\n 'MIDSCENE_USE_DOUBAO_VISION and MIDSCENE_USE_QWEN_VL cannot be true at the same time',\n );\n }\n\n if (getAIConfigInBoolean(MIDSCENE_USE_QWEN_VL)) {\n return 'qwen-vl';\n }\n\n if (getAIConfigInBoolean(MIDSCENE_USE_DOUBAO_VISION)) {\n return 'doubao-vision';\n }\n\n if (getAIConfigInBoolean(MIDSCENE_USE_VL_MODEL)) {\n return 'vl-model';\n }\n\n if (getAIConfigInBoolean(MIDSCENE_USE_VLM_UI_TARS)) {\n return 'vlm-ui-tars';\n }\n\n return false;\n};\n\nexport const getAIConfig = (\n configKey: keyof typeof userConfig,\n): string | undefined => {\n if (configKey === MATCH_BY_POSITION) {\n throw new Error(\n 'MATCH_BY_POSITION is deprecated, use MIDSCENE_USE_VL_MODEL instead',\n );\n }\n\n if (typeof userConfig[configKey] !== 'undefined') {\n if (typeof userConfig[configKey] === 'string') {\n return userConfig[configKey]?.trim();\n }\n return userConfig[configKey];\n }\n return allConfigFromEnv()[configKey]?.trim();\n};\n\nexport const getAIConfigInBoolean = (configKey: keyof typeof userConfig) => {\n const config = getAIConfig(configKey) || '';\n return /^(true|1)$/i.test(config);\n};\n\nexport const getAIConfigInJson = (configKey: keyof typeof userConfig) => {\n const config = getAIConfig(configKey);\n try {\n return config ? JSON.parse(config) : undefined;\n } catch (error: any) {\n throw new Error(\n `Failed to parse json config: ${configKey}. ${error.message}`,\n {\n cause: error,\n },\n );\n }\n};\n\nexport const allAIConfig = () => {\n return { ...allConfigFromEnv(), ...userConfig };\n};\n\nexport const overrideAIConfig = (\n newConfig: Partial<ReturnType<typeof allConfigFromEnv>>,\n extendMode?: boolean,\n) => {\n for (const key in newConfig) {\n if (typeof key !== 'string') {\n throw new Error(`Failed to override AI config, invalid key: ${key}`);\n }\n if (typeof newConfig[key as keyof typeof newConfig] === 'object') {\n throw new Error(\n `Failed to override AI config, invalid value for key: ${key}, value: ${newConfig[key as keyof typeof newConfig]}`,\n );\n }\n }\n\n userConfig = extendMode ? { ...userConfig, ...newConfig } : { ...newConfig };\n};\n"]}
@@ -25,7 +25,7 @@ import {
25
25
  getAIConfigInBoolean,
26
26
  getAIConfigInJson,
27
27
  vlLocateMode
28
- } from "./chunk-UBGEKXK7.js";
28
+ } from "./chunk-6SYVFZ6C.js";
29
29
 
30
30
  // src/ai-model/service-caller/index.ts
31
31
  import { Anthropic } from "@anthropic-ai/sdk";
@@ -1888,4 +1888,4 @@ export {
1888
1888
  vlmPlanning
1889
1889
  };
1890
1890
 
1891
- //# sourceMappingURL=chunk-5EO33FHK.js.map
1891
+ //# sourceMappingURL=chunk-QX6K65KH.js.map
package/dist/es/env.d.ts CHANGED
@@ -60,7 +60,7 @@ declare const allConfigFromEnv: () => {
60
60
  AZURE_OPENAI_DEPLOYMENT: string | undefined;
61
61
  };
62
62
  declare let userConfig: Partial<ReturnType<typeof allConfigFromEnv>>;
63
- declare const vlLocateMode: () => "qwen-vl" | "doubao-vision" | "vl-model" | false;
63
+ declare const vlLocateMode: () => "qwen-vl" | "doubao-vision" | "vl-model" | "vlm-ui-tars" | false;
64
64
  declare const getAIConfig: (configKey: keyof typeof userConfig) => string | undefined;
65
65
  declare const getAIConfigInBoolean: (configKey: keyof typeof userConfig) => boolean;
66
66
  declare const getAIConfigInJson: (configKey: keyof typeof userConfig) => any;
package/dist/es/env.js CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  getAIConfigInJson,
36
36
  overrideAIConfig,
37
37
  vlLocateMode
38
- } from "./chunk-UBGEKXK7.js";
38
+ } from "./chunk-6SYVFZ6C.js";
39
39
  export {
40
40
  ANTHROPIC_API_KEY,
41
41
  AZURE_OPENAI_API_VERSION,
@@ -1,7 +1,7 @@
1
- import { E as ExecutionTask, a as ExecutionTaskProgressOptions, b as ExecutionTaskApply, c as ExecutionDump, B as BaseElement, U as UIContext, I as InsightAction, D as DumpSubscriber, d as InsightTaskInfo, e as InsightOptions, f as DetailedLocateParam, L as LocateResult, g as InsightAssertionResponse, A as AISingleElementResponse } from './types-e2a418c3.js';
2
- export { t as AIAssertionResponse, r as AIDataExtractionResponse, p as AIElementCoordinatesResponse, o as AIElementLocatorResponse, q as AIElementResponse, l as AIResponseFormat, s as AISectionLocatorResponse, m as AISingleElementResponseById, n as AISingleElementResponseByPosition, k as AIUsageInfo, K as AgentAssertOpt, J as AgentWaitForOpt, a2 as BaseAgentParserOpt, C as CallAIFn, a1 as Color, x as DumpMeta, H as ElementById, j as ElementTreeNode, u as EnsureObject, a5 as ExecutionRecorderItem, an as ExecutionTaskAction, am as ExecutionTaskActionApply, al as ExecutionTaskInsightAssertion, ak as ExecutionTaskInsightAssertionApply, aj as ExecutionTaskInsightAssertionParam, ac as ExecutionTaskInsightDumpLog, ae as ExecutionTaskInsightLocate, ad as ExecutionTaskInsightLocateApply, ab as ExecutionTaskInsightLocateOutput, aa as ExecutionTaskInsightLocateParam, ai as ExecutionTaskInsightQuery, ah as ExecutionTaskInsightQueryApply, ag as ExecutionTaskInsightQueryOutput, af as ExecutionTaskInsightQueryParam, ap as ExecutionTaskPlanning, ao as ExecutionTaskPlanningApply, a9 as ExecutionTaskReturn, a6 as ExecutionTaskType, a7 as ExecutorContext, aE as FreeFn, aq as GroupedActionDump, z as InsightDump, v as InsightExtractParam, G as LiteUISection, ar as LocateOption, w as LocateResultElement, i as MidsceneYamlFlowItem, au as MidsceneYamlFlowItemAIAction, av as MidsceneYamlFlowItemAIAssert, az as MidsceneYamlFlowItemAIHover, aA as MidsceneYamlFlowItemAIInput, aB as MidsceneYamlFlowItemAIKeyboardPress, aw as MidsceneYamlFlowItemAIQuery, aC as MidsceneYamlFlowItemAIScroll, ay as MidsceneYamlFlowItemAITap, ax as MidsceneYamlFlowItemAIWaitFor, aD as MidsceneYamlFlowItemSleep, M as MidsceneYamlScript, at as MidsceneYamlScriptEnv, h as MidsceneYamlTask, O as OnTaskStartTip, F as PartialInsightDumpFromSDK, T as PlanningAIResponse, Q as PlanningAction, Z as PlanningActionParamAssert, $ as PlanningActionParamError, W as PlanningActionParamHover, X as PlanningActionParamInputOrKeyPress, Y as PlanningActionParamScroll, _ as PlanningActionParamSleep, V as PlanningActionParamTap, a0 as PlanningActionParamWaitFor, N as PlanningLocateParam, a4 as PlaywrightParserOpt, P as Point, a3 as PuppeteerParserOpt, R as Rect, y as ReportDumpWithAttributes, aG as ScriptPlayerStatusValue, aF as ScriptPlayerTaskStatus, S as Size, a8 as TaskCacheInfo, as as scrollParam } from './types-e2a418c3.js';
3
- import { c as callAiFn } from './llm-planning-bd80e99e.js';
4
- export { a as AiAssert, A as AiLocateElement, d as describeUserPage, p as plan } from './llm-planning-bd80e99e.js';
1
+ import { E as ExecutionTask, a as ExecutionTaskProgressOptions, b as ExecutionTaskApply, c as ExecutionDump, B as BaseElement, U as UIContext, I as InsightAction, D as DumpSubscriber, d as InsightTaskInfo, e as InsightOptions, f as DetailedLocateParam, L as LocateResult, g as InsightAssertionResponse, A as AISingleElementResponse } from './types-d2831105.js';
2
+ export { t as AIAssertionResponse, r as AIDataExtractionResponse, p as AIElementCoordinatesResponse, o as AIElementLocatorResponse, q as AIElementResponse, l as AIResponseFormat, s as AISectionLocatorResponse, m as AISingleElementResponseById, n as AISingleElementResponseByPosition, k as AIUsageInfo, K as AgentAssertOpt, J as AgentWaitForOpt, a2 as BaseAgentParserOpt, C as CallAIFn, a1 as Color, x as DumpMeta, H as ElementById, j as ElementTreeNode, u as EnsureObject, a5 as ExecutionRecorderItem, an as ExecutionTaskAction, am as ExecutionTaskActionApply, al as ExecutionTaskInsightAssertion, ak as ExecutionTaskInsightAssertionApply, aj as ExecutionTaskInsightAssertionParam, ac as ExecutionTaskInsightDumpLog, ae as ExecutionTaskInsightLocate, ad as ExecutionTaskInsightLocateApply, ab as ExecutionTaskInsightLocateOutput, aa as ExecutionTaskInsightLocateParam, ai as ExecutionTaskInsightQuery, ah as ExecutionTaskInsightQueryApply, ag as ExecutionTaskInsightQueryOutput, af as ExecutionTaskInsightQueryParam, ap as ExecutionTaskPlanning, ao as ExecutionTaskPlanningApply, a9 as ExecutionTaskReturn, a6 as ExecutionTaskType, a7 as ExecutorContext, aH as FreeFn, aq as GroupedActionDump, z as InsightDump, v as InsightExtractParam, G as LiteUISection, ar as LocateOption, w as LocateResultElement, i as MidsceneYamlFlowItem, ax as MidsceneYamlFlowItemAIAction, ay as MidsceneYamlFlowItemAIAssert, aC as MidsceneYamlFlowItemAIHover, aD as MidsceneYamlFlowItemAIInput, aE as MidsceneYamlFlowItemAIKeyboardPress, az as MidsceneYamlFlowItemAIQuery, aF as MidsceneYamlFlowItemAIScroll, aB as MidsceneYamlFlowItemAITap, aA as MidsceneYamlFlowItemAIWaitFor, aG as MidsceneYamlFlowItemSleep, M as MidsceneYamlScript, av as MidsceneYamlScriptAndroidEnv, aw as MidsceneYamlScriptEnv, at as MidsceneYamlScriptEnvBase, au as MidsceneYamlScriptWebEnv, h as MidsceneYamlTask, O as OnTaskStartTip, F as PartialInsightDumpFromSDK, T as PlanningAIResponse, Q as PlanningAction, Z as PlanningActionParamAssert, $ as PlanningActionParamError, W as PlanningActionParamHover, X as PlanningActionParamInputOrKeyPress, Y as PlanningActionParamScroll, _ as PlanningActionParamSleep, V as PlanningActionParamTap, a0 as PlanningActionParamWaitFor, N as PlanningLocateParam, a4 as PlaywrightParserOpt, P as Point, a3 as PuppeteerParserOpt, R as Rect, y as ReportDumpWithAttributes, aJ as ScriptPlayerStatusValue, aI as ScriptPlayerTaskStatus, S as Size, a8 as TaskCacheInfo, as as scrollParam } from './types-d2831105.js';
3
+ import { c as callAiFn } from './llm-planning-d084250f.js';
4
+ export { a as AiAssert, A as AiLocateElement, d as describeUserPage, p as plan } from './llm-planning-d084250f.js';
5
5
  export { getLogDirByType, getVersion, setLogDir } from './utils.js';
6
6
  export { MIDSCENE_MODEL_NAME, getAIConfig } from './env.js';
7
7
  import '@midscene/shared/constants';
package/dist/es/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  getLogDirByType,
4
4
  getVersion,
5
5
  setLogDir
6
- } from "./chunk-SAXMKI7Z.js";
6
+ } from "./chunk-6MPYG6WR.js";
7
7
  import {
8
8
  AiAssert,
9
9
  AiExtractElementInfo,
@@ -12,7 +12,7 @@ import {
12
12
  callAiFn,
13
13
  describeUserPage,
14
14
  plan
15
- } from "./chunk-5EO33FHK.js";
15
+ } from "./chunk-QX6K65KH.js";
16
16
  import {
17
17
  MIDSCENE_FORCE_DEEP_THINK,
18
18
  MIDSCENE_MODEL_NAME,
@@ -20,7 +20,7 @@ import {
20
20
  getAIConfig,
21
21
  getAIConfigInBoolean,
22
22
  vlLocateMode
23
- } from "./chunk-UBGEKXK7.js";
23
+ } from "./chunk-6SYVFZ6C.js";
24
24
 
25
25
  // src/ai-model/action-executor.ts
26
26
  import { assert } from "@midscene/shared/utils";
@@ -1,4 +1,4 @@
1
- import { k as AIUsageInfo, R as Rect, B as BaseElement, U as UIContext, A as AISingleElementResponse, n as AISingleElementResponseByPosition, o as AIElementLocatorResponse, H as ElementById, r as AIDataExtractionResponse, t as AIAssertionResponse, T as PlanningAIResponse } from './types-e2a418c3.js';
1
+ import { k as AIUsageInfo, R as Rect, B as BaseElement, U as UIContext, A as AISingleElementResponse, n as AISingleElementResponseByPosition, o as AIElementLocatorResponse, H as ElementById, r as AIDataExtractionResponse, t as AIAssertionResponse, T as PlanningAIResponse } from './types-d2831105.js';
2
2
  import { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam } from 'openai/resources';
3
3
 
4
4
  type AIArgs = [
package/dist/es/tree.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _midscene_shared_constants from '@midscene/shared/constants';
2
- import { B as BaseElement, j as ElementTreeNode } from './types-e2a418c3.js';
2
+ import { B as BaseElement, j as ElementTreeNode } from './types-d2831105.js';
3
3
  import 'openai/resources';
4
4
 
5
5
  declare function truncateText(text: string | number | object | undefined, maxLength?: number): string;
@@ -14,7 +14,9 @@ interface scrollParam {
14
14
  distance?: null | number;
15
15
  }
16
16
  interface MidsceneYamlScript {
17
- target: MidsceneYamlScriptEnv;
17
+ target?: MidsceneYamlScriptWebEnv;
18
+ web?: MidsceneYamlScriptWebEnv;
19
+ android?: MidsceneYamlScriptAndroidEnv;
18
20
  tasks: MidsceneYamlTask[];
19
21
  }
20
22
  interface MidsceneYamlTask {
@@ -22,9 +24,11 @@ interface MidsceneYamlTask {
22
24
  flow: MidsceneYamlFlowItem[];
23
25
  continueOnError?: boolean;
24
26
  }
25
- interface MidsceneYamlScriptEnv {
27
+ interface MidsceneYamlScriptEnvBase {
26
28
  output?: string;
27
29
  aiActionContext?: string;
30
+ }
31
+ interface MidsceneYamlScriptWebEnv extends MidsceneYamlScriptEnvBase {
28
32
  serve?: string;
29
33
  url: string;
30
34
  userAgent?: string;
@@ -41,6 +45,11 @@ interface MidsceneYamlScriptEnv {
41
45
  bridgeMode?: false | 'newTabWithUrl' | 'currentTab';
42
46
  closeNewTabsAfterDisconnect?: boolean;
43
47
  }
48
+ interface MidsceneYamlScriptAndroidEnv extends MidsceneYamlScriptEnvBase {
49
+ deviceId?: string;
50
+ launch?: string;
51
+ }
52
+ type MidsceneYamlScriptEnv = MidsceneYamlScriptWebEnv | MidsceneYamlScriptAndroidEnv;
44
53
  interface MidsceneYamlFlowItemAIAction {
45
54
  ai?: string;
46
55
  aiAction?: string;
@@ -410,4 +419,4 @@ interface GroupedActionDump {
410
419
  executions: ExecutionDump[];
411
420
  }
412
421
 
413
- export { type PlanningActionParamError as $, type AISingleElementResponse as A, BaseElement as B, type CallAIFn as C, type DumpSubscriber as D, type ExecutionTask as E, type PartialInsightDumpFromSDK as F, type LiteUISection as G, type ElementById as H, type InsightAction as I, type AgentWaitForOpt as J, type AgentAssertOpt as K, type LocateResult as L, type MidsceneYamlScript as M, type PlanningLocateParam as N, type OnTaskStartTip as O, type Point as P, type PlanningAction as Q, type Rect as R, type Size as S, type PlanningAIResponse as T, UIContext as U, type PlanningActionParamTap as V, type PlanningActionParamHover as W, type PlanningActionParamInputOrKeyPress as X, type PlanningActionParamScroll as Y, type PlanningActionParamAssert as Z, type PlanningActionParamSleep as _, type ExecutionTaskProgressOptions as a, type PlanningActionParamWaitFor as a0, type Color as a1, type BaseAgentParserOpt as a2, type PuppeteerParserOpt as a3, type PlaywrightParserOpt as a4, type ExecutionRecorderItem as a5, type ExecutionTaskType as a6, type ExecutorContext as a7, type TaskCacheInfo as a8, type ExecutionTaskReturn as a9, type MidsceneYamlFlowItemAIInput as aA, type MidsceneYamlFlowItemAIKeyboardPress as aB, type MidsceneYamlFlowItemAIScroll as aC, type MidsceneYamlFlowItemSleep as aD, type FreeFn as aE, type ScriptPlayerTaskStatus as aF, type ScriptPlayerStatusValue as aG, type ExecutionTaskInsightLocateParam as aa, type ExecutionTaskInsightLocateOutput as ab, type ExecutionTaskInsightDumpLog as ac, type ExecutionTaskInsightLocateApply as ad, type ExecutionTaskInsightLocate as ae, type ExecutionTaskInsightQueryParam as af, type ExecutionTaskInsightQueryOutput as ag, type ExecutionTaskInsightQueryApply as ah, type ExecutionTaskInsightQuery as ai, type ExecutionTaskInsightAssertionParam as aj, type ExecutionTaskInsightAssertionApply as ak, type ExecutionTaskInsightAssertion as al, type ExecutionTaskActionApply as am, type ExecutionTaskAction as an, type ExecutionTaskPlanningApply as ao, type ExecutionTaskPlanning as ap, type GroupedActionDump as aq, type LocateOption as ar, type scrollParam as as, type MidsceneYamlScriptEnv as at, type MidsceneYamlFlowItemAIAction as au, type MidsceneYamlFlowItemAIAssert as av, type MidsceneYamlFlowItemAIQuery as aw, type MidsceneYamlFlowItemAIWaitFor as ax, type MidsceneYamlFlowItemAITap as ay, type MidsceneYamlFlowItemAIHover as az, type ExecutionTaskApply as b, type ExecutionDump as c, type InsightTaskInfo as d, type InsightOptions as e, type DetailedLocateParam as f, type InsightAssertionResponse as g, type MidsceneYamlTask as h, type MidsceneYamlFlowItem as i, type ElementTreeNode as j, type AIUsageInfo as k, AIResponseFormat as l, type AISingleElementResponseById as m, type AISingleElementResponseByPosition as n, type AIElementLocatorResponse as o, type AIElementCoordinatesResponse as p, type AIElementResponse as q, type AIDataExtractionResponse as r, type AISectionLocatorResponse as s, type AIAssertionResponse as t, type EnsureObject as u, type InsightExtractParam as v, type LocateResultElement as w, type DumpMeta as x, type ReportDumpWithAttributes as y, type InsightDump as z };
422
+ export { type PlanningActionParamError as $, type AISingleElementResponse as A, BaseElement as B, type CallAIFn as C, type DumpSubscriber as D, type ExecutionTask as E, type PartialInsightDumpFromSDK as F, type LiteUISection as G, type ElementById as H, type InsightAction as I, type AgentWaitForOpt as J, type AgentAssertOpt as K, type LocateResult as L, type MidsceneYamlScript as M, type PlanningLocateParam as N, type OnTaskStartTip as O, type Point as P, type PlanningAction as Q, type Rect as R, type Size as S, type PlanningAIResponse as T, UIContext as U, type PlanningActionParamTap as V, type PlanningActionParamHover as W, type PlanningActionParamInputOrKeyPress as X, type PlanningActionParamScroll as Y, type PlanningActionParamAssert as Z, type PlanningActionParamSleep as _, type ExecutionTaskProgressOptions as a, type PlanningActionParamWaitFor as a0, type Color as a1, type BaseAgentParserOpt as a2, type PuppeteerParserOpt as a3, type PlaywrightParserOpt as a4, type ExecutionRecorderItem as a5, type ExecutionTaskType as a6, type ExecutorContext as a7, type TaskCacheInfo as a8, type ExecutionTaskReturn as a9, type MidsceneYamlFlowItemAIWaitFor as aA, type MidsceneYamlFlowItemAITap as aB, type MidsceneYamlFlowItemAIHover as aC, type MidsceneYamlFlowItemAIInput as aD, type MidsceneYamlFlowItemAIKeyboardPress as aE, type MidsceneYamlFlowItemAIScroll as aF, type MidsceneYamlFlowItemSleep as aG, type FreeFn as aH, type ScriptPlayerTaskStatus as aI, type ScriptPlayerStatusValue as aJ, type ExecutionTaskInsightLocateParam as aa, type ExecutionTaskInsightLocateOutput as ab, type ExecutionTaskInsightDumpLog as ac, type ExecutionTaskInsightLocateApply as ad, type ExecutionTaskInsightLocate as ae, type ExecutionTaskInsightQueryParam as af, type ExecutionTaskInsightQueryOutput as ag, type ExecutionTaskInsightQueryApply as ah, type ExecutionTaskInsightQuery as ai, type ExecutionTaskInsightAssertionParam as aj, type ExecutionTaskInsightAssertionApply as ak, type ExecutionTaskInsightAssertion as al, type ExecutionTaskActionApply as am, type ExecutionTaskAction as an, type ExecutionTaskPlanningApply as ao, type ExecutionTaskPlanning as ap, type GroupedActionDump as aq, type LocateOption as ar, type scrollParam as as, type MidsceneYamlScriptEnvBase as at, type MidsceneYamlScriptWebEnv as au, type MidsceneYamlScriptAndroidEnv as av, type MidsceneYamlScriptEnv as aw, type MidsceneYamlFlowItemAIAction as ax, type MidsceneYamlFlowItemAIAssert as ay, type MidsceneYamlFlowItemAIQuery as az, type ExecutionTaskApply as b, type ExecutionDump as c, type InsightTaskInfo as d, type InsightOptions as e, type DetailedLocateParam as f, type InsightAssertionResponse as g, type MidsceneYamlTask as h, type MidsceneYamlFlowItem as i, type ElementTreeNode as j, type AIUsageInfo as k, AIResponseFormat as l, type AISingleElementResponseById as m, type AISingleElementResponseByPosition as n, type AIElementLocatorResponse as o, type AIElementCoordinatesResponse as p, type AIElementResponse as q, type AIDataExtractionResponse as r, type AISectionLocatorResponse as s, type AIAssertionResponse as t, type EnsureObject as u, type InsightExtractParam as v, type LocateResultElement as w, type DumpMeta as x, type ReportDumpWithAttributes as y, type InsightDump as z };
@@ -1,4 +1,4 @@
1
- import { y as ReportDumpWithAttributes, R as Rect } from './types-e2a418c3.js';
1
+ import { y as ReportDumpWithAttributes, R as Rect } from './types-d2831105.js';
2
2
  import '@midscene/shared/constants';
3
3
  import 'openai/resources';
4
4
 
package/dist/es/utils.js CHANGED
@@ -16,8 +16,8 @@ import {
16
16
  uploadTestInfoToServer,
17
17
  writeDumpReport,
18
18
  writeLogFile
19
- } from "./chunk-SAXMKI7Z.js";
20
- import "./chunk-UBGEKXK7.js";
19
+ } from "./chunk-6MPYG6WR.js";
20
+ import "./chunk-6SYVFZ6C.js";
21
21
  export {
22
22
  getLogDir,
23
23
  getLogDirByType,
@@ -1,8 +1,8 @@
1
- import { k as AIUsageInfo, Q as PlanningAction } from './types-e2a418c3.js';
1
+ import { k as AIUsageInfo, Q as PlanningAction } from './types-d2831105.js';
2
2
  import { ChatCompletionMessageParam } from 'openai/resources';
3
3
  export { ChatCompletionMessageParam } from 'openai/resources';
4
- import { b as AIActionType } from './llm-planning-bd80e99e.js';
5
- export { a as AiAssert, e as AiExtractElementInfo, A as AiLocateElement, f as AiLocateSection, g as adaptBboxToRect, c as callAiFn, d as describeUserPage, p as plan } from './llm-planning-bd80e99e.js';
4
+ import { b as AIActionType } from './llm-planning-d084250f.js';
5
+ export { a as AiAssert, e as AiExtractElementInfo, A as AiLocateElement, f as AiLocateSection, g as adaptBboxToRect, c as callAiFn, d as describeUserPage, p as plan } from './llm-planning-d084250f.js';
6
6
  import { actionParser } from '@ui-tars/action-parser';
7
7
  import '@midscene/shared/constants';
8
8
 
@@ -10,8 +10,8 @@
10
10
 
11
11
 
12
12
 
13
- var _chunk5EO33FHKjs = require('./chunk-5EO33FHK.js');
14
- require('./chunk-UBGEKXK7.js');
13
+ var _chunkQX6K65KHjs = require('./chunk-QX6K65KH.js');
14
+ require('./chunk-6SYVFZ6C.js');
15
15
 
16
16
 
17
17
 
@@ -24,4 +24,4 @@ require('./chunk-UBGEKXK7.js');
24
24
 
25
25
 
26
26
 
27
- exports.AiAssert = _chunk5EO33FHKjs.AiAssert; exports.AiExtractElementInfo = _chunk5EO33FHKjs.AiExtractElementInfo; exports.AiLocateElement = _chunk5EO33FHKjs.AiLocateElement; exports.AiLocateSection = _chunk5EO33FHKjs.AiLocateSection; exports.adaptBboxToRect = _chunk5EO33FHKjs.adaptBboxToRect; exports.callAiFn = _chunk5EO33FHKjs.callAiFn; exports.callToGetJSONObject = _chunk5EO33FHKjs.callToGetJSONObject; exports.describeUserPage = _chunk5EO33FHKjs.describeUserPage; exports.plan = _chunk5EO33FHKjs.plan; exports.systemPromptToLocateElement = _chunk5EO33FHKjs.systemPromptToLocateElement; exports.vlmPlanning = _chunk5EO33FHKjs.vlmPlanning;
27
+ exports.AiAssert = _chunkQX6K65KHjs.AiAssert; exports.AiExtractElementInfo = _chunkQX6K65KHjs.AiExtractElementInfo; exports.AiLocateElement = _chunkQX6K65KHjs.AiLocateElement; exports.AiLocateSection = _chunkQX6K65KHjs.AiLocateSection; exports.adaptBboxToRect = _chunkQX6K65KHjs.adaptBboxToRect; exports.callAiFn = _chunkQX6K65KHjs.callAiFn; exports.callToGetJSONObject = _chunkQX6K65KHjs.callToGetJSONObject; exports.describeUserPage = _chunkQX6K65KHjs.describeUserPage; exports.plan = _chunkQX6K65KHjs.plan; exports.systemPromptToLocateElement = _chunkQX6K65KHjs.systemPromptToLocateElement; exports.vlmPlanning = _chunkQX6K65KHjs.vlmPlanning;
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkUBGEKXK7js = require('./chunk-UBGEKXK7.js');
6
+ var _chunk6SYVFZ6Cjs = require('./chunk-6SYVFZ6C.js');
7
7
 
8
8
  // src/utils.ts
9
9
  var _child_process = require('child_process');
@@ -201,10 +201,10 @@ function stringifyDumpData(data, indents) {
201
201
  return JSON.stringify(data, replacerForPageObject, indents);
202
202
  }
203
203
  function getVersion() {
204
- return "0.14.3";
204
+ return "0.14.4-beta-20250415065130.0";
205
205
  }
206
206
  function debugLog(...message) {
207
- const debugMode = _chunkUBGEKXK7js.getAIConfig.call(void 0, _chunkUBGEKXK7js.MIDSCENE_DEBUG_MODE);
207
+ const debugMode = _chunk6SYVFZ6Cjs.getAIConfig.call(void 0, _chunk6SYVFZ6Cjs.MIDSCENE_DEBUG_MODE);
208
208
  if (debugMode) {
209
209
  console.log("[Midscene]", ...message);
210
210
  }
@@ -213,7 +213,7 @@ var lastReportedRepoUrl = "";
213
213
  function uploadTestInfoToServer({ testUrl }) {
214
214
  let repoUrl = "";
215
215
  let userEmail = "";
216
- const extraConfig = _chunkUBGEKXK7js.getAIConfigInJson.call(void 0, _chunkUBGEKXK7js.MIDSCENE_OPENAI_INIT_CONFIG_JSON);
216
+ const extraConfig = _chunk6SYVFZ6Cjs.getAIConfigInJson.call(void 0, _chunk6SYVFZ6Cjs.MIDSCENE_OPENAI_INIT_CONFIG_JSON);
217
217
  const serverUrl = _optionalChain([extraConfig, 'optionalAccess', _6 => _6.REPORT_SERVER_URL]);
218
218
  try {
219
219
  repoUrl = _child_process.execSync.call(void 0, "git config --get remote.origin.url").toString().trim();
@@ -267,4 +267,4 @@ function uploadTestInfoToServer({ testUrl }) {
267
267
 
268
268
  exports.groupedActionDumpFileExt = groupedActionDumpFileExt; exports.getLogDir = getLogDir; exports.setLogDir = setLogDir; exports.getLogDirByType = getLogDirByType; exports.setReportTpl = setReportTpl; exports.replaceStringWithFirstAppearance = replaceStringWithFirstAppearance; exports.reportHTMLContent = reportHTMLContent; exports.writeDumpReport = writeDumpReport; exports.writeLogFile = writeLogFile; exports.getTmpDir = getTmpDir; exports.getTmpFile = getTmpFile; exports.overlapped = overlapped; exports.sleep = sleep; exports.replacerForPageObject = replacerForPageObject; exports.stringifyDumpData = stringifyDumpData; exports.getVersion = getVersion; exports.uploadTestInfoToServer = uploadTestInfoToServer;
269
269
 
270
- //# sourceMappingURL=chunk-SAXMKI7Z.js.map
270
+ //# sourceMappingURL=chunk-6MPYG6WR.js.map
@@ -78,6 +78,9 @@ var vlLocateMode = () => {
78
78
  if (getAIConfigInBoolean(MIDSCENE_USE_VL_MODEL)) {
79
79
  return "vl-model";
80
80
  }
81
+ if (getAIConfigInBoolean(MIDSCENE_USE_VLM_UI_TARS)) {
82
+ return "vlm-ui-tars";
83
+ }
81
84
  return false;
82
85
  };
83
86
  var getAIConfig = (configKey) => {
@@ -167,4 +170,4 @@ var overrideAIConfig = (newConfig, extendMode) => {
167
170
 
168
171
  exports.MIDSCENE_OPENAI_INIT_CONFIG_JSON = MIDSCENE_OPENAI_INIT_CONFIG_JSON; exports.MIDSCENE_MODEL_NAME = MIDSCENE_MODEL_NAME; exports.MIDSCENE_LANGSMITH_DEBUG = MIDSCENE_LANGSMITH_DEBUG; exports.MIDSCENE_DEBUG_AI_PROFILE = MIDSCENE_DEBUG_AI_PROFILE; exports.MIDSCENE_DEBUG_AI_RESPONSE = MIDSCENE_DEBUG_AI_RESPONSE; exports.MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG = MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG; exports.MIDSCENE_DEBUG_MODE = MIDSCENE_DEBUG_MODE; exports.MIDSCENE_FORCE_DEEP_THINK = MIDSCENE_FORCE_DEEP_THINK; exports.MIDSCENE_OPENAI_SOCKS_PROXY = MIDSCENE_OPENAI_SOCKS_PROXY; exports.OPENAI_API_KEY = OPENAI_API_KEY; exports.OPENAI_BASE_URL = OPENAI_BASE_URL; exports.OPENAI_MAX_TOKENS = OPENAI_MAX_TOKENS; exports.MIDSCENE_CACHE = MIDSCENE_CACHE; exports.MIDSCENE_USE_VLM_UI_TARS = MIDSCENE_USE_VLM_UI_TARS; exports.MIDSCENE_USE_QWEN_VL = MIDSCENE_USE_QWEN_VL; exports.MIDSCENE_USE_DOUBAO_VISION = MIDSCENE_USE_DOUBAO_VISION; exports.MIDSCENE_USE_VL_MODEL = MIDSCENE_USE_VL_MODEL; exports.MATCH_BY_POSITION = MATCH_BY_POSITION; exports.MIDSCENE_API_TYPE = MIDSCENE_API_TYPE; exports.MIDSCENE_REPORT_TAG_NAME = MIDSCENE_REPORT_TAG_NAME; exports.MIDSCENE_USE_AZURE_OPENAI = MIDSCENE_USE_AZURE_OPENAI; exports.MIDSCENE_AZURE_OPENAI_SCOPE = MIDSCENE_AZURE_OPENAI_SCOPE; exports.MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON = MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON; exports.AZURE_OPENAI_ENDPOINT = AZURE_OPENAI_ENDPOINT; exports.AZURE_OPENAI_KEY = AZURE_OPENAI_KEY; exports.AZURE_OPENAI_API_VERSION = AZURE_OPENAI_API_VERSION; exports.AZURE_OPENAI_DEPLOYMENT = AZURE_OPENAI_DEPLOYMENT; exports.MIDSCENE_USE_ANTHROPIC_SDK = MIDSCENE_USE_ANTHROPIC_SDK; exports.ANTHROPIC_API_KEY = ANTHROPIC_API_KEY; exports.OPENAI_USE_AZURE = OPENAI_USE_AZURE; exports.vlLocateMode = vlLocateMode; exports.getAIConfig = getAIConfig; exports.getAIConfigInBoolean = getAIConfigInBoolean; exports.getAIConfigInJson = getAIConfigInJson; exports.allAIConfig = allAIConfig; exports.overrideAIConfig = overrideAIConfig;
169
172
 
170
- //# sourceMappingURL=chunk-UBGEKXK7.js.map
173
+ //# sourceMappingURL=chunk-6SYVFZ6C.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"mappings":";AACO,IAAM,mCACX;AACK,IAAM,sBAAsB;AAC5B,IAAM,2BAA2B;AACjC,IAAM,4BAA4B;AAClC,IAAM,6BAA6B;AACnC,IAAM,wCACX;AACK,IAAM,sBAAsB;AAE5B,IAAM,4BAA4B;AAElC,IAAM,8BAA8B;AACpC,IAAM,iBAAiB;AACvB,IAAM,kBAAkB;AACxB,IAAM,oBAAoB;AAE1B,IAAM,iBAAiB;AACvB,IAAM,2BAA2B;AACjC,IAAM,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C7E","names":[],"ignoreList":[],"sources":["../../src/env.ts"],"sourcesContent":["// config keys\nexport const MIDSCENE_OPENAI_INIT_CONFIG_JSON =\n 'MIDSCENE_OPENAI_INIT_CONFIG_JSON';\nexport const MIDSCENE_MODEL_NAME = 'MIDSCENE_MODEL_NAME';\nexport const MIDSCENE_LANGSMITH_DEBUG = 'MIDSCENE_LANGSMITH_DEBUG';\nexport const MIDSCENE_DEBUG_AI_PROFILE = 'MIDSCENE_DEBUG_AI_PROFILE';\nexport const MIDSCENE_DEBUG_AI_RESPONSE = 'MIDSCENE_DEBUG_AI_RESPONSE';\nexport const MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG =\n 'MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG';\nexport const MIDSCENE_DEBUG_MODE = 'MIDSCENE_DEBUG_MODE';\n\nexport const MIDSCENE_FORCE_DEEP_THINK = 'MIDSCENE_FORCE_DEEP_THINK';\n\nexport const MIDSCENE_OPENAI_SOCKS_PROXY = 'MIDSCENE_OPENAI_SOCKS_PROXY';\nexport const OPENAI_API_KEY = 'OPENAI_API_KEY';\nexport const OPENAI_BASE_URL = 'OPENAI_BASE_URL';\nexport const OPENAI_MAX_TOKENS = 'OPENAI_MAX_TOKENS';\n\nexport const MIDSCENE_CACHE = 'MIDSCENE_CACHE';\nexport const MIDSCENE_USE_VLM_UI_TARS = 'MIDSCENE_USE_VLM_UI_TARS';\nexport const MIDSCENE_USE_QWEN_VL = 'MIDSCENE_USE_QWEN_VL';\nexport const MIDSCENE_USE_DOUBAO_VISION = 'MIDSCENE_USE_DOUBAO_VISION';\nexport const MIDSCENE_USE_VL_MODEL = 'MIDSCENE_USE_VL_MODEL';\nexport const MATCH_BY_POSITION = 'MATCH_BY_POSITION';\nexport const MIDSCENE_API_TYPE = 'MIDSCENE-API-TYPE';\nexport const MIDSCENE_REPORT_TAG_NAME = 'MIDSCENE_REPORT_TAG_NAME';\n\nexport const MIDSCENE_USE_AZURE_OPENAI = 'MIDSCENE_USE_AZURE_OPENAI';\nexport const MIDSCENE_AZURE_OPENAI_SCOPE = 'MIDSCENE_AZURE_OPENAI_SCOPE';\nexport const MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON =\n 'MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON';\n\nexport const AZURE_OPENAI_ENDPOINT = 'AZURE_OPENAI_ENDPOINT';\nexport const AZURE_OPENAI_KEY = 'AZURE_OPENAI_KEY';\nexport const AZURE_OPENAI_API_VERSION = 'AZURE_OPENAI_API_VERSION';\nexport const AZURE_OPENAI_DEPLOYMENT = 'AZURE_OPENAI_DEPLOYMENT';\n\nexport const MIDSCENE_USE_ANTHROPIC_SDK = 'MIDSCENE_USE_ANTHROPIC_SDK';\nexport const ANTHROPIC_API_KEY = 'ANTHROPIC_API_KEY';\n\n// @deprecated\nexport const OPENAI_USE_AZURE = 'OPENAI_USE_AZURE';\n\nconst allConfigFromEnv = () => {\n return {\n [MIDSCENE_OPENAI_INIT_CONFIG_JSON]:\n process.env[MIDSCENE_OPENAI_INIT_CONFIG_JSON] || undefined,\n [MIDSCENE_MODEL_NAME]: process.env[MIDSCENE_MODEL_NAME] || undefined,\n [MIDSCENE_DEBUG_MODE]: process.env[MIDSCENE_DEBUG_MODE] || undefined,\n [MIDSCENE_FORCE_DEEP_THINK]:\n process.env[MIDSCENE_FORCE_DEEP_THINK] || undefined,\n [MIDSCENE_LANGSMITH_DEBUG]:\n process.env[MIDSCENE_LANGSMITH_DEBUG] || undefined,\n [MIDSCENE_DEBUG_AI_PROFILE]:\n process.env[MIDSCENE_DEBUG_AI_PROFILE] || undefined,\n [MIDSCENE_DEBUG_AI_RESPONSE]:\n process.env[MIDSCENE_DEBUG_AI_RESPONSE] || undefined,\n [MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG]:\n process.env[MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG] || undefined,\n [OPENAI_API_KEY]: process.env[OPENAI_API_KEY] || undefined,\n [OPENAI_BASE_URL]: process.env[OPENAI_BASE_URL] || undefined,\n [OPENAI_MAX_TOKENS]: process.env[OPENAI_MAX_TOKENS] || undefined,\n [OPENAI_USE_AZURE]: process.env[OPENAI_USE_AZURE] || undefined,\n [MIDSCENE_CACHE]: process.env[MIDSCENE_CACHE] || undefined,\n [MATCH_BY_POSITION]: process.env[MATCH_BY_POSITION] || undefined,\n [MIDSCENE_REPORT_TAG_NAME]:\n process.env[MIDSCENE_REPORT_TAG_NAME] || undefined,\n [MIDSCENE_OPENAI_SOCKS_PROXY]:\n process.env[MIDSCENE_OPENAI_SOCKS_PROXY] || undefined,\n [MIDSCENE_USE_AZURE_OPENAI]:\n process.env[MIDSCENE_USE_AZURE_OPENAI] || undefined,\n [MIDSCENE_AZURE_OPENAI_SCOPE]:\n process.env[MIDSCENE_AZURE_OPENAI_SCOPE] || undefined,\n [MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON]:\n process.env[MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON] || undefined,\n [MIDSCENE_USE_ANTHROPIC_SDK]:\n process.env[MIDSCENE_USE_ANTHROPIC_SDK] || undefined,\n [MIDSCENE_USE_VLM_UI_TARS]:\n process.env[MIDSCENE_USE_VLM_UI_TARS] || undefined,\n [MIDSCENE_USE_QWEN_VL]: process.env[MIDSCENE_USE_QWEN_VL] || undefined,\n [MIDSCENE_USE_DOUBAO_VISION]:\n process.env[MIDSCENE_USE_DOUBAO_VISION] || undefined,\n [MIDSCENE_USE_VL_MODEL]: process.env[MIDSCENE_USE_VL_MODEL] || undefined,\n [ANTHROPIC_API_KEY]: process.env[ANTHROPIC_API_KEY] || undefined,\n [AZURE_OPENAI_ENDPOINT]: process.env[AZURE_OPENAI_ENDPOINT] || undefined,\n [AZURE_OPENAI_KEY]: process.env[AZURE_OPENAI_KEY] || undefined,\n [AZURE_OPENAI_API_VERSION]:\n process.env[AZURE_OPENAI_API_VERSION] || undefined,\n [AZURE_OPENAI_DEPLOYMENT]:\n process.env[AZURE_OPENAI_DEPLOYMENT] || undefined,\n };\n};\n\nlet userConfig: Partial<ReturnType<typeof allConfigFromEnv>> = {};\n\nexport const vlLocateMode = ():\n | 'qwen-vl'\n | 'doubao-vision'\n | 'vl-model'\n | 'vlm-ui-tars'\n | false => {\n if (\n getAIConfigInBoolean(MIDSCENE_USE_DOUBAO_VISION) &&\n getAIConfigInBoolean(MIDSCENE_USE_QWEN_VL)\n ) {\n throw new Error(\n 'MIDSCENE_USE_DOUBAO_VISION and MIDSCENE_USE_QWEN_VL cannot be true at the same time',\n );\n }\n\n if (getAIConfigInBoolean(MIDSCENE_USE_QWEN_VL)) {\n return 'qwen-vl';\n }\n\n if (getAIConfigInBoolean(MIDSCENE_USE_DOUBAO_VISION)) {\n return 'doubao-vision';\n }\n\n if (getAIConfigInBoolean(MIDSCENE_USE_VL_MODEL)) {\n return 'vl-model';\n }\n\n if (getAIConfigInBoolean(MIDSCENE_USE_VLM_UI_TARS)) {\n return 'vlm-ui-tars';\n }\n\n return false;\n};\n\nexport const getAIConfig = (\n configKey: keyof typeof userConfig,\n): string | undefined => {\n if (configKey === MATCH_BY_POSITION) {\n throw new Error(\n 'MATCH_BY_POSITION is deprecated, use MIDSCENE_USE_VL_MODEL instead',\n );\n }\n\n if (typeof userConfig[configKey] !== 'undefined') {\n if (typeof userConfig[configKey] === 'string') {\n return userConfig[configKey]?.trim();\n }\n return userConfig[configKey];\n }\n return allConfigFromEnv()[configKey]?.trim();\n};\n\nexport const getAIConfigInBoolean = (configKey: keyof typeof userConfig) => {\n const config = getAIConfig(configKey) || '';\n return /^(true|1)$/i.test(config);\n};\n\nexport const getAIConfigInJson = (configKey: keyof typeof userConfig) => {\n const config = getAIConfig(configKey);\n try {\n return config ? JSON.parse(config) : undefined;\n } catch (error: any) {\n throw new Error(\n `Failed to parse json config: ${configKey}. ${error.message}`,\n {\n cause: error,\n },\n );\n }\n};\n\nexport const allAIConfig = () => {\n return { ...allConfigFromEnv(), ...userConfig };\n};\n\nexport const overrideAIConfig = (\n newConfig: Partial<ReturnType<typeof allConfigFromEnv>>,\n extendMode?: boolean,\n) => {\n for (const key in newConfig) {\n if (typeof key !== 'string') {\n throw new Error(`Failed to override AI config, invalid key: ${key}`);\n }\n if (typeof newConfig[key as keyof typeof newConfig] === 'object') {\n throw new Error(\n `Failed to override AI config, invalid value for key: ${key}, value: ${newConfig[key as keyof typeof newConfig]}`,\n );\n }\n }\n\n userConfig = extendMode ? { ...userConfig, ...newConfig } : { ...newConfig };\n};\n"]}