diff --git a/src/strands_tools/browser/browser.py b/src/strands_tools/browser/browser.py index 03d44808..b1f97adf 100644 --- a/src/strands_tools/browser/browser.py +++ b/src/strands_tools/browser/browser.py @@ -147,6 +147,8 @@ def browser(self, browser_input: BrowserInput) -> Dict[str, Any]: return self.click(action) elif isinstance(action, TypeAction): return self.type(action) + elif isinstance(action, PressKeyAction): + return self.press_key(action) elif isinstance(action, GetTextAction): return self.get_text(action) elif isinstance(action, GetHtmlAction): diff --git a/src/strands_tools/editor.py b/src/strands_tools/editor.py index a70f86da..1f131241 100644 --- a/src/strands_tools/editor.py +++ b/src/strands_tools/editor.py @@ -314,7 +314,7 @@ def editor( console = console_util.create() try: - path = os.path.expanduser(path) + path = os.path.abspath(os.path.expanduser(path)) if not command: raise ValueError("Command is required") @@ -805,3 +805,4 @@ def editor( "status": "error", "content": [{"text": f"Error: {str(e)}"}], } + diff --git a/src/strands_tools/generate_image.py b/src/strands_tools/generate_image.py index c9f50385..1bc926d4 100644 --- a/src/strands_tools/generate_image.py +++ b/src/strands_tools/generate_image.py @@ -241,10 +241,11 @@ def generate_image(tool: ToolUse, **kwargs: Any) -> ToolResult: os.makedirs(output_dir) i = 1 - base_image_path = os.path.join(output_dir, f"{filename}.png") + ext = "jpg" if output_format == "jpeg" else output_format + base_image_path = os.path.join(output_dir, f"{filename}.{ext}") image_path = base_image_path while os.path.exists(image_path): - image_path = os.path.join(output_dir, f"{filename}_{i}.png") + image_path = os.path.join(output_dir, f"{filename}_{i}.{ext}") i += 1 with open(image_path, "wb") as file: