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 @@ def __init__(self, computer_interface):
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 @@ async def get_current_url(self) -> str:
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."""
0 commit comments