pub struct RunControl { /* private fields */ }Expand description
A cloneable route for sending input to a live Run.
Keep this beside the task that drains Run::recv. A delivery receipt may
arrive after a burst of agent events, so awaiting Self::send on the same
task that owns the mutable Run can apply backpressure to the event stream
and prevent the receipt itself from being read. A separate control handle
lets both directions make progress concurrently.
Implementations§
Source§impl RunControl
impl RunControl
Sourcepub async fn send(&self, message: &str) -> Result<()>
pub async fn send(&self, message: &str) -> Result<()>
Send another message while the agent is still working.
The future resolves only after the transport accepts the message. It is
safe to await from a separate task while the owner continues draining
Run::recv.
§Errors
Returns Error::Unsupported when the run is not interactive, or
Error::Cancelled when the run finishes before delivery is confirmed.
Returns Error::ControlTimeout when the live transport stops
acknowledging input. The caller should stop that run before retrying on
a resumed session.
Sourcepub async fn respond(&self, id: &str, decision: &Decision) -> Result<()>
pub async fn respond(&self, id: &str, decision: &Decision) -> Result<()>
Answer an Event::ApprovalRequest without borrowing the event stream.
§Errors
Returns Error::Unsupported when the run does not accept approvals,
or Error::Cancelled when the run finishes before the response is sent.
Trait Implementations§
Source§impl Clone for RunControl
impl Clone for RunControl
Source§fn clone(&self) -> RunControl
fn clone(&self) -> RunControl
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more