hackagent.interfaces.tui.base
Base Tab Class
Base class for all TUI tabs with common functionality.
HackAgentHeader Objects
class HackAgentHeader(Container)
Custom header with ASCII logo
BaseTab Objects
class BaseTab(Container)
Base class for all TUI tabs.
Provides common functionality:
- CLI configuration access
- API client creation with timeout
- Error handling helpers
- Refresh mechanism
Subclasses should implement refresh_data() method.
__init__
def __init__(cli_config: CLIConfig, **kwargs)
Initialize base tab.
Arguments:
cli_config- CLI configuration instance**kwargs- Additional arguments passed to Container
client
def client()
Session using the explicitly selected storage backend.
local_client
def local_client()
Session over this machine's database, whatever the account is.
Where a run was recorded is the campaign's choice: execution.storage
keeps it here unless the campaign names a server, which it does while
an account is configured for reading. A view that only ever read the
account would never show those runs.
handle_api_error
def handle_api_error(error: Exception, context: str = "API call") -> str
Format API error messages for display.
Arguments:
error- The exception that occurredcontext- Description of what operation failed
Returns:
Formatted error message
refresh_data
def refresh_data() -> None
Refresh tab data from API.
Should be overridden by subclasses that need data refresh functionality. Default implementation does nothing.
enable_auto_refresh
def enable_auto_refresh(interval: float = 5.0) -> None
Enable automatic data refresh at specified interval.
Arguments:
interval- Refresh interval in seconds (default: 5.0)
disable_auto_refresh
def disable_auto_refresh() -> None
Disable automatic data refresh.
on_mount
def on_mount() -> None
Called when tab is mounted.
Subclasses can override to add custom mounting behavior, but should call super().on_mount() to ensure proper initialization.
on_show
def on_show() -> None
Refresh lazily the first time a hidden tab becomes visible.