public interface AcpTransport
The AcpTransport interface provides the foundation for implementing custom transport mechanisms in the Agent Client Protocol. It handles the bidirectional communication between the client and agent components, supporting asynchronous message exchange using JSON-RPC format.
Implementations of this interface are responsible for:
The transport layer is designed to be protocol-agnostic, allowing for various implementations such as STDIO, HTTP, SSE, or custom protocols.
| 限定符和类型 | 方法和说明 |
|---|---|
default void |
close()
Closes the transport connection and releases any associated resources.
|
reactor.core.publisher.Mono<java.lang.Void> |
closeGracefully()
Closes the transport connection and releases any associated resources
asynchronously.
|
default java.util.List<java.lang.Integer> |
protocolVersions()
Returns the list of protocol versions supported by this transport.
|
reactor.core.publisher.Mono<java.lang.Void> |
sendMessage(AcpSchema.JSONRPCMessage message)
Sends a message to the peer asynchronously.
|
<T> T |
unmarshalFrom(java.lang.Object data,
TypeRef<T> typeRef)
Unmarshals the given data into an object of the specified type.
|
default void close()
This method ensures proper cleanup of resources when the transport is no longer needed. It should handle the graceful shutdown of any active connections.
reactor.core.publisher.Mono<java.lang.Void> closeGracefully()
Mono that completes when the connection has been closed.reactor.core.publisher.Mono<java.lang.Void> sendMessage(AcpSchema.JSONRPCMessage message)
This method handles the transmission of messages to the peer in an asynchronous manner. Messages are sent in JSON-RPC format as specified by the ACP protocol.
message - the AcpSchema.JSONRPCMessage to be sent to the peerMono that completes when the message has been sent<T> T unmarshalFrom(java.lang.Object data,
TypeRef<T> typeRef)
T - the type of the object to unmarshaldata - the data to unmarshaltypeRef - the type reference for the object to unmarshaldefault java.util.List<java.lang.Integer> protocolVersions()