Skip to content

Commit ef8f96e

Browse files
committed
Pull in core schema
1 parent 2368e51 commit ef8f96e

File tree

5 files changed

+16
-41
lines changed

5 files changed

+16
-41
lines changed

Cargo.lock

Lines changed: 3 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ include = ["/src/**/*.rs", "/README.md", "/LICENSE", "/Cargo.toml"]
1717
unstable = ["agent-client-protocol-schema/unstable"]
1818

1919
[dependencies]
20-
agent-client-protocol-schema = { git = "https://github.com/agentclientprotocol/agent-client-protocol.git", package = "agent-client-protocol" }
20+
agent-client-protocol-schema = { git = "https://github.com/agentclientprotocol/agent-client-protocol.git" }
2121
anyhow = "1"
2222
async-broadcast = "0.7"
2323
async-trait = "0.1"

examples/agent.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
1515
use std::cell::Cell;
1616

17-
use agent_client_protocol::{
18-
self as acp, AuthenticateResponse, Client, ExtNotification, ExtRequest, ExtResponse,
19-
SessionNotification, SetSessionModeResponse,
20-
};
17+
use agent_client_protocol::{self as acp, Client as _};
2118
use serde_json::json;
2219
use tokio::sync::{mpsc, oneshot};
2320
use tokio_util::compat::{TokioAsyncReadCompatExt as _, TokioAsyncWriteCompatExt as _};
@@ -56,9 +53,9 @@ impl acp::Agent for ExampleAgent {
5653
async fn authenticate(
5754
&self,
5855
arguments: acp::AuthenticateRequest,
59-
) -> Result<AuthenticateResponse, acp::Error> {
56+
) -> Result<acp::AuthenticateResponse, acp::Error> {
6057
log::info!("Received authenticate request {arguments:?}");
61-
Ok(AuthenticateResponse::default())
58+
Ok(acp::AuthenticateResponse::default())
6259
}
6360

6461
async fn new_session(
@@ -99,7 +96,7 @@ impl acp::Agent for ExampleAgent {
9996
let (tx, rx) = oneshot::channel();
10097
self.session_update_tx
10198
.send((
102-
SessionNotification {
99+
acp::SessionNotification {
103100
session_id: arguments.session_id.clone(),
104101
update: acp::SessionUpdate::AgentMessageChunk { content },
105102
meta: None,
@@ -125,7 +122,7 @@ impl acp::Agent for ExampleAgent {
125122
args: acp::SetSessionModeRequest,
126123
) -> Result<acp::SetSessionModeResponse, acp::Error> {
127124
log::info!("Received set session mode request {args:?}");
128-
Ok(SetSessionModeResponse::default())
125+
Ok(acp::SetSessionModeResponse::default())
129126
}
130127

131128
#[cfg(feature = "unstable")]
@@ -137,7 +134,7 @@ impl acp::Agent for ExampleAgent {
137134
Ok(acp::SetSessionModelResponse::default())
138135
}
139136

140-
async fn ext_method(&self, args: ExtRequest) -> Result<ExtResponse, acp::Error> {
137+
async fn ext_method(&self, args: acp::ExtRequest) -> Result<acp::ExtResponse, acp::Error> {
141138
log::info!(
142139
"Received extension method call: method={}, params={:?}",
143140
args.method,
@@ -146,7 +143,7 @@ impl acp::Agent for ExampleAgent {
146143
Ok(serde_json::value::to_raw_value(&json!({"example": "response"}))?.into())
147144
}
148145

149-
async fn ext_notification(&self, args: ExtNotification) -> Result<(), acp::Error> {
146+
async fn ext_notification(&self, args: acp::ExtNotification) -> Result<(), acp::Error> {
150147
log::info!(
151148
"Received extension notification: method={}, params={:?}",
152149
args.method,

examples/client.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
//! cargo build --example agent && cargo run --example client -- target/debug/examples/agent
1313
//! ```
1414
15-
use agent_client_protocol::{
16-
self as acp, Agent, ExtNotification, ExtRequest, ExtResponse, KillTerminalCommandResponse,
17-
};
15+
use agent_client_protocol::{self as acp, Agent as _};
1816
use anyhow::bail;
1917
use tokio_util::compat::{TokioAsyncReadCompatExt, TokioAsyncWriteCompatExt};
2018

@@ -74,7 +72,7 @@ impl acp::Client for ExampleClient {
7472
async fn kill_terminal_command(
7573
&self,
7674
_args: acp::KillTerminalCommandRequest,
77-
) -> anyhow::Result<KillTerminalCommandResponse, acp::Error> {
75+
) -> anyhow::Result<acp::KillTerminalCommandResponse, acp::Error> {
7876
Err(acp::Error::method_not_found())
7977
}
8078

@@ -104,11 +102,11 @@ impl acp::Client for ExampleClient {
104102
Ok(())
105103
}
106104

107-
async fn ext_method(&self, _args: ExtRequest) -> Result<ExtResponse, acp::Error> {
105+
async fn ext_method(&self, _args: acp::ExtRequest) -> Result<acp::ExtResponse, acp::Error> {
108106
Err(acp::Error::method_not_found())
109107
}
110108

111-
async fn ext_notification(&self, _args: ExtNotification) -> Result<(), acp::Error> {
109+
async fn ext_notification(&self, _args: acp::ExtNotification) -> Result<(), acp::Error> {
112110
Err(acp::Error::method_not_found())
113111
}
114112
}

src/lib.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
pub use agent_client_protocol_schema::{
2-
AGENT_METHOD_NAMES, AgentCapabilities, AgentNotification, AgentRequest, AgentResponse,
3-
AuthenticateRequest, AuthenticateResponse, CLIENT_METHOD_NAMES, CancelNotification,
4-
ClientCapabilities, ClientNotification, ClientRequest, ClientResponse, ContentBlock,
5-
CreateTerminalRequest, CreateTerminalResponse, Error, ExtNotification, ExtRequest, ExtResponse,
6-
InitializeRequest, InitializeResponse, KillTerminalCommandRequest, KillTerminalCommandResponse,
7-
LoadSessionRequest, LoadSessionResponse, NewSessionRequest, NewSessionResponse, PromptRequest,
8-
PromptResponse, RawValue, ReadTextFileRequest, ReadTextFileResponse, ReleaseTerminalRequest,
9-
ReleaseTerminalResponse, RequestPermissionRequest, RequestPermissionResponse, SessionId,
10-
SessionNotification, SessionUpdate, SetSessionModeRequest, SetSessionModeResponse, StopReason,
11-
TerminalOutputRequest, TerminalOutputResponse, V1, WaitForTerminalExitRequest,
12-
WaitForTerminalExitResponse, WriteTextFileRequest, WriteTextFileResponse,
13-
};
14-
#[cfg(feature = "unstable")]
15-
pub use agent_client_protocol_schema::{SetSessionModelRequest, SetSessionModelResponse};
161
use anyhow::Result;
172
use futures::{AsyncRead, AsyncWrite, future::LocalBoxFuture};
183
use rpc::{MessageHandler, RpcConnection, Side};
@@ -25,7 +10,7 @@ mod rpc_tests;
2510
mod stream_broadcast;
2611

2712
pub use agent::*;
28-
// pub use agent_client_protocol_schema::*; // TODO
13+
pub use agent_client_protocol_schema::*;
2914
pub use client::*;
3015
pub use stream_broadcast::{
3116
StreamMessage, StreamMessageContent, StreamMessageDirection, StreamReceiver,

0 commit comments

Comments
 (0)