pub struct Client;Expand description
The client role - typically an IDE or CLI that controls an agent.
Clients send prompts and receive responses from agents.
Implementations§
Source§impl Client
impl Client
Sourcepub fn v1(self) -> Builder<Client>
pub fn v1(self) -> Builder<Client>
Create a client builder that uses the ACP protocol v1 API.
Callbacks receive a v1::ConnectionTo and
typed handlers receive v1 request handles. With the
unstable_protocol_v2 feature, use Client::v2 for a protocol v2
client, or Client::protocol_connector to support both.
Sourcepub fn v2(self) -> Builder<Client>
Available on crate feature unstable_protocol_v2 only.
pub fn v2(self) -> Builder<Client>
unstable_protocol_v2 only.Create a client builder that requires an ACP protocol v2 agent.
Initialize the connection with
v2::ConnectionTo::send_initialize.
If the agent selects v1, it resolves to
InitializeOutcome::LowerVersion
rather than an error, and the connection stays uninitialized: fall back
to a v1 client implementation if that is acceptable. A plain
send_request of a v2 InitializeRequest resolves with an error
instead. To let the SDK do the fallback, use
Client::protocol_connector.
Requires the unstable_protocol_v2 crate feature.
Sourcepub fn protocol_connector(self) -> ClientProtocolConnector
Available on crate feature unstable_protocol_v2 only.
pub fn protocol_connector(self) -> ClientProtocolConnector
unstable_protocol_v2 only.Create a connector that chooses between configured protocol implementations.
Add implementation factories with ClientProtocolConnector::with_v1
and ClientProtocolConnector::with_v2. The resulting connector starts
the highest configured protocol implementation. If a v2 implementation
successfully negotiates v1 and a v1 implementation is configured, the
connector reuses the connection only when the v1 implementation’s
complete initialize parameters match what the agent already saw;
otherwise it opens a fresh agent connection and restarts with v1.
Requires the unstable_protocol_v2 crate feature while protocol v2
stabilizes.
Trait Implementations§
Source§impl ConnectTo<Client> for AgentProtocolRouter
Available on crate feature unstable_protocol_v2 only.
impl ConnectTo<Client> for AgentProtocolRouter
unstable_protocol_v2 only.Source§async fn connect_to(self, client: impl ConnectTo<Agent>) -> Result<(), Error>
async fn connect_to(self, client: impl ConnectTo<Agent>) -> Result<(), Error>
Source§fn into_channel_and_future(self) -> (Channel, Option<ConnectionDriver>)where
Self: Sized,
fn into_channel_and_future(self) -> (Channel, Option<ConnectionDriver>)where
Self: Sized,
impl Copy for Client
impl Eq for Client
Source§impl HasPeer<Client> for Client
impl HasPeer<Client> for Client
Source§fn remote_style(&self, _peer: Client) -> RemoteStyle
fn remote_style(&self, _peer: Client) -> RemoteStyle
Source§impl HasPeer<Client> for Conductor
impl HasPeer<Client> for Conductor
Source§fn remote_style(&self, _peer: Client) -> RemoteStyle
fn remote_style(&self, _peer: Client) -> RemoteStyle
Source§impl Ord for Client
impl Ord for Client
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Client
impl PartialOrd for Client
Source§impl Role for Client
impl Role for Client
Source§fn default_handle_dispatch_from(
&self,
message: Dispatch,
connection: ConnectionTo<Client>,
) -> impl Future<Output = Result<Handled<Dispatch>, Error>> + Send
fn default_handle_dispatch_from( &self, message: Dispatch, connection: ConnectionTo<Client>, ) -> impl Future<Output = Result<Handled<Dispatch>, Error>> + Send
Handles the requests and notifications an agent receives from its client that no handler claimed.
A v2 agent (Agent.v2()) answers an unhandled tool_call/cancel or
terminal/cancel with -32602: it has no tool call or terminal it can
cancel. Every other message is left to the generic -32601 fallback.
Source§type Counterpart = Agent
type Counterpart = Agent
Source§fn counterpart(&self) -> Self::Counterpart
fn counterpart(&self) -> Self::Counterpart
impl StructuralPartialEq for Client
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.