cua-computer 0.2.13__tar.gz → 0.3.0__tar.gz
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.
- {cua_computer-0.2.13 → cua_computer-0.3.0}/PKG-INFO +7 -7
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/interface/base.py +26 -4
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/interface/linux.py +7 -4
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/interface/macos.py +7 -4
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/interface/models.py +12 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/interface/windows.py +7 -4
- {cua_computer-0.2.13 → cua_computer-0.3.0}/pyproject.toml +9 -9
- {cua_computer-0.2.13 → cua_computer-0.3.0}/README.md +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/__init__.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/computer.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/diorama_computer.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/helpers.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/interface/__init__.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/interface/factory.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/logger.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/models.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/providers/__init__.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/providers/base.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/providers/cloud/__init__.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/providers/cloud/provider.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/providers/factory.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/providers/lume/__init__.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/providers/lume/provider.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/providers/lume_api.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/providers/lumier/__init__.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/providers/lumier/provider.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/providers/winsandbox/__init__.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/providers/winsandbox/provider.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/providers/winsandbox/setup_script.ps1 +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/telemetry.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/ui/__init__.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/ui/__main__.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/ui/gradio/__init__.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/ui/gradio/app.py +0 -0
- {cua_computer-0.2.13 → cua_computer-0.3.0}/computer/utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: cua-computer
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.3.0
|
4
4
|
Summary: Computer-Use Interface (CUI) framework powering Cua
|
5
5
|
Author-Email: TryCua <gh@trycua.com>
|
6
6
|
Requires-Python: >=3.11
|
@@ -13,13 +13,13 @@ Requires-Dist: pydantic>=2.11.1
|
|
13
13
|
Provides-Extra: lume
|
14
14
|
Provides-Extra: lumier
|
15
15
|
Provides-Extra: ui
|
16
|
-
Requires-Dist: gradio
|
17
|
-
Requires-Dist: python-dotenv
|
18
|
-
Requires-Dist: datasets
|
16
|
+
Requires-Dist: gradio>=5.23.3; extra == "ui"
|
17
|
+
Requires-Dist: python-dotenv>=1.0.1; extra == "ui"
|
18
|
+
Requires-Dist: datasets>=3.6.0; extra == "ui"
|
19
19
|
Provides-Extra: all
|
20
|
-
Requires-Dist: gradio
|
21
|
-
Requires-Dist: python-dotenv
|
22
|
-
Requires-Dist: datasets
|
20
|
+
Requires-Dist: gradio>=5.23.3; extra == "all"
|
21
|
+
Requires-Dist: python-dotenv>=1.0.1; extra == "all"
|
22
|
+
Requires-Dist: datasets>=3.6.0; extra == "all"
|
23
23
|
Description-Content-Type: text/markdown
|
24
24
|
|
25
25
|
<div align="center">
|
@@ -3,8 +3,7 @@
|
|
3
3
|
from abc import ABC, abstractmethod
|
4
4
|
from typing import Optional, Dict, Any, Tuple, List
|
5
5
|
from ..logger import Logger, LogLevel
|
6
|
-
from .models import MouseButton
|
7
|
-
|
6
|
+
from .models import MouseButton, CommandResult
|
8
7
|
|
9
8
|
class BaseComputerInterface(ABC):
|
10
9
|
"""Base class for computer control interfaces."""
|
@@ -234,8 +233,31 @@ class BaseComputerInterface(ABC):
|
|
234
233
|
pass
|
235
234
|
|
236
235
|
@abstractmethod
|
237
|
-
async def run_command(self, command: str) ->
|
238
|
-
"""Run shell command.
|
236
|
+
async def run_command(self, command: str) -> CommandResult:
|
237
|
+
"""Run shell command and return structured result.
|
238
|
+
|
239
|
+
Executes a shell command using subprocess.run with shell=True and check=False.
|
240
|
+
The command is run in the target environment and captures both stdout and stderr.
|
241
|
+
|
242
|
+
Args:
|
243
|
+
command (str): The shell command to execute
|
244
|
+
|
245
|
+
Returns:
|
246
|
+
CommandResult: A structured result containing:
|
247
|
+
- stdout (str): Standard output from the command
|
248
|
+
- stderr (str): Standard error from the command
|
249
|
+
- returncode (int): Exit code from the command (0 indicates success)
|
250
|
+
|
251
|
+
Raises:
|
252
|
+
RuntimeError: If the command execution fails at the system level
|
253
|
+
|
254
|
+
Example:
|
255
|
+
result = await interface.run_command("ls -la")
|
256
|
+
if result.returncode == 0:
|
257
|
+
print(f"Output: {result.stdout}")
|
258
|
+
else:
|
259
|
+
print(f"Error: {result.stderr}, Exit code: {result.returncode}")
|
260
|
+
"""
|
239
261
|
pass
|
240
262
|
|
241
263
|
# Accessibility Actions
|
@@ -9,8 +9,7 @@ import websockets
|
|
9
9
|
from ..logger import Logger, LogLevel
|
10
10
|
from .base import BaseComputerInterface
|
11
11
|
from ..utils import decode_base64_image, encode_base64_image, bytes_to_image, draw_box, resize_image
|
12
|
-
from .models import Key, KeyType, MouseButton
|
13
|
-
|
12
|
+
from .models import Key, KeyType, MouseButton, CommandResult
|
14
13
|
|
15
14
|
class LinuxComputerInterface(BaseComputerInterface):
|
16
15
|
"""Interface for Linux."""
|
@@ -616,11 +615,15 @@ class LinuxComputerInterface(BaseComputerInterface):
|
|
616
615
|
if not result.get("success", False):
|
617
616
|
raise RuntimeError(result.get("error", "Failed to delete directory"))
|
618
617
|
|
619
|
-
async def run_command(self, command: str) ->
|
618
|
+
async def run_command(self, command: str) -> CommandResult:
|
620
619
|
result = await self._send_command("run_command", {"command": command})
|
621
620
|
if not result.get("success", False):
|
622
621
|
raise RuntimeError(result.get("error", "Failed to run command"))
|
623
|
-
return
|
622
|
+
return CommandResult(
|
623
|
+
stdout=result.get("stdout", ""),
|
624
|
+
stderr=result.get("stderr", ""),
|
625
|
+
returncode=result.get("return_code", 0)
|
626
|
+
)
|
624
627
|
|
625
628
|
# Accessibility Actions
|
626
629
|
async def get_accessibility_tree(self) -> Dict[str, Any]:
|
@@ -9,8 +9,7 @@ import websockets
|
|
9
9
|
from ..logger import Logger, LogLevel
|
10
10
|
from .base import BaseComputerInterface
|
11
11
|
from ..utils import decode_base64_image, encode_base64_image, bytes_to_image, draw_box, resize_image
|
12
|
-
from .models import Key, KeyType, MouseButton
|
13
|
-
|
12
|
+
from .models import Key, KeyType, MouseButton, CommandResult
|
14
13
|
|
15
14
|
class MacOSComputerInterface(BaseComputerInterface):
|
16
15
|
"""Interface for macOS."""
|
@@ -623,11 +622,15 @@ class MacOSComputerInterface(BaseComputerInterface):
|
|
623
622
|
if not result.get("success", False):
|
624
623
|
raise RuntimeError(result.get("error", "Failed to delete directory"))
|
625
624
|
|
626
|
-
async def run_command(self, command: str) ->
|
625
|
+
async def run_command(self, command: str) -> CommandResult:
|
627
626
|
result = await self._send_command("run_command", {"command": command})
|
628
627
|
if not result.get("success", False):
|
629
628
|
raise RuntimeError(result.get("error", "Failed to run command"))
|
630
|
-
return
|
629
|
+
return CommandResult(
|
630
|
+
stdout=result.get("stdout", ""),
|
631
|
+
stderr=result.get("stderr", ""),
|
632
|
+
returncode=result.get("return_code", 0)
|
633
|
+
)
|
631
634
|
|
632
635
|
# Accessibility Actions
|
633
636
|
async def get_accessibility_tree(self) -> Dict[str, Any]:
|
@@ -1,5 +1,17 @@
|
|
1
1
|
from enum import Enum
|
2
2
|
from typing import Dict, List, Any, TypedDict, Union, Literal
|
3
|
+
from dataclasses import dataclass
|
4
|
+
|
5
|
+
@dataclass
|
6
|
+
class CommandResult:
|
7
|
+
stdout: str
|
8
|
+
stderr: str
|
9
|
+
returncode: int
|
10
|
+
|
11
|
+
def __init__(self, stdout: str, stderr: str, returncode: int):
|
12
|
+
self.stdout = stdout
|
13
|
+
self.stderr = stderr
|
14
|
+
self.returncode = returncode
|
3
15
|
|
4
16
|
# Navigation key literals
|
5
17
|
NavigationKey = Literal['pagedown', 'pageup', 'home', 'end', 'left', 'right', 'up', 'down']
|
@@ -9,8 +9,7 @@ import websockets
|
|
9
9
|
from ..logger import Logger, LogLevel
|
10
10
|
from .base import BaseComputerInterface
|
11
11
|
from ..utils import decode_base64_image, encode_base64_image, bytes_to_image, draw_box, resize_image
|
12
|
-
from .models import Key, KeyType, MouseButton
|
13
|
-
|
12
|
+
from .models import Key, KeyType, MouseButton, CommandResult
|
14
13
|
|
15
14
|
class WindowsComputerInterface(BaseComputerInterface):
|
16
15
|
"""Interface for Windows."""
|
@@ -615,11 +614,15 @@ class WindowsComputerInterface(BaseComputerInterface):
|
|
615
614
|
if not result.get("success", False):
|
616
615
|
raise RuntimeError(result.get("error", "Failed to delete directory"))
|
617
616
|
|
618
|
-
async def run_command(self, command: str) ->
|
617
|
+
async def run_command(self, command: str) -> CommandResult:
|
619
618
|
result = await self._send_command("run_command", {"command": command})
|
620
619
|
if not result.get("success", False):
|
621
620
|
raise RuntimeError(result.get("error", "Failed to run command"))
|
622
|
-
return
|
621
|
+
return CommandResult(
|
622
|
+
stdout=result.get("stdout", ""),
|
623
|
+
stderr=result.get("stderr", ""),
|
624
|
+
returncode=result.get("return_code", 0)
|
625
|
+
)
|
623
626
|
|
624
627
|
# Accessibility Actions
|
625
628
|
async def get_accessibility_tree(self) -> Dict[str, Any]:
|
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
|
|
6
6
|
|
7
7
|
[project]
|
8
8
|
name = "cua-computer"
|
9
|
-
version = "0.
|
9
|
+
version = "0.3.0"
|
10
10
|
description = "Computer-Use Interface (CUI) framework powering Cua"
|
11
11
|
readme = "README.md"
|
12
12
|
authors = [
|
@@ -26,14 +26,14 @@ requires-python = ">=3.11"
|
|
26
26
|
lume = []
|
27
27
|
lumier = []
|
28
28
|
ui = [
|
29
|
-
"gradio>=5.23.3
|
30
|
-
"python-dotenv>=1.0.1
|
31
|
-
"datasets>=3.6.0
|
29
|
+
"gradio>=5.23.3",
|
30
|
+
"python-dotenv>=1.0.1",
|
31
|
+
"datasets>=3.6.0",
|
32
32
|
]
|
33
33
|
all = [
|
34
|
-
"gradio>=5.23.3
|
35
|
-
"python-dotenv>=1.0.1
|
36
|
-
"datasets>=3.6.0
|
34
|
+
"gradio>=5.23.3",
|
35
|
+
"python-dotenv>=1.0.1",
|
36
|
+
"datasets>=3.6.0",
|
37
37
|
]
|
38
38
|
|
39
39
|
[tool.pdm]
|
@@ -57,7 +57,7 @@ target-version = [
|
|
57
57
|
|
58
58
|
[tool.ruff]
|
59
59
|
line-length = 100
|
60
|
-
target-version = "0.
|
60
|
+
target-version = "0.3.0"
|
61
61
|
select = [
|
62
62
|
"E",
|
63
63
|
"F",
|
@@ -71,7 +71,7 @@ docstring-code-format = true
|
|
71
71
|
|
72
72
|
[tool.mypy]
|
73
73
|
strict = true
|
74
|
-
python_version = "0.
|
74
|
+
python_version = "0.3.0"
|
75
75
|
ignore_missing_imports = true
|
76
76
|
disallow_untyped_defs = true
|
77
77
|
check_untyped_defs = true
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|