cua-computer 0.1.24__py3-none-any.whl → 0.1.25__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.
- computer/computer.py +7 -6
- computer/interface/base.py +11 -0
- computer/interface/macos.py +5 -0
- computer/ui/gradio/app.py +1 -1
- {cua_computer-0.1.24.dist-info → cua_computer-0.1.25.dist-info}/METADATA +2 -2
- {cua_computer-0.1.24.dist-info → cua_computer-0.1.25.dist-info}/RECORD +8 -8
- {cua_computer-0.1.24.dist-info → cua_computer-0.1.25.dist-info}/WHEEL +0 -0
- {cua_computer-0.1.24.dist-info → cua_computer-0.1.25.dist-info}/entry_points.txt +0 -0
computer/computer.py
CHANGED
@@ -29,7 +29,7 @@ class Computer:
|
|
29
29
|
display: Union[Display, Dict[str, int], str] = "1024x768",
|
30
30
|
memory: str = "8GB",
|
31
31
|
cpu: str = "4",
|
32
|
-
|
32
|
+
os_type: OSType = "macos",
|
33
33
|
name: str = "",
|
34
34
|
image: str = "macos-sequoia-cua:latest",
|
35
35
|
shared_directories: Optional[List[str]] = None,
|
@@ -68,6 +68,7 @@ class Computer:
|
|
68
68
|
self.image = image
|
69
69
|
self.port = port
|
70
70
|
self.host = host
|
71
|
+
self.os_type = os_type
|
71
72
|
|
72
73
|
# Store telemetry preference
|
73
74
|
self._telemetry_enabled = telemetry_enabled
|
@@ -129,8 +130,8 @@ class Computer:
|
|
129
130
|
self.shared_paths = []
|
130
131
|
if shared_directories:
|
131
132
|
for path in shared_directories:
|
132
|
-
abs_path = os.path.abspath(os.path.expanduser(path))
|
133
|
-
if not os.path.exists(abs_path):
|
133
|
+
abs_path = os.path.abspath(os.path.expanduser(path))
|
134
|
+
if not os.path.exists(abs_path):
|
134
135
|
raise ValueError(f"Shared directory does not exist: {path}")
|
135
136
|
self.shared_paths.append(abs_path)
|
136
137
|
self._pylume_context = None
|
@@ -188,7 +189,7 @@ class Computer:
|
|
188
189
|
self._interface = cast(
|
189
190
|
BaseComputerInterface,
|
190
191
|
InterfaceFactory.create_interface_for_os(
|
191
|
-
os=self.
|
192
|
+
os=self.os_type, ip_address=ip_address # type: ignore[arg-type]
|
192
193
|
),
|
193
194
|
)
|
194
195
|
|
@@ -288,13 +289,13 @@ class Computer:
|
|
288
289
|
|
289
290
|
try:
|
290
291
|
# Initialize the interface using the factory with the specified OS
|
291
|
-
self.logger.info(f"Initializing interface for {self.
|
292
|
+
self.logger.info(f"Initializing interface for {self.os_type} at {ip_address}")
|
292
293
|
from .interface.base import BaseComputerInterface
|
293
294
|
|
294
295
|
self._interface = cast(
|
295
296
|
BaseComputerInterface,
|
296
297
|
InterfaceFactory.create_interface_for_os(
|
297
|
-
os=self.
|
298
|
+
os=self.os_type, ip_address=ip_address # type: ignore[arg-type]
|
298
299
|
),
|
299
300
|
)
|
300
301
|
|
computer/interface/base.py
CHANGED
@@ -79,6 +79,17 @@ class BaseComputerInterface(ABC):
|
|
79
79
|
"""
|
80
80
|
pass
|
81
81
|
|
82
|
+
@abstractmethod
|
83
|
+
async def drag(self, path: List[Tuple[int, int]], button: str = "left", duration: float = 0.5) -> None:
|
84
|
+
"""Drag the cursor along a path of coordinates.
|
85
|
+
|
86
|
+
Args:
|
87
|
+
path: List of (x, y) coordinate tuples defining the drag path
|
88
|
+
button: The mouse button to use ('left', 'middle', 'right')
|
89
|
+
duration: Total time in seconds that the drag operation should take
|
90
|
+
"""
|
91
|
+
pass
|
92
|
+
|
82
93
|
# Keyboard Actions
|
83
94
|
@abstractmethod
|
84
95
|
async def type_text(self, text: str) -> None:
|
computer/interface/macos.py
CHANGED
@@ -328,6 +328,11 @@ class MacOSComputerInterface(BaseComputerInterface):
|
|
328
328
|
"drag_to", {"x": x, "y": y, "button": button, "duration": duration}
|
329
329
|
)
|
330
330
|
|
331
|
+
async def drag(self, path: List[Tuple[int, int]], button: str = "left", duration: float = 0.5) -> None:
|
332
|
+
await self._send_command(
|
333
|
+
"drag", {"path": path, "button": button, "duration": duration}
|
334
|
+
)
|
335
|
+
|
331
336
|
# Keyboard Actions
|
332
337
|
async def type_text(self, text: str) -> None:
|
333
338
|
await self._send_command("type_text", {"text": text})
|
computer/ui/gradio/app.py
CHANGED
@@ -532,7 +532,7 @@ async def handle_init_computer():
|
|
532
532
|
"""Initialize the computer instance and tools"""
|
533
533
|
global computer, tool_call_logs, tools
|
534
534
|
|
535
|
-
computer = Computer(
|
535
|
+
computer = Computer(os_type="macos", display="1024x768", memory="8GB", cpu="4")
|
536
536
|
await computer.run()
|
537
537
|
|
538
538
|
# Log computer initialization as a tool call
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: cua-computer
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.25
|
4
4
|
Summary: Computer-Use Interface (CUI) framework powering Cua
|
5
5
|
Author-Email: TryCua <gh@trycua.com>
|
6
6
|
Requires-Python: >=3.10
|
@@ -44,7 +44,7 @@ Description-Content-Type: text/markdown
|
|
44
44
|
```python
|
45
45
|
from computer import Computer
|
46
46
|
|
47
|
-
computer = Computer(
|
47
|
+
computer = Computer(os_type="macos", display="1024x768", memory="8GB", cpu="4")
|
48
48
|
try:
|
49
49
|
await computer.run()
|
50
50
|
|
@@ -1,19 +1,19 @@
|
|
1
1
|
computer/__init__.py,sha256=_FvOJ5EmGErcPfmmHsIYTOPC7fz8jcMZJOMJUg2zd0I,1139
|
2
|
-
computer/computer.py,sha256=
|
2
|
+
computer/computer.py,sha256=GB7EaZ9i4YQMXQ37jwMlK8Vxo387TTLQiHOkXUSw0vE,23712
|
3
3
|
computer/interface/__init__.py,sha256=xQvYjq5PMn9ZJOmRR5mWtONTl_0HVd8ACvW6AQnzDdw,262
|
4
|
-
computer/interface/base.py,sha256=
|
4
|
+
computer/interface/base.py,sha256=uRF2AfF3dbpOmvzZ55JgODpNC6LiudfhK8KCf5v7uUw,5771
|
5
5
|
computer/interface/factory.py,sha256=7Sczbmgu7Zlf9QfmhxOe_wFawRSPpvwd2dLSA4asDs0,1028
|
6
6
|
computer/interface/linux.py,sha256=0Kc_vkPnEUlKUcVYMycbxiuKyZOpOPwwmUcFJbFmopE,817
|
7
|
-
computer/interface/macos.py,sha256=
|
7
|
+
computer/interface/macos.py,sha256=HWRCjjinatT0BaHMUOVWCAWyI6Y8Yyz1AcDDmdQ90JE,24773
|
8
8
|
computer/interface/models.py,sha256=RZKVUdwKrKUoFqwlx2Dk8Egkmq_AInlIu_d0xg7SZzw,3238
|
9
9
|
computer/logger.py,sha256=UVvnmZGOWVF9TCsixEbeQnDZ3wBPAJ2anW3Zp-MoJ8Y,2896
|
10
10
|
computer/models.py,sha256=6chs4wxMpWdVhsOETeaGqFFI3feBmSyLIC8l5EJDq5g,780
|
11
11
|
computer/telemetry.py,sha256=FvNFpxgeRuCMdNpREuSL7bOMZy9gSzY4J0rLeNDw0CU,3746
|
12
12
|
computer/ui/__init__.py,sha256=pmo05ek9qiB_x7DPeE6Vf_8RsIOqTD0w1dBLMHfoOnY,45
|
13
13
|
computer/ui/gradio/__init__.py,sha256=5_KimixM48-X74FCsLw7LbSt39MQfUMEL8-M9amK3Cw,117
|
14
|
-
computer/ui/gradio/app.py,sha256=
|
14
|
+
computer/ui/gradio/app.py,sha256=IU4gmvXvUxJxt1MSAMT6bfNC2YjT_JQbQ0M60bLygMs,64086
|
15
15
|
computer/utils.py,sha256=zY50NXB7r51GNLQ6l7lhG_qv0_ufpQ8n0-SDhCei8m4,2838
|
16
|
-
cua_computer-0.1.
|
17
|
-
cua_computer-0.1.
|
18
|
-
cua_computer-0.1.
|
19
|
-
cua_computer-0.1.
|
16
|
+
cua_computer-0.1.25.dist-info/METADATA,sha256=ZvKgxQuCYSbEnFgwZZHbQnwiNrXr32GjKfHdXi5uqmc,5584
|
17
|
+
cua_computer-0.1.25.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
18
|
+
cua_computer-0.1.25.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
19
|
+
cua_computer-0.1.25.dist-info/RECORD,,
|
File without changes
|
File without changes
|