(message: Option<String>)
| 73 | } |
| 74 | |
| 75 | fn resolve_exec_message(message: Option<String>) -> Result<String> { |
| 76 | let mut combined = message.unwrap_or_default(); |
| 77 | if !std::io::stdin().is_terminal() { |
| 78 | use std::io::Read; |
| 79 | let mut stdin_content = String::new(); |
| 80 | std::io::stdin().read_to_string(&mut stdin_content)?; |
| 81 | let stdin_content = stdin_content.trim_end().to_string(); |
| 82 | if !stdin_content.is_empty() { |
| 83 | if combined.is_empty() { |
| 84 | combined = stdin_content; |
| 85 | } else { |
| 86 | combined.push('\n'); |
| 87 | combined.push_str(&stdin_content); |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | let message = combined.trim().to_string(); |
| 93 | if message.is_empty() { |
| 94 | anyhow::bail!("Prompt cannot be empty"); |
| 95 | } |
| 96 | |
| 97 | Ok(message) |
| 98 | } |
| 99 | |
| 100 | pub async fn handle_session_action(action: SessionAction) -> Result<Option<String>> { |
| 101 | let agentic_system = crate::agent::agentic_system::init_agentic_system_for_cli().await?; |
no test coverage detected