orgo 0.0.14__tar.gz → 0.0.16__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orgo
3
- Version: 0.0.14
3
+ Version: 0.0.16
4
4
  Summary: Computers for AI agents
5
5
  Author: Orgo Team
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "orgo"
7
- version = "0.0.14"
7
+ version = "0.0.16"
8
8
  description = "Computers for AI agents"
9
9
  authors = [{name = "Orgo Team"}]
10
10
  license = {text = "MIT"}
@@ -4,8 +4,9 @@ import os
4
4
  import io
5
5
  import base64
6
6
  import logging
7
- from typing import Dict, List, Any, Optional, Callable, Union
7
+ from typing import Dict, List, Any, Optional, Callable
8
8
  from PIL import Image
9
+ import requests
9
10
  from requests.exceptions import RequestException
10
11
 
11
12
  from .api.client import ApiClient
@@ -97,13 +98,33 @@ class Computer:
97
98
  def screenshot(self) -> Image.Image:
98
99
  """Capture screenshot and return as PIL Image"""
99
100
  response = self.api.get_screenshot(self.project_id)
100
- img_data = base64.b64decode(response.get("image", ""))
101
- return Image.open(io.BytesIO(img_data))
101
+ image_data = response.get("image", "")
102
+
103
+ # Check if it's a URL (new format) or base64 (legacy format)
104
+ if image_data.startswith(('http://', 'https://')):
105
+ # Download image from URL
106
+ img_response = requests.get(image_data)
107
+ img_response.raise_for_status()
108
+ return Image.open(io.BytesIO(img_response.content))
109
+ else:
110
+ # Legacy base64 format
111
+ img_data = base64.b64decode(image_data)
112
+ return Image.open(io.BytesIO(img_data))
102
113
 
103
114
  def screenshot_base64(self) -> str:
104
115
  """Capture screenshot and return as base64 string"""
105
116
  response = self.api.get_screenshot(self.project_id)
106
- return response.get("image", "")
117
+ image_data = response.get("image", "")
118
+
119
+ # Check if it's a URL (new format) or base64 (legacy format)
120
+ if image_data.startswith(('http://', 'https://')):
121
+ # Download image from URL and convert to base64
122
+ img_response = requests.get(image_data)
123
+ img_response.raise_for_status()
124
+ return base64.b64encode(img_response.content).decode('utf-8')
125
+ else:
126
+ # Already base64
127
+ return image_data
107
128
 
108
129
  # Execution methods
109
130
  def bash(self, command: str) -> str:
@@ -323,12 +323,28 @@ class AnthropicProvider:
323
323
  response = api_client.get_screenshot(computer_id)
324
324
  if callback:
325
325
  callback("tool_result", {"type": "image", "action": "screenshot"})
326
+
327
+ # The API now returns a URL instead of base64 data
328
+ # We need to fetch the image from the URL and convert it to base64
329
+ image_url = response.get("image", "")
330
+
331
+ if not image_url:
332
+ raise ValueError("No image URL received from API")
333
+
334
+ # Fetch the image from the URL
335
+ import requests
336
+ img_response = requests.get(image_url)
337
+ img_response.raise_for_status()
338
+
339
+ # Convert to base64
340
+ image_base64 = base64.b64encode(img_response.content).decode('utf-8')
341
+
326
342
  return {
327
343
  "type": "image",
328
344
  "source": {
329
345
  "type": "base64",
330
346
  "media_type": "image/jpeg",
331
- "data": response.get("image", "")
347
+ "data": image_base64
332
348
  }
333
349
  }
334
350
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orgo
3
- Version: 0.0.14
3
+ Version: 0.0.16
4
4
  Summary: Computers for AI agents
5
5
  Author: Orgo Team
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes