@@ -49,7 +49,7 @@ func (c clientFuncs) SessionUpdate(ctx context.Context, n SessionNotification) e
4949type agentFuncs struct {
5050 InitializeFunc func (context.Context , InitializeRequest ) (InitializeResponse , error )
5151 NewSessionFunc func (context.Context , NewSessionRequest ) (NewSessionResponse , error )
52- LoadSessionFunc func (context.Context , LoadSessionRequest ) error
52+ LoadSessionFunc func (context.Context , LoadSessionRequest ) ( LoadSessionResponse , error )
5353 AuthenticateFunc func (context.Context , AuthenticateRequest ) error
5454 PromptFunc func (context.Context , PromptRequest ) (PromptResponse , error )
5555 CancelFunc func (context.Context , CancelNotification ) error
@@ -74,11 +74,11 @@ func (a agentFuncs) NewSession(ctx context.Context, p NewSessionRequest) (NewSes
7474 return NewSessionResponse {}, nil
7575}
7676
77- func (a agentFuncs ) LoadSession (ctx context.Context , p LoadSessionRequest ) error {
77+ func (a agentFuncs ) LoadSession (ctx context.Context , p LoadSessionRequest ) ( LoadSessionResponse , error ) {
7878 if a .LoadSessionFunc != nil {
7979 return a .LoadSessionFunc (ctx , p )
8080 }
81- return nil
81+ return LoadSessionResponse {}, nil
8282}
8383
8484func (a agentFuncs ) Authenticate (ctx context.Context , p AuthenticateRequest ) error {
@@ -127,8 +127,8 @@ func TestConnectionHandlesErrorsBidirectional(t *testing.T) {
127127 NewSessionFunc : func (context.Context , NewSessionRequest ) (NewSessionResponse , error ) {
128128 return NewSessionResponse {}, & RequestError {Code : - 32603 , Message : "Failed to create session" }
129129 },
130- LoadSessionFunc : func (context.Context , LoadSessionRequest ) error {
131- return & RequestError {Code : - 32603 , Message : "Failed to load session" }
130+ LoadSessionFunc : func (context.Context , LoadSessionRequest ) ( LoadSessionResponse , error ) {
131+ return LoadSessionResponse {}, & RequestError {Code : - 32603 , Message : "Failed to load session" }
132132 },
133133 AuthenticateFunc : func (context.Context , AuthenticateRequest ) error {
134134 return & RequestError {Code : - 32603 , Message : "Authentication failed" }
@@ -181,7 +181,9 @@ func TestConnectionHandlesConcurrentRequests(t *testing.T) {
181181 NewSessionFunc : func (context.Context , NewSessionRequest ) (NewSessionResponse , error ) {
182182 return NewSessionResponse {SessionId : "test-session" }, nil
183183 },
184- LoadSessionFunc : func (context.Context , LoadSessionRequest ) error { return nil },
184+ LoadSessionFunc : func (context.Context , LoadSessionRequest ) (LoadSessionResponse , error ) {
185+ return LoadSessionResponse {}, nil
186+ },
185187 AuthenticateFunc : func (context.Context , AuthenticateRequest ) error { return nil },
186188 PromptFunc : func (context.Context , PromptRequest ) (PromptResponse , error ) {
187189 return PromptResponse {StopReason : "end_turn" }, nil
@@ -254,9 +256,9 @@ func TestConnectionHandlesMessageOrdering(t *testing.T) {
254256 push ("newSession called: " + p .Cwd )
255257 return NewSessionResponse {SessionId : "test-session" }, nil
256258 },
257- LoadSessionFunc : func (_ context.Context , p LoadSessionRequest ) error {
259+ LoadSessionFunc : func (_ context.Context , p LoadSessionRequest ) ( LoadSessionResponse , error ) {
258260 push ("loadSession called: " + string (p .SessionId ))
259- return nil
261+ return LoadSessionResponse {}, nil
260262 },
261263 AuthenticateFunc : func (_ context.Context , p AuthenticateRequest ) error {
262264 push ("authenticate called: " + string (p .MethodId ))
@@ -354,7 +356,9 @@ func TestConnectionHandlesNotifications(t *testing.T) {
354356 NewSessionFunc : func (context.Context , NewSessionRequest ) (NewSessionResponse , error ) {
355357 return NewSessionResponse {SessionId : "test-session" }, nil
356358 },
357- LoadSessionFunc : func (context.Context , LoadSessionRequest ) error { return nil },
359+ LoadSessionFunc : func (context.Context , LoadSessionRequest ) (LoadSessionResponse , error ) {
360+ return LoadSessionResponse {}, nil
361+ },
358362 AuthenticateFunc : func (context.Context , AuthenticateRequest ) error { return nil },
359363 PromptFunc : func (context.Context , PromptRequest ) (PromptResponse , error ) {
360364 return PromptResponse {StopReason : "end_turn" }, nil
@@ -425,7 +429,9 @@ func TestConnectionHandlesInitialize(t *testing.T) {
425429 NewSessionFunc : func (context.Context , NewSessionRequest ) (NewSessionResponse , error ) {
426430 return NewSessionResponse {SessionId : "test-session" }, nil
427431 },
428- LoadSessionFunc : func (context.Context , LoadSessionRequest ) error { return nil },
432+ LoadSessionFunc : func (context.Context , LoadSessionRequest ) (LoadSessionResponse , error ) {
433+ return LoadSessionResponse {}, nil
434+ },
429435 AuthenticateFunc : func (context.Context , AuthenticateRequest ) error { return nil },
430436 PromptFunc : func (context.Context , PromptRequest ) (PromptResponse , error ) {
431437 return PromptResponse {StopReason : "end_turn" }, nil
@@ -472,7 +478,9 @@ func TestPromptCancellationSendsCancelAndAllowsNewSession(t *testing.T) {
472478 NewSessionFunc : func (context.Context , NewSessionRequest ) (NewSessionResponse , error ) {
473479 return NewSessionResponse {SessionId : "s-1" }, nil
474480 },
475- LoadSessionFunc : func (context.Context , LoadSessionRequest ) error { return nil },
481+ LoadSessionFunc : func (context.Context , LoadSessionRequest ) (LoadSessionResponse , error ) {
482+ return LoadSessionResponse {}, nil
483+ },
476484 AuthenticateFunc : func (context.Context , AuthenticateRequest ) error { return nil },
477485 PromptFunc : func (ctx context.Context , p PromptRequest ) (PromptResponse , error ) {
478486 <- ctx .Done ()
0 commit comments