MCPcopy Create free account
hub / github.com/IBM/mcp-cli / __init__

Method __init__

src/mcp_cli/display/manager.py:65–106  ·  view source on GitHub ↗

Initialize display manager. Args: renderer: Custom renderer, defaults to ChukTermRenderer

(self, renderer: DisplayRenderer | None = None)

Source from the content-addressed store, hash-verified

63 """
64
65 def __init__(self, renderer: DisplayRenderer | None = None):
66 """Initialize display manager.
67
68 Args:
69 renderer: Custom renderer, defaults to ChukTermRenderer
70 """
71 self.renderer = renderer or ChukTermRenderer()
72
73 # Streaming state
74 self.streaming_state: StreamingState | None = None
75
76 # Tool execution state
77 self.tool_execution: "ToolExecutionState | None" = None
78
79 # Live status display for tool execution (handles terminal control properly)
80 # Uses chuk_term.ui.LiveStatus
81 self._tool_status: "LiveStatus | None" = None
82
83 # Background refresh task
84 self._refresh_task: asyncio.Task | None = None
85 self._refresh_active: bool = False
86
87 # Spinner animation
88 self._spinner_frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
89 self._spinner_index = 0
90
91 # Reasoning display debouncing
92 self._last_reasoning_update = 0.0
93 self._last_reasoning_chunk_count = 0
94 self._last_reasoning_preview = "" # Cached preview text
95 self._reasoning_update_interval = (
96 2.0 # seconds (increased for less frequent updates)
97 )
98 self._reasoning_chunk_interval = 20 # chunks (increased for less noise)
99
100 # Display state
101 self._last_status = ""
102 self._last_line_count = 0 # Track how many lines were last printed
103 self._showing_thinking = False # Track if we're showing thinking vs content
104
105 # Rendering lock to prevent simultaneous updates
106 self._render_lock = asyncio.Lock()
107
108 # ==================== STREAMING OPERATIONS ====================
109

Callers

nothing calls this directly

Calls 1

ChukTermRendererClass · 0.85

Tested by

no test coverage detected