MCPcopy Create free account
hub / github.com/MiniMax-AI/Mini-Agent / print_session_info

Function print_session_info

mini_agent/cli.py:223–258  ·  view source on GitHub ↗

Print session information with proper alignment

(agent: Agent, workspace_dir: Path, model: str)

Source from the content-addressed store, hash-verified

221
222
223def print_session_info(agent: Agent, workspace_dir: Path, model: str):
224 """Print session information with proper alignment"""
225 BOX_WIDTH = 58
226
227 def print_info_line(text: str):
228 """Print a single info line with proper padding"""
229 # Account for leading space
230 text_width = calculate_display_width(text)
231 padding = max(0, BOX_WIDTH - 1 - text_width)
232 print(f"{Colors.DIM}│{Colors.RESET} {text}{' ' * padding}{Colors.DIM}│{Colors.RESET}")
233
234 # Top border
235 print(f"{Colors.DIM}┌{'─' * BOX_WIDTH}┐{Colors.RESET}")
236
237 # Header (centered)
238 header_text = f"{Colors.BRIGHT_CYAN}Session Info{Colors.RESET}"
239 header_width = calculate_display_width(header_text)
240 header_padding_total = BOX_WIDTH - 1 - header_width # -1 for leading space
241 header_padding_left = header_padding_total // 2
242 header_padding_right = header_padding_total - header_padding_left
243 print(f"{Colors.DIM}│{Colors.RESET} {' ' * header_padding_left}{header_text}{' ' * header_padding_right}{Colors.DIM}│{Colors.RESET}")
244
245 # Divider
246 print(f"{Colors.DIM}├{'─' * BOX_WIDTH}┤{Colors.RESET}")
247
248 # Info lines
249 print_info_line(f"Model: {model}")
250 print_info_line(f"Workspace: {workspace_dir}")
251 print_info_line(f"Message History: {len(agent.messages)} messages")
252 print_info_line(f"Available Tools: {len(agent.tools)} tools")
253
254 # Bottom border
255 print(f"{Colors.DIM}└{'─' * BOX_WIDTH}┘{Colors.RESET}")
256 print()
257 print(f"{Colors.DIM}Type {Colors.BRIGHT_GREEN}/help{Colors.DIM} for help, {Colors.BRIGHT_GREEN}/exit{Colors.DIM} to quit{Colors.RESET}")
258 print()
259
260
261def print_stats(agent: Agent, session_start: datetime):

Callers 1

run_agentFunction · 0.85

Calls 2

calculate_display_widthFunction · 0.90
print_info_lineFunction · 0.85

Tested by

no test coverage detected