MCPcopy Create free account
hub / github.com/AI45Lab/Code / dispatch_blocking

Function dispatch_blocking

core/src/agent_api/command_runtime.rs:9–29  ·  view source on GitHub ↗
(
    session: &AgentSession,
    prompt: &str,
    history: Option<&[Message]>,
)

Source from the content-addressed store, hash-verified

7use tokio::task::JoinHandle;
8
9pub(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
31fn command_messages(session: &AgentSession, history: Option<&[Message]>) -> Vec<Message> {
32 history

Callers 1

sendFunction · 0.85

Calls 4

build_command_contextFunction · 0.85
dispatchFunction · 0.85
command_resultFunction · 0.85
command_messagesFunction · 0.85

Tested by

no test coverage detected