pub trait AcpProxyExt<OB: AsyncWrite, IB: AsyncRead, H: JsonRpcHandler> {
// Required methods
fn on_receive_request_from_successor<R, F>(
self,
op: F,
) -> JsonRpcConnection<OB, IB, ChainHandler<H, RequestFromSuccessorHandler<R, F>>>
where R: JsonRpcRequest,
F: AsyncFnMut(R, JsonRpcRequestCx<R::Response>) -> Result<(), Error>;
fn on_receive_notification_from_successor<N, F>(
self,
op: F,
) -> JsonRpcConnection<OB, IB, ChainHandler<H, NotificationFromSuccessorHandler<N, F>>>
where N: JsonRpcNotification,
F: AsyncFnMut(N, JsonRpcConnectionCx) -> Result<(), Error>;
fn proxy(self) -> JsonRpcConnection<OB, IB, ChainHandler<H, ProxyHandler>>;
fn provide_mcp(
self,
registry: impl AsRef<McpServiceRegistry>,
) -> JsonRpcConnection<OB, IB, ChainHandler<H, McpServiceRegistry>>;
}Required Methods§
Sourcefn on_receive_request_from_successor<R, F>(
self,
op: F,
) -> JsonRpcConnection<OB, IB, ChainHandler<H, RequestFromSuccessorHandler<R, F>>>
fn on_receive_request_from_successor<R, F>( self, op: F, ) -> JsonRpcConnection<OB, IB, ChainHandler<H, RequestFromSuccessorHandler<R, F>>>
Adds a handler for requests received from the successor component.
The provided handler will receive unwrapped ACP messages - the
_proxy/successor/receive/* protocol wrappers are handled automatically.
Your handler processes normal ACP requests and notifications as if it were
a regular ACP component.
§Example
JsonRpcConnection::new(tokio::io::stdin(), tokio::io::stdout())
.on_receive_from_successor(MyHandler)
.serve()
.await?;Sourcefn on_receive_notification_from_successor<N, F>(
self,
op: F,
) -> JsonRpcConnection<OB, IB, ChainHandler<H, NotificationFromSuccessorHandler<N, F>>>
fn on_receive_notification_from_successor<N, F>( self, op: F, ) -> JsonRpcConnection<OB, IB, ChainHandler<H, NotificationFromSuccessorHandler<N, F>>>
Adds a handler for messages received from the successor component.
The provided handler will receive unwrapped ACP messages - the
_proxy/successor/receive/* protocol wrappers are handled automatically.
Your handler processes normal ACP requests and notifications as if it were
a regular ACP component.
§Example
JsonRpcConnection::new(tokio::io::stdin(), tokio::io::stdout())
.on_receive_from_successor(MyHandler)
.serve()
.await?;Sourcefn proxy(self) -> JsonRpcConnection<OB, IB, ChainHandler<H, ProxyHandler>>
fn proxy(self) -> JsonRpcConnection<OB, IB, ChainHandler<H, ProxyHandler>>
Installs a proxy layer that proxies all requests/notifications to/from the successor. This is typically the last component in the chain.
Sourcefn provide_mcp(
self,
registry: impl AsRef<McpServiceRegistry>,
) -> JsonRpcConnection<OB, IB, ChainHandler<H, McpServiceRegistry>>
fn provide_mcp( self, registry: impl AsRef<McpServiceRegistry>, ) -> JsonRpcConnection<OB, IB, ChainHandler<H, McpServiceRegistry>>
Provide MCP servers to downstream successors.
This layer will modify session/new requests to include those MCP servers
(unless you intercept them earlier).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.