Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/agent-client-protocol/examples/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use std::cell::Cell;

use agent_client_protocol::{self as acp, Client as _, SessionConfigOptionValue};
use agent_client_protocol::{self as acp, Client as _};
use serde_json::json;
use tokio::sync::{mpsc, oneshot};
use tokio_util::compat::{TokioAsyncReadCompatExt as _, TokioAsyncWriteCompatExt as _};
Expand Down Expand Up @@ -120,9 +120,11 @@ impl acp::Agent for ExampleAgent {
args: acp::SetSessionConfigOptionRequest,
) -> Result<acp::SetSessionConfigOptionResponse, acp::Error> {
log::info!("Received set session config option request {args:?}");
let SessionConfigOptionValue::ValueId { value } = args.value else {
return Err(acp::Error::invalid_params());
};
let value = args
.value
.as_value_id()
.ok_or(acp::Error::invalid_params())?
.clone();
let option = acp::SessionConfigOption::select(
args.config_id,
"Example Option",
Expand Down
15 changes: 6 additions & 9 deletions src/agent-client-protocol/src/rpc_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,7 @@ impl TestAgent {
impl Agent for TestAgent {
async fn initialize(&self, arguments: InitializeRequest) -> Result<InitializeResponse> {
Ok(InitializeResponse::new(arguments.protocol_version)
.agent_capabilities(
AgentCapabilities::new().auth(
agent_client_protocol_schema::AgentAuthCapabilities::new()
.logout(agent_client_protocol_schema::LogoutCapabilities::new()),
),
)
.agent_capabilities(AgentCapabilities::new())
.agent_info(Implementation::new("test-agent", "0.0.0").title("Test Agent")))
}

Expand Down Expand Up @@ -271,9 +266,11 @@ impl Agent for TestAgent {
&self,
args: agent_client_protocol_schema::SetSessionConfigOptionRequest,
) -> Result<agent_client_protocol_schema::SetSessionConfigOptionResponse> {
let SessionConfigOptionValue::ValueId { value } = args.value else {
return Err(Error::invalid_params());
};
let value = args
.value
.as_value_id()
.ok_or(agent_client_protocol_schema::Error::invalid_params())?
.clone();
let option = agent_client_protocol_schema::SessionConfigOption::select(
args.config_id,
"Test Option",
Expand Down