orgo 0.0.26__tar.gz → 0.0.28__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.26
3
+ Version: 0.0.28
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.26"
7
+ version = "0.0.28"
8
8
  description = "Computers for AI agents"
9
9
  authors = [{name = "Orgo Team"}]
10
10
  license = {text = "MIT"}
@@ -2,9 +2,12 @@
2
2
 
3
3
  import requests
4
4
  from typing import Dict, Any, Optional, List
5
+ import logging
5
6
 
6
7
  from orgo.utils.auth import get_api_key
7
8
 
9
+ logger = logging.getLogger(__name__)
10
+
8
11
  class ApiClient:
9
12
  def __init__(self, api_key: Optional[str] = None, base_url: Optional[str] = None):
10
13
  self.api_key = get_api_key(api_key)
@@ -28,16 +31,20 @@ class ApiClient:
28
31
  response.raise_for_status()
29
32
  return response.json()
30
33
  except requests.exceptions.RequestException as e:
34
+ # Log the full error for debugging
35
+ logger.debug(f"API request failed: {method} {url}", exc_info=True)
36
+
31
37
  if hasattr(e, 'response') and e.response is not None:
32
- error_message = f"API error: {e.response.status_code}"
33
38
  try:
34
39
  error_data = e.response.json()
35
40
  if 'error' in error_data:
36
- error_message += f" - {error_data['error']}"
41
+ raise Exception(error_data['error']) from None
37
42
  except ValueError:
38
43
  pass
39
- raise Exception(error_message) from e
40
- raise Exception(f"Connection error: {str(e)}") from e
44
+ raise Exception(f"Request failed with status {e.response.status_code}") from None
45
+
46
+ # Generic error message without exposing internal details
47
+ raise Exception("Failed to connect to Orgo service. Please check your connection and try again.") from None
41
48
 
42
49
  # Project methods
43
50
  def create_project(self, name: str) -> Dict[str, Any]:
@@ -57,28 +64,17 @@ class ApiClient:
57
64
  response = self._request("GET", "projects")
58
65
  return response.get("projects", [])
59
66
 
60
- def start_project(self, project_id: str) -> Dict[str, Any]:
61
- """Start a project"""
62
- return self._request("POST", f"projects/{project_id}/start")
63
-
64
- def stop_project(self, project_id: str) -> Dict[str, Any]:
65
- """Stop a project"""
66
- return self._request("POST", f"projects/{project_id}/stop")
67
-
68
- def restart_project(self, project_id: str) -> Dict[str, Any]:
69
- """Restart a project"""
70
- return self._request("POST", f"projects/{project_id}/restart")
71
-
72
67
  def delete_project(self, project_id: str) -> Dict[str, Any]:
73
68
  """Delete a project and all its computers"""
74
- return self._request("POST", f"projects/{project_id}/delete")
69
+ return self._request("DELETE", f"projects/{project_id}")
75
70
 
76
71
  # Computer methods
77
- def create_computer(self, project_name: str, computer_name: str,
72
+ def create_computer(self, project_id: str, computer_name: str,
78
73
  os: str = "linux", ram: int = 2, cpu: int = 2,
79
74
  gpu: str = "none") -> Dict[str, Any]:
80
75
  """Create a new computer within a project"""
81
- return self._request("POST", f"projects/{project_name}/computers", {
76
+ return self._request("POST", "computers", {
77
+ "project_id": project_id,
82
78
  "name": computer_name,
83
79
  "os": os,
84
80
  "ram": ram,
@@ -86,10 +82,10 @@ class ApiClient:
86
82
  "gpu": gpu
87
83
  })
88
84
 
89
- def list_computers(self, project_name: str) -> List[Dict[str, Any]]:
85
+ def list_computers(self, project_id: str) -> List[Dict[str, Any]]:
90
86
  """List all computers in a project"""
91
- response = self._request("GET", f"projects/{project_name}/computers")
92
- return response.get("computers", [])
87
+ project = self.get_project(project_id)
88
+ return project.get("desktops", [])
93
89
 
94
90
  def get_computer(self, computer_id: str) -> Dict[str, Any]:
95
91
  """Get computer details"""
@@ -99,14 +95,6 @@ class ApiClient:
99
95
  """Delete a computer"""
100
96
  return self._request("DELETE", f"computers/{computer_id}")
101
97
 
102
- def start_computer(self, computer_id: str) -> Dict[str, Any]:
103
- """Start a computer"""
104
- return self._request("POST", f"computers/{computer_id}/start")
105
-
106
- def stop_computer(self, computer_id: str) -> Dict[str, Any]:
107
- """Stop a computer"""
108
- return self._request("POST", f"computers/{computer_id}/stop")
109
-
110
98
  def restart_computer(self, computer_id: str) -> Dict[str, Any]:
111
99
  """Restart a computer"""
112
100
  return self._request("POST", f"computers/{computer_id}/restart")
@@ -1,6 +1,5 @@
1
1
  """Computer class for interacting with Orgo virtual environments"""
2
- import os
3
- import io
2
+ import os as operating_system
4
3
  import base64
5
4
  import logging
6
5
  import uuid
@@ -50,7 +49,7 @@ class Computer:
50
49
  # Connect to existing computer in project
51
50
  computer = Computer(project="manus")
52
51
  """
53
- self.api_key = api_key or os.environ.get("ORGO_API_KEY")
52
+ self.api_key = api_key or operating_system.environ.get("ORGO_API_KEY")
54
53
  self.base_api_url = base_api_url
55
54
  self.api = ApiClient(self.api_key, self.base_api_url)
56
55
 
@@ -1,5 +1,5 @@
1
1
  """Project class for managing Orgo projects"""
2
- import os
2
+ import os as operating_system # Renamed to avoid any potential conflicts
3
3
  import uuid
4
4
  from typing import Dict, List, Any, Optional
5
5
 
@@ -18,7 +18,7 @@ class Project:
18
18
  api_key: Orgo API key (defaults to ORGO_API_KEY env var)
19
19
  base_api_url: Custom API URL (optional)
20
20
  """
21
- self.api_key = api_key or os.environ.get("ORGO_API_KEY")
21
+ self.api_key = api_key or operating_system.environ.get("ORGO_API_KEY")
22
22
  self.base_api_url = base_api_url
23
23
  self.api = ApiClient(self.api_key, self.base_api_url)
24
24
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orgo
3
- Version: 0.0.26
3
+ Version: 0.0.28
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