@midscene/core 0.26.5-beta-20250814080504.0 → 0.26.5-beta-20250814125155.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 (132) hide show
  1. package/dist/es/ai-model/action-executor.mjs +139 -0
  2. package/dist/es/ai-model/action-executor.mjs.map +1 -0
  3. package/dist/es/ai-model/common.mjs +219 -0
  4. package/dist/es/ai-model/common.mjs.map +1 -0
  5. package/dist/es/ai-model/index.mjs +10 -0
  6. package/dist/es/ai-model/inspect.mjs +317 -0
  7. package/dist/es/ai-model/inspect.mjs.map +1 -0
  8. package/dist/es/ai-model/llm-planning.mjs +85 -0
  9. package/dist/es/ai-model/llm-planning.mjs.map +1 -0
  10. package/dist/es/ai-model/prompt/assertion.mjs +55 -0
  11. package/dist/es/ai-model/prompt/assertion.mjs.map +1 -0
  12. package/dist/es/ai-model/prompt/common.mjs +7 -0
  13. package/dist/es/ai-model/prompt/common.mjs.map +1 -0
  14. package/dist/es/ai-model/prompt/describe.mjs +44 -0
  15. package/dist/es/ai-model/prompt/describe.mjs.map +1 -0
  16. package/dist/es/ai-model/prompt/extraction.mjs +137 -0
  17. package/dist/es/ai-model/prompt/extraction.mjs.map +1 -0
  18. package/dist/es/ai-model/prompt/llm-locator.mjs +275 -0
  19. package/dist/es/ai-model/prompt/llm-locator.mjs.map +1 -0
  20. package/dist/es/ai-model/prompt/llm-planning.mjs +359 -0
  21. package/dist/es/ai-model/prompt/llm-planning.mjs.map +1 -0
  22. package/dist/es/ai-model/prompt/llm-section-locator.mjs +47 -0
  23. package/dist/es/ai-model/prompt/llm-section-locator.mjs.map +1 -0
  24. package/dist/es/ai-model/prompt/playwright-generator.mjs +117 -0
  25. package/dist/es/ai-model/prompt/playwright-generator.mjs.map +1 -0
  26. package/dist/es/ai-model/prompt/ui-tars-locator.mjs +34 -0
  27. package/dist/es/ai-model/prompt/ui-tars-locator.mjs.map +1 -0
  28. package/dist/es/ai-model/prompt/ui-tars-planning.mjs +36 -0
  29. package/dist/es/ai-model/prompt/ui-tars-planning.mjs.map +1 -0
  30. package/dist/es/ai-model/prompt/util.mjs +123 -0
  31. package/dist/es/ai-model/prompt/util.mjs.map +1 -0
  32. package/dist/es/ai-model/prompt/yaml-generator.mjs +219 -0
  33. package/dist/es/ai-model/prompt/yaml-generator.mjs.map +1 -0
  34. package/dist/es/ai-model/service-caller/index.mjs +413 -0
  35. package/dist/es/ai-model/service-caller/index.mjs.map +1 -0
  36. package/dist/es/ai-model/ui-tars-planning.mjs +235 -0
  37. package/dist/es/ai-model/ui-tars-planning.mjs.map +1 -0
  38. package/dist/es/image/index.mjs +2 -0
  39. package/dist/es/index.mjs +7 -2360
  40. package/dist/es/index.mjs.map +1 -1
  41. package/dist/es/insight/index.mjs +261 -0
  42. package/dist/es/insight/index.mjs.map +1 -0
  43. package/dist/es/insight/utils.mjs +19 -0
  44. package/dist/es/insight/utils.mjs.map +1 -0
  45. package/dist/es/types.mjs +11 -0
  46. package/dist/es/types.mjs.map +1 -0
  47. package/dist/es/utils.mjs +2 -2
  48. package/dist/es/yaml.mjs +0 -0
  49. package/dist/lib/ai-model/action-executor.js +173 -0
  50. package/dist/lib/ai-model/action-executor.js.map +1 -0
  51. package/dist/lib/ai-model/common.js +289 -0
  52. package/dist/lib/ai-model/common.js.map +1 -0
  53. package/dist/lib/ai-model/index.js +103 -0
  54. package/dist/lib/ai-model/index.js.map +1 -0
  55. package/dist/lib/ai-model/inspect.js +360 -0
  56. package/dist/lib/ai-model/inspect.js.map +1 -0
  57. package/dist/lib/ai-model/llm-planning.js +119 -0
  58. package/dist/lib/ai-model/llm-planning.js.map +1 -0
  59. package/dist/lib/ai-model/prompt/assertion.js +92 -0
  60. package/dist/lib/ai-model/prompt/assertion.js.map +1 -0
  61. package/dist/lib/ai-model/prompt/common.js +41 -0
  62. package/dist/lib/ai-model/prompt/common.js.map +1 -0
  63. package/dist/lib/ai-model/prompt/describe.js +78 -0
  64. package/dist/lib/ai-model/prompt/describe.js.map +1 -0
  65. package/dist/lib/ai-model/prompt/extraction.js +177 -0
  66. package/dist/lib/ai-model/prompt/extraction.js.map +1 -0
  67. package/dist/lib/ai-model/prompt/llm-locator.js +315 -0
  68. package/dist/lib/ai-model/prompt/llm-locator.js.map +1 -0
  69. package/dist/lib/ai-model/prompt/llm-planning.js +415 -0
  70. package/dist/lib/ai-model/prompt/llm-planning.js.map +1 -0
  71. package/dist/lib/ai-model/prompt/llm-section-locator.js +84 -0
  72. package/dist/lib/ai-model/prompt/llm-section-locator.js.map +1 -0
  73. package/dist/lib/ai-model/prompt/playwright-generator.js +178 -0
  74. package/dist/lib/ai-model/prompt/playwright-generator.js.map +1 -0
  75. package/dist/lib/ai-model/prompt/ui-tars-locator.js +68 -0
  76. package/dist/lib/ai-model/prompt/ui-tars-locator.js.map +1 -0
  77. package/dist/lib/ai-model/prompt/ui-tars-planning.js +73 -0
  78. package/dist/lib/ai-model/prompt/ui-tars-planning.js.map +1 -0
  79. package/dist/lib/ai-model/prompt/util.js +175 -0
  80. package/dist/lib/ai-model/prompt/util.js.map +1 -0
  81. package/dist/lib/ai-model/prompt/yaml-generator.js +280 -0
  82. package/dist/lib/ai-model/prompt/yaml-generator.js.map +1 -0
  83. package/dist/lib/ai-model/service-caller/index.js +496 -0
  84. package/dist/lib/ai-model/service-caller/index.js.map +1 -0
  85. package/dist/lib/ai-model/ui-tars-planning.js +272 -0
  86. package/dist/lib/ai-model/ui-tars-planning.js.map +1 -0
  87. package/dist/lib/image/index.js +56 -0
  88. package/dist/lib/image/index.js.map +1 -0
  89. package/dist/lib/index.js +21 -2393
  90. package/dist/lib/index.js.map +1 -1
  91. package/dist/lib/insight/index.js +295 -0
  92. package/dist/lib/insight/index.js.map +1 -0
  93. package/dist/lib/insight/utils.js +53 -0
  94. package/dist/lib/insight/utils.js.map +1 -0
  95. package/dist/lib/types.js +82 -0
  96. package/dist/lib/types.js.map +1 -0
  97. package/dist/lib/utils.js +2 -2
  98. package/dist/lib/yaml.js +20 -0
  99. package/dist/lib/yaml.js.map +1 -0
  100. package/dist/types/ai-model/action-executor.d.ts +19 -0
  101. package/dist/types/ai-model/common.d.ts +34 -0
  102. package/dist/types/ai-model/index.d.ts +11 -0
  103. package/dist/types/ai-model/inspect.d.ts +49 -0
  104. package/dist/types/ai-model/llm-planning.d.ts +10 -0
  105. package/dist/types/ai-model/prompt/assertion.d.ts +5 -0
  106. package/dist/types/ai-model/prompt/common.d.ts +2 -0
  107. package/dist/types/ai-model/prompt/describe.d.ts +1 -0
  108. package/dist/types/ai-model/prompt/extraction.d.ts +4 -0
  109. package/dist/types/ai-model/prompt/llm-locator.d.ts +9 -0
  110. package/dist/types/ai-model/prompt/llm-planning.d.ts +15 -0
  111. package/dist/types/ai-model/prompt/llm-section-locator.d.ts +6 -0
  112. package/dist/types/ai-model/prompt/playwright-generator.d.ts +25 -0
  113. package/dist/types/ai-model/prompt/ui-tars-locator.d.ts +1 -0
  114. package/dist/types/ai-model/prompt/ui-tars-planning.d.ts +2 -0
  115. package/dist/types/ai-model/prompt/util.d.ts +45 -0
  116. package/dist/types/ai-model/prompt/yaml-generator.d.ts +99 -0
  117. package/dist/types/ai-model/service-caller/index.d.ts +26 -0
  118. package/dist/types/ai-model/ui-tars-planning.d.ts +76 -0
  119. package/dist/types/image/index.d.ts +1 -0
  120. package/dist/types/index.d.ts +9 -1289
  121. package/dist/types/insight/index.d.ts +26 -0
  122. package/dist/types/insight/utils.d.ts +2 -0
  123. package/dist/types/tree.d.ts +1 -11
  124. package/dist/types/types.d.ts +399 -0
  125. package/dist/types/utils.d.ts +27 -47
  126. package/dist/types/yaml.d.ts +172 -0
  127. package/package.json +6 -6
  128. package/dist/es/ai-model.mjs +0 -2502
  129. package/dist/es/ai-model.mjs.map +0 -1
  130. package/dist/lib/ai-model.js +0 -2622
  131. package/dist/lib/ai-model.js.map +0 -1
  132. package/dist/types/ai-model.d.ts +0 -596
