#include <conversational_agent_service.h>
Classes | |
| struct | InternalMetrics |
Public Types | |
| using | ExternalDriverCallback |
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 |
| absl::Status | ConfigureProvider (const AIServiceConfig &config) |
| const AIServiceConfig & | provider_config () const |
| void | SetToolPreferences (const ToolDispatcher::ToolPreferences &prefs) |
| ChatMessage::SessionMetrics | GetMetrics () const |
| void | ReplaceHistory (std::vector< ChatMessage > history) |
| void | SetExternalDriver (ExternalDriverCallback driver) |
| void | HandleExternalResponse (const AgentResponse &response) |
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_ |
| ToolDispatcher::ToolPreferences | tool_preferences_ |
| AIServiceConfig | provider_config_ |
| Rom * | rom_context_ = nullptr |
| AgentConfig | config_ |
| InternalMetrics | metrics_ |
| bool | has_external_driver_ = false |
| ExternalDriverCallback | external_driver_ |
Definition at line 94 of file conversational_agent_service.h.
Definition at line 123 of file conversational_agent_service.h.
| yaze::cli::agent::ConversationalAgentService::ConversationalAgentService | ( | ) |
Definition at line 189 of file conversational_agent_service.cc.
References ai_service_, config_, yaze::cli::AIServiceConfig::provider, provider_config_, yaze::cli::agent::ToolDispatcher::SetToolPreferences(), tool_dispatcher_, tool_preferences_, and yaze::cli::agent::AgentConfig::verbose.

|
explicit |
Definition at line 213 of file conversational_agent_service.cc.
References ai_service_, config_, yaze::cli::AIServiceConfig::provider, provider_config_, yaze::cli::agent::ToolDispatcher::SetToolPreferences(), tool_dispatcher_, tool_preferences_, and yaze::cli::agent::AgentConfig::verbose.

| absl::StatusOr< ChatMessage > yaze::cli::agent::ConversationalAgentService::SendMessage | ( | const std::string & | message | ) |
Definition at line 439 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, external_driver_, has_external_driver_, 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::ChatMessage::ModelMetadata::latency_seconds, yaze::cli::agent::AgentConfig::max_tool_iterations, yaze::cli::agent::ChatMessage::metrics, metrics_, yaze::cli::agent::ChatMessage::ModelMetadata::model, yaze::cli::AIServiceConfig::model, yaze::cli::agent::ChatMessage::model_metadata, yaze::cli::agent::ChatMessage::ModelMetadata::parameters, 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::ChatMessage::ModelMetadata::provider, yaze::cli::AIServiceConfig::provider, provider_config_, 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::ChatMessage::ModelMetadata::tool_iterations, yaze::cli::agent::ChatMessage::ModelMetadata::tool_names, yaze::cli::agent::ConversationalAgentService::InternalMetrics::total_latency, TrimHistoryIfNeeded(), yaze::cli::agent::ConversationalAgentService::InternalMetrics::turns_completed, yaze::cli::agent::ConversationalAgentService::InternalMetrics::user_messages, yaze::cli::agent::AgentConfig::verbose, and yaze::cli::agent::ChatMessage::warnings.
Referenced by yaze::cli::tui::ChatTUI::LaunchAgentPrompt(), yaze::cli::tui::ChatTUI::OnSubmit(), yaze::cli::EnhancedChatComponent::ProcessMessage(), 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::AgentChat::SendMessage().
| const std::vector< ChatMessage > & yaze::cli::agent::ConversationalAgentService::GetHistory | ( | ) | const |
Definition at line 755 of file conversational_agent_service.cc.
References history_.
Referenced by yaze::cli::agent::SimpleChatSession::GetHistory(), yaze::editor::AgentChat::RenderHistory(), yaze::cli::tui::ChatTUI::Run(), yaze::cli::agent::anonymous_namespace{conversation_test.cc}::RunTestCase(), and yaze::editor::AgentChat::SaveHistory().
| void yaze::cli::agent::ConversationalAgentService::SetRomContext | ( | Rom * | rom | ) |
Definition at line 238 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(), yaze::cli::agent::SimpleChatSession::SetRomContext(), yaze::cli::tui::ChatTUI::SetRomContext(), and yaze::cli::EnhancedChatComponent::SetRomContext().

| void yaze::cli::agent::ConversationalAgentService::ResetConversation | ( | ) |
Definition at line 247 of file conversational_agent_service.cc.
References history_, and metrics_.
Referenced by yaze::editor::AgentChat::ClearHistory(), yaze::cli::tui::ChatTUI::OnSubmit(), yaze::cli::agent::SimpleChatSession::Reset(), yaze::cli::EnhancedChatComponent::ResetConversation(), and yaze::cli::agent::anonymous_namespace{conversation_test.cc}::RunTestCase().
|
inline |
Definition at line 112 of file conversational_agent_service.h.
References config_.
Referenced by yaze::cli::agent::SimpleChatSession::SetConfig().
|
inline |
Definition at line 113 of file conversational_agent_service.h.
References config_.
| absl::Status yaze::cli::agent::ConversationalAgentService::ConfigureProvider | ( | const AIServiceConfig & | config | ) |
Definition at line 725 of file conversational_agent_service.cc.
References ai_service_, yaze::cli::CreateAIServiceStrict(), yaze::cli::AIServiceConfig::provider, provider_config_, and rom_context_.

