pub struct TestPeer { /* private fields */ }Implementations§
Source§impl TestPeer
impl TestPeer
Sourcepub fn new() -> (Self, Builder<Client, impl HandleDispatchFrom<Agent>, NullRun>)
pub fn new() -> (Self, Builder<Client, impl HandleDispatchFrom<Agent>, NullRun>)
Build a TestPeer plus a pre-wired Client.builder() whose
notification handlers route session/mcp/elicitation traffic into the
peer. The caller decides whether to run the builder via connect_to
(drop the agent-side cx) or connect_with (capture the agent-side cx).
pub async fn next_session_notification(&mut self) -> SessionNotification
pub async fn next_mcp_notification(&mut self) -> McpNotification
pub async fn next_elicitation_request(&mut self) -> ElicitationParams
Sourcepub fn queue_elicitation_response(&self, response: ElicitationResponse)
pub fn queue_elicitation_response(&self, response: ElicitationResponse)
Queue a response the peer will hand back for the next incoming
elicitation request. If the queue is empty when a request arrives, the
peer responds with a protocol error, which exercises the
cancel_result() fallback path in the caller.
Sourcepub async fn fake_elicitation(
&mut self,
cx: &ConnectionTo<Client>,
) -> (Responder<ElicitationResponse>, Receiver<ElicitationResponse>)
pub async fn fake_elicitation( &mut self, cx: &ConnectionTo<Client>, ) -> (Responder<ElicitationResponse>, Receiver<ElicitationResponse>)
Kick off a placeholder elicitation request from the agent side of cx,
hand back the Responder<ElicitationResponse> captured on the client
side, and return a receiver that resolves when the responder is
consumed.
Use in tests that pass a Responder<ElicitationResponse> into code
under test and want to observe the response without driving a full ACP
round-trip themselves.