orgo 0.0.27__py3-none-any.whl → 0.0.28__py3-none-any.whl

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.
orgo/api/client.py CHANGED
@@ -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,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orgo
3
- Version: 0.0.27
3
+ Version: 0.0.28
4
4
  Summary: Computers for AI agents
5
5
  Author: Orgo Team
6
6
  License: MIT
@@ -3,10 +3,10 @@ orgo/computer.py,sha256=B3B0NQwpSHzadjbssxHzoXe3-A3A3cuUD1fXW18k_bU,14487
3
3
  orgo/project.py,sha256=uVDFa8iyn5OaHzTzjGQhxnF_nVzwkqkqUShiV3M0AWU,3150
4
4
  orgo/prompt.py,sha256=ynblwXPTDp_aF1MbGBsY0PIEr9naklDaKFcfSE_EZ6E,19781
5
5
  orgo/api/__init__.py,sha256=9Tzb_OPJ5DH7Cg7OrHzpZZUT4ip05alpa9RLDYmnId8,113
6
- orgo/api/client.py,sha256=JofBHTnks4nO60786vAmzJmECVFFf-Yff1qF0ir-YQ8,7958
6
+ orgo/api/client.py,sha256=BgRJQaQxng4EUD72bcQGF6Iwkw79fvvx1tTR1koLGx0,7383
7
7
  orgo/utils/__init__.py,sha256=W4G_nwGBf_7jy0w_mfcrkllurYHSRU4B5cMTVYH_uCc,123
8
8
  orgo/utils/auth.py,sha256=tPLBJY-6gdBQWLUjUbwIwxHphC3KoRT_XgP3Iykw3Mw,509
9
- orgo-0.0.27.dist-info/METADATA,sha256=Ty1vixQaj3ccyXNkTKFZEaZAEVYr-5O4zMGvKiQQZxo,822
10
- orgo-0.0.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- orgo-0.0.27.dist-info/top_level.txt,sha256=q0rYtFji8GbYuhFW8A5Ab9e0j27761IKPhnL0E9xow4,5
12
- orgo-0.0.27.dist-info/RECORD,,
9
+ orgo-0.0.28.dist-info/METADATA,sha256=ixsfJKWG9dL3AxbYN0aAsS_4J8D-5zcIpfhIfJZb9C4,822
10
+ orgo-0.0.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ orgo-0.0.28.dist-info/top_level.txt,sha256=q0rYtFji8GbYuhFW8A5Ab9e0j27761IKPhnL0E9xow4,5
12
+ orgo-0.0.28.dist-info/RECORD,,
File without changes