Skip to content

Commit bc11736

Browse files
author
Mark Pollack
committed
Name the client calls' parameters request and notification
AcpAsyncClient and AcpSyncClient named each parameter after its type (newSessionRequest, authenticateRequest) and once after another method (setSessionMode's setModeRequest), while the providers calls and the agent side say request. Renaming a parameter does not change the API.
1 parent 63f7e08 commit bc11736

2 files changed

Lines changed: 95 additions & 95 deletions

File tree

‎acp-core/src/main/java/com/agentclientprotocol/sdk/client/AcpAsyncClient.java‎

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,15 @@ public Mono<AcpSchema.InitializeResponse> initialize(int protocolVersion, @Nulla
282282
* Logs in with one of the authentication methods the agent listed in its {@code initialize}
283283
* answer ({@code authenticate}). Needed only for an agent that requires it; such an agent
284284
* answers other requests with {@code -32000} (authentication required) until then.
285-
* @param authenticateRequest the ID of the chosen authentication method
285+
* @param request the ID of the chosen authentication method
286286
* @return a {@code Mono} emitting the agent's answer
287287
* @see AcpSchema#METHOD_AUTHENTICATE
288288
*/
289-
public Mono<AcpSchema.AuthenticateResponse> authenticate(AcpSchema.AuthenticateRequest authenticateRequest) {
290-
Assert.notNull(authenticateRequest, "Authenticate request must not be null");
291-
logger.debug("Authenticating with method: {}", authenticateRequest.methodId());
289+
public Mono<AcpSchema.AuthenticateResponse> authenticate(AcpSchema.AuthenticateRequest request) {
290+
Assert.notNull(request, "Authenticate request must not be null");
291+
logger.debug("Authenticating with method: {}", request.methodId());
292292
return afterInitialize(AcpSchema.METHOD_AUTHENTICATE, AcpAsyncClient::initializedOnly,
293-
() -> session.sendRequest(AcpSchema.METHOD_AUTHENTICATE, authenticateRequest, AUTHENTICATE_RESPONSE_TYPE_REF));
293+
() -> session.sendRequest(AcpSchema.METHOD_AUTHENTICATE, request, AUTHENTICATE_RESPONSE_TYPE_REF));
294294
}
295295

296296
/**
@@ -300,15 +300,15 @@ public Mono<AcpSchema.AuthenticateResponse> authenticate(AcpSchema.AuthenticateR
300300
* {@link com.agentclientprotocol.sdk.capabilities.NegotiatedCapabilities#supportsLogout()}
301301
* first: otherwise the call fails with
302302
* {@link com.agentclientprotocol.sdk.error.AcpCapabilityException} without being sent.
303-
* @param logoutRequest the logout request
303+
* @param request the logout request
304304
* @return a {@code Mono} emitting the agent's answer
305305
* @see AcpSchema#METHOD_LOGOUT
306306
*/
307-
public Mono<AcpSchema.LogoutResponse> logout(AcpSchema.LogoutRequest logoutRequest) {
308-
Assert.notNull(logoutRequest, "Logout request must not be null");
307+
public Mono<AcpSchema.LogoutResponse> logout(AcpSchema.LogoutRequest request) {
308+
Assert.notNull(request, "Logout request must not be null");
309309
logger.debug("Logging out");
310310
return afterInitialize(AcpSchema.METHOD_LOGOUT, NegotiatedCapabilities::requireLogout,
311-
() -> session.sendRequest(AcpSchema.METHOD_LOGOUT, logoutRequest, LOGOUT_RESPONSE_TYPE_REF));
311+
() -> session.sendRequest(AcpSchema.METHOD_LOGOUT, request, LOGOUT_RESPONSE_TYPE_REF));
312312
}
313313

314314
// --------------------------
@@ -319,76 +319,76 @@ public Mono<AcpSchema.LogoutResponse> logout(AcpSchema.LogoutRequest logoutReque
319319
* Creates an ACP session ({@code session/new}) for a working directory, with the MCP servers
320320
* the agent should connect to. The answer carries the session ID every later call for the
321321
* session uses, and optionally the session's modes and config options.
322-
* @param newSessionRequest the working directory, an absolute path, and the MCP servers
322+
* @param request the working directory, an absolute path, and the MCP servers
323323
* @return a {@code Mono} emitting the agent's answer, with the session ID
324324
* @see AcpSchema#METHOD_SESSION_NEW
325325
*/
326-
public Mono<AcpSchema.NewSessionResponse> newSession(AcpSchema.NewSessionRequest newSessionRequest) {
327-
Assert.notNull(newSessionRequest, "New session request must not be null");
328-
logger.debug("Creating new session with cwd: {}", newSessionRequest.cwd());
326+
public Mono<AcpSchema.NewSessionResponse> newSession(AcpSchema.NewSessionRequest request) {
327+
Assert.notNull(request, "New session request must not be null");
328+
logger.debug("Creating new session with cwd: {}", request.cwd());
329329
return afterInitialize(AcpSchema.METHOD_SESSION_NEW, AcpAsyncClient::initializedOnly,
330-
() -> session.sendRequest(AcpSchema.METHOD_SESSION_NEW, newSessionRequest, NEW_SESSION_RESPONSE_TYPE_REF));
330+
() -> session.sendRequest(AcpSchema.METHOD_SESSION_NEW, request, NEW_SESSION_RESPONSE_TYPE_REF));
331331
}
332332

333333
/**
334334
* Reopens a session the agent kept ({@code session/load}). The agent replays the conversation
335335
* as session updates, which reach the session update consumers before this call completes, then
336336
* answers. Only an agent that advertises {@code loadSession} supports it; for any other the call
337337
* fails with {@link com.agentclientprotocol.sdk.error.AcpCapabilityException} without being sent.
338-
* @param loadSessionRequest the session ID, the working directory and the MCP servers
338+
* @param request the session ID, the working directory and the MCP servers
339339
* @return a {@code Mono} emitting the agent's answer once the history has been replayed
340340
* @see AcpSchema#METHOD_SESSION_LOAD
341341
*/
342-
public Mono<AcpSchema.LoadSessionResponse> loadSession(AcpSchema.LoadSessionRequest loadSessionRequest) {
343-
Assert.notNull(loadSessionRequest, "Load session request must not be null");
344-
logger.debug("Loading session: {}", loadSessionRequest.sessionId());
342+
public Mono<AcpSchema.LoadSessionResponse> loadSession(AcpSchema.LoadSessionRequest request) {
343+
Assert.notNull(request, "Load session request must not be null");
344+
logger.debug("Loading session: {}", request.sessionId());
345345
return afterInitialize(AcpSchema.METHOD_SESSION_LOAD, NegotiatedCapabilities::requireLoadSession,
346-
() -> session.sendRequest(AcpSchema.METHOD_SESSION_LOAD, loadSessionRequest, LOAD_SESSION_RESPONSE_TYPE_REF));
346+
() -> session.sendRequest(AcpSchema.METHOD_SESSION_LOAD, request, LOAD_SESSION_RESPONSE_TYPE_REF));
347347
}
348348

349349
/**
350350
* Switches a session to one of the modes the agent offered ({@code session/set_mode}). Modes
351351
* may change how the agent works on prompts and what it asks permission for.
352-
* @param setModeRequest the session ID and the mode ID
352+
* @param request the session ID and the mode ID
353353
* @return a {@code Mono} emitting the agent's answer
354354
* @see AcpSchema#METHOD_SESSION_SET_MODE
355355
*/
356-
public Mono<AcpSchema.SetSessionModeResponse> setSessionMode(AcpSchema.SetSessionModeRequest setModeRequest) {
357-
Assert.notNull(setModeRequest, "Set session mode request must not be null");
358-
logger.debug("Setting session mode: {} for session: {}", setModeRequest.modeId(), setModeRequest.sessionId());
356+
public Mono<AcpSchema.SetSessionModeResponse> setSessionMode(AcpSchema.SetSessionModeRequest request) {
357+
Assert.notNull(request, "Set session mode request must not be null");
358+
logger.debug("Setting session mode: {} for session: {}", request.modeId(), request.sessionId());
359359
return afterInitialize(AcpSchema.METHOD_SESSION_SET_MODE, AcpAsyncClient::initializedOnly,
360-
() -> session.sendRequest(AcpSchema.METHOD_SESSION_SET_MODE, setModeRequest,
360+
() -> session.sendRequest(AcpSchema.METHOD_SESSION_SET_MODE, request,
361361
SET_SESSION_MODE_RESPONSE_TYPE_REF));
362362
}
363363

364364
/**
365365
* Lists the sessions the agent knows ({@code session/list}), optionally only those of one
366366
* working directory. The answer may be one page: pass its {@code nextCursor} in the next
367367
* request to get the next page.
368-
* @param listSessionsRequest an optional working directory and an optional cursor
368+
* @param request an optional working directory and an optional cursor
369369
* @return a {@code Mono} emitting a page of sessions
370370
* @see AcpSchema#METHOD_SESSION_LIST
371371
*/
372-
public Mono<AcpSchema.ListSessionsResponse> listSessions(AcpSchema.ListSessionsRequest listSessionsRequest) {
373-
Assert.notNull(listSessionsRequest, "List sessions request must not be null");
372+
public Mono<AcpSchema.ListSessionsResponse> listSessions(AcpSchema.ListSessionsRequest request) {
373+
Assert.notNull(request, "List sessions request must not be null");
374374
logger.debug("Listing sessions");
375375
return afterInitialize(AcpSchema.METHOD_SESSION_LIST, NegotiatedCapabilities::requireListSessions,
376-
() -> session.sendRequest(AcpSchema.METHOD_SESSION_LIST, listSessionsRequest,
376+
() -> session.sendRequest(AcpSchema.METHOD_SESSION_LIST, request,
377377
LIST_SESSIONS_RESPONSE_TYPE_REF));
378378
}
379379

380380
/**
381381
* Closes an active session ({@code session/close}): the agent stops its work as for
382382
* {@code session/cancel}, then frees what the session holds.
383-
* @param closeSessionRequest the session ID
383+
* @param request the session ID
384384
* @return a {@code Mono} emitting the agent's answer
385385
* @see AcpSchema#METHOD_SESSION_CLOSE
386386
*/
387-
public Mono<AcpSchema.CloseSessionResponse> closeSession(AcpSchema.CloseSessionRequest closeSessionRequest) {
388-
Assert.notNull(closeSessionRequest, "Close session request must not be null");
389-
logger.debug("Closing session: {}", closeSessionRequest.sessionId());
387+
public Mono<AcpSchema.CloseSessionResponse> closeSession(AcpSchema.CloseSessionRequest request) {
388+
Assert.notNull(request, "Close session request must not be null");
389+
logger.debug("Closing session: {}", request.sessionId());
390390
return afterInitialize(AcpSchema.METHOD_SESSION_CLOSE, NegotiatedCapabilities::requireCloseSession,
391-
() -> session.sendRequest(AcpSchema.METHOD_SESSION_CLOSE, closeSessionRequest,
391+
() -> session.sendRequest(AcpSchema.METHOD_SESSION_CLOSE, request,
392392
CLOSE_SESSION_RESPONSE_TYPE_REF));
393393
}
394394

@@ -398,47 +398,47 @@ public Mono<AcpSchema.CloseSessionResponse> closeSession(AcpSchema.CloseSessionR
398398
* appears in {@code session/list}. Only an agent that advertises
399399
* {@code sessionCapabilities.delete} supports it; for any other the call fails with
400400
* {@link com.agentclientprotocol.sdk.error.AcpCapabilityException} without being sent.
401-
* @param deleteSessionRequest the session ID
401+
* @param request the session ID
402402
* @return a {@code Mono} emitting the agent's answer
403403
* @see AcpSchema#METHOD_SESSION_DELETE
404404
*/
405-
public Mono<AcpSchema.DeleteSessionResponse> deleteSession(AcpSchema.DeleteSessionRequest deleteSessionRequest) {
406-
Assert.notNull(deleteSessionRequest, "Delete session request must not be null");
407-
logger.debug("Deleting session: {}", deleteSessionRequest.sessionId());
405+
public Mono<AcpSchema.DeleteSessionResponse> deleteSession(AcpSchema.DeleteSessionRequest request) {
406+
Assert.notNull(request, "Delete session request must not be null");
407+
logger.debug("Deleting session: {}", request.sessionId());
408408
return afterInitialize(AcpSchema.METHOD_SESSION_DELETE, NegotiatedCapabilities::requireDeleteSession,
409-
() -> session.sendRequest(AcpSchema.METHOD_SESSION_DELETE, deleteSessionRequest,
409+
() -> session.sendRequest(AcpSchema.METHOD_SESSION_DELETE, request,
410410
DELETE_SESSION_RESPONSE_TYPE_REF));
411411
}
412412

413413
/**
414414
* Reopens a session without replaying its history ({@code session/resume}), unlike
415415
* {@link #loadSession}. Use it to reconnect to a session the agent still runs, or when the
416416
* client keeps the history itself.
417-
* @param resumeSessionRequest the session ID, the working directory and the MCP servers
417+
* @param request the session ID, the working directory and the MCP servers
418418
* @return a {@code Mono} emitting the agent's answer
419419
* @see AcpSchema#METHOD_SESSION_RESUME
420420
*/
421421
public Mono<AcpSchema.ResumeSessionResponse> resumeSession(
422-
AcpSchema.ResumeSessionRequest resumeSessionRequest) {
423-
Assert.notNull(resumeSessionRequest, "Resume session request must not be null");
424-
logger.debug("Resuming session: {}", resumeSessionRequest.sessionId());
422+
AcpSchema.ResumeSessionRequest request) {
423+
Assert.notNull(request, "Resume session request must not be null");
424+
logger.debug("Resuming session: {}", request.sessionId());
425425
return afterInitialize(AcpSchema.METHOD_SESSION_RESUME, NegotiatedCapabilities::requireResumeSession,
426-
() -> session.sendRequest(AcpSchema.METHOD_SESSION_RESUME, resumeSessionRequest,
426+
() -> session.sendRequest(AcpSchema.METHOD_SESSION_RESUME, request,
427427
RESUME_SESSION_RESPONSE_TYPE_REF));
428428
}
429429

430430
/**
431431
* Creates a new session branched from an existing one ({@code session/fork}).
432-
* @param forkSessionRequest the ID of the session to branch from and the working directory
432+
* @param request the ID of the session to branch from and the working directory
433433
* @return a {@code Mono} emitting the agent's answer, with the new session's ID
434434
* @see AcpSchema#METHOD_SESSION_FORK
435435
*/
436436
@UnstableAcpApi
437-
public Mono<AcpSchema.ForkSessionResponse> forkSession(AcpSchema.ForkSessionRequest forkSessionRequest) {
438-
Assert.notNull(forkSessionRequest, "Fork session request must not be null");
439-
logger.debug("Forking session: {}", forkSessionRequest.sessionId());
437+
public Mono<AcpSchema.ForkSessionResponse> forkSession(AcpSchema.ForkSessionRequest request) {
438+
Assert.notNull(request, "Fork session request must not be null");
439+
logger.debug("Forking session: {}", request.sessionId());
440440
return afterInitialize(AcpSchema.METHOD_SESSION_FORK, NegotiatedCapabilities::requireForkSession,
441-
() -> session.sendRequest(AcpSchema.METHOD_SESSION_FORK, forkSessionRequest,
441+
() -> session.sendRequest(AcpSchema.METHOD_SESSION_FORK, request,
442442
FORK_SESSION_RESPONSE_TYPE_REF));
443443
}
444444

@@ -534,19 +534,19 @@ public Mono<AcpSchema.DisableProviderResponse> disableProvider(AcpSchema.Disable
534534
* {@link java.util.concurrent.TimeoutException} and the client sends {@code $/cancel_request},
535535
* which makes a Java agent cancel the turn. Disposing the returned {@code Mono} does the same
536536
* at any time.
537-
* @param promptRequest the session ID and the prompt's content blocks
537+
* @param request the session ID and the prompt's content blocks
538538
* @return a {@code Mono} emitting the agent's answer, with the stop reason
539539
* @see AcpSchema#METHOD_SESSION_PROMPT
540540
*/
541-
public Mono<AcpSchema.PromptResponse> prompt(AcpSchema.PromptRequest promptRequest) {
542-
Assert.notNull(promptRequest, "Prompt request must not be null");
543-
logger.debug("Sending prompt to session: {}", promptRequest.sessionId());
541+
public Mono<AcpSchema.PromptResponse> prompt(AcpSchema.PromptRequest request) {
542+
Assert.notNull(request, "Prompt request must not be null");
543+
logger.debug("Sending prompt to session: {}", request.sessionId());
544544
return afterInitialize(AcpSchema.METHOD_SESSION_PROMPT, AcpAsyncClient::initializedOnly, () -> {
545545
if (session instanceof AcpClientSession clientSession) {
546-
return clientSession.sendRequest(AcpSchema.METHOD_SESSION_PROMPT, promptRequest,
546+
return clientSession.sendRequest(AcpSchema.METHOD_SESSION_PROMPT, request,
547547
PROMPT_RESPONSE_TYPE_REF, this.promptTimeout);
548548
}
549-
return session.sendRequest(AcpSchema.METHOD_SESSION_PROMPT, promptRequest, PROMPT_RESPONSE_TYPE_REF);
549+
return session.sendRequest(AcpSchema.METHOD_SESSION_PROMPT, request, PROMPT_RESPONSE_TYPE_REF);
550550
});
551551
}
552552

@@ -558,15 +558,15 @@ public Mono<AcpSchema.PromptResponse> prompt(AcpSchema.PromptRequest promptReque
558558
* reach the session update consumers as usual, and then answers the pending prompt with stop
559559
* reason {@code cancelled}. Send the next prompt on the session once that answer has arrived:
560560
* until then the agent refuses it (ACP v1, prompt turn, Cancellation).
561-
* @param cancelNotification the session ID
561+
* @param notification the session ID
562562
* @return a {@code Mono} that completes when the notification has been handed to the transport
563563
* @see AcpSchema#METHOD_SESSION_CANCEL
564564
*/
565-
public Mono<Void> cancel(AcpSchema.CancelNotification cancelNotification) {
566-
Assert.notNull(cancelNotification, "Cancel notification must not be null");
567-
logger.debug("Canceling operations for session: {}", cancelNotification.sessionId());
565+
public Mono<Void> cancel(AcpSchema.CancelNotification notification) {
566+
Assert.notNull(notification, "Cancel notification must not be null");
567+
logger.debug("Canceling operations for session: {}", notification.sessionId());
568568
return afterInitialize(AcpSchema.METHOD_SESSION_CANCEL, AcpAsyncClient::initializedOnly,
569-
() -> session.sendNotification(AcpSchema.METHOD_SESSION_CANCEL, cancelNotification));
569+
() -> session.sendNotification(AcpSchema.METHOD_SESSION_CANCEL, notification));
570570
}
571571

572572
// --------------------------

0 commit comments

Comments
 (0)