public class AcpAgentSession extends java.lang.Object implements AcpSession
AcpClientSession.
The session manages:
This is the agent-side session that receives requests from clients (initialize, newSession, prompt, etc.) and sends requests to clients (readTextFile, writeTextFile, requestPermission, etc.)
| 限定符和类型 | 类和说明 |
|---|---|
static class |
AcpAgentSession.AcpError
ACP-specific error wrapper for JSON-RPC errors.
|
static interface |
AcpAgentSession.NotificationHandler
Functional interface for handling incoming JSON-RPC notifications.
|
static interface |
AcpAgentSession.RequestHandler<T>
Functional interface for handling incoming JSON-RPC requests.
|
| 构造器和说明 |
|---|
AcpAgentSession(java.time.Duration requestTimeout,
AcpAgentTransport transport,
java.util.Map<java.lang.String,AcpAgentSession.RequestHandler<?>> requestHandlers,
java.util.Map<java.lang.String,AcpAgentSession.NotificationHandler> notificationHandlers)
Creates a new AcpAgentSession with the specified configuration and handlers.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
Closes the session immediately, potentially interrupting pending operations.
|
reactor.core.publisher.Mono<java.lang.Void> |
closeGracefully()
Closes the session gracefully, allowing pending operations to complete.
|
java.lang.String |
getActivePromptSessionId()
Gets the session ID of the active prompt, if any.
|
boolean |
hasActivePrompt()
Checks if there is an active prompt being processed.
|
reactor.core.publisher.Mono<java.lang.Void> |
sendNotification(java.lang.String method,
java.lang.Object params)
Sends a JSON-RPC notification to the client.
|
<T> reactor.core.publisher.Mono<T> |
sendRequest(java.lang.String method,
java.lang.Object requestParams,
TypeRef<T> typeRef)
Sends a JSON-RPC request to the client and expects a response of type T.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsendNotificationpublic AcpAgentSession(java.time.Duration requestTimeout,
AcpAgentTransport transport,
java.util.Map<java.lang.String,AcpAgentSession.RequestHandler<?>> requestHandlers,
java.util.Map<java.lang.String,AcpAgentSession.NotificationHandler> notificationHandlers)
requestTimeout - Duration to wait for responsestransport - Transport implementation for message exchangerequestHandlers - Map of method names to request handlersnotificationHandlers - Map of method names to notification handlerspublic <T> reactor.core.publisher.Mono<T> sendRequest(java.lang.String method,
java.lang.Object requestParams,
TypeRef<T> typeRef)
sendRequest 在接口中 AcpSessionT - the type of the expected responsemethod - the name of the method to call on the clientrequestParams - the parameters to send with the requesttypeRef - the TypeReference describing the expected response typepublic reactor.core.publisher.Mono<java.lang.Void> sendNotification(java.lang.String method,
java.lang.Object params)
sendNotification 在接口中 AcpSessionmethod - the name of the notification methodparams - the notification parameterspublic boolean hasActivePrompt()
public java.lang.String getActivePromptSessionId()
public reactor.core.publisher.Mono<java.lang.Void> closeGracefully()
closeGracefully 在接口中 AcpSessionpublic void close()
close 在接口中 AcpSession