(
session: &AgentSession,
prompt: &str,
history: Option<&[Message]>,
)
| 7 | use tokio::task::JoinHandle; |
| 8 | |
| 9 | pub(super) async fn dispatch_blocking( |
| 10 | session: &AgentSession, |
| 11 | prompt: &str, |
| 12 | history: Option<&[Message]>, |
| 13 | ) -> Result<Option<AgentResult>> { |
| 14 | if !CommandRegistry::is_command(prompt) { |
| 15 | return Ok(None); |
| 16 | } |
| 17 | |
| 18 | let ctx = build_command_context(session); |
| 19 | let output = session_commands::dispatch(session, prompt, &ctx); |
| 20 | let Some(output) = output else { |
| 21 | return Ok(None); |
| 22 | }; |
| 23 | |
| 24 | Ok(Some(command_result( |
| 25 | output.text, |
| 26 | command_messages(session, history), |
| 27 | crate::llm::TokenUsage::default(), |
| 28 | ))) |
| 29 | } |
| 30 | |
| 31 | fn command_messages(session: &AgentSession, history: Option<&[Message]>) -> Vec<Message> { |
| 32 | history |
no test coverage detected