orgo 0.0.24__tar.gz → 0.0.25__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.24 → orgo-0.0.25}/PKG-INFO +1 -1
- {orgo-0.0.24 → orgo-0.0.25}/pyproject.toml +1 -1
- {orgo-0.0.24 → orgo-0.0.25}/src/orgo/computer.py +9 -22
- {orgo-0.0.24 → orgo-0.0.25}/src/orgo.egg-info/PKG-INFO +1 -1
- {orgo-0.0.24 → orgo-0.0.25}/src/orgo.egg-info/SOURCES.txt +0 -1
- orgo-0.0.24/src/orgo/project.py +0 -64
- {orgo-0.0.24 → orgo-0.0.25}/README.md +0 -0
- {orgo-0.0.24 → orgo-0.0.25}/setup.cfg +0 -0
- {orgo-0.0.24 → orgo-0.0.25}/src/orgo/__init__.py +0 -0
- {orgo-0.0.24 → orgo-0.0.25}/src/orgo/api/__init__.py +0 -0
- {orgo-0.0.24 → orgo-0.0.25}/src/orgo/api/client.py +0 -0
- {orgo-0.0.24 → orgo-0.0.25}/src/orgo/prompt.py +0 -0
- {orgo-0.0.24 → orgo-0.0.25}/src/orgo/utils/__init__.py +0 -0
- {orgo-0.0.24 → orgo-0.0.25}/src/orgo/utils/auth.py +0 -0
- {orgo-0.0.24 → orgo-0.0.25}/src/orgo.egg-info/dependency_links.txt +0 -0
- {orgo-0.0.24 → orgo-0.0.25}/src/orgo.egg-info/requires.txt +0 -0
- {orgo-0.0.24 → orgo-0.0.25}/src/orgo.egg-info/top_level.txt +0 -0
|
@@ -10,7 +10,6 @@ from requests.exceptions import RequestException
|
|
|
10
10
|
|
|
11
11
|
from .api.client import ApiClient
|
|
12
12
|
from .prompt import get_provider
|
|
13
|
-
from .project import ProjectManager
|
|
14
13
|
|
|
15
14
|
logger = logging.getLogger(__name__)
|
|
16
15
|
|
|
@@ -45,27 +44,21 @@ class Computer:
|
|
|
45
44
|
if ram is None and memory is not None:
|
|
46
45
|
ram = memory
|
|
47
46
|
|
|
48
|
-
# Look for a saved project ID if none was provided
|
|
49
|
-
if project_id is None:
|
|
50
|
-
project_id = ProjectManager.load_project_id()
|
|
51
|
-
|
|
52
47
|
if project_id:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
except (RequestException, ValueError) as e:
|
|
60
|
-
logger.warning(f"Could not connect to saved project {project_id}: {e}")
|
|
61
|
-
self._create_new_computer(config, ram, cpu)
|
|
48
|
+
# Connect to existing computer
|
|
49
|
+
self.project_id = project_id
|
|
50
|
+
self._info = self.api.connect_computer(project_id)
|
|
51
|
+
# Log if ram/memory/cpu were provided but ignored
|
|
52
|
+
if ram is not None or memory is not None or cpu is not None:
|
|
53
|
+
logger.info("Note: ram, memory, and cpu parameters are ignored when connecting to existing computer")
|
|
62
54
|
else:
|
|
55
|
+
# Create a new computer
|
|
63
56
|
self._create_new_computer(config, ram, cpu)
|
|
64
57
|
|
|
65
58
|
def _create_new_computer(self, config: Optional[Dict[str, Any]] = None,
|
|
66
59
|
ram: Optional[Literal[2, 4]] = None,
|
|
67
60
|
cpu: Optional[Literal[2, 4]] = None):
|
|
68
|
-
"""Create a new computer instance
|
|
61
|
+
"""Create a new computer instance"""
|
|
69
62
|
# Validate ram and cpu values if provided
|
|
70
63
|
if ram is not None and ram not in [2, 4]:
|
|
71
64
|
raise ValueError("ram/memory must be either 2 or 4 GB")
|
|
@@ -92,9 +85,6 @@ class Computer:
|
|
|
92
85
|
|
|
93
86
|
if not self.project_id:
|
|
94
87
|
raise ValueError("Failed to initialize computer: No project ID returned")
|
|
95
|
-
|
|
96
|
-
# Save the project ID for future use
|
|
97
|
-
ProjectManager.save_project_id(self.project_id)
|
|
98
88
|
|
|
99
89
|
def status(self) -> Dict[str, Any]:
|
|
100
90
|
"""Get current computer status"""
|
|
@@ -114,10 +104,7 @@ class Computer:
|
|
|
114
104
|
|
|
115
105
|
def destroy(self) -> Dict[str, Any]:
|
|
116
106
|
"""Terminate and delete the computer instance"""
|
|
117
|
-
|
|
118
|
-
# Clear the local project cache after destroying
|
|
119
|
-
ProjectManager.clear_project_cache()
|
|
120
|
-
return result
|
|
107
|
+
return self.api.delete_computer(self.project_id)
|
|
121
108
|
|
|
122
109
|
# Navigation methods
|
|
123
110
|
def left_click(self, x: int, y: int) -> Dict[str, Any]:
|
orgo-0.0.24/src/orgo/project.py
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# src/orgo/project.py
|
|
2
|
-
"""Project management for Orgo virtual environments"""
|
|
3
|
-
import os
|
|
4
|
-
import json
|
|
5
|
-
import shutil
|
|
6
|
-
import logging
|
|
7
|
-
from typing import Optional
|
|
8
|
-
|
|
9
|
-
logger = logging.getLogger(__name__)
|
|
10
|
-
|
|
11
|
-
class ProjectManager:
|
|
12
|
-
"""Manages project persistence for Orgo computers"""
|
|
13
|
-
|
|
14
|
-
@staticmethod
|
|
15
|
-
def load_project_id() -> Optional[str]:
|
|
16
|
-
"""Load project ID from local config file"""
|
|
17
|
-
config_path = ProjectManager._get_config_path()
|
|
18
|
-
|
|
19
|
-
if not os.path.exists(config_path):
|
|
20
|
-
return None
|
|
21
|
-
|
|
22
|
-
try:
|
|
23
|
-
with open(config_path, 'r') as f:
|
|
24
|
-
data = json.load(f)
|
|
25
|
-
return data.get('project_id')
|
|
26
|
-
except (json.JSONDecodeError, IOError, OSError) as e:
|
|
27
|
-
logger.warning(f"Error loading project config: {str(e)}")
|
|
28
|
-
return None
|
|
29
|
-
|
|
30
|
-
@staticmethod
|
|
31
|
-
def save_project_id(project_id: str) -> None:
|
|
32
|
-
"""Save project ID to local config file"""
|
|
33
|
-
config_dir = ProjectManager._get_project_dir()
|
|
34
|
-
config_path = ProjectManager._get_config_path()
|
|
35
|
-
|
|
36
|
-
try:
|
|
37
|
-
os.makedirs(config_dir, exist_ok=True)
|
|
38
|
-
with open(config_path, 'w') as f:
|
|
39
|
-
json.dump({'project_id': project_id}, f, indent=2)
|
|
40
|
-
except (IOError, OSError) as e:
|
|
41
|
-
logger.error(f"Failed to save project ID: {str(e)}")
|
|
42
|
-
raise RuntimeError(f"Failed to save project configuration: {str(e)}") from e
|
|
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
|
-
|
|
56
|
-
@staticmethod
|
|
57
|
-
def _get_project_dir() -> str:
|
|
58
|
-
"""Get the project directory path"""
|
|
59
|
-
return os.path.join(os.getcwd(), ".orgo")
|
|
60
|
-
|
|
61
|
-
@staticmethod
|
|
62
|
-
def _get_config_path() -> str:
|
|
63
|
-
"""Get the full path to the config file"""
|
|
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
|