#include <conversational_agent_service.h>
Classes | |
struct | InternalMetrics |
Public Member Functions | |
ConversationalAgentService () | |
ConversationalAgentService (const AgentConfig &config) | |
absl::StatusOr< ChatMessage > | SendMessage (const std::string &message) |
const std::vector< ChatMessage > & | GetHistory () const |
void | SetRomContext (Rom *rom) |
void | ResetConversation () |
void | SetConfig (const AgentConfig &config) |
const AgentConfig & | GetConfig () const |
ChatMessage::SessionMetrics | GetMetrics () const |
void | ReplaceHistory (std::vector< ChatMessage > history) |
Private Member Functions | |
void | TrimHistoryIfNeeded () |
ChatMessage::SessionMetrics | BuildMetricsSnapshot () const |
void | RebuildMetricsFromHistory () |
Private Attributes | |
std::vector< ChatMessage > | history_ |
std::unique_ptr< AIService > | ai_service_ |
ToolDispatcher | tool_dispatcher_ |
Rom * | rom_context_ = nullptr |
AgentConfig | config_ |
InternalMetrics | metrics_ |
Definition at line 74 of file conversational_agent_service.h.
yaze::cli::agent::ConversationalAgentService::ConversationalAgentService | ( | ) |
Definition at line 175 of file conversational_agent_service.cc.
References ai_service_, and yaze::cli::CreateAIService().
|
explicit |
Definition at line 179 of file conversational_agent_service.cc.
References ai_service_, and yaze::cli::CreateAIService().
absl::StatusOr< ChatMessage > yaze::cli::agent::ConversationalAgentService::SendMessage | ( | const std::string & | message | ) |
Definition at line 229 of file conversational_agent_service.cc.
References yaze::cli::agent::ConversationalAgentService::InternalMetrics::agent_messages, yaze::cli::agent::ProposalCreationRequest::ai_provider, ai_service_, BuildMetricsSnapshot(), yaze::cli::agent::ChatMessage::ProposalSummary::change_count, yaze::cli::agent::ConversationalAgentService::InternalMetrics::commands_generated, config_, yaze::cli::agent::CreateProposalFromAgentResponse(), yaze::cli::agent::ToolDispatcher::Dispatch(), yaze::cli::agent::ChatMessage::ProposalSummary::executed_commands, history_, yaze::cli::agent::ChatMessage::ProposalSummary::id, yaze::Rom::is_loaded(), yaze::cli::agent::ChatMessage::kAgent, yaze::cli::util::colors::kCyan, yaze::cli::util::colors::kDim, yaze::cli::util::colors::kReset, yaze::cli::agent::ChatMessage::kUser, yaze::cli::util::colors::kYellow, yaze::cli::agent::AgentConfig::max_tool_iterations, yaze::cli::agent::ChatMessage::metrics, metrics_, yaze::cli::util::PrintError(), yaze::cli::util::PrintInfo(), yaze::cli::util::PrintSeparator(), yaze::cli::util::PrintSuccess(), yaze::cli::util::PrintToolCall(), yaze::cli::util::PrintWarning(), yaze::cli::agent::ProposalCreationRequest::prompt, yaze::cli::agent::ChatMessage::proposal, yaze::cli::agent::ChatMessage::ProposalSummary::proposal_json_path, yaze::cli::agent::ConversationalAgentService::InternalMetrics::proposals_created, yaze::cli::agent::ProposalCreationRequest::response, yaze::cli::agent::ProposalCreationRequest::rom, rom_context_, yaze::cli::agent::ProposalCreationRequest::sandbox_label, yaze::cli::agent::ChatMessage::ProposalSummary::sandbox_rom_path, yaze::cli::agent::AgentConfig::show_reasoning, yaze::cli::util::LoadingIndicator::Start(), yaze::cli::util::LoadingIndicator::Stop(), yaze::cli::agent::ConversationalAgentService::InternalMetrics::tool_calls, tool_dispatcher_, yaze::cli::agent::ConversationalAgentService::InternalMetrics::total_latency, TrimHistoryIfNeeded(), yaze::cli::agent::ConversationalAgentService::InternalMetrics::turns_completed, yaze::cli::agent::ConversationalAgentService::InternalMetrics::user_messages, and yaze::cli::agent::AgentConfig::verbose.
Referenced by yaze::cli::tui::ChatTUI::LaunchAgentPrompt(), yaze::cli::tui::ChatTUI::OnSubmit(), yaze::cli::EnhancedChatComponent::ProcessMessage(), yaze::editor::AgentChatWidget::RenderInputBox(), yaze::cli::agent::SimpleChatSession::RunBatch(), yaze::cli::agent::SimpleChatSession::RunInteractive(), yaze::cli::agent::anonymous_namespace{conversation_test.cc}::RunTestCase(), yaze::cli::agent::SimpleChatSession::SendAndWaitForResponse(), and yaze::editor::AgentChatWidget::SetChatHistoryPopup().
const std::vector< ChatMessage > & yaze::cli::agent::ConversationalAgentService::GetHistory | ( | ) | const |
Definition at line 474 of file conversational_agent_service.cc.
References history_.
Referenced by yaze::editor::AgentChatWidget::CountKnownProposals(), yaze::editor::AgentChatWidget::EnsureHistoryLoaded(), yaze::cli::agent::SimpleChatSession::GetHistory(), yaze::editor::AgentChatWidget::PersistHistory(), yaze::editor::AgentChatWidget::RenderHistory(), yaze::cli::tui::ChatTUI::Run(), yaze::cli::agent::anonymous_namespace{conversation_test.cc}::RunTestCase(), yaze::editor::AgentChatWidget::SwitchToSharedHistory(), and yaze::editor::AgentChatWidget::SyncHistoryToPopup().
void yaze::cli::agent::ConversationalAgentService::SetRomContext | ( | Rom * | rom | ) |
Definition at line 184 of file conversational_agent_service.cc.
References ai_service_, rom_context_, yaze::cli::agent::ToolDispatcher::SetRomContext(), and tool_dispatcher_.
Referenced by yaze::cli::tui::ChatTUI::ChatTUI(), yaze::cli::EnhancedChatComponent::EnhancedChatComponent(), yaze::cli::agent::HandleTestConversationCommand(), main(), yaze::editor::AgentChatWidget::SetRomContext(), yaze::cli::agent::SimpleChatSession::SetRomContext(), yaze::cli::tui::ChatTUI::SetRomContext(), and yaze::cli::EnhancedChatComponent::SetRomContext().
void yaze::cli::agent::ConversationalAgentService::ResetConversation | ( | ) |
Definition at line 193 of file conversational_agent_service.cc.
References history_, and metrics_.
Referenced by yaze::editor::AgentChatWidget::Draw(), yaze::cli::tui::ChatTUI::OnSubmit(), yaze::editor::AgentChatWidget::RenderInputBox(), yaze::cli::agent::SimpleChatSession::Reset(), yaze::cli::EnhancedChatComponent::ResetConversation(), and yaze::cli::agent::anonymous_namespace{conversation_test.cc}::RunTestCase().
|
inline |
Definition at line 92 of file conversational_agent_service.h.
References config_.
Referenced by yaze::cli::agent::SimpleChatSession::SetConfig(), and yaze::editor::AgentChatWidget::UpdateAgentConfig().
|
inline |
Definition at line 93 of file conversational_agent_service.h.
References config_.
ChatMessage::SessionMetrics yaze::cli::agent::ConversationalAgentService::GetMetrics | ( | ) | const |
Definition at line 225 of file conversational_agent_service.cc.
References BuildMetricsSnapshot().
Referenced by yaze::cli::tui::ChatTUI::CurrentMetrics(), yaze::cli::tui::ChatTUI::OnSubmit(), yaze::cli::agent::SimpleChatSession::RunBatch(), and yaze::cli::agent::SimpleChatSession::RunInteractive().
void yaze::cli::agent::ConversationalAgentService::ReplaceHistory | ( | std::vector< ChatMessage > | history | ) |
Definition at line 478 of file conversational_agent_service.cc.
References history_, RebuildMetricsFromHistory(), and TrimHistoryIfNeeded().
Referenced by yaze::editor::AgentChatWidget::EnsureHistoryLoaded(), and yaze::editor::AgentChatWidget::PollSharedHistory().
|
private |
Definition at line 198 of file conversational_agent_service.cc.
References config_, history_, yaze::cli::agent::AgentConfig::max_history_messages, and yaze::cli::agent::AgentConfig::trim_history.
Referenced by ReplaceHistory(), and SendMessage().
|
private |
Definition at line 208 of file conversational_agent_service.cc.
References yaze::cli::agent::ConversationalAgentService::InternalMetrics::agent_messages, yaze::cli::agent::ChatMessage::SessionMetrics::average_latency_seconds, yaze::cli::agent::ConversationalAgentService::InternalMetrics::commands_generated, metrics_, yaze::cli::agent::ConversationalAgentService::InternalMetrics::proposals_created, yaze::cli::agent::ConversationalAgentService::InternalMetrics::tool_calls, yaze::cli::agent::ChatMessage::SessionMetrics::total_agent_messages, yaze::cli::agent::ChatMessage::SessionMetrics::total_commands, yaze::cli::agent::ChatMessage::SessionMetrics::total_elapsed_seconds, yaze::cli::agent::ConversationalAgentService::InternalMetrics::total_latency, yaze::cli::agent::ChatMessage::SessionMetrics::total_proposals, yaze::cli::agent::ChatMessage::SessionMetrics::total_tool_calls, yaze::cli::agent::ChatMessage::SessionMetrics::total_user_messages, yaze::cli::agent::ChatMessage::SessionMetrics::turn_index, yaze::cli::agent::ConversationalAgentService::InternalMetrics::turns_completed, and yaze::cli::agent::ConversationalAgentService::InternalMetrics::user_messages.
Referenced by GetMetrics(), and SendMessage().
|
private |
Definition at line 485 of file conversational_agent_service.cc.
References yaze::cli::agent::ConversationalAgentService::InternalMetrics::agent_messages, yaze::cli::agent::ConversationalAgentService::InternalMetrics::commands_generated, history_, yaze::cli::agent::ChatMessage::kAgent, yaze::cli::agent::ChatMessage::kUser, metrics_, yaze::cli::agent::ConversationalAgentService::InternalMetrics::proposals_created, yaze::cli::agent::ConversationalAgentService::InternalMetrics::tool_calls, yaze::cli::agent::ConversationalAgentService::InternalMetrics::total_latency, yaze::cli::agent::ConversationalAgentService::InternalMetrics::turns_completed, and yaze::cli::agent::ConversationalAgentService::InternalMetrics::user_messages.
Referenced by ReplaceHistory().
|
private |
Definition at line 114 of file conversational_agent_service.h.
Referenced by GetHistory(), RebuildMetricsFromHistory(), ReplaceHistory(), ResetConversation(), SendMessage(), and TrimHistoryIfNeeded().
|
private |
Definition at line 115 of file conversational_agent_service.h.
Referenced by ConversationalAgentService(), ConversationalAgentService(), SendMessage(), and SetRomContext().
|
private |
Definition at line 116 of file conversational_agent_service.h.
Referenced by SendMessage(), and SetRomContext().
|
private |
Definition at line 117 of file conversational_agent_service.h.
Referenced by SendMessage(), and SetRomContext().
|
private |
Definition at line 118 of file conversational_agent_service.h.
Referenced by GetConfig(), SendMessage(), SetConfig(), and TrimHistoryIfNeeded().
|
private |
Definition at line 119 of file conversational_agent_service.h.
Referenced by BuildMetricsSnapshot(), RebuildMetricsFromHistory(), ResetConversation(), and SendMessage().