MCPcopy Index your code
hub / github.com/AI45Lab/Code / send_session_request

Function send_session_request

sdk/node/src/lib.rs:845–869  ·  view source on GitHub ↗
(
    session: Arc<RustAgentSession>,
    prompt: String,
    history: Option<Vec<RustMessage>>,
    attachments: Vec<a3s_code_core::llm::Attachment>,
)

Source from the content-addressed store, hash-verified

843}
844
845async 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
871async fn stream_session_request(
872 session: Arc<RustAgentSession>,

Callers 3

sendMethod · 0.85
runMethod · 0.85
send_requestMethod · 0.85

Calls 5

get_runtimeFunction · 0.70
is_emptyMethod · 0.45
spawnMethod · 0.45
sendMethod · 0.45
send_with_attachmentsMethod · 0.45

Tested by

no test coverage detected