Spaces:
Sleeping
Sleeping
Update definitions.py
Browse files- definitions.py +73 -32
definitions.py
CHANGED
@@ -192,37 +192,37 @@ class CodeMetricsAnalyzer:
|
|
192 |
"""Returns the history of metrics measurements"""
|
193 |
return self.metrics_history
|
194 |
|
195 |
-
def get_trend_analysis(self) -> Dict[str, Any]:
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
def _calculate_trend(self, values: List[float]) -> Dict[str, Any]:
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
|
227 |
class WorkspaceManager:
|
228 |
"""Manages the workspace for the Autonomous Agent System."""
|
@@ -408,7 +408,47 @@ class AutonomousAgentApp:
|
|
408 |
logging.error(f"Application error: {str(e)}")
|
409 |
st.error("An error occurred while starting the application. Please check the logs.")
|
410 |
raise
|
411 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
412 |
@dataclass
|
413 |
class QualityMetrics:
|
414 |
"""Advanced quality metrics tracking and analysis"""
|
@@ -746,6 +786,7 @@ class AutonomousAgentApp:
|
|
746 |
st.write(f"Python Version: {sys.version}")
|
747 |
st.write(f"Platform: {platform.platform()}")
|
748 |
st.write(f"Available Memory: {psutil.virtual_memory().available / (1024**3):.1f} GB free")
|
|
|
749 |
if __name__ == "__main__":
|
750 |
app = AutonomousAgentApp() # Create an instance of the app
|
751 |
app.run() # Call the run method to start the application
|
|
|
192 |
"""Returns the history of metrics measurements"""
|
193 |
return self.metrics_history
|
194 |
|
195 |
+
def get_trend_analysis(self) -> Dict[str, Any]:
|
196 |
+
"""Analyzes trends in metrics over time"""
|
197 |
+
if not self.metrics_history:
|
198 |
+
return {"status": "No metrics history available"}
|
199 |
+
|
200 |
+
trends = {
|
201 |
+
"quality_score": self._calculate_trend([m["quality_score"] for m in self.metrics_history]),
|
202 |
+
"coverage_score": self._calculate_trend([m["coverage_score"] for m in self.metrics_history]),
|
203 |
+
"security_score": self._calculate_trend([m["security_score"] for m in self.metrics_history])
|
204 |
+
}
|
205 |
+
|
206 |
+
return trends
|
207 |
+
|
208 |
+
def _calculate_trend(self, values: List[float]) -> Dict[str, Any]:
|
209 |
+
"""Calculates trend statistics for a metric"""
|
210 |
+
if not values:
|
211 |
+
return {"trend": "unknown", "change": 0.0}
|
212 |
+
|
213 |
+
recent_values = values[-3:] # Look at last 3 measurements
|
214 |
+
if len(recent_values) < 2:
|
215 |
+
return {"trend": "insufficient data", "change": 0.0}
|
216 |
+
|
217 |
+
change = recent_values[-1] - recent_values[0]
|
218 |
+
trend = "improving" if change > 0 else "declining" if change < 0 else "stable"
|
219 |
+
|
220 |
+
return {
|
221 |
+
"trend": trend,
|
222 |
+
"change": change,
|
223 |
+
"current": recent_values[-1],
|
224 |
+
"previous": recent_values[0]
|
225 |
+
}
|
226 |
|
227 |
class WorkspaceManager:
|
228 |
"""Manages the workspace for the Autonomous Agent System."""
|
|
|
408 |
logging.error(f"Application error: {str(e)}")
|
409 |
st.error("An error occurred while starting the application. Please check the logs.")
|
410 |
raise
|
411 |
+
|
412 |
+
class DevelopmentPipeline:
|
413 |
+
"""Development pipeline for the autonomous agent system."""
|
414 |
+
|
415 |
+
def __init__(self, workspace_manager, tool_manager):
|
416 |
+
self.workspace_manager = workspace_manager
|
417 |
+
self.tool_manager = tool_manager
|
418 |
+
self.pipeline_stages = {
|
419 |
+
self.PipelineStage.PLANNING: self._execute_planning_stage,
|
420 |
+
self.PipelineStage.DEVELOPMENT: self._execute_development_stage,
|
421 |
+
self.PipelineStage.TESTING: self._execute_testing_stage
|
422 |
+
}
|
423 |
+
|
424 |
+
class PipelineStage(Enum):
|
425 |
+
"""Enum for pipeline stages."""
|
426 |
+
PLANNING = 1
|
427 |
+
DEVELOPMENT = 2
|
428 |
+
TESTING = 3
|
429 |
+
|
430 |
+
async def execute_stage(self, stage, input_data):
|
431 |
+
"""Execute a pipeline stage."""
|
432 |
+
if stage in self.pipeline_stages:
|
433 |
+
return await self.pipeline_stages[stage](input_data)
|
434 |
+
else:
|
435 |
+
raise ValueError(f"Invalid pipeline stage: {stage}")
|
436 |
+
|
437 |
+
async def _execute_planning_stage(self, input_data):
|
438 |
+
"""Execute the planning stage."""
|
439 |
+
# Planning stage logic here
|
440 |
+
pass
|
441 |
+
|
442 |
+
async def _execute_development_stage(self, input_data):
|
443 |
+
"""Execute the development stage."""
|
444 |
+
# Development stage logic here
|
445 |
+
pass
|
446 |
+
|
447 |
+
async def _execute_testing_stage(self, input_data):
|
448 |
+
"""Execute the testing stage."""
|
449 |
+
# Testing stage logic here
|
450 |
+
pass
|
451 |
+
|
452 |
@dataclass
|
453 |
class QualityMetrics:
|
454 |
"""Advanced quality metrics tracking and analysis"""
|
|
|
786 |
st.write(f"Python Version: {sys.version}")
|
787 |
st.write(f"Platform: {platform.platform()}")
|
788 |
st.write(f"Available Memory: {psutil.virtual_memory().available / (1024**3):.1f} GB free")
|
789 |
+
|
790 |
if __name__ == "__main__":
|
791 |
app = AutonomousAgentApp() # Create an instance of the app
|
792 |
app.run() # Call the run method to start the application
|