Skip to content

Commit cca5b5b

Browse files
committed
rename JsonRpcRequest to JrRequest
1 parent 4734ba0 commit cca5b5b

File tree

15 files changed

+81
-87
lines changed

15 files changed

+81
-87
lines changed

src/sacp-conductor/src/conductor.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ use sacp_proxy::{
7070
};
7171

7272
use sacp::{
73-
JrConnection, JrConnectionCx, JrNotification, JrRequestCx, JrResponse, JsonRpcRequest,
74-
MessageAndCx, MetaCapabilityExt, NullHandler, Proxy, TypeNotification, TypeRequest,
75-
UntypedMessage,
73+
JrConnection, JrConnectionCx, JrNotification, JrRequest, JrRequestCx, JrResponse, MessageAndCx,
74+
MetaCapabilityExt, NullHandler, Proxy, UntypedMessage,
75+
util::{TypeNotification, TypeRequest},
7676
};
7777
use tokio_util::compat::{TokioAsyncReadCompatExt, TokioAsyncWriteCompatExt};
7878
use tracing::{debug, info};
@@ -480,7 +480,7 @@ impl Conductor {
480480
/// * If the message is going to a proxy component, then we have to wrap
481481
/// it in a "from successor" wrapper, because the conductor is the
482482
/// proxy's client.
483-
fn send_message_to_predecessor_of<Req: JsonRpcRequest, N: JrNotification>(
483+
fn send_message_to_predecessor_of<Req: JrRequest, N: JrNotification>(
484484
&mut self,
485485
client: &JrConnectionCx,
486486
source_component_index: usize,
@@ -504,7 +504,7 @@ impl Conductor {
504504
}
505505
}
506506

507-
fn send_request_to_predecessor_of<Req: JsonRpcRequest>(
507+
fn send_request_to_predecessor_of<Req: JrRequest>(
508508
&mut self,
509509
client: &JrConnectionCx,
510510
source_component_index: usize,

src/sacp-proxy/src/mcp_over_acp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use sacp;
22
use sacp::{
3-
JrMessage, JrNotification, JrResponsePayload, JsonRpcRequest, UntypedMessage, util::json_cast,
3+
JrMessage, JrNotification, JrRequest, JrResponsePayload, UntypedMessage, util::json_cast,
44
};
55
use serde::{Deserialize, Serialize};
66

@@ -37,7 +37,7 @@ impl JrMessage for McpConnectRequest {
3737
}
3838
}
3939

40-
impl JsonRpcRequest for McpConnectRequest {
40+
impl JrRequest for McpConnectRequest {
4141
type Response = McpConnectResponse;
4242
}
4343

@@ -109,7 +109,7 @@ pub struct McpOverAcpRequest<R> {
109109
pub request: R,
110110
}
111111

112-
impl<R: JsonRpcRequest> JrMessage for McpOverAcpRequest<R> {
112+
impl<R: JrRequest> JrMessage for McpOverAcpRequest<R> {
113113
fn into_untyped_message(self) -> Result<UntypedMessage, sacp::Error> {
114114
let message = self.request.into_untyped_message()?;
115115
UntypedMessage::new(
@@ -151,7 +151,7 @@ impl<R: JsonRpcRequest> JrMessage for McpOverAcpRequest<R> {
151151
}
152152
}
153153

154-
impl<R: JsonRpcRequest> JsonRpcRequest for McpOverAcpRequest<R> {
154+
impl<R: JrRequest> JrRequest for McpOverAcpRequest<R> {
155155
type Response = R::Response;
156156
}
157157

src/sacp-proxy/src/to_from_successor.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use futures::{AsyncRead, AsyncWrite};
22
use sacp::{
33
ChainHandler, Handled, InitializeRequest, InitializeResponse, JrConnection, JrConnectionCx,
4-
JrHandler, JrMessage, JrNotification, JrRequestCx, JsonRpcRequest, MessageAndCx,
5-
MetaCapabilityExt, Proxy, UntypedMessage,
4+
JrHandler, JrMessage, JrNotification, JrRequest, JrRequestCx, MessageAndCx, MetaCapabilityExt,
5+
Proxy, UntypedMessage,
66
};
77
use serde::{Deserialize, Serialize};
88
use std::marker::PhantomData;
@@ -18,13 +18,13 @@ const SUCCESSOR_REQUEST_METHOD: &str = "_proxy/successor/request";
1818
///
1919
/// Used in `_proxy/successor/send` when the proxy wants to forward a request downstream.
2020
#[derive(Debug, Clone, Serialize, Deserialize)]
21-
pub struct SuccessorRequest<Req: JsonRpcRequest> {
21+
pub struct SuccessorRequest<Req: JrRequest> {
2222
/// The message to be sent to the successor component.
2323
#[serde(flatten)]
2424
pub request: Req,
2525
}
2626

27-
impl<Req: JsonRpcRequest> JrMessage for SuccessorRequest<Req> {
27+
impl<Req: JrRequest> JrMessage for SuccessorRequest<Req> {
2828
fn into_untyped_message(self) -> Result<sacp::UntypedMessage, sacp::Error> {
2929
sacp::UntypedMessage::new(
3030
SUCCESSOR_REQUEST_METHOD,
@@ -62,7 +62,7 @@ impl<Req: JsonRpcRequest> JrMessage for SuccessorRequest<Req> {
6262
}
6363
}
6464

65-
impl<Req: JsonRpcRequest> JsonRpcRequest for SuccessorRequest<Req> {
65+
impl<Req: JrRequest> JrRequest for SuccessorRequest<Req> {
6666
type Response = Req::Response;
6767
}
6868

@@ -151,7 +151,7 @@ pub trait AcpProxyExt<OB: AsyncWrite, IB: AsyncRead, H: JrHandler> {
151151
op: F,
152152
) -> JrConnection<OB, IB, ChainHandler<H, RequestFromSuccessorHandler<R, F>>>
153153
where
154-
R: JsonRpcRequest,
154+
R: JrRequest,
155155
F: AsyncFnMut(R, JrRequestCx<R::Response>) -> Result<(), sacp::Error>;
156156

157157
/// Adds a handler for messages received from the successor component.
@@ -208,7 +208,7 @@ where
208208
op: F,
209209
) -> JrConnection<OB, IB, ChainHandler<H, RequestFromSuccessorHandler<R, F>>>
210210
where
211-
R: JsonRpcRequest,
211+
R: JrRequest,
212212
F: AsyncFnMut(R, JrRequestCx<R::Response>) -> Result<(), sacp::Error>,
213213
{
214214
self.chain_handler(RequestFromSuccessorHandler::new(op))
@@ -240,7 +240,7 @@ where
240240
/// Handler to process a request of type `R` coming from the successor component.
241241
pub struct RequestFromSuccessorHandler<R, F>
242242
where
243-
R: JsonRpcRequest,
243+
R: JrRequest,
244244
F: AsyncFnMut(R, JrRequestCx<R::Response>) -> Result<(), sacp::Error>,
245245
{
246246
handler: F,
@@ -249,7 +249,7 @@ where
249249

250250
impl<R, F> RequestFromSuccessorHandler<R, F>
251251
where
252-
R: JsonRpcRequest,
252+
R: JrRequest,
253253
F: AsyncFnMut(R, JrRequestCx<R::Response>) -> Result<(), sacp::Error>,
254254
{
255255
pub fn new(handler: F) -> Self {
@@ -262,7 +262,7 @@ where
262262

263263
impl<R, F> JrHandler for RequestFromSuccessorHandler<R, F>
264264
where
265-
R: JsonRpcRequest,
265+
R: JrRequest,
266266
F: AsyncFnMut(R, JrRequestCx<R::Response>) -> Result<(), sacp::Error>,
267267
{
268268
async fn handle_message(
@@ -509,7 +509,7 @@ pub trait JrCxExt {
509509
/// let response = cx.send_request_to_successor(prompt).recv().await?;
510510
/// // response is the typed PromptResponse
511511
/// ```
512-
fn send_request_to_successor<Req: JsonRpcRequest>(
512+
fn send_request_to_successor<Req: JrRequest>(
513513
&self,
514514
request: Req,
515515
) -> sacp::JrResponse<Req::Response>;
@@ -532,7 +532,7 @@ pub trait JrCxExt {
532532
}
533533

534534
impl JrCxExt for JrConnectionCx {
535-
fn send_request_to_successor<Req: JsonRpcRequest>(
535+
fn send_request_to_successor<Req: JrRequest>(
536536
&self,
537537
request: Req,
538538
) -> sacp::JrResponse<Req::Response> {

src/sacp/src/acp/agent_to_client/requests.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use serde::Serialize;
22

3-
use crate::jsonrpc::{JrMessage, JrResponsePayload, JsonRpcRequest};
3+
use crate::jsonrpc::{JrMessage, JrRequest, JrResponsePayload};
44
use crate::util::json_cast;
55
use crate::{
66
CreateTerminalRequest, CreateTerminalResponse, KillTerminalCommandRequest,
@@ -43,7 +43,7 @@ impl JrMessage for RequestPermissionRequest {
4343
}
4444
}
4545

46-
impl JsonRpcRequest for RequestPermissionRequest {
46+
impl JrRequest for RequestPermissionRequest {
4747
type Response = RequestPermissionResponse;
4848
}
4949

@@ -87,7 +87,7 @@ impl JrMessage for WriteTextFileRequest {
8787
}
8888
}
8989

90-
impl JsonRpcRequest for WriteTextFileRequest {
90+
impl JrRequest for WriteTextFileRequest {
9191
type Response = WriteTextFileResponse;
9292
}
9393

@@ -131,7 +131,7 @@ impl JrMessage for ReadTextFileRequest {
131131
}
132132
}
133133

134-
impl JsonRpcRequest for ReadTextFileRequest {
134+
impl JrRequest for ReadTextFileRequest {
135135
type Response = ReadTextFileResponse;
136136
}
137137

@@ -175,7 +175,7 @@ impl JrMessage for CreateTerminalRequest {
175175
}
176176
}
177177

178-
impl JsonRpcRequest for CreateTerminalRequest {
178+
impl JrRequest for CreateTerminalRequest {
179179
type Response = CreateTerminalResponse;
180180
}
181181

@@ -219,7 +219,7 @@ impl JrMessage for TerminalOutputRequest {
219219
}
220220
}
221221

222-
impl JsonRpcRequest for TerminalOutputRequest {
222+
impl JrRequest for TerminalOutputRequest {
223223
type Response = TerminalOutputResponse;
224224
}
225225

@@ -263,7 +263,7 @@ impl JrMessage for ReleaseTerminalRequest {
263263
}
264264
}
265265

266-
impl JsonRpcRequest for ReleaseTerminalRequest {
266+
impl JrRequest for ReleaseTerminalRequest {
267267
type Response = ReleaseTerminalResponse;
268268
}
269269

@@ -307,7 +307,7 @@ impl JrMessage for WaitForTerminalExitRequest {
307307
}
308308
}
309309

310-
impl JsonRpcRequest for WaitForTerminalExitRequest {
310+
impl JrRequest for WaitForTerminalExitRequest {
311311
type Response = WaitForTerminalExitResponse;
312312
}
313313

@@ -351,7 +351,7 @@ impl JrMessage for KillTerminalCommandRequest {
351351
}
352352
}
353353

354-
impl JsonRpcRequest for KillTerminalCommandRequest {
354+
impl JrRequest for KillTerminalCommandRequest {
355355
type Response = KillTerminalCommandResponse;
356356
}
357357

src/sacp/src/acp/client_to_agent/requests.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
};
66
use serde::Serialize;
77

8-
use crate::jsonrpc::{JrMessage, JrResponsePayload, JsonRpcRequest};
8+
use crate::jsonrpc::{JrMessage, JrResponsePayload, JrRequest};
99
use crate::util::json_cast;
1010

1111
// ============================================================================
@@ -39,7 +39,7 @@ impl JrMessage for InitializeRequest {
3939
}
4040
}
4141

42-
impl JsonRpcRequest for InitializeRequest {
42+
impl JrRequest for InitializeRequest {
4343
type Response = InitializeResponse;
4444
}
4545

@@ -83,7 +83,7 @@ impl JrMessage for AuthenticateRequest {
8383
}
8484
}
8585

86-
impl JsonRpcRequest for AuthenticateRequest {
86+
impl JrRequest for AuthenticateRequest {
8787
type Response = AuthenticateResponse;
8888
}
8989

@@ -127,7 +127,7 @@ impl JrMessage for LoadSessionRequest {
127127
}
128128
}
129129

130-
impl JsonRpcRequest for LoadSessionRequest {
130+
impl JrRequest for LoadSessionRequest {
131131
type Response = LoadSessionResponse;
132132
}
133133

@@ -171,7 +171,7 @@ impl JrMessage for NewSessionRequest {
171171
}
172172
}
173173

174-
impl JsonRpcRequest for NewSessionRequest {
174+
impl JrRequest for NewSessionRequest {
175175
type Response = NewSessionResponse;
176176
}
177177

@@ -215,7 +215,7 @@ impl JrMessage for PromptRequest {
215215
}
216216
}
217217

218-
impl JsonRpcRequest for PromptRequest {
218+
impl JrRequest for PromptRequest {
219219
type Response = PromptResponse;
220220
}
221221

@@ -259,7 +259,7 @@ impl JrMessage for SetSessionModeRequest {
259259
}
260260
}
261261

262-
impl JsonRpcRequest for SetSessionModeRequest {
262+
impl JrRequest for SetSessionModeRequest {
263263
type Response = SetSessionModeResponse;
264264
}
265265

src/sacp/src/acp/enum_impls.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! JsonRpcRequest and JrNotification implementations for ACP enum types.
1+
//! JrRequest and JrNotification implementations for ACP enum types.
22
//!
33
//! This module implements the JSON-RPC traits for the enum types from
44
//! agent-client-protocol-schema that represent all possible messages:
@@ -10,7 +10,7 @@
1010
use crate::{AgentNotification, AgentRequest, ClientNotification, ClientRequest};
1111
use serde::Serialize;
1212

13-
use crate::jsonrpc::{JrMessage, JrNotification, JsonRpcRequest};
13+
use crate::jsonrpc::{JrMessage, JrNotification, JrRequest};
1414
use crate::util::json_cast;
1515

1616
// ============================================================================
@@ -70,7 +70,7 @@ impl JrMessage for ClientRequest {
7070
}
7171
}
7272

73-
impl JsonRpcRequest for ClientRequest {
73+
impl JrRequest for ClientRequest {
7474
type Response = serde_json::Value;
7575
}
7676

@@ -187,7 +187,7 @@ impl JrMessage for AgentRequest {
187187
}
188188
}
189189

190-
impl JsonRpcRequest for AgentRequest {
190+
impl JrRequest for AgentRequest {
191191
type Response = serde_json::Value;
192192
}
193193

0 commit comments

Comments
 (0)