Stop tool execution display and show result. Args: result: Tool execution result success: Whether execution succeeded
(self, result: str, success: bool = True)
| 278 | self._last_status = "" |
| 279 | |
| 280 | async def stop_tool_execution(self, result: str, success: bool = True) -> None: |
| 281 | """Stop tool execution display and show result. |
| 282 | |
| 283 | Args: |
| 284 | result: Tool execution result |
| 285 | success: Whether execution succeeded |
| 286 | """ |
| 287 | |
| 288 | if not self.tool_execution: |
| 289 | logger.warning("No active tool execution to stop") |
| 290 | return |
| 291 | |
| 292 | # Update state |
| 293 | elapsed = time.time() - self.tool_execution.start_time |
| 294 | self.tool_execution.result = result |
| 295 | self.tool_execution.success = success |
| 296 | self.tool_execution.elapsed = elapsed |
| 297 | self.tool_execution.completed = True |
| 298 | |
| 299 | # Stop refresh |
| 300 | await self._stop_refresh_loop() |
| 301 | |
| 302 | # Stop live status display |
| 303 | if self._tool_status: |
| 304 | self._tool_status.stop() |
| 305 | self._tool_status = None |
| 306 | |
| 307 | # Show final result (uses Rich output) |
| 308 | self._show_tool_result(self.tool_execution) |
| 309 | |
| 310 | # Ensure stdout is flushed after Rich output |
| 311 | # This helps prevent state issues with subsequent direct stdout writes |
| 312 | sys.stdout.flush() |
| 313 | |
| 314 | self.tool_execution = None |
| 315 | |
| 316 | # ==================== USER MESSAGES ==================== |
| 317 |