"""Command-palette command specs for the optional Textual TUI.
Purpose:
Keep command names and callbacks declarative so the app can expose Textual
command-palette actions without hard-coding every command inside the app
class.
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Literal
[docs]
TUICommandAction = Literal[
"action_show_home",
"action_show_cheapest",
"action_show_coding",
"action_show_catalog",
"action_show_suites",
"action_show_profiles",
"action_show_benchmarks",
"action_focus_search",
"action_clear_search",
"action_refresh",
]
@dataclass(frozen=True, slots=True)
[docs]
class TUICommandSpec:
"""Declarative command-palette entry for the TUI app."""
[docs]
action: TUICommandAction
[docs]
def default_tui_command_specs(*, show_benchmarks: bool = True) -> tuple[TUICommandSpec, ...]:
"""Return built-in command-palette commands for the model explorer."""
commands = [
TUICommandSpec("Home", "Show the TUI overview and key map.", "action_show_home"),
TUICommandSpec("Cheapest models", "Compare models by estimated call cost.", "action_show_cheapest"),
TUICommandSpec("Coding models", "Show coding-oriented model comparisons.", "action_show_coding"),
TUICommandSpec("Catalog", "Show raw model metadata and capabilities.", "action_show_catalog"),
TUICommandSpec("Suites", "Show catalog-derived model-suite candidates.", "action_show_suites"),
TUICommandSpec("Profiles", "Show profile and runtime usage notes.", "action_show_profiles"),
TUICommandSpec("Search", "Focus the model and capability search box.", "action_focus_search"),
TUICommandSpec("Clear search", "Clear the current free-text search.", "action_clear_search", discover=False),
TUICommandSpec("Refresh", "Refresh catalog, comparison, and suite data.", "action_refresh"),
]
if show_benchmarks:
commands.insert(
6,
TUICommandSpec(
"Benchmarks",
"Show known LiveCodeBench Pro endpoint surfaces.",
"action_show_benchmarks",
),
)
return tuple(commands)