File size: 3,740 Bytes
e20bd8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import logging
from art import text2art
from colorama import init, Fore, Style
from datetime import datetime

# Initialize colorama
init()

logger = logging.getLogger(__name__)

class AgentVisualManager:
    """Provides visual feedback for agent operations"""
    
    def show_agent_status(self, agent_name: str, status: str):
        """Display agent status with visual feedback"""
        colors = {
            "initializing": Fore.YELLOW,
            "processing": Fore.BLUE,
            "completed": Fore.GREEN,
            "error": Fore.RED,
            "waiting": Fore.CYAN
        }
        
        stages = {
            "initializing": f"""
            {colors["initializing"]}β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚    Agent Init     β”‚
            β”‚  {agent_name:<14} β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜{Style.RESET_ALL}
            """,
            "processing": f"""
            {colors["processing"]}β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚    Processing     β”‚ βš™οΈ
            β”‚  {agent_name:<14} β”‚ 
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜{Style.RESET_ALL}
            """,
            "completed": f"""
            {colors["completed"]}β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚    Completed!     β”‚ βœ…
            β”‚  {agent_name:<14} β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜{Style.RESET_ALL}
            """,
            "error": f"""
            {colors["error"]}β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚     Error!       β”‚ ❌
            β”‚  {agent_name:<14} β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜{Style.RESET_ALL}
            """,
            "waiting": f"""
            {colors["waiting"]}β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚     Waiting      β”‚ ⏳
            β”‚  {agent_name:<14} β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜{Style.RESET_ALL}
            """
        }
        
        print(f"\n{datetime.now().strftime('%H:%M:%S')} - ", end="")
        print(stages.get(status, ""))
        
    def show_agent_communication(self, from_agent: str, to_agent: str, message_type: str = "request"):
        """Display agent communication flow"""
        arrow = "──→" if message_type == "request" else "←──"
        color = Fore.BLUE if message_type == "request" else Fore.GREEN
        
        print(f"""
        {color}β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” {arrow} β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ {from_agent:<11}β”‚      β”‚ {to_agent:<11}β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜{Style.RESET_ALL}
        """)
        
    def show_team_formation(self, team_leader: str, team_members: list):
        """Display team structure"""
        print(Fore.CYAN + text2art("Team Formation") + Style.RESET_ALL)
        print(f"""
        {Fore.YELLOW}β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚   LEADER    β”‚
        β”‚ {team_leader:<11}β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜{Style.RESET_ALL}
             β”‚
        """)
        
        for member in team_members:
            if member != team_leader:
                print(f"""     {Fore.BLUE}     ↓
             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
             β”‚ {member:<11}β”‚
             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜{Style.RESET_ALL}""")