#include <chat_tui.h>
Public Member Functions | |
ChatTUI (Rom *rom_context=nullptr) | |
~ChatTUI () | |
void | Run () |
void | SetRomContext (Rom *rom_context) |
Private Member Functions | |
void | OnSubmit (const std::string &message) |
void | LaunchAgentPrompt (const std::string &prompt) |
void | CleanupWorkers () |
void | StopSpinner () |
void | InitializeAutocomplete () |
agent::ChatMessage::SessionMetrics | CurrentMetrics () const |
void | ToggleTodoPopup () |
ftxui::Component | CreateTodoPopup () |
ftxui::Component | BuildShortcutPalette () |
bool | IsPopupOpen () const |
void | ToggleShortcutPalette () |
Private Attributes | |
ftxui::ScreenInteractive | screen_ = ftxui::ScreenInteractive::Fullscreen() |
agent::ConversationalAgentService | agent_service_ |
agent::TodoManager | todo_manager_ |
Rom * | rom_context_ = nullptr |
std::optional< std::string > | last_error_ |
AutocompleteEngine | autocomplete_engine_ |
std::string | rom_header_ |
std::atomic< bool > | agent_busy_ {false} |
std::atomic< bool > | spinner_running_ {false} |
std::atomic< int > | spinner_index_ {0} |
std::vector< std::future< void > > | worker_futures_ |
std::mutex | worker_mutex_ |
std::chrono::steady_clock::time_point | last_send_time_ {} |
double | last_response_seconds_ = 0.0 |
std::vector< double > | latency_history_ |
std::vector< std::string > | quick_actions_ |
std::thread | spinner_thread_ |
bool | todo_popup_visible_ = false |
ftxui::Component | todo_popup_component_ |
ftxui::Component | shortcut_palette_component_ |
bool | shortcut_palette_visible_ = false |
bool | todo_manager_ready_ = false |
Definition at line 26 of file chat_tui.h.
|
explicit |
Definition at line 65 of file chat_tui.cc.
References agent_service_, yaze::cli::agent::TodoManager::Initialize(), InitializeAutocomplete(), quick_actions_, rom_context_, rom_header_, yaze::cli::agent::ConversationalAgentService::SetRomContext(), yaze::Rom::size(), yaze::Rom::title(), todo_manager_, and todo_manager_ready_.
yaze::cli::tui::ChatTUI::~ChatTUI | ( | ) |
Definition at line 83 of file chat_tui.cc.
References CleanupWorkers().
void yaze::cli::tui::ChatTUI::Run | ( | ) |
Definition at line 113 of file chat_tui.cc.
References agent_busy_, agent_service_, autocomplete_engine_, BuildShortcutPalette(), yaze::cli::CreateAutocompleteInput(), CreateTodoPopup(), CurrentMetrics(), yaze::cli::agent::ConversationalAgentService::GetHistory(), yaze::cli::agent::ChatMessage::kUser, last_error_, last_response_seconds_, latency_history_, OnSubmit(), quick_actions_, rom_header_, screen_, shortcut_palette_component_, shortcut_palette_visible_, spinner_index_, todo_popup_component_, todo_popup_visible_, ToggleShortcutPalette(), and ToggleTodoPopup().
Referenced by yaze::cli::agent::HandleChatCommand(), and yaze::cli::ModernCLI::Run().
void yaze::cli::tui::ChatTUI::SetRomContext | ( | Rom * | rom_context | ) |
Definition at line 87 of file chat_tui.cc.
References agent_service_, rom_context_, rom_header_, yaze::cli::agent::ConversationalAgentService::SetRomContext(), yaze::Rom::size(), and yaze::Rom::title().
|
private |
Definition at line 354 of file chat_tui.cc.
References agent_service_, yaze::cli::agent::ConversationalAgentService::GetMetrics(), last_error_, LaunchAgentPrompt(), yaze::cli::agent::ConversationalAgentService::ResetConversation(), screen_, and yaze::cli::agent::ConversationalAgentService::SendMessage().
Referenced by Run().
|
private |
Definition at line 421 of file chat_tui.cc.
References agent_busy_, agent_service_, last_response_seconds_, last_send_time_, latency_history_, screen_, yaze::cli::agent::ConversationalAgentService::SendMessage(), spinner_running_, spinner_thread_, StopSpinner(), worker_futures_, and worker_mutex_.
Referenced by OnSubmit().
|
private |
Definition at line 467 of file chat_tui.cc.
References StopSpinner(), worker_futures_, and worker_mutex_.
Referenced by ~ChatTUI().
|
private |
Definition at line 483 of file chat_tui.cc.
References spinner_running_, and spinner_thread_.
Referenced by CleanupWorkers(), and LaunchAgentPrompt().
|
private |
Definition at line 97 of file chat_tui.cc.
References autocomplete_engine_, and yaze::cli::AutocompleteEngine::RegisterCommand().
Referenced by ChatTUI().
|
private |
Definition at line 479 of file chat_tui.cc.
References agent_service_, and yaze::cli::agent::ConversationalAgentService::GetMetrics().
Referenced by Run().
|
private |
Definition at line 490 of file chat_tui.cc.
References CreateTodoPopup(), screen_, todo_popup_component_, and todo_popup_visible_.
Referenced by Run().
|
private |
Definition at line 510 of file chat_tui.cc.
References yaze::cli::agent::TodoManager::GetAllTodos(), screen_, todo_manager_, todo_manager_ready_, and todo_popup_visible_.
Referenced by Run(), and ToggleTodoPopup().
|
private |
Definition at line 553 of file chat_tui.cc.
Referenced by Run(), and ToggleShortcutPalette().
|
private |
Definition at line 591 of file chat_tui.cc.
|
private |
Definition at line 500 of file chat_tui.cc.
References BuildShortcutPalette(), screen_, shortcut_palette_component_, and shortcut_palette_visible_.
Referenced by Run().
|
private |
Definition at line 49 of file chat_tui.h.
Referenced by CreateTodoPopup(), LaunchAgentPrompt(), OnSubmit(), Run(), ToggleShortcutPalette(), and ToggleTodoPopup().
|
private |
Definition at line 50 of file chat_tui.h.
Referenced by ChatTUI(), CurrentMetrics(), LaunchAgentPrompt(), OnSubmit(), Run(), and SetRomContext().
|
private |
Definition at line 51 of file chat_tui.h.
Referenced by ChatTUI(), and CreateTodoPopup().
|
private |
Definition at line 52 of file chat_tui.h.
Referenced by ChatTUI(), and SetRomContext().
|
private |
Definition at line 53 of file chat_tui.h.
Referenced by OnSubmit(), and Run().
|
private |
Definition at line 54 of file chat_tui.h.
Referenced by InitializeAutocomplete(), and Run().
|
private |
Definition at line 55 of file chat_tui.h.
Referenced by ChatTUI(), Run(), and SetRomContext().
|
private |
Definition at line 57 of file chat_tui.h.
Referenced by LaunchAgentPrompt(), and Run().
|
private |
Definition at line 58 of file chat_tui.h.
Referenced by LaunchAgentPrompt(), and StopSpinner().
|
private |
Definition at line 59 of file chat_tui.h.
Referenced by Run().
|
private |
Definition at line 61 of file chat_tui.h.
Referenced by CleanupWorkers(), and LaunchAgentPrompt().
|
mutableprivate |
Definition at line 62 of file chat_tui.h.
Referenced by CleanupWorkers(), and LaunchAgentPrompt().
|
private |
Definition at line 63 of file chat_tui.h.
Referenced by LaunchAgentPrompt().
|
private |
Definition at line 64 of file chat_tui.h.
Referenced by LaunchAgentPrompt(), and Run().
|
private |
Definition at line 65 of file chat_tui.h.
Referenced by LaunchAgentPrompt(), and Run().
|
private |
Definition at line 67 of file chat_tui.h.
|
private |
Definition at line 69 of file chat_tui.h.
Referenced by LaunchAgentPrompt(), and StopSpinner().
|
private |
Definition at line 72 of file chat_tui.h.
Referenced by CreateTodoPopup(), Run(), and ToggleTodoPopup().
|
private |
Definition at line 73 of file chat_tui.h.
Referenced by Run(), and ToggleTodoPopup().
|
private |
Definition at line 74 of file chat_tui.h.
Referenced by Run(), and ToggleShortcutPalette().
|
private |
Definition at line 75 of file chat_tui.h.
Referenced by Run(), and ToggleShortcutPalette().
|
private |
Definition at line 76 of file chat_tui.h.
Referenced by ChatTUI(), and CreateTodoPopup().