Skip to content

Commit e863586

Browse files
authored
feat(acp-nats): add new_session handler with session.ready lifecycle (#12)
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
1 parent 2f05030 commit e863586

File tree

7 files changed

+421
-15
lines changed

7 files changed

+421
-15
lines changed

rsworkspace/crates/acp-nats/src/agent/mod.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
mod initialize;
2+
mod new_session;
23

34
use crate::config::Config;
45
use crate::nats::{FlushClient, PublishClient, RequestClient};
@@ -48,11 +49,8 @@ impl<N: RequestClient + PublishClient + FlushClient, C: GetElapsed> Agent for Br
4849
))
4950
}
5051

51-
async fn new_session(&self, _args: NewSessionRequest) -> Result<NewSessionResponse> {
52-
Err(Error::new(
53-
ErrorCode::InternalError.into(),
54-
"not yet implemented",
55-
))
52+
async fn new_session(&self, args: NewSessionRequest) -> Result<NewSessionResponse> {
53+
new_session::handle(self, args).await
5654
}
5755

5856
async fn load_session(&self, _args: LoadSessionRequest) -> Result<LoadSessionResponse> {
@@ -109,7 +107,7 @@ mod tests {
109107
use crate::config::Config;
110108
use agent_client_protocol::{
111109
Agent, AuthenticateRequest, CancelNotification, ExtNotification, ExtRequest,
112-
LoadSessionRequest, NewSessionRequest, PromptRequest, SetSessionModeRequest,
110+
LoadSessionRequest, PromptRequest, SetSessionModeRequest,
113111
};
114112
use trogon_nats::AdvancedMockNatsClient;
115113

@@ -137,12 +135,6 @@ mod tests {
137135
.await
138136
.is_err()
139137
);
140-
assert!(
141-
bridge
142-
.new_session(NewSessionRequest::new("."))
143-
.await
144-
.is_err()
145-
);
146138
assert!(
147139
bridge
148140
.load_session(LoadSessionRequest::new("s1", "."))

0 commit comments

Comments
 (0)