orgo 0.0.18__tar.gz → 0.0.20__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.
- {orgo-0.0.18 → orgo-0.0.20}/PKG-INFO +1 -1
- {orgo-0.0.18 → orgo-0.0.20}/pyproject.toml +1 -1
- {orgo-0.0.18 → orgo-0.0.20}/src/orgo/api/client.py +24 -4
- {orgo-0.0.18 → orgo-0.0.20}/src/orgo/computer.py +4 -1
- {orgo-0.0.18 → orgo-0.0.20}/src/orgo/project.py +14 -1
- {orgo-0.0.18 → orgo-0.0.20}/src/orgo.egg-info/PKG-INFO +1 -1
- {orgo-0.0.18 → orgo-0.0.20}/README.md +0 -0
- {orgo-0.0.18 → orgo-0.0.20}/setup.cfg +0 -0
- {orgo-0.0.18 → orgo-0.0.20}/src/orgo/__init__.py +0 -0
- {orgo-0.0.18 → orgo-0.0.20}/src/orgo/api/__init__.py +0 -0
- {orgo-0.0.18 → orgo-0.0.20}/src/orgo/prompt.py +0 -0
- {orgo-0.0.18 → orgo-0.0.20}/src/orgo/utils/__init__.py +0 -0
- {orgo-0.0.18 → orgo-0.0.20}/src/orgo/utils/auth.py +0 -0
- {orgo-0.0.18 → orgo-0.0.20}/src/orgo.egg-info/SOURCES.txt +0 -0
- {orgo-0.0.18 → orgo-0.0.20}/src/orgo.egg-info/dependency_links.txt +0 -0
- {orgo-0.0.18 → orgo-0.0.20}/src/orgo.egg-info/requires.txt +0 -0
- {orgo-0.0.18 → orgo-0.0.20}/src/orgo.egg-info/top_level.txt +0 -0
|
@@ -51,16 +51,36 @@ class ApiClient:
|
|
|
51
51
|
def get_status(self, project_id: str) -> Dict[str, Any]:
|
|
52
52
|
return self._request("GET", f"projects/by-name/{project_id}")
|
|
53
53
|
|
|
54
|
-
def start_computer(self,
|
|
54
|
+
def start_computer(self, project_name: str) -> Dict[str, Any]:
|
|
55
|
+
# Get the actual project ID from the name
|
|
56
|
+
project = self.get_status(project_name)
|
|
57
|
+
project_id = project.get("id")
|
|
58
|
+
if not project_id:
|
|
59
|
+
raise ValueError(f"Could not find ID for project {project_name}")
|
|
55
60
|
return self._request("POST", f"projects/{project_id}/start")
|
|
56
61
|
|
|
57
|
-
def stop_computer(self,
|
|
62
|
+
def stop_computer(self, project_name: str) -> Dict[str, Any]:
|
|
63
|
+
# Get the actual project ID from the name
|
|
64
|
+
project = self.get_status(project_name)
|
|
65
|
+
project_id = project.get("id")
|
|
66
|
+
if not project_id:
|
|
67
|
+
raise ValueError(f"Could not find ID for project {project_name}")
|
|
58
68
|
return self._request("POST", f"projects/{project_id}/stop")
|
|
59
69
|
|
|
60
|
-
def restart_computer(self,
|
|
70
|
+
def restart_computer(self, project_name: str) -> Dict[str, Any]:
|
|
71
|
+
# Get the actual project ID from the name
|
|
72
|
+
project = self.get_status(project_name)
|
|
73
|
+
project_id = project.get("id")
|
|
74
|
+
if not project_id:
|
|
75
|
+
raise ValueError(f"Could not find ID for project {project_name}")
|
|
61
76
|
return self._request("POST", f"projects/{project_id}/restart")
|
|
62
77
|
|
|
63
|
-
def delete_computer(self,
|
|
78
|
+
def delete_computer(self, project_name: str) -> Dict[str, Any]:
|
|
79
|
+
# Get the actual project ID from the name
|
|
80
|
+
project = self.get_status(project_name)
|
|
81
|
+
project_id = project.get("id")
|
|
82
|
+
if not project_id:
|
|
83
|
+
raise ValueError(f"Could not find ID for project {project_name}")
|
|
64
84
|
return self._request("POST", f"projects/{project_id}/delete")
|
|
65
85
|
|
|
66
86
|
# Computer control methods
|
|
@@ -74,7 +74,10 @@ class Computer:
|
|
|
74
74
|
|
|
75
75
|
def destroy(self) -> Dict[str, Any]:
|
|
76
76
|
"""Terminate and delete the computer instance"""
|
|
77
|
-
|
|
77
|
+
result = self.api.delete_computer(self.project_id)
|
|
78
|
+
# Clear the local project cache after destroying
|
|
79
|
+
ProjectManager.clear_project_cache()
|
|
80
|
+
return result
|
|
78
81
|
|
|
79
82
|
# Navigation methods
|
|
80
83
|
def left_click(self, x: int, y: int) -> Dict[str, Any]:
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"""Project management for Orgo virtual environments"""
|
|
3
3
|
import os
|
|
4
4
|
import json
|
|
5
|
+
import shutil
|
|
5
6
|
import logging
|
|
6
7
|
from typing import Optional
|
|
7
8
|
|
|
@@ -40,6 +41,18 @@ class ProjectManager:
|
|
|
40
41
|
logger.error(f"Failed to save project ID: {str(e)}")
|
|
41
42
|
raise RuntimeError(f"Failed to save project configuration: {str(e)}") from e
|
|
42
43
|
|
|
44
|
+
@staticmethod
|
|
45
|
+
def clear_project_cache() -> None:
|
|
46
|
+
"""Clear the .orgo folder and all its contents"""
|
|
47
|
+
project_dir = ProjectManager._get_project_dir()
|
|
48
|
+
|
|
49
|
+
if os.path.exists(project_dir):
|
|
50
|
+
try:
|
|
51
|
+
shutil.rmtree(project_dir)
|
|
52
|
+
logger.info(f"Cleared project cache at {project_dir}")
|
|
53
|
+
except (IOError, OSError) as e:
|
|
54
|
+
logger.warning(f"Failed to clear project cache: {str(e)}")
|
|
55
|
+
|
|
43
56
|
@staticmethod
|
|
44
57
|
def _get_project_dir() -> str:
|
|
45
58
|
"""Get the project directory path"""
|
|
@@ -48,4 +61,4 @@ class ProjectManager:
|
|
|
48
61
|
@staticmethod
|
|
49
62
|
def _get_config_path() -> str:
|
|
50
63
|
"""Get the full path to the config file"""
|
|
51
|
-
return os.path.join(ProjectManager._get_project_dir(), "project.json")
|
|
64
|
+
return os.path.join(ProjectManager._get_project_dir(), "project.json")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|