From 9774bcd3a7a812d583ee996beda37f9128795096 Mon Sep 17 00:00:00 2001 From: Dillon DuPont Date: Wed, 25 Jun 2025 12:12:30 -0400 Subject: [PATCH] Bump version for breaking change --- .../agent/providers/anthropic/tools/bash.py | 4 ++-- .../agent/providers/anthropic/tools/edit.py | 18 +++++++++--------- libs/agent/pyproject.toml | 2 +- libs/computer/pyproject.toml | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libs/agent/agent/providers/anthropic/tools/bash.py b/libs/agent/agent/providers/anthropic/tools/bash.py index babbacfd..479e1127 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 e4da1f85..1114b586 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 f078a5c9..279a5b9f 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 04bd2dfb..de0ed190 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 = [