@@ -0,0 +1,272 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ resizeImageForUiTars: ()=>resizeImageForUiTars,
28
+ vlmPlanning: ()=>vlmPlanning
29
+ });
30
+ const env_namespaceObject = require("@midscene/shared/env");
31
+ const img_namespaceObject = require("@midscene/shared/img");
32
+ const logger_namespaceObject = require("@midscene/shared/logger");
33
+ const us_keyboard_layout_namespaceObject = require("@midscene/shared/us-keyboard-layout");
34
+ const utils_namespaceObject = require("@midscene/shared/utils");
35
+ const action_parser_namespaceObject = require("@ui-tars/action-parser");
36
+ const external_common_js_namespaceObject = require("./common.js");
37
+ const ui_tars_planning_js_namespaceObject = require("./prompt/ui-tars-planning.js");
38
+ const index_js_namespaceObject = require("./service-caller/index.js");
39
+ const debug = (0, logger_namespaceObject.getDebug)('ui-tars-planning');
40
+ const bboxSize = 10;
41
+ const pointToBbox = (point, width, height)=>[
42
+ Math.round(Math.max(point.x - bboxSize / 2, 0)),
43
+ Math.round(Math.max(point.y - bboxSize / 2, 0)),
44
+ Math.round(Math.min(point.x + bboxSize / 2, width)),
45
+ Math.round(Math.min(point.y + bboxSize / 2, height))
46
+ ];
47
+ async function vlmPlanning(options) {
48
+ const { conversationHistory, userInstruction, size } = options;
49
+ const systemPrompt = (0, ui_tars_planning_js_namespaceObject.getUiTarsPlanningPrompt)() + userInstruction;
50
+ const res = await (0, index_js_namespaceObject.call)([
51
+ {
52
+ role: 'user',
53
+ content: systemPrompt
54
+ },
55
+ ...conversationHistory
56
+ ], external_common_js_namespaceObject.AIActionType.INSPECT_ELEMENT);
57
+ const convertedText = convertBboxToCoordinates(res.content);
58
+ const modelVer = (0, env_namespaceObject.uiTarsModelVersion)();
59
+ const { parsed } = (0, action_parser_namespaceObject.actionParser)({
60
+ prediction: convertedText,
61
+ factor: [
62
+ 1000,
63
+ 1000
64
+ ],
65
+ screenContext: {
66
+ width: size.width,
67
+ height: size.height
68
+ },
69
+ modelVer: modelVer || void 0
70
+ });
71
+ debug('modelVer', modelVer, 'parsed', JSON.stringify(parsed));
72
+ const transformActions = [];
73
+ parsed.forEach((action)=>{
74
+ if ('click' === action.action_type) {
75
+ (0, utils_namespaceObject.assert)(action.action_inputs.start_box, 'start_box is required');
76
+ const point = getPoint(action.action_inputs.start_box, size);
77
+ transformActions.push({
78
+ type: 'Locate',
79
+ param: {},
80
+ locate: {
81
+ prompt: action.thought || '',
82
+ bbox: pointToBbox({
83
+ x: point[0],
84
+ y: point[1]
85
+ }, size.width, size.height)
86
+ }
87
+ });
88
+ transformActions.push({
89
+ type: 'Tap',
90
+ locate: {
91
+ prompt: action.thought || '',
92
+ bbox: pointToBbox({
93
+ x: point[0],
94
+ y: point[1]
95
+ }, size.width, size.height)
96
+ },
97
+ param: action.thought || ''
98
+ });
99
+ } else if ('drag' === action.action_type) {
100
+ (0, utils_namespaceObject.assert)(action.action_inputs.start_box, 'start_box is required');
101
+ (0, utils_namespaceObject.assert)(action.action_inputs.end_box, 'end_box is required');
102
+ const startPoint = getPoint(action.action_inputs.start_box, size);
103
+ const endPoint = getPoint(action.action_inputs.end_box, size);
104
+ transformActions.push({
105
+ type: 'Drag',
106
+ param: {
107
+ start_box: {
108
+ x: startPoint[0],
109
+ y: startPoint[1]
110
+ },
111
+ end_box: {
112
+ x: endPoint[0],
113
+ y: endPoint[1]
114
+ }
115
+ },
116
+ locate: null,
117
+ thought: action.thought || ''
118
+ });
119
+ } else if ('type' === action.action_type) transformActions.push({
120
+ type: 'Input',
121
+ param: {
122
+ value: action.action_inputs.content
123
+ },
124
+ locate: null,
125
+ thought: action.thought || ''
126
+ });
127
+ else if ('scroll' === action.action_type) transformActions.push({
128
+ type: 'Scroll',
129
+ param: {
130
+ direction: action.action_inputs.direction
131
+ },
132
+ locate: null,
133
+ thought: action.thought || ''
134
+ });
135
+ else if ('finished' === action.action_type) transformActions.push({
136
+ type: 'Finished',
137
+ param: {},
138
+ locate: null,
139
+ thought: action.thought || ''
140
+ });
141
+ else if ('hotkey' === action.action_type) if (action.action_inputs.key) {
142
+ const keys = (0, us_keyboard_layout_namespaceObject.transformHotkeyInput)(action.action_inputs.key);
143
+ transformActions.push({
144
+ type: 'KeyboardPress',
145
+ param: {
146
+ value: keys
147
+ },
148
+ locate: null,
149
+ thought: action.thought || ''
150
+ });
151
+ } else console.warn('No key found in action: hotkey. Will not perform action.');
152
+ else if ('wait' === action.action_type) transformActions.push({
153
+ type: 'Sleep',
154
+ param: {
155
+ timeMs: 1000
156
+ },
157
+ locate: null,
158
+ thought: action.thought || ''
159
+ });
160
+ else if ('androidBackButton' === action.action_type) transformActions.push({
161
+ type: 'AndroidBackButton',
162
+ param: {},
163
+ locate: null,
164
+ thought: action.thought || ''
165
+ });
166
+ else if ('androidHomeButton' === action.action_type) transformActions.push({
167
+ type: 'AndroidHomeButton',
168
+ param: {},
169
+ locate: null,
170
+ thought: action.thought || ''
171
+ });
172
+ else if ('androidRecentAppsButton' === action.action_type) transformActions.push({
173
+ type: 'AndroidRecentAppsButton',
174
+ param: {}
175
+ });
176
+ else if ('androidLongPress' === action.action_type) {
177
+ (0, utils_namespaceObject.assert)(action.action_inputs.start_coords, 'start_coords is required for androidLongPress');
178
+ const point = action.action_inputs.start_coords;
179
+ transformActions.push({
180
+ type: 'AndroidLongPress',
181
+ param: {
182
+ x: point[0],
183
+ y: point[1],
184
+ duration: 1000
185
+ },
186
+ locate: null,
187
+ thought: action.thought || ''
188
+ });
189
+ } else if ('androidPull' === action.action_type) {
190
+ const pullDirection = action.action_inputs.direction || 'down';
191
+ const startPoint = action.action_inputs.start_coords ? {
192
+ x: action.action_inputs.start_coords[0],
193
+ y: action.action_inputs.start_coords[1]
194
+ } : void 0;
195
+ transformActions.push({
196
+ type: 'AndroidPull',
197
+ param: {
198
+ direction: pullDirection,
199
+ startPoint,
200
+ distance: action.action_inputs.distance,
201
+ duration: action.action_inputs.duration || 500
202
+ },
203
+ locate: null,
204
+ thought: action.thought || ''
205
+ });
206
+ }
207
+ });
208
+ if (0 === transformActions.length) throw new Error(`No actions found, response: ${res.content}`, {
209
+ cause: {
210
+ prediction: res.content,
211
+ parsed
212
+ }
213
+ });
214
+ return {
215
+ actions: transformActions,
216
+ actionsFromModel: parsed,
217
+ action_summary: (0, ui_tars_planning_js_namespaceObject.getSummary)(res.content),
218
+ usage: res.usage,
219
+ rawResponse: JSON.stringify(res.content, void 0, 2)
220
+ };
221
+ }
222
+ function convertBboxToCoordinates(text) {
223
+ const pattern = /<bbox>(\d+)\s+(\d+)\s+(\d+)\s+(\d+)<\/bbox>/g;
224
+ function replaceMatch(match, x1, y1, x2, y2) {
225
+ const x1Num = Number.parseInt(x1, 10);
226
+ const y1Num = Number.parseInt(y1, 10);
227
+ const x2Num = Number.parseInt(x2, 10);
228
+ const y2Num = Number.parseInt(y2, 10);
229
+ const x = Math.floor((x1Num + x2Num) / 2);
230
+ const y = Math.floor((y1Num + y2Num) / 2);
231
+ return `(${x},${y})`;
232
+ }
233
+ const cleanedText = text.replace(/\[EOS\]/g, '');
234
+ return cleanedText.replace(pattern, replaceMatch).trim();
235
+ }
236
+ function getPoint(startBox, size) {
237
+ const [x, y] = JSON.parse(startBox);
238
+ return [
239
+ x * size.width,
240
+ y * size.height
241
+ ];
242
+ }
243
+ async function resizeImageForUiTars(imageBase64, size) {
244
+ if ('vlm-ui-tars' === (0, env_namespaceObject.vlLocateMode)() && (0, env_namespaceObject.uiTarsModelVersion)() === env_namespaceObject.UITarsModelVersion.V1_5) {
245
+ debug('ui-tars-v1.5, will check image size', size);
246
+ const currentPixels = size.width * size.height;
247
+ const maxPixels = 12845056;
248
+ if (currentPixels > maxPixels) {
249
+ const resizeFactor = Math.sqrt(maxPixels / currentPixels);
250
+ const newWidth = Math.floor(size.width * resizeFactor);
251
+ const newHeight = Math.floor(size.height * resizeFactor);
252
+ debug('resize image for ui-tars, new width: %s, new height: %s', newWidth, newHeight);
253
+ const resizedImage = await (0, img_namespaceObject.resizeImgBase64)(imageBase64, {
254
+ width: newWidth,
255
+ height: newHeight
256
+ });
257
+ return resizedImage;
258
+ }
259
+ }
260
+ return imageBase64;
261
+ }
262
+ exports.resizeImageForUiTars = __webpack_exports__.resizeImageForUiTars;
263
+ exports.vlmPlanning = __webpack_exports__.vlmPlanning;
264
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
265
+ "resizeImageForUiTars",
266
+ "vlmPlanning"
267
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
268
+ Object.defineProperty(exports, '__esModule', {
269
+ value: true
270
+ });
271
+
272
+ //# sourceMappingURL=ui-tars-planning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-model/ui-tars-planning.js","sources":["webpack://@midscene/core/webpack/runtime/define_property_getters","webpack://@midscene/core/webpack/runtime/has_own_property","webpack://@midscene/core/webpack/runtime/make_namespace_object","webpack://@midscene/core/./src/ai-model/ui-tars-planning.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type {\n AIUsageInfo,\n MidsceneYamlFlowItem,\n PlanningAction,\n Size,\n} from '@/types';\nimport {\n UITarsModelVersion,\n uiTarsModelVersion,\n vlLocateMode,\n} from '@midscene/shared/env';\nimport { resizeImgBase64 } from '@midscene/shared/img';\nimport { getDebug } from '@midscene/shared/logger';\nimport { transformHotkeyInput } from '@midscene/shared/us-keyboard-layout';\nimport { assert } from '@midscene/shared/utils';\nimport { actionParser } from '@ui-tars/action-parser';\nimport type { ChatCompletionMessageParam } from 'openai/resources/index';\nimport { AIActionType } from './common';\nimport { getSummary, getUiTarsPlanningPrompt } from './prompt/ui-tars-planning';\nimport { call } from './service-caller/index';\ntype ActionType =\n | 'click'\n | 'drag'\n | 'type'\n | 'hotkey'\n | 'finished'\n | 'scroll'\n | 'wait'\n | 'androidBackButton'\n | 'androidHomeButton'\n | 'androidRecentAppsButton'\n | 'androidLongPress'\n | 'androidPull';\n\nconst debug = getDebug('ui-tars-planning');\nconst bboxSize = 10;\nconst pointToBbox = (\n point: { x: number; y: number },\n width: number,\n height: number,\n): [number, number, number, number] => {\n return [\n Math.round(Math.max(point.x - bboxSize / 2, 0)),\n Math.round(Math.max(point.y - bboxSize / 2, 0)),\n Math.round(Math.min(point.x + bboxSize / 2, width)),\n Math.round(Math.min(point.y + bboxSize / 2, height)),\n ];\n};\n\nexport async function vlmPlanning(options: {\n userInstruction: string;\n conversationHistory: ChatCompletionMessageParam[];\n size: { width: number; height: number };\n}): Promise<{\n actions: PlanningAction<any>[];\n actionsFromModel: ReturnType<typeof actionParser>['parsed'];\n action_summary: string;\n yamlFlow?: MidsceneYamlFlowItem[];\n usage?: AIUsageInfo;\n rawResponse?: string;\n}> {\n const { conversationHistory, userInstruction, size } = options;\n const systemPrompt = getUiTarsPlanningPrompt() + userInstruction;\n\n const res = await call(\n [\n {\n role: 'user',\n content: systemPrompt,\n },\n ...conversationHistory,\n ],\n AIActionType.INSPECT_ELEMENT,\n );\n const convertedText = convertBboxToCoordinates(res.content);\n\n const modelVer = uiTarsModelVersion();\n\n const { parsed } = actionParser({\n prediction: convertedText,\n factor: [1000, 1000],\n screenContext: {\n width: size.width,\n height: size.height,\n },\n modelVer: modelVer || undefined,\n });\n\n debug('modelVer', modelVer, 'parsed', JSON.stringify(parsed));\n\n const transformActions: PlanningAction[] = [];\n parsed.forEach((action) => {\n if (action.action_type === 'click') {\n assert(action.action_inputs.start_box, 'start_box is required');\n const point = getPoint(action.action_inputs.start_box, size);\n transformActions.push({\n type: 'Locate',\n param: {},\n locate: {\n prompt: action.thought || '',\n bbox: pointToBbox(\n { x: point[0], y: point[1] },\n size.width,\n size.height,\n ),\n },\n });\n transformActions.push({\n type: 'Tap',\n locate: {\n prompt: action.thought || '',\n bbox: pointToBbox(\n { x: point[0], y: point[1] },\n size.width,\n size.height,\n ),\n },\n param: action.thought || '',\n });\n } else if (action.action_type === 'drag') {\n assert(action.action_inputs.start_box, 'start_box is required');\n assert(action.action_inputs.end_box, 'end_box is required');\n const startPoint = getPoint(action.action_inputs.start_box, size);\n const endPoint = getPoint(action.action_inputs.end_box, size);\n transformActions.push({\n type: 'Drag',\n param: {\n start_box: { x: startPoint[0], y: startPoint[1] },\n end_box: { x: endPoint[0], y: endPoint[1] },\n },\n locate: null,\n thought: action.thought || '',\n });\n } else if (action.action_type === 'type') {\n transformActions.push({\n type: 'Input',\n param: {\n value: action.action_inputs.content,\n },\n locate: null,\n thought: action.thought || '',\n });\n } else if (action.action_type === 'scroll') {\n transformActions.push({\n type: 'Scroll',\n param: {\n direction: action.action_inputs.direction,\n },\n locate: null,\n thought: action.thought || '',\n });\n } else if (action.action_type === 'finished') {\n transformActions.push({\n type: 'Finished',\n param: {},\n locate: null,\n thought: action.thought || '',\n });\n } else if (action.action_type === 'hotkey') {\n if (!action.action_inputs.key) {\n console.warn(\n 'No key found in action: hotkey. Will not perform action.',\n );\n } else {\n const keys = transformHotkeyInput(action.action_inputs.key);\n\n transformActions.push({\n type: 'KeyboardPress',\n param: {\n value: keys,\n },\n locate: null,\n thought: action.thought || '',\n });\n }\n } else if (action.action_type === 'wait') {\n transformActions.push({\n type: 'Sleep',\n param: {\n timeMs: 1000,\n },\n locate: null,\n thought: action.thought || '',\n });\n } else if (action.action_type === 'androidBackButton') {\n transformActions.push({\n type: 'AndroidBackButton',\n param: {},\n locate: null,\n thought: action.thought || '',\n });\n } else if (action.action_type === 'androidHomeButton') {\n transformActions.push({\n type: 'AndroidHomeButton',\n param: {},\n locate: null,\n thought: action.thought || '',\n });\n } else if (action.action_type === 'androidRecentAppsButton') {\n transformActions.push({\n type: 'AndroidRecentAppsButton',\n param: {},\n });\n } else if (action.action_type === 'androidLongPress') {\n assert(\n action.action_inputs.start_coords,\n 'start_coords is required for androidLongPress',\n );\n const point = action.action_inputs.start_coords;\n transformActions.push({\n type: 'AndroidLongPress',\n param: {\n x: point[0],\n y: point[1],\n duration: 1000,\n },\n locate: null,\n thought: action.thought || '',\n });\n } else if (action.action_type === 'androidPull') {\n const pullDirection = action.action_inputs.direction || 'down';\n const startPoint = action.action_inputs.start_coords\n ? {\n x: action.action_inputs.start_coords[0],\n y: action.action_inputs.start_coords[1],\n }\n : undefined;\n\n transformActions.push({\n type: 'AndroidPull',\n param: {\n direction: pullDirection as 'up' | 'down',\n startPoint,\n distance: (action.action_inputs as any).distance,\n duration: (action.action_inputs as any).duration || 500,\n },\n locate: null,\n thought: action.thought || '',\n });\n }\n });\n\n if (transformActions.length === 0) {\n throw new Error(`No actions found, response: ${res.content}`, {\n cause: {\n prediction: res.content,\n parsed,\n },\n });\n }\n\n return {\n actions: transformActions,\n actionsFromModel: parsed,\n action_summary: getSummary(res.content),\n usage: res.usage,\n rawResponse: JSON.stringify(res.content, undefined, 2),\n };\n}\n\n/**\n * Converts bounding box notation to coordinate points\n * @param text - The text containing bbox tags to be converted\n * @returns The text with bbox tags replaced by coordinate points\n */\nfunction convertBboxToCoordinates(text: string): string {\n // Match the four numbers after <bbox>\n const pattern = /<bbox>(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)<\\/bbox>/g;\n\n function replaceMatch(\n match: string,\n x1: string,\n y1: string,\n x2: string,\n y2: string,\n ): string {\n // Convert strings to numbers and calculate center point\n const x1Num = Number.parseInt(x1, 10);\n const y1Num = Number.parseInt(y1, 10);\n const x2Num = Number.parseInt(x2, 10);\n const y2Num = Number.parseInt(y2, 10);\n\n // Use Math.floor to truncate and calculate center point\n const x = Math.floor((x1Num + x2Num) / 2);\n const y = Math.floor((y1Num + y2Num) / 2);\n\n // Return formatted coordinate string\n return `(${x},${y})`;\n }\n\n // Remove [EOS] and replace <bbox> coordinates\n const cleanedText = text.replace(/\\[EOS\\]/g, '');\n return cleanedText.replace(pattern, replaceMatch).trim();\n}\n\nfunction getPoint(startBox: string, size: { width: number; height: number }) {\n const [x, y] = JSON.parse(startBox);\n return [x * size.width, y * size.height];\n}\n\ninterface BaseAction {\n action_type: ActionType;\n action_inputs: Record<string, any>;\n reflection: string | null;\n thought: string | null;\n}\n\ninterface ClickAction extends BaseAction {\n action_type: 'click';\n action_inputs: {\n start_box: string; // JSON string of [x, y] coordinates\n };\n}\n\ninterface DragAction extends BaseAction {\n action_type: 'drag';\n action_inputs: {\n start_box: string; // JSON string of [x, y] coordinates\n end_box: string; // JSON string of [x, y] coordinates\n };\n}\n\ninterface WaitAction extends BaseAction {\n action_type: 'wait';\n action_inputs: {\n time: string; // JSON string of [x, y] coordinates\n };\n}\n\ninterface TypeAction extends BaseAction {\n action_type: 'type';\n action_inputs: {\n content: string;\n };\n}\n\ninterface HotkeyAction extends BaseAction {\n action_type: 'hotkey';\n action_inputs: {\n key: string;\n };\n}\n\ninterface ScrollAction extends BaseAction {\n action_type: 'scroll';\n action_inputs: {\n direction: 'up' | 'down';\n };\n}\n\ninterface FinishedAction extends BaseAction {\n action_type: 'finished';\n action_inputs: Record<string, never>;\n}\n\ninterface AndroidLongPressAction extends BaseAction {\n action_type: 'androidLongPress';\n action_inputs: {\n start_coords: [number, number]; // Coordinates for long press\n duration?: number; // Duration in milliseconds\n };\n}\n\nexport type Action =\n | ClickAction\n | DragAction\n | TypeAction\n | HotkeyAction\n | ScrollAction\n | FinishedAction\n | WaitAction\n | AndroidLongPressAction;\n\nexport async function resizeImageForUiTars(imageBase64: string, size: Size) {\n if (\n vlLocateMode() === 'vlm-ui-tars' &&\n uiTarsModelVersion() === UITarsModelVersion.V1_5\n ) {\n debug('ui-tars-v1.5, will check image size', size);\n const currentPixels = size.width * size.height;\n const maxPixels = 16384 * 28 * 28; //\n if (currentPixels > maxPixels) {\n const resizeFactor = Math.sqrt(maxPixels / currentPixels);\n const newWidth = Math.floor(size.width * resizeFactor);\n const newHeight = Math.floor(size.height * resizeFactor);\n debug(\n 'resize image for ui-tars, new width: %s, new height: %s',\n newWidth,\n newHeight,\n );\n const resizedImage = await resizeImgBase64(imageBase64, {\n width: newWidth,\n height: newHeight,\n });\n return resizedImage;\n }\n }\n return imageBase64;\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","debug","getDebug","bboxSize","pointToBbox","point","width","height","Math","vlmPlanning","options","conversationHistory","userInstruction","size","systemPrompt","getUiTarsPlanningPrompt","res","call","AIActionType","convertedText","convertBboxToCoordinates","modelVer","uiTarsModelVersion","parsed","actionParser","undefined","JSON","transformActions","action","assert","getPoint","startPoint","endPoint","keys","transformHotkeyInput","console","pullDirection","Error","getSummary","text","pattern","replaceMatch","match","x1","y1","x2","y2","x1Num","Number","y1Num","x2Num","y2Num","x","y","cleanedText","startBox","resizeImageForUiTars","imageBase64","vlLocateMode","UITarsModelVersion","currentPixels","maxPixels","resizeFactor","newWidth","newHeight","resizedImage","resizeImgBase64"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,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AAEC,EAAE,CAAC,EAAEC,EAAE,CAAC,CAAC;IACtB;IAGA,MAAMC,cAAcf,KAAK,OAAO,CAAC,YAAY;IAC7C,OAAOe,YAAY,OAAO,CAACd,SAASC,cAAc,IAAI;AACxD;AAEA,SAASX,SAASyB,QAAgB,EAAE1C,IAAuC;IACzE,MAAM,CAACuC,GAAGC,EAAE,GAAG3B,KAAK,KAAK,CAAC6B;IAC1B,OAAO;QAACH,IAAIvC,KAAK,KAAK;QAAEwC,IAAIxC,KAAK,MAAM;KAAC;AAC1C;AA2EO,eAAe2C,qBAAqBC,WAAmB,EAAE5C,IAAU;IACxE,IACE6C,AAAmB,kBAAnBA,AAAAA,IAAAA,oBAAAA,YAAAA,AAAAA,OACApC,AAAAA,IAAAA,oBAAAA,kBAAAA,AAAAA,QAAyBqC,oBAAAA,kBAAAA,CAAAA,IAAuB,EAChD;QACA1D,MAAM,uCAAuCY;QAC7C,MAAM+C,gBAAgB/C,KAAK,KAAK,GAAGA,KAAK,MAAM;QAC9C,MAAMgD,YAAY;QAClB,IAAID,gBAAgBC,WAAW;YAC7B,MAAMC,eAAetD,KAAK,IAAI,CAACqD,YAAYD;YAC3C,MAAMG,WAAWvD,KAAK,KAAK,CAACK,KAAK,KAAK,GAAGiD;YACzC,MAAME,YAAYxD,KAAK,KAAK,CAACK,KAAK,MAAM,GAAGiD;YAC3C7D,MACE,2DACA8D,UACAC;YAEF,MAAMC,eAAe,MAAMC,AAAAA,IAAAA,oBAAAA,eAAAA,AAAAA,EAAgBT,aAAa;gBACtD,OAAOM;gBACP,QAAQC;YACV;YACA,OAAOC;QACT;IACF;IACA,OAAOR;AACT"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ resizeImg: ()=>img_namespaceObject.resizeImg,
28
+ httpImg2Base64: ()=>img_namespaceObject.httpImg2Base64,
29
+ localImg2Base64: ()=>img_namespaceObject.localImg2Base64,
30
+ zoomForGPT4o: ()=>img_namespaceObject.zoomForGPT4o,
31
+ imageInfoOfBase64: ()=>img_namespaceObject.imageInfoOfBase64,
32
+ imageInfo: ()=>img_namespaceObject.imageInfo,
33
+ saveBase64Image: ()=>img_namespaceObject.saveBase64Image
34
+ });
35
+ const img_namespaceObject = require("@midscene/shared/img");
36
+ exports.httpImg2Base64 = __webpack_exports__.httpImg2Base64;
37
+ exports.imageInfo = __webpack_exports__.imageInfo;
38
+ exports.imageInfoOfBase64 = __webpack_exports__.imageInfoOfBase64;
39
+ exports.localImg2Base64 = __webpack_exports__.localImg2Base64;
40
+ exports.resizeImg = __webpack_exports__.resizeImg;
41
+ exports.saveBase64Image = __webpack_exports__.saveBase64Image;
42
+ exports.zoomForGPT4o = __webpack_exports__.zoomForGPT4o;
43
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
44
+ "httpImg2Base64",
45
+ "imageInfo",
46
+ "imageInfoOfBase64",
47
+ "localImg2Base64",
48
+ "resizeImg",
49
+ "saveBase64Image",
50
+ "zoomForGPT4o"
51
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
52
+ Object.defineProperty(exports, '__esModule', {
53
+ value: true
54
+ });
55
+
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image/index.js","sources":["webpack://@midscene/core/webpack/runtime/define_property_getters","webpack://@midscene/core/webpack/runtime/has_own_property","webpack://@midscene/core/webpack/runtime/make_namespace_object"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D"}