diff --git a/app/agent/swe.py b/app/agent/swe.py index 8db61ca..0ac1b36 100644 --- a/app/agent/swe.py +++ b/app/agent/swe.py @@ -29,7 +29,8 @@ class SWEAgent(ToolCallAgent): async def think(self) -> bool: """Process current state and decide next action""" # Update working directory - self.working_dir = await self.bash.execute("pwd") + result = await self.bash.execute("pwd") + self.working_dir = result.output self.next_step_prompt = self.next_step_prompt.format( current_dir=self.working_dir ) diff --git a/app/tool/bash.py b/app/tool/bash.py index 0e5c2ff..c6b9072 100644 --- a/app/tool/bash.py +++ b/app/tool/bash.py @@ -3,7 +3,7 @@ import os from typing import Optional from app.exceptions import ToolError -from app.tool.base import BaseTool, CLIResult, ToolResult +from app.tool.base import BaseTool, CLIResult _BASH_DESCRIPTION = """Execute a bash command in the terminal. @@ -57,7 +57,7 @@ class _BashSession: if not self._started: raise ToolError("Session has not started.") if self._process.returncode is not None: - return ToolResult( + return CLIResult( system="tool must be restarted", error=f"bash has exited with returncode {self._process.returncode}", ) @@ -140,7 +140,7 @@ class Bash(BaseTool): self._session = _BashSession() await self._session.start() - return ToolResult(system="tool has been restarted.") + return CLIResult(system="tool has been restarted.") if self._session is None: self._session = _BashSession()