Skip to main content

hackagent.interfaces.tui.app

Main TUI Application

One screen, one job: build a campaign, check it, run it.

The app opens on :class:WelcomeScreen — the logo, and a working campaign to start from — then hands over to :class:CampaignBuilder. The other views (results, targets, config) are no longer part of that flow: each is a whole app of its own, opened by starting HackAgentTUI on it, which is how the welcome screen reaches past results.

HackAgentTUI Objects​

class HackAgentTUI(App)

HackAgent Terminal User Interface Application

VIEWS​

The view this app shows. campaign is the app proper; the others are opened one at a time by whoever constructs the app.

__init__​

def __init__(cli_config: CLIConfig,
initial_tab: str = "campaign",
initial_data: dict[Any, Any] | None = None)

Initialize the TUI application.

Arguments:

  • cli_config - CLI configuration object
  • initial_tab - Which view to show. Defaults to the campaign builder; the legacy names results, agents and config open that view on its own.
  • initial_data - Data to pre-fill the view with (default: None)

get_css_variables​

def get_css_variables() -> dict[str, str]

Expose the HackAgent brand palette as CSS variables.

compose​

def compose() -> ComposeResult

One view and a footer.

No header bar: the view below says what it is — the builder opens on the campaign's name and whether it is ready to run — so a title strip above it only costs rows the form can use.

on_mount​

def on_mount() -> None

Open on the welcome screen, unless a campaign was handed to us.

show_welcome​

def show_welcome() -> None

Offer the ways in, and take the one chosen.

action_help​

def action_help() -> None

Show the keys and what this screen is for.

action_refresh​

def action_refresh() -> None

Refresh whatever view is on screen.

action_copy_selection​

def action_copy_selection() -> None

Copy logs (or a text selection) to the clipboard — bound to Ctrl+Y.

If you've dragged to select text, that selection is copied. Otherwise it copies the whole visible Logs (or Actions) panel — so you can copy without needing the mouse at all. Uses Textual's terminal-native clipboard (OSC 52), which works locally and over SSH.

show_success​

def show_success(message: str) -> None

Show success notification with checkmark.

show_error​

def show_error(message: str) -> None

Show error notification with X mark.

show_warning​

def show_warning(message: str) -> None

Show warning notification with warning sign.

show_info​

def show_info(message: str) -> None

Show info notification with info icon.