orka.tui_interface module
OrKa TUI Interface
Terminal User Interface for OrKa memory system monitoring and management. Provides real-time visualizations and interactive controls for memory operations.
Overview
The TUI interface offers a modern terminal-based monitoring solution for OrKa memory systems, with support for both basic text-based displays and advanced interactive interfaces when Textual is available.
Core Features
Real-time Monitoring - Live memory statistics with automatic refresh - Connection status and backend information - Performance metrics and system health indicators - Error tracking and status reporting
Memory Management - View stored memories and orchestration logs - Monitor active and expired entries - Track memory usage patterns - Backend-specific statistics (Redis, RedisStack)
Interactive Interface - Keyboard navigation and shortcuts - Multiple view modes (dashboard, memories, performance, config) - Customizable refresh intervals - Color-coded status indicators
Architecture
Modular Design The TUI system is built with a modular architecture:
ModernTUIInterface - Core interface class with data management
OrKaMonitorApp - Legacy Textual-based interactive app (backward compatibility)
OrKaTextualApp - Modern Textual app with advanced features (optional)
Dependency Handling - Graceful fallback when Textual is not available - Optional advanced features with dependency checking - Backward compatibility with existing interfaces
Data Management - Automatic data refresh with configurable intervals - Connection pooling for backend systems - Error handling and recovery mechanisms - Performance optimization for large datasets
Implementation Details
Textual Integration When Textual is available, the interface provides: - Rich terminal widgets and layouts - Interactive keyboard bindings - Real-time data updates - Professional styling and themes
Fallback Mode When Textual is not available: - Basic text-based output - Simple refresh mechanisms - Core functionality preservation - Minimal dependencies
Key Bindings - q - Quit application - 1 - Dashboard view - 2 - Memories view - 3 - Performance view - 4 - Configuration view - r - Force refresh
Usage Patterns
Basic Usage ```python from orka.tui_interface import ModernTUIInterface
# Create TUI interface tui = ModernTUIInterface(memory_logger=memory_backend)
# Start monitoring tui.run() ```
Advanced Usage with Textual ```python from orka.tui_interface import OrKaMonitorApp, ModernTUIInterface
# Create TUI with Textual app tui = ModernTUIInterface(memory_logger=memory_backend) app = OrKaMonitorApp(tui)
# Run interactive interface app.run() ```
Configuration Options ```python tui = ModernTUIInterface(
memory_logger=memory_backend, refresh_interval=2.0, # seconds auto_refresh=True, color_theme=”default”
Display Information
Memory Statistics - Total entries count - Stored memories vs orchestration logs - Active vs expired entries - Backend type and connection status
Performance Metrics - Memory usage patterns - Search performance (for RedisStack) - Connection health - Error rates and patterns
System Information - Backend configuration - Connection endpoints - Version information - Feature availability
Error Handling
Connection Issues - Automatic retry mechanisms - Graceful degradation when backend unavailable - Clear error messages and recovery suggestions - Fallback to cached data when possible
Display Errors - Safe error rendering in terminal - Non-blocking error handling - Detailed error context for debugging - Recovery actions and suggestions
Compatibility
Backward Compatibility - Maintains compatibility with existing TUI interfaces - Preserves all public APIs and methods - Supports legacy configuration patterns - Graceful handling of missing dependencies
Future Extensions - Plugin system for custom views - Export functionality for data analysis - Integration with external monitoring systems - Advanced filtering and search capabilities
- class orka.tui_interface.ModernTUIInterface[source]
Bases:
object
Modern TUI interface for OrKa memory monitoring.
- class orka.tui_interface.OrKaMonitorApp(tui_interface)[source]
Bases:
App
Legacy Textual-based interactive monitoring app (kept for backward compatibility).
- BINDINGS: ClassVar[list[BindingType]] = [Binding(key='q', action='quit', description='Quit', show=True, key_display=None, priority=False, tooltip='', id=None, system=False), Binding(key='1', action='show_dashboard', description='Dashboard', show=True, key_display=None, priority=False, tooltip='', id=None, system=False), Binding(key='2', action='show_memories', description='Memories', show=True, key_display=None, priority=False, tooltip='', id=None, system=False), Binding(key='3', action='show_performance', description='Performance', show=True, key_display=None, priority=False, tooltip='', id=None, system=False), Binding(key='4', action='show_config', description='Config', show=True, key_display=None, priority=False, tooltip='', id=None, system=False), Binding(key='r', action='refresh', description='Refresh', show=True, key_display=None, priority=False, tooltip='', id=None, system=False)]
The default key bindings.
- CSS: ClassVar[str] = '\n Screen {\n background: $surface;\n }\n \n .box {\n border: solid $primary;\n background: $surface;\n }\n \n .header {\n dock: top;\n height: 3;\n background: $primary;\n color: $text;\n }\n \n .footer {\n dock: bottom;\n height: 3;\n background: $primary-darken-3;\n color: $text;\n }\n '
Inline CSS, useful for quick scripts. This is loaded after CSS_PATH, and therefore takes priority in the event of a specificity clash.