Spaces:
Sleeping
Sleeping
| """ | |
| Agent 0: Super Agent (Visual Checklist Manager) | |
| Updated for LangGraph dictionary-based state. | |
| """ | |
| from typing import Dict, Any, List | |
| class SuperAgent: | |
| """ | |
| Agent 0: Super Agent | |
| Analyzes input and creates a comprehensive test plan. | |
| """ | |
| def __init__(self): | |
| """Initialize the Super Agent.""" | |
| self.default_components = [ | |
| "buttons", "inputs", "cards", "headers", "footers", | |
| "navigation", "forms", "modals", "alerts", "badges" | |
| ] | |
| self.default_viewports = [ | |
| {"name": "desktop", "width": 1440, "height": 900}, | |
| {"name": "mobile", "width": 375, "height": 812} | |
| ] | |
| self.test_categories_config = { | |
| "colors": {"enabled": True, "priority": "high", "items": ["primary_color", "secondary_color"]}, | |
| "typography": {"enabled": True, "priority": "high", "items": ["font_family", "font_size"]}, | |
| "spacing": {"enabled": True, "priority": "high", "items": ["margin", "padding"]}, | |
| "layout": {"enabled": True, "priority": "high", "items": ["width", "height"]}, | |
| "borders": {"enabled": True, "priority": "medium", "items": ["border_radius", "box_shadow"]}, | |
| "responsive": {"enabled": True, "priority": "high", "items": ["breakpoint_1440", "breakpoint_375"]} | |
| } | |
| def generate_test_plan(self, state: Dict[str, Any]) -> Dict[str, Any]: | |
| """Generate a comprehensive test plan.""" | |
| print("\n🤖 Agent 0: Super Agent - Generating Test Plan...") | |
| try: | |
| # Create test categories as dictionaries | |
| test_categories = [] | |
| for name, config in self.test_categories_config.items(): | |
| if config["enabled"]: | |
| test_categories.append({"name": name, "description": name, "count": len(config["items"])}) | |
| # Create test plan | |
| test_plan = { | |
| "components": self.default_components, | |
| "viewports": self.default_viewports, | |
| "categories": test_categories, | |
| "total_tests": len(self.default_components) * len(self.default_viewports) * len(test_categories), | |
| "status": "ready" | |
| } | |
| return { | |
| "viewports": self.default_viewports, | |
| "test_plan": test_plan, | |
| "status": "test_plan_generated" | |
| } | |
| except Exception as e: | |
| print(f" ❌ Error generating test plan: {str(e)}") | |
| return { | |
| "error_message": f"Agent 0 Error: {str(e)}", | |
| "status": "failed" | |
| } | |
| def agent_0_node(state: Dict[str, Any]) -> Dict[str, Any]: | |
| """LangGraph node for Agent 0.""" | |
| agent = SuperAgent() | |
| return agent.generate_test_plan(state) | |