Skip to content

Commit 398ec68

Browse files
committed
feat!: Updating to newest proto to align with 1.0 Draft specifications
* Update AgentCard and transport discovery. Removing the deprecated fields for now * Added ProtoUtils.FromProto.agentCard() method to convert io.a2a.grpc.AgentCard to io.a2a.spec.AgentCard. * Fixing the AGENT_CARD test constant to use the correct protobuf JSON format * Updated ProtoUtils.ToProto and ProtoUtils.FromProto * Update streaming test JSON to protobuf format * Update SSE listener to use proto JSON instead of Jackson * Updating and renaming all JSON-RPC method names to the new standard. * Fixing NullSpecify * Fixing Making unmarshalResponse type-safe * Fixing cloud example * Fixing streaming tests with http client * Fixing issues with configId * Fixing issues with missing id in jsonrpc requests. * Add comprehensive tests for JSONRPCUtils * Update protocol version to 1.0.0 Signed-off-by: Emmanuel Hugonnet <[email protected]>
1 parent 7640e16 commit 398ec68

File tree

106 files changed

+2724
-1423
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+2724
-1423
lines changed

client/base/src/main/java/io/a2a/client/ClientBuilder.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,8 @@ private ClientTransport buildClientTransport() throws A2AClientException {
110110

111111
private Map<String, String> getServerPreferredTransports() {
112112
Map<String, String> serverPreferredTransports = new LinkedHashMap<>();
113-
serverPreferredTransports.put(agentCard.preferredTransport(), agentCard.url());
114-
if (agentCard.additionalInterfaces() != null) {
115-
for (AgentInterface agentInterface : agentCard.additionalInterfaces()) {
116-
serverPreferredTransports.putIfAbsent(agentInterface.protocolBinding(), agentInterface.url());
117-
}
113+
for (AgentInterface agentInterface : agentCard.supportedInterfaces()) {
114+
serverPreferredTransports.putIfAbsent(agentInterface.protocolBinding(), agentInterface.url());
118115
}
119116
return serverPreferredTransports;
120117
}

client/base/src/test/java/io/a2a/client/AuthenticationAuthorizationTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ public void setUp() {
7777
agentCard = new AgentCard.Builder()
7878
.name("Test Agent")
7979
.description("Test agent for auth tests")
80-
.url(AGENT_URL)
8180
.version("1.0.0")
8281
.capabilities(new AgentCapabilities.Builder()
8382
.streaming(true) // Support streaming for all tests
@@ -91,7 +90,7 @@ public void setUp() {
9190
.tags(Collections.singletonList("test"))
9291
.build()))
9392
.protocolVersion("0.3.0")
94-
.additionalInterfaces(java.util.Arrays.asList(
93+
.supportedInterfaces(java.util.Arrays.asList(
9594
new AgentInterface(TransportProtocol.JSONRPC.asString(), AGENT_URL),
9695
new AgentInterface(TransportProtocol.HTTP_JSON.asString(), AGENT_URL),
9796
new AgentInterface(TransportProtocol.GRPC.asString(), grpcServerName)))

client/base/src/test/java/io/a2a/client/ClientBuilderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class ClientBuilderTest {
2424
private AgentCard card = new AgentCard.Builder()
2525
.name("Hello World Agent")
2626
.description("Just a hello world agent")
27-
.url("http://localhost:9999")
27+
.supportedInterfaces(Collections.singletonList(new AgentInterface("jsonrpc", "http://localhost:9999")))
2828
.version("1.0.0")
2929
.documentationUrl("http://example.com/docs")
3030
.capabilities(new AgentCapabilities.Builder()

client/transport/grpc/src/main/java/io/a2a/client/transport/grpc/GrpcTransport.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import io.a2a.grpc.A2AServiceGrpc.A2AServiceBlockingV2Stub;
1818
import io.a2a.grpc.A2AServiceGrpc.A2AServiceStub;
1919
import io.a2a.grpc.CancelTaskRequest;
20-
import io.a2a.grpc.DeleteTaskPushNotificationConfigRequest;
2120
import io.a2a.grpc.GetTaskPushNotificationConfigRequest;
2221
import io.a2a.grpc.GetTaskRequest;
2322
import io.a2a.grpc.ListTaskPushNotificationConfigRequest;
@@ -44,7 +43,6 @@
4443
import io.a2a.spec.TaskIdParams;
4544
import io.a2a.spec.TaskPushNotificationConfig;
4645
import io.a2a.spec.TaskQueryParams;
47-
import io.a2a.spec.TaskResubscriptionRequest;
4846
import io.grpc.Channel;
4947
import io.grpc.Metadata;
5048
import io.grpc.StatusRuntimeException;
@@ -272,7 +270,7 @@ public void deleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationC
272270
@Nullable ClientCallContext context) throws A2AClientException {
273271
checkNotNullParam("request", request);
274272

275-
DeleteTaskPushNotificationConfigRequest grpcRequest = DeleteTaskPushNotificationConfigRequest.newBuilder()
273+
io.a2a.grpc.DeleteTaskPushNotificationConfigRequest grpcRequest = io.a2a.grpc.DeleteTaskPushNotificationConfigRequest.newBuilder()
276274
.setName(getTaskPushNotificationConfigName(request.id(), request.pushNotificationConfigId()))
277275
.build();
278276
PayloadAndHeaders payloadAndHeaders = applyInterceptors(io.a2a.spec.DeleteTaskPushNotificationConfigRequest.METHOD,
@@ -295,7 +293,7 @@ public void resubscribe(TaskIdParams request, Consumer<StreamingEventKind> event
295293
SubscribeToTaskRequest grpcRequest = SubscribeToTaskRequest.newBuilder()
296294
.setName("tasks/" + request.id())
297295
.build();
298-
PayloadAndHeaders payloadAndHeaders = applyInterceptors(TaskResubscriptionRequest.METHOD,
296+
PayloadAndHeaders payloadAndHeaders = applyInterceptors(io.a2a.spec.SubscribeToTaskRequest.METHOD,
299297
grpcRequest, agentCard, context);
300298

301299
StreamObserver<StreamResponse> streamObserver = new EventStreamObserver(eventConsumer, errorConsumer);

client/transport/jsonrpc/pom.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,25 @@
3333
<groupId>${project.groupId}</groupId>
3434
<artifactId>a2a-java-sdk-spec</artifactId>
3535
</dependency>
36+
<dependency>
37+
<groupId>${project.groupId}</groupId>
38+
<artifactId>a2a-java-sdk-spec-grpc</artifactId>
39+
</dependency>
40+
<dependency>
41+
<groupId>com.google.code.gson</groupId>
42+
<artifactId>gson</artifactId>
43+
<scope>provided</scope>
44+
</dependency>
45+
<dependency>
46+
<groupId>com.google.protobuf</groupId>
47+
<artifactId>protobuf-java-util</artifactId>
48+
<scope>provided</scope>
49+
</dependency>
50+
<dependency>
51+
<groupId>com.google.protobuf</groupId>
52+
<artifactId>protobuf-java</artifactId>
53+
<scope>provided</scope>
54+
</dependency>
3655
<dependency>
3756
<groupId>org.junit.jupiter</groupId>
3857
<artifactId>junit-jupiter-api</artifactId>

0 commit comments

Comments
 (0)