Skip to main content

AgentResponse

Enum AgentResponse 

Source
#[non_exhaustive]
pub enum AgentResponse {
Show 23 variants InitializeResponse(Box<InitializeResponse>), LoginAuthResponse(Box<LoginAuthResponse>), ListProvidersResponse(Box<ListProvidersResponse>), SetProviderResponse(Box<SetProviderResponse>), DisableProviderResponse(Box<DisableProviderResponse>), LogoutAuthResponse(Box<LogoutAuthResponse>), AuthStatusResponse(Box<AuthStatusResponse>), NewSessionResponse(Box<NewSessionResponse>), ListSessionsResponse(Box<ListSessionsResponse>), DeleteSessionResponse(Box<DeleteSessionResponse>), ForkSessionResponse(Box<ForkSessionResponse>), ArchiveSessionResponse(Box<ArchiveSessionResponse>), UnarchiveSessionResponse(Box<UnarchiveSessionResponse>), SessionStatusResponse(Box<SessionStatusResponse>), SessionOptionsResponse(Box<SessionOptionsResponse>), SetSessionTitleResponse(Box<SetSessionTitleResponse>), ResumeSessionResponse(Box<ResumeSessionResponse>), CloseSessionResponse(Box<CloseSessionResponse>), CancelToolCallResponse(Box<CancelToolCallResponse>), CancelTerminalResponse(Box<CancelTerminalResponse>), SetSessionConfigOptionResponse(Box<SetSessionConfigOptionResponse>), PromptResponse(Box<PromptResponse>), ExtMethodResponse(Box<ExtResponse>),
}
Available on crate feature unstable_protocol_v2 only.
Expand description

All possible responses that an Agent can send to a Client.

This enum is used internally for routing RPC responses. You typically won’t need to use this directly. The connection handles the responses automatically.

These are responses to the corresponding ClientRequest variants.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

InitializeResponse(Box<InitializeResponse>)

Successful result returned for a initialize request.

§

LoginAuthResponse(Box<LoginAuthResponse>)

Successful result returned for an auth/login request.

§

ListProvidersResponse(Box<ListProvidersResponse>)

Available on crate feature unstable_llm_providers only.

Successful result returned for a providers/list request.

§

SetProviderResponse(Box<SetProviderResponse>)

Available on crate feature unstable_llm_providers only.

Successful result returned for a providers/set request.

§

DisableProviderResponse(Box<DisableProviderResponse>)

Available on crate feature unstable_llm_providers only.

Successful result returned for a providers/disable request.

§

LogoutAuthResponse(Box<LogoutAuthResponse>)

Successful result returned for an auth/logout request.

§

AuthStatusResponse(Box<AuthStatusResponse>)

Available on crate feature unstable_auth_status only.

Successful result returned for an auth/status request.

§

NewSessionResponse(Box<NewSessionResponse>)

Successful result returned for a session/new request.

§

ListSessionsResponse(Box<ListSessionsResponse>)

Successful result returned for a session/list request.

§

DeleteSessionResponse(Box<DeleteSessionResponse>)

Successful result returned for a session/delete request.

§

ForkSessionResponse(Box<ForkSessionResponse>)

Available on crate feature unstable_session_fork only.

Successful result returned for a session/fork request.

§

ArchiveSessionResponse(Box<ArchiveSessionResponse>)

Available on crate feature unstable_session_archive only.

Successful result returned for a session/archive request.

§

UnarchiveSessionResponse(Box<UnarchiveSessionResponse>)

Available on crate feature unstable_session_archive only.

Successful result returned for a session/unarchive request.

§

SessionStatusResponse(Box<SessionStatusResponse>)

Available on crate feature unstable_session_status only.

Successful result returned for a session/status request.

§

SessionOptionsResponse(Box<SessionOptionsResponse>)

Available on crate feature unstable_session_options only.

Successful result returned for a session/options request.

§

SetSessionTitleResponse(Box<SetSessionTitleResponse>)

Available on crate feature unstable_session_set_title only.

Successful result returned for a session/set_title request.

§

ResumeSessionResponse(Box<ResumeSessionResponse>)

Successful result returned for a session/resume request.

§

CloseSessionResponse(Box<CloseSessionResponse>)

Successful result returned for a session/close request.

§

CancelToolCallResponse(Box<CancelToolCallResponse>)

Successful result returned for a tool_call/cancel request.

§

CancelTerminalResponse(Box<CancelTerminalResponse>)

Successful result returned for a terminal/cancel request.

§

SetSessionConfigOptionResponse(Box<SetSessionConfigOptionResponse>)

Successful result returned for a session/set_config_option request.

§

PromptResponse(Box<PromptResponse>)

Successful result returned for a session/prompt request.

§

ExtMethodResponse(Box<ExtResponse>)

Successful result returned by an extension method outside the core ACP method set.

Implementations§

Source§

impl AgentResponse

Source

pub fn from_method_and_result( method: &str, result: Value, ) -> Result<AgentResponse, MethodDispatchError>

Parses a successful result using the originating request’s method.

Responses do not carry a method. The caller must retain it when sending the request and supply it here when the response arrives. This does not parse JSON-RPC error responses.

Use this instead of the enum’s untagged Deserialize implementation, which can silently select an unrelated variant. The result is deserialized unchanged, including null.

§Errors

Returns crate::MethodDispatchError::UnknownMethod for an unsupported method, or crate::MethodDispatchError::InvalidPayload for a malformed result.

Trait Implementations§

Source§

impl Clone for AgentResponse

Source§

fn clone(&self) -> AgentResponse

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AgentResponse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AgentResponse

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<AgentResponse, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonRpcResponse for AgentResponse

Source§

fn into_json(self, _method: &str) -> Result<Value, Error>

Convert this message into a JSON value. Read more
Source§

fn from_json(method: &str, value: Value) -> Result<Self, Error>

Parse a JSON value into the response type. Read more
Source§

impl JsonSchema for AgentResponse

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for AgentResponse

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoMaybeUndefined<T> for T

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more