computer-use-ootb-internal 0.0.174__py3-none-any.whl → 0.0.176__py3-none-any.whl

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.
@@ -1,40 +1,40 @@
1
- """
2
- Test script to verify cursor animation is working
3
- """
4
- import asyncio
5
- import sys
6
- import time
7
- from pathlib import Path
8
- from computer_use_ootb_internal.computer_use_demo.tools.computer import ComputerTool
9
-
10
- async def test_animations():
11
-
12
- # Initialize the computer tool
13
- computer = ComputerTool()
14
-
15
- # Test mouse move animation
16
- print("Testing mouse move animation...")
17
- await computer(action="mouse_move_windll", coordinate=(500, 500))
18
- print("Waiting 2 seconds...")
19
- await asyncio.sleep(2)
20
-
21
- # Test click animation
22
- print("Testing click animation...")
23
- await computer(action="left_click_windll", coordinate=(700, 300))
24
- print("Waiting 2 seconds...")
25
- await asyncio.sleep(2)
26
-
27
- # Test another move
28
- print("Testing move and click sequence...")
29
- await computer(action="mouse_move_windll", coordinate=(300, 300))
30
- await asyncio.sleep(1)
31
- await computer(action="left_click_windll", coordinate=(300, 300))
32
-
33
- # Wait for animations to complete
34
- print("Waiting for animations to complete...")
35
- await asyncio.sleep(3)
36
-
37
- print("Test completed")
38
-
39
- if __name__ == "__main__":
1
+ """
2
+ Test script to verify cursor animation is working
3
+ """
4
+ import asyncio
5
+ import sys
6
+ import time
7
+ from pathlib import Path
8
+ from computer_use_ootb_internal.computer_use_demo.tools.computer import ComputerTool
9
+
10
+ async def test_animations():
11
+
12
+ # Initialize the computer tool
13
+ computer = ComputerTool()
14
+
15
+ # Test mouse move animation
16
+ print("Testing mouse move animation...")
17
+ await computer(action="mouse_move_windll", coordinate=(500, 500))
18
+ print("Waiting 2 seconds...")
19
+ await asyncio.sleep(2)
20
+
21
+ # Test click animation
22
+ print("Testing click animation...")
23
+ await computer(action="left_click_windll", coordinate=(700, 300))
24
+ print("Waiting 2 seconds...")
25
+ await asyncio.sleep(2)
26
+
27
+ # Test another move
28
+ print("Testing move and click sequence...")
29
+ await computer(action="mouse_move_windll", coordinate=(300, 300))
30
+ await asyncio.sleep(1)
31
+ await computer(action="left_click_windll", coordinate=(300, 300))
32
+
33
+ # Wait for animations to complete
34
+ print("Waiting for animations to complete...")
35
+ await asyncio.sleep(3)
36
+
37
+ print("Test completed")
38
+
39
+ if __name__ == "__main__":
40
40
  asyncio.run(test_animations())
@@ -37,6 +37,7 @@ class TeachmodeExecutor:
37
37
  "DRAG": "key",
38
38
  "SCROLL": "key",
39
39
  "DOUBLE_CLICK": "key",
40
+ "TRIPLE_CLICK": "key",
40
41
  "WAIT": "key",
41
42
  }
42
43
 
@@ -191,6 +192,11 @@ class TeachmodeExecutor:
191
192
  refined_output.append({"action": "mouse_move", "text": None, "coordinate": (x, y)})
192
193
  refined_output.append({"action": "double_click", "text": None, "coordinate": None})
193
194
 
195
+ elif action_item["action"] == "TRIPLE_CLICK": # 11. triple click
196
+ x, y = action_item["position"]
197
+ refined_output.append({"action": "mouse_move", "text": None, "coordinate": (x, y)})
198
+ refined_output.append({"action": "triple_click", "text": None, "coordinate": None})
199
+
194
200
  elif action_item["action"] == "WAIT": # 11. wait
195
201
  refined_output.append({"action": "wait", "text": None, "coordinate": None})
196
202
 
@@ -39,6 +39,7 @@ Action = Literal[
39
39
  "right_click",
40
40
  "middle_click",
41
41
  "double_click",
42
+ "triple_click",
42
43
  "left_press",
43
44
  "key_down",
44
45
  "key_up",
@@ -285,6 +286,7 @@ class ComputerTool(BaseAnthropicTool):
285
286
  "left_click",
286
287
  "right_click",
287
288
  "double_click",
289
+ "triple_click",
288
290
  "middle_click",
289
291
  "left_press",
290
292
  "scroll_down",
@@ -298,6 +300,8 @@ class ComputerTool(BaseAnthropicTool):
298
300
 
299
301
  if coordinate is not None:
300
302
  x, y = coordinate
303
+ x += self.offset_x
304
+ y += self.offset_y
301
305
  else:
302
306
  x, y = pyautogui.position()
303
307
 
@@ -317,6 +321,10 @@ class ComputerTool(BaseAnthropicTool):
317
321
  show_click(x, y)
318
322
  pyautogui.doubleClick(x=x, y=y)
319
323
  return ToolResult(output="Double click", action_base_type="click")
324
+ elif action == "triple_click":
325
+ show_click(x, y)
326
+ pyautogui.click(x=x, y=y, clicks=3, interval=0.1) # 3 clicks with 0.1s interval
327
+ return ToolResult(output="Triple click", action_base_type="click")
320
328
  elif action == "left_press":
321
329
  show_click(x, y)
322
330
  pyautogui.mouseDown(x=x, y=y)
@@ -391,7 +399,6 @@ class ComputerTool(BaseAnthropicTool):
391
399
  if coordinate is None:
392
400
  raise ToolError(output=f"coordinate is required for {action}", action_base_type="error")
393
401
 
394
- time.sleep(0.5)
395
402
  x0, y0 = pyautogui.position()
396
403
  # x0, y0 = self.scale_coordinates(ScalingSource.COMPUTER, x0, y0)
397
404
  x1 = coordinate[0]+self.offset_x
@@ -399,7 +406,7 @@ class ComputerTool(BaseAnthropicTool):
399
406
 
400
407
  show_move_to(x0, y0, x1, y1)
401
408
  self.marbot_auto_gui.moveTo(x=x1, y=y1)
402
- time.sleep(0.5)
409
+ time.sleep(0.25)
403
410
 
404
411
  return ToolResult(output=f"Mouse move", action_base_type="move")
405
412
 
@@ -407,7 +414,7 @@ class ComputerTool(BaseAnthropicTool):
407
414
  # self.marbot_auto_gui.rightClick(x=coordinate[0], y=coordinate[1])
408
415
  elif action == "key_down_windll":
409
416
  self.marbot_auto_gui.keyDown(text)
410
- time.sleep(0.5)
417
+ time.sleep(0.25)
411
418
  return ToolResult(output=f"Key down '{text}'", type="hidden", action_base_type="key")
412
419
 
413
420
  elif action == "key_up_windll":