@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,227 @@
1
+ export const PLAYWRIGHT_EXAMPLE_CODE = `
2
+ // Reference the following code to generate Midscene test cases
3
+ // The following is test code for Midscene AI, for reference
4
+ // The following is Playwright syntax, you can use Playwright to assist in test generation
5
+ IMPORTANT: Follow these exact type signatures for AI functions:
6
+
7
+ // Type signatures for AI functions:
8
+ aiAct(prompt: string, options?: { cacheable?: boolean, deepThink?: 'unset' | true | false }): Promise<void>
9
+ aiInput(text: string, locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>
10
+ aiTap(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>
11
+ aiHover(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>
12
+ aiDoubleClick(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>
13
+ aiKeyboardPress(key: string, locate?: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>
14
+ aiScroll(locate: string | undefined, options: {
15
+ direction?: 'up' | 'down' | 'left' | 'right',
16
+ scrollType?: 'singleAction' | 'scrollToBottom' | 'scrollToTop' | 'scrollToRight' | 'scrollToLeft',
17
+ distance?: number | null,
18
+ deepLocate?: boolean,
19
+ xpath?: string,
20
+ cacheable?: boolean
21
+ }): Promise<void>
22
+ aiAssert(assertion: string, options?: { errorMessage?: string }): Promise<void>
23
+ aiWaitFor(prompt: string, options?: { timeout?: number }): Promise<void>
24
+ aiQuery<T>(queryObject: Record<string, string>): Promise<T> // Extracts data from page based on descriptions
25
+
26
+ // examples:
27
+ // Reference the following code to generate Midscene test cases
28
+ // The following is test code for Midscene AI, for reference
29
+ // The following is Playwright syntax, you can use Playwright to assist in test generation
30
+ import { test as base } from '@playwright/test';
31
+ import type { PlayWrightAiFixtureType } from '@godscene/web/playwright';
32
+ import { PlaywrightAiFixture } from '@godscene/web/playwright';
33
+
34
+ const test = base.extend<PlayWrightAiFixtureType>(PlaywrightAiFixture({
35
+ waitForNetworkIdleTimeout: 2000, // optional, the timeout for waiting for network idle between each action, default is 2000ms
36
+ }));
37
+
38
+
39
+ test.beforeEach(async ({ page }) => {
40
+ await page.goto('https://www.xxx.com/');
41
+ await page.setViewportSize({ width: 1920, height: 1080 });
42
+ });
43
+
44
+ test('ai shop', async ({
45
+ aiAct,
46
+ aiInput,
47
+ aiAssert,
48
+ aiQuery,
49
+ aiKeyboardPress,
50
+ aiHover,
51
+ aiTap,
52
+ aiWaitFor,
53
+ agentForPage,
54
+ page,
55
+ }) => {
56
+ // login
57
+ await aiAssert('The page shows the login interface');
58
+ await aiInput('user_name', 'in user name input');
59
+ await aiInput('password', 'in password input');
60
+ await aiKeyboardPress('Enter', 'Login Button');
61
+
62
+ // check the login success
63
+ await aiWaitFor('The page shows that the loading is complete');
64
+ await aiAssert('The current page shows the product detail page');
65
+
66
+ // check the product info
67
+ const dataA = await aiQuery({
68
+ userInfo: 'User information in the format {name: string}',
69
+ theFirstProductInfo: 'The first product info in the format {name: string, price: number}',
70
+ });
71
+ expect(dataA.theFirstProductInfo.name).toBe('xxx');
72
+ expect(dataA.theFirstProductInfo.price).toBe(100);
73
+
74
+
75
+ // add to cart
76
+ await aiTap('click add to cart button');
77
+
78
+ await aiTap('click right top cart icon');
79
+ await aiAssert('The cart icon shows the number 1');
80
+ });
81
+ `;
82
+
83
+ export const YAML_EXAMPLE_CODE = `
84
+ CRITICAL - YAML Indentation Rules:
85
+ For actions with additional parameters (aiScroll, aiInput, aiKeyboardPress), the parameters must be SIBLING keys at the SAME indentation level as the action key, NOT nested children indented further.
86
+ CORRECT (parameters align with the action key):
87
+ - aiScroll:
88
+ direction: 'down'
89
+ scrollType: 'singleAction'
90
+ distance: 500
91
+ locate: "main content area"
92
+ - aiInput: 'text value'
93
+ locate: 'input field description'
94
+ WRONG (parameters are indented further than the action key, DO NOT do this):
95
+ - aiScroll:
96
+ direction: 'down'
97
+ scrollType: 'singleAction'
98
+ - aiInput: 'text value'
99
+ locate: 'input field description'
100
+
101
+ 1. Format:
102
+
103
+ web:
104
+ url: "starting_url"
105
+ viewportWidth: 1280
106
+ viewportHeight: 960
107
+
108
+ tasks:
109
+ - name: "descriptive task name"
110
+ flow:
111
+ - aiTap: "element description"
112
+ xpath: '/html/body/div[1]/button[1]'
113
+ - aiInput: 'text value'
114
+ locate: 'input field description'
115
+ xpath: '/html/body/div[1]/input[1]'
116
+ - aiScroll:
117
+ direction: 'down'
118
+ scrollType: 'singleAction'
119
+ distance: 500
120
+ locate: "scrollable area description"
121
+ xpath: '/html/body/div[1]/main[1]'
122
+ - aiAssert: "expected state"
123
+ - sleep: 1000
124
+
125
+ 2. Action Types:
126
+ - aiTap: for clicks (natural language targeting)
127
+ - aiInput: for text input with 'locate' field
128
+ - aiScroll: with direction and scrollType
129
+ - aiAssert: for validations
130
+ - sleep: for delays (milliseconds)
131
+
132
+
133
+
134
+ YAML type
135
+ tasks:
136
+ - name: <name>
137
+ continueOnError: <boolean> # Optional, whether to continue to the next task on error, defaults to false.
138
+ flow:
139
+ # Auto Planning (.ai)
140
+ # ----------------
141
+
142
+ # Perform an interaction. \`ai\` is a shorthand for \`aiAct\`.
143
+ - ai: <prompt>
144
+ cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.
145
+
146
+ # This usage is the same as \`ai\`.
147
+ - aiAct: <prompt>
148
+ cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.
149
+
150
+ # Instant Action (.aiTap, .aiDoubleClick, .aiHover, .aiInput, .aiKeyboardPress, .aiScroll)
151
+ # ----------------
152
+
153
+ # Tap an element described by a prompt.
154
+ - aiTap: <prompt>
155
+ deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.
156
+ xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.
157
+ cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.
158
+
159
+ # Double click an element described by a prompt.
160
+ - aiDoubleClick: <prompt>
161
+ deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.
162
+ xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.
163
+ cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.
164
+
165
+ # Hover over an element described by a prompt.
166
+ - aiHover: <prompt>
167
+ deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.
168
+ xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.
169
+ cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.
170
+
171
+ # Input text into an element described by a prompt.
172
+ - aiInput: <final text content of the input>
173
+ locate: <prompt>
174
+ deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.
175
+ xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.
176
+ cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.
177
+
178
+ # Press a key (e.g., Enter, Tab, Escape) on an element described by a prompt.
179
+ - aiKeyboardPress: <key>
180
+ locate: <prompt>
181
+ deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.
182
+ xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.
183
+ cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.
184
+
185
+ # Scroll globally or on an element described by a prompt.
186
+ - aiScroll:
187
+ direction: 'up' # or 'down' | 'left' | 'right'
188
+ scrollType: 'singleAction' # or 'scrollToTop' | 'scrollToBottom' | 'scrollToLeft' | 'scrollToRight'
189
+ distance: <number> # Optional, the scroll distance in pixels.
190
+ locate: <prompt> # Optional, the element to scroll on.
191
+ deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.
192
+ xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.
193
+ cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.
194
+
195
+ # Record the current screenshot with a description in the report file.
196
+ - recordToReport: <title> # Optional, the title of the screenshot. If not provided, the title will be 'untitled'.
197
+ content: <content> # Optional, the description of the screenshot.
198
+
199
+ # Data Extraction
200
+ # ----------------
201
+
202
+ # Perform a query that returns a JSON object.
203
+ - aiQuery: <prompt> # Remember to describe the format of the result in the prompt.
204
+ name: <name> # The key for the query result in the JSON output.
205
+
206
+ # More APIs
207
+ # ----------------
208
+
209
+ # Wait for a condition to be met, with a timeout (in ms, optional, defaults to 30000).
210
+ - aiWaitFor: <prompt>
211
+ timeout: <ms>
212
+
213
+ # Perform an assertion.
214
+ - aiAssert: <prompt>
215
+ errorMessage: <error-message> # Optional, the error message to print if the assertion fails.
216
+
217
+ # Wait for a specified amount of time.
218
+ - sleep: <ms>
219
+
220
+ # Execute a piece of JavaScript code in the web page context.
221
+ - javascript: <javascript>
222
+ name: <name> # Optional, assign a name to the return value, which will be used as a key in the JSON output.
223
+
224
+ - name: <name>
225
+ flow:
226
+ # ...
227
+ `;
@@ -0,0 +1,139 @@
1
+ export const TEXT_SIZE_THRESHOLD = 9;
2
+
3
+ export const TEXT_MAX_SIZE = 40;
4
+
5
+ export const CONTAINER_MINI_HEIGHT = 3;
6
+ export const CONTAINER_MINI_WIDTH = 3;
7
+
8
+ export enum NodeType {
9
+ CONTAINER = 'CONTAINER Node',
10
+ FORM_ITEM = 'FORM_ITEM Node',
11
+ BUTTON = 'BUTTON Node',
12
+ A = 'Anchor Node',
13
+ IMG = 'IMG Node',
14
+ TEXT = 'TEXT Node',
15
+ POSITION = 'POSITION Node',
16
+ }
17
+
18
+ export const PLAYGROUND_SERVER_PORT = 5800;
19
+ export const SCRCPY_SERVER_PORT = 5700;
20
+ export const SCRCPY_ADB_CONNECT_TIMEOUT_MS = 10_000;
21
+ export const SCRCPY_PUSH_TIMEOUT_MS = 10_000;
22
+ export const SCRCPY_START_TIMEOUT_MS = 15_000;
23
+ export const SCRCPY_VIDEO_STREAM_TIMEOUT_MS = 15_000;
24
+ export const SCRCPY_PREVIEW_METADATA_TIMEOUT_MS =
25
+ SCRCPY_ADB_CONNECT_TIMEOUT_MS +
26
+ SCRCPY_PUSH_TIMEOUT_MS +
27
+ SCRCPY_START_TIMEOUT_MS +
28
+ SCRCPY_VIDEO_STREAM_TIMEOUT_MS +
29
+ 5_000;
30
+
31
+ // WebDriver constants
32
+ export const WEBDRIVER_ELEMENT_ID_KEY = 'element-6066-11e4-a52e-4f735466cecf';
33
+ export const DEFAULT_WDA_PORT = 8100;
34
+
35
+ export const DEFAULT_WAIT_FOR_NAVIGATION_TIMEOUT = 5000;
36
+ export const DEFAULT_WAIT_FOR_NETWORK_IDLE_TIMEOUT = 2000;
37
+ export const DEFAULT_WAIT_FOR_NETWORK_IDLE_CONCURRENCY = 2;
38
+
39
+ export { PLAYWRIGHT_EXAMPLE_CODE, YAML_EXAMPLE_CODE } from './example-code';
40
+
41
+
42
+ export const rpasceneCommand = {
43
+ Tap: 'Tap',
44
+ RightClick: 'RightClick',
45
+ DoubleClick: 'DoubleClick',
46
+ Hover: 'Hover',
47
+ Input: 'Input',
48
+ KeyboardPress: 'KeyboardPress',
49
+ Scroll: 'Scroll',
50
+ DragAndDrop: 'DragAndDrop',
51
+ ClearInput: 'ClearInput',
52
+ Sleep: 'Sleep',
53
+ LongPress: 'LongPress',
54
+ Swipe: 'Swipe',
55
+ Reload: 'Reload',
56
+ GoBack: 'GoBack',
57
+ Navigate: 'Navigate',
58
+ };
59
+
60
+ export const rpastudioCommand = {
61
+ SeleniumClickCommand: 'SeleniumClickCommand',
62
+ SeleniumRightClickCommand: 'SeleniumRightClickCommand',
63
+ SeleniumDoubleClickCommand: 'SeleniumDoubleClickCommand',
64
+ SeleniumMouseHoverCommand: 'SeleniumMouseHoverCommand',
65
+ SeleniumSetValueCommand: 'SeleniumSetValueCommand',
66
+ SeleniumElementSendKeysCommand: 'SeleniumElementSendKeysCommand',
67
+ SeleniumSendKeysCommand: 'SeleniumSendKeysCommand',
68
+ SeleniumElementScrollCommand: 'SeleniumElementScrollCommand',
69
+ SeleniumWindowScrollCommand: 'SeleniumWindowScrollCommand',
70
+ SeleniumDragAndDropCommand: 'SeleniumDragAndDropCommand',
71
+ SeleniumClearValueCommand: 'SeleniumClearValueCommand',
72
+ PauseCommand: 'PauseCommand',
73
+ SeleniumBrowserRefreshCommand: 'SeleniumBrowserRefreshCommand',
74
+ SeleniumBrowserNavigateBackCommand: 'SeleniumBrowserNavigateBackCommand',
75
+ SeleniumBrowserNavigateCommand: 'SeleniumBrowserNavigateCommand',
76
+ };
77
+
78
+ export const commandMap: any = {
79
+ [rpasceneCommand.Tap]: {
80
+ CommandName: rpastudioCommand.SeleniumClickCommand,
81
+ DisplayName: '元素点击',
82
+ },
83
+ [rpasceneCommand.RightClick]: {
84
+ CommandName: rpastudioCommand.SeleniumRightClickCommand,
85
+ DisplayName: '元素右键点击',
86
+ },
87
+ [rpasceneCommand.DoubleClick]: {
88
+ CommandName: rpastudioCommand.SeleniumDoubleClickCommand,
89
+ DisplayName: '元素双击',
90
+ },
91
+ [rpasceneCommand.Hover]: {
92
+ CommandName: rpastudioCommand.SeleniumMouseHoverCommand,
93
+ DisplayName: '鼠标悬停',
94
+ },
95
+ [rpasceneCommand.Input]: {
96
+ CommandName: rpastudioCommand.SeleniumSetValueCommand,
97
+ DisplayName: '设置文本',
98
+ },
99
+ [rpasceneCommand.KeyboardPress]: {
100
+ CommandName: rpastudioCommand.SeleniumElementSendKeysCommand,
101
+ DisplayName: '模拟按键',
102
+ },
103
+ [rpasceneCommand.Scroll]: {
104
+ CommandName: rpastudioCommand.SeleniumElementScrollCommand,
105
+ DisplayName: '元素滚动',
106
+ },
107
+ [rpasceneCommand.DragAndDrop]: {
108
+ CommandName: rpastudioCommand.SeleniumDragAndDropCommand,
109
+ DisplayName: '元素拖拽(至指定元素)',
110
+ },
111
+ [rpasceneCommand.ClearInput]: {
112
+ CommandName: rpastudioCommand.SeleniumClearValueCommand,
113
+ DisplayName: '清空文本',
114
+ },
115
+ [rpasceneCommand.Sleep]: {
116
+ CommandName: rpastudioCommand.PauseCommand,
117
+ DisplayName: '暂停脚本',
118
+ },
119
+ [rpasceneCommand.LongPress]: {
120
+ CommandName: '',
121
+ DisplayName: '',
122
+ },
123
+ [rpasceneCommand.Swipe]: {
124
+ CommandName: '',
125
+ DisplayName: '',
126
+ },
127
+ [rpasceneCommand.Reload]: {
128
+ CommandName: rpastudioCommand.SeleniumBrowserRefreshCommand,
129
+ DisplayName: '刷新',
130
+ },
131
+ [rpasceneCommand.GoBack]: {
132
+ CommandName: rpastudioCommand.SeleniumBrowserNavigateBackCommand,
133
+ DisplayName: '后退',
134
+ },
135
+ [rpasceneCommand.Navigate]: {
136
+ CommandName: rpastudioCommand.SeleniumBrowserNavigateCommand,
137
+ DisplayName: '打开页面',
138
+ },
139
+ };
@@ -0,0 +1,12 @@
1
+ import { BASIC_ENV_KEYS } from './types';
2
+
3
+ /**
4
+ * get basic env value from process.env
5
+ * use a single file to avoid circular dependency
6
+ */
7
+ export const getBasicEnvValue = (key: (typeof BASIC_ENV_KEYS)[number]) => {
8
+ if (!BASIC_ENV_KEYS.includes(key)) {
9
+ throw new Error(`getBasicEnvValue with key ${key} is not supported.`);
10
+ }
11
+ return process.env[key];
12
+ };
@@ -0,0 +1,303 @@
1
+ import {
2
+ MIDSCENE_INSIGHT_MODEL_API_KEY,
3
+ MIDSCENE_INSIGHT_MODEL_BASE_URL,
4
+ MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON,
5
+ MIDSCENE_INSIGHT_MODEL_FAMILY,
6
+ MIDSCENE_INSIGHT_MODEL_HTTP_PROXY,
7
+ MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON,
8
+ MIDSCENE_INSIGHT_MODEL_NAME,
9
+ MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET,
10
+ MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT,
11
+ MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED,
12
+ MIDSCENE_INSIGHT_MODEL_RETRY_COUNT,
13
+ MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL,
14
+ MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY,
15
+ MIDSCENE_INSIGHT_MODEL_TEMPERATURE,
16
+ MIDSCENE_INSIGHT_MODEL_TIMEOUT,
17
+ MIDSCENE_MODEL_API_KEY,
18
+ MIDSCENE_MODEL_BASE_URL,
19
+ MIDSCENE_MODEL_EXTRA_BODY_JSON,
20
+ MIDSCENE_MODEL_FAMILY,
21
+ MIDSCENE_MODEL_HTTP_PROXY,
22
+ MIDSCENE_MODEL_INIT_CONFIG_JSON,
23
+ MIDSCENE_MODEL_NAME,
24
+ MIDSCENE_MODEL_REASONING_BUDGET,
25
+ MIDSCENE_MODEL_REASONING_EFFORT,
26
+ MIDSCENE_MODEL_REASONING_ENABLED,
27
+ MIDSCENE_MODEL_RETRY_COUNT,
28
+ MIDSCENE_MODEL_RETRY_INTERVAL,
29
+ MIDSCENE_MODEL_SOCKS_PROXY,
30
+ MIDSCENE_MODEL_TEMPERATURE,
31
+ MIDSCENE_MODEL_TIMEOUT,
32
+ MIDSCENE_OPENAI_HTTP_PROXY,
33
+ MIDSCENE_OPENAI_INIT_CONFIG_JSON,
34
+ MIDSCENE_OPENAI_SOCKS_PROXY,
35
+ MIDSCENE_PLANNING_MODEL_API_KEY,
36
+ MIDSCENE_PLANNING_MODEL_BASE_URL,
37
+ MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON,
38
+ MIDSCENE_PLANNING_MODEL_FAMILY,
39
+ MIDSCENE_PLANNING_MODEL_HTTP_PROXY,
40
+ MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON,
41
+ MIDSCENE_PLANNING_MODEL_NAME,
42
+ MIDSCENE_PLANNING_MODEL_REASONING_BUDGET,
43
+ MIDSCENE_PLANNING_MODEL_REASONING_EFFORT,
44
+ MIDSCENE_PLANNING_MODEL_REASONING_ENABLED,
45
+ MIDSCENE_PLANNING_MODEL_RETRY_COUNT,
46
+ MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL,
47
+ MIDSCENE_PLANNING_MODEL_SOCKS_PROXY,
48
+ MIDSCENE_PLANNING_MODEL_TEMPERATURE,
49
+ MIDSCENE_PLANNING_MODEL_TIMEOUT,
50
+ OPENAI_API_KEY,
51
+ OPENAI_BASE_URL,
52
+
53
+ // 友互通
54
+ YHT_ACCESS_TOKEN,
55
+ YHT_BASE_URL,
56
+ YHT_CHAT_TYPE,
57
+ YHT_DOMAIN,
58
+ YHT_MODEL,
59
+ YHT_MODEL_CATEGORY,
60
+ YHT_STREAM,
61
+ YHT_TEMPERATURE,
62
+ YHT_TOP_P,
63
+ YHT_TRACE_ID,
64
+ } from './types';
65
+
66
+ interface IModelConfigKeys {
67
+ modelName: string;
68
+ /**
69
+ * proxy
70
+ */
71
+ socksProxy: string;
72
+ httpProxy: string;
73
+ /**
74
+ * OpenAI
75
+ */
76
+ openaiBaseURL: string;
77
+ openaiApiKey: string;
78
+ openaiExtraConfig: string;
79
+ extraBody: string;
80
+ /**
81
+ * Extra
82
+ */
83
+ modelFamily: string;
84
+ /**
85
+ * Timeout
86
+ */
87
+ timeout: string;
88
+ /**
89
+ * Temperature
90
+ */
91
+ temperature: string;
92
+ /**
93
+ * Retry
94
+ */
95
+ retryCount: string;
96
+ retryInterval: string;
97
+ reasoningEffort: string;
98
+ reasoningEnabled: string;
99
+ reasoningBudget: string;
100
+
101
+ // 友互通
102
+ yht_domain: string;
103
+ yht_access_token: string;
104
+ yht_model: string;
105
+ yht_base_url: string;
106
+ yht_chat_type: string;
107
+ yht_model_category: string;
108
+ yht_stream: string;
109
+ yht_temperature: string;
110
+ yht_top_p: string;
111
+ yht_trace_id: string;
112
+ }
113
+
114
+ export const INSIGHT_MODEL_CONFIG_KEYS: IModelConfigKeys = {
115
+ modelName: MIDSCENE_INSIGHT_MODEL_NAME,
116
+ /**
117
+ * proxy
118
+ */
119
+ socksProxy: MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY,
120
+ httpProxy: MIDSCENE_INSIGHT_MODEL_HTTP_PROXY,
121
+ /**
122
+ * OpenAI
123
+ */
124
+ openaiBaseURL: MIDSCENE_INSIGHT_MODEL_BASE_URL,
125
+ openaiApiKey: MIDSCENE_INSIGHT_MODEL_API_KEY,
126
+ openaiExtraConfig: MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON,
127
+ extraBody: MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON,
128
+ /**
129
+ * Extra
130
+ */
131
+ modelFamily: MIDSCENE_INSIGHT_MODEL_FAMILY,
132
+ /**
133
+ * Timeout
134
+ */
135
+ timeout: MIDSCENE_INSIGHT_MODEL_TIMEOUT,
136
+ /**
137
+ * Temperature
138
+ */
139
+ temperature: MIDSCENE_INSIGHT_MODEL_TEMPERATURE,
140
+ /**
141
+ * Retry
142
+ */
143
+ retryCount: MIDSCENE_INSIGHT_MODEL_RETRY_COUNT,
144
+ retryInterval: MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL,
145
+ reasoningEffort: MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT,
146
+ reasoningEnabled: MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED,
147
+ reasoningBudget: MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET,
148
+ // 友互通
149
+ yht_domain: YHT_DOMAIN,
150
+ yht_access_token: YHT_ACCESS_TOKEN,
151
+ yht_model: YHT_MODEL,
152
+ yht_base_url: YHT_BASE_URL,
153
+ yht_chat_type: YHT_CHAT_TYPE,
154
+ yht_model_category: YHT_MODEL_CATEGORY,
155
+ yht_stream: YHT_STREAM,
156
+ yht_temperature: YHT_TEMPERATURE,
157
+ yht_top_p: YHT_TOP_P,
158
+ yht_trace_id: YHT_TRACE_ID,
159
+ } as const;
160
+
161
+ export const PLANNING_MODEL_CONFIG_KEYS: IModelConfigKeys = {
162
+ modelName: MIDSCENE_PLANNING_MODEL_NAME,
163
+ /**
164
+ * proxy
165
+ */
166
+ socksProxy: MIDSCENE_PLANNING_MODEL_SOCKS_PROXY,
167
+ httpProxy: MIDSCENE_PLANNING_MODEL_HTTP_PROXY,
168
+ /**
169
+ * OpenAI
170
+ */
171
+ openaiBaseURL: MIDSCENE_PLANNING_MODEL_BASE_URL,
172
+ openaiApiKey: MIDSCENE_PLANNING_MODEL_API_KEY,
173
+ openaiExtraConfig: MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON,
174
+ extraBody: MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON,
175
+ /**
176
+ * Extra
177
+ */
178
+ modelFamily: MIDSCENE_PLANNING_MODEL_FAMILY,
179
+ /**
180
+ * Timeout
181
+ */
182
+ timeout: MIDSCENE_PLANNING_MODEL_TIMEOUT,
183
+ /**
184
+ * Temperature
185
+ */
186
+ temperature: MIDSCENE_PLANNING_MODEL_TEMPERATURE,
187
+ /**
188
+ * Retry
189
+ */
190
+ retryCount: MIDSCENE_PLANNING_MODEL_RETRY_COUNT,
191
+ retryInterval: MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL,
192
+ reasoningEffort: MIDSCENE_PLANNING_MODEL_REASONING_EFFORT,
193
+ reasoningEnabled: MIDSCENE_PLANNING_MODEL_REASONING_ENABLED,
194
+ reasoningBudget: MIDSCENE_PLANNING_MODEL_REASONING_BUDGET,
195
+ // 友互通
196
+ yht_domain: YHT_DOMAIN,
197
+ yht_access_token: YHT_ACCESS_TOKEN,
198
+ yht_model: YHT_MODEL,
199
+ yht_base_url: YHT_BASE_URL,
200
+ yht_chat_type: YHT_CHAT_TYPE,
201
+ yht_model_category: YHT_MODEL_CATEGORY,
202
+ yht_stream: YHT_STREAM,
203
+ yht_temperature: YHT_TEMPERATURE,
204
+ yht_top_p: YHT_TOP_P,
205
+ yht_trace_id: YHT_TRACE_ID,
206
+
207
+ } as const;
208
+
209
+ // modelConfig return default
210
+ export const DEFAULT_MODEL_CONFIG_KEYS: IModelConfigKeys = {
211
+ modelName: MIDSCENE_MODEL_NAME,
212
+ /**
213
+ * proxy
214
+ */
215
+ socksProxy: MIDSCENE_MODEL_SOCKS_PROXY,
216
+ httpProxy: MIDSCENE_MODEL_HTTP_PROXY,
217
+ /**
218
+ * OpenAI
219
+ */
220
+ openaiBaseURL: MIDSCENE_MODEL_BASE_URL,
221
+ openaiApiKey: MIDSCENE_MODEL_API_KEY,
222
+ openaiExtraConfig: MIDSCENE_MODEL_INIT_CONFIG_JSON,
223
+ extraBody: MIDSCENE_MODEL_EXTRA_BODY_JSON,
224
+ /**
225
+ * Extra
226
+ */
227
+ modelFamily: MIDSCENE_MODEL_FAMILY,
228
+ /**
229
+ * Timeout
230
+ */
231
+ timeout: MIDSCENE_MODEL_TIMEOUT,
232
+ /**
233
+ * Temperature
234
+ */
235
+ temperature: MIDSCENE_MODEL_TEMPERATURE,
236
+ /**
237
+ * Retry
238
+ */
239
+ retryCount: MIDSCENE_MODEL_RETRY_COUNT,
240
+ retryInterval: MIDSCENE_MODEL_RETRY_INTERVAL,
241
+ reasoningEffort: MIDSCENE_MODEL_REASONING_EFFORT,
242
+ reasoningEnabled: MIDSCENE_MODEL_REASONING_ENABLED,
243
+ reasoningBudget: MIDSCENE_MODEL_REASONING_BUDGET,
244
+ // 友互通
245
+ yht_domain: YHT_DOMAIN,
246
+ yht_access_token: YHT_ACCESS_TOKEN,
247
+ yht_model: YHT_MODEL,
248
+ yht_base_url: YHT_BASE_URL,
249
+ yht_chat_type: YHT_CHAT_TYPE,
250
+ yht_model_category: YHT_MODEL_CATEGORY,
251
+ yht_stream: YHT_STREAM,
252
+ yht_temperature: YHT_TEMPERATURE,
253
+ yht_top_p: YHT_TOP_P,
254
+ yht_trace_id: YHT_TRACE_ID,
255
+ } as const;
256
+
257
+ // read from process.env
258
+ export const DEFAULT_MODEL_CONFIG_KEYS_LEGACY: IModelConfigKeys = {
259
+ modelName: MIDSCENE_MODEL_NAME,
260
+ /**
261
+ * proxy - Uses legacy MIDSCENE_OPENAI_* variables for backward compatibility
262
+ */
263
+ socksProxy: MIDSCENE_OPENAI_SOCKS_PROXY,
264
+ httpProxy: MIDSCENE_OPENAI_HTTP_PROXY,
265
+ /**
266
+ * Model API - Uses legacy OPENAI_* variables for backward compatibility
267
+ */
268
+ openaiBaseURL: OPENAI_BASE_URL,
269
+ openaiApiKey: OPENAI_API_KEY,
270
+ openaiExtraConfig: MIDSCENE_OPENAI_INIT_CONFIG_JSON,
271
+ extraBody: MIDSCENE_MODEL_EXTRA_BODY_JSON,
272
+ /**
273
+ * Extra
274
+ */
275
+ modelFamily: 'DEFAULT_MODEL_CONFIG_KEYS has no modelFamily key',
276
+ /**
277
+ * Timeout - use the new key for legacy mode too
278
+ */
279
+ timeout: MIDSCENE_MODEL_TIMEOUT,
280
+ /**
281
+ * Temperature - use the new key for legacy mode too
282
+ */
283
+ temperature: MIDSCENE_MODEL_TEMPERATURE,
284
+ /**
285
+ * Retry - use the new key for legacy mode too
286
+ */
287
+ retryCount: MIDSCENE_MODEL_RETRY_COUNT,
288
+ retryInterval: MIDSCENE_MODEL_RETRY_INTERVAL,
289
+ reasoningEffort: MIDSCENE_MODEL_REASONING_EFFORT,
290
+ reasoningEnabled: MIDSCENE_MODEL_REASONING_ENABLED,
291
+ reasoningBudget: MIDSCENE_MODEL_REASONING_BUDGET,
292
+ // 友互通
293
+ yht_domain: YHT_DOMAIN,
294
+ yht_access_token: YHT_ACCESS_TOKEN,
295
+ yht_model: YHT_MODEL,
296
+ yht_base_url: YHT_BASE_URL,
297
+ yht_chat_type: YHT_CHAT_TYPE,
298
+ yht_model_category: YHT_MODEL_CATEGORY,
299
+ yht_stream: YHT_STREAM,
300
+ yht_temperature: YHT_TEMPERATURE,
301
+ yht_top_p: YHT_TOP_P,
302
+ yht_trace_id: YHT_TRACE_ID,
303
+ } as const;