pub struct OutboundRun { /* private fields */ }Expand description
A scoped handle for one logical outbound run.
All messages sent through this handle carry the same run_id, which lets the
peer group them as one run. The run boundary is defined by the caller — this
SDK never infers it.
Obtain one from crate::MessageContext::run or crate::WeixinClient::run.
§Ordering
Each send is one HTTP request. Awaiting calls in sequence guarantees the peer observes them in that order. If you spawn sends concurrently, ordering is yours to manage.
§Observed behaviour
Verified against the production API on 2026-08-13: the server accepts
tool-call progress items (HTTP 200) but answers with an empty body and
allocates no message_id, whereas any message carrying a text item does get
one — the server does not treat progress items as conversation messages, and
the WeChat client does not render them. Five wire variants were tried
(GENERATING state, progress merged into a text item_list, added
msg_id/update_time_ms, dropped run_id/context_token) with no change,
and getConfig exposes no capability flag. This reads as a capability iLink
has reserved but not yet enabled.
run_id was likewise not observed to affect client-side presentation; treat
it as a server-side correlation field. The value of both features today is
protocol readiness, not a user-visible progress display.
§Example
let run = ctx.run();
run.tool_call_start("bash", Some("call-1")).await?;
// ... execute the tool ...
run.tool_call_result("bash", Some("call-1"), ToolCallStatus::Completed)
.await?;
run.send_text("done").await?;Implementations§
Source§impl OutboundRun
impl OutboundRun
Sourcepub fn with_run_id(self, run_id: impl Into<String>) -> Self
pub fn with_run_id(self, run_id: impl Into<String>) -> Self
Override the auto-generated run ID (e.g. to reuse a caller-side run identifier).
Sourcepub async fn send_text(&self, text: &str) -> Result<SendResult>
pub async fn send_text(&self, text: &str) -> Result<SendResult>
Send text (markdown filter applies per config, same as reply_text).
Sourcepub async fn send_media(&self, file_path: &Path) -> Result<SendResult>
pub async fn send_media(&self, file_path: &Path) -> Result<SendResult>
Upload and send a media file.
Sourcepub async fn tool_call_start(
&self,
tool_name: &str,
tool_call_id: Option<&str>,
) -> Result<SendResult>
pub async fn tool_call_start( &self, tool_name: &str, tool_call_id: Option<&str>, ) -> Result<SendResult>
Announce that a tool call started.
tool_call_id pairs this event with the matching
Self::tool_call_result; provide one whenever the peer may see
overlapping calls.
Sourcepub async fn tool_call_result(
&self,
tool_name: &str,
tool_call_id: Option<&str>,
status: ToolCallStatus,
) -> Result<SendResult>
pub async fn tool_call_result( &self, tool_name: &str, tool_call_id: Option<&str>, status: ToolCallStatus, ) -> Result<SendResult>
Announce that a tool call finished.