cua-agent 0.4.10__py3-none-any.whl → 0.4.11__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.

Potentially problematic release.


This version of cua-agent might be problematic. Click here for more details.

agent/cli.py CHANGED
@@ -94,14 +94,14 @@ def print_action(action_type: str, details: Dict[str, Any], total_cost: float):
94
94
  # Format action details
95
95
  args_str = ""
96
96
  if action_type == "click" and "x" in details and "y" in details:
97
- args_str = f"({details['x']}, {details['y']})"
97
+ args_str = f"_{details['button']}({details['x']}, {details['y']})"
98
98
  elif action_type == "type" and "text" in details:
99
99
  text = details["text"]
100
100
  if len(text) > 50:
101
101
  text = text[:47] + "..."
102
- args_str = f'"{text}"'
103
- elif action_type == "key" and "key" in details:
104
- args_str = f"'{details['key']}'"
102
+ args_str = f'("{text}")'
103
+ elif action_type == "key" and "text" in details:
104
+ args_str = f"('{details['text']}')"
105
105
  elif action_type == "scroll" and "x" in details and "y" in details:
106
106
  args_str = f"({details['x']}, {details['y']})"
107
107
 
agent/computer_handler.py CHANGED
@@ -3,7 +3,7 @@ Computer handler implementation for OpenAI computer-use-preview protocol.
3
3
  """
4
4
 
5
5
  import base64
6
- from typing import Dict, List, Any, Literal, Union
6
+ from typing import Dict, List, Any, Literal, Union, Optional
7
7
  from .types import Computer
8
8
 
9
9
 
@@ -14,11 +14,13 @@ class OpenAIComputerHandler:
14
14
  """Initialize with a computer interface (from tool schema)."""
15
15
  self.interface = computer_interface
16
16
 
17
+ # ==== Computer-Use-Preview Action Space ====
18
+
17
19
  async def get_environment(self) -> Literal["windows", "mac", "linux", "browser"]:
18
20
  """Get the current environment type."""
19
21
  # For now, return a default - this could be enhanced to detect actual environment
20
22
  return "windows"
21
-
23
+
22
24
  async def get_dimensions(self) -> tuple[int, int]:
23
25
  """Get screen dimensions as (width, height)."""
24
26
  screen_size = await self.interface.get_screen_size()
@@ -94,6 +96,14 @@ class OpenAIComputerHandler:
94
96
  # For now, return empty string
95
97
  return ""
96
98
 
99
+ # ==== Anthropic Computer Action Space ====
100
+ async def left_mouse_down(self, x: Optional[int] = None, y: Optional[int] = None) -> None:
101
+ """Left mouse down at coordinates."""
102
+ await self.interface.mouse_down(x, y, button="left")
103
+
104
+ async def left_mouse_up(self, x: Optional[int] = None, y: Optional[int] = None) -> None:
105
+ """Left mouse up at coordinates."""
106
+ await self.interface.mouse_up(x, y, button="left")
97
107
 
98
108
  def acknowledge_safety_check_callback(message: str, allow_always: bool = False) -> bool:
99
109
  """Safety check callback for user acknowledgment."""