Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

Bump version for breaking change

Dillon DuPont9774bcd3a7a8
diff --git a/libs/agent/agent/providers/anthropic/tools/bash.py b/libs/agent/agent/providers/anthropic/tools/bash.py
index babbacfd1d..479e112757 100644
--- a/libs/agent/agent/providers/anthropic/tools/bash.py
+++ b/libs/agent/agent/providers/anthropic/tools/bash.py
@@ -50,8 +50,8 @@ class BashTool(BaseBashTool, BaseAnthropicTool):
try:
async with asyncio.timeout(self._timeout):
- stdout, stderr = await self.computer.interface.run_command(command)
- return CLIResult(output=stdout or "", error=stderr or "")
+ result = await self.computer.interface.run_command(command)
+ return CLIResult(output=result.stdout or "", error=result.stderr or "")
except asyncio.TimeoutError as e:
raise ToolError(f"Command timed out after {self._timeout} seconds") from e
except Exception as e:
diff --git a/libs/agent/agent/providers/anthropic/tools/edit.py b/libs/agent/agent/providers/anthropic/tools/edit.py
index e4da1f85ff..1114b586bc 100644
--- a/libs/agent/agent/providers/anthropic/tools/edit.py
+++ b/libs/agent/agent/providers/anthropic/tools/edit.py
@@ -95,13 +95,13 @@ class EditTool(BaseEditTool, BaseAnthropicTool):
result = await self.computer.interface.run_command(
f'[ -e "{str(path)}" ] && echo "exists" || echo "not exists"'
)
- exists = result[0].strip() == "exists"
+ exists = result.stdout.strip() == "exists"
if exists:
result = await self.computer.interface.run_command(
f'[ -d "{str(path)}" ] && echo "dir" || echo "file"'
)
- is_dir = result[0].strip() == "dir"
+ is_dir = result.stdout.strip() == "dir"
else:
is_dir = False
@@ -126,7 +126,7 @@ class EditTool(BaseEditTool, BaseAnthropicTool):
result = await self.computer.interface.run_command(
f'[ -d "{str(path)}" ] && echo "dir" || echo "file"'
)
- is_dir = result[0].strip() == "dir"
+ is_dir = result.stdout.strip() == "dir"
if is_dir:
if view_range:
@@ -136,7 +136,7 @@ class EditTool(BaseEditTool, BaseAnthropicTool):
# List directory contents using ls
result = await self.computer.interface.run_command(f'ls -la "{str(path)}"')
- contents = result[0]
+ contents = result.stdout
if contents:
stdout = f"Here's the files and directories in {path}:\n{contents}\n"
else:
@@ -272,9 +272,9 @@ class EditTool(BaseEditTool, BaseAnthropicTool):
"""Read the content of a file using cat command."""
try:
result = await self.computer.interface.run_command(f'cat "{str(path)}"')
- if result[1]: # If there's stderr output
- raise ToolError(f"Error reading file: {result[1]}")
- return result[0]
+ if result.stderr: # If there's stderr output
+ raise ToolError(f"Error reading file: {result.stderr}")
+ return result.stdout
except Exception as e:
raise ToolError(f"Failed to read {path}: {str(e)}")
@@ -291,8 +291,8 @@ class EditTool(BaseEditTool, BaseAnthropicTool):
{content}
EOFCUA"""
result = await self.computer.interface.run_command(cmd)
- if result[1]: # If there's stderr output
- raise ToolError(f"Error writing file: {result[1]}")
+ if result.stderr: # If there's stderr output
+ raise ToolError(f"Error writing file: {result.stderr}")
except Exception as e:
raise ToolError(f"Failed to write to {path}: {str(e)}")
diff --git a/libs/agent/pyproject.toml b/libs/agent/pyproject.toml
index f078a5c98a..279a5b9fa0 100644
--- a/libs/agent/pyproject.toml
+++ b/libs/agent/pyproject.toml
@@ -19,7 +19,7 @@ dependencies = [
"pydantic>=2.6.4,<3.0.0",
"rich>=13.7.1,<14.0.0",
"python-dotenv>=1.0.1,<2.0.0",
- "cua-computer>=0.2.0,<0.3.0",
+ "cua-computer>=0.3.0,<0.4.0",
"cua-core>=0.1.0,<0.2.0",
"certifi>=2024.2.2"
]
diff --git a/libs/computer/pyproject.toml b/libs/computer/pyproject.toml
index 04bd2dfb96..de0ed190f3 100644
--- a/libs/computer/pyproject.toml
+++ b/libs/computer/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "pdm.backend"
[project]
name = "cua-computer"
-version = "0.2.0"
+version = "0.3.0"
description = "Computer-Use Interface (CUI) framework powering Cua"
readme = "README.md"
authors = [