#[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>),
}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
InitializeResponse(Box<InitializeResponse>)
Successful result returned for a initialize request.
LoginAuthResponse(Box<LoginAuthResponse>)
Successful result returned for an auth/login request.
ListProvidersResponse(Box<ListProvidersResponse>)
unstable_llm_providers only.Successful result returned for a providers/list request.
SetProviderResponse(Box<SetProviderResponse>)
unstable_llm_providers only.Successful result returned for a providers/set request.
DisableProviderResponse(Box<DisableProviderResponse>)
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>)
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>)
unstable_session_fork only.Successful result returned for a session/fork request.
ArchiveSessionResponse(Box<ArchiveSessionResponse>)
unstable_session_archive only.Successful result returned for a session/archive request.
UnarchiveSessionResponse(Box<UnarchiveSessionResponse>)
unstable_session_archive only.Successful result returned for a session/unarchive request.
SessionStatusResponse(Box<SessionStatusResponse>)
unstable_session_status only.Successful result returned for a session/status request.
SessionOptionsResponse(Box<SessionOptionsResponse>)
unstable_session_options only.Successful result returned for a session/options request.
SetSessionTitleResponse(Box<SetSessionTitleResponse>)
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
impl AgentResponse
Sourcepub fn from_method_and_result(
method: &str,
result: Value,
) -> Result<Self, MethodDispatchError>
pub fn from_method_and_result( method: &str, result: Value, ) -> Result<Self, 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
impl Clone for AgentResponse
Source§impl Debug for AgentResponse
impl Debug for AgentResponse
Source§impl<'de> Deserialize<'de> for AgentResponse
impl<'de> Deserialize<'de> for AgentResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for AgentResponse
Available on crate feature schemars only.
impl JsonSchema for AgentResponse
schemars only.Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more