pub trait DynAgentSession: Send {
// Required methods
fn capabilities(&self) -> &InterventionCapabilities;
fn events(&mut self) -> BoxStream<'static, ActivityEvent>;
fn intervene<'life0, 'async_trait>(
&'life0 self,
cmd: InterventionCommand,
) -> Pin<Box<dyn Future<Output = Result<(), HarnessError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn wait_result<'async_trait>(
self: Box<Self>,
) -> Pin<Box<dyn Future<Output = Result<Payload, HarnessError>> + 'async_trait>>
where Self: 'async_trait;
}Expand description
An object-safe erased AgentSession, so a worker can drive a session behind a
Box<dyn ..> without being generic over the concrete harness.
It mirrors AgentSession exactly EXCEPT that the terminal Self::wait_result
takes self: Box<Self> (rather than self by value), which is what makes the
trait object-safe — an owned-self method is not dispatchable through dyn. A
blanket impl over every AgentSession means an integrator implements only the
ergonomic typed trait and gets the erased form for free.
The async methods are ?Send-dispatched. AgentSession is Send but not
Sync, so a &session cannot cross threads; the worker holds an erased session
inside ONE task and drives it (plus its event drain) there — never tokio::spawn-ing
a borrow of it — so requiring Sync would over-constrain every adapter for no gain.
Required Methods§
Sourcefn capabilities(&self) -> &InterventionCapabilities
fn capabilities(&self) -> &InterventionCapabilities
The negotiated capability set — see AgentSession::capabilities.
Sourcefn events(&mut self) -> BoxStream<'static, ActivityEvent>
fn events(&mut self) -> BoxStream<'static, ActivityEvent>
The neutral event stream OUT — see AgentSession::events.
Sourcefn intervene<'life0, 'async_trait>(
&'life0 self,
cmd: InterventionCommand,
) -> Pin<Box<dyn Future<Output = Result<(), HarnessError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn intervene<'life0, 'async_trait>(
&'life0 self,
cmd: InterventionCommand,
) -> Pin<Box<dyn Future<Output = Result<(), HarnessError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deliver a neutral command IN — see AgentSession::intervene.
§Errors
Propagates AgentSession::intervene’s errors unchanged.
Sourcefn wait_result<'async_trait>(
self: Box<Self>,
) -> Pin<Box<dyn Future<Output = Result<Payload, HarnessError>> + 'async_trait>>where
Self: 'async_trait,
fn wait_result<'async_trait>(
self: Box<Self>,
) -> Pin<Box<dyn Future<Output = Result<Payload, HarnessError>> + 'async_trait>>where
Self: 'async_trait,
Await the single terminal result — see AgentSession::wait_result. Takes
Box<Self> (not self) so the trait stays object-safe.
§Errors
Propagates AgentSession::wait_result’s errors unchanged.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".