Skip to content

Commit 729bc88

Browse files
committed
Updating to newest proto
Signed-off-by: Emmanuel Hugonnet <[email protected]>
1 parent 8ecb546 commit 729bc88

File tree

93 files changed

+5158
-4133
lines changed

Some content is hidden

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

93 files changed

+5158
-4133
lines changed

boms/sdk/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
<dependency>
156156
<groupId>com.google.protobuf</groupId>
157157
<artifactId>protobuf-java</artifactId>
158-
<version>${protobuf.version}</version>
158+
<version>${protobuf-java.version}</version>
159159
</dependency>
160160
<dependency>
161161
<groupId>io.smallrye.reactive</groupId>

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

Lines changed: 7 additions & 8 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.CreateTaskPushNotificationConfigRequest;
2120
import io.a2a.grpc.DeleteTaskPushNotificationConfigRequest;
2221
import io.a2a.grpc.GetTaskPushNotificationConfigRequest;
2322
import io.a2a.grpc.GetTaskRequest;
@@ -26,7 +25,8 @@
2625
import io.a2a.grpc.SendMessageRequest;
2726
import io.a2a.grpc.SendMessageResponse;
2827
import io.a2a.grpc.StreamResponse;
29-
import io.a2a.grpc.TaskSubscriptionRequest;
28+
import io.a2a.grpc.SetTaskPushNotificationConfigRequest;
29+
import io.a2a.grpc.SubscribeToTaskRequest;
3030
import io.a2a.grpc.utils.ProtoUtils.FromProto;
3131
import io.a2a.grpc.utils.ProtoUtils.ToProto;
3232
import io.a2a.spec.A2AClientException;
@@ -39,7 +39,6 @@
3939
import io.a2a.spec.ListTasksResult;
4040
import io.a2a.spec.MessageSendParams;
4141
import io.a2a.spec.SendStreamingMessageRequest;
42-
import io.a2a.spec.SetTaskPushNotificationConfigRequest;
4342
import io.a2a.spec.StreamingEventKind;
4443
import io.a2a.spec.Task;
4544
import io.a2a.spec.TaskIdParams;
@@ -208,17 +207,17 @@ public TaskPushNotificationConfig setTaskPushNotificationConfiguration(TaskPushN
208207
checkNotNullParam("request", request);
209208

210209
String configId = request.pushNotificationConfig().id();
211-
CreateTaskPushNotificationConfigRequest grpcRequest = CreateTaskPushNotificationConfigRequest.newBuilder()
210+
SetTaskPushNotificationConfigRequest grpcRequest = SetTaskPushNotificationConfigRequest.newBuilder()
212211
.setParent("tasks/" + request.taskId())
213212
.setConfig(ToProto.taskPushNotificationConfig(request))
214213
.setConfigId(configId != null ? configId : request.taskId())
215214
.build();
216-
PayloadAndHeaders payloadAndHeaders = applyInterceptors(SetTaskPushNotificationConfigRequest.METHOD,
215+
PayloadAndHeaders payloadAndHeaders = applyInterceptors(io.a2a.spec.SetTaskPushNotificationConfigRequest.METHOD,
217216
grpcRequest, agentCard, context);
218217

219218
try {
220219
A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders);
221-
return FromProto.taskPushNotificationConfig(stubWithMetadata.createTaskPushNotificationConfig(grpcRequest));
220+
return FromProto.taskPushNotificationConfig(stubWithMetadata.setTaskPushNotificationConfig(grpcRequest));
222221
} catch (StatusRuntimeException e) {
223222
throw GrpcErrorMapper.mapGrpcError(e, "Failed to create task push notification config: ");
224223
}
@@ -291,7 +290,7 @@ public void resubscribe(TaskIdParams request, Consumer<StreamingEventKind> event
291290
checkNotNullParam("request", request);
292291
checkNotNullParam("eventConsumer", eventConsumer);
293292

294-
TaskSubscriptionRequest grpcRequest = TaskSubscriptionRequest.newBuilder()
293+
SubscribeToTaskRequest grpcRequest = SubscribeToTaskRequest.newBuilder()
295294
.setName("tasks/" + request.id())
296295
.build();
297296
PayloadAndHeaders payloadAndHeaders = applyInterceptors(TaskResubscriptionRequest.METHOD,
@@ -301,7 +300,7 @@ public void resubscribe(TaskIdParams request, Consumer<StreamingEventKind> event
301300

302301
try {
303302
A2AServiceStub stubWithMetadata = createAsyncStubWithMetadata(context, payloadAndHeaders);
304-
stubWithMetadata.taskSubscription(grpcRequest, streamObserver);
303+
stubWithMetadata.subscribeToTask(grpcRequest, streamObserver);
305304
} catch (StatusRuntimeException e) {
306305
throw GrpcErrorMapper.mapGrpcError(e, "Failed to resubscribe task push notification config: ");
307306
}

client/transport/rest/src/main/java/io/a2a/client/transport/rest/RestTransport.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
import io.a2a.client.transport.spi.interceptors.ClientCallInterceptor;
1717
import io.a2a.client.transport.spi.interceptors.PayloadAndHeaders;
1818
import io.a2a.grpc.CancelTaskRequest;
19-
import io.a2a.grpc.CreateTaskPushNotificationConfigRequest;
2019
import io.a2a.grpc.GetTaskPushNotificationConfigRequest;
2120
import io.a2a.grpc.GetTaskRequest;
2221
import io.a2a.grpc.ListTaskPushNotificationConfigRequest;
2322
import io.a2a.grpc.ListTasksRequest;
23+
import io.a2a.grpc.SetTaskPushNotificationConfigRequest;
2424
import io.a2a.spec.TaskPushNotificationConfig;
2525
import io.a2a.spec.A2AClientException;
2626
import io.a2a.spec.AgentCard;
@@ -38,7 +38,6 @@
3838
import io.a2a.grpc.utils.ProtoUtils;
3939
import io.a2a.spec.A2AClientError;
4040
import io.a2a.spec.SendStreamingMessageRequest;
41-
import io.a2a.spec.SetTaskPushNotificationConfigRequest;
4241
import io.a2a.util.Utils;
4342
import java.io.IOException;
4443
import java.net.URLEncoder;
@@ -146,6 +145,7 @@ public Task getTask(TaskQueryParams taskQueryParams, @Nullable ClientCallContext
146145
throw RestErrorMapper.mapRestError(response);
147146
}
148147
String httpResponseBody = response.body();
148+
System.out.println("********************************************* " + httpResponseBody);
149149
io.a2a.grpc.Task.Builder responseBuilder = io.a2a.grpc.Task.newBuilder();
150150
JsonFormat.parser().merge(httpResponseBody, responseBuilder);
151151
return ProtoUtils.FromProto.task(responseBuilder);
@@ -262,13 +262,13 @@ private String buildListTasksQueryString(ListTasksParams request) {
262262
@Override
263263
public TaskPushNotificationConfig setTaskPushNotificationConfiguration(TaskPushNotificationConfig request, @Nullable ClientCallContext context) throws A2AClientException {
264264
checkNotNullParam("request", request);
265-
CreateTaskPushNotificationConfigRequest.Builder builder = CreateTaskPushNotificationConfigRequest.newBuilder();
265+
SetTaskPushNotificationConfigRequest.Builder builder = SetTaskPushNotificationConfigRequest.newBuilder();
266266
builder.setConfig(ProtoUtils.ToProto.taskPushNotificationConfig(request))
267267
.setParent("tasks/" + request.taskId());
268268
if (request.pushNotificationConfig().id() != null) {
269269
builder.setConfigId(request.pushNotificationConfig().id());
270270
}
271-
PayloadAndHeaders payloadAndHeaders = applyInterceptors(SetTaskPushNotificationConfigRequest.METHOD, builder, agentCard, context);
271+
PayloadAndHeaders payloadAndHeaders = applyInterceptors(io.a2a.spec.SetTaskPushNotificationConfigRequest.METHOD, builder, agentCard, context);
272272
try {
273273
String httpResponseBody = sendPostRequest(agentUrl + String.format("/v1/tasks/%1s/pushNotificationConfigs", request.taskId()), payloadAndHeaders);
274274
io.a2a.grpc.TaskPushNotificationConfig.Builder responseBuilder = io.a2a.grpc.TaskPushNotificationConfig.newBuilder();
@@ -370,7 +370,7 @@ public void deleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationC
370370
public void resubscribe(TaskIdParams request, Consumer<StreamingEventKind> eventConsumer,
371371
Consumer<Throwable> errorConsumer, @Nullable ClientCallContext context) throws A2AClientException {
372372
checkNotNullParam("request", request);
373-
io.a2a.grpc.TaskSubscriptionRequest.Builder builder = io.a2a.grpc.TaskSubscriptionRequest.newBuilder();
373+
io.a2a.grpc.SubscribeToTaskRequest.Builder builder = io.a2a.grpc.SubscribeToTaskRequest.newBuilder();
374374
builder.setName("tasks/" + request.id());
375375
PayloadAndHeaders payloadAndHeaders = applyInterceptors(io.a2a.spec.TaskResubscriptionRequest.METHOD, builder,
376376
agentCard, context);

client/transport/rest/src/test/java/io/a2a/client/transport/rest/JsonRestMessages.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ public class JsonRestMessages {
8888
{
8989
"file": {
9090
"file_with_uri": "file:///path/to/file.txt",
91-
"mimeType": "text/plain"
91+
"mediaType": "text/plain"
9292
}
9393
},
9494
{
9595
"file": {
9696
"file_with_bytes": "aGVsbG8=",
97-
"mimeType": "text/plain"
97+
"mediaType": "text/plain"
9898
}
9999
}
100100
],
@@ -454,7 +454,7 @@ public class JsonRestMessages {
454454
"kind": "file",
455455
"file": {
456456
"uri": "file:///path/to/image.jpg",
457-
"mimeType": "image/jpeg"
457+
"mediaType": "image/jpeg"
458458
}
459459
}
460460
],
@@ -571,7 +571,7 @@ public class JsonRestMessages {
571571
"file": {
572572
"bytes": "aGVsbG8=",
573573
"name": "chart.png",
574-
"mimeType": "image/png"
574+
"mediaType": "image/png"
575575
}
576576
},
577577
{

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<mockserver.version>5.15.0</mockserver.version>
5959
<mutiny-zero.version>1.1.1</mutiny-zero.version>
6060
<os-maven-plugin.version>1.7.1</os-maven-plugin.version>
61-
<protobuf.version>4.31.1</protobuf.version>
61+
<protobuf-java.version>4.31.1</protobuf-java.version>
6262
<protobuf-maven-plugin.version>0.6.1</protobuf-maven-plugin.version>
6363
<quarkus.platform.version>3.28.2</quarkus.platform.version>
6464
<rest-assured.version>5.5.1</rest-assured.version>
@@ -206,7 +206,7 @@
206206
<dependency>
207207
<groupId>com.google.protobuf</groupId>
208208
<artifactId>protobuf-java</artifactId>
209-
<version>${protobuf.version}</version>
209+
<version>${protobuf-java.version}</version>
210210
</dependency>
211211
<dependency>
212212
<groupId>io.smallrye.reactive</groupId>

spec-grpc/pom.xml

Lines changed: 32 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
<name>Java SDK A2A Spec: gRPC</name>
1717
<description>Java SDK for the Agent2Agent Protocol (A2A) - Spec: gRPC</description>
18+
<properties>
19+
<skip.protobuf.generate>true</skip.protobuf.generate>
20+
</properties>
1821

1922
<dependencies>
2023
<dependency>
@@ -72,75 +75,34 @@
7275
</dependencies>
7376

7477
<build>
75-
<extensions>
76-
<!--
77-
Seems to be needed by the protobuf-maven-plugin.
78-
Adding these extensions to the profile is not possible
79-
-->
80-
<extension>
81-
<groupId>kr.motd.maven</groupId>
82-
<artifactId>os-maven-plugin</artifactId>
83-
<version>${os-maven-plugin.version}</version>
84-
</extension>
85-
</extensions>
78+
<plugins>
79+
<!-- Protocol Buffers Compiler Plugin -->
80+
<plugin>
81+
<groupId>io.github.ascopes</groupId>
82+
<artifactId>protobuf-maven-plugin</artifactId>
83+
<version>4.0.2</version>
84+
<configuration>
85+
<skip>${skip.protobuf.generate}</skip>
86+
<cleanOutputDirectories>true</cleanOutputDirectories>
87+
<protoc>${protobuf-java.version}</protoc>
88+
<outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
89+
<binaryMavenPlugins>
90+
<binaryMavenPlugin>
91+
<groupId>io.grpc</groupId>
92+
<artifactId>protoc-gen-grpc-java</artifactId>
93+
<version>${grpc.version}</version>
94+
</binaryMavenPlugin>
95+
</binaryMavenPlugins>
96+
</configuration>
97+
<executions>
98+
<execution>
99+
<phase>generate-sources</phase>
100+
<goals>
101+
<goal>generate</goal>
102+
</goals>
103+
</execution>
104+
</executions>
105+
</plugin>
106+
</plugins>
86107
</build>
87-
88-
<profiles>
89-
<profile>
90-
<id>proto-compile</id>
91-
<build>
92-
93-
<plugins>
94-
<plugin>
95-
<groupId>org.apache.maven.plugins</groupId>
96-
<artifactId>maven-clean-plugin</artifactId>
97-
<version>${maven-clean-plugin.version}</version>
98-
<executions>
99-
<execution>
100-
<id>remove-generated-files</id>
101-
<phase>initialize</phase>
102-
<goals>
103-
<goal>clean</goal>
104-
</goals>
105-
<configuration>
106-
<excludeDefaultDirectories>true</excludeDefaultDirectories>
107-
<filesets>
108-
<fileset>
109-
<directory>${project.basedir}/src/main/java/io/a2a/grpc</directory>
110-
<followSymlinks>false</followSymlinks>
111-
<includes>
112-
<include>*.java</include>
113-
</includes>
114-
</fileset>
115-
</filesets>
116-
</configuration>
117-
</execution>
118-
</executions>
119-
</plugin>
120-
<!-- Protocol Buffers Compiler Plugin -->
121-
<plugin>
122-
<groupId>org.xolstice.maven.plugins</groupId>
123-
<artifactId>protobuf-maven-plugin</artifactId>
124-
<version>${protobuf-maven-plugin.version}</version>
125-
<configuration>
126-
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
127-
<pluginId>grpc-java</pluginId>
128-
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
129-
<outputDirectory>src/main/java</outputDirectory>
130-
<clearOutputDirectory>false</clearOutputDirectory>
131-
</configuration>
132-
<executions>
133-
<execution>
134-
<goals>
135-
<goal>compile</goal>
136-
<goal>compile-custom</goal>
137-
</goals>
138-
</execution>
139-
</executions>
140-
</plugin>
141-
</plugins>
142-
</build>
143-
144-
</profile>
145-
</profiles>
146108
</project>

0 commit comments

Comments
 (0)