1919from hanerma .memory .compression .xerv_crayon_ext import XervCrayonAdapter
2020from hanerma .autoprompt .enhancer import AutoPromptEnhancer
2121
22+ from rich .console import Console
23+ from rich .panel import Panel
24+ from rich .text import Text
25+ from rich import box
26+
27+ console = Console ()
28+
2229async def run_mission (prompt : str , agents_list : Optional [List [str ]] = None ):
2330 """
2431 Sets up the hardware-rooted stack and executes the mission.
2532 """
26- print (f"\n { '=' * 80 } " )
27- print (f"🚀 HANERMA APEX MISSION START" )
28- print (f"{ '=' * 80 } " )
33+ console .print ()
34+ console .print (Panel (
35+ Text (f"🚀 HANERMA APEX MISSION: { prompt } " , style = "bold cyan" ),
36+ title = "[NEON-PULSE]" ,
37+ subtitle = "[LAYER-0 BOOT SEQUENCE]" ,
38+ border_style = "bright_cyan" ,
39+ box = box .DOUBLE_EDGE
40+ ))
2941
3042 # 1. Initialize Bare-Metal Layer (Layer 0)
31- print (f " [L0] Booting XERV-CRAYON Hardware Root..." )
43+ console . print (" [grey42]◈[/] [ L0] [cyan] Booting XERV-CRAYON Hardware Root...[/] " )
3244 tokenizer = XervCrayonAdapter (profile = "lite" )
3345
3446 # 2. Setup Orchestrator (Layer 1)
3547 model_id = os .getenv ("HANERMA_MODEL" ) or os .getenv ("HF_DEFAULT_MODEL" ) or "Qwen/Qwen3-Coder-Next-FP8:together"
36- print (f" [L1] Initializing Orchestrator (Model : { model_id } )" )
48+ console . print (f" [grey42]◈[/] [ L1] [cyan] Initializing Orchestrator[/] [grey37](Kernel : { model_id } )[/] " )
3749 orch = HANERMAOrchestrator (model = model_id , tokenizer = tokenizer )
3850
3951 # 3. Equip Apex Tools
4052 reg = ToolRegistry ()
4153 apex_tools = [reg .get_tool (n ) for n in ["web_search" , "calculator" , "get_system_time" , "delegate_task" , "execute_sandbox" ]]
4254
4355 # 4. Agent Discovery & Spawning
44- # We dynamically detect if the user requested specific roles
4556 requested_agents = []
4657 if agents_list :
4758 requested_agents = agents_list
4859 else :
49- # Heuristic detection for common roles
5060 lower_prompt = prompt .lower ()
5161 if "architect" in lower_prompt :
5262 requested_agents .append ("Code_Architect" )
@@ -56,7 +66,6 @@ async def run_mission(prompt: str, agents_list: Optional[List[str]] = None):
5666 if not requested_agents :
5767 requested_agents = ["Apex_Specialist" ]
5868
59- # Register agents with specialized profiles
6069 primary_agent = requested_agents [0 ]
6170 for name in requested_agents :
6271 role = "System Specialist"
@@ -65,27 +74,41 @@ async def run_mission(prompt: str, agents_list: Optional[List[str]] = None):
6574
6675 agent = spawn_agent (name , model = model_id , tools = apex_tools , role = role )
6776 orch .register_agent (agent )
68- print (f" [L2] Deployed Agent: { name } ({ role } )" )
77+ console . print (f" [grey42]◈[/] [ L2] [spring_green3] Deployed Agent:[/] [bold] { name } [/] [grey37] ({ role } )[/] " )
6978
7079 # 5. Core Execution Loop
71- print (f"\n [L3] Executing Reasoning Swarm..." )
80+ console . print (f"\n [grey42]◈[/] [ L3] [bold bright_yellow] Executing Reasoning Swarm...[/] " )
7281 try :
7382 result = await orch .run (prompt , target_agent = primary_agent )
7483
75- print ("\n " + "💎" + "=" * 78 + "💎" )
76- print (" FINAL APEX MISSION OUTPUT" )
77- print ("=" * 80 )
78- print (result .get ('output' , 'No output generated.' ))
79- print ("=" * 80 )
84+ output_content = result .get ('output' , 'No output generated.' )
85+ console .print ()
86+ console .print (Panel (
87+ Text (output_content , style = "bright_white" ),
88+ title = "💎 [bold bright_magenta]FINAL APEX MISSION OUTPUT[/] 💎" ,
89+ border_style = "bright_magenta" ,
90+ box = box .ROUNDED ,
91+ padding = (1 , 2 )
92+ ))
8093
8194 # Telemetry
8295 metrics = result .get ('metrics' , {})
83- print (f"\n [TELEMETRY] Latency: { metrics .get ('latency_ms' , 0 ):.2f} ms | Iterations: { metrics .get ('iterations' , 0 )} " )
84- print (f" [PERSISTENCE] Trace ID: { orch .trace_id } " )
85- print (f" [PERSISTENCE] Database: hanerma_state.db" )
96+ latency = metrics .get ('latency_ms' , 0 )
97+ iterations = metrics .get ('iterations' , 0 )
98+
99+ telemetry_text = Text ()
100+ telemetry_text .append ("\n [TELEMETRY] " , style = "bold grey50" )
101+ telemetry_text .append (f"Latency: { latency :.2f} ms" , style = "bright_cyan" )
102+ telemetry_text .append (" | " , style = "grey37" )
103+ telemetry_text .append (f"Iterations: { iterations } " , style = "bright_green" )
104+ telemetry_text .append (" | " , style = "grey37" )
105+ telemetry_text .append (f"Trace ID: { orch .trace_id } " , style = "grey50" )
106+
107+ console .print (telemetry_text )
108+ console .print (f" [PERSISTENCE] Database: [grey70]hanerma_state.db[/]\n " )
86109
87110 except Exception as e :
88- print (f"\n ❌ [CRITICAL] Mission Failure: { e } " )
111+ console . print (f"\n [bold red] ❌ [CRITICAL] Mission Failure:[/] { e } " )
89112 import traceback
90113 traceback .print_exc ()
91114
0 commit comments