ZHZisZZ commited on
Commit
a3f133e
·
1 Parent(s): 6f29621
cua_lite/data/preproc/AGENTS.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dataset Preprocessing Specification
2
+
3
+ This document defines the format for processed dataset subsets in JSONL format.
4
+
5
+ ---
6
+
7
+ ## Core Dataset Schema
8
+
9
+ Each line in the JSONL file must contain a JSON object with the following fields:
10
+
11
+ ```json
12
+ {
13
+ "id": "unique_identifier",
14
+ "images": ["path/to/image0.png", "path/to/image1.png"],
15
+ "messages": [...],
16
+ "tools": "none | POINT_TOOLS_LIST | BBOX_TOOLS_LIST | DESKTOP_USE_ATOMIC_TOOLS_LIST | MOBILE_USE_ATOMIC_TOOLS_LIST",
17
+ "resolution": [width, height],
18
+ "meta": {
19
+ "os": "none | ubuntu | windows | macos | android | ios",
20
+ ...
21
+ }
22
+ }
23
+ ```
24
+
25
+ ### Field Descriptions
26
+
27
+ - **`id`**: Unique identifier for each data sample
28
+ - **`images`**: List of file paths to screenshot images
29
+ - **`messages`**: Conversation turns in OpenAI-style message format
30
+ - **`tools`**: Tool configuration (see [Tool Types](#tool-types) and `cua_lite/data/tools/atomic.py`)
31
+ - **`resolution`**: Display resolution as `[width, height]`
32
+ - **`meta`**: Metadata object containing:
33
+ - **`os`**: Operating system context (`none` for web-based, or specific OS)
34
+ - Additional custom metadata fields as needed
35
+
36
+ ### Tool Types
37
+
38
+ The `tools` field specifies which tool set is available for the agent; Please find the definition of these tools in `cua_lite/data/tools/atomic.py`.
39
+
40
+ | Tool Type | Description |
41
+ |-----------|-------------|
42
+ | `none` | No tools (understanding tasks only) |
43
+ | `POINT_TOOLS_LIST` | Point-based interaction tools |
44
+ | `BBOX_TOOLS_LIST` | Bounding box tools |
45
+ | `DESKTOP_USE_ATOMIC_TOOLS_LIST` | Desktop atomic action tools |
46
+ | `MOBILE_USE_ATOMIC_TOOLS_LIST` | Mobile atomic action tools |
47
+
48
+
49
+ ---
50
+
51
+ ## Dataset Task Types
52
+
53
+ ### Understanding Tasks
54
+
55
+ Understanding tasks involve image comprehension without tool usage.
56
+
57
+ **Configuration:**
58
+ - **`tools`**: `none`
59
+ - **`messages`**: `none`
60
+ **Message Format Example:**
61
+
62
+ ```json
63
+ {
64
+ "messages": [
65
+ {
66
+ "role": "user",
67
+ "content": [
68
+ {"type": "image", "index": 0},
69
+ {"type": "text", "text": "Please explain the first screenshot to me."}
70
+ ]
71
+ },
72
+ {
73
+ "role": "assistant",
74
+ "content": [
75
+ {"type": "text", "text": "This is a screenshot of a desktop."}
76
+ ]
77
+ }
78
+ ]
79
+ }
80
+ ```
81
+
82
+ **Notes:**
83
+ - The `"index"` field in image content references the zero-based position in the `images` array
84
+ - Multiple conversation turns are supported for follow-up questions
85
+
86
+ ---
cua_lite/data/tools/atomic.py ADDED
@@ -0,0 +1,519 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DESKTOP_USE_ATOMIC_TOOLS_LIST = [
2
+ {
3
+ "type": "function",
4
+ "function": {
5
+ "name": "key",
6
+ "description": "On a desktop, press and release keys.",
7
+ "parameters": {
8
+ "type": "object",
9
+ "properties": {
10
+ "keys": {
11
+ "type": "array",
12
+ "items": {"type": "string"},
13
+ "description": "List of keys to press."
14
+ }
15
+ },
16
+ "required": ["keys"]
17
+ }
18
+ }
19
+ },
20
+ {
21
+ "type": "function",
22
+ "function": {
23
+ "name": "type",
24
+ "description": "On a desktop, type text content into the currently focused input field.",
25
+ "parameters": {
26
+ "type": "object",
27
+ "properties": {
28
+ "text": {
29
+ "type": "string",
30
+ "description": "The text content to type."
31
+ }
32
+ },
33
+ "required": ["text"]
34
+ }
35
+ }
36
+ },
37
+ {
38
+ "type": "function",
39
+ "function": {
40
+ "name": "mouse_move",
41
+ "description": "On a desktop, move the mouse cursor to specified coordinates.",
42
+ "parameters": {
43
+ "type": "object",
44
+ "properties": {
45
+ "coordinate": {
46
+ "type": "array",
47
+ "items": {"type": "integer"},
48
+ "description": "(x, y) coordinates normalized to [0, 1000]."
49
+ }
50
+ },
51
+ "required": ["coordinate"]
52
+ }
53
+ }
54
+ },
55
+ {
56
+ "type": "function",
57
+ "function": {
58
+ "name": "click",
59
+ "description": "On a desktop, perform mouse click at specified coordinates. Default is at current cursor position.",
60
+ "parameters": {
61
+ "type": "object",
62
+ "properties": {
63
+ "coordinate": {
64
+ "type": "array",
65
+ "items": {"type": "integer"},
66
+ "description": "(x, y) coordinates normalized to [0, 1000]. Default is current cursor position."
67
+ },
68
+ "button": {
69
+ "type": "string",
70
+ "enum": ["left", "right", "middle"],
71
+ "description": "Mouse button to click. Default is 'left'."
72
+ },
73
+ "clicks": {
74
+ "type": "integer",
75
+ "enum": [1, 2, 3],
76
+ "description": "Number of clicks: 1=single, 2=double, 3=triple. Default is 1."
77
+ }
78
+ },
79
+ "required": []
80
+ }
81
+ }
82
+ },
83
+ {
84
+ "type": "function",
85
+ "function": {
86
+ "name": "drag",
87
+ "description": "On a desktop, drag the mouse from start to end coordinates. Default start is current cursor position.",
88
+ "parameters": {
89
+ "type": "object",
90
+ "properties": {
91
+ "start_coordinate": {
92
+ "type": "array",
93
+ "items": {"type": "integer"},
94
+ "description": "Starting (x, y) coordinates, normalized to [0, 1000]. Default is current cursor position."
95
+ },
96
+ "coordinate": {
97
+ "type": "array",
98
+ "items": {"type": "integer"},
99
+ "description": "Ending (x, y) coordinates, normalized to [0, 1000]."
100
+ },
101
+ "button": {
102
+ "type": "string",
103
+ "enum": ["left", "right", "middle"],
104
+ "description": "Mouse button to hold while dragging. Default is 'left'."
105
+ }
106
+ },
107
+ "required": ["coordinate"]
108
+ }
109
+ }
110
+ },
111
+ {
112
+ "type": "function",
113
+ "function": {
114
+ "name": "mouse_down",
115
+ "description": "On a desktop, press the mouse button without releasing.",
116
+ "parameters": {
117
+ "type": "object",
118
+ "properties": {
119
+ "button": {
120
+ "type": "string",
121
+ "enum": ["left", "right", "middle"],
122
+ "description": "Mouse button to press. Default is 'left'."
123
+ }
124
+ },
125
+ "required": []
126
+ }
127
+ }
128
+ },
129
+ {
130
+ "type": "function",
131
+ "function": {
132
+ "name": "mouse_up",
133
+ "description": "On a desktop, release the mouse button.",
134
+ "parameters": {
135
+ "type": "object",
136
+ "properties": {
137
+ "button": {
138
+ "type": "string",
139
+ "enum": ["left", "right", "middle"],
140
+ "description": "Mouse button to release. Default is 'left'."
141
+ }
142
+ },
143
+ "required": []
144
+ }
145
+ }
146
+ },
147
+ {
148
+ "type": "function",
149
+ "function": {
150
+ "name": "scroll",
151
+ "description": "On a desktop, scroll in a specified direction by a specified amount. Default is at current cursor position.",
152
+ "parameters": {
153
+ "type": "object",
154
+ "properties": {
155
+ "direction": {
156
+ "type": "string",
157
+ "enum": ["up", "down", "left", "right"],
158
+ "description": "The direction to scroll."
159
+ },
160
+ "amount": {
161
+ "type": "integer",
162
+ "description": "Number of scroll units."
163
+ },
164
+ "coordinate": {
165
+ "type": "array",
166
+ "items": {"type": "integer"},
167
+ "description": "(x, y) coordinates normalized to [0, 1000]. If provided, cursor moves to this position before scrolling. Default is current cursor position."
168
+ }
169
+ },
170
+ "required": ["direction", "amount"]
171
+ }
172
+ }
173
+ },
174
+ {
175
+ "type": "function",
176
+ "function": {
177
+ "name": "hold_key",
178
+ "description": "On a desktop, hold keys down for a specified duration.",
179
+ "parameters": {
180
+ "type": "object",
181
+ "properties": {
182
+ "keys": {
183
+ "type": "array",
184
+ "items": {"type": "string"},
185
+ "description": "List of keys to hold down."
186
+ },
187
+ "duration": {
188
+ "type": "number",
189
+ "description": "Duration in seconds."
190
+ }
191
+ },
192
+ "required": ["keys", "duration"]
193
+ }
194
+ }
195
+ },
196
+ {
197
+ "type": "function",
198
+ "function": {
199
+ "name": "wait",
200
+ "description": "On a desktop, pause execution for a specified duration.",
201
+ "parameters": {
202
+ "type": "object",
203
+ "properties": {
204
+ "duration": {
205
+ "type": "number",
206
+ "description": "Time in seconds to wait."
207
+ }
208
+ },
209
+ "required": ["duration"]
210
+ }
211
+ }
212
+ },
213
+ {
214
+ "type": "function",
215
+ "function": {
216
+ "name": "screenshot",
217
+ "description": "On a desktop, take a screenshot.",
218
+ "parameters": {
219
+ "type": "object",
220
+ "properties": {},
221
+ "required": []
222
+ }
223
+ }
224
+ },
225
+ {
226
+ "type": "function",
227
+ "function": {
228
+ "name": "cursor_position",
229
+ "description": "On a desktop, get the current cursor position.",
230
+ "parameters": {
231
+ "type": "object",
232
+ "properties": {},
233
+ "required": []
234
+ }
235
+ }
236
+ },
237
+ {
238
+ "type": "function",
239
+ "function": {
240
+ "name": "terminate",
241
+ "description": "On a desktop, signal that the task is completed or failed.",
242
+ "parameters": {
243
+ "type": "object",
244
+ "properties": {
245
+ "status": {
246
+ "type": "string",
247
+ "enum": ["success", "failure"],
248
+ "description": "The final status of the task."
249
+ },
250
+ "reason": {
251
+ "type": "string",
252
+ "description": "Explanation of the result or reason for failure."
253
+ }
254
+ },
255
+ "required": ["status"]
256
+ }
257
+ }
258
+ }
259
+ ]
260
+
261
+
262
+ POINT_TOOLS_LIST = [
263
+ {
264
+ "type": "function",
265
+ "function": {
266
+ "name": "point",
267
+ "description": "Locate a specific object on the screen by returning its center coordinates.",
268
+ "parameters": {
269
+ "type": "object",
270
+ "properties": {
271
+ "coordinate": {
272
+ "type": "array",
273
+ "items": {"type": "integer"},
274
+ "description": "(x, y) coordinates representing the center of the described object, normalized to [0, 1000]."
275
+ }
276
+ },
277
+ "required": ["coordinate"]
278
+ }
279
+ }
280
+ }
281
+ ]
282
+
283
+
284
+ BBOX_TOOLS_LIST = [
285
+ {
286
+ "type": "function",
287
+ "function": {
288
+ "name": "bbox",
289
+ "description": "Locate a specific object on the screen by returning its bounding box coordinates.",
290
+ "parameters": {
291
+ "type": "object",
292
+ "properties": {
293
+ "coordinate": {
294
+ "type": "array",
295
+ "items": {"type": "integer"},
296
+ "description": "(x_min, y_min, x_max, y_max) defining the bounding box, where (x_min, y_min) is the top-left corner and (x_max, y_max) is the bottom-right corner. Normalized to [0, 1000]."
297
+ }
298
+ },
299
+ "required": ["coordinate"]
300
+ }
301
+ }
302
+ }
303
+ ]
304
+
305
+
306
+
307
+ MOBILE_USE_ATOMIC_TOOLS_LIST = [
308
+ {
309
+ "type": "function",
310
+ "function": {
311
+ "name": "tap",
312
+ "description": "On a mobile device, perform a single tap at the specified coordinates.",
313
+ "parameters": {
314
+ "type": "object",
315
+ "properties": {
316
+ "coordinate": {
317
+ "type": "array",
318
+ "items": {"type": "integer"},
319
+ "description": "(x, y) coordinates normalized to [0, 1000]."
320
+ }
321
+ },
322
+ "required": ["coordinate"]
323
+ }
324
+ }
325
+ },
326
+ {
327
+ "type": "function",
328
+ "function": {
329
+ "name": "long_press",
330
+ "description": "On a mobile device, perform a long press action at the specified coordinates.",
331
+ "parameters": {
332
+ "type": "object",
333
+ "properties": {
334
+ "coordinate": {
335
+ "type": "array",
336
+ "items": {"type": "integer"},
337
+ "description": "(x, y) coordinates normalized to [0, 1000]."
338
+ },
339
+ "duration": {
340
+ "type": "number",
341
+ "description": "Duration of the press in seconds. Default is system standard."
342
+ }
343
+ },
344
+ "required": ["coordinate"]
345
+ }
346
+ }
347
+ },
348
+ {
349
+ "type": "function",
350
+ "function": {
351
+ "name": "type",
352
+ "description": "On a mobile device, type text content into the currently focused input field.",
353
+ "parameters": {
354
+ "type": "object",
355
+ "properties": {
356
+ "text": {
357
+ "type": "string",
358
+ "description": "The text content to type."
359
+ }
360
+ },
361
+ "required": ["text"]
362
+ }
363
+ }
364
+ },
365
+ {
366
+ "type": "function",
367
+ "function": {
368
+ "name": "scroll",
369
+ "description": "On a mobile device, scroll the screen in a specified direction from a starting point.",
370
+ "parameters": {
371
+ "type": "object",
372
+ "properties": {
373
+ "direction": {
374
+ "type": "string",
375
+ "enum": ["up", "down", "left", "right"],
376
+ "description": "The direction to scroll."
377
+ },
378
+ "coordinate": {
379
+ "type": "array",
380
+ "items": {"type": "integer"},
381
+ "description": "Starting (x, y) coordinates for the scroll action, normalized to [0, 1000]."
382
+ }
383
+ },
384
+ "required": ["direction", "coordinate"]
385
+ }
386
+ }
387
+ },
388
+ {
389
+ "type": "function",
390
+ "function": {
391
+ "name": "swipe",
392
+ "description": "On a mobile device, perform a swipe gesture from a start point to an end point.",
393
+ "parameters": {
394
+ "type": "object",
395
+ "properties": {
396
+ "start_coordinate": {
397
+ "type": "array",
398
+ "items": {"type": "integer"},
399
+ "description": "Starting (x, y) coordinates, normalized to [0, 1000]."
400
+ },
401
+ "coordinate": {
402
+ "type": "array",
403
+ "items": {"type": "integer"},
404
+ "description": "Ending (x, y) coordinates, normalized to [0, 1000]."
405
+ }
406
+ },
407
+ "required": ["start_coordinate", "coordinate"]
408
+ }
409
+ }
410
+ },
411
+ {
412
+ "type": "function",
413
+ "function": {
414
+ "name": "open_app",
415
+ "description": "On a mobile device, launch an application by its name.",
416
+ "parameters": {
417
+ "type": "object",
418
+ "properties": {
419
+ "app_name": {
420
+ "type": "string",
421
+ "description": "The exact name of the application to open."
422
+ }
423
+ },
424
+ "required": ["app_name"]
425
+ }
426
+ }
427
+ },
428
+ {
429
+ "type": "function",
430
+ "function": {
431
+ "name": "press_home",
432
+ "description": "On a mobile device, press the Home button to return to the launcher.",
433
+ "parameters": {
434
+ "type": "object",
435
+ "properties": {},
436
+ "required": []
437
+ }
438
+ }
439
+ },
440
+ {
441
+ "type": "function",
442
+ "function": {
443
+ "name": "press_back",
444
+ "description": "On a mobile device, press the Back button.",
445
+ "parameters": {
446
+ "type": "object",
447
+ "properties": {},
448
+ "required": []
449
+ }
450
+ }
451
+ },
452
+ {
453
+ "type": "function",
454
+ "function": {
455
+ "name": "terminate",
456
+ "description": "On a mobile device, signal that the task is completed or failed.",
457
+ "parameters": {
458
+ "type": "object",
459
+ "properties": {
460
+ "status": {
461
+ "type": "string",
462
+ "enum": ["success", "failure"],
463
+ "description": "The final status of the task."
464
+ },
465
+ "reason": {
466
+ "type": "string",
467
+ "description": "Explanation of the result or reason for failure."
468
+ }
469
+ },
470
+ "required": ["status"]
471
+ }
472
+ }
473
+ }
474
+ ]
475
+
476
+
477
+ POINT_TOOL_LIST = [
478
+ {
479
+ "type": "function",
480
+ "function": {
481
+ "name": "point",
482
+ "description": "Locate a specific object on the screen by returning its center coordinates.",
483
+ "parameters": {
484
+ "type": "object",
485
+ "properties": {
486
+ "coordinate": {
487
+ "type": "array",
488
+ "items": {"type": "integer"},
489
+ "description": "(x, y) coordinates representing the center of the described object, normalized to [0, 1000]."
490
+ }
491
+ },
492
+ "required": ["coordinate"]
493
+ }
494
+ }
495
+ }
496
+ ]
497
+
498
+
499
+ BBOX_TOOL_LIST = [
500
+ {
501
+ "type": "function",
502
+ "function": {
503
+ "name": "bbox",
504
+ "description": "Locate a specific object on the screen by returning its bounding box coordinates.",
505
+ "parameters": {
506
+ "type": "object",
507
+ "properties": {
508
+ "coordinate": {
509
+ "type": "array",
510
+ "items": {"type": "integer"},
511
+ "description": "(x_min, y_min, x_max, y_max) defining the bounding box, where (x_min, y_min) is the top-left corner and (x_max, y_max) is the bottom-right corner. Normalized to [0, 1000]."
512
+ }
513
+ },
514
+ "required": ["coordinate"]
515
+ }
516
+ }
517
+ }
518
+ ]
519
+
cua_lite/data/tools/collective.py ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DESKTOP_USE_TOOLS = {
2
+ "type": "function",
3
+ "function": {
4
+ "name": "desktop_use",
5
+ "description": "Perform actions on the desktop interface. Coordinates are normalized to the range [0, 1000].",
6
+ "parameters": {
7
+ "type": "object",
8
+ "required": ["action"],
9
+ "properties": {
10
+ "action": {
11
+ "type": "string",
12
+ "enum": [
13
+ "key", "type", "mouse_move", "left_click", "left_click_drag",
14
+ "right_click", "middle_click", "double_click", "triple_click",
15
+ "left_mouse_down", "left_mouse_up", "scroll", "hold_key",
16
+ "wait", "screenshot", "cursor_position", "terminate"
17
+ ],
18
+ "description": (
19
+ "The action to perform:\n"
20
+ "- `key`: Press `keys`. [Args: keys]\n"
21
+ "- `type`: Type the `text` content. [Args: text]\n"
22
+ "- `mouse_move`: Move the cursor to `coordinate`. [Args: coordinate]\n"
23
+ "- `*_click`: Click at `coordinate` (or current position). [Args: coordinate?]\n"
24
+ "- `left_click_drag`: Drag from `start_coordinate` (or current position) to `coordinate`. [Args: coordinate, start_coordinate?]\n"
25
+ "- `scroll`: Scroll `scroll_amount` in `scroll_direction` at `coordinate` (or current position). [Args: scroll_direction, scroll_amount, coordinate?]\n"
26
+ "- `hold_key`: Hold `keys` down for `duration` seconds. [Args: keys, duration]\n"
27
+ "- `wait`: Pause execution for `duration` seconds. [Args: duration]\n"
28
+ "- `screenshot`: Take a full screen screenshot. [No args]\n"
29
+ "- `cursor_position`: Return the current (x, y) coordinates. [No args]\n"
30
+ "- `left_mouse_down`/`up`: Press or releases the left mouse button. [No args]\n"
31
+ "- `terminate`: End the task with `status` and an optional `text` reason. [Args: status, text?]"
32
+ )
33
+ },
34
+ "coordinate": {
35
+ "type": "array",
36
+ "items": {"type": "integer"},
37
+ "description": "(x, y) coordinates. Required for `mouse_move` and `left_click_drag`. Optional for `*_click*` and `scroll` (defaults to current)."
38
+ },
39
+ "start_coordinate": {
40
+ "type": "array",
41
+ "items": {"type": "integer"},
42
+ "description": "(x, y) coordinates. Optional for `left_click_drag` (defaults to current)."
43
+ },
44
+ "keys": {
45
+ "type": "array",
46
+ "items": {"type": "string"},
47
+ "description": "List of keys. Required for `key` and `hold_key`."
48
+ },
49
+ "text": {
50
+ "type": "string",
51
+ "description": "Text content. Required for `type`. Optional for `terminate`."
52
+ },
53
+ "scroll_direction": {
54
+ "type": "string",
55
+ "enum": ["up", "down", "left", "right"],
56
+ "description": "Direction to Scroll. Required for `scroll`."
57
+ },
58
+ "scroll_amount": {
59
+ "type": "integer",
60
+ "description": "Number of notches to scroll. Required for `scroll`."
61
+ },
62
+ "duration": {
63
+ "type": "number",
64
+ "description": "Time in seconds. Required for `wait` and `hold_key`."
65
+ },
66
+ "status": {
67
+ "type": "string",
68
+ "enum": ["success", "failure"],
69
+ "description": "Completion status. Required for `terminate`."
70
+ }
71
+ }
72
+ }
73
+ }
74
+ }
75
+
76
+
77
+ MOBILE_USE_TOOLS = {
78
+ "type": "function",
79
+ "function": {
80
+ "name_for_human": "mobile_use",
81
+ "name": "mobile_use",
82
+ "description": "Perform actions on the mobile device interface. Coordinates are normalized to the range [0, 1000].",
83
+ "parameters": {
84
+ "type": "object",
85
+ "properties": {
86
+ "action": {
87
+ "type": "string",
88
+ "enum": [
89
+ "tap",
90
+ "long_press",
91
+ "type",
92
+ "scroll",
93
+ "open_app",
94
+ "swipe",
95
+ "press_home",
96
+ "press_back",
97
+ "terminate"
98
+ ],
99
+ "description": (
100
+ "The action to perform:\n"
101
+ "- `tap`: Tap at `coordinate`. [Args: coordinate]\n"
102
+ "- `long_press`: Long press at `coordinate` for optional `duration`. [Args: coordinate, duration?]\n"
103
+ "- `type`: Type the `text` content. [Args: text]\n"
104
+ "- `swipe`: Swipe from `start_coordinate` to `coordinate`. [Args: start_coordinate, coordinate]\n"
105
+ "- `scroll`: Scroll in `scroll_direction` at `coordinate`. [Args: coordinate, scroll_direction]\n"
106
+ "- `open_app`: Launch the app specified by `text` (app name). [Args: text]\n"
107
+ "- `press_home`: Press the device Home button. [No args]\n"
108
+ "- `press_back`: Press the device Back button. [No args]\n"
109
+ "- `terminate`: End the task with `status` and `text` (reason). [Args: status, text?]"
110
+ ),
111
+ },
112
+ "coordinate": {
113
+ "type": "array",
114
+ "items": { "type": "integer" },
115
+ "description": "(x, y) coordinates. Required for: `tap`, `long_press`, `scroll`, `swipe`."
116
+ },
117
+ "start_coordinate": {
118
+ "type": "array",
119
+ "items": { "type": "integer" },
120
+ "description": "(x, y) coordinates. Required for: `swipe`."
121
+ },
122
+ "text": {
123
+ "type": "string",
124
+ "description": "Text content. Required for: `type` (content), `open_app` (app name). Optional for: `terminate` (reason)."
125
+ },
126
+ "scroll_direction": {
127
+ "type": "string",
128
+ "enum": ["up", "down", "left", "right"],
129
+ "description": "Direction to scroll. Required for: `scroll`."
130
+ },
131
+ "duration": {
132
+ "type": "number",
133
+ "description": "Time in seconds. Optional for: `long_press` (defaults to system standard)."
134
+ },
135
+ "status": {
136
+ "type": "string",
137
+ "enum": ["success", "failure"],
138
+ "description": "Completion status. Required for: `terminate`."
139
+ }
140
+ },
141
+ "required": ["action"]
142
+ }
143
+ }
144
+ }
145
+
146
+
147
+ POINT_TOOL = {
148
+ "type": "function",
149
+ "function": {
150
+ "name_for_human": "point",
151
+ "name": "point",
152
+ "description": "Locate a specific object on the screen by returning its center coordinates. Coordinates are normalized to the range [0, 1000].",
153
+ "parameters": {
154
+ "properties": {
155
+ "coordinate": {
156
+ "type": "array",
157
+ "description": "(x, y) coordinates representing the screen coordinates for the center of the described object.",
158
+ },
159
+ },
160
+ "required": ["coordinate"],
161
+ "type": "object",
162
+ },
163
+ "args_format": "Format the arguments as a JSON object.",
164
+ },
165
+ }
166
+
167
+
168
+ BBOX_TOOL = {
169
+ "type": "function",
170
+ "function": {
171
+ "name_for_human": "bbox",
172
+ "name": "bbox",
173
+ "description": "Locate a specific object on the screen by returning its bounding box coordinates. Coordinates are normalized to the range [0, 1000].",
174
+ "parameters": {
175
+ "properties": {
176
+ "coordinate": {
177
+ "description": "(x_min, y_min, x_max, y_max) defining the bounding box, where (x_min, y_min) is the top-left corner and (x_max, y_max) is the bottom-right corner.",
178
+ "type": "array",
179
+ },
180
+ },
181
+ "required": ["coordinate"],
182
+ "type": "object",
183
+ },
184
+ "args_format": "Format the arguments as a JSON object.",
185
+ },
186
+ }