65db3a4fcd
* Add status bar and compact summary widgets with context window resolution - Implemented a shared status bar for CLI and TUI frontends, including helpers for managing session metrics and context windows. - Created a `CompactSummaryWidget` for displaying manual summaries in a collapsible format. - Introduced a `CompactingWidget` to indicate ongoing compacting processes. - Added a base class `TimedStatusWidget` for widgets that require a timer. - Developed context window resolution helpers to retrieve context window sizes from various model attributes. - Enhanced tests for context window resolution and status bar functionalities, ensuring accurate behavior across different scenarios. - Updated existing tests to cover new features and maintain code quality. * refactor(Channel): simplify lambda function in _send_with_retry method * feat: enhance context editing logic and improve error handling in StreamState * refactor(Channel): streamline lambda function in _send_with_retry method * feat: rename auto-approve option to auto-mode for unattended execution; update checkpoint queries to filter by agent name; improve compatibility validation logic * feat: rename auto-approve option to auto-mode; update related logic and tests for improved unattended execution * fix: correct formatting of console message for MCP server configuration status * feat: add check for None summary_message in _apply_summarization_event to prevent errors * feat: enhance _load_checkpoint_messages to validate message format and apply summarization event
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
"""Loading spinner widget shown while waiting for the first token."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from .timed_status_widget import TimedStatusWidget
|
|
|
|
_SPINNER_FRAMES = "\u280b\u2819\u2839\u2838\u283c\u2834\u2826\u2827\u2807\u280f"
|
|
|
|
|
|
class LoadingWidget(TimedStatusWidget):
|
|
"""Spinner + 'Thinking...' with elapsed time counter.
|
|
|
|
Mount when a turn starts; call ``remove()`` when the first
|
|
thinking/text/tool_call event arrives.
|
|
"""
|
|
|
|
DEFAULT_CSS = """
|
|
LoadingWidget {
|
|
height: auto;
|
|
color: #22d3ee;
|
|
padding: 0 0;
|
|
}
|
|
"""
|
|
|
|
def __init__(self) -> None:
|
|
super().__init__()
|
|
self._frame = 0
|
|
|
|
def _tick(self) -> None:
|
|
self._frame = (self._frame + 1) % len(_SPINNER_FRAMES)
|
|
super()._tick()
|
|
|
|
def _refresh_display(self) -> None:
|
|
char = _SPINNER_FRAMES[self._frame]
|
|
self.update(f"{char} Thinking... ({self.elapsed_seconds}s)")
|
|
|
|
async def cleanup(self) -> None:
|
|
"""Stop timer and remove from DOM."""
|
|
self._stop_timer()
|
|
await self.remove()
|