(
session: Arc<RustAgentSession>,
prompt: String,
history: Option<Vec<RustMessage>>,
attachments: Vec<a3s_code_core::llm::Attachment>,
)
| 843 | } |
| 844 | |
| 845 | async fn send_session_request( |
| 846 | session: Arc<RustAgentSession>, |
| 847 | prompt: String, |
| 848 | history: Option<Vec<RustMessage>>, |
| 849 | attachments: Vec<a3s_code_core::llm::Attachment>, |
| 850 | ) -> napi::Result<AgentResult> { |
| 851 | let result = if attachments.is_empty() { |
| 852 | get_runtime() |
| 853 | .spawn(async move { session.send(&prompt, history.as_deref()).await }) |
| 854 | .await |
| 855 | .map_err(|e| napi::Error::from_reason(format!("Task join error: {e}")))? |
| 856 | } else { |
| 857 | get_runtime() |
| 858 | .spawn(async move { |
| 859 | session |
| 860 | .send_with_attachments(&prompt, &attachments, history.as_deref()) |
| 861 | .await |
| 862 | }) |
| 863 | .await |
| 864 | .map_err(|e| napi::Error::from_reason(format!("Task join error: {e}")))? |
| 865 | } |
| 866 | .map_err(|e| napi::Error::from_reason(format!("Agent execution failed: {e}")))?; |
| 867 | |
| 868 | Ok(AgentResult::from(result)) |
| 869 | } |
| 870 | |
| 871 | async fn stream_session_request( |
| 872 | session: Arc<RustAgentSession>, |
no test coverage detected