|
inline |
Definition at line 115 of file conversational_agent_service.h.
References provider_config_.
| void yaze::cli::agent::ConversationalAgentService::SetToolPreferences | ( | const ToolDispatcher::ToolPreferences & | prefs | ) |
Definition at line 749 of file conversational_agent_service.cc.
References yaze::cli::agent::ToolDispatcher::SetToolPreferences(), tool_dispatcher_, and tool_preferences_.

| ChatMessage::SessionMetrics yaze::cli::agent::ConversationalAgentService::GetMetrics | ( | ) | const |
Definition at line 281 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 759 of file conversational_agent_service.cc.
References history_, RebuildMetricsFromHistory(), and TrimHistoryIfNeeded().

| void yaze::cli::agent::ConversationalAgentService::SetExternalDriver | ( | ExternalDriverCallback | driver | ) |
Definition at line 285 of file conversational_agent_service.cc.
References external_driver_, and has_external_driver_.
| void yaze::cli::agent::ConversationalAgentService::HandleExternalResponse | ( | const AgentResponse & | response | ) |
Definition at line 290 of file conversational_agent_service.cc.
References yaze::cli::agent::ConversationalAgentService::InternalMetrics::agent_messages, yaze::cli::agent::ProposalCreationRequest::ai_provider, yaze::cli::agent::ChatMessage::ProposalSummary::change_count, yaze::cli::AgentResponse::commands, yaze::cli::agent::ConversationalAgentService::InternalMetrics::commands_generated, yaze::cli::agent::CreateProposalFromAgentResponse(), yaze::cli::agent::ToolDispatcher::Dispatch(), yaze::cli::agent::ChatMessage::ProposalSummary::executed_commands, external_driver_, has_external_driver_, history_, yaze::cli::agent::ChatMessage::ProposalSummary::id, yaze::Rom::is_loaded(), yaze::cli::agent::ChatMessage::kAgent, yaze::cli::agent::ChatMessage::kUser, metrics_, yaze::cli::agent::ChatMessage::ModelMetadata::model, yaze::cli::agent::ChatMessage::model_metadata, yaze::cli::util::PrintError(), yaze::cli::util::PrintSuccess(), yaze::cli::util::PrintToolCall(), yaze::cli::agent::ProposalCreationRequest::prompt, yaze::cli::agent::ChatMessage::proposal, yaze::cli::agent::ConversationalAgentService::InternalMetrics::proposals_created, yaze::cli::agent::ChatMessage::ModelMetadata::provider, yaze::cli::AgentResponse::reasoning, yaze::cli::agent::ProposalCreationRequest::response, yaze::cli::agent::ProposalCreationRequest::rom, rom_context_, yaze::cli::agent::ProposalCreationRequest::sandbox_label, yaze::cli::AgentResponse::text_response, yaze::cli::agent::ConversationalAgentService::InternalMetrics::tool_calls, yaze::cli::AgentResponse::tool_calls, tool_dispatcher_, yaze::cli::agent::ChatMessage::ModelMetadata::tool_names, TrimHistoryIfNeeded(), and yaze::cli::agent::ConversationalAgentService::InternalMetrics::turns_completed.
|
private |
Definition at line 252 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 HandleExternalResponse(), ReplaceHistory(), and SendMessage().
|
private |
Definition at line 262 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 766 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 165 of file conversational_agent_service.h.
Referenced by GetHistory(), HandleExternalResponse(), RebuildMetricsFromHistory(), ReplaceHistory(), ResetConversation(), SendMessage(), and TrimHistoryIfNeeded().
|
private |
Definition at line 166 of file conversational_agent_service.h.
Referenced by ConfigureProvider(), ConversationalAgentService(), ConversationalAgentService(), SendMessage(), and SetRomContext().
|
private |
Definition at line 167 of file conversational_agent_service.h.
Referenced by ConversationalAgentService(), ConversationalAgentService(), HandleExternalResponse(), SendMessage(), SetRomContext(), and SetToolPreferences().
|
private |
Definition at line 168 of file conversational_agent_service.h.
Referenced by ConversationalAgentService(), ConversationalAgentService(), and SetToolPreferences().
|
private |
Definition at line 169 of file conversational_agent_service.h.
Referenced by ConfigureProvider(), ConversationalAgentService(), ConversationalAgentService(), provider_config(), and SendMessage().
|
private |
Definition at line 170 of file conversational_agent_service.h.
Referenced by ConfigureProvider(), HandleExternalResponse(), SendMessage(), and SetRomContext().
|
private |
Definition at line 171 of file conversational_agent_service.h.
Referenced by ConversationalAgentService(), ConversationalAgentService(), GetConfig(), SendMessage(), SetConfig(), and TrimHistoryIfNeeded().
|
private |
Definition at line 172 of file conversational_agent_service.h.
Referenced by BuildMetricsSnapshot(), HandleExternalResponse(), RebuildMetricsFromHistory(), ResetConversation(), and SendMessage().
|
private |
Definition at line 175 of file conversational_agent_service.h.
Referenced by HandleExternalResponse(), SendMessage(), and SetExternalDriver().
|
private |
Definition at line 176 of file conversational_agent_service.h.
Referenced by HandleExternalResponse(), SendMessage(), and SetExternalDriver().