(
&mut self,
os: &mut Os,
agent_name: &str,
agent_description: &str,
selected_servers: &str,
schema: &str,
is_global: bool,
request_meta
| 1819 | |
| 1820 | #[allow(clippy::too_many_arguments)] |
| 1821 | async fn generate_agent_config_impl( |
| 1822 | &mut self, |
| 1823 | os: &mut Os, |
| 1824 | agent_name: &str, |
| 1825 | agent_description: &str, |
| 1826 | selected_servers: &str, |
| 1827 | schema: &str, |
| 1828 | is_global: bool, |
| 1829 | request_metadata_lock: Arc<Mutex<Option<RequestMetadata>>>, |
| 1830 | ) -> Result<ChatState, ChatError> { |
| 1831 | debug!(?agent_name, ?agent_description, "generating agent config"); |
| 1832 | |
| 1833 | if agent_name.trim().is_empty() || agent_description.trim().is_empty() { |
| 1834 | execute!( |
| 1835 | self.stderr, |
| 1836 | StyledText::warning_fg(), |
| 1837 | style::Print("\nAgent name and description cannot be empty.\n\n"), |
| 1838 | StyledText::reset(), |
| 1839 | )?; |
| 1840 | |
| 1841 | return Ok(ChatState::PromptUser { |
| 1842 | skip_printing_tools: true, |
| 1843 | }); |
| 1844 | } |
| 1845 | |
| 1846 | let prepopulated_agent = Agent { |
| 1847 | name: agent_name.to_string(), |
| 1848 | description: Some(agent_description.to_string()), |
| 1849 | ..Default::default() |
| 1850 | }; |
| 1851 | let prepopulated_content = prepopulated_agent |
| 1852 | .to_str_pretty() |
| 1853 | .map_err(|e| ChatError::Custom(format!("Error prepopulating agent fields: {}", e).into()))?; |
| 1854 | |
| 1855 | // Create the agent generation request - this now works! |
| 1856 | let generation_state = self |
| 1857 | .conversation |
| 1858 | .create_agent_generation_request( |
| 1859 | agent_name, |
| 1860 | agent_description, |
| 1861 | selected_servers, |
| 1862 | schema, |
| 1863 | prepopulated_content.as_str(), |
| 1864 | ) |
| 1865 | .await?; |
| 1866 | |
| 1867 | if self.interactive { |
| 1868 | execute!(self.stderr, cursor::Hide, style::Print("\n"))?; |
| 1869 | self.spinner = Some(Spinner::new( |
| 1870 | Spinners::Dots, |
| 1871 | format!("Generating agent config for '{}'...", agent_name), |
| 1872 | )); |
| 1873 | } |
| 1874 | |
| 1875 | let mut response = match self |
| 1876 | .send_message( |
| 1877 | os, |
| 1878 | generation_state, |
nothing calls this directly
no test coverage detected