@godscene/shared 1.7.11

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 (236) hide show
  1. package/README.md +9 -0
  2. package/dist/es/baseDB.mjs +109 -0
  3. package/dist/es/cli/cli-args.mjs +95 -0
  4. package/dist/es/cli/cli-error.mjs +24 -0
  5. package/dist/es/cli/cli-runner.mjs +122 -0
  6. package/dist/es/cli/index.mjs +4 -0
  7. package/dist/es/common.mjs +37 -0
  8. package/dist/es/constants/example-code.mjs +227 -0
  9. package/dist/es/constants/index.mjs +124 -0
  10. package/dist/es/env/basic.mjs +6 -0
  11. package/dist/es/env/constants.mjs +110 -0
  12. package/dist/es/env/global-config-manager.mjs +94 -0
  13. package/dist/es/env/helper.mjs +43 -0
  14. package/dist/es/env/index.mjs +5 -0
  15. package/dist/es/env/init-debug.mjs +18 -0
  16. package/dist/es/env/model-config-manager.mjs +79 -0
  17. package/dist/es/env/parse-model-config.mjs +165 -0
  18. package/dist/es/env/types.mjs +232 -0
  19. package/dist/es/env/utils.mjs +18 -0
  20. package/dist/es/extractor/constants.mjs +2 -0
  21. package/dist/es/extractor/cs_postmessage.mjs +61 -0
  22. package/dist/es/extractor/customLocator.mjs +641 -0
  23. package/dist/es/extractor/debug.mjs +6 -0
  24. package/dist/es/extractor/dom-util.mjs +96 -0
  25. package/dist/es/extractor/index.mjs +5 -0
  26. package/dist/es/extractor/locator.mjs +250 -0
  27. package/dist/es/extractor/tree.mjs +78 -0
  28. package/dist/es/extractor/util.mjs +245 -0
  29. package/dist/es/extractor/web-extractor.mjs +393 -0
  30. package/dist/es/img/box-select.mjs +824 -0
  31. package/dist/es/img/canvas-fallback.mjs +238 -0
  32. package/dist/es/img/get-photon.mjs +45 -0
  33. package/dist/es/img/get-sharp.mjs +11 -0
  34. package/dist/es/img/index.mjs +4 -0
  35. package/dist/es/img/info.mjs +35 -0
  36. package/dist/es/img/transform.mjs +275 -0
  37. package/dist/es/index.mjs +2 -0
  38. package/dist/es/key-alias-utils.mjs +19 -0
  39. package/dist/es/logger.mjs +64 -0
  40. package/dist/es/mcp/base-server.mjs +282 -0
  41. package/dist/es/mcp/base-tools.mjs +159 -0
  42. package/dist/es/mcp/chrome-path.mjs +35 -0
  43. package/dist/es/mcp/cli-report-session.mjs +78 -0
  44. package/dist/es/mcp/error-formatter.mjs +19 -0
  45. package/dist/es/mcp/index.mjs +9 -0
  46. package/dist/es/mcp/init-arg-utils.mjs +38 -0
  47. package/dist/es/mcp/inject-report-html-plugin.mjs +53 -0
  48. package/dist/es/mcp/launcher-helper.mjs +52 -0
  49. package/dist/es/mcp/tool-generator.mjs +419 -0
  50. package/dist/es/mcp/types.mjs +3 -0
  51. package/dist/es/node/fs.mjs +44 -0
  52. package/dist/es/node/index.mjs +2 -0
  53. package/dist/es/node/port.mjs +24 -0
  54. package/dist/es/polyfills/async-hooks.mjs +2 -0
  55. package/dist/es/polyfills/index.mjs +1 -0
  56. package/dist/es/types/index.mjs +3 -0
  57. package/dist/es/us-keyboard-layout.mjs +1414 -0
  58. package/dist/es/us-keyboard-layout.mjs.LICENSE.txt +5 -0
  59. package/dist/es/utils.mjs +72 -0
  60. package/dist/es/zod-schema-utils.mjs +54 -0
  61. package/dist/lib/baseDB.js +149 -0
  62. package/dist/lib/cli/cli-args.js +138 -0
  63. package/dist/lib/cli/cli-error.js +61 -0
  64. package/dist/lib/cli/cli-runner.js +181 -0
  65. package/dist/lib/cli/index.js +53 -0
  66. package/dist/lib/common.js +93 -0
  67. package/dist/lib/constants/example-code.js +264 -0
  68. package/dist/lib/constants/index.js +221 -0
  69. package/dist/lib/env/basic.js +40 -0
  70. package/dist/lib/env/constants.js +153 -0
  71. package/dist/lib/env/global-config-manager.js +128 -0
  72. package/dist/lib/env/helper.js +80 -0
  73. package/dist/lib/env/index.js +90 -0
  74. package/dist/lib/env/init-debug.js +52 -0
  75. package/dist/lib/env/model-config-manager.js +113 -0
  76. package/dist/lib/env/parse-model-config.js +211 -0
  77. package/dist/lib/env/types.js +572 -0
  78. package/dist/lib/env/utils.js +61 -0
  79. package/dist/lib/extractor/constants.js +42 -0
  80. package/dist/lib/extractor/cs_postmessage.js +98 -0
  81. package/dist/lib/extractor/customLocator.js +693 -0
  82. package/dist/lib/extractor/debug.js +12 -0
  83. package/dist/lib/extractor/dom-util.js +157 -0
  84. package/dist/lib/extractor/index.js +87 -0
  85. package/dist/lib/extractor/locator.js +296 -0
  86. package/dist/lib/extractor/tree.js +124 -0
  87. package/dist/lib/extractor/util.js +336 -0
  88. package/dist/lib/extractor/web-extractor.js +442 -0
  89. package/dist/lib/img/box-select.js +875 -0
  90. package/dist/lib/img/canvas-fallback.js +305 -0
  91. package/dist/lib/img/get-photon.js +82 -0
  92. package/dist/lib/img/get-sharp.js +45 -0
  93. package/dist/lib/img/index.js +95 -0
  94. package/dist/lib/img/info.js +92 -0
  95. package/dist/lib/img/transform.js +364 -0
  96. package/dist/lib/index.js +36 -0
  97. package/dist/lib/key-alias-utils.js +62 -0
  98. package/dist/lib/logger.js +114 -0
  99. package/dist/lib/mcp/base-server.js +332 -0
  100. package/dist/lib/mcp/base-tools.js +193 -0
  101. package/dist/lib/mcp/chrome-path.js +72 -0
  102. package/dist/lib/mcp/cli-report-session.js +121 -0
  103. package/dist/lib/mcp/error-formatter.js +53 -0
  104. package/dist/lib/mcp/index.js +114 -0
  105. package/dist/lib/mcp/init-arg-utils.js +78 -0
  106. package/dist/lib/mcp/inject-report-html-plugin.js +98 -0
  107. package/dist/lib/mcp/launcher-helper.js +86 -0
  108. package/dist/lib/mcp/tool-generator.js +456 -0
  109. package/dist/lib/mcp/types.js +40 -0
  110. package/dist/lib/node/fs.js +97 -0
  111. package/dist/lib/node/index.js +65 -0
  112. package/dist/lib/node/port.js +61 -0
  113. package/dist/lib/polyfills/async-hooks.js +36 -0
  114. package/dist/lib/polyfills/index.js +58 -0
  115. package/dist/lib/types/index.js +37 -0
  116. package/dist/lib/us-keyboard-layout.js +1457 -0
  117. package/dist/lib/us-keyboard-layout.js.LICENSE.txt +5 -0
  118. package/dist/lib/utils.js +148 -0
  119. package/dist/lib/zod-schema-utils.js +97 -0
  120. package/dist/types/baseDB.d.ts +25 -0
  121. package/dist/types/cli/cli-args.d.ts +8 -0
  122. package/dist/types/cli/cli-error.d.ts +5 -0
  123. package/dist/types/cli/cli-runner.d.ts +19 -0
  124. package/dist/types/cli/index.d.ts +4 -0
  125. package/dist/types/common.d.ts +12 -0
  126. package/dist/types/constants/example-code.d.ts +2 -0
  127. package/dist/types/constants/index.d.ts +61 -0
  128. package/dist/types/env/basic.d.ts +6 -0
  129. package/dist/types/env/constants.d.ts +50 -0
  130. package/dist/types/env/global-config-manager.d.ts +32 -0
  131. package/dist/types/env/helper.d.ts +4 -0
  132. package/dist/types/env/index.d.ts +4 -0
  133. package/dist/types/env/init-debug.d.ts +1 -0
  134. package/dist/types/env/model-config-manager.d.ts +25 -0
  135. package/dist/types/env/parse-model-config.d.ts +31 -0
  136. package/dist/types/env/types.d.ts +339 -0
  137. package/dist/types/env/utils.d.ts +7 -0
  138. package/dist/types/extractor/constants.d.ts +1 -0
  139. package/dist/types/extractor/cs_postmessage.d.ts +2 -0
  140. package/dist/types/extractor/customLocator.d.ts +69 -0
  141. package/dist/types/extractor/debug.d.ts +1 -0
  142. package/dist/types/extractor/dom-util.d.ts +57 -0
  143. package/dist/types/extractor/index.d.ts +33 -0
  144. package/dist/types/extractor/locator.d.ts +9 -0
  145. package/dist/types/extractor/tree.d.ts +6 -0
  146. package/dist/types/extractor/util.d.ts +47 -0
  147. package/dist/types/extractor/web-extractor.d.ts +24 -0
  148. package/dist/types/img/box-select.d.ts +26 -0
  149. package/dist/types/img/canvas-fallback.d.ts +105 -0
  150. package/dist/types/img/get-photon.d.ts +19 -0
  151. package/dist/types/img/get-sharp.d.ts +3 -0
  152. package/dist/types/img/index.d.ts +3 -0
  153. package/dist/types/img/info.d.ts +34 -0
  154. package/dist/types/img/transform.d.ts +98 -0
  155. package/dist/types/index.d.ts +2 -0
  156. package/dist/types/key-alias-utils.d.ts +9 -0
  157. package/dist/types/logger.d.ts +5 -0
  158. package/dist/types/mcp/base-server.d.ts +93 -0
  159. package/dist/types/mcp/base-tools.d.ts +148 -0
  160. package/dist/types/mcp/chrome-path.d.ts +2 -0
  161. package/dist/types/mcp/cli-report-session.d.ts +12 -0
  162. package/dist/types/mcp/error-formatter.d.ts +12 -0
  163. package/dist/types/mcp/index.d.ts +9 -0
  164. package/dist/types/mcp/init-arg-utils.d.ts +13 -0
  165. package/dist/types/mcp/inject-report-html-plugin.d.ts +18 -0
  166. package/dist/types/mcp/launcher-helper.d.ts +94 -0
  167. package/dist/types/mcp/tool-generator.d.ts +10 -0
  168. package/dist/types/mcp/types.d.ts +113 -0
  169. package/dist/types/node/fs.d.ts +15 -0
  170. package/dist/types/node/index.d.ts +2 -0
  171. package/dist/types/node/port.d.ts +8 -0
  172. package/dist/types/polyfills/async-hooks.d.ts +6 -0
  173. package/dist/types/polyfills/index.d.ts +4 -0
  174. package/dist/types/types/index.d.ts +36 -0
  175. package/dist/types/us-keyboard-layout.d.ts +32 -0
  176. package/dist/types/utils.d.ts +34 -0
  177. package/dist/types/zod-schema-utils.d.ts +23 -0
  178. package/package.json +125 -0
  179. package/src/baseDB.ts +158 -0
  180. package/src/cli/cli-args.ts +173 -0
  181. package/src/cli/cli-error.ts +24 -0
  182. package/src/cli/cli-runner.ts +230 -0
  183. package/src/cli/index.ts +4 -0
  184. package/src/common.ts +67 -0
  185. package/src/constants/example-code.ts +227 -0
  186. package/src/constants/index.ts +139 -0
  187. package/src/env/basic.ts +12 -0
  188. package/src/env/constants.ts +303 -0
  189. package/src/env/global-config-manager.ts +191 -0
  190. package/src/env/helper.ts +58 -0
  191. package/src/env/index.ts +4 -0
  192. package/src/env/init-debug.ts +34 -0
  193. package/src/env/model-config-manager.ts +149 -0
  194. package/src/env/parse-model-config.ts +357 -0
  195. package/src/env/types.ts +583 -0
  196. package/src/env/utils.ts +39 -0
  197. package/src/extractor/constants.ts +5 -0
  198. package/src/extractor/cs_postmessage.ts +136 -0
  199. package/src/extractor/customLocator.ts +1245 -0
  200. package/src/extractor/debug.ts +10 -0
  201. package/src/extractor/dom-util.ts +231 -0
  202. package/src/extractor/index.ts +50 -0
  203. package/src/extractor/locator.ts +469 -0
  204. package/src/extractor/tree.ts +179 -0
  205. package/src/extractor/util.ts +482 -0
  206. package/src/extractor/web-extractor.ts +617 -0
  207. package/src/img/box-select.ts +588 -0
  208. package/src/img/canvas-fallback.ts +393 -0
  209. package/src/img/get-photon.ts +108 -0
  210. package/src/img/get-sharp.ts +18 -0
  211. package/src/img/index.ts +27 -0
  212. package/src/img/info.ts +102 -0
  213. package/src/img/transform.ts +553 -0
  214. package/src/index.ts +1 -0
  215. package/src/key-alias-utils.ts +23 -0
  216. package/src/logger.ts +96 -0
  217. package/src/mcp/base-server.ts +500 -0
  218. package/src/mcp/base-tools.ts +391 -0
  219. package/src/mcp/chrome-path.ts +48 -0
  220. package/src/mcp/cli-report-session.ts +130 -0
  221. package/src/mcp/error-formatter.ts +52 -0
  222. package/src/mcp/index.ts +9 -0
  223. package/src/mcp/init-arg-utils.ts +105 -0
  224. package/src/mcp/inject-report-html-plugin.ts +119 -0
  225. package/src/mcp/launcher-helper.ts +200 -0
  226. package/src/mcp/tool-generator.ts +658 -0
  227. package/src/mcp/types.ts +131 -0
  228. package/src/node/fs.ts +84 -0
  229. package/src/node/index.ts +2 -0
  230. package/src/node/port.ts +37 -0
  231. package/src/polyfills/async-hooks.ts +6 -0
  232. package/src/polyfills/index.ts +4 -0
  233. package/src/types/index.ts +54 -0
  234. package/src/us-keyboard-layout.ts +723 -0
  235. package/src/utils.ts +149 -0
  236. package/src/zod-schema-utils.ts +133 -0
@@ -0,0 +1,339 @@
1
+ export declare const MIDSCENE_MODEL_INIT_CONFIG_JSON = "MIDSCENE_MODEL_INIT_CONFIG_JSON";
2
+ export declare const MIDSCENE_MODEL_EXTRA_BODY_JSON = "MIDSCENE_MODEL_EXTRA_BODY_JSON";
3
+ export declare const MIDSCENE_MODEL_NAME = "MIDSCENE_MODEL_NAME";
4
+ export declare const MIDSCENE_DEBUG_MODEL_PROFILE = "MIDSCENE_DEBUG_MODEL_PROFILE";
5
+ export declare const MIDSCENE_DEBUG_MODEL_RESPONSE = "MIDSCENE_DEBUG_MODEL_RESPONSE";
6
+ export declare const MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG = "MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG";
7
+ export declare const MIDSCENE_DEBUG_MODE = "MIDSCENE_DEBUG_MODE";
8
+ export declare const MIDSCENE_MCP_USE_PUPPETEER_MODE = "MIDSCENE_MCP_USE_PUPPETEER_MODE";
9
+ export declare const MIDSCENE_MCP_CHROME_PATH = "MIDSCENE_MCP_CHROME_PATH";
10
+ export declare const MIDSCENE_MCP_ANDROID_MODE = "MIDSCENE_MCP_ANDROID_MODE";
11
+ export declare const DOCKER_CONTAINER = "DOCKER_CONTAINER";
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
+ export declare const MIDSCENE_MODEL_TEMPERATURE = "MIDSCENE_MODEL_TEMPERATURE";
21
+ export declare const MIDSCENE_MODEL_RETRY_COUNT = "MIDSCENE_MODEL_RETRY_COUNT";
22
+ export declare const MIDSCENE_MODEL_RETRY_INTERVAL = "MIDSCENE_MODEL_RETRY_INTERVAL";
23
+ export declare const MIDSCENE_MODEL_REASONING_EFFORT = "MIDSCENE_MODEL_REASONING_EFFORT";
24
+ export declare const MIDSCENE_MODEL_REASONING_ENABLED = "MIDSCENE_MODEL_REASONING_ENABLED";
25
+ export declare const MIDSCENE_MODEL_REASONING_BUDGET = "MIDSCENE_MODEL_REASONING_BUDGET";
26
+ /**
27
+ * @deprecated Use MIDSCENE_MODEL_API_KEY instead. This is kept for backward compatibility.
28
+ */
29
+ export declare const OPENAI_API_KEY = "OPENAI_API_KEY";
30
+ /**
31
+ * @deprecated Use MIDSCENE_MODEL_BASE_URL instead. This is kept for backward compatibility.
32
+ */
33
+ export declare const OPENAI_BASE_URL = "OPENAI_BASE_URL";
34
+ /**
35
+ * @deprecated Use MIDSCENE_MODEL_INIT_CONFIG_JSON instead. This is kept for backward compatibility.
36
+ */
37
+ export declare const MIDSCENE_OPENAI_INIT_CONFIG_JSON = "MIDSCENE_OPENAI_INIT_CONFIG_JSON";
38
+ /**
39
+ * @deprecated Use MIDSCENE_MODEL_HTTP_PROXY instead. This is kept for backward compatibility.
40
+ */
41
+ export declare const MIDSCENE_OPENAI_HTTP_PROXY = "MIDSCENE_OPENAI_HTTP_PROXY";
42
+ /**
43
+ * @deprecated Use MIDSCENE_MODEL_SOCKS_PROXY instead. This is kept for backward compatibility.
44
+ */
45
+ export declare const MIDSCENE_OPENAI_SOCKS_PROXY = "MIDSCENE_OPENAI_SOCKS_PROXY";
46
+ /**
47
+ * @deprecated Use MIDSCENE_MODEL_MAX_TOKENS instead. This is kept for backward compatibility.
48
+ */
49
+ export declare const OPENAI_MAX_TOKENS = "OPENAI_MAX_TOKENS";
50
+ export declare const MIDSCENE_ADB_PATH = "MIDSCENE_ADB_PATH";
51
+ export declare const MIDSCENE_ADB_REMOTE_HOST = "MIDSCENE_ADB_REMOTE_HOST";
52
+ export declare const MIDSCENE_ADB_REMOTE_PORT = "MIDSCENE_ADB_REMOTE_PORT";
53
+ export declare const MIDSCENE_ANDROID_IME_STRATEGY = "MIDSCENE_ANDROID_IME_STRATEGY";
54
+ export declare const MIDSCENE_IOS_DEVICE_UDID = "MIDSCENE_IOS_DEVICE_UDID";
55
+ export declare const MIDSCENE_IOS_SIMULATOR_UDID = "MIDSCENE_IOS_SIMULATOR_UDID";
56
+ export declare const MIDSCENE_IOS_DEVICE_CLASS_OVERRIDE = "MIDSCENE_IOS_DEVICE_CLASS_OVERRIDE";
57
+ export declare const MIDSCENE_CACHE = "MIDSCENE_CACHE";
58
+ export declare const MIDSCENE_USE_VLM_UI_TARS = "MIDSCENE_USE_VLM_UI_TARS";
59
+ export declare const MIDSCENE_USE_QWEN_VL = "MIDSCENE_USE_QWEN_VL";
60
+ export declare const MIDSCENE_USE_QWEN3_VL = "MIDSCENE_USE_QWEN3_VL";
61
+ export declare const MIDSCENE_USE_DOUBAO_VISION = "MIDSCENE_USE_DOUBAO_VISION";
62
+ export declare const MIDSCENE_USE_GEMINI = "MIDSCENE_USE_GEMINI";
63
+ export declare const MIDSCENE_USE_VL_MODEL = "MIDSCENE_USE_VL_MODEL";
64
+ export declare const MATCH_BY_POSITION = "MATCH_BY_POSITION";
65
+ export declare const MIDSCENE_REPORT_TAG_NAME = "MIDSCENE_REPORT_TAG_NAME";
66
+ export declare const MIDSCENE_REPORT_QUIET = "MIDSCENE_REPORT_QUIET";
67
+ export declare const MIDSCENE_PREFERRED_LANGUAGE = "MIDSCENE_PREFERRED_LANGUAGE";
68
+ export declare const MIDSCENE_CACHE_MAX_FILENAME_LENGTH = "MIDSCENE_CACHE_MAX_FILENAME_LENGTH";
69
+ export declare const MIDSCENE_REPLANNING_CYCLE_LIMIT = "MIDSCENE_REPLANNING_CYCLE_LIMIT";
70
+ export declare const MIDSCENE_RUN_DIR = "MIDSCENE_RUN_DIR";
71
+ export declare const MIDSCENE_INSIGHT_MODEL_NAME = "MIDSCENE_INSIGHT_MODEL_NAME";
72
+ export declare const MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY = "MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY";
73
+ export declare const MIDSCENE_INSIGHT_MODEL_HTTP_PROXY = "MIDSCENE_INSIGHT_MODEL_HTTP_PROXY";
74
+ export declare const MIDSCENE_INSIGHT_MODEL_BASE_URL = "MIDSCENE_INSIGHT_MODEL_BASE_URL";
75
+ export declare const MIDSCENE_INSIGHT_MODEL_API_KEY = "MIDSCENE_INSIGHT_MODEL_API_KEY";
76
+ export declare const MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON = "MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON";
77
+ export declare const MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON = "MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON";
78
+ export declare const MIDSCENE_INSIGHT_MODEL_TIMEOUT = "MIDSCENE_INSIGHT_MODEL_TIMEOUT";
79
+ export declare const MIDSCENE_INSIGHT_MODEL_TEMPERATURE = "MIDSCENE_INSIGHT_MODEL_TEMPERATURE";
80
+ export declare const MIDSCENE_INSIGHT_MODEL_RETRY_COUNT = "MIDSCENE_INSIGHT_MODEL_RETRY_COUNT";
81
+ export declare const MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL = "MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL";
82
+ export declare const MIDSCENE_INSIGHT_MODEL_FAMILY = "MIDSCENE_INSIGHT_MODEL_FAMILY";
83
+ export declare const MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT = "MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT";
84
+ export declare const MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED = "MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED";
85
+ export declare const MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET = "MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET";
86
+ export declare const YHT_DOMAIN = "YHT_DOMAIN";
87
+ export declare const YHT_ACCESS_TOKEN = "YHT_ACCESS_TOKEN";
88
+ export declare const YHT_MODEL = "YHT_MODEL";
89
+ export declare const YHT_BASE_URL = "YHT_BASE_URL";
90
+ export declare const YHT_CHAT_TYPE = "YHT_CHAT_TYPE";
91
+ export declare const YHT_MODEL_CATEGORY = "YHT_MODEL_CATEGORY";
92
+ export declare const YHT_STREAM = "YHT_STREAM";
93
+ export declare const YHT_TEMPERATURE = "YHT_TEMPERATURE";
94
+ export declare const YHT_TOP_P = "YHT_TOP_P";
95
+ export declare const YHT_TRACE_ID = "YHT_TRACE_ID";
96
+ export declare const MIDSCENE_PLANNING_MODEL_NAME = "MIDSCENE_PLANNING_MODEL_NAME";
97
+ export declare const MIDSCENE_PLANNING_MODEL_SOCKS_PROXY = "MIDSCENE_PLANNING_MODEL_SOCKS_PROXY";
98
+ export declare const MIDSCENE_PLANNING_MODEL_HTTP_PROXY = "MIDSCENE_PLANNING_MODEL_HTTP_PROXY";
99
+ export declare const MIDSCENE_PLANNING_MODEL_BASE_URL = "MIDSCENE_PLANNING_MODEL_BASE_URL";
100
+ export declare const MIDSCENE_PLANNING_MODEL_API_KEY = "MIDSCENE_PLANNING_MODEL_API_KEY";
101
+ export declare const MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON = "MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON";
102
+ export declare const MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON = "MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON";
103
+ export declare const MIDSCENE_PLANNING_MODEL_TIMEOUT = "MIDSCENE_PLANNING_MODEL_TIMEOUT";
104
+ export declare const MIDSCENE_PLANNING_MODEL_TEMPERATURE = "MIDSCENE_PLANNING_MODEL_TEMPERATURE";
105
+ export declare const MIDSCENE_PLANNING_MODEL_RETRY_COUNT = "MIDSCENE_PLANNING_MODEL_RETRY_COUNT";
106
+ export declare const MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL = "MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL";
107
+ export declare const MIDSCENE_PLANNING_MODEL_FAMILY = "MIDSCENE_PLANNING_MODEL_FAMILY";
108
+ export declare const MIDSCENE_PLANNING_MODEL_REASONING_EFFORT = "MIDSCENE_PLANNING_MODEL_REASONING_EFFORT";
109
+ export declare const MIDSCENE_PLANNING_MODEL_REASONING_ENABLED = "MIDSCENE_PLANNING_MODEL_REASONING_ENABLED";
110
+ export declare const MIDSCENE_PLANNING_MODEL_REASONING_BUDGET = "MIDSCENE_PLANNING_MODEL_REASONING_BUDGET";
111
+ export declare const MIDSCENE_MODEL_FAMILY = "MIDSCENE_MODEL_FAMILY";
112
+ /**
113
+ * env keys declared but unused
114
+ */
115
+ export declare const UNUSED_ENV_KEYS: string[];
116
+ /**
117
+ * env keys for debug or basic run
118
+ * can not be override by overrideAIConfig
119
+ */
120
+ export declare const BASIC_ENV_KEYS: readonly ["MIDSCENE_DEBUG_MODE", "MIDSCENE_DEBUG_MODEL_PROFILE", "MIDSCENE_DEBUG_MODEL_RESPONSE", "MIDSCENE_RUN_DIR"];
121
+ export declare const BOOLEAN_ENV_KEYS: readonly ["MIDSCENE_CACHE", "MIDSCENE_MCP_USE_PUPPETEER_MODE", "MIDSCENE_MCP_ANDROID_MODE", "MIDSCENE_LANGSMITH_DEBUG", "MIDSCENE_LANGFUSE_DEBUG", "MIDSCENE_REPORT_QUIET"];
122
+ export declare const NUMBER_ENV_KEYS: readonly ["MIDSCENE_MODEL_MAX_TOKENS", "MIDSCENE_CACHE_MAX_FILENAME_LENGTH", "MIDSCENE_REPLANNING_CYCLE_LIMIT"];
123
+ 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"];
124
+ /**
125
+ * Non model related env keys, used for globally controlling the behavior of midscene
126
+ * Can not be override by agent.modelConfig but can be override by overrideAIConfig
127
+ * Can be access at any time
128
+ */
129
+ export declare const GLOBAL_ENV_KEYS: readonly ["MIDSCENE_CACHE", "MIDSCENE_MCP_USE_PUPPETEER_MODE", "MIDSCENE_MCP_ANDROID_MODE", "MIDSCENE_LANGSMITH_DEBUG", "MIDSCENE_LANGFUSE_DEBUG", "MIDSCENE_REPORT_QUIET", "MIDSCENE_MODEL_MAX_TOKENS", "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"];
130
+ /**
131
+ * Model related eve keys, used for declare which model to use.
132
+ * Can be override by both agent.modelConfig and overrideAIConfig
133
+ * Can only be access after agent.constructor
134
+ */
135
+ export declare const MODEL_ENV_KEYS: readonly ["MIDSCENE_MODEL_NAME", "MIDSCENE_MODEL_INIT_CONFIG_JSON", "MIDSCENE_MODEL_EXTRA_BODY_JSON", "MIDSCENE_MODEL_API_KEY", "MIDSCENE_MODEL_BASE_URL", "MIDSCENE_MODEL_SOCKS_PROXY", "MIDSCENE_MODEL_HTTP_PROXY", "MIDSCENE_MODEL_TIMEOUT", "MIDSCENE_MODEL_TEMPERATURE", "MIDSCENE_MODEL_RETRY_COUNT", "MIDSCENE_MODEL_RETRY_INTERVAL", "MIDSCENE_MODEL_REASONING_EFFORT", "MIDSCENE_MODEL_REASONING_ENABLED", "MIDSCENE_MODEL_REASONING_BUDGET", "MIDSCENE_USE_VLM_UI_TARS", "MIDSCENE_USE_QWEN_VL", "MIDSCENE_USE_QWEN3_VL", "MIDSCENE_USE_DOUBAO_VISION", "MIDSCENE_USE_GEMINI", "MIDSCENE_USE_VL_MODEL", "OPENAI_API_KEY", "OPENAI_BASE_URL", "MIDSCENE_OPENAI_INIT_CONFIG_JSON", "MIDSCENE_OPENAI_HTTP_PROXY", "MIDSCENE_OPENAI_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_NAME", "MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_HTTP_PROXY", "MIDSCENE_INSIGHT_MODEL_BASE_URL", "MIDSCENE_INSIGHT_MODEL_API_KEY", "MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON", "MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON", "MIDSCENE_INSIGHT_MODEL_TIMEOUT", "MIDSCENE_INSIGHT_MODEL_TEMPERATURE", "MIDSCENE_INSIGHT_MODEL_RETRY_COUNT", "MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL", "MIDSCENE_INSIGHT_MODEL_FAMILY", "MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT", "MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED", "MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET", "MIDSCENE_PLANNING_MODEL_NAME", "MIDSCENE_PLANNING_MODEL_SOCKS_PROXY", "MIDSCENE_PLANNING_MODEL_HTTP_PROXY", "MIDSCENE_PLANNING_MODEL_BASE_URL", "MIDSCENE_PLANNING_MODEL_API_KEY", "MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON", "MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON", "MIDSCENE_PLANNING_MODEL_TIMEOUT", "MIDSCENE_PLANNING_MODEL_TEMPERATURE", "MIDSCENE_PLANNING_MODEL_RETRY_COUNT", "MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL", "MIDSCENE_PLANNING_MODEL_FAMILY", "MIDSCENE_PLANNING_MODEL_REASONING_EFFORT", "MIDSCENE_PLANNING_MODEL_REASONING_ENABLED", "MIDSCENE_PLANNING_MODEL_REASONING_BUDGET", "MIDSCENE_MODEL_FAMILY", "YHT_DOMAIN", "YHT_ACCESS_TOKEN", "YHT_MODEL", "YHT_BASE_URL", "YHT_CHAT_TYPE", "YHT_MODEL_CATEGORY", "YHT_STREAM", "YHT_TEMPERATURE", "YHT_TOP_P"];
136
+ 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_MCP_USE_PUPPETEER_MODE", "MIDSCENE_MCP_ANDROID_MODE", "MIDSCENE_LANGSMITH_DEBUG", "MIDSCENE_LANGFUSE_DEBUG", "MIDSCENE_REPORT_QUIET", "MIDSCENE_MODEL_MAX_TOKENS", "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_EXTRA_BODY_JSON", "MIDSCENE_MODEL_API_KEY", "MIDSCENE_MODEL_BASE_URL", "MIDSCENE_MODEL_SOCKS_PROXY", "MIDSCENE_MODEL_HTTP_PROXY", "MIDSCENE_MODEL_TIMEOUT", "MIDSCENE_MODEL_TEMPERATURE", "MIDSCENE_MODEL_RETRY_COUNT", "MIDSCENE_MODEL_RETRY_INTERVAL", "MIDSCENE_MODEL_REASONING_EFFORT", "MIDSCENE_MODEL_REASONING_ENABLED", "MIDSCENE_MODEL_REASONING_BUDGET", "MIDSCENE_USE_VLM_UI_TARS", "MIDSCENE_USE_QWEN_VL", "MIDSCENE_USE_QWEN3_VL", "MIDSCENE_USE_DOUBAO_VISION", "MIDSCENE_USE_GEMINI", "MIDSCENE_USE_VL_MODEL", "OPENAI_API_KEY", "OPENAI_BASE_URL", "MIDSCENE_OPENAI_INIT_CONFIG_JSON", "MIDSCENE_OPENAI_HTTP_PROXY", "MIDSCENE_OPENAI_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_NAME", "MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_HTTP_PROXY", "MIDSCENE_INSIGHT_MODEL_BASE_URL", "MIDSCENE_INSIGHT_MODEL_API_KEY", "MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON", "MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON", "MIDSCENE_INSIGHT_MODEL_TIMEOUT", "MIDSCENE_INSIGHT_MODEL_TEMPERATURE", "MIDSCENE_INSIGHT_MODEL_RETRY_COUNT", "MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL", "MIDSCENE_INSIGHT_MODEL_FAMILY", "MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT", "MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED", "MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET", "MIDSCENE_PLANNING_MODEL_NAME", "MIDSCENE_PLANNING_MODEL_SOCKS_PROXY", "MIDSCENE_PLANNING_MODEL_HTTP_PROXY", "MIDSCENE_PLANNING_MODEL_BASE_URL", "MIDSCENE_PLANNING_MODEL_API_KEY", "MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON", "MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON", "MIDSCENE_PLANNING_MODEL_TIMEOUT", "MIDSCENE_PLANNING_MODEL_TEMPERATURE", "MIDSCENE_PLANNING_MODEL_RETRY_COUNT", "MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL", "MIDSCENE_PLANNING_MODEL_FAMILY", "MIDSCENE_PLANNING_MODEL_REASONING_EFFORT", "MIDSCENE_PLANNING_MODEL_REASONING_ENABLED", "MIDSCENE_PLANNING_MODEL_REASONING_BUDGET", "MIDSCENE_MODEL_FAMILY", "YHT_DOMAIN", "YHT_ACCESS_TOKEN", "YHT_MODEL", "YHT_BASE_URL", "YHT_CHAT_TYPE", "YHT_MODEL_CATEGORY", "YHT_STREAM", "YHT_TEMPERATURE", "YHT_TOP_P"];
137
+ export type TEnvKeys = (typeof ALL_ENV_KEYS)[number];
138
+ export type TGlobalConfig = Record<TEnvKeys, string | undefined>;
139
+ /**
140
+ * valid Model family types
141
+ */
142
+ export type TModelFamily = 'qwen2.5-vl' | 'qwen3-vl' | 'qwen3.5' | 'qwen3.6' | 'doubao-vision' | 'doubao-seed' | 'gemini' | 'vlm-ui-tars' | 'vlm-ui-tars-doubao' | 'vlm-ui-tars-doubao-1.5' | 'glm-v' | 'auto-glm' | 'auto-glm-multilingual' | 'gpt-5';
143
+ export declare const MODEL_FAMILY_VALUES: TModelFamily[];
144
+ export interface IModelConfigForInsight {
145
+ [MIDSCENE_INSIGHT_MODEL_NAME]: string;
146
+ [MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY]?: string;
147
+ [MIDSCENE_INSIGHT_MODEL_HTTP_PROXY]?: string;
148
+ [MIDSCENE_INSIGHT_MODEL_BASE_URL]?: string;
149
+ [MIDSCENE_INSIGHT_MODEL_API_KEY]?: string;
150
+ [MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON]?: string;
151
+ [MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON]?: string;
152
+ [MIDSCENE_INSIGHT_MODEL_TIMEOUT]?: string;
153
+ [MIDSCENE_INSIGHT_MODEL_TEMPERATURE]?: string;
154
+ [MIDSCENE_INSIGHT_MODEL_FAMILY]?: TModelFamily;
155
+ [YHT_DOMAIN]?: string;
156
+ [YHT_ACCESS_TOKEN]?: string;
157
+ [YHT_MODEL]?: string;
158
+ [YHT_BASE_URL]?: string;
159
+ [YHT_CHAT_TYPE]?: string;
160
+ [YHT_MODEL_CATEGORY]?: string;
161
+ [YHT_STREAM]?: string;
162
+ [YHT_TEMPERATURE]?: string;
163
+ [YHT_TOP_P]?: string;
164
+ }
165
+ export interface IModelConfigForPlanning {
166
+ [MIDSCENE_PLANNING_MODEL_NAME]: string;
167
+ [MIDSCENE_PLANNING_MODEL_SOCKS_PROXY]?: string;
168
+ [MIDSCENE_PLANNING_MODEL_HTTP_PROXY]?: string;
169
+ [MIDSCENE_PLANNING_MODEL_BASE_URL]?: string;
170
+ [MIDSCENE_PLANNING_MODEL_API_KEY]?: string;
171
+ [MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON]?: string;
172
+ [MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON]?: string;
173
+ [MIDSCENE_PLANNING_MODEL_TIMEOUT]?: string;
174
+ [MIDSCENE_PLANNING_MODEL_TEMPERATURE]?: string;
175
+ [MIDSCENE_PLANNING_MODEL_FAMILY]?: TModelFamily;
176
+ }
177
+ /**
178
+ * Model configuration for Planning intent.
179
+ *
180
+ * IMPORTANT: Planning MUST use a vision language model (VL mode).
181
+ * DOM-based planning is not supported.
182
+ *
183
+ * Required: MIDSCENE_MODEL_FAMILY must be set to one of 「TModelFamily」
184
+ */
185
+ export interface IModelConfigForDefault {
186
+ [MIDSCENE_MODEL_NAME]: string;
187
+ [MIDSCENE_MODEL_SOCKS_PROXY]?: string;
188
+ [MIDSCENE_MODEL_HTTP_PROXY]?: string;
189
+ [MIDSCENE_MODEL_BASE_URL]?: string;
190
+ [MIDSCENE_MODEL_API_KEY]?: string;
191
+ [MIDSCENE_MODEL_INIT_CONFIG_JSON]?: string;
192
+ [MIDSCENE_MODEL_EXTRA_BODY_JSON]?: string;
193
+ [MIDSCENE_MODEL_FAMILY]?: TModelFamily;
194
+ [MIDSCENE_MODEL_TEMPERATURE]?: string;
195
+ [MIDSCENE_MODEL_REASONING_EFFORT]?: string;
196
+ [MIDSCENE_MODEL_REASONING_ENABLED]?: string;
197
+ [MIDSCENE_MODEL_REASONING_BUDGET]?: string;
198
+ }
199
+ export interface IModelConfigForDefaultLegacy {
200
+ [MIDSCENE_MODEL_NAME]: string;
201
+ [MIDSCENE_OPENAI_SOCKS_PROXY]?: string;
202
+ [MIDSCENE_OPENAI_HTTP_PROXY]?: string;
203
+ [OPENAI_BASE_URL]?: string;
204
+ [OPENAI_API_KEY]?: string;
205
+ [MIDSCENE_OPENAI_INIT_CONFIG_JSON]?: string;
206
+ }
207
+ /**
208
+ * - insight: Visual Question Answering and Visual Grounding (unified)
209
+ * - planning: planning
210
+ * - default: all except insight、planning
211
+ */
212
+ export type TIntent = 'insight' | 'planning' | 'default';
213
+ /**
214
+ * Env-style model configuration map supplied directly to the agent.
215
+ * Numbers are allowed so callers can pass numeric env values (e.g. limits) without casting.
216
+ */
217
+ export type TModelConfig = Record<string, string | number>;
218
+ export declare enum UITarsModelVersion {
219
+ V1_0 = "1.0",
220
+ V1_5 = "1.5",
221
+ DOUBAO_1_5_15B = "doubao-1.5-15B",
222
+ DOUBAO_1_5_20B = "doubao-1.5-20B"
223
+ }
224
+ /**
225
+ * Callback to create custom OpenAI client instance
226
+ * @param config - Resolved model configuration including apiKey, baseURL, modelName, intent, etc.
227
+ * @returns OpenAI client instance (can be wrapped with langsmith, langfuse, etc.)
228
+ *
229
+ * Note: Wrapper functions like langsmith's wrapOpenAI() return the same OpenAI instance
230
+ * with enhanced behavior, so the return type remains compatible with OpenAI.
231
+ *
232
+ * Note: The return type is `any` in the shared package to avoid requiring openai as a dependency.
233
+ * The actual implementation should return an OpenAI instance.
234
+ *
235
+ * @example
236
+ * ```typescript
237
+ * import OpenAI from 'openai';
238
+ * import { wrapOpenAI } from 'langsmith/wrappers';
239
+ *
240
+ * createOpenAIClient: async (openai, opts) => {
241
+ * // Wrap with langsmith for planning tasks
242
+ * if (opts.baseURL?.includes('planning')) {
243
+ * return wrapOpenAI(openai, { metadata: { task: 'planning' } });
244
+ * }
245
+ *
246
+ * return openai;
247
+ * }
248
+ * ```
249
+ */
250
+ export type CreateOpenAIClientFn = (openAIInstance: any, options: Record<string, unknown>) => Promise<any>;
251
+ export interface IModelConfig {
252
+ /**
253
+ * proxy
254
+ */
255
+ socksProxy?: string;
256
+ httpProxy?: string;
257
+ /**
258
+ * model
259
+ */
260
+ modelName: string;
261
+ /**
262
+ * OpenAI
263
+ */
264
+ openaiBaseURL?: string;
265
+ openaiApiKey?: string;
266
+ openaiExtraConfig?: Record<string, unknown>;
267
+ /**
268
+ * Extra body parameters merged into each chat completion request body.
269
+ * Unlike openaiExtraConfig (which configures the OpenAI client instance),
270
+ * this is spread directly into the completion.create() call body.
271
+ * Example: { "chat_template_kwargs": { "enable_thinking": true } }
272
+ */
273
+ extraBody?: Record<string, unknown>;
274
+ /**
275
+ * Timeout for API calls in milliseconds.
276
+ * If not set, uses OpenAI SDK default (10 minutes).
277
+ */
278
+ timeout?: number;
279
+ /**
280
+ * Temperature for model sampling.
281
+ */
282
+ temperature?: number;
283
+ /**
284
+ * Number of retries when AI call fails.
285
+ * Default is 1 (retry once after failure).
286
+ */
287
+ retryCount?: number;
288
+ /**
289
+ * Interval between retries in milliseconds.
290
+ * Default is 2000.
291
+ */
292
+ retryInterval?: number;
293
+ /**
294
+ * Reasoning effort level for the model.
295
+ * Passed through to model-family-specific parameters (e.g., reasoning_effort for doubao, reasoning.effort for gpt-5).
296
+ */
297
+ reasoningEffort?: string;
298
+ /**
299
+ * Enable/disable reasoning for the model.
300
+ * Passed through to model-family-specific parameters (e.g., enable_thinking for qwen, thinking.type for doubao/glm-v).
301
+ */
302
+ reasoningEnabled?: boolean;
303
+ /**
304
+ * Reasoning token budget for the model.
305
+ * Passed through to model-family-specific parameters (e.g., thinking_budget for qwen).
306
+ */
307
+ reasoningBudget?: number;
308
+ /**
309
+ * Model family - unified model configuration
310
+ * Maps directly to model families like 'qwen2.5-vl', 'qwen3-vl', 'doubao-vision', 'doubao-seed', etc.
311
+ */
312
+ modelFamily?: TModelFamily;
313
+ uiTarsModelVersion?: UITarsModelVersion;
314
+ modelDescription: string;
315
+ /**
316
+ * original intent from the config
317
+ */
318
+ intent: TIntent;
319
+ /**
320
+ * Custom OpenAI client factory function
321
+ *
322
+ * If provided, this function will be called to create OpenAI client instances
323
+ * for each AI call, allowing you to:
324
+ * - Wrap clients with observability tools (langsmith, langfuse)
325
+ * - Use custom OpenAI-compatible clients
326
+ * - Apply different configurations based on intent
327
+ */
328
+ createOpenAIClient?: CreateOpenAIClientFn;
329
+ yht_domain?: string;
330
+ yht_access_token?: string;
331
+ yht_model?: string;
332
+ yht_base_url?: string;
333
+ yht_chat_type?: string;
334
+ yht_model_category?: string;
335
+ yht_stream?: string;
336
+ yht_temperature?: string;
337
+ yht_top_p?: string;
338
+ yht_trace_id?: string;
339
+ }
@@ -0,0 +1,7 @@
1
+ import { GlobalConfigManager } from './global-config-manager';
2
+ import { ModelConfigManager } from './model-config-manager';
3
+ import { type GLOBAL_ENV_KEYS, type MODEL_ENV_KEYS } from './types';
4
+ export declare const globalModelConfigManager: ModelConfigManager;
5
+ export declare const globalConfigManager: GlobalConfigManager;
6
+ export declare const getPreferredLanguage: () => string;
7
+ export declare const overrideAIConfig: (newConfig: Partial<Record<(typeof GLOBAL_ENV_KEYS)[number] | (typeof MODEL_ENV_KEYS)[number], string>>, extendMode?: boolean) => void;
@@ -0,0 +1 @@
1
+ export { NodeType, TEXT_MAX_SIZE, TEXT_SIZE_THRESHOLD, } from '../constants/index';
@@ -0,0 +1,2 @@
1
+ export declare const postWindowMessage: (targetWin: any, sourceWin: any, payload: any, targetOrigin?: any, timeout?: any) => Promise<any>;
2
+ export declare const onWindowMessage: (win: any, fn: any) => () => any;
@@ -0,0 +1,69 @@
1
+ /**
2
+ *
3
+ * 直到遇到fieldid或id为止
4
+ * @param {*} dom
5
+ * @param {*} onece
6
+ * @returns
7
+ */
8
+ declare const getLocatorUntilFieldid: (dom: any, type?: string) => {
9
+ type: string;
10
+ value: any;
11
+ };
12
+ /**
13
+ * 全路径,适用于静态元素,当元素动态改变,而节点位置不变,可能不准确,比如百度的搜索结果,位置可能发生改变,指向一个固定的项
14
+ * 实现浏览器自带的Copy fullXPath方法
15
+ * 一直递归到 /html
16
+ * 忽略id
17
+ * 其他同上XPath
18
+ * @param {*} dom
19
+ * @returns string
20
+ */
21
+ declare const getFullLocator: (dom: any, type?: string) => {
22
+ type: string;
23
+ value: any;
24
+ };
25
+ /**
26
+ * 对外的方法,依次调用上面的方法,生成可以的列表
27
+ * return []
28
+ * */
29
+ declare const getLocators: (dom: any) => any[];
30
+ /**
31
+ * 对外的方法,iframe在页面数量少,不需要全路径,要简洁
32
+ * @param {*} dom
33
+ */
34
+ declare const getContainerLocatorData: (dom: any) => {
35
+ containerAllPaths: any[];
36
+ containerType: string;
37
+ containerPathType: any;
38
+ containerPathValue: any;
39
+ containerPathIndex: any;
40
+ };
41
+ /**
42
+ * 获取多个元素
43
+ * @param {*} locators
44
+ * @param {*} docOrHost
45
+ * @param {*} selected
46
+ * @returns
47
+ */
48
+ declare const getManyElementByLocators: (docOrHost: Document | undefined, locators: any[], selected?: boolean) => unknown[];
49
+ /**
50
+ * 获取单个元素
51
+ * @param {*} locators
52
+ * @param {*} docOrHost
53
+ * @returns
54
+ */
55
+ declare const getOneElementByLocators: (docOrHost: any, locators: any[], selected?: boolean) => {} | null;
56
+ /**
57
+ * 录制时先获取shadowRoot的容器树,再添加frame的容器树
58
+ * 获取shadowRoot的容器树
59
+ * @param {*} dom
60
+ * @returns
61
+ */
62
+ declare const getShadowRootContainerStack: (dom: any) => {
63
+ containerAllPaths: any[];
64
+ containerType: string;
65
+ containerPathType: any;
66
+ containerPathValue: any;
67
+ containerPathIndex: any;
68
+ }[];
69
+ export { getLocators, getShadowRootContainerStack, getFullLocator, getLocatorUntilFieldid, getContainerLocatorData as getContainerPath, getManyElementByLocators as getElements, getOneElementByLocators as getUniqueElement, };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,57 @@
1
+ import type { LocateResultElement } from '../types';
2
+ export declare function isFormElement(node: globalThis.Node): boolean;
3
+ export declare function isButtonElement(node: globalThis.Node): node is globalThis.HTMLButtonElement;
4
+ export declare function isAElement(node: globalThis.Node): node is globalThis.HTMLButtonElement;
5
+ export declare function isSvgElement(node: globalThis.Node): node is globalThis.SVGSVGElement;
6
+ export declare function isImgElement(node: globalThis.Node): node is globalThis.HTMLImageElement;
7
+ export declare function isNotContainerElement(node: globalThis.Node): boolean;
8
+ export declare function isTextElement(node: globalThis.Node): node is globalThis.HTMLTextAreaElement;
9
+ export declare function isContainerElement(node: globalThis.Node): node is globalThis.HTMLElement;
10
+ /**
11
+ * Generate a LocateResultElement from a point.
12
+ * This function creates an expanded rect around the given center point.
13
+ *
14
+ * Note: Center coordinates should be integers for pixel-aligned positioning.
15
+ * If decimal values are provided, they will be used as-is, which may result in
16
+ * non-pixel-aligned rect positions.
17
+ *
18
+ * The rect positioning behavior:
19
+ * - When edgeSize is even: center is at the top-left of the four center pixels
20
+ * For example, with edgeSize=4 and center=[10, 10]:
21
+ * □□□□
22
+ * □■□□ (■ represents the center point at pixel 10)
23
+ * □□□□
24
+ * □□□□
25
+ *
26
+ * - When edgeSize is odd: center is at the exact middle pixel
27
+ * For example, with edgeSize=5 and center=[10, 10]:
28
+ * □□□□□
29
+ * □□■□□ (■ represents the center point at pixel 10)
30
+ * □□□□□
31
+ *
32
+ * @param center - Center point coordinates as [x, y] (should be integers)
33
+ * @param description - Description of the element
34
+ * @param edgeSize - Size to expand around the center point (default: 8)
35
+ * @returns A LocateResultElement with rect, center, and description
36
+ */
37
+ export declare function generateElementByPoint(center: [number, number], description: string, edgeSize?: number): LocateResultElement;
38
+ /**
39
+ * Generate a LocateResultElement from a rect.
40
+ * This function calculates the center point from the rect and preserves the
41
+ * original rect as the returned element boundary.
42
+ *
43
+ * Note: The rect uses inclusive coordinates where:
44
+ * - A rect from [left=10, top=10] with [width=1, height=1] covers exactly 1 pixel
45
+ * - The actual pixel range is [left, left+width) which means width pixels
46
+ *
47
+ * @param sourceRect - The source rect to generate element from (typically contains integer values)
48
+ * @param description - Description of the element
49
+ * @param edgeSize - Deprecated, retained for backward compatibility
50
+ * @returns A LocateResultElement with the original rect, center (always integers), and description
51
+ */
52
+ export declare function generateElementByRect(sourceRect: {
53
+ left: number;
54
+ top: number;
55
+ width: number;
56
+ height: number;
57
+ }, description: string, _edgeSize?: number): LocateResultElement;
@@ -0,0 +1,33 @@
1
+ import type { NodeType } from '../constants/index';
2
+ export interface ElementInfo {
3
+ id: string;
4
+ indexId: number;
5
+ nodeHashId: string;
6
+ xpaths?: string[];
7
+ attributes: {
8
+ nodeType: NodeType;
9
+ [key: string]: string;
10
+ };
11
+ nodeType: NodeType;
12
+ content: string;
13
+ rect: {
14
+ left: number;
15
+ top: number;
16
+ width: number;
17
+ height: number;
18
+ };
19
+ center: [number, number];
20
+ isVisible: boolean;
21
+ }
22
+ export interface ElementNode {
23
+ node: ElementInfo | null;
24
+ children: ElementNode[];
25
+ }
26
+ export { descriptionOfTree, traverseTree, treeToList, truncateText, trimAttributes, } from './tree';
27
+ export { extractTextWithPosition as webExtractTextWithPosition } from './web-extractor';
28
+ export { extractTreeNode as webExtractNodeTree } from './web-extractor';
29
+ export { extractTreeNodeAsString as webExtractNodeTreeAsString } from './web-extractor';
30
+ export { getElementFromPoint as webGetElementFromPoint } from './web-extractor';
31
+ export { getXpathsByPoint, getXpathsById, getNodeInfoByXpath, getElementInfoByXpath, getElementXpath, } from './locator';
32
+ export { generateElementByPoint, generateElementByRect } from './dom-util';
33
+ export { isNotContainerElement } from './dom-util';
@@ -0,0 +1,9 @@
1
+ import type { ElementInfo } from '.';
2
+ import type { Point } from '../types';
3
+ export declare const getElementXpath: (element: Node, isOrderSensitive?: boolean, isLeafElement?: boolean, limitToCurrentDocument?: boolean) => string;
4
+ /** Retrieve XPath for a previously cached node by its hash ID.
5
+ * Returns a local xpath within the node's own document (limitToCurrentDocument=true). */
6
+ export declare function getXpathsById(id: string): string[] | null;
7
+ export declare function getXpathsByPoint(point: Point, isOrderSensitive: boolean): string[] | null;
8
+ export declare function getNodeInfoByXpath(xpath: string): Node | null;
9
+ export declare function getElementInfoByXpath(xpath: string): ElementInfo | null;
@@ -0,0 +1,6 @@
1
+ import type { BaseElement, ElementTreeNode } from '../types';
2
+ export declare function truncateText(text: string | number | object | undefined, maxLength?: number): string;
3
+ export declare function trimAttributes(attributes: Record<string, any>, truncateTextLength?: number): Record<string, string>;
4
+ export declare function descriptionOfTree<ElementType extends BaseElement = BaseElement>(tree: ElementTreeNode<ElementType>, truncateTextLength?: number, filterNonTextContent?: boolean, visibleOnly?: boolean): string;
5
+ export declare function treeToList<T extends BaseElement>(tree: ElementTreeNode<T>): T[];
6
+ export declare function traverseTree<T extends BaseElement, ReturnNodeType extends BaseElement>(tree: ElementTreeNode<T>, onNode: (node: T) => ReturnNodeType): ElementTreeNode<ReturnNodeType>;
@@ -0,0 +1,47 @@
1
+ import type { Rect } from '../types';
2
+ export declare function setDebugMode(mode: boolean): void;
3
+ export declare function getDebugMode(): boolean;
4
+ export declare function logger(..._msg: any[]): void;
5
+ export declare function isElementPartiallyInViewport(rect: ReturnType<typeof getRect>, currentWindow: typeof window, currentDocument: typeof document, visibleAreaRatio?: number): boolean;
6
+ export declare function getPseudoElementContent(element: globalThis.Node, currentWindow: typeof globalThis.window): {
7
+ before: string;
8
+ after: string;
9
+ };
10
+ export declare function hasOverflowY(element: globalThis.HTMLElement, currentWindow: typeof globalThis.window): boolean;
11
+ export interface ExtractedRect {
12
+ width: number;
13
+ height: number;
14
+ left: number;
15
+ top: number;
16
+ right: number;
17
+ bottom: number;
18
+ x: number;
19
+ y: number;
20
+ zoom: number;
21
+ }
22
+ export declare function overlappedRect(rect1: ExtractedRect, rect2: ExtractedRect): ExtractedRect | null;
23
+ export declare function getRect(el: globalThis.HTMLElement | globalThis.Node, baseZoom: number, // base zoom
24
+ currentWindow: typeof globalThis.window): ExtractedRect;
25
+ export declare function elementRect(el: globalThis.HTMLElement | globalThis.Node | null, currentWindow: typeof globalThis.window, currentDocument: typeof globalThis.document, baseZoom?: number): {
26
+ left: number;
27
+ top: number;
28
+ width: number;
29
+ height: number;
30
+ zoom: number;
31
+ isVisible: boolean;
32
+ } | false;
33
+ export declare function validTextNodeContent(node: globalThis.Node): string | false;
34
+ export declare function getNodeAttributes(node: globalThis.HTMLElement | globalThis.Node, currentWindow: typeof globalThis.window): Record<string, string>;
35
+ /**
36
+ * Reset the node hash cache. Call at the beginning of each extraction cycle
37
+ * to prevent stale DOM references from accumulating.
38
+ */
39
+ export declare function setNodeHashCacheListOnWindow(): void;
40
+ export declare function setNodeToCacheList(node: globalThis.Node, id: string): void;
41
+ export declare function getNodeFromCacheList(id: string): globalThis.Node | undefined;
42
+ export declare function midsceneGenerateHash(node: globalThis.Node | null, content: string, rect: Rect): string;
43
+ export declare function generateId(numberId: number): string;
44
+ export declare function setGenerateHashOnWindow(): void;
45
+ export declare function setMidsceneVisibleRectOnWindow(): void;
46
+ export declare function setExtractTextWithPositionOnWindow(): void;
47
+ export declare function getTopDocument(): globalThis.HTMLElement;
@@ -0,0 +1,24 @@
1
+ import type { WebElementInfo } from '../types';
2
+ import type { Point } from '../types';
3
+ export declare function collectElementInfo(node: Node, currentWindow: typeof window, currentDocument: typeof document, baseZoom?: number, basePoint?: Point, isContainer?: boolean): WebElementInfo | null | any;
4
+ interface WebElementNode {
5
+ node: WebElementInfo | null;
6
+ children: WebElementNode[];
7
+ }
8
+ export declare function extractTextWithPosition(initNode: globalThis.Node, debugMode?: boolean): Promise<WebElementInfo[]>;
9
+ export declare function extractTreeNodeAsString(initNode: globalThis.Node, visibleOnly?: boolean, debugMode?: boolean): Promise<string>;
10
+ export declare function extractTreeNode(initNode: globalThis.Node, debugMode?: boolean, basePoint?: Point, baseZoom?: number): Promise<WebElementNode>;
11
+ export declare function mergeElementAndChildrenRects(node: Node, currentWindow: typeof window, currentDocument: typeof document, baseZoom?: number): {
12
+ left: number;
13
+ top: number;
14
+ width: number;
15
+ height: number;
16
+ zoom: number;
17
+ isVisible: boolean;
18
+ } | null;
19
+ export declare const getElementFromPoint: (args: {
20
+ x: number;
21
+ y: number;
22
+ containerPaths: string[];
23
+ }) => Promise<any>;
24
+ export {};
@@ -0,0 +1,26 @@
1
+ import type { BaseElement, Rect } from '../types';
2
+ interface ElementForOverlay {
3
+ rect: Rect;
4
+ indexId?: number;
5
+ }
6
+ export declare const compositeElementInfoImg: (options: {
7
+ inputImgBase64: string;
8
+ elementsPositionInfo: Array<ElementForOverlay>;
9
+ size?: {
10
+ width: number;
11
+ height: number;
12
+ };
13
+ annotationPadding?: number;
14
+ borderThickness?: number;
15
+ prompt?: string;
16
+ }) => Promise<string>;
17
+ export declare const processImageElementInfo: (options: {
18
+ inputImgBase64: string;
19
+ elementsPositionInfo: Array<BaseElement>;
20
+ elementsPositionInfoWithoutText: Array<BaseElement>;
21
+ }) => Promise<{
22
+ compositeElementInfoImgBase64: string;
23
+ compositeElementInfoImgWithoutTextBase64: string;
24
+ }>;
25
+ export declare function annotateRects(imgBase64: string, rects: Rect[], prompt?: string): Promise<string>;
26
+ export